From 85c1d938ee416710d0826151bdd98de7cdc918e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Thu, 20 Nov 2025 14:22:19 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20cloudflare-workers?= =?UTF-8?q?=20=E5=88=B0=20.gitignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 328a86aa..844e60a5 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,7 @@ template/compare/model_config_template.toml src/plugins/utils/statistic.py CLAUDE.md MaiBot-Dashboard/ +cloudflare-workers/ # Byte-compiled / optimized / DLL files __pycache__/ From 256a5e3ceffac5e9cdbf2612dcb42c96789ac75b Mon Sep 17 00:00:00 2001 From: SengokuCola <1026294844@qq.com> Date: Thu, 20 Nov 2025 14:48:10 +0800 Subject: [PATCH 02/11] =?UTF-8?q?feat=EF=BC=9A=E4=BC=98=E5=8C=96log?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chat/heart_flow/heartFC_chat.py | 4 +- src/chat/knowledge/qa_manager.py | 7 ++- src/chat/utils/chat_history_summarizer.py | 6 +- src/config/official_configs.py | 6 ++ src/jargon/jargon_miner.py | 8 +-- src/memory_system/memory_retrieval.py | 69 ++++++++++++----------- template/bot_config_template.toml | 5 +- 7 files changed, 59 insertions(+), 46 deletions(-) diff --git a/src/chat/heart_flow/heartFC_chat.py b/src/chat/heart_flow/heartFC_chat.py index dbbd39ef..bb37e29e 100644 --- a/src/chat/heart_flow/heartFC_chat.py +++ b/src/chat/heart_flow/heartFC_chat.py @@ -230,7 +230,7 @@ class HeartFChatting: if (message.is_mentioned or message.is_at) and global_config.chat.mentioned_bot_reply: mentioned_message = message - logger.info(f"{self.log_prefix} 当前talk_value: {global_config.chat.get_talk_value(self.stream_id)}") + # logger.info(f"{self.log_prefix} 当前talk_value: {global_config.chat.get_talk_value(self.stream_id)}") # *控制频率用 if mentioned_message: @@ -410,7 +410,7 @@ class HeartFChatting: # asyncio.create_task(self.chat_history_summarizer.process()) cycle_timers, thinking_id = self.start_cycle() - logger.info(f"{self.log_prefix} 开始第{self._cycle_counter}次思考") + logger.info(f"{self.log_prefix} 开始第{self._cycle_counter}次思考(频率: {global_config.chat.get_talk_value(self.stream_id)})") # 第一步:动作检查 available_actions: Dict[str, ActionInfo] = {} diff --git a/src/chat/knowledge/qa_manager.py b/src/chat/knowledge/qa_manager.py index 9988dc22..1a087a7f 100644 --- a/src/chat/knowledge/qa_manager.py +++ b/src/chat/knowledge/qa_manager.py @@ -92,9 +92,10 @@ class QAManager: # 过滤阈值 result = dyn_select_top_k(result, 0.5, 1.0) - for res in result: - raw_paragraph = self.embed_manager.paragraphs_embedding_store.store[res[0]].str - logger.info(f"找到相关文段,相关系数:{res[1]:.8f}\n{raw_paragraph}\n\n") + if global_config.debug.show_lpmm_paragraph: + for res in result: + raw_paragraph = self.embed_manager.paragraphs_embedding_store.store[res[0]].str + logger.info(f"找到相关文段,相关系数:{res[1]:.8f}\n{raw_paragraph}\n\n") return result, ppr_node_weights diff --git a/src/chat/utils/chat_history_summarizer.py b/src/chat/utils/chat_history_summarizer.py index f471781d..7fa55834 100644 --- a/src/chat/utils/chat_history_summarizer.py +++ b/src/chat/utils/chat_history_summarizer.py @@ -107,7 +107,7 @@ class ChatHistorySummarizer: self.last_check_time = current_time return - logger.info( + logger.debug( f"{self.log_prefix} 开始处理聊天概括,时间窗口: {self.last_check_time:.2f} -> {current_time:.2f}" ) @@ -119,7 +119,7 @@ class ChatHistorySummarizer: before_count = len(self.current_batch.messages) self.current_batch.messages.extend(new_messages) self.current_batch.end_time = current_time - logger.info(f"{self.log_prefix} 批次更新: {before_count} -> {len(self.current_batch.messages)} 条消息") + logger.info(f"{self.log_prefix} 更新聊天话题: {before_count} -> {len(self.current_batch.messages)} 条消息") else: # 创建新批次 self.current_batch = MessageBatch( @@ -127,7 +127,7 @@ class ChatHistorySummarizer: start_time=new_messages[0].time if new_messages else current_time, end_time=current_time, ) - logger.info(f"{self.log_prefix} 新建批次: {len(new_messages)} 条消息") + logger.info(f"{self.log_prefix} 新建聊天话题: {len(new_messages)} 条消息") # 检查是否需要打包 await self._check_and_package(current_time) diff --git a/src/config/official_configs.py b/src/config/official_configs.py index 454f6976..fc084ecb 100644 --- a/src/config/official_configs.py +++ b/src/config/official_configs.py @@ -581,9 +581,15 @@ class DebugConfig(ConfigBase): show_jargon_prompt: bool = False """是否显示jargon相关提示词""" + show_memory_prompt: bool = False + """是否显示记忆检索相关prompt""" + show_planner_prompt: bool = False """是否显示planner相关提示词""" + show_lpmm_paragraph: bool = False + """是否显示lpmm找到的相关文段日志""" + @dataclass class ExperimentalConfig(ConfigBase): diff --git a/src/jargon/jargon_miner.py b/src/jargon/jargon_miner.py index db1b79f9..4319ad3d 100644 --- a/src/jargon/jargon_miner.py +++ b/src/jargon/jargon_miner.py @@ -384,10 +384,10 @@ class JargonMiner: logger.error(f"jargon {content} 推断2解析失败: {e}") return - logger.info(f"jargon {content} 推断2提示词: {prompt2}") - logger.info(f"jargon {content} 推断2结果: {response2}") - logger.info(f"jargon {content} 推断1提示词: {prompt1}") - logger.info(f"jargon {content} 推断1结果: {response1}") + # logger.info(f"jargon {content} 推断2提示词: {prompt2}") + # logger.info(f"jargon {content} 推断2结果: {response2}") + # logger.info(f"jargon {content} 推断1提示词: {prompt1}") + # logger.info(f"jargon {content} 推断1结果: {response1}") if global_config.debug.show_jargon_prompt: logger.info(f"jargon {content} 推断2提示词: {prompt2}") diff --git a/src/memory_system/memory_retrieval.py b/src/memory_system/memory_retrieval.py index e9187eb0..7d129bbc 100644 --- a/src/memory_system/memory_retrieval.py +++ b/src/memory_system/memory_retrieval.py @@ -16,8 +16,8 @@ from src.llm_models.payload_content.message import MessageBuilder, RoleType, Mes logger = get_logger("memory_retrieval") -THINKING_BACK_NOT_FOUND_RETENTION_SECONDS = 3600 # 未找到答案记录保留时长 -THINKING_BACK_CLEANUP_INTERVAL_SECONDS = 300 # 清理频率 +THINKING_BACK_NOT_FOUND_RETENTION_SECONDS = 36000 # 未找到答案记录保留时长 +THINKING_BACK_CLEANUP_INTERVAL_SECONDS = 3000 # 清理频率 _last_not_found_cleanup_ts: float = 0.0 @@ -340,7 +340,8 @@ async def _react_agent_solve_question( max_iterations=max_iterations, ) - logger.info(f"ReAct Agent 第 {iteration + 1} 次Prompt: {prompt}") + if global_config.debug.show_memory_prompt: + logger.info(f"ReAct Agent 第 {iteration + 1} 次Prompt: {prompt}") success, response, reasoning_content, model_name, tool_calls = await llm_api.generate_with_model_with_tools( prompt, model_config=model_config.model_task_config.tool_use, @@ -380,42 +381,43 @@ async def _react_agent_solve_question( messages.extend(_conversation_messages) - # 优化日志展示 - 合并所有消息到一条日志 - log_lines = [] - for idx, msg in enumerate(messages, 1): - role_name = msg.role.value if hasattr(msg.role, "value") else str(msg.role) + if global_config.debug.show_memory_prompt: + # 优化日志展示 - 合并所有消息到一条日志 + log_lines = [] + for idx, msg in enumerate(messages, 1): + role_name = msg.role.value if hasattr(msg.role, "value") else str(msg.role) - # 处理内容 - 显示完整内容,不截断 - if isinstance(msg.content, str): - full_content = msg.content - content_type = "文本" - elif isinstance(msg.content, list): - text_parts = [item for item in msg.content if isinstance(item, str)] - image_count = len([item for item in msg.content if isinstance(item, tuple)]) - full_content = "".join(text_parts) if text_parts else "" - content_type = f"混合({len(text_parts)}段文本, {image_count}张图片)" - else: - full_content = str(msg.content) - content_type = "未知" + # 处理内容 - 显示完整内容,不截断 + if isinstance(msg.content, str): + full_content = msg.content + content_type = "文本" + elif isinstance(msg.content, list): + text_parts = [item for item in msg.content if isinstance(item, str)] + image_count = len([item for item in msg.content if isinstance(item, tuple)]) + full_content = "".join(text_parts) if text_parts else "" + content_type = f"混合({len(text_parts)}段文本, {image_count}张图片)" + else: + full_content = str(msg.content) + content_type = "未知" - # 构建单条消息的日志信息 - msg_info = f"\n[消息 {idx}] 角色: {role_name} 内容类型: {content_type}\n========================================" + # 构建单条消息的日志信息 + msg_info = f"\n[消息 {idx}] 角色: {role_name} 内容类型: {content_type}\n========================================" - if full_content: - msg_info += f"\n{full_content}" + if full_content: + msg_info += f"\n{full_content}" - if msg.tool_calls: - msg_info += f"\n 工具调用: {len(msg.tool_calls)}个" - for tool_call in msg.tool_calls: - msg_info += f"\n - {tool_call}" + if msg.tool_calls: + msg_info += f"\n 工具调用: {len(msg.tool_calls)}个" + for tool_call in msg.tool_calls: + msg_info += f"\n - {tool_call}" - if msg.tool_call_id: - msg_info += f"\n 工具调用ID: {msg.tool_call_id}" + if msg.tool_call_id: + msg_info += f"\n 工具调用ID: {msg.tool_call_id}" - log_lines.append(msg_info) + log_lines.append(msg_info) - # 合并所有消息为一条日志输出 - logger.info(f"消息列表 (共{len(messages)}条):{''.join(log_lines)}") + # 合并所有消息为一条日志输出 + logger.info(f"消息列表 (共{len(messages)}条):{''.join(log_lines)}") return messages @@ -1068,7 +1070,8 @@ async def build_memory_retrieval_prompt( request_type="memory.question", ) - logger.info(f"记忆检索问题生成提示词: {question_prompt}") + if global_config.debug.show_memory_prompt: + logger.info(f"记忆检索问题生成提示词: {question_prompt}") logger.info(f"记忆检索问题生成响应: {response}") if not success: diff --git a/template/bot_config_template.toml b/template/bot_config_template.toml index 8bbfaf9d..2c1da1be 100644 --- a/template/bot_config_template.toml +++ b/template/bot_config_template.toml @@ -1,5 +1,5 @@ [inner] -version = "6.21.6" +version = "6.21.8" #----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- #如果你想要修改配置文件,请递增version的值 @@ -211,6 +211,9 @@ show_prompt = false # 是否显示prompt show_replyer_prompt = false # 是否显示回复器prompt show_replyer_reasoning = false # 是否显示回复器推理 show_jargon_prompt = false # 是否显示jargon相关提示词 +show_memory_prompt = false # 是否显示记忆检索相关提示词 +show_planner_prompt = false # 是否显示planner的prompt和原始返回结果 +show_lpmm_paragraph = false # 是否显示lpmm找到的相关文段日志 [maim_message] auth_token = [] # 认证令牌,用于API验证,为空则不启用验证 From c393044052f768a8d9da17b88ccc9b56d91c9074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Thu, 20 Nov 2025 15:05:51 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=80=82=E9=85=8D?= =?UTF-8?q?=E5=99=A8=E9=85=8D=E7=BD=AE=E7=AE=A1=E7=90=86=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E5=8C=85=E6=8B=AC=E8=8E=B7=E5=8F=96=E3=80=81=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=92=8C=E8=AF=BB=E5=8F=96=E9=80=82=E9=85=8D=E5=99=A8?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B7=AF=E5=BE=84=E5=8F=8A=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/webui/config_routes.py | 141 +++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) diff --git a/src/webui/config_routes.py b/src/webui/config_routes.py index c4a4d417..40801f91 100644 --- a/src/webui/config_routes.py +++ b/src/webui/config_routes.py @@ -364,3 +364,144 @@ async def update_model_config_section(section_name: str, section_data: Any = Bod except Exception as e: logger.error(f"更新配置节失败: {e}") raise HTTPException(status_code=500, detail=f"更新配置节失败: {str(e)}") + + +# ===== 适配器配置管理接口 ===== + + +@router.get("/adapter-config/path") +async def get_adapter_config_path(): + """获取保存的适配器配置文件路径""" + try: + # 从 data/webui.json 读取路径偏好 + webui_data_path = os.path.join("data", "webui.json") + if not os.path.exists(webui_data_path): + return {"success": True, "path": None} + + import json + with open(webui_data_path, "r", encoding="utf-8") as f: + webui_data = json.load(f) + + adapter_config_path = webui_data.get("adapter_config_path") + if not adapter_config_path: + return {"success": True, "path": None} + + # 检查文件是否存在并返回最后修改时间 + if os.path.exists(adapter_config_path): + import datetime + mtime = os.path.getmtime(adapter_config_path) + last_modified = datetime.datetime.fromtimestamp(mtime).isoformat() + return {"success": True, "path": adapter_config_path, "lastModified": last_modified} + else: + return {"success": True, "path": adapter_config_path, "lastModified": None} + + except Exception as e: + logger.error(f"获取适配器配置路径失败: {e}") + raise HTTPException(status_code=500, detail=f"获取配置路径失败: {str(e)}") + + +@router.post("/adapter-config/path") +async def save_adapter_config_path(data: dict[str, str] = Body(...)): + """保存适配器配置文件路径偏好""" + try: + path = data.get("path") + if not path: + raise HTTPException(status_code=400, detail="路径不能为空") + + # 保存到 data/webui.json + webui_data_path = os.path.join("data", "webui.json") + import json + + # 读取现有数据 + if os.path.exists(webui_data_path): + with open(webui_data_path, "r", encoding="utf-8") as f: + webui_data = json.load(f) + else: + webui_data = {} + + # 更新路径 + webui_data["adapter_config_path"] = path + + # 保存 + os.makedirs("data", exist_ok=True) + with open(webui_data_path, "w", encoding="utf-8") as f: + json.dump(webui_data, f, ensure_ascii=False, indent=2) + + logger.info(f"适配器配置路径已保存: {path}") + return {"success": True, "message": "路径已保存"} + + except HTTPException: + raise + except Exception as e: + logger.error(f"保存适配器配置路径失败: {e}") + raise HTTPException(status_code=500, detail=f"保存路径失败: {str(e)}") + + +@router.get("/adapter-config") +async def get_adapter_config(path: str): + """从指定路径读取适配器配置文件""" + try: + if not path: + raise HTTPException(status_code=400, detail="路径参数不能为空") + + # 检查文件是否存在 + if not os.path.exists(path): + raise HTTPException(status_code=404, detail=f"配置文件不存在: {path}") + + # 检查文件扩展名 + if not path.endswith(".toml"): + raise HTTPException(status_code=400, detail="只支持 .toml 格式的配置文件") + + # 读取文件内容 + with open(path, "r", encoding="utf-8") as f: + content = f.read() + + logger.info(f"已读取适配器配置: {path}") + return {"success": True, "content": content} + + except HTTPException: + raise + except Exception as e: + logger.error(f"读取适配器配置失败: {e}") + raise HTTPException(status_code=500, detail=f"读取配置失败: {str(e)}") + + +@router.post("/adapter-config") +async def save_adapter_config(data: dict[str, str] = Body(...)): + """保存适配器配置到指定路径""" + try: + path = data.get("path") + content = data.get("content") + + if not path: + raise HTTPException(status_code=400, detail="路径不能为空") + if content is None: + raise HTTPException(status_code=400, detail="配置内容不能为空") + + # 检查文件扩展名 + if not path.endswith(".toml"): + raise HTTPException(status_code=400, detail="只支持 .toml 格式的配置文件") + + # 验证 TOML 格式 + try: + import toml + toml.loads(content) + except Exception as e: + raise HTTPException(status_code=400, detail=f"TOML 格式错误: {str(e)}") + + # 确保目录存在 + os.makedirs(os.path.dirname(path) if os.path.dirname(path) else ".", exist_ok=True) + + # 保存文件 + with open(path, "w", encoding="utf-8") as f: + f.write(content) + + logger.info(f"适配器配置已保存: {path}") + return {"success": True, "message": "配置已保存"} + + except HTTPException: + raise + except Exception as e: + logger.error(f"保存适配器配置失败: {e}") + raise HTTPException(status_code=500, detail=f"保存配置失败: {str(e)}") + From fa504969ae9edf0d9157e8453a3a1735b9c17b54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Thu, 20 Nov 2025 15:07:30 +0800 Subject: [PATCH 04/11] upload WebUI 0.11.5 Beta.a77f99d DashBoard after Build Files commit hash : a77f99d45b747a36817344ceb6f66bb3d5e5c6ad --- webui/dist/assets/icons-8vbl1orV.js | 1 + webui/dist/assets/icons-BdGv2zEo.js | 1 - webui/dist/assets/index-BExEVKIA.js | 344 +++++++++++++++++++++++++++ webui/dist/assets/index-BGzEu9LP.css | 1 + webui/dist/assets/index-C_Xpfn5c.css | 1 - webui/dist/assets/index-pMcRRAxj.js | 344 --------------------------- webui/dist/index.html | 6 +- 7 files changed, 349 insertions(+), 349 deletions(-) create mode 100644 webui/dist/assets/icons-8vbl1orV.js delete mode 100644 webui/dist/assets/icons-BdGv2zEo.js create mode 100644 webui/dist/assets/index-BExEVKIA.js create mode 100644 webui/dist/assets/index-BGzEu9LP.css delete mode 100644 webui/dist/assets/index-C_Xpfn5c.css delete mode 100644 webui/dist/assets/index-pMcRRAxj.js diff --git a/webui/dist/assets/icons-8vbl1orV.js b/webui/dist/assets/icons-8vbl1orV.js new file mode 100644 index 00000000..daee84d4 --- /dev/null +++ b/webui/dist/assets/icons-8vbl1orV.js @@ -0,0 +1 @@ +import{r as s}from"./router-BWgTyY51.js";const _=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,o,c)=>c?c.toUpperCase():o.toLowerCase()),d=t=>{const a=M(t);return a.charAt(0).toUpperCase()+a.slice(1)},r=(...t)=>t.filter((a,o,c)=>!!a&&a.trim()!==""&&c.indexOf(a)===o).join(" ").trim(),m=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var v={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"};const x=s.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:y="",children:n,iconNode:k,...h},i)=>s.createElement("svg",{ref:i,...v,width:a,height:a,stroke:t,strokeWidth:c?Number(o)*24/Number(a):o,className:r("lucide",y),...!n&&!m(h)&&{"aria-hidden":"true"},...h},[...k.map(([p,l])=>s.createElement(p,l)),...Array.isArray(n)?n:[n]]));const e=(t,a)=>{const o=s.forwardRef(({className:c,...y},n)=>s.createElement(x,{ref:n,iconNode:a,className:r(`lucide-${_(d(t))}`,`lucide-${t}`,c),...y}));return o.displayName=d(t),o};const u=[["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"}]],I1=e("activity",u);const $=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],K1=e("arrow-left",$);const g=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],W1=e("arrow-right",g);const N=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Q1=e("ban",N);const w=[["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"}]],X1=e("book-open",w);const f=[["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"}]],G1=e("bot",f);const z=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],J1=e("boxes",z);const C=[["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"}]],Y1=e("calendar",C);const b=[["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"}]],e2=e("chart-column",b);const q=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],a2=e("check",q);const A=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],t2=e("chevron-down",A);const j=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],o2=e("chevron-left",j);const H=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],c2=e("chevron-right",H);const V=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],n2=e("chevron-up",V);const L=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],s2=e("chevrons-left",L);const S=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],y2=e("chevrons-right",S);const P=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],h2=e("chevrons-up-down",P);const U=[["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"}]],d2=e("circle-alert",U);const R=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],r2=e("circle-check",R);const Z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],k2=e("circle-question-mark",Z);const E=[["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"}]],i2=e("circle-user",E);const T=[["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"}]],p2=e("circle-x",T);const B=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],l2=e("circle",B);const D=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],_2=e("clock",D);const F=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],M2=e("copy",F);const O=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],m2=e("database",O);const I=[["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"}]],v2=e("dollar-sign",I);const K=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],x2=e("download",K);const W=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],u2=e("external-link",W);const Q=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],$2=e("eye-off",Q);const X=[["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"}]],g2=e("eye",X);const G=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],N2=e("file-search",G);const J=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],w2=e("file-text",J);const Y=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],f2=e("folder-open",Y);const e1=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],z2=e("funnel",e1);const a1=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],C2=e("hash",a1);const t1=[["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-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],b2=e("house",t1);const o1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],q2=e("info",o1);const c1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],A2=e("key",c1);const n1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],j2=e("loader-circle",n1);const s1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],H2=e("lock",s1);const y1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],V2=e("log-out",y1);const h1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],L2=e("menu",h1);const d1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],S2=e("message-square",d1);const r1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],P2=e("moon",r1);const k1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],U2=e("package",k1);const i1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],R2=e("palette",i1);const p1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Z2=e("pause",p1);const l1=[["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"}]],E2=e("pencil",l1);const _1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],T2=e("play",_1);const M1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],B2=e("plus",M1);const m1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],D2=e("power",m1);const v1=[["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"}]],F2=e("refresh-cw",v1);const x1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],O2=e("rotate-ccw",x1);const u1=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],I2=e("rotate-cw",u1);const $1=[["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"}]],K2=e("save",$1);const g1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],W2=e("search",g1);const N1=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Q2=e("server",N1);const w1=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],X2=e("settings-2",w1);const f1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],G2=e("settings",f1);const z1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],J2=e("shield",z1);const C1=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],Y2=e("skip-forward",C1);const b1=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],e0=e("sliders-vertical",b1);const q1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],a0=e("smile",q1);const A1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],t0=e("sparkles",A1);const j1=[["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"}]],o0=e("square-pen",j1);const H1=[["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"}]],c0=e("star",H1);const V1=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],n0=e("sun",V1);const L1=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],s0=e("terminal",L1);const S1=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],y0=e("thumbs-up",S1);const P1=[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]],h0=e("thumbs-down",P1);const U1=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],d0=e("trash-2",U1);const R1=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],r0=e("trending-up",R1);const Z1=[["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"}]],k0=e("triangle-alert",Z1);const E1=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],i0=e("upload",E1);const T1=[["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"}]],p0=e("user",T1);const B1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],l0=e("users",B1);const D1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],_0=e("x",D1);const F1=[["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"}]],M0=e("zap",F1);export{f2 as $,I1 as A,G1 as B,_2 as C,v2 as D,$2 as E,w2 as F,d0 as G,b2 as H,q2 as I,N2 as J,A2 as K,H2 as L,S2 as M,E2 as N,s2 as O,R2 as P,o2 as Q,F2 as R,J2 as S,r0 as T,p0 as U,c2 as V,y2 as W,_0 as X,h2 as Y,M0 as Z,i0 as _,m2 as a,x2 as a0,z2 as a1,o0 as a2,Q1 as a3,C2 as a4,l0 as a5,Y1 as a6,Z2 as a7,T2 as a8,c0 as a9,y0 as aa,h0 as ab,X2 as ac,u2 as ad,U2 as ae,Q2 as af,J1 as ag,i2 as ah,e2 as ai,l2 as aj,e0 as ak,L2 as al,X1 as am,V2 as an,I2 as ao,G2 as b,k0 as c,a2 as d,M2 as e,g2 as f,r2 as g,p2 as h,O2 as i,n0 as j,P2 as k,d2 as l,k2 as m,s0 as n,t0 as o,a0 as p,Y2 as q,W1 as r,W2 as s,K1 as t,t2 as u,n2 as v,j2 as w,K2 as x,D2 as y,B2 as z}; diff --git a/webui/dist/assets/icons-BdGv2zEo.js b/webui/dist/assets/icons-BdGv2zEo.js deleted file mode 100644 index 8b732ced..00000000 --- a/webui/dist/assets/icons-BdGv2zEo.js +++ /dev/null @@ -1 +0,0 @@ -import{r as n}from"./router-BWgTyY51.js";const _=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,o)=>o?o.toUpperCase():c.toLowerCase()),d=t=>{const a=M(t);return a.charAt(0).toUpperCase()+a.slice(1)},r=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),v=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var m={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"};const x=n.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:y="",children:s,iconNode:k,...h},i)=>n.createElement("svg",{ref:i,...m,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:r("lucide",y),...!s&&!v(h)&&{"aria-hidden":"true"},...h},[...k.map(([l,p])=>n.createElement(l,p)),...Array.isArray(s)?s:[s]]));const e=(t,a)=>{const c=n.forwardRef(({className:o,...y},s)=>n.createElement(x,{ref:s,iconNode:a,className:r(`lucide-${_(d(t))}`,`lucide-${t}`,o),...y}));return c.displayName=d(t),c};const u=[["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"}]],T1=e("activity",u);const g=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],F1=e("arrow-left",g);const $=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],O1=e("arrow-right",$);const N=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],I1=e("ban",N);const f=[["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"}]],K1=e("book-open",f);const w=[["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"}]],W1=e("bot",w);const z=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],Q1=e("boxes",z);const C=[["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"}]],X1=e("calendar",C);const q=[["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"}]],G1=e("chart-column",q);const b=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],J1=e("check",b);const j=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Y1=e("chevron-down",j);const A=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],e2=e("chevron-left",A);const V=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],a2=e("chevron-right",V);const H=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],t2=e("chevron-up",H);const L=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],c2=e("chevrons-left",L);const S=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],o2=e("chevrons-right",S);const P=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],s2=e("chevrons-up-down",P);const U=[["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"}]],n2=e("circle-alert",U);const R=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],y2=e("circle-check",R);const E=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],h2=e("circle-question-mark",E);const B=[["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"}]],d2=e("circle-user",B);const Z=[["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"}]],r2=e("circle-x",Z);const D=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],k2=e("circle",D);const T=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],i2=e("clock",T);const F=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],l2=e("copy",F);const O=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],p2=e("database",O);const I=[["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"}]],_2=e("dollar-sign",I);const K=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],M2=e("download",K);const W=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],v2=e("external-link",W);const Q=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],m2=e("eye-off",Q);const X=[["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"}]],x2=e("eye",X);const G=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],u2=e("file-search",G);const J=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],g2=e("file-text",J);const Y=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],$2=e("funnel",Y);const e1=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],N2=e("hash",e1);const a1=[["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-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],f2=e("house",a1);const t1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],w2=e("info",t1);const c1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],z2=e("key",c1);const o1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],C2=e("loader-circle",o1);const s1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],q2=e("lock",s1);const n1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],b2=e("log-out",n1);const y1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],j2=e("menu",y1);const h1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],A2=e("message-square",h1);const d1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],V2=e("moon",d1);const r1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],H2=e("package",r1);const k1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],L2=e("palette",k1);const i1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],S2=e("pause",i1);const l1=[["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"}]],P2=e("pencil",l1);const p1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],U2=e("play",p1);const _1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],R2=e("plus",_1);const M1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],E2=e("power",M1);const v1=[["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"}]],B2=e("refresh-cw",v1);const m1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Z2=e("rotate-ccw",m1);const x1=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],D2=e("rotate-cw",x1);const u1=[["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"}]],T2=e("save",u1);const g1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],F2=e("search",g1);const $1=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],O2=e("server",$1);const N1=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],I2=e("settings-2",N1);const f1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],K2=e("settings",f1);const w1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],W2=e("shield",w1);const z1=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],Q2=e("skip-forward",z1);const C1=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],X2=e("sliders-vertical",C1);const q1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],G2=e("smile",q1);const b1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],J2=e("sparkles",b1);const j1=[["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"}]],Y2=e("square-pen",j1);const A1=[["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"}]],e0=e("star",A1);const V1=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],a0=e("sun",V1);const H1=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],t0=e("terminal",H1);const L1=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],c0=e("trash-2",L1);const S1=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],o0=e("trending-up",S1);const P1=[["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"}]],s0=e("triangle-alert",P1);const U1=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],n0=e("upload",U1);const R1=[["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"}]],y0=e("user",R1);const E1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],h0=e("users",E1);const B1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],d0=e("x",B1);const Z1=[["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"}]],r0=e("zap",Z1);export{M2 as $,T1 as A,W1 as B,i2 as C,_2 as D,m2 as E,g2 as F,c0 as G,f2 as H,w2 as I,u2 as J,z2 as K,q2 as L,A2 as M,P2 as N,c2 as O,L2 as P,e2 as Q,B2 as R,W2 as S,o0 as T,y0 as U,a2 as V,o2 as W,d0 as X,s2 as Y,r0 as Z,n0 as _,p2 as a,$2 as a0,Y2 as a1,I1 as a2,N2 as a3,h0 as a4,X1 as a5,S2 as a6,U2 as a7,I2 as a8,e0 as a9,v2 as aa,H2 as ab,O2 as ac,Q1 as ad,d2 as ae,G1 as af,k2 as ag,X2 as ah,j2 as ai,K1 as aj,b2 as ak,D2 as al,K2 as b,s0 as c,J1 as d,l2 as e,x2 as f,y2 as g,r2 as h,Z2 as i,a0 as j,V2 as k,n2 as l,h2 as m,t0 as n,J2 as o,G2 as p,Q2 as q,O1 as r,F2 as s,F1 as t,Y1 as u,t2 as v,C2 as w,T2 as x,E2 as y,R2 as z}; diff --git a/webui/dist/assets/index-BExEVKIA.js b/webui/dist/assets/index-BExEVKIA.js new file mode 100644 index 00000000..a52c84f3 --- /dev/null +++ b/webui/dist/assets/index-BExEVKIA.js @@ -0,0 +1,344 @@ +import{r as w,j as r,u as as,R as Fe,d as LC,L as BC,e as PC,f as gr,g as FC,h as IC,O as L5,b as qC,k as HC}from"./router-BWgTyY51.js";import{a as UC,b as $C,g as B5}from"./react-vendor-Dtc2IqVY.js";import{c as P5,R as VC,T as GC,L as YC,a as WC,C as y0,X as b0,Y as Wc,b as XC,B as vp,d as w0,P as KC,e as QC,f as ZC}from"./charts-DU5SeejN.js";import{c as Ua,a as bm,u as Ta,P as It,b as Pe,d as mn,e as Eu,f as zl,g as yr,h as Wr,i as F5,j as h1,k as f1,S as JC,l as I5,m as q5,R as H5,O as wm,n as p1,C as jm,o as x1,T as g1,D as v1,p as y1,q as U5,r as $5,W as eT,s as V5,I as tT,t as G5,v as Y5,w as nT,x as W5,V as rT,L as X5,y as K5,z as aT,A as sT,B as Q5,E as lT,F as iT,G as Sl,H as Nm,J as Vo,K as Z5,M as J5,N as e6,Q as t6,U as b1,X as w1,Y as Sm,Z as km,_ as j1,$ as n6,a0 as oT,a1 as r6,a2 as cT,a3 as uT,a4 as a6,a5 as dT}from"./ui-vendor-nTGLnMlb.js";import{R as Ia,A as mT,D as hT,a as fT,Z as fu,C as di,M as Mu,T as pT,X as Au,P as s6,S as xT,b as Pa,I as pi,c as Ao,d as mi,e as vx,E as yx,f as Ha,g as $r,h as bx,i as gT,j as wx,k as jx,L as $y,K as vT,l as xi,m as yT,n as bT,F as Nl,o as wT,B as jT,U as l6,p as N1,q as NT,r as ST,s as Yr,H as J0,t as i6,u as pu,v as Nx,w as xu,x as Cm,y as S1,z as pr,G as zt,J as em,N as Bo,O as Du,Q as bi,V as wi,W as zu,Y as kT,_ as Vy,$ as CT,a0 as hi,a1 as Sx,a2 as Po,a3 as Gy,a4 as tm,a5 as TT,a6 as Yy,a7 as _T,a8 as ET,a9 as wl,aa as yp,ab as Wy,ac as MT,ad as ou,ae as nm,af as o6,ag as c6,ah as u6,ai as AT,aj as DT,ak as Xy,al as zT,am as OT,an as Ky,ao as RT}from"./icons-8vbl1orV.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))a(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();var bp={exports:{}},Xc={},wp={exports:{}},jp={};var Qy;function LT(){return Qy||(Qy=1,(function(e){function t(H,le){var re=H.length;H.push(le);e:for(;0>>1,E=H[ge];if(0>>1;gel(z,re))Xl(q,z)?(H[ge]=q,H[X]=re,ge=X):(H[ge]=z,H[Z]=re,ge=Z);else if(Xl(q,re))H[ge]=q,H[X]=re,ge=X;else break e}}return le}function l(H,le){var re=H.sortIndex-le.sortIndex;return re!==0?re:H.id-le.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var m=[],f=[],p=1,x=null,y=3,b=!1,N=!1,k=!1,S=!1,T=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function R(H){for(var le=n(f);le!==null;){if(le.callback===null)a(f);else if(le.startTime<=H)a(f),le.sortIndex=le.expirationTime,t(m,le);else break;le=n(f)}}function B(H){if(k=!1,R(H),!N)if(n(m)!==null)N=!0,O||(O=!0,ee());else{var le=n(f);le!==null&&se(B,le.startTime-H)}}var O=!1,L=-1,$=5,U=-1;function I(){return S?!0:!(e.unstable_now()-U<$)}function G(){if(S=!1,O){var H=e.unstable_now();U=H;var le=!0;try{e:{N=!1,k&&(k=!1,M(L),L=-1),b=!0;var re=y;try{t:{for(R(H),x=n(m);x!==null&&!(x.expirationTime>H&&I());){var ge=x.callback;if(typeof ge=="function"){x.callback=null,y=x.priorityLevel;var E=ge(x.expirationTime<=H);if(H=e.unstable_now(),typeof E=="function"){x.callback=E,R(H),le=!0;break t}x===n(m)&&a(m),R(H)}else a(m);x=n(m)}if(x!==null)le=!0;else{var we=n(f);we!==null&&se(B,we.startTime-H),le=!1}}break e}finally{x=null,y=re,b=!1}le=void 0}}finally{le?ee():O=!1}}}var ee;if(typeof A=="function")ee=function(){A(G)};else if(typeof MessageChannel<"u"){var Ne=new MessageChannel,J=Ne.port2;Ne.port1.onmessage=G,ee=function(){J.postMessage(null)}}else ee=function(){T(G,0)};function se(H,le){L=T(function(){H(e.unstable_now())},le)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(H){H.callback=null},e.unstable_forceFrameRate=function(H){0>H||125ge?(H.sortIndex=re,t(f,H),n(m)===null&&H===n(f)&&(k?(M(L),L=-1):k=!0,se(B,re-ge))):(H.sortIndex=E,t(m,H),N||b||(N=!0,O||(O=!0,ee()))),H},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(H){var le=y;return function(){var re=y;y=le;try{return H.apply(this,arguments)}finally{y=re}}}})(jp)),jp}var Zy;function BT(){return Zy||(Zy=1,wp.exports=LT()),wp.exports}var Jy;function PT(){if(Jy)return Xc;Jy=1;var e=BT(),t=UC(),n=$C();function a(s){var i="https://react.dev/errors/"+s;if(1E||(s.current=ge[E],ge[E]=null,E--)}function z(s,i){E++,ge[E]=s.current,s.current=i}var X=we(null),q=we(null),ce=we(null),fe=we(null);function De(s,i){switch(z(ce,i),z(q,s),z(X,null),i.nodeType){case 9:case 11:s=(s=i.documentElement)&&(s=s.namespaceURI)?hy(s):0;break;default:if(s=i.tagName,i=i.namespaceURI)i=hy(i),s=fy(i,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}Z(X),z(X,s)}function oe(){Z(X),Z(q),Z(ce)}function He(s){s.memoizedState!==null&&z(fe,s);var i=X.current,u=fy(i,s.type);i!==u&&(z(q,s),z(X,u))}function at(s){q.current===s&&(Z(X),Z(q)),fe.current===s&&(Z(fe),$c._currentValue=re)}var je,Ze;function qe(s){if(je===void 0)try{throw Error()}catch(u){var i=u.stack.trim().match(/\n( *(at )?)/);je=i&&i[1]||"",Ze=-1)":-1g||W[h]!==me[g]){var Se=` +`+W[h].replace(" at new "," at ");return s.displayName&&Se.includes("")&&(Se=Se.replace("",s.displayName)),Se}while(1<=h&&0<=g);break}}}finally{Ot=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?qe(u):""}function Dn(s,i){switch(s.tag){case 26:case 27:case 5:return qe(s.type);case 16:return qe("Lazy");case 13:return s.child!==i&&i!==null?qe("Suspense Fallback"):qe("Suspense");case 19:return qe("SuspenseList");case 0:case 15:return bn(s.type,!1);case 11:return bn(s.type.render,!1);case 1:return bn(s.type,!0);case 31:return qe("Activity");default:return""}}function Xe(s){try{var i="",u=null;do i+=Dn(s,u),u=s,s=s.return;while(s);return i}catch(h){return` +Error generating stack: `+h.message+` +`+h.stack}}var wn=Object.prototype.hasOwnProperty,Wn=e.unstable_scheduleCallback,Ar=e.unstable_cancelCallback,Cn=e.unstable_shouldYield,cr=e.unstable_requestPaint,$e=e.unstable_now,Fn=e.unstable_getCurrentPriorityLevel,K=e.unstable_ImmediatePriority,be=e.unstable_UserBlockingPriority,Re=e.unstable_NormalPriority,nt=e.unstable_LowPriority,kt=e.unstable_IdlePriority,rr=e.log,Dr=e.unstable_setDisableYieldValue,pe=null,Ee=null;function dt(s){if(typeof rr=="function"&&Dr(s),Ee&&typeof Ee.setStrictMode=="function")try{Ee.setStrictMode(pe,s)}catch{}}var mt=Math.clz32?Math.clz32:gn,zr=Math.log,st=Math.LN2;function gn(s){return s>>>=0,s===0?32:31-(zr(s)/st|0)|0}var ot=256,$t=262144,ar=4194304;function bt(s){var i=s&42;if(i!==0)return i;switch(s&-s){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Ai(s,i,u){var h=s.pendingLanes;if(h===0)return 0;var g=0,v=s.suspendedLanes,_=s.pingedLanes;s=s.warmLanes;var P=h&134217727;return P!==0?(h=P&~v,h!==0?g=bt(h):(_&=P,_!==0?g=bt(_):u||(u=P&~s,u!==0&&(g=bt(u))))):(P=h&~v,P!==0?g=bt(P):_!==0?g=bt(_):u||(u=h&~s,u!==0&&(g=bt(u)))),g===0?0:i!==0&&i!==g&&(i&v)===0&&(v=g&-g,u=i&-i,v>=u||v===32&&(u&4194048)!==0)?i:g}function Fl(s,i){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&i)===0}function sh(s,i){switch(s){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32: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 i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Di(){var s=ar;return ar<<=1,(ar&62914560)===0&&(ar=4194304),s}function Il(s){for(var i=[],u=0;31>u;u++)i.push(s);return i}function ac(s,i){s.pendingLanes|=i,i!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function SS(s,i,u,h,g,v){var _=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var P=s.entanglements,W=s.expirationTimes,me=s.hiddenUpdates;for(u=_&~u;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var MS=/[\n"\\]/g;function pa(s){return s.replace(MS,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function dh(s,i,u,h,g,v,_,P){s.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?s.type=_:s.removeAttribute("type"),i!=null?_==="number"?(i===0&&s.value===""||s.value!=i)&&(s.value=""+fa(i)):s.value!==""+fa(i)&&(s.value=""+fa(i)):_!=="submit"&&_!=="reset"||s.removeAttribute("value"),i!=null?mh(s,_,fa(i)):u!=null?mh(s,_,fa(u)):h!=null&&s.removeAttribute("value"),g==null&&v!=null&&(s.defaultChecked=!!v),g!=null&&(s.checked=g&&typeof g!="function"&&typeof g!="symbol"),P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?s.name=""+fa(P):s.removeAttribute("name")}function iv(s,i,u,h,g,v,_,P){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(s.type=v),i!=null||u!=null){if(!(v!=="submit"&&v!=="reset"||i!=null)){uh(s);return}u=u!=null?""+fa(u):"",i=i!=null?""+fa(i):u,P||i===s.value||(s.value=i),s.defaultValue=i}h=h??g,h=typeof h!="function"&&typeof h!="symbol"&&!!h,s.checked=P?s.checked:!!h,s.defaultChecked=!!h,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(s.name=_),uh(s)}function mh(s,i,u){i==="number"&&cd(s.ownerDocument)===s||s.defaultValue===""+u||(s.defaultValue=""+u)}function Pi(s,i,u,h){if(s=s.options,i){i={};for(var g=0;g"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gh=!1;if(hs)try{var oc={};Object.defineProperty(oc,"passive",{get:function(){gh=!0}}),window.addEventListener("test",oc,oc),window.removeEventListener("test",oc,oc)}catch{gh=!1}var Ys=null,vh=null,dd=null;function fv(){if(dd)return dd;var s,i=vh,u=i.length,h,g="value"in Ys?Ys.value:Ys.textContent,v=g.length;for(s=0;s=dc),bv=" ",wv=!1;function jv(s,i){switch(s){case"keyup":return ak.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nv(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Hi=!1;function lk(s,i){switch(s){case"compositionend":return Nv(i);case"keypress":return i.which!==32?null:(wv=!0,bv);case"textInput":return s=i.data,s===bv&&wv?null:s;default:return null}}function ik(s,i){if(Hi)return s==="compositionend"||!Nh&&jv(s,i)?(s=fv(),dd=vh=Ys=null,Hi=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1=i)return{node:u,offset:i-s};s=h}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=Av(u)}}function zv(s,i){return s&&i?s===i?!0:s&&s.nodeType===3?!1:i&&i.nodeType===3?zv(s,i.parentNode):"contains"in s?s.contains(i):s.compareDocumentPosition?!!(s.compareDocumentPosition(i)&16):!1:!1}function Ov(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var i=cd(s.document);i instanceof s.HTMLIFrameElement;){try{var u=typeof i.contentWindow.location.href=="string"}catch{u=!1}if(u)s=i.contentWindow;else break;i=cd(s.document)}return i}function Ch(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i&&(i==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||i==="textarea"||s.contentEditable==="true")}var pk=hs&&"documentMode"in document&&11>=document.documentMode,Ui=null,Th=null,pc=null,_h=!1;function Rv(s,i,u){var h=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;_h||Ui==null||Ui!==cd(h)||(h=Ui,"selectionStart"in h&&Ch(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),pc&&fc(pc,h)||(pc=h,h=a0(Th,"onSelect"),0>=_,g-=_,Va=1<<32-mt(i)+g|u<xt?(Dt=Ye,Ye=null):Dt=Ye.sibling;var Ht=xe(ie,Ye,ue[xt],ke);if(Ht===null){Ye===null&&(Ye=Dt);break}s&&Ye&&Ht.alternate===null&&i(ie,Ye),te=v(Ht,te,xt),qt===null?Qe=Ht:qt.sibling=Ht,qt=Ht,Ye=Dt}if(xt===ue.length)return u(ie,Ye),Rt&&ps(ie,xt),Qe;if(Ye===null){for(;xtxt?(Dt=Ye,Ye=null):Dt=Ye.sibling;var pl=xe(ie,Ye,Ht.value,ke);if(pl===null){Ye===null&&(Ye=Dt);break}s&&Ye&&pl.alternate===null&&i(ie,Ye),te=v(pl,te,xt),qt===null?Qe=pl:qt.sibling=pl,qt=pl,Ye=Dt}if(Ht.done)return u(ie,Ye),Rt&&ps(ie,xt),Qe;if(Ye===null){for(;!Ht.done;xt++,Ht=ue.next())Ht=Ce(ie,Ht.value,ke),Ht!==null&&(te=v(Ht,te,xt),qt===null?Qe=Ht:qt.sibling=Ht,qt=Ht);return Rt&&ps(ie,xt),Qe}for(Ye=h(Ye);!Ht.done;xt++,Ht=ue.next())Ht=ye(Ye,ie,xt,Ht.value,ke),Ht!==null&&(s&&Ht.alternate!==null&&Ye.delete(Ht.key===null?xt:Ht.key),te=v(Ht,te,xt),qt===null?Qe=Ht:qt.sibling=Ht,qt=Ht);return s&&Ye.forEach(function(RC){return i(ie,RC)}),Rt&&ps(ie,xt),Qe}function on(ie,te,ue,ke){if(typeof ue=="object"&&ue!==null&&ue.type===k&&ue.key===null&&(ue=ue.props.children),typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case b:e:{for(var Qe=ue.key;te!==null;){if(te.key===Qe){if(Qe=ue.type,Qe===k){if(te.tag===7){u(ie,te.sibling),ke=g(te,ue.props.children),ke.return=ie,ie=ke;break e}}else if(te.elementType===Qe||typeof Qe=="object"&&Qe!==null&&Qe.$$typeof===$&&Ql(Qe)===te.type){u(ie,te.sibling),ke=g(te,ue.props),wc(ke,ue),ke.return=ie,ie=ke;break e}u(ie,te);break}else i(ie,te);te=te.sibling}ue.type===k?(ke=Gl(ue.props.children,ie.mode,ke,ue.key),ke.return=ie,ie=ke):(ke=wd(ue.type,ue.key,ue.props,null,ie.mode,ke),wc(ke,ue),ke.return=ie,ie=ke)}return _(ie);case N:e:{for(Qe=ue.key;te!==null;){if(te.key===Qe)if(te.tag===4&&te.stateNode.containerInfo===ue.containerInfo&&te.stateNode.implementation===ue.implementation){u(ie,te.sibling),ke=g(te,ue.children||[]),ke.return=ie,ie=ke;break e}else{u(ie,te);break}else i(ie,te);te=te.sibling}ke=Rh(ue,ie.mode,ke),ke.return=ie,ie=ke}return _(ie);case $:return ue=Ql(ue),on(ie,te,ue,ke)}if(se(ue))return Ue(ie,te,ue,ke);if(ee(ue)){if(Qe=ee(ue),typeof Qe!="function")throw Error(a(150));return ue=Qe.call(ue),rt(ie,te,ue,ke)}if(typeof ue.then=="function")return on(ie,te,_d(ue),ke);if(ue.$$typeof===A)return on(ie,te,Sd(ie,ue),ke);Ed(ie,ue)}return typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint"?(ue=""+ue,te!==null&&te.tag===6?(u(ie,te.sibling),ke=g(te,ue),ke.return=ie,ie=ke):(u(ie,te),ke=Oh(ue,ie.mode,ke),ke.return=ie,ie=ke),_(ie)):u(ie,te)}return function(ie,te,ue,ke){try{bc=0;var Qe=on(ie,te,ue,ke);return eo=null,Qe}catch(Ye){if(Ye===Ji||Ye===Cd)throw Ye;var qt=ea(29,Ye,null,ie.mode);return qt.lanes=ke,qt.return=ie,qt}finally{}}}var Jl=a4(!0),s4=a4(!1),Zs=!1;function Yh(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Wh(s,i){s=s.updateQueue,i.updateQueue===s&&(i.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Js(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function el(s,i,u){var h=s.updateQueue;if(h===null)return null;if(h=h.shared,(Vt&2)!==0){var g=h.pending;return g===null?i.next=i:(i.next=g.next,g.next=i),h.pending=i,i=bd(s),Hv(s,null,u),i}return yd(s,h,i,u),bd(s)}function jc(s,i,u){if(i=i.updateQueue,i!==null&&(i=i.shared,(u&4194048)!==0)){var h=i.lanes;h&=s.pendingLanes,u|=h,i.lanes=u,Kg(s,u)}}function Xh(s,i){var u=s.updateQueue,h=s.alternate;if(h!==null&&(h=h.updateQueue,u===h)){var g=null,v=null;if(u=u.firstBaseUpdate,u!==null){do{var _={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};v===null?g=v=_:v=v.next=_,u=u.next}while(u!==null);v===null?g=v=i:v=v.next=i}else g=v=i;u={baseState:h.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:h.shared,callbacks:h.callbacks},s.updateQueue=u;return}s=u.lastBaseUpdate,s===null?u.firstBaseUpdate=i:s.next=i,u.lastBaseUpdate=i}var Kh=!1;function Nc(){if(Kh){var s=Zi;if(s!==null)throw s}}function Sc(s,i,u,h){Kh=!1;var g=s.updateQueue;Zs=!1;var v=g.firstBaseUpdate,_=g.lastBaseUpdate,P=g.shared.pending;if(P!==null){g.shared.pending=null;var W=P,me=W.next;W.next=null,_===null?v=me:_.next=me,_=W;var Se=s.alternate;Se!==null&&(Se=Se.updateQueue,P=Se.lastBaseUpdate,P!==_&&(P===null?Se.firstBaseUpdate=me:P.next=me,Se.lastBaseUpdate=W))}if(v!==null){var Ce=g.baseState;_=0,Se=me=W=null,P=v;do{var xe=P.lane&-536870913,ye=xe!==P.lane;if(ye?(At&xe)===xe:(h&xe)===xe){xe!==0&&xe===Qi&&(Kh=!0),Se!==null&&(Se=Se.next={lane:0,tag:P.tag,payload:P.payload,callback:null,next:null});e:{var Ue=s,rt=P;xe=i;var on=u;switch(rt.tag){case 1:if(Ue=rt.payload,typeof Ue=="function"){Ce=Ue.call(on,Ce,xe);break e}Ce=Ue;break e;case 3:Ue.flags=Ue.flags&-65537|128;case 0:if(Ue=rt.payload,xe=typeof Ue=="function"?Ue.call(on,Ce,xe):Ue,xe==null)break e;Ce=x({},Ce,xe);break e;case 2:Zs=!0}}xe=P.callback,xe!==null&&(s.flags|=64,ye&&(s.flags|=8192),ye=g.callbacks,ye===null?g.callbacks=[xe]:ye.push(xe))}else ye={lane:xe,tag:P.tag,payload:P.payload,callback:P.callback,next:null},Se===null?(me=Se=ye,W=Ce):Se=Se.next=ye,_|=xe;if(P=P.next,P===null){if(P=g.shared.pending,P===null)break;ye=P,P=ye.next,ye.next=null,g.lastBaseUpdate=ye,g.shared.pending=null}}while(!0);Se===null&&(W=Ce),g.baseState=W,g.firstBaseUpdate=me,g.lastBaseUpdate=Se,v===null&&(g.shared.lanes=0),sl|=_,s.lanes=_,s.memoizedState=Ce}}function l4(s,i){if(typeof s!="function")throw Error(a(191,s));s.call(i)}function i4(s,i){var u=s.callbacks;if(u!==null)for(s.callbacks=null,s=0;sv?v:8;var _=H.T,P={};H.T=P,xf(s,!1,i,u);try{var W=g(),me=H.S;if(me!==null&&me(P,W),W!==null&&typeof W=="object"&&typeof W.then=="function"){var Se=Sk(W,h);Tc(s,i,Se,sa(s))}else Tc(s,i,h,sa(s))}catch(Ce){Tc(s,i,{then:function(){},status:"rejected",reason:Ce},sa())}finally{le.p=v,_!==null&&P.types!==null&&(_.types=P.types),H.T=_}}function Mk(){}function ff(s,i,u,h){if(s.tag!==5)throw Error(a(476));var g=F4(s).queue;P4(s,g,i,re,u===null?Mk:function(){return I4(s),u(h)})}function F4(s){var i=s.memoizedState;if(i!==null)return i;i={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ys,lastRenderedState:re},next:null};var u={};return i.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ys,lastRenderedState:u},next:null},s.memoizedState=i,s=s.alternate,s!==null&&(s.memoizedState=i),i}function I4(s){var i=F4(s);i.next===null&&(i=s.alternate.memoizedState),Tc(s,i.next.queue,{},sa())}function pf(){return mr($c)}function q4(){return Bn().memoizedState}function H4(){return Bn().memoizedState}function Ak(s){for(var i=s.return;i!==null;){switch(i.tag){case 24:case 3:var u=sa();s=Js(u);var h=el(i,s,u);h!==null&&(Ir(h,i,u),jc(h,i,u)),i={cache:Uh()},s.payload=i;return}i=i.return}}function Dk(s,i,u){var h=sa();u={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Fd(s)?$4(i,u):(u=Dh(s,i,u,h),u!==null&&(Ir(u,s,h),V4(u,i,h)))}function U4(s,i,u){var h=sa();Tc(s,i,u,h)}function Tc(s,i,u,h){var g={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Fd(s))$4(i,g);else{var v=s.alternate;if(s.lanes===0&&(v===null||v.lanes===0)&&(v=i.lastRenderedReducer,v!==null))try{var _=i.lastRenderedState,P=v(_,u);if(g.hasEagerState=!0,g.eagerState=P,Jr(P,_))return yd(s,i,g,0),hn===null&&vd(),!1}catch{}finally{}if(u=Dh(s,i,g,h),u!==null)return Ir(u,s,h),V4(u,i,h),!0}return!1}function xf(s,i,u,h){if(h={lane:2,revertLane:Wf(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Fd(s)){if(i)throw Error(a(479))}else i=Dh(s,u,h,2),i!==null&&Ir(i,s,2)}function Fd(s){var i=s.alternate;return s===ht||i!==null&&i===ht}function $4(s,i){no=Dd=!0;var u=s.pending;u===null?i.next=i:(i.next=u.next,u.next=i),s.pending=i}function V4(s,i,u){if((u&4194048)!==0){var h=i.lanes;h&=s.pendingLanes,u|=h,i.lanes=u,Kg(s,u)}}var _c={readContext:mr,use:Rd,useCallback:zn,useContext:zn,useEffect:zn,useImperativeHandle:zn,useLayoutEffect:zn,useInsertionEffect:zn,useMemo:zn,useReducer:zn,useRef:zn,useState:zn,useDebugValue:zn,useDeferredValue:zn,useTransition:zn,useSyncExternalStore:zn,useId:zn,useHostTransitionStatus:zn,useFormState:zn,useActionState:zn,useOptimistic:zn,useMemoCache:zn,useCacheRefresh:zn};_c.useEffectEvent=zn;var G4={readContext:mr,use:Rd,useCallback:function(s,i){return kr().memoizedState=[s,i===void 0?null:i],s},useContext:mr,useEffect:E4,useImperativeHandle:function(s,i,u){u=u!=null?u.concat([s]):null,Bd(4194308,4,z4.bind(null,i,s),u)},useLayoutEffect:function(s,i){return Bd(4194308,4,s,i)},useInsertionEffect:function(s,i){Bd(4,2,s,i)},useMemo:function(s,i){var u=kr();i=i===void 0?null:i;var h=s();if(ei){dt(!0);try{s()}finally{dt(!1)}}return u.memoizedState=[h,i],h},useReducer:function(s,i,u){var h=kr();if(u!==void 0){var g=u(i);if(ei){dt(!0);try{u(i)}finally{dt(!1)}}}else g=i;return h.memoizedState=h.baseState=g,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:g},h.queue=s,s=s.dispatch=Dk.bind(null,ht,s),[h.memoizedState,s]},useRef:function(s){var i=kr();return s={current:s},i.memoizedState=s},useState:function(s){s=cf(s);var i=s.queue,u=U4.bind(null,ht,i);return i.dispatch=u,[s.memoizedState,u]},useDebugValue:mf,useDeferredValue:function(s,i){var u=kr();return hf(u,s,i)},useTransition:function(){var s=cf(!1);return s=P4.bind(null,ht,s.queue,!0,!1),kr().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,i,u){var h=ht,g=kr();if(Rt){if(u===void 0)throw Error(a(407));u=u()}else{if(u=i(),hn===null)throw Error(a(349));(At&127)!==0||h4(h,i,u)}g.memoizedState=u;var v={value:u,getSnapshot:i};return g.queue=v,E4(p4.bind(null,h,v,s),[s]),h.flags|=2048,ao(9,{destroy:void 0},f4.bind(null,h,v,u,i),null),u},useId:function(){var s=kr(),i=hn.identifierPrefix;if(Rt){var u=Ga,h=Va;u=(h&~(1<<32-mt(h)-1)).toString(32)+u,i="_"+i+"R_"+u,u=zd++,0<\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof h.is=="string"?_.createElement("select",{is:h.is}):_.createElement("select"),h.multiple?v.multiple=!0:h.size&&(v.size=h.size);break;default:v=typeof h.is=="string"?_.createElement(g,{is:h.is}):_.createElement(g)}}v[ur]=i,v[Or]=h;e:for(_=i.child;_!==null;){if(_.tag===5||_.tag===6)v.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===i)break e;for(;_.sibling===null;){if(_.return===null||_.return===i)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}i.stateNode=v;e:switch(fr(v,g,h),g){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&ws(i)}}return Nn(i),Mf(i,i.type,s===null?null:s.memoizedProps,i.pendingProps,u),null;case 6:if(s&&i.stateNode!=null)s.memoizedProps!==h&&ws(i);else{if(typeof h!="string"&&i.stateNode===null)throw Error(a(166));if(s=ce.current,Xi(i)){if(s=i.stateNode,u=i.memoizedProps,h=null,g=dr,g!==null)switch(g.tag){case 27:case 5:h=g.memoizedProps}s[ur]=i,s=!!(s.nodeValue===u||h!==null&&h.suppressHydrationWarning===!0||dy(s.nodeValue,u)),s||Ks(i,!0)}else s=s0(s).createTextNode(h),s[ur]=i,i.stateNode=s}return Nn(i),null;case 31:if(u=i.memoizedState,s===null||s.memoizedState!==null){if(h=Xi(i),u!==null){if(s===null){if(!h)throw Error(a(318));if(s=i.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(557));s[ur]=i}else Yl(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Nn(i),s=!1}else u=Fh(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return i.flags&256?(na(i),i):(na(i),null);if((i.flags&128)!==0)throw Error(a(558))}return Nn(i),null;case 13:if(h=i.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(g=Xi(i),h!==null&&h.dehydrated!==null){if(s===null){if(!g)throw Error(a(318));if(g=i.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(a(317));g[ur]=i}else Yl(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Nn(i),g=!1}else g=Fh(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=g),g=!0;if(!g)return i.flags&256?(na(i),i):(na(i),null)}return na(i),(i.flags&128)!==0?(i.lanes=u,i):(u=h!==null,s=s!==null&&s.memoizedState!==null,u&&(h=i.child,g=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(g=h.alternate.memoizedState.cachePool.pool),v=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(v=h.memoizedState.cachePool.pool),v!==g&&(h.flags|=2048)),u!==s&&u&&(i.child.flags|=8192),$d(i,i.updateQueue),Nn(i),null);case 4:return oe(),s===null&&Zf(i.stateNode.containerInfo),Nn(i),null;case 10:return gs(i.type),Nn(i),null;case 19:if(Z(Ln),h=i.memoizedState,h===null)return Nn(i),null;if(g=(i.flags&128)!==0,v=h.rendering,v===null)if(g)Mc(h,!1);else{if(On!==0||s!==null&&(s.flags&128)!==0)for(s=i.child;s!==null;){if(v=Ad(s),v!==null){for(i.flags|=128,Mc(h,!1),s=v.updateQueue,i.updateQueue=s,$d(i,s),i.subtreeFlags=0,s=u,u=i.child;u!==null;)Uv(u,s),u=u.sibling;return z(Ln,Ln.current&1|2),Rt&&ps(i,h.treeForkCount),i.child}s=s.sibling}h.tail!==null&&$e()>Xd&&(i.flags|=128,g=!0,Mc(h,!1),i.lanes=4194304)}else{if(!g)if(s=Ad(v),s!==null){if(i.flags|=128,g=!0,s=s.updateQueue,i.updateQueue=s,$d(i,s),Mc(h,!0),h.tail===null&&h.tailMode==="hidden"&&!v.alternate&&!Rt)return Nn(i),null}else 2*$e()-h.renderingStartTime>Xd&&u!==536870912&&(i.flags|=128,g=!0,Mc(h,!1),i.lanes=4194304);h.isBackwards?(v.sibling=i.child,i.child=v):(s=h.last,s!==null?s.sibling=v:i.child=v,h.last=v)}return h.tail!==null?(s=h.tail,h.rendering=s,h.tail=s.sibling,h.renderingStartTime=$e(),s.sibling=null,u=Ln.current,z(Ln,g?u&1|2:u&1),Rt&&ps(i,h.treeForkCount),s):(Nn(i),null);case 22:case 23:return na(i),Zh(),h=i.memoizedState!==null,s!==null?s.memoizedState!==null!==h&&(i.flags|=8192):h&&(i.flags|=8192),h?(u&536870912)!==0&&(i.flags&128)===0&&(Nn(i),i.subtreeFlags&6&&(i.flags|=8192)):Nn(i),u=i.updateQueue,u!==null&&$d(i,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),h=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(h=i.memoizedState.cachePool.pool),h!==u&&(i.flags|=2048),s!==null&&Z(Kl),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),i.memoizedState.cache!==u&&(i.flags|=2048),gs(In),Nn(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function Bk(s,i){switch(Bh(i),i.tag){case 1:return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 3:return gs(In),oe(),s=i.flags,(s&65536)!==0&&(s&128)===0?(i.flags=s&-65537|128,i):null;case 26:case 27:case 5:return at(i),null;case 31:if(i.memoizedState!==null){if(na(i),i.alternate===null)throw Error(a(340));Yl()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 13:if(na(i),s=i.memoizedState,s!==null&&s.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Yl()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 19:return Z(Ln),null;case 4:return oe(),null;case 10:return gs(i.type),null;case 22:case 23:return na(i),Zh(),s!==null&&Z(Kl),s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 24:return gs(In),null;case 25:return null;default:return null}}function x2(s,i){switch(Bh(i),i.tag){case 3:gs(In),oe();break;case 26:case 27:case 5:at(i);break;case 4:oe();break;case 31:i.memoizedState!==null&&na(i);break;case 13:na(i);break;case 19:Z(Ln);break;case 10:gs(i.type);break;case 22:case 23:na(i),Zh(),s!==null&&Z(Kl);break;case 24:gs(In)}}function Ac(s,i){try{var u=i.updateQueue,h=u!==null?u.lastEffect:null;if(h!==null){var g=h.next;u=g;do{if((u.tag&s)===s){h=void 0;var v=u.create,_=u.inst;h=v(),_.destroy=h}u=u.next}while(u!==g)}}catch(P){nn(i,i.return,P)}}function rl(s,i,u){try{var h=i.updateQueue,g=h!==null?h.lastEffect:null;if(g!==null){var v=g.next;h=v;do{if((h.tag&s)===s){var _=h.inst,P=_.destroy;if(P!==void 0){_.destroy=void 0,g=i;var W=u,me=P;try{me()}catch(Se){nn(g,W,Se)}}}h=h.next}while(h!==v)}}catch(Se){nn(i,i.return,Se)}}function g2(s){var i=s.updateQueue;if(i!==null){var u=s.stateNode;try{i4(i,u)}catch(h){nn(s,s.return,h)}}}function v2(s,i,u){u.props=ti(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(h){nn(s,i,h)}}function Dc(s,i){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var h=s.stateNode;break;case 30:h=s.stateNode;break;default:h=s.stateNode}typeof u=="function"?s.refCleanup=u(h):u.current=h}}catch(g){nn(s,i,g)}}function Ya(s,i){var u=s.ref,h=s.refCleanup;if(u!==null)if(typeof h=="function")try{h()}catch(g){nn(s,i,g)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(g){nn(s,i,g)}else u.current=null}function y2(s){var i=s.type,u=s.memoizedProps,h=s.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":u.autoFocus&&h.focus();break e;case"img":u.src?h.src=u.src:u.srcSet&&(h.srcset=u.srcSet)}}catch(g){nn(s,s.return,g)}}function Af(s,i,u){try{var h=s.stateNode;sC(h,s.type,u,i),h[Or]=i}catch(g){nn(s,s.return,g)}}function b2(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&ul(s.type)||s.tag===4}function Df(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||b2(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&ul(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function zf(s,i,u){var h=s.tag;if(h===5||h===6)s=s.stateNode,i?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(s,i):(i=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,i.appendChild(s),u=u._reactRootContainer,u!=null||i.onclick!==null||(i.onclick=ms));else if(h!==4&&(h===27&&ul(s.type)&&(u=s.stateNode,i=null),s=s.child,s!==null))for(zf(s,i,u),s=s.sibling;s!==null;)zf(s,i,u),s=s.sibling}function Vd(s,i,u){var h=s.tag;if(h===5||h===6)s=s.stateNode,i?u.insertBefore(s,i):u.appendChild(s);else if(h!==4&&(h===27&&ul(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(Vd(s,i,u),s=s.sibling;s!==null;)Vd(s,i,u),s=s.sibling}function w2(s){var i=s.stateNode,u=s.memoizedProps;try{for(var h=s.type,g=i.attributes;g.length;)i.removeAttributeNode(g[0]);fr(i,h,u),i[ur]=s,i[Or]=u}catch(v){nn(s,s.return,v)}}var js=!1,Un=!1,Of=!1,j2=typeof WeakSet=="function"?WeakSet:Set,lr=null;function Pk(s,i){if(s=s.containerInfo,tp=m0,s=Ov(s),Ch(s)){if("selectionStart"in s)var u={start:s.selectionStart,end:s.selectionEnd};else e:{u=(u=s.ownerDocument)&&u.defaultView||window;var h=u.getSelection&&u.getSelection();if(h&&h.rangeCount!==0){u=h.anchorNode;var g=h.anchorOffset,v=h.focusNode;h=h.focusOffset;try{u.nodeType,v.nodeType}catch{u=null;break e}var _=0,P=-1,W=-1,me=0,Se=0,Ce=s,xe=null;t:for(;;){for(var ye;Ce!==u||g!==0&&Ce.nodeType!==3||(P=_+g),Ce!==v||h!==0&&Ce.nodeType!==3||(W=_+h),Ce.nodeType===3&&(_+=Ce.nodeValue.length),(ye=Ce.firstChild)!==null;)xe=Ce,Ce=ye;for(;;){if(Ce===s)break t;if(xe===u&&++me===g&&(P=_),xe===v&&++Se===h&&(W=_),(ye=Ce.nextSibling)!==null)break;Ce=xe,xe=Ce.parentNode}Ce=ye}u=P===-1||W===-1?null:{start:P,end:W}}else u=null}u=u||{start:0,end:0}}else u=null;for(np={focusedElem:s,selectionRange:u},m0=!1,lr=i;lr!==null;)if(i=lr,s=i.child,(i.subtreeFlags&1028)!==0&&s!==null)s.return=i,lr=s;else for(;lr!==null;){switch(i=lr,v=i.alternate,s=i.flags,i.tag){case 0:if((s&4)!==0&&(s=i.updateQueue,s=s!==null?s.events:null,s!==null))for(u=0;u title"))),fr(v,h,u),v[ur]=s,sr(v),h=v;break e;case"link":var _=_y("link","href",g).get(h+(u.href||""));if(_){for(var P=0;P<_.length;P++)if(v=_[P],v.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&v.getAttribute("rel")===(u.rel==null?null:u.rel)&&v.getAttribute("title")===(u.title==null?null:u.title)&&v.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){_.splice(P,1);break t}}v=g.createElement(h),fr(v,h,u),g.head.appendChild(v);break;case"meta":if(_=_y("meta","content",g).get(h+(u.content||""))){for(P=0;P<_.length;P++)if(v=_[P],v.getAttribute("content")===(u.content==null?null:""+u.content)&&v.getAttribute("name")===(u.name==null?null:u.name)&&v.getAttribute("property")===(u.property==null?null:u.property)&&v.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&v.getAttribute("charset")===(u.charSet==null?null:u.charSet)){_.splice(P,1);break t}}v=g.createElement(h),fr(v,h,u),g.head.appendChild(v);break;default:throw Error(a(468,h))}v[ur]=s,sr(v),h=v}s.stateNode=h}else Ey(g,s.type,s.stateNode);else s.stateNode=Ty(g,h,s.memoizedProps);else v!==h?(v===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):v.count--,h===null?Ey(g,s.type,s.stateNode):Ty(g,h,s.memoizedProps)):h===null&&s.stateNode!==null&&Af(s,s.memoizedProps,u.memoizedProps)}break;case 27:Br(i,s),Pr(s),h&512&&(Un||u===null||Ya(u,u.return)),u!==null&&h&4&&Af(s,s.memoizedProps,u.memoizedProps);break;case 5:if(Br(i,s),Pr(s),h&512&&(Un||u===null||Ya(u,u.return)),s.flags&32){g=s.stateNode;try{Fi(g,"")}catch(Ue){nn(s,s.return,Ue)}}h&4&&s.stateNode!=null&&(g=s.memoizedProps,Af(s,g,u!==null?u.memoizedProps:g)),h&1024&&(Of=!0);break;case 6:if(Br(i,s),Pr(s),h&4){if(s.stateNode===null)throw Error(a(162));h=s.memoizedProps,u=s.stateNode;try{u.nodeValue=h}catch(Ue){nn(s,s.return,Ue)}}break;case 3:if(o0=null,g=za,za=l0(i.containerInfo),Br(i,s),za=g,Pr(s),h&4&&u!==null&&u.memoizedState.isDehydrated)try{go(i.containerInfo)}catch(Ue){nn(s,s.return,Ue)}Of&&(Of=!1,E2(s));break;case 4:h=za,za=l0(s.stateNode.containerInfo),Br(i,s),Pr(s),za=h;break;case 12:Br(i,s),Pr(s);break;case 31:Br(i,s),Pr(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Gd(s,h)));break;case 13:Br(i,s),Pr(s),s.child.flags&8192&&s.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(Wd=$e()),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Gd(s,h)));break;case 22:g=s.memoizedState!==null;var W=u!==null&&u.memoizedState!==null,me=js,Se=Un;if(js=me||g,Un=Se||W,Br(i,s),Un=Se,js=me,Pr(s),h&8192)e:for(i=s.stateNode,i._visibility=g?i._visibility&-2:i._visibility|1,g&&(u===null||W||js||Un||ni(s)),u=null,i=s;;){if(i.tag===5||i.tag===26){if(u===null){W=u=i;try{if(v=W.stateNode,g)_=v.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{P=W.stateNode;var Ce=W.memoizedProps.style,xe=Ce!=null&&Ce.hasOwnProperty("display")?Ce.display:null;P.style.display=xe==null||typeof xe=="boolean"?"":(""+xe).trim()}}catch(Ue){nn(W,W.return,Ue)}}}else if(i.tag===6){if(u===null){W=i;try{W.stateNode.nodeValue=g?"":W.memoizedProps}catch(Ue){nn(W,W.return,Ue)}}}else if(i.tag===18){if(u===null){W=i;try{var ye=W.stateNode;g?vy(ye,!0):vy(W.stateNode,!1)}catch(Ue){nn(W,W.return,Ue)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===s)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;u===i&&(u=null),i=i.return}u===i&&(u=null),i.sibling.return=i.return,i=i.sibling}h&4&&(h=s.updateQueue,h!==null&&(u=h.retryQueue,u!==null&&(h.retryQueue=null,Gd(s,u))));break;case 19:Br(i,s),Pr(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Gd(s,h)));break;case 30:break;case 21:break;default:Br(i,s),Pr(s)}}function Pr(s){var i=s.flags;if(i&2){try{for(var u,h=s.return;h!==null;){if(b2(h)){u=h;break}h=h.return}if(u==null)throw Error(a(160));switch(u.tag){case 27:var g=u.stateNode,v=Df(s);Vd(s,v,g);break;case 5:var _=u.stateNode;u.flags&32&&(Fi(_,""),u.flags&=-33);var P=Df(s);Vd(s,P,_);break;case 3:case 4:var W=u.stateNode.containerInfo,me=Df(s);zf(s,me,W);break;default:throw Error(a(161))}}catch(Se){nn(s,s.return,Se)}s.flags&=-3}i&4096&&(s.flags&=-4097)}function E2(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var i=s;E2(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),s=s.sibling}}function Ss(s,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)N2(s,i.alternate,i),i=i.sibling}function ni(s){for(s=s.child;s!==null;){var i=s;switch(i.tag){case 0:case 11:case 14:case 15:rl(4,i,i.return),ni(i);break;case 1:Ya(i,i.return);var u=i.stateNode;typeof u.componentWillUnmount=="function"&&v2(i,i.return,u),ni(i);break;case 27:qc(i.stateNode);case 26:case 5:Ya(i,i.return),ni(i);break;case 22:i.memoizedState===null&&ni(i);break;case 30:ni(i);break;default:ni(i)}s=s.sibling}}function ks(s,i,u){for(u=u&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var h=i.alternate,g=s,v=i,_=v.flags;switch(v.tag){case 0:case 11:case 15:ks(g,v,u),Ac(4,v);break;case 1:if(ks(g,v,u),h=v,g=h.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(me){nn(h,h.return,me)}if(h=v,g=h.updateQueue,g!==null){var P=h.stateNode;try{var W=g.shared.hiddenCallbacks;if(W!==null)for(g.shared.hiddenCallbacks=null,g=0;gon&&(_=on,on=rt,rt=_);var ie=Dv(P,rt),te=Dv(P,on);if(ie&&te&&(ye.rangeCount!==1||ye.anchorNode!==ie.node||ye.anchorOffset!==ie.offset||ye.focusNode!==te.node||ye.focusOffset!==te.offset)){var ue=Ce.createRange();ue.setStart(ie.node,ie.offset),ye.removeAllRanges(),rt>on?(ye.addRange(ue),ye.extend(te.node,te.offset)):(ue.setEnd(te.node,te.offset),ye.addRange(ue))}}}}for(Ce=[],ye=P;ye=ye.parentNode;)ye.nodeType===1&&Ce.push({element:ye,left:ye.scrollLeft,top:ye.scrollTop});for(typeof P.focus=="function"&&P.focus(),P=0;Pu?32:u,H.T=null,u=qf,qf=null;var v=il,_=Ts;if(Xn=0,co=il=null,Ts=0,(Vt&6)!==0)throw Error(a(331));var P=Vt;if(Vt|=4,z2(v.current),M2(v,v.current,_,u),Vt=P,Pc(0,!1),Ee&&typeof Ee.onPostCommitFiberRoot=="function")try{Ee.onPostCommitFiberRoot(pe,v)}catch{}return!0}finally{le.p=g,H.T=h,Q2(s,i)}}function J2(s,i,u){i=ga(u,i),i=bf(s.stateNode,i,2),s=el(s,i,2),s!==null&&(ac(s,2),Wa(s))}function nn(s,i,u){if(s.tag===3)J2(s,s,u);else for(;i!==null;){if(i.tag===3){J2(i,s,u);break}else if(i.tag===1){var h=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(ll===null||!ll.has(h))){s=ga(u,s),u=e2(2),h=el(i,u,2),h!==null&&(t2(u,h,i,s),ac(h,2),Wa(h));break}}i=i.return}}function Vf(s,i,u){var h=s.pingCache;if(h===null){h=s.pingCache=new qk;var g=new Set;h.set(i,g)}else g=h.get(i),g===void 0&&(g=new Set,h.set(i,g));g.has(u)||(Bf=!0,g.add(u),s=Gk.bind(null,s,i,u),i.then(s,s))}function Gk(s,i,u){var h=s.pingCache;h!==null&&h.delete(i),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,hn===s&&(At&u)===u&&(On===4||On===3&&(At&62914560)===At&&300>$e()-Wd?(Vt&2)===0&&uo(s,0):Pf|=u,oo===At&&(oo=0)),Wa(s)}function ey(s,i){i===0&&(i=Di()),s=Vl(s,i),s!==null&&(ac(s,i),Wa(s))}function Yk(s){var i=s.memoizedState,u=0;i!==null&&(u=i.retryLane),ey(s,u)}function Wk(s,i){var u=0;switch(s.tag){case 31:case 13:var h=s.stateNode,g=s.memoizedState;g!==null&&(u=g.retryLane);break;case 19:h=s.stateNode;break;case 22:h=s.stateNode._retryCache;break;default:throw Error(a(314))}h!==null&&h.delete(i),ey(s,u)}function Xk(s,i){return Wn(s,i)}var t0=null,ho=null,Gf=!1,n0=!1,Yf=!1,cl=0;function Wa(s){s!==ho&&s.next===null&&(ho===null?t0=ho=s:ho=ho.next=s),n0=!0,Gf||(Gf=!0,Qk())}function Pc(s,i){if(!Yf&&n0){Yf=!0;do for(var u=!1,h=t0;h!==null;){if(s!==0){var g=h.pendingLanes;if(g===0)var v=0;else{var _=h.suspendedLanes,P=h.pingedLanes;v=(1<<31-mt(42|s)+1)-1,v&=g&~(_&~P),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(u=!0,ay(h,v))}else v=At,v=Ai(h,h===hn?v:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(v&3)===0||Fl(h,v)||(u=!0,ay(h,v));h=h.next}while(u);Yf=!1}}function Kk(){ty()}function ty(){n0=Gf=!1;var s=0;cl!==0&&iC()&&(s=cl);for(var i=$e(),u=null,h=t0;h!==null;){var g=h.next,v=ny(h,i);v===0?(h.next=null,u===null?t0=g:u.next=g,g===null&&(ho=u)):(u=h,(s!==0||(v&3)!==0)&&(n0=!0)),h=g}Xn!==0&&Xn!==5||Pc(s),cl!==0&&(cl=0)}function ny(s,i){for(var u=s.suspendedLanes,h=s.pingedLanes,g=s.expirationTimes,v=s.pendingLanes&-62914561;0P)break;var Se=W.transferSize,Ce=W.initiatorType;Se&&my(Ce)&&(W=W.responseEnd,_+=Se*(W"u"?null:document;function Sy(s,i,u){var h=fo;if(h&&typeof i=="string"&&i){var g=pa(i);g='link[rel="'+s+'"][href="'+g+'"]',typeof u=="string"&&(g+='[crossorigin="'+u+'"]'),Ny.has(g)||(Ny.add(g),s={rel:s,crossOrigin:u,href:i},h.querySelector(g)===null&&(i=h.createElement("link"),fr(i,"link",s),sr(i),h.head.appendChild(i)))}}function xC(s){_s.D(s),Sy("dns-prefetch",s,null)}function gC(s,i){_s.C(s,i),Sy("preconnect",s,i)}function vC(s,i,u){_s.L(s,i,u);var h=fo;if(h&&s&&i){var g='link[rel="preload"][as="'+pa(i)+'"]';i==="image"&&u&&u.imageSrcSet?(g+='[imagesrcset="'+pa(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(g+='[imagesizes="'+pa(u.imageSizes)+'"]')):g+='[href="'+pa(s)+'"]';var v=g;switch(i){case"style":v=po(s);break;case"script":v=xo(s)}Na.has(v)||(s=x({rel:"preload",href:i==="image"&&u&&u.imageSrcSet?void 0:s,as:i},u),Na.set(v,s),h.querySelector(g)!==null||i==="style"&&h.querySelector(Hc(v))||i==="script"&&h.querySelector(Uc(v))||(i=h.createElement("link"),fr(i,"link",s),sr(i),h.head.appendChild(i)))}}function yC(s,i){_s.m(s,i);var u=fo;if(u&&s){var h=i&&typeof i.as=="string"?i.as:"script",g='link[rel="modulepreload"][as="'+pa(h)+'"][href="'+pa(s)+'"]',v=g;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=xo(s)}if(!Na.has(v)&&(s=x({rel:"modulepreload",href:s},i),Na.set(v,s),u.querySelector(g)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(Uc(v)))return}h=u.createElement("link"),fr(h,"link",s),sr(h),u.head.appendChild(h)}}}function bC(s,i,u){_s.S(s,i,u);var h=fo;if(h&&s){var g=Li(h).hoistableStyles,v=po(s);i=i||"default";var _=g.get(v);if(!_){var P={loading:0,preload:null};if(_=h.querySelector(Hc(v)))P.loading=5;else{s=x({rel:"stylesheet",href:s,"data-precedence":i},u),(u=Na.get(v))&&cp(s,u);var W=_=h.createElement("link");sr(W),fr(W,"link",s),W._p=new Promise(function(me,Se){W.onload=me,W.onerror=Se}),W.addEventListener("load",function(){P.loading|=1}),W.addEventListener("error",function(){P.loading|=2}),P.loading|=4,i0(_,i,h)}_={type:"stylesheet",instance:_,count:1,state:P},g.set(v,_)}}}function wC(s,i){_s.X(s,i);var u=fo;if(u&&s){var h=Li(u).hoistableScripts,g=xo(s),v=h.get(g);v||(v=u.querySelector(Uc(g)),v||(s=x({src:s,async:!0},i),(i=Na.get(g))&&up(s,i),v=u.createElement("script"),sr(v),fr(v,"link",s),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(g,v))}}function jC(s,i){_s.M(s,i);var u=fo;if(u&&s){var h=Li(u).hoistableScripts,g=xo(s),v=h.get(g);v||(v=u.querySelector(Uc(g)),v||(s=x({src:s,async:!0,type:"module"},i),(i=Na.get(g))&&up(s,i),v=u.createElement("script"),sr(v),fr(v,"link",s),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(g,v))}}function ky(s,i,u,h){var g=(g=ce.current)?l0(g):null;if(!g)throw Error(a(446));switch(s){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(i=po(u.href),u=Li(g).hoistableStyles,h=u.get(i),h||(h={type:"style",instance:null,count:0,state:null},u.set(i,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){s=po(u.href);var v=Li(g).hoistableStyles,_=v.get(s);if(_||(g=g.ownerDocument||g,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(s,_),(v=g.querySelector(Hc(s)))&&!v._p&&(_.instance=v,_.state.loading=5),Na.has(s)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Na.set(s,u),v||NC(g,s,u,_.state))),i&&h===null)throw Error(a(528,""));return _}if(i&&h!==null)throw Error(a(529,""));return null;case"script":return i=u.async,u=u.src,typeof u=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=xo(u),u=Li(g).hoistableScripts,h=u.get(i),h||(h={type:"script",instance:null,count:0,state:null},u.set(i,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,s))}}function po(s){return'href="'+pa(s)+'"'}function Hc(s){return'link[rel="stylesheet"]['+s+"]"}function Cy(s){return x({},s,{"data-precedence":s.precedence,precedence:null})}function NC(s,i,u,h){s.querySelector('link[rel="preload"][as="style"]['+i+"]")?h.loading=1:(i=s.createElement("link"),h.preload=i,i.addEventListener("load",function(){return h.loading|=1}),i.addEventListener("error",function(){return h.loading|=2}),fr(i,"link",u),sr(i),s.head.appendChild(i))}function xo(s){return'[src="'+pa(s)+'"]'}function Uc(s){return"script[async]"+s}function Ty(s,i,u){if(i.count++,i.instance===null)switch(i.type){case"style":var h=s.querySelector('style[data-href~="'+pa(u.href)+'"]');if(h)return i.instance=h,sr(h),h;var g=x({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return h=(s.ownerDocument||s).createElement("style"),sr(h),fr(h,"style",g),i0(h,u.precedence,s),i.instance=h;case"stylesheet":g=po(u.href);var v=s.querySelector(Hc(g));if(v)return i.state.loading|=4,i.instance=v,sr(v),v;h=Cy(u),(g=Na.get(g))&&cp(h,g),v=(s.ownerDocument||s).createElement("link"),sr(v);var _=v;return _._p=new Promise(function(P,W){_.onload=P,_.onerror=W}),fr(v,"link",h),i.state.loading|=4,i0(v,u.precedence,s),i.instance=v;case"script":return v=xo(u.src),(g=s.querySelector(Uc(v)))?(i.instance=g,sr(g),g):(h=u,(g=Na.get(v))&&(h=x({},u),up(h,g)),s=s.ownerDocument||s,g=s.createElement("script"),sr(g),fr(g,"link",h),s.head.appendChild(g),i.instance=g);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(h=i.instance,i.state.loading|=4,i0(h,u.precedence,s));return i.instance}function i0(s,i,u){for(var h=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=h.length?h[h.length-1]:null,v=g,_=0;_ title"):null)}function SC(s,i,u){if(u===1||i.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return s=i.disabled,typeof i.precedence=="string"&&s==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function My(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function kC(s,i,u,h){if(u.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var g=po(h.href),v=i.querySelector(Hc(g));if(v){i=v._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(s.count++,s=c0.bind(s),i.then(s,s)),u.state.loading|=4,u.instance=v,sr(v);return}v=i.ownerDocument||i,h=Cy(h),(g=Na.get(g))&&cp(h,g),v=v.createElement("link"),sr(v);var _=v;_._p=new Promise(function(P,W){_.onload=P,_.onerror=W}),fr(v,"link",h),u.instance=v}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(u,i),(i=u.state.preload)&&(u.state.loading&3)===0&&(s.count++,u=c0.bind(s),i.addEventListener("load",u),i.addEventListener("error",u))}}var dp=0;function CC(s,i){return s.stylesheets&&s.count===0&&d0(s,s.stylesheets),0dp?50:800)+i);return s.unsuspend=u,function(){s.unsuspend=null,clearTimeout(h),clearTimeout(g)}}:null}function c0(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)d0(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var u0=null;function d0(s,i){s.stylesheets=null,s.unsuspend!==null&&(s.count++,u0=new Map,i.forEach(TC,s),u0=null,c0.call(s))}function TC(s,i){if(!(i.state.loading&4)){var u=u0.get(s);if(u)var h=u.get(null);else{u=new Map,u0.set(s,u);for(var g=s.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),bp.exports=PT(),bp.exports}var IT=FT();function d6(e,t){return function(){return e.apply(t,arguments)}}const{toString:qT}=Object.prototype,{getPrototypeOf:k1}=Object,{iterator:Tm,toStringTag:m6}=Symbol,_m=(e=>t=>{const n=qT.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),$a=e=>(e=e.toLowerCase(),t=>_m(t)===e),Em=e=>t=>typeof t===e,{isArray:Go}=Array,Fo=Em("undefined");function Ou(e){return e!==null&&!Fo(e)&&e.constructor!==null&&!Fo(e.constructor)&&Vr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const h6=$a("ArrayBuffer");function HT(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&h6(e.buffer),t}const UT=Em("string"),Vr=Em("function"),f6=Em("number"),Ru=e=>e!==null&&typeof e=="object",$T=e=>e===!0||e===!1,$0=e=>{if(_m(e)!=="object")return!1;const t=k1(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(m6 in e)&&!(Tm in e)},VT=e=>{if(!Ru(e)||Ou(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},GT=$a("Date"),YT=$a("File"),WT=$a("Blob"),XT=$a("FileList"),KT=e=>Ru(e)&&Vr(e.pipe),QT=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Vr(e.append)&&((t=_m(e))==="formdata"||t==="object"&&Vr(e.toString)&&e.toString()==="[object FormData]"))},ZT=$a("URLSearchParams"),[JT,e_,t_,n_]=["ReadableStream","Request","Response","Headers"].map($a),r_=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Lu(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let a,l;if(typeof e!="object"&&(e=[e]),Go(e))for(a=0,l=e.length;a0;)if(l=n[a],t===l.toLowerCase())return l;return null}const ci=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,x6=e=>!Fo(e)&&e!==ci;function kx(){const{caseless:e,skipUndefined:t}=x6(this)&&this||{},n={},a=(l,o)=>{const c=e&&p6(n,o)||o;$0(n[c])&&$0(l)?n[c]=kx(n[c],l):$0(l)?n[c]=kx({},l):Go(l)?n[c]=l.slice():(!t||!Fo(l))&&(n[c]=l)};for(let l=0,o=arguments.length;l(Lu(t,(l,o)=>{n&&Vr(l)?e[o]=d6(l,n):e[o]=l},{allOwnKeys:a}),e),s_=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),l_=(e,t,n,a)=>{e.prototype=Object.create(t.prototype,a),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},i_=(e,t,n,a)=>{let l,o,c;const d={};if(t=t||{},e==null)return t;do{for(l=Object.getOwnPropertyNames(e),o=l.length;o-- >0;)c=l[o],(!a||a(c,e,t))&&!d[c]&&(t[c]=e[c],d[c]=!0);e=n!==!1&&k1(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},o_=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const a=e.indexOf(t,n);return a!==-1&&a===n},c_=e=>{if(!e)return null;if(Go(e))return e;let t=e.length;if(!f6(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},u_=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&k1(Uint8Array)),d_=(e,t)=>{const a=(e&&e[Tm]).call(e);let l;for(;(l=a.next())&&!l.done;){const o=l.value;t.call(e,o[0],o[1])}},m_=(e,t)=>{let n;const a=[];for(;(n=e.exec(t))!==null;)a.push(n);return a},h_=$a("HTMLFormElement"),f_=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,a,l){return a.toUpperCase()+l}),tb=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),p_=$a("RegExp"),g6=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),a={};Lu(n,(l,o)=>{let c;(c=t(l,o,e))!==!1&&(a[o]=c||l)}),Object.defineProperties(e,a)},x_=e=>{g6(e,(t,n)=>{if(Vr(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const a=e[n];if(Vr(a)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},g_=(e,t)=>{const n={},a=l=>{l.forEach(o=>{n[o]=!0})};return Go(e)?a(e):a(String(e).split(t)),n},v_=()=>{},y_=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function b_(e){return!!(e&&Vr(e.append)&&e[m6]==="FormData"&&e[Tm])}const w_=e=>{const t=new Array(10),n=(a,l)=>{if(Ru(a)){if(t.indexOf(a)>=0)return;if(Ou(a))return a;if(!("toJSON"in a)){t[l]=a;const o=Go(a)?[]:{};return Lu(a,(c,d)=>{const m=n(c,l+1);!Fo(m)&&(o[d]=m)}),t[l]=void 0,o}}return a};return n(e,0)},j_=$a("AsyncFunction"),N_=e=>e&&(Ru(e)||Vr(e))&&Vr(e.then)&&Vr(e.catch),v6=((e,t)=>e?setImmediate:t?((n,a)=>(ci.addEventListener("message",({source:l,data:o})=>{l===ci&&o===n&&a.length&&a.shift()()},!1),l=>{a.push(l),ci.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Vr(ci.postMessage)),S_=typeof queueMicrotask<"u"?queueMicrotask.bind(ci):typeof process<"u"&&process.nextTick||v6,k_=e=>e!=null&&Vr(e[Tm]),ve={isArray:Go,isArrayBuffer:h6,isBuffer:Ou,isFormData:QT,isArrayBufferView:HT,isString:UT,isNumber:f6,isBoolean:$T,isObject:Ru,isPlainObject:$0,isEmptyObject:VT,isReadableStream:JT,isRequest:e_,isResponse:t_,isHeaders:n_,isUndefined:Fo,isDate:GT,isFile:YT,isBlob:WT,isRegExp:p_,isFunction:Vr,isStream:KT,isURLSearchParams:ZT,isTypedArray:u_,isFileList:XT,forEach:Lu,merge:kx,extend:a_,trim:r_,stripBOM:s_,inherits:l_,toFlatObject:i_,kindOf:_m,kindOfTest:$a,endsWith:o_,toArray:c_,forEachEntry:d_,matchAll:m_,isHTMLForm:h_,hasOwnProperty:tb,hasOwnProp:tb,reduceDescriptors:g6,freezeMethods:x_,toObjectSet:g_,toCamelCase:f_,noop:v_,toFiniteNumber:y_,findKey:p6,global:ci,isContextDefined:x6,isSpecCompliantForm:b_,toJSONObject:w_,isAsyncFn:j_,isThenable:N_,setImmediate:v6,asap:S_,isIterable:k_};function ft(e,t,n,a,l){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),a&&(this.request=a),l&&(this.response=l,this.status=l.status?l.status:null)}ve.inherits(ft,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:ve.toJSONObject(this.config),code:this.code,status:this.status}}});const y6=ft.prototype,b6={};["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(e=>{b6[e]={value:e}});Object.defineProperties(ft,b6);Object.defineProperty(y6,"isAxiosError",{value:!0});ft.from=(e,t,n,a,l,o)=>{const c=Object.create(y6);ve.toFlatObject(e,c,function(p){return p!==Error.prototype},f=>f!=="isAxiosError");const d=e&&e.message?e.message:"Error",m=t==null&&e?e.code:t;return ft.call(c,d,m,n,a,l),e&&c.cause==null&&Object.defineProperty(c,"cause",{value:e,configurable:!0}),c.name=e&&e.name||"Error",o&&Object.assign(c,o),c};const C_=null;function Cx(e){return ve.isPlainObject(e)||ve.isArray(e)}function w6(e){return ve.endsWith(e,"[]")?e.slice(0,-2):e}function nb(e,t,n){return e?e.concat(t).map(function(l,o){return l=w6(l),!n&&o?"["+l+"]":l}).join(n?".":""):t}function T_(e){return ve.isArray(e)&&!e.some(Cx)}const __=ve.toFlatObject(ve,{},null,function(t){return/^is[A-Z]/.test(t)});function Mm(e,t,n){if(!ve.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=ve.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(k,S){return!ve.isUndefined(S[k])});const a=n.metaTokens,l=n.visitor||p,o=n.dots,c=n.indexes,m=(n.Blob||typeof Blob<"u"&&Blob)&&ve.isSpecCompliantForm(t);if(!ve.isFunction(l))throw new TypeError("visitor must be a function");function f(N){if(N===null)return"";if(ve.isDate(N))return N.toISOString();if(ve.isBoolean(N))return N.toString();if(!m&&ve.isBlob(N))throw new ft("Blob is not supported. Use a Buffer instead.");return ve.isArrayBuffer(N)||ve.isTypedArray(N)?m&&typeof Blob=="function"?new Blob([N]):Buffer.from(N):N}function p(N,k,S){let T=N;if(N&&!S&&typeof N=="object"){if(ve.endsWith(k,"{}"))k=a?k:k.slice(0,-2),N=JSON.stringify(N);else if(ve.isArray(N)&&T_(N)||(ve.isFileList(N)||ve.endsWith(k,"[]"))&&(T=ve.toArray(N)))return k=w6(k),T.forEach(function(A,R){!(ve.isUndefined(A)||A===null)&&t.append(c===!0?nb([k],R,o):c===null?k:k+"[]",f(A))}),!1}return Cx(N)?!0:(t.append(nb(S,k,o),f(N)),!1)}const x=[],y=Object.assign(__,{defaultVisitor:p,convertValue:f,isVisitable:Cx});function b(N,k){if(!ve.isUndefined(N)){if(x.indexOf(N)!==-1)throw Error("Circular reference detected in "+k.join("."));x.push(N),ve.forEach(N,function(T,M){(!(ve.isUndefined(T)||T===null)&&l.call(t,T,ve.isString(M)?M.trim():M,k,y))===!0&&b(T,k?k.concat(M):[M])}),x.pop()}}if(!ve.isObject(e))throw new TypeError("data must be an object");return b(e),t}function rb(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(a){return t[a]})}function C1(e,t){this._pairs=[],e&&Mm(e,this,t)}const j6=C1.prototype;j6.append=function(t,n){this._pairs.push([t,n])};j6.toString=function(t){const n=t?function(a){return t.call(this,a,rb)}:rb;return this._pairs.map(function(l){return n(l[0])+"="+n(l[1])},"").join("&")};function E_(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function N6(e,t,n){if(!t)return e;const a=n&&n.encode||E_;ve.isFunction(n)&&(n={serialize:n});const l=n&&n.serialize;let o;if(l?o=l(t,n):o=ve.isURLSearchParams(t)?t.toString():new C1(t,n).toString(a),o){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class ab{constructor(){this.handlers=[]}use(t,n,a){return this.handlers.push({fulfilled:t,rejected:n,synchronous:a?a.synchronous:!1,runWhen:a?a.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ve.forEach(this.handlers,function(a){a!==null&&t(a)})}}const S6={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},M_=typeof URLSearchParams<"u"?URLSearchParams:C1,A_=typeof FormData<"u"?FormData:null,D_=typeof Blob<"u"?Blob:null,z_={isBrowser:!0,classes:{URLSearchParams:M_,FormData:A_,Blob:D_},protocols:["http","https","file","blob","url","data"]},T1=typeof window<"u"&&typeof document<"u",Tx=typeof navigator=="object"&&navigator||void 0,O_=T1&&(!Tx||["ReactNative","NativeScript","NS"].indexOf(Tx.product)<0),R_=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",L_=T1&&window.location.href||"http://localhost",B_=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:T1,hasStandardBrowserEnv:O_,hasStandardBrowserWebWorkerEnv:R_,navigator:Tx,origin:L_},Symbol.toStringTag,{value:"Module"})),br={...B_,...z_};function P_(e,t){return Mm(e,new br.classes.URLSearchParams,{visitor:function(n,a,l,o){return br.isNode&&ve.isBuffer(n)?(this.append(a,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function F_(e){return ve.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function I_(e){const t={},n=Object.keys(e);let a;const l=n.length;let o;for(a=0;a=n.length;return c=!c&&ve.isArray(l)?l.length:c,m?(ve.hasOwnProp(l,c)?l[c]=[l[c],a]:l[c]=a,!d):((!l[c]||!ve.isObject(l[c]))&&(l[c]=[]),t(n,a,l[c],o)&&ve.isArray(l[c])&&(l[c]=I_(l[c])),!d)}if(ve.isFormData(e)&&ve.isFunction(e.entries)){const n={};return ve.forEachEntry(e,(a,l)=>{t(F_(a),l,n,0)}),n}return null}function q_(e,t,n){if(ve.isString(e))try{return(t||JSON.parse)(e),ve.trim(e)}catch(a){if(a.name!=="SyntaxError")throw a}return(n||JSON.stringify)(e)}const Bu={transitional:S6,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const a=n.getContentType()||"",l=a.indexOf("application/json")>-1,o=ve.isObject(t);if(o&&ve.isHTMLForm(t)&&(t=new FormData(t)),ve.isFormData(t))return l?JSON.stringify(k6(t)):t;if(ve.isArrayBuffer(t)||ve.isBuffer(t)||ve.isStream(t)||ve.isFile(t)||ve.isBlob(t)||ve.isReadableStream(t))return t;if(ve.isArrayBufferView(t))return t.buffer;if(ve.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let d;if(o){if(a.indexOf("application/x-www-form-urlencoded")>-1)return P_(t,this.formSerializer).toString();if((d=ve.isFileList(t))||a.indexOf("multipart/form-data")>-1){const m=this.env&&this.env.FormData;return Mm(d?{"files[]":t}:t,m&&new m,this.formSerializer)}}return o||l?(n.setContentType("application/json",!1),q_(t)):t}],transformResponse:[function(t){const n=this.transitional||Bu.transitional,a=n&&n.forcedJSONParsing,l=this.responseType==="json";if(ve.isResponse(t)||ve.isReadableStream(t))return t;if(t&&ve.isString(t)&&(a&&!this.responseType||l)){const c=!(n&&n.silentJSONParsing)&&l;try{return JSON.parse(t,this.parseReviver)}catch(d){if(c)throw d.name==="SyntaxError"?ft.from(d,ft.ERR_BAD_RESPONSE,this,null,this.response):d}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:br.classes.FormData,Blob:br.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ve.forEach(["delete","get","head","post","put","patch"],e=>{Bu.headers[e]={}});const H_=ve.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"]),U_=e=>{const t={};let n,a,l;return e&&e.split(` +`).forEach(function(c){l=c.indexOf(":"),n=c.substring(0,l).trim().toLowerCase(),a=c.substring(l+1).trim(),!(!n||t[n]&&H_[n])&&(n==="set-cookie"?t[n]?t[n].push(a):t[n]=[a]:t[n]=t[n]?t[n]+", "+a:a)}),t},sb=Symbol("internals");function Kc(e){return e&&String(e).trim().toLowerCase()}function V0(e){return e===!1||e==null?e:ve.isArray(e)?e.map(V0):String(e)}function $_(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let a;for(;a=n.exec(e);)t[a[1]]=a[2];return t}const V_=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Np(e,t,n,a,l){if(ve.isFunction(a))return a.call(this,t,n);if(l&&(t=n),!!ve.isString(t)){if(ve.isString(a))return t.indexOf(a)!==-1;if(ve.isRegExp(a))return a.test(t)}}function G_(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,a)=>n.toUpperCase()+a)}function Y_(e,t){const n=ve.toCamelCase(" "+t);["get","set","has"].forEach(a=>{Object.defineProperty(e,a+n,{value:function(l,o,c){return this[a].call(this,t,l,o,c)},configurable:!0})})}let Gr=class{constructor(t){t&&this.set(t)}set(t,n,a){const l=this;function o(d,m,f){const p=Kc(m);if(!p)throw new Error("header name must be a non-empty string");const x=ve.findKey(l,p);(!x||l[x]===void 0||f===!0||f===void 0&&l[x]!==!1)&&(l[x||m]=V0(d))}const c=(d,m)=>ve.forEach(d,(f,p)=>o(f,p,m));if(ve.isPlainObject(t)||t instanceof this.constructor)c(t,n);else if(ve.isString(t)&&(t=t.trim())&&!V_(t))c(U_(t),n);else if(ve.isObject(t)&&ve.isIterable(t)){let d={},m,f;for(const p of t){if(!ve.isArray(p))throw TypeError("Object iterator must return a key-value pair");d[f=p[0]]=(m=d[f])?ve.isArray(m)?[...m,p[1]]:[m,p[1]]:p[1]}c(d,n)}else t!=null&&o(n,t,a);return this}get(t,n){if(t=Kc(t),t){const a=ve.findKey(this,t);if(a){const l=this[a];if(!n)return l;if(n===!0)return $_(l);if(ve.isFunction(n))return n.call(this,l,a);if(ve.isRegExp(n))return n.exec(l);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Kc(t),t){const a=ve.findKey(this,t);return!!(a&&this[a]!==void 0&&(!n||Np(this,this[a],a,n)))}return!1}delete(t,n){const a=this;let l=!1;function o(c){if(c=Kc(c),c){const d=ve.findKey(a,c);d&&(!n||Np(a,a[d],d,n))&&(delete a[d],l=!0)}}return ve.isArray(t)?t.forEach(o):o(t),l}clear(t){const n=Object.keys(this);let a=n.length,l=!1;for(;a--;){const o=n[a];(!t||Np(this,this[o],o,t,!0))&&(delete this[o],l=!0)}return l}normalize(t){const n=this,a={};return ve.forEach(this,(l,o)=>{const c=ve.findKey(a,o);if(c){n[c]=V0(l),delete n[o];return}const d=t?G_(o):String(o).trim();d!==o&&delete n[o],n[d]=V0(l),a[d]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return ve.forEach(this,(a,l)=>{a!=null&&a!==!1&&(n[l]=t&&ve.isArray(a)?a.join(", "):a)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const a=new this(t);return n.forEach(l=>a.set(l)),a}static accessor(t){const a=(this[sb]=this[sb]={accessors:{}}).accessors,l=this.prototype;function o(c){const d=Kc(c);a[d]||(Y_(l,c),a[d]=!0)}return ve.isArray(t)?t.forEach(o):o(t),this}};Gr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ve.reduceDescriptors(Gr.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(a){this[n]=a}}});ve.freezeMethods(Gr);function Sp(e,t){const n=this||Bu,a=t||n,l=Gr.from(a.headers);let o=a.data;return ve.forEach(e,function(d){o=d.call(n,o,l.normalize(),t?t.status:void 0)}),l.normalize(),o}function C6(e){return!!(e&&e.__CANCEL__)}function Yo(e,t,n){ft.call(this,e??"canceled",ft.ERR_CANCELED,t,n),this.name="CanceledError"}ve.inherits(Yo,ft,{__CANCEL__:!0});function T6(e,t,n){const a=n.config.validateStatus;!n.status||!a||a(n.status)?e(n):t(new ft("Request failed with status code "+n.status,[ft.ERR_BAD_REQUEST,ft.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function W_(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function X_(e,t){e=e||10;const n=new Array(e),a=new Array(e);let l=0,o=0,c;return t=t!==void 0?t:1e3,function(m){const f=Date.now(),p=a[o];c||(c=f),n[l]=m,a[l]=f;let x=o,y=0;for(;x!==l;)y+=n[x++],x=x%e;if(l=(l+1)%e,l===o&&(o=(o+1)%e),f-c{n=p,l=null,o&&(clearTimeout(o),o=null),e(...f)};return[(...f)=>{const p=Date.now(),x=p-n;x>=a?c(f,p):(l=f,o||(o=setTimeout(()=>{o=null,c(l)},a-x)))},()=>l&&c(l)]}const rm=(e,t,n=3)=>{let a=0;const l=X_(50,250);return K_(o=>{const c=o.loaded,d=o.lengthComputable?o.total:void 0,m=c-a,f=l(m),p=c<=d;a=c;const x={loaded:c,total:d,progress:d?c/d:void 0,bytes:m,rate:f||void 0,estimated:f&&d&&p?(d-c)/f:void 0,event:o,lengthComputable:d!=null,[t?"download":"upload"]:!0};e(x)},n)},lb=(e,t)=>{const n=e!=null;return[a=>t[0]({lengthComputable:n,total:e,loaded:a}),t[1]]},ib=e=>(...t)=>ve.asap(()=>e(...t)),Q_=br.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,br.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(br.origin),br.navigator&&/(msie|trident)/i.test(br.navigator.userAgent)):()=>!0,Z_=br.hasStandardBrowserEnv?{write(e,t,n,a,l,o,c){if(typeof document>"u")return;const d=[`${e}=${encodeURIComponent(t)}`];ve.isNumber(n)&&d.push(`expires=${new Date(n).toUTCString()}`),ve.isString(a)&&d.push(`path=${a}`),ve.isString(l)&&d.push(`domain=${l}`),o===!0&&d.push("secure"),ve.isString(c)&&d.push(`SameSite=${c}`),document.cookie=d.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function J_(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function eE(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function _6(e,t,n){let a=!J_(t);return e&&(a||n==!1)?eE(e,t):t}const ob=e=>e instanceof Gr?{...e}:e;function gi(e,t){t=t||{};const n={};function a(f,p,x,y){return ve.isPlainObject(f)&&ve.isPlainObject(p)?ve.merge.call({caseless:y},f,p):ve.isPlainObject(p)?ve.merge({},p):ve.isArray(p)?p.slice():p}function l(f,p,x,y){if(ve.isUndefined(p)){if(!ve.isUndefined(f))return a(void 0,f,x,y)}else return a(f,p,x,y)}function o(f,p){if(!ve.isUndefined(p))return a(void 0,p)}function c(f,p){if(ve.isUndefined(p)){if(!ve.isUndefined(f))return a(void 0,f)}else return a(void 0,p)}function d(f,p,x){if(x in t)return a(f,p);if(x in e)return a(void 0,f)}const m={url:o,method:o,data:o,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:d,headers:(f,p,x)=>l(ob(f),ob(p),x,!0)};return ve.forEach(Object.keys({...e,...t}),function(p){const x=m[p]||l,y=x(e[p],t[p],p);ve.isUndefined(y)&&x!==d||(n[p]=y)}),n}const E6=e=>{const t=gi({},e);let{data:n,withXSRFToken:a,xsrfHeaderName:l,xsrfCookieName:o,headers:c,auth:d}=t;if(t.headers=c=Gr.from(c),t.url=N6(_6(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),d&&c.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):""))),ve.isFormData(n)){if(br.hasStandardBrowserEnv||br.hasStandardBrowserWebWorkerEnv)c.setContentType(void 0);else if(ve.isFunction(n.getHeaders)){const m=n.getHeaders(),f=["content-type","content-length"];Object.entries(m).forEach(([p,x])=>{f.includes(p.toLowerCase())&&c.set(p,x)})}}if(br.hasStandardBrowserEnv&&(a&&ve.isFunction(a)&&(a=a(t)),a||a!==!1&&Q_(t.url))){const m=l&&o&&Z_.read(o);m&&c.set(l,m)}return t},tE=typeof XMLHttpRequest<"u",nE=tE&&function(e){return new Promise(function(n,a){const l=E6(e);let o=l.data;const c=Gr.from(l.headers).normalize();let{responseType:d,onUploadProgress:m,onDownloadProgress:f}=l,p,x,y,b,N;function k(){b&&b(),N&&N(),l.cancelToken&&l.cancelToken.unsubscribe(p),l.signal&&l.signal.removeEventListener("abort",p)}let S=new XMLHttpRequest;S.open(l.method.toUpperCase(),l.url,!0),S.timeout=l.timeout;function T(){if(!S)return;const A=Gr.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),B={data:!d||d==="text"||d==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:A,config:e,request:S};T6(function(L){n(L),k()},function(L){a(L),k()},B),S=null}"onloadend"in S?S.onloadend=T:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(T)},S.onabort=function(){S&&(a(new ft("Request aborted",ft.ECONNABORTED,e,S)),S=null)},S.onerror=function(R){const B=R&&R.message?R.message:"Network Error",O=new ft(B,ft.ERR_NETWORK,e,S);O.event=R||null,a(O),S=null},S.ontimeout=function(){let R=l.timeout?"timeout of "+l.timeout+"ms exceeded":"timeout exceeded";const B=l.transitional||S6;l.timeoutErrorMessage&&(R=l.timeoutErrorMessage),a(new ft(R,B.clarifyTimeoutError?ft.ETIMEDOUT:ft.ECONNABORTED,e,S)),S=null},o===void 0&&c.setContentType(null),"setRequestHeader"in S&&ve.forEach(c.toJSON(),function(R,B){S.setRequestHeader(B,R)}),ve.isUndefined(l.withCredentials)||(S.withCredentials=!!l.withCredentials),d&&d!=="json"&&(S.responseType=l.responseType),f&&([y,N]=rm(f,!0),S.addEventListener("progress",y)),m&&S.upload&&([x,b]=rm(m),S.upload.addEventListener("progress",x),S.upload.addEventListener("loadend",b)),(l.cancelToken||l.signal)&&(p=A=>{S&&(a(!A||A.type?new Yo(null,e,S):A),S.abort(),S=null)},l.cancelToken&&l.cancelToken.subscribe(p),l.signal&&(l.signal.aborted?p():l.signal.addEventListener("abort",p)));const M=W_(l.url);if(M&&br.protocols.indexOf(M)===-1){a(new ft("Unsupported protocol "+M+":",ft.ERR_BAD_REQUEST,e));return}S.send(o||null)})},rE=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let a=new AbortController,l;const o=function(f){if(!l){l=!0,d();const p=f instanceof Error?f:this.reason;a.abort(p instanceof ft?p:new Yo(p instanceof Error?p.message:p))}};let c=t&&setTimeout(()=>{c=null,o(new ft(`timeout ${t} of ms exceeded`,ft.ETIMEDOUT))},t);const d=()=>{e&&(c&&clearTimeout(c),c=null,e.forEach(f=>{f.unsubscribe?f.unsubscribe(o):f.removeEventListener("abort",o)}),e=null)};e.forEach(f=>f.addEventListener("abort",o));const{signal:m}=a;return m.unsubscribe=()=>ve.asap(d),m}},aE=function*(e,t){let n=e.byteLength;if(n{const l=sE(e,t);let o=0,c,d=m=>{c||(c=!0,a&&a(m))};return new ReadableStream({async pull(m){try{const{done:f,value:p}=await l.next();if(f){d(),m.close();return}let x=p.byteLength;if(n){let y=o+=x;n(y)}m.enqueue(new Uint8Array(p))}catch(f){throw d(f),f}},cancel(m){return d(m),l.return()}},{highWaterMark:2})},ub=64*1024,{isFunction:j0}=ve,iE=(({Request:e,Response:t})=>({Request:e,Response:t}))(ve.global),{ReadableStream:db,TextEncoder:mb}=ve.global,hb=(e,...t)=>{try{return!!e(...t)}catch{return!1}},oE=e=>{e=ve.merge.call({skipUndefined:!0},iE,e);const{fetch:t,Request:n,Response:a}=e,l=t?j0(t):typeof fetch=="function",o=j0(n),c=j0(a);if(!l)return!1;const d=l&&j0(db),m=l&&(typeof mb=="function"?(N=>k=>N.encode(k))(new mb):async N=>new Uint8Array(await new n(N).arrayBuffer())),f=o&&d&&hb(()=>{let N=!1;const k=new n(br.origin,{body:new db,method:"POST",get duplex(){return N=!0,"half"}}).headers.has("Content-Type");return N&&!k}),p=c&&d&&hb(()=>ve.isReadableStream(new a("").body)),x={stream:p&&(N=>N.body)};l&&["text","arrayBuffer","blob","formData","stream"].forEach(N=>{!x[N]&&(x[N]=(k,S)=>{let T=k&&k[N];if(T)return T.call(k);throw new ft(`Response type '${N}' is not supported`,ft.ERR_NOT_SUPPORT,S)})});const y=async N=>{if(N==null)return 0;if(ve.isBlob(N))return N.size;if(ve.isSpecCompliantForm(N))return(await new n(br.origin,{method:"POST",body:N}).arrayBuffer()).byteLength;if(ve.isArrayBufferView(N)||ve.isArrayBuffer(N))return N.byteLength;if(ve.isURLSearchParams(N)&&(N=N+""),ve.isString(N))return(await m(N)).byteLength},b=async(N,k)=>{const S=ve.toFiniteNumber(N.getContentLength());return S??y(k)};return async N=>{let{url:k,method:S,data:T,signal:M,cancelToken:A,timeout:R,onDownloadProgress:B,onUploadProgress:O,responseType:L,headers:$,withCredentials:U="same-origin",fetchOptions:I}=E6(N),G=t||fetch;L=L?(L+"").toLowerCase():"text";let ee=rE([M,A&&A.toAbortSignal()],R),Ne=null;const J=ee&&ee.unsubscribe&&(()=>{ee.unsubscribe()});let se;try{if(O&&f&&S!=="get"&&S!=="head"&&(se=await b($,T))!==0){let we=new n(k,{method:"POST",body:T,duplex:"half"}),Z;if(ve.isFormData(T)&&(Z=we.headers.get("content-type"))&&$.setContentType(Z),we.body){const[z,X]=lb(se,rm(ib(O)));T=cb(we.body,ub,z,X)}}ve.isString(U)||(U=U?"include":"omit");const H=o&&"credentials"in n.prototype,le={...I,signal:ee,method:S.toUpperCase(),headers:$.normalize().toJSON(),body:T,duplex:"half",credentials:H?U:void 0};Ne=o&&new n(k,le);let re=await(o?G(Ne,I):G(k,le));const ge=p&&(L==="stream"||L==="response");if(p&&(B||ge&&J)){const we={};["status","statusText","headers"].forEach(q=>{we[q]=re[q]});const Z=ve.toFiniteNumber(re.headers.get("content-length")),[z,X]=B&&lb(Z,rm(ib(B),!0))||[];re=new a(cb(re.body,ub,z,()=>{X&&X(),J&&J()}),we)}L=L||"text";let E=await x[ve.findKey(x,L)||"text"](re,N);return!ge&&J&&J(),await new Promise((we,Z)=>{T6(we,Z,{data:E,headers:Gr.from(re.headers),status:re.status,statusText:re.statusText,config:N,request:Ne})})}catch(H){throw J&&J(),H&&H.name==="TypeError"&&/Load failed|fetch/i.test(H.message)?Object.assign(new ft("Network Error",ft.ERR_NETWORK,N,Ne),{cause:H.cause||H}):ft.from(H,H&&H.code,N,Ne)}}},cE=new Map,M6=e=>{let t=e&&e.env||{};const{fetch:n,Request:a,Response:l}=t,o=[a,l,n];let c=o.length,d=c,m,f,p=cE;for(;d--;)m=o[d],f=p.get(m),f===void 0&&p.set(m,f=d?new Map:oE(t)),p=f;return f};M6();const _1={http:C_,xhr:nE,fetch:{get:M6}};ve.forEach(_1,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const fb=e=>`- ${e}`,uE=e=>ve.isFunction(e)||e===null||e===!1;function dE(e,t){e=ve.isArray(e)?e:[e];const{length:n}=e;let a,l;const o={};for(let c=0;c`adapter ${m} `+(f===!1?"is not supported by the environment":"is not available in the build"));let d=n?c.length>1?`since : +`+c.map(fb).join(` +`):" "+fb(c[0]):"as no adapter specified";throw new ft("There is no suitable adapter to dispatch the request "+d,"ERR_NOT_SUPPORT")}return l}const A6={getAdapter:dE,adapters:_1};function kp(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Yo(null,e)}function pb(e){return kp(e),e.headers=Gr.from(e.headers),e.data=Sp.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),A6.getAdapter(e.adapter||Bu.adapter,e)(e).then(function(a){return kp(e),a.data=Sp.call(e,e.transformResponse,a),a.headers=Gr.from(a.headers),a},function(a){return C6(a)||(kp(e),a&&a.response&&(a.response.data=Sp.call(e,e.transformResponse,a.response),a.response.headers=Gr.from(a.response.headers))),Promise.reject(a)})}const D6="1.13.2",Am={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Am[e]=function(a){return typeof a===e||"a"+(t<1?"n ":" ")+e}});const xb={};Am.transitional=function(t,n,a){function l(o,c){return"[Axios v"+D6+"] Transitional option '"+o+"'"+c+(a?". "+a:"")}return(o,c,d)=>{if(t===!1)throw new ft(l(c," has been removed"+(n?" in "+n:"")),ft.ERR_DEPRECATED);return n&&!xb[c]&&(xb[c]=!0,console.warn(l(c," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,c,d):!0}};Am.spelling=function(t){return(n,a)=>(console.warn(`${a} is likely a misspelling of ${t}`),!0)};function mE(e,t,n){if(typeof e!="object")throw new ft("options must be an object",ft.ERR_BAD_OPTION_VALUE);const a=Object.keys(e);let l=a.length;for(;l-- >0;){const o=a[l],c=t[o];if(c){const d=e[o],m=d===void 0||c(d,o,e);if(m!==!0)throw new ft("option "+o+" must be "+m,ft.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ft("Unknown option "+o,ft.ERR_BAD_OPTION)}}const G0={assertOptions:mE,validators:Am},Xa=G0.validators;let fi=class{constructor(t){this.defaults=t||{},this.interceptors={request:new ab,response:new ab}}async request(t,n){try{return await this._request(t,n)}catch(a){if(a instanceof Error){let l={};Error.captureStackTrace?Error.captureStackTrace(l):l=new Error;const o=l.stack?l.stack.replace(/^.+\n/,""):"";try{a.stack?o&&!String(a.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(a.stack+=` +`+o):a.stack=o}catch{}}throw a}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=gi(this.defaults,n);const{transitional:a,paramsSerializer:l,headers:o}=n;a!==void 0&&G0.assertOptions(a,{silentJSONParsing:Xa.transitional(Xa.boolean),forcedJSONParsing:Xa.transitional(Xa.boolean),clarifyTimeoutError:Xa.transitional(Xa.boolean)},!1),l!=null&&(ve.isFunction(l)?n.paramsSerializer={serialize:l}:G0.assertOptions(l,{encode:Xa.function,serialize:Xa.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),G0.assertOptions(n,{baseUrl:Xa.spelling("baseURL"),withXsrfToken:Xa.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let c=o&&ve.merge(o.common,o[n.method]);o&&ve.forEach(["delete","get","head","post","put","patch","common"],N=>{delete o[N]}),n.headers=Gr.concat(c,o);const d=[];let m=!0;this.interceptors.request.forEach(function(k){typeof k.runWhen=="function"&&k.runWhen(n)===!1||(m=m&&k.synchronous,d.unshift(k.fulfilled,k.rejected))});const f=[];this.interceptors.response.forEach(function(k){f.push(k.fulfilled,k.rejected)});let p,x=0,y;if(!m){const N=[pb.bind(this),void 0];for(N.unshift(...d),N.push(...f),y=N.length,p=Promise.resolve(n);x{if(!a._listeners)return;let o=a._listeners.length;for(;o-- >0;)a._listeners[o](l);a._listeners=null}),this.promise.then=l=>{let o;const c=new Promise(d=>{a.subscribe(d),o=d}).then(l);return c.cancel=function(){a.unsubscribe(o)},c},t(function(o,c,d){a.reason||(a.reason=new Yo(o,c,d),n(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=a=>{t.abort(a)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new z6(function(l){t=l}),cancel:t}}};function fE(e){return function(n){return e.apply(null,n)}}function pE(e){return ve.isObject(e)&&e.isAxiosError===!0}const _x={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(_x).forEach(([e,t])=>{_x[t]=e});function O6(e){const t=new fi(e),n=d6(fi.prototype.request,t);return ve.extend(n,fi.prototype,t,{allOwnKeys:!0}),ve.extend(n,t,null,{allOwnKeys:!0}),n.create=function(l){return O6(gi(e,l))},n}const An=O6(Bu);An.Axios=fi;An.CanceledError=Yo;An.CancelToken=hE;An.isCancel=C6;An.VERSION=D6;An.toFormData=Mm;An.AxiosError=ft;An.Cancel=An.CanceledError;An.all=function(t){return Promise.all(t)};An.spread=fE;An.isAxiosError=pE;An.mergeConfig=gi;An.AxiosHeaders=Gr;An.formToJSON=e=>k6(ve.isHTMLForm(e)?new FormData(e):e);An.getAdapter=A6.getAdapter;An.HttpStatusCode=_x;An.default=An;const{Axios:wK,AxiosError:jK,CanceledError:NK,isCancel:SK,CancelToken:kK,VERSION:CK,all:TK,Cancel:_K,isAxiosError:EK,spread:MK,toFormData:AK,AxiosHeaders:DK,HttpStatusCode:zK,formToJSON:OK,getAdapter:RK,mergeConfig:LK}=An,xE=(e,t)=>{const n=new Array(e.length+t.length);for(let a=0;a({classGroupId:e,validator:t}),R6=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),am="-",gb=[],vE="arbitrary..",yE=e=>{const t=wE(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return bE(c);const d=c.split(am),m=d[0]===""&&d.length>1?1:0;return L6(d,m,t)},getConflictingClassGroupIds:(c,d)=>{if(d){const m=a[c],f=n[c];return m?f?xE(f,m):m:f||gb}return n[c]||gb}}},L6=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const l=e[t],o=n.nextPart.get(l);if(o){const f=L6(e,t+1,o);if(f)return f}const c=n.validators;if(c===null)return;const d=t===0?e.join(am):e.slice(t).join(am),m=c.length;for(let f=0;fe.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),a=t.slice(0,n);return a?vE+a:void 0})(),wE=e=>{const{theme:t,classGroups:n}=e;return jE(n,t)},jE=(e,t)=>{const n=R6();for(const a in e){const l=e[a];E1(l,n,a,t)}return n},E1=(e,t,n,a)=>{const l=e.length;for(let o=0;o{if(typeof e=="string"){SE(e,t,n);return}if(typeof e=="function"){kE(e,t,n,a);return}CE(e,t,n,a)},SE=(e,t,n)=>{const a=e===""?t:B6(t,e);a.classGroupId=n},kE=(e,t,n,a)=>{if(TE(e)){E1(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(gE(n,e))},CE=(e,t,n,a)=>{const l=Object.entries(e),o=l.length;for(let c=0;c{let n=e;const a=t.split(am),l=a.length;for(let o=0;o"isThemeGetter"in e&&e.isThemeGetter===!0,_E=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),a=Object.create(null);const l=(o,c)=>{n[o]=c,t++,t>e&&(t=0,a=n,n=Object.create(null))};return{get(o){let c=n[o];if(c!==void 0)return c;if((c=a[o])!==void 0)return l(o,c),c},set(o,c){o in n?n[o]=c:l(o,c)}}},Ex="!",vb=":",EE=[],yb=(e,t,n,a,l)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:l}),ME=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=l=>{const o=[];let c=0,d=0,m=0,f;const p=l.length;for(let k=0;km?f-m:void 0;return yb(o,b,y,N)};if(t){const l=t+vb,o=a;a=c=>c.startsWith(l)?o(c.slice(l.length)):yb(EE,!1,c,void 0,!0)}if(n){const l=a;a=o=>n({className:o,parseClassName:l})}return a},AE=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,a)=>{t.set(n,1e6+a)}),n=>{const a=[];let l=[];for(let o=0;o0&&(l.sort(),a.push(...l),l=[]),a.push(c)):l.push(c)}return l.length>0&&(l.sort(),a.push(...l)),a}},DE=e=>({cache:_E(e.cacheSize),parseClassName:ME(e),sortModifiers:AE(e),...yE(e)}),zE=/\s+/,OE=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:l,sortModifiers:o}=t,c=[],d=e.trim().split(zE);let m="";for(let f=d.length-1;f>=0;f-=1){const p=d[f],{isExternal:x,modifiers:y,hasImportantModifier:b,baseClassName:N,maybePostfixModifierPosition:k}=n(p);if(x){m=p+(m.length>0?" "+m:m);continue}let S=!!k,T=a(S?N.substring(0,k):N);if(!T){if(!S){m=p+(m.length>0?" "+m:m);continue}if(T=a(N),!T){m=p+(m.length>0?" "+m:m);continue}S=!1}const M=y.length===0?"":y.length===1?y[0]:o(y).join(":"),A=b?M+Ex:M,R=A+T;if(c.indexOf(R)>-1)continue;c.push(R);const B=l(T,S);for(let O=0;O0?" "+m:m)}return m},RE=(...e)=>{let t=0,n,a,l="";for(;t{if(typeof e=="string")return e;let t,n="";for(let a=0;a{let n,a,l,o;const c=m=>{const f=t.reduce((p,x)=>x(p),e());return n=DE(f),a=n.cache.get,l=n.cache.set,o=d,d(m)},d=m=>{const f=a(m);if(f)return f;const p=OE(m,n);return l(m,p),p};return o=c,(...m)=>o(RE(...m))},BE=[],Kn=e=>{const t=n=>n[e]||BE;return t.isThemeGetter=!0,t},F6=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,I6=/^\((?:(\w[\w-]*):)?(.+)\)$/i,PE=/^\d+\/\d+$/,FE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,IE=/\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$/,qE=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,HE=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,UE=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,vo=e=>PE.test(e),wt=e=>!!e&&!Number.isNaN(Number(e)),xl=e=>!!e&&Number.isInteger(Number(e)),Cp=e=>e.endsWith("%")&&wt(e.slice(0,-1)),Es=e=>FE.test(e),$E=()=>!0,VE=e=>IE.test(e)&&!qE.test(e),q6=()=>!1,GE=e=>HE.test(e),YE=e=>UE.test(e),WE=e=>!Ve(e)&&!Ge(e),XE=e=>Wo(e,$6,q6),Ve=e=>F6.test(e),ai=e=>Wo(e,V6,VE),Tp=e=>Wo(e,eM,wt),bb=e=>Wo(e,H6,q6),KE=e=>Wo(e,U6,YE),N0=e=>Wo(e,G6,GE),Ge=e=>I6.test(e),Qc=e=>Xo(e,V6),QE=e=>Xo(e,tM),wb=e=>Xo(e,H6),ZE=e=>Xo(e,$6),JE=e=>Xo(e,U6),S0=e=>Xo(e,G6,!0),Wo=(e,t,n)=>{const a=F6.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},Xo=(e,t,n=!1)=>{const a=I6.exec(e);return a?a[1]?t(a[1]):n:!1},H6=e=>e==="position"||e==="percentage",U6=e=>e==="image"||e==="url",$6=e=>e==="length"||e==="size"||e==="bg-size",V6=e=>e==="length",eM=e=>e==="number",tM=e=>e==="family-name",G6=e=>e==="shadow",nM=()=>{const e=Kn("color"),t=Kn("font"),n=Kn("text"),a=Kn("font-weight"),l=Kn("tracking"),o=Kn("leading"),c=Kn("breakpoint"),d=Kn("container"),m=Kn("spacing"),f=Kn("radius"),p=Kn("shadow"),x=Kn("inset-shadow"),y=Kn("text-shadow"),b=Kn("drop-shadow"),N=Kn("blur"),k=Kn("perspective"),S=Kn("aspect"),T=Kn("ease"),M=Kn("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],B=()=>[...R(),Ge,Ve],O=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],$=()=>[Ge,Ve,m],U=()=>[vo,"full","auto",...$()],I=()=>[xl,"none","subgrid",Ge,Ve],G=()=>["auto",{span:["full",xl,Ge,Ve]},xl,Ge,Ve],ee=()=>[xl,"auto",Ge,Ve],Ne=()=>["auto","min","max","fr",Ge,Ve],J=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],se=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...$()],le=()=>[vo,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...$()],re=()=>[e,Ge,Ve],ge=()=>[...R(),wb,bb,{position:[Ge,Ve]}],E=()=>["no-repeat",{repeat:["","x","y","space","round"]}],we=()=>["auto","cover","contain",ZE,XE,{size:[Ge,Ve]}],Z=()=>[Cp,Qc,ai],z=()=>["","none","full",f,Ge,Ve],X=()=>["",wt,Qc,ai],q=()=>["solid","dashed","dotted","double"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],fe=()=>[wt,Cp,wb,bb],De=()=>["","none",N,Ge,Ve],oe=()=>["none",wt,Ge,Ve],He=()=>["none",wt,Ge,Ve],at=()=>[wt,Ge,Ve],je=()=>[vo,"full",...$()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Es],breakpoint:[Es],color:[$E],container:[Es],"drop-shadow":[Es],ease:["in","out","in-out"],font:[WE],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Es],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Es],shadow:[Es],spacing:["px",wt],text:[Es],"text-shadow":[Es],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",vo,Ve,Ge,S]}],container:["container"],columns:[{columns:[wt,Ve,Ge,d]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"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"],sr:["sr-only","not-sr-only"],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:B()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:U()}],"inset-x":[{"inset-x":U()}],"inset-y":[{"inset-y":U()}],start:[{start:U()}],end:[{end:U()}],top:[{top:U()}],right:[{right:U()}],bottom:[{bottom:U()}],left:[{left:U()}],visibility:["visible","invisible","collapse"],z:[{z:[xl,"auto",Ge,Ve]}],basis:[{basis:[vo,"full","auto",d,...$()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[wt,vo,"auto","initial","none",Ve]}],grow:[{grow:["",wt,Ge,Ve]}],shrink:[{shrink:["",wt,Ge,Ve]}],order:[{order:[xl,"first","last","none",Ge,Ve]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:G()}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:G()}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ne()}],"auto-rows":[{"auto-rows":Ne()}],gap:[{gap:$()}],"gap-x":[{"gap-x":$()}],"gap-y":[{"gap-y":$()}],"justify-content":[{justify:[...J(),"normal"]}],"justify-items":[{"justify-items":[...se(),"normal"]}],"justify-self":[{"justify-self":["auto",...se()]}],"align-content":[{content:["normal",...J()]}],"align-items":[{items:[...se(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...se(),{baseline:["","last"]}]}],"place-content":[{"place-content":J()}],"place-items":[{"place-items":[...se(),"baseline"]}],"place-self":[{"place-self":["auto",...se()]}],p:[{p:$()}],px:[{px:$()}],py:[{py:$()}],ps:[{ps:$()}],pe:[{pe:$()}],pt:[{pt:$()}],pr:[{pr:$()}],pb:[{pb:$()}],pl:[{pl:$()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":$()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":$()}],"space-y-reverse":["space-y-reverse"],size:[{size:le()}],w:[{w:[d,"screen",...le()]}],"min-w":[{"min-w":[d,"screen","none",...le()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[c]},...le()]}],h:[{h:["screen","lh",...le()]}],"min-h":[{"min-h":["screen","lh","none",...le()]}],"max-h":[{"max-h":["screen","lh",...le()]}],"font-size":[{text:["base",n,Qc,ai]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,Ge,Tp]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Cp,Ve]}],"font-family":[{font:[QE,Ve,t]}],"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-fractions"],tracking:[{tracking:[l,Ge,Ve]}],"line-clamp":[{"line-clamp":[wt,"none",Ge,Tp]}],leading:[{leading:[o,...$()]}],"list-image":[{"list-image":["none",Ge,Ve]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ge,Ve]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:re()}],"text-color":[{text:re()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:[wt,"from-font","auto",Ge,ai]}],"text-decoration-color":[{decoration:re()}],"underline-offset":[{"underline-offset":[wt,"auto",Ge,Ve]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:$()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ge,Ve]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ge,Ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ge()}],"bg-repeat":[{bg:E()}],"bg-size":[{bg:we()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},xl,Ge,Ve],radial:["",Ge,Ve],conic:[xl,Ge,Ve]},JE,KE]}],"bg-color":[{bg:re()}],"gradient-from-pos":[{from:Z()}],"gradient-via-pos":[{via:Z()}],"gradient-to-pos":[{to:Z()}],"gradient-from":[{from:re()}],"gradient-via":[{via:re()}],"gradient-to":[{to:re()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:X()}],"border-w-x":[{"border-x":X()}],"border-w-y":[{"border-y":X()}],"border-w-s":[{"border-s":X()}],"border-w-e":[{"border-e":X()}],"border-w-t":[{"border-t":X()}],"border-w-r":[{"border-r":X()}],"border-w-b":[{"border-b":X()}],"border-w-l":[{"border-l":X()}],"divide-x":[{"divide-x":X()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":X()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...q(),"hidden","none"]}],"divide-style":[{divide:[...q(),"hidden","none"]}],"border-color":[{border:re()}],"border-color-x":[{"border-x":re()}],"border-color-y":[{"border-y":re()}],"border-color-s":[{"border-s":re()}],"border-color-e":[{"border-e":re()}],"border-color-t":[{"border-t":re()}],"border-color-r":[{"border-r":re()}],"border-color-b":[{"border-b":re()}],"border-color-l":[{"border-l":re()}],"divide-color":[{divide:re()}],"outline-style":[{outline:[...q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[wt,Ge,Ve]}],"outline-w":[{outline:["",wt,Qc,ai]}],"outline-color":[{outline:re()}],shadow:[{shadow:["","none",p,S0,N0]}],"shadow-color":[{shadow:re()}],"inset-shadow":[{"inset-shadow":["none",x,S0,N0]}],"inset-shadow-color":[{"inset-shadow":re()}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:re()}],"ring-offset-w":[{"ring-offset":[wt,ai]}],"ring-offset-color":[{"ring-offset":re()}],"inset-ring-w":[{"inset-ring":X()}],"inset-ring-color":[{"inset-ring":re()}],"text-shadow":[{"text-shadow":["none",y,S0,N0]}],"text-shadow-color":[{"text-shadow":re()}],opacity:[{opacity:[wt,Ge,Ve]}],"mix-blend":[{"mix-blend":[...ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[wt]}],"mask-image-linear-from-pos":[{"mask-linear-from":fe()}],"mask-image-linear-to-pos":[{"mask-linear-to":fe()}],"mask-image-linear-from-color":[{"mask-linear-from":re()}],"mask-image-linear-to-color":[{"mask-linear-to":re()}],"mask-image-t-from-pos":[{"mask-t-from":fe()}],"mask-image-t-to-pos":[{"mask-t-to":fe()}],"mask-image-t-from-color":[{"mask-t-from":re()}],"mask-image-t-to-color":[{"mask-t-to":re()}],"mask-image-r-from-pos":[{"mask-r-from":fe()}],"mask-image-r-to-pos":[{"mask-r-to":fe()}],"mask-image-r-from-color":[{"mask-r-from":re()}],"mask-image-r-to-color":[{"mask-r-to":re()}],"mask-image-b-from-pos":[{"mask-b-from":fe()}],"mask-image-b-to-pos":[{"mask-b-to":fe()}],"mask-image-b-from-color":[{"mask-b-from":re()}],"mask-image-b-to-color":[{"mask-b-to":re()}],"mask-image-l-from-pos":[{"mask-l-from":fe()}],"mask-image-l-to-pos":[{"mask-l-to":fe()}],"mask-image-l-from-color":[{"mask-l-from":re()}],"mask-image-l-to-color":[{"mask-l-to":re()}],"mask-image-x-from-pos":[{"mask-x-from":fe()}],"mask-image-x-to-pos":[{"mask-x-to":fe()}],"mask-image-x-from-color":[{"mask-x-from":re()}],"mask-image-x-to-color":[{"mask-x-to":re()}],"mask-image-y-from-pos":[{"mask-y-from":fe()}],"mask-image-y-to-pos":[{"mask-y-to":fe()}],"mask-image-y-from-color":[{"mask-y-from":re()}],"mask-image-y-to-color":[{"mask-y-to":re()}],"mask-image-radial":[{"mask-radial":[Ge,Ve]}],"mask-image-radial-from-pos":[{"mask-radial-from":fe()}],"mask-image-radial-to-pos":[{"mask-radial-to":fe()}],"mask-image-radial-from-color":[{"mask-radial-from":re()}],"mask-image-radial-to-color":[{"mask-radial-to":re()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":R()}],"mask-image-conic-pos":[{"mask-conic":[wt]}],"mask-image-conic-from-pos":[{"mask-conic-from":fe()}],"mask-image-conic-to-pos":[{"mask-conic-to":fe()}],"mask-image-conic-from-color":[{"mask-conic-from":re()}],"mask-image-conic-to-color":[{"mask-conic-to":re()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ge()}],"mask-repeat":[{mask:E()}],"mask-size":[{mask:we()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ge,Ve]}],filter:[{filter:["","none",Ge,Ve]}],blur:[{blur:De()}],brightness:[{brightness:[wt,Ge,Ve]}],contrast:[{contrast:[wt,Ge,Ve]}],"drop-shadow":[{"drop-shadow":["","none",b,S0,N0]}],"drop-shadow-color":[{"drop-shadow":re()}],grayscale:[{grayscale:["",wt,Ge,Ve]}],"hue-rotate":[{"hue-rotate":[wt,Ge,Ve]}],invert:[{invert:["",wt,Ge,Ve]}],saturate:[{saturate:[wt,Ge,Ve]}],sepia:[{sepia:["",wt,Ge,Ve]}],"backdrop-filter":[{"backdrop-filter":["","none",Ge,Ve]}],"backdrop-blur":[{"backdrop-blur":De()}],"backdrop-brightness":[{"backdrop-brightness":[wt,Ge,Ve]}],"backdrop-contrast":[{"backdrop-contrast":[wt,Ge,Ve]}],"backdrop-grayscale":[{"backdrop-grayscale":["",wt,Ge,Ve]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[wt,Ge,Ve]}],"backdrop-invert":[{"backdrop-invert":["",wt,Ge,Ve]}],"backdrop-opacity":[{"backdrop-opacity":[wt,Ge,Ve]}],"backdrop-saturate":[{"backdrop-saturate":[wt,Ge,Ve]}],"backdrop-sepia":[{"backdrop-sepia":["",wt,Ge,Ve]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":$()}],"border-spacing-x":[{"border-spacing-x":$()}],"border-spacing-y":[{"border-spacing-y":$()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ge,Ve]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[wt,"initial",Ge,Ve]}],ease:[{ease:["linear","initial",T,Ge,Ve]}],delay:[{delay:[wt,Ge,Ve]}],animate:[{animate:["none",M,Ge,Ve]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,Ge,Ve]}],"perspective-origin":[{"perspective-origin":B()}],rotate:[{rotate:oe()}],"rotate-x":[{"rotate-x":oe()}],"rotate-y":[{"rotate-y":oe()}],"rotate-z":[{"rotate-z":oe()}],scale:[{scale:He()}],"scale-x":[{"scale-x":He()}],"scale-y":[{"scale-y":He()}],"scale-z":[{"scale-z":He()}],"scale-3d":["scale-3d"],skew:[{skew:at()}],"skew-x":[{"skew-x":at()}],"skew-y":[{"skew-y":at()}],transform:[{transform:[Ge,Ve,"","none","gpu","cpu"]}],"transform-origin":[{origin:B()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:je()}],"translate-x":[{"translate-x":je()}],"translate-y":[{"translate-y":je()}],"translate-z":[{"translate-z":je()}],"translate-none":["translate-none"],accent:[{accent:re()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:re()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",Ge,Ve]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"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",Ge,Ve]}],fill:[{fill:["none",...re()]}],"stroke-w":[{stroke:[wt,Qc,ai,Tp]}],stroke:[{stroke:["none",...re()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},rM=LE(nM);function he(...e){return rM(P5(e))}const ct=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:he("rounded-xl border bg-card text-card-foreground shadow",e),...t}));ct.displayName="Card";const Lt=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:he("flex flex-col space-y-1.5 p-6",e),...t}));Lt.displayName="CardHeader";const Bt=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:he("font-semibold leading-none tracking-tight",e),...t}));Bt.displayName="CardTitle";const Qn=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:he("text-sm text-muted-foreground",e),...t}));Qn.displayName="CardDescription";const Gt=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:he("p-6 pt-0",e),...t}));Gt.displayName="CardContent";const Y6=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:he("flex items-center p-6 pt-0",e),...t}));Y6.displayName="CardFooter";var _p="rovingFocusGroup.onEntryFocus",aM={bubbles:!1,cancelable:!0},Pu="RovingFocusGroup",[Mx,W6,sM]=bm(Pu),[lM,Dm]=Ua(Pu,[sM]),[iM,oM]=lM(Pu),X6=w.forwardRef((e,t)=>r.jsx(Mx.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Mx.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(cM,{...e,ref:t})})}));X6.displayName=Pu;var cM=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:a,loop:l=!1,dir:o,currentTabStopId:c,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:m,onEntryFocus:f,preventScrollOnEntryFocus:p=!1,...x}=e,y=w.useRef(null),b=mn(t,y),N=Eu(o),[k,S]=zl({prop:c,defaultProp:d??null,onChange:m,caller:Pu}),[T,M]=w.useState(!1),A=yr(f),R=W6(n),B=w.useRef(!1),[O,L]=w.useState(0);return w.useEffect(()=>{const $=y.current;if($)return $.addEventListener(_p,A),()=>$.removeEventListener(_p,A)},[A]),r.jsx(iM,{scope:n,orientation:a,dir:N,loop:l,currentTabStopId:k,onItemFocus:w.useCallback($=>S($),[S]),onItemShiftTab:w.useCallback(()=>M(!0),[]),onFocusableItemAdd:w.useCallback(()=>L($=>$+1),[]),onFocusableItemRemove:w.useCallback(()=>L($=>$-1),[]),children:r.jsx(It.div,{tabIndex:T||O===0?-1:0,"data-orientation":a,...x,ref:b,style:{outline:"none",...e.style},onMouseDown:Pe(e.onMouseDown,()=>{B.current=!0}),onFocus:Pe(e.onFocus,$=>{const U=!B.current;if($.target===$.currentTarget&&U&&!T){const I=new CustomEvent(_p,aM);if($.currentTarget.dispatchEvent(I),!I.defaultPrevented){const G=R().filter(H=>H.focusable),ee=G.find(H=>H.active),Ne=G.find(H=>H.id===k),se=[ee,Ne,...G].filter(Boolean).map(H=>H.ref.current);Z6(se,p)}}B.current=!1}),onBlur:Pe(e.onBlur,()=>M(!1))})})}),K6="RovingFocusGroupItem",Q6=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:a=!0,active:l=!1,tabStopId:o,children:c,...d}=e,m=Ta(),f=o||m,p=oM(K6,n),x=p.currentTabStopId===f,y=W6(n),{onFocusableItemAdd:b,onFocusableItemRemove:N,currentTabStopId:k}=p;return w.useEffect(()=>{if(a)return b(),()=>N()},[a,b,N]),r.jsx(Mx.ItemSlot,{scope:n,id:f,focusable:a,active:l,children:r.jsx(It.span,{tabIndex:x?0:-1,"data-orientation":p.orientation,...d,ref:t,onMouseDown:Pe(e.onMouseDown,S=>{a?p.onItemFocus(f):S.preventDefault()}),onFocus:Pe(e.onFocus,()=>p.onItemFocus(f)),onKeyDown:Pe(e.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){p.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const T=mM(S,p.orientation,p.dir);if(T!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let A=y().filter(R=>R.focusable).map(R=>R.ref.current);if(T==="last")A.reverse();else if(T==="prev"||T==="next"){T==="prev"&&A.reverse();const R=A.indexOf(S.currentTarget);A=p.loop?hM(A,R+1):A.slice(R+1)}setTimeout(()=>Z6(A))}}),children:typeof c=="function"?c({isCurrentTabStop:x,hasTabStop:k!=null}):c})})});Q6.displayName=K6;var uM={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function dM(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function mM(e,t,n){const a=dM(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(a))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(a)))return uM[a]}function Z6(e,t=!1){const n=document.activeElement;for(const a of e)if(a===n||(a.focus({preventScroll:t}),document.activeElement!==n))return}function hM(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var J6=X6,ew=Q6,zm="Tabs",[fM]=Ua(zm,[Dm]),tw=Dm(),[pM,M1]=fM(zm),nw=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,onValueChange:l,defaultValue:o,orientation:c="horizontal",dir:d,activationMode:m="automatic",...f}=e,p=Eu(d),[x,y]=zl({prop:a,onChange:l,defaultProp:o??"",caller:zm});return r.jsx(pM,{scope:n,baseId:Ta(),value:x,onValueChange:y,orientation:c,dir:p,activationMode:m,children:r.jsx(It.div,{dir:p,"data-orientation":c,...f,ref:t})})});nw.displayName=zm;var rw="TabsList",aw=w.forwardRef((e,t)=>{const{__scopeTabs:n,loop:a=!0,...l}=e,o=M1(rw,n),c=tw(n);return r.jsx(J6,{asChild:!0,...c,orientation:o.orientation,dir:o.dir,loop:a,children:r.jsx(It.div,{role:"tablist","aria-orientation":o.orientation,...l,ref:t})})});aw.displayName=rw;var sw="TabsTrigger",lw=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,disabled:l=!1,...o}=e,c=M1(sw,n),d=tw(n),m=cw(c.baseId,a),f=uw(c.baseId,a),p=a===c.value;return r.jsx(ew,{asChild:!0,...d,focusable:!l,active:p,children:r.jsx(It.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":f,"data-state":p?"active":"inactive","data-disabled":l?"":void 0,disabled:l,id:m,...o,ref:t,onMouseDown:Pe(e.onMouseDown,x=>{!l&&x.button===0&&x.ctrlKey===!1?c.onValueChange(a):x.preventDefault()}),onKeyDown:Pe(e.onKeyDown,x=>{[" ","Enter"].includes(x.key)&&c.onValueChange(a)}),onFocus:Pe(e.onFocus,()=>{const x=c.activationMode!=="manual";!p&&!l&&x&&c.onValueChange(a)})})})});lw.displayName=sw;var iw="TabsContent",ow=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,forceMount:l,children:o,...c}=e,d=M1(iw,n),m=cw(d.baseId,a),f=uw(d.baseId,a),p=a===d.value,x=w.useRef(p);return w.useEffect(()=>{const y=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(y)},[]),r.jsx(Wr,{present:l||p,children:({present:y})=>r.jsx(It.div,{"data-state":p?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":m,hidden:!y,id:f,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:x.current?"0s":void 0},children:y&&o})})});ow.displayName=iw;function cw(e,t){return`${e}-trigger-${t}`}function uw(e,t){return`${e}-content-${t}`}var xM=nw,dw=aw,mw=lw,hw=ow;const kl=xM,Bs=w.forwardRef(({className:e,...t},n)=>r.jsx(dw,{ref:n,className:he("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));Bs.displayName=dw.displayName;const Pt=w.forwardRef(({className:e,...t},n)=>r.jsx(mw,{ref:n,className:he("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 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",e),...t}));Pt.displayName=mw.displayName;const cn=w.forwardRef(({className:e,...t},n)=>r.jsx(hw,{ref:n,className:he("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",e),...t}));cn.displayName=hw.displayName;function gM(e,t){return w.useReducer((n,a)=>t[n][a]??n,e)}var A1="ScrollArea",[fw]=Ua(A1),[vM,Aa]=fw(A1),pw=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:a="hover",dir:l,scrollHideDelay:o=600,...c}=e,[d,m]=w.useState(null),[f,p]=w.useState(null),[x,y]=w.useState(null),[b,N]=w.useState(null),[k,S]=w.useState(null),[T,M]=w.useState(0),[A,R]=w.useState(0),[B,O]=w.useState(!1),[L,$]=w.useState(!1),U=mn(t,G=>m(G)),I=Eu(l);return r.jsx(vM,{scope:n,type:a,dir:I,scrollHideDelay:o,scrollArea:d,viewport:f,onViewportChange:p,content:x,onContentChange:y,scrollbarX:b,onScrollbarXChange:N,scrollbarXEnabled:B,onScrollbarXEnabledChange:O,scrollbarY:k,onScrollbarYChange:S,scrollbarYEnabled:L,onScrollbarYEnabledChange:$,onCornerWidthChange:M,onCornerHeightChange:R,children:r.jsx(It.div,{dir:I,...c,ref:U,style:{position:"relative","--radix-scroll-area-corner-width":T+"px","--radix-scroll-area-corner-height":A+"px",...e.style}})})});pw.displayName=A1;var xw="ScrollAreaViewport",gw=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:a,nonce:l,...o}=e,c=Aa(xw,n),d=w.useRef(null),m=mn(t,d,c.onViewportChange);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:l}),r.jsx(It.div,{"data-radix-scroll-area-viewport":"",...o,ref:m,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...e.style},children:r.jsx("div",{ref:c.onContentChange,style:{minWidth:"100%",display:"table"},children:a})})]})});gw.displayName=xw;var ss="ScrollAreaScrollbar",D1=w.forwardRef((e,t)=>{const{forceMount:n,...a}=e,l=Aa(ss,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:c}=l,d=e.orientation==="horizontal";return w.useEffect(()=>(d?o(!0):c(!0),()=>{d?o(!1):c(!1)}),[d,o,c]),l.type==="hover"?r.jsx(yM,{...a,ref:t,forceMount:n}):l.type==="scroll"?r.jsx(bM,{...a,ref:t,forceMount:n}):l.type==="auto"?r.jsx(vw,{...a,ref:t,forceMount:n}):l.type==="always"?r.jsx(z1,{...a,ref:t}):null});D1.displayName=ss;var yM=w.forwardRef((e,t)=>{const{forceMount:n,...a}=e,l=Aa(ss,e.__scopeScrollArea),[o,c]=w.useState(!1);return w.useEffect(()=>{const d=l.scrollArea;let m=0;if(d){const f=()=>{window.clearTimeout(m),c(!0)},p=()=>{m=window.setTimeout(()=>c(!1),l.scrollHideDelay)};return d.addEventListener("pointerenter",f),d.addEventListener("pointerleave",p),()=>{window.clearTimeout(m),d.removeEventListener("pointerenter",f),d.removeEventListener("pointerleave",p)}}},[l.scrollArea,l.scrollHideDelay]),r.jsx(Wr,{present:n||o,children:r.jsx(vw,{"data-state":o?"visible":"hidden",...a,ref:t})})}),bM=w.forwardRef((e,t)=>{const{forceMount:n,...a}=e,l=Aa(ss,e.__scopeScrollArea),o=e.orientation==="horizontal",c=Rm(()=>m("SCROLL_END"),100),[d,m]=gM("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 w.useEffect(()=>{if(d==="idle"){const f=window.setTimeout(()=>m("HIDE"),l.scrollHideDelay);return()=>window.clearTimeout(f)}},[d,l.scrollHideDelay,m]),w.useEffect(()=>{const f=l.viewport,p=o?"scrollLeft":"scrollTop";if(f){let x=f[p];const y=()=>{const b=f[p];x!==b&&(m("SCROLL"),c()),x=b};return f.addEventListener("scroll",y),()=>f.removeEventListener("scroll",y)}},[l.viewport,o,m,c]),r.jsx(Wr,{present:n||d!=="hidden",children:r.jsx(z1,{"data-state":d==="hidden"?"hidden":"visible",...a,ref:t,onPointerEnter:Pe(e.onPointerEnter,()=>m("POINTER_ENTER")),onPointerLeave:Pe(e.onPointerLeave,()=>m("POINTER_LEAVE"))})})}),vw=w.forwardRef((e,t)=>{const n=Aa(ss,e.__scopeScrollArea),{forceMount:a,...l}=e,[o,c]=w.useState(!1),d=e.orientation==="horizontal",m=Rm(()=>{if(n.viewport){const f=n.viewport.offsetWidth{const{orientation:n="vertical",...a}=e,l=Aa(ss,e.__scopeScrollArea),o=w.useRef(null),c=w.useRef(0),[d,m]=w.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),f=Nw(d.viewport,d.content),p={...a,sizes:d,onSizesChange:m,hasThumb:f>0&&f<1,onThumbChange:y=>o.current=y,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:y=>c.current=y};function x(y,b){return CM(y,c.current,d,b)}return n==="horizontal"?r.jsx(wM,{...p,ref:t,onThumbPositionChange:()=>{if(l.viewport&&o.current){const y=l.viewport.scrollLeft,b=jb(y,d,l.dir);o.current.style.transform=`translate3d(${b}px, 0, 0)`}},onWheelScroll:y=>{l.viewport&&(l.viewport.scrollLeft=y)},onDragScroll:y=>{l.viewport&&(l.viewport.scrollLeft=x(y,l.dir))}}):n==="vertical"?r.jsx(jM,{...p,ref:t,onThumbPositionChange:()=>{if(l.viewport&&o.current){const y=l.viewport.scrollTop,b=jb(y,d);o.current.style.transform=`translate3d(0, ${b}px, 0)`}},onWheelScroll:y=>{l.viewport&&(l.viewport.scrollTop=y)},onDragScroll:y=>{l.viewport&&(l.viewport.scrollTop=x(y))}}):null}),wM=w.forwardRef((e,t)=>{const{sizes:n,onSizesChange:a,...l}=e,o=Aa(ss,e.__scopeScrollArea),[c,d]=w.useState(),m=w.useRef(null),f=mn(t,m,o.onScrollbarXChange);return w.useEffect(()=>{m.current&&d(getComputedStyle(m.current))},[m]),r.jsx(bw,{"data-orientation":"horizontal",...l,ref:f,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":Om(n)+"px",...e.style},onThumbPointerDown:p=>e.onThumbPointerDown(p.x),onDragScroll:p=>e.onDragScroll(p.x),onWheelScroll:(p,x)=>{if(o.viewport){const y=o.viewport.scrollLeft+p.deltaX;e.onWheelScroll(y),kw(y,x)&&p.preventDefault()}},onResize:()=>{m.current&&o.viewport&&c&&a({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:m.current.clientWidth,paddingStart:lm(c.paddingLeft),paddingEnd:lm(c.paddingRight)}})}})}),jM=w.forwardRef((e,t)=>{const{sizes:n,onSizesChange:a,...l}=e,o=Aa(ss,e.__scopeScrollArea),[c,d]=w.useState(),m=w.useRef(null),f=mn(t,m,o.onScrollbarYChange);return w.useEffect(()=>{m.current&&d(getComputedStyle(m.current))},[m]),r.jsx(bw,{"data-orientation":"vertical",...l,ref:f,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":Om(n)+"px",...e.style},onThumbPointerDown:p=>e.onThumbPointerDown(p.y),onDragScroll:p=>e.onDragScroll(p.y),onWheelScroll:(p,x)=>{if(o.viewport){const y=o.viewport.scrollTop+p.deltaY;e.onWheelScroll(y),kw(y,x)&&p.preventDefault()}},onResize:()=>{m.current&&o.viewport&&c&&a({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:m.current.clientHeight,paddingStart:lm(c.paddingTop),paddingEnd:lm(c.paddingBottom)}})}})}),[NM,yw]=fw(ss),bw=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:a,hasThumb:l,onThumbChange:o,onThumbPointerUp:c,onThumbPointerDown:d,onThumbPositionChange:m,onDragScroll:f,onWheelScroll:p,onResize:x,...y}=e,b=Aa(ss,n),[N,k]=w.useState(null),S=mn(t,U=>k(U)),T=w.useRef(null),M=w.useRef(""),A=b.viewport,R=a.content-a.viewport,B=yr(p),O=yr(m),L=Rm(x,10);function $(U){if(T.current){const I=U.clientX-T.current.left,G=U.clientY-T.current.top;f({x:I,y:G})}}return w.useEffect(()=>{const U=I=>{const G=I.target;N?.contains(G)&&B(I,R)};return document.addEventListener("wheel",U,{passive:!1}),()=>document.removeEventListener("wheel",U,{passive:!1})},[A,N,R,B]),w.useEffect(O,[a,O]),Io(N,L),Io(b.content,L),r.jsx(NM,{scope:n,scrollbar:N,hasThumb:l,onThumbChange:yr(o),onThumbPointerUp:yr(c),onThumbPositionChange:O,onThumbPointerDown:yr(d),children:r.jsx(It.div,{...y,ref:S,style:{position:"absolute",...y.style},onPointerDown:Pe(e.onPointerDown,U=>{U.button===0&&(U.target.setPointerCapture(U.pointerId),T.current=N.getBoundingClientRect(),M.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",b.viewport&&(b.viewport.style.scrollBehavior="auto"),$(U))}),onPointerMove:Pe(e.onPointerMove,$),onPointerUp:Pe(e.onPointerUp,U=>{const I=U.target;I.hasPointerCapture(U.pointerId)&&I.releasePointerCapture(U.pointerId),document.body.style.webkitUserSelect=M.current,b.viewport&&(b.viewport.style.scrollBehavior=""),T.current=null})})})}),sm="ScrollAreaThumb",ww=w.forwardRef((e,t)=>{const{forceMount:n,...a}=e,l=yw(sm,e.__scopeScrollArea);return r.jsx(Wr,{present:n||l.hasThumb,children:r.jsx(SM,{ref:t,...a})})}),SM=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:a,...l}=e,o=Aa(sm,n),c=yw(sm,n),{onThumbPositionChange:d}=c,m=mn(t,x=>c.onThumbChange(x)),f=w.useRef(void 0),p=Rm(()=>{f.current&&(f.current(),f.current=void 0)},100);return w.useEffect(()=>{const x=o.viewport;if(x){const y=()=>{if(p(),!f.current){const b=TM(x,d);f.current=b,d()}};return d(),x.addEventListener("scroll",y),()=>x.removeEventListener("scroll",y)}},[o.viewport,p,d]),r.jsx(It.div,{"data-state":c.hasThumb?"visible":"hidden",...l,ref:m,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...a},onPointerDownCapture:Pe(e.onPointerDownCapture,x=>{const b=x.target.getBoundingClientRect(),N=x.clientX-b.left,k=x.clientY-b.top;c.onThumbPointerDown({x:N,y:k})}),onPointerUp:Pe(e.onPointerUp,c.onThumbPointerUp)})});ww.displayName=sm;var O1="ScrollAreaCorner",jw=w.forwardRef((e,t)=>{const n=Aa(O1,e.__scopeScrollArea),a=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&a?r.jsx(kM,{...e,ref:t}):null});jw.displayName=O1;var kM=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,...a}=e,l=Aa(O1,n),[o,c]=w.useState(0),[d,m]=w.useState(0),f=!!(o&&d);return Io(l.scrollbarX,()=>{const p=l.scrollbarX?.offsetHeight||0;l.onCornerHeightChange(p),m(p)}),Io(l.scrollbarY,()=>{const p=l.scrollbarY?.offsetWidth||0;l.onCornerWidthChange(p),c(p)}),f?r.jsx(It.div,{...a,ref:t,style:{width:o,height:d,position:"absolute",right:l.dir==="ltr"?0:void 0,left:l.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function lm(e){return e?parseInt(e,10):0}function Nw(e,t){const n=e/t;return isNaN(n)?0:n}function Om(e){const t=Nw(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,a=(e.scrollbar.size-n)*t;return Math.max(a,18)}function CM(e,t,n,a="ltr"){const l=Om(n),o=l/2,c=t||o,d=l-c,m=n.scrollbar.paddingStart+c,f=n.scrollbar.size-n.scrollbar.paddingEnd-d,p=n.content-n.viewport,x=a==="ltr"?[0,p]:[p*-1,0];return Sw([m,f],x)(e)}function jb(e,t,n="ltr"){const a=Om(t),l=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-l,c=t.content-t.viewport,d=o-a,m=n==="ltr"?[0,c]:[c*-1,0],f=h1(e,m);return Sw([0,c],[0,d])(f)}function Sw(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const a=(t[1]-t[0])/(e[1]-e[0]);return t[0]+a*(n-e[0])}}function kw(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},a=0;return(function l(){const o={left:e.scrollLeft,top:e.scrollTop},c=n.left!==o.left,d=n.top!==o.top;(c||d)&&t(),n=o,a=window.requestAnimationFrame(l)})(),()=>window.cancelAnimationFrame(a)};function Rm(e,t){const n=yr(e),a=w.useRef(0);return w.useEffect(()=>()=>window.clearTimeout(a.current),[]),w.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(n,t)},[n,t])}function Io(e,t){const n=yr(t);F5(()=>{let a=0;if(e){const l=new ResizeObserver(()=>{cancelAnimationFrame(a),a=window.requestAnimationFrame(n)});return l.observe(e),()=>{window.cancelAnimationFrame(a),l.unobserve(e)}}},[e,n])}var Cw=pw,_M=gw,EM=jw;const an=w.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(Cw,{ref:a,className:he("relative overflow-hidden",e),...n,children:[r.jsx(_M,{className:"h-full w-full rounded-[inherit]",children:t}),r.jsx(Tw,{}),r.jsx(EM,{})]}));an.displayName=Cw.displayName;const Tw=w.forwardRef(({className:e,orientation:t="vertical",...n},a)=>r.jsx(D1,{ref:a,orientation:t,className:he("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:r.jsx(ww,{className:"relative flex-1 rounded-full bg-border"})}));Tw.displayName=D1.displayName;function Nb({className:e,...t}){return r.jsx("div",{className:he("animate-pulse rounded-md bg-primary/10",e),...t})}function MM(e,t=[]){let n=[];function a(o,c){const d=w.createContext(c);d.displayName=o+"Context";const m=n.length;n=[...n,c];const f=x=>{const{scope:y,children:b,...N}=x,k=y?.[e]?.[m]||d,S=w.useMemo(()=>N,Object.values(N));return r.jsx(k.Provider,{value:S,children:b})};f.displayName=o+"Provider";function p(x,y){const b=y?.[e]?.[m]||d,N=w.useContext(b);if(N)return N;if(c!==void 0)return c;throw new Error(`\`${x}\` must be used within \`${o}\``)}return[f,p]}const l=()=>{const o=n.map(c=>w.createContext(c));return function(d){const m=d?.[e]||o;return w.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])}};return l.scopeName=e,[a,AM(l,...t)]}function AM(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(o){const c=a.reduce((d,{useScope:m,scopeName:f})=>{const x=m(o)[`__scope${f}`];return{...d,...x}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var DM=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_w=DM.reduce((e,t)=>{const n=f1(`Primitive.${t}`),a=w.forwardRef((l,o)=>{const{asChild:c,...d}=l,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(m,{...d,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),R1="Progress",L1=100,[zM]=MM(R1),[OM,RM]=zM(R1),Ew=w.forwardRef((e,t)=>{const{__scopeProgress:n,value:a=null,max:l,getValueLabel:o=LM,...c}=e;(l||l===0)&&!Sb(l)&&console.error(BM(`${l}`,"Progress"));const d=Sb(l)?l:L1;a!==null&&!kb(a,d)&&console.error(PM(`${a}`,"Progress"));const m=kb(a,d)?a:null,f=im(m)?o(m,d):void 0;return r.jsx(OM,{scope:n,value:m,max:d,children:r.jsx(_w.div,{"aria-valuemax":d,"aria-valuemin":0,"aria-valuenow":im(m)?m:void 0,"aria-valuetext":f,role:"progressbar","data-state":Dw(m,d),"data-value":m??void 0,"data-max":d,...c,ref:t})})});Ew.displayName=R1;var Mw="ProgressIndicator",Aw=w.forwardRef((e,t)=>{const{__scopeProgress:n,...a}=e,l=RM(Mw,n);return r.jsx(_w.div,{"data-state":Dw(l.value,l.max),"data-value":l.value??void 0,"data-max":l.max,...a,ref:t})});Aw.displayName=Mw;function LM(e,t){return`${Math.round(e/t*100)}%`}function Dw(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function im(e){return typeof e=="number"}function Sb(e){return im(e)&&!isNaN(e)&&e>0}function kb(e,t){return im(e)&&!isNaN(e)&&e<=t&&e>=0}function BM(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${L1}\`.`}function PM(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: + - a positive number + - less than the value passed to \`max\` (or ${L1} if no \`max\` prop is set) + - \`null\` or \`undefined\` if the progress is indeterminate. + +Defaulting to \`null\`.`}var zw=Ew,FM=Aw;const Fu=w.forwardRef(({className:e,value:t,...n},a)=>r.jsx(zw,{ref:a,className:he("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...n,children:r.jsx(FM,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Fu.displayName=zw.displayName;const IM={light:"",dark:".dark"},Ow=w.createContext(null);function Rw(){const e=w.useContext(Ow);if(!e)throw new Error("useChart must be used within a ");return e}const So=w.forwardRef(({id:e,className:t,children:n,config:a,...l},o)=>{const c=w.useId(),d=`chart-${e||c.replace(/:/g,"")}`;return r.jsx(Ow.Provider,{value:{config:a},children:r.jsxs("div",{"data-chart":d,ref:o,className:he("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",t),...l,children:[r.jsx(qM,{id:d,config:a}),r.jsx(VC,{children:n})]})})});So.displayName="Chart";const qM=({id:e,config:t})=>{const n=Object.entries(t).filter(([,a])=>a.theme||a.color);return n.length?r.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(IM).map(([a,l])=>` +${l} [data-chart=${e}] { +${n.map(([o,c])=>{const d=c.theme?.[a]||c.color;return d?` --color-${o}: ${d};`:null}).join(` +`)} +} +`).join(` +`)}}):null},Zc=GC,ko=w.forwardRef(({active:e,payload:t,className:n,indicator:a="dot",hideLabel:l=!1,hideIndicator:o=!1,label:c,labelFormatter:d,labelClassName:m,formatter:f,color:p,nameKey:x,labelKey:y},b)=>{const{config:N}=Rw(),k=w.useMemo(()=>{if(l||!t?.length)return null;const[T]=t,M=`${y||T?.dataKey||T?.name||"value"}`,A=Ax(N,T,M),R=!y&&typeof c=="string"?N[c]?.label||c:A?.label;return d?r.jsx("div",{className:he("font-medium",m),children:d(R,t)}):R?r.jsx("div",{className:he("font-medium",m),children:R}):null},[c,d,t,l,m,N,y]);if(!e||!t?.length)return null;const S=t.length===1&&a!=="dot";return r.jsxs("div",{ref:b,className:he("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[S?null:k,r.jsx("div",{className:"grid gap-1.5",children:t.filter(T=>T.type!=="none").map((T,M)=>{const A=`${x||T.name||T.dataKey||"value"}`,R=Ax(N,T,A),B=p||T.payload.fill||T.color;return r.jsx("div",{className:he("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",a==="dot"&&"items-center"),children:f&&T?.value!==void 0&&T.name?f(T.value,T.name,T,M,T.payload):r.jsxs(r.Fragment,{children:[R?.icon?r.jsx(R.icon,{}):!o&&r.jsx("div",{className:he("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":a==="dot","w-1":a==="line","w-0 border-[1.5px] border-dashed bg-transparent":a==="dashed","my-0.5":S&&a==="dashed"}),style:{"--color-bg":B,"--color-border":B}}),r.jsxs("div",{className:he("flex flex-1 justify-between leading-none",S?"items-end":"items-center"),children:[r.jsxs("div",{className:"grid gap-1.5",children:[S?k:null,r.jsx("span",{className:"text-muted-foreground",children:R?.label||T.name})]}),T.value&&r.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:T.value.toLocaleString()})]})]})},T.dataKey)})})]})});ko.displayName="ChartTooltip";const HM=YC,Lw=w.forwardRef(({className:e,hideIcon:t=!1,payload:n,verticalAlign:a="bottom",nameKey:l},o)=>{const{config:c}=Rw();return n?.length?r.jsx("div",{ref:o,className:he("flex items-center justify-center gap-4",a==="top"?"pb-3":"pt-3",e),children:n.filter(d=>d.type!=="none").map(d=>{const m=`${l||d.dataKey||"value"}`,f=Ax(c,d,m);return r.jsxs("div",{className:he("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[f?.icon&&!t?r.jsx(f.icon,{}):r.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:d.color}}),f?.label]},d.value)})}):null});Lw.displayName="ChartLegend";function Ax(e,t,n){if(typeof t!="object"||t===null)return;const a="payload"in t&&typeof t.payload=="object"&&t.payload!==null?t.payload:void 0;let l=n;return n in t&&typeof t[n]=="string"?l=t[n]:a&&n in a&&typeof a[n]=="string"&&(l=a[n]),l in e?e[l]:e[n]}const Cb=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Tb=P5,Ko=(e,t)=>n=>{var a;if(t?.variants==null)return Tb(e,n?.class,n?.className);const{variants:l,defaultVariants:o}=t,c=Object.keys(l).map(f=>{const p=n?.[f],x=o?.[f];if(p===null)return null;const y=Cb(p)||Cb(x);return l[f][y]}),d=n&&Object.entries(n).reduce((f,p)=>{let[x,y]=p;return y===void 0||(f[x]=y),f},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((f,p)=>{let{class:x,className:y,...b}=p;return Object.entries(b).every(N=>{let[k,S]=N;return Array.isArray(S)?S.includes({...o,...d}[k]):{...o,...d}[k]===S})?[...f,x,y]:f},[]);return Tb(e,c,m,n?.class,n?.className)},gu=Ko("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring 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 shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ne=w.forwardRef(({className:e,variant:t,size:n,asChild:a=!1,...l},o)=>{const c=a?JC:"button";return r.jsx(c,{className:he(gu({variant:t,size:n,className:e})),ref:o,...l})});ne.displayName="Button";function UM(){const[e,t]=w.useState(null),[n,a]=w.useState(!0),[l,o]=w.useState(0),[c,d]=w.useState(24),[m,f]=w.useState(!0),[p,x]=w.useState(null),[y,b]=w.useState(!0),N=w.useCallback(async()=>{try{b(!0);const U=await An.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");x({hitokoto:U.data.hitokoto,from:U.data.from||U.data.from_who||"未知"})}catch(U){console.error("获取一言失败:",U),x({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{b(!1)}},[]),k=w.useCallback(async()=>{try{const U=localStorage.getItem("access-token"),I=await An.get(`/api/webui/statistics/dashboard?hours=${c}`,{headers:{Authorization:`Bearer ${U}`}});t(I.data),a(!1),o(100)}catch(U){console.error("Failed to fetch dashboard data:",U),a(!1),o(100)}},[c]);if(w.useEffect(()=>{if(!n)return;o(0);const U=setTimeout(()=>o(15),200),I=setTimeout(()=>o(30),800),G=setTimeout(()=>o(45),2e3),ee=setTimeout(()=>o(60),4e3),Ne=setTimeout(()=>o(75),6500),J=setTimeout(()=>o(85),9e3),se=setTimeout(()=>o(92),11e3);return()=>{clearTimeout(U),clearTimeout(I),clearTimeout(G),clearTimeout(ee),clearTimeout(Ne),clearTimeout(J),clearTimeout(se)}},[n]),w.useEffect(()=>{k(),N()},[k,N]),w.useEffect(()=>{if(!m)return;const U=setInterval(()=>{k()},3e4);return()=>clearInterval(U)},[m,k]),n||!e)return r.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:r.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[r.jsx(Ia,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Fu,{value:l,className:"h-2"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[l,"%"]})]})]})});const{summary:S,model_stats:T,hourly_data:M,daily_data:A,recent_activity:R}=e,B=U=>{const I=Math.floor(U/3600),G=Math.floor(U%3600/60);return`${I}小时${G}分钟`},O=U=>new Date(U).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),L=T.slice(0,6).map(U=>({name:U.model_name,value:U.request_count,fill:`hsl(var(--chart-${T.indexOf(U)%5+1}))`})),$={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return r.jsx(an,{className:"h-full",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(kl,{value:c.toString(),onValueChange:U=>d(Number(U)),children:r.jsxs(Bs,{className:"grid grid-cols-3 w-full sm:w-auto",children:[r.jsx(Pt,{value:"24",children:"24小时"}),r.jsx(Pt,{value:"168",children:"7天"}),r.jsx(Pt,{value:"720",children:"30天"})]})}),r.jsxs(ne,{variant:m?"default":"outline",size:"sm",onClick:()=>f(!m),className:"gap-2",children:[r.jsx(Ia,{className:`h-4 w-4 ${m?"animate-spin":""}`}),r.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),r.jsx(ne,{variant:"outline",size:"sm",onClick:k,children:r.jsx(Ia,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"总请求数"}),r.jsx(mT,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Gt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:S.total_requests.toLocaleString()}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",c<48?c+"小时":Math.floor(c/24)+"天"]})]})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"总花费"}),r.jsx(hT,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Gt,{children:[r.jsxs("div",{className:"text-2xl font-bold",children:["¥",S.total_cost.toFixed(2)]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.cost_per_hour>0?`¥${S.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"Token消耗"}),r.jsx(fT,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Gt,{children:[r.jsxs("div",{className:"text-2xl font-bold",children:[(S.total_tokens/1e3).toFixed(1),"K"]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.tokens_per_hour>0?`${(S.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"平均响应"}),r.jsx(fu,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Gt,{children:[r.jsxs("div",{className:"text-2xl font-bold",children:[S.avg_response_time.toFixed(2),"s"]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),r.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"在线时长"}),r.jsx(di,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Gt,{children:r.jsx("div",{className:"text-xl font-bold",children:B(S.online_time)})})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"消息处理"}),r.jsx(Mu,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Gt,{children:[r.jsx("div",{className:"text-xl font-bold",children:S.total_messages.toLocaleString()}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",S.total_replies.toLocaleString()," 条"]})]})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"成本效率"}),r.jsx(pT,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Gt,{children:[r.jsx("div",{className:"text-xl font-bold",children:S.total_messages>0?`¥${(S.total_cost/S.total_messages*100).toFixed(2)}`:"¥0.00"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),r.jsxs(kl,{defaultValue:"trends",className:"space-y-4",children:[r.jsxs(Bs,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[r.jsx(Pt,{value:"trends",children:"趋势"}),r.jsx(Pt,{value:"models",children:"模型"}),r.jsx(Pt,{value:"activity",children:"活动"}),r.jsx(Pt,{value:"daily",children:"日统计"})]}),r.jsxs(cn,{value:"trends",className:"space-y-4",children:[r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"请求趋势"}),r.jsxs(Qn,{children:["最近",c,"小时的请求量变化"]})]}),r.jsx(Gt,{children:r.jsx(So,{config:$,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:r.jsxs(WC,{data:M,children:[r.jsx(y0,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),r.jsx(b0,{dataKey:"timestamp",tickFormatter:U=>O(U),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Wc,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Zc,{content:r.jsx(ko,{labelFormatter:U=>O(U)})}),r.jsx(XC,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),r.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"花费趋势"}),r.jsx(Qn,{children:"API调用成本变化"})]}),r.jsx(Gt,{children:r.jsx(So,{config:$,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:r.jsxs(vp,{data:M,children:[r.jsx(y0,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),r.jsx(b0,{dataKey:"timestamp",tickFormatter:U=>O(U),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Wc,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Zc,{content:r.jsx(ko,{labelFormatter:U=>O(U)})}),r.jsx(w0,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"Token消耗"}),r.jsx(Qn,{children:"Token使用量变化"})]}),r.jsx(Gt,{children:r.jsx(So,{config:$,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:r.jsxs(vp,{data:M,children:[r.jsx(y0,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),r.jsx(b0,{dataKey:"timestamp",tickFormatter:U=>O(U),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Wc,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Zc,{content:r.jsx(ko,{labelFormatter:U=>O(U)})}),r.jsx(w0,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),r.jsx(cn,{value:"models",className:"space-y-4",children:r.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"模型请求分布"}),r.jsx(Qn,{children:"各模型使用占比"})]}),r.jsx(Gt,{children:r.jsx(So,{config:Object.fromEntries(T.slice(0,6).map((U,I)=>[U.model_name,{label:U.model_name,color:`hsl(var(--chart-${I%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:r.jsxs(KC,{children:[r.jsx(Zc,{content:r.jsx(ko,{})}),r.jsx(QC,{data:L,cx:"50%",cy:"50%",labelLine:!1,label:({name:U,percent:I})=>`${U} ${I?(I*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:L.map((U,I)=>r.jsx(ZC,{fill:U.fill},`cell-${I}`))})]})})})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"模型详细统计"}),r.jsx(Qn,{children:"请求数、花费和性能"})]}),r.jsx(Gt,{children:r.jsx(an,{className:"h-[300px] sm:h-[400px]",children:r.jsx("div",{className:"space-y-3",children:T.map((U,I)=>r.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:U.model_name}),r.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${I%5+1}))`}})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),r.jsx("span",{className:"ml-1 font-medium",children:U.request_count.toLocaleString()})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"花费:"}),r.jsxs("span",{className:"ml-1 font-medium",children:["¥",U.total_cost.toFixed(2)]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),r.jsxs("span",{className:"ml-1 font-medium",children:[(U.total_tokens/1e3).toFixed(1),"K"]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),r.jsxs("span",{className:"ml-1 font-medium",children:[U.avg_response_time.toFixed(2),"s"]})]})]})]},I))})})})]})]})}),r.jsx(cn,{value:"activity",children:r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"最近活动"}),r.jsx(Qn,{children:"最新的API调用记录"})]}),r.jsx(Gt,{children:r.jsx(an,{className:"h-[400px] sm:h-[500px]",children:r.jsx("div",{className:"space-y-2",children:R.map((U,I)=>r.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium text-sm truncate",children:U.model}),r.jsx("div",{className:"text-xs text-muted-foreground",children:U.request_type})]}),r.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:O(U.timestamp)})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),r.jsx("span",{className:"ml-1",children:U.tokens})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"花费:"}),r.jsxs("span",{className:"ml-1",children:["¥",U.cost.toFixed(4)]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),r.jsxs("span",{className:"ml-1",children:[U.time_cost.toFixed(2),"s"]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"状态:"}),r.jsx("span",{className:`ml-1 ${U.status==="success"?"text-green-600":"text-red-600"}`,children:U.status})]})]})]},I))})})})]})}),r.jsx(cn,{value:"daily",children:r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"每日统计"}),r.jsx(Qn,{children:"最近7天的数据汇总"})]}),r.jsx(Gt,{children:r.jsx(So,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:r.jsxs(vp,{data:A,children:[r.jsx(y0,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),r.jsx(b0,{dataKey:"timestamp",tickFormatter:U=>{const I=new Date(U);return`${I.getMonth()+1}/${I.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Wc,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Wc,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Zc,{content:r.jsx(ko,{labelFormatter:U=>new Date(U).toLocaleDateString("zh-CN")})}),r.jsx(HM,{content:r.jsx(Lw,{})}),r.jsx(w0,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),r.jsx(w0,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),r.jsxs(ct,{className:"border-2 border-primary/20",children:[r.jsx(Lt,{className:"pb-3",children:r.jsx(Bt,{className:"text-lg",children:"每日一言"})}),r.jsx(Gt,{children:y?r.jsxs("div",{className:"space-y-2",children:[r.jsx(Nb,{className:"h-6 w-3/4"}),r.jsx(Nb,{className:"h-4 w-1/4"})]}):p?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-lg font-medium leading-relaxed italic",children:['"',p.hitokoto,'"']}),r.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["—— ",p.from]})]}):null})]})]})})}const $M={theme:"system",setTheme:()=>null},Bw=w.createContext($M),B1=()=>{const e=w.useContext(Bw);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},VM=(e,t,n)=>{const a=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||a){t(e);return}const l=n.clientX,o=n.clientY,c=Math.hypot(Math.max(l,innerWidth-l),Math.max(o,innerHeight-o));document.startViewTransition(()=>{t(e)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${l}px ${o}px)`,`circle(${c}px at ${l}px ${o}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},Pw=w.createContext(void 0),Fw=()=>{const e=w.useContext(Pw);if(e===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return e};var Lm="Switch",[GM]=Ua(Lm),[YM,WM]=GM(Lm),Iw=w.forwardRef((e,t)=>{const{__scopeSwitch:n,name:a,checked:l,defaultChecked:o,required:c,disabled:d,value:m="on",onCheckedChange:f,form:p,...x}=e,[y,b]=w.useState(null),N=mn(t,A=>b(A)),k=w.useRef(!1),S=y?p||!!y.closest("form"):!0,[T,M]=zl({prop:l,defaultProp:o??!1,onChange:f,caller:Lm});return r.jsxs(YM,{scope:n,checked:T,disabled:d,children:[r.jsx(It.button,{type:"button",role:"switch","aria-checked":T,"aria-required":c,"data-state":$w(T),"data-disabled":d?"":void 0,disabled:d,value:m,...x,ref:N,onClick:Pe(e.onClick,A=>{M(R=>!R),S&&(k.current=A.isPropagationStopped(),k.current||A.stopPropagation())})}),S&&r.jsx(Uw,{control:y,bubbles:!k.current,name:a,value:m,checked:T,required:c,disabled:d,form:p,style:{transform:"translateX(-100%)"}})]})});Iw.displayName=Lm;var qw="SwitchThumb",Hw=w.forwardRef((e,t)=>{const{__scopeSwitch:n,...a}=e,l=WM(qw,n);return r.jsx(It.span,{"data-state":$w(l.checked),"data-disabled":l.disabled?"":void 0,...a,ref:t})});Hw.displayName=qw;var XM="SwitchBubbleInput",Uw=w.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:a=!0,...l},o)=>{const c=w.useRef(null),d=mn(c,o),m=I5(n),f=q5(t);return w.useEffect(()=>{const p=c.current;if(!p)return;const x=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(x,"checked").set;if(m!==n&&b){const N=new Event("click",{bubbles:a});b.call(p,n),p.dispatchEvent(N)}},[m,n,a]),r.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...l,tabIndex:-1,ref:d,style:{...l.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Uw.displayName=XM;function $w(e){return e?"checked":"unchecked"}var Vw=Iw,KM=Hw;const vt=w.forwardRef(({className:e,...t},n)=>r.jsx(Vw,{className:he("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm 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",e),...t,ref:n,children:r.jsx(KM,{className:he("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));vt.displayName=Vw.displayName;const QM=Ko("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Q=w.forwardRef(({className:e,...t},n)=>r.jsx(H5,{ref:n,className:he(QM(),e),...t}));Q.displayName=H5.displayName;const Te=w.forwardRef(({className:e,type:t,...n},a)=>r.jsx("input",{type:t,className:he("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors 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-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:a,...n}));Te.displayName="Input";const ZM=1,JM=1e6;let Ep=0;function eA(){return Ep=(Ep+1)%Number.MAX_SAFE_INTEGER,Ep.toString()}const Mp=new Map,_b=e=>{if(Mp.has(e))return;const t=setTimeout(()=>{Mp.delete(e),cu({type:"REMOVE_TOAST",toastId:e})},JM);Mp.set(e,t)},tA=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,ZM)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?_b(n):e.toasts.forEach(a=>{_b(a.id)}),{...e,toasts:e.toasts.map(a=>a.id===n||n===void 0?{...a,open:!1}:a)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},Y0=[];let W0={toasts:[]};function cu(e){W0=tA(W0,e),Y0.forEach(t=>{t(W0)})}function nA({...e}){const t=eA(),n=l=>cu({type:"UPDATE_TOAST",toast:{...l,id:t}}),a=()=>cu({type:"DISMISS_TOAST",toastId:t});return cu({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:l=>{l||a()}}}),{id:t,dismiss:a,update:n}}function or(){const[e,t]=w.useState(W0);return w.useEffect(()=>(Y0.push(t),()=>{const n=Y0.indexOf(t);n>-1&&Y0.splice(n,1)}),[e]),{...e,toast:nA,dismiss:n=>cu({type:"DISMISS_TOAST",toastId:n})}}const rA=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:e=>e.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:e=>/[A-Z]/.test(e)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:e=>/[a-z]/.test(e)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:e=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(e)}];function aA(e){const t=rA.map(a=>({id:a.id,label:a.label,description:a.description,passed:a.validate(e)}));return{isValid:t.every(a=>a.passed),rules:t}}const P1="0.11.5 Beta",F1="MaiBot Dashboard",sA=`${F1} v${P1}`,lA=(e="v")=>`${e}${P1}`,ir=y1,I1=U5,iA=p1,Gw=w.forwardRef(({className:e,...t},n)=>r.jsx(wm,{ref:n,className:he("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",e),...t}));Gw.displayName=wm.displayName;const Jn=w.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(iA,{children:[r.jsx(Gw,{}),r.jsxs(jm,{ref:a,className:he("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",e),...n,children:[t,r.jsxs(x1,{className:"absolute right-4 top-4 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:[r.jsx(Au,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Jn.displayName=jm.displayName;const er=({className:e,...t})=>r.jsx("div",{className:he("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});er.displayName="DialogHeader";const Er=({className:e,...t})=>r.jsx("div",{className:he("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Er.displayName="DialogFooter";const tr=w.forwardRef(({className:e,...t},n)=>r.jsx(g1,{ref:n,className:he("text-lg font-semibold leading-none tracking-tight",e),...t}));tr.displayName=g1.displayName;const xr=w.forwardRef(({className:e,...t},n)=>r.jsx(v1,{ref:n,className:he("text-sm text-muted-foreground",e),...t}));xr.displayName=v1.displayName;var oA=Symbol("radix.slottable");function cA(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=oA,t}var Yw="AlertDialog",[uA]=Ua(Yw,[$5]),Hs=$5(),Ww=e=>{const{__scopeAlertDialog:t,...n}=e,a=Hs(t);return r.jsx(y1,{...a,...n,modal:!0})};Ww.displayName=Yw;var dA="AlertDialogTrigger",Xw=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...a}=e,l=Hs(n);return r.jsx(U5,{...l,...a,ref:t})});Xw.displayName=dA;var mA="AlertDialogPortal",Kw=e=>{const{__scopeAlertDialog:t,...n}=e,a=Hs(t);return r.jsx(p1,{...a,...n})};Kw.displayName=mA;var hA="AlertDialogOverlay",Qw=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...a}=e,l=Hs(n);return r.jsx(wm,{...l,...a,ref:t})});Qw.displayName=hA;var Do="AlertDialogContent",[fA,pA]=uA(Do),xA=cA("AlertDialogContent"),Zw=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:a,...l}=e,o=Hs(n),c=w.useRef(null),d=mn(t,c),m=w.useRef(null);return r.jsx(eT,{contentName:Do,titleName:Jw,docsSlug:"alert-dialog",children:r.jsx(fA,{scope:n,cancelRef:m,children:r.jsxs(jm,{role:"alertdialog",...o,...l,ref:d,onOpenAutoFocus:Pe(l.onOpenAutoFocus,f=>{f.preventDefault(),m.current?.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[r.jsx(xA,{children:a}),r.jsx(vA,{contentRef:c})]})})})});Zw.displayName=Do;var Jw="AlertDialogTitle",ej=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...a}=e,l=Hs(n);return r.jsx(g1,{...l,...a,ref:t})});ej.displayName=Jw;var tj="AlertDialogDescription",nj=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...a}=e,l=Hs(n);return r.jsx(v1,{...l,...a,ref:t})});nj.displayName=tj;var gA="AlertDialogAction",rj=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...a}=e,l=Hs(n);return r.jsx(x1,{...l,...a,ref:t})});rj.displayName=gA;var aj="AlertDialogCancel",sj=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...a}=e,{cancelRef:l}=pA(aj,n),o=Hs(n),c=mn(t,l);return r.jsx(x1,{...o,...a,ref:c})});sj.displayName=aj;var vA=({contentRef:e})=>{const t=`\`${Do}\` requires a description for the component to be accessible for screen reader users. + +You can add a description to the \`${Do}\` by passing a \`${tj}\` 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 \`${Do}\`. 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 w.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},yA=Ww,bA=Xw,wA=Kw,lj=Qw,ij=Zw,oj=rj,cj=sj,uj=ej,dj=nj;const en=yA,Zn=bA,jA=wA,mj=w.forwardRef(({className:e,...t},n)=>r.jsx(lj,{className:he("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",e),...t,ref:n}));mj.displayName=lj.displayName;const Yt=w.forwardRef(({className:e,...t},n)=>r.jsxs(jA,{children:[r.jsx(mj,{}),r.jsx(ij,{ref:n,className:he("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",e),...t})]}));Yt.displayName=ij.displayName;const Wt=({className:e,...t})=>r.jsx("div",{className:he("flex flex-col space-y-2 text-center sm:text-left",e),...t});Wt.displayName="AlertDialogHeader";const Xt=({className:e,...t})=>r.jsx("div",{className:he("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Xt.displayName="AlertDialogFooter";const Kt=w.forwardRef(({className:e,...t},n)=>r.jsx(uj,{ref:n,className:he("text-lg font-semibold",e),...t}));Kt.displayName=uj.displayName;const Qt=w.forwardRef(({className:e,...t},n)=>r.jsx(dj,{ref:n,className:he("text-sm text-muted-foreground",e),...t}));Qt.displayName=dj.displayName;const Zt=w.forwardRef(({className:e,...t},n)=>r.jsx(oj,{ref:n,className:he(gu(),e),...t}));Zt.displayName=oj.displayName;const Jt=w.forwardRef(({className:e,...t},n)=>r.jsx(cj,{ref:n,className:he(gu({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Jt.displayName=cj.displayName;function NA(){return r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),r.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),r.jsxs(kl,{defaultValue:"appearance",className:"w-full",children:[r.jsxs(Bs,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[r.jsxs(Pt,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[r.jsx(s6,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),r.jsx("span",{children:"外观"})]}),r.jsxs(Pt,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[r.jsx(xT,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),r.jsx("span",{children:"安全"})]}),r.jsxs(Pt,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[r.jsx(Pa,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),r.jsx("span",{children:"其他"})]}),r.jsxs(Pt,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[r.jsx(pi,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),r.jsx("span",{children:"关于"})]})]}),r.jsxs(an,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[r.jsx(cn,{value:"appearance",className:"mt-0",children:r.jsx(SA,{})}),r.jsx(cn,{value:"security",className:"mt-0",children:r.jsx(kA,{})}),r.jsx(cn,{value:"other",className:"mt-0",children:r.jsx(CA,{})}),r.jsx(cn,{value:"about",className:"mt-0",children:r.jsx(TA,{})})]})]})]})}function Eb(e){const t=document.documentElement,a={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[e];if(a)t.style.setProperty("--primary",a.hsl),a.gradient?(t.style.setProperty("--primary-gradient",a.gradient),t.classList.add("has-gradient")):(t.style.removeProperty("--primary-gradient"),t.classList.remove("has-gradient"));else if(e.startsWith("#")){const l=o=>{o=o.replace("#","");const c=parseInt(o.substring(0,2),16)/255,d=parseInt(o.substring(2,4),16)/255,m=parseInt(o.substring(4,6),16)/255,f=Math.max(c,d,m),p=Math.min(c,d,m);let x=0,y=0;const b=(f+p)/2;if(f!==p){const N=f-p;switch(y=b>.5?N/(2-f-p):N/(f+p),f){case c:x=((d-m)/N+(dlocalStorage.getItem("accent-color")||"blue");w.useEffect(()=>{const f=localStorage.getItem("accent-color")||"blue";Eb(f)},[]);const m=f=>{d(f),localStorage.setItem("accent-color",f),Eb(f)};return r.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[r.jsx(Ap,{value:"light",current:e,onChange:t,label:"浅色",description:"始终使用浅色主题"}),r.jsx(Ap,{value:"dark",current:e,onChange:t,label:"深色",description:"始终使用深色主题"}),r.jsx(Ap,{value:"system",current:e,onChange:t,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),r.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),r.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[r.jsx(Sa,{value:"blue",current:c,onChange:m,label:"蓝色",colorClass:"bg-blue-500"}),r.jsx(Sa,{value:"purple",current:c,onChange:m,label:"紫色",colorClass:"bg-purple-500"}),r.jsx(Sa,{value:"green",current:c,onChange:m,label:"绿色",colorClass:"bg-green-500"}),r.jsx(Sa,{value:"orange",current:c,onChange:m,label:"橙色",colorClass:"bg-orange-500"}),r.jsx(Sa,{value:"pink",current:c,onChange:m,label:"粉色",colorClass:"bg-pink-500"}),r.jsx(Sa,{value:"red",current:c,onChange:m,label:"红色",colorClass:"bg-red-500"})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),r.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[r.jsx(Sa,{value:"gradient-sunset",current:c,onChange:m,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),r.jsx(Sa,{value:"gradient-ocean",current:c,onChange:m,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),r.jsx(Sa,{value:"gradient-forest",current:c,onChange:m,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),r.jsx(Sa,{value:"gradient-aurora",current:c,onChange:m,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),r.jsx(Sa,{value:"gradient-fire",current:c,onChange:m,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),r.jsx(Sa,{value:"gradient-twilight",current:c,onChange:m,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[r.jsx("div",{className:"flex-1",children:r.jsx("input",{type:"color",value:c.startsWith("#")?c:"#3b82f6",onChange:f=>m(f.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),r.jsx("div",{className:"flex-1",children:r.jsx(Te,{type:"text",value:c,onChange:f=>m(f.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),r.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),r.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[r.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5 flex-1",children:[r.jsx(Q,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),r.jsx(vt,{id:"animations",checked:n,onCheckedChange:a})]})}),r.jsx("div",{className:"rounded-lg border bg-card p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5 flex-1",children:[r.jsx(Q,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),r.jsx(vt,{id:"waves-background",checked:l,onCheckedChange:o})]})})]})]})]})}function kA(){const e=as(),[t,n]=w.useState(""),[a,l]=w.useState(""),[o,c]=w.useState(!1),[d,m]=w.useState(!1),[f,p]=w.useState(!1),[x,y]=w.useState(!1),[b,N]=w.useState(!1),[k,S]=w.useState(!1),[T,M]=w.useState(""),[A,R]=w.useState(!1),{toast:B}=or(),O=w.useMemo(()=>aA(a),[a]),L=()=>localStorage.getItem("access-token")||"",$=async J=>{try{await navigator.clipboard.writeText(J),N(!0),B({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>N(!1),2e3)}catch{B({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},U=async()=>{if(!a.trim()){B({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!O.isValid){const J=O.rules.filter(se=>!se.passed).map(se=>se.label).join(", ");B({title:"格式错误",description:`Token 不符合要求: ${J}`,variant:"destructive"});return}p(!0);try{const J=L(),se=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${J}`},body:JSON.stringify({new_token:a.trim()})}),H=await se.json();se.ok&&H.success?(localStorage.setItem("access-token",a.trim()),l(""),t&&n(a.trim()),B({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),e({to:"/auth"})},1500)):B({title:"更新失败",description:H.message||"无法更新 Token",variant:"destructive"})}catch(J){console.error("更新 Token 错误:",J),B({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{p(!1)}},I=async()=>{y(!0);try{const J=L(),se=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${J}`}}),H=await se.json();se.ok&&H.success?(localStorage.setItem("access-token",H.token),n(H.token),M(H.token),S(!0),R(!1),B({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):B({title:"生成失败",description:H.message||"无法生成新 Token",variant:"destructive"})}catch(J){console.error("生成 Token 错误:",J),B({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{y(!1)}},G=async()=>{try{await navigator.clipboard.writeText(T),R(!0),B({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{B({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},ee=()=>{S(!1),setTimeout(()=>{M(""),R(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),e({to:"/auth"})},500)},Ne=J=>{J||ee()};return r.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[r.jsx(ir,{open:k,onOpenChange:Ne,children:r.jsxs(Jn,{className:"sm:max-w-md",children:[r.jsxs(er,{children:[r.jsxs(tr,{className:"flex items-center gap-2",children:[r.jsx(Ao,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),r.jsx(xr,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[r.jsx(Q,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),r.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:T})]}),r.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Ao,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[r.jsx("p",{className:"font-semibold",children:"重要提示"}),r.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[r.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),r.jsx("li",{children:"请立即复制并保存到安全的位置"}),r.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),r.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),r.jsxs(Er,{className:"gap-2 sm:gap-0",children:[r.jsx(ne,{variant:"outline",onClick:G,className:"gap-2",children:A?r.jsxs(r.Fragment,{children:[r.jsx(mi,{className:"h-4 w-4 text-green-500"}),"已复制"]}):r.jsxs(r.Fragment,{children:[r.jsx(vx,{className:"h-4 w-4"}),"复制 Token"]})}),r.jsx(ne,{onClick:ee,children:"我已保存,关闭"})]})]})}),r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),r.jsx("div",{className:"space-y-3 sm:space-y-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Te,{id:"current-token",type:o?"text":"password",value:t||L(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),r.jsx("button",{onClick:()=>{t||n(L()),c(!o)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:o?"隐藏":"显示",children:o?r.jsx(yx,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(Ha,{className:"h-4 w-4 text-muted-foreground"})})]}),r.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[r.jsx(ne,{variant:"outline",size:"icon",onClick:()=>$(L()),title:"复制到剪贴板",className:"flex-shrink-0",children:b?r.jsx(mi,{className:"h-4 w-4 text-green-500"}):r.jsx(vx,{className:"h-4 w-4"})}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsxs(ne,{variant:"outline",disabled:x,className:"gap-2 flex-1 sm:flex-none",children:[r.jsx(Ia,{className:he("h-4 w-4",x&&"animate-spin")}),r.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),r.jsx("span",{className:"sm:hidden",children:"生成"})]})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认重新生成 Token"}),r.jsx(Qt,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:I,children:"确认生成"})]})]})]})]})]}),r.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),r.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),r.jsxs("div",{className:"relative",children:[r.jsx(Te,{id:"new-token",type:d?"text":"password",value:a,onChange:J=>l(J.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),r.jsx("button",{onClick:()=>m(!d),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:d?"隐藏":"显示",children:d?r.jsx(yx,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(Ha,{className:"h-4 w-4 text-muted-foreground"})})]}),a&&r.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),r.jsx("div",{className:"space-y-1.5",children:O.rules.map(J=>r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[J.passed?r.jsx($r,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):r.jsx(bx,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx("span",{className:he(J.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:J.label})]},J.id))}),O.isValid&&r.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:r.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[r.jsx(mi,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),r.jsx(ne,{onClick:U,disabled:f||!O.isValid||!a,className:"w-full sm:w-auto",children:f?"更新中...":"更新自定义 Token"})]})]}),r.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[r.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),r.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[r.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),r.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),r.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),r.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),r.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),r.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function CA(){const e=as(),{toast:t}=or(),[n,a]=w.useState(!1),l=async()=>{a(!0);try{const o=localStorage.getItem("access-token"),c=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${o}`}}),d=await c.json();c.ok&&d.success?(t({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{e({to:"/setup"})},1e3)):t({title:"重置失败",description:d.message||"无法重置配置状态",variant:"destructive"})}catch(o){console.error("重置配置状态错误:",o),t({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{a(!1)}};return r.jsx("div",{className:"space-y-4 sm:space-y-6",children:r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),r.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[r.jsx("div",{className:"space-y-2",children:r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsxs(ne,{variant:"outline",disabled:n,className:"gap-2",children:[r.jsx(gT,{className:he("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认重新配置"}),r.jsx(Qt,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:l,children:"确认重置"})]})]})]})]})]})})}function TA(){return r.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",F1]}),r.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[r.jsxs("p",{children:["版本: ",P1]}),r.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),r.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",r.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),r.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[r.jsx("li",{children:"React 19.2.0"}),r.jsx("li",{children:"TypeScript 5.7.2"}),r.jsx("li",{children:"Vite 6.0.7"}),r.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),r.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[r.jsx("li",{children:"shadcn/ui"}),r.jsx("li",{children:"Radix UI"}),r.jsx("li",{children:"Tailwind CSS 3.4.17"}),r.jsx("li",{children:"Lucide Icons"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("p",{className:"font-medium text-foreground",children:"后端"}),r.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[r.jsx("li",{children:"Python 3.12+"}),r.jsx("li",{children:"FastAPI"}),r.jsx("li",{children:"Uvicorn"}),r.jsx("li",{children:"WebSocket"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),r.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[r.jsx("li",{children:"Bun / npm"}),r.jsx("li",{children:"ESLint 9.17.0"}),r.jsx("li",{children:"PostCSS"})]})]})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),r.jsx(an,{className:"h-[300px] sm:h-[400px]",children:r.jsxs("div",{className:"space-y-4 pr-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(Tn,{name:"React",description:"用户界面构建库",license:"MIT"}),r.jsx(Tn,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),r.jsx(Tn,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),r.jsx(Tn,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),r.jsx(Tn,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(Tn,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),r.jsx(Tn,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(Tn,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),r.jsx(Tn,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(Tn,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),r.jsx(Tn,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),r.jsx(Tn,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),r.jsx(Tn,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(Tn,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),r.jsx(Tn,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(Tn,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),r.jsx(Tn,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),r.jsx(Tn,{name:"Pydantic",description:"数据验证库",license:"MIT"}),r.jsx(Tn,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(Tn,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),r.jsx(Tn,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),r.jsx(Tn,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),r.jsx(Tn,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:r.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[r.jsx("div",{className:"flex-shrink-0 mt-0.5",children:r.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:r.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Tn({name:e,description:t,license:n}){return r.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-foreground truncate",children:e}),r.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:t})]}),r.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:n})]})}function Ap({value:e,current:t,onChange:n,label:a,description:l}){const o=t===e;return r.jsxs("button",{onClick:()=>n(e),className:he("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",o?"border-primary bg-accent":"border-border"),children:[o&&r.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-sm sm:text-base font-medium",children:a}),r.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:l})]}),r.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[e==="light"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),r.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),r.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),e==="dark"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),r.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),r.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),e==="system"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),r.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),r.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function Sa({value:e,current:t,onChange:n,label:a,colorClass:l}){const o=t===e;return r.jsxs("button",{onClick:()=>n(e),className:he("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",o?"border-primary bg-accent":"border-border"),children:[o&&r.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),r.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[r.jsx("div",{className:he("h-8 w-8 sm:h-10 sm:w-10 rounded-full",l)}),r.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:a})]})]})}class _A{grad3;p;perm;constructor(t=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let n=0;n<256;n++)this.p[n]=Math.floor(Math.random()*256);this.perm=[];for(let n=0;n<512;n++)this.perm[n]=this.p[n&255]}dot(t,n,a){return t[0]*n+t[1]*a}mix(t,n,a){return(1-a)*t+a*n}fade(t){return t*t*t*(t*(t*6-15)+10)}perlin2(t,n){const a=Math.floor(t)&255,l=Math.floor(n)&255;t-=Math.floor(t),n-=Math.floor(n);const o=this.fade(t),c=this.fade(n),d=this.perm[a]+l,m=this.perm[d],f=this.perm[d+1],p=this.perm[a+1]+l,x=this.perm[p],y=this.perm[p+1];return this.mix(this.mix(this.dot(this.grad3[m%12],t,n),this.dot(this.grad3[x%12],t-1,n),o),this.mix(this.dot(this.grad3[f%12],t,n-1),this.dot(this.grad3[y%12],t-1,n-1),o),c)}}function EA(){const e=w.useRef(null),t=w.useRef(null),n=w.useRef(void 0),a=w.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new _A(Math.random()),bounding:null});return w.useEffect(()=>{const l=t.current,o=e.current;if(!l||!o)return;const c=a.current,d=()=>{const k=l.getBoundingClientRect();c.bounding=k,o.style.width=`${k.width}px`,o.style.height=`${k.height}px`},m=()=>{if(!c.bounding)return;const{width:k,height:S}=c.bounding;c.lines=[],c.paths.forEach(U=>U.remove()),c.paths=[];const T=10,M=32,A=k+200,R=S+30,B=Math.ceil(A/T),O=Math.ceil(R/M),L=(k-T*B)/2,$=(S-M*O)/2;for(let U=0;U<=B;U++){const I=[];for(let ee=0;ee<=O;ee++){const Ne={x:L+T*U,y:$+M*ee,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};I.push(Ne)}const G=document.createElementNS("http://www.w3.org/2000/svg","path");o.appendChild(G),c.paths.push(G),c.lines.push(I)}},f=k=>{const{lines:S,mouse:T,noise:M}=c;S.forEach(A=>{A.forEach(R=>{const B=M.perlin2((R.x+k*.0125)*.002,(R.y+k*.005)*.0015)*12;R.wave.x=Math.cos(B)*32,R.wave.y=Math.sin(B)*16;const O=R.x-T.sx,L=R.y-T.sy,$=Math.hypot(O,L),U=Math.max(175,T.vs);if(${const T={x:k.x+k.wave.x+(S?k.cursor.x:0),y:k.y+k.wave.y+(S?k.cursor.y:0)};return T.x=Math.round(T.x*10)/10,T.y=Math.round(T.y*10)/10,T},x=()=>{const{lines:k,paths:S}=c;k.forEach((T,M)=>{let A=p(T[0],!1),R=`M ${A.x} ${A.y}`;T.forEach((B,O)=>{const L=O===T.length-1;A=p(B,!L),R+=`L ${A.x} ${A.y}`}),S[M].setAttribute("d",R)})},y=k=>{const{mouse:S}=c;S.sx+=(S.x-S.sx)*.1,S.sy+=(S.y-S.sy)*.1;const T=S.x-S.lx,M=S.y-S.ly,A=Math.hypot(T,M);S.v=A,S.vs+=(A-S.vs)*.1,S.vs=Math.min(100,S.vs),S.lx=S.x,S.ly=S.y,S.a=Math.atan2(M,T),l&&(l.style.setProperty("--x",`${S.sx}px`),l.style.setProperty("--y",`${S.sy}px`)),f(k),x(),n.current=requestAnimationFrame(y)},b=k=>{if(!c.bounding)return;const{mouse:S}=c;S.x=k.pageX-c.bounding.left,S.y=k.pageY-c.bounding.top+window.scrollY,S.set||(S.sx=S.x,S.sy=S.y,S.lx=S.x,S.ly=S.y,S.set=!0)},N=()=>{d(),m()};return d(),m(),window.addEventListener("resize",N),window.addEventListener("mousemove",b),n.current=requestAnimationFrame(y),()=>{window.removeEventListener("resize",N),window.removeEventListener("mousemove",b),n.current&&cancelAnimationFrame(n.current)}},[]),r.jsxs("div",{ref:t,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[r.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),r.jsx("svg",{ref:e,style:{display:"block",width:"100%",height:"100%"},children:r.jsx("style",{children:` + path { + fill: none; + stroke: hsl(var(--primary) / 0.20); + stroke-width: 1px; + } + `})})]})}function MA(){const e=as();w.useEffect(()=>{localStorage.getItem("access-token")||e({to:"/auth"})},[e])}function hj(){return!!localStorage.getItem("access-token")}function AA(){const[e,t]=w.useState(""),[n,a]=w.useState(!1),[l,o]=w.useState(""),c=as(),{enableWavesBackground:d,setEnableWavesBackground:m}=Fw(),{theme:f,setTheme:p}=B1();w.useEffect(()=>{hj()&&c({to:"/"})},[c]);const y=f==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":f,b=()=>{p(y==="dark"?"light":"dark")},N=async k=>{if(k.preventDefault(),o(""),!e.trim()){o("请输入 Access Token");return}a(!0);try{const S=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e.trim()})}),T=await S.json();if(S.ok&&T.valid){localStorage.setItem("access-token",e.trim());const M=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${e.trim()}`}}),A=await M.json();M.ok&&A.is_first_setup?c({to:"/setup"}):c({to:"/"})}else o(T.message||"Token 验证失败,请检查后重试")}catch(S){console.error("Token 验证错误:",S),o("连接服务器失败,请检查网络连接")}finally{a(!1)}};return r.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[d&&r.jsx(EA,{}),r.jsxs(ct,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[r.jsx("button",{onClick:b,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:y==="dark"?"切换到浅色模式":"切换到深色模式",children:y==="dark"?r.jsx(wx,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):r.jsx(jx,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),r.jsxs(Lt,{className:"space-y-4 text-center",children:[r.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:r.jsx($y,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Bt,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),r.jsx(Qn,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),r.jsx(Gt,{children:r.jsxs("form",{onSubmit:N,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),r.jsxs("div",{className:"relative",children:[r.jsx(vT,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),r.jsx(Te,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:e,onChange:k=>t(k.target.value),className:he("pl-10",l&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),l&&r.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[r.jsx(xi,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),r.jsx("span",{children:l})]}),r.jsx(ne,{type:"submit",className:"w-full",disabled:n,children:n?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),r.jsxs(ir,{children:[r.jsx(I1,{asChild:!0,children:r.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[r.jsx(yT,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),r.jsxs(Jn,{className:"sm:max-w-md",children:[r.jsxs(er,{children:[r.jsxs(tr,{className:"flex items-center gap-2",children:[r.jsx($y,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),r.jsx(xr,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(bT,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),r.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[r.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),r.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),r.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Nl,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),r.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:r.jsx("code",{className:"text-primary",children:"data/webui.json"})}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",r.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),r.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(xi,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),r.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[r.jsx("p",{className:"font-semibold",children:"安全提示"}),r.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[r.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),r.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[r.jsx(fu,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsxs(Kt,{className:"flex items-center gap-2",children:[r.jsx(fu,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),r.jsx(Qt,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),r.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>m(!1),children:"关闭动画"})]})]})]})]})})]}),r.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:r.jsx("p",{children:sA})})]})}const fn=w.forwardRef(({className:e,...t},n)=>r.jsx("textarea",{className:he("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));fn.displayName="Textarea";var DA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],zA=DA.reduce((e,t)=>{const n=f1(`Primitive.${t}`),a=w.forwardRef((l,o)=>{const{asChild:c,...d}=l,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(m,{...d,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),OA="Separator",Mb="horizontal",RA=["horizontal","vertical"],fj=w.forwardRef((e,t)=>{const{decorative:n,orientation:a=Mb,...l}=e,o=LA(a)?a:Mb,d=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return r.jsx(zA.div,{"data-orientation":o,...d,...l,ref:t})});fj.displayName=OA;function LA(e){return RA.includes(e)}var pj=fj;const vu=w.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...a},l)=>r.jsx(pj,{ref:l,decorative:n,orientation:t,className:he("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...a}));vu.displayName=pj.displayName;const BA=Ko("inline-flex items-center rounded-md 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 shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function un({className:e,variant:t,...n}){return r.jsx("div",{className:he(BA({variant:t}),e),...n})}function PA({config:e,onChange:t}){const n=l=>{l.trim()&&!e.alias_names.includes(l.trim())&&t({...e,alias_names:[...e.alias_names,l.trim()]})},a=l=>{t({...e,alias_names:e.alias_names.filter((o,c)=>c!==l)})};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"qq_account",children:"QQ账号 *"}),r.jsx(Te,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:e.qq_account||"",onChange:l=>t({...e,qq_account:Number(l.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"nickname",children:"昵称 *"}),r.jsx(Te,{id:"nickname",placeholder:"请输入机器人的昵称",value:e.nickname,onChange:l=>t({...e,nickname:l.target.value})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{children:"别名"}),r.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:e.alias_names.map((l,o)=>r.jsxs(un,{variant:"secondary",className:"gap-1",children:[l,r.jsx("button",{type:"button",onClick:()=>a(o),className:"ml-1 hover:text-destructive",children:r.jsx(Au,{className:"h-3 w-3"})})]},o))}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:l=>{l.key==="Enter"&&(n(l.target.value),l.target.value="")}}),r.jsx(ne,{type:"button",variant:"outline",onClick:()=>{const l=document.getElementById("alias_input");l&&(n(l.value),l.value="")},children:"添加"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function FA({config:e,onChange:t}){return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"personality",children:"人格特征 *"}),r.jsx(fn,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:e.personality,onChange:n=>t({...e,personality:n.target.value}),rows:3}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"reply_style",children:"表达风格 *"}),r.jsx(fn,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:e.reply_style,onChange:n=>t({...e,reply_style:n.target.value}),rows:3}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"interest",children:"兴趣 *"}),r.jsx(fn,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:e.interest,onChange:n=>t({...e,interest:n.target.value}),rows:2}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),r.jsx(vu,{}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"plan_style",children:"群聊说话规则 *"}),r.jsx(fn,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:e.plan_style,onChange:n=>t({...e,plan_style:n.target.value}),rows:4}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),r.jsx(fn,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:e.private_plan_style,onChange:n=>t({...e,private_plan_style:n.target.value}),rows:3}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function IA({config:e,onChange:t}){return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{htmlFor:"emoji_chance",children:"表情包激活概率"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[(e.emoji_chance*100).toFixed(0),"%"]})]}),r.jsx(Te,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:e.emoji_chance,onChange:n=>t({...e,emoji_chance:Number(n.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"max_reg_num",children:"最大表情包数量"}),r.jsx(Te,{id:"max_reg_num",type:"number",min:"1",max:"200",value:e.max_reg_num,onChange:n=>t({...e,max_reg_num:Number(n.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Q,{htmlFor:"do_replace",children:"达到最大数量时替换"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),r.jsx(vt,{id:"do_replace",checked:e.do_replace,onCheckedChange:n=>t({...e,do_replace:n})})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),r.jsx(Te,{id:"check_interval",type:"number",min:"1",max:"120",value:e.check_interval,onChange:n=>t({...e,check_interval:Number(n.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),r.jsx(vu,{}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Q,{htmlFor:"steal_emoji",children:"偷取表情包"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),r.jsx(vt,{id:"steal_emoji",checked:e.steal_emoji,onCheckedChange:n=>t({...e,steal_emoji:n})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Q,{htmlFor:"content_filtration",children:"启用表情包过滤"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),r.jsx(vt,{id:"content_filtration",checked:e.content_filtration,onCheckedChange:n=>t({...e,content_filtration:n})})]}),e.content_filtration&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"filtration_prompt",children:"过滤要求"}),r.jsx(Te,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:e.filtration_prompt,onChange:n=>t({...e,filtration_prompt:n.target.value})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function qA({config:e,onChange:t}){return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Q,{htmlFor:"enable_tool",children:"启用工具系统"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),r.jsx(vt,{id:"enable_tool",checked:e.enable_tool,onCheckedChange:n=>t({...e,enable_tool:n})})]}),r.jsx(vu,{}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Q,{htmlFor:"enable_mood",children:"启用情绪系统"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),r.jsx(vt,{id:"enable_mood",checked:e.enable_mood,onCheckedChange:n=>t({...e,enable_mood:n})})]}),e.enable_mood&&r.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),r.jsx(Te,{id:"mood_update_threshold",type:"number",min:"0.1",max:"10",step:"0.1",value:e.mood_update_threshold||1,onChange:n=>t({...e,mood_update_threshold:Number(n.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"emotion_style",children:"情感特征"}),r.jsx(fn,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:e.emotion_style||"",onChange:n=>t({...e,emotion_style:n.target.value}),rows:2}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),r.jsx(vu,{}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Q,{htmlFor:"all_global",children:"启用全局黑话模式"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),r.jsx(vt,{id:"all_global",checked:e.all_global,onCheckedChange:n=>t({...e,all_global:n})})]})]})}async function lt(e,t){const n=await fetch(e,t);if(n.status===401)throw localStorage.removeItem("access-token"),window.location.href="/auth",new Error("认证失败,请重新登录");return n}function pt(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function HA(){const e=await lt("/api/webui/config/bot",{method:"GET",headers:pt()});if(!e.ok)throw new Error("读取Bot配置失败");const n=(await e.json()).config.bot||{};return{qq_account:n.qq_account||0,nickname:n.nickname||"",alias_names:n.alias_names||[]}}async function UA(){const e=await lt("/api/webui/config/bot",{method:"GET",headers:pt()});if(!e.ok)throw new Error("读取人格配置失败");const n=(await e.json()).config.personality||{};return{personality:n.personality||"",reply_style:n.reply_style||"",interest:n.interest||"",plan_style:n.plan_style||"",private_plan_style:n.private_plan_style||""}}async function $A(){const e=await lt("/api/webui/config/bot",{method:"GET",headers:pt()});if(!e.ok)throw new Error("读取表情包配置失败");const n=(await e.json()).config.emoji||{};return{emoji_chance:n.emoji_chance??.4,max_reg_num:n.max_reg_num??40,do_replace:n.do_replace??!0,check_interval:n.check_interval??10,steal_emoji:n.steal_emoji??!0,content_filtration:n.content_filtration??!1,filtration_prompt:n.filtration_prompt||""}}async function VA(){const e=await lt("/api/webui/config/bot",{method:"GET",headers:pt()});if(!e.ok)throw new Error("读取其他配置失败");const n=(await e.json()).config,a=n.tool||{},l=n.mood||{},o=n.jargon||{};return{enable_tool:a.enable_tool??!0,enable_mood:l.enable_mood??!1,mood_update_threshold:l.mood_update_threshold,emotion_style:l.emotion_style,all_global:o.all_global??!0}}async function GA(e){const t=await lt("/api/webui/config/bot/section/bot",{method:"POST",headers:pt(),body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await t.json()}async function YA(e){const t=await lt("/api/webui/config/bot/section/personality",{method:"POST",headers:pt(),body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.detail||"保存人格配置失败")}return await t.json()}async function WA(e){const t=await lt("/api/webui/config/bot/section/emoji",{method:"POST",headers:pt(),body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.detail||"保存表情包配置失败")}return await t.json()}async function XA(e){const t=[];t.push(lt("/api/webui/config/bot/section/tool",{method:"POST",headers:pt(),body:JSON.stringify({enable_tool:e.enable_tool})})),t.push(lt("/api/webui/config/bot/section/jargon",{method:"POST",headers:pt(),body:JSON.stringify({all_global:e.all_global})}));const n={enable_mood:e.enable_mood};e.enable_mood&&(n.mood_update_threshold=e.mood_update_threshold||1,n.emotion_style=e.emotion_style||""),t.push(lt("/api/webui/config/bot/section/mood",{method:"POST",headers:pt(),body:JSON.stringify(n)}));const a=await Promise.all(t);for(const l of a)if(!l.ok){const o=await l.json();throw new Error(o.detail||"保存其他配置失败")}return{success:!0}}async function Ab(){const e=localStorage.getItem("access-token"),t=await lt("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${e}`}});if(!t.ok){const n=await t.json();throw new Error(n.message||"标记配置完成失败")}return await t.json()}function KA(){const e=as(),{toast:t}=or(),[n,a]=w.useState(0),[l,o]=w.useState(!1),[c,d]=w.useState(!1),[m,f]=w.useState(!0),[p,x]=w.useState({qq_account:0,nickname:"",alias_names:[]}),[y,b]=w.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 +2.如果相同的内容已经被执行,请不要重复执行 +3.请控制你的发言频率,不要太过频繁的发言 +4.如果有人对你感到厌烦,请减少回复 +5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 +2.如果相同的内容已经被执行,请不要重复执行 +3.某句话如果已经被回复过,不要重复回复`}),[N,k]=w.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[S,T]=w.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遭遇特定事件的时候起伏较大",all_global:!0}),M=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:jT},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:l6},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:N1},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:Pa},{id:"complete",title:"完成设置",description:"后续配置提示",icon:fu}],A=(n+1)/M.length*100;w.useEffect(()=>{(async()=>{try{f(!0);const[G,ee,Ne,J]=await Promise.all([HA(),UA(),$A(),VA()]);x(G),b(ee),k(Ne),T(J)}catch(G){t({title:"加载配置失败",description:G instanceof Error?G.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{f(!1)}})()},[t]);const R=async()=>{d(!0);try{switch(n){case 0:await GA(p);break;case 1:await YA(y);break;case 2:await WA(N);break;case 3:await XA(S);break}return t({title:"保存成功",description:`${M[n].title}配置已保存`}),!0}catch(I){return t({title:"保存失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"}),!1}finally{d(!1)}},B=async()=>{await R()&&n{n>0&&a(n-1)},L=async()=>{o(!0);try{if(!await R()){o(!1);return}await Ab(),t({title:"配置完成",description:"所有配置已保存,正在跳转..."}),setTimeout(()=>{e({to:"/"})},500)}catch(I){t({title:"完成失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"})}finally{o(!1)}},$=async()=>{try{await Ab(),e({to:"/"})}catch(I){t({title:"跳过失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"})}},U=()=>{switch(n){case 0:return r.jsx(PA,{config:p,onChange:x});case 1:return r.jsx(FA,{config:y,onChange:b});case 2:return r.jsx(IA,{config:N,onChange:k});case 3:return r.jsx(qA,{config:S,onChange:T});case 4:return r.jsxs("div",{className:"space-y-6 text-center py-8",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(fu,{className:"h-8 w-8 text-primary",strokeWidth:2})}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"text-xl font-semibold",children:"模型配置"}),r.jsx("p",{className:"text-muted-foreground max-w-md mx-auto",children:"为了让机器人正常工作,您需要配置 AI 模型提供商和模型。"})]}),r.jsxs("div",{className:"rounded-lg border bg-muted/50 p-6 max-w-md mx-auto text-left space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"mt-0.5",children:r.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"1"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"配置 API 提供商"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → API 提供商"中添加您的 API 提供商信息'})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"mt-0.5",children:r.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"2"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"添加模型"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型列表"中添加需要使用的模型'})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"mt-0.5",children:r.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"3"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"配置模型任务"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型任务配置"中为不同任务分配模型'})]})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"💡 提示:完成向导后,您可以在系统设置中进行详细的模型配置"})]});default:return null}};return r.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),r.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),m?r.jsxs("div",{className:"relative z-10 text-center",children:[r.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:r.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),r.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[r.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[r.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:r.jsx(wT,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),r.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),r.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",F1," 的初始配置"]})]}),r.jsxs("div",{className:"mb-6 md:mb-8",children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[r.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",M.length]}),r.jsxs("span",{className:"font-medium text-primary",children:[Math.round(A),"%"]})]}),r.jsx(Fu,{value:A,className:"h-2"})]}),r.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:M.map((I,G)=>{const ee=I.icon;return r.jsxs("div",{className:he("flex flex-1 flex-col items-center gap-1 md:gap-2",Ge({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[r.jsx(J0,{className:"h-4 w-4"}),"返回首页"]}),r.jsxs(ne,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[r.jsx(i6,{className:"h-4 w-4"}),"返回上一页"]})]}),r.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var gj=["PageUp","PageDown"],vj=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],yj={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Qo="Slider",[Dx,QA,ZA]=bm(Qo),[bj]=Ua(Qo,[ZA]),[JA,Bm]=bj(Qo),wj=w.forwardRef((e,t)=>{const{name:n,min:a=0,max:l=100,step:o=1,orientation:c="horizontal",disabled:d=!1,minStepsBetweenThumbs:m=0,defaultValue:f=[a],value:p,onValueChange:x=()=>{},onValueCommit:y=()=>{},inverted:b=!1,form:N,...k}=e,S=w.useRef(new Set),T=w.useRef(0),A=c==="horizontal"?eD:tD,[R=[],B]=zl({prop:p,defaultProp:f,onChange:G=>{[...S.current][T.current]?.focus(),x(G)}}),O=w.useRef(R);function L(G){const ee=lD(R,G);I(G,ee)}function $(G){I(G,T.current)}function U(){const G=O.current[T.current];R[T.current]!==G&&y(R)}function I(G,ee,{commit:Ne}={commit:!1}){const J=uD(o),se=dD(Math.round((G-a)/o)*o+a,J),H=h1(se,[a,l]);B((le=[])=>{const re=aD(le,H,ee);if(cD(re,m*o)){T.current=re.indexOf(H);const ge=String(re)!==String(le);return ge&&Ne&&y(re),ge?re:le}else return le})}return r.jsx(JA,{scope:e.__scopeSlider,name:n,disabled:d,min:a,max:l,valueIndexToChangeRef:T,thumbs:S.current,values:R,orientation:c,form:N,children:r.jsx(Dx.Provider,{scope:e.__scopeSlider,children:r.jsx(Dx.Slot,{scope:e.__scopeSlider,children:r.jsx(A,{"aria-disabled":d,"data-disabled":d?"":void 0,...k,ref:t,onPointerDown:Pe(k.onPointerDown,()=>{d||(O.current=R)}),min:a,max:l,inverted:b,onSlideStart:d?void 0:L,onSlideMove:d?void 0:$,onSlideEnd:d?void 0:U,onHomeKeyDown:()=>!d&&I(a,0,{commit:!0}),onEndKeyDown:()=>!d&&I(l,R.length-1,{commit:!0}),onStepKeyDown:({event:G,direction:ee})=>{if(!d){const se=gj.includes(G.key)||G.shiftKey&&vj.includes(G.key)?10:1,H=T.current,le=R[H],re=o*se*ee;I(le+re,H,{commit:!0})}}})})})})});wj.displayName=Qo;var[jj,Nj]=bj(Qo,{startEdge:"left",endEdge:"right",size:"width",direction:1}),eD=w.forwardRef((e,t)=>{const{min:n,max:a,dir:l,inverted:o,onSlideStart:c,onSlideMove:d,onSlideEnd:m,onStepKeyDown:f,...p}=e,[x,y]=w.useState(null),b=mn(t,A=>y(A)),N=w.useRef(void 0),k=Eu(l),S=k==="ltr",T=S&&!o||!S&&o;function M(A){const R=N.current||x.getBoundingClientRect(),B=[0,R.width],L=q1(B,T?[n,a]:[a,n]);return N.current=R,L(A-R.left)}return r.jsx(jj,{scope:e.__scopeSlider,startEdge:T?"left":"right",endEdge:T?"right":"left",direction:T?1:-1,size:"width",children:r.jsx(Sj,{dir:k,"data-orientation":"horizontal",...p,ref:b,style:{...p.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:A=>{const R=M(A.clientX);c?.(R)},onSlideMove:A=>{const R=M(A.clientX);d?.(R)},onSlideEnd:()=>{N.current=void 0,m?.()},onStepKeyDown:A=>{const B=yj[T?"from-left":"from-right"].includes(A.key);f?.({event:A,direction:B?-1:1})}})})}),tD=w.forwardRef((e,t)=>{const{min:n,max:a,inverted:l,onSlideStart:o,onSlideMove:c,onSlideEnd:d,onStepKeyDown:m,...f}=e,p=w.useRef(null),x=mn(t,p),y=w.useRef(void 0),b=!l;function N(k){const S=y.current||p.current.getBoundingClientRect(),T=[0,S.height],A=q1(T,b?[a,n]:[n,a]);return y.current=S,A(k-S.top)}return r.jsx(jj,{scope:e.__scopeSlider,startEdge:b?"bottom":"top",endEdge:b?"top":"bottom",size:"height",direction:b?1:-1,children:r.jsx(Sj,{"data-orientation":"vertical",...f,ref:x,style:{...f.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:k=>{const S=N(k.clientY);o?.(S)},onSlideMove:k=>{const S=N(k.clientY);c?.(S)},onSlideEnd:()=>{y.current=void 0,d?.()},onStepKeyDown:k=>{const T=yj[b?"from-bottom":"from-top"].includes(k.key);m?.({event:k,direction:T?-1:1})}})})}),Sj=w.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:a,onSlideMove:l,onSlideEnd:o,onHomeKeyDown:c,onEndKeyDown:d,onStepKeyDown:m,...f}=e,p=Bm(Qo,n);return r.jsx(It.span,{...f,ref:t,onKeyDown:Pe(e.onKeyDown,x=>{x.key==="Home"?(c(x),x.preventDefault()):x.key==="End"?(d(x),x.preventDefault()):gj.concat(vj).includes(x.key)&&(m(x),x.preventDefault())}),onPointerDown:Pe(e.onPointerDown,x=>{const y=x.target;y.setPointerCapture(x.pointerId),x.preventDefault(),p.thumbs.has(y)?y.focus():a(x)}),onPointerMove:Pe(e.onPointerMove,x=>{x.target.hasPointerCapture(x.pointerId)&&l(x)}),onPointerUp:Pe(e.onPointerUp,x=>{const y=x.target;y.hasPointerCapture(x.pointerId)&&(y.releasePointerCapture(x.pointerId),o(x))})})}),kj="SliderTrack",Cj=w.forwardRef((e,t)=>{const{__scopeSlider:n,...a}=e,l=Bm(kj,n);return r.jsx(It.span,{"data-disabled":l.disabled?"":void 0,"data-orientation":l.orientation,...a,ref:t})});Cj.displayName=kj;var zx="SliderRange",Tj=w.forwardRef((e,t)=>{const{__scopeSlider:n,...a}=e,l=Bm(zx,n),o=Nj(zx,n),c=w.useRef(null),d=mn(t,c),m=l.values.length,f=l.values.map(y=>Mj(y,l.min,l.max)),p=m>1?Math.min(...f):0,x=100-Math.max(...f);return r.jsx(It.span,{"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,...a,ref:d,style:{...e.style,[o.startEdge]:p+"%",[o.endEdge]:x+"%"}})});Tj.displayName=zx;var Ox="SliderThumb",_j=w.forwardRef((e,t)=>{const n=QA(e.__scopeSlider),[a,l]=w.useState(null),o=mn(t,d=>l(d)),c=w.useMemo(()=>a?n().findIndex(d=>d.ref.current===a):-1,[n,a]);return r.jsx(nD,{...e,ref:o,index:c})}),nD=w.forwardRef((e,t)=>{const{__scopeSlider:n,index:a,name:l,...o}=e,c=Bm(Ox,n),d=Nj(Ox,n),[m,f]=w.useState(null),p=mn(t,M=>f(M)),x=m?c.form||!!m.closest("form"):!0,y=q5(m),b=c.values[a],N=b===void 0?0:Mj(b,c.min,c.max),k=sD(a,c.values.length),S=y?.[d.size],T=S?iD(S,N,d.direction):0;return w.useEffect(()=>{if(m)return c.thumbs.add(m),()=>{c.thumbs.delete(m)}},[m,c.thumbs]),r.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[d.startEdge]:`calc(${N}% + ${T}px)`},children:[r.jsx(Dx.ItemSlot,{scope:e.__scopeSlider,children:r.jsx(It.span,{role:"slider","aria-label":e["aria-label"]||k,"aria-valuemin":c.min,"aria-valuenow":b,"aria-valuemax":c.max,"aria-orientation":c.orientation,"data-orientation":c.orientation,"data-disabled":c.disabled?"":void 0,tabIndex:c.disabled?void 0:0,...o,ref:p,style:b===void 0?{display:"none"}:e.style,onFocus:Pe(e.onFocus,()=>{c.valueIndexToChangeRef.current=a})})}),x&&r.jsx(Ej,{name:l??(c.name?c.name+(c.values.length>1?"[]":""):void 0),form:c.form,value:b},a)]})});_j.displayName=Ox;var rD="RadioBubbleInput",Ej=w.forwardRef(({__scopeSlider:e,value:t,...n},a)=>{const l=w.useRef(null),o=mn(l,a),c=I5(t);return w.useEffect(()=>{const d=l.current;if(!d)return;const m=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(m,"value").set;if(c!==t&&p){const x=new Event("input",{bubbles:!0});p.call(d,t),d.dispatchEvent(x)}},[c,t]),r.jsx(It.input,{style:{display:"none"},...n,ref:o,defaultValue:t})});Ej.displayName=rD;function aD(e=[],t,n){const a=[...e];return a[n]=t,a.sort((l,o)=>l-o)}function Mj(e,t,n){const o=100/(n-t)*(e-t);return h1(o,[0,100])}function sD(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function lD(e,t){if(e.length===1)return 0;const n=e.map(l=>Math.abs(l-t)),a=Math.min(...n);return n.indexOf(a)}function iD(e,t,n){const a=e/2,o=q1([0,50],[0,a]);return(a-o(t)*n)*n}function oD(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function cD(e,t){if(t>0){const n=oD(e);return Math.min(...n)>=t}return!0}function q1(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const a=(t[1]-t[0])/(e[1]-e[0]);return t[0]+a*(n-e[0])}}function uD(e){return(String(e).split(".")[1]||"").length}function dD(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var Aj=wj,mD=Cj,hD=Tj,fD=_j;const Pm=w.forwardRef(({className:e,...t},n)=>r.jsxs(Aj,{ref:n,className:he("relative flex w-full touch-none select-none items-center",e),...t,children:[r.jsx(mD,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:r.jsx(hD,{className:"absolute h-full bg-primary"})}),r.jsx(fD,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));Pm.displayName=Aj.displayName;const _t=lT,Et=iT,jt=w.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(V5,{ref:a,className:he("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,r.jsx(tT,{asChild:!0,children:r.jsx(pu,{className:"h-4 w-4 opacity-50"})})]}));jt.displayName=V5.displayName;const Dj=w.forwardRef(({className:e,...t},n)=>r.jsx(G5,{ref:n,className:he("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Nx,{className:"h-4 w-4"})}));Dj.displayName=G5.displayName;const zj=w.forwardRef(({className:e,...t},n)=>r.jsx(Y5,{ref:n,className:he("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(pu,{className:"h-4 w-4"})}));zj.displayName=Y5.displayName;const Nt=w.forwardRef(({className:e,children:t,position:n="popper",...a},l)=>r.jsx(nT,{children:r.jsxs(W5,{ref:l,className:he("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 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 origin-[--radix-select-content-transform-origin]",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",e),position:n,...a,children:[r.jsx(Dj,{}),r.jsx(rT,{className:he("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(zj,{})]})}));Nt.displayName=W5.displayName;const pD=w.forwardRef(({className:e,...t},n)=>r.jsx(X5,{ref:n,className:he("px-2 py-1.5 text-sm font-semibold",e),...t}));pD.displayName=X5.displayName;const Oe=w.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(K5,{ref:a,className:he("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(aT,{children:r.jsx(mi,{className:"h-4 w-4"})})}),r.jsx(sT,{children:t})]}));Oe.displayName=K5.displayName;const xD=w.forwardRef(({className:e,...t},n)=>r.jsx(Q5,{ref:n,className:he("-mx-1 my-1 h-px bg-muted",e),...t}));xD.displayName=Q5.displayName;function gD(e){const t=vD(e),n=w.forwardRef((a,l)=>{const{children:o,...c}=a,d=w.Children.toArray(o),m=d.find(bD);if(m){const f=m.props.children,p=d.map(x=>x===m?w.Children.count(f)>1?w.Children.only(null):w.isValidElement(f)?f.props.children:null:x);return r.jsx(t,{...c,ref:l,children:w.isValidElement(f)?w.cloneElement(f,void 0,p):null})}return r.jsx(t,{...c,ref:l,children:o})});return n.displayName=`${e}.Slot`,n}function vD(e){const t=w.forwardRef((n,a)=>{const{children:l,...o}=n;if(w.isValidElement(l)){const c=jD(l),d=wD(o,l.props);return l.type!==w.Fragment&&(d.ref=a?Sl(a,c):c),w.cloneElement(l,d)}return w.Children.count(l)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var yD=Symbol("radix.slottable");function bD(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===yD}function wD(e,t){const n={...t};for(const a in t){const l=e[a],o=t[a];/^on[A-Z]/.test(a)?l&&o?n[a]=(...d)=>{const m=o(...d);return l(...d),m}:l&&(n[a]=l):a==="style"?n[a]={...l,...o}:a==="className"&&(n[a]=[l,o].filter(Boolean).join(" "))}return{...e,...n}}function jD(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Fm="Popover",[Oj]=Ua(Fm,[Vo]),Iu=Vo(),[ND,Ol]=Oj(Fm),Rj=e=>{const{__scopePopover:t,children:n,open:a,defaultOpen:l,onOpenChange:o,modal:c=!1}=e,d=Iu(t),m=w.useRef(null),[f,p]=w.useState(!1),[x,y]=zl({prop:a,defaultProp:l??!1,onChange:o,caller:Fm});return r.jsx(Sm,{...d,children:r.jsx(ND,{scope:t,contentId:Ta(),triggerRef:m,open:x,onOpenChange:y,onOpenToggle:w.useCallback(()=>y(b=>!b),[y]),hasCustomAnchor:f,onCustomAnchorAdd:w.useCallback(()=>p(!0),[]),onCustomAnchorRemove:w.useCallback(()=>p(!1),[]),modal:c,children:n})})};Rj.displayName=Fm;var Lj="PopoverAnchor",SD=w.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,l=Ol(Lj,n),o=Iu(n),{onCustomAnchorAdd:c,onCustomAnchorRemove:d}=l;return w.useEffect(()=>(c(),()=>d()),[c,d]),r.jsx(km,{...o,...a,ref:t})});SD.displayName=Lj;var Bj="PopoverTrigger",Pj=w.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,l=Ol(Bj,n),o=Iu(n),c=mn(t,l.triggerRef),d=r.jsx(It.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":Uj(l.open),...a,ref:c,onClick:Pe(e.onClick,l.onOpenToggle)});return l.hasCustomAnchor?d:r.jsx(km,{asChild:!0,...o,children:d})});Pj.displayName=Bj;var H1="PopoverPortal",[kD,CD]=Oj(H1,{forceMount:void 0}),Fj=e=>{const{__scopePopover:t,forceMount:n,children:a,container:l}=e,o=Ol(H1,t);return r.jsx(kD,{scope:t,forceMount:n,children:r.jsx(Wr,{present:n||o.open,children:r.jsx(Nm,{asChild:!0,container:l,children:a})})})};Fj.displayName=H1;var qo="PopoverContent",Ij=w.forwardRef((e,t)=>{const n=CD(qo,e.__scopePopover),{forceMount:a=n.forceMount,...l}=e,o=Ol(qo,e.__scopePopover);return r.jsx(Wr,{present:a||o.open,children:o.modal?r.jsx(_D,{...l,ref:t}):r.jsx(ED,{...l,ref:t})})});Ij.displayName=qo;var TD=gD("PopoverContent.RemoveScroll"),_D=w.forwardRef((e,t)=>{const n=Ol(qo,e.__scopePopover),a=w.useRef(null),l=mn(t,a),o=w.useRef(!1);return w.useEffect(()=>{const c=a.current;if(c)return Z5(c)},[]),r.jsx(J5,{as:TD,allowPinchZoom:!0,children:r.jsx(qj,{...e,ref:l,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Pe(e.onCloseAutoFocus,c=>{c.preventDefault(),o.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Pe(e.onPointerDownOutside,c=>{const d=c.detail.originalEvent,m=d.button===0&&d.ctrlKey===!0,f=d.button===2||m;o.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:Pe(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1})})})}),ED=w.forwardRef((e,t)=>{const n=Ol(qo,e.__scopePopover),a=w.useRef(!1),l=w.useRef(!1);return r.jsx(qj,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(a.current||n.triggerRef.current?.focus(),o.preventDefault()),a.current=!1,l.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(a.current=!0,o.detail.originalEvent.type==="pointerdown"&&(l.current=!0));const c=o.target;n.triggerRef.current?.contains(c)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&l.current&&o.preventDefault()}})}),qj=w.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:o,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:f,onInteractOutside:p,...x}=e,y=Ol(qo,n),b=Iu(n);return e6(),r.jsx(t6,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:l,onUnmountAutoFocus:o,children:r.jsx(b1,{asChild:!0,disableOutsidePointerEvents:c,onInteractOutside:p,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:f,onDismiss:()=>y.onOpenChange(!1),children:r.jsx(w1,{"data-state":Uj(y.open),role:"dialog",id:y.contentId,...b,...x,ref:t,style:{...x.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Hj="PopoverClose",MD=w.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,l=Ol(Hj,n);return r.jsx(It.button,{type:"button",...a,ref:t,onClick:Pe(e.onClick,()=>l.onOpenChange(!1))})});MD.displayName=Hj;var AD="PopoverArrow",DD=w.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,l=Iu(n);return r.jsx(j1,{...l,...a,ref:t})});DD.displayName=AD;function Uj(e){return e?"open":"closed"}var zD=Rj,OD=Pj,RD=Fj,$j=Ij;const Cl=zD,Tl=OD,Ps=w.forwardRef(({className:e,align:t="center",sideOffset:n=4,...a},l)=>r.jsx(RD,{children:r.jsx($j,{ref:l,align:t,sideOffset:n,className:he("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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 origin-[--radix-popover-content-transform-origin]",e),...a})}));Ps.displayName=$j.displayName;const Zo="/api/webui/config";async function LD(){const t=await(await lt(`${Zo}/bot`)).json();if(!t.success)throw new Error("获取配置数据失败");return t.config}async function zo(){const t=await(await lt(`${Zo}/model`)).json();if(!t.success)throw new Error("获取模型配置数据失败");return t.config}async function Db(e){const n=await(await lt(`${Zo}/bot`,{method:"POST",headers:pt(),body:JSON.stringify(e)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function om(e){const n=await(await lt(`${Zo}/model`,{method:"POST",headers:pt(),body:JSON.stringify(e)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function BD(e,t){const a=await(await lt(`${Zo}/bot/section/${e}`,{method:"POST",headers:pt(),body:JSON.stringify(t)})).json();if(!a.success)throw new Error(a.message||`保存配置节 ${e} 失败`)}async function Rx(e,t){const a=await(await lt(`${Zo}/model/section/${e}`,{method:"POST",headers:pt(),body:JSON.stringify(t)})).json();if(!a.success)throw new Error(a.message||`保存配置节 ${e} 失败`)}const PD=An.create({baseURL:"",timeout:1e4});async function U1(){try{return(await PD.post("/api/webui/system/restart")).data}catch(e){throw console.error("重启麦麦失败:",e),e}}const FD=Ko("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),qu=w.forwardRef(({className:e,variant:t,...n},a)=>r.jsx("div",{ref:a,role:"alert",className:he(FD({variant:t}),e),...n}));qu.displayName="Alert";const ID=w.forwardRef(({className:e,...t},n)=>r.jsx("h5",{ref:n,className:he("mb-1 font-medium leading-none tracking-tight",e),...t}));ID.displayName="AlertTitle";const Hu=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:he("text-sm [&_p]:leading-relaxed",e),...t}));Hu.displayName="AlertDescription";function $1({onRestartComplete:e,onRestartFailed:t}){const[n,a]=w.useState(0),[l,o]=w.useState("restarting"),[c,d]=w.useState(0),[m,f]=w.useState(0);w.useEffect(()=>{const y=setInterval(()=>{a(k=>k>=90?k:k+1)},200),b=setInterval(()=>{d(k=>k+1)},1e3),N=setTimeout(()=>{o("checking"),p()},3e3);return()=>{clearInterval(y),clearInterval(b),clearTimeout(N)}},[]);const p=()=>{const b=async()=>{try{if(f(k=>k+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)a(100),o("success"),setTimeout(()=>{e?.()},1500);else throw new Error("Status check failed")}catch{m<60?setTimeout(b,2e3):(o("failed"),t?.())}};b()},x=y=>{const b=Math.floor(y/60),N=y%60;return`${b}:${N.toString().padStart(2,"0")}`};return r.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:r.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[r.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[l==="restarting"&&r.jsxs(r.Fragment,{children:[r.jsx(xu,{className:"h-16 w-16 text-primary animate-spin"}),r.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),r.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),l==="checking"&&r.jsxs(r.Fragment,{children:[r.jsx(xu,{className:"h-16 w-16 text-primary animate-spin"}),r.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),r.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",m,"/60)"]})]}),l==="success"&&r.jsxs(r.Fragment,{children:[r.jsx($r,{className:"h-16 w-16 text-green-500"}),r.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),r.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),l==="failed"&&r.jsxs(r.Fragment,{children:[r.jsx(xi,{className:"h-16 w-16 text-destructive"}),r.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),r.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),l!=="failed"&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Fu,{value:n,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[n,"%"]}),r.jsxs("span",{children:["已用时: ",x(c)]})]})]}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:r.jsxs("p",{className:"text-sm text-muted-foreground",children:[l==="restarting"&&"🔄 配置已保存,正在重启主程序...",l==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",l==="success"&&"✅ 配置已生效,服务运行正常",l==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),l==="failed"&&r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),r.jsx("button",{onClick:()=>{o("checking"),f(0),p()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}function qD(){const[e,t]=w.useState(!0),[n,a]=w.useState(!1),[l,o]=w.useState(!1),[c,d]=w.useState(!1),[m,f]=w.useState(!1),[p,x]=w.useState(!1),{toast:y}=or(),[b,N]=w.useState(null),[k,S]=w.useState(null),[T,M]=w.useState(null),[A,R]=w.useState(null),[B,O]=w.useState(null),[L,$]=w.useState(null),[U,I]=w.useState(null),[G,ee]=w.useState(null),[Ne,J]=w.useState(null),[se,H]=w.useState(null),[le,re]=w.useState(null),[ge,E]=w.useState(null),[we,Z]=w.useState(null),[z,X]=w.useState(null),[q,ce]=w.useState(null),[fe,De]=w.useState(null),[oe,He]=w.useState(null),[at,je]=w.useState(null),Ze=w.useRef(null),qe=w.useRef(!0),Ot=w.useRef({}),bn=w.useCallback(async()=>{try{t(!0);const $e=await LD();Ot.current=$e,N($e.bot),S($e.personality);const Fn=$e.chat;Fn.talk_value_rules||(Fn.talk_value_rules=[]),M(Fn),R($e.expression),O($e.emoji),$($e.memory),I($e.tool),ee($e.mood),J($e.voice),H($e.lpmm_knowledge),re($e.keyword_reaction),E($e.response_post_process),Z($e.chinese_typo),X($e.response_splitter),ce($e.log),De($e.debug),He($e.maim_message),je($e.telemetry),d(!1),qe.current=!1}catch($e){console.error("加载配置失败:",$e),y({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{t(!1)}},[y]);w.useEffect(()=>{bn()},[bn]);const Dn=w.useCallback(async($e,Fn)=>{if(!qe.current)try{o(!0),await BD($e,Fn),d(!1)}catch(K){console.error(`自动保存 ${$e} 失败:`,K),d(!0)}finally{o(!1)}},[]),Xe=w.useCallback(($e,Fn)=>{qe.current||(d(!0),Ze.current&&clearTimeout(Ze.current),Ze.current=setTimeout(()=>{Dn($e,Fn)},2e3))},[Dn]);w.useEffect(()=>{b&&!qe.current&&Xe("bot",b)},[b,Xe]),w.useEffect(()=>{k&&!qe.current&&Xe("personality",k)},[k,Xe]),w.useEffect(()=>{T&&!qe.current&&Xe("chat",T)},[T,Xe]),w.useEffect(()=>{A&&!qe.current&&Xe("expression",A)},[A,Xe]),w.useEffect(()=>{B&&!qe.current&&Xe("emoji",B)},[B,Xe]),w.useEffect(()=>{L&&!qe.current&&Xe("memory",L)},[L,Xe]),w.useEffect(()=>{U&&!qe.current&&Xe("tool",U)},[U,Xe]),w.useEffect(()=>{G&&!qe.current&&Xe("mood",G)},[G,Xe]),w.useEffect(()=>{Ne&&!qe.current&&Xe("voice",Ne)},[Ne,Xe]),w.useEffect(()=>{se&&!qe.current&&Xe("lpmm_knowledge",se)},[se,Xe]),w.useEffect(()=>{le&&!qe.current&&Xe("keyword_reaction",le)},[le,Xe]),w.useEffect(()=>{ge&&!qe.current&&Xe("response_post_process",ge)},[ge,Xe]),w.useEffect(()=>{we&&!qe.current&&Xe("chinese_typo",we)},[we,Xe]),w.useEffect(()=>{z&&!qe.current&&Xe("response_splitter",z)},[z,Xe]),w.useEffect(()=>{q&&!qe.current&&Xe("log",q)},[q,Xe]),w.useEffect(()=>{fe&&!qe.current&&Xe("debug",fe)},[fe,Xe]),w.useEffect(()=>{oe&&!qe.current&&Xe("maim_message",oe)},[oe,Xe]),w.useEffect(()=>{at&&!qe.current&&Xe("telemetry",at)},[at,Xe]);const wn=async()=>{try{a(!0),Ze.current&&clearTimeout(Ze.current);const $e={...Ot.current,bot:b,personality:k,chat:T,expression:A,emoji:B,memory:L,tool:U,mood:G,voice:Ne,lpmm_knowledge:se,keyword_reaction:le,response_post_process:ge,chinese_typo:we,response_splitter:z,log:q,debug:fe,maim_message:oe,telemetry:at};await Db($e),d(!1),y({title:"保存成功",description:"麦麦主程序配置已保存"})}catch($e){console.error("保存配置失败:",$e),y({title:"保存失败",description:$e.message,variant:"destructive"})}finally{a(!1)}},Wn=async()=>{try{f(!0),U1().catch(()=>{}),x(!0)}catch($e){console.error("重启失败:",$e),x(!1),y({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),f(!1)}},Ar=async()=>{try{a(!0),Ze.current&&clearTimeout(Ze.current);const $e={...Ot.current,bot:b,personality:k,chat:T,expression:A,emoji:B,memory:L,tool:U,mood:G,voice:Ne,lpmm_knowledge:se,keyword_reaction:le,response_post_process:ge,chinese_typo:we,response_splitter:z,log:q,debug:fe,maim_message:oe,telemetry:at};await Db($e),d(!1),y({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(Fn=>setTimeout(Fn,500)),await Wn()}catch($e){console.error("保存失败:",$e),y({title:"保存失败",description:$e.message,variant:"destructive"})}finally{a(!1)}},Cn=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},cr=()=>{x(!1),f(!1),y({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return e?r.jsx(an,{className:"h-full",children:r.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):r.jsx(an,{className:"h-full",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),r.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),r.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[r.jsxs(ne,{onClick:wn,disabled:n||l||!c||m,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[r.jsx(Cm,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":l?"自动保存中...":c?"保存配置":"已保存"]}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsxs(ne,{disabled:n||l||m,size:"sm",className:"flex-1 sm:flex-none",children:[r.jsx(S1,{className:"mr-2 h-4 w-4"}),m?"重启中...":c?"保存并重启":"重启麦麦"]})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认重启麦麦?"}),r.jsx(Qt,{children:c?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:c?Ar:Wn,children:c?"保存并重启":"确认重启"})]})]})]})]})]}),r.jsxs(qu,{children:[r.jsx(pi,{className:"h-4 w-4"}),r.jsxs(Hu,{children:["配置更新后需要",r.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),r.jsxs(kl,{defaultValue:"bot",className:"w-full",children:[r.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:r.jsxs(Bs,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[r.jsx(Pt,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),r.jsx(Pt,{value:"personality",className:"flex-shrink-0",children:"人格"}),r.jsx(Pt,{value:"chat",className:"flex-shrink-0",children:"聊天"}),r.jsx(Pt,{value:"expression",className:"flex-shrink-0",children:"表达"}),r.jsx(Pt,{value:"features",className:"flex-shrink-0",children:"功能"}),r.jsx(Pt,{value:"processing",className:"flex-shrink-0",children:"处理"}),r.jsx(Pt,{value:"mood",className:"flex-shrink-0",children:"情绪"}),r.jsx(Pt,{value:"voice",className:"flex-shrink-0",children:"语音"}),r.jsx(Pt,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),r.jsx(Pt,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),r.jsx(cn,{value:"bot",className:"space-y-4",children:b&&r.jsx(HD,{config:b,onChange:N})}),r.jsx(cn,{value:"personality",className:"space-y-4",children:k&&r.jsx(UD,{config:k,onChange:S})}),r.jsx(cn,{value:"chat",className:"space-y-4",children:T&&r.jsx($D,{config:T,onChange:M})}),r.jsx(cn,{value:"expression",className:"space-y-4",children:A&&r.jsx(VD,{config:A,onChange:R})}),r.jsx(cn,{value:"features",className:"space-y-4",children:B&&L&&U&&r.jsx(GD,{emojiConfig:B,memoryConfig:L,toolConfig:U,onEmojiChange:O,onMemoryChange:$,onToolChange:I})}),r.jsx(cn,{value:"processing",className:"space-y-4",children:le&&ge&&we&&z&&r.jsx(YD,{keywordReactionConfig:le,responsePostProcessConfig:ge,chineseTypoConfig:we,responseSplitterConfig:z,onKeywordReactionChange:re,onResponsePostProcessChange:E,onChineseTypoChange:Z,onResponseSplitterChange:X})}),r.jsx(cn,{value:"mood",className:"space-y-4",children:G&&r.jsx(WD,{config:G,onChange:ee})}),r.jsx(cn,{value:"voice",className:"space-y-4",children:Ne&&r.jsx(XD,{config:Ne,onChange:J})}),r.jsx(cn,{value:"lpmm",className:"space-y-4",children:se&&r.jsx(KD,{config:se,onChange:H})}),r.jsxs(cn,{value:"other",className:"space-y-4",children:[q&&r.jsx(QD,{config:q,onChange:ce}),fe&&r.jsx(ZD,{config:fe,onChange:De}),oe&&r.jsx(JD,{config:oe,onChange:He}),at&&r.jsx(ez,{config:at,onChange:je})]})]}),p&&r.jsx($1,{onRestartComplete:Cn,onRestartFailed:cr})]})})}function HD({config:e,onChange:t}){const n=()=>{t({...e,platforms:[...e.platforms,""]})},a=m=>{t({...e,platforms:e.platforms.filter((f,p)=>p!==m)})},l=(m,f)=>{const p=[...e.platforms];p[m]=f,t({...e,platforms:p})},o=()=>{t({...e,alias_names:[...e.alias_names,""]})},c=m=>{t({...e,alias_names:e.alias_names.filter((f,p)=>p!==m)})},d=(m,f)=>{const p=[...e.alias_names];p[m]=f,t({...e,alias_names:p})};return r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"platform",children:"平台"}),r.jsx(Te,{id:"platform",value:e.platform,onChange:m=>t({...e,platform:m.target.value}),placeholder:"qq"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"qq_account",children:"QQ账号"}),r.jsx(Te,{id:"qq_account",value:e.qq_account,onChange:m=>t({...e,qq_account:m.target.value}),placeholder:"123456789"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"nickname",children:"昵称"}),r.jsx(Te,{id:"nickname",value:e.nickname,onChange:m=>t({...e,nickname:m.target.value}),placeholder:"麦麦"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{children:"其他平台账号"}),r.jsxs(ne,{onClick:n,size:"sm",variant:"outline",children:[r.jsx(pr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),r.jsxs("div",{className:"space-y-2",children:[e.platforms.map((m,f)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{value:m,onChange:p=>l(f,p.target.value),placeholder:"wx:114514"}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"icon",variant:"outline",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:['确定要删除平台账号 "',m||"(空)",'" 吗?此操作无法撤销。']})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>a(f),children:"删除"})]})]})]})]},f)),e.platforms.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{children:"别名"}),r.jsxs(ne,{onClick:o,size:"sm",variant:"outline",children:[r.jsx(pr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),r.jsxs("div",{className:"space-y-2",children:[e.alias_names.map((m,f)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{value:m,onChange:p=>d(f,p.target.value),placeholder:"小麦"}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"icon",variant:"outline",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:['确定要删除别名 "',m||"(空)",'" 吗?此操作无法撤销。']})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>c(f),children:"删除"})]})]})]})]},f)),e.alias_names.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function UD({config:e,onChange:t}){const n=()=>{t({...e,states:[...e.states,""]})},a=o=>{t({...e,states:e.states.filter((c,d)=>d!==o)})},l=(o,c)=>{const d=[...e.states];d[o]=c,t({...e,states:d})};return r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"personality",children:"人格特质"}),r.jsx(fn,{id:"personality",value:e.personality,onChange:o=>t({...e,personality:o.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"reply_style",children:"表达风格"}),r.jsx(fn,{id:"reply_style",value:e.reply_style,onChange:o=>t({...e,reply_style:o.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"interest",children:"兴趣"}),r.jsx(fn,{id:"interest",value:e.interest,onChange:o=>t({...e,interest:o.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"plan_style",children:"说话规则与行为风格"}),r.jsx(fn,{id:"plan_style",value:e.plan_style,onChange:o=>t({...e,plan_style:o.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"visual_style",children:"识图规则"}),r.jsx(fn,{id:"visual_style",value:e.visual_style,onChange:o=>t({...e,visual_style:o.target.value}),placeholder:"识图时的处理规则",rows:3})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"private_plan_style",children:"私聊规则"}),r.jsx(fn,{id:"private_plan_style",value:e.private_plan_style,onChange:o=>t({...e,private_plan_style:o.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{children:"状态列表(人格多样性)"}),r.jsxs(ne,{onClick:n,size:"sm",variant:"outline",children:[r.jsx(pr,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),r.jsx("div",{className:"space-y-2",children:e.states.map((o,c)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(fn,{value:o,onChange:d=>l(c,d.target.value),placeholder:"描述一个人格状态",rows:2}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"icon",variant:"outline",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsx(Qt,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>a(c),children:"删除"})]})]})]})]},c))})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"state_probability",children:"状态替换概率"}),r.jsx(Te,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:e.state_probability,onChange:o=>t({...e,state_probability:parseFloat(o.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function $D({config:e,onChange:t}){const n=()=>{t({...e,talk_value_rules:[...e.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},a=d=>{t({...e,talk_value_rules:e.talk_value_rules.filter((m,f)=>f!==d)})},l=(d,m,f)=>{const p=[...e.talk_value_rules];p[d]={...p[d],[m]:f},t({...e,talk_value_rules:p})},o=({value:d,onChange:m})=>{const[f,p]=w.useState("00"),[x,y]=w.useState("00"),[b,N]=w.useState("23"),[k,S]=w.useState("59");w.useEffect(()=>{const M=d.split("-");if(M.length===2){const[A,R]=M,[B,O]=A.split(":"),[L,$]=R.split(":");B&&p(B.padStart(2,"0")),O&&y(O.padStart(2,"0")),L&&N(L.padStart(2,"0")),$&&S($.padStart(2,"0"))}},[d]);const T=(M,A,R,B)=>{const O=`${M}:${A}-${R}:${B}`;m(O)};return r.jsxs(Cl,{children:[r.jsx(Tl,{asChild:!0,children:r.jsxs(ne,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[r.jsx(di,{className:"h-4 w-4 mr-2"}),d||"选择时间段"]})}),r.jsx(Ps,{className:"w-80",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-xs",children:"小时"}),r.jsxs(_t,{value:f,onValueChange:M=>{p(M),T(M,x,b,k)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsx(Nt,{children:Array.from({length:24},(M,A)=>A).map(M=>r.jsx(Oe,{value:M.toString().padStart(2,"0"),children:M.toString().padStart(2,"0")},M))})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-xs",children:"分钟"}),r.jsxs(_t,{value:x,onValueChange:M=>{y(M),T(f,M,b,k)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsx(Nt,{children:Array.from({length:60},(M,A)=>A).map(M=>r.jsx(Oe,{value:M.toString().padStart(2,"0"),children:M.toString().padStart(2,"0")},M))})]})]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-xs",children:"小时"}),r.jsxs(_t,{value:b,onValueChange:M=>{N(M),T(f,x,M,k)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsx(Nt,{children:Array.from({length:24},(M,A)=>A).map(M=>r.jsx(Oe,{value:M.toString().padStart(2,"0"),children:M.toString().padStart(2,"0")},M))})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-xs",children:"分钟"}),r.jsxs(_t,{value:k,onValueChange:M=>{S(M),T(f,x,b,M)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsx(Nt,{children:Array.from({length:60},(M,A)=>A).map(M=>r.jsx(Oe,{value:M.toString().padStart(2,"0"),children:M.toString().padStart(2,"0")},M))})]})]})]})]})]})})]})},c=({rule:d})=>{const m=`{ target = "${d.target}", time = "${d.time}", value = ${d.value.toFixed(1)} }`;return r.jsxs(Cl,{children:[r.jsx(Tl,{asChild:!0,children:r.jsxs(ne,{variant:"outline",size:"sm",children:[r.jsx(Ha,{className:"h-4 w-4 mr-1"}),"预览"]})}),r.jsx(Ps,{className:"w-96",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),r.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:m}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),r.jsx(Te,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:e.talk_value,onChange:d=>t({...e,talk_value:parseFloat(d.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"mentioned_bot_reply",children:"提及回复增幅"}),r.jsx(Te,{id:"mentioned_bot_reply",type:"number",step:"0.1",min:"0",max:"1",value:e.mentioned_bot_reply,onChange:d=>t({...e,mentioned_bot_reply:parseFloat(d.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"提及时回复概率增幅,1 为 100% 回复"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"max_context_size",children:"上下文长度"}),r.jsx(Te,{id:"max_context_size",type:"number",min:"1",value:e.max_context_size,onChange:d=>t({...e,max_context_size:parseInt(d.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"planner_smooth",children:"规划器平滑"}),r.jsx(Te,{id:"planner_smooth",type:"number",step:"1",min:"0",value:e.planner_smooth,onChange:d=>t({...e,planner_smooth:parseFloat(d.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"enable_talk_value_rules",checked:e.enable_talk_value_rules,onCheckedChange:d=>t({...e,enable_talk_value_rules:d})}),r.jsx(Q,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"include_planner_reasoning",checked:e.include_planner_reasoning,onCheckedChange:d=>t({...e,include_planner_reasoning:d})}),r.jsx(Q,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),e.enable_talk_value_rules&&r.jsxs("div",{className:"border-t pt-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),r.jsxs(ne,{onClick:n,size:"sm",children:[r.jsx(pr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),e.talk_value_rules&&e.talk_value_rules.length>0?r.jsx("div",{className:"space-y-4",children:e.talk_value_rules.map((d,m)=>r.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",m+1]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(c,{rule:d}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{variant:"ghost",size:"sm",children:r.jsx(zt,{className:"h-4 w-4 text-destructive"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:["确定要删除规则 #",m+1," 吗?此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>a(m),children:"删除"})]})]})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"配置类型"}),r.jsxs(_t,{value:d.target===""?"global":"specific",onValueChange:f=>{f==="global"?l(m,"target",""):l(m,"target","qq::group")},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"global",children:"全局配置"}),r.jsx(Oe,{value:"specific",children:"详细配置"})]})]})]}),d.target!==""&&(()=>{const f=d.target.split(":"),p=f[0]||"qq",x=f[1]||"",y=f[2]||"group";return r.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"平台"}),r.jsxs(_t,{value:p,onValueChange:b=>{l(m,"target",`${b}:${x}:${y}`)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"qq",children:"QQ"}),r.jsx(Oe,{value:"wx",children:"微信"})]})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"群 ID"}),r.jsx(Te,{value:x,onChange:b=>{l(m,"target",`${p}:${b.target.value}:${y}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"类型"}),r.jsxs(_t,{value:y,onValueChange:b=>{l(m,"target",`${p}:${x}:${b}`)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"group",children:"群组(group)"}),r.jsx(Oe,{value:"private",children:"私聊(private)"})]})]})]})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",d.target||"(未设置)"]})]})})(),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"时间段 (Time)"}),r.jsx(o,{value:d.time,onChange:f=>l(m,"time",f)}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{htmlFor:`rule-value-${m}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),r.jsx(Te,{id:`rule-value-${m}`,type:"number",step:"0.01",min:"0",max:"1",value:d.value,onChange:f=>{const p=parseFloat(f.target.value);isNaN(p)||l(m,"value",Math.max(0,Math.min(1,p)))},className:"w-20 h-8 text-xs"})]}),r.jsx(Pm,{value:[d.value],onValueChange:f=>l(m,"value",f[0]),min:0,max:1,step:.01,className:"w-full"}),r.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[r.jsx("span",{children:"0 (完全沉默)"}),r.jsx("span",{children:"0.5"}),r.jsx("span",{children:"1.0 (正常)"})]})]})]})]},m))}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:r.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),r.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[r.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),r.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[r.jsxs("li",{children:["• ",r.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),r.jsxs("li",{children:["• ",r.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),r.jsxs("li",{children:["• ",r.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),r.jsxs("li",{children:["• ",r.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),r.jsxs("li",{children:["• ",r.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function VD({config:e,onChange:t}){const n=()=>{t({...e,learning_list:[...e.learning_list,["","enable","enable","1.0"]]})},a=y=>{t({...e,learning_list:e.learning_list.filter((b,N)=>N!==y)})},l=(y,b,N)=>{const k=[...e.learning_list];k[y][b]=N,t({...e,learning_list:k})},o=({rule:y})=>{const b=`["${y[0]}", "${y[1]}", "${y[2]}", "${y[3]}"]`;return r.jsxs(Cl,{children:[r.jsx(Tl,{asChild:!0,children:r.jsxs(ne,{variant:"outline",size:"sm",children:[r.jsx(Ha,{className:"h-4 w-4 mr-1"}),"预览"]})}),r.jsx(Ps,{className:"w-96",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),r.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:b}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},c=({member:y,groupIndex:b,memberIndex:N,availableChatIds:k})=>{const S=k.includes(y)||y==="*",[T,M]=w.useState(!S);return r.jsxs("div",{className:"flex gap-2",children:[r.jsx("div",{className:"flex-1 flex gap-2",children:T?r.jsxs(r.Fragment,{children:[r.jsx(Te,{value:y,onChange:A=>x(b,N,A.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),k.length>0&&r.jsx(ne,{size:"sm",variant:"outline",onClick:()=>M(!1),title:"切换到下拉选择",children:"下拉"})]}):r.jsxs(r.Fragment,{children:[r.jsxs(_t,{value:y,onValueChange:A=>x(b,N,A),children:[r.jsx(jt,{className:"flex-1",children:r.jsx(Et,{placeholder:"选择聊天流"})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"*",children:"* (全局共享)"}),k.map((A,R)=>r.jsx(Oe,{value:A,children:A},R))]})]}),r.jsx(ne,{size:"sm",variant:"outline",onClick:()=>M(!0),title:"切换到手动输入",children:"输入"})]})}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"icon",variant:"outline",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:['确定要删除组成员 "',y||"(空)",'" 吗?此操作无法撤销。']})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>p(b,N),children:"删除"})]})]})]})]})},d=()=>{t({...e,expression_groups:[...e.expression_groups,[]]})},m=y=>{t({...e,expression_groups:e.expression_groups.filter((b,N)=>N!==y)})},f=y=>{const b=[...e.expression_groups];b[y]=[...b[y],""],t({...e,expression_groups:b})},p=(y,b)=>{const N=[...e.expression_groups];N[y]=N[y].filter((k,S)=>S!==b),t({...e,expression_groups:N})},x=(y,b,N)=>{const k=[...e.expression_groups];k[y][b]=N,t({...e,expression_groups:k})};return r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),r.jsxs(ne,{onClick:n,size:"sm",variant:"outline",children:[r.jsx(pr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),r.jsxs("div",{className:"space-y-4",children:[e.learning_list.map((y,b)=>{const N=e.learning_list.some((R,B)=>B!==b&&R[0]===""),k=y[0]==="",S=y[0].split(":"),T=S[0]||"qq",M=S[1]||"",A=S[2]||"group";return r.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-sm font-medium",children:["规则 ",b+1," ",k&&"(全局配置)"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(o,{rule:y}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"sm",variant:"ghost",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:["确定要删除学习规则 ",b+1," 吗?此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>a(b),children:"删除"})]})]})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"配置类型"}),r.jsxs(_t,{value:k?"global":"specific",onValueChange:R=>{R==="global"?l(b,0,""):l(b,0,"qq::group")},disabled:N&&!k,children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"global",children:"全局配置"}),r.jsx(Oe,{value:"specific",disabled:N&&!k,children:"详细配置"})]})]}),N&&!k&&r.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!k&&r.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"平台"}),r.jsxs(_t,{value:T,onValueChange:R=>{l(b,0,`${R}:${M}:${A}`)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"qq",children:"QQ"}),r.jsx(Oe,{value:"wx",children:"微信"})]})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"群 ID"}),r.jsx(Te,{value:M,onChange:R=>{l(b,0,`${T}:${R.target.value}:${A}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"类型"}),r.jsxs(_t,{value:A,onValueChange:R=>{l(b,0,`${T}:${M}:${R}`)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"group",children:"群组(group)"}),r.jsx(Oe,{value:"private",children:"私聊(private)"})]})]})]})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",y[0]||"(未设置)"]})]}),r.jsx("div",{className:"grid gap-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-xs font-medium",children:"使用学到的表达"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),r.jsx(vt,{checked:y[1]==="enable",onCheckedChange:R=>l(b,1,R?"enable":"disable")})]})}),r.jsx("div",{className:"grid gap-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-xs font-medium",children:"学习表达"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),r.jsx(vt,{checked:y[2]==="enable",onCheckedChange:R=>l(b,2,R?"enable":"disable")})]})}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{className:"text-xs font-medium",children:"学习强度"}),r.jsx(Te,{type:"number",step:"0.1",min:"0",max:"5",value:y[3],onChange:R=>{const B=parseFloat(R.target.value);isNaN(B)||l(b,3,Math.max(0,Math.min(5,B)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),r.jsx(Pm,{value:[parseFloat(y[3])||1],onValueChange:R=>l(b,3,R[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),r.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[r.jsx("span",{children:"0 (不学习)"}),r.jsx("span",{children:"2.5"}),r.jsx("span",{children:"5.0 (快速学习)"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},b)}),e.learning_list.length===0&&r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),r.jsxs(ne,{onClick:d,size:"sm",variant:"outline",children:[r.jsx(pr,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),r.jsxs("div",{className:"space-y-4",children:[e.expression_groups.map((y,b)=>{const N=e.learning_list.map(k=>k[0]).filter(k=>k!=="");return r.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",b+1,y.length===1&&y[0]==="*"&&"(全局共享)"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ne,{onClick:()=>f(b),size:"sm",variant:"outline",children:r.jsx(pr,{className:"h-4 w-4"})}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"sm",variant:"ghost",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:["确定要删除共享组 ",b+1," 吗?此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>m(b),children:"删除"})]})]})]})]})]}),r.jsx("div",{className:"space-y-2",children:y.map((k,S)=>r.jsx(c,{member:k,groupIndex:b,memberIndex:S,availableChatIds:N},S))}),r.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},b)}),e.expression_groups.length===0&&r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function GD({emojiConfig:e,memoryConfig:t,toolConfig:n,onEmojiChange:a,onMemoryChange:l,onToolChange:o}){return r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:c=>o({...n,enable_tool:c})}),r.jsx(Q,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),r.jsx(Te,{id:"max_agent_iterations",type:"number",min:"1",value:t.max_agent_iterations,onChange:c=>l({...t,max_agent_iterations:parseInt(c.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"emoji_chance",children:"表情包激活概率"}),r.jsx(Te,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:e.emoji_chance,onChange:c=>a({...e,emoji_chance:parseFloat(c.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"max_reg_num",children:"最大注册数量"}),r.jsx(Te,{id:"max_reg_num",type:"number",min:"1",value:e.max_reg_num,onChange:c=>a({...e,max_reg_num:parseInt(c.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),r.jsx(Te,{id:"check_interval",type:"number",min:"1",value:e.check_interval,onChange:c=>a({...e,check_interval:parseInt(c.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"do_replace",checked:e.do_replace,onCheckedChange:c=>a({...e,do_replace:c})}),r.jsx(Q,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"steal_emoji",checked:e.steal_emoji,onCheckedChange:c=>a({...e,steal_emoji:c})}),r.jsx(Q,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),r.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"content_filtration",checked:e.content_filtration,onCheckedChange:c=>a({...e,content_filtration:c})}),r.jsx(Q,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),e.content_filtration&&r.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[r.jsx(Q,{htmlFor:"filtration_prompt",children:"过滤要求"}),r.jsx(Te,{id:"filtration_prompt",value:e.filtration_prompt,onChange:c=>a({...e,filtration_prompt:c.target.value}),placeholder:"符合公序良俗"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function YD({keywordReactionConfig:e,responsePostProcessConfig:t,chineseTypoConfig:n,responseSplitterConfig:a,onKeywordReactionChange:l,onResponsePostProcessChange:o,onChineseTypoChange:c,onResponseSplitterChange:d}){const m=()=>{l({...e,regex_rules:[...e.regex_rules,{regex:[""],reaction:""}]})},f=R=>{l({...e,regex_rules:e.regex_rules.filter((B,O)=>O!==R)})},p=(R,B,O)=>{const L=[...e.regex_rules];B==="regex"&&typeof O=="string"?L[R]={...L[R],regex:[O]}:B==="reaction"&&typeof O=="string"&&(L[R]={...L[R],reaction:O}),l({...e,regex_rules:L})},x=({regex:R,reaction:B,onRegexChange:O,onReactionChange:L})=>{const[$,U]=w.useState(!1),[I,G]=w.useState(""),[ee,Ne]=w.useState(null),[J,se]=w.useState(""),[H,le]=w.useState({}),[re,ge]=w.useState(""),E=w.useRef(null),[we,Z]=w.useState("build"),z=fe=>fe.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),X=(fe,De=0)=>{const oe=E.current;if(!oe)return;const He=oe.selectionStart||0,at=oe.selectionEnd||0,je=R.substring(0,He)+fe+R.substring(at);O(je),setTimeout(()=>{const Ze=He+fe.length+De;oe.setSelectionRange(Ze,Ze),oe.focus()},0)};w.useEffect(()=>{if(!R||!I){Ne(null),le({}),ge(B),se("");return}try{const fe=z(R),De=new RegExp(fe,"g"),oe=I.match(De);Ne(oe),se("");const at=new RegExp(fe).exec(I);if(at&&at.groups){le(at.groups);let je=B;Object.entries(at.groups).forEach(([Ze,qe])=>{je=je.replace(new RegExp(`\\[${Ze}\\]`,"g"),qe||"")}),ge(je)}else le({}),ge(B)}catch(fe){se(fe.message),Ne(null),le({}),ge(B)}},[R,I,B]);const q=()=>{if(!I||!ee||ee.length===0)return r.jsx("span",{className:"text-muted-foreground",children:I||"请输入测试文本"});try{const fe=z(R),De=new RegExp(fe,"g");let oe=0;const He=[];let at;for(;(at=De.exec(I))!==null;)at.index>oe&&He.push(r.jsx("span",{children:I.substring(oe,at.index)},`text-${oe}`)),He.push(r.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:at[0]},`match-${at.index}`)),oe=at.index+at[0].length;return oe)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return r.jsxs(ir,{open:$,onOpenChange:U,children:[r.jsx(I1,{asChild:!0,children:r.jsxs(ne,{variant:"outline",size:"sm",children:[r.jsx(em,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),r.jsxs(Jn,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[r.jsxs(er,{children:[r.jsx(tr,{children:"正则表达式编辑器"}),r.jsx(xr,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),r.jsx(an,{className:"max-h-[calc(90vh-120px)]",children:r.jsxs(kl,{value:we,onValueChange:fe=>Z(fe),className:"w-full",children:[r.jsxs(Bs,{className:"grid w-full grid-cols-2",children:[r.jsx(Pt,{value:"build",children:"🔧 构建器"}),r.jsx(Pt,{value:"test",children:"🧪 测试器"})]}),r.jsxs(cn,{value:"build",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{className:"text-sm font-medium",children:"正则表达式"}),r.jsx(Te,{ref:E,value:R,onChange:fe=>O(fe.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{className:"text-sm font-medium",children:"Reaction 内容"}),r.jsx(fn,{value:B,onChange:fe=>L(fe.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),r.jsxs("div",{className:"space-y-4 border-t pt-4",children:[ce.map(fe=>r.jsxs("div",{className:"space-y-2",children:[r.jsx("h5",{className:"text-xs font-semibold text-primary",children:fe.category}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:fe.items.map(De=>r.jsx(ne,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>X(De.pattern,De.moveCursor||0),children:r.jsxs("div",{className:"flex flex-col items-start w-full",children:[r.jsxs("div",{className:"flex items-center gap-2 w-full",children:[r.jsx("span",{className:"text-xs font-medium",children:De.label}),r.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:De.pattern})]}),r.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:De.desc})]})},De.label))})]},fe.category)),r.jsxs("div",{className:"space-y-2 border-t pt-4",children:[r.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ne,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>O("^(?P\\S{1,20})是这样的$"),children:r.jsxs("div",{className:"flex flex-col items-start w-full",children:[r.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),r.jsx(ne,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>O("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:r.jsxs("div",{className:"flex flex-col items-start w-full",children:[r.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),r.jsx(ne,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>O("(?P.+?)(?:是|为什么|怎么)"),children:r.jsxs("div",{className:"flex flex-col items-start w-full",children:[r.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),r.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[r.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),r.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[r.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),r.jsxs("li",{children:["命名捕获组格式:",r.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),r.jsxs("li",{children:["在 reaction 中使用 ",r.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),r.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),r.jsxs(cn,{value:"test",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{className:"text-sm font-medium",children:"当前正则表达式"}),r.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:R||"(未设置)"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),r.jsx(fn,{id:"test-text",value:I,onChange:fe=>G(fe.target.value),placeholder:`在此输入要测试的文本... +例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),J&&r.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[r.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),r.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:J})]}),!J&&I&&r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex items-center gap-2",children:ee&&ee.length>0?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),r.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",ee.length," 处)"]})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),r.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{className:"text-sm font-medium",children:"匹配高亮"}),r.jsx(an,{className:"h-40 rounded-md bg-muted p-3",children:r.jsx("div",{className:"text-sm break-words",children:q()})})]}),Object.keys(H).length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{className:"text-sm font-medium",children:"命名捕获组"}),r.jsx(an,{className:"h-32 rounded-md border p-3",children:r.jsx("div",{className:"space-y-2",children:Object.entries(H).map(([fe,De])=>r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[r.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",fe,"]"]}),r.jsx("span",{className:"text-muted-foreground",children:"="}),r.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:De})]},fe))})})]}),Object.keys(H).length>0&&B&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{className:"text-sm font-medium",children:"Reaction 替换预览"}),r.jsx(an,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:r.jsx("div",{className:"text-sm break-words",children:re})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),r.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[r.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),r.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[r.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),r.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),r.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),r.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},y=()=>{l({...e,keyword_rules:[...e.keyword_rules,{keywords:[],reaction:""}]})},b=R=>{l({...e,keyword_rules:e.keyword_rules.filter((B,O)=>O!==R)})},N=(R,B,O)=>{const L=[...e.keyword_rules];typeof O=="string"&&(L[R]={...L[R],reaction:O}),l({...e,keyword_rules:L})},k=R=>{const B=[...e.keyword_rules];B[R]={...B[R],keywords:[...B[R].keywords||[],""]},l({...e,keyword_rules:B})},S=(R,B)=>{const O=[...e.keyword_rules];O[R]={...O[R],keywords:(O[R].keywords||[]).filter((L,$)=>$!==B)},l({...e,keyword_rules:O})},T=(R,B,O)=>{const L=[...e.keyword_rules],$=[...L[R].keywords||[]];$[B]=O,L[R]={...L[R],keywords:$},l({...e,keyword_rules:L})},M=({rule:R})=>{const B=`{ regex = [${(R.regex||[]).map(O=>`"${O}"`).join(", ")}], reaction = "${R.reaction}" }`;return r.jsxs(Cl,{children:[r.jsx(Tl,{asChild:!0,children:r.jsxs(ne,{variant:"outline",size:"sm",children:[r.jsx(Ha,{className:"h-4 w-4 mr-1"}),"预览"]})}),r.jsx(Ps,{className:"w-[95vw] sm:w-[500px]",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),r.jsx(an,{className:"h-60 rounded-md bg-muted p-3",children:r.jsx("pre",{className:"font-mono text-xs break-all",children:B})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},A=({rule:R})=>{const B=`[[keyword_reaction.keyword_rules]] +keywords = [${(R.keywords||[]).map(O=>`"${O}"`).join(", ")}] +reaction = "${R.reaction}"`;return r.jsxs(Cl,{children:[r.jsx(Tl,{asChild:!0,children:r.jsxs(ne,{variant:"outline",size:"sm",children:[r.jsx(Ha,{className:"h-4 w-4 mr-1"}),"预览"]})}),r.jsx(Ps,{className:"w-[95vw] sm:w-[500px]",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),r.jsx(an,{className:"h-60 rounded-md bg-muted p-3",children:r.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:B})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),r.jsxs(ne,{onClick:m,size:"sm",variant:"outline",children:[r.jsx(pr,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),r.jsxs("div",{className:"space-y-3",children:[e.regex_rules.map((R,B)=>r.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",B+1]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(x,{regex:R.regex&&R.regex[0]||"",reaction:R.reaction,onRegexChange:O=>p(B,"regex",O),onReactionChange:O=>p(B,"reaction",O)}),r.jsx(M,{rule:R}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"sm",variant:"ghost",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:["确定要删除正则规则 ",B+1," 吗?此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>f(B),children:"删除"})]})]})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),r.jsx(Te,{value:R.regex&&R.regex[0]||"",onChange:O=>p(B,"regex",O.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"反应内容"}),r.jsx(fn,{value:R.reaction,onChange:O=>p(B,"reaction",O.target.value),placeholder:`触发后麦麦的反应... +可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},B)),e.regex_rules.length===0&&r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),r.jsxs("div",{className:"space-y-4 border-t pt-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),r.jsxs(ne,{onClick:y,size:"sm",variant:"outline",children:[r.jsx(pr,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),r.jsxs("div",{className:"space-y-3",children:[e.keyword_rules.map((R,B)=>r.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",B+1]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(A,{rule:R}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"sm",variant:"ghost",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:["确定要删除关键词规则 ",B+1," 吗?此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>b(B),children:"删除"})]})]})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{className:"text-xs font-medium",children:"关键词列表"}),r.jsxs(ne,{onClick:()=>k(B),size:"sm",variant:"ghost",children:[r.jsx(pr,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),r.jsxs("div",{className:"space-y-2",children:[(R.keywords||[]).map((O,L)=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te,{value:O,onChange:$=>T(B,L,$.target.value),placeholder:"关键词",className:"flex-1"}),r.jsx(ne,{onClick:()=>S(B,L),size:"sm",variant:"ghost",children:r.jsx(zt,{className:"h-4 w-4"})})]},L)),(!R.keywords||R.keywords.length===0)&&r.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"反应内容"}),r.jsx(fn,{value:R.reaction,onChange:O=>N(B,"reaction",O.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},B)),e.keyword_rules.length===0&&r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"enable_response_post_process",checked:t.enable_response_post_process,onCheckedChange:R=>o({...t,enable_response_post_process:R})}),r.jsx(Q,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),t.enable_response_post_process&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"border-t pt-6 space-y-4",children:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[r.jsx(vt,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:R=>c({...n,enable:R})}),r.jsx(Q,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),r.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&r.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),r.jsx(Te,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:R=>c({...n,error_rate:parseFloat(R.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),r.jsx(Te,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:R=>c({...n,min_freq:parseInt(R.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),r.jsx(Te,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:R=>c({...n,tone_error_rate:parseFloat(R.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),r.jsx(Te,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:R=>c({...n,word_replace_rate:parseFloat(R.target.value)})})]})]})]})}),r.jsx("div",{className:"border-t pt-6 space-y-4",children:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[r.jsx(vt,{id:"enable_response_splitter",checked:a.enable,onCheckedChange:R=>d({...a,enable:R})}),r.jsx(Q,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),r.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),a.enable&&r.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),r.jsx(Te,{id:"max_length",type:"number",min:"1",value:a.max_length,onChange:R=>d({...a,max_length:parseInt(R.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),r.jsx(Te,{id:"max_sentence_num",type:"number",min:"1",value:a.max_sentence_num,onChange:R=>d({...a,max_sentence_num:parseInt(R.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"enable_kaomoji_protection",checked:a.enable_kaomoji_protection,onCheckedChange:R=>d({...a,enable_kaomoji_protection:R})}),r.jsx(Q,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"enable_overflow_return_all",checked:a.enable_overflow_return_all,onCheckedChange:R=>d({...a,enable_overflow_return_all:R})}),r.jsx(Q,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),r.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function WD({config:e,onChange:t}){return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{checked:e.enable_mood,onCheckedChange:n=>t({...e,enable_mood:n})}),r.jsx(Q,{className:"cursor-pointer",children:"启用情绪系统"})]}),e.enable_mood&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"情绪更新阈值"}),r.jsx(Te,{type:"number",min:"1",value:e.mood_update_threshold,onChange:n=>t({...e,mood_update_threshold:parseInt(n.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"情感特征"}),r.jsx(fn,{value:e.emotion_style,onChange:n=>t({...e,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function XD({config:e,onChange:t}){return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{checked:e.enable_asr,onCheckedChange:n=>t({...e,enable_asr:n})}),r.jsx(Q,{className:"cursor-pointer",children:"启用语音识别"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function KD({config:e,onChange:t}){return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{checked:e.enable,onCheckedChange:n=>t({...e,enable:n})}),r.jsx(Q,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),e.enable&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"LPMM 模式"}),r.jsxs(_t,{value:e.lpmm_mode,onValueChange:n=>t({...e,lpmm_mode:n}),children:[r.jsx(jt,{children:r.jsx(Et,{placeholder:"选择 LPMM 模式"})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"classic",children:"经典模式"}),r.jsx(Oe,{value:"agent",children:"Agent 模式"})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"同义词搜索 TopK"}),r.jsx(Te,{type:"number",min:"1",value:e.rag_synonym_search_top_k,onChange:n=>t({...e,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"同义词阈值"}),r.jsx(Te,{type:"number",step:"0.1",min:"0",max:"1",value:e.rag_synonym_threshold,onChange:n=>t({...e,rag_synonym_threshold:parseFloat(n.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"实体提取线程数"}),r.jsx(Te,{type:"number",min:"1",value:e.info_extraction_workers,onChange:n=>t({...e,info_extraction_workers:parseInt(n.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"嵌入向量维度"}),r.jsx(Te,{type:"number",min:"1",value:e.embedding_dimension,onChange:n=>t({...e,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function QD({config:e,onChange:t}){const[n,a]=w.useState(""),[l,o]=w.useState("WARNING"),c=()=>{n&&!e.suppress_libraries.includes(n)&&(t({...e,suppress_libraries:[...e.suppress_libraries,n]}),a(""))},d=b=>{t({...e,suppress_libraries:e.suppress_libraries.filter(N=>N!==b)})},m=()=>{n&&!e.library_log_levels[n]&&(t({...e,library_log_levels:{...e.library_log_levels,[n]:l}}),a(""),o("WARNING"))},f=b=>{const N={...e.library_log_levels};delete N[b],t({...e,library_log_levels:N})},p=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],x=["FULL","compact","lite"],y=["none","title","full"];return r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"日期格式"}),r.jsx(Te,{value:e.date_style,onChange:b=>t({...e,date_style:b.target.value}),placeholder:"例如: m-d H:i:s"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"日志级别样式"}),r.jsxs(_t,{value:e.log_level_style,onValueChange:b=>t({...e,log_level_style:b}),children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsx(Nt,{children:x.map(b=>r.jsx(Oe,{value:b,children:b},b))})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"日志文本颜色"}),r.jsxs(_t,{value:e.color_text,onValueChange:b=>t({...e,color_text:b}),children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsx(Nt,{children:y.map(b=>r.jsx(Oe,{value:b,children:b},b))})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"全局日志级别"}),r.jsxs(_t,{value:e.log_level,onValueChange:b=>t({...e,log_level:b}),children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsx(Nt,{children:p.map(b=>r.jsx(Oe,{value:b,children:b},b))})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"控制台日志级别"}),r.jsxs(_t,{value:e.console_log_level,onValueChange:b=>t({...e,console_log_level:b}),children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsx(Nt,{children:p.map(b=>r.jsx(Oe,{value:b,children:b},b))})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"文件日志级别"}),r.jsxs(_t,{value:e.file_log_level,onValueChange:b=>t({...e,file_log_level:b}),children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsx(Nt,{children:p.map(b=>r.jsx(Oe,{value:b,children:b},b))})]})]})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"mb-2 block",children:"完全屏蔽的库"}),r.jsxs("div",{className:"flex gap-2 mb-2",children:[r.jsx(Te,{value:n,onChange:b=>a(b.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),c())}}),r.jsx(ne,{onClick:c,size:"sm",className:"flex-shrink-0",children:r.jsx(pr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:e.suppress_libraries.map(b=>r.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[r.jsx("span",{className:"text-sm",children:b}),r.jsx(ne,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>d(b),children:r.jsx(zt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},b))})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"mb-2 block",children:"特定库的日志级别"}),r.jsxs("div",{className:"flex gap-2 mb-2",children:[r.jsx(Te,{value:n,onChange:b=>a(b.target.value),placeholder:"输入库名",className:"flex-1"}),r.jsxs(_t,{value:l,onValueChange:o,children:[r.jsx(jt,{className:"w-32",children:r.jsx(Et,{})}),r.jsx(Nt,{children:p.map(b=>r.jsx(Oe,{value:b,children:b},b))})]}),r.jsx(ne,{onClick:m,size:"sm",children:r.jsx(pr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),r.jsx("div",{className:"space-y-2",children:Object.entries(e.library_log_levels).map(([b,N])=>r.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[r.jsx("span",{className:"text-sm font-medium",children:b}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:N}),r.jsx(ne,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>f(b),children:r.jsx(zt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},b))})]})]})}function ZD({config:e,onChange:t}){return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Q,{children:"显示 Prompt"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),r.jsx(vt,{checked:e.show_prompt,onCheckedChange:n=>t({...e,show_prompt:n})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Q,{children:"显示回复器 Prompt"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),r.jsx(vt,{checked:e.show_replyer_prompt,onCheckedChange:n=>t({...e,show_replyer_prompt:n})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Q,{children:"显示回复器推理"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),r.jsx(vt,{checked:e.show_replyer_reasoning,onCheckedChange:n=>t({...e,show_replyer_reasoning:n})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Q,{children:"显示 Jargon Prompt"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),r.jsx(vt,{checked:e.show_jargon_prompt,onCheckedChange:n=>t({...e,show_jargon_prompt:n})})]})]})]})}function JD({config:e,onChange:t}){const[n,a]=w.useState(""),l=()=>{n&&!e.auth_token.includes(n)&&(t({...e,auth_token:[...e.auth_token,n]}),a(""))},o=c=>{t({...e,auth_token:e.auth_token.filter((d,m)=>m!==c)})};return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Q,{children:"启用自定义服务器"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),r.jsx(vt,{checked:e.use_custom,onCheckedChange:c=>t({...e,use_custom:c})})]}),e.use_custom&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"主机地址"}),r.jsx(Te,{value:e.host,onChange:c=>t({...e,host:c.target.value}),placeholder:"127.0.0.1"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"端口号"}),r.jsx(Te,{type:"number",value:e.port,onChange:c=>t({...e,port:parseInt(c.target.value)}),placeholder:"8090"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"连接模式"}),r.jsxs(_t,{value:e.mode,onValueChange:c=>t({...e,mode:c}),children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"ws",children:"WebSocket (ws)"}),r.jsx(Oe,{value:"tcp",children:"TCP"})]})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{checked:e.use_wss,onCheckedChange:c=>t({...e,use_wss:c}),disabled:e.mode!=="ws"}),r.jsx(Q,{children:"使用 WSS 安全连接"})]})]}),e.use_wss&&e.mode==="ws"&&r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"SSL 证书文件路径"}),r.jsx(Te,{value:e.cert_file,onChange:c=>t({...e,cert_file:c.target.value}),placeholder:"cert.pem"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"SSL 密钥文件路径"}),r.jsx(Te,{value:e.key_file,onChange:c=>t({...e,key_file:c.target.value}),placeholder:"key.pem"})]})]})]})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"mb-2 block",children:"认证令牌"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),r.jsxs("div",{className:"flex gap-2 mb-2",children:[r.jsx(Te,{value:n,onChange:c=>a(c.target.value),placeholder:"输入认证令牌",onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),l())}}),r.jsx(ne,{onClick:l,size:"sm",children:r.jsx(pr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),r.jsx("div",{className:"space-y-2",children:e.auth_token.map((c,d)=>r.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[r.jsx("span",{className:"text-sm font-mono",children:c}),r.jsx(ne,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>o(d),children:r.jsx(zt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},d))})]})]})}function ez({config:e,onChange:t}){return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Q,{children:"启用统计信息发送"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),r.jsx(vt,{checked:e.enable,onCheckedChange:n=>t({...e,enable:n})})]})]})}const ji=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{className:"relative w-full overflow-auto",children:r.jsx("table",{ref:n,className:he("w-full caption-bottom text-sm",e),...t})}));ji.displayName="Table";const Ni=w.forwardRef(({className:e,...t},n)=>r.jsx("thead",{ref:n,className:he("[&_tr]:border-b",e),...t}));Ni.displayName="TableHeader";const Si=w.forwardRef(({className:e,...t},n)=>r.jsx("tbody",{ref:n,className:he("[&_tr:last-child]:border-0",e),...t}));Si.displayName="TableBody";const tz=w.forwardRef(({className:e,...t},n)=>r.jsx("tfoot",{ref:n,className:he("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));tz.displayName="TableFooter";const Vn=w.forwardRef(({className:e,...t},n)=>r.jsx("tr",{ref:n,className:he("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Vn.displayName="TableRow";const ut=w.forwardRef(({className:e,...t},n)=>r.jsx("th",{ref:n,className:he("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));ut.displayName="TableHead";const et=w.forwardRef(({className:e,...t},n)=>r.jsx("td",{ref:n,className:he("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));et.displayName="TableCell";const nz=w.forwardRef(({className:e,...t},n)=>r.jsx("caption",{ref:n,className:he("mt-4 text-sm text-muted-foreground",e),...t}));nz.displayName="TableCaption";const jr=w.forwardRef(({className:e,...t},n)=>r.jsx(n6,{ref:n,className:he("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:r.jsx(oT,{className:he("grid place-content-center text-current"),children:r.jsx(mi,{className:"h-4 w-4"})})}));jr.displayName=n6.displayName;function rz(){const[e,t]=w.useState([]),[n,a]=w.useState(!0),[l,o]=w.useState(!1),[c,d]=w.useState(!1),[m,f]=w.useState(!1),[p,x]=w.useState(!1),[y,b]=w.useState(!1),[N,k]=w.useState(!1),[S,T]=w.useState(null),[M,A]=w.useState(null),[R,B]=w.useState(!1),[O,L]=w.useState(null),[$,U]=w.useState(!1),[I,G]=w.useState(""),[ee,Ne]=w.useState(new Set),[J,se]=w.useState(!1),[H,le]=w.useState(1),[re,ge]=w.useState(20),[E,we]=w.useState(""),{toast:Z}=or(),z=w.useRef(null),X=w.useRef(!0);w.useEffect(()=>{q()},[]);const q=async()=>{try{a(!0);const K=await zo();t(K.api_providers||[]),f(!1),X.current=!1}catch(K){console.error("加载配置失败:",K)}finally{a(!1)}},ce=async()=>{try{x(!0),U1().catch(()=>{}),b(!0)}catch(K){console.error("重启失败:",K),b(!1),Z({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),x(!1)}},fe=async()=>{try{o(!0),z.current&&clearTimeout(z.current);const K=await zo();K.api_providers=e,await om(K),f(!1),Z({title:"保存成功",description:"正在重启麦麦..."}),await ce()}catch(K){console.error("保存配置失败:",K),Z({title:"保存失败",description:K.message,variant:"destructive"}),o(!1)}},De=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},oe=()=>{b(!1),x(!1),Z({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},He=w.useCallback(async K=>{if(!X.current)try{d(!0),await Rx("api_providers",K),f(!1)}catch(be){console.error("自动保存失败:",be),f(!0)}finally{d(!1)}},[]);w.useEffect(()=>{if(!X.current)return f(!0),z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{He(e)},2e3),()=>{z.current&&clearTimeout(z.current)}},[e,He]);const at=async()=>{try{o(!0),z.current&&clearTimeout(z.current);const K=await zo();K.api_providers=e,await om(K),f(!1),Z({title:"保存成功",description:"模型提供商配置已保存"})}catch(K){console.error("保存配置失败:",K),Z({title:"保存失败",description:K.message,variant:"destructive"})}finally{o(!1)}},je=(K,be)=>{T(K||{name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),A(be),U(!1),k(!0)},Ze=async()=>{if(S?.api_key)try{await navigator.clipboard.writeText(S.api_key),Z({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{Z({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},qe=()=>{if(!S)return;const K={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};if(M!==null){const be=[...e];be[M]=K,t(be)}else t([...e,K]);k(!1),T(null),A(null)},Ot=K=>{if(!K&&S){const be={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};T(be)}k(K)},bn=K=>{L(K),B(!0)},Dn=()=>{if(O!==null){const K=e.filter((be,Re)=>Re!==O);t(K),Z({title:"删除成功",description:"提供商已从列表中移除"})}B(!1),L(null)},Xe=K=>{const be=new Set(ee);be.has(K)?be.delete(K):be.add(K),Ne(be)},wn=()=>{if(ee.size===Cn.length)Ne(new Set);else{const K=Cn.map((be,Re)=>e.findIndex(nt=>nt===Cn[Re]));Ne(new Set(K))}},Wn=()=>{if(ee.size===0){Z({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}se(!0)},Ar=()=>{const K=e.filter((be,Re)=>!ee.has(Re));t(K),Ne(new Set),se(!1),Z({title:"批量删除成功",description:`已删除 ${ee.size} 个提供商`})},Cn=e.filter(K=>{if(!I)return!0;const be=I.toLowerCase();return K.name.toLowerCase().includes(be)||K.base_url.toLowerCase().includes(be)||K.client_type.toLowerCase().includes(be)}),cr=Math.ceil(Cn.length/re),$e=Cn.slice((H-1)*re,H*re),Fn=()=>{const K=parseInt(E);K>=1&&K<=cr&&(le(K),we(""))};return n?r.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型提供商配置"}),r.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 API 提供商配置"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[ee.size>0&&r.jsxs(ne,{onClick:Wn,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[r.jsx(zt,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",ee.size,")"]}),r.jsxs(ne,{onClick:()=>je(null,null),size:"sm",className:"w-full sm:w-auto",children:[r.jsx(pr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),r.jsxs(ne,{onClick:at,disabled:l||c||!m||p,size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[r.jsx(Cm,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),l?"保存中...":c?"自动保存中...":m?"保存配置":"已保存"]}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsxs(ne,{disabled:l||c||p,size:"sm",className:"w-full sm:w-auto",children:[r.jsx(S1,{className:"mr-2 h-4 w-4"}),p?"重启中...":m?"保存并重启":"重启麦麦"]})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认重启麦麦?"}),r.jsx(Qt,{children:m?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:m?fe:ce,children:m?"保存并重启":"确认重启"})]})]})]})]})]}),r.jsxs(qu,{children:[r.jsx(pi,{className:"h-4 w-4"}),r.jsxs(Hu,{children:["配置更新后需要",r.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),r.jsxs(an,{className:"h-[calc(100vh-260px)]",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[r.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[r.jsx(Yr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{placeholder:"搜索提供商名称、URL 或类型...",value:I,onChange:K=>G(K.target.value),className:"pl-9"})]}),I&&r.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Cn.length," 个结果"]})]}),r.jsx("div",{className:"md:hidden space-y-3",children:Cn.length===0?r.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:I?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):$e.map((K,be)=>{const Re=e.findIndex(nt=>nt===K);return r.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold text-base truncate",children:K.name}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:K.base_url})]}),r.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>je(K,Re),children:[r.jsx(Bo,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),r.jsxs(ne,{size:"sm",onClick:()=>bn(Re),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(zt,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),r.jsx("p",{className:"font-medium",children:K.client_type})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),r.jsx("p",{className:"font-medium",children:K.max_retry})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),r.jsx("p",{className:"font-medium",children:K.timeout})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),r.jsx("p",{className:"font-medium",children:K.retry_interval})]})]})]},be)})}),r.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:r.jsxs(ji,{children:[r.jsx(Ni,{children:r.jsxs(Vn,{children:[r.jsx(ut,{className:"w-12",children:r.jsx(jr,{checked:ee.size===Cn.length&&Cn.length>0,onCheckedChange:wn})}),r.jsx(ut,{children:"名称"}),r.jsx(ut,{children:"基础URL"}),r.jsx(ut,{children:"客户端类型"}),r.jsx(ut,{className:"text-right",children:"最大重试"}),r.jsx(ut,{className:"text-right",children:"超时(秒)"}),r.jsx(ut,{className:"text-right",children:"重试间隔(秒)"}),r.jsx(ut,{className:"text-right",children:"操作"})]})}),r.jsx(Si,{children:$e.length===0?r.jsx(Vn,{children:r.jsx(et,{colSpan:8,className:"text-center text-muted-foreground py-8",children:I?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):$e.map((K,be)=>{const Re=e.findIndex(nt=>nt===K);return r.jsxs(Vn,{children:[r.jsx(et,{children:r.jsx(jr,{checked:ee.has(Re),onCheckedChange:()=>Xe(Re)})}),r.jsx(et,{className:"font-medium",children:K.name}),r.jsx(et,{className:"max-w-xs truncate",title:K.base_url,children:K.base_url}),r.jsx(et,{children:K.client_type}),r.jsx(et,{className:"text-right",children:K.max_retry}),r.jsx(et,{className:"text-right",children:K.timeout}),r.jsx(et,{className:"text-right",children:K.retry_interval}),r.jsx(et,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>je(K,Re),children:[r.jsx(Bo,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),r.jsxs(ne,{size:"sm",onClick:()=>bn(Re),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(zt,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},be)})})]})}),Cn.length>0&&r.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),r.jsxs(_t,{value:re.toString(),onValueChange:K=>{ge(parseInt(K)),le(1),Ne(new Set)},children:[r.jsx(jt,{id:"page-size-provider",className:"w-20",children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"10",children:"10"}),r.jsx(Oe,{value:"20",children:"20"}),r.jsx(Oe,{value:"50",children:"50"}),r.jsx(Oe,{value:"100",children:"100"})]})]}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(H-1)*re+1," 到"," ",Math.min(H*re,Cn.length)," 条,共 ",Cn.length," 条"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>le(1),disabled:H===1,className:"hidden sm:flex",children:r.jsx(Du,{className:"h-4 w-4"})}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>le(K=>Math.max(1,K-1)),disabled:H===1,children:[r.jsx(bi,{className:"h-4 w-4 sm:mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te,{type:"number",value:E,onChange:K=>we(K.target.value),onKeyDown:K=>K.key==="Enter"&&Fn(),placeholder:H.toString(),className:"w-16 h-8 text-center",min:1,max:cr}),r.jsx(ne,{variant:"outline",size:"sm",onClick:Fn,disabled:!E,className:"h-8",children:"跳转"})]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>le(K=>K+1),disabled:H>=cr,children:[r.jsx("span",{className:"hidden sm:inline",children:"下一页"}),r.jsx(wi,{className:"h-4 w-4 sm:ml-1"})]}),r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>le(cr),disabled:H>=cr,className:"hidden sm:flex",children:r.jsx(zu,{className:"h-4 w-4"})})]})]})]}),r.jsx(ir,{open:N,onOpenChange:Ot,children:r.jsxs(Jn,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(er,{children:[r.jsx(tr,{children:M!==null?"编辑提供商":"添加提供商"}),r.jsx(xr,{children:"配置 API 提供商的连接信息和参数"})]}),r.jsxs("div",{className:"grid gap-4 py-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"name",children:"名称 *"}),r.jsx(Te,{id:"name",value:S?.name||"",onChange:K=>T(be=>be?{...be,name:K.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"base_url",children:"基础 URL *"}),r.jsx(Te,{id:"base_url",value:S?.base_url||"",onChange:K=>T(be=>be?{...be,base_url:K.target.value}:null),placeholder:"https://api.example.com/v1"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"api_key",children:"API Key *"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{id:"api_key",type:$?"text":"password",value:S?.api_key||"",onChange:K=>T(be=>be?{...be,api_key:K.target.value}:null),placeholder:"sk-...",className:"flex-1"}),r.jsx(ne,{type:"button",variant:"outline",size:"icon",onClick:()=>U(!$),title:$?"隐藏密钥":"显示密钥",children:$?r.jsx(yx,{className:"h-4 w-4"}):r.jsx(Ha,{className:"h-4 w-4"})}),r.jsx(ne,{type:"button",variant:"outline",size:"icon",onClick:Ze,title:"复制密钥",children:r.jsx(vx,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"client_type",children:"客户端类型"}),r.jsxs(_t,{value:S?.client_type||"openai",onValueChange:K=>T(be=>be?{...be,client_type:K}:null),children:[r.jsx(jt,{id:"client_type",children:r.jsx(Et,{placeholder:"选择客户端类型"})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"openai",children:"OpenAI"}),r.jsx(Oe,{value:"gemini",children:"Gemini"})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"max_retry",children:"最大重试"}),r.jsx(Te,{id:"max_retry",type:"number",min:"0",value:S?.max_retry??"",onChange:K=>{const be=K.target.value===""?null:parseInt(K.target.value);T(Re=>Re?{...Re,max_retry:be}:null)},placeholder:"默认: 2"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"timeout",children:"超时(秒)"}),r.jsx(Te,{id:"timeout",type:"number",min:"1",value:S?.timeout??"",onChange:K=>{const be=K.target.value===""?null:parseInt(K.target.value);T(Re=>Re?{...Re,timeout:be}:null)},placeholder:"默认: 30"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),r.jsx(Te,{id:"retry_interval",type:"number",min:"1",value:S?.retry_interval??"",onChange:K=>{const be=K.target.value===""?null:parseInt(K.target.value);T(Re=>Re?{...Re,retry_interval:be}:null)},placeholder:"默认: 10"})]})]})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>k(!1),children:"取消"}),r.jsx(ne,{onClick:qe,children:"保存"})]})]})}),r.jsx(en,{open:R,onOpenChange:B,children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:['确定要删除提供商 "',O!==null?e[O]?.name:"",'" 吗? 此操作无法撤销。']})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:Dn,children:"删除"})]})]})}),r.jsx(en,{open:J,onOpenChange:se,children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认批量删除"}),r.jsxs(Qt,{children:["确定要删除选中的 ",ee.size," 个提供商吗? 此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:Ar,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),y&&r.jsx($1,{onRestartComplete:De,onRestartFailed:oe})]})}var zb=1,az=.9,sz=.8,lz=.17,Dp=.1,zp=.999,iz=.9999,oz=.99,cz=/[\\\/_+.#"@\[\(\{&]/,uz=/[\\\/_+.#"@\[\(\{&]/g,dz=/[\s-]/,Vj=/[\s-]/g;function Lx(e,t,n,a,l,o,c){if(o===t.length)return l===e.length?zb:oz;var d=`${l},${o}`;if(c[d]!==void 0)return c[d];for(var m=a.charAt(o),f=n.indexOf(m,l),p=0,x,y,b,N;f>=0;)x=Lx(e,t,n,a,f+1,o+1,c),x>p&&(f===l?x*=zb:cz.test(e.charAt(f-1))?(x*=sz,b=e.slice(l,f-1).match(uz),b&&l>0&&(x*=Math.pow(zp,b.length))):dz.test(e.charAt(f-1))?(x*=az,N=e.slice(l,f-1).match(Vj),N&&l>0&&(x*=Math.pow(zp,N.length))):(x*=lz,l>0&&(x*=Math.pow(zp,f-l))),e.charAt(f)!==t.charAt(o)&&(x*=iz)),(xx&&(x=y*Dp)),x>p&&(p=x),f=n.indexOf(m,f+1);return c[d]=p,p}function Ob(e){return e.toLowerCase().replace(Vj," ")}function mz(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Lx(e,t,Ob(e),Ob(t),0,0,{})}var hz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Rl=hz.reduce((e,t)=>{const n=f1(`Primitive.${t}`),a=w.forwardRef((l,o)=>{const{asChild:c,...d}=l,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(m,{...d,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),Jc='[cmdk-group=""]',Op='[cmdk-group-items=""]',fz='[cmdk-group-heading=""]',Gj='[cmdk-item=""]',Rb=`${Gj}:not([aria-disabled="true"])`,Bx="cmdk-item-select",Co="data-value",pz=(e,t,n)=>mz(e,t,n),Yj=w.createContext(void 0),Uu=()=>w.useContext(Yj),Wj=w.createContext(void 0),V1=()=>w.useContext(Wj),Xj=w.createContext(void 0),Kj=w.forwardRef((e,t)=>{let n=To(()=>{var Z,z;return{search:"",value:(z=(Z=e.value)!=null?Z:e.defaultValue)!=null?z:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=To(()=>new Set),l=To(()=>new Map),o=To(()=>new Map),c=To(()=>new Set),d=Qj(e),{label:m,children:f,value:p,onValueChange:x,filter:y,shouldFilter:b,loop:N,disablePointerSelection:k=!1,vimBindings:S=!0,...T}=e,M=Ta(),A=Ta(),R=Ta(),B=w.useRef(null),O=Cz();vi(()=>{if(p!==void 0){let Z=p.trim();n.current.value=Z,L.emit()}},[p]),vi(()=>{O(6,Ne)},[]);let L=w.useMemo(()=>({subscribe:Z=>(c.current.add(Z),()=>c.current.delete(Z)),snapshot:()=>n.current,setState:(Z,z,X)=>{var q,ce,fe,De;if(!Object.is(n.current[Z],z)){if(n.current[Z]=z,Z==="search")ee(),I(),O(1,G);else if(Z==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let oe=document.getElementById(R);oe?oe.focus():(q=document.getElementById(M))==null||q.focus()}if(O(7,()=>{var oe;n.current.selectedItemId=(oe=J())==null?void 0:oe.id,L.emit()}),X||O(5,Ne),((ce=d.current)==null?void 0:ce.value)!==void 0){let oe=z??"";(De=(fe=d.current).onValueChange)==null||De.call(fe,oe);return}}L.emit()}},emit:()=>{c.current.forEach(Z=>Z())}}),[]),$=w.useMemo(()=>({value:(Z,z,X)=>{var q;z!==((q=o.current.get(Z))==null?void 0:q.value)&&(o.current.set(Z,{value:z,keywords:X}),n.current.filtered.items.set(Z,U(z,X)),O(2,()=>{I(),L.emit()}))},item:(Z,z)=>(a.current.add(Z),z&&(l.current.has(z)?l.current.get(z).add(Z):l.current.set(z,new Set([Z]))),O(3,()=>{ee(),I(),n.current.value||G(),L.emit()}),()=>{o.current.delete(Z),a.current.delete(Z),n.current.filtered.items.delete(Z);let X=J();O(4,()=>{ee(),X?.getAttribute("id")===Z&&G(),L.emit()})}),group:Z=>(l.current.has(Z)||l.current.set(Z,new Set),()=>{o.current.delete(Z),l.current.delete(Z)}),filter:()=>d.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:M,inputId:R,labelId:A,listInnerRef:B}),[]);function U(Z,z){var X,q;let ce=(q=(X=d.current)==null?void 0:X.filter)!=null?q:pz;return Z?ce(Z,n.current.search,z):0}function I(){if(!n.current.search||d.current.shouldFilter===!1)return;let Z=n.current.filtered.items,z=[];n.current.filtered.groups.forEach(q=>{let ce=l.current.get(q),fe=0;ce.forEach(De=>{let oe=Z.get(De);fe=Math.max(oe,fe)}),z.push([q,fe])});let X=B.current;se().sort((q,ce)=>{var fe,De;let oe=q.getAttribute("id"),He=ce.getAttribute("id");return((fe=Z.get(He))!=null?fe:0)-((De=Z.get(oe))!=null?De:0)}).forEach(q=>{let ce=q.closest(Op);ce?ce.appendChild(q.parentElement===ce?q:q.closest(`${Op} > *`)):X.appendChild(q.parentElement===X?q:q.closest(`${Op} > *`))}),z.sort((q,ce)=>ce[1]-q[1]).forEach(q=>{var ce;let fe=(ce=B.current)==null?void 0:ce.querySelector(`${Jc}[${Co}="${encodeURIComponent(q[0])}"]`);fe?.parentElement.appendChild(fe)})}function G(){let Z=se().find(X=>X.getAttribute("aria-disabled")!=="true"),z=Z?.getAttribute(Co);L.setState("value",z||void 0)}function ee(){var Z,z,X,q;if(!n.current.search||d.current.shouldFilter===!1){n.current.filtered.count=a.current.size;return}n.current.filtered.groups=new Set;let ce=0;for(let fe of a.current){let De=(z=(Z=o.current.get(fe))==null?void 0:Z.value)!=null?z:"",oe=(q=(X=o.current.get(fe))==null?void 0:X.keywords)!=null?q:[],He=U(De,oe);n.current.filtered.items.set(fe,He),He>0&&ce++}for(let[fe,De]of l.current)for(let oe of De)if(n.current.filtered.items.get(oe)>0){n.current.filtered.groups.add(fe);break}n.current.filtered.count=ce}function Ne(){var Z,z,X;let q=J();q&&(((Z=q.parentElement)==null?void 0:Z.firstChild)===q&&((X=(z=q.closest(Jc))==null?void 0:z.querySelector(fz))==null||X.scrollIntoView({block:"nearest"})),q.scrollIntoView({block:"nearest"}))}function J(){var Z;return(Z=B.current)==null?void 0:Z.querySelector(`${Gj}[aria-selected="true"]`)}function se(){var Z;return Array.from(((Z=B.current)==null?void 0:Z.querySelectorAll(Rb))||[])}function H(Z){let z=se()[Z];z&&L.setState("value",z.getAttribute(Co))}function le(Z){var z;let X=J(),q=se(),ce=q.findIndex(De=>De===X),fe=q[ce+Z];(z=d.current)!=null&&z.loop&&(fe=ce+Z<0?q[q.length-1]:ce+Z===q.length?q[0]:q[ce+Z]),fe&&L.setState("value",fe.getAttribute(Co))}function re(Z){let z=J(),X=z?.closest(Jc),q;for(;X&&!q;)X=Z>0?Sz(X,Jc):kz(X,Jc),q=X?.querySelector(Rb);q?L.setState("value",q.getAttribute(Co)):le(Z)}let ge=()=>H(se().length-1),E=Z=>{Z.preventDefault(),Z.metaKey?ge():Z.altKey?re(1):le(1)},we=Z=>{Z.preventDefault(),Z.metaKey?H(0):Z.altKey?re(-1):le(-1)};return w.createElement(Rl.div,{ref:t,tabIndex:-1,...T,"cmdk-root":"",onKeyDown:Z=>{var z;(z=T.onKeyDown)==null||z.call(T,Z);let X=Z.nativeEvent.isComposing||Z.keyCode===229;if(!(Z.defaultPrevented||X))switch(Z.key){case"n":case"j":{S&&Z.ctrlKey&&E(Z);break}case"ArrowDown":{E(Z);break}case"p":case"k":{S&&Z.ctrlKey&&we(Z);break}case"ArrowUp":{we(Z);break}case"Home":{Z.preventDefault(),H(0);break}case"End":{Z.preventDefault(),ge();break}case"Enter":{Z.preventDefault();let q=J();if(q){let ce=new Event(Bx);q.dispatchEvent(ce)}}}}},w.createElement("label",{"cmdk-label":"",htmlFor:$.inputId,id:$.labelId,style:_z},m),Im(e,Z=>w.createElement(Wj.Provider,{value:L},w.createElement(Yj.Provider,{value:$},Z))))}),xz=w.forwardRef((e,t)=>{var n,a;let l=Ta(),o=w.useRef(null),c=w.useContext(Xj),d=Uu(),m=Qj(e),f=(a=(n=m.current)==null?void 0:n.forceMount)!=null?a:c?.forceMount;vi(()=>{if(!f)return d.item(l,c?.id)},[f]);let p=Zj(l,o,[e.value,e.children,o],e.keywords),x=V1(),y=_l(O=>O.value&&O.value===p.current),b=_l(O=>f||d.filter()===!1?!0:O.search?O.filtered.items.get(l)>0:!0);w.useEffect(()=>{let O=o.current;if(!(!O||e.disabled))return O.addEventListener(Bx,N),()=>O.removeEventListener(Bx,N)},[b,e.onSelect,e.disabled]);function N(){var O,L;k(),(L=(O=m.current).onSelect)==null||L.call(O,p.current)}function k(){x.setState("value",p.current,!0)}if(!b)return null;let{disabled:S,value:T,onSelect:M,forceMount:A,keywords:R,...B}=e;return w.createElement(Rl.div,{ref:Sl(o,t),...B,id:l,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!y,"data-disabled":!!S,"data-selected":!!y,onPointerMove:S||d.getDisablePointerSelection()?void 0:k,onClick:S?void 0:N},e.children)}),gz=w.forwardRef((e,t)=>{let{heading:n,children:a,forceMount:l,...o}=e,c=Ta(),d=w.useRef(null),m=w.useRef(null),f=Ta(),p=Uu(),x=_l(b=>l||p.filter()===!1?!0:b.search?b.filtered.groups.has(c):!0);vi(()=>p.group(c),[]),Zj(c,d,[e.value,e.heading,m]);let y=w.useMemo(()=>({id:c,forceMount:l}),[l]);return w.createElement(Rl.div,{ref:Sl(d,t),...o,"cmdk-group":"",role:"presentation",hidden:x?void 0:!0},n&&w.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),Im(e,b=>w.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},w.createElement(Xj.Provider,{value:y},b))))}),vz=w.forwardRef((e,t)=>{let{alwaysRender:n,...a}=e,l=w.useRef(null),o=_l(c=>!c.search);return!n&&!o?null:w.createElement(Rl.div,{ref:Sl(l,t),...a,"cmdk-separator":"",role:"separator"})}),yz=w.forwardRef((e,t)=>{let{onValueChange:n,...a}=e,l=e.value!=null,o=V1(),c=_l(f=>f.search),d=_l(f=>f.selectedItemId),m=Uu();return w.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),w.createElement(Rl.input,{ref:t,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":d,id:m.inputId,type:"text",value:l?e.value:c,onChange:f=>{l||o.setState("search",f.target.value),n?.(f.target.value)}})}),bz=w.forwardRef((e,t)=>{let{children:n,label:a="Suggestions",...l}=e,o=w.useRef(null),c=w.useRef(null),d=_l(f=>f.selectedItemId),m=Uu();return w.useEffect(()=>{if(c.current&&o.current){let f=c.current,p=o.current,x,y=new ResizeObserver(()=>{x=requestAnimationFrame(()=>{let b=f.offsetHeight;p.style.setProperty("--cmdk-list-height",b.toFixed(1)+"px")})});return y.observe(f),()=>{cancelAnimationFrame(x),y.unobserve(f)}}},[]),w.createElement(Rl.div,{ref:Sl(o,t),...l,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":a,id:m.listId},Im(e,f=>w.createElement("div",{ref:Sl(c,m.listInnerRef),"cmdk-list-sizer":""},f)))}),wz=w.forwardRef((e,t)=>{let{open:n,onOpenChange:a,overlayClassName:l,contentClassName:o,container:c,...d}=e;return w.createElement(y1,{open:n,onOpenChange:a},w.createElement(p1,{container:c},w.createElement(wm,{"cmdk-overlay":"",className:l}),w.createElement(jm,{"aria-label":e.label,"cmdk-dialog":"",className:o},w.createElement(Kj,{ref:t,...d}))))}),jz=w.forwardRef((e,t)=>_l(n=>n.filtered.count===0)?w.createElement(Rl.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Nz=w.forwardRef((e,t)=>{let{progress:n,children:a,label:l="Loading...",...o}=e;return w.createElement(Rl.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":l},Im(e,c=>w.createElement("div",{"aria-hidden":!0},c)))}),Xr=Object.assign(Kj,{List:bz,Item:xz,Input:yz,Group:gz,Separator:vz,Dialog:wz,Empty:jz,Loading:Nz});function Sz(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function kz(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Qj(e){let t=w.useRef(e);return vi(()=>{t.current=e}),t}var vi=typeof window>"u"?w.useEffect:w.useLayoutEffect;function To(e){let t=w.useRef();return t.current===void 0&&(t.current=e()),t}function _l(e){let t=V1(),n=()=>e(t.snapshot());return w.useSyncExternalStore(t.subscribe,n,n)}function Zj(e,t,n,a=[]){let l=w.useRef(),o=Uu();return vi(()=>{var c;let d=(()=>{var f;for(let p of n){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(f=p.current.textContent)==null?void 0:f.trim():l.current}})(),m=a.map(f=>f.trim());o.value(e,d,m),(c=t.current)==null||c.setAttribute(Co,d),l.current=d}),l}var Cz=()=>{let[e,t]=w.useState(),n=To(()=>new Map);return vi(()=>{n.current.forEach(a=>a()),n.current=new Map},[e]),(a,l)=>{n.current.set(a,l),t({})}};function Tz(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Im({asChild:e,children:t},n){return e&&w.isValidElement(t)?w.cloneElement(Tz(t),{ref:t.ref},n(t.props.children)):n(t)}var _z={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Jj=w.forwardRef(({className:e,...t},n)=>r.jsx(Xr,{ref:n,className:he("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Jj.displayName=Xr.displayName;const e7=w.forwardRef(({className:e,...t},n)=>r.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[r.jsx(Yr,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),r.jsx(Xr.Input,{ref:n,className:he("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));e7.displayName=Xr.Input.displayName;const t7=w.forwardRef(({className:e,...t},n)=>r.jsx(Xr.List,{ref:n,className:he("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));t7.displayName=Xr.List.displayName;const n7=w.forwardRef((e,t)=>r.jsx(Xr.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));n7.displayName=Xr.Empty.displayName;const r7=w.forwardRef(({className:e,...t},n)=>r.jsx(Xr.Group,{ref:n,className:he("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));r7.displayName=Xr.Group.displayName;const Ez=w.forwardRef(({className:e,...t},n)=>r.jsx(Xr.Separator,{ref:n,className:he("-mx-1 h-px bg-border",e),...t}));Ez.displayName=Xr.Separator.displayName;const a7=w.forwardRef(({className:e,...t},n)=>r.jsx(Xr.Item,{ref:n,className:he("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));a7.displayName=Xr.Item.displayName;function Mz({options:e,selected:t,onChange:n,placeholder:a="选择选项...",emptyText:l="未找到选项",className:o}){const[c,d]=w.useState(!1),m=p=>{t.includes(p)?n(t.filter(x=>x!==p)):n([...t,p])},f=p=>{n(t.filter(x=>x!==p))};return r.jsxs(Cl,{open:c,onOpenChange:d,children:[r.jsx(Tl,{asChild:!0,children:r.jsxs(ne,{variant:"outline",role:"combobox","aria-expanded":c,className:he("w-full justify-between min-h-10 h-auto",o),children:[r.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:t.length===0?r.jsx("span",{className:"text-muted-foreground",children:a}):t.map(p=>{const x=e.find(y=>y.value===p);return r.jsxs(un,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80",onClick:y=>{y.stopPropagation(),f(p)},children:[x?.label||p,r.jsx(Au,{className:"ml-1 h-3 w-3",strokeWidth:2,fill:"none"})]},p)})}),r.jsx(kT,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),r.jsx(Ps,{className:"w-full p-0",align:"start",children:r.jsxs(Jj,{children:[r.jsx(e7,{placeholder:"搜索...",className:"h-9"}),r.jsxs(t7,{children:[r.jsx(n7,{children:l}),r.jsx(r7,{children:e.map(p=>{const x=t.includes(p.value);return r.jsxs(a7,{value:p.value,onSelect:()=>m(p.value),children:[r.jsx("div",{className:he("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",x?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:r.jsx(mi,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),r.jsx("span",{children:p.label})]},p.value)})})]})]})})]})}function Az(){const[e,t]=w.useState([]),[n,a]=w.useState([]),[l,o]=w.useState([]),[c,d]=w.useState(null),[m,f]=w.useState(!0),[p,x]=w.useState(!1),[y,b]=w.useState(!1),[N,k]=w.useState(!1),[S,T]=w.useState(!1),[M,A]=w.useState(!1),[R,B]=w.useState(!1),[O,L]=w.useState(null),[$,U]=w.useState(null),[I,G]=w.useState(!1),[ee,Ne]=w.useState(null),[J,se]=w.useState(""),[H,le]=w.useState(new Set),[re,ge]=w.useState(!1),[E,we]=w.useState(1),[Z,z]=w.useState(20),[X,q]=w.useState(""),{toast:ce}=or(),fe=w.useRef(null),De=w.useRef(null),oe=w.useRef(!0);w.useEffect(()=>{He()},[]);const He=async()=>{try{f(!0);const pe=await zo(),Ee=pe.models||[];t(Ee),o(Ee.map(mt=>mt.name));const dt=pe.api_providers||[];a(dt.map(mt=>mt.name)),d(pe.model_task_config||null),k(!1),oe.current=!1}catch(pe){console.error("加载配置失败:",pe)}finally{f(!1)}},at=async()=>{try{T(!0),U1().catch(()=>{}),A(!0)}catch(pe){console.error("重启失败:",pe),A(!1),ce({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),T(!1)}},je=async()=>{try{x(!0),fe.current&&clearTimeout(fe.current),De.current&&clearTimeout(De.current);const pe=await zo();pe.models=e,pe.model_task_config=c,await om(pe),k(!1),ce({title:"保存成功",description:"正在重启麦麦..."}),await at()}catch(pe){console.error("保存配置失败:",pe),ce({title:"保存失败",description:pe.message,variant:"destructive"}),x(!1)}},Ze=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},qe=()=>{A(!1),T(!1),ce({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Ot=w.useCallback(async pe=>{if(!oe.current)try{b(!0),await Rx("models",pe),k(!1)}catch(Ee){console.error("自动保存模型列表失败:",Ee),k(!0)}finally{b(!1)}},[]),bn=w.useCallback(async pe=>{if(!oe.current)try{b(!0),await Rx("model_task_config",pe),k(!1)}catch(Ee){console.error("自动保存任务配置失败:",Ee),k(!0)}finally{b(!1)}},[]);w.useEffect(()=>{if(!oe.current)return k(!0),fe.current&&clearTimeout(fe.current),fe.current=setTimeout(()=>{Ot(e)},2e3),()=>{fe.current&&clearTimeout(fe.current)}},[e,Ot]),w.useEffect(()=>{if(!(oe.current||!c))return k(!0),De.current&&clearTimeout(De.current),De.current=setTimeout(()=>{bn(c)},2e3),()=>{De.current&&clearTimeout(De.current)}},[c,bn]);const Dn=async()=>{try{x(!0),fe.current&&clearTimeout(fe.current),De.current&&clearTimeout(De.current);const pe=await zo();pe.models=e,pe.model_task_config=c,await om(pe),k(!1),ce({title:"保存成功",description:"模型配置已保存"}),await He()}catch(pe){console.error("保存配置失败:",pe),ce({title:"保存失败",description:pe.message,variant:"destructive"})}finally{x(!1)}},Xe=(pe,Ee)=>{L(pe||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),U(Ee),B(!0)},wn=()=>{if(!O)return;const pe={...O,price_in:O.price_in??0,price_out:O.price_out??0};let Ee;$!==null?(Ee=[...e],Ee[$]=pe):Ee=[...e,pe],t(Ee),o(Ee.map(dt=>dt.name)),B(!1),L(null),U(null)},Wn=pe=>{if(!pe&&O){const Ee={...O,price_in:O.price_in??0,price_out:O.price_out??0};L(Ee)}B(pe)},Ar=pe=>{Ne(pe),G(!0)},Cn=()=>{if(ee!==null){const pe=e.filter((Ee,dt)=>dt!==ee);t(pe),o(pe.map(Ee=>Ee.name)),ce({title:"删除成功",description:"模型已从列表中移除"})}G(!1),Ne(null)},cr=pe=>{const Ee=new Set(H);Ee.has(pe)?Ee.delete(pe):Ee.add(pe),le(Ee)},$e=()=>{if(H.size===Re.length)le(new Set);else{const pe=Re.map((Ee,dt)=>e.findIndex(mt=>mt===Re[dt]));le(new Set(pe))}},Fn=()=>{if(H.size===0){ce({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ge(!0)},K=()=>{const pe=e.filter((Ee,dt)=>!H.has(dt));t(pe),o(pe.map(Ee=>Ee.name)),le(new Set),ge(!1),ce({title:"批量删除成功",description:`已删除 ${H.size} 个模型`})},be=(pe,Ee,dt)=>{c&&d({...c,[pe]:{...c[pe],[Ee]:dt}})},Re=e.filter(pe=>{if(!J)return!0;const Ee=J.toLowerCase();return pe.name.toLowerCase().includes(Ee)||pe.model_identifier.toLowerCase().includes(Ee)||pe.api_provider.toLowerCase().includes(Ee)}),nt=Math.ceil(Re.length/Z),kt=Re.slice((E-1)*Z,E*Z),rr=()=>{const pe=parseInt(X);pe>=1&&pe<=nt&&(we(pe),q(""))},Dr=pe=>c?[c.utils?.model_list||[],c.utils_small?.model_list||[],c.tool_use?.model_list||[],c.replyer?.model_list||[],c.planner?.model_list||[],c.vlm?.model_list||[],c.voice?.model_list||[],c.embedding?.model_list||[],c.lpmm_entity_extract?.model_list||[],c.lpmm_rdf_build?.model_list||[],c.lpmm_qa?.model_list||[]].some(dt=>dt.includes(pe)):!1;return m?r.jsx(an,{className:"h-full",children:r.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):r.jsx(an,{className:"h-full",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型配置"}),r.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理模型和任务配置"})]}),r.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[r.jsxs(ne,{onClick:Dn,disabled:p||y||!N||S,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[r.jsx(Cm,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),p?"保存中...":y?"自动保存中...":N?"保存配置":"已保存"]}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsxs(ne,{disabled:p||y||S,size:"sm",className:"flex-1 sm:flex-none",children:[r.jsx(S1,{className:"mr-2 h-4 w-4"}),S?"重启中...":N?"保存并重启":"重启麦麦"]})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认重启麦麦?"}),r.jsx(Qt,{children:N?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:N?je:at,children:N?"保存并重启":"确认重启"})]})]})]})]})]}),r.jsxs(qu,{children:[r.jsx(pi,{className:"h-4 w-4"}),r.jsxs(Hu,{children:["配置更新后需要",r.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),r.jsxs(kl,{defaultValue:"models",className:"w-full",children:[r.jsxs(Bs,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[r.jsx(Pt,{value:"models",children:"模型配置"}),r.jsx(Pt,{value:"tasks",children:"模型任务配置"})]}),r.jsxs(cn,{value:"models",className:"space-y-4 mt-0",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),r.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[H.size>0&&r.jsxs(ne,{onClick:Fn,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[r.jsx(zt,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",H.size,")"]}),r.jsxs(ne,{onClick:()=>Xe(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[r.jsx(pr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[r.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[r.jsx(Yr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{placeholder:"搜索模型名称、标识符或提供商...",value:J,onChange:pe=>se(pe.target.value),className:"pl-9"})]}),J&&r.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Re.length," 个结果"]})]}),r.jsx("div",{className:"md:hidden space-y-3",children:kt.length===0?r.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:J?"未找到匹配的模型":"暂无模型配置"}):kt.map((pe,Ee)=>{const dt=e.findIndex(zr=>zr===pe),mt=Dr(pe.name);return r.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-base",children:pe.name}),r.jsx(un,{variant:mt?"default":"secondary",className:mt?"bg-green-600 hover:bg-green-700":"",children:mt?"已使用":"未使用"})]}),r.jsx("p",{className:"text-xs text-muted-foreground break-all",title:pe.model_identifier,children:pe.model_identifier})]}),r.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>Xe(pe,dt),children:[r.jsx(Bo,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),r.jsxs(ne,{size:"sm",onClick:()=>Ar(dt),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(zt,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),r.jsx("p",{className:"font-medium",children:pe.api_provider})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),r.jsx("p",{className:"font-medium",children:pe.force_stream_mode?"是":"否"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),r.jsxs("p",{className:"font-medium",children:["¥",pe.price_in,"/M"]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),r.jsxs("p",{className:"font-medium",children:["¥",pe.price_out,"/M"]})]})]})]},Ee)})}),r.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:r.jsxs(ji,{children:[r.jsx(Ni,{children:r.jsxs(Vn,{children:[r.jsx(ut,{className:"w-12",children:r.jsx(jr,{checked:H.size===Re.length&&Re.length>0,onCheckedChange:$e})}),r.jsx(ut,{className:"w-24",children:"使用状态"}),r.jsx(ut,{children:"模型名称"}),r.jsx(ut,{children:"模型标识符"}),r.jsx(ut,{children:"提供商"}),r.jsx(ut,{className:"text-right",children:"输入价格"}),r.jsx(ut,{className:"text-right",children:"输出价格"}),r.jsx(ut,{className:"text-center",children:"强制流式"}),r.jsx(ut,{className:"text-right",children:"操作"})]})}),r.jsx(Si,{children:kt.length===0?r.jsx(Vn,{children:r.jsx(et,{colSpan:9,className:"text-center text-muted-foreground py-8",children:J?"未找到匹配的模型":"暂无模型配置"})}):kt.map((pe,Ee)=>{const dt=e.findIndex(zr=>zr===pe),mt=Dr(pe.name);return r.jsxs(Vn,{children:[r.jsx(et,{children:r.jsx(jr,{checked:H.has(dt),onCheckedChange:()=>cr(dt)})}),r.jsx(et,{children:r.jsx(un,{variant:mt?"default":"secondary",className:mt?"bg-green-600 hover:bg-green-700":"",children:mt?"已使用":"未使用"})}),r.jsx(et,{className:"font-medium",children:pe.name}),r.jsx(et,{className:"max-w-xs truncate",title:pe.model_identifier,children:pe.model_identifier}),r.jsx(et,{children:pe.api_provider}),r.jsxs(et,{className:"text-right",children:["¥",pe.price_in,"/M"]}),r.jsxs(et,{className:"text-right",children:["¥",pe.price_out,"/M"]}),r.jsx(et,{className:"text-center",children:pe.force_stream_mode?"是":"否"}),r.jsx(et,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>Xe(pe,dt),children:[r.jsx(Bo,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),r.jsxs(ne,{size:"sm",onClick:()=>Ar(dt),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(zt,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Ee)})})]})}),Re.length>0&&r.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),r.jsxs(_t,{value:Z.toString(),onValueChange:pe=>{z(parseInt(pe)),we(1),le(new Set)},children:[r.jsx(jt,{id:"page-size-model",className:"w-20",children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"10",children:"10"}),r.jsx(Oe,{value:"20",children:"20"}),r.jsx(Oe,{value:"50",children:"50"}),r.jsx(Oe,{value:"100",children:"100"})]})]}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(E-1)*Z+1," 到"," ",Math.min(E*Z,Re.length)," 条,共 ",Re.length," 条"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>we(1),disabled:E===1,className:"hidden sm:flex",children:r.jsx(Du,{className:"h-4 w-4"})}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>we(pe=>Math.max(1,pe-1)),disabled:E===1,children:[r.jsx(bi,{className:"h-4 w-4 sm:mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te,{type:"number",value:X,onChange:pe=>q(pe.target.value),onKeyDown:pe=>pe.key==="Enter"&&rr(),placeholder:E.toString(),className:"w-16 h-8 text-center",min:1,max:nt}),r.jsx(ne,{variant:"outline",size:"sm",onClick:rr,disabled:!X,className:"h-8",children:"跳转"})]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>we(pe=>pe+1),disabled:E>=nt,children:[r.jsx("span",{className:"hidden sm:inline",children:"下一页"}),r.jsx(wi,{className:"h-4 w-4 sm:ml-1"})]}),r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>we(nt),disabled:E>=nt,className:"hidden sm:flex",children:r.jsx(zu,{className:"h-4 w-4"})})]})]})]}),r.jsxs(cn,{value:"tasks",className:"space-y-6 mt-0",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),c&&r.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[r.jsx(Ra,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:c.utils,modelNames:l,onChange:(pe,Ee)=>be("utils",pe,Ee)}),r.jsx(Ra,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:c.utils_small,modelNames:l,onChange:(pe,Ee)=>be("utils_small",pe,Ee)}),r.jsx(Ra,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:c.tool_use,modelNames:l,onChange:(pe,Ee)=>be("tool_use",pe,Ee)}),r.jsx(Ra,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:c.replyer,modelNames:l,onChange:(pe,Ee)=>be("replyer",pe,Ee)}),r.jsx(Ra,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:c.planner,modelNames:l,onChange:(pe,Ee)=>be("planner",pe,Ee)}),r.jsx(Ra,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:c.vlm,modelNames:l,onChange:(pe,Ee)=>be("vlm",pe,Ee),hideTemperature:!0}),r.jsx(Ra,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:c.voice,modelNames:l,onChange:(pe,Ee)=>be("voice",pe,Ee),hideTemperature:!0,hideMaxTokens:!0}),r.jsx(Ra,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:c.embedding,modelNames:l,onChange:(pe,Ee)=>be("embedding",pe,Ee),hideTemperature:!0,hideMaxTokens:!0}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),r.jsx(Ra,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:c.lpmm_entity_extract,modelNames:l,onChange:(pe,Ee)=>be("lpmm_entity_extract",pe,Ee)}),r.jsx(Ra,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:c.lpmm_rdf_build,modelNames:l,onChange:(pe,Ee)=>be("lpmm_rdf_build",pe,Ee)}),r.jsx(Ra,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:c.lpmm_qa,modelNames:l,onChange:(pe,Ee)=>be("lpmm_qa",pe,Ee)})]})]})]})]}),r.jsx(ir,{open:R,onOpenChange:Wn,children:r.jsxs(Jn,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(er,{children:[r.jsx(tr,{children:$!==null?"编辑模型":"添加模型"}),r.jsx(xr,{children:"配置模型的基本信息和参数"})]}),r.jsxs("div",{className:"grid gap-4 py-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"model_name",children:"模型名称 *"}),r.jsx(Te,{id:"model_name",value:O?.name||"",onChange:pe=>L(Ee=>Ee?{...Ee,name:pe.target.value}:null),placeholder:"例如: qwen3-30b"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"model_identifier",children:"模型标识符 *"}),r.jsx(Te,{id:"model_identifier",value:O?.model_identifier||"",onChange:pe=>L(Ee=>Ee?{...Ee,model_identifier:pe.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"API 提供商提供的模型 ID"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"api_provider",children:"API 提供商 *"}),r.jsxs(_t,{value:O?.api_provider||"",onValueChange:pe=>L(Ee=>Ee?{...Ee,api_provider:pe}:null),children:[r.jsx(jt,{id:"api_provider",children:r.jsx(Et,{placeholder:"选择提供商"})}),r.jsx(Nt,{children:n.map(pe=>r.jsx(Oe,{value:pe,children:pe},pe))})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),r.jsx(Te,{id:"price_in",type:"number",step:"0.1",min:"0",value:O?.price_in??"",onChange:pe=>{const Ee=pe.target.value===""?null:parseFloat(pe.target.value);L(dt=>dt?{...dt,price_in:Ee}:null)},placeholder:"默认: 0"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),r.jsx(Te,{id:"price_out",type:"number",step:"0.1",min:"0",value:O?.price_out??"",onChange:pe=>{const Ee=pe.target.value===""?null:parseFloat(pe.target.value);L(dt=>dt?{...dt,price_out:Ee}:null)},placeholder:"默认: 0"})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"force_stream_mode",checked:O?.force_stream_mode||!1,onCheckedChange:pe=>L(Ee=>Ee?{...Ee,force_stream_mode:pe}:null)}),r.jsx(Q,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>B(!1),children:"取消"}),r.jsx(ne,{onClick:wn,children:"保存"})]})]})}),r.jsx(en,{open:I,onOpenChange:G,children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:['确定要删除模型 "',ee!==null?e[ee]?.name:"",'" 吗? 此操作无法撤销。']})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:Cn,children:"删除"})]})]})}),r.jsx(en,{open:re,onOpenChange:ge,children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认批量删除"}),r.jsxs(Qt,{children:["确定要删除选中的 ",H.size," 个模型吗? 此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:K,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),M&&r.jsx($1,{onRestartComplete:Ze,onRestartFailed:qe})]})})}function Ra({title:e,description:t,taskConfig:n,modelNames:a,onChange:l,hideTemperature:o=!1,hideMaxTokens:c=!1}){const d=m=>{l("model_list",m)};return r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:e}),r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:t})]}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"模型列表"}),r.jsx(Mz,{options:a.map(m=>({label:m,value:m})),selected:n.model_list||[],onChange:d,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!o&&r.jsxs("div",{className:"grid gap-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{children:"温度"}),r.jsx(Te,{type:"number",step:"0.1",min:"0",max:"1",value:n.temperature??.3,onChange:m=>{const f=parseFloat(m.target.value);!isNaN(f)&&f>=0&&f<=1&&l("temperature",f)},className:"w-20 h-8 text-sm"})]}),r.jsx(Pm,{value:[n.temperature??.3],onValueChange:m=>l("temperature",m[0]),min:0,max:1,step:.1,className:"w-full"})]}),!c&&r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"最大 Token"}),r.jsx(Te,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:m=>l("max_tokens",parseInt(m.target.value))})]})]})]})]})}const qm="/api/webui/config";async function Dz(){const t=await(await lt(`${qm}/adapter-config/path`)).json();return!t.success||!t.path?null:{path:t.path,lastModified:t.lastModified}}async function zz(e){const n=await(await lt(`${qm}/adapter-config/path`,{method:"POST",headers:pt(),body:JSON.stringify({path:e})})).json();if(!n.success)throw new Error(n.message||"保存路径失败")}async function Oz(e){const n=await(await lt(`${qm}/adapter-config?path=${encodeURIComponent(e)}`)).json();if(!n.success)throw new Error("读取配置文件失败");return n.content}async function Lb(e,t){const a=await(await lt(`${qm}/adapter-config`,{method:"POST",headers:pt(),body:JSON.stringify({path:e,content:t})})).json();if(!a.success)throw new Error(a.message||"保存配置失败")}const la={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}};function Rz(){const[e,t]=w.useState("upload"),[n,a]=w.useState(null),[l,o]=w.useState(""),[c,d]=w.useState(""),[m,f]=w.useState(""),[p,x]=w.useState(!1),[y,b]=w.useState(!1),[N,k]=w.useState(!1),[S,T]=w.useState(!1),[M,A]=w.useState(null),R=w.useRef(null),{toast:B}=or(),O=w.useRef(null),L=X=>{if(!X.trim())return{valid:!1,error:"路径不能为空"};const q=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,ce=/^(\/|~\/).+\.toml$/i,fe=q.test(X),De=ce.test(X);return!fe&&!De?{valid:!1,error:"路径格式错误。Windows: C:\\path\\file.toml,Linux: /path/file.toml"}:X.toLowerCase().endsWith(".toml")?/[<>"|?*\x00-\x1F]/.test(X)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}:{valid:!1,error:"文件必须是 .toml 格式"}},$=X=>{if(d(X),X.trim()){const q=L(X);f(q.error)}else f("")};w.useEffect(()=>{(async()=>{try{const q=await Dz();q&&q.path&&(d(q.path),t("path"),await U(q.path))}catch(q){console.error("加载保存的路径失败:",q)}})()},[]);const U=async X=>{const q=L(X);if(!q.valid){f(q.error),B({title:"路径无效",description:q.error,variant:"destructive"});return}f(""),b(!0);try{const ce=await Oz(X),fe=ge(ce);a(fe),d(X),await zz(X),B({title:"加载成功",description:"已从配置文件加载"})}catch(ce){console.error("加载配置失败:",ce),B({title:"加载失败",description:ce instanceof Error?ce.message:"无法读取配置文件",variant:"destructive"})}finally{b(!1)}},I=w.useCallback(X=>{e!=="path"||!c||(O.current&&clearTimeout(O.current),O.current=setTimeout(async()=>{x(!0);try{const q=E(X);await Lb(c,q),B({title:"自动保存成功",description:"配置已保存到文件"})}catch(q){console.error("自动保存失败:",q),B({title:"自动保存失败",description:q instanceof Error?q.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},1e3))},[e,c,B]),G=async()=>{if(!n||!c)return;const X=L(c);if(!X.valid){B({title:"保存失败",description:X.error,variant:"destructive"});return}x(!0);try{const q=E(n);await Lb(c,q),B({title:"保存成功",description:"配置已保存到文件"})}catch(q){console.error("保存失败:",q),B({title:"保存失败",description:q instanceof Error?q.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},ee=async()=>{c&&await U(c)},Ne=X=>{if(X!==e){if(n){A(X),k(!0);return}J(X)}},J=X=>{a(null),o(""),f(""),t(X),B({title:"已切换模式",description:X==="upload"?"现在可以上传配置文件":"现在可以指定配置文件路径"})},se=()=>{M&&(J(M),A(null)),k(!1)},H=()=>{if(n){T(!0);return}le()},le=()=>{d(""),a(null),f(""),B({title:"已清空",description:"路径和配置已清空"})},re=()=>{le(),T(!1)},ge=X=>{const q=JSON.parse(JSON.stringify(la)),ce=X.split(` +`);let fe="";for(const De of ce){const oe=De.trim();if(!oe||oe.startsWith("#"))continue;const He=oe.match(/^\[(\w+)\]$/);if(He){fe=He[1];continue}const at=oe.match(/^(\w+)\s*=\s*(.+)$/);if(at&&fe){const[,je,Ze]=at,qe=Ze.trim();let Ot;if(qe==="true")Ot=!0;else if(qe==="false")Ot=!1;else if(qe.startsWith("[")&&qe.endsWith("]")){const bn=qe.slice(1,-1).trim();if(bn){const Dn=bn.split(",").map(wn=>{const Wn=wn.trim();return isNaN(Number(Wn))?Wn.replace(/"/g,""):Number(Wn)}),Xe=typeof Dn[0];Ot=Dn.every(wn=>typeof wn===Xe)?Dn:Dn.filter(wn=>typeof wn=="number")}else Ot=[]}else qe.startsWith('"')&&qe.endsWith('"')?Ot=qe.slice(1,-1):isNaN(Number(qe))?Ot=qe.replace(/"/g,""):Ot=Number(qe);if(fe in q){const bn=q[fe];bn[je]=Ot}}}return q},E=X=>{const q=[],ce=(fe,De)=>fe===""||fe===null||fe===void 0?De:fe;return q.push("[inner]"),q.push(`version = "${ce(X.inner.version,la.inner.version)}" # 版本号`),q.push("# 请勿修改版本号,除非你知道自己在做什么"),q.push(""),q.push("[nickname] # 现在没用"),q.push(`nickname = "${ce(X.nickname.nickname,la.nickname.nickname)}"`),q.push(""),q.push("[napcat_server] # Napcat连接的ws服务设置"),q.push(`host = "${ce(X.napcat_server.host,la.napcat_server.host)}" # Napcat设定的主机地址`),q.push(`port = ${ce(X.napcat_server.port||0,la.napcat_server.port)} # Napcat设定的端口`),q.push(`token = "${ce(X.napcat_server.token,la.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),q.push(`heartbeat_interval = ${ce(X.napcat_server.heartbeat_interval||0,la.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),q.push(""),q.push("[maibot_server] # 连接麦麦的ws服务设置"),q.push(`host = "${ce(X.maibot_server.host,la.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),q.push(`port = ${ce(X.maibot_server.port||0,la.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),q.push(""),q.push("[chat] # 黑白名单功能"),q.push(`group_list_type = "${ce(X.chat.group_list_type,la.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),q.push(`group_list = [${X.chat.group_list.join(", ")}] # 群组名单`),q.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),q.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),q.push(`private_list_type = "${ce(X.chat.private_list_type,la.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),q.push(`private_list = [${X.chat.private_list.join(", ")}] # 私聊名单`),q.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),q.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),q.push(`ban_user_id = [${X.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),q.push(`ban_qq_bot = ${X.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),q.push(`enable_poke = ${X.chat.enable_poke} # 是否启用戳一戳功能`),q.push(""),q.push("[voice] # 发送语音设置"),q.push(`use_tts = ${X.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),q.push(""),q.push("[debug]"),q.push(`level = "${ce(X.debug.level,la.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),q.join(` +`)},we=X=>{const q=X.target.files?.[0];if(!q)return;const ce=new FileReader;ce.onload=fe=>{try{const De=fe.target?.result,oe=ge(De);a(oe),o(q.name),B({title:"上传成功",description:`已加载配置文件:${q.name}`})}catch(De){console.error("解析配置文件失败:",De),B({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},ce.readAsText(q)},Z=()=>{if(!n)return;const X=E(n),q=new Blob([X],{type:"text/plain;charset=utf-8"}),ce=URL.createObjectURL(q),fe=document.createElement("a");fe.href=ce,fe.download=l||"config.toml",document.body.appendChild(fe),fe.click(),document.body.removeChild(fe),URL.revokeObjectURL(ce),B({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},z=()=>{a(JSON.parse(JSON.stringify(la))),o("config.toml"),B({title:"已加载默认配置",description:"可以开始编辑配置"})};return r.jsx(an,{className:"h-full",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),r.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"工作模式"}),r.jsx(Qn,{children:"选择配置文件的管理方式"})]}),r.jsxs(Gt,{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 md:gap-4",children:[r.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${e==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Ne("upload"),children:r.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[r.jsx(Vy,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),r.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),r.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${e==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Ne("path"),children:r.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[r.jsx(CT,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),r.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),e==="path"&&r.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[r.jsxs("div",{className:"flex-1 space-y-1",children:[r.jsx(Te,{id:"config-path",value:c,onChange:X=>$(X.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${m?"border-destructive":""}`}),m&&r.jsx("p",{className:"text-xs text-destructive",children:m})]}),r.jsx(ne,{onClick:()=>U(c),disabled:y||!c||!!m,className:"w-full sm:w-auto",children:y?r.jsxs(r.Fragment,{children:[r.jsx(Ia,{className:"h-4 w-4 animate-spin mr-2"}),r.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"sm:hidden",children:"加载配置"}),r.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),r.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[r.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[r.jsx("span",{children:"路径格式说明"}),r.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),r.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[r.jsx("div",{children:"C:\\Adapter\\config.toml"}),r.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),r.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),r.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[r.jsx("div",{children:"/opt/adapter/config.toml"}),r.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),r.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),r.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),r.jsxs(qu,{children:[r.jsx(pi,{className:"h-4 w-4"}),r.jsx(Hu,{children:e==="upload"?r.jsxs(r.Fragment,{children:[r.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):r.jsxs(r.Fragment,{children:[r.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",p&&" (正在保存...)"]})})]}),e==="upload"&&!n&&r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[r.jsx("input",{ref:R,type:"file",accept:".toml",className:"hidden",onChange:we}),r.jsxs(ne,{onClick:()=>R.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[r.jsx(Vy,{className:"mr-2 h-4 w-4"}),"上传配置"]}),r.jsxs(ne,{onClick:z,size:"sm",className:"w-full sm:w-auto",children:[r.jsx(Nl,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),e==="upload"&&n&&r.jsx("div",{className:"flex gap-2",children:r.jsxs(ne,{onClick:Z,size:"sm",className:"w-full sm:w-auto",children:[r.jsx(hi,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),e==="path"&&n&&r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[r.jsxs(ne,{onClick:G,size:"sm",disabled:p||!!m,className:"w-full sm:w-auto",children:[r.jsx(Cm,{className:"mr-2 h-4 w-4"}),p?"保存中...":"立即保存"]}),r.jsxs(ne,{onClick:ee,size:"sm",variant:"outline",disabled:y,className:"w-full sm:w-auto",children:[r.jsx(Ia,{className:`mr-2 h-4 w-4 ${y?"animate-spin":""}`}),"刷新"]}),r.jsxs(ne,{onClick:H,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[r.jsx(zt,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),n?r.jsxs(kl,{defaultValue:"napcat",className:"w-full",children:[r.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:r.jsxs(Bs,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[r.jsxs(Pt,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[r.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),r.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),r.jsxs(Pt,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[r.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),r.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),r.jsxs(Pt,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[r.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),r.jsx("span",{className:"sm:hidden",children:"聊天"})]}),r.jsxs(Pt,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[r.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),r.jsx("span",{className:"sm:hidden",children:"语音"})]}),r.jsx(Pt,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),r.jsx(cn,{value:"napcat",className:"space-y-4",children:r.jsx(Lz,{config:n,onChange:X=>{a(X),I(X)}})}),r.jsx(cn,{value:"maibot",className:"space-y-4",children:r.jsx(Bz,{config:n,onChange:X=>{a(X),I(X)}})}),r.jsx(cn,{value:"chat",className:"space-y-4",children:r.jsx(Pz,{config:n,onChange:X=>{a(X),I(X)}})}),r.jsx(cn,{value:"voice",className:"space-y-4",children:r.jsx(Fz,{config:n,onChange:X=>{a(X),I(X)}})}),r.jsx(cn,{value:"debug",className:"space-y-4",children:r.jsx(Iz,{config:n,onChange:X=>{a(X),I(X)}})})]}):r.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:r.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[r.jsx(Nl,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),r.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:e==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),r.jsx(en,{open:N,onOpenChange:k,children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认切换模式"}),r.jsxs(Qt,{children:["切换模式将清空当前配置,确定要继续吗?",r.jsx("br",{}),r.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{onClick:()=>{k(!1),A(null)},children:"取消"}),r.jsx(Zt,{onClick:se,children:"确认切换"})]})]})}),r.jsx(en,{open:S,onOpenChange:T,children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认清空路径"}),r.jsxs(Qt,{children:["清空路径将清除当前配置,确定要继续吗?",r.jsx("br",{}),r.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{onClick:()=>T(!1),children:"取消"}),r.jsx(Zt,{onClick:re,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function Lz({config:e,onChange:t}){return r.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),r.jsxs("div",{className:"grid gap-3 md:gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),r.jsx(Te,{id:"napcat-host",value:e.napcat_server.host,onChange:n=>t({...e,napcat_server:{...e.napcat_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),r.jsx(Te,{id:"napcat-port",type:"number",value:e.napcat_server.port||"",onChange:n=>t({...e,napcat_server:{...e.napcat_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),r.jsx(Te,{id:"napcat-token",type:"password",value:e.napcat_server.token,onChange:n=>t({...e,napcat_server:{...e.napcat_server,token:n.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),r.jsx(Te,{id:"napcat-heartbeat",type:"number",value:e.napcat_server.heartbeat_interval||"",onChange:n=>t({...e,napcat_server:{...e.napcat_server,heartbeat_interval:n.target.value?parseInt(n.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function Bz({config:e,onChange:t}){return r.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),r.jsxs("div",{className:"grid gap-3 md:gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),r.jsx(Te,{id:"maibot-host",value:e.maibot_server.host,onChange:n=>t({...e,maibot_server:{...e.maibot_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),r.jsx(Te,{id:"maibot-port",type:"number",value:e.maibot_server.port||"",onChange:n=>t({...e,maibot_server:{...e.maibot_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function Pz({config:e,onChange:t}){const n=o=>{const c={...e};o==="group"?c.chat.group_list=[...c.chat.group_list,0]:o==="private"?c.chat.private_list=[...c.chat.private_list,0]:c.chat.ban_user_id=[...c.chat.ban_user_id,0],t(c)},a=(o,c)=>{const d={...e};o==="group"?d.chat.group_list=d.chat.group_list.filter((m,f)=>f!==c):o==="private"?d.chat.private_list=d.chat.private_list.filter((m,f)=>f!==c):d.chat.ban_user_id=d.chat.ban_user_id.filter((m,f)=>f!==c),t(d)},l=(o,c,d)=>{const m={...e};o==="group"?m.chat.group_list[c]=d:o==="private"?m.chat.private_list[c]=d:m.chat.ban_user_id[c]=d,t(m)};return r.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),r.jsxs("div",{className:"grid gap-4 md:gap-6",children:[r.jsxs("div",{className:"space-y-3 md:space-y-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-sm md:text-base",children:"群组名单类型"}),r.jsxs(_t,{value:e.chat.group_list_type,onValueChange:o=>t({...e,chat:{...e.chat,group_list_type:o}}),children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),r.jsx(Oe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[r.jsx(Q,{className:"text-sm md:text-base",children:"群组列表"}),r.jsxs(ne,{onClick:()=>n("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[r.jsx(Nl,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),e.chat.group_list.map((o,c)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{type:"number",value:o,onChange:d=>l("group",c,parseInt(d.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"icon",variant:"outline",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:["确定要删除群号 ",o," 吗?此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>a("group",c),children:"删除"})]})]})]})]},c)),e.chat.group_list.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),r.jsxs("div",{className:"space-y-3 md:space-y-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-sm md:text-base",children:"私聊名单类型"}),r.jsxs(_t,{value:e.chat.private_list_type,onValueChange:o=>t({...e,chat:{...e.chat,private_list_type:o}}),children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),r.jsx(Oe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[r.jsx(Q,{className:"text-sm md:text-base",children:"私聊列表"}),r.jsxs(ne,{onClick:()=>n("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[r.jsx(Nl,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),e.chat.private_list.map((o,c)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{type:"number",value:o,onChange:d=>l("private",c,parseInt(d.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"icon",variant:"outline",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:["确定要删除用户 ",o," 吗?此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>a("private",c),children:"删除"})]})]})]})]},c)),e.chat.private_list.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-sm md:text-base",children:"全局禁止名单"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),r.jsxs(ne,{onClick:()=>n("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[r.jsx(Nl,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),e.chat.ban_user_id.map((o,c)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{type:"number",value:o,onChange:d=>l("ban",c,parseInt(d.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"icon",variant:"outline",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:["确定要从全局禁止名单中删除用户 ",o," 吗?此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>a("ban",c),children:"删除"})]})]})]})]},c)),e.chat.ban_user_id.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),r.jsx(vt,{checked:e.chat.ban_qq_bot,onCheckedChange:o=>t({...e,chat:{...e.chat,ban_qq_bot:o}})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),r.jsx(vt,{checked:e.chat.enable_poke,onCheckedChange:o=>t({...e,chat:{...e.chat,enable_poke:o}})})]})]})]})})}function Fz({config:e,onChange:t}){return r.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),r.jsx(vt,{checked:e.voice.use_tts,onCheckedChange:n=>t({...e,voice:{use_tts:n}})})]})]})})}function Iz({config:e,onChange:t}){return r.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),r.jsx("div",{className:"grid gap-3 md:gap-4",children:r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-sm md:text-base",children:"日志等级"}),r.jsxs(_t,{value:e.debug.level,onValueChange:n=>t({...e,debug:{level:n}}),children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"DEBUG",children:"DEBUG(调试)"}),r.jsx(Oe,{value:"INFO",children:"INFO(信息)"}),r.jsx(Oe,{value:"WARNING",children:"WARNING(警告)"}),r.jsx(Oe,{value:"ERROR",children:"ERROR(错误)"}),r.jsx(Oe,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function Bb(e){const t=[],n=String(e||"");let a=n.indexOf(","),l=0,o=!1;for(;!o;){a===-1&&(a=n.length,o=!0);const c=n.slice(l,a).trim();(c||!o)&&t.push(c),l=a+1,a=n.indexOf(",",l)}return t}function qz(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Hz=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Uz=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$z={};function Pb(e,t){return($z.jsx?Uz:Hz).test(e)}const Vz=/[ \t\n\f\r]/g;function Gz(e){return typeof e=="object"?e.type==="text"?Fb(e.value):!1:Fb(e)}function Fb(e){return e.replace(Vz,"")===""}class $u{constructor(t,n,a){this.normal=n,this.property=t,a&&(this.space=a)}}$u.prototype.normal={};$u.prototype.property={};$u.prototype.space=void 0;function s7(e,t){const n={},a={};for(const l of e)Object.assign(n,l.property),Object.assign(a,l.normal);return new $u(n,a,t)}function yu(e){return e.toLowerCase()}class Kr{constructor(t,n){this.attribute=n,this.property=t}}Kr.prototype.attribute="";Kr.prototype.booleanish=!1;Kr.prototype.boolean=!1;Kr.prototype.commaOrSpaceSeparated=!1;Kr.prototype.commaSeparated=!1;Kr.prototype.defined=!1;Kr.prototype.mustUseProperty=!1;Kr.prototype.number=!1;Kr.prototype.overloadedBoolean=!1;Kr.prototype.property="";Kr.prototype.spaceSeparated=!1;Kr.prototype.space=void 0;let Yz=0;const gt=ki(),$n=ki(),Px=ki(),ze=ki(),vn=ki(),Oo=ki(),ia=ki();function ki(){return 2**++Yz}const Fx=Object.freeze(Object.defineProperty({__proto__:null,boolean:gt,booleanish:$n,commaOrSpaceSeparated:ia,commaSeparated:Oo,number:ze,overloadedBoolean:Px,spaceSeparated:vn},Symbol.toStringTag,{value:"Module"})),Rp=Object.keys(Fx);class G1 extends Kr{constructor(t,n,a,l){let o=-1;if(super(t,n),Ib(this,"space",l),typeof a=="number")for(;++o4&&n.slice(0,4)==="data"&&Zz.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(qb,eO);a="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!qb.test(o)){let c=o.replace(Qz,Jz);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}l=G1}return new l(a,t)}function Jz(e){return"-"+e.toLowerCase()}function eO(e){return e.charAt(1).toUpperCase()}const h7=s7([l7,Wz,c7,u7,d7],"html"),Hm=s7([l7,Xz,c7,u7,d7],"svg");function Hb(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function tO(e){return e.join(" ").trim()}var yo={},Lp,Ub;function nO(){if(Ub)return Lp;Ub=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,d=/^\s+|\s+$/g,m=` +`,f="/",p="*",x="",y="comment",b="declaration";function N(S,T){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];T=T||{};var M=1,A=1;function R(J){var se=J.match(t);se&&(M+=se.length);var H=J.lastIndexOf(m);A=~H?J.length-H:A+J.length}function B(){var J={line:M,column:A};return function(se){return se.position=new O(J),U(),se}}function O(J){this.start=J,this.end={line:M,column:A},this.source=T.source}O.prototype.content=S;function L(J){var se=new Error(T.source+":"+M+":"+A+": "+J);if(se.reason=J,se.filename=T.source,se.line=M,se.column=A,se.source=S,!T.silent)throw se}function $(J){var se=J.exec(S);if(se){var H=se[0];return R(H),S=S.slice(H.length),se}}function U(){$(n)}function I(J){var se;for(J=J||[];se=G();)se!==!1&&J.push(se);return J}function G(){var J=B();if(!(f!=S.charAt(0)||p!=S.charAt(1))){for(var se=2;x!=S.charAt(se)&&(p!=S.charAt(se)||f!=S.charAt(se+1));)++se;if(se+=2,x===S.charAt(se-1))return L("End of comment missing");var H=S.slice(2,se-2);return A+=2,R(H),S=S.slice(se),A+=2,J({type:y,comment:H})}}function ee(){var J=B(),se=$(a);if(se){if(G(),!$(l))return L("property missing ':'");var H=$(o),le=J({type:b,property:k(se[0].replace(e,x)),value:H?k(H[0].replace(e,x)):x});return $(c),le}}function Ne(){var J=[];I(J);for(var se;se=ee();)se!==!1&&(J.push(se),I(J));return J}return U(),Ne()}function k(S){return S?S.replace(d,x):x}return Lp=N,Lp}var $b;function rO(){if($b)return yo;$b=1;var e=yo&&yo.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(yo,"__esModule",{value:!0}),yo.default=n;const t=e(nO());function n(a,l){let o=null;if(!a||typeof a!="string")return o;const c=(0,t.default)(a),d=typeof l=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:f,value:p}=m;d?l(f,p,m):p&&(o=o||{},o[f]=p)}),o}return yo}var eu={},Vb;function aO(){if(Vb)return eu;Vb=1,Object.defineProperty(eu,"__esModule",{value:!0}),eu.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,o=function(f){return!f||n.test(f)||e.test(f)},c=function(f,p){return p.toUpperCase()},d=function(f,p){return"".concat(p,"-")},m=function(f,p){return p===void 0&&(p={}),o(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(l,d):f=f.replace(a,d),f.replace(t,c))};return eu.camelCase=m,eu}var tu,Gb;function sO(){if(Gb)return tu;Gb=1;var e=tu&&tu.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(rO()),n=aO();function a(l,o){var c={};return!l||typeof l!="string"||(0,t.default)(l,function(d,m){d&&m&&(c[(0,n.camelCase)(d,o)]=m)}),c}return a.default=a,tu=a,tu}var lO=sO();const iO=B5(lO),f7=p7("end"),Y1=p7("start");function p7(e){return t;function t(n){const a=n&&n.position&&n.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function oO(e){const t=Y1(e),n=f7(e);if(t&&n)return{start:t,end:n}}function uu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Yb(e.position):"start"in e||"end"in e?Yb(e):"line"in e||"column"in e?Ix(e):""}function Ix(e){return Wb(e&&e.line)+":"+Wb(e&&e.column)}function Yb(e){return Ix(e&&e.start)+"-"+Ix(e&&e.end)}function Wb(e){return e&&typeof e=="number"?e:1}class Nr extends Error{constructor(t,n,a){super(),typeof n=="string"&&(a=n,n=void 0);let l="",o={},c=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?l=t:!o.cause&&t&&(c=!0,l=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof a=="string"){const m=a.indexOf(":");m===-1?o.ruleId=a:(o.source=a.slice(0,m),o.ruleId=a.slice(m+1))}if(!o.place&&o.ancestors&&o.ancestors){const m=o.ancestors[o.ancestors.length-1];m&&(o.place=m.position)}const d=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=d?d.line:void 0,this.name=uu(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=c&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Nr.prototype.file="";Nr.prototype.name="";Nr.prototype.reason="";Nr.prototype.message="";Nr.prototype.stack="";Nr.prototype.column=void 0;Nr.prototype.line=void 0;Nr.prototype.ancestors=void 0;Nr.prototype.cause=void 0;Nr.prototype.fatal=void 0;Nr.prototype.place=void 0;Nr.prototype.ruleId=void 0;Nr.prototype.source=void 0;const W1={}.hasOwnProperty,cO=new Map,uO=/[A-Z]/g,dO=new Set(["table","tbody","thead","tfoot","tr"]),mO=new Set(["td","th"]),x7="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function hO(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let a;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=wO(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=bO(n,t.jsx,t.jsxs)}const l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:a,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Hm:h7,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=g7(l,e,void 0);return o&&typeof o!="string"?o:l.create(e,l.Fragment,{children:o||void 0},void 0)}function g7(e,t,n){if(t.type==="element")return fO(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return pO(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return gO(e,t,n);if(t.type==="mdxjsEsm")return xO(e,t);if(t.type==="root")return vO(e,t,n);if(t.type==="text")return yO(e,t)}function fO(e,t,n){const a=e.schema;let l=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(l=Hm,e.schema=l),e.ancestors.push(t);const o=y7(e,t.tagName,!1),c=jO(e,t);let d=K1(e,t);return dO.has(t.tagName)&&(d=d.filter(function(m){return typeof m=="string"?!Gz(m):!0})),v7(e,c,o,t),X1(c,d),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function pO(e,t){if(t.data&&t.data.estree&&e.evaluater){const a=t.data.estree.body[0];return a.type,e.evaluater.evaluateExpression(a.expression)}bu(e,t.position)}function xO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);bu(e,t.position)}function gO(e,t,n){const a=e.schema;let l=a;t.name==="svg"&&a.space==="html"&&(l=Hm,e.schema=l),e.ancestors.push(t);const o=t.name===null?e.Fragment:y7(e,t.name,!0),c=NO(e,t),d=K1(e,t);return v7(e,c,o,t),X1(c,d),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function vO(e,t,n){const a={};return X1(a,K1(e,t)),e.create(t,e.Fragment,a,n)}function yO(e,t){return t.value}function v7(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function X1(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function bO(e,t,n){return a;function a(l,o,c,d){const f=Array.isArray(c.children)?n:t;return d?f(o,c,d):f(o,c)}}function wO(e,t){return n;function n(a,l,o,c){const d=Array.isArray(o.children),m=Y1(a);return t(l,o,c,d,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function jO(e,t){const n={};let a,l;for(l in t.properties)if(l!=="children"&&W1.call(t.properties,l)){const o=SO(e,l,t.properties[l]);if(o){const[c,d]=o;e.tableCellAlignToStyle&&c==="align"&&typeof d=="string"&&mO.has(t.tagName)?a=d:n[c]=d}}if(a){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return n}function NO(e,t){const n={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const o=a.data.estree.body[0];o.type;const c=o.expression;c.type;const d=c.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else bu(e,t.position);else{const l=a.name;let o;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const d=a.value.data.estree.body[0];d.type,o=e.evaluater.evaluateExpression(d.expression)}else bu(e,t.position);else o=a.value===null?!0:a.value;n[l]=o}return n}function K1(e,t){const n=[];let a=-1;const l=e.passKeys?new Map:cO;for(;++al?0:l+t:t=t>l?l:t,n=n>0?n:0,a.length<1e4)c=Array.from(a),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);o0?(ua(e,e.length,0,t),e):t}const Qb={}.hasOwnProperty;function w7(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function qa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Tr=Ll(/[A-Za-z]/),wr=Ll(/[\dA-Za-z]/),zO=Ll(/[#-'*+\--9=?A-Z^-~]/);function cm(e){return e!==null&&(e<32||e===127)}const qx=Ll(/\d/),OO=Ll(/[\dA-Fa-f]/),RO=Ll(/[!-/:-@[-`{-~]/);function We(e){return e!==null&&e<-2}function pn(e){return e!==null&&(e<0||e===32)}function Mt(e){return e===-2||e===-1||e===32}const Um=Ll(new RegExp("\\p{P}|\\p{S}","u")),yi=Ll(/\s/);function Ll(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ec(e){const t=[];let n=-1,a=0,l=0;for(;++n55295&&o<57344){const d=e.charCodeAt(n+1);o<56320&&d>56319&&d<57344?(c=String.fromCharCode(o,d),l=1):c="�"}else c=String.fromCharCode(o);c&&(t.push(e.slice(a,n),encodeURIComponent(c)),a=n+l+1,c=""),l&&(n+=l,l=0)}return t.join("")+e.slice(a)}function St(e,t,n,a){const l=a?a-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(m){return Mt(m)?(e.enter(n),d(m)):t(m)}function d(m){return Mt(m)&&o++c))return;const L=t.events.length;let $=L,U,I;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(U){I=t.events[$][1].end;break}U=!0}for(T(a),O=L;OA;){const B=n[R];t.containerState=B[1],B[0].exit.call(t,e)}n.length=A}function M(){l.write([null]),o=void 0,l=void 0,t.containerState._closeFlow=void 0}}function IO(e,t,n){return St(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ho(e){if(e===null||pn(e)||yi(e))return 1;if(Um(e))return 2}function $m(e,t,n){const a=[];let l=-1;for(;++l1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const x={...e[a][1].end},y={...e[n][1].start};Jb(x,-m),Jb(y,m),c={type:m>1?"strongSequence":"emphasisSequence",start:x,end:{...e[a][1].end}},d={type:m>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},o={type:m>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},l={type:m>1?"strong":"emphasis",start:{...c.start},end:{...d.end}},e[a][1].end={...c.start},e[n][1].start={...d.end},f=[],e[a][1].end.offset-e[a][1].start.offset&&(f=ka(f,[["enter",e[a][1],t],["exit",e[a][1],t]])),f=ka(f,[["enter",l,t],["enter",c,t],["exit",c,t],["enter",o,t]]),f=ka(f,$m(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),f=ka(f,[["exit",o,t],["enter",d,t],["exit",d,t],["exit",l,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,f=ka(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,ua(e,a-1,n-a+3,f),n=a+f.length-p-2;break}}for(n=-1;++n0&&Mt(O)?St(e,M,"linePrefix",o+1)(O):M(O)}function M(O){return O===null||We(O)?e.check(e3,k,R)(O):(e.enter("codeFlowValue"),A(O))}function A(O){return O===null||We(O)?(e.exit("codeFlowValue"),M(O)):(e.consume(O),A)}function R(O){return e.exit("codeFenced"),t(O)}function B(O,L,$){let U=0;return I;function I(se){return O.enter("lineEnding"),O.consume(se),O.exit("lineEnding"),G}function G(se){return O.enter("codeFencedFence"),Mt(se)?St(O,ee,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(se):ee(se)}function ee(se){return se===d?(O.enter("codeFencedFenceSequence"),Ne(se)):$(se)}function Ne(se){return se===d?(U++,O.consume(se),Ne):U>=c?(O.exit("codeFencedFenceSequence"),Mt(se)?St(O,J,"whitespace")(se):J(se)):$(se)}function J(se){return se===null||We(se)?(O.exit("codeFencedFence"),L(se)):$(se)}}}function ZO(e,t,n){const a=this;return l;function l(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o)}function o(c){return a.parser.lazy[a.now().line]?n(c):t(c)}}const Pp={name:"codeIndented",tokenize:eR},JO={partial:!0,tokenize:tR};function eR(e,t,n){const a=this;return l;function l(f){return e.enter("codeIndented"),St(e,o,"linePrefix",5)(f)}function o(f){const p=a.events[a.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?c(f):n(f)}function c(f){return f===null?m(f):We(f)?e.attempt(JO,c,m)(f):(e.enter("codeFlowValue"),d(f))}function d(f){return f===null||We(f)?(e.exit("codeFlowValue"),c(f)):(e.consume(f),d)}function m(f){return e.exit("codeIndented"),t(f)}}function tR(e,t,n){const a=this;return l;function l(c){return a.parser.lazy[a.now().line]?n(c):We(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):St(e,o,"linePrefix",5)(c)}function o(c){const d=a.events[a.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(c):We(c)?l(c):n(c)}}const nR={name:"codeText",previous:aR,resolve:rR,tokenize:sR};function rR(e){let t=e.length-4,n=3,a,l;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(a=n;++a=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(t,n,a){const l=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return a&&nu(this.left,a),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),nu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),nu(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(c):e.interrupt(a.parser.constructs.flow,n,t)(c)}}function T7(e,t,n,a,l,o,c,d,m){const f=m||Number.POSITIVE_INFINITY;let p=0;return x;function x(T){return T===60?(e.enter(a),e.enter(l),e.enter(o),e.consume(T),e.exit(o),y):T===null||T===32||T===41||cm(T)?n(T):(e.enter(a),e.enter(c),e.enter(d),e.enter("chunkString",{contentType:"string"}),k(T))}function y(T){return T===62?(e.enter(o),e.consume(T),e.exit(o),e.exit(l),e.exit(a),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),b(T))}function b(T){return T===62?(e.exit("chunkString"),e.exit(d),y(T)):T===null||T===60||We(T)?n(T):(e.consume(T),T===92?N:b)}function N(T){return T===60||T===62||T===92?(e.consume(T),b):b(T)}function k(T){return!p&&(T===null||T===41||pn(T))?(e.exit("chunkString"),e.exit(d),e.exit(c),e.exit(a),t(T)):p999||b===null||b===91||b===93&&!m||b===94&&!d&&"_hiddenFootnoteSupport"in c.parser.constructs?n(b):b===93?(e.exit(o),e.enter(l),e.consume(b),e.exit(l),e.exit(a),t):We(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),x(b))}function x(b){return b===null||b===91||b===93||We(b)||d++>999?(e.exit("chunkString"),p(b)):(e.consume(b),m||(m=!Mt(b)),b===92?y:x)}function y(b){return b===91||b===92||b===93?(e.consume(b),d++,x):x(b)}}function E7(e,t,n,a,l,o){let c;return d;function d(y){return y===34||y===39||y===40?(e.enter(a),e.enter(l),e.consume(y),e.exit(l),c=y===40?41:y,m):n(y)}function m(y){return y===c?(e.enter(l),e.consume(y),e.exit(l),e.exit(a),t):(e.enter(o),f(y))}function f(y){return y===c?(e.exit(o),m(c)):y===null?n(y):We(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),St(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===c||y===null||We(y)?(e.exit("chunkString"),f(y)):(e.consume(y),y===92?x:p)}function x(y){return y===c||y===92?(e.consume(y),p):p(y)}}function du(e,t){let n;return a;function a(l){return We(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),n=!0,a):Mt(l)?St(e,a,n?"linePrefix":"lineSuffix")(l):t(l)}}const hR={name:"definition",tokenize:pR},fR={partial:!0,tokenize:xR};function pR(e,t,n){const a=this;let l;return o;function o(b){return e.enter("definition"),c(b)}function c(b){return _7.call(a,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function d(b){return l=qa(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),m):n(b)}function m(b){return pn(b)?du(e,f)(b):f(b)}function f(b){return T7(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function p(b){return e.attempt(fR,x,x)(b)}function x(b){return Mt(b)?St(e,y,"whitespace")(b):y(b)}function y(b){return b===null||We(b)?(e.exit("definition"),a.parser.defined.push(l),t(b)):n(b)}}function xR(e,t,n){return a;function a(d){return pn(d)?du(e,l)(d):n(d)}function l(d){return E7(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function o(d){return Mt(d)?St(e,c,"whitespace")(d):c(d)}function c(d){return d===null||We(d)?t(d):n(d)}}const gR={name:"hardBreakEscape",tokenize:vR};function vR(e,t,n){return a;function a(o){return e.enter("hardBreakEscape"),e.consume(o),l}function l(o){return We(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const yR={name:"headingAtx",resolve:bR,tokenize:wR};function bR(e,t){let n=e.length-2,a=3,l,o;return e[a][1].type==="whitespace"&&(a+=2),n-2>a&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(a===n-1||n-4>a&&e[n-2][1].type==="whitespace")&&(n-=a+1===n?2:4),n>a&&(l={type:"atxHeadingText",start:e[a][1].start,end:e[n][1].end},o={type:"chunkText",start:e[a][1].start,end:e[n][1].end,contentType:"text"},ua(e,a,n-a+1,[["enter",l,t],["enter",o,t],["exit",o,t],["exit",l,t]])),e}function wR(e,t,n){let a=0;return l;function l(p){return e.enter("atxHeading"),o(p)}function o(p){return e.enter("atxHeadingSequence"),c(p)}function c(p){return p===35&&a++<6?(e.consume(p),c):p===null||pn(p)?(e.exit("atxHeadingSequence"),d(p)):n(p)}function d(p){return p===35?(e.enter("atxHeadingSequence"),m(p)):p===null||We(p)?(e.exit("atxHeading"),t(p)):Mt(p)?St(e,d,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function m(p){return p===35?(e.consume(p),m):(e.exit("atxHeadingSequence"),d(p))}function f(p){return p===null||p===35||pn(p)?(e.exit("atxHeadingText"),d(p)):(e.consume(p),f)}}const jR=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],n3=["pre","script","style","textarea"],NR={concrete:!0,name:"htmlFlow",resolveTo:CR,tokenize:TR},SR={partial:!0,tokenize:ER},kR={partial:!0,tokenize:_R};function CR(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function TR(e,t,n){const a=this;let l,o,c,d,m;return f;function f(z){return p(z)}function p(z){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(z),x}function x(z){return z===33?(e.consume(z),y):z===47?(e.consume(z),o=!0,k):z===63?(e.consume(z),l=3,a.interrupt?t:E):Tr(z)?(e.consume(z),c=String.fromCharCode(z),S):n(z)}function y(z){return z===45?(e.consume(z),l=2,b):z===91?(e.consume(z),l=5,d=0,N):Tr(z)?(e.consume(z),l=4,a.interrupt?t:E):n(z)}function b(z){return z===45?(e.consume(z),a.interrupt?t:E):n(z)}function N(z){const X="CDATA[";return z===X.charCodeAt(d++)?(e.consume(z),d===X.length?a.interrupt?t:ee:N):n(z)}function k(z){return Tr(z)?(e.consume(z),c=String.fromCharCode(z),S):n(z)}function S(z){if(z===null||z===47||z===62||pn(z)){const X=z===47,q=c.toLowerCase();return!X&&!o&&n3.includes(q)?(l=1,a.interrupt?t(z):ee(z)):jR.includes(c.toLowerCase())?(l=6,X?(e.consume(z),T):a.interrupt?t(z):ee(z)):(l=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(z):o?M(z):A(z))}return z===45||wr(z)?(e.consume(z),c+=String.fromCharCode(z),S):n(z)}function T(z){return z===62?(e.consume(z),a.interrupt?t:ee):n(z)}function M(z){return Mt(z)?(e.consume(z),M):I(z)}function A(z){return z===47?(e.consume(z),I):z===58||z===95||Tr(z)?(e.consume(z),R):Mt(z)?(e.consume(z),A):I(z)}function R(z){return z===45||z===46||z===58||z===95||wr(z)?(e.consume(z),R):B(z)}function B(z){return z===61?(e.consume(z),O):Mt(z)?(e.consume(z),B):A(z)}function O(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(e.consume(z),m=z,L):Mt(z)?(e.consume(z),O):$(z)}function L(z){return z===m?(e.consume(z),m=null,U):z===null||We(z)?n(z):(e.consume(z),L)}function $(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||pn(z)?B(z):(e.consume(z),$)}function U(z){return z===47||z===62||Mt(z)?A(z):n(z)}function I(z){return z===62?(e.consume(z),G):n(z)}function G(z){return z===null||We(z)?ee(z):Mt(z)?(e.consume(z),G):n(z)}function ee(z){return z===45&&l===2?(e.consume(z),H):z===60&&l===1?(e.consume(z),le):z===62&&l===4?(e.consume(z),we):z===63&&l===3?(e.consume(z),E):z===93&&l===5?(e.consume(z),ge):We(z)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(SR,Z,Ne)(z)):z===null||We(z)?(e.exit("htmlFlowData"),Ne(z)):(e.consume(z),ee)}function Ne(z){return e.check(kR,J,Z)(z)}function J(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),se}function se(z){return z===null||We(z)?Ne(z):(e.enter("htmlFlowData"),ee(z))}function H(z){return z===45?(e.consume(z),E):ee(z)}function le(z){return z===47?(e.consume(z),c="",re):ee(z)}function re(z){if(z===62){const X=c.toLowerCase();return n3.includes(X)?(e.consume(z),we):ee(z)}return Tr(z)&&c.length<8?(e.consume(z),c+=String.fromCharCode(z),re):ee(z)}function ge(z){return z===93?(e.consume(z),E):ee(z)}function E(z){return z===62?(e.consume(z),we):z===45&&l===2?(e.consume(z),E):ee(z)}function we(z){return z===null||We(z)?(e.exit("htmlFlowData"),Z(z)):(e.consume(z),we)}function Z(z){return e.exit("htmlFlow"),t(z)}}function _R(e,t,n){const a=this;return l;function l(c){return We(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):n(c)}function o(c){return a.parser.lazy[a.now().line]?n(c):t(c)}}function ER(e,t,n){return a;function a(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Vu,t,n)}}const MR={name:"htmlText",tokenize:AR};function AR(e,t,n){const a=this;let l,o,c;return d;function d(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),m}function m(E){return E===33?(e.consume(E),f):E===47?(e.consume(E),B):E===63?(e.consume(E),A):Tr(E)?(e.consume(E),$):n(E)}function f(E){return E===45?(e.consume(E),p):E===91?(e.consume(E),o=0,N):Tr(E)?(e.consume(E),M):n(E)}function p(E){return E===45?(e.consume(E),b):n(E)}function x(E){return E===null?n(E):E===45?(e.consume(E),y):We(E)?(c=x,le(E)):(e.consume(E),x)}function y(E){return E===45?(e.consume(E),b):x(E)}function b(E){return E===62?H(E):E===45?y(E):x(E)}function N(E){const we="CDATA[";return E===we.charCodeAt(o++)?(e.consume(E),o===we.length?k:N):n(E)}function k(E){return E===null?n(E):E===93?(e.consume(E),S):We(E)?(c=k,le(E)):(e.consume(E),k)}function S(E){return E===93?(e.consume(E),T):k(E)}function T(E){return E===62?H(E):E===93?(e.consume(E),T):k(E)}function M(E){return E===null||E===62?H(E):We(E)?(c=M,le(E)):(e.consume(E),M)}function A(E){return E===null?n(E):E===63?(e.consume(E),R):We(E)?(c=A,le(E)):(e.consume(E),A)}function R(E){return E===62?H(E):A(E)}function B(E){return Tr(E)?(e.consume(E),O):n(E)}function O(E){return E===45||wr(E)?(e.consume(E),O):L(E)}function L(E){return We(E)?(c=L,le(E)):Mt(E)?(e.consume(E),L):H(E)}function $(E){return E===45||wr(E)?(e.consume(E),$):E===47||E===62||pn(E)?U(E):n(E)}function U(E){return E===47?(e.consume(E),H):E===58||E===95||Tr(E)?(e.consume(E),I):We(E)?(c=U,le(E)):Mt(E)?(e.consume(E),U):H(E)}function I(E){return E===45||E===46||E===58||E===95||wr(E)?(e.consume(E),I):G(E)}function G(E){return E===61?(e.consume(E),ee):We(E)?(c=G,le(E)):Mt(E)?(e.consume(E),G):U(E)}function ee(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),l=E,Ne):We(E)?(c=ee,le(E)):Mt(E)?(e.consume(E),ee):(e.consume(E),J)}function Ne(E){return E===l?(e.consume(E),l=void 0,se):E===null?n(E):We(E)?(c=Ne,le(E)):(e.consume(E),Ne)}function J(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||pn(E)?U(E):(e.consume(E),J)}function se(E){return E===47||E===62||pn(E)?U(E):n(E)}function H(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function le(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),re}function re(E){return Mt(E)?St(e,ge,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):ge(E)}function ge(E){return e.enter("htmlTextData"),c(E)}}const J1={name:"labelEnd",resolveAll:RR,resolveTo:LR,tokenize:BR},DR={tokenize:PR},zR={tokenize:FR},OR={tokenize:IR};function RR(e){let t=-1;const n=[];for(;++t=3&&(f===null||We(f))?(e.exit("thematicBreak"),t(f)):n(f)}function m(f){return f===l?(e.consume(f),a++,m):(e.exit("thematicBreakSequence"),Mt(f)?St(e,d,"whitespace")(f):d(f))}}const qr={continuation:{tokenize:KR},exit:ZR,name:"list",tokenize:XR},YR={partial:!0,tokenize:JR},WR={partial:!0,tokenize:QR};function XR(e,t,n){const a=this,l=a.events[a.events.length-1];let o=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,c=0;return d;function d(b){const N=a.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(N==="listUnordered"?!a.containerState.marker||b===a.containerState.marker:qx(b)){if(a.containerState.type||(a.containerState.type=N,e.enter(N,{_container:!0})),N==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(X0,n,f)(b):f(b);if(!a.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(b)}return n(b)}function m(b){return qx(b)&&++c<10?(e.consume(b),m):(!a.interrupt||c<2)&&(a.containerState.marker?b===a.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),f(b)):n(b)}function f(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||b,e.check(Vu,a.interrupt?n:p,e.attempt(YR,y,x))}function p(b){return a.containerState.initialBlankLine=!0,o++,y(b)}function x(b){return Mt(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return a.containerState.size=o+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function KR(e,t,n){const a=this;return a.containerState._closeFlow=void 0,e.check(Vu,l,o);function l(d){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,St(e,t,"listItemIndent",a.containerState.size+1)(d)}function o(d){return a.containerState.furtherBlankLines||!Mt(d)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,c(d)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(WR,t,c)(d))}function c(d){return a.containerState._closeFlow=!0,a.interrupt=void 0,St(e,e.attempt(qr,t,n),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function QR(e,t,n){const a=this;return St(e,l,"listItemIndent",a.containerState.size+1);function l(o){const c=a.events[a.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===a.containerState.size?t(o):n(o)}}function ZR(e){e.exit(this.containerState.type)}function JR(e,t,n){const a=this;return St(e,l,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(o){const c=a.events[a.events.length-1];return!Mt(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const r3={name:"setextUnderline",resolveTo:eL,tokenize:tL};function eL(e,t){let n=e.length,a,l,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){a=n;break}e[n][1].type==="paragraph"&&(l=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const c={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",o?(e.splice(l,0,["enter",c,t]),e.splice(o+1,0,["exit",e[a][1],t]),e[a][1].end={...e[o][1].end}):e[a][1]=c,e.push(["exit",c,t]),e}function tL(e,t,n){const a=this;let l;return o;function o(f){let p=a.events.length,x;for(;p--;)if(a.events[p][1].type!=="lineEnding"&&a.events[p][1].type!=="linePrefix"&&a.events[p][1].type!=="content"){x=a.events[p][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||x)?(e.enter("setextHeadingLine"),l=f,c(f)):n(f)}function c(f){return e.enter("setextHeadingLineSequence"),d(f)}function d(f){return f===l?(e.consume(f),d):(e.exit("setextHeadingLineSequence"),Mt(f)?St(e,m,"lineSuffix")(f):m(f))}function m(f){return f===null||We(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const nL={tokenize:rL};function rL(e){const t=this,n=e.attempt(Vu,a,e.attempt(this.parser.constructs.flowInitial,l,St(e,e.attempt(this.parser.constructs.flow,l,e.attempt(oR,l)),"linePrefix")));return n;function a(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function l(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const aL={resolveAll:A7()},sL=M7("string"),lL=M7("text");function M7(e){return{resolveAll:A7(e==="text"?iL:void 0),tokenize:t};function t(n){const a=this,l=this.parser.constructs[e],o=n.attempt(l,c,d);return c;function c(p){return f(p)?o(p):d(p)}function d(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),m}function m(p){return f(p)?(n.exit("data"),o(p)):(n.consume(p),m)}function f(p){if(p===null)return!0;const x=l[p];let y=-1;if(x)for(;++y-1){const d=c[0];typeof d=="string"?c[0]=d.slice(a):c.shift()}o>0&&c.push(e[l].slice(0,o))}return c}function bL(e,t){let n=-1;const a=[];let l;for(;++n0){const rr=Re.tokenStack[Re.tokenStack.length-1];(rr[1]||s3).call(Re,void 0,rr[0])}for(be.position={start:gl(K.length>0?K[0][1].start:{line:1,column:1,offset:0}),end:gl(K.length>0?K[K.length-2][1].end:{line:1,column:1,offset:0})},kt=-1;++kt1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,m);const f={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(t,f),e.applyData(t,f)}function BL(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PL(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function O7(e,t){const n=t.referenceType;let a="]";if(n==="collapsed"?a+="[]":n==="full"&&(a+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+a}];const l=e.all(t),o=l[0];o&&o.type==="text"?o.value="["+o.value:l.unshift({type:"text",value:"["});const c=l[l.length-1];return c&&c.type==="text"?c.value+=a:l.push({type:"text",value:a}),l}function FL(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return O7(e,t);const l={src:ec(a.url||""),alt:t.alt};a.title!==null&&a.title!==void 0&&(l.title=a.title);const o={type:"element",tagName:"img",properties:l,children:[]};return e.patch(t,o),e.applyData(t,o)}function IL(e,t){const n={src:ec(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,a),e.applyData(t,a)}function qL(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const a={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,a),e.applyData(t,a)}function HL(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return O7(e,t);const l={href:ec(a.url||"")};a.title!==null&&a.title!==void 0&&(l.title=a.title);const o={type:"element",tagName:"a",properties:l,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function UL(e,t){const n={href:ec(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function $L(e,t,n){const a=e.all(t),l=n?VL(n):R7(t),o={},c=[];if(typeof t.checked=="boolean"){const p=a[0];let x;p&&p.type==="element"&&p.tagName==="p"?x=p:(x={type:"element",tagName:"p",properties:{},children:[]},a.unshift(x)),x.children.length>0&&x.children.unshift({type:"text",value:" "}),x.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let d=-1;for(;++d1}function GL(e,t){const n={},a=e.all(t);let l=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++l0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},d=Y1(t.children[1]),m=f7(t.children[t.children.length-1]);d&&m&&(c.position={start:d,end:m}),l.push(c)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(t,o),e.applyData(t,o)}function QL(e,t,n){const a=n?n.children:void 0,o=(a?a.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,d=c?c.length:t.children.length;let m=-1;const f=[];for(;++m0,!0),a[0]),l=a.index+a[0].length,a=n.exec(t);return o.push(o3(t.slice(l),l>0,!1)),o.join("")}function o3(e,t,n){let a=0,l=e.length;if(t){let o=e.codePointAt(a);for(;o===l3||o===i3;)a++,o=e.codePointAt(a)}if(n){let o=e.codePointAt(l-1);for(;o===l3||o===i3;)l--,o=e.codePointAt(l-1)}return l>a?e.slice(a,l):""}function eB(e,t){const n={type:"text",value:JL(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function tB(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const nB={blockquote:AL,break:DL,code:zL,delete:OL,emphasis:RL,footnoteReference:LL,heading:BL,html:PL,imageReference:FL,image:IL,inlineCode:qL,linkReference:HL,link:UL,listItem:$L,list:GL,paragraph:YL,root:WL,strong:XL,table:KL,tableCell:ZL,tableRow:QL,text:eB,thematicBreak:tB,toml:k0,yaml:k0,definition:k0,footnoteDefinition:k0};function k0(){}const L7=-1,Vm=0,mu=1,um=2,eg=3,tg=4,ng=5,rg=6,B7=7,P7=8,c3=typeof self=="object"?self:globalThis,rB=(e,t)=>{const n=(l,o)=>(e.set(o,l),l),a=l=>{if(e.has(l))return e.get(l);const[o,c]=t[l];switch(o){case Vm:case L7:return n(c,l);case mu:{const d=n([],l);for(const m of c)d.push(a(m));return d}case um:{const d=n({},l);for(const[m,f]of c)d[a(m)]=a(f);return d}case eg:return n(new Date(c),l);case tg:{const{source:d,flags:m}=c;return n(new RegExp(d,m),l)}case ng:{const d=n(new Map,l);for(const[m,f]of c)d.set(a(m),a(f));return d}case rg:{const d=n(new Set,l);for(const m of c)d.add(a(m));return d}case B7:{const{name:d,message:m}=c;return n(new c3[d](m),l)}case P7:return n(BigInt(c),l);case"BigInt":return n(Object(BigInt(c)),l);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:d}=new Uint8Array(c);return n(new DataView(d),c)}}return n(new c3[o](c),l)};return a},u3=e=>rB(new Map,e)(0),bo="",{toString:aB}={},{keys:sB}=Object,ru=e=>{const t=typeof e;if(t!=="object"||!e)return[Vm,t];const n=aB.call(e).slice(8,-1);switch(n){case"Array":return[mu,bo];case"Object":return[um,bo];case"Date":return[eg,bo];case"RegExp":return[tg,bo];case"Map":return[ng,bo];case"Set":return[rg,bo];case"DataView":return[mu,n]}return n.includes("Array")?[mu,n]:n.includes("Error")?[B7,n]:[um,n]},C0=([e,t])=>e===Vm&&(t==="function"||t==="symbol"),lB=(e,t,n,a)=>{const l=(c,d)=>{const m=a.push(c)-1;return n.set(d,m),m},o=c=>{if(n.has(c))return n.get(c);let[d,m]=ru(c);switch(d){case Vm:{let p=c;switch(m){case"bigint":d=P7,p=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);p=null;break;case"undefined":return l([L7],c)}return l([d,p],c)}case mu:{if(m){let y=c;return m==="DataView"?y=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(y=new Uint8Array(c)),l([m,[...y]],c)}const p=[],x=l([d,p],c);for(const y of c)p.push(o(y));return x}case um:{if(m)switch(m){case"BigInt":return l([m,c.toString()],c);case"Boolean":case"Number":case"String":return l([m,c.valueOf()],c)}if(t&&"toJSON"in c)return o(c.toJSON());const p=[],x=l([d,p],c);for(const y of sB(c))(e||!C0(ru(c[y])))&&p.push([o(y),o(c[y])]);return x}case eg:return l([d,c.toISOString()],c);case tg:{const{source:p,flags:x}=c;return l([d,{source:p,flags:x}],c)}case ng:{const p=[],x=l([d,p],c);for(const[y,b]of c)(e||!(C0(ru(y))||C0(ru(b))))&&p.push([o(y),o(b)]);return x}case rg:{const p=[],x=l([d,p],c);for(const y of c)(e||!C0(ru(y)))&&p.push(o(y));return x}}const{message:f}=c;return l([d,{name:m,message:f}],c)};return o},d3=(e,{json:t,lossy:n}={})=>{const a=[];return lB(!(t||n),!!t,new Map,a)(e),a},dm=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?u3(d3(e,t)):structuredClone(e):(e,t)=>u3(d3(e,t));function iB(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function oB(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function cB(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||iB,a=e.options.footnoteBackLabel||oB,l=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let m=-1;for(;++m0&&N.push({type:"text",value:" "});let M=typeof n=="string"?n:n(m,b);typeof M=="string"&&(M={type:"text",value:M}),N.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,b),className:["data-footnote-backref"]},children:Array.isArray(M)?M:[M]})}const S=p[p.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const M=S.children[S.children.length-1];M&&M.type==="text"?M.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...N)}else p.push(...N);const T={type:"element",tagName:"li",properties:{id:t+"fn-"+y},children:e.wrap(p,!0)};e.patch(f,T),d.push(T)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...dm(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:` +`}]}}const Gu=(function(e){if(e==null)return hB;if(typeof e=="function")return Gm(e);if(typeof e=="object")return Array.isArray(e)?uB(e):dB(e);if(typeof e=="string")return mB(e);throw new Error("Expected function, string, or object as test")});function uB(e){const t=[];let n=-1;for(;++n":""))+")"})}return y;function y(){let b=F7,N,k,S;if((!t||o(m,f,p[p.length-1]||void 0))&&(b=xB(n(m,p)),b[0]===Ux))return b;if("children"in m&&m.children){const T=m;if(T.children&&b[0]!==I7)for(k=(a?T.children.length:-1)+c,S=p.concat(T);k>-1&&k0&&n.push({type:"text",value:` +`}),n}function m3(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function h3(e,t){const n=vB(e,t),a=n.one(e,void 0),l=cB(n),o=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return l&&o.children.push({type:"text",value:` +`},l),o}function NB(e,t){return e&&"run"in e?async function(n,a){const l=h3(n,{file:a,...t});await e.run(l,a)}:function(n,a){return h3(n,{file:a,...e||t})}}function f3(e){if(e)throw e}var Ip,p3;function SB(){if(p3)return Ip;p3=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},o=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var p=e.call(f,"constructor"),x=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!x)return!1;var y;for(y in f);return typeof y>"u"||e.call(f,y)},c=function(f,p){n&&p.name==="__proto__"?n(f,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):f[p.name]=p.newValue},d=function(f,p){if(p==="__proto__")if(e.call(f,p)){if(a)return a(f,p).value}else return;return f[p]};return Ip=function m(){var f,p,x,y,b,N,k=arguments[0],S=1,T=arguments.length,M=!1;for(typeof k=="boolean"&&(M=k,k=arguments[1]||{},S=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});Sc.length;let m;d&&c.push(l);try{m=e.apply(this,c)}catch(f){const p=f;if(d&&n)throw p;return l(p)}d||(m&&m.then&&typeof m.then=="function"?m.then(o,l):m instanceof Error?l(m):o(m))}function l(c,...d){n||(n=!0,t(c,...d))}function o(c){l(null,c)}}const Ka={basename:_B,dirname:EB,extname:MB,join:AB,sep:"/"};function _B(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Yu(e);let n=0,a=-1,l=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(o){n=l+1;break}}else a<0&&(o=!0,a=l+1);return a<0?"":e.slice(n,a)}if(t===e)return"";let c=-1,d=t.length-1;for(;l--;)if(e.codePointAt(l)===47){if(o){n=l+1;break}}else c<0&&(o=!0,c=l+1),d>-1&&(e.codePointAt(l)===t.codePointAt(d--)?d<0&&(a=l):(d=-1,a=c));return n===a?a=c:a<0&&(a=e.length),e.slice(n,a)}function EB(e){if(Yu(e),e.length===0)return".";let t=-1,n=e.length,a;for(;--n;)if(e.codePointAt(n)===47){if(a){t=n;break}}else a||(a=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function MB(e){Yu(e);let t=e.length,n=-1,a=0,l=-1,o=0,c;for(;t--;){const d=e.codePointAt(t);if(d===47){if(c){a=t+1;break}continue}n<0&&(c=!0,n=t+1),d===46?l<0?l=t:o!==1&&(o=1):l>-1&&(o=-1)}return l<0||n<0||o===0||o===1&&l===n-1&&l===a+1?"":e.slice(l,n)}function AB(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function zB(e,t){let n="",a=0,l=-1,o=0,c=-1,d,m;for(;++c<=e.length;){if(c2){if(m=n.lastIndexOf("/"),m!==n.length-1){m<0?(n="",a=0):(n=n.slice(0,m),a=n.length-1-n.lastIndexOf("/")),l=c,o=0;continue}}else if(n.length>0){n="",a=0,l=c,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",a=2)}else n.length>0?n+="/"+e.slice(l+1,c):n=e.slice(l+1,c),a=c-l-1;l=c,o=0}else d===46&&o>-1?o++:o=-1}return n}function Yu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const OB={cwd:RB};function RB(){return"/"}function Gx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function LB(e){if(typeof e=="string")e=new URL(e);else if(!Gx(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return BB(e)}function BB(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const t=e.pathname;let n=-1;for(;++n0){let[b,...N]=p;const k=a[y][1];Vx(k)&&Vx(b)&&(b=qp(!0,k,b)),a[y]=[f,b,...N]}}}}const qB=new lg().freeze();function Vp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Gp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Yp(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function g3(e){if(!Vx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function v3(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function T0(e){return HB(e)?e:new q7(e)}function HB(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function UB(e){return typeof e=="string"||$B(e)}function $B(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const VB="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",y3=[],b3={allowDangerousHtml:!0},GB=/^(https?|ircs?|mailto|xmpp)$/i,YB=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function WB(e){const t=XB(e),n=KB(e);return QB(t.runSync(t.parse(n),n),e)}function XB(e){const t=e.rehypePlugins||y3,n=e.remarkPlugins||y3,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...b3}:b3;return qB().use(ML).use(n).use(NB,a).use(t)}function KB(e){const t=e.children||"",n=new q7;return typeof t=="string"&&(n.value=t),n}function QB(e,t){const n=t.allowedElements,a=t.allowElement,l=t.components,o=t.disallowedElements,c=t.skipHtml,d=t.unwrapDisallowed,m=t.urlTransform||ZB;for(const p of YB)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+VB+p.id,void 0);return sg(e,f),hO(e,{Fragment:r.Fragment,components:l,ignoreInvalidStyle:!0,jsx:r.jsx,jsxs:r.jsxs,passKeys:!0,passNode:!0});function f(p,x,y){if(p.type==="raw"&&y&&typeof x=="number")return c?y.children.splice(x,1):y.children[x]={type:"text",value:p.value},x;if(p.type==="element"){let b;for(b in Bp)if(Object.hasOwn(Bp,b)&&Object.hasOwn(p.properties,b)){const N=p.properties[b],k=Bp[b];(k===null||k.includes(p.tagName))&&(p.properties[b]=m(String(N||""),b,p))}}if(p.type==="element"){let b=n?!n.includes(p.tagName):o?o.includes(p.tagName):!1;if(!b&&a&&typeof x=="number"&&(b=!a(p,x,y)),b&&y&&typeof x=="number")return d&&p.children?y.children.splice(x,1,...p.children):y.children.splice(x,1),x}}}function ZB(e){const t=e.indexOf(":"),n=e.indexOf("?"),a=e.indexOf("#"),l=e.indexOf("/");return t===-1||l!==-1&&t>l||n!==-1&&t>n||a!==-1&&t>a||GB.test(e.slice(0,t))?e:""}function w3(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let a=0,l=n.indexOf(t);for(;l!==-1;)a++,l=n.indexOf(t,l+t.length);return a}function JB(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function eP(e,t,n){const l=Gu((n||{}).ignore||[]),o=tP(t);let c=-1;for(;++c0?{type:"text",value:O}:void 0),O===!1?y.lastIndex=R+1:(N!==R&&M.push({type:"text",value:f.value.slice(N,R)}),Array.isArray(O)?M.push(...O):O&&M.push(O),N=R+A[0].length,T=!0),!y.global)break;A=y.exec(f.value)}return T?(N?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],a=n.indexOf(")");const l=w3(e,"(");let o=w3(e,")");for(;a!==-1&&l>o;)e+=n.slice(0,a+1),n=n.slice(a+1),a=n.indexOf(")"),o++;return[e,n]}function H7(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||yi(n)||Um(n))&&(!t||n!==47)}U7.peek=SP;function xP(){this.buffer()}function gP(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function vP(){this.buffer()}function yP(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function bP(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=qa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function wP(e){this.exit(e)}function jP(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=qa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function NP(e){this.exit(e)}function SP(){return"["}function U7(e,t,n,a){const l=n.createTracker(a);let o=l.move("[^");const c=n.enter("footnoteReference"),d=n.enter("reference");return o+=l.move(n.safe(n.associationId(e),{after:"]",before:o})),d(),c(),o+=l.move("]"),o}function kP(){return{enter:{gfmFootnoteCallString:xP,gfmFootnoteCall:gP,gfmFootnoteDefinitionLabelString:vP,gfmFootnoteDefinition:yP},exit:{gfmFootnoteCallString:bP,gfmFootnoteCall:wP,gfmFootnoteDefinitionLabelString:jP,gfmFootnoteDefinition:NP}}}function CP(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:U7},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(a,l,o,c){const d=o.createTracker(c);let m=d.move("[^");const f=o.enter("footnoteDefinition"),p=o.enter("label");return m+=d.move(o.safe(o.associationId(a),{before:m,after:"]"})),p(),m+=d.move("]:"),a.children&&a.children.length>0&&(d.shift(4),m+=d.move((t?` +`:" ")+o.indentLines(o.containerFlow(a,d.current()),t?$7:TP))),f(),m}}function TP(e,t,n){return t===0?e:$7(e,t,n)}function $7(e,t,n){return(n?"":" ")+e}const _P=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];V7.peek=zP;function EP(){return{canContainEols:["delete"],enter:{strikethrough:AP},exit:{strikethrough:DP}}}function MP(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:_P}],handlers:{delete:V7}}}function AP(e){this.enter({type:"delete",children:[]},e)}function DP(e){this.exit(e)}function V7(e,t,n,a){const l=n.createTracker(a),o=n.enter("strikethrough");let c=l.move("~~");return c+=n.containerPhrasing(e,{...l.current(),before:c,after:"~"}),c+=l.move("~~"),o(),c}function zP(){return"~"}function OP(e){return e.length}function RP(e,t){const n=t||{},a=(n.align||[]).concat(),l=n.stringLength||OP,o=[],c=[],d=[],m=[];let f=0,p=-1;for(;++pf&&(f=e[p].length);++Tm[T])&&(m[T]=A)}k.push(M)}c[p]=k,d[p]=S}let x=-1;if(typeof a=="object"&&"length"in a)for(;++xm[x]&&(m[x]=M),b[x]=M),y[x]=A}c.splice(1,0,y),d.splice(1,0,b),p=-1;const N=[];for(;++p "),o.shift(2);const c=n.indentLines(n.containerFlow(e,o.current()),PP);return l(),c}function PP(e,t,n){return">"+(n?"":" ")+e}function FP(e,t){return N3(e,t.inConstruct,!0)&&!N3(e,t.notInConstruct,!1)}function N3(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let a=-1;for(;++ac&&(c=o):o=1,l=a+t.length,a=n.indexOf(t,l);return c}function IP(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function qP(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function HP(e,t,n,a){const l=qP(n),o=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(IP(e,n)){const x=n.enter("codeIndented"),y=n.indentLines(o,UP);return x(),y}const d=n.createTracker(a),m=l.repeat(Math.max(G7(o,l)+1,3)),f=n.enter("codeFenced");let p=d.move(m);if(e.lang){const x=n.enter(`codeFencedLang${c}`);p+=d.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...d.current()})),x()}if(e.lang&&e.meta){const x=n.enter(`codeFencedMeta${c}`);p+=d.move(" "),p+=d.move(n.safe(e.meta,{before:p,after:` +`,encode:["`"],...d.current()})),x()}return p+=d.move(` +`),o&&(p+=d.move(o+` +`)),p+=d.move(m),f(),p}function UP(e,t,n){return(n?"":" ")+e}function ig(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function $P(e,t,n,a){const l=ig(n),o=l==='"'?"Quote":"Apostrophe",c=n.enter("definition");let d=n.enter("label");const m=n.createTracker(a);let f=m.move("[");return f+=m.move(n.safe(n.associationId(e),{before:f,after:"]",...m.current()})),f+=m.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),f+=m.move("<"),f+=m.move(n.safe(e.url,{before:f,after:">",...m.current()})),f+=m.move(">")):(d=n.enter("destinationRaw"),f+=m.move(n.safe(e.url,{before:f,after:e.title?" ":` +`,...m.current()}))),d(),e.title&&(d=n.enter(`title${o}`),f+=m.move(" "+l),f+=m.move(n.safe(e.title,{before:f,after:l,...m.current()})),f+=m.move(l),d()),c(),f}function VP(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function wu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function mm(e,t,n){const a=Ho(e),l=Ho(t);return a===void 0?l===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Y7.peek=GP;function Y7(e,t,n,a){const l=VP(n),o=n.enter("emphasis"),c=n.createTracker(a),d=c.move(l);let m=c.move(n.containerPhrasing(e,{after:l,before:d,...c.current()}));const f=m.charCodeAt(0),p=mm(a.before.charCodeAt(a.before.length-1),f,l);p.inside&&(m=wu(f)+m.slice(1));const x=m.charCodeAt(m.length-1),y=mm(a.after.charCodeAt(0),x,l);y.inside&&(m=m.slice(0,-1)+wu(x));const b=c.move(l);return o(),n.attentionEncodeSurroundingInfo={after:y.outside,before:p.outside},d+m+b}function GP(e,t,n){return n.options.emphasis||"*"}function YP(e,t){let n=!1;return sg(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return n=!0,Ux}),!!((!e.depth||e.depth<3)&&Q1(e)&&(t.options.setext||n))}function WP(e,t,n,a){const l=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(a);if(YP(e,n)){const p=n.enter("headingSetext"),x=n.enter("phrasing"),y=n.containerPhrasing(e,{...o.current(),before:` +`,after:` +`});return x(),p(),y+` +`+(l===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(` +`))+1))}const c="#".repeat(l),d=n.enter("headingAtx"),m=n.enter("phrasing");o.move(c+" ");let f=n.containerPhrasing(e,{before:"# ",after:` +`,...o.current()});return/^[\t ]/.test(f)&&(f=wu(f.charCodeAt(0))+f.slice(1)),f=f?c+" "+f:c,n.options.closeAtx&&(f+=" "+c),m(),d(),f}W7.peek=XP;function W7(e){return e.value||""}function XP(){return"<"}X7.peek=KP;function X7(e,t,n,a){const l=ig(n),o=l==='"'?"Quote":"Apostrophe",c=n.enter("image");let d=n.enter("label");const m=n.createTracker(a);let f=m.move("![");return f+=m.move(n.safe(e.alt,{before:f,after:"]",...m.current()})),f+=m.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),f+=m.move("<"),f+=m.move(n.safe(e.url,{before:f,after:">",...m.current()})),f+=m.move(">")):(d=n.enter("destinationRaw"),f+=m.move(n.safe(e.url,{before:f,after:e.title?" ":")",...m.current()}))),d(),e.title&&(d=n.enter(`title${o}`),f+=m.move(" "+l),f+=m.move(n.safe(e.title,{before:f,after:l,...m.current()})),f+=m.move(l),d()),f+=m.move(")"),c(),f}function KP(){return"!"}K7.peek=QP;function K7(e,t,n,a){const l=e.referenceType,o=n.enter("imageReference");let c=n.enter("label");const d=n.createTracker(a);let m=d.move("![");const f=n.safe(e.alt,{before:m,after:"]",...d.current()});m+=d.move(f+"]["),c();const p=n.stack;n.stack=[],c=n.enter("reference");const x=n.safe(n.associationId(e),{before:m,after:"]",...d.current()});return c(),n.stack=p,o(),l==="full"||!f||f!==x?m+=d.move(x+"]"):l==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function QP(){return"!"}Q7.peek=ZP;function Q7(e,t,n){let a=e.value||"",l="`",o=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(a);)l+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++o\u007F]/.test(e.url))}J7.peek=JP;function J7(e,t,n,a){const l=ig(n),o=l==='"'?"Quote":"Apostrophe",c=n.createTracker(a);let d,m;if(Z7(e,n)){const p=n.stack;n.stack=[],d=n.enter("autolink");let x=c.move("<");return x+=c.move(n.containerPhrasing(e,{before:x,after:">",...c.current()})),x+=c.move(">"),d(),n.stack=p,x}d=n.enter("link"),m=n.enter("label");let f=c.move("[");return f+=c.move(n.containerPhrasing(e,{before:f,after:"](",...c.current()})),f+=c.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=n.enter("destinationLiteral"),f+=c.move("<"),f+=c.move(n.safe(e.url,{before:f,after:">",...c.current()})),f+=c.move(">")):(m=n.enter("destinationRaw"),f+=c.move(n.safe(e.url,{before:f,after:e.title?" ":")",...c.current()}))),m(),e.title&&(m=n.enter(`title${o}`),f+=c.move(" "+l),f+=c.move(n.safe(e.title,{before:f,after:l,...c.current()})),f+=c.move(l),m()),f+=c.move(")"),d(),f}function JP(e,t,n){return Z7(e,n)?"<":"["}e8.peek=eF;function e8(e,t,n,a){const l=e.referenceType,o=n.enter("linkReference");let c=n.enter("label");const d=n.createTracker(a);let m=d.move("[");const f=n.containerPhrasing(e,{before:m,after:"]",...d.current()});m+=d.move(f+"]["),c();const p=n.stack;n.stack=[],c=n.enter("reference");const x=n.safe(n.associationId(e),{before:m,after:"]",...d.current()});return c(),n.stack=p,o(),l==="full"||!f||f!==x?m+=d.move(x+"]"):l==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function eF(){return"["}function og(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function tF(e){const t=og(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function nF(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function t8(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function rF(e,t,n,a){const l=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?nF(n):og(n);const d=e.ordered?c==="."?")":".":tF(n);let m=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(m=!0),t8(n)===c&&p){let x=-1;for(;++x-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let c=o.length+1;(l==="tab"||l==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const d=n.createTracker(a);d.move(o+" ".repeat(c-o.length)),d.shift(c);const m=n.enter("listItem"),f=n.indentLines(n.containerFlow(e,d.current()),p);return m(),f;function p(x,y,b){return y?(b?"":" ".repeat(c))+x:(b?o:o+" ".repeat(c-o.length))+x}}function lF(e,t,n,a){const l=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,a);return o(),l(),c}const iF=Gu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function oF(e,t,n,a){return(e.children.some(function(c){return iF(c)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function cF(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}n8.peek=uF;function n8(e,t,n,a){const l=cF(n),o=n.enter("strong"),c=n.createTracker(a),d=c.move(l+l);let m=c.move(n.containerPhrasing(e,{after:l,before:d,...c.current()}));const f=m.charCodeAt(0),p=mm(a.before.charCodeAt(a.before.length-1),f,l);p.inside&&(m=wu(f)+m.slice(1));const x=m.charCodeAt(m.length-1),y=mm(a.after.charCodeAt(0),x,l);y.inside&&(m=m.slice(0,-1)+wu(x));const b=c.move(l+l);return o(),n.attentionEncodeSurroundingInfo={after:y.outside,before:p.outside},d+m+b}function uF(e,t,n){return n.options.strong||"*"}function dF(e,t,n,a){return n.safe(e.value,a)}function mF(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function hF(e,t,n){const a=(t8(n)+(n.options.ruleSpaces?" ":"")).repeat(mF(n));return n.options.ruleSpaces?a.slice(0,-1):a}const r8={blockquote:BP,break:S3,code:HP,definition:$P,emphasis:Y7,hardBreak:S3,heading:WP,html:W7,image:X7,imageReference:K7,inlineCode:Q7,link:J7,linkReference:e8,list:rF,listItem:sF,paragraph:lF,root:oF,strong:n8,text:dF,thematicBreak:hF};function fF(){return{enter:{table:pF,tableData:k3,tableHeader:k3,tableRow:gF},exit:{codeText:vF,table:xF,tableData:Qp,tableHeader:Qp,tableRow:Qp}}}function pF(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function xF(e){this.exit(e),this.data.inTable=void 0}function gF(e){this.enter({type:"tableRow",children:[]},e)}function Qp(e){this.exit(e)}function k3(e){this.enter({type:"tableCell",children:[]},e)}function vF(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,yF));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function yF(e,t){return t==="|"?t:e}function bF(e){const t=e||{},n=t.tableCellPadding,a=t.tablePipeAlign,l=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:c,tableCell:m,tableRow:d}};function c(b,N,k,S){return f(p(b,k,S),b.align)}function d(b,N,k,S){const T=x(b,k,S),M=f([T]);return M.slice(0,M.indexOf(` +`))}function m(b,N,k,S){const T=k.enter("tableCell"),M=k.enter("phrasing"),A=k.containerPhrasing(b,{...S,before:o,after:o});return M(),T(),A}function f(b,N){return RP(b,{align:N,alignDelimiters:a,padding:n,stringLength:l})}function p(b,N,k){const S=b.children;let T=-1;const M=[],A=N.enter("table");for(;++T0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const PF={tokenize:GF,partial:!0};function FF(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:UF,continuation:{tokenize:$F},exit:VF}},text:{91:{name:"gfmFootnoteCall",tokenize:HF},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:IF,resolveTo:qF}}}}function IF(e,t,n){const a=this;let l=a.events.length;const o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let c;for(;l--;){const m=a.events[l][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return d;function d(m){if(!c||!c._balanced)return n(m);const f=qa(a.sliceSerialize({start:c.end,end:a.now()}));return f.codePointAt(0)!==94||!o.includes(f.slice(1))?n(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),t(m))}}function qF(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},d=[e[n+1],e[n+2],["enter",a,t],e[n+3],e[n+4],["enter",l,t],["exit",l,t],["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(n,e.length-n+1,...d),e}function HF(e,t,n){const a=this,l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o=0,c;return d;function d(x){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),m}function m(x){return x!==94?n(x):(e.enter("gfmFootnoteCallMarker"),e.consume(x),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(x){if(o>999||x===93&&!c||x===null||x===91||pn(x))return n(x);if(x===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return l.includes(qa(a.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(x)}return pn(x)||(c=!0),o++,e.consume(x),x===92?p:f}function p(x){return x===91||x===92||x===93?(e.consume(x),o++,f):f(x)}}function UF(e,t,n){const a=this,l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o,c=0,d;return m;function m(N){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(N),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(N){return N===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(N),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(N)}function p(N){if(c>999||N===93&&!d||N===null||N===91||pn(N))return n(N);if(N===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=qa(a.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(N),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return pn(N)||(d=!0),c++,e.consume(N),N===92?x:p}function x(N){return N===91||N===92||N===93?(e.consume(N),c++,p):p(N)}function y(N){return N===58?(e.enter("definitionMarker"),e.consume(N),e.exit("definitionMarker"),l.includes(o)||l.push(o),St(e,b,"gfmFootnoteDefinitionWhitespace")):n(N)}function b(N){return t(N)}}function $F(e,t,n){return e.check(Vu,t,e.attempt(PF,t,n))}function VF(e){e.exit("gfmFootnoteDefinition")}function GF(e,t,n){const a=this;return St(e,l,"gfmFootnoteDefinitionIndent",5);function l(o){const c=a.events[a.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(o):n(o)}}function YF(e){let n=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:o,resolveAll:l};return n==null&&(n=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function l(c,d){let m=-1;for(;++m1?m(N):(c.consume(N),x++,b);if(x<2&&!n)return m(N);const S=c.exit("strikethroughSequenceTemporary"),T=Ho(N);return S._open=!T||T===2&&!!k,S._close=!k||k===2&&!!T,d(N)}}}class WF{constructor(){this.map=[]}add(t,n,a){XF(this,t,n,a)}consume(t){if(this.map.sort(function(o,c){return o[0]-c[0]}),this.map.length===0)return;let n=this.map.length;const a=[];for(;n>0;)n-=1,a.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];a.push(t.slice()),t.length=0;let l=a.pop();for(;l;){for(const o of l)t.push(o);l=a.pop()}this.map.length=0}}function XF(e,t,n,a){let l=0;if(!(n===0&&a.length===0)){for(;l-1;){const J=a.events[G][1].type;if(J==="lineEnding"||J==="linePrefix")G--;else break}const ee=G>-1?a.events[G][1].type:null,Ne=ee==="tableHead"||ee==="tableRow"?O:m;return Ne===O&&a.parser.lazy[a.now().line]?n(I):Ne(I)}function m(I){return e.enter("tableHead"),e.enter("tableRow"),f(I)}function f(I){return I===124||(c=!0,o+=1),p(I)}function p(I){return I===null?n(I):We(I)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),b):n(I):Mt(I)?St(e,p,"whitespace")(I):(o+=1,c&&(c=!1,l+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),c=!0,p):(e.enter("data"),x(I)))}function x(I){return I===null||I===124||pn(I)?(e.exit("data"),p(I)):(e.consume(I),I===92?y:x)}function y(I){return I===92||I===124?(e.consume(I),x):x(I)}function b(I){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(I):(e.enter("tableDelimiterRow"),c=!1,Mt(I)?St(e,N,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):N(I))}function N(I){return I===45||I===58?S(I):I===124?(c=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),k):B(I)}function k(I){return Mt(I)?St(e,S,"whitespace")(I):S(I)}function S(I){return I===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),T):I===45?(o+=1,T(I)):I===null||We(I)?R(I):B(I)}function T(I){return I===45?(e.enter("tableDelimiterFiller"),M(I)):B(I)}function M(I){return I===45?(e.consume(I),M):I===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),A):(e.exit("tableDelimiterFiller"),A(I))}function A(I){return Mt(I)?St(e,R,"whitespace")(I):R(I)}function R(I){return I===124?N(I):I===null||We(I)?!c||l!==o?B(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):B(I)}function B(I){return n(I)}function O(I){return e.enter("tableRow"),L(I)}function L(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),L):I===null||We(I)?(e.exit("tableRow"),t(I)):Mt(I)?St(e,L,"whitespace")(I):(e.enter("data"),$(I))}function $(I){return I===null||I===124||pn(I)?(e.exit("data"),L(I)):(e.consume(I),I===92?U:$)}function U(I){return I===92||I===124?(e.consume(I),$):$(I)}}function JF(e,t){let n=-1,a=!0,l=0,o=[0,0,0,0],c=[0,0,0,0],d=!1,m=0,f,p,x;const y=new WF;for(;++nn[2]+1){const N=n[2]+1,k=n[3]-n[2]-1;e.add(N,k,[])}}e.add(n[3]+1,0,[["exit",x,t]])}return l!==void 0&&(o.end=Object.assign({},_o(t.events,l)),e.add(l,0,[["exit",o,t]]),o=void 0),o}function T3(e,t,n,a,l){const o=[],c=_o(t.events,n);l&&(l.end=Object.assign({},c),o.push(["exit",l,t])),a.end=Object.assign({},c),o.push(["exit",a,t]),e.add(n+1,0,o)}function _o(e,t){const n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}const eI={name:"tasklistCheck",tokenize:nI};function tI(){return{text:{91:eI}}}function nI(e,t,n){const a=this;return l;function l(m){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?n(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),o)}function o(m){return pn(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):n(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),d):n(m)}function d(m){return We(m)?t(m):Mt(m)?e.check({tokenize:rI},t,n)(m):n(m)}}function rI(e,t,n){return St(e,a,"whitespace");function a(l){return l===null?n(l):t(l)}}function aI(e){return w7([EF(),FF(),YF(e),QF(),tI()])}const sI={};function lI(e){const t=this,n=e||sI,a=t.data(),l=a.micromarkExtensions||(a.micromarkExtensions=[]),o=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);l.push(aI(n)),o.push(kF()),c.push(CF(n))}function iI(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:o},exit:{mathFlow:l,mathFlowFence:a,mathFlowFenceMeta:n,mathFlowValue:d,mathText:c,mathTextData:d}};function e(m){const f={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[f]}},m)}function t(){this.buffer()}function n(){const m=this.resume(),f=this.stack[this.stack.length-1];f.type,f.meta=m}function a(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function l(m){const f=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),p=this.stack[this.stack.length-1];p.type,this.exit(m),p.value=f;const x=p.data.hChildren[0];x.type,x.tagName,x.children.push({type:"text",value:f}),this.data.mathFlowInside=void 0}function o(m){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},m),this.buffer()}function c(m){const f=this.resume(),p=this.stack[this.stack.length-1];p.type,this.exit(m),p.value=f,p.data.hChildren.push({type:"text",value:f})}function d(m){this.config.enter.data.call(this,m),this.config.exit.data.call(this,m)}}function oI(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),a.peek=l,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` +`,inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:a}};function n(o,c,d,m){const f=o.value||"",p=d.createTracker(m),x="$".repeat(Math.max(G7(f,"$")+1,2)),y=d.enter("mathFlow");let b=p.move(x);if(o.meta){const N=d.enter("mathFlowMeta");b+=p.move(d.safe(o.meta,{after:` +`,before:b,encode:["$"],...p.current()})),N()}return b+=p.move(` +`),f&&(b+=p.move(f+` +`)),b+=p.move(x),y(),b}function a(o,c,d){let m=o.value||"",f=1;for(t||f++;new RegExp("(^|[^$])"+"\\$".repeat(f)+"([^$]|$)").test(m);)f++;const p="$".repeat(f);/[^ \r\n]/.test(m)&&(/^[ \r\n]/.test(m)&&/[ \r\n]$/.test(m)||/^\$|\$$/.test(m))&&(m=" "+m+" ");let x=-1;for(;++x15?f="…"+d.slice(l-15,l):f=d.slice(0,l);var p;o+15":">","<":"<",'"':""","'":"'"},bI=/[&><"']/g;function wI(e){return String(e).replace(bI,t=>yI[t])}var m8=function e(t){return t.type==="ordgroup"||t.type==="color"?t.body.length===1?e(t.body[0]):t:t.type==="font"?e(t.body):t},jI=function(t){var n=m8(t);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},NI=function(t){if(!t)throw new Error("Expected non-null, but got "+String(t));return t},SI=function(t){var n=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(t);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},Ut={deflt:xI,escape:wI,hyphenate:vI,getBaseElem:m8,isCharacterBox:jI,protocolFromUrl:SI},K0={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand ",cliProcessor:e=>e==="Infinity"?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function kI(e){if(e.default)return e.default;var t=e.type,n=Array.isArray(t)?t[0]:t;if(typeof n!="string")return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class ug{constructor(t){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,t=t||{};for(var n in K0)if(K0.hasOwnProperty(n)){var a=K0[n];this[n]=t[n]!==void 0?a.processor?a.processor(t[n]):t[n]:kI(a)}}reportNonstrict(t,n,a){var l=this.strict;if(typeof l=="function"&&(l=l(t,n,a)),!(!l||l==="ignore")){if(l===!0||l==="error")throw new Ae("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+t+"]"),a);l==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+l+"': "+n+" ["+t+"]"))}}useStrictBehavior(t,n,a){var l=this.strict;if(typeof l=="function")try{l=l(t,n,a)}catch{l="error"}return!l||l==="ignore"?!1:l===!0||l==="error"?!0:l==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+l+"': "+n+" ["+t+"]")),!1)}isTrusted(t){if(t.url&&!t.protocol){var n=Ut.protocolFromUrl(t.url);if(n==null)return!1;t.protocol=n}var a=typeof this.trust=="function"?this.trust(t):this.trust;return!!a}}class vl{constructor(t,n,a){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=n,this.cramped=a}sup(){return Za[CI[this.id]]}sub(){return Za[TI[this.id]]}fracNum(){return Za[_I[this.id]]}fracDen(){return Za[EI[this.id]]}cramp(){return Za[MI[this.id]]}text(){return Za[AI[this.id]]}isTight(){return this.size>=2}}var dg=0,hm=1,Ro=2,Rs=3,ju=4,Ca=5,Uo=6,_r=7,Za=[new vl(dg,0,!1),new vl(hm,0,!0),new vl(Ro,1,!1),new vl(Rs,1,!0),new vl(ju,2,!1),new vl(Ca,2,!0),new vl(Uo,3,!1),new vl(_r,3,!0)],CI=[ju,Ca,ju,Ca,Uo,_r,Uo,_r],TI=[Ca,Ca,Ca,Ca,_r,_r,_r,_r],_I=[Ro,Rs,ju,Ca,Uo,_r,Uo,_r],EI=[Rs,Rs,Ca,Ca,_r,_r,_r,_r],MI=[hm,hm,Rs,Rs,Ca,Ca,_r,_r],AI=[dg,hm,Ro,Rs,Ro,Rs,Ro,Rs],tt={DISPLAY:Za[dg],TEXT:Za[Ro],SCRIPT:Za[ju],SCRIPTSCRIPT:Za[Uo]},Wx=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function DI(e){for(var t=0;t=l[0]&&e<=l[1])return n.name}return null}var Q0=[];Wx.forEach(e=>e.blocks.forEach(t=>Q0.push(...t)));function h8(e){for(var t=0;t=Q0[t]&&e<=Q0[t+1])return!0;return!1}var wo=80,zI=function(t,n){return"M95,"+(622+t+n)+` +c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 +c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 +c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 +s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429 +c69,-144,104.5,-217.7,106.5,-221 +l`+t/2.075+" -"+t+` +c5.3,-9.3,12,-14,20,-14 +H400000v`+(40+t)+`H845.2724 +s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 +c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z +M`+(834+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},OI=function(t,n){return"M263,"+(601+t+n)+`c0.7,0,18,39.7,52,119 +c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 +c340,-704.7,510.7,-1060.3,512,-1067 +l`+t/2.084+" -"+t+` +c4.7,-7.3,11,-11,19,-11 +H40000v`+(40+t)+`H1012.3 +s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232 +c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 +s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 +c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z +M`+(1001+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},RI=function(t,n){return"M983 "+(10+t+n)+` +l`+t/3.13+" -"+t+` +c4,-6.7,10,-10,18,-10 H400000v`+(40+t)+` +H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 +s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744 +c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 +c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 +c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 +c53.7,-170.3,84.5,-266.8,92.5,-289.5z +M`+(1001+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},LI=function(t,n){return"M424,"+(2398+t+n)+` +c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 +c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 +s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 +s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081 +l`+t/4.223+" -"+t+`c4,-6.7,10,-10,18,-10 H400000 +v`+(40+t)+`H1014.6 +s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 +c-2,6,-10,9,-24,9 +c-8,0,-12,-0.7,-12,-2z M`+(1001+t)+" "+n+` +h400000v`+(40+t)+"h-400000z"},BI=function(t,n){return"M473,"+(2713+t+n)+` +c339.3,-1799.3,509.3,-2700,510,-2702 l`+t/5.298+" -"+t+` +c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+t)+`H1017.7 +s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 +c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 +c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 +s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, +606zM`+(1001+t)+" "+n+"h400000v"+(40+t)+"H1017.7z"},PI=function(t){var n=t/2;return"M400000 "+t+" H0 L"+n+" 0 l65 45 L145 "+(t-80)+" H400000z"},FI=function(t,n,a){var l=a-54-n-t;return"M702 "+(t+n)+"H400000"+(40+t)+` +H742v`+l+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 +h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 +c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 +219 661 l218 661zM702 `+n+"H400000v"+(40+t)+"H742z"},II=function(t,n,a){n=1e3*n;var l="";switch(t){case"sqrtMain":l=zI(n,wo);break;case"sqrtSize1":l=OI(n,wo);break;case"sqrtSize2":l=RI(n,wo);break;case"sqrtSize3":l=LI(n,wo);break;case"sqrtSize4":l=BI(n,wo);break;case"sqrtTall":l=FI(n,wo,a)}return l},qI=function(t,n){switch(t){case"⎜":return"M291 0 H417 V"+n+" H291z M291 0 H417 V"+n+" H291z";case"∣":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z";case"∥":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z"+("M367 0 H410 V"+n+" H367z M367 0 H410 V"+n+" H367z");case"⎟":return"M457 0 H583 V"+n+" H457z M457 0 H583 V"+n+" H457z";case"⎢":return"M319 0 H403 V"+n+" H319z M319 0 H403 V"+n+" H319z";case"⎥":return"M263 0 H347 V"+n+" H263z M263 0 H347 V"+n+" H263z";case"⎪":return"M384 0 H504 V"+n+" H384z M384 0 H504 V"+n+" H384z";case"⏐":return"M312 0 H355 V"+n+" H312z M312 0 H355 V"+n+" H312z";case"‖":return"M257 0 H300 V"+n+" H257z M257 0 H300 V"+n+" H257z"+("M478 0 H521 V"+n+" H478z M478 0 H521 V"+n+" H478z");default:return""}},E3={doubleleftarrow:`M262 157 +l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3 + 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28 + 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5 +c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5 + 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87 +-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7 +-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z +m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l +-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5 + 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88 +-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68 +-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18 +-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782 +c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3 +-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120 + 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8 +-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247 +c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208 + 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3 + 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202 + l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117 +-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7 + 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13 + 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688 + 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7 +-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80 +H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0 + 435 0h399565z`,leftgroupunder:`M400000 262 +H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219 + 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3 +-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5 +-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7 +-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5 + 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3 +-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7 +-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z +m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333 + 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5 + 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667 +-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12 + 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7 +-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0 +v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5 +-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3 +-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21 + 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z +M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z +M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23 +-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8 +c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3 + 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z +M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334 +c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14 +-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7 + 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11 + 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214 +c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14 + 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3 + 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0 +-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6 +-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z +m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8 +60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8 +-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z +m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2 +c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6 +-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z +m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0 +85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8 +-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z +m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1 +c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128 +-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 + 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 + 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85 +-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 +-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 + 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l +-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5 +s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1 +c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3 + 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237 +-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0 + 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18 + 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3 +-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2 +-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 + 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11 +-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7 + 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z +m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8 + 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5 +-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95 +-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8 + 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 + 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3 +-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z +m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3 + 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0 +-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21 + 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z +M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23 + 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32 +-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142 +-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40 + 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69 +-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3 +-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19 +-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101 + 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167 +c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3 + 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42 + 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333 +-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70 + 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7 +-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0 + 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0 + 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128 +-68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418 +-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9 + 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114 +c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751 + 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457 +-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0 + 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697 + 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696 + -338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345 +-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409 + 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9 + 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409 + -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5 +3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11 +10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63 +-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1 +-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59 +H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359 +c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22 +c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1, +-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202 +c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5 +c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130 +s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47 +121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6 +s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11 +c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z +M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32 +-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0 +13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39 +-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5 +-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 +-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 +151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 +c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17 +c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21 +c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40 +c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z +M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0 +c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, +-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 +c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z +M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 +c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9, +1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7, +-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z +M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0 +c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, +-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 +c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z +M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},HI=function(t,n){switch(t){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v1759 h347 v-84 +H403z M403 1759 V0 H319 V1759 v`+n+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v1759 H0 v84 H347z +M347 1759 V0 H263 V1759 v`+n+" v1759 h84z";case"vert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+" v585 h43z";case"doublevert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+` v585 h43z +M367 15 v585 v`+n+` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+n+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+n+` v1715 h263 v84 H319z +MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+n+` v1799 H0 v-84 H319z +MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v602 h84z +M403 1759 V0 H319 V1759 v`+n+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v602 h84z +M347 1759 V0 h-84 V1759 v`+n+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1 +c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349, +-36,557 l0,`+(n+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210, +949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9 +c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5, +-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189 +l0,-`+(n+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3, +-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3, +63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5 +c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(n+9)+` +c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664 +c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11 +c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 +c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 +l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, +-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class Wu{constructor(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){for(var t=document.createDocumentFragment(),n=0;nn.toText();return this.children.map(t).join("")}}var ts={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},E0={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},M3={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function UI(e,t){ts[e]=t}function mg(e,t,n){if(!ts[t])throw new Error("Font metrics not found for font: "+t+".");var a=e.charCodeAt(0),l=ts[t][a];if(!l&&e[0]in M3&&(a=M3[e[0]].charCodeAt(0),l=ts[t][a]),!l&&n==="text"&&h8(a)&&(l=ts[t][77]),l)return{depth:l[0],height:l[1],italic:l[2],skew:l[3],width:l[4]}}var Zp={};function $I(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!Zp[t]){var n=Zp[t]={cssEmPerMu:E0.quad[t]/18};for(var a in E0)E0.hasOwnProperty(a)&&(n[a]=E0[a][t])}return Zp[t]}var VI=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],A3=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],D3=function(t,n){return n.size<2?t:VI[t-1][n.size-1]};class Ds{constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||Ds.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.sizeMultiplier=A3[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}extend(t){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var a in t)t.hasOwnProperty(a)&&(n[a]=t[a]);return new Ds(n)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:D3(this.textSize,t)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(t){return this.size===t&&this.textSize===t?this:this.extend({style:this.style.text(),size:t,textSize:t,sizeMultiplier:A3[t-1]})}havingBaseStyle(t){t=t||this.style.text();var n=D3(Ds.BASESIZE,t);return this.size===n&&this.textSize===Ds.BASESIZE&&this.style===t?this:this.extend({style:t,size:n})}havingBaseSizing(){var t;switch(this.style.id){case 4:case 5:t=3;break;case 6:case 7:t=1;break;default:t=6}return this.extend({style:this.style.text(),size:t})}withColor(t){return this.extend({color:t})}withPhantom(){return this.extend({phantom:!0})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}sizingClasses(t){return t.size!==this.size?["sizing","reset-size"+t.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==Ds.BASESIZE?["sizing","reset-size"+this.size,"size"+Ds.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=$I(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Ds.BASESIZE=6;var Xx={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},GI={ex:!0,em:!0,mu:!0},f8=function(t){return typeof t!="string"&&(t=t.unit),t in Xx||t in GI||t==="ex"},Mn=function(t,n){var a;if(t.unit in Xx)a=Xx[t.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(t.unit==="mu")a=n.fontMetrics().cssEmPerMu;else{var l;if(n.style.isTight()?l=n.havingStyle(n.style.text()):l=n,t.unit==="ex")a=l.fontMetrics().xHeight;else if(t.unit==="em")a=l.fontMetrics().quad;else throw new Ae("Invalid unit: '"+t.unit+"'");l!==n&&(a*=l.sizeMultiplier/n.sizeMultiplier)}return Math.min(t.number*a,n.maxSize)},Le=function(t){return+t.toFixed(4)+"em"},El=function(t){return t.filter(n=>n).join(" ")},p8=function(t,n,a){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=a||{},n){n.style.isTight()&&this.classes.push("mtight");var l=n.getColor();l&&(this.style.color=l)}},x8=function(t){var n=document.createElement(t);n.className=El(this.classes);for(var a in this.style)this.style.hasOwnProperty(a)&&(n.style[a]=this.style[a]);for(var l in this.attributes)this.attributes.hasOwnProperty(l)&&n.setAttribute(l,this.attributes[l]);for(var o=0;o/=\x00-\x1f]/,g8=function(t){var n="<"+t;this.classes.length&&(n+=' class="'+Ut.escape(El(this.classes))+'"');var a="";for(var l in this.style)this.style.hasOwnProperty(l)&&(a+=Ut.hyphenate(l)+":"+this.style[l]+";");a&&(n+=' style="'+Ut.escape(a)+'"');for(var o in this.attributes)if(this.attributes.hasOwnProperty(o)){if(YI.test(o))throw new Ae("Invalid attribute name '"+o+"'");n+=" "+o+'="'+Ut.escape(this.attributes[o])+'"'}n+=">";for(var c=0;c",n};class Xu{constructor(t,n,a,l){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,p8.call(this,t,a,l),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return x8.call(this,"span")}toMarkup(){return g8.call(this,"span")}}class hg{constructor(t,n,a,l){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,p8.call(this,n,l),this.children=a||[],this.setAttribute("href",t)}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return x8.call(this,"a")}toMarkup(){return g8.call(this,"a")}}class WI{constructor(t,n,a){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=t,this.classes=["mord"],this.style=a}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createElement("img");t.src=this.src,t.alt=this.alt,t.className="mord";for(var n in this.style)this.style.hasOwnProperty(n)&&(t.style[n]=this.style[n]);return t}toMarkup(){var t=''+Ut.escape(this.alt)+'0&&(n=document.createElement("span"),n.style.marginRight=Le(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=El(this.classes));for(var a in this.style)this.style.hasOwnProperty(a)&&(n=n||document.createElement("span"),n.style[a]=this.style[a]);return n?(n.appendChild(t),n):t}toMarkup(){var t=!1,n="0&&(a+="margin-right:"+this.italic+"em;");for(var l in this.style)this.style.hasOwnProperty(l)&&(a+=Ut.hyphenate(l)+":"+this.style[l]+";");a&&(t=!0,n+=' style="'+Ut.escape(a)+'"');var o=Ut.escape(this.text);return t?(n+=">",n+=o,n+="",n):o}}class Fs{constructor(t,n){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=n||{}}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");for(var a in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,a)&&n.setAttribute(a,this.attributes[a]);for(var l=0;l':''}}class Kx{constructor(t){this.attributes=void 0,this.attributes=t||{}}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"line");for(var a in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,a)&&n.setAttribute(a,this.attributes[a]);return n}toMarkup(){var t=" but got "+String(e)+".")}var QI={bin:1,close:1,inner:1,open:1,punct:1,rel:1},ZI={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},yn={math:{},text:{}};function j(e,t,n,a,l,o){yn[e][l]={font:t,group:n,replace:a},o&&a&&(yn[e][a]=yn[e][l])}var C="math",_e="text",D="main",V="ams",kn="accent-token",Ie="bin",Mr="close",tc="inner",Je="mathord",Yn="op-token",ha="open",Ym="punct",Y="rel",$s="spacing",ae="textord";j(C,D,Y,"≡","\\equiv",!0);j(C,D,Y,"≺","\\prec",!0);j(C,D,Y,"≻","\\succ",!0);j(C,D,Y,"∼","\\sim",!0);j(C,D,Y,"⊥","\\perp");j(C,D,Y,"⪯","\\preceq",!0);j(C,D,Y,"⪰","\\succeq",!0);j(C,D,Y,"≃","\\simeq",!0);j(C,D,Y,"∣","\\mid",!0);j(C,D,Y,"≪","\\ll",!0);j(C,D,Y,"≫","\\gg",!0);j(C,D,Y,"≍","\\asymp",!0);j(C,D,Y,"∥","\\parallel");j(C,D,Y,"⋈","\\bowtie",!0);j(C,D,Y,"⌣","\\smile",!0);j(C,D,Y,"⊑","\\sqsubseteq",!0);j(C,D,Y,"⊒","\\sqsupseteq",!0);j(C,D,Y,"≐","\\doteq",!0);j(C,D,Y,"⌢","\\frown",!0);j(C,D,Y,"∋","\\ni",!0);j(C,D,Y,"∝","\\propto",!0);j(C,D,Y,"⊢","\\vdash",!0);j(C,D,Y,"⊣","\\dashv",!0);j(C,D,Y,"∋","\\owns");j(C,D,Ym,".","\\ldotp");j(C,D,Ym,"⋅","\\cdotp");j(C,D,ae,"#","\\#");j(_e,D,ae,"#","\\#");j(C,D,ae,"&","\\&");j(_e,D,ae,"&","\\&");j(C,D,ae,"ℵ","\\aleph",!0);j(C,D,ae,"∀","\\forall",!0);j(C,D,ae,"ℏ","\\hbar",!0);j(C,D,ae,"∃","\\exists",!0);j(C,D,ae,"∇","\\nabla",!0);j(C,D,ae,"♭","\\flat",!0);j(C,D,ae,"ℓ","\\ell",!0);j(C,D,ae,"♮","\\natural",!0);j(C,D,ae,"♣","\\clubsuit",!0);j(C,D,ae,"℘","\\wp",!0);j(C,D,ae,"♯","\\sharp",!0);j(C,D,ae,"♢","\\diamondsuit",!0);j(C,D,ae,"ℜ","\\Re",!0);j(C,D,ae,"♡","\\heartsuit",!0);j(C,D,ae,"ℑ","\\Im",!0);j(C,D,ae,"♠","\\spadesuit",!0);j(C,D,ae,"§","\\S",!0);j(_e,D,ae,"§","\\S");j(C,D,ae,"¶","\\P",!0);j(_e,D,ae,"¶","\\P");j(C,D,ae,"†","\\dag");j(_e,D,ae,"†","\\dag");j(_e,D,ae,"†","\\textdagger");j(C,D,ae,"‡","\\ddag");j(_e,D,ae,"‡","\\ddag");j(_e,D,ae,"‡","\\textdaggerdbl");j(C,D,Mr,"⎱","\\rmoustache",!0);j(C,D,ha,"⎰","\\lmoustache",!0);j(C,D,Mr,"⟯","\\rgroup",!0);j(C,D,ha,"⟮","\\lgroup",!0);j(C,D,Ie,"∓","\\mp",!0);j(C,D,Ie,"⊖","\\ominus",!0);j(C,D,Ie,"⊎","\\uplus",!0);j(C,D,Ie,"⊓","\\sqcap",!0);j(C,D,Ie,"∗","\\ast");j(C,D,Ie,"⊔","\\sqcup",!0);j(C,D,Ie,"◯","\\bigcirc",!0);j(C,D,Ie,"∙","\\bullet",!0);j(C,D,Ie,"‡","\\ddagger");j(C,D,Ie,"≀","\\wr",!0);j(C,D,Ie,"⨿","\\amalg");j(C,D,Ie,"&","\\And");j(C,D,Y,"⟵","\\longleftarrow",!0);j(C,D,Y,"⇐","\\Leftarrow",!0);j(C,D,Y,"⟸","\\Longleftarrow",!0);j(C,D,Y,"⟶","\\longrightarrow",!0);j(C,D,Y,"⇒","\\Rightarrow",!0);j(C,D,Y,"⟹","\\Longrightarrow",!0);j(C,D,Y,"↔","\\leftrightarrow",!0);j(C,D,Y,"⟷","\\longleftrightarrow",!0);j(C,D,Y,"⇔","\\Leftrightarrow",!0);j(C,D,Y,"⟺","\\Longleftrightarrow",!0);j(C,D,Y,"↦","\\mapsto",!0);j(C,D,Y,"⟼","\\longmapsto",!0);j(C,D,Y,"↗","\\nearrow",!0);j(C,D,Y,"↩","\\hookleftarrow",!0);j(C,D,Y,"↪","\\hookrightarrow",!0);j(C,D,Y,"↘","\\searrow",!0);j(C,D,Y,"↼","\\leftharpoonup",!0);j(C,D,Y,"⇀","\\rightharpoonup",!0);j(C,D,Y,"↙","\\swarrow",!0);j(C,D,Y,"↽","\\leftharpoondown",!0);j(C,D,Y,"⇁","\\rightharpoondown",!0);j(C,D,Y,"↖","\\nwarrow",!0);j(C,D,Y,"⇌","\\rightleftharpoons",!0);j(C,V,Y,"≮","\\nless",!0);j(C,V,Y,"","\\@nleqslant");j(C,V,Y,"","\\@nleqq");j(C,V,Y,"⪇","\\lneq",!0);j(C,V,Y,"≨","\\lneqq",!0);j(C,V,Y,"","\\@lvertneqq");j(C,V,Y,"⋦","\\lnsim",!0);j(C,V,Y,"⪉","\\lnapprox",!0);j(C,V,Y,"⊀","\\nprec",!0);j(C,V,Y,"⋠","\\npreceq",!0);j(C,V,Y,"⋨","\\precnsim",!0);j(C,V,Y,"⪹","\\precnapprox",!0);j(C,V,Y,"≁","\\nsim",!0);j(C,V,Y,"","\\@nshortmid");j(C,V,Y,"∤","\\nmid",!0);j(C,V,Y,"⊬","\\nvdash",!0);j(C,V,Y,"⊭","\\nvDash",!0);j(C,V,Y,"⋪","\\ntriangleleft");j(C,V,Y,"⋬","\\ntrianglelefteq",!0);j(C,V,Y,"⊊","\\subsetneq",!0);j(C,V,Y,"","\\@varsubsetneq");j(C,V,Y,"⫋","\\subsetneqq",!0);j(C,V,Y,"","\\@varsubsetneqq");j(C,V,Y,"≯","\\ngtr",!0);j(C,V,Y,"","\\@ngeqslant");j(C,V,Y,"","\\@ngeqq");j(C,V,Y,"⪈","\\gneq",!0);j(C,V,Y,"≩","\\gneqq",!0);j(C,V,Y,"","\\@gvertneqq");j(C,V,Y,"⋧","\\gnsim",!0);j(C,V,Y,"⪊","\\gnapprox",!0);j(C,V,Y,"⊁","\\nsucc",!0);j(C,V,Y,"⋡","\\nsucceq",!0);j(C,V,Y,"⋩","\\succnsim",!0);j(C,V,Y,"⪺","\\succnapprox",!0);j(C,V,Y,"≆","\\ncong",!0);j(C,V,Y,"","\\@nshortparallel");j(C,V,Y,"∦","\\nparallel",!0);j(C,V,Y,"⊯","\\nVDash",!0);j(C,V,Y,"⋫","\\ntriangleright");j(C,V,Y,"⋭","\\ntrianglerighteq",!0);j(C,V,Y,"","\\@nsupseteqq");j(C,V,Y,"⊋","\\supsetneq",!0);j(C,V,Y,"","\\@varsupsetneq");j(C,V,Y,"⫌","\\supsetneqq",!0);j(C,V,Y,"","\\@varsupsetneqq");j(C,V,Y,"⊮","\\nVdash",!0);j(C,V,Y,"⪵","\\precneqq",!0);j(C,V,Y,"⪶","\\succneqq",!0);j(C,V,Y,"","\\@nsubseteqq");j(C,V,Ie,"⊴","\\unlhd");j(C,V,Ie,"⊵","\\unrhd");j(C,V,Y,"↚","\\nleftarrow",!0);j(C,V,Y,"↛","\\nrightarrow",!0);j(C,V,Y,"⇍","\\nLeftarrow",!0);j(C,V,Y,"⇏","\\nRightarrow",!0);j(C,V,Y,"↮","\\nleftrightarrow",!0);j(C,V,Y,"⇎","\\nLeftrightarrow",!0);j(C,V,Y,"△","\\vartriangle");j(C,V,ae,"ℏ","\\hslash");j(C,V,ae,"▽","\\triangledown");j(C,V,ae,"◊","\\lozenge");j(C,V,ae,"Ⓢ","\\circledS");j(C,V,ae,"®","\\circledR");j(_e,V,ae,"®","\\circledR");j(C,V,ae,"∡","\\measuredangle",!0);j(C,V,ae,"∄","\\nexists");j(C,V,ae,"℧","\\mho");j(C,V,ae,"Ⅎ","\\Finv",!0);j(C,V,ae,"⅁","\\Game",!0);j(C,V,ae,"‵","\\backprime");j(C,V,ae,"▲","\\blacktriangle");j(C,V,ae,"▼","\\blacktriangledown");j(C,V,ae,"■","\\blacksquare");j(C,V,ae,"⧫","\\blacklozenge");j(C,V,ae,"★","\\bigstar");j(C,V,ae,"∢","\\sphericalangle",!0);j(C,V,ae,"∁","\\complement",!0);j(C,V,ae,"ð","\\eth",!0);j(_e,D,ae,"ð","ð");j(C,V,ae,"╱","\\diagup");j(C,V,ae,"╲","\\diagdown");j(C,V,ae,"□","\\square");j(C,V,ae,"□","\\Box");j(C,V,ae,"◊","\\Diamond");j(C,V,ae,"¥","\\yen",!0);j(_e,V,ae,"¥","\\yen",!0);j(C,V,ae,"✓","\\checkmark",!0);j(_e,V,ae,"✓","\\checkmark");j(C,V,ae,"ℶ","\\beth",!0);j(C,V,ae,"ℸ","\\daleth",!0);j(C,V,ae,"ℷ","\\gimel",!0);j(C,V,ae,"ϝ","\\digamma",!0);j(C,V,ae,"ϰ","\\varkappa");j(C,V,ha,"┌","\\@ulcorner",!0);j(C,V,Mr,"┐","\\@urcorner",!0);j(C,V,ha,"└","\\@llcorner",!0);j(C,V,Mr,"┘","\\@lrcorner",!0);j(C,V,Y,"≦","\\leqq",!0);j(C,V,Y,"⩽","\\leqslant",!0);j(C,V,Y,"⪕","\\eqslantless",!0);j(C,V,Y,"≲","\\lesssim",!0);j(C,V,Y,"⪅","\\lessapprox",!0);j(C,V,Y,"≊","\\approxeq",!0);j(C,V,Ie,"⋖","\\lessdot");j(C,V,Y,"⋘","\\lll",!0);j(C,V,Y,"≶","\\lessgtr",!0);j(C,V,Y,"⋚","\\lesseqgtr",!0);j(C,V,Y,"⪋","\\lesseqqgtr",!0);j(C,V,Y,"≑","\\doteqdot");j(C,V,Y,"≓","\\risingdotseq",!0);j(C,V,Y,"≒","\\fallingdotseq",!0);j(C,V,Y,"∽","\\backsim",!0);j(C,V,Y,"⋍","\\backsimeq",!0);j(C,V,Y,"⫅","\\subseteqq",!0);j(C,V,Y,"⋐","\\Subset",!0);j(C,V,Y,"⊏","\\sqsubset",!0);j(C,V,Y,"≼","\\preccurlyeq",!0);j(C,V,Y,"⋞","\\curlyeqprec",!0);j(C,V,Y,"≾","\\precsim",!0);j(C,V,Y,"⪷","\\precapprox",!0);j(C,V,Y,"⊲","\\vartriangleleft");j(C,V,Y,"⊴","\\trianglelefteq");j(C,V,Y,"⊨","\\vDash",!0);j(C,V,Y,"⊪","\\Vvdash",!0);j(C,V,Y,"⌣","\\smallsmile");j(C,V,Y,"⌢","\\smallfrown");j(C,V,Y,"≏","\\bumpeq",!0);j(C,V,Y,"≎","\\Bumpeq",!0);j(C,V,Y,"≧","\\geqq",!0);j(C,V,Y,"⩾","\\geqslant",!0);j(C,V,Y,"⪖","\\eqslantgtr",!0);j(C,V,Y,"≳","\\gtrsim",!0);j(C,V,Y,"⪆","\\gtrapprox",!0);j(C,V,Ie,"⋗","\\gtrdot");j(C,V,Y,"⋙","\\ggg",!0);j(C,V,Y,"≷","\\gtrless",!0);j(C,V,Y,"⋛","\\gtreqless",!0);j(C,V,Y,"⪌","\\gtreqqless",!0);j(C,V,Y,"≖","\\eqcirc",!0);j(C,V,Y,"≗","\\circeq",!0);j(C,V,Y,"≜","\\triangleq",!0);j(C,V,Y,"∼","\\thicksim");j(C,V,Y,"≈","\\thickapprox");j(C,V,Y,"⫆","\\supseteqq",!0);j(C,V,Y,"⋑","\\Supset",!0);j(C,V,Y,"⊐","\\sqsupset",!0);j(C,V,Y,"≽","\\succcurlyeq",!0);j(C,V,Y,"⋟","\\curlyeqsucc",!0);j(C,V,Y,"≿","\\succsim",!0);j(C,V,Y,"⪸","\\succapprox",!0);j(C,V,Y,"⊳","\\vartriangleright");j(C,V,Y,"⊵","\\trianglerighteq");j(C,V,Y,"⊩","\\Vdash",!0);j(C,V,Y,"∣","\\shortmid");j(C,V,Y,"∥","\\shortparallel");j(C,V,Y,"≬","\\between",!0);j(C,V,Y,"⋔","\\pitchfork",!0);j(C,V,Y,"∝","\\varpropto");j(C,V,Y,"◀","\\blacktriangleleft");j(C,V,Y,"∴","\\therefore",!0);j(C,V,Y,"∍","\\backepsilon");j(C,V,Y,"▶","\\blacktriangleright");j(C,V,Y,"∵","\\because",!0);j(C,V,Y,"⋘","\\llless");j(C,V,Y,"⋙","\\gggtr");j(C,V,Ie,"⊲","\\lhd");j(C,V,Ie,"⊳","\\rhd");j(C,V,Y,"≂","\\eqsim",!0);j(C,D,Y,"⋈","\\Join");j(C,V,Y,"≑","\\Doteq",!0);j(C,V,Ie,"∔","\\dotplus",!0);j(C,V,Ie,"∖","\\smallsetminus");j(C,V,Ie,"⋒","\\Cap",!0);j(C,V,Ie,"⋓","\\Cup",!0);j(C,V,Ie,"⩞","\\doublebarwedge",!0);j(C,V,Ie,"⊟","\\boxminus",!0);j(C,V,Ie,"⊞","\\boxplus",!0);j(C,V,Ie,"⋇","\\divideontimes",!0);j(C,V,Ie,"⋉","\\ltimes",!0);j(C,V,Ie,"⋊","\\rtimes",!0);j(C,V,Ie,"⋋","\\leftthreetimes",!0);j(C,V,Ie,"⋌","\\rightthreetimes",!0);j(C,V,Ie,"⋏","\\curlywedge",!0);j(C,V,Ie,"⋎","\\curlyvee",!0);j(C,V,Ie,"⊝","\\circleddash",!0);j(C,V,Ie,"⊛","\\circledast",!0);j(C,V,Ie,"⋅","\\centerdot");j(C,V,Ie,"⊺","\\intercal",!0);j(C,V,Ie,"⋒","\\doublecap");j(C,V,Ie,"⋓","\\doublecup");j(C,V,Ie,"⊠","\\boxtimes",!0);j(C,V,Y,"⇢","\\dashrightarrow",!0);j(C,V,Y,"⇠","\\dashleftarrow",!0);j(C,V,Y,"⇇","\\leftleftarrows",!0);j(C,V,Y,"⇆","\\leftrightarrows",!0);j(C,V,Y,"⇚","\\Lleftarrow",!0);j(C,V,Y,"↞","\\twoheadleftarrow",!0);j(C,V,Y,"↢","\\leftarrowtail",!0);j(C,V,Y,"↫","\\looparrowleft",!0);j(C,V,Y,"⇋","\\leftrightharpoons",!0);j(C,V,Y,"↶","\\curvearrowleft",!0);j(C,V,Y,"↺","\\circlearrowleft",!0);j(C,V,Y,"↰","\\Lsh",!0);j(C,V,Y,"⇈","\\upuparrows",!0);j(C,V,Y,"↿","\\upharpoonleft",!0);j(C,V,Y,"⇃","\\downharpoonleft",!0);j(C,D,Y,"⊶","\\origof",!0);j(C,D,Y,"⊷","\\imageof",!0);j(C,V,Y,"⊸","\\multimap",!0);j(C,V,Y,"↭","\\leftrightsquigarrow",!0);j(C,V,Y,"⇉","\\rightrightarrows",!0);j(C,V,Y,"⇄","\\rightleftarrows",!0);j(C,V,Y,"↠","\\twoheadrightarrow",!0);j(C,V,Y,"↣","\\rightarrowtail",!0);j(C,V,Y,"↬","\\looparrowright",!0);j(C,V,Y,"↷","\\curvearrowright",!0);j(C,V,Y,"↻","\\circlearrowright",!0);j(C,V,Y,"↱","\\Rsh",!0);j(C,V,Y,"⇊","\\downdownarrows",!0);j(C,V,Y,"↾","\\upharpoonright",!0);j(C,V,Y,"⇂","\\downharpoonright",!0);j(C,V,Y,"⇝","\\rightsquigarrow",!0);j(C,V,Y,"⇝","\\leadsto");j(C,V,Y,"⇛","\\Rrightarrow",!0);j(C,V,Y,"↾","\\restriction");j(C,D,ae,"‘","`");j(C,D,ae,"$","\\$");j(_e,D,ae,"$","\\$");j(_e,D,ae,"$","\\textdollar");j(C,D,ae,"%","\\%");j(_e,D,ae,"%","\\%");j(C,D,ae,"_","\\_");j(_e,D,ae,"_","\\_");j(_e,D,ae,"_","\\textunderscore");j(C,D,ae,"∠","\\angle",!0);j(C,D,ae,"∞","\\infty",!0);j(C,D,ae,"′","\\prime");j(C,D,ae,"△","\\triangle");j(C,D,ae,"Γ","\\Gamma",!0);j(C,D,ae,"Δ","\\Delta",!0);j(C,D,ae,"Θ","\\Theta",!0);j(C,D,ae,"Λ","\\Lambda",!0);j(C,D,ae,"Ξ","\\Xi",!0);j(C,D,ae,"Π","\\Pi",!0);j(C,D,ae,"Σ","\\Sigma",!0);j(C,D,ae,"Υ","\\Upsilon",!0);j(C,D,ae,"Φ","\\Phi",!0);j(C,D,ae,"Ψ","\\Psi",!0);j(C,D,ae,"Ω","\\Omega",!0);j(C,D,ae,"A","Α");j(C,D,ae,"B","Β");j(C,D,ae,"E","Ε");j(C,D,ae,"Z","Ζ");j(C,D,ae,"H","Η");j(C,D,ae,"I","Ι");j(C,D,ae,"K","Κ");j(C,D,ae,"M","Μ");j(C,D,ae,"N","Ν");j(C,D,ae,"O","Ο");j(C,D,ae,"P","Ρ");j(C,D,ae,"T","Τ");j(C,D,ae,"X","Χ");j(C,D,ae,"¬","\\neg",!0);j(C,D,ae,"¬","\\lnot");j(C,D,ae,"⊤","\\top");j(C,D,ae,"⊥","\\bot");j(C,D,ae,"∅","\\emptyset");j(C,V,ae,"∅","\\varnothing");j(C,D,Je,"α","\\alpha",!0);j(C,D,Je,"β","\\beta",!0);j(C,D,Je,"γ","\\gamma",!0);j(C,D,Je,"δ","\\delta",!0);j(C,D,Je,"ϵ","\\epsilon",!0);j(C,D,Je,"ζ","\\zeta",!0);j(C,D,Je,"η","\\eta",!0);j(C,D,Je,"θ","\\theta",!0);j(C,D,Je,"ι","\\iota",!0);j(C,D,Je,"κ","\\kappa",!0);j(C,D,Je,"λ","\\lambda",!0);j(C,D,Je,"μ","\\mu",!0);j(C,D,Je,"ν","\\nu",!0);j(C,D,Je,"ξ","\\xi",!0);j(C,D,Je,"ο","\\omicron",!0);j(C,D,Je,"π","\\pi",!0);j(C,D,Je,"ρ","\\rho",!0);j(C,D,Je,"σ","\\sigma",!0);j(C,D,Je,"τ","\\tau",!0);j(C,D,Je,"υ","\\upsilon",!0);j(C,D,Je,"ϕ","\\phi",!0);j(C,D,Je,"χ","\\chi",!0);j(C,D,Je,"ψ","\\psi",!0);j(C,D,Je,"ω","\\omega",!0);j(C,D,Je,"ε","\\varepsilon",!0);j(C,D,Je,"ϑ","\\vartheta",!0);j(C,D,Je,"ϖ","\\varpi",!0);j(C,D,Je,"ϱ","\\varrho",!0);j(C,D,Je,"ς","\\varsigma",!0);j(C,D,Je,"φ","\\varphi",!0);j(C,D,Ie,"∗","*",!0);j(C,D,Ie,"+","+");j(C,D,Ie,"−","-",!0);j(C,D,Ie,"⋅","\\cdot",!0);j(C,D,Ie,"∘","\\circ",!0);j(C,D,Ie,"÷","\\div",!0);j(C,D,Ie,"±","\\pm",!0);j(C,D,Ie,"×","\\times",!0);j(C,D,Ie,"∩","\\cap",!0);j(C,D,Ie,"∪","\\cup",!0);j(C,D,Ie,"∖","\\setminus",!0);j(C,D,Ie,"∧","\\land");j(C,D,Ie,"∨","\\lor");j(C,D,Ie,"∧","\\wedge",!0);j(C,D,Ie,"∨","\\vee",!0);j(C,D,ae,"√","\\surd");j(C,D,ha,"⟨","\\langle",!0);j(C,D,ha,"∣","\\lvert");j(C,D,ha,"∥","\\lVert");j(C,D,Mr,"?","?");j(C,D,Mr,"!","!");j(C,D,Mr,"⟩","\\rangle",!0);j(C,D,Mr,"∣","\\rvert");j(C,D,Mr,"∥","\\rVert");j(C,D,Y,"=","=");j(C,D,Y,":",":");j(C,D,Y,"≈","\\approx",!0);j(C,D,Y,"≅","\\cong",!0);j(C,D,Y,"≥","\\ge");j(C,D,Y,"≥","\\geq",!0);j(C,D,Y,"←","\\gets");j(C,D,Y,">","\\gt",!0);j(C,D,Y,"∈","\\in",!0);j(C,D,Y,"","\\@not");j(C,D,Y,"⊂","\\subset",!0);j(C,D,Y,"⊃","\\supset",!0);j(C,D,Y,"⊆","\\subseteq",!0);j(C,D,Y,"⊇","\\supseteq",!0);j(C,V,Y,"⊈","\\nsubseteq",!0);j(C,V,Y,"⊉","\\nsupseteq",!0);j(C,D,Y,"⊨","\\models");j(C,D,Y,"←","\\leftarrow",!0);j(C,D,Y,"≤","\\le");j(C,D,Y,"≤","\\leq",!0);j(C,D,Y,"<","\\lt",!0);j(C,D,Y,"→","\\rightarrow",!0);j(C,D,Y,"→","\\to");j(C,V,Y,"≱","\\ngeq",!0);j(C,V,Y,"≰","\\nleq",!0);j(C,D,$s," ","\\ ");j(C,D,$s," ","\\space");j(C,D,$s," ","\\nobreakspace");j(_e,D,$s," ","\\ ");j(_e,D,$s," "," ");j(_e,D,$s," ","\\space");j(_e,D,$s," ","\\nobreakspace");j(C,D,$s,null,"\\nobreak");j(C,D,$s,null,"\\allowbreak");j(C,D,Ym,",",",");j(C,D,Ym,";",";");j(C,V,Ie,"⊼","\\barwedge",!0);j(C,V,Ie,"⊻","\\veebar",!0);j(C,D,Ie,"⊙","\\odot",!0);j(C,D,Ie,"⊕","\\oplus",!0);j(C,D,Ie,"⊗","\\otimes",!0);j(C,D,ae,"∂","\\partial",!0);j(C,D,Ie,"⊘","\\oslash",!0);j(C,V,Ie,"⊚","\\circledcirc",!0);j(C,V,Ie,"⊡","\\boxdot",!0);j(C,D,Ie,"△","\\bigtriangleup");j(C,D,Ie,"▽","\\bigtriangledown");j(C,D,Ie,"†","\\dagger");j(C,D,Ie,"⋄","\\diamond");j(C,D,Ie,"⋆","\\star");j(C,D,Ie,"◃","\\triangleleft");j(C,D,Ie,"▹","\\triangleright");j(C,D,ha,"{","\\{");j(_e,D,ae,"{","\\{");j(_e,D,ae,"{","\\textbraceleft");j(C,D,Mr,"}","\\}");j(_e,D,ae,"}","\\}");j(_e,D,ae,"}","\\textbraceright");j(C,D,ha,"{","\\lbrace");j(C,D,Mr,"}","\\rbrace");j(C,D,ha,"[","\\lbrack",!0);j(_e,D,ae,"[","\\lbrack",!0);j(C,D,Mr,"]","\\rbrack",!0);j(_e,D,ae,"]","\\rbrack",!0);j(C,D,ha,"(","\\lparen",!0);j(C,D,Mr,")","\\rparen",!0);j(_e,D,ae,"<","\\textless",!0);j(_e,D,ae,">","\\textgreater",!0);j(C,D,ha,"⌊","\\lfloor",!0);j(C,D,Mr,"⌋","\\rfloor",!0);j(C,D,ha,"⌈","\\lceil",!0);j(C,D,Mr,"⌉","\\rceil",!0);j(C,D,ae,"\\","\\backslash");j(C,D,ae,"∣","|");j(C,D,ae,"∣","\\vert");j(_e,D,ae,"|","\\textbar",!0);j(C,D,ae,"∥","\\|");j(C,D,ae,"∥","\\Vert");j(_e,D,ae,"∥","\\textbardbl");j(_e,D,ae,"~","\\textasciitilde");j(_e,D,ae,"\\","\\textbackslash");j(_e,D,ae,"^","\\textasciicircum");j(C,D,Y,"↑","\\uparrow",!0);j(C,D,Y,"⇑","\\Uparrow",!0);j(C,D,Y,"↓","\\downarrow",!0);j(C,D,Y,"⇓","\\Downarrow",!0);j(C,D,Y,"↕","\\updownarrow",!0);j(C,D,Y,"⇕","\\Updownarrow",!0);j(C,D,Yn,"∐","\\coprod");j(C,D,Yn,"⋁","\\bigvee");j(C,D,Yn,"⋀","\\bigwedge");j(C,D,Yn,"⨄","\\biguplus");j(C,D,Yn,"⋂","\\bigcap");j(C,D,Yn,"⋃","\\bigcup");j(C,D,Yn,"∫","\\int");j(C,D,Yn,"∫","\\intop");j(C,D,Yn,"∬","\\iint");j(C,D,Yn,"∭","\\iiint");j(C,D,Yn,"∏","\\prod");j(C,D,Yn,"∑","\\sum");j(C,D,Yn,"⨂","\\bigotimes");j(C,D,Yn,"⨁","\\bigoplus");j(C,D,Yn,"⨀","\\bigodot");j(C,D,Yn,"∮","\\oint");j(C,D,Yn,"∯","\\oiint");j(C,D,Yn,"∰","\\oiiint");j(C,D,Yn,"⨆","\\bigsqcup");j(C,D,Yn,"∫","\\smallint");j(_e,D,tc,"…","\\textellipsis");j(C,D,tc,"…","\\mathellipsis");j(_e,D,tc,"…","\\ldots",!0);j(C,D,tc,"…","\\ldots",!0);j(C,D,tc,"⋯","\\@cdots",!0);j(C,D,tc,"⋱","\\ddots",!0);j(C,D,ae,"⋮","\\varvdots");j(_e,D,ae,"⋮","\\varvdots");j(C,D,kn,"ˊ","\\acute");j(C,D,kn,"ˋ","\\grave");j(C,D,kn,"¨","\\ddot");j(C,D,kn,"~","\\tilde");j(C,D,kn,"ˉ","\\bar");j(C,D,kn,"˘","\\breve");j(C,D,kn,"ˇ","\\check");j(C,D,kn,"^","\\hat");j(C,D,kn,"⃗","\\vec");j(C,D,kn,"˙","\\dot");j(C,D,kn,"˚","\\mathring");j(C,D,Je,"","\\@imath");j(C,D,Je,"","\\@jmath");j(C,D,ae,"ı","ı");j(C,D,ae,"ȷ","ȷ");j(_e,D,ae,"ı","\\i",!0);j(_e,D,ae,"ȷ","\\j",!0);j(_e,D,ae,"ß","\\ss",!0);j(_e,D,ae,"æ","\\ae",!0);j(_e,D,ae,"œ","\\oe",!0);j(_e,D,ae,"ø","\\o",!0);j(_e,D,ae,"Æ","\\AE",!0);j(_e,D,ae,"Œ","\\OE",!0);j(_e,D,ae,"Ø","\\O",!0);j(_e,D,kn,"ˊ","\\'");j(_e,D,kn,"ˋ","\\`");j(_e,D,kn,"ˆ","\\^");j(_e,D,kn,"˜","\\~");j(_e,D,kn,"ˉ","\\=");j(_e,D,kn,"˘","\\u");j(_e,D,kn,"˙","\\.");j(_e,D,kn,"¸","\\c");j(_e,D,kn,"˚","\\r");j(_e,D,kn,"ˇ","\\v");j(_e,D,kn,"¨",'\\"');j(_e,D,kn,"˝","\\H");j(_e,D,kn,"◯","\\textcircled");var v8={"--":!0,"---":!0,"``":!0,"''":!0};j(_e,D,ae,"–","--",!0);j(_e,D,ae,"–","\\textendash");j(_e,D,ae,"—","---",!0);j(_e,D,ae,"—","\\textemdash");j(_e,D,ae,"‘","`",!0);j(_e,D,ae,"‘","\\textquoteleft");j(_e,D,ae,"’","'",!0);j(_e,D,ae,"’","\\textquoteright");j(_e,D,ae,"“","``",!0);j(_e,D,ae,"“","\\textquotedblleft");j(_e,D,ae,"”","''",!0);j(_e,D,ae,"”","\\textquotedblright");j(C,D,ae,"°","\\degree",!0);j(_e,D,ae,"°","\\degree");j(_e,D,ae,"°","\\textdegree",!0);j(C,D,ae,"£","\\pounds");j(C,D,ae,"£","\\mathsterling",!0);j(_e,D,ae,"£","\\pounds");j(_e,D,ae,"£","\\textsterling",!0);j(C,V,ae,"✠","\\maltese");j(_e,V,ae,"✠","\\maltese");var O3='0123456789/@."';for(var Jp=0;Jp0)return Ba(o,f,l,n,c.concat(p));if(m){var x,y;if(m==="boldsymbol"){var b=tq(o,l,n,c,a);x=b.fontName,y=[b.fontClass]}else d?(x=w8[m].fontName,y=[m]):(x=z0(m,n.fontWeight,n.fontShape),y=[m,n.fontWeight,n.fontShape]);if(Wm(o,x,l).metrics)return Ba(o,x,l,n,c.concat(y));if(v8.hasOwnProperty(o)&&x.slice(0,10)==="Typewriter"){for(var N=[],k=0;k{if(El(e.classes)!==El(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize)return!1;if(e.classes.length===1){var n=e.classes[0];if(n==="mbin"||n==="mord")return!1}for(var a in e.style)if(e.style.hasOwnProperty(a)&&e.style[a]!==t.style[a])return!1;for(var l in t.style)if(t.style.hasOwnProperty(l)&&e.style[l]!==t.style[l])return!1;return!0},aq=e=>{for(var t=0;tn&&(n=c.height),c.depth>a&&(a=c.depth),c.maxFontSize>l&&(l=c.maxFontSize)}t.height=n,t.depth=a,t.maxFontSize=l},Hr=function(t,n,a,l){var o=new Xu(t,n,a,l);return fg(o),o},y8=(e,t,n,a)=>new Xu(e,t,n,a),sq=function(t,n,a){var l=Hr([t],[],n);return l.height=Math.max(a||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),l.style.borderBottomWidth=Le(l.height),l.maxFontSize=1,l},lq=function(t,n,a,l){var o=new hg(t,n,a,l);return fg(o),o},b8=function(t){var n=new Wu(t);return fg(n),n},iq=function(t,n){return t instanceof Wu?Hr([],[t],n):t},oq=function(t){if(t.positionType==="individualShift"){for(var n=t.children,a=[n[0]],l=-n[0].shift-n[0].elem.depth,o=l,c=1;c{var n=Hr(["mspace"],[],t),a=Mn(e,t);return n.style.marginRight=Le(a),n},z0=function(t,n,a){var l="";switch(t){case"amsrm":l="AMS";break;case"textrm":l="Main";break;case"textsf":l="SansSerif";break;case"texttt":l="Typewriter";break;default:l=t}var o;return n==="textbf"&&a==="textit"?o="BoldItalic":n==="textbf"?o="Bold":n==="textit"?o="Italic":o="Regular",l+"-"+o},w8={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},j8={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},dq=function(t,n){var[a,l,o]=j8[t],c=new Ml(a),d=new Fs([c],{width:Le(l),height:Le(o),style:"width:"+Le(l),viewBox:"0 0 "+1e3*l+" "+1e3*o,preserveAspectRatio:"xMinYMin"}),m=y8(["overlay"],[d],n);return m.height=o,m.style.height=Le(o),m.style.width=Le(l),m},de={fontMap:w8,makeSymbol:Ba,mathsym:eq,makeSpan:Hr,makeSvgSpan:y8,makeLineSpan:sq,makeAnchor:lq,makeFragment:b8,wrapFragment:iq,makeVList:cq,makeOrd:nq,makeGlue:uq,staticSvg:dq,svgData:j8,tryCombineChars:aq},_n={number:3,unit:"mu"},ii={number:4,unit:"mu"},Ms={number:5,unit:"mu"},mq={mord:{mop:_n,mbin:ii,mrel:Ms,minner:_n},mop:{mord:_n,mop:_n,mrel:Ms,minner:_n},mbin:{mord:ii,mop:ii,mopen:ii,minner:ii},mrel:{mord:Ms,mop:Ms,mopen:Ms,minner:Ms},mopen:{},mclose:{mop:_n,mbin:ii,mrel:Ms,minner:_n},mpunct:{mord:_n,mop:_n,mrel:Ms,mopen:_n,mclose:_n,mpunct:_n,minner:_n},minner:{mord:_n,mop:_n,mbin:ii,mrel:Ms,mopen:_n,mpunct:_n,minner:_n}},hq={mord:{mop:_n},mop:{mord:_n,mop:_n},mbin:{},mrel:{},mopen:{},mclose:{mop:_n},mpunct:{},minner:{mop:_n}},N8={},pm={},xm={};function Be(e){for(var{type:t,names:n,props:a,handler:l,htmlBuilder:o,mathmlBuilder:c}=e,d={type:t,numArgs:a.numArgs,argTypes:a.argTypes,allowedInArgument:!!a.allowedInArgument,allowedInText:!!a.allowedInText,allowedInMath:a.allowedInMath===void 0?!0:a.allowedInMath,numOptionalArgs:a.numOptionalArgs||0,infix:!!a.infix,primitive:!!a.primitive,handler:l},m=0;m{var S=k.classes[0],T=N.classes[0];S==="mbin"&&pq.includes(T)?k.classes[0]="mord":T==="mbin"&&fq.includes(S)&&(N.classes[0]="mord")},{node:x},y,b),F3(o,(N,k)=>{var S=Zx(k),T=Zx(N),M=S&&T?N.hasClass("mtight")?hq[S][T]:mq[S][T]:null;if(M)return de.makeGlue(M,f)},{node:x},y,b),o},F3=function e(t,n,a,l,o){l&&t.push(l);for(var c=0;cy=>{t.splice(x+1,0,y),c++})(c)}l&&t.pop()},S8=function(t){return t instanceof Wu||t instanceof hg||t instanceof Xu&&t.hasClass("enclosing")?t:null},vq=function e(t,n){var a=S8(t);if(a){var l=a.children;if(l.length){if(n==="right")return e(l[l.length-1],"right");if(n==="left")return e(l[0],"left")}}return t},Zx=function(t,n){return t?(n&&(t=vq(t,n)),gq[t.classes[0]]||null):null},Nu=function(t,n){var a=["nulldelimiter"].concat(t.baseSizingClasses());return Is(n.concat(a))},Ft=function(t,n,a){if(!t)return Is();if(pm[t.type]){var l=pm[t.type](t,n);if(a&&n.size!==a.size){l=Is(n.sizingClasses(a),[l],n);var o=n.sizeMultiplier/a.sizeMultiplier;l.height*=o,l.depth*=o}return l}else throw new Ae("Got group of unknown type: '"+t.type+"'")};function O0(e,t){var n=Is(["base"],e,t),a=Is(["strut"]);return a.style.height=Le(n.height+n.depth),n.depth&&(a.style.verticalAlign=Le(-n.depth)),n.children.unshift(a),n}function Jx(e,t){var n=null;e.length===1&&e[0].type==="tag"&&(n=e[0].tag,e=e[0].body);var a=nr(e,t,"root"),l;a.length===2&&a[1].hasClass("tag")&&(l=a.pop());for(var o=[],c=[],d=0;d0&&(o.push(O0(c,t)),c=[]),o.push(a[d]));c.length>0&&o.push(O0(c,t));var f;n?(f=O0(nr(n,t,!0)),f.classes=["tag"],o.push(f)):l&&o.push(l);var p=Is(["katex-html"],o);if(p.setAttribute("aria-hidden","true"),f){var x=f.children[0];x.style.height=Le(p.height+p.depth),p.depth&&(x.style.verticalAlign=Le(-p.depth))}return p}function k8(e){return new Wu(e)}class ca{constructor(t,n,a){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=t,this.attributes={},this.children=n||[],this.classes=a||[]}setAttribute(t,n){this.attributes[t]=n}getAttribute(t){return this.attributes[t]}toNode(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);this.classes.length>0&&(t.className=El(this.classes));for(var a=0;a0&&(t+=' class ="'+Ut.escape(El(this.classes))+'"'),t+=">";for(var a=0;a",t}toText(){return this.children.map(t=>t.toText()).join("")}}class ns{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return Ut.escape(this.toText())}toText(){return this.text}}class yq{constructor(t){this.width=void 0,this.character=void 0,this.width=t,t>=.05555&&t<=.05556?this.character=" ":t>=.1666&&t<=.1667?this.character=" ":t>=.2222&&t<=.2223?this.character=" ":t>=.2777&&t<=.2778?this.character="  ":t>=-.05556&&t<=-.05555?this.character=" ⁣":t>=-.1667&&t<=-.1666?this.character=" ⁣":t>=-.2223&&t<=-.2222?this.character=" ⁣":t>=-.2778&&t<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",Le(this.width)),t}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var Me={MathNode:ca,TextNode:ns,SpaceNode:yq,newDocumentFragment:k8},Ma=function(t,n,a){return yn[n][t]&&yn[n][t].replace&&t.charCodeAt(0)!==55349&&!(v8.hasOwnProperty(t)&&a&&(a.fontFamily&&a.fontFamily.slice(4,6)==="tt"||a.font&&a.font.slice(4,6)==="tt"))&&(t=yn[n][t].replace),new Me.TextNode(t)},pg=function(t){return t.length===1?t[0]:new Me.MathNode("mrow",t)},xg=function(t,n){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold";var a=n.font;if(!a||a==="mathnormal")return null;var l=t.mode;if(a==="mathit")return"italic";if(a==="boldsymbol")return t.type==="textord"?"bold":"bold-italic";if(a==="mathbf")return"bold";if(a==="mathbb")return"double-struck";if(a==="mathsfit")return"sans-serif-italic";if(a==="mathfrak")return"fraktur";if(a==="mathscr"||a==="mathcal")return"script";if(a==="mathsf")return"sans-serif";if(a==="mathtt")return"monospace";var o=t.text;if(["\\imath","\\jmath"].includes(o))return null;yn[l][o]&&yn[l][o].replace&&(o=yn[l][o].replace);var c=de.fontMap[a].fontName;return mg(o,c,l)?de.fontMap[a].variant:null};function rx(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof ns&&t.text==="."}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){var n=e.children[0];return n instanceof ns&&n.text===","}else return!1}var Qr=function(t,n,a){if(t.length===1){var l=xn(t[0],n);return a&&l instanceof ca&&l.type==="mo"&&(l.setAttribute("lspace","0em"),l.setAttribute("rspace","0em")),[l]}for(var o=[],c,d=0;d=1&&(c.type==="mn"||rx(c))){var f=m.children[0];f instanceof ca&&f.type==="mn"&&(f.children=[...c.children,...f.children],o.pop())}else if(c.type==="mi"&&c.children.length===1){var p=c.children[0];if(p instanceof ns&&p.text==="̸"&&(m.type==="mo"||m.type==="mi"||m.type==="mn")){var x=m.children[0];x instanceof ns&&x.text.length>0&&(x.text=x.text.slice(0,1)+"̸"+x.text.slice(1),o.pop())}}}o.push(m),c=m}return o},Al=function(t,n,a){return pg(Qr(t,n,a))},xn=function(t,n){if(!t)return new Me.MathNode("mrow");if(xm[t.type]){var a=xm[t.type](t,n);return a}else throw new Ae("Got group of unknown type: '"+t.type+"'")};function I3(e,t,n,a,l){var o=Qr(e,n),c;o.length===1&&o[0]instanceof ca&&["mrow","mtable"].includes(o[0].type)?c=o[0]:c=new Me.MathNode("mrow",o);var d=new Me.MathNode("annotation",[new Me.TextNode(t)]);d.setAttribute("encoding","application/x-tex");var m=new Me.MathNode("semantics",[c,d]),f=new Me.MathNode("math",[m]);f.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),a&&f.setAttribute("display","block");var p=l?"katex":"katex-mathml";return de.makeSpan([p],[f])}var C8=function(t){return new Ds({style:t.displayMode?tt.DISPLAY:tt.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},T8=function(t,n){if(n.displayMode){var a=["katex-display"];n.leqno&&a.push("leqno"),n.fleqn&&a.push("fleqn"),t=de.makeSpan(a,[t])}return t},bq=function(t,n,a){var l=C8(a),o;if(a.output==="mathml")return I3(t,n,l,a.displayMode,!0);if(a.output==="html"){var c=Jx(t,l);o=de.makeSpan(["katex"],[c])}else{var d=I3(t,n,l,a.displayMode,!1),m=Jx(t,l);o=de.makeSpan(["katex"],[d,m])}return T8(o,a)},wq=function(t,n,a){var l=C8(a),o=Jx(t,l),c=de.makeSpan(["katex"],[o]);return T8(c,a)},jq={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Nq=function(t){var n=new Me.MathNode("mo",[new Me.TextNode(jq[t.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},Sq={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},kq=function(t){return t.type==="ordgroup"?t.body.length:1},Cq=function(t,n){function a(){var d=4e5,m=t.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(m)){var f=t,p=kq(f.base),x,y,b;if(p>5)m==="widehat"||m==="widecheck"?(x=420,d=2364,b=.42,y=m+"4"):(x=312,d=2340,b=.34,y="tilde4");else{var N=[1,1,2,2,3,3][p];m==="widehat"||m==="widecheck"?(d=[0,1062,2364,2364,2364][N],x=[0,239,300,360,420][N],b=[0,.24,.3,.3,.36,.42][N],y=m+N):(d=[0,600,1033,2339,2340][N],x=[0,260,286,306,312][N],b=[0,.26,.286,.3,.306,.34][N],y="tilde"+N)}var k=new Ml(y),S=new Fs([k],{width:"100%",height:Le(b),viewBox:"0 0 "+d+" "+x,preserveAspectRatio:"none"});return{span:de.makeSvgSpan([],[S],n),minWidth:0,height:b}}else{var T=[],M=Sq[m],[A,R,B]=M,O=B/1e3,L=A.length,$,U;if(L===1){var I=M[3];$=["hide-tail"],U=[I]}else if(L===2)$=["halfarrow-left","halfarrow-right"],U=["xMinYMin","xMaxYMin"];else if(L===3)$=["brace-left","brace-center","brace-right"],U=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support + `+L+" children.");for(var G=0;G0&&(l.style.minWidth=Le(o)),l},Tq=function(t,n,a,l,o){var c,d=t.height+t.depth+a+l;if(/fbox|color|angl/.test(n)){if(c=de.makeSpan(["stretchy",n],[],o),n==="fbox"){var m=o.color&&o.getColor();m&&(c.style.borderColor=m)}}else{var f=[];/^[bx]cancel$/.test(n)&&f.push(new Kx({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&f.push(new Kx({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var p=new Fs(f,{width:"100%",height:Le(d)});c=de.makeSvgSpan([],[p],o)}return c.height=d,c.style.height=Le(d),c},qs={encloseSpan:Tq,mathMLnode:Nq,svgSpan:Cq};function yt(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function gg(e){var t=Xm(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function Xm(e){return e&&(e.type==="atom"||ZI.hasOwnProperty(e.type))?e:null}var vg=(e,t)=>{var n,a,l;e&&e.type==="supsub"?(a=yt(e.base,"accent"),n=a.base,e.base=n,l=KI(Ft(e,t)),e.base=a):(a=yt(e,"accent"),n=a.base);var o=Ft(n,t.havingCrampedStyle()),c=a.isShifty&&Ut.isCharacterBox(n),d=0;if(c){var m=Ut.getBaseElem(n),f=Ft(m,t.havingCrampedStyle());d=z3(f).skew}var p=a.label==="\\c",x=p?o.height+o.depth:Math.min(o.height,t.fontMetrics().xHeight),y;if(a.isStretchy)y=qs.svgSpan(a,t),y=de.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"elem",elem:y,wrapperClasses:["svg-align"],wrapperStyle:d>0?{width:"calc(100% - "+Le(2*d)+")",marginLeft:Le(2*d)}:void 0}]},t);else{var b,N;a.label==="\\vec"?(b=de.staticSvg("vec",t),N=de.svgData.vec[1]):(b=de.makeOrd({mode:a.mode,text:a.label},t,"textord"),b=z3(b),b.italic=0,N=b.width,p&&(x+=b.depth)),y=de.makeSpan(["accent-body"],[b]);var k=a.label==="\\textcircled";k&&(y.classes.push("accent-full"),x=o.height);var S=d;k||(S-=N/2),y.style.left=Le(S),a.label==="\\textcircled"&&(y.style.top=".2em"),y=de.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"kern",size:-x},{type:"elem",elem:y}]},t)}var T=de.makeSpan(["mord","accent"],[y],t);return l?(l.children[0]=T,l.height=Math.max(T.height,l.height),l.classes[0]="mord",l):T},_8=(e,t)=>{var n=e.isStretchy?qs.mathMLnode(e.label):new Me.MathNode("mo",[Ma(e.label,e.mode)]),a=new Me.MathNode("mover",[xn(e.base,t),n]);return a.setAttribute("accent","true"),a},_q=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));Be({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{var n=gm(t[0]),a=!_q.test(e.funcName),l=!a||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:a,isShifty:l,base:n}},htmlBuilder:vg,mathmlBuilder:_8});Be({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var n=t[0],a=e.parser.mode;return a==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),a="text"),{type:"accent",mode:a,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:vg,mathmlBuilder:_8});Be({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=t[0];return{type:"accentUnder",mode:n.mode,label:a,base:l}},htmlBuilder:(e,t)=>{var n=Ft(e.base,t),a=qs.svgSpan(e,t),l=e.label==="\\utilde"?.12:0,o=de.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:a,wrapperClasses:["svg-align"]},{type:"kern",size:l},{type:"elem",elem:n}]},t);return de.makeSpan(["mord","accentunder"],[o],t)},mathmlBuilder:(e,t)=>{var n=qs.mathMLnode(e.label),a=new Me.MathNode("munder",[xn(e.base,t),n]);return a.setAttribute("accentunder","true"),a}});var R0=e=>{var t=new Me.MathNode("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};Be({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:a,funcName:l}=e;return{type:"xArrow",mode:a.mode,label:l,body:t[0],below:n[0]}},htmlBuilder(e,t){var n=t.style,a=t.havingStyle(n.sup()),l=de.wrapFragment(Ft(e.body,a,t),t),o=e.label.slice(0,2)==="\\x"?"x":"cd";l.classes.push(o+"-arrow-pad");var c;e.below&&(a=t.havingStyle(n.sub()),c=de.wrapFragment(Ft(e.below,a,t),t),c.classes.push(o+"-arrow-pad"));var d=qs.svgSpan(e,t),m=-t.fontMetrics().axisHeight+.5*d.height,f=-t.fontMetrics().axisHeight-.5*d.height-.111;(l.depth>.25||e.label==="\\xleftequilibrium")&&(f-=l.depth);var p;if(c){var x=-t.fontMetrics().axisHeight+c.height+.5*d.height+.111;p=de.makeVList({positionType:"individualShift",children:[{type:"elem",elem:l,shift:f},{type:"elem",elem:d,shift:m},{type:"elem",elem:c,shift:x}]},t)}else p=de.makeVList({positionType:"individualShift",children:[{type:"elem",elem:l,shift:f},{type:"elem",elem:d,shift:m}]},t);return p.children[0].children[0].children[1].classes.push("svg-align"),de.makeSpan(["mrel","x-arrow"],[p],t)},mathmlBuilder(e,t){var n=qs.mathMLnode(e.label);n.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var a;if(e.body){var l=R0(xn(e.body,t));if(e.below){var o=R0(xn(e.below,t));a=new Me.MathNode("munderover",[n,o,l])}else a=new Me.MathNode("mover",[n,l])}else if(e.below){var c=R0(xn(e.below,t));a=new Me.MathNode("munder",[n,c])}else a=R0(),a=new Me.MathNode("mover",[n,a]);return a}});var Eq=de.makeSpan;function E8(e,t){var n=nr(e.body,t,!0);return Eq([e.mclass],n,t)}function M8(e,t){var n,a=Qr(e.body,t);return e.mclass==="minner"?n=new Me.MathNode("mpadded",a):e.mclass==="mord"?e.isCharacterBox?(n=a[0],n.type="mi"):n=new Me.MathNode("mi",a):(e.isCharacterBox?(n=a[0],n.type="mo"):n=new Me.MathNode("mo",a),e.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):e.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):e.mclass==="mopen"||e.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):e.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}Be({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:n,funcName:a}=e,l=t[0];return{type:"mclass",mode:n.mode,mclass:"m"+a.slice(5),body:Pn(l),isCharacterBox:Ut.isCharacterBox(l)}},htmlBuilder:E8,mathmlBuilder:M8});var Km=e=>{var t=e.type==="ordgroup"&&e.body.length?e.body[0]:e;return t.type==="atom"&&(t.family==="bin"||t.family==="rel")?"m"+t.family:"mord"};Be({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:Km(t[0]),body:Pn(t[1]),isCharacterBox:Ut.isCharacterBox(t[1])}}});Be({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:n,funcName:a}=e,l=t[1],o=t[0],c;a!=="\\stackrel"?c=Km(l):c="mrel";var d={type:"op",mode:l.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:a!=="\\stackrel",body:Pn(l)},m={type:"supsub",mode:o.mode,base:d,sup:a==="\\underset"?null:o,sub:a==="\\underset"?o:null};return{type:"mclass",mode:n.mode,mclass:c,body:[m],isCharacterBox:Ut.isCharacterBox(m)}},htmlBuilder:E8,mathmlBuilder:M8});Be({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:Km(t[0]),body:Pn(t[0])}},htmlBuilder(e,t){var n=nr(e.body,t,!0),a=de.makeSpan([e.mclass],n,t);return a.style.textShadow="0.02em 0.01em 0.04px",a},mathmlBuilder(e,t){var n=Qr(e.body,t),a=new Me.MathNode("mstyle",n);return a.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),a}});var Mq={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},q3=()=>({type:"styling",body:[],mode:"math",style:"display"}),H3=e=>e.type==="textord"&&e.text==="@",Aq=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function Dq(e,t,n){var a=Mq[e];switch(a){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(a,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var l=n.callFunction("\\\\cdleft",[t[0]],[]),o={type:"atom",text:a,mode:"math",family:"rel"},c=n.callFunction("\\Big",[o],[]),d=n.callFunction("\\\\cdright",[t[1]],[]),m={type:"ordgroup",mode:"math",body:[l,c,d]};return n.callFunction("\\\\cdparent",[m],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var f={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[f],[])}default:return{type:"textord",text:" ",mode:"math"}}}function zq(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var n=e.fetch().text;if(n==="&"||n==="\\\\")e.consume();else if(n==="\\end"){t[t.length-1].length===0&&t.pop();break}else throw new Ae("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var a=[],l=[a],o=0;o-1))if("<>AV".indexOf(f)>-1)for(var x=0;x<2;x++){for(var y=!0,b=m+1;bAV=|." after @',c[m]);var N=Dq(f,p,e),k={type:"styling",body:[N],mode:"math",style:"display"};a.push(k),d=q3()}o%2===0?a.push(d):a.shift(),a=[],l.push(a)}e.gullet.endGroup(),e.gullet.endGroup();var S=new Array(l[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:l,arraystretch:1,addJot:!0,rowGaps:[null],cols:S,colSeparationType:"CD",hLinesBeforeRow:new Array(l.length+1).fill([])}}Be({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:a}=e;return{type:"cdlabel",mode:n.mode,side:a.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),a=de.wrapFragment(Ft(e.label,n,t),t);return a.classes.push("cd-label-"+e.side),a.style.bottom=Le(.8-a.depth),a.height=0,a.depth=0,a},mathmlBuilder(e,t){var n=new Me.MathNode("mrow",[xn(e.label,t)]);return n=new Me.MathNode("mpadded",[n]),n.setAttribute("width","0"),e.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Me.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Be({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:n}=e;return{type:"cdlabelparent",mode:n.mode,fragment:t[0]}},htmlBuilder(e,t){var n=de.wrapFragment(Ft(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(e,t){return new Me.MathNode("mrow",[xn(e.fragment,t)])}});Be({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,a=yt(t[0],"ordgroup"),l=a.body,o="",c=0;c=1114111)throw new Ae("\\@char with invalid code point "+o);return m<=65535?f=String.fromCharCode(m):(m-=65536,f=String.fromCharCode((m>>10)+55296,(m&1023)+56320)),{type:"textord",mode:n.mode,text:f}}});var A8=(e,t)=>{var n=nr(e.body,t.withColor(e.color),!1);return de.makeFragment(n)},D8=(e,t)=>{var n=Qr(e.body,t.withColor(e.color)),a=new Me.MathNode("mstyle",n);return a.setAttribute("mathcolor",e.color),a};Be({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,a=yt(t[0],"color-token").color,l=t[1];return{type:"color",mode:n.mode,color:a,body:Pn(l)}},htmlBuilder:A8,mathmlBuilder:D8});Be({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:a}=e,l=yt(t[0],"color-token").color;n.gullet.macros.set("\\current@color",l);var o=n.parseExpression(!0,a);return{type:"color",mode:n.mode,color:l,body:o}},htmlBuilder:A8,mathmlBuilder:D8});Be({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,n){var{parser:a}=e,l=a.gullet.future().text==="["?a.parseSizeGroup(!0):null,o=!a.settings.displayMode||!a.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:a.mode,newLine:o,size:l&&yt(l,"size").value}},htmlBuilder(e,t){var n=de.makeSpan(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=Le(Mn(e.size,t)))),n},mathmlBuilder(e,t){var n=new Me.MathNode("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",Le(Mn(e.size,t)))),n}});var e1={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},z8=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new Ae("Expected a control sequence",e);return t},Oq=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},O8=(e,t,n,a)=>{var l=e.gullet.macros.get(n.text);l==null&&(n.noexpand=!0,l={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,l,a)};Be({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:n}=e;t.consumeSpaces();var a=t.fetch();if(e1[a.text])return(n==="\\global"||n==="\\\\globallong")&&(a.text=e1[a.text]),yt(t.parseFunction(),"internal");throw new Ae("Invalid token after macro prefix",a)}});Be({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,a=t.gullet.popToken(),l=a.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(l))throw new Ae("Expected a control sequence",a);for(var o=0,c,d=[[]];t.gullet.future().text!=="{";)if(a=t.gullet.popToken(),a.text==="#"){if(t.gullet.future().text==="{"){c=t.gullet.future(),d[o].push("{");break}if(a=t.gullet.popToken(),!/^[1-9]$/.test(a.text))throw new Ae('Invalid argument number "'+a.text+'"');if(parseInt(a.text)!==o+1)throw new Ae('Argument number "'+a.text+'" out of order');o++,d.push([])}else{if(a.text==="EOF")throw new Ae("Expected a macro definition");d[o].push(a.text)}var{tokens:m}=t.gullet.consumeArg();return c&&m.unshift(c),(n==="\\edef"||n==="\\xdef")&&(m=t.gullet.expandTokens(m),m.reverse()),t.gullet.macros.set(l,{tokens:m,numArgs:o,delimiters:d},n===e1[n]),{type:"internal",mode:t.mode}}});Be({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,a=z8(t.gullet.popToken());t.gullet.consumeSpaces();var l=Oq(t);return O8(t,a,l,n==="\\\\globallet"),{type:"internal",mode:t.mode}}});Be({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,a=z8(t.gullet.popToken()),l=t.gullet.popToken(),o=t.gullet.popToken();return O8(t,a,o,n==="\\\\globalfuture"),t.gullet.pushToken(o),t.gullet.pushToken(l),{type:"internal",mode:t.mode}}});var au=function(t,n,a){var l=yn.math[t]&&yn.math[t].replace,o=mg(l||t,n,a);if(!o)throw new Error("Unsupported symbol "+t+" and font size "+n+".");return o},yg=function(t,n,a,l){var o=a.havingBaseStyle(n),c=de.makeSpan(l.concat(o.sizingClasses(a)),[t],a),d=o.sizeMultiplier/a.sizeMultiplier;return c.height*=d,c.depth*=d,c.maxFontSize=o.sizeMultiplier,c},R8=function(t,n,a){var l=n.havingBaseStyle(a),o=(1-n.sizeMultiplier/l.sizeMultiplier)*n.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=Le(o),t.height-=o,t.depth+=o},Rq=function(t,n,a,l,o,c){var d=de.makeSymbol(t,"Main-Regular",o,l),m=yg(d,n,l,c);return a&&R8(m,l,n),m},Lq=function(t,n,a,l){return de.makeSymbol(t,"Size"+n+"-Regular",a,l)},L8=function(t,n,a,l,o,c){var d=Lq(t,n,o,l),m=yg(de.makeSpan(["delimsizing","size"+n],[d],l),tt.TEXT,l,c);return a&&R8(m,l,tt.TEXT),m},ax=function(t,n,a){var l;n==="Size1-Regular"?l="delim-size1":l="delim-size4";var o=de.makeSpan(["delimsizinginner",l],[de.makeSpan([],[de.makeSymbol(t,n,a)])]);return{type:"elem",elem:o}},sx=function(t,n,a){var l=ts["Size4-Regular"][t.charCodeAt(0)]?ts["Size4-Regular"][t.charCodeAt(0)][4]:ts["Size1-Regular"][t.charCodeAt(0)][4],o=new Ml("inner",qI(t,Math.round(1e3*n))),c=new Fs([o],{width:Le(l),height:Le(n),style:"width:"+Le(l),viewBox:"0 0 "+1e3*l+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),d=de.makeSvgSpan([],[c],a);return d.height=n,d.style.height=Le(n),d.style.width=Le(l),{type:"elem",elem:d}},t1=.008,L0={type:"kern",size:-1*t1},Bq=["|","\\lvert","\\rvert","\\vert"],Pq=["\\|","\\lVert","\\rVert","\\Vert"],B8=function(t,n,a,l,o,c){var d,m,f,p,x="",y=0;d=f=p=t,m=null;var b="Size1-Regular";t==="\\uparrow"?f=p="⏐":t==="\\Uparrow"?f=p="‖":t==="\\downarrow"?d=f="⏐":t==="\\Downarrow"?d=f="‖":t==="\\updownarrow"?(d="\\uparrow",f="⏐",p="\\downarrow"):t==="\\Updownarrow"?(d="\\Uparrow",f="‖",p="\\Downarrow"):Bq.includes(t)?(f="∣",x="vert",y=333):Pq.includes(t)?(f="∥",x="doublevert",y=556):t==="["||t==="\\lbrack"?(d="⎡",f="⎢",p="⎣",b="Size4-Regular",x="lbrack",y=667):t==="]"||t==="\\rbrack"?(d="⎤",f="⎥",p="⎦",b="Size4-Regular",x="rbrack",y=667):t==="\\lfloor"||t==="⌊"?(f=d="⎢",p="⎣",b="Size4-Regular",x="lfloor",y=667):t==="\\lceil"||t==="⌈"?(d="⎡",f=p="⎢",b="Size4-Regular",x="lceil",y=667):t==="\\rfloor"||t==="⌋"?(f=d="⎥",p="⎦",b="Size4-Regular",x="rfloor",y=667):t==="\\rceil"||t==="⌉"?(d="⎤",f=p="⎥",b="Size4-Regular",x="rceil",y=667):t==="("||t==="\\lparen"?(d="⎛",f="⎜",p="⎝",b="Size4-Regular",x="lparen",y=875):t===")"||t==="\\rparen"?(d="⎞",f="⎟",p="⎠",b="Size4-Regular",x="rparen",y=875):t==="\\{"||t==="\\lbrace"?(d="⎧",m="⎨",p="⎩",f="⎪",b="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(d="⎫",m="⎬",p="⎭",f="⎪",b="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(d="⎧",p="⎩",f="⎪",b="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(d="⎫",p="⎭",f="⎪",b="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(d="⎧",p="⎭",f="⎪",b="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(d="⎫",p="⎩",f="⎪",b="Size4-Regular");var N=au(d,b,o),k=N.height+N.depth,S=au(f,b,o),T=S.height+S.depth,M=au(p,b,o),A=M.height+M.depth,R=0,B=1;if(m!==null){var O=au(m,b,o);R=O.height+O.depth,B=2}var L=k+A+R,$=Math.max(0,Math.ceil((n-L)/(B*T))),U=L+$*B*T,I=l.fontMetrics().axisHeight;a&&(I*=l.sizeMultiplier);var G=U/2-I,ee=[];if(x.length>0){var Ne=U-k-A,J=Math.round(U*1e3),se=HI(x,Math.round(Ne*1e3)),H=new Ml(x,se),le=(y/1e3).toFixed(3)+"em",re=(J/1e3).toFixed(3)+"em",ge=new Fs([H],{width:le,height:re,viewBox:"0 0 "+y+" "+J}),E=de.makeSvgSpan([],[ge],l);E.height=J/1e3,E.style.width=le,E.style.height=re,ee.push({type:"elem",elem:E})}else{if(ee.push(ax(p,b,o)),ee.push(L0),m===null){var we=U-k-A+2*t1;ee.push(sx(f,we,l))}else{var Z=(U-k-A-R)/2+2*t1;ee.push(sx(f,Z,l)),ee.push(L0),ee.push(ax(m,b,o)),ee.push(L0),ee.push(sx(f,Z,l))}ee.push(L0),ee.push(ax(d,b,o))}var z=l.havingBaseStyle(tt.TEXT),X=de.makeVList({positionType:"bottom",positionData:G,children:ee},z);return yg(de.makeSpan(["delimsizing","mult"],[X],z),tt.TEXT,l,c)},lx=80,ix=.08,ox=function(t,n,a,l,o){var c=II(t,l,a),d=new Ml(t,c),m=new Fs([d],{width:"400em",height:Le(n),viewBox:"0 0 400000 "+a,preserveAspectRatio:"xMinYMin slice"});return de.makeSvgSpan(["hide-tail"],[m],o)},Fq=function(t,n){var a=n.havingBaseSizing(),l=q8("\\surd",t*a.sizeMultiplier,I8,a),o=a.sizeMultiplier,c=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),d,m=0,f=0,p=0,x;return l.type==="small"?(p=1e3+1e3*c+lx,t<1?o=1:t<1.4&&(o=.7),m=(1+c+ix)/o,f=(1+c)/o,d=ox("sqrtMain",m,p,c,n),d.style.minWidth="0.853em",x=.833/o):l.type==="large"?(p=(1e3+lx)*hu[l.size],f=(hu[l.size]+c)/o,m=(hu[l.size]+c+ix)/o,d=ox("sqrtSize"+l.size,m,p,c,n),d.style.minWidth="1.02em",x=1/o):(m=t+c+ix,f=t+c,p=Math.floor(1e3*t+c)+lx,d=ox("sqrtTall",m,p,c,n),d.style.minWidth="0.742em",x=1.056),d.height=f,d.style.height=Le(m),{span:d,advanceWidth:x,ruleWidth:(n.fontMetrics().sqrtRuleThickness+c)*o}},P8=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Iq=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],F8=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],hu=[0,1.2,1.8,2.4,3],qq=function(t,n,a,l,o){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),P8.includes(t)||F8.includes(t))return L8(t,n,!1,a,l,o);if(Iq.includes(t))return B8(t,hu[n],!1,a,l,o);throw new Ae("Illegal delimiter: '"+t+"'")},Hq=[{type:"small",style:tt.SCRIPTSCRIPT},{type:"small",style:tt.SCRIPT},{type:"small",style:tt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Uq=[{type:"small",style:tt.SCRIPTSCRIPT},{type:"small",style:tt.SCRIPT},{type:"small",style:tt.TEXT},{type:"stack"}],I8=[{type:"small",style:tt.SCRIPTSCRIPT},{type:"small",style:tt.SCRIPT},{type:"small",style:tt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],$q=function(t){if(t.type==="small")return"Main-Regular";if(t.type==="large")return"Size"+t.size+"-Regular";if(t.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+t.type+"' here.")},q8=function(t,n,a,l){for(var o=Math.min(2,3-l.style.size),c=o;cn)return a[c]}return a[a.length-1]},H8=function(t,n,a,l,o,c){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var d;F8.includes(t)?d=Hq:P8.includes(t)?d=I8:d=Uq;var m=q8(t,n,d,l);return m.type==="small"?Rq(t,m.style,a,l,o,c):m.type==="large"?L8(t,m.size,a,l,o,c):B8(t,n,a,l,o,c)},Vq=function(t,n,a,l,o,c){var d=l.fontMetrics().axisHeight*l.sizeMultiplier,m=901,f=5/l.fontMetrics().ptPerEm,p=Math.max(n-d,a+d),x=Math.max(p/500*m,2*p-f);return H8(t,x,!0,l,o,c)},Ls={sqrtImage:Fq,sizedDelim:qq,sizeToMaxHeight:hu,customSizedDelim:H8,leftRightDelim:Vq},U3={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Gq=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function Qm(e,t){var n=Xm(e);if(n&&Gq.includes(n.text))return n;throw n?new Ae("Invalid delimiter '"+n.text+"' after '"+t.funcName+"'",e):new Ae("Invalid delimiter type '"+e.type+"'",e)}Be({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{var n=Qm(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:U3[e.funcName].size,mclass:U3[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim==="."?de.makeSpan([e.mclass]):Ls.sizedDelim(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(Ma(e.delim,e.mode));var n=new Me.MathNode("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var a=Le(Ls.sizeToMaxHeight[e.size]);return n.setAttribute("minsize",a),n.setAttribute("maxsize",a),n}});function $3(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Be({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=e.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new Ae("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:Qm(t[0],e).text,color:n}}});Be({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Qm(t[0],e),a=e.parser;++a.leftrightDepth;var l=a.parseExpression(!1);--a.leftrightDepth,a.expect("\\right",!1);var o=yt(a.parseFunction(),"leftright-right");return{type:"leftright",mode:a.mode,body:l,left:n.text,right:o.delim,rightColor:o.color}},htmlBuilder:(e,t)=>{$3(e);for(var n=nr(e.body,t,!0,["mopen","mclose"]),a=0,l=0,o=!1,c=0;c{$3(e);var n=Qr(e.body,t);if(e.left!=="."){var a=new Me.MathNode("mo",[Ma(e.left,e.mode)]);a.setAttribute("fence","true"),n.unshift(a)}if(e.right!=="."){var l=new Me.MathNode("mo",[Ma(e.right,e.mode)]);l.setAttribute("fence","true"),e.rightColor&&l.setAttribute("mathcolor",e.rightColor),n.push(l)}return pg(n)}});Be({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Qm(t[0],e);if(!e.parser.leftrightDepth)throw new Ae("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;if(e.delim===".")n=Nu(t,[]);else{n=Ls.sizedDelim(e.delim,1,t,e.mode,[]);var a={delim:e.delim,options:t};n.isMiddle=a}return n},mathmlBuilder:(e,t)=>{var n=e.delim==="\\vert"||e.delim==="|"?Ma("|","text"):Ma(e.delim,e.mode),a=new Me.MathNode("mo",[n]);return a.setAttribute("fence","true"),a.setAttribute("lspace","0.05em"),a.setAttribute("rspace","0.05em"),a}});var bg=(e,t)=>{var n=de.wrapFragment(Ft(e.body,t),t),a=e.label.slice(1),l=t.sizeMultiplier,o,c=0,d=Ut.isCharacterBox(e.body);if(a==="sout")o=de.makeSpan(["stretchy","sout"]),o.height=t.fontMetrics().defaultRuleThickness/l,c=-.5*t.fontMetrics().xHeight;else if(a==="phase"){var m=Mn({number:.6,unit:"pt"},t),f=Mn({number:.35,unit:"ex"},t),p=t.havingBaseSizing();l=l/p.sizeMultiplier;var x=n.height+n.depth+m+f;n.style.paddingLeft=Le(x/2+m);var y=Math.floor(1e3*x*l),b=PI(y),N=new Fs([new Ml("phase",b)],{width:"400em",height:Le(y/1e3),viewBox:"0 0 400000 "+y,preserveAspectRatio:"xMinYMin slice"});o=de.makeSvgSpan(["hide-tail"],[N],t),o.style.height=Le(x),c=n.depth+m+f}else{/cancel/.test(a)?d||n.classes.push("cancel-pad"):a==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var k=0,S=0,T=0;/box/.test(a)?(T=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),k=t.fontMetrics().fboxsep+(a==="colorbox"?0:T),S=k):a==="angl"?(T=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),k=4*T,S=Math.max(0,.25-n.depth)):(k=d?.2:0,S=k),o=qs.encloseSpan(n,a,k,S,t),/fbox|boxed|fcolorbox/.test(a)?(o.style.borderStyle="solid",o.style.borderWidth=Le(T)):a==="angl"&&T!==.049&&(o.style.borderTopWidth=Le(T),o.style.borderRightWidth=Le(T)),c=n.depth+S,e.backgroundColor&&(o.style.backgroundColor=e.backgroundColor,e.borderColor&&(o.style.borderColor=e.borderColor))}var M;if(e.backgroundColor)M=de.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:c},{type:"elem",elem:n,shift:0}]},t);else{var A=/cancel|phase/.test(a)?["svg-align"]:[];M=de.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:o,shift:c,wrapperClasses:A}]},t)}return/cancel/.test(a)&&(M.height=n.height,M.depth=n.depth),/cancel/.test(a)&&!d?de.makeSpan(["mord","cancel-lap"],[M],t):de.makeSpan(["mord"],[M],t)},wg=(e,t)=>{var n=0,a=new Me.MathNode(e.label.indexOf("colorbox")>-1?"mpadded":"menclose",[xn(e.body,t)]);switch(e.label){case"\\cancel":a.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":a.setAttribute("notation","downdiagonalstrike");break;case"\\phase":a.setAttribute("notation","phasorangle");break;case"\\sout":a.setAttribute("notation","horizontalstrike");break;case"\\fbox":a.setAttribute("notation","box");break;case"\\angl":a.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,a.setAttribute("width","+"+2*n+"pt"),a.setAttribute("height","+"+2*n+"pt"),a.setAttribute("lspace",n+"pt"),a.setAttribute("voffset",n+"pt"),e.label==="\\fcolorbox"){var l=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);a.setAttribute("style","border: "+l+"em solid "+String(e.borderColor))}break;case"\\xcancel":a.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&a.setAttribute("mathbackground",e.backgroundColor),a};Be({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(e,t,n){var{parser:a,funcName:l}=e,o=yt(t[0],"color-token").color,c=t[1];return{type:"enclose",mode:a.mode,label:l,backgroundColor:o,body:c}},htmlBuilder:bg,mathmlBuilder:wg});Be({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(e,t,n){var{parser:a,funcName:l}=e,o=yt(t[0],"color-token").color,c=yt(t[1],"color-token").color,d=t[2];return{type:"enclose",mode:a.mode,label:l,backgroundColor:c,borderColor:o,body:d}},htmlBuilder:bg,mathmlBuilder:wg});Be({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\fbox",body:t[0]}}});Be({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:a}=e,l=t[0];return{type:"enclose",mode:n.mode,label:a,body:l}},htmlBuilder:bg,mathmlBuilder:wg});Be({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\angl",body:t[0]}}});var U8={};function is(e){for(var{type:t,names:n,props:a,handler:l,htmlBuilder:o,mathmlBuilder:c}=e,d={type:t,numArgs:a.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:l},m=0;m{var t=e.parser.settings;if(!t.displayMode)throw new Ae("{"+e.envName+"} can be used only in display mode.")};function jg(e){if(e.indexOf("ed")===-1)return e.indexOf("*")===-1}function Bl(e,t,n){var{hskipBeforeAndAfter:a,addJot:l,cols:o,arraystretch:c,colSeparationType:d,autoTag:m,singleRow:f,emptySingleRow:p,maxNumCols:x,leqno:y}=t;if(e.gullet.beginGroup(),f||e.gullet.macros.set("\\cr","\\\\\\relax"),!c){var b=e.gullet.expandMacroAsText("\\arraystretch");if(b==null)c=1;else if(c=parseFloat(b),!c||c<0)throw new Ae("Invalid \\arraystretch: "+b)}e.gullet.beginGroup();var N=[],k=[N],S=[],T=[],M=m!=null?[]:void 0;function A(){m&&e.gullet.macros.set("\\@eqnsw","1",!0)}function R(){M&&(e.gullet.macros.get("\\df@tag")?(M.push(e.subparse([new da("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):M.push(!!m&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(A(),T.push(V3(e));;){var B=e.parseExpression(!1,f?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup(),B={type:"ordgroup",mode:e.mode,body:B},n&&(B={type:"styling",mode:e.mode,style:n,body:[B]}),N.push(B);var O=e.fetch().text;if(O==="&"){if(x&&N.length===x){if(f||d)throw new Ae("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(O==="\\end"){R(),N.length===1&&B.type==="styling"&&B.body[0].body.length===0&&(k.length>1||!p)&&k.pop(),T.length0&&(A+=.25),f.push({pos:A,isDashed:Xe[wn]})}for(R(c[0]),a=0;a0&&(G+=M,LXe))for(a=0;a=d)){var fe=void 0;(l>0||t.hskipBeforeAndAfter)&&(fe=Ut.deflt(Z.pregap,y),fe!==0&&(se=de.makeSpan(["arraycolsep"],[]),se.style.width=Le(fe),J.push(se)));var De=[];for(a=0;a0){for(var je=de.makeLineSpan("hline",n,p),Ze=de.makeLineSpan("hdashline",n,p),qe=[{type:"elem",elem:m,shift:0}];f.length>0;){var Ot=f.pop(),bn=Ot.pos-ee;Ot.isDashed?qe.push({type:"elem",elem:Ze,shift:bn}):qe.push({type:"elem",elem:je,shift:bn})}m=de.makeVList({positionType:"individualShift",children:qe},n)}if(le.length===0)return de.makeSpan(["mord"],[m],n);var Dn=de.makeVList({positionType:"individualShift",children:le},n);return Dn=de.makeSpan(["tag"],[Dn],n),de.makeFragment([m,Dn])},Yq={c:"center ",l:"left ",r:"right "},cs=function(t,n){for(var a=[],l=new Me.MathNode("mtd",[],["mtr-glue"]),o=new Me.MathNode("mtd",[],["mml-eqn-num"]),c=0;c0){var N=t.cols,k="",S=!1,T=0,M=N.length;N[0].type==="separator"&&(y+="top ",T=1),N[N.length-1].type==="separator"&&(y+="bottom ",M-=1);for(var A=T;A0?"left ":"",y+=$[$.length-1].length>0?"right ":"";for(var U=1;U<$.length-1;U++)L+=$[U].length===0?"none ":$[U][0]?"dashed ":"solid ";return/[sd]/.test(L)&&p.setAttribute("rowlines",L.trim()),y!==""&&(p=new Me.MathNode("menclose",[p]),p.setAttribute("notation",y.trim())),t.arraystretch&&t.arraystretch<1&&(p=new Me.MathNode("mstyle",[p]),p.setAttribute("scriptlevel","1")),p},V8=function(t,n){t.envName.indexOf("ed")===-1&&Zm(t);var a=[],l=t.envName.indexOf("at")>-1?"alignat":"align",o=t.envName==="split",c=Bl(t.parser,{cols:a,addJot:!0,autoTag:o?void 0:jg(t.envName),emptySingleRow:!0,colSeparationType:l,maxNumCols:o?2:void 0,leqno:t.parser.settings.leqno},"display"),d,m=0,f={type:"ordgroup",mode:t.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var p="",x=0;x0&&b&&(S=1),a[N]={type:"align",align:k,pregap:S,postgap:0}}return c.colSeparationType=b?"align":"alignat",c};is({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=Xm(t[0]),a=n?[t[0]]:yt(t[0],"ordgroup").body,l=a.map(function(c){var d=gg(c),m=d.text;if("lcr".indexOf(m)!==-1)return{type:"align",align:m};if(m==="|")return{type:"separator",separator:"|"};if(m===":")return{type:"separator",separator:":"};throw new Ae("Unknown column alignment: "+m,c)}),o={cols:l,hskipBeforeAndAfter:!0,maxNumCols:l.length};return Bl(e.parser,o,Ng(e.envName))},htmlBuilder:os,mathmlBuilder:cs});is({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],n="c",a={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(e.envName.charAt(e.envName.length-1)==="*"){var l=e.parser;if(l.consumeSpaces(),l.fetch().text==="["){if(l.consume(),l.consumeSpaces(),n=l.fetch().text,"lcr".indexOf(n)===-1)throw new Ae("Expected l or c or r",l.nextToken);l.consume(),l.consumeSpaces(),l.expect("]"),l.consume(),a.cols=[{type:"align",align:n}]}}var o=Bl(e.parser,a,Ng(e.envName)),c=Math.max(0,...o.body.map(d=>d.length));return o.cols=new Array(c).fill({type:"align",align:n}),t?{type:"leftright",mode:e.mode,body:[o],left:t[0],right:t[1],rightColor:void 0}:o},htmlBuilder:os,mathmlBuilder:cs});is({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},n=Bl(e.parser,t,"script");return n.colSeparationType="small",n},htmlBuilder:os,mathmlBuilder:cs});is({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=Xm(t[0]),a=n?[t[0]]:yt(t[0],"ordgroup").body,l=a.map(function(c){var d=gg(c),m=d.text;if("lc".indexOf(m)!==-1)return{type:"align",align:m};throw new Ae("Unknown column alignment: "+m,c)});if(l.length>1)throw new Ae("{subarray} can contain only one column");var o={cols:l,hskipBeforeAndAfter:!1,arraystretch:.5};if(o=Bl(e.parser,o,"script"),o.body.length>0&&o.body[0].length>1)throw new Ae("{subarray} can contain only one column");return o},htmlBuilder:os,mathmlBuilder:cs});is({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=Bl(e.parser,t,Ng(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:os,mathmlBuilder:cs});is({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:V8,htmlBuilder:os,mathmlBuilder:cs});is({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){["gather","gather*"].includes(e.envName)&&Zm(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:jg(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Bl(e.parser,t,"display")},htmlBuilder:os,mathmlBuilder:cs});is({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:V8,htmlBuilder:os,mathmlBuilder:cs});is({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){Zm(e);var t={autoTag:jg(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Bl(e.parser,t,"display")},htmlBuilder:os,mathmlBuilder:cs});is({type:"array",names:["CD"],props:{numArgs:0},handler(e){return Zm(e),zq(e.parser)},htmlBuilder:os,mathmlBuilder:cs});F("\\nonumber","\\gdef\\@eqnsw{0}");F("\\notag","\\nonumber");Be({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new Ae(e.funcName+" valid only within array environment")}});var G3=U8;Be({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:n,funcName:a}=e,l=t[0];if(l.type!=="ordgroup")throw new Ae("Invalid environment name",l);for(var o="",c=0;c{var n=e.font,a=t.withFont(n);return Ft(e.body,a)},Y8=(e,t)=>{var n=e.font,a=t.withFont(n);return xn(e.body,a)},Y3={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Be({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=gm(t[0]),o=a;return o in Y3&&(o=Y3[o]),{type:"font",mode:n.mode,font:o.slice(1),body:l}},htmlBuilder:G8,mathmlBuilder:Y8});Be({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:n}=e,a=t[0],l=Ut.isCharacterBox(a);return{type:"mclass",mode:n.mode,mclass:Km(a),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:a}],isCharacterBox:l}}});Be({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:a,breakOnTokenText:l}=e,{mode:o}=n,c=n.parseExpression(!0,l),d="math"+a.slice(1);return{type:"font",mode:o,font:d,body:{type:"ordgroup",mode:n.mode,body:c}}},htmlBuilder:G8,mathmlBuilder:Y8});var W8=(e,t)=>{var n=t;return e==="display"?n=n.id>=tt.SCRIPT.id?n.text():tt.DISPLAY:e==="text"&&n.size===tt.DISPLAY.size?n=tt.TEXT:e==="script"?n=tt.SCRIPT:e==="scriptscript"&&(n=tt.SCRIPTSCRIPT),n},Sg=(e,t)=>{var n=W8(e.size,t.style),a=n.fracNum(),l=n.fracDen(),o;o=t.havingStyle(a);var c=Ft(e.numer,o,t);if(e.continued){var d=8.5/t.fontMetrics().ptPerEm,m=3.5/t.fontMetrics().ptPerEm;c.height=c.height0?N=3*y:N=7*y,k=t.fontMetrics().denom1):(x>0?(b=t.fontMetrics().num2,N=y):(b=t.fontMetrics().num3,N=3*y),k=t.fontMetrics().denom2);var S;if(p){var M=t.fontMetrics().axisHeight;b-c.depth-(M+.5*x){var n=new Me.MathNode("mfrac",[xn(e.numer,t),xn(e.denom,t)]);if(!e.hasBarLine)n.setAttribute("linethickness","0px");else if(e.barSize){var a=Mn(e.barSize,t);n.setAttribute("linethickness",Le(a))}var l=W8(e.size,t.style);if(l.size!==t.style.size){n=new Me.MathNode("mstyle",[n]);var o=l.size===tt.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",o),n.setAttribute("scriptlevel","0")}if(e.leftDelim!=null||e.rightDelim!=null){var c=[];if(e.leftDelim!=null){var d=new Me.MathNode("mo",[new Me.TextNode(e.leftDelim.replace("\\",""))]);d.setAttribute("fence","true"),c.push(d)}if(c.push(n),e.rightDelim!=null){var m=new Me.MathNode("mo",[new Me.TextNode(e.rightDelim.replace("\\",""))]);m.setAttribute("fence","true"),c.push(m)}return pg(c)}return n};Be({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=t[0],o=t[1],c,d=null,m=null,f="auto";switch(a){case"\\dfrac":case"\\frac":case"\\tfrac":c=!0;break;case"\\\\atopfrac":c=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":c=!1,d="(",m=")";break;case"\\\\bracefrac":c=!1,d="\\{",m="\\}";break;case"\\\\brackfrac":c=!1,d="[",m="]";break;default:throw new Error("Unrecognized genfrac command")}switch(a){case"\\dfrac":case"\\dbinom":f="display";break;case"\\tfrac":case"\\tbinom":f="text";break}return{type:"genfrac",mode:n.mode,continued:!1,numer:l,denom:o,hasBarLine:c,leftDelim:d,rightDelim:m,size:f,barSize:null}},htmlBuilder:Sg,mathmlBuilder:kg});Be({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=t[0],o=t[1];return{type:"genfrac",mode:n.mode,continued:!0,numer:l,denom:o,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});Be({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:n,token:a}=e,l;switch(n){case"\\over":l="\\frac";break;case"\\choose":l="\\binom";break;case"\\atop":l="\\\\atopfrac";break;case"\\brace":l="\\\\bracefrac";break;case"\\brack":l="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:l,token:a}}});var W3=["display","text","script","scriptscript"],X3=function(t){var n=null;return t.length>0&&(n=t,n=n==="."?null:n),n};Be({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:n}=e,a=t[4],l=t[5],o=gm(t[0]),c=o.type==="atom"&&o.family==="open"?X3(o.text):null,d=gm(t[1]),m=d.type==="atom"&&d.family==="close"?X3(d.text):null,f=yt(t[2],"size"),p,x=null;f.isBlank?p=!0:(x=f.value,p=x.number>0);var y="auto",b=t[3];if(b.type==="ordgroup"){if(b.body.length>0){var N=yt(b.body[0],"textord");y=W3[Number(N.text)]}}else b=yt(b,"textord"),y=W3[Number(b.text)];return{type:"genfrac",mode:n.mode,numer:a,denom:l,continued:!1,hasBarLine:p,barSize:x,leftDelim:c,rightDelim:m,size:y}},htmlBuilder:Sg,mathmlBuilder:kg});Be({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:n,funcName:a,token:l}=e;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:yt(t[0],"size").value,token:l}}});Be({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=t[0],o=NI(yt(t[1],"infix").size),c=t[2],d=o.number>0;return{type:"genfrac",mode:n.mode,numer:l,denom:c,continued:!1,hasBarLine:d,barSize:o,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:Sg,mathmlBuilder:kg});var X8=(e,t)=>{var n=t.style,a,l;e.type==="supsub"?(a=e.sup?Ft(e.sup,t.havingStyle(n.sup()),t):Ft(e.sub,t.havingStyle(n.sub()),t),l=yt(e.base,"horizBrace")):l=yt(e,"horizBrace");var o=Ft(l.base,t.havingBaseStyle(tt.DISPLAY)),c=qs.svgSpan(l,t),d;if(l.isOver?(d=de.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"kern",size:.1},{type:"elem",elem:c}]},t),d.children[0].children[0].children[1].classes.push("svg-align")):(d=de.makeVList({positionType:"bottom",positionData:o.depth+.1+c.height,children:[{type:"elem",elem:c},{type:"kern",size:.1},{type:"elem",elem:o}]},t),d.children[0].children[0].children[0].classes.push("svg-align")),a){var m=de.makeSpan(["mord",l.isOver?"mover":"munder"],[d],t);l.isOver?d=de.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:m},{type:"kern",size:.2},{type:"elem",elem:a}]},t):d=de.makeVList({positionType:"bottom",positionData:m.depth+.2+a.height+a.depth,children:[{type:"elem",elem:a},{type:"kern",size:.2},{type:"elem",elem:m}]},t)}return de.makeSpan(["mord",l.isOver?"mover":"munder"],[d],t)},Wq=(e,t)=>{var n=qs.mathMLnode(e.label);return new Me.MathNode(e.isOver?"mover":"munder",[xn(e.base,t),n])};Be({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:a}=e;return{type:"horizBrace",mode:n.mode,label:a,isOver:/^\\over/.test(a),base:t[0]}},htmlBuilder:X8,mathmlBuilder:Wq});Be({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,a=t[1],l=yt(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:l})?{type:"href",mode:n.mode,href:l,body:Pn(a)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=nr(e.body,t,!1);return de.makeAnchor(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=Al(e.body,t);return n instanceof ca||(n=new ca("mrow",[n])),n.setAttribute("href",e.href),n}});Be({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,a=yt(t[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:a}))return n.formatUnsupportedCmd("\\url");for(var l=[],o=0;o{var{parser:n,funcName:a,token:l}=e,o=yt(t[0],"raw").string,c=t[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var d,m={};switch(a){case"\\htmlClass":m.class=o,d={command:"\\htmlClass",class:o};break;case"\\htmlId":m.id=o,d={command:"\\htmlId",id:o};break;case"\\htmlStyle":m.style=o,d={command:"\\htmlStyle",style:o};break;case"\\htmlData":{for(var f=o.split(","),p=0;p{var n=nr(e.body,t,!1),a=["enclosing"];e.attributes.class&&a.push(...e.attributes.class.trim().split(/\s+/));var l=de.makeSpan(a,n,t);for(var o in e.attributes)o!=="class"&&e.attributes.hasOwnProperty(o)&&l.setAttribute(o,e.attributes[o]);return l},mathmlBuilder:(e,t)=>Al(e.body,t)});Be({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"htmlmathml",mode:n.mode,html:Pn(t[0]),mathml:Pn(t[1])}},htmlBuilder:(e,t)=>{var n=nr(e.html,t,!1);return de.makeFragment(n)},mathmlBuilder:(e,t)=>Al(e.mathml,t)});var cx=function(t){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(t))return{number:+t,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t);if(!n)throw new Ae("Invalid size: '"+t+"' in \\includegraphics");var a={number:+(n[1]+n[2]),unit:n[3]};if(!f8(a))throw new Ae("Invalid unit: '"+a.unit+"' in \\includegraphics.");return a};Be({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,n)=>{var{parser:a}=e,l={number:0,unit:"em"},o={number:.9,unit:"em"},c={number:0,unit:"em"},d="";if(n[0])for(var m=yt(n[0],"raw").string,f=m.split(","),p=0;p{var n=Mn(e.height,t),a=0;e.totalheight.number>0&&(a=Mn(e.totalheight,t)-n);var l=0;e.width.number>0&&(l=Mn(e.width,t));var o={height:Le(n+a)};l>0&&(o.width=Le(l)),a>0&&(o.verticalAlign=Le(-a));var c=new WI(e.src,e.alt,o);return c.height=n,c.depth=a,c},mathmlBuilder:(e,t)=>{var n=new Me.MathNode("mglyph",[]);n.setAttribute("alt",e.alt);var a=Mn(e.height,t),l=0;if(e.totalheight.number>0&&(l=Mn(e.totalheight,t)-a,n.setAttribute("valign",Le(-l))),n.setAttribute("height",Le(a+l)),e.width.number>0){var o=Mn(e.width,t);n.setAttribute("width",Le(o))}return n.setAttribute("src",e.src),n}});Be({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:a}=e,l=yt(t[0],"size");if(n.settings.strict){var o=a[1]==="m",c=l.value.unit==="mu";o?(c||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" supports only mu units, "+("not "+l.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" works only in math mode")):c&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:l.value}},htmlBuilder(e,t){return de.makeGlue(e.dimension,t)},mathmlBuilder(e,t){var n=Mn(e.dimension,t);return new Me.SpaceNode(n)}});Be({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=t[0];return{type:"lap",mode:n.mode,alignment:a.slice(5),body:l}},htmlBuilder:(e,t)=>{var n;e.alignment==="clap"?(n=de.makeSpan([],[Ft(e.body,t)]),n=de.makeSpan(["inner"],[n],t)):n=de.makeSpan(["inner"],[Ft(e.body,t)]);var a=de.makeSpan(["fix"],[]),l=de.makeSpan([e.alignment],[n,a],t),o=de.makeSpan(["strut"]);return o.style.height=Le(l.height+l.depth),l.depth&&(o.style.verticalAlign=Le(-l.depth)),l.children.unshift(o),l=de.makeSpan(["thinbox"],[l],t),de.makeSpan(["mord","vbox"],[l],t)},mathmlBuilder:(e,t)=>{var n=new Me.MathNode("mpadded",[xn(e.body,t)]);if(e.alignment!=="rlap"){var a=e.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",a+"width")}return n.setAttribute("width","0px"),n}});Be({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:n,parser:a}=e,l=a.mode;a.switchMode("math");var o=n==="\\("?"\\)":"$",c=a.parseExpression(!1,o);return a.expect(o),a.switchMode(l),{type:"styling",mode:a.mode,style:"text",body:c}}});Be({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new Ae("Mismatched "+e.funcName)}});var K3=(e,t)=>{switch(t.style.size){case tt.DISPLAY.size:return e.display;case tt.TEXT.size:return e.text;case tt.SCRIPT.size:return e.script;case tt.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};Be({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:Pn(t[0]),text:Pn(t[1]),script:Pn(t[2]),scriptscript:Pn(t[3])}},htmlBuilder:(e,t)=>{var n=K3(e,t),a=nr(n,t,!1);return de.makeFragment(a)},mathmlBuilder:(e,t)=>{var n=K3(e,t);return Al(n,t)}});var K8=(e,t,n,a,l,o,c)=>{e=de.makeSpan([],[e]);var d=n&&Ut.isCharacterBox(n),m,f;if(t){var p=Ft(t,a.havingStyle(l.sup()),a);f={elem:p,kern:Math.max(a.fontMetrics().bigOpSpacing1,a.fontMetrics().bigOpSpacing3-p.depth)}}if(n){var x=Ft(n,a.havingStyle(l.sub()),a);m={elem:x,kern:Math.max(a.fontMetrics().bigOpSpacing2,a.fontMetrics().bigOpSpacing4-x.height)}}var y;if(f&&m){var b=a.fontMetrics().bigOpSpacing5+m.elem.height+m.elem.depth+m.kern+e.depth+c;y=de.makeVList({positionType:"bottom",positionData:b,children:[{type:"kern",size:a.fontMetrics().bigOpSpacing5},{type:"elem",elem:m.elem,marginLeft:Le(-o)},{type:"kern",size:m.kern},{type:"elem",elem:e},{type:"kern",size:f.kern},{type:"elem",elem:f.elem,marginLeft:Le(o)},{type:"kern",size:a.fontMetrics().bigOpSpacing5}]},a)}else if(m){var N=e.height-c;y=de.makeVList({positionType:"top",positionData:N,children:[{type:"kern",size:a.fontMetrics().bigOpSpacing5},{type:"elem",elem:m.elem,marginLeft:Le(-o)},{type:"kern",size:m.kern},{type:"elem",elem:e}]},a)}else if(f){var k=e.depth+c;y=de.makeVList({positionType:"bottom",positionData:k,children:[{type:"elem",elem:e},{type:"kern",size:f.kern},{type:"elem",elem:f.elem,marginLeft:Le(o)},{type:"kern",size:a.fontMetrics().bigOpSpacing5}]},a)}else return e;var S=[y];if(m&&o!==0&&!d){var T=de.makeSpan(["mspace"],[],a);T.style.marginRight=Le(o),S.unshift(T)}return de.makeSpan(["mop","op-limits"],S,a)},Q8=["\\smallint"],nc=(e,t)=>{var n,a,l=!1,o;e.type==="supsub"?(n=e.sup,a=e.sub,o=yt(e.base,"op"),l=!0):o=yt(e,"op");var c=t.style,d=!1;c.size===tt.DISPLAY.size&&o.symbol&&!Q8.includes(o.name)&&(d=!0);var m;if(o.symbol){var f=d?"Size2-Regular":"Size1-Regular",p="";if((o.name==="\\oiint"||o.name==="\\oiiint")&&(p=o.name.slice(1),o.name=p==="oiint"?"\\iint":"\\iiint"),m=de.makeSymbol(o.name,f,"math",t,["mop","op-symbol",d?"large-op":"small-op"]),p.length>0){var x=m.italic,y=de.staticSvg(p+"Size"+(d?"2":"1"),t);m=de.makeVList({positionType:"individualShift",children:[{type:"elem",elem:m,shift:0},{type:"elem",elem:y,shift:d?.08:0}]},t),o.name="\\"+p,m.classes.unshift("mop"),m.italic=x}}else if(o.body){var b=nr(o.body,t,!0);b.length===1&&b[0]instanceof Ea?(m=b[0],m.classes[0]="mop"):m=de.makeSpan(["mop"],b,t)}else{for(var N=[],k=1;k{var n;if(e.symbol)n=new ca("mo",[Ma(e.name,e.mode)]),Q8.includes(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new ca("mo",Qr(e.body,t));else{n=new ca("mi",[new ns(e.name.slice(1))]);var a=new ca("mo",[Ma("⁡","text")]);e.parentIsSupSub?n=new ca("mrow",[n,a]):n=k8([n,a])}return n},Xq={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Be({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=a;return l.length===1&&(l=Xq[l]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:l}},htmlBuilder:nc,mathmlBuilder:Ku});Be({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:n}=e,a=t[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Pn(a)}},htmlBuilder:nc,mathmlBuilder:Ku});var Kq={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Be({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:nc,mathmlBuilder:Ku});Be({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:nc,mathmlBuilder:Ku});Be({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e,a=n;return a.length===1&&(a=Kq[a]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:a}},htmlBuilder:nc,mathmlBuilder:Ku});var Z8=(e,t)=>{var n,a,l=!1,o;e.type==="supsub"?(n=e.sup,a=e.sub,o=yt(e.base,"operatorname"),l=!0):o=yt(e,"operatorname");var c;if(o.body.length>0){for(var d=o.body.map(x=>{var y=x.text;return typeof y=="string"?{type:"textord",mode:x.mode,text:y}:x}),m=nr(d,t.withFont("mathrm"),!0),f=0;f{for(var n=Qr(e.body,t.withFont("mathrm")),a=!0,l=0;lp.toText()).join("");n=[new Me.TextNode(d)]}var m=new Me.MathNode("mi",n);m.setAttribute("mathvariant","normal");var f=new Me.MathNode("mo",[Ma("⁡","text")]);return e.parentIsSupSub?new Me.MathNode("mrow",[m,f]):Me.newDocumentFragment([m,f])};Be({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=t[0];return{type:"operatorname",mode:n.mode,body:Pn(l),alwaysHandleSupSub:a==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Z8,mathmlBuilder:Qq});F("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Ci({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?de.makeFragment(nr(e.body,t,!1)):de.makeSpan(["mord"],nr(e.body,t,!0),t)},mathmlBuilder(e,t){return Al(e.body,t,!0)}});Be({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:n}=e,a=t[0];return{type:"overline",mode:n.mode,body:a}},htmlBuilder(e,t){var n=Ft(e.body,t.havingCrampedStyle()),a=de.makeLineSpan("overline-line",t),l=t.fontMetrics().defaultRuleThickness,o=de.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*l},{type:"elem",elem:a},{type:"kern",size:l}]},t);return de.makeSpan(["mord","overline"],[o],t)},mathmlBuilder(e,t){var n=new Me.MathNode("mo",[new Me.TextNode("‾")]);n.setAttribute("stretchy","true");var a=new Me.MathNode("mover",[xn(e.body,t),n]);return a.setAttribute("accent","true"),a}});Be({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,a=t[0];return{type:"phantom",mode:n.mode,body:Pn(a)}},htmlBuilder:(e,t)=>{var n=nr(e.body,t.withPhantom(),!1);return de.makeFragment(n)},mathmlBuilder:(e,t)=>{var n=Qr(e.body,t);return new Me.MathNode("mphantom",n)}});Be({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,a=t[0];return{type:"hphantom",mode:n.mode,body:a}},htmlBuilder:(e,t)=>{var n=de.makeSpan([],[Ft(e.body,t.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var a=0;a{var n=Qr(Pn(e.body),t),a=new Me.MathNode("mphantom",n),l=new Me.MathNode("mpadded",[a]);return l.setAttribute("height","0px"),l.setAttribute("depth","0px"),l}});Be({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,a=t[0];return{type:"vphantom",mode:n.mode,body:a}},htmlBuilder:(e,t)=>{var n=de.makeSpan(["inner"],[Ft(e.body,t.withPhantom())]),a=de.makeSpan(["fix"],[]);return de.makeSpan(["mord","rlap"],[n,a],t)},mathmlBuilder:(e,t)=>{var n=Qr(Pn(e.body),t),a=new Me.MathNode("mphantom",n),l=new Me.MathNode("mpadded",[a]);return l.setAttribute("width","0px"),l}});Be({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,a=yt(t[0],"size").value,l=t[1];return{type:"raisebox",mode:n.mode,dy:a,body:l}},htmlBuilder(e,t){var n=Ft(e.body,t),a=Mn(e.dy,t);return de.makeVList({positionType:"shift",positionData:-a,children:[{type:"elem",elem:n}]},t)},mathmlBuilder(e,t){var n=new Me.MathNode("mpadded",[xn(e.body,t)]),a=e.dy.number+e.dy.unit;return n.setAttribute("voffset",a),n}});Be({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});Be({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,n){var{parser:a}=e,l=n[0],o=yt(t[0],"size"),c=yt(t[1],"size");return{type:"rule",mode:a.mode,shift:l&&yt(l,"size").value,width:o.value,height:c.value}},htmlBuilder(e,t){var n=de.makeSpan(["mord","rule"],[],t),a=Mn(e.width,t),l=Mn(e.height,t),o=e.shift?Mn(e.shift,t):0;return n.style.borderRightWidth=Le(a),n.style.borderTopWidth=Le(l),n.style.bottom=Le(o),n.width=a,n.height=l+o,n.depth=-o,n.maxFontSize=l*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=Mn(e.width,t),a=Mn(e.height,t),l=e.shift?Mn(e.shift,t):0,o=t.color&&t.getColor()||"black",c=new Me.MathNode("mspace");c.setAttribute("mathbackground",o),c.setAttribute("width",Le(n)),c.setAttribute("height",Le(a));var d=new Me.MathNode("mpadded",[c]);return l>=0?d.setAttribute("height",Le(l)):(d.setAttribute("height",Le(l)),d.setAttribute("depth",Le(-l))),d.setAttribute("voffset",Le(l)),d}});function J8(e,t,n){for(var a=nr(e,t,!1),l=t.sizeMultiplier/n.sizeMultiplier,o=0;o{var n=t.havingSize(e.size);return J8(e.body,n,t)};Be({type:"sizing",names:Q3,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:n,funcName:a,parser:l}=e,o=l.parseExpression(!1,n);return{type:"sizing",mode:l.mode,size:Q3.indexOf(a)+1,body:o}},htmlBuilder:Zq,mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),a=Qr(e.body,n),l=new Me.MathNode("mstyle",a);return l.setAttribute("mathsize",Le(n.sizeMultiplier)),l}});Be({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:a}=e,l=!1,o=!1,c=n[0]&&yt(n[0],"ordgroup");if(c)for(var d="",m=0;m{var n=de.makeSpan([],[Ft(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return n;if(e.smashHeight&&(n.height=0,n.children))for(var a=0;a{var n=new Me.MathNode("mpadded",[xn(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});Be({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:a}=e,l=n[0],o=t[0];return{type:"sqrt",mode:a.mode,body:o,index:l}},htmlBuilder(e,t){var n=Ft(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=de.wrapFragment(n,t);var a=t.fontMetrics(),l=a.defaultRuleThickness,o=l;t.style.idn.height+n.depth+c&&(c=(c+x-n.height-n.depth)/2);var y=m.height-n.height-c-f;n.style.paddingLeft=Le(p);var b=de.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+y)},{type:"elem",elem:m},{type:"kern",size:f}]},t);if(e.index){var N=t.havingStyle(tt.SCRIPTSCRIPT),k=Ft(e.index,N,t),S=.6*(b.height-b.depth),T=de.makeVList({positionType:"shift",positionData:-S,children:[{type:"elem",elem:k}]},t),M=de.makeSpan(["root"],[T]);return de.makeSpan(["mord","sqrt"],[M,b],t)}else return de.makeSpan(["mord","sqrt"],[b],t)},mathmlBuilder(e,t){var{body:n,index:a}=e;return a?new Me.MathNode("mroot",[xn(n,t),xn(a,t)]):new Me.MathNode("msqrt",[xn(n,t)])}});var Z3={display:tt.DISPLAY,text:tt.TEXT,script:tt.SCRIPT,scriptscript:tt.SCRIPTSCRIPT};Be({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:n,funcName:a,parser:l}=e,o=l.parseExpression(!0,n),c=a.slice(1,a.length-5);return{type:"styling",mode:l.mode,style:c,body:o}},htmlBuilder(e,t){var n=Z3[e.style],a=t.havingStyle(n).withFont("");return J8(e.body,a,t)},mathmlBuilder(e,t){var n=Z3[e.style],a=t.havingStyle(n),l=Qr(e.body,a),o=new Me.MathNode("mstyle",l),c={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},d=c[e.style];return o.setAttribute("scriptlevel",d[0]),o.setAttribute("displaystyle",d[1]),o}});var Jq=function(t,n){var a=t.base;if(a)if(a.type==="op"){var l=a.limits&&(n.style.size===tt.DISPLAY.size||a.alwaysHandleSupSub);return l?nc:null}else if(a.type==="operatorname"){var o=a.alwaysHandleSupSub&&(n.style.size===tt.DISPLAY.size||a.limits);return o?Z8:null}else{if(a.type==="accent")return Ut.isCharacterBox(a.base)?vg:null;if(a.type==="horizBrace"){var c=!t.sub;return c===a.isOver?X8:null}else return null}else return null};Ci({type:"supsub",htmlBuilder(e,t){var n=Jq(e,t);if(n)return n(e,t);var{base:a,sup:l,sub:o}=e,c=Ft(a,t),d,m,f=t.fontMetrics(),p=0,x=0,y=a&&Ut.isCharacterBox(a);if(l){var b=t.havingStyle(t.style.sup());d=Ft(l,b,t),y||(p=c.height-b.fontMetrics().supDrop*b.sizeMultiplier/t.sizeMultiplier)}if(o){var N=t.havingStyle(t.style.sub());m=Ft(o,N,t),y||(x=c.depth+N.fontMetrics().subDrop*N.sizeMultiplier/t.sizeMultiplier)}var k;t.style===tt.DISPLAY?k=f.sup1:t.style.cramped?k=f.sup3:k=f.sup2;var S=t.sizeMultiplier,T=Le(.5/f.ptPerEm/S),M=null;if(m){var A=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");(c instanceof Ea||A)&&(M=Le(-c.italic))}var R;if(d&&m){p=Math.max(p,k,d.depth+.25*f.xHeight),x=Math.max(x,f.sub2);var B=f.defaultRuleThickness,O=4*B;if(p-d.depth-(m.height-x)0&&(p+=L,x-=L)}var $=[{type:"elem",elem:m,shift:x,marginRight:T,marginLeft:M},{type:"elem",elem:d,shift:-p,marginRight:T}];R=de.makeVList({positionType:"individualShift",children:$},t)}else if(m){x=Math.max(x,f.sub1,m.height-.8*f.xHeight);var U=[{type:"elem",elem:m,marginLeft:M,marginRight:T}];R=de.makeVList({positionType:"shift",positionData:x,children:U},t)}else if(d)p=Math.max(p,k,d.depth+.25*f.xHeight),R=de.makeVList({positionType:"shift",positionData:-p,children:[{type:"elem",elem:d,marginRight:T}]},t);else throw new Error("supsub must have either sup or sub.");var I=Zx(c,"right")||"mord";return de.makeSpan([I],[c,de.makeSpan(["msupsub"],[R])],t)},mathmlBuilder(e,t){var n=!1,a,l;e.base&&e.base.type==="horizBrace"&&(l=!!e.sup,l===e.base.isOver&&(n=!0,a=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var o=[xn(e.base,t)];e.sub&&o.push(xn(e.sub,t)),e.sup&&o.push(xn(e.sup,t));var c;if(n)c=a?"mover":"munder";else if(e.sub)if(e.sup){var f=e.base;f&&f.type==="op"&&f.limits&&t.style===tt.DISPLAY||f&&f.type==="operatorname"&&f.alwaysHandleSupSub&&(t.style===tt.DISPLAY||f.limits)?c="munderover":c="msubsup"}else{var m=e.base;m&&m.type==="op"&&m.limits&&(t.style===tt.DISPLAY||m.alwaysHandleSupSub)||m&&m.type==="operatorname"&&m.alwaysHandleSupSub&&(m.limits||t.style===tt.DISPLAY)?c="munder":c="msub"}else{var d=e.base;d&&d.type==="op"&&d.limits&&(t.style===tt.DISPLAY||d.alwaysHandleSupSub)||d&&d.type==="operatorname"&&d.alwaysHandleSupSub&&(d.limits||t.style===tt.DISPLAY)?c="mover":c="msup"}return new Me.MathNode(c,o)}});Ci({type:"atom",htmlBuilder(e,t){return de.mathsym(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var n=new Me.MathNode("mo",[Ma(e.text,e.mode)]);if(e.family==="bin"){var a=xg(e,t);a==="bold-italic"&&n.setAttribute("mathvariant",a)}else e.family==="punct"?n.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&n.setAttribute("stretchy","false");return n}});var eN={mi:"italic",mn:"normal",mtext:"normal"};Ci({type:"mathord",htmlBuilder(e,t){return de.makeOrd(e,t,"mathord")},mathmlBuilder(e,t){var n=new Me.MathNode("mi",[Ma(e.text,e.mode,t)]),a=xg(e,t)||"italic";return a!==eN[n.type]&&n.setAttribute("mathvariant",a),n}});Ci({type:"textord",htmlBuilder(e,t){return de.makeOrd(e,t,"textord")},mathmlBuilder(e,t){var n=Ma(e.text,e.mode,t),a=xg(e,t)||"normal",l;return e.mode==="text"?l=new Me.MathNode("mtext",[n]):/[0-9]/.test(e.text)?l=new Me.MathNode("mn",[n]):e.text==="\\prime"?l=new Me.MathNode("mo",[n]):l=new Me.MathNode("mi",[n]),a!==eN[l.type]&&l.setAttribute("mathvariant",a),l}});var ux={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},dx={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Ci({type:"spacing",htmlBuilder(e,t){if(dx.hasOwnProperty(e.text)){var n=dx[e.text].className||"";if(e.mode==="text"){var a=de.makeOrd(e,t,"textord");return a.classes.push(n),a}else return de.makeSpan(["mspace",n],[de.mathsym(e.text,e.mode,t)],t)}else{if(ux.hasOwnProperty(e.text))return de.makeSpan(["mspace",ux[e.text]],[],t);throw new Ae('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var n;if(dx.hasOwnProperty(e.text))n=new Me.MathNode("mtext",[new Me.TextNode(" ")]);else{if(ux.hasOwnProperty(e.text))return new Me.MathNode("mspace");throw new Ae('Unknown type of space "'+e.text+'"')}return n}});var J3=()=>{var e=new Me.MathNode("mtd",[]);return e.setAttribute("width","50%"),e};Ci({type:"tag",mathmlBuilder(e,t){var n=new Me.MathNode("mtable",[new Me.MathNode("mtr",[J3(),new Me.MathNode("mtd",[Al(e.body,t)]),J3(),new Me.MathNode("mtd",[Al(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var e5={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},t5={"\\textbf":"textbf","\\textmd":"textmd"},eH={"\\textit":"textit","\\textup":"textup"},n5=(e,t)=>{var n=e.font;if(n){if(e5[n])return t.withTextFontFamily(e5[n]);if(t5[n])return t.withTextFontWeight(t5[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(eH[n])};Be({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:a}=e,l=t[0];return{type:"text",mode:n.mode,body:Pn(l),font:a}},htmlBuilder(e,t){var n=n5(e,t),a=nr(e.body,n,!0);return de.makeSpan(["mord","text"],a,n)},mathmlBuilder(e,t){var n=n5(e,t);return Al(e.body,n)}});Be({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"underline",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=Ft(e.body,t),a=de.makeLineSpan("underline-line",t),l=t.fontMetrics().defaultRuleThickness,o=de.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:l},{type:"elem",elem:a},{type:"kern",size:3*l},{type:"elem",elem:n}]},t);return de.makeSpan(["mord","underline"],[o],t)},mathmlBuilder(e,t){var n=new Me.MathNode("mo",[new Me.TextNode("‾")]);n.setAttribute("stretchy","true");var a=new Me.MathNode("munder",[xn(e.body,t),n]);return a.setAttribute("accentunder","true"),a}});Be({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"vcenter",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=Ft(e.body,t),a=t.fontMetrics().axisHeight,l=.5*(n.height-a-(n.depth+a));return de.makeVList({positionType:"shift",positionData:l,children:[{type:"elem",elem:n}]},t)},mathmlBuilder(e,t){return new Me.MathNode("mpadded",[xn(e.body,t)],["vcenter"])}});Be({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new Ae("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=r5(e),a=[],l=t.havingStyle(t.style.text()),o=0;oe.body.replace(/ /g,e.star?"␣":" "),jl=N8,tN=`[ \r + ]`,tH="\\\\[a-zA-Z@]+",nH="\\\\[^\uD800-\uDFFF]",rH="("+tH+")"+tN+"*",aH=`\\\\( +|[ \r ]+ +?)[ \r ]*`,n1="[̀-ͯ]",sH=new RegExp(n1+"+$"),lH="("+tN+"+)|"+(aH+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(n1+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(n1+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+rH)+("|"+nH+")");class a5{constructor(t,n){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=t,this.settings=n,this.tokenRegex=new RegExp(lH,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,n){this.catcodes[t]=n}lex(){var t=this.input,n=this.tokenRegex.lastIndex;if(n===t.length)return new da("EOF",new Ur(this,n,n));var a=this.tokenRegex.exec(t);if(a===null||a.index!==n)throw new Ae("Unexpected character: '"+t[n]+"'",new da(t[n],new Ur(this,n,n+1)));var l=a[6]||a[3]||(a[2]?"\\ ":" ");if(this.catcodes[l]===14){var o=t.indexOf(` +`,this.tokenRegex.lastIndex);return o===-1?(this.tokenRegex.lastIndex=t.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=o+1,this.lex()}return new da(l,new Ur(this,n,this.tokenRegex.lastIndex))}}class iH{constructor(t,n){t===void 0&&(t={}),n===void 0&&(n={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=n,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new Ae("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var t=this.undefStack.pop();for(var n in t)t.hasOwnProperty(n)&&(t[n]==null?delete this.current[n]:this.current[n]=t[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,n,a){if(a===void 0&&(a=!1),a){for(var l=0;l0&&(this.undefStack[this.undefStack.length-1][t]=n)}else{var o=this.undefStack[this.undefStack.length-1];o&&!o.hasOwnProperty(t)&&(o[t]=this.current[t])}n==null?delete this.current[t]:this.current[t]=n}}var oH=$8;F("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});F("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});F("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});F("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});F("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var n=e.future();return t[0].length===1&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});F("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");F("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var s5={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};F("\\char",function(e){var t=e.popToken(),n,a="";if(t.text==="'")n=8,t=e.popToken();else if(t.text==='"')n=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")a=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new Ae("\\char` missing argument");a=t.text.charCodeAt(0)}else n=10;if(n){if(a=s5[t.text],a==null||a>=n)throw new Ae("Invalid base-"+n+" digit "+t.text);for(var l;(l=s5[e.future().text])!=null&&l{var l=e.consumeArg().tokens;if(l.length!==1)throw new Ae("\\newcommand's first argument must be a macro name");var o=l[0].text,c=e.isDefined(o);if(c&&!t)throw new Ae("\\newcommand{"+o+"} attempting to redefine "+(o+"; use \\renewcommand"));if(!c&&!n)throw new Ae("\\renewcommand{"+o+"} when command "+o+" does not yet exist; use \\newcommand");var d=0;if(l=e.consumeArg().tokens,l.length===1&&l[0].text==="["){for(var m="",f=e.expandNextToken();f.text!=="]"&&f.text!=="EOF";)m+=f.text,f=e.expandNextToken();if(!m.match(/^\s*[0-9]+\s*$/))throw new Ae("Invalid number of arguments: "+m);d=parseInt(m),l=e.consumeArg().tokens}return c&&a||e.macros.set(o,{tokens:l,numArgs:d}),""};F("\\newcommand",e=>Cg(e,!1,!0,!1));F("\\renewcommand",e=>Cg(e,!0,!1,!1));F("\\providecommand",e=>Cg(e,!0,!0,!0));F("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(n=>n.text).join("")),""});F("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(n=>n.text).join("")),""});F("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),jl[n],yn.math[n],yn.text[n]),""});F("\\bgroup","{");F("\\egroup","}");F("~","\\nobreakspace");F("\\lq","`");F("\\rq","'");F("\\aa","\\r a");F("\\AA","\\r A");F("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");F("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");F("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");F("ℬ","\\mathscr{B}");F("ℰ","\\mathscr{E}");F("ℱ","\\mathscr{F}");F("ℋ","\\mathscr{H}");F("ℐ","\\mathscr{I}");F("ℒ","\\mathscr{L}");F("ℳ","\\mathscr{M}");F("ℛ","\\mathscr{R}");F("ℭ","\\mathfrak{C}");F("ℌ","\\mathfrak{H}");F("ℨ","\\mathfrak{Z}");F("\\Bbbk","\\Bbb{k}");F("·","\\cdotp");F("\\llap","\\mathllap{\\textrm{#1}}");F("\\rlap","\\mathrlap{\\textrm{#1}}");F("\\clap","\\mathclap{\\textrm{#1}}");F("\\mathstrut","\\vphantom{(}");F("\\underbar","\\underline{\\text{#1}}");F("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');F("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");F("\\ne","\\neq");F("≠","\\neq");F("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");F("∉","\\notin");F("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");F("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");F("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");F("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");F("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");F("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");F("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");F("⟂","\\perp");F("‼","\\mathclose{!\\mkern-0.8mu!}");F("∌","\\notni");F("⌜","\\ulcorner");F("⌝","\\urcorner");F("⌞","\\llcorner");F("⌟","\\lrcorner");F("©","\\copyright");F("®","\\textregistered");F("️","\\textregistered");F("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');F("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');F("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');F("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');F("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");F("⋮","\\vdots");F("\\varGamma","\\mathit{\\Gamma}");F("\\varDelta","\\mathit{\\Delta}");F("\\varTheta","\\mathit{\\Theta}");F("\\varLambda","\\mathit{\\Lambda}");F("\\varXi","\\mathit{\\Xi}");F("\\varPi","\\mathit{\\Pi}");F("\\varSigma","\\mathit{\\Sigma}");F("\\varUpsilon","\\mathit{\\Upsilon}");F("\\varPhi","\\mathit{\\Phi}");F("\\varPsi","\\mathit{\\Psi}");F("\\varOmega","\\mathit{\\Omega}");F("\\substack","\\begin{subarray}{c}#1\\end{subarray}");F("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");F("\\boxed","\\fbox{$\\displaystyle{#1}$}");F("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");F("\\implies","\\DOTSB\\;\\Longrightarrow\\;");F("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");F("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");F("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var l5={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};F("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in l5?t=l5[n]:(n.slice(0,4)==="\\not"||n in yn.math&&["bin","rel"].includes(yn.math[n].group))&&(t="\\dotsb"),t});var Tg={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};F("\\dotso",function(e){var t=e.future().text;return t in Tg?"\\ldots\\,":"\\ldots"});F("\\dotsc",function(e){var t=e.future().text;return t in Tg&&t!==","?"\\ldots\\,":"\\ldots"});F("\\cdots",function(e){var t=e.future().text;return t in Tg?"\\@cdots\\,":"\\@cdots"});F("\\dotsb","\\cdots");F("\\dotsm","\\cdots");F("\\dotsi","\\!\\cdots");F("\\dotsx","\\ldots\\,");F("\\DOTSI","\\relax");F("\\DOTSB","\\relax");F("\\DOTSX","\\relax");F("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");F("\\,","\\tmspace+{3mu}{.1667em}");F("\\thinspace","\\,");F("\\>","\\mskip{4mu}");F("\\:","\\tmspace+{4mu}{.2222em}");F("\\medspace","\\:");F("\\;","\\tmspace+{5mu}{.2777em}");F("\\thickspace","\\;");F("\\!","\\tmspace-{3mu}{.1667em}");F("\\negthinspace","\\!");F("\\negmedspace","\\tmspace-{4mu}{.2222em}");F("\\negthickspace","\\tmspace-{5mu}{.277em}");F("\\enspace","\\kern.5em ");F("\\enskip","\\hskip.5em\\relax");F("\\quad","\\hskip1em\\relax");F("\\qquad","\\hskip2em\\relax");F("\\tag","\\@ifstar\\tag@literal\\tag@paren");F("\\tag@paren","\\tag@literal{({#1})}");F("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new Ae("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});F("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");F("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");F("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");F("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");F("\\newline","\\\\\\relax");F("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var nN=Le(ts["Main-Regular"][84][1]-.7*ts["Main-Regular"][65][1]);F("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+nN+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");F("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+nN+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");F("\\hspace","\\@ifstar\\@hspacer\\@hspace");F("\\@hspace","\\hskip #1\\relax");F("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");F("\\ordinarycolon",":");F("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");F("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');F("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');F("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');F("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');F("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');F("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');F("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');F("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');F("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');F("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');F("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');F("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');F("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');F("∷","\\dblcolon");F("∹","\\eqcolon");F("≔","\\coloneqq");F("≕","\\eqqcolon");F("⩴","\\Coloneqq");F("\\ratio","\\vcentcolon");F("\\coloncolon","\\dblcolon");F("\\colonequals","\\coloneqq");F("\\coloncolonequals","\\Coloneqq");F("\\equalscolon","\\eqqcolon");F("\\equalscoloncolon","\\Eqqcolon");F("\\colonminus","\\coloneq");F("\\coloncolonminus","\\Coloneq");F("\\minuscolon","\\eqcolon");F("\\minuscoloncolon","\\Eqcolon");F("\\coloncolonapprox","\\Colonapprox");F("\\coloncolonsim","\\Colonsim");F("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");F("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");F("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");F("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");F("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");F("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");F("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");F("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");F("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");F("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");F("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");F("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");F("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");F("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");F("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");F("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");F("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");F("\\nleqq","\\html@mathml{\\@nleqq}{≰}");F("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");F("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");F("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");F("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");F("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");F("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");F("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");F("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");F("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");F("\\imath","\\html@mathml{\\@imath}{ı}");F("\\jmath","\\html@mathml{\\@jmath}{ȷ}");F("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");F("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");F("⟦","\\llbracket");F("⟧","\\rrbracket");F("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");F("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");F("⦃","\\lBrace");F("⦄","\\rBrace");F("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");F("⦵","\\minuso");F("\\darr","\\downarrow");F("\\dArr","\\Downarrow");F("\\Darr","\\Downarrow");F("\\lang","\\langle");F("\\rang","\\rangle");F("\\uarr","\\uparrow");F("\\uArr","\\Uparrow");F("\\Uarr","\\Uparrow");F("\\N","\\mathbb{N}");F("\\R","\\mathbb{R}");F("\\Z","\\mathbb{Z}");F("\\alef","\\aleph");F("\\alefsym","\\aleph");F("\\Alpha","\\mathrm{A}");F("\\Beta","\\mathrm{B}");F("\\bull","\\bullet");F("\\Chi","\\mathrm{X}");F("\\clubs","\\clubsuit");F("\\cnums","\\mathbb{C}");F("\\Complex","\\mathbb{C}");F("\\Dagger","\\ddagger");F("\\diamonds","\\diamondsuit");F("\\empty","\\emptyset");F("\\Epsilon","\\mathrm{E}");F("\\Eta","\\mathrm{H}");F("\\exist","\\exists");F("\\harr","\\leftrightarrow");F("\\hArr","\\Leftrightarrow");F("\\Harr","\\Leftrightarrow");F("\\hearts","\\heartsuit");F("\\image","\\Im");F("\\infin","\\infty");F("\\Iota","\\mathrm{I}");F("\\isin","\\in");F("\\Kappa","\\mathrm{K}");F("\\larr","\\leftarrow");F("\\lArr","\\Leftarrow");F("\\Larr","\\Leftarrow");F("\\lrarr","\\leftrightarrow");F("\\lrArr","\\Leftrightarrow");F("\\Lrarr","\\Leftrightarrow");F("\\Mu","\\mathrm{M}");F("\\natnums","\\mathbb{N}");F("\\Nu","\\mathrm{N}");F("\\Omicron","\\mathrm{O}");F("\\plusmn","\\pm");F("\\rarr","\\rightarrow");F("\\rArr","\\Rightarrow");F("\\Rarr","\\Rightarrow");F("\\real","\\Re");F("\\reals","\\mathbb{R}");F("\\Reals","\\mathbb{R}");F("\\Rho","\\mathrm{P}");F("\\sdot","\\cdot");F("\\sect","\\S");F("\\spades","\\spadesuit");F("\\sub","\\subset");F("\\sube","\\subseteq");F("\\supe","\\supseteq");F("\\Tau","\\mathrm{T}");F("\\thetasym","\\vartheta");F("\\weierp","\\wp");F("\\Zeta","\\mathrm{Z}");F("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");F("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");F("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");F("\\bra","\\mathinner{\\langle{#1}|}");F("\\ket","\\mathinner{|{#1}\\rangle}");F("\\braket","\\mathinner{\\langle{#1}\\rangle}");F("\\Bra","\\left\\langle#1\\right|");F("\\Ket","\\left|#1\\right\\rangle");var rN=e=>t=>{var n=t.consumeArg().tokens,a=t.consumeArg().tokens,l=t.consumeArg().tokens,o=t.consumeArg().tokens,c=t.macros.get("|"),d=t.macros.get("\\|");t.macros.beginGroup();var m=x=>y=>{e&&(y.macros.set("|",c),l.length&&y.macros.set("\\|",d));var b=x;if(!x&&l.length){var N=y.future();N.text==="|"&&(y.popToken(),b=!0)}return{tokens:b?l:a,numArgs:0}};t.macros.set("|",m(!1)),l.length&&t.macros.set("\\|",m(!0));var f=t.consumeArg().tokens,p=t.expandTokens([...o,...f,...n]);return t.macros.endGroup(),{tokens:p.reverse(),numArgs:0}};F("\\bra@ket",rN(!1));F("\\bra@set",rN(!0));F("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");F("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");F("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");F("\\angln","{\\angl n}");F("\\blue","\\textcolor{##6495ed}{#1}");F("\\orange","\\textcolor{##ffa500}{#1}");F("\\pink","\\textcolor{##ff00af}{#1}");F("\\red","\\textcolor{##df0030}{#1}");F("\\green","\\textcolor{##28ae7b}{#1}");F("\\gray","\\textcolor{gray}{#1}");F("\\purple","\\textcolor{##9d38bd}{#1}");F("\\blueA","\\textcolor{##ccfaff}{#1}");F("\\blueB","\\textcolor{##80f6ff}{#1}");F("\\blueC","\\textcolor{##63d9ea}{#1}");F("\\blueD","\\textcolor{##11accd}{#1}");F("\\blueE","\\textcolor{##0c7f99}{#1}");F("\\tealA","\\textcolor{##94fff5}{#1}");F("\\tealB","\\textcolor{##26edd5}{#1}");F("\\tealC","\\textcolor{##01d1c1}{#1}");F("\\tealD","\\textcolor{##01a995}{#1}");F("\\tealE","\\textcolor{##208170}{#1}");F("\\greenA","\\textcolor{##b6ffb0}{#1}");F("\\greenB","\\textcolor{##8af281}{#1}");F("\\greenC","\\textcolor{##74cf70}{#1}");F("\\greenD","\\textcolor{##1fab54}{#1}");F("\\greenE","\\textcolor{##0d923f}{#1}");F("\\goldA","\\textcolor{##ffd0a9}{#1}");F("\\goldB","\\textcolor{##ffbb71}{#1}");F("\\goldC","\\textcolor{##ff9c39}{#1}");F("\\goldD","\\textcolor{##e07d10}{#1}");F("\\goldE","\\textcolor{##a75a05}{#1}");F("\\redA","\\textcolor{##fca9a9}{#1}");F("\\redB","\\textcolor{##ff8482}{#1}");F("\\redC","\\textcolor{##f9685d}{#1}");F("\\redD","\\textcolor{##e84d39}{#1}");F("\\redE","\\textcolor{##bc2612}{#1}");F("\\maroonA","\\textcolor{##ffbde0}{#1}");F("\\maroonB","\\textcolor{##ff92c6}{#1}");F("\\maroonC","\\textcolor{##ed5fa6}{#1}");F("\\maroonD","\\textcolor{##ca337c}{#1}");F("\\maroonE","\\textcolor{##9e034e}{#1}");F("\\purpleA","\\textcolor{##ddd7ff}{#1}");F("\\purpleB","\\textcolor{##c6b9fc}{#1}");F("\\purpleC","\\textcolor{##aa87ff}{#1}");F("\\purpleD","\\textcolor{##7854ab}{#1}");F("\\purpleE","\\textcolor{##543b78}{#1}");F("\\mintA","\\textcolor{##f5f9e8}{#1}");F("\\mintB","\\textcolor{##edf2df}{#1}");F("\\mintC","\\textcolor{##e0e5cc}{#1}");F("\\grayA","\\textcolor{##f6f7f7}{#1}");F("\\grayB","\\textcolor{##f0f1f2}{#1}");F("\\grayC","\\textcolor{##e3e5e6}{#1}");F("\\grayD","\\textcolor{##d6d8da}{#1}");F("\\grayE","\\textcolor{##babec2}{#1}");F("\\grayF","\\textcolor{##888d93}{#1}");F("\\grayG","\\textcolor{##626569}{#1}");F("\\grayH","\\textcolor{##3b3e40}{#1}");F("\\grayI","\\textcolor{##21242c}{#1}");F("\\kaBlue","\\textcolor{##314453}{#1}");F("\\kaGreen","\\textcolor{##71B307}{#1}");var aN={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class cH{constructor(t,n,a){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(t),this.macros=new iH(oH,n.macros),this.mode=a,this.stack=[]}feed(t){this.lexer=new a5(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var n,a,l;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:l,end:a}=this.consumeArg(["]"])}else({tokens:l,start:n,end:a}=this.consumeArg());return this.pushToken(new da("EOF",a.loc)),this.pushTokens(l),new da("",Ur.range(n,a))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var n=[],a=t&&t.length>0;a||this.consumeSpaces();var l=this.future(),o,c=0,d=0;do{if(o=this.popToken(),n.push(o),o.text==="{")++c;else if(o.text==="}"){if(--c,c===-1)throw new Ae("Extra }",o)}else if(o.text==="EOF")throw new Ae("Unexpected end of input in a macro argument, expected '"+(t&&a?t[d]:"}")+"'",o);if(t&&a)if((c===0||c===1&&t[d]==="{")&&o.text===t[d]){if(++d,d===t.length){n.splice(-d,d);break}}else d=0}while(c!==0||a);return l.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:l,end:o}}consumeArgs(t,n){if(n){if(n.length!==t+1)throw new Ae("The length of delimiters doesn't match the number of args!");for(var a=n[0],l=0;lthis.settings.maxExpand)throw new Ae("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var n=this.popToken(),a=n.text,l=n.noexpand?null:this._getExpansion(a);if(l==null||t&&l.unexpandable){if(t&&l==null&&a[0]==="\\"&&!this.isDefined(a))throw new Ae("Undefined control sequence: "+a);return this.pushToken(n),!1}this.countExpansion(1);var o=l.tokens,c=this.consumeArgs(l.numArgs,l.delimiters);if(l.numArgs){o=o.slice();for(var d=o.length-1;d>=0;--d){var m=o[d];if(m.text==="#"){if(d===0)throw new Ae("Incomplete placeholder at end of macro body",m);if(m=o[--d],m.text==="#")o.splice(d+1,1);else if(/^[1-9]$/.test(m.text))o.splice(d,2,...c[+m.text-1]);else throw new Ae("Not a valid argument number",m)}}}return this.pushTokens(o),o.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}throw new Error}expandMacro(t){return this.macros.has(t)?this.expandTokens([new da(t)]):void 0}expandTokens(t){var n=[],a=this.stack.length;for(this.pushTokens(t);this.stack.length>a;)if(this.expandOnce(!0)===!1){var l=this.stack.pop();l.treatAsRelax&&(l.noexpand=!1,l.treatAsRelax=!1),n.push(l)}return this.countExpansion(n.length),n}expandMacroAsText(t){var n=this.expandMacro(t);return n&&n.map(a=>a.text).join("")}_getExpansion(t){var n=this.macros.get(t);if(n==null)return n;if(t.length===1){var a=this.lexer.catcodes[t];if(a!=null&&a!==13)return}var l=typeof n=="function"?n(this):n;if(typeof l=="string"){var o=0;if(l.indexOf("#")!==-1)for(var c=l.replace(/##/g,"");c.indexOf("#"+(o+1))!==-1;)++o;for(var d=new a5(l,this.settings),m=[],f=d.lex();f.text!=="EOF";)m.push(f),f=d.lex();m.reverse();var p={tokens:m,numArgs:o};return p}return l}isDefined(t){return this.macros.has(t)||jl.hasOwnProperty(t)||yn.math.hasOwnProperty(t)||yn.text.hasOwnProperty(t)||aN.hasOwnProperty(t)}isExpandable(t){var n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:jl.hasOwnProperty(t)&&!jl[t].primitive}}var i5=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,B0=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),mx={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},o5={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Jm{constructor(t,n){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new cH(t,n,this.mode),this.settings=n,this.leftrightDepth=0}expect(t,n){if(n===void 0&&(n=!0),this.fetch().text!==t)throw new Ae("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t}finally{this.gullet.endGroups()}}subparse(t){var n=this.nextToken;this.consume(),this.gullet.pushToken(new da("}")),this.gullet.pushTokens(t);var a=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,a}parseExpression(t,n){for(var a=[];;){this.mode==="math"&&this.consumeSpaces();var l=this.fetch();if(Jm.endOfExpression.indexOf(l.text)!==-1||n&&l.text===n||t&&jl[l.text]&&jl[l.text].infix)break;var o=this.parseAtom(n);if(o){if(o.type==="internal")continue}else break;a.push(o)}return this.mode==="text"&&this.formLigatures(a),this.handleInfixNodes(a)}handleInfixNodes(t){for(var n=-1,a,l=0;l=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',t);var d=yn[this.mode][n].group,m=Ur.range(t),f;if(QI.hasOwnProperty(d)){var p=d;f={type:"atom",mode:this.mode,family:p,loc:m,text:n}}else f={type:d,mode:this.mode,loc:m,text:n};c=f}else if(n.charCodeAt(0)>=128)this.settings.strict&&(h8(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),t)),c={type:"textord",mode:"text",loc:Ur.range(t),text:n};else return null;if(this.consume(),o)for(var x=0;xf&&(f=p):p&&(f!==void 0&&f>-1&&m.push(` +`.repeat(f)||" "),f=-1,m.push(p))}return m.join("")}function dN(e,t,n){return e.type==="element"?IH(e,t,n):e.type==="text"?n.whitespace==="normal"?mN(e,n):qH(e):[]}function IH(e,t,n){const a=hN(e,n),l=e.children||[];let o=-1,c=[];if(PH(e))return c;let d,m;for(a1(e)||g5(e)&&h5(t,e,g5)?m=` +`:BH(e)?(d=2,m=2):uN(e)&&(d=1,m=1);++o{try{o(!0);const je=await QH({page:c,page_size:p,search:y||void 0,is_registered:N==="all"?void 0:N==="registered",is_banned:S==="all"?void 0:S==="banned",format:M==="all"?void 0:M,sort_by:"usage_count",sort_order:"desc"});t(je.data),f(je.total)}catch(je){const Ze=je instanceof Error?je.message:"加载表情包列表失败";re({title:"错误",description:Ze,variant:"destructive"})}finally{o(!1)}},[c,p,y,N,S,M,re]),E=async()=>{try{const je=await tU();a(je.data)}catch(je){console.error("加载统计数据失败:",je)}};w.useEffect(()=>{ge()},[ge]),w.useEffect(()=>{E()},[]);const we=async je=>{try{const Ze=await ZH(je.id);B(Ze.data),L(!0)}catch(Ze){const qe=Ze instanceof Error?Ze.message:"加载详情失败";re({title:"错误",description:qe,variant:"destructive"})}},Z=je=>{B(je),U(!0)},z=je=>{B(je),G(!0)},X=async()=>{if(R)try{await eU(R.id),re({title:"成功",description:"表情包已删除"}),G(!1),B(null),ge(),E()}catch(je){const Ze=je instanceof Error?je.message:"删除失败";re({title:"错误",description:Ze,variant:"destructive"})}},q=async je=>{try{await nU(je.id),re({title:"成功",description:"表情包已注册"}),ge(),E()}catch(Ze){const qe=Ze instanceof Error?Ze.message:"注册失败";re({title:"错误",description:qe,variant:"destructive"})}},ce=async je=>{try{await rU(je.id),re({title:"成功",description:"表情包已封禁"}),ge(),E()}catch(Ze){const qe=Ze instanceof Error?Ze.message:"封禁失败";re({title:"错误",description:qe,variant:"destructive"})}},fe=je=>{const Ze=new Set(ee);Ze.has(je)?Ze.delete(je):Ze.add(je),Ne(Ze)},De=()=>{ee.size===e.length&&e.length>0?Ne(new Set):Ne(new Set(e.map(je=>je.id)))},oe=async()=>{try{const je=await aU(Array.from(ee));re({title:"批量删除完成",description:je.message}),Ne(new Set),se(!1),ge(),E()}catch(je){re({title:"批量删除失败",description:je instanceof Error?je.message:"批量删除失败",variant:"destructive"})}},He=()=>{const je=parseInt(H),Ze=Math.ceil(m/p);je>=1&&je<=Ze?(d(je),le("")):re({title:"无效的页码",description:`请输入1-${Ze}之间的页码`,variant:"destructive"})},at=n?.formats?Object.keys(n.formats):[];return r.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[r.jsxs("div",{className:"mb-4 sm:mb-6",children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),r.jsx(an,{className:"flex-1",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&r.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[r.jsx(ct,{children:r.jsxs(Lt,{className:"pb-2",children:[r.jsx(Qn,{children:"总数"}),r.jsx(Bt,{className:"text-2xl",children:n.total})]})}),r.jsx(ct,{children:r.jsxs(Lt,{className:"pb-2",children:[r.jsx(Qn,{children:"已注册"}),r.jsx(Bt,{className:"text-2xl text-green-600",children:n.registered})]})}),r.jsx(ct,{children:r.jsxs(Lt,{className:"pb-2",children:[r.jsx(Qn,{children:"已封禁"}),r.jsx(Bt,{className:"text-2xl text-red-600",children:n.banned})]})}),r.jsx(ct,{children:r.jsxs(Lt,{className:"pb-2",children:[r.jsx(Qn,{children:"未注册"}),r.jsx(Bt,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),r.jsxs(ct,{children:[r.jsx(Lt,{children:r.jsxs(Bt,{className:"flex items-center gap-2",children:[r.jsx(Sx,{className:"h-5 w-5"}),"搜索和筛选"]})}),r.jsxs(Gt,{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{children:"搜索"}),r.jsxs("div",{className:"relative",children:[r.jsx(Yr,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{placeholder:"描述或哈希值...",value:y,onChange:je=>{b(je.target.value),d(1)},className:"pl-8"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{children:"注册状态"}),r.jsxs(_t,{value:N,onValueChange:je=>{k(je),d(1)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"all",children:"全部"}),r.jsx(Oe,{value:"registered",children:"已注册"}),r.jsx(Oe,{value:"unregistered",children:"未注册"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{children:"封禁状态"}),r.jsxs(_t,{value:S,onValueChange:je=>{T(je),d(1)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"all",children:"全部"}),r.jsx(Oe,{value:"banned",children:"已封禁"}),r.jsx(Oe,{value:"unbanned",children:"未封禁"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{children:"格式"}),r.jsxs(_t,{value:M,onValueChange:je=>{A(je),d(1)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"all",children:"全部"}),at.map(je=>r.jsxs(Oe,{value:je,children:[je.toUpperCase()," (",n?.formats[je],")"]},je))]})]})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[r.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:ee.size>0&&r.jsxs("span",{children:["已选择 ",ee.size," 个表情包"]})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),r.jsxs(_t,{value:p.toString(),onValueChange:je=>{x(parseInt(je)),d(1),Ne(new Set)},children:[r.jsx(jt,{id:"emoji-page-size",className:"w-20",children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"10",children:"10"}),r.jsx(Oe,{value:"20",children:"20"}),r.jsx(Oe,{value:"50",children:"50"}),r.jsx(Oe,{value:"100",children:"100"})]})]}),ee.size>0&&r.jsxs(r.Fragment,{children:[r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>Ne(new Set),children:"取消选择"}),r.jsxs(ne,{variant:"destructive",size:"sm",onClick:()=>se(!0),children:[r.jsx(zt,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),r.jsx("div",{className:"flex justify-end pt-4 border-t",children:r.jsxs(ne,{variant:"outline",size:"sm",onClick:ge,disabled:l,children:[r.jsx(Ia,{className:`h-4 w-4 mr-2 ${l?"animate-spin":""}`}),"刷新"]})})]})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"表情包列表"}),r.jsxs(Qn,{children:["共 ",m," 个表情包,当前第 ",c," 页"]})]}),r.jsxs(Gt,{children:[r.jsx("div",{className:"hidden md:block rounded-md border overflow-hidden",children:r.jsxs(ji,{children:[r.jsx(Ni,{children:r.jsxs(Vn,{children:[r.jsx(ut,{className:"w-12",children:r.jsx(jr,{checked:e.length>0&&ee.size===e.length,onCheckedChange:De,"aria-label":"全选"})}),r.jsx(ut,{className:"w-16",children:"预览"}),r.jsx(ut,{children:"描述"}),r.jsx(ut,{children:"格式"}),r.jsx(ut,{children:"情绪标签"}),r.jsx(ut,{className:"text-center",children:"状态"}),r.jsx(ut,{className:"text-right",children:"使用次数"}),r.jsx(ut,{className:"text-right",children:"操作"})]})}),r.jsx(Si,{children:e.length===0?r.jsx(Vn,{children:r.jsx(et,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):e.map(je=>r.jsxs(Vn,{children:[r.jsx(et,{children:r.jsx(jr,{checked:ee.has(je.id),onCheckedChange:()=>fe(je.id),"aria-label":`选择 ${je.description}`})}),r.jsx(et,{children:r.jsx("div",{className:"w-20 h-20 bg-muted rounded flex items-center justify-center overflow-hidden",children:r.jsx("img",{src:s1(je.id),alt:je.description||"表情包",className:"w-full h-full object-cover",onError:Ze=>{const qe=Ze.target;qe.style.display="none";const Ot=qe.parentElement;Ot&&(Ot.innerHTML='')}})})}),r.jsx(et,{children:r.jsxs("div",{className:"space-y-1 max-w-xs",children:[r.jsx("div",{className:"font-medium truncate",title:je.description||"无描述",children:je.description||"无描述"}),r.jsxs("div",{className:"text-xs text-muted-foreground font-mono",children:[je.emoji_hash.slice(0,16),"..."]})]})}),r.jsx(et,{children:r.jsx(un,{variant:"outline",children:je.format.toUpperCase()})}),r.jsx(et,{children:r.jsx(v5,{emotions:je.emotion})}),r.jsx(et,{className:"align-middle",children:r.jsxs("div",{className:"flex gap-2 justify-center",children:[je.is_registered&&r.jsxs(un,{variant:"default",className:"bg-green-600",children:[r.jsx($r,{className:"h-3 w-3 mr-1"}),"已注册"]}),je.is_banned&&r.jsxs(un,{variant:"destructive",children:[r.jsx(bx,{className:"h-3 w-3 mr-1"}),"已封禁"]})]})}),r.jsx(et,{className:"text-right font-mono",children:je.usage_count}),r.jsx(et,{children:r.jsxs("div",{className:"flex items-center justify-end gap-1 flex-wrap",children:[r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>we(je),children:[r.jsx(pi,{className:"h-4 w-4 mr-1"}),"详情"]}),r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>Z(je),children:[r.jsx(Po,{className:"h-4 w-4 mr-1"}),"编辑"]}),!je.is_registered&&r.jsxs(ne,{size:"sm",onClick:()=>q(je),className:"bg-green-600 hover:bg-green-700 text-white",children:[r.jsx($r,{className:"h-4 w-4 mr-1"}),"注册"]}),!je.is_banned&&r.jsxs(ne,{size:"sm",onClick:()=>ce(je),className:"bg-orange-600 hover:bg-orange-700 text-white",children:[r.jsx(Gy,{className:"h-4 w-4 mr-1"}),"封禁"]}),r.jsxs(ne,{size:"sm",onClick:()=>z(je),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(zt,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},je.id))})]})}),r.jsx("div",{className:"md:hidden space-y-3",children:e.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):e.map(je=>r.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-16 h-16 bg-muted rounded flex items-center justify-center overflow-hidden",children:r.jsx("img",{src:s1(je.id),alt:je.description||"表情包",className:"w-full h-full object-cover",onError:Ze=>{const qe=Ze.target;qe.style.display="none";const Ot=qe.parentElement;Ot&&(Ot.innerHTML='')}})})}),r.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[r.jsxs("div",{className:"min-w-0 w-full overflow-hidden",children:[r.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",title:je.description||"无描述",children:je.description||"无描述"}),r.jsxs("p",{className:"text-xs text-muted-foreground font-mono line-clamp-1 w-full break-all",children:[je.emoji_hash.slice(0,16),"..."]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 items-center min-w-0",children:[r.jsx(un,{variant:"outline",className:"text-xs flex-shrink-0",children:je.format.toUpperCase()}),je.is_registered&&r.jsxs(un,{variant:"default",className:"bg-green-600 text-xs flex-shrink-0",children:[r.jsx($r,{className:"h-3 w-3 mr-1"}),"已注册"]}),je.is_banned&&r.jsxs(un,{variant:"destructive",className:"text-xs flex-shrink-0",children:[r.jsx(bx,{className:"h-3 w-3 mr-1"}),"已封禁"]}),r.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:["使用: ",je.usage_count]})]}),je.emotion&&je.emotion.length>0&&r.jsx("div",{className:"min-w-0 overflow-hidden",children:r.jsx(v5,{emotions:je.emotion})})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>we(je),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[r.jsx(pi,{className:"h-3 w-3 mr-1"}),"详情"]}),r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>Z(je),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[r.jsx(Po,{className:"h-3 w-3 mr-1"}),"编辑"]}),!je.is_registered&&r.jsxs(ne,{size:"sm",onClick:()=>q(je),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-green-600 hover:bg-green-700 text-white",children:[r.jsx($r,{className:"h-3 w-3 mr-1"}),"注册"]}),!je.is_banned&&r.jsxs(ne,{size:"sm",onClick:()=>ce(je),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-orange-600 hover:bg-orange-700 text-white",children:[r.jsx(Gy,{className:"h-3 w-3 mr-1"}),"封禁"]}),r.jsxs(ne,{size:"sm",onClick:()=>z(je),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(zt,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},je.id))}),m>0&&r.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(c-1)*p+1," 到"," ",Math.min(c*p,m)," 条,共 ",m," 条"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>d(1),disabled:c===1,className:"hidden sm:flex",children:r.jsx(Du,{className:"h-4 w-4"})}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>d(je=>Math.max(1,je-1)),disabled:c===1,children:[r.jsx(bi,{className:"h-4 w-4 sm:mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te,{type:"number",value:H,onChange:je=>le(je.target.value),onKeyDown:je=>je.key==="Enter"&&He(),placeholder:c.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(m/p)}),r.jsx(ne,{variant:"outline",size:"sm",onClick:He,disabled:!H,className:"h-8",children:"跳转"})]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>d(je=>je+1),disabled:c>=Math.ceil(m/p),children:[r.jsx("span",{className:"hidden sm:inline",children:"下一页"}),r.jsx(wi,{className:"h-4 w-4 sm:ml-1"})]}),r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>d(Math.ceil(m/p)),disabled:c>=Math.ceil(m/p),className:"hidden sm:flex",children:r.jsx(zu,{className:"h-4 w-4"})})]})]})]})]}),r.jsx(lU,{emoji:R,open:O,onOpenChange:L}),r.jsx(iU,{emoji:R,open:$,onOpenChange:U,onSuccess:()=>{ge(),E()}})]})}),r.jsx(en,{open:J,onOpenChange:se,children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认批量删除"}),r.jsxs(Qt,{children:["你确定要删除选中的 ",ee.size," 个表情包吗?此操作不可撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:oe,children:"确认删除"})]})]})}),r.jsx(ir,{open:I,onOpenChange:G,children:r.jsxs(Jn,{children:[r.jsxs(er,{children:[r.jsx(tr,{children:"确认删除"}),r.jsx(xr,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>G(!1),children:"取消"}),r.jsx(ne,{variant:"destructive",onClick:X,children:"删除"})]})]})})]})}function lU({emoji:e,open:t,onOpenChange:n}){if(!e)return null;const a=l=>l?new Date(l*1e3).toLocaleString("zh-CN"):"-";return r.jsx(ir,{open:t,onOpenChange:n,children:r.jsxs(Jn,{className:"max-w-2xl max-h-[90vh]",children:[r.jsx(er,{children:r.jsx(tr,{children:"表情包详情"})}),r.jsx(an,{className:"max-h-[calc(90vh-8rem)] pr-4",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex justify-center",children:r.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:r.jsx("img",{src:s1(e.id),alt:e.description||"表情包",className:"w-full h-full object-cover",onError:l=>{const o=l.target;o.style.display="none";const c=o.parentElement;c&&(c.innerHTML='')}})})}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"ID"}),r.jsx("div",{className:"mt-1 font-mono",children:e.id})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"格式"}),r.jsx("div",{className:"mt-1",children:r.jsx(un,{variant:"outline",children:e.format.toUpperCase()})})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"文件路径"}),r.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:e.full_path})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"哈希值"}),r.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:e.emoji_hash})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"描述"}),e.description?r.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:r.jsx(KH,{className:"prose-sm",children:e.description})}):r.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"情绪标签"}),r.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:(()=>{const l=e.emotion?e.emotion.split(/[,,]/).map(o=>o.trim()).filter(Boolean):[];return l.length>0?l.map((o,c)=>r.jsx(un,{variant:"secondary",children:o},c)):r.jsx("span",{className:"text-sm text-muted-foreground",children:"无"})})()})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"状态"}),r.jsxs("div",{className:"mt-2 flex gap-2",children:[e.is_registered&&r.jsx(un,{variant:"default",className:"bg-green-600",children:"已注册"}),e.is_banned&&r.jsx(un,{variant:"destructive",children:"已封禁"}),!e.is_registered&&!e.is_banned&&r.jsx(un,{variant:"outline",children:"未注册"})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"使用次数"}),r.jsx("div",{className:"mt-1 font-mono text-lg",children:e.usage_count})]})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"记录时间"}),r.jsx("div",{className:"mt-1 text-sm",children:a(e.record_time)})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"注册时间"}),r.jsx("div",{className:"mt-1 text-sm",children:a(e.register_time)})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"最后使用"}),r.jsx("div",{className:"mt-1 text-sm",children:a(e.last_used_time)})]})]})})]})})}function iU({emoji:e,open:t,onOpenChange:n,onSuccess:a}){const[l,o]=w.useState(""),[c,d]=w.useState(""),[m,f]=w.useState(!1),[p,x]=w.useState(!1),[y,b]=w.useState(!1),{toast:N}=or();w.useEffect(()=>{e&&(o(e.description||""),d(e.emotion||""),f(e.is_registered),x(e.is_banned))},[e]);const k=async()=>{if(e)try{b(!0);const S=c.split(/[,,]/).map(T=>T.trim()).filter(Boolean).join(",");await JH(e.id,{description:l||void 0,emotion:S||void 0,is_registered:m,is_banned:p}),N({title:"成功",description:"表情包信息已更新"}),n(!1),a()}catch(S){const T=S instanceof Error?S.message:"保存失败";N({title:"错误",description:T,variant:"destructive"})}finally{b(!1)}};return e?r.jsx(ir,{open:t,onOpenChange:n,children:r.jsxs(Jn,{className:"max-w-2xl",children:[r.jsxs(er,{children:[r.jsx(tr,{children:"编辑表情包"}),r.jsx(xr,{children:"修改表情包的描述和标签信息"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Q,{children:"描述"}),r.jsx(fn,{value:l,onChange:S=>o(S.target.value),placeholder:"输入表情包描述...",rows:3,className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx(Q,{children:"情绪标签"}),r.jsx(Te,{value:c,onChange:S=>d(S.target.value),placeholder:"使用逗号分隔多个标签,如:开心, 微笑, 快乐",className:"mt-1"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入多个标签时使用逗号分隔(支持中英文逗号)"})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(jr,{id:"is_registered",checked:m,onCheckedChange:S=>f(S===!0)}),r.jsx(Q,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(jr,{id:"is_banned",checked:p,onCheckedChange:S=>x(S===!0)}),r.jsx(Q,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>n(!1),children:"取消"}),r.jsx(ne,{onClick:k,disabled:y,children:y?"保存中...":"保存"})]})]})}):null}function v5({emotions:e}){const t=e?e.split(/[,,]/).map(o=>o.trim()).filter(Boolean):[];if(t.length===0)return r.jsx("span",{className:"text-xs text-muted-foreground",children:"-"});const n=(o,c=6)=>o.length<=c?o:o.slice(0,c)+"...",a=t.slice(0,3),l=t.length-3;return r.jsxs("div",{className:"flex flex-wrap gap-1 max-w-full overflow-hidden",children:[a.map((o,c)=>r.jsx(un,{variant:"secondary",className:"text-xs flex-shrink-0",title:o,children:n(o)},c)),l>0&&r.jsxs(un,{variant:"outline",className:"text-xs flex-shrink-0",title:`还有 ${l} 个标签: ${t.slice(3).join(", ")}`,children:["+",l]})]})}const _i="/api/webui/expression";async function oU(e){const t=new URLSearchParams;e.page&&t.append("page",e.page.toString()),e.page_size&&t.append("page_size",e.page_size.toString()),e.search&&t.append("search",e.search),e.chat_id&&t.append("chat_id",e.chat_id);const n=await lt(`${_i}/list?${t}`,{headers:pt()});if(!n.ok){const a=await n.json();throw new Error(a.detail||"获取表达方式列表失败")}return n.json()}async function cU(e){const t=await lt(`${_i}/${e}`,{headers:pt()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"获取表达方式详情失败")}return t.json()}async function uU(e){const t=await lt(`${_i}/`,{method:"POST",headers:pt(),body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.detail||"创建表达方式失败")}return t.json()}async function dU(e,t){const n=await lt(`${_i}/${e}`,{method:"PATCH",headers:pt(),body:JSON.stringify(t)});if(!n.ok){const a=await n.json();throw new Error(a.detail||"更新表达方式失败")}return n.json()}async function mU(e){const t=await lt(`${_i}/${e}`,{method:"DELETE",headers:pt()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"删除表达方式失败")}return t.json()}async function hU(e){const t=await lt(`${_i}/batch/delete`,{method:"POST",headers:pt(),body:JSON.stringify({ids:e})});if(!t.ok){const n=await t.json();throw new Error(n.detail||"批量删除表达方式失败")}return t.json()}async function fU(){const e=await lt(`${_i}/stats/summary`,{headers:pt()});if(!e.ok){const t=await e.json();throw new Error(t.detail||"获取统计数据失败")}return e.json()}function pU(){const[e,t]=w.useState([]),[n,a]=w.useState(!0),[l,o]=w.useState(0),[c,d]=w.useState(1),[m,f]=w.useState(20),[p,x]=w.useState(""),[y,b]=w.useState(null),[N,k]=w.useState(!1),[S,T]=w.useState(!1),[M,A]=w.useState(!1),[R,B]=w.useState(null),[O,L]=w.useState(new Set),[$,U]=w.useState(!1),[I,G]=w.useState(""),[ee,Ne]=w.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),{toast:J}=or(),se=async()=>{try{a(!0);const q=await oU({page:c,page_size:m,search:p||void 0});t(q.data),o(q.total)}catch(q){J({title:"加载失败",description:q instanceof Error?q.message:"无法加载表达方式",variant:"destructive"})}finally{a(!1)}},H=async()=>{try{const q=await fU();Ne(q.data)}catch(q){console.error("加载统计数据失败:",q)}};w.useEffect(()=>{se(),H()},[c,m,p]);const le=async q=>{try{const ce=await cU(q.id);b(ce.data),k(!0)}catch(ce){J({title:"加载详情失败",description:ce instanceof Error?ce.message:"无法加载表达方式详情",variant:"destructive"})}},re=q=>{b(q),T(!0)},ge=async q=>{try{await mU(q.id),J({title:"删除成功",description:`已删除表达方式: ${q.situation}`}),B(null),se(),H()}catch(ce){J({title:"删除失败",description:ce instanceof Error?ce.message:"无法删除表达方式",variant:"destructive"})}},E=q=>{const ce=new Set(O);ce.has(q)?ce.delete(q):ce.add(q),L(ce)},we=()=>{O.size===e.length&&e.length>0?L(new Set):L(new Set(e.map(q=>q.id)))},Z=async()=>{try{await hU(Array.from(O)),J({title:"批量删除成功",description:`已删除 ${O.size} 个表达方式`}),L(new Set),U(!1),se(),H()}catch(q){J({title:"批量删除失败",description:q instanceof Error?q.message:"无法批量删除表达方式",variant:"destructive"})}},z=()=>{const q=parseInt(I),ce=Math.ceil(l/m);q>=1&&q<=ce?(d(q),G("")):J({title:"无效的页码",description:`请输入1-${ce}之间的页码`,variant:"destructive"})},X=q=>q?new Date(q*1e3).toLocaleString("zh-CN"):"-";return r.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[r.jsx("div",{className:"mb-4 sm:mb-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[r.jsx(Mu,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),r.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),r.jsxs(ne,{onClick:()=>A(!0),className:"gap-2",children:[r.jsx(pr,{className:"h-4 w-4"}),"新增表达方式"]})]})}),r.jsx(an,{className:"flex-1",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),r.jsx("div",{className:"text-2xl font-bold mt-1",children:ee.total})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),r.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:ee.recent_7days})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),r.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:ee.chat_count})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx(Q,{htmlFor:"search",children:"搜索"}),r.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:r.jsxs("div",{className:"flex-1 relative",children:[r.jsx(Yr,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{id:"search",placeholder:"搜索情境、风格或上下文...",value:p,onChange:q=>x(q.target.value),className:"pl-9"})]})}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[r.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:O.size>0&&r.jsxs("span",{children:["已选择 ",O.size," 个表达方式"]})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),r.jsxs(_t,{value:m.toString(),onValueChange:q=>{f(parseInt(q)),d(1),L(new Set)},children:[r.jsx(jt,{id:"page-size",className:"w-20",children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"10",children:"10"}),r.jsx(Oe,{value:"20",children:"20"}),r.jsx(Oe,{value:"50",children:"50"}),r.jsx(Oe,{value:"100",children:"100"})]})]}),O.size>0&&r.jsxs(r.Fragment,{children:[r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>L(new Set),children:"取消选择"}),r.jsxs(ne,{variant:"destructive",size:"sm",onClick:()=>U(!0),children:[r.jsx(zt,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card",children:[r.jsx("div",{className:"hidden md:block",children:r.jsxs(ji,{children:[r.jsx(Ni,{children:r.jsxs(Vn,{children:[r.jsx(ut,{className:"w-12",children:r.jsx(jr,{checked:O.size===e.length&&e.length>0,onCheckedChange:we})}),r.jsx(ut,{children:"情境"}),r.jsx(ut,{children:"风格"}),r.jsx(ut,{children:"聊天ID"}),r.jsx(ut,{children:"最后活跃"}),r.jsx(ut,{className:"text-right",children:"操作"})]})}),r.jsx(Si,{children:n?r.jsx(Vn,{children:r.jsx(et,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):e.length===0?r.jsx(Vn,{children:r.jsx(et,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):e.map(q=>r.jsxs(Vn,{children:[r.jsx(et,{children:r.jsx(jr,{checked:O.has(q.id),onCheckedChange:()=>E(q.id)})}),r.jsx(et,{className:"font-medium max-w-xs truncate",children:q.situation}),r.jsx(et,{className:"max-w-xs truncate",children:q.style}),r.jsx(et,{className:"font-mono text-sm",children:q.chat_id}),r.jsx(et,{className:"text-sm text-muted-foreground",children:X(q.last_active_time)}),r.jsx(et,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>le(q),children:[r.jsx(Ha,{className:"h-4 w-4 mr-1"}),"详情"]}),r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>re(q),children:[r.jsx(Po,{className:"h-4 w-4 mr-1"}),"编辑"]}),r.jsxs(ne,{size:"sm",onClick:()=>B(q),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(zt,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},q.id))})]})}),r.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):e.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):e.map(q=>r.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(jr,{checked:O.has(q.id),onCheckedChange:()=>E(q.id),className:"mt-1"}),r.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),r.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:q.situation,children:q.situation})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),r.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:q.style,children:q.style})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天ID"}),r.jsx("p",{className:"font-mono text-xs truncate",children:q.chat_id})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后活跃"}),r.jsx("p",{className:"text-xs",children:X(q.last_active_time)})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>le(q),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[r.jsx(Ha,{className:"h-3 w-3 mr-1"}),"查看"]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>re(q),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[r.jsx(Po,{className:"h-3 w-3 mr-1"}),"编辑"]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>B(q),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[r.jsx(zt,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},q.id))}),l>0&&r.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",l," 条记录,第 ",c," / ",Math.ceil(l/m)," 页"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>d(1),disabled:c===1,className:"hidden sm:flex",children:r.jsx(Du,{className:"h-4 w-4"})}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>d(c-1),disabled:c===1,children:[r.jsx(bi,{className:"h-4 w-4 sm:mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te,{type:"number",value:I,onChange:q=>G(q.target.value),onKeyDown:q=>q.key==="Enter"&&z(),placeholder:c.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(l/m)}),r.jsx(ne,{variant:"outline",size:"sm",onClick:z,disabled:!I,className:"h-8",children:"跳转"})]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>d(c+1),disabled:c>=Math.ceil(l/m),children:[r.jsx("span",{className:"hidden sm:inline",children:"下一页"}),r.jsx(wi,{className:"h-4 w-4 sm:ml-1"})]}),r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>d(Math.ceil(l/m)),disabled:c>=Math.ceil(l/m),className:"hidden sm:flex",children:r.jsx(zu,{className:"h-4 w-4"})})]})]})]})]})}),r.jsx(xU,{expression:y,open:N,onOpenChange:k}),r.jsx(gU,{open:M,onOpenChange:A,onSuccess:()=>{se(),H(),A(!1)}}),r.jsx(vU,{expression:y,open:S,onOpenChange:T,onSuccess:()=>{se(),H(),T(!1)}}),r.jsx(en,{open:!!R,onOpenChange:()=>B(null),children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:['确定要删除表达方式 "',R?.situation,'" 吗? 此操作不可撤销。']})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>R&&ge(R),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),r.jsx(yU,{open:$,onOpenChange:U,onConfirm:Z,count:O.size})]})}function xU({expression:e,open:t,onOpenChange:n}){if(!e)return null;const a=l=>l?new Date(l*1e3).toLocaleString("zh-CN"):"-";return r.jsx(ir,{open:t,onOpenChange:n,children:r.jsxs(Jn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(er,{children:[r.jsx(tr,{children:"表达方式详情"}),r.jsx(xr,{children:"查看表达方式的完整信息"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(jo,{label:"情境",value:e.situation}),r.jsx(jo,{label:"风格",value:e.style}),r.jsx(jo,{icon:tm,label:"聊天ID",value:e.chat_id,mono:!0}),r.jsx(jo,{icon:tm,label:"记录ID",value:e.id.toString(),mono:!0})]}),e.context&&r.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[r.jsx(Q,{className:"text-xs text-muted-foreground",children:"上下文"}),r.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:e.context})]}),e.up_content&&r.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[r.jsx(Q,{className:"text-xs text-muted-foreground",children:"上文内容"}),r.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:e.up_content})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(jo,{icon:di,label:"最后活跃",value:a(e.last_active_time)}),r.jsx(jo,{icon:di,label:"创建时间",value:a(e.create_date)})]})]}),r.jsx(Er,{children:r.jsx(ne,{onClick:()=>n(!1),children:"关闭"})})]})})}function jo({icon:e,label:t,value:n,mono:a=!1}){return r.jsxs("div",{className:"space-y-1",children:[r.jsxs(Q,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e&&r.jsx(e,{className:"h-3 w-3"}),t]}),r.jsx("div",{className:he("text-sm",a&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function gU({open:e,onOpenChange:t,onSuccess:n}){const[a,l]=w.useState({situation:"",style:"",context:"",up_content:"",chat_id:""}),[o,c]=w.useState(!1),{toast:d}=or(),m=async()=>{if(!a.situation||!a.style||!a.chat_id){d({title:"验证失败",description:"请填写必填字段:情境、风格和聊天ID",variant:"destructive"});return}try{c(!0),await uU(a),d({title:"创建成功",description:"表达方式已创建"}),l({situation:"",style:"",context:"",up_content:"",chat_id:""}),n()}catch(f){d({title:"创建失败",description:f instanceof Error?f.message:"无法创建表达方式",variant:"destructive"})}finally{c(!1)}};return r.jsx(ir,{open:e,onOpenChange:t,children:r.jsxs(Jn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(er,{children:[r.jsx(tr,{children:"新增表达方式"}),r.jsx(xr,{children:"创建新的表达方式记录"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Q,{htmlFor:"situation",children:["情境 ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsx(Te,{id:"situation",value:a.situation,onChange:f=>l({...a,situation:f.target.value}),placeholder:"描述使用场景"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Q,{htmlFor:"style",children:["风格 ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsx(Te,{id:"style",value:a.style,onChange:f=>l({...a,style:f.target.value}),placeholder:"描述表达风格"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Q,{htmlFor:"chat_id",children:["聊天ID ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsx(Te,{id:"chat_id",value:a.chat_id,onChange:f=>l({...a,chat_id:f.target.value}),placeholder:"关联的聊天ID"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"context",children:"上下文"}),r.jsx(fn,{id:"context",value:a.context,onChange:f=>l({...a,context:f.target.value}),placeholder:"上下文信息(可选)",rows:3})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"up_content",children:"上文内容"}),r.jsx(fn,{id:"up_content",value:a.up_content,onChange:f=>l({...a,up_content:f.target.value}),placeholder:"上文内容(可选)",rows:3})]})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>t(!1),children:"取消"}),r.jsx(ne,{onClick:m,disabled:o,children:o?"创建中...":"创建"})]})]})})}function vU({expression:e,open:t,onOpenChange:n,onSuccess:a}){const[l,o]=w.useState({}),[c,d]=w.useState(!1),{toast:m}=or();w.useEffect(()=>{e&&o({situation:e.situation,style:e.style,context:e.context||"",up_content:e.up_content||"",chat_id:e.chat_id})},[e]);const f=async()=>{if(e)try{d(!0),await dU(e.id,l),m({title:"保存成功",description:"表达方式已更新"}),a()}catch(p){m({title:"保存失败",description:p instanceof Error?p.message:"无法更新表达方式",variant:"destructive"})}finally{d(!1)}};return e?r.jsx(ir,{open:t,onOpenChange:n,children:r.jsxs(Jn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(er,{children:[r.jsx(tr,{children:"编辑表达方式"}),r.jsx(xr,{children:"修改表达方式的信息"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit_situation",children:"情境"}),r.jsx(Te,{id:"edit_situation",value:l.situation||"",onChange:p=>o({...l,situation:p.target.value}),placeholder:"描述使用场景"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit_style",children:"风格"}),r.jsx(Te,{id:"edit_style",value:l.style||"",onChange:p=>o({...l,style:p.target.value}),placeholder:"描述表达风格"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit_chat_id",children:"聊天ID"}),r.jsx(Te,{id:"edit_chat_id",value:l.chat_id||"",onChange:p=>o({...l,chat_id:p.target.value}),placeholder:"关联的聊天ID"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit_context",children:"上下文"}),r.jsx(fn,{id:"edit_context",value:l.context||"",onChange:p=>o({...l,context:p.target.value}),placeholder:"上下文信息",rows:3})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit_up_content",children:"上文内容"}),r.jsx(fn,{id:"edit_up_content",value:l.up_content||"",onChange:p=>o({...l,up_content:p.target.value}),placeholder:"上文内容",rows:3})]})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>n(!1),children:"取消"}),r.jsx(ne,{onClick:f,disabled:c,children:c?"保存中...":"保存"})]})]})}):null}function yU({open:e,onOpenChange:t,onConfirm:n,count:a}){return r.jsx(en,{open:e,onOpenChange:t,children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认批量删除"}),r.jsxs(Qt,{children:["您即将删除 ",a," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const rc="/api/webui/person";async function bU(e){const t=new URLSearchParams;e.page&&t.append("page",e.page.toString()),e.page_size&&t.append("page_size",e.page_size.toString()),e.search&&t.append("search",e.search),e.is_known!==void 0&&t.append("is_known",e.is_known.toString()),e.platform&&t.append("platform",e.platform);const n=await lt(`${rc}/list?${t}`,{headers:pt()});if(!n.ok){const a=await n.json();throw new Error(a.detail||"获取人物列表失败")}return n.json()}async function wU(e){const t=await lt(`${rc}/${e}`,{headers:pt()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"获取人物详情失败")}return t.json()}async function jU(e,t){const n=await lt(`${rc}/${e}`,{method:"PATCH",headers:pt(),body:JSON.stringify(t)});if(!n.ok){const a=await n.json();throw new Error(a.detail||"更新人物信息失败")}return n.json()}async function NU(e){const t=await lt(`${rc}/${e}`,{method:"DELETE",headers:pt()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"删除人物信息失败")}return t.json()}async function SU(){const e=await lt(`${rc}/stats/summary`,{headers:pt()});if(!e.ok){const t=await e.json();throw new Error(t.detail||"获取统计数据失败")}return e.json()}async function kU(e){const t=await lt(`${rc}/batch/delete`,{method:"POST",headers:pt(),body:JSON.stringify({person_ids:e})});if(!t.ok){const n=await t.json();throw new Error(n.detail||"批量删除失败")}return t.json()}function CU(){const[e,t]=w.useState([]),[n,a]=w.useState(!0),[l,o]=w.useState(0),[c,d]=w.useState(1),[m,f]=w.useState(20),[p,x]=w.useState(""),[y,b]=w.useState(void 0),[N,k]=w.useState(void 0),[S,T]=w.useState(null),[M,A]=w.useState(!1),[R,B]=w.useState(!1),[O,L]=w.useState(null),[$,U]=w.useState({total:0,known:0,unknown:0,platforms:{}}),[I,G]=w.useState(new Set),[ee,Ne]=w.useState(!1),[J,se]=w.useState(""),{toast:H}=or(),le=async()=>{try{a(!0);const oe=await bU({page:c,page_size:m,search:p||void 0,is_known:y,platform:N});t(oe.data),o(oe.total)}catch(oe){H({title:"加载失败",description:oe instanceof Error?oe.message:"无法加载人物信息",variant:"destructive"})}finally{a(!1)}},re=async()=>{try{const oe=await SU();U(oe.data)}catch(oe){console.error("加载统计数据失败:",oe)}};w.useEffect(()=>{le(),re()},[c,m,p,y,N]);const ge=async oe=>{try{const He=await wU(oe.person_id);T(He.data),A(!0)}catch(He){H({title:"加载详情失败",description:He instanceof Error?He.message:"无法加载人物详情",variant:"destructive"})}},E=oe=>{T(oe),B(!0)},we=async oe=>{try{await NU(oe.person_id),H({title:"删除成功",description:`已删除人物信息: ${oe.person_name||oe.nickname||oe.user_id}`}),L(null),le(),re()}catch(He){H({title:"删除失败",description:He instanceof Error?He.message:"无法删除人物信息",variant:"destructive"})}},Z=w.useMemo(()=>Object.keys($.platforms),[$.platforms]),z=oe=>{const He=new Set(I);He.has(oe)?He.delete(oe):He.add(oe),G(He)},X=()=>{I.size===e.length&&e.length>0?G(new Set):G(new Set(e.map(oe=>oe.person_id)))},q=()=>{if(I.size===0){H({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}Ne(!0)},ce=async()=>{try{const oe=await kU(Array.from(I));H({title:"批量删除完成",description:oe.message}),G(new Set),Ne(!1),le(),re()}catch(oe){H({title:"批量删除失败",description:oe instanceof Error?oe.message:"批量删除失败",variant:"destructive"})}},fe=()=>{const oe=parseInt(J),He=Math.ceil(l/m);oe>=1&&oe<=He?(d(oe),se("")):H({title:"无效的页码",description:`请输入1-${He}之间的页码`,variant:"destructive"})},De=oe=>oe?new Date(oe*1e3).toLocaleString("zh-CN"):"-";return r.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[r.jsx("div",{className:"mb-4 sm:mb-6",children:r.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:r.jsxs("div",{children:[r.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[r.jsx(TT,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),r.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),r.jsx(an,{className:"flex-1",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),r.jsx("div",{className:"text-2xl font-bold mt-1",children:$.total})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),r.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:$.known})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),r.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:$.unknown})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"sm:col-span-2",children:[r.jsx(Q,{htmlFor:"search",children:"搜索"}),r.jsxs("div",{className:"relative mt-1.5",children:[r.jsx(Yr,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:p,onChange:oe=>x(oe.target.value),className:"pl-9"})]})]}),r.jsxs("div",{children:[r.jsx(Q,{htmlFor:"filter-known",children:"认识状态"}),r.jsxs(_t,{value:y===void 0?"all":y.toString(),onValueChange:oe=>{b(oe==="all"?void 0:oe==="true"),d(1)},children:[r.jsx(jt,{id:"filter-known",className:"mt-1.5",children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"all",children:"全部"}),r.jsx(Oe,{value:"true",children:"已认识"}),r.jsx(Oe,{value:"false",children:"未认识"})]})]})]}),r.jsxs("div",{children:[r.jsx(Q,{htmlFor:"filter-platform",children:"平台"}),r.jsxs(_t,{value:N||"all",onValueChange:oe=>{k(oe==="all"?void 0:oe),d(1)},children:[r.jsx(jt,{id:"filter-platform",className:"mt-1.5",children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"all",children:"全部平台"}),Z.map(oe=>r.jsxs(Oe,{value:oe,children:[oe," (",$.platforms[oe],")"]},oe))]})]})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[r.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:I.size>0&&r.jsxs("span",{children:["已选择 ",I.size," 个人物"]})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),r.jsxs(_t,{value:m.toString(),onValueChange:oe=>{f(parseInt(oe)),d(1),G(new Set)},children:[r.jsx(jt,{id:"page-size",className:"w-20",children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"10",children:"10"}),r.jsx(Oe,{value:"20",children:"20"}),r.jsx(Oe,{value:"50",children:"50"}),r.jsx(Oe,{value:"100",children:"100"})]})]}),I.size>0&&r.jsxs(r.Fragment,{children:[r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>G(new Set),children:"取消选择"}),r.jsxs(ne,{variant:"destructive",size:"sm",onClick:q,children:[r.jsx(zt,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card",children:[r.jsx("div",{className:"hidden md:block",children:r.jsxs(ji,{children:[r.jsx(Ni,{children:r.jsxs(Vn,{children:[r.jsx(ut,{className:"w-12",children:r.jsx(jr,{checked:e.length>0&&I.size===e.length,onCheckedChange:X,"aria-label":"全选"})}),r.jsx(ut,{children:"状态"}),r.jsx(ut,{children:"名称"}),r.jsx(ut,{children:"昵称"}),r.jsx(ut,{children:"平台"}),r.jsx(ut,{children:"用户ID"}),r.jsx(ut,{children:"最后更新"}),r.jsx(ut,{className:"text-right",children:"操作"})]})}),r.jsx(Si,{children:n?r.jsx(Vn,{children:r.jsx(et,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):e.length===0?r.jsx(Vn,{children:r.jsx(et,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):e.map(oe=>r.jsxs(Vn,{children:[r.jsx(et,{children:r.jsx(jr,{checked:I.has(oe.person_id),onCheckedChange:()=>z(oe.person_id),"aria-label":`选择 ${oe.person_name||oe.nickname||oe.user_id}`})}),r.jsx(et,{children:r.jsx("div",{className:he("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",oe.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:oe.is_known?"已认识":"未认识"})}),r.jsx(et,{className:"font-medium",children:oe.person_name||r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(et,{children:oe.nickname||"-"}),r.jsx(et,{children:oe.platform}),r.jsx(et,{className:"font-mono text-sm",children:oe.user_id}),r.jsx(et,{className:"text-sm text-muted-foreground",children:De(oe.last_know)}),r.jsx(et,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>ge(oe),children:[r.jsx(Ha,{className:"h-4 w-4 mr-1"}),"详情"]}),r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>E(oe),children:[r.jsx(Po,{className:"h-4 w-4 mr-1"}),"编辑"]}),r.jsxs(ne,{size:"sm",onClick:()=>L(oe),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(zt,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},oe.id))})]})}),r.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):e.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):e.map(oe=>r.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(jr,{checked:I.has(oe.person_id),onCheckedChange:()=>z(oe.person_id),className:"mt-1"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:he("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",oe.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:oe.is_known?"已认识":"未认识"}),r.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:oe.person_name||r.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),oe.nickname&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",oe.nickname]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),r.jsx("p",{className:"font-medium text-xs",children:oe.platform})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),r.jsx("p",{className:"font-mono text-xs truncate",title:oe.user_id,children:oe.user_id})]}),r.jsxs("div",{className:"col-span-2",children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),r.jsx("p",{className:"text-xs",children:De(oe.last_know)})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>ge(oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[r.jsx(Ha,{className:"h-3 w-3 mr-1"}),"查看"]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>E(oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[r.jsx(Po,{className:"h-3 w-3 mr-1"}),"编辑"]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>L(oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[r.jsx(zt,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},oe.id))}),l>0&&r.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",l," 条记录,第 ",c," / ",Math.ceil(l/m)," 页"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>d(1),disabled:c===1,className:"hidden sm:flex",children:r.jsx(Du,{className:"h-4 w-4"})}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>d(c-1),disabled:c===1,children:[r.jsx(bi,{className:"h-4 w-4 sm:mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te,{type:"number",value:J,onChange:oe=>se(oe.target.value),onKeyDown:oe=>oe.key==="Enter"&&fe(),placeholder:c.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(l/m)}),r.jsx(ne,{variant:"outline",size:"sm",onClick:fe,disabled:!J,className:"h-8",children:"跳转"})]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>d(c+1),disabled:c>=Math.ceil(l/m),children:[r.jsx("span",{className:"hidden sm:inline",children:"下一页"}),r.jsx(wi,{className:"h-4 w-4 sm:ml-1"})]}),r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>d(Math.ceil(l/m)),disabled:c>=Math.ceil(l/m),className:"hidden sm:flex",children:r.jsx(zu,{className:"h-4 w-4"})})]})]})]})]})}),r.jsx(TU,{person:S,open:M,onOpenChange:A}),r.jsx(_U,{person:S,open:R,onOpenChange:B,onSuccess:()=>{le(),re(),B(!1)}}),r.jsx(en,{open:!!O,onOpenChange:()=>L(null),children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:['确定要删除人物信息 "',O?.person_name||O?.nickname||O?.user_id,'" 吗? 此操作不可撤销。']})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>O&&we(O),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),r.jsx(en,{open:ee,onOpenChange:Ne,children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认批量删除"}),r.jsxs(Qt,{children:["确定要删除选中的 ",I.size," 个人物信息吗? 此操作不可撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:ce,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function TU({person:e,open:t,onOpenChange:n}){if(!e)return null;const a=l=>l?new Date(l*1e3).toLocaleString("zh-CN"):"-";return r.jsx(ir,{open:t,onOpenChange:n,children:r.jsxs(Jn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(er,{children:[r.jsx(tr,{children:"人物详情"}),r.jsxs(xr,{children:["查看 ",e.person_name||e.nickname||e.user_id," 的完整信息"]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(As,{icon:l6,label:"人物名称",value:e.person_name}),r.jsx(As,{icon:Mu,label:"昵称",value:e.nickname}),r.jsx(As,{icon:tm,label:"用户ID",value:e.user_id,mono:!0}),r.jsx(As,{icon:tm,label:"人物ID",value:e.person_id,mono:!0}),r.jsx(As,{label:"平台",value:e.platform}),r.jsx(As,{label:"状态",value:e.is_known?"已认识":"未认识"})]}),e.name_reason&&r.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[r.jsx(Q,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),r.jsx("p",{className:"mt-1 text-sm",children:e.name_reason})]}),e.memory_points&&r.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[r.jsx(Q,{className:"text-xs text-muted-foreground",children:"个人印象"}),r.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:e.memory_points})]}),e.group_nick_name&&e.group_nick_name.length>0&&r.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[r.jsx(Q,{className:"text-xs text-muted-foreground",children:"群昵称"}),r.jsx("div",{className:"mt-2 space-y-1",children:e.group_nick_name.map((l,o)=>r.jsxs("div",{className:"text-sm flex items-center gap-2",children:[r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:l.group_id}),r.jsx("span",{children:"→"}),r.jsx("span",{children:l.group_nick_name})]},o))})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsx(As,{icon:di,label:"认识时间",value:a(e.know_times)}),r.jsx(As,{icon:di,label:"首次记录",value:a(e.know_since)}),r.jsx(As,{icon:di,label:"最后更新",value:a(e.last_know)})]})]}),r.jsx(Er,{children:r.jsx(ne,{onClick:()=>n(!1),children:"关闭"})})]})})}function As({icon:e,label:t,value:n,mono:a=!1}){return r.jsxs("div",{className:"space-y-1",children:[r.jsxs(Q,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e&&r.jsx(e,{className:"h-3 w-3"}),t]}),r.jsx("div",{className:he("text-sm",a&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function _U({person:e,open:t,onOpenChange:n,onSuccess:a}){const[l,o]=w.useState({}),[c,d]=w.useState(!1),{toast:m}=or();w.useEffect(()=>{e&&o({person_name:e.person_name||"",name_reason:e.name_reason||"",nickname:e.nickname||"",memory_points:e.memory_points||"",is_known:e.is_known})},[e]);const f=async()=>{if(e)try{d(!0),await jU(e.person_id,l),m({title:"保存成功",description:"人物信息已更新"}),a()}catch(p){m({title:"保存失败",description:p instanceof Error?p.message:"无法更新人物信息",variant:"destructive"})}finally{d(!1)}};return e?r.jsx(ir,{open:t,onOpenChange:n,children:r.jsxs(Jn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(er,{children:[r.jsx(tr,{children:"编辑人物信息"}),r.jsxs(xr,{children:["修改 ",e.person_name||e.nickname||e.user_id," 的信息"]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"person_name",children:"人物名称"}),r.jsx(Te,{id:"person_name",value:l.person_name||"",onChange:p=>o({...l,person_name:p.target.value}),placeholder:"为这个人设置一个名称"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"nickname",children:"昵称"}),r.jsx(Te,{id:"nickname",value:l.nickname||"",onChange:p=>o({...l,nickname:p.target.value}),placeholder:"昵称"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"name_reason",children:"名称设定原因"}),r.jsx(fn,{id:"name_reason",value:l.name_reason||"",onChange:p=>o({...l,name_reason:p.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"memory_points",children:"个人印象"}),r.jsx(fn,{id:"memory_points",value:l.memory_points||"",onChange:p=>o({...l,memory_points:p.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{children:[r.jsx(Q,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),r.jsx(vt,{id:"is_known",checked:l.is_known,onCheckedChange:p=>o({...l,is_known:p})})]})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>n(!1),children:"取消"}),r.jsx(ne,{onClick:f,disabled:c,children:c?"保存中...":"保存"})]})]})}):null}function EU(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}const MU={},su={};function ui(e,t){try{const a=(MU[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];return a in su?su[a]:y5(a,a.split(":"))}catch{if(e in su)return su[e];const n=e?.match(AU);return n?y5(e,n.slice(1)):NaN}}const AU=/([+-]\d\d):?(\d\d)?/;function y5(e,t){const n=+(t[0]||0),a=+(t[1]||0),l=+(t[2]||0)/60;return su[e]=n*60+a>0?n*60+a+l:n*60-a-l}class rs extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(ui(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),fN(this),l1(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new rs(...n,t):new rs(Date.now(),t)}withTimeZone(t){return new rs(+this,t)}getTimezoneOffset(){const t=-ui(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),l1(this),+this}[Symbol.for("constructDateFrom")](t){return new rs(+new Date(t),this.timeZone)}}const b5=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!b5.test(e))return;const t=e.replace(b5,"$1UTC");rs.prototype[t]&&(e.startsWith("get")?rs.prototype[e]=function(){return this.internal[t]()}:(rs.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),DU(this),+this},rs.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),l1(this),+this}))});function l1(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-ui(e.timeZone,e)*60))}function DU(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),fN(e)}function fN(e){const t=ui(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),a=new Date(+e);a.setUTCHours(a.getUTCHours()-1);const l=-new Date(+e).getTimezoneOffset(),o=-new Date(+a).getTimezoneOffset(),c=l-o,d=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();c&&d&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+c);const m=l-n;m&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+m);const f=new Date(+e);f.setUTCSeconds(0);const p=l>0?f.getSeconds():(f.getSeconds()-60)%60,x=Math.round(-(ui(e.timeZone,e)*60))%60;(x||p)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+x),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+x+p));const y=ui(e.timeZone,e),b=y>0?Math.floor(y):Math.ceil(y),k=-new Date(+e).getTimezoneOffset()-b,S=b!==n,T=k-m;if(S&&T){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+T);const M=ui(e.timeZone,e),A=M>0?Math.floor(M):Math.ceil(M),R=b-A;R&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+R),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+R))}}class vr extends rs{static tz(t,...n){return n.length?new vr(...n,t):new vr(Date.now(),t)}toISOString(){const[t,n,a]=this.tzComponents(),l=`${t}${n}:${a}`;return this.internal.toISOString().slice(0,-1)+l}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,a,l]=this.internal.toUTCString().split(" ");return`${t?.slice(0,-1)} ${a} ${n} ${l}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,a,l]=this.tzComponents();return`${t} GMT${n}${a}${l} (${EU(this.timeZone,this)})`}toLocaleString(t,n){return Date.prototype.toLocaleString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(t,n){return Date.prototype.toLocaleDateString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(t,n){return Date.prototype.toLocaleTimeString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),n=t>0?"-":"+",a=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),l=String(Math.abs(t)%60).padStart(2,"0");return[n,a,l]}withTimeZone(t){return new vr(+this,t)}[Symbol.for("constructDateFrom")](t){return new vr(+new Date(t),this.timeZone)}}const pN=6048e5,zU=864e5,w5=Symbol.for("constructDateFrom");function Gn(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&w5 in e?e[w5](t):e instanceof Date?new e.constructor(t):new Date(t)}function dn(e,t){return Gn(t||e,e)}function xN(e,t,n){const a=dn(e,n?.in);return isNaN(t)?Gn(e,NaN):(t&&a.setDate(a.getDate()+t),a)}function gN(e,t,n){const a=dn(e,n?.in);if(isNaN(t))return Gn(e,NaN);if(!t)return a;const l=a.getDate(),o=Gn(e,a.getTime());o.setMonth(a.getMonth()+t+1,0);const c=o.getDate();return l>=c?o:(a.setFullYear(o.getFullYear(),o.getMonth(),l),a)}let OU={};function Qu(){return OU}function Dl(e,t){const n=Qu(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,l=dn(e,t?.in),o=l.getDay(),c=(o=o.getTime()?a+1:n.getTime()>=d.getTime()?a:a-1}function j5(e){const t=dn(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Ei(e,...t){const n=Gn.bind(null,e||t.find(a=>typeof a=="object"));return t.map(n)}function ku(e,t){const n=dn(e,t?.in);return n.setHours(0,0,0,0),n}function yN(e,t,n){const[a,l]=Ei(n?.in,e,t),o=ku(a),c=ku(l),d=+o-j5(o),m=+c-j5(c);return Math.round((d-m)/zU)}function RU(e,t){const n=vN(e,t),a=Gn(e,0);return a.setFullYear(n,0,4),a.setHours(0,0,0,0),Su(a)}function LU(e,t,n){return xN(e,t*7,n)}function BU(e,t,n){return gN(e,t*12,n)}function PU(e,t){let n,a=t?.in;return e.forEach(l=>{!a&&typeof l=="object"&&(a=Gn.bind(null,l));const o=dn(l,a);(!n||n{!a&&typeof l=="object"&&(a=Gn.bind(null,l));const o=dn(l,a);(!n||n>o||isNaN(+o))&&(n=o)}),Gn(a,n||NaN)}function IU(e,t,n){const[a,l]=Ei(n?.in,e,t);return+ku(a)==+ku(l)}function bN(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function qU(e){return!(!bN(e)&&typeof e!="number"||isNaN(+dn(e)))}function HU(e,t,n){const[a,l]=Ei(n?.in,e,t),o=a.getFullYear()-l.getFullYear(),c=a.getMonth()-l.getMonth();return o*12+c}function UU(e,t){const n=dn(e,t?.in),a=n.getMonth();return n.setFullYear(n.getFullYear(),a+1,0),n.setHours(23,59,59,999),n}function wN(e,t){const[n,a]=Ei(e,t.start,t.end);return{start:n,end:a}}function $U(e,t){const{start:n,end:a}=wN(t?.in,e);let l=+n>+a;const o=l?+n:+a,c=l?a:n;c.setHours(0,0,0,0),c.setDate(1);let d=1;const m=[];for(;+c<=o;)m.push(Gn(n,c)),c.setMonth(c.getMonth()+d);return l?m.reverse():m}function VU(e,t){const n=dn(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function GU(e,t){const n=dn(e,t?.in),a=n.getFullYear();return n.setFullYear(a+1,0,0),n.setHours(23,59,59,999),n}function jN(e,t){const n=dn(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function YU(e,t){const{start:n,end:a}=wN(t?.in,e);let l=+n>+a;const o=l?+n:+a,c=l?a:n;c.setHours(0,0,0,0),c.setMonth(0,1);let d=1;const m=[];for(;+c<=o;)m.push(Gn(n,c)),c.setFullYear(c.getFullYear()+d);return l?m.reverse():m}function NN(e,t){const n=Qu(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,l=dn(e,t?.in),o=l.getDay(),c=(o{let a;const l=XU[e];return typeof l=="string"?a=l:t===1?a=l.one:a=l.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a};function Lo(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const QU={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ZU={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},JU={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},e$={date:Lo({formats:QU,defaultWidth:"full"}),time:Lo({formats:ZU,defaultWidth:"full"}),dateTime:Lo({formats:JU,defaultWidth:"full"})},t$={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},n$=(e,t,n,a)=>t$[e];function Ja(e){return(t,n)=>{const a=n?.context?String(n.context):"standalone";let l;if(a==="formatting"&&e.formattingValues){const c=e.defaultFormattingWidth||e.defaultWidth,d=n?.width?String(n.width):c;l=e.formattingValues[d]||e.formattingValues[c]}else{const c=e.defaultWidth,d=n?.width?String(n.width):e.defaultWidth;l=e.values[d]||e.values[c]}const o=e.argumentCallback?e.argumentCallback(t):t;return l[o]}}const r$={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},a$={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},s$={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},l$={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},i$={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},o$={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},c$=(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},u$={ordinalNumber:c$,era:Ja({values:r$,defaultWidth:"wide"}),quarter:Ja({values:a$,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Ja({values:s$,defaultWidth:"wide"}),day:Ja({values:l$,defaultWidth:"wide"}),dayPeriod:Ja({values:i$,defaultWidth:"wide",formattingValues:o$,defaultFormattingWidth:"wide"})};function es(e){return(t,n={})=>{const a=n.width,l=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],o=t.match(l);if(!o)return null;const c=o[0],d=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],m=Array.isArray(d)?m$(d,x=>x.test(c)):d$(d,x=>x.test(c));let f;f=e.valueCallback?e.valueCallback(m):m,f=n.valueCallback?n.valueCallback(f):f;const p=t.slice(c.length);return{value:f,rest:p}}}function d$(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function m$(e,t){for(let n=0;n{const a=t.match(e.matchPattern);if(!a)return null;const l=a[0],o=t.match(e.parsePattern);if(!o)return null;let c=e.valueCallback?e.valueCallback(o[0]):o[0];c=n.valueCallback?n.valueCallback(c):c;const d=t.slice(l.length);return{value:c,rest:d}}}const h$=/^(\d+)(th|st|nd|rd)?/i,f$=/\d+/i,p$={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},x$={any:[/^b/i,/^(a|c)/i]},g$={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},v$={any:[/1/i,/2/i,/3/i,/4/i]},y$={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},b$={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},w$={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},j$={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},N$={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},S$={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},k$={ordinalNumber:SN({matchPattern:h$,parsePattern:f$,valueCallback:e=>parseInt(e,10)}),era:es({matchPatterns:p$,defaultMatchWidth:"wide",parsePatterns:x$,defaultParseWidth:"any"}),quarter:es({matchPatterns:g$,defaultMatchWidth:"wide",parsePatterns:v$,defaultParseWidth:"any",valueCallback:e=>e+1}),month:es({matchPatterns:y$,defaultMatchWidth:"wide",parsePatterns:b$,defaultParseWidth:"any"}),day:es({matchPatterns:w$,defaultMatchWidth:"wide",parsePatterns:j$,defaultParseWidth:"any"}),dayPeriod:es({matchPatterns:N$,defaultMatchWidth:"any",parsePatterns:S$,defaultParseWidth:"any"})},Ag={code:"en-US",formatDistance:KU,formatLong:e$,formatRelative:n$,localize:u$,match:k$,options:{weekStartsOn:0,firstWeekContainsDate:1}};function C$(e,t){const n=dn(e,t?.in);return yN(n,jN(n))+1}function kN(e,t){const n=dn(e,t?.in),a=+Su(n)-+RU(n);return Math.round(a/pN)+1}function CN(e,t){const n=dn(e,t?.in),a=n.getFullYear(),l=Qu(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??l.firstWeekContainsDate??l.locale?.options?.firstWeekContainsDate??1,c=Gn(t?.in||e,0);c.setFullYear(a+1,0,o),c.setHours(0,0,0,0);const d=Dl(c,t),m=Gn(t?.in||e,0);m.setFullYear(a,0,o),m.setHours(0,0,0,0);const f=Dl(m,t);return+n>=+d?a+1:+n>=+f?a:a-1}function T$(e,t){const n=Qu(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,l=CN(e,t),o=Gn(t?.in||e,0);return o.setFullYear(l,0,a),o.setHours(0,0,0,0),Dl(o,t)}function TN(e,t){const n=dn(e,t?.in),a=+Dl(n,t)-+T$(n,t);return Math.round(a/pN)+1}function rn(e,t){const n=e<0?"-":"",a=Math.abs(e).toString().padStart(t,"0");return n+a}const bl={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return rn(t==="yy"?a%100:a,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):rn(n+1,2)},d(e,t){return rn(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return rn(e.getHours()%12||12,t.length)},H(e,t){return rn(e.getHours(),t.length)},m(e,t){return rn(e.getMinutes(),t.length)},s(e,t){return rn(e.getSeconds(),t.length)},S(e,t){const n=t.length,a=e.getMilliseconds(),l=Math.trunc(a*Math.pow(10,n-3));return rn(l,t.length)}},No={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},N5={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});case"GGGG":default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const a=e.getFullYear(),l=a>0?a:1-a;return n.ordinalNumber(l,{unit:"year"})}return bl.y(e,t)},Y:function(e,t,n,a){const l=CN(e,a),o=l>0?l:1-l;if(t==="YY"){const c=o%100;return rn(c,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):rn(o,t.length)},R:function(e,t){const n=vN(e);return rn(n,t.length)},u:function(e,t){const n=e.getFullYear();return rn(n,t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return rn(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return rn(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return bl.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return rn(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const l=TN(e,a);return t==="wo"?n.ordinalNumber(l,{unit:"week"}):rn(l,t.length)},I:function(e,t,n){const a=kN(e);return t==="Io"?n.ordinalNumber(a,{unit:"week"}):rn(a,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):bl.d(e,t)},D:function(e,t,n){const a=C$(e);return t==="Do"?n.ordinalNumber(a,{unit:"dayOfYear"}):rn(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});case"EEEE":default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const l=e.getDay(),o=(l-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return rn(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(l,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(l,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(l,{width:"short",context:"formatting"});case"eeee":default:return n.day(l,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const l=e.getDay(),o=(l-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return rn(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(l,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(l,{width:"narrow",context:"standalone"});case"cccccc":return n.day(l,{width:"short",context:"standalone"});case"cccc":default:return n.day(l,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),l=a===0?7:a;switch(t){case"i":return String(l);case"ii":return rn(l,t.length);case"io":return n.ordinalNumber(l,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});case"iiii":default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const l=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let l;switch(a===12?l=No.noon:a===0?l=No.midnight:l=a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let l;switch(a>=17?l=No.evening:a>=12?l=No.afternoon:a>=4?l=No.morning:l=No.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let a=e.getHours()%12;return a===0&&(a=12),n.ordinalNumber(a,{unit:"hour"})}return bl.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):bl.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return t==="Ko"?n.ordinalNumber(a,{unit:"hour"}):rn(a,t.length)},k:function(e,t,n){let a=e.getHours();return a===0&&(a=24),t==="ko"?n.ordinalNumber(a,{unit:"hour"}):rn(a,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):bl.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):bl.s(e,t)},S:function(e,t){return bl.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(a===0)return"Z";switch(t){case"X":return k5(a);case"XXXX":case"XX":return oi(a);case"XXXXX":case"XXX":default:return oi(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return k5(a);case"xxxx":case"xx":return oi(a);case"xxxxx":case"xxx":default:return oi(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+S5(a,":");case"OOOO":default:return"GMT"+oi(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+S5(a,":");case"zzzz":default:return"GMT"+oi(a,":")}},t:function(e,t,n){const a=Math.trunc(+e/1e3);return rn(a,t.length)},T:function(e,t,n){return rn(+e,t.length)}};function S5(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),l=Math.trunc(a/60),o=a%60;return o===0?n+String(l):n+String(l)+t+rn(o,2)}function k5(e,t){return e%60===0?(e>0?"-":"+")+rn(Math.abs(e)/60,2):oi(e,t)}function oi(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),l=rn(Math.trunc(a/60),2),o=rn(a%60,2);return n+l+t+o}const C5=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},_N=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},_$=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],l=n[2];if(!l)return C5(e,t);let o;switch(a){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",C5(a,t)).replace("{{time}}",_N(l,t))},E$={p:_N,P:_$},M$=/^D+$/,A$=/^Y+$/,D$=["D","DD","YY","YYYY"];function z$(e){return M$.test(e)}function O$(e){return A$.test(e)}function R$(e,t,n){const a=L$(e,t,n);if(console.warn(a),D$.includes(e))throw new RangeError(a)}function L$(e,t,n){const a=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const B$=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,P$=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,F$=/^'([^]*?)'?$/,I$=/''/g,q$=/[a-zA-Z]/;function Z0(e,t,n){const a=Qu(),l=n?.locale??a.locale??Ag,o=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,c=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,d=dn(e,n?.in);if(!qU(d))throw new RangeError("Invalid time value");let m=t.match(P$).map(p=>{const x=p[0];if(x==="p"||x==="P"){const y=E$[x];return y(p,l.formatLong)}return p}).join("").match(B$).map(p=>{if(p==="''")return{isToken:!1,value:"'"};const x=p[0];if(x==="'")return{isToken:!1,value:H$(p)};if(N5[x])return{isToken:!0,value:p};if(x.match(q$))throw new RangeError("Format string contains an unescaped latin alphabet character `"+x+"`");return{isToken:!1,value:p}});l.localize.preprocessor&&(m=l.localize.preprocessor(d,m));const f={firstWeekContainsDate:o,weekStartsOn:c,locale:l};return m.map(p=>{if(!p.isToken)return p.value;const x=p.value;(!n?.useAdditionalWeekYearTokens&&O$(x)||!n?.useAdditionalDayOfYearTokens&&z$(x))&&R$(x,t,String(e));const y=N5[x[0]];return y(d,x,l.localize,f)}).join("")}function H$(e){const t=e.match(F$);return t?t[1].replace(I$,"'"):e}function U$(e,t){const n=dn(e,t?.in),a=n.getFullYear(),l=n.getMonth(),o=Gn(n,0);return o.setFullYear(a,l+1,0),o.setHours(0,0,0,0),o.getDate()}function $$(e,t){return dn(e,t?.in).getMonth()}function V$(e,t){return dn(e,t?.in).getFullYear()}function G$(e,t){return+dn(e)>+dn(t)}function Y$(e,t){return+dn(e)<+dn(t)}function W$(e,t,n){const[a,l]=Ei(n?.in,e,t);return+Dl(a,n)==+Dl(l,n)}function X$(e,t,n){const[a,l]=Ei(n?.in,e,t);return a.getFullYear()===l.getFullYear()&&a.getMonth()===l.getMonth()}function K$(e,t,n){const[a,l]=Ei(n?.in,e,t);return a.getFullYear()===l.getFullYear()}function Q$(e,t,n){const a=dn(e,n?.in),l=a.getFullYear(),o=a.getDate(),c=Gn(e,0);c.setFullYear(l,t,15),c.setHours(0,0,0,0);const d=U$(c);return a.setMonth(t,Math.min(o,d)),a}function Z$(e,t,n){const a=dn(e,n?.in);return isNaN(+a)?Gn(e,NaN):(a.setFullYear(t),a)}const T5=5,J$=4;function eV(e,t){const n=t.startOfMonth(e),a=n.getDay()>0?n.getDay():7,l=t.addDays(e,-a+1),o=t.addDays(l,T5*7-1);return t.getMonth(e)===t.getMonth(o)?T5:J$}function EN(e,t){const n=t.startOfMonth(e),a=n.getDay();return a===1?n:a===0?t.addDays(n,-6):t.addDays(n,-1*(a-1))}function tV(e,t){const n=EN(e,t),a=eV(e,t);return t.addDays(n,a*7-1)}class ma{constructor(t,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?vr.tz(this.options.timeZone):new this.Date,this.newDate=(a,l,o)=>this.overrides?.newDate?this.overrides.newDate(a,l,o):this.options.timeZone?new vr(a,l,o,this.options.timeZone):new Date(a,l,o),this.addDays=(a,l)=>this.overrides?.addDays?this.overrides.addDays(a,l):xN(a,l),this.addMonths=(a,l)=>this.overrides?.addMonths?this.overrides.addMonths(a,l):gN(a,l),this.addWeeks=(a,l)=>this.overrides?.addWeeks?this.overrides.addWeeks(a,l):LU(a,l),this.addYears=(a,l)=>this.overrides?.addYears?this.overrides.addYears(a,l):BU(a,l),this.differenceInCalendarDays=(a,l)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(a,l):yN(a,l),this.differenceInCalendarMonths=(a,l)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(a,l):HU(a,l),this.eachMonthOfInterval=a=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(a):$U(a),this.eachYearOfInterval=a=>{const l=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(a):YU(a),o=new Set(l.map(d=>this.getYear(d)));if(o.size===l.length)return l;const c=[];return o.forEach(d=>{c.push(new Date(d,0,1))}),c},this.endOfBroadcastWeek=a=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(a):tV(a,this),this.endOfISOWeek=a=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(a):WU(a),this.endOfMonth=a=>this.overrides?.endOfMonth?this.overrides.endOfMonth(a):UU(a),this.endOfWeek=(a,l)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(a,l):NN(a,this.options),this.endOfYear=a=>this.overrides?.endOfYear?this.overrides.endOfYear(a):GU(a),this.format=(a,l,o)=>{const c=this.overrides?.format?this.overrides.format(a,l,this.options):Z0(a,l,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(c):c},this.getISOWeek=a=>this.overrides?.getISOWeek?this.overrides.getISOWeek(a):kN(a),this.getMonth=(a,l)=>this.overrides?.getMonth?this.overrides.getMonth(a,this.options):$$(a,this.options),this.getYear=(a,l)=>this.overrides?.getYear?this.overrides.getYear(a,this.options):V$(a,this.options),this.getWeek=(a,l)=>this.overrides?.getWeek?this.overrides.getWeek(a,this.options):TN(a,this.options),this.isAfter=(a,l)=>this.overrides?.isAfter?this.overrides.isAfter(a,l):G$(a,l),this.isBefore=(a,l)=>this.overrides?.isBefore?this.overrides.isBefore(a,l):Y$(a,l),this.isDate=a=>this.overrides?.isDate?this.overrides.isDate(a):bN(a),this.isSameDay=(a,l)=>this.overrides?.isSameDay?this.overrides.isSameDay(a,l):IU(a,l),this.isSameMonth=(a,l)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(a,l):X$(a,l),this.isSameYear=(a,l)=>this.overrides?.isSameYear?this.overrides.isSameYear(a,l):K$(a,l),this.max=a=>this.overrides?.max?this.overrides.max(a):PU(a),this.min=a=>this.overrides?.min?this.overrides.min(a):FU(a),this.setMonth=(a,l)=>this.overrides?.setMonth?this.overrides.setMonth(a,l):Q$(a,l),this.setYear=(a,l)=>this.overrides?.setYear?this.overrides.setYear(a,l):Z$(a,l),this.startOfBroadcastWeek=(a,l)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(a,this):EN(a,this),this.startOfDay=a=>this.overrides?.startOfDay?this.overrides.startOfDay(a):ku(a),this.startOfISOWeek=a=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(a):Su(a),this.startOfMonth=a=>this.overrides?.startOfMonth?this.overrides.startOfMonth(a):VU(a),this.startOfWeek=(a,l)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(a,this.options):Dl(a,this.options),this.startOfYear=a=>this.overrides?.startOfYear?this.overrides.startOfYear(a):jN(a),this.options={locale:Ag,...t},this.overrides=n}getDigitMap(){const{numerals:t="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:t}),a={};for(let l=0;l<10;l++)a[l.toString()]=n.format(l);return a}replaceDigits(t){const n=this.getDigitMap();return t.replace(/\d/g,a=>n[a]||a)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){const t=this.options.locale?.code;return t&&ma.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:n,timeZone:a,numerals:l}=this.options,o=n?.code;if(o&&ma.yearFirstLocales.has(o))try{return new Intl.DateTimeFormat(o,{month:"long",year:"numeric",timeZone:a,numberingSystem:l}).format(t)}catch{}const c=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,c)}}ma.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const us=new ma;class MN{constructor(t,n,a=us){this.date=t,this.displayMonth=n,this.outside=!!(n&&!a.isSameMonth(t,n)),this.dateLib=a}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class nV{constructor(t,n){this.date=t,this.weeks=n}}class rV{constructor(t,n){this.days=n,this.weekNumber=t}}function aV(e){return Fe.createElement("button",{...e})}function sV(e){return Fe.createElement("span",{...e})}function lV(e){const{size:t=24,orientation:n="left",className:a}=e;return Fe.createElement("svg",{className:a,width:t,height:t,viewBox:"0 0 24 24"},n==="up"&&Fe.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&Fe.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&Fe.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&Fe.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function iV(e){const{day:t,modifiers:n,...a}=e;return Fe.createElement("td",{...a})}function oV(e){const{day:t,modifiers:n,...a}=e,l=Fe.useRef(null);return Fe.useEffect(()=>{n.focused&&l.current?.focus()},[n.focused]),Fe.createElement("button",{ref:l,...a})}var Ke;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(Ke||(Ke={}));var En;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(En||(En={}));var Fa;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(Fa||(Fa={}));var oa;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(oa||(oa={}));function cV(e){const{options:t,className:n,components:a,classNames:l,...o}=e,c=[l[Ke.Dropdown],n].join(" "),d=t?.find(({value:m})=>m===o.value);return Fe.createElement("span",{"data-disabled":o.disabled,className:l[Ke.DropdownRoot]},Fe.createElement(a.Select,{className:c,...o},t?.map(({value:m,label:f,disabled:p})=>Fe.createElement(a.Option,{key:m,value:m,disabled:p},f))),Fe.createElement("span",{className:l[Ke.CaptionLabel],"aria-hidden":!0},d?.label,Fe.createElement(a.Chevron,{orientation:"down",size:18,className:l[Ke.Chevron]})))}function uV(e){return Fe.createElement("div",{...e})}function dV(e){return Fe.createElement("div",{...e})}function mV(e){const{calendarMonth:t,displayIndex:n,...a}=e;return Fe.createElement("div",{...a},e.children)}function hV(e){const{calendarMonth:t,displayIndex:n,...a}=e;return Fe.createElement("div",{...a})}function fV(e){return Fe.createElement("table",{...e})}function pV(e){return Fe.createElement("div",{...e})}const AN=w.createContext(void 0);function Zu(){const e=w.useContext(AN);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function xV(e){const{components:t}=Zu();return Fe.createElement(t.Dropdown,{...e})}function gV(e){const{onPreviousClick:t,onNextClick:n,previousMonth:a,nextMonth:l,...o}=e,{components:c,classNames:d,labels:{labelPrevious:m,labelNext:f}}=Zu(),p=w.useCallback(y=>{l&&n?.(y)},[l,n]),x=w.useCallback(y=>{a&&t?.(y)},[a,t]);return Fe.createElement("nav",{...o},Fe.createElement(c.PreviousMonthButton,{type:"button",className:d[Ke.PreviousMonthButton],tabIndex:a?void 0:-1,"aria-disabled":a?void 0:!0,"aria-label":m(a),onClick:x},Fe.createElement(c.Chevron,{disabled:a?void 0:!0,className:d[Ke.Chevron],orientation:"left"})),Fe.createElement(c.NextMonthButton,{type:"button",className:d[Ke.NextMonthButton],tabIndex:l?void 0:-1,"aria-disabled":l?void 0:!0,"aria-label":f(l),onClick:p},Fe.createElement(c.Chevron,{disabled:l?void 0:!0,orientation:"right",className:d[Ke.Chevron]})))}function vV(e){const{components:t}=Zu();return Fe.createElement(t.Button,{...e})}function yV(e){return Fe.createElement("option",{...e})}function bV(e){const{components:t}=Zu();return Fe.createElement(t.Button,{...e})}function wV(e){const{rootRef:t,...n}=e;return Fe.createElement("div",{...n,ref:t})}function jV(e){return Fe.createElement("select",{...e})}function NV(e){const{week:t,...n}=e;return Fe.createElement("tr",{...n})}function SV(e){return Fe.createElement("th",{...e})}function kV(e){return Fe.createElement("thead",{"aria-hidden":!0},Fe.createElement("tr",{...e}))}function CV(e){const{week:t,...n}=e;return Fe.createElement("th",{...n})}function TV(e){return Fe.createElement("th",{...e})}function _V(e){return Fe.createElement("tbody",{...e})}function EV(e){const{components:t}=Zu();return Fe.createElement(t.Dropdown,{...e})}const MV=Object.freeze(Object.defineProperty({__proto__:null,Button:aV,CaptionLabel:sV,Chevron:lV,Day:iV,DayButton:oV,Dropdown:cV,DropdownNav:uV,Footer:dV,Month:mV,MonthCaption:hV,MonthGrid:fV,Months:pV,MonthsDropdown:xV,Nav:gV,NextMonthButton:vV,Option:yV,PreviousMonthButton:bV,Root:wV,Select:jV,Week:NV,WeekNumber:CV,WeekNumberHeader:TV,Weekday:SV,Weekdays:kV,Weeks:_V,YearsDropdown:EV},Symbol.toStringTag,{value:"Module"}));function zs(e,t,n=!1,a=us){let{from:l,to:o}=e;const{differenceInCalendarDays:c,isSameDay:d}=a;return l&&o?(c(o,l)<0&&([l,o]=[o,l]),c(t,l)>=(n?1:0)&&c(o,t)>=(n?1:0)):!n&&o?d(o,t):!n&&l?d(l,t):!1}function DN(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function Dg(e){return!!(e&&typeof e=="object"&&"from"in e)}function zN(e){return!!(e&&typeof e=="object"&&"after"in e)}function ON(e){return!!(e&&typeof e=="object"&&"before"in e)}function RN(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function LN(e,t){return Array.isArray(e)&&e.every(t.isDate)}function Os(e,t,n=us){const a=Array.isArray(t)?t:[t],{isSameDay:l,differenceInCalendarDays:o,isAfter:c}=n;return a.some(d=>{if(typeof d=="boolean")return d;if(n.isDate(d))return l(e,d);if(LN(d,n))return d.includes(e);if(Dg(d))return zs(d,e,!1,n);if(RN(d))return Array.isArray(d.dayOfWeek)?d.dayOfWeek.includes(e.getDay()):d.dayOfWeek===e.getDay();if(DN(d)){const m=o(d.before,e),f=o(d.after,e),p=m>0,x=f<0;return c(d.before,d.after)?x&&p:p||x}return zN(d)?o(e,d.after)>0:ON(d)?o(d.before,e)>0:typeof d=="function"?d(e):!1})}function AV(e,t,n,a,l){const{disabled:o,hidden:c,modifiers:d,showOutsideDays:m,broadcastCalendar:f,today:p}=t,{isSameDay:x,isSameMonth:y,startOfMonth:b,isBefore:N,endOfMonth:k,isAfter:S}=l,T=n&&b(n),M=a&&k(a),A={[En.focused]:[],[En.outside]:[],[En.disabled]:[],[En.hidden]:[],[En.today]:[]},R={};for(const B of e){const{date:O,displayMonth:L}=B,$=!!(L&&!y(O,L)),U=!!(T&&N(O,T)),I=!!(M&&S(O,M)),G=!!(o&&Os(O,o,l)),ee=!!(c&&Os(O,c,l))||U||I||!f&&!m&&$||f&&m===!1&&$,Ne=x(O,p??l.today());$&&A.outside.push(B),G&&A.disabled.push(B),ee&&A.hidden.push(B),Ne&&A.today.push(B),d&&Object.keys(d).forEach(J=>{const se=d?.[J];se&&Os(O,se,l)&&(R[J]?R[J].push(B):R[J]=[B])})}return B=>{const O={[En.focused]:!1,[En.disabled]:!1,[En.hidden]:!1,[En.outside]:!1,[En.today]:!1},L={};for(const $ in A){const U=A[$];O[$]=U.some(I=>I===B)}for(const $ in R)L[$]=R[$].some(U=>U===B);return{...O,...L}}}function DV(e,t,n={}){return Object.entries(e).filter(([,l])=>l===!0).reduce((l,[o])=>(n[o]?l.push(n[o]):t[En[o]]?l.push(t[En[o]]):t[Fa[o]]&&l.push(t[Fa[o]]),l),[t[Ke.Day]])}function zV(e){return{...MV,...e}}function OV(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([n,a])=>{n.startsWith("data-")&&(t[n]=a)}),t}function zg(){const e={};for(const t in Ke)e[Ke[t]]=`rdp-${Ke[t]}`;for(const t in En)e[En[t]]=`rdp-${En[t]}`;for(const t in Fa)e[Fa[t]]=`rdp-${Fa[t]}`;for(const t in oa)e[oa[t]]=`rdp-${oa[t]}`;return e}function BN(e,t,n){return(n??new ma(t)).formatMonthYear(e)}const RV=BN;function LV(e,t,n){return(n??new ma(t)).format(e,"d")}function BV(e,t=us){return t.format(e,"LLLL")}function PV(e,t,n){return(n??new ma(t)).format(e,"cccccc")}function FV(e,t=us){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function IV(){return""}function PN(e,t=us){return t.format(e,"yyyy")}const qV=PN,HV=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:BN,formatDay:LV,formatMonthCaption:RV,formatMonthDropdown:BV,formatWeekNumber:FV,formatWeekNumberHeader:IV,formatWeekdayName:PV,formatYearCaption:qV,formatYearDropdown:PN},Symbol.toStringTag,{value:"Module"}));function UV(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...HV,...e}}function $V(e,t,n,a,l){const{startOfMonth:o,startOfYear:c,endOfYear:d,eachMonthOfInterval:m,getMonth:f}=l;return m({start:c(e),end:d(e)}).map(y=>{const b=a.formatMonthDropdown(y,l),N=f(y),k=t&&yo(n)||!1;return{value:N,label:b,disabled:k}})}function VV(e,t={},n={}){let a={...t?.[Ke.Day]};return Object.entries(e).filter(([,l])=>l===!0).forEach(([l])=>{a={...a,...n?.[l]}}),a}function GV(e,t,n){const a=e.today(),l=t?e.startOfISOWeek(a):e.startOfWeek(a),o=[];for(let c=0;c<7;c++){const d=e.addDays(l,c);o.push(d)}return o}function YV(e,t,n,a,l=!1){if(!e||!t)return;const{startOfYear:o,endOfYear:c,eachYearOfInterval:d,getYear:m}=a,f=o(e),p=c(t),x=d({start:f,end:p});return l&&x.reverse(),x.map(y=>{const b=n.formatYearDropdown(y,a);return{value:m(y),label:b,disabled:!1}})}function FN(e,t,n,a){let l=(a??new ma(n)).format(e,"PPPP");return t.today&&(l=`Today, ${l}`),t.selected&&(l=`${l}, selected`),l}const WV=FN;function IN(e,t,n){return(n??new ma(t)).formatMonthYear(e)}const XV=IN;function KV(e,t,n,a){let l=(a??new ma(n)).format(e,"PPPP");return t?.today&&(l=`Today, ${l}`),l}function QV(e){return"Choose the Month"}function ZV(){return""}function JV(e){return"Go to the Next Month"}function eG(e){return"Go to the Previous Month"}function tG(e,t,n){return(n??new ma(t)).format(e,"cccc")}function nG(e,t){return`Week ${e}`}function rG(e){return"Week Number"}function aG(e){return"Choose the Year"}const sG=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:XV,labelDay:WV,labelDayButton:FN,labelGrid:IN,labelGridcell:KV,labelMonthDropdown:QV,labelNav:ZV,labelNext:JV,labelPrevious:eG,labelWeekNumber:nG,labelWeekNumberHeader:rG,labelWeekday:tG,labelYearDropdown:aG},Symbol.toStringTag,{value:"Module"})),Ju=e=>e instanceof HTMLElement?e:null,fx=e=>[...e.querySelectorAll("[data-animated-month]")??[]],lG=e=>Ju(e.querySelector("[data-animated-month]")),px=e=>Ju(e.querySelector("[data-animated-caption]")),xx=e=>Ju(e.querySelector("[data-animated-weeks]")),iG=e=>Ju(e.querySelector("[data-animated-nav]")),oG=e=>Ju(e.querySelector("[data-animated-weekdays]"));function cG(e,t,{classNames:n,months:a,focused:l,dateLib:o}){const c=w.useRef(null),d=w.useRef(a),m=w.useRef(!1);w.useLayoutEffect(()=>{const f=d.current;if(d.current=a,!t||!e.current||!(e.current instanceof HTMLElement)||a.length===0||f.length===0||a.length!==f.length)return;const p=o.isSameMonth(a[0].date,f[0].date),x=o.isAfter(a[0].date,f[0].date),y=x?n[oa.caption_after_enter]:n[oa.caption_before_enter],b=x?n[oa.weeks_after_enter]:n[oa.weeks_before_enter],N=c.current,k=e.current.cloneNode(!0);if(k instanceof HTMLElement?(fx(k).forEach(A=>{if(!(A instanceof HTMLElement))return;const R=lG(A);R&&A.contains(R)&&A.removeChild(R);const B=px(A);B&&B.classList.remove(y);const O=xx(A);O&&O.classList.remove(b)}),c.current=k):c.current=null,m.current||p||l)return;const S=N instanceof HTMLElement?fx(N):[],T=fx(e.current);if(T?.every(M=>M instanceof HTMLElement)&&S&&S.every(M=>M instanceof HTMLElement)){m.current=!0,e.current.style.isolation="isolate";const M=iG(e.current);M&&(M.style.zIndex="1"),T.forEach((A,R)=>{const B=S[R];if(!B)return;A.style.position="relative",A.style.overflow="hidden";const O=px(A);O&&O.classList.add(y);const L=xx(A);L&&L.classList.add(b);const $=()=>{m.current=!1,e.current&&(e.current.style.isolation=""),M&&(M.style.zIndex=""),O&&O.classList.remove(y),L&&L.classList.remove(b),A.style.position="",A.style.overflow="",A.contains(B)&&A.removeChild(B)};B.style.pointerEvents="none",B.style.position="absolute",B.style.overflow="hidden",B.setAttribute("aria-hidden","true");const U=oG(B);U&&(U.style.opacity="0");const I=px(B);I&&(I.classList.add(x?n[oa.caption_before_exit]:n[oa.caption_after_exit]),I.addEventListener("animationend",$));const G=xx(B);G&&G.classList.add(x?n[oa.weeks_before_exit]:n[oa.weeks_after_exit]),A.insertBefore(B,A.firstChild)})}})}function uG(e,t,n,a){const l=e[0],o=e[e.length-1],{ISOWeek:c,fixedWeeks:d,broadcastCalendar:m}=n??{},{addDays:f,differenceInCalendarDays:p,differenceInCalendarMonths:x,endOfBroadcastWeek:y,endOfISOWeek:b,endOfMonth:N,endOfWeek:k,isAfter:S,startOfBroadcastWeek:T,startOfISOWeek:M,startOfWeek:A}=a,R=m?T(l,a):c?M(l):A(l),B=m?y(o):c?b(N(o)):k(N(o)),O=p(B,R),L=x(o,l)+1,$=[];for(let G=0;G<=O;G++){const ee=f(R,G);if(t&&S(ee,t))break;$.push(ee)}const I=(m?35:42)*L;if(d&&$.length{const l=a.weeks.reduce((o,c)=>o.concat(c.days.slice()),t.slice());return n.concat(l.slice())},t.slice())}function mG(e,t,n,a){const{numberOfMonths:l=1}=n,o=[];for(let c=0;ct)break;o.push(d)}return o}function _5(e,t,n,a){const{month:l,defaultMonth:o,today:c=a.today(),numberOfMonths:d=1}=e;let m=l||o||c;const{differenceInCalendarMonths:f,addMonths:p,startOfMonth:x}=a;if(n&&f(n,m){const T=n.broadcastCalendar?x(S,a):n.ISOWeek?y(S):b(S),M=n.broadcastCalendar?o(S):n.ISOWeek?c(d(S)):m(d(S)),A=t.filter(L=>L>=T&&L<=M),R=n.broadcastCalendar?35:42;if(n.fixedWeeks&&A.length{const U=R-A.length;return $>M&&$<=l(M,U)});A.push(...L)}const B=A.reduce((L,$)=>{const U=n.ISOWeek?f($):p($),I=L.find(ee=>ee.weekNumber===U),G=new MN($,S,a);return I?I.days.push(G):L.push(new rV(U,[G])),L},[]),O=new nV(S,B);return k.push(O),k},[]);return n.reverseMonths?N.reverse():N}function fG(e,t){let{startMonth:n,endMonth:a}=e;const{startOfYear:l,startOfDay:o,startOfMonth:c,endOfMonth:d,addYears:m,endOfYear:f,newDate:p,today:x}=t,{fromYear:y,toYear:b,fromMonth:N,toMonth:k}=e;!n&&N&&(n=N),!n&&y&&(n=t.newDate(y,0,1)),!a&&k&&(a=k),!a&&b&&(a=p(b,11,31));const S=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return n?n=c(n):y?n=p(y,0,1):!n&&S&&(n=l(m(e.today??x(),-100))),a?a=d(a):b?a=p(b,11,31):!a&&S&&(a=f(e.today??x())),[n&&o(n),a&&o(a)]}function pG(e,t,n,a){if(n.disableNavigation)return;const{pagedNavigation:l,numberOfMonths:o=1}=n,{startOfMonth:c,addMonths:d,differenceInCalendarMonths:m}=a,f=l?o:1,p=c(e);if(!t)return d(p,f);if(!(m(t,e)n.concat(a.weeks.slice()),t.slice())}function eh(e,t){const[n,a]=w.useState(e);return[t===void 0?n:t,a]}function vG(e,t){const[n,a]=fG(e,t),{startOfMonth:l,endOfMonth:o}=t,c=_5(e,n,a,t),[d,m]=eh(c,e.month?c:void 0);w.useEffect(()=>{const O=_5(e,n,a,t);m(O)},[e.timeZone]);const f=mG(d,a,e,t),p=uG(f,e.endMonth?o(e.endMonth):void 0,e,t),x=hG(f,p,e,t),y=gG(x),b=dG(x),N=xG(d,n,e,t),k=pG(d,a,e,t),{disableNavigation:S,onMonthChange:T}=e,M=O=>y.some(L=>L.days.some($=>$.isEqualTo(O))),A=O=>{if(S)return;let L=l(O);n&&Ll(a)&&(L=l(a)),m(L),T?.(L)};return{months:x,weeks:y,days:b,navStart:n,navEnd:a,previousMonth:N,nextMonth:k,goToMonth:A,goToDay:O=>{M(O)||A(O.date)}}}var Qa;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(Qa||(Qa={}));function E5(e){return!e[En.disabled]&&!e[En.hidden]&&!e[En.outside]}function yG(e,t,n,a){let l,o=-1;for(const c of e){const d=t(c);E5(d)&&(d[En.focused]&&oE5(t(c)))),l}function bG(e,t,n,a,l,o,c){const{ISOWeek:d,broadcastCalendar:m}=o,{addDays:f,addMonths:p,addWeeks:x,addYears:y,endOfBroadcastWeek:b,endOfISOWeek:N,endOfWeek:k,max:S,min:T,startOfBroadcastWeek:M,startOfISOWeek:A,startOfWeek:R}=c;let O={day:f,week:x,month:p,year:y,startOfWeek:L=>m?M(L,c):d?A(L):R(L),endOfWeek:L=>m?b(L):d?N(L):k(L)}[e](n,t==="after"?1:-1);return t==="before"&&a?O=S([a,O]):t==="after"&&l&&(O=T([l,O])),O}function qN(e,t,n,a,l,o,c,d=0){if(d>365)return;const m=bG(e,t,n.date,a,l,o,c),f=!!(o.disabled&&Os(m,o.disabled,c)),p=!!(o.hidden&&Os(m,o.hidden,c)),x=m,y=new MN(m,x,c);return!f&&!p?y:qN(e,t,y,a,l,o,c,d+1)}function wG(e,t,n,a,l){const{autoFocus:o}=e,[c,d]=w.useState(),m=yG(t.days,n,a||(()=>!1),c),[f,p]=w.useState(o?m:void 0);return{isFocusTarget:k=>!!m?.isEqualTo(k),setFocused:p,focused:f,blur:()=>{d(f),p(void 0)},moveFocus:(k,S)=>{if(!f)return;const T=qN(k,S,f,t.navStart,t.navEnd,e,l);T&&(e.disableNavigation&&!t.days.some(A=>A.isEqualTo(T))||(t.goToDay(T),p(T)))}}}function jG(e,t){const{selected:n,required:a,onSelect:l}=e,[o,c]=eh(n,l?n:void 0),d=l?n:o,{isSameDay:m}=t,f=b=>d?.some(N=>m(N,b))??!1,{min:p,max:x}=e;return{selected:d,select:(b,N,k)=>{let S=[...d??[]];if(f(b)){if(d?.length===p||a&&d?.length===1)return;S=d?.filter(T=>!m(T,b))}else d?.length===x?S=[b]:S=[...S,b];return l||c(S),l?.(S,b,N,k),S},isSelected:f}}function NG(e,t,n=0,a=0,l=!1,o=us){const{from:c,to:d}=t||{},{isSameDay:m,isAfter:f,isBefore:p}=o;let x;if(!c&&!d)x={from:e,to:n>0?void 0:e};else if(c&&!d)m(c,e)?n===0?x={from:c,to:e}:l?x={from:c,to:void 0}:x=void 0:p(e,c)?x={from:e,to:c}:x={from:c,to:e};else if(c&&d)if(m(c,e)&&m(d,e))l?x={from:c,to:d}:x=void 0;else if(m(c,e))x={from:c,to:n>0?void 0:e};else if(m(d,e))x={from:e,to:n>0?void 0:e};else if(p(e,c))x={from:e,to:d};else if(f(e,c))x={from:c,to:e};else if(f(e,d))x={from:c,to:e};else throw new Error("Invalid range");if(x?.from&&x?.to){const y=o.differenceInCalendarDays(x.to,x.from);a>0&&y>a?x={from:e,to:void 0}:n>1&&ytypeof d!="function").some(d=>typeof d=="boolean"?d:n.isDate(d)?zs(e,d,!1,n):LN(d,n)?d.some(m=>zs(e,m,!1,n)):Dg(d)?d.from&&d.to?M5(e,{from:d.from,to:d.to},n):!1:RN(d)?SG(e,d.dayOfWeek,n):DN(d)?n.isAfter(d.before,d.after)?M5(e,{from:n.addDays(d.after,1),to:n.addDays(d.before,-1)},n):Os(e.from,d,n)||Os(e.to,d,n):zN(d)||ON(d)?Os(e.from,d,n)||Os(e.to,d,n):!1))return!0;const c=a.filter(d=>typeof d=="function");if(c.length){let d=e.from;const m=n.differenceInCalendarDays(e.to,e.from);for(let f=0;f<=m;f++){if(c.some(p=>p(d)))return!0;d=n.addDays(d,1)}}return!1}function CG(e,t){const{disabled:n,excludeDisabled:a,selected:l,required:o,onSelect:c}=e,[d,m]=eh(l,c?l:void 0),f=c?l:d;return{selected:f,select:(y,b,N)=>{const{min:k,max:S}=e,T=y?NG(y,f,k,S,o,t):void 0;return a&&n&&T?.from&&T.to&&kG({from:T.from,to:T.to},n,t)&&(T.from=y,T.to=void 0),c||m(T),c?.(T,y,b,N),T},isSelected:y=>f&&zs(f,y,!1,t)}}function TG(e,t){const{selected:n,required:a,onSelect:l}=e,[o,c]=eh(n,l?n:void 0),d=l?n:o,{isSameDay:m}=t;return{selected:d,select:(x,y,b)=>{let N=x;return!a&&d&&d&&m(x,d)&&(N=void 0),l||c(N),l?.(N,x,y,b),N},isSelected:x=>d?m(d,x):!1}}function _G(e,t){const n=TG(e,t),a=jG(e,t),l=CG(e,t);switch(e.mode){case"single":return n;case"multiple":return a;case"range":return l;default:return}}function EG(e){let t=e;t.timeZone&&(t={...e},t.today&&(t.today=new vr(t.today,t.timeZone)),t.month&&(t.month=new vr(t.month,t.timeZone)),t.defaultMonth&&(t.defaultMonth=new vr(t.defaultMonth,t.timeZone)),t.startMonth&&(t.startMonth=new vr(t.startMonth,t.timeZone)),t.endMonth&&(t.endMonth=new vr(t.endMonth,t.timeZone)),t.mode==="single"&&t.selected?t.selected=new vr(t.selected,t.timeZone):t.mode==="multiple"&&t.selected?t.selected=t.selected?.map(st=>new vr(st,t.timeZone)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?new vr(t.selected.from,t.timeZone):void 0,to:t.selected.to?new vr(t.selected.to,t.timeZone):void 0}));const{components:n,formatters:a,labels:l,dateLib:o,locale:c,classNames:d}=w.useMemo(()=>{const st={...Ag,...t.locale};return{dateLib:new ma({locale:st,weekStartsOn:t.broadcastCalendar?1:t.weekStartsOn,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},t.dateLib),components:zV(t.components),formatters:UV(t.formatters),labels:{...sG,...t.labels},locale:st,classNames:{...zg(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.components,t.formatters,t.labels,t.classNames]),{captionLayout:m,mode:f,navLayout:p,numberOfMonths:x=1,onDayBlur:y,onDayClick:b,onDayFocus:N,onDayKeyDown:k,onDayMouseEnter:S,onDayMouseLeave:T,onNextClick:M,onPrevClick:A,showWeekNumber:R,styles:B}=t,{formatCaption:O,formatDay:L,formatMonthDropdown:$,formatWeekNumber:U,formatWeekNumberHeader:I,formatWeekdayName:G,formatYearDropdown:ee}=a,Ne=vG(t,o),{days:J,months:se,navStart:H,navEnd:le,previousMonth:re,nextMonth:ge,goToMonth:E}=Ne,we=AV(J,t,H,le,o),{isSelected:Z,select:z,selected:X}=_G(t,o)??{},{blur:q,focused:ce,isFocusTarget:fe,moveFocus:De,setFocused:oe}=wG(t,Ne,we,Z??(()=>!1),o),{labelDayButton:He,labelGridcell:at,labelGrid:je,labelMonthDropdown:Ze,labelNav:qe,labelPrevious:Ot,labelNext:bn,labelWeekday:Dn,labelWeekNumber:Xe,labelWeekNumberHeader:wn,labelYearDropdown:Wn}=l,Ar=w.useMemo(()=>GV(o,t.ISOWeek),[o,t.ISOWeek]),Cn=f!==void 0||b!==void 0,cr=w.useCallback(()=>{re&&(E(re),A?.(re))},[re,E,A]),$e=w.useCallback(()=>{ge&&(E(ge),M?.(ge))},[E,ge,M]),Fn=w.useCallback((st,gn)=>ot=>{ot.preventDefault(),ot.stopPropagation(),oe(st),z?.(st.date,gn,ot),b?.(st.date,gn,ot)},[z,b,oe]),K=w.useCallback((st,gn)=>ot=>{oe(st),N?.(st.date,gn,ot)},[N,oe]),be=w.useCallback((st,gn)=>ot=>{q(),y?.(st.date,gn,ot)},[q,y]),Re=w.useCallback((st,gn)=>ot=>{const $t={ArrowLeft:[ot.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[ot.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[ot.shiftKey?"year":"week","after"],ArrowUp:[ot.shiftKey?"year":"week","before"],PageUp:[ot.shiftKey?"year":"month","before"],PageDown:[ot.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if($t[ot.key]){ot.preventDefault(),ot.stopPropagation();const[ar,bt]=$t[ot.key];De(ar,bt)}k?.(st.date,gn,ot)},[De,k,t.dir]),nt=w.useCallback((st,gn)=>ot=>{S?.(st.date,gn,ot)},[S]),kt=w.useCallback((st,gn)=>ot=>{T?.(st.date,gn,ot)},[T]),rr=w.useCallback(st=>gn=>{const ot=Number(gn.target.value),$t=o.setMonth(o.startOfMonth(st),ot);E($t)},[o,E]),Dr=w.useCallback(st=>gn=>{const ot=Number(gn.target.value),$t=o.setYear(o.startOfMonth(st),ot);E($t)},[o,E]),{className:pe,style:Ee}=w.useMemo(()=>({className:[d[Ke.Root],t.className].filter(Boolean).join(" "),style:{...B?.[Ke.Root],...t.style}}),[d,t.className,t.style,B]),dt=OV(t),mt=w.useRef(null);cG(mt,!!t.animate,{classNames:d,months:se,focused:ce,dateLib:o});const zr={dayPickerProps:t,selected:X,select:z,isSelected:Z,months:se,nextMonth:ge,previousMonth:re,goToMonth:E,getModifiers:we,components:n,classNames:d,styles:B,labels:l,formatters:a};return Fe.createElement(AN.Provider,{value:zr},Fe.createElement(n.Root,{rootRef:t.animate?mt:void 0,className:pe,style:Ee,dir:t.dir,id:t.id,lang:t.lang,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...dt},Fe.createElement(n.Months,{className:d[Ke.Months],style:B?.[Ke.Months]},!t.hideNavigation&&!p&&Fe.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:d[Ke.Nav],style:B?.[Ke.Nav],"aria-label":qe(),onPreviousClick:cr,onNextClick:$e,previousMonth:re,nextMonth:ge}),se.map((st,gn)=>Fe.createElement(n.Month,{"data-animated-month":t.animate?"true":void 0,className:d[Ke.Month],style:B?.[Ke.Month],key:gn,displayIndex:gn,calendarMonth:st},p==="around"&&!t.hideNavigation&&gn===0&&Fe.createElement(n.PreviousMonthButton,{type:"button",className:d[Ke.PreviousMonthButton],tabIndex:re?void 0:-1,"aria-disabled":re?void 0:!0,"aria-label":Ot(re),onClick:cr,"data-animated-button":t.animate?"true":void 0},Fe.createElement(n.Chevron,{disabled:re?void 0:!0,className:d[Ke.Chevron],orientation:t.dir==="rtl"?"right":"left"})),Fe.createElement(n.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:d[Ke.MonthCaption],style:B?.[Ke.MonthCaption],calendarMonth:st,displayIndex:gn},m?.startsWith("dropdown")?Fe.createElement(n.DropdownNav,{className:d[Ke.Dropdowns],style:B?.[Ke.Dropdowns]},(()=>{const ot=m==="dropdown"||m==="dropdown-months"?Fe.createElement(n.MonthsDropdown,{key:"month",className:d[Ke.MonthsDropdown],"aria-label":Ze(),classNames:d,components:n,disabled:!!t.disableNavigation,onChange:rr(st.date),options:$V(st.date,H,le,a,o),style:B?.[Ke.Dropdown],value:o.getMonth(st.date)}):Fe.createElement("span",{key:"month"},$(st.date,o)),$t=m==="dropdown"||m==="dropdown-years"?Fe.createElement(n.YearsDropdown,{key:"year",className:d[Ke.YearsDropdown],"aria-label":Wn(o.options),classNames:d,components:n,disabled:!!t.disableNavigation,onChange:Dr(st.date),options:YV(H,le,a,o,!!t.reverseYears),style:B?.[Ke.Dropdown],value:o.getYear(st.date)}):Fe.createElement("span",{key:"year"},ee(st.date,o));return o.getMonthYearOrder()==="year-first"?[$t,ot]:[ot,$t]})(),Fe.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},O(st.date,o.options,o))):Fe.createElement(n.CaptionLabel,{className:d[Ke.CaptionLabel],role:"status","aria-live":"polite"},O(st.date,o.options,o))),p==="around"&&!t.hideNavigation&&gn===x-1&&Fe.createElement(n.NextMonthButton,{type:"button",className:d[Ke.NextMonthButton],tabIndex:ge?void 0:-1,"aria-disabled":ge?void 0:!0,"aria-label":bn(ge),onClick:$e,"data-animated-button":t.animate?"true":void 0},Fe.createElement(n.Chevron,{disabled:ge?void 0:!0,className:d[Ke.Chevron],orientation:t.dir==="rtl"?"left":"right"})),gn===x-1&&p==="after"&&!t.hideNavigation&&Fe.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:d[Ke.Nav],style:B?.[Ke.Nav],"aria-label":qe(),onPreviousClick:cr,onNextClick:$e,previousMonth:re,nextMonth:ge}),Fe.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":f==="multiple"||f==="range","aria-label":je(st.date,o.options,o)||void 0,className:d[Ke.MonthGrid],style:B?.[Ke.MonthGrid]},!t.hideWeekdays&&Fe.createElement(n.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:d[Ke.Weekdays],style:B?.[Ke.Weekdays]},R&&Fe.createElement(n.WeekNumberHeader,{"aria-label":wn(o.options),className:d[Ke.WeekNumberHeader],style:B?.[Ke.WeekNumberHeader],scope:"col"},I()),Ar.map(ot=>Fe.createElement(n.Weekday,{"aria-label":Dn(ot,o.options,o),className:d[Ke.Weekday],key:String(ot),style:B?.[Ke.Weekday],scope:"col"},G(ot,o.options,o)))),Fe.createElement(n.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:d[Ke.Weeks],style:B?.[Ke.Weeks]},st.weeks.map(ot=>Fe.createElement(n.Week,{className:d[Ke.Week],key:ot.weekNumber,style:B?.[Ke.Week],week:ot},R&&Fe.createElement(n.WeekNumber,{week:ot,style:B?.[Ke.WeekNumber],"aria-label":Xe(ot.weekNumber,{locale:c}),className:d[Ke.WeekNumber],scope:"row",role:"rowheader"},U(ot.weekNumber,o)),ot.days.map($t=>{const{date:ar}=$t,bt=we($t);if(bt[En.focused]=!bt.hidden&&!!ce?.isEqualTo($t),bt[Fa.selected]=Z?.(ar)||bt.selected,Dg(X)){const{from:Di,to:Il}=X;bt[Fa.range_start]=!!(Di&&Il&&o.isSameDay(ar,Di)),bt[Fa.range_end]=!!(Di&&Il&&o.isSameDay(ar,Il)),bt[Fa.range_middle]=zs(X,ar,!0,o)}const Ai=VV(bt,B,t.modifiersStyles),Fl=DV(bt,d,t.modifiersClassNames),sh=!Cn&&!bt.hidden?at(ar,bt,o.options,o):void 0;return Fe.createElement(n.Day,{key:`${o.format(ar,"yyyy-MM-dd")}_${o.format($t.displayMonth,"yyyy-MM")}`,day:$t,modifiers:bt,className:Fl.join(" "),style:Ai,role:"gridcell","aria-selected":bt.selected||void 0,"aria-label":sh,"data-day":o.format(ar,"yyyy-MM-dd"),"data-month":$t.outside?o.format(ar,"yyyy-MM"):void 0,"data-selected":bt.selected||void 0,"data-disabled":bt.disabled||void 0,"data-hidden":bt.hidden||void 0,"data-outside":$t.outside||void 0,"data-focused":bt.focused||void 0,"data-today":bt.today||void 0},!bt.hidden&&Cn?Fe.createElement(n.DayButton,{className:d[Ke.DayButton],style:B?.[Ke.DayButton],type:"button",day:$t,modifiers:bt,disabled:bt.disabled||void 0,tabIndex:fe($t)?0:-1,"aria-label":He(ar,bt,o.options,o),onClick:Fn($t,bt),onBlur:be($t,bt),onFocus:K($t,bt),onKeyDown:Re($t,bt),onMouseEnter:nt($t,bt),onMouseLeave:kt($t,bt)},L(ar,o.options,o)):!bt.hidden&&L($t.date,o.options,o))})))))))),t.footer&&Fe.createElement(n.Footer,{className:d[Ke.Footer],style:B?.[Ke.Footer],role:"status","aria-live":"polite"},t.footer)))}function A5({className:e,classNames:t,showOutsideDays:n=!0,captionLayout:a="label",buttonVariant:l="ghost",formatters:o,components:c,...d}){const m=zg();return r.jsx(EG,{showOutsideDays:n,className:he("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:a,formatters:{formatMonthDropdown:f=>f.toLocaleString("default",{month:"short"}),...o},classNames:{root:he("w-fit",m.root),months:he("relative flex flex-col gap-4 md:flex-row",m.months),month:he("flex w-full flex-col gap-4",m.month),nav:he("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",m.nav),button_previous:he(gu({variant:l}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",m.button_previous),button_next:he(gu({variant:l}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",m.button_next),month_caption:he("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",m.month_caption),dropdowns:he("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",m.dropdowns),dropdown_root:he("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",m.dropdown_root),dropdown:he("bg-popover absolute inset-0 opacity-0",m.dropdown),caption_label:he("select-none font-medium",a==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",m.caption_label),table:"w-full border-collapse",weekdays:he("flex",m.weekdays),weekday:he("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",m.weekday),week:he("mt-2 flex w-full",m.week),week_number_header:he("w-[--cell-size] select-none",m.week_number_header),week_number:he("text-muted-foreground select-none text-[0.8rem]",m.week_number),day:he("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",m.day),range_start:he("bg-accent rounded-l-md",m.range_start),range_middle:he("rounded-none",m.range_middle),range_end:he("bg-accent rounded-r-md",m.range_end),today:he("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",m.today),outside:he("text-muted-foreground aria-selected:text-muted-foreground",m.outside),disabled:he("text-muted-foreground opacity-50",m.disabled),hidden:he("invisible",m.hidden),...t},components:{Root:({className:f,rootRef:p,...x})=>r.jsx("div",{"data-slot":"calendar",ref:p,className:he(f),...x}),Chevron:({className:f,orientation:p,...x})=>p==="left"?r.jsx(bi,{className:he("size-4",f),...x}):p==="right"?r.jsx(wi,{className:he("size-4",f),...x}):r.jsx(pu,{className:he("size-4",f),...x}),DayButton:MG,WeekNumber:({children:f,...p})=>r.jsx("td",{...p,children:r.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:f})}),...c},...d})}function MG({className:e,day:t,modifiers:n,...a}){const l=zg(),o=w.useRef(null);return w.useEffect(()=>{n.focused&&o.current?.focus()},[n.focused]),r.jsx(ne,{ref:o,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:he("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",l.day,e),...a})}class AG{ws=null;reconnectTimeout=null;reconnectAttempts=0;maxReconnectAttempts=10;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];maxCacheSize=1e3;getWebSocketUrl(){{const t=window.location.protocol==="https:"?"wss:":"ws:",n=window.location.host;return`${t}//${n}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const t=this.getWebSocketUrl();try{this.ws=new WebSocket(t),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=n=>{try{if(n.data==="pong")return;const a=JSON.parse(n.data);this.notifyLog(a)}catch(a){console.error("解析日志消息失败:",a)}},this.ws.onerror=n=>{console.error("❌ WebSocket 错误:",n),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(n){console.error("创建 WebSocket 连接失败:",n),this.attemptReconnect()}}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return;this.reconnectAttempts+=1;const t=Math.min(1e3*this.reconnectAttempts,1e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},t)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(t){return this.logCallbacks.add(t),()=>this.logCallbacks.delete(t)}onConnectionChange(t){return this.connectionCallbacks.add(t),t(this.isConnected),()=>this.connectionCallbacks.delete(t)}notifyLog(t){this.logCache.some(a=>a.id===t.id)||(this.logCache.push(t),this.logCache.length>this.maxCacheSize&&(this.logCache=this.logCache.slice(-this.maxCacheSize)),this.logCallbacks.forEach(a=>{try{a(t)}catch(l){console.error("日志回调执行失败:",l)}}))}notifyConnection(t){this.connectionCallbacks.forEach(n=>{try{n(t)}catch(a){console.error("连接状态回调执行失败:",a)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const Eo=new AG;typeof window<"u"&&Eo.connect();const DG={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},zG=(e,t,n)=>{let a;const l=DG[e];return typeof l=="string"?a=l:t===1?a=l.one:a=l.other.replace("{{count}}",String(t)),n?.addSuffix?n.comparison&&n.comparison>0?a+"内":a+"前":a},OG={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},RG={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},LG={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},BG={date:Lo({formats:OG,defaultWidth:"full"}),time:Lo({formats:RG,defaultWidth:"full"}),dateTime:Lo({formats:LG,defaultWidth:"full"})};function D5(e,t,n){const a="eeee p";return W$(e,t,n)?a:e.getTime()>t.getTime()?"'下个'"+a:"'上个'"+a}const PG={lastWeek:D5,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:D5,other:"PP p"},FG=(e,t,n,a)=>{const l=PG[e];return typeof l=="function"?l(t,n,a):l},IG={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},qG={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},HG={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},UG={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},$G={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},VG={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},GG=(e,t)=>{const n=Number(e);switch(t?.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},YG={ordinalNumber:GG,era:Ja({values:IG,defaultWidth:"wide"}),quarter:Ja({values:qG,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Ja({values:HG,defaultWidth:"wide"}),day:Ja({values:UG,defaultWidth:"wide"}),dayPeriod:Ja({values:$G,defaultWidth:"wide",formattingValues:VG,defaultFormattingWidth:"wide"})},WG=/^(第\s*)?\d+(日|时|分|秒)?/i,XG=/\d+/i,KG={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},QG={any:[/^(前)/i,/^(公元)/i]},ZG={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},JG={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},eY={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},tY={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},nY={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},rY={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},aY={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},sY={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},lY={ordinalNumber:SN({matchPattern:WG,parsePattern:XG,valueCallback:e=>parseInt(e,10)}),era:es({matchPatterns:KG,defaultMatchWidth:"wide",parsePatterns:QG,defaultParseWidth:"any"}),quarter:es({matchPatterns:ZG,defaultMatchWidth:"wide",parsePatterns:JG,defaultParseWidth:"any",valueCallback:e=>e+1}),month:es({matchPatterns:eY,defaultMatchWidth:"wide",parsePatterns:tY,defaultParseWidth:"any"}),day:es({matchPatterns:nY,defaultMatchWidth:"wide",parsePatterns:rY,defaultParseWidth:"any"}),dayPeriod:es({matchPatterns:aY,defaultMatchWidth:"any",parsePatterns:sY,defaultParseWidth:"any"})},P0={code:"zh-CN",formatDistance:zG,formatLong:BG,formatRelative:FG,localize:YG,match:lY,options:{weekStartsOn:1,firstWeekContainsDate:4}};function iY(){const[e,t]=w.useState([]),[n,a]=w.useState(""),[l,o]=w.useState("all"),[c,d]=w.useState("all"),[m,f]=w.useState(void 0),[p,x]=w.useState(void 0),[y,b]=w.useState(!0),[N,k]=w.useState(!1),S=w.useRef(null),T=w.useRef(null);w.useEffect(()=>{const G=Eo.getAllLogs();t(G);const ee=Eo.onLog(()=>{t(Eo.getAllLogs())}),Ne=Eo.onConnectionChange(J=>{k(J)});return()=>{ee(),Ne()}},[]),w.useEffect(()=>{y&&T.current&&T.current.scrollIntoView({behavior:"smooth",block:"end"})},[e,y]);const M=w.useMemo(()=>{const G=new Set(e.map(ee=>ee.module));return Array.from(G).sort()},[e]),A=G=>{switch(G){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},R=G=>{switch(G){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},B=()=>{window.location.reload()},O=()=>{Eo.clearLogs(),t([])},L=()=>{const G=I.map(se=>`${se.timestamp} [${se.level.padEnd(8)}] [${se.module}] ${se.message}`).join(` +`),ee=new Blob([G],{type:"text/plain;charset=utf-8"}),Ne=URL.createObjectURL(ee),J=document.createElement("a");J.href=Ne,J.download=`logs-${Z0(new Date,"yyyy-MM-dd-HHmmss")}.txt`,J.click(),URL.revokeObjectURL(Ne)},$=()=>{b(!y)},U=()=>{f(void 0),x(void 0)},I=w.useMemo(()=>e.filter(G=>{const ee=n===""||G.message.toLowerCase().includes(n.toLowerCase())||G.module.toLowerCase().includes(n.toLowerCase()),Ne=l==="all"||G.level===l,J=c==="all"||G.module===c;let se=!0;if(m||p){const H=new Date(G.timestamp);if(m){const le=new Date(m);le.setHours(0,0,0,0),se=se&&H>=le}if(p){const le=new Date(p);le.setHours(23,59,59,999),se=se&&H<=le}}return ee&&Ne&&J&&se}),[e,n,l,c,m,p]);return r.jsx(an,{className:"h-full",children:r.jsxs("div",{className:"space-y-4 p-3 sm:p-4 lg:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:he("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",N?"bg-green-500 animate-pulse":"bg-red-500")}),r.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:N?"已连接":"未连接"})]})]}),r.jsx(ct,{className:"p-3 sm:p-4",children:r.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[r.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[r.jsxs("div",{className:"flex-1 relative",children:[r.jsx(Yr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{placeholder:"搜索日志...",value:n,onChange:G=>a(G.target.value),className:"pl-9 h-9 text-sm"})]}),r.jsxs(_t,{value:l,onValueChange:o,children:[r.jsxs(jt,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[r.jsx(Sx,{className:"h-4 w-4 mr-2"}),r.jsx(Et,{placeholder:"级别"})]}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"all",children:"全部级别"}),r.jsx(Oe,{value:"DEBUG",children:"DEBUG"}),r.jsx(Oe,{value:"INFO",children:"INFO"}),r.jsx(Oe,{value:"WARNING",children:"WARNING"}),r.jsx(Oe,{value:"ERROR",children:"ERROR"}),r.jsx(Oe,{value:"CRITICAL",children:"CRITICAL"})]})]}),r.jsxs(_t,{value:c,onValueChange:d,children:[r.jsxs(jt,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[r.jsx(Sx,{className:"h-4 w-4 mr-2"}),r.jsx(Et,{placeholder:"模块"})]}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"all",children:"全部模块"}),M.map(G=>r.jsx(Oe,{value:G,children:G},G))]})]})]}),r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[r.jsxs(Cl,{children:[r.jsx(Tl,{asChild:!0,children:r.jsxs(ne,{variant:"outline",size:"sm",className:he("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!m&&"text-muted-foreground"),children:[r.jsx(Yy,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"text-xs sm:text-sm",children:m?Z0(m,"PPP",{locale:P0}):"开始日期"})]})}),r.jsx(Ps,{className:"w-auto p-0",align:"start",children:r.jsx(A5,{mode:"single",selected:m,onSelect:f,initialFocus:!0,locale:P0})})]}),r.jsxs(Cl,{children:[r.jsx(Tl,{asChild:!0,children:r.jsxs(ne,{variant:"outline",size:"sm",className:he("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!p&&"text-muted-foreground"),children:[r.jsx(Yy,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"text-xs sm:text-sm",children:p?Z0(p,"PPP",{locale:P0}):"结束日期"})]})}),r.jsx(Ps,{className:"w-auto p-0",align:"start",children:r.jsx(A5,{mode:"single",selected:p,onSelect:x,initialFocus:!0,locale:P0})})]}),(m||p)&&r.jsxs(ne,{variant:"outline",size:"sm",onClick:U,className:"w-full sm:w-auto h-9",children:[r.jsx(Au,{className:"h-4 w-4 sm:mr-2"}),r.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),r.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(ne,{variant:y?"default":"outline",size:"sm",onClick:$,className:"flex-1 sm:flex-none h-9",children:[y?r.jsx(_T,{className:"h-4 w-4"}):r.jsx(ET,{className:"h-4 w-4"}),r.jsx("span",{className:"ml-2 text-sm",children:y?"自动滚动":"已暂停"})]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:B,className:"flex-1 sm:flex-none h-9",children:[r.jsx(Ia,{className:"h-4 w-4"}),r.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:O,className:"flex-1 sm:flex-none h-9",children:[r.jsx(zt,{className:"h-4 w-4"}),r.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:L,className:"flex-1 sm:flex-none h-9",children:[r.jsx(hi,{className:"h-4 w-4"}),r.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),r.jsx("div",{className:"flex-1 hidden sm:block"}),r.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[r.jsxs("span",{className:"font-mono",children:[I.length," / ",e.length]}),r.jsx("span",{className:"ml-1",children:"条日志"})]})]})]})}),r.jsx(ct,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900",children:r.jsx(an,{className:"h-[calc(100vh-280px)] sm:h-[calc(100vh-320px)] lg:h-[calc(100vh-400px)]",children:r.jsxs("div",{ref:S,className:"p-2 sm:p-3 lg:p-4 font-mono text-xs sm:text-sm space-y-1",children:[I.length===0?r.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):I.map(G=>r.jsxs("div",{className:he("py-2 px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",R(G.level)),children:[r.jsxs("div",{className:"flex flex-col gap-1 sm:hidden",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-gray-500 dark:text-gray-600 text-xs",children:G.timestamp}),r.jsxs("span",{className:he("text-xs font-semibold",A(G.level)),children:["[",G.level,"]"]})]}),r.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 text-xs truncate",children:G.module}),r.jsx("div",{className:"text-gray-300 dark:text-gray-400 text-xs break-all",children:G.message})]}),r.jsxs("div",{className:"hidden sm:flex gap-3 items-start",children:[r.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[140px] lg:w-[180px] text-xs lg:text-sm",children:G.timestamp}),r.jsxs("span",{className:he("flex-shrink-0 w-[70px] lg:w-[80px] font-semibold text-xs lg:text-sm",A(G.level)),children:["[",G.level,"]"]}),r.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[120px] lg:w-[150px] truncate text-xs lg:text-sm",children:G.module}),r.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 break-all text-xs lg:text-sm",children:G.message})]})]},G.id)),r.jsx("div",{ref:T,className:"h-4"})]})})})]})})}const oY="Mai-with-u",cY="plugin-repo",uY="main",dY="plugin_details.json";async function mY(){try{const e=await lt("/api/webui/plugins/fetch-raw",{method:"POST",headers:pt(),body:JSON.stringify({owner:oY,repo:cY,branch:uY,file_path:dY})});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const t=await e.json();if(!t.success||!t.data)throw new Error(t.error||"获取插件列表失败");return JSON.parse(t.data).filter(l=>!l?.id||!l?.manifest?(console.warn("跳过无效插件数据:",l),!1):!l.manifest.name||!l.manifest.version?(console.warn("跳过缺少必需字段的插件:",l.id),!1):!0).map(l=>({id:l.id,manifest:{manifest_version:l.manifest.manifest_version||1,name:l.manifest.name,version:l.manifest.version,description:l.manifest.description||"",author:l.manifest.author||{name:"Unknown"},license:l.manifest.license||"Unknown",host_application:l.manifest.host_application||{min_version:"0.0.0"},homepage_url:l.manifest.homepage_url,repository_url:l.manifest.repository_url,keywords:l.manifest.keywords||[],categories:l.manifest.categories||[],default_locale:l.manifest.default_locale||"zh-CN",locales_path:l.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(e){throw console.error("Failed to fetch plugin list:",e),e}}async function hY(){try{const e=await lt("/api/webui/plugins/git-status");if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch(e){return console.error("Failed to check Git status:",e),{installed:!1,error:"无法检测 Git 安装状态"}}}async function fY(){try{const e=await lt("/api/webui/plugins/version");if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch(e){return console.error("Failed to get Maimai version:",e),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function pY(e,t,n){const a=e.split(".").map(d=>parseInt(d)||0),l=a[0]||0,o=a[1]||0,c=a[2]||0;if(n.version_majorparseInt(x)||0),m=d[0]||0,f=d[1]||0,p=d[2]||0;if(n.version_major>m||n.version_major===m&&n.version_minor>f||n.version_major===m&&n.version_minor===f&&n.version_patch>p)return!1}return!0}function xY(e,t){const n=window.location.protocol==="https:"?"wss:":"ws:",a=window.location.host,l=new WebSocket(`${n}//${a}/api/webui/ws/plugin-progress`);return l.onopen=()=>{console.log("Plugin progress WebSocket connected");const o=setInterval(()=>{l.readyState===WebSocket.OPEN?l.send("ping"):clearInterval(o)},3e4)},l.onmessage=o=>{try{if(o.data==="pong")return;const c=JSON.parse(o.data);e(c)}catch(c){console.error("Failed to parse progress data:",c)}},l.onerror=o=>{console.error("Plugin progress WebSocket error:",o),t?.(o)},l.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},l}async function F0(){try{const e=await lt("/api/webui/plugins/installed",{headers:pt()});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const t=await e.json();if(!t.success)throw new Error(t.message||"获取已安装插件列表失败");return t.plugins||[]}catch(e){return console.error("Failed to get installed plugins:",e),[]}}function I0(e,t){return t.some(n=>n.id===e)}function q0(e,t){const n=t.find(a=>a.id===e);if(n)return n.manifest?.version||n.version}async function gY(e,t,n="main"){const a=await lt("/api/webui/plugins/install",{method:"POST",headers:pt(),body:JSON.stringify({plugin_id:e,repository_url:t,branch:n})});if(!a.ok){const l=await a.json();throw new Error(l.detail||"安装失败")}return await a.json()}async function vY(e){const t=await lt("/api/webui/plugins/uninstall",{method:"POST",headers:pt(),body:JSON.stringify({plugin_id:e})});if(!t.ok){const n=await t.json();throw new Error(n.detail||"卸载失败")}return await t.json()}async function yY(e,t,n="main"){const a=await lt("/api/webui/plugins/update",{method:"POST",headers:pt(),body:JSON.stringify({plugin_id:e,repository_url:t,branch:n})});if(!a.ok){const l=await a.json();throw new Error(l.detail||"更新失败")}return await a.json()}const ed="https://maibot-plugin-stats.maibot-webui.workers.dev";async function HN(e){try{const t=await fetch(`${ed}/stats/${e}`);return t.ok?await t.json():(console.error("Failed to fetch plugin stats:",t.statusText),null)}catch(t){return console.error("Error fetching plugin stats:",t),null}}async function bY(e,t){try{const n=t||Og(),a=await fetch(`${ed}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:e,user_id:n})}),l=await a.json();return a.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:a.ok?{success:!0,...l}:{success:!1,error:l.error||"点赞失败"}}catch(n){return console.error("Error liking plugin:",n),{success:!1,error:"网络错误"}}}async function wY(e,t){try{const n=t||Og(),a=await fetch(`${ed}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:e,user_id:n})}),l=await a.json();return a.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:a.ok?{success:!0,...l}:{success:!1,error:l.error||"点踩失败"}}catch(n){return console.error("Error disliking plugin:",n),{success:!1,error:"网络错误"}}}async function jY(e,t,n,a){if(t<1||t>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const l=a||Og(),o=await fetch(`${ed}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:e,rating:t,comment:n,user_id:l})}),c=await o.json();return o.status===429?{success:!1,error:"每天最多评分 3 次"}:o.ok?{success:!0,...c}:{success:!1,error:c.error||"评分失败"}}catch(l){return console.error("Error rating plugin:",l),{success:!1,error:"网络错误"}}}async function NY(e){try{const t=await fetch(`${ed}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:e})}),n=await t.json();return t.status===429?(console.warn("Download recording rate limited"),{success:!0}):t.ok?{success:!0,...n}:(console.error("Failed to record download:",n.error),{success:!1,error:n.error})}catch(t){return console.error("Error recording download:",t),{success:!1,error:"网络错误"}}}function SY(){const e=navigator,t=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,e.deviceMemory||0].join("|");let n=0;for(let a=0;a{o(!0);const T=await HN(e);T&&a(T),o(!1)};w.useEffect(()=>{b()},[e]);const N=async()=>{const T=await bY(e);T.success?(y({title:"已点赞",description:"感谢你的支持!"}),b()):y({title:"点赞失败",description:T.error||"未知错误",variant:"destructive"})},k=async()=>{const T=await wY(e);T.success?(y({title:"已反馈",description:"感谢你的反馈!"}),b()):y({title:"操作失败",description:T.error||"未知错误",variant:"destructive"})},S=async()=>{if(c===0){y({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const T=await jY(e,c,m||void 0);T.success?(y({title:"评分成功",description:"感谢你的评价!"}),x(!1),d(0),f(""),b()):y({title:"评分失败",description:T.error||"未知错误",variant:"destructive"})};return l?r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(hi,{className:"h-4 w-4"}),r.jsx("span",{children:"-"})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(wl,{className:"h-4 w-4"}),r.jsx("span",{children:"-"})]})]}):n?t?r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${n.downloads.toLocaleString()}`,children:[r.jsx(hi,{className:"h-4 w-4"}),r.jsx("span",{children:n.downloads.toLocaleString()})]}),r.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${n.rating.toFixed(1)} (${n.rating_count} 条评价)`,children:[r.jsx(wl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),r.jsx("span",{children:n.rating.toFixed(1)})]}),r.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${n.likes}`,children:[r.jsx(yp,{className:"h-4 w-4"}),r.jsx("span",{children:n.likes})]})]}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[r.jsx(hi,{className:"h-5 w-5 text-muted-foreground mb-1"}),r.jsx("span",{className:"text-2xl font-bold",children:n.downloads.toLocaleString()}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),r.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[r.jsx(wl,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),r.jsx("span",{className:"text-2xl font-bold",children:n.rating.toFixed(1)}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.rating_count," 条评价"]})]}),r.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[r.jsx(yp,{className:"h-5 w-5 text-green-500 mb-1"}),r.jsx("span",{className:"text-2xl font-bold",children:n.likes}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),r.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[r.jsx(Wy,{className:"h-5 w-5 text-red-500 mb-1"}),r.jsx("span",{className:"text-2xl font-bold",children:n.dislikes}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ne,{variant:"outline",size:"sm",onClick:N,children:[r.jsx(yp,{className:"h-4 w-4 mr-1"}),"点赞"]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:k,children:[r.jsx(Wy,{className:"h-4 w-4 mr-1"}),"点踩"]}),r.jsxs(ir,{open:p,onOpenChange:x,children:[r.jsx(I1,{asChild:!0,children:r.jsxs(ne,{variant:"default",size:"sm",children:[r.jsx(wl,{className:"h-4 w-4 mr-1"}),"评分"]})}),r.jsxs(Jn,{children:[r.jsxs(er,{children:[r.jsx(tr,{children:"为插件评分"}),r.jsx(xr,{children:"分享你的使用体验,帮助其他用户"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(T=>r.jsx("button",{onClick:()=>d(T),className:"focus:outline-none",children:r.jsx(wl,{className:`h-8 w-8 transition-colors ${T<=c?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},T))}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[c===0&&"点击星星进行评分",c===1&&"很差",c===2&&"一般",c===3&&"还行",c===4&&"不错",c===5&&"非常好"]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),r.jsx(fn,{value:m,onChange:T=>f(T.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),r.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[m.length," / 500"]})]})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>x(!1),children:"取消"}),r.jsx(ne,{onClick:S,disabled:c===0,children:"提交评分"})]})]})]})]}),n.recent_ratings&&n.recent_ratings.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),r.jsx("div",{className:"space-y-3",children:n.recent_ratings.map((T,M)=>r.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(A=>r.jsx(wl,{className:`h-3 w-3 ${A<=T.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},A))}),r.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(T.created_at).toLocaleDateString()})]}),T.comment&&r.jsx("p",{className:"text-sm text-muted-foreground",children:T.comment})]},M))})]})]}):null}const z5={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function CY(){const e=as(),[t,n]=w.useState(null),[a,l]=w.useState(""),[o,c]=w.useState("all"),[d,m]=w.useState("all"),[f,p]=w.useState(!1),[x,y]=w.useState([]),[b,N]=w.useState(!0),[k,S]=w.useState(null),[T,M]=w.useState(null),[A,R]=w.useState(null),[B,O]=w.useState(null),[,L]=w.useState([]),[$,U]=w.useState({}),{toast:I}=or(),G=async E=>{const we=E.map(async X=>{try{const q=await HN(X.id);return{id:X.id,stats:q}}catch(q){return console.warn(`Failed to load stats for ${X.id}:`,q),{id:X.id,stats:null}}}),Z=await Promise.all(we),z={};Z.forEach(({id:X,stats:q})=>{q&&(z[X]=q)}),U(z)};w.useEffect(()=>{let E=null,we=!1;return(async()=>{if(E=xY(z=>{we||(R(z),z.stage==="success"?setTimeout(()=>{we||R(null)},2e3):z.stage==="error"&&(N(!1),S(z.error||"加载失败")))},z=>{console.error("WebSocket error:",z),we||I({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(z=>{if(!E){z();return}const X=()=>{E&&E.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),z()):E&&E.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),z()):setTimeout(X,100)};X()}),!we){const z=await hY();M(z),z.installed||I({title:"Git 未安装",description:z.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!we){const z=await fY();O(z)}if(!we)try{N(!0),S(null);const z=await mY();if(!we){const X=await F0();L(X);const q=z.map(ce=>{const fe=I0(ce.id,X),De=q0(ce.id,X);return{...ce,installed:fe,installed_version:De}});for(const ce of X)!q.some(De=>De.id===ce.id)&&ce.manifest&&q.push({id:ce.id,manifest:{manifest_version:ce.manifest.manifest_version||1,name:ce.manifest.name,version:ce.manifest.version,description:ce.manifest.description||"",author:ce.manifest.author,license:ce.manifest.license||"Unknown",host_application:ce.manifest.host_application,homepage_url:ce.manifest.homepage_url,repository_url:ce.manifest.repository_url,keywords:ce.manifest.keywords||[],categories:ce.manifest.categories||[],default_locale:ce.manifest.default_locale||"zh-CN",locales_path:ce.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:ce.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});y(q),G(q)}}catch(z){if(!we){const X=z instanceof Error?z.message:"加载插件列表失败";S(X),I({title:"加载失败",description:X,variant:"destructive"})}}finally{we||N(!1)}})(),()=>{we=!0,E&&E.close()}},[I]);const ee=E=>{if(!E.installed&&B&&!Ne(E))return r.jsxs(un,{variant:"destructive",className:"gap-1",children:[r.jsx(xi,{className:"h-3 w-3"}),"不兼容"]});if(E.installed){const we=E.installed_version?.trim(),Z=E.manifest.version?.trim();if(we!==Z){const z=we?.split(".").map(Number)||[0,0,0],X=Z?.split(".").map(Number)||[0,0,0];for(let q=0;q<3;q++){if((X[q]||0)>(z[q]||0))return r.jsxs(un,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[r.jsx(xi,{className:"h-3 w-3"}),"可更新"]});if((X[q]||0)<(z[q]||0))break}}return r.jsxs(un,{variant:"default",className:"gap-1",children:[r.jsx($r,{className:"h-3 w-3"}),"已安装"]})}return null},Ne=E=>!B||!E.manifest?.host_application?!0:pY(E.manifest.host_application.min_version,E.manifest.host_application.max_version,B),J=E=>{if(!E.installed||!E.installed_version||!E.manifest?.version)return!1;const we=E.installed_version.trim(),Z=E.manifest.version.trim();if(we===Z)return!1;const z=we.split(".").map(Number),X=Z.split(".").map(Number);for(let q=0;q<3;q++){if((X[q]||0)>(z[q]||0))return!0;if((X[q]||0)<(z[q]||0))return!1}return!1},se=x.filter(E=>{if(!E.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",E.id),!1;const we=a===""||E.manifest.name?.toLowerCase().includes(a.toLowerCase())||E.manifest.description?.toLowerCase().includes(a.toLowerCase())||E.manifest.keywords&&E.manifest.keywords.some(q=>q.toLowerCase().includes(a.toLowerCase())),Z=o==="all"||E.manifest.categories&&E.manifest.categories.includes(o);let z=!0;d==="installed"?z=E.installed===!0:d==="updates"&&(z=E.installed===!0&&J(E));const X=!f||!B||Ne(E);return we&&Z&&z&&X}),H=()=>{n(null)},le=async E=>{if(!T?.installed){I({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(B&&!Ne(E)){I({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await gY(E.id,E.manifest.repository_url||"","main"),NY(E.id).catch(Z=>{console.warn("Failed to record download:",Z)}),I({title:"安装成功",description:`${E.manifest.name} 已成功安装`});const we=await F0();L(we),y(Z=>Z.map(z=>{if(z.id===E.id){const X=I0(z.id,we),q=q0(z.id,we);return{...z,installed:X,installed_version:q}}return z}))}catch(we){I({title:"安装失败",description:we instanceof Error?we.message:"未知错误",variant:"destructive"})}},re=async E=>{try{await vY(E.id),I({title:"卸载成功",description:`${E.manifest.name} 已成功卸载`});const we=await F0();L(we),y(Z=>Z.map(z=>{if(z.id===E.id){const X=I0(z.id,we),q=q0(z.id,we);return{...z,installed:X,installed_version:q}}return z}))}catch(we){I({title:"卸载失败",description:we instanceof Error?we.message:"未知错误",variant:"destructive"})}},ge=async E=>{if(!T?.installed){I({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const we=await yY(E.id,E.manifest.repository_url||"","main");I({title:"更新成功",description:`${E.manifest.name} 已从 ${we.old_version} 更新到 ${we.new_version}`});const Z=await F0();L(Z),y(z=>z.map(X=>{if(X.id===E.id){const q=I0(X.id,Z),ce=q0(X.id,Z);return{...X,installed:q,installed_version:ce}}return X}))}catch(we){I({title:"更新失败",description:we instanceof Error?we.message:"未知错误",variant:"destructive"})}};return r.jsx(an,{className:"h-full",children:r.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),r.jsxs(ne,{onClick:()=>e({to:"/plugin-mirrors"}),children:[r.jsx(MT,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),T&&!T.installed&&r.jsxs(ct,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[r.jsx(Lt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ao,{className:"h-5 w-5 text-orange-600"}),r.jsxs("div",{children:[r.jsx(Bt,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),r.jsx(Qn,{className:"text-orange-800 dark:text-orange-200",children:T.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),r.jsx(Gt,{children:r.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",r.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),r.jsx(ct,{className:"p-4",children:r.jsxs("div",{className:"flex flex-col gap-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"flex-1 relative",children:[r.jsx(Yr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{placeholder:"搜索插件...",value:a,onChange:E=>l(E.target.value),className:"pl-9"})]}),r.jsxs(_t,{value:o,onValueChange:c,children:[r.jsx(jt,{className:"w-full sm:w-[200px]",children:r.jsx(Et,{placeholder:"选择分类"})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"all",children:"全部分类"}),r.jsx(Oe,{value:"Group Management",children:"群组管理"}),r.jsx(Oe,{value:"Entertainment & Interaction",children:"娱乐互动"}),r.jsx(Oe,{value:"Utility Tools",children:"实用工具"}),r.jsx(Oe,{value:"Content Generation",children:"内容生成"}),r.jsx(Oe,{value:"Multimedia",children:"多媒体"}),r.jsx(Oe,{value:"External Integration",children:"外部集成"}),r.jsx(Oe,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),r.jsx(Oe,{value:"Other",children:"其他"})]})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(jr,{id:"compatible-only",checked:f,onCheckedChange:E=>p(E===!0)}),r.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),r.jsx(kl,{value:d,onValueChange:m,className:"w-full",children:r.jsxs(Bs,{className:"grid w-full grid-cols-3",children:[r.jsxs(Pt,{value:"all",children:["全部插件 (",x.length,")"]}),r.jsxs(Pt,{value:"installed",children:["已安装 (",x.filter(E=>E.installed).length,")"]}),r.jsxs(Pt,{value:"updates",children:["可更新 (",x.filter(E=>E.installed&&J(E)).length,")"]})]})}),A&&A.stage==="loading"&&r.jsx(ct,{className:"p-4",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(xu,{className:"h-4 w-4 animate-spin"}),r.jsxs("span",{className:"text-sm font-medium",children:[A.operation==="fetch"&&"加载插件列表",A.operation==="install"&&`安装插件${A.plugin_id?`: ${A.plugin_id}`:""}`,A.operation==="uninstall"&&`卸载插件${A.plugin_id?`: ${A.plugin_id}`:""}`,A.operation==="update"&&`更新插件${A.plugin_id?`: ${A.plugin_id}`:""}`]})]}),r.jsxs("span",{className:"text-sm font-medium",children:[A.progress,"%"]})]}),r.jsx(Fu,{value:A.progress,className:"h-2"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:A.message}),A.operation==="fetch"&&A.total_plugins>0&&r.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",A.loaded_plugins," / ",A.total_plugins," 个插件"]})]})}),A&&A.stage==="error"&&A.error&&r.jsx(ct,{className:"border-destructive bg-destructive/10",children:r.jsx(Lt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ao,{className:"h-5 w-5 text-destructive"}),r.jsxs("div",{children:[r.jsx(Bt,{className:"text-lg text-destructive",children:"加载失败"}),r.jsx(Qn,{className:"text-destructive/80",children:A.error})]})]})})}),b?r.jsxs("div",{className:"flex items-center justify-center py-12",children:[r.jsx(xu,{className:"h-8 w-8 animate-spin text-muted-foreground"}),r.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):k?r.jsx(ct,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[r.jsx(Ao,{className:"h-12 w-12 text-destructive mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:k}),r.jsx(ne,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):se.length===0?r.jsx(ct,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[r.jsx(Yr,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:a||o!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:se.map(E=>r.jsxs(ct,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[r.jsxs(Lt,{children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx(Bt,{className:"text-xl",children:E.manifest?.name||E.id}),r.jsxs("div",{className:"flex flex-col gap-1",children:[E.manifest?.categories&&E.manifest.categories[0]&&r.jsx(un,{variant:"secondary",className:"text-xs whitespace-nowrap",children:z5[E.manifest.categories[0]]||E.manifest.categories[0]}),ee(E)]})]}),r.jsx(Qn,{className:"line-clamp-2",children:E.manifest?.description||"无描述"})]}),r.jsx(Gt,{className:"flex-1",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(hi,{className:"h-4 w-4"}),r.jsx("span",{children:($[E.id]?.downloads??E.downloads??0).toLocaleString()})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(wl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),r.jsx("span",{children:($[E.id]?.rating??E.rating??0).toFixed(1)})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[E.manifest?.keywords&&E.manifest.keywords.slice(0,3).map(we=>r.jsx(un,{variant:"outline",className:"text-xs",children:we},we)),E.manifest?.keywords&&E.manifest.keywords.length>3&&r.jsxs(un,{variant:"outline",className:"text-xs",children:["+",E.manifest.keywords.length-3]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[r.jsxs("div",{children:["v",E.manifest?.version||"unknown"," · ",E.manifest?.author?.name||"Unknown"]}),E.manifest?.host_application&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("span",{children:"支持:"}),r.jsxs("span",{className:"font-medium",children:[E.manifest.host_application.min_version,E.manifest.host_application.max_version?` - ${E.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),r.jsx(Y6,{className:"pt-4",children:r.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>n(E),children:"查看详情"}),E.installed?J(E)?r.jsxs(ne,{size:"sm",disabled:!T?.installed,title:T?.installed?void 0:"Git 未安装",onClick:()=>ge(E),children:[r.jsx(Ia,{className:"h-4 w-4 mr-1"}),"更新"]}):r.jsxs(ne,{variant:"destructive",size:"sm",disabled:!T?.installed,title:T?.installed?void 0:"Git 未安装",onClick:()=>re(E),children:[r.jsx(zt,{className:"h-4 w-4 mr-1"}),"卸载"]}):r.jsxs(ne,{size:"sm",disabled:!T?.installed||A?.operation==="install"||B!==null&&!Ne(E),title:T?.installed?B!==null&&!Ne(E)?`不兼容当前版本 (需要 ${E.manifest?.host_application?.min_version||"未知"}${E.manifest?.host_application?.max_version?` - ${E.manifest.host_application.max_version}`:"+"},当前 ${B?.version})`:void 0:"Git 未安装",onClick:()=>le(E),children:[r.jsx(hi,{className:"h-4 w-4 mr-1"}),A?.operation==="install"&&A?.plugin_id===E.id?"安装中...":"安装"]})]})})]},E.id))}),r.jsx(ir,{open:t!==null,onOpenChange:H,children:t&&t.manifest&&r.jsxs(Jn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsx(er,{children:r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"space-y-2 flex-1",children:[r.jsx(tr,{className:"text-2xl",children:t.manifest.name}),r.jsxs(xr,{children:["作者: ",t.manifest.author?.name||"Unknown",t.manifest.author?.url&&r.jsx("a",{href:t.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:r.jsx(ou,{className:"h-3 w-3 inline"})})]})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[t.manifest.categories&&t.manifest.categories[0]&&r.jsx(un,{variant:"secondary",children:z5[t.manifest.categories[0]]||t.manifest.categories[0]}),ee(t)]})]})}),r.jsxs("div",{className:"space-y-6",children:[r.jsx(kY,{pluginId:t.id}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"版本"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",t.manifest?.version||"unknown"]}),t.installed&&t.installed_version&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",t.installed_version]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"下载量"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:($[t.id]?.downloads??t.downloads??0).toLocaleString()})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"评分"}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(wl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[($[t.id]?.rating??t.rating??0).toFixed(1)," (",$[t.id]?.rating_count??t.review_count??0,")"]})]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"许可证"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:t.manifest.license||"Unknown"})]}),r.jsxs("div",{className:"col-span-2",children:[r.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.manifest.host_application?.min_version||"未知",t.manifest.host_application?.max_version?` - ${t.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:t.manifest.keywords&&t.manifest.keywords.map(E=>r.jsx(un,{variant:"outline",children:E},E))})]}),t.detailed_description&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:t.detailed_description})]}),!t.detailed_description&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:t.manifest.description||"无描述"})]}),r.jsxs("div",{className:"space-y-2",children:[t.manifest.homepage_url&&r.jsxs("div",{className:"text-sm",children:[r.jsx("span",{className:"font-medium",children:"主页: "}),r.jsx("a",{href:t.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:t.manifest.homepage_url})]}),t.manifest.repository_url&&r.jsxs("div",{className:"text-sm",children:[r.jsx("span",{className:"font-medium",children:"仓库: "}),r.jsx("a",{href:t.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:t.manifest.repository_url})]})]})]}),r.jsxs(Er,{children:[t.manifest.homepage_url&&r.jsxs(ne,{onClick:()=>window.open(t.manifest.homepage_url,"_blank"),children:[r.jsx(ou,{className:"h-4 w-4 mr-2"}),"访问主页"]}),t.manifest.repository_url&&r.jsxs(ne,{variant:"outline",onClick:()=>window.open(t.manifest.repository_url,"_blank"),children:[r.jsx(ou,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function TY(){return r.jsx(an,{className:"h-full",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),r.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ne,{variant:"outline",size:"sm",children:[r.jsx(Ia,{className:"h-4 w-4 mr-2"}),"刷新"]}),r.jsxs(ne,{size:"sm",children:[r.jsx(Pa,{className:"h-4 w-4 mr-2"}),"全局设置"]})]})]}),r.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"已安装插件"}),r.jsx(nm,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Gt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:"0"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"正在加载..."})]})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"已启用"}),r.jsx($r,{className:"h-4 w-4 text-green-600"})]}),r.jsxs(Gt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:"0"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"已禁用"}),r.jsx(xi,{className:"h-4 w-4 text-orange-600"})]}),r.jsxs(Gt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:"0"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"可更新"}),r.jsx(Ia,{className:"h-4 w-4 text-blue-600"})]}),r.jsxs(Gt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:"0"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"有新版本可用"})]})]})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"已安装的插件"}),r.jsx(Qn,{children:"查看和管理已安装插件的配置"})]}),r.jsx(Gt,{children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[r.jsx(nm,{className:"h-16 w-16 text-muted-foreground/50"}),r.jsxs("div",{className:"text-center space-y-2",children:[r.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"插件配置功能开发中"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"即将支持插件的启用/禁用、参数配置等功能"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsx(ne,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:"/plugins",children:[r.jsx(ou,{className:"h-4 w-4 mr-2"}),"前往插件市场"]})})})]})})]}),r.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[r.jsxs(ct,{children:[r.jsx(Lt,{children:r.jsx(Bt,{className:"text-base",children:"即将推出的功能"})}),r.jsx(Gt,{children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:r.jsx($r,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"插件启用/禁用"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"快速切换插件运行状态"})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:r.jsx($r,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"配置参数编辑"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"可视化编辑插件配置文件"})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:r.jsx($r,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"依赖管理"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"查看和安装插件依赖包"})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:r.jsx($r,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"插件日志"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"查看插件运行日志和错误信息"})]})]})]})})]}),r.jsxs(ct,{children:[r.jsx(Lt,{children:r.jsx(Bt,{className:"text-base",children:"开发者工具"})}),r.jsx(Gt,{children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:r.jsx(Pa,{className:"h-4 w-4 text-blue-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"热重载"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"无需重启即可重新加载插件"})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:r.jsx(Pa,{className:"h-4 w-4 text-blue-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"配置验证"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"检查配置文件格式和完整性"})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:r.jsx(Pa,{className:"h-4 w-4 text-blue-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"性能监控"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"监控插件的资源占用情况"})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:r.jsx(Pa,{className:"h-4 w-4 text-blue-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"调试模式"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"详细的调试信息和错误追踪"})]})]})]})})]})]}),r.jsx(ct,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:r.jsx(Gt,{className:"pt-6",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(xi,{className:"h-5 w-5 text-blue-600 mt-0.5 flex-shrink-0"}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"开发进行中"}),r.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["插件配置功能正在积极开发中。目前您可以通过",r.jsx("strong",{children:"插件市场"}),"安装和卸载插件,完整的配置管理功能即将推出。"]})]})]})})})]})})}function _Y(){const e=as(),{toast:t}=or(),[n,a]=w.useState([]),[l,o]=w.useState(!0),[c,d]=w.useState(null),[m,f]=w.useState(null),[p,x]=w.useState(!1),[y,b]=w.useState(!1),[N,k]=w.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S=w.useCallback(async()=>{try{o(!0),d(null);const L=localStorage.getItem("access-token"),$=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${L}`}});if(!$.ok)throw new Error("获取镜像源列表失败");const U=await $.json();a(U.mirrors||[])}catch(L){const $=L instanceof Error?L.message:"加载镜像源失败";d($),t({title:"加载失败",description:$,variant:"destructive"})}finally{o(!1)}},[t]);w.useEffect(()=>{S()},[S]);const T=async()=>{try{const L=localStorage.getItem("access-token"),$=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${L}`,"Content-Type":"application/json"},body:JSON.stringify(N)});if(!$.ok){const U=await $.json();throw new Error(U.detail||"添加镜像源失败")}t({title:"添加成功",description:"镜像源已添加"}),x(!1),k({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S()}catch(L){t({title:"添加失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},M=async()=>{if(m)try{const L=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${m.id}`,{method:"PUT",headers:{Authorization:`Bearer ${L}`,"Content-Type":"application/json"},body:JSON.stringify({name:N.name,raw_prefix:N.raw_prefix,clone_prefix:N.clone_prefix,enabled:N.enabled,priority:N.priority})})).ok)throw new Error("更新镜像源失败");t({title:"更新成功",description:"镜像源已更新"}),b(!1),f(null),S()}catch(L){t({title:"更新失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},A=async L=>{if(confirm("确定要删除这个镜像源吗?"))try{const $=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${L}`,{method:"DELETE",headers:{Authorization:`Bearer ${$}`}})).ok)throw new Error("删除镜像源失败");t({title:"删除成功",description:"镜像源已删除"}),S()}catch($){t({title:"删除失败",description:$ instanceof Error?$.message:"未知错误",variant:"destructive"})}},R=async L=>{try{const $=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${L.id}`,{method:"PUT",headers:{Authorization:`Bearer ${$}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!L.enabled})})).ok)throw new Error("更新状态失败");S()}catch($){t({title:"更新失败",description:$ instanceof Error?$.message:"未知错误",variant:"destructive"})}},B=L=>{f(L),k({id:L.id,name:L.name,raw_prefix:L.raw_prefix,clone_prefix:L.clone_prefix,enabled:L.enabled,priority:L.priority}),b(!0)},O=async(L,$)=>{const U=$==="up"?L.priority-1:L.priority+1;if(!(U<1))try{const I=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${L.id}`,{method:"PUT",headers:{Authorization:`Bearer ${I}`,"Content-Type":"application/json"},body:JSON.stringify({priority:U})})).ok)throw new Error("更新优先级失败");S()}catch(I){t({title:"更新失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"})}};return r.jsx(an,{className:"h-full",children:r.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(ne,{variant:"ghost",size:"icon",onClick:()=>e({to:"/plugins"}),children:r.jsx(i6,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),r.jsxs(ne,{onClick:()=>x(!0),children:[r.jsx(pr,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),l?r.jsx(ct,{className:"p-6",children:r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(xu,{className:"h-8 w-8 animate-spin text-primary"})})}):c?r.jsx(ct,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[r.jsx(Ao,{className:"h-12 w-12 text-destructive mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:c}),r.jsx(ne,{onClick:S,children:"重新加载"})]})}):r.jsxs(ct,{children:[r.jsx("div",{className:"hidden md:block",children:r.jsxs(ji,{children:[r.jsx(Ni,{children:r.jsxs(Vn,{children:[r.jsx(ut,{children:"状态"}),r.jsx(ut,{children:"名称"}),r.jsx(ut,{children:"ID"}),r.jsx(ut,{children:"优先级"}),r.jsx(ut,{className:"text-right",children:"操作"})]})}),r.jsx(Si,{children:n.map(L=>r.jsxs(Vn,{children:[r.jsx(et,{children:r.jsx(vt,{checked:L.enabled,onCheckedChange:()=>R(L)})}),r.jsx(et,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:L.name}),r.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",L.raw_prefix]})]})}),r.jsx(et,{children:r.jsx(un,{variant:"outline",children:L.id})}),r.jsx(et,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-mono",children:L.priority}),r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(ne,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>O(L,"up"),disabled:L.priority===1,children:r.jsx(Nx,{className:"h-3 w-3"})}),r.jsx(ne,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>O(L,"down"),children:r.jsx(pu,{className:"h-3 w-3"})})]})]})}),r.jsx(et,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(ne,{variant:"ghost",size:"icon",onClick:()=>B(L),children:r.jsx(Bo,{className:"h-4 w-4"})}),r.jsx(ne,{variant:"ghost",size:"icon",onClick:()=>A(L.id),children:r.jsx(zt,{className:"h-4 w-4 text-destructive"})})]})})]},L.id))})]})}),r.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(L=>r.jsx(ct,{className:"p-4",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"font-semibold",children:L.name}),L.enabled&&r.jsx(un,{variant:"default",className:"text-xs",children:"启用"})]}),r.jsx(un,{variant:"outline",className:"mt-1 text-xs",children:L.id})]}),r.jsx(vt,{checked:L.enabled,onCheckedChange:()=>R(L)})]}),r.jsxs("div",{className:"text-sm space-y-1",children:[r.jsxs("div",{className:"text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Raw: "}),r.jsx("span",{className:"break-all",children:L.raw_prefix})]}),r.jsxs("div",{className:"text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"优先级: "}),r.jsx("span",{className:"font-mono",children:L.priority})]})]}),r.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[r.jsxs(ne,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>B(L),children:[r.jsx(Bo,{className:"h-4 w-4 mr-1"}),"编辑"]}),r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>O(L,"up"),disabled:L.priority===1,children:r.jsx(Nx,{className:"h-4 w-4"})}),r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>O(L,"down"),children:r.jsx(pu,{className:"h-4 w-4"})}),r.jsx(ne,{variant:"destructive",size:"sm",onClick:()=>A(L.id),children:r.jsx(zt,{className:"h-4 w-4"})})]})]})},L.id))})]}),r.jsx(ir,{open:p,onOpenChange:x,children:r.jsxs(Jn,{className:"max-w-lg",children:[r.jsxs(er,{children:[r.jsx(tr,{children:"添加镜像源"}),r.jsx(xr,{children:"添加新的 Git 镜像源配置"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"add-id",children:"镜像源 ID *"}),r.jsx(Te,{id:"add-id",placeholder:"例如: my-mirror",value:N.id,onChange:L=>k({...N,id:L.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"add-name",children:"名称 *"}),r.jsx(Te,{id:"add-name",placeholder:"例如: 我的镜像源",value:N.name,onChange:L=>k({...N,name:L.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),r.jsx(Te,{id:"add-raw",placeholder:"https://example.com/raw",value:N.raw_prefix,onChange:L=>k({...N,raw_prefix:L.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"add-clone",children:"克隆前缀 *"}),r.jsx(Te,{id:"add-clone",placeholder:"https://example.com/clone",value:N.clone_prefix,onChange:L=>k({...N,clone_prefix:L.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"add-priority",children:"优先级"}),r.jsx(Te,{id:"add-priority",type:"number",min:"1",value:N.priority,onChange:L=>k({...N,priority:parseInt(L.target.value)||1})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"add-enabled",checked:N.enabled,onCheckedChange:L=>k({...N,enabled:L})}),r.jsx(Q,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>x(!1),children:"取消"}),r.jsx(ne,{onClick:T,children:"添加"})]})]})}),r.jsx(ir,{open:y,onOpenChange:b,children:r.jsxs(Jn,{className:"max-w-lg",children:[r.jsxs(er,{children:[r.jsx(tr,{children:"编辑镜像源"}),r.jsx(xr,{children:"修改镜像源配置"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{children:"镜像源 ID"}),r.jsx(Te,{value:N.id,disabled:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit-name",children:"名称 *"}),r.jsx(Te,{id:"edit-name",value:N.name,onChange:L=>k({...N,name:L.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),r.jsx(Te,{id:"edit-raw",value:N.raw_prefix,onChange:L=>k({...N,raw_prefix:L.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit-clone",children:"克隆前缀 *"}),r.jsx(Te,{id:"edit-clone",value:N.clone_prefix,onChange:L=>k({...N,clone_prefix:L.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit-priority",children:"优先级"}),r.jsx(Te,{id:"edit-priority",type:"number",min:"1",value:N.priority,onChange:L=>k({...N,priority:parseInt(L.target.value)||1})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"edit-enabled",checked:N.enabled,onCheckedChange:L=>k({...N,enabled:L})}),r.jsx(Q,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>b(!1),children:"取消"}),r.jsx(ne,{onClick:M,children:"保存"})]})]})})]})})}const EY=Ko("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),UN=w.forwardRef(({className:e,size:t,abbrTitle:n,children:a,...l},o)=>r.jsx("kbd",{className:he(EY({size:t,className:e})),ref:o,...l,children:n?r.jsx("abbr",{title:n,children:a}):a}));UN.displayName="Kbd";const MY=[{icon:J0,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:Nl,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:o6,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:c6,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:N1,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Mu,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:u6,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:AT,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:nm,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:em,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:Pa,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function AY({open:e,onOpenChange:t}){const[n,a]=w.useState(""),[l,o]=w.useState(0),c=as(),d=MY.filter(p=>p.title.toLowerCase().includes(n.toLowerCase())||p.description.toLowerCase().includes(n.toLowerCase())||p.category.toLowerCase().includes(n.toLowerCase()));w.useEffect(()=>{e&&(a(""),o(0))},[e]);const m=w.useCallback(p=>{c({to:p}),t(!1)},[c,t]),f=w.useCallback(p=>{p.key==="ArrowDown"?(p.preventDefault(),o(x=>(x+1)%d.length)):p.key==="ArrowUp"?(p.preventDefault(),o(x=>(x-1+d.length)%d.length)):p.key==="Enter"&&d[l]&&(p.preventDefault(),m(d[l].path))},[d,l,m]);return r.jsx(ir,{open:e,onOpenChange:t,children:r.jsxs(Jn,{className:"max-w-2xl p-0 gap-0",children:[r.jsxs(er,{className:"px-4 pt-4 pb-0",children:[r.jsx(tr,{className:"sr-only",children:"搜索"}),r.jsxs("div",{className:"relative",children:[r.jsx(Yr,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),r.jsx(Te,{value:n,onChange:p=>{a(p.target.value),o(0)},onKeyDown:f,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),r.jsx("div",{className:"border-t",children:r.jsx(an,{className:"h-[400px]",children:d.length>0?r.jsx("div",{className:"p-2",children:d.map((p,x)=>{const y=p.icon;return r.jsxs("button",{onClick:()=>m(p.path),onMouseEnter:()=>o(x),className:he("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",x===l?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[r.jsx(y,{className:"h-5 w-5 flex-shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium text-sm",children:p.title}),r.jsx("div",{className:"text-xs text-muted-foreground truncate",children:p.description})]}),r.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:p.category})]},p.path)})}):r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Yr,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),r.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),r.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function DY(e){const t=zY(e),n=w.forwardRef((a,l)=>{const{children:o,...c}=a,d=w.Children.toArray(o),m=d.find(RY);if(m){const f=m.props.children,p=d.map(x=>x===m?w.Children.count(f)>1?w.Children.only(null):w.isValidElement(f)?f.props.children:null:x);return r.jsx(t,{...c,ref:l,children:w.isValidElement(f)?w.cloneElement(f,void 0,p):null})}return r.jsx(t,{...c,ref:l,children:o})});return n.displayName=`${e}.Slot`,n}function zY(e){const t=w.forwardRef((n,a)=>{const{children:l,...o}=n;if(w.isValidElement(l)){const c=BY(l),d=LY(o,l.props);return l.type!==w.Fragment&&(d.ref=a?Sl(a,c):c),w.cloneElement(l,d)}return w.Children.count(l)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var OY=Symbol("radix.slottable");function RY(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===OY}function LY(e,t){const n={...t};for(const a in t){const l=e[a],o=t[a];/^on[A-Z]/.test(a)?l&&o?n[a]=(...d)=>{const m=o(...d);return l(...d),m}:l&&(n[a]=l):a==="style"?n[a]={...l,...o}:a==="className"&&(n[a]=[l,o].filter(Boolean).join(" "))}return{...e,...n}}function BY(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var i1=["Enter"," "],PY=["ArrowDown","PageUp","Home"],$N=["ArrowUp","PageDown","End"],FY=[...PY,...$N],IY={ltr:[...i1,"ArrowRight"],rtl:[...i1,"ArrowLeft"]},qY={ltr:["ArrowLeft"],rtl:["ArrowRight"]},td="Menu",[Cu,HY,UY]=bm(td),[Mi,VN]=Ua(td,[UY,Vo,Dm]),nd=Vo(),GN=Dm(),[YN,Pl]=Mi(td),[$Y,rd]=Mi(td),WN=e=>{const{__scopeMenu:t,open:n=!1,children:a,dir:l,onOpenChange:o,modal:c=!0}=e,d=nd(t),[m,f]=w.useState(null),p=w.useRef(!1),x=yr(o),y=Eu(l);return w.useEffect(()=>{const b=()=>{p.current=!0,document.addEventListener("pointerdown",N,{capture:!0,once:!0}),document.addEventListener("pointermove",N,{capture:!0,once:!0})},N=()=>p.current=!1;return document.addEventListener("keydown",b,{capture:!0}),()=>{document.removeEventListener("keydown",b,{capture:!0}),document.removeEventListener("pointerdown",N,{capture:!0}),document.removeEventListener("pointermove",N,{capture:!0})}},[]),r.jsx(Sm,{...d,children:r.jsx(YN,{scope:t,open:n,onOpenChange:x,content:m,onContentChange:f,children:r.jsx($Y,{scope:t,onClose:w.useCallback(()=>x(!1),[x]),isUsingKeyboardRef:p,dir:y,modal:c,children:a})})})};WN.displayName=td;var VY="MenuAnchor",Rg=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,l=nd(n);return r.jsx(km,{...l,...a,ref:t})});Rg.displayName=VY;var Lg="MenuPortal",[GY,XN]=Mi(Lg,{forceMount:void 0}),KN=e=>{const{__scopeMenu:t,forceMount:n,children:a,container:l}=e,o=Pl(Lg,t);return r.jsx(GY,{scope:t,forceMount:n,children:r.jsx(Wr,{present:n||o.open,children:r.jsx(Nm,{asChild:!0,container:l,children:a})})})};KN.displayName=Lg;var _a="MenuContent",[YY,Bg]=Mi(_a),QN=w.forwardRef((e,t)=>{const n=XN(_a,e.__scopeMenu),{forceMount:a=n.forceMount,...l}=e,o=Pl(_a,e.__scopeMenu),c=rd(_a,e.__scopeMenu);return r.jsx(Cu.Provider,{scope:e.__scopeMenu,children:r.jsx(Wr,{present:a||o.open,children:r.jsx(Cu.Slot,{scope:e.__scopeMenu,children:c.modal?r.jsx(WY,{...l,ref:t}):r.jsx(XY,{...l,ref:t})})})})}),WY=w.forwardRef((e,t)=>{const n=Pl(_a,e.__scopeMenu),a=w.useRef(null),l=mn(t,a);return w.useEffect(()=>{const o=a.current;if(o)return Z5(o)},[]),r.jsx(Pg,{...e,ref:l,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Pe(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),XY=w.forwardRef((e,t)=>{const n=Pl(_a,e.__scopeMenu);return r.jsx(Pg,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),KY=DY("MenuContent.ScrollLock"),Pg=w.forwardRef((e,t)=>{const{__scopeMenu:n,loop:a=!1,trapFocus:l,onOpenAutoFocus:o,onCloseAutoFocus:c,disableOutsidePointerEvents:d,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:p,onFocusOutside:x,onInteractOutside:y,onDismiss:b,disableOutsideScroll:N,...k}=e,S=Pl(_a,n),T=rd(_a,n),M=nd(n),A=GN(n),R=HY(n),[B,O]=w.useState(null),L=w.useRef(null),$=mn(t,L,S.onContentChange),U=w.useRef(0),I=w.useRef(""),G=w.useRef(0),ee=w.useRef(null),Ne=w.useRef("right"),J=w.useRef(0),se=N?J5:w.Fragment,H=N?{as:KY,allowPinchZoom:!0}:void 0,le=ge=>{const E=I.current+ge,we=R().filter(fe=>!fe.disabled),Z=document.activeElement,z=we.find(fe=>fe.ref.current===Z)?.textValue,X=we.map(fe=>fe.textValue),q=oW(X,E,z),ce=we.find(fe=>fe.textValue===q)?.ref.current;(function fe(De){I.current=De,window.clearTimeout(U.current),De!==""&&(U.current=window.setTimeout(()=>fe(""),1e3))})(E),ce&&setTimeout(()=>ce.focus())};w.useEffect(()=>()=>window.clearTimeout(U.current),[]),e6();const re=w.useCallback(ge=>Ne.current===ee.current?.side&&uW(ge,ee.current?.area),[]);return r.jsx(YY,{scope:n,searchRef:I,onItemEnter:w.useCallback(ge=>{re(ge)&&ge.preventDefault()},[re]),onItemLeave:w.useCallback(ge=>{re(ge)||(L.current?.focus(),O(null))},[re]),onTriggerLeave:w.useCallback(ge=>{re(ge)&&ge.preventDefault()},[re]),pointerGraceTimerRef:G,onPointerGraceIntentChange:w.useCallback(ge=>{ee.current=ge},[]),children:r.jsx(se,{...H,children:r.jsx(t6,{asChild:!0,trapped:l,onMountAutoFocus:Pe(o,ge=>{ge.preventDefault(),L.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:c,children:r.jsx(b1,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:f,onPointerDownOutside:p,onFocusOutside:x,onInteractOutside:y,onDismiss:b,children:r.jsx(J6,{asChild:!0,...A,dir:T.dir,orientation:"vertical",loop:a,currentTabStopId:B,onCurrentTabStopIdChange:O,onEntryFocus:Pe(m,ge=>{T.isUsingKeyboardRef.current||ge.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(w1,{role:"menu","aria-orientation":"vertical","data-state":f9(S.open),"data-radix-menu-content":"",dir:T.dir,...M,...k,ref:$,style:{outline:"none",...k.style},onKeyDown:Pe(k.onKeyDown,ge=>{const we=ge.target.closest("[data-radix-menu-content]")===ge.currentTarget,Z=ge.ctrlKey||ge.altKey||ge.metaKey,z=ge.key.length===1;we&&(ge.key==="Tab"&&ge.preventDefault(),!Z&&z&&le(ge.key));const X=L.current;if(ge.target!==X||!FY.includes(ge.key))return;ge.preventDefault();const ce=R().filter(fe=>!fe.disabled).map(fe=>fe.ref.current);$N.includes(ge.key)&&ce.reverse(),lW(ce)}),onBlur:Pe(e.onBlur,ge=>{ge.currentTarget.contains(ge.target)||(window.clearTimeout(U.current),I.current="")}),onPointerMove:Pe(e.onPointerMove,Tu(ge=>{const E=ge.target,we=J.current!==ge.clientX;if(ge.currentTarget.contains(E)&&we){const Z=ge.clientX>J.current?"right":"left";Ne.current=Z,J.current=ge.clientX}}))})})})})})})});QN.displayName=_a;var QY="MenuGroup",Fg=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return r.jsx(It.div,{role:"group",...a,ref:t})});Fg.displayName=QY;var ZY="MenuLabel",ZN=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return r.jsx(It.div,{...a,ref:t})});ZN.displayName=ZY;var vm="MenuItem",O5="menu.itemSelect",th=w.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:a,...l}=e,o=w.useRef(null),c=rd(vm,e.__scopeMenu),d=Bg(vm,e.__scopeMenu),m=mn(t,o),f=w.useRef(!1),p=()=>{const x=o.current;if(!n&&x){const y=new CustomEvent(O5,{bubbles:!0,cancelable:!0});x.addEventListener(O5,b=>a?.(b),{once:!0}),r6(x,y),y.defaultPrevented?f.current=!1:c.onClose()}};return r.jsx(JN,{...l,ref:m,disabled:n,onClick:Pe(e.onClick,p),onPointerDown:x=>{e.onPointerDown?.(x),f.current=!0},onPointerUp:Pe(e.onPointerUp,x=>{f.current||x.currentTarget?.click()}),onKeyDown:Pe(e.onKeyDown,x=>{const y=d.searchRef.current!=="";n||y&&x.key===" "||i1.includes(x.key)&&(x.currentTarget.click(),x.preventDefault())})})});th.displayName=vm;var JN=w.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:a=!1,textValue:l,...o}=e,c=Bg(vm,n),d=GN(n),m=w.useRef(null),f=mn(t,m),[p,x]=w.useState(!1),[y,b]=w.useState("");return w.useEffect(()=>{const N=m.current;N&&b((N.textContent??"").trim())},[o.children]),r.jsx(Cu.ItemSlot,{scope:n,disabled:a,textValue:l??y,children:r.jsx(ew,{asChild:!0,...d,focusable:!a,children:r.jsx(It.div,{role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...o,ref:f,onPointerMove:Pe(e.onPointerMove,Tu(N=>{a?c.onItemLeave(N):(c.onItemEnter(N),N.defaultPrevented||N.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Pe(e.onPointerLeave,Tu(N=>c.onItemLeave(N))),onFocus:Pe(e.onFocus,()=>x(!0)),onBlur:Pe(e.onBlur,()=>x(!1))})})})}),JY="MenuCheckboxItem",e9=w.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:a,...l}=e;return r.jsx(s9,{scope:e.__scopeMenu,checked:n,children:r.jsx(th,{role:"menuitemcheckbox","aria-checked":ym(n)?"mixed":n,...l,ref:t,"data-state":Hg(n),onSelect:Pe(l.onSelect,()=>a?.(ym(n)?!0:!n),{checkForDefaultPrevented:!1})})})});e9.displayName=JY;var t9="MenuRadioGroup",[eW,tW]=Mi(t9,{value:void 0,onValueChange:()=>{}}),n9=w.forwardRef((e,t)=>{const{value:n,onValueChange:a,...l}=e,o=yr(a);return r.jsx(eW,{scope:e.__scopeMenu,value:n,onValueChange:o,children:r.jsx(Fg,{...l,ref:t})})});n9.displayName=t9;var r9="MenuRadioItem",a9=w.forwardRef((e,t)=>{const{value:n,...a}=e,l=tW(r9,e.__scopeMenu),o=n===l.value;return r.jsx(s9,{scope:e.__scopeMenu,checked:o,children:r.jsx(th,{role:"menuitemradio","aria-checked":o,...a,ref:t,"data-state":Hg(o),onSelect:Pe(a.onSelect,()=>l.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});a9.displayName=r9;var Ig="MenuItemIndicator",[s9,nW]=Mi(Ig,{checked:!1}),l9=w.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:a,...l}=e,o=nW(Ig,n);return r.jsx(Wr,{present:a||ym(o.checked)||o.checked===!0,children:r.jsx(It.span,{...l,ref:t,"data-state":Hg(o.checked)})})});l9.displayName=Ig;var rW="MenuSeparator",i9=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return r.jsx(It.div,{role:"separator","aria-orientation":"horizontal",...a,ref:t})});i9.displayName=rW;var aW="MenuArrow",o9=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,l=nd(n);return r.jsx(j1,{...l,...a,ref:t})});o9.displayName=aW;var qg="MenuSub",[sW,c9]=Mi(qg),u9=e=>{const{__scopeMenu:t,children:n,open:a=!1,onOpenChange:l}=e,o=Pl(qg,t),c=nd(t),[d,m]=w.useState(null),[f,p]=w.useState(null),x=yr(l);return w.useEffect(()=>(o.open===!1&&x(!1),()=>x(!1)),[o.open,x]),r.jsx(Sm,{...c,children:r.jsx(YN,{scope:t,open:a,onOpenChange:x,content:f,onContentChange:p,children:r.jsx(sW,{scope:t,contentId:Ta(),triggerId:Ta(),trigger:d,onTriggerChange:m,children:n})})})};u9.displayName=qg;var lu="MenuSubTrigger",d9=w.forwardRef((e,t)=>{const n=Pl(lu,e.__scopeMenu),a=rd(lu,e.__scopeMenu),l=c9(lu,e.__scopeMenu),o=Bg(lu,e.__scopeMenu),c=w.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:m}=o,f={__scopeMenu:e.__scopeMenu},p=w.useCallback(()=>{c.current&&window.clearTimeout(c.current),c.current=null},[]);return w.useEffect(()=>p,[p]),w.useEffect(()=>{const x=d.current;return()=>{window.clearTimeout(x),m(null)}},[d,m]),r.jsx(Rg,{asChild:!0,...f,children:r.jsx(JN,{id:l.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":l.contentId,"data-state":f9(n.open),...e,ref:Sl(t,l.onTriggerChange),onClick:x=>{e.onClick?.(x),!(e.disabled||x.defaultPrevented)&&(x.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Pe(e.onPointerMove,Tu(x=>{o.onItemEnter(x),!x.defaultPrevented&&!e.disabled&&!n.open&&!c.current&&(o.onPointerGraceIntentChange(null),c.current=window.setTimeout(()=>{n.onOpenChange(!0),p()},100))})),onPointerLeave:Pe(e.onPointerLeave,Tu(x=>{p();const y=n.content?.getBoundingClientRect();if(y){const b=n.content?.dataset.side,N=b==="right",k=N?-5:5,S=y[N?"left":"right"],T=y[N?"right":"left"];o.onPointerGraceIntentChange({area:[{x:x.clientX+k,y:x.clientY},{x:S,y:y.top},{x:T,y:y.top},{x:T,y:y.bottom},{x:S,y:y.bottom}],side:b}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(x),x.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Pe(e.onKeyDown,x=>{const y=o.searchRef.current!=="";e.disabled||y&&x.key===" "||IY[a.dir].includes(x.key)&&(n.onOpenChange(!0),n.content?.focus(),x.preventDefault())})})})});d9.displayName=lu;var m9="MenuSubContent",h9=w.forwardRef((e,t)=>{const n=XN(_a,e.__scopeMenu),{forceMount:a=n.forceMount,...l}=e,o=Pl(_a,e.__scopeMenu),c=rd(_a,e.__scopeMenu),d=c9(m9,e.__scopeMenu),m=w.useRef(null),f=mn(t,m);return r.jsx(Cu.Provider,{scope:e.__scopeMenu,children:r.jsx(Wr,{present:a||o.open,children:r.jsx(Cu.Slot,{scope:e.__scopeMenu,children:r.jsx(Pg,{id:d.contentId,"aria-labelledby":d.triggerId,...l,ref:f,align:"start",side:c.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{c.isUsingKeyboardRef.current&&m.current?.focus(),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:Pe(e.onFocusOutside,p=>{p.target!==d.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Pe(e.onEscapeKeyDown,p=>{c.onClose(),p.preventDefault()}),onKeyDown:Pe(e.onKeyDown,p=>{const x=p.currentTarget.contains(p.target),y=qY[c.dir].includes(p.key);x&&y&&(o.onOpenChange(!1),d.trigger?.focus(),p.preventDefault())})})})})})});h9.displayName=m9;function f9(e){return e?"open":"closed"}function ym(e){return e==="indeterminate"}function Hg(e){return ym(e)?"indeterminate":e?"checked":"unchecked"}function lW(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function iW(e,t){return e.map((n,a)=>e[(t+a)%e.length])}function oW(e,t,n){const l=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let c=iW(e,Math.max(o,0));l.length===1&&(c=c.filter(f=>f!==n));const m=c.find(f=>f.toLowerCase().startsWith(l.toLowerCase()));return m!==n?m:void 0}function cW(e,t){const{x:n,y:a}=e;let l=!1;for(let o=0,c=t.length-1;oa!=y>a&&n<(x-f)*(a-p)/(y-p)+f&&(l=!l)}return l}function uW(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return cW(n,t)}function Tu(e){return t=>t.pointerType==="mouse"?e(t):void 0}var dW=WN,mW=Rg,hW=KN,fW=QN,pW=Fg,xW=ZN,gW=th,vW=e9,yW=n9,bW=a9,wW=l9,jW=i9,NW=o9,SW=u9,kW=d9,CW=h9,Ug="ContextMenu",[TW]=Ua(Ug,[VN]),Sr=VN(),[_W,p9]=TW(Ug),x9=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:a,dir:l,modal:o=!0}=e,[c,d]=w.useState(!1),m=Sr(t),f=yr(a),p=w.useCallback(x=>{d(x),f(x)},[f]);return r.jsx(_W,{scope:t,open:c,onOpenChange:p,modal:o,children:r.jsx(dW,{...m,dir:l,open:c,onOpenChange:p,modal:o,children:n})})};x9.displayName=Ug;var g9="ContextMenuTrigger",v9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:a=!1,...l}=e,o=p9(g9,n),c=Sr(n),d=w.useRef({x:0,y:0}),m=w.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...d.current})}),f=w.useRef(0),p=w.useCallback(()=>window.clearTimeout(f.current),[]),x=y=>{d.current={x:y.clientX,y:y.clientY},o.onOpenChange(!0)};return w.useEffect(()=>p,[p]),w.useEffect(()=>void(a&&p()),[a,p]),r.jsxs(r.Fragment,{children:[r.jsx(mW,{...c,virtualRef:m}),r.jsx(It.span,{"data-state":o.open?"open":"closed","data-disabled":a?"":void 0,...l,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:a?e.onContextMenu:Pe(e.onContextMenu,y=>{p(),x(y),y.preventDefault()}),onPointerDown:a?e.onPointerDown:Pe(e.onPointerDown,H0(y=>{p(),f.current=window.setTimeout(()=>x(y),700)})),onPointerMove:a?e.onPointerMove:Pe(e.onPointerMove,H0(p)),onPointerCancel:a?e.onPointerCancel:Pe(e.onPointerCancel,H0(p)),onPointerUp:a?e.onPointerUp:Pe(e.onPointerUp,H0(p))})]})});v9.displayName=g9;var EW="ContextMenuPortal",y9=e=>{const{__scopeContextMenu:t,...n}=e,a=Sr(t);return r.jsx(hW,{...a,...n})};y9.displayName=EW;var b9="ContextMenuContent",w9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=p9(b9,n),o=Sr(n),c=w.useRef(!1);return r.jsx(fW,{...o,...a,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:d=>{e.onCloseAutoFocus?.(d),!d.defaultPrevented&&c.current&&d.preventDefault(),c.current=!1},onInteractOutside:d=>{e.onInteractOutside?.(d),!d.defaultPrevented&&!l.modal&&(c.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});w9.displayName=b9;var MW="ContextMenuGroup",AW=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(pW,{...l,...a,ref:t})});AW.displayName=MW;var DW="ContextMenuLabel",j9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(xW,{...l,...a,ref:t})});j9.displayName=DW;var zW="ContextMenuItem",N9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(gW,{...l,...a,ref:t})});N9.displayName=zW;var OW="ContextMenuCheckboxItem",S9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(vW,{...l,...a,ref:t})});S9.displayName=OW;var RW="ContextMenuRadioGroup",LW=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(yW,{...l,...a,ref:t})});LW.displayName=RW;var BW="ContextMenuRadioItem",k9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(bW,{...l,...a,ref:t})});k9.displayName=BW;var PW="ContextMenuItemIndicator",C9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(wW,{...l,...a,ref:t})});C9.displayName=PW;var FW="ContextMenuSeparator",T9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(jW,{...l,...a,ref:t})});T9.displayName=FW;var IW="ContextMenuArrow",qW=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(NW,{...l,...a,ref:t})});qW.displayName=IW;var _9="ContextMenuSub",E9=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:a,open:l,defaultOpen:o}=e,c=Sr(t),[d,m]=zl({prop:l,defaultProp:o??!1,onChange:a,caller:_9});return r.jsx(SW,{...c,open:d,onOpenChange:m,children:n})};E9.displayName=_9;var HW="ContextMenuSubTrigger",M9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(kW,{...l,...a,ref:t})});M9.displayName=HW;var UW="ContextMenuSubContent",A9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(CW,{...l,...a,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});A9.displayName=UW;function H0(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var $W=x9,VW=v9,GW=y9,D9=w9,z9=j9,O9=N9,R9=S9,L9=k9,B9=C9,P9=T9,YW=E9,F9=M9,I9=A9;const WW=$W,XW=VW,KW=YW,q9=w.forwardRef(({className:e,inset:t,children:n,...a},l)=>r.jsxs(F9,{ref:l,className:he("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...a,children:[n,r.jsx(wi,{className:"ml-auto h-4 w-4"})]}));q9.displayName=F9.displayName;const H9=w.forwardRef(({className:e,...t},n)=>r.jsx(I9,{ref:n,className:he("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 origin-[--radix-context-menu-content-transform-origin]",e),...t}));H9.displayName=I9.displayName;const U9=w.forwardRef(({className:e,...t},n)=>r.jsx(GW,{children:r.jsx(D9,{ref:n,className:he("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-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 origin-[--radix-context-menu-content-transform-origin]",e),...t})}));U9.displayName=D9.displayName;const La=w.forwardRef(({className:e,inset:t,...n},a)=>r.jsx(O9,{ref:a,className:he("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));La.displayName=O9.displayName;const QW=w.forwardRef(({className:e,children:t,checked:n,...a},l)=>r.jsxs(R9,{ref:l,className:he("relative flex 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",e),checked:n,...a,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(B9,{children:r.jsx(mi,{className:"h-4 w-4"})})}),t]}));QW.displayName=R9.displayName;const ZW=w.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(L9,{ref:a,className:he("relative flex 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",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(B9,{children:r.jsx(DT,{className:"h-2 w-2 fill-current"})})}),t]}));ZW.displayName=L9.displayName;const JW=w.forwardRef(({className:e,inset:t,...n},a)=>r.jsx(z9,{ref:a,className:he("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...n}));JW.displayName=z9.displayName;const iu=w.forwardRef(({className:e,...t},n)=>r.jsx(P9,{ref:n,className:he("-mx-1 my-1 h-px bg-border",e),...t}));iu.displayName=P9.displayName;const Mo=({className:e,...t})=>r.jsx("span",{className:he("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});Mo.displayName="ContextMenuShortcut";var eX=Symbol("radix.slottable");function tX(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=eX,t}var[nh]=Ua("Tooltip",[Vo]),rh=Vo(),$9="TooltipProvider",nX=700,o1="tooltip.open",[rX,$g]=nh($9),V9=e=>{const{__scopeTooltip:t,delayDuration:n=nX,skipDelayDuration:a=300,disableHoverableContent:l=!1,children:o}=e,c=w.useRef(!0),d=w.useRef(!1),m=w.useRef(0);return w.useEffect(()=>{const f=m.current;return()=>window.clearTimeout(f)},[]),r.jsx(rX,{scope:t,isOpenDelayedRef:c,delayDuration:n,onOpen:w.useCallback(()=>{window.clearTimeout(m.current),c.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>c.current=!0,a)},[a]),isPointerInTransitRef:d,onPointerInTransitChange:w.useCallback(f=>{d.current=f},[]),disableHoverableContent:l,children:o})};V9.displayName=$9;var _u="Tooltip",[aX,ad]=nh(_u),G9=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:l,onOpenChange:o,disableHoverableContent:c,delayDuration:d}=e,m=$g(_u,e.__scopeTooltip),f=rh(t),[p,x]=w.useState(null),y=Ta(),b=w.useRef(0),N=c??m.disableHoverableContent,k=d??m.delayDuration,S=w.useRef(!1),[T,M]=zl({prop:a,defaultProp:l??!1,onChange:L=>{L?(m.onOpen(),document.dispatchEvent(new CustomEvent(o1))):m.onClose(),o?.(L)},caller:_u}),A=w.useMemo(()=>T?S.current?"delayed-open":"instant-open":"closed",[T]),R=w.useCallback(()=>{window.clearTimeout(b.current),b.current=0,S.current=!1,M(!0)},[M]),B=w.useCallback(()=>{window.clearTimeout(b.current),b.current=0,M(!1)},[M]),O=w.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{S.current=!0,M(!0),b.current=0},k)},[k,M]);return w.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),r.jsx(Sm,{...f,children:r.jsx(aX,{scope:t,contentId:y,open:T,stateAttribute:A,trigger:p,onTriggerChange:x,onTriggerEnter:w.useCallback(()=>{m.isOpenDelayedRef.current?O():R()},[m.isOpenDelayedRef,O,R]),onTriggerLeave:w.useCallback(()=>{N?B():(window.clearTimeout(b.current),b.current=0)},[B,N]),onOpen:R,onClose:B,disableHoverableContent:N,children:n})})};G9.displayName=_u;var c1="TooltipTrigger",Y9=w.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,l=ad(c1,n),o=$g(c1,n),c=rh(n),d=w.useRef(null),m=mn(t,d,l.onTriggerChange),f=w.useRef(!1),p=w.useRef(!1),x=w.useCallback(()=>f.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",x),[x]),r.jsx(km,{asChild:!0,...c,children:r.jsx(It.button,{"aria-describedby":l.open?l.contentId:void 0,"data-state":l.stateAttribute,...a,ref:m,onPointerMove:Pe(e.onPointerMove,y=>{y.pointerType!=="touch"&&!p.current&&!o.isPointerInTransitRef.current&&(l.onTriggerEnter(),p.current=!0)}),onPointerLeave:Pe(e.onPointerLeave,()=>{l.onTriggerLeave(),p.current=!1}),onPointerDown:Pe(e.onPointerDown,()=>{l.open&&l.onClose(),f.current=!0,document.addEventListener("pointerup",x,{once:!0})}),onFocus:Pe(e.onFocus,()=>{f.current||l.onOpen()}),onBlur:Pe(e.onBlur,l.onClose),onClick:Pe(e.onClick,l.onClose)})})});Y9.displayName=c1;var Vg="TooltipPortal",[sX,lX]=nh(Vg,{forceMount:void 0}),W9=e=>{const{__scopeTooltip:t,forceMount:n,children:a,container:l}=e,o=ad(Vg,t);return r.jsx(sX,{scope:t,forceMount:n,children:r.jsx(Wr,{present:n||o.open,children:r.jsx(Nm,{asChild:!0,container:l,children:a})})})};W9.displayName=Vg;var $o="TooltipContent",X9=w.forwardRef((e,t)=>{const n=lX($o,e.__scopeTooltip),{forceMount:a=n.forceMount,side:l="top",...o}=e,c=ad($o,e.__scopeTooltip);return r.jsx(Wr,{present:a||c.open,children:c.disableHoverableContent?r.jsx(K9,{side:l,...o,ref:t}):r.jsx(iX,{side:l,...o,ref:t})})}),iX=w.forwardRef((e,t)=>{const n=ad($o,e.__scopeTooltip),a=$g($o,e.__scopeTooltip),l=w.useRef(null),o=mn(t,l),[c,d]=w.useState(null),{trigger:m,onClose:f}=n,p=l.current,{onPointerInTransitChange:x}=a,y=w.useCallback(()=>{d(null),x(!1)},[x]),b=w.useCallback((N,k)=>{const S=N.currentTarget,T={x:N.clientX,y:N.clientY},M=mX(T,S.getBoundingClientRect()),A=hX(T,M),R=fX(k.getBoundingClientRect()),B=xX([...A,...R]);d(B),x(!0)},[x]);return w.useEffect(()=>()=>y(),[y]),w.useEffect(()=>{if(m&&p){const N=S=>b(S,p),k=S=>b(S,m);return m.addEventListener("pointerleave",N),p.addEventListener("pointerleave",k),()=>{m.removeEventListener("pointerleave",N),p.removeEventListener("pointerleave",k)}}},[m,p,b,y]),w.useEffect(()=>{if(c){const N=k=>{const S=k.target,T={x:k.clientX,y:k.clientY},M=m?.contains(S)||p?.contains(S),A=!pX(T,c);M?y():A&&(y(),f())};return document.addEventListener("pointermove",N),()=>document.removeEventListener("pointermove",N)}},[m,p,c,f,y]),r.jsx(K9,{...e,ref:o})}),[oX,cX]=nh(_u,{isInside:!1}),uX=tX("TooltipContent"),K9=w.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":l,onEscapeKeyDown:o,onPointerDownOutside:c,...d}=e,m=ad($o,n),f=rh(n),{onClose:p}=m;return w.useEffect(()=>(document.addEventListener(o1,p),()=>document.removeEventListener(o1,p)),[p]),w.useEffect(()=>{if(m.trigger){const x=y=>{y.target?.contains(m.trigger)&&p()};return window.addEventListener("scroll",x,{capture:!0}),()=>window.removeEventListener("scroll",x,{capture:!0})}},[m.trigger,p]),r.jsx(b1,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:x=>x.preventDefault(),onDismiss:p,children:r.jsxs(w1,{"data-state":m.stateAttribute,...f,...d,ref:t,style:{...d.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:[r.jsx(uX,{children:a}),r.jsx(oX,{scope:n,isInside:!0,children:r.jsx(cT,{id:m.contentId,role:"tooltip",children:l||a})})]})})});X9.displayName=$o;var Q9="TooltipArrow",dX=w.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,l=rh(n);return cX(Q9,n).isInside?null:r.jsx(j1,{...l,...a,ref:t})});dX.displayName=Q9;function mX(e,t){const n=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),l=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,a,l,o)){case o:return"left";case l:return"right";case n:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function hX(e,t,n=5){const a=[];switch(t){case"top":a.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":a.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":a.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":a.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return a}function fX(e){const{top:t,right:n,bottom:a,left:l}=e;return[{x:l,y:t},{x:n,y:t},{x:n,y:a},{x:l,y:a}]}function pX(e,t){const{x:n,y:a}=e;let l=!1;for(let o=0,c=t.length-1;oa!=y>a&&n<(x-f)*(a-p)/(y-p)+f&&(l=!l)}return l}function xX(e){const t=e.slice();return t.sort((n,a)=>n.xa.x?1:n.ya.y?1:0),gX(t)}function gX(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a=2;){const o=t[t.length-1],c=t[t.length-2];if((o.x-c.x)*(l.y-c.y)>=(o.y-c.y)*(l.x-c.x))t.pop();else break}t.push(l)}t.pop();const n=[];for(let a=e.length-1;a>=0;a--){const l=e[a];for(;n.length>=2;){const o=n[n.length-1],c=n[n.length-2];if((o.x-c.x)*(l.y-c.y)>=(o.y-c.y)*(l.x-c.x))n.pop();else break}n.push(l)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var vX=V9,yX=G9,bX=Y9,wX=W9,Z9=X9;const jX=vX,NX=yX,SX=bX,J9=w.forwardRef(({className:e,sideOffset:t=4,...n},a)=>r.jsx(wX,{children:r.jsx(Z9,{ref:a,sideOffset:t,className:he("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...n})}));J9.displayName=Z9.displayName;function kX({children:e}){MA();const[t,n]=w.useState(!0),[a,l]=w.useState(!1),[o,c]=w.useState(!1),{theme:d,setTheme:m}=B1(),f=LC(),p=as();w.useEffect(()=>{const k=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),c(!0))};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[]);const x=[{title:"概览",items:[{icon:J0,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:Nl,label:"麦麦主程序配置",path:"/config/bot"},{icon:o6,label:"麦麦模型提供商配置",path:"/config/modelProvider"},{icon:c6,label:"麦麦模型配置",path:"/config/model"},{icon:Xy,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:N1,label:"表情包管理",path:"/resource/emoji"},{icon:Mu,label:"表达方式管理",path:"/resource/expression"},{icon:u6,label:"人物信息管理",path:"/resource/person"}]},{title:"扩展与监控",items:[{icon:nm,label:"插件市场",path:"/plugins"},{icon:Xy,label:"插件配置",path:"/plugin-config"},{icon:em,label:"日志查看器",path:"/logs"}]},{title:"系统",items:[{icon:Pa,label:"系统设置",path:"/settings"}]}],b=d==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":d,N=()=>{localStorage.removeItem("access-token"),p({to:"/auth"})};return r.jsx(jX,{delayDuration:300,children:r.jsxs("div",{className:"flex h-screen overflow-hidden",children:[r.jsxs("aside",{className:he("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",t?"lg:w-64":"lg:w-16",a?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[r.jsx("div",{className:"flex h-16 items-center border-b px-4",children:r.jsxs("div",{className:he("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!t&&"lg:flex-none lg:w-8"),children:[r.jsxs("div",{className:he("flex items-baseline gap-2",!t&&"lg:hidden"),children:[r.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),r.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:lA()})]}),!t&&r.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),r.jsx("nav",{className:"flex-1 overflow-y-auto p-4",children:r.jsx("ul",{className:he("space-y-6",!t&&"lg:space-y-3"),children:x.map((k,S)=>r.jsxs("li",{children:[r.jsx("div",{className:he("px-3 h-[1.25rem]","mb-2",!t&&"lg:mb-1 lg:invisible"),children:r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:k.title})}),!t&&S>0&&r.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),r.jsx("ul",{className:"space-y-1",children:k.items.map(T=>{const M=f({to:T.path}),A=T.icon,R=r.jsxs(r.Fragment,{children:[M&&r.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),r.jsxs("div",{className:he("flex items-center transition-all duration-300",t?"gap-3":"lg:gap-0"),children:[r.jsx(A,{className:he("h-5 w-5 flex-shrink-0",M&&"text-primary"),strokeWidth:2,fill:"none"}),r.jsx("span",{className:he("text-sm font-medium whitespace-nowrap transition-all duration-300",M&&"font-semibold",t?"opacity-100 max-w-[200px]":"lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:T.label})]})]});return r.jsx("li",{className:"relative",children:r.jsxs(NX,{children:[r.jsx(SX,{asChild:!0,children:r.jsx(BC,{to:T.path,className:he("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",M?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",t?"px-3":"lg:px-0 lg:justify-center"),onClick:()=>l(!1),children:R})}),!t&&r.jsx(J9,{side:"right",className:"hidden lg:block",children:r.jsx("p",{children:T.label})})]})},T.path)})})]},k.title))})})]}),a&&r.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>l(!1)}),r.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[r.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("button",{onClick:()=>l(!a),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:r.jsx(zT,{className:"h-5 w-5"})}),r.jsx("button",{onClick:()=>n(!t),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:t?"收起侧边栏":"展开侧边栏",children:r.jsx(bi,{className:he("h-5 w-5 transition-transform",!t&&"rotate-180")})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("button",{onClick:()=>c(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[r.jsx(Yr,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),r.jsxs(UN,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[r.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),r.jsx(AY,{open:o,onOpenChange:c}),r.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[r.jsx(OT,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),r.jsx("button",{onClick:k=>{VM(b==="dark"?"light":"dark",m,k)},className:"rounded-lg p-2 hover:bg-accent",title:b==="dark"?"切换到浅色模式":"切换到深色模式",children:b==="dark"?r.jsx(wx,{className:"h-5 w-5"}):r.jsx(jx,{className:"h-5 w-5"})}),r.jsx("div",{className:"h-6 w-px bg-border"}),r.jsxs(ne,{variant:"ghost",size:"sm",onClick:N,className:"gap-2",title:"登出系统",children:[r.jsx(Ky,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),r.jsxs(WW,{children:[r.jsx(XW,{asChild:!0,children:r.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:e})}),r.jsxs(U9,{className:"w-64",children:[r.jsxs(La,{onClick:()=>p({to:"/"}),children:[r.jsx(J0,{className:"mr-2 h-4 w-4"}),"首页"]}),r.jsxs(La,{onClick:()=>p({to:"/settings"}),children:[r.jsx(Pa,{className:"mr-2 h-4 w-4"}),"系统设置"]}),r.jsxs(La,{onClick:()=>p({to:"/logs"}),children:[r.jsx(em,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),r.jsx(iu,{}),r.jsxs(KW,{children:[r.jsxs(q9,{children:[r.jsx(s6,{className:"mr-2 h-4 w-4"}),"切换主题"]}),r.jsxs(H9,{className:"w-48",children:[r.jsxs(La,{onClick:()=>m("light"),disabled:d==="light",children:[r.jsx(wx,{className:"mr-2 h-4 w-4"}),"浅色",d==="light"&&r.jsx(Mo,{children:"✓"})]}),r.jsxs(La,{onClick:()=>m("dark"),disabled:d==="dark",children:[r.jsx(jx,{className:"mr-2 h-4 w-4"}),"深色",d==="dark"&&r.jsx(Mo,{children:"✓"})]}),r.jsxs(La,{onClick:()=>m("system"),disabled:d==="system",children:[r.jsx(Pa,{className:"mr-2 h-4 w-4"}),"跟随系统",d==="system"&&r.jsx(Mo,{children:"✓"})]})]})]}),r.jsx(iu,{}),r.jsxs(La,{onClick:()=>window.location.reload(),children:[r.jsx(RT,{className:"mr-2 h-4 w-4"}),"刷新页面",r.jsx(Mo,{children:"⌘R"})]}),r.jsxs(La,{onClick:()=>c(!0),children:[r.jsx(Yr,{className:"mr-2 h-4 w-4"}),"搜索",r.jsx(Mo,{children:"⌘K"})]}),r.jsx(iu,{}),r.jsxs(La,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[r.jsx(ou,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),r.jsx(iu,{}),r.jsxs(La,{onClick:N,className:"text-destructive focus:text-destructive",children:[r.jsx(Ky,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}const sd=PC({component:()=>r.jsxs(r.Fragment,{children:[r.jsx(L5,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!hj())throw IC({to:"/auth"})}}),CX=gr({getParentRoute:()=>sd,path:"/auth",component:AA}),TX=gr({getParentRoute:()=>sd,path:"/setup",component:KA}),Zr=gr({getParentRoute:()=>sd,id:"protected",component:()=>r.jsx(kX,{children:r.jsx(L5,{})})}),_X=gr({getParentRoute:()=>Zr,path:"/",component:UM}),EX=gr({getParentRoute:()=>Zr,path:"/config/bot",component:qD}),MX=gr({getParentRoute:()=>Zr,path:"/config/modelProvider",component:rz}),AX=gr({getParentRoute:()=>Zr,path:"/config/model",component:Az}),DX=gr({getParentRoute:()=>Zr,path:"/config/adapter",component:Rz}),zX=gr({getParentRoute:()=>Zr,path:"/resource/emoji",component:sU}),OX=gr({getParentRoute:()=>Zr,path:"/resource/expression",component:pU}),RX=gr({getParentRoute:()=>Zr,path:"/resource/person",component:CU}),LX=gr({getParentRoute:()=>Zr,path:"/logs",component:iY}),BX=gr({getParentRoute:()=>Zr,path:"/plugins",component:CY}),PX=gr({getParentRoute:()=>Zr,path:"/plugin-config",component:TY}),FX=gr({getParentRoute:()=>Zr,path:"/plugin-mirrors",component:_Y}),IX=gr({getParentRoute:()=>Zr,path:"/settings",component:NA}),qX=gr({getParentRoute:()=>sd,path:"*",component:xj}),HX=sd.addChildren([CX,TX,Zr.addChildren([_X,EX,MX,AX,DX,zX,OX,RX,BX,PX,FX,LX,IX]),qX]),UX=FC({routeTree:HX,defaultNotFoundComponent:xj});function $X({children:e,defaultTheme:t="system",storageKey:n="ui-theme",...a}){const[l,o]=w.useState(()=>localStorage.getItem(n)||t);w.useEffect(()=>{const d=window.document.documentElement;if(d.classList.remove("light","dark"),l==="system"){const m=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";d.classList.add(m);return}d.classList.add(l)},[l]),w.useEffect(()=>{const d=localStorage.getItem("accent-color");if(d){const m=document.documentElement,p={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[d];p&&(m.style.setProperty("--primary",p.hsl),p.gradient?(m.style.setProperty("--primary-gradient",p.gradient),m.classList.add("has-gradient")):(m.style.removeProperty("--primary-gradient"),m.classList.remove("has-gradient")))}},[]);const c={theme:l,setTheme:d=>{localStorage.setItem(n,d),o(d)}};return r.jsx(Bw.Provider,{...a,value:c,children:e})}function VX({children:e,defaultEnabled:t=!0,defaultWavesEnabled:n=!0,storageKey:a="enable-animations",wavesStorageKey:l="enable-waves-background"}){const[o,c]=w.useState(()=>{const p=localStorage.getItem(a);return p!==null?p==="true":t}),[d,m]=w.useState(()=>{const p=localStorage.getItem(l);return p!==null?p==="true":n});w.useEffect(()=>{const p=document.documentElement;o?p.classList.remove("no-animations"):p.classList.add("no-animations"),localStorage.setItem(a,String(o))},[o,a]),w.useEffect(()=>{localStorage.setItem(l,String(d))},[d,l]);const f={enableAnimations:o,setEnableAnimations:c,enableWavesBackground:d,setEnableWavesBackground:m};return r.jsx(Pw.Provider,{value:f,children:e})}var Gg="ToastProvider",[Yg,GX,YX]=bm("Toast"),[eS]=Ua("Toast",[YX]),[WX,ah]=eS(Gg),tS=e=>{const{__scopeToast:t,label:n="Notification",duration:a=5e3,swipeDirection:l="right",swipeThreshold:o=50,children:c}=e,[d,m]=w.useState(null),[f,p]=w.useState(0),x=w.useRef(!1),y=w.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Gg}\`. Expected non-empty \`string\`.`),r.jsx(Yg.Provider,{scope:t,children:r.jsx(WX,{scope:t,label:n,duration:a,swipeDirection:l,swipeThreshold:o,toastCount:f,viewport:d,onViewportChange:m,onToastAdd:w.useCallback(()=>p(b=>b+1),[]),onToastRemove:w.useCallback(()=>p(b=>b-1),[]),isFocusedToastEscapeKeyDownRef:x,isClosePausedRef:y,children:c})})};tS.displayName=Gg;var nS="ToastViewport",XX=["F8"],u1="toast.viewportPause",d1="toast.viewportResume",rS=w.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:a=XX,label:l="Notifications ({hotkey})",...o}=e,c=ah(nS,n),d=GX(n),m=w.useRef(null),f=w.useRef(null),p=w.useRef(null),x=w.useRef(null),y=mn(t,x,c.onViewportChange),b=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),N=c.toastCount>0;w.useEffect(()=>{const S=T=>{a.length!==0&&a.every(A=>T[A]||T.code===A)&&x.current?.focus()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[a]),w.useEffect(()=>{const S=m.current,T=x.current;if(N&&S&&T){const M=()=>{if(!c.isClosePausedRef.current){const O=new CustomEvent(u1);T.dispatchEvent(O),c.isClosePausedRef.current=!0}},A=()=>{if(c.isClosePausedRef.current){const O=new CustomEvent(d1);T.dispatchEvent(O),c.isClosePausedRef.current=!1}},R=O=>{!S.contains(O.relatedTarget)&&A()},B=()=>{S.contains(document.activeElement)||A()};return S.addEventListener("focusin",M),S.addEventListener("focusout",R),S.addEventListener("pointermove",M),S.addEventListener("pointerleave",B),window.addEventListener("blur",M),window.addEventListener("focus",A),()=>{S.removeEventListener("focusin",M),S.removeEventListener("focusout",R),S.removeEventListener("pointermove",M),S.removeEventListener("pointerleave",B),window.removeEventListener("blur",M),window.removeEventListener("focus",A)}}},[N,c.isClosePausedRef]);const k=w.useCallback(({tabbingDirection:S})=>{const M=d().map(A=>{const R=A.ref.current,B=[R,...oK(R)];return S==="forwards"?B:B.reverse()});return(S==="forwards"?M.reverse():M).flat()},[d]);return w.useEffect(()=>{const S=x.current;if(S){const T=M=>{const A=M.altKey||M.ctrlKey||M.metaKey;if(M.key==="Tab"&&!A){const B=document.activeElement,O=M.shiftKey;if(M.target===S&&O){f.current?.focus();return}const U=k({tabbingDirection:O?"backwards":"forwards"}),I=U.findIndex(G=>G===B);gx(U.slice(I+1))?M.preventDefault():O?f.current?.focus():p.current?.focus()}};return S.addEventListener("keydown",T),()=>S.removeEventListener("keydown",T)}},[d,k]),r.jsxs(uT,{ref:m,role:"region","aria-label":l.replace("{hotkey}",b),tabIndex:-1,style:{pointerEvents:N?void 0:"none"},children:[N&&r.jsx(m1,{ref:f,onFocusFromOutsideViewport:()=>{const S=k({tabbingDirection:"forwards"});gx(S)}}),r.jsx(Yg.Slot,{scope:n,children:r.jsx(It.ol,{tabIndex:-1,...o,ref:y})}),N&&r.jsx(m1,{ref:p,onFocusFromOutsideViewport:()=>{const S=k({tabbingDirection:"backwards"});gx(S)}})]})});rS.displayName=nS;var aS="ToastFocusProxy",m1=w.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:a,...l}=e,o=ah(aS,n);return r.jsx(a6,{tabIndex:0,...l,ref:t,style:{position:"fixed"},onFocus:c=>{const d=c.relatedTarget;!o.viewport?.contains(d)&&a()}})});m1.displayName=aS;var ld="Toast",KX="toast.swipeStart",QX="toast.swipeMove",ZX="toast.swipeCancel",JX="toast.swipeEnd",sS=w.forwardRef((e,t)=>{const{forceMount:n,open:a,defaultOpen:l,onOpenChange:o,...c}=e,[d,m]=zl({prop:a,defaultProp:l??!0,onChange:o,caller:ld});return r.jsx(Wr,{present:n||d,children:r.jsx(nK,{open:d,...c,ref:t,onClose:()=>m(!1),onPause:yr(e.onPause),onResume:yr(e.onResume),onSwipeStart:Pe(e.onSwipeStart,f=>{f.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Pe(e.onSwipeMove,f=>{const{x:p,y:x}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","move"),f.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${p}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${x}px`)}),onSwipeCancel:Pe(e.onSwipeCancel,f=>{f.currentTarget.setAttribute("data-swipe","cancel"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Pe(e.onSwipeEnd,f=>{const{x:p,y:x}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","end"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${p}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${x}px`),m(!1)})})})});sS.displayName=ld;var[eK,tK]=eS(ld,{onClose(){}}),nK=w.forwardRef((e,t)=>{const{__scopeToast:n,type:a="foreground",duration:l,open:o,onClose:c,onEscapeKeyDown:d,onPause:m,onResume:f,onSwipeStart:p,onSwipeMove:x,onSwipeCancel:y,onSwipeEnd:b,...N}=e,k=ah(ld,n),[S,T]=w.useState(null),M=mn(t,J=>T(J)),A=w.useRef(null),R=w.useRef(null),B=l||k.duration,O=w.useRef(0),L=w.useRef(B),$=w.useRef(0),{onToastAdd:U,onToastRemove:I}=k,G=yr(()=>{S?.contains(document.activeElement)&&k.viewport?.focus(),c()}),ee=w.useCallback(J=>{!J||J===1/0||(window.clearTimeout($.current),O.current=new Date().getTime(),$.current=window.setTimeout(G,J))},[G]);w.useEffect(()=>{const J=k.viewport;if(J){const se=()=>{ee(L.current),f?.()},H=()=>{const le=new Date().getTime()-O.current;L.current=L.current-le,window.clearTimeout($.current),m?.()};return J.addEventListener(u1,H),J.addEventListener(d1,se),()=>{J.removeEventListener(u1,H),J.removeEventListener(d1,se)}}},[k.viewport,B,m,f,ee]),w.useEffect(()=>{o&&!k.isClosePausedRef.current&&ee(B)},[o,B,k.isClosePausedRef,ee]),w.useEffect(()=>(U(),()=>I()),[U,I]);const Ne=w.useMemo(()=>S?mS(S):null,[S]);return k.viewport?r.jsxs(r.Fragment,{children:[Ne&&r.jsx(rK,{__scopeToast:n,role:"status","aria-live":a==="foreground"?"assertive":"polite",children:Ne}),r.jsx(eK,{scope:n,onClose:G,children:qC.createPortal(r.jsx(Yg.ItemSlot,{scope:n,children:r.jsx(dT,{asChild:!0,onEscapeKeyDown:Pe(d,()=>{k.isFocusedToastEscapeKeyDownRef.current||G(),k.isFocusedToastEscapeKeyDownRef.current=!1}),children:r.jsx(It.li,{tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":k.swipeDirection,...N,ref:M,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Pe(e.onKeyDown,J=>{J.key==="Escape"&&(d?.(J.nativeEvent),J.nativeEvent.defaultPrevented||(k.isFocusedToastEscapeKeyDownRef.current=!0,G()))}),onPointerDown:Pe(e.onPointerDown,J=>{J.button===0&&(A.current={x:J.clientX,y:J.clientY})}),onPointerMove:Pe(e.onPointerMove,J=>{if(!A.current)return;const se=J.clientX-A.current.x,H=J.clientY-A.current.y,le=!!R.current,re=["left","right"].includes(k.swipeDirection),ge=["left","up"].includes(k.swipeDirection)?Math.min:Math.max,E=re?ge(0,se):0,we=re?0:ge(0,H),Z=J.pointerType==="touch"?10:2,z={x:E,y:we},X={originalEvent:J,delta:z};le?(R.current=z,U0(QX,x,X,{discrete:!1})):R5(z,k.swipeDirection,Z)?(R.current=z,U0(KX,p,X,{discrete:!1}),J.target.setPointerCapture(J.pointerId)):(Math.abs(se)>Z||Math.abs(H)>Z)&&(A.current=null)}),onPointerUp:Pe(e.onPointerUp,J=>{const se=R.current,H=J.target;if(H.hasPointerCapture(J.pointerId)&&H.releasePointerCapture(J.pointerId),R.current=null,A.current=null,se){const le=J.currentTarget,re={originalEvent:J,delta:se};R5(se,k.swipeDirection,k.swipeThreshold)?U0(JX,b,re,{discrete:!0}):U0(ZX,y,re,{discrete:!0}),le.addEventListener("click",ge=>ge.preventDefault(),{once:!0})}})})})}),k.viewport)})]}):null}),rK=e=>{const{__scopeToast:t,children:n,...a}=e,l=ah(ld,t),[o,c]=w.useState(!1),[d,m]=w.useState(!1);return lK(()=>c(!0)),w.useEffect(()=>{const f=window.setTimeout(()=>m(!0),1e3);return()=>window.clearTimeout(f)},[]),d?null:r.jsx(Nm,{asChild:!0,children:r.jsx(a6,{...a,children:o&&r.jsxs(r.Fragment,{children:[l.label," ",n]})})})},aK="ToastTitle",lS=w.forwardRef((e,t)=>{const{__scopeToast:n,...a}=e;return r.jsx(It.div,{...a,ref:t})});lS.displayName=aK;var sK="ToastDescription",iS=w.forwardRef((e,t)=>{const{__scopeToast:n,...a}=e;return r.jsx(It.div,{...a,ref:t})});iS.displayName=sK;var oS="ToastAction",cS=w.forwardRef((e,t)=>{const{altText:n,...a}=e;return n.trim()?r.jsx(dS,{altText:n,asChild:!0,children:r.jsx(Wg,{...a,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${oS}\`. Expected non-empty \`string\`.`),null)});cS.displayName=oS;var uS="ToastClose",Wg=w.forwardRef((e,t)=>{const{__scopeToast:n,...a}=e,l=tK(uS,n);return r.jsx(dS,{asChild:!0,children:r.jsx(It.button,{type:"button",...a,ref:t,onClick:Pe(e.onClick,l.onClose)})})});Wg.displayName=uS;var dS=w.forwardRef((e,t)=>{const{__scopeToast:n,altText:a,...l}=e;return r.jsx(It.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":a||void 0,...l,ref:t})});function mS(e){const t=[];return Array.from(e.childNodes).forEach(a=>{if(a.nodeType===a.TEXT_NODE&&a.textContent&&t.push(a.textContent),iK(a)){const l=a.ariaHidden||a.hidden||a.style.display==="none",o=a.dataset.radixToastAnnounceExclude==="";if(!l)if(o){const c=a.dataset.radixToastAnnounceAlt;c&&t.push(c)}else t.push(...mS(a))}}),t}function U0(e,t,n,{discrete:a}){const l=n.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&l.addEventListener(e,t,{once:!0}),a?r6(l,o):l.dispatchEvent(o)}var R5=(e,t,n=0)=>{const a=Math.abs(e.x),l=Math.abs(e.y),o=a>l;return t==="left"||t==="right"?o&&a>n:!o&&l>n};function lK(e=()=>{}){const t=yr(e);F5(()=>{let n=0,a=0;return n=window.requestAnimationFrame(()=>a=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(a)}},[t])}function iK(e){return e.nodeType===e.ELEMENT_NODE}function oK(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const l=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||l?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function gx(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var cK=tS,hS=rS,fS=sS,pS=lS,xS=iS,gS=cS,vS=Wg;const uK=cK,yS=w.forwardRef(({className:e,...t},n)=>r.jsx(hS,{ref:n,className:he("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));yS.displayName=hS.displayName;const dK=Ko("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),bS=w.forwardRef(({className:e,variant:t,...n},a)=>r.jsx(fS,{ref:a,className:he(dK({variant:t}),e),...n}));bS.displayName=fS.displayName;const mK=w.forwardRef(({className:e,...t},n)=>r.jsx(gS,{ref:n,className:he("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));mK.displayName=gS.displayName;const wS=w.forwardRef(({className:e,...t},n)=>r.jsx(vS,{ref:n,className:he("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:r.jsx(Au,{className:"h-4 w-4"})}));wS.displayName=vS.displayName;const jS=w.forwardRef(({className:e,...t},n)=>r.jsx(pS,{ref:n,className:he("text-sm font-semibold [&+div]:text-xs",e),...t}));jS.displayName=pS.displayName;const NS=w.forwardRef(({className:e,...t},n)=>r.jsx(xS,{ref:n,className:he("text-sm opacity-90",e),...t}));NS.displayName=xS.displayName;function hK(){const{toasts:e}=or();return r.jsxs(uK,{children:[e.map(function({id:t,title:n,description:a,action:l,...o}){return r.jsxs(bS,{...o,children:[r.jsxs("div",{className:"grid gap-1",children:[n&&r.jsx(jS,{children:n}),a&&r.jsx(NS,{children:a})]}),l,r.jsx(wS,{})]},t)}),r.jsx(yS,{})]})}IT.createRoot(document.getElementById("root")).render(r.jsx(w.StrictMode,{children:r.jsx($X,{defaultTheme:"system",children:r.jsxs(VX,{children:[r.jsx(HC,{router:UX}),r.jsx(hK,{})]})})})); diff --git a/webui/dist/assets/index-BGzEu9LP.css b/webui/dist/assets/index-BGzEu9LP.css new file mode 100644 index 00000000..0abdc436 --- /dev/null +++ b/webui/dist/assets/index-BGzEu9LP.css @@ -0,0 +1 @@ +*,: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:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";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: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem;--chart-1: 221.2 83.2% 53.3%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 217.2 91.2% 59.8%;--primary-foreground: 222.2 47.4% 11.2%;--primary-gradient: none;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 224.3 76.3% 48%;--chart-1: 217.2 91.2% 59.8%;--chart-2: 160 60% 50%;--chart-3: 30 80% 60%;--chart-4: 280 65% 65%;--chart-5: 340 75% 60%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.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}.pointer-events-auto{pointer-events:auto}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-1\/4{bottom:25%}.bottom-4{bottom:1rem}.left-0{left:0}.left-1\/2{left:50%}.left-1\/4{left:25%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-1\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.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-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.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-3{margin-left:.75rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.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-9{height:2.25rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[1px\]{height:1px}.h-\[250px\]{height:250px}.h-\[300px\]{height:300px}.h-\[400px\]{height:400px}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-240px\)\]{height:calc(100vh - 240px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.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-screen{height:100vh}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[300px\]{max-height:300px}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-screen{max-height:100vh}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[300px\]{min-height:300px}.min-h-\[60px\]{min-height:60px}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-1\/4{width:25%}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.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-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[1px\]{width:1px}.w-\[70px\]{width:70px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-full{--tw-translate-x: -100%;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-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))}.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-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-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))}.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))}@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{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.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))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.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-0{gap:0px}.gap-0\.5{gap:.125rem}.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}.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-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))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-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))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.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-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.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-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.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-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.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-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / 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-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / 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\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / 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-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / 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-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-900\/20{background-color:#713f1233}.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))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 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-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-yellow-400{fill:#facc15}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.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-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.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-2\.5{padding-top:.625rem;padding-bottom:.625rem}.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}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{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}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.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-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.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-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / 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-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / 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-900{--tw-text-opacity: 1;color:rgb(17 24 39 / 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-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / 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-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.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-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.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)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px 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-offset-background{--tw-ring-offset-color: hsl(var(--background))}.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)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-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,backdrop-filter;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-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.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))}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.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-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-yellow-300:hover{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.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)}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\: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)}.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-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-0: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(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)}.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-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.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\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-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:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.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-4[data-state=checked]{--tw-translate-x: 1rem;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],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--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-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);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-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);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-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.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\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.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-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-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\=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\=active\]\:shadow[data-state=active]{--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)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--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(3px + 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\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-blue-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 58 138 / var(--tw-border-opacity, 1))}.dark\:border-gray-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:top-auto{top:auto}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mr-2{margin-right:.5rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-24{height:6rem}.sm\:h-3{height:.75rem}.sm\:h-4{height:1rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:h-\[calc\(100vh-320px\)\]{height:calc(100vh - 320px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-24{width:6rem}.sm\:w-3{width:.75rem}.sm\:w-4{width:1rem}.sm\:w-\[140px\]{width:140px}.sm\:w-\[160px\]{width:160px}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.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\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:flex-wrap{flex-wrap:wrap}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.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-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))}.sm\: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))}.sm\: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))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:mb-4{margin-bottom:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-5{height:1.25rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-5{width:1.25rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-\[420px\]{max-width:420px}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:gap-3{gap:.75rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\: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))}.md\: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))}.md\:whitespace-normal{white-space:normal}.md\:p-12{padding:3rem}.md\:p-4{padding:1rem}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:mb-1{margin-bottom:.25rem}.lg\:block{display:block}.lg\:hidden{display:none}.lg\:h-\[calc\(100vh-400px\)\]{height:calc(100vh - 400px)}.lg\:w-16{width:4rem}.lg\:w-64{width:16rem}.lg\:w-8{width:2rem}.lg\:w-\[150px\]{width:150px}.lg\:w-\[180px\]{width:180px}.lg\:w-\[200px\]{width:200px}.lg\:w-\[240px\]{width:240px}.lg\:w-\[80px\]{width:80px}.lg\:w-auto{width:auto}.lg\:max-w-0{max-width:0px}.lg\:flex-1{flex:1 1 0%}.lg\:flex-none{flex:none}.lg\: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))}.lg\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.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\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\: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))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-4{padding:1rem}.lg\:p-6{padding:1.5rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:text-3xl{font-size:1.875rem;line-height:2.25rem}.lg\:text-sm{font-size:.875rem;line-height:1.25rem}.lg\:opacity-0{opacity:0}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--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))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>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\]\: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\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&_\.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\]\:invisible svg{visibility:hidden}.\[\&_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-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.16.25"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.1666666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.6666666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.4566666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.1466666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.7142857143em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.8571428571em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.1428571429em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.2857142857em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.4285714286em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.7142857143em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.0571428571em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.4685714286em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.9628571429em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.5542857143em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.7777777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.8888888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.1111111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.3044444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.7644444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.5833333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.7283333333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.0733333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.4861111111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.4402777778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.7277777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.2893518519em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.4050925926em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462962963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.5208333333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.2002314815em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.4398148148em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.2410800386em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2892960463em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512054em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.3857280617em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.4339440694em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.4821600771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.5785920926em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.6943105111em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8331726133em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.1996142719em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.2009646302em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.2411575563em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.2813504823em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.3215434084em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.3617363344em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.4019292605em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.4823151125em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778135em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.6945337621em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.8336012862em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo} diff --git a/webui/dist/assets/index-C_Xpfn5c.css b/webui/dist/assets/index-C_Xpfn5c.css deleted file mode 100644 index c53a20a4..00000000 --- a/webui/dist/assets/index-C_Xpfn5c.css +++ /dev/null @@ -1 +0,0 @@ -*,: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:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";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: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem;--chart-1: 221.2 83.2% 53.3%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 217.2 91.2% 59.8%;--primary-foreground: 222.2 47.4% 11.2%;--primary-gradient: none;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 224.3 76.3% 48%;--chart-1: 217.2 91.2% 59.8%;--chart-2: 160 60% 50%;--chart-3: 30 80% 60%;--chart-4: 280 65% 65%;--chart-5: 340 75% 60%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.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}.pointer-events-auto{pointer-events:auto}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-1\/4{bottom:25%}.bottom-4{bottom:1rem}.left-0{left:0}.left-1\/2{left:50%}.left-1\/4{left:25%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-1\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.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-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.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-3{margin-left:.75rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.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-9{height:2.25rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[1px\]{height:1px}.h-\[250px\]{height:250px}.h-\[300px\]{height:300px}.h-\[400px\]{height:400px}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-240px\)\]{height:calc(100vh - 240px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.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-screen{height:100vh}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[300px\]{max-height:300px}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-screen{max-height:100vh}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[300px\]{min-height:300px}.min-h-\[60px\]{min-height:60px}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-1\/4{width:25%}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.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-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[1px\]{width:1px}.w-\[70px\]{width:70px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-full{--tw-translate-x: -100%;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-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))}.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-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-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))}.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))}@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{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.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))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.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-0{gap:0px}.gap-0\.5{gap:.125rem}.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}.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-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))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-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))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.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-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.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-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.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-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.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-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / 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-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / 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\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / 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-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / 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-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-900\/20{background-color:#713f1233}.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))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 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-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-yellow-400{fill:#facc15}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-12{padding:3rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.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-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.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-2\.5{padding-top:.625rem;padding-bottom:.625rem}.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}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-2{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}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.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-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.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-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / 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-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / 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-900{--tw-text-opacity: 1;color:rgb(17 24 39 / 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-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / 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-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.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)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px 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-offset-background{--tw-ring-offset-color: hsl(var(--background))}.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)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-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,backdrop-filter;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-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.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))}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.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-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.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)}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\: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)}.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-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-0: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(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)}.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-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.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))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.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-4[data-state=checked]{--tw-translate-x: 1rem;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],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--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-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);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-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);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-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.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\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.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-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-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\=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\=active\]\:shadow[data-state=active]{--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)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--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(3px + 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\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-blue-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 58 138 / var(--tw-border-opacity, 1))}.dark\:border-gray-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:top-auto{top:auto}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mr-2{margin-right:.5rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-24{height:6rem}.sm\:h-3{height:.75rem}.sm\:h-4{height:1rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:h-\[calc\(100vh-320px\)\]{height:calc(100vh - 320px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-24{width:6rem}.sm\:w-3{width:.75rem}.sm\:w-4{width:1rem}.sm\:w-\[140px\]{width:140px}.sm\:w-\[160px\]{width:160px}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.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\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:flex-wrap{flex-wrap:wrap}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.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-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))}.sm\: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))}.sm\: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))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-\[420px\]{max-width:420px}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:whitespace-normal{white-space:normal}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:mb-1{margin-bottom:.25rem}.lg\:block{display:block}.lg\:hidden{display:none}.lg\:h-\[calc\(100vh-400px\)\]{height:calc(100vh - 400px)}.lg\:w-16{width:4rem}.lg\:w-64{width:16rem}.lg\:w-8{width:2rem}.lg\:w-\[150px\]{width:150px}.lg\:w-\[180px\]{width:180px}.lg\:w-\[200px\]{width:200px}.lg\:w-\[240px\]{width:240px}.lg\:w-\[80px\]{width:80px}.lg\:w-auto{width:auto}.lg\:max-w-0{max-width:0px}.lg\:flex-1{flex:1 1 0%}.lg\:flex-none{flex:none}.lg\: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))}.lg\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.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\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\: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))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-4{padding:1rem}.lg\:p-6{padding:1.5rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:text-3xl{font-size:1.875rem;line-height:2.25rem}.lg\:text-sm{font-size:.875rem;line-height:1.25rem}.lg\:opacity-0{opacity:0}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--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))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>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\]\: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\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&_\.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\]\:invisible svg{visibility:hidden}.\[\&_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-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.16.25"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.1666666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.6666666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.4566666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.1466666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.7142857143em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.8571428571em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.1428571429em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.2857142857em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.4285714286em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.7142857143em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.0571428571em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.4685714286em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.9628571429em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.5542857143em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.7777777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.8888888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.1111111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.3044444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.7644444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.5833333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.7283333333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.0733333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.4861111111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.4402777778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.7277777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.2893518519em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.4050925926em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462962963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.5208333333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.2002314815em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.4398148148em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.2410800386em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2892960463em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512054em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.3857280617em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.4339440694em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.4821600771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.5785920926em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.6943105111em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8331726133em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.1996142719em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.2009646302em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.2411575563em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.2813504823em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.3215434084em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.3617363344em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.4019292605em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.4823151125em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778135em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.6945337621em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.8336012862em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo} diff --git a/webui/dist/assets/index-pMcRRAxj.js b/webui/dist/assets/index-pMcRRAxj.js deleted file mode 100644 index 7a2399d9..00000000 --- a/webui/dist/assets/index-pMcRRAxj.js +++ /dev/null @@ -1,344 +0,0 @@ -import{r as w,j as r,u as rs,R as Fe,d as _C,L as MC,e as EC,f as fr,g as AC,h as DC,O as _5,b as zC,k as OC}from"./router-BWgTyY51.js";import{a as RC,b as BC,g as M5}from"./react-vendor-Dtc2IqVY.js";import{c as E5,R as LC,T as PC,L as FC,a as IC,C as x0,X as g0,Y as Gc,b as qC,B as fp,d as v0,P as HC,e as UC,f as $C}from"./charts-DU5SeejN.js";import{c as Ha,a as vm,u as Ta,P as Ft,b as Pe,d as dn,e as Tu,f as Dl,g as gr,h as Wr,i as A5,j as o1,k as c1,S as VC,l as D5,m as z5,R as O5,O as ym,n as u1,C as bm,o as d1,T as m1,D as h1,p as f1,q as R5,r as B5,W as GC,s as L5,I as YC,t as P5,v as F5,w as WC,x as I5,V as XC,L as q5,y as H5,z as KC,A as QC,B as U5,E as ZC,F as JC,G as Nl,H as wm,J as Uo,K as $5,M as V5,N as G5,Q as Y5,U as p1,X as x1,Y as jm,Z as Nm,_ as g1,$ as W5,a0 as eT,a1 as X5,a2 as tT,a3 as nT,a4 as K5,a5 as rT}from"./ui-vendor-nTGLnMlb.js";import{R as Os,A as aT,D as sT,a as lT,Z as mu,C as ui,M as _u,T as iT,X as Mu,P as Q5,S as oT,b as Pa,I as hi,c as Mo,d as di,e as hx,E as fx,f as qa,g as Ur,h as px,i as cT,j as xx,k as gx,L as Py,K as uT,l as fi,m as dT,n as mT,F as jl,o as hT,B as fT,U as Z5,p as v1,q as pT,r as xT,s as Gr,H as K0,t as J5,u as hu,v as vx,w as fu,x as y1,y as b1,z as mr,G as Ot,J as Q0,N as Ro,O as Eu,Q as vi,V as yi,W as Au,Y as gT,_ as vT,$ as Z0,a0 as yx,a1 as Bo,a2 as Fy,a3 as J0,a4 as yT,a5 as Iy,a6 as bT,a7 as wT,a8 as jT,a9 as qy,aa as lu,ab as em,ac as e6,ad as t6,ae as n6,af as NT,ag as ST,ah as Hy,ai as kT,aj as CT,ak as Uy,al as TT}from"./icons-BdGv2zEo.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))a(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();var pp={exports:{}},Yc={},xp={exports:{}},gp={};var $y;function _T(){return $y||($y=1,(function(e){function t(U,q){var W=U.length;U.push(q);e:for(;0>>1,P=U[oe];if(0>>1;oel(O,W))Nel(se,O)?(U[oe]=se,U[Ne]=W,oe=Ne):(U[oe]=O,U[Z]=W,oe=Z);else if(Nel(se,W))U[oe]=se,U[Ne]=W,oe=Ne;else break e}}return q}function l(U,q){var W=U.sortIndex-q.sortIndex;return W!==0?W:U.id-q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var m=[],f=[],p=1,x=null,y=3,b=!1,j=!1,k=!1,S=!1,_=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function z(U){for(var q=n(f);q!==null;){if(q.callback===null)a(f);else if(q.startTime<=U)a(f),q.sortIndex=q.expirationTime,t(m,q);else break;q=n(f)}}function L(U){if(k=!1,z(U),!j)if(n(m)!==null)j=!0,E||(E=!0,te());else{var q=n(f);q!==null&&ae(L,q.startTime-U)}}var E=!1,R=-1,H=5,$=-1;function I(){return S?!0:!(e.unstable_now()-$U&&I());){var oe=x.callback;if(typeof oe=="function"){x.callback=null,y=x.priorityLevel;var P=oe(x.expirationTime<=U);if(U=e.unstable_now(),typeof P=="function"){x.callback=P,z(U),q=!0;break t}x===n(m)&&a(m),z(U)}else a(m);x=n(m)}if(x!==null)q=!0;else{var je=n(f);je!==null&&ae(L,je.startTime-U),q=!1}}break e}finally{x=null,y=W,b=!1}q=void 0}}finally{q?te():E=!1}}}var te;if(typeof D=="function")te=function(){D(G)};else if(typeof MessageChannel<"u"){var we=new MessageChannel,J=we.port2;we.port1.onmessage=G,te=function(){J.postMessage(null)}}else te=function(){_(G,0)};function ae(U,q){R=_(function(){U(e.unstable_now())},q)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(U){U.callback=null},e.unstable_forceFrameRate=function(U){0>U||125oe?(U.sortIndex=W,t(f,U),n(m)===null&&U===n(f)&&(k?(M(R),R=-1):k=!0,ae(L,W-oe))):(U.sortIndex=P,t(m,U),j||b||(j=!0,E||(E=!0,te()))),U},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(U){var q=y;return function(){var W=y;y=q;try{return U.apply(this,arguments)}finally{y=W}}}})(gp)),gp}var Vy;function MT(){return Vy||(Vy=1,xp.exports=_T()),xp.exports}var Gy;function ET(){if(Gy)return Yc;Gy=1;var e=MT(),t=RC(),n=BC();function a(s){var i="https://react.dev/errors/"+s;if(1P||(s.current=oe[P],oe[P]=null,P--)}function O(s,i){P++,oe[P]=s.current,s.current=i}var Ne=je(null),se=je(null),Ce=je(null),ye=je(null);function Be(s,i){switch(O(Ce,i),O(se,s),O(Ne,null),i.nodeType){case 9:case 11:s=(s=i.documentElement)&&(s=s.namespaceURI)?iy(s):0;break;default:if(s=i.tagName,i=i.namespaceURI)i=iy(i),s=oy(i,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}Z(Ne),O(Ne,s)}function ie(){Z(Ne),Z(se),Z(Ce)}function He(s){s.memoizedState!==null&&O(ye,s);var i=Ne.current,u=oy(i,s.type);i!==u&&(O(se,s),O(Ne,u))}function lt(s){se.current===s&&(Z(Ne),Z(se)),ye.current===s&&(Z(ye),Hc._currentValue=W)}var ve,Ze;function We(s){if(ve===void 0)try{throw Error()}catch(u){var i=u.stack.trim().match(/\n( *(at )?)/);ve=i&&i[1]||"",Ze=-1)":-1g||X[h]!==de[g]){var be=` -`+X[h].replace(" at new "," at ");return s.displayName&&be.includes("")&&(be=be.replace("",s.displayName)),be}while(1<=h&&0<=g);break}}}finally{pn=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?We(u):""}function sr(s,i){switch(s.tag){case 26:case 27:case 5:return We(s.type);case 16:return We("Lazy");case 13:return s.child!==i&&i!==null?We("Suspense Fallback"):We("Suspense");case 19:return We("SuspenseList");case 0:case 15:return Bn(s.type,!1);case 11:return Bn(s.type.render,!1);case 1:return Bn(s.type,!0);case 31:return We("Activity");default:return""}}function Qe(s){try{var i="",u=null;do i+=sr(s,u),u=s,s=s.return;while(s);return i}catch(h){return` -Error generating stack: `+h.message+` -`+h.stack}}var Gn=Object.prototype.hasOwnProperty,Sr=e.unstable_scheduleCallback,Er=e.unstable_cancelCallback,Sn=e.unstable_shouldYield,lr=e.unstable_requestPaint,Ue=e.unstable_now,Ln=e.unstable_getCurrentPriorityLevel,K=e.unstable_ImmediatePriority,ge=e.unstable_UserBlockingPriority,Oe=e.unstable_NormalPriority,nt=e.unstable_LowPriority,kt=e.unstable_IdlePriority,Qn=e.log,Ar=e.unstable_setDisableYieldValue,he=null,Me=null;function dt(s){if(typeof Qn=="function"&&Ar(s),Me&&typeof Me.setStrictMode=="function")try{Me.setStrictMode(he,s)}catch{}}var mt=Math.clz32?Math.clz32:xn,Dr=Math.log,at=Math.LN2;function xn(s){return s>>>=0,s===0?32:31-(Dr(s)/at|0)|0}var it=256,Ut=262144,Zn=4194304;function bt(s){var i=s&42;if(i!==0)return i;switch(s&-s){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Mi(s,i,u){var h=s.pendingLanes;if(h===0)return 0;var g=0,v=s.suspendedLanes,T=s.pingedLanes;s=s.warmLanes;var B=h&134217727;return B!==0?(h=B&~v,h!==0?g=bt(h):(T&=B,T!==0?g=bt(T):u||(u=B&~s,u!==0&&(g=bt(u))))):(B=h&~v,B!==0?g=bt(B):T!==0?g=bt(T):u||(u=h&~s,u!==0&&(g=bt(u)))),g===0?0:i!==0&&i!==g&&(i&v)===0&&(v=g&-g,u=i&-i,v>=u||v===32&&(u&4194048)!==0)?i:g}function Pl(s,i){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&i)===0}function th(s,i){switch(s){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32: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 i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ei(){var s=Zn;return Zn<<=1,(Zn&62914560)===0&&(Zn=4194304),s}function Fl(s){for(var i=[],u=0;31>u;u++)i.push(s);return i}function nc(s,i){s.pendingLanes|=i,i!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function xS(s,i,u,h,g,v){var T=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var B=s.entanglements,X=s.expirationTimes,de=s.hiddenUpdates;for(u=T&~u;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var jS=/[\n"\\]/g;function pa(s){return s.replace(jS,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function ih(s,i,u,h,g,v,T,B){s.name="",T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?s.type=T:s.removeAttribute("type"),i!=null?T==="number"?(i===0&&s.value===""||s.value!=i)&&(s.value=""+fa(i)):s.value!==""+fa(i)&&(s.value=""+fa(i)):T!=="submit"&&T!=="reset"||s.removeAttribute("value"),i!=null?oh(s,T,fa(i)):u!=null?oh(s,T,fa(u)):h!=null&&s.removeAttribute("value"),g==null&&v!=null&&(s.defaultChecked=!!v),g!=null&&(s.checked=g&&typeof g!="function"&&typeof g!="symbol"),B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"?s.name=""+fa(B):s.removeAttribute("name")}function tv(s,i,u,h,g,v,T,B){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(s.type=v),i!=null||u!=null){if(!(v!=="submit"&&v!=="reset"||i!=null)){lh(s);return}u=u!=null?""+fa(u):"",i=i!=null?""+fa(i):u,B||i===s.value||(s.value=i),s.defaultValue=i}h=h??g,h=typeof h!="function"&&typeof h!="symbol"&&!!h,s.checked=B?s.checked:!!h,s.defaultChecked=!!h,T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(s.name=T),lh(s)}function oh(s,i,u){i==="number"&&ld(s.ownerDocument)===s||s.defaultValue===""+u||(s.defaultValue=""+u)}function Bi(s,i,u,h){if(s=s.options,i){i={};for(var g=0;g"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hh=!1;if(ms)try{var lc={};Object.defineProperty(lc,"passive",{get:function(){hh=!0}}),window.addEventListener("test",lc,lc),window.removeEventListener("test",lc,lc)}catch{hh=!1}var Ys=null,fh=null,od=null;function ov(){if(od)return od;var s,i=fh,u=i.length,h,g="value"in Ys?Ys.value:Ys.textContent,v=g.length;for(s=0;s=cc),fv=" ",pv=!1;function xv(s,i){switch(s){case"keyup":return KS.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gv(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Ii=!1;function ZS(s,i){switch(s){case"compositionend":return gv(i);case"keypress":return i.which!==32?null:(pv=!0,fv);case"textInput":return s=i.data,s===fv&&pv?null:s;default:return null}}function JS(s,i){if(Ii)return s==="compositionend"||!yh&&xv(s,i)?(s=ov(),od=fh=Ys=null,Ii=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1=i)return{node:u,offset:i-s};s=h}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=kv(u)}}function Tv(s,i){return s&&i?s===i?!0:s&&s.nodeType===3?!1:i&&i.nodeType===3?Tv(s,i.parentNode):"contains"in s?s.contains(i):s.compareDocumentPosition?!!(s.compareDocumentPosition(i)&16):!1:!1}function _v(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var i=ld(s.document);i instanceof s.HTMLIFrameElement;){try{var u=typeof i.contentWindow.location.href=="string"}catch{u=!1}if(u)s=i.contentWindow;else break;i=ld(s.document)}return i}function jh(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i&&(i==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||i==="textarea"||s.contentEditable==="true")}var ik=ms&&"documentMode"in document&&11>=document.documentMode,qi=null,Nh=null,hc=null,Sh=!1;function Mv(s,i,u){var h=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Sh||qi==null||qi!==ld(h)||(h=qi,"selectionStart"in h&&jh(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),hc&&mc(hc,h)||(hc=h,h=t0(Nh,"onSelect"),0>=T,g-=T,$a=1<<32-mt(i)+g|u<pt?(Dt=Ge,Ge=null):Dt=Ge.sibling;var qt=fe(le,Ge,ce[pt],Se);if(qt===null){Ge===null&&(Ge=Dt);break}s&&Ge&&qt.alternate===null&&i(le,Ge),ee=v(qt,ee,pt),It===null?Ke=qt:It.sibling=qt,It=qt,Ge=Dt}if(pt===ce.length)return u(le,Ge),zt&&fs(le,pt),Ke;if(Ge===null){for(;ptpt?(Dt=Ge,Ge=null):Dt=Ge.sibling;var pl=fe(le,Ge,qt.value,Se);if(pl===null){Ge===null&&(Ge=Dt);break}s&&Ge&&pl.alternate===null&&i(le,Ge),ee=v(pl,ee,pt),It===null?Ke=pl:It.sibling=pl,It=pl,Ge=Dt}if(qt.done)return u(le,Ge),zt&&fs(le,pt),Ke;if(Ge===null){for(;!qt.done;pt++,qt=ce.next())qt=ke(le,qt.value,Se),qt!==null&&(ee=v(qt,ee,pt),It===null?Ke=qt:It.sibling=qt,It=qt);return zt&&fs(le,pt),Ke}for(Ge=h(Ge);!qt.done;pt++,qt=ce.next())qt=xe(Ge,le,pt,qt.value,Se),qt!==null&&(s&&qt.alternate!==null&&Ge.delete(qt.key===null?pt:qt.key),ee=v(qt,ee,pt),It===null?Ke=qt:It.sibling=qt,It=qt);return s&&Ge.forEach(function(TC){return i(le,TC)}),zt&&fs(le,pt),Ke}function sn(le,ee,ce,Se){if(typeof ce=="object"&&ce!==null&&ce.type===k&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case b:e:{for(var Ke=ce.key;ee!==null;){if(ee.key===Ke){if(Ke=ce.type,Ke===k){if(ee.tag===7){u(le,ee.sibling),Se=g(ee,ce.props.children),Se.return=le,le=Se;break e}}else if(ee.elementType===Ke||typeof Ke=="object"&&Ke!==null&&Ke.$$typeof===H&&Kl(Ke)===ee.type){u(le,ee.sibling),Se=g(ee,ce.props),yc(Se,ce),Se.return=le,le=Se;break e}u(le,ee);break}else i(le,ee);ee=ee.sibling}ce.type===k?(Se=Vl(ce.props.children,le.mode,Se,ce.key),Se.return=le,le=Se):(Se=vd(ce.type,ce.key,ce.props,null,le.mode,Se),yc(Se,ce),Se.return=le,le=Se)}return T(le);case j:e:{for(Ke=ce.key;ee!==null;){if(ee.key===Ke)if(ee.tag===4&&ee.stateNode.containerInfo===ce.containerInfo&&ee.stateNode.implementation===ce.implementation){u(le,ee.sibling),Se=g(ee,ce.children||[]),Se.return=le,le=Se;break e}else{u(le,ee);break}else i(le,ee);ee=ee.sibling}Se=Ah(ce,le.mode,Se),Se.return=le,le=Se}return T(le);case H:return ce=Kl(ce),sn(le,ee,ce,Se)}if(ae(ce))return qe(le,ee,ce,Se);if(te(ce)){if(Ke=te(ce),typeof Ke!="function")throw Error(a(150));return ce=Ke.call(ce),rt(le,ee,ce,Se)}if(typeof ce.then=="function")return sn(le,ee,kd(ce),Se);if(ce.$$typeof===D)return sn(le,ee,wd(le,ce),Se);Cd(le,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint"?(ce=""+ce,ee!==null&&ee.tag===6?(u(le,ee.sibling),Se=g(ee,ce),Se.return=le,le=Se):(u(le,ee),Se=Eh(ce,le.mode,Se),Se.return=le,le=Se),T(le)):u(le,ee)}return function(le,ee,ce,Se){try{vc=0;var Ke=sn(le,ee,ce,Se);return Zi=null,Ke}catch(Ge){if(Ge===Qi||Ge===Nd)throw Ge;var It=ea(29,Ge,null,le.mode);return It.lanes=Se,It.return=le,It}finally{}}}var Zl=Zv(!0),Jv=Zv(!1),Zs=!1;function Uh(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $h(s,i){s=s.updateQueue,i.updateQueue===s&&(i.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Js(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function el(s,i,u){var h=s.updateQueue;if(h===null)return null;if(h=h.shared,($t&2)!==0){var g=h.pending;return g===null?i.next=i:(i.next=g.next,g.next=i),h.pending=i,i=gd(s),Bv(s,null,u),i}return xd(s,h,i,u),gd(s)}function bc(s,i,u){if(i=i.updateQueue,i!==null&&(i=i.shared,(u&4194048)!==0)){var h=i.lanes;h&=s.pendingLanes,u|=h,i.lanes=u,$g(s,u)}}function Vh(s,i){var u=s.updateQueue,h=s.alternate;if(h!==null&&(h=h.updateQueue,u===h)){var g=null,v=null;if(u=u.firstBaseUpdate,u!==null){do{var T={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};v===null?g=v=T:v=v.next=T,u=u.next}while(u!==null);v===null?g=v=i:v=v.next=i}else g=v=i;u={baseState:h.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:h.shared,callbacks:h.callbacks},s.updateQueue=u;return}s=u.lastBaseUpdate,s===null?u.firstBaseUpdate=i:s.next=i,u.lastBaseUpdate=i}var Gh=!1;function wc(){if(Gh){var s=Ki;if(s!==null)throw s}}function jc(s,i,u,h){Gh=!1;var g=s.updateQueue;Zs=!1;var v=g.firstBaseUpdate,T=g.lastBaseUpdate,B=g.shared.pending;if(B!==null){g.shared.pending=null;var X=B,de=X.next;X.next=null,T===null?v=de:T.next=de,T=X;var be=s.alternate;be!==null&&(be=be.updateQueue,B=be.lastBaseUpdate,B!==T&&(B===null?be.firstBaseUpdate=de:B.next=de,be.lastBaseUpdate=X))}if(v!==null){var ke=g.baseState;T=0,be=de=X=null,B=v;do{var fe=B.lane&-536870913,xe=fe!==B.lane;if(xe?(At&fe)===fe:(h&fe)===fe){fe!==0&&fe===Xi&&(Gh=!0),be!==null&&(be=be.next={lane:0,tag:B.tag,payload:B.payload,callback:null,next:null});e:{var qe=s,rt=B;fe=i;var sn=u;switch(rt.tag){case 1:if(qe=rt.payload,typeof qe=="function"){ke=qe.call(sn,ke,fe);break e}ke=qe;break e;case 3:qe.flags=qe.flags&-65537|128;case 0:if(qe=rt.payload,fe=typeof qe=="function"?qe.call(sn,ke,fe):qe,fe==null)break e;ke=x({},ke,fe);break e;case 2:Zs=!0}}fe=B.callback,fe!==null&&(s.flags|=64,xe&&(s.flags|=8192),xe=g.callbacks,xe===null?g.callbacks=[fe]:xe.push(fe))}else xe={lane:fe,tag:B.tag,payload:B.payload,callback:B.callback,next:null},be===null?(de=be=xe,X=ke):be=be.next=xe,T|=fe;if(B=B.next,B===null){if(B=g.shared.pending,B===null)break;xe=B,B=xe.next,xe.next=null,g.lastBaseUpdate=xe,g.shared.pending=null}}while(!0);be===null&&(X=ke),g.baseState=X,g.firstBaseUpdate=de,g.lastBaseUpdate=be,v===null&&(g.shared.lanes=0),sl|=T,s.lanes=T,s.memoizedState=ke}}function e4(s,i){if(typeof s!="function")throw Error(a(191,s));s.call(i)}function t4(s,i){var u=s.callbacks;if(u!==null)for(s.callbacks=null,s=0;sv?v:8;var T=U.T,B={};U.T=B,mf(s,!1,i,u);try{var X=g(),de=U.S;if(de!==null&&de(B,X),X!==null&&typeof X=="object"&&typeof X.then=="function"){var be=xk(X,h);kc(s,i,be,sa(s))}else kc(s,i,h,sa(s))}catch(ke){kc(s,i,{then:function(){},status:"rejected",reason:ke},sa())}finally{q.p=v,T!==null&&B.types!==null&&(T.types=B.types),U.T=T}}function jk(){}function uf(s,i,u,h){if(s.tag!==5)throw Error(a(476));var g=z4(s).queue;D4(s,g,i,W,u===null?jk:function(){return O4(s),u(h)})}function z4(s){var i=s.memoizedState;if(i!==null)return i;i={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vs,lastRenderedState:W},next:null};var u={};return i.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vs,lastRenderedState:u},next:null},s.memoizedState=i,s=s.alternate,s!==null&&(s.memoizedState=i),i}function O4(s){var i=z4(s);i.next===null&&(i=s.alternate.memoizedState),kc(s,i.next.queue,{},sa())}function df(){return cr(Hc)}function R4(){return On().memoizedState}function B4(){return On().memoizedState}function Nk(s){for(var i=s.return;i!==null;){switch(i.tag){case 24:case 3:var u=sa();s=Js(u);var h=el(i,s,u);h!==null&&(Fr(h,i,u),bc(h,i,u)),i={cache:Fh()},s.payload=i;return}i=i.return}}function Sk(s,i,u){var h=sa();u={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Bd(s)?P4(i,u):(u=_h(s,i,u,h),u!==null&&(Fr(u,s,h),F4(u,i,h)))}function L4(s,i,u){var h=sa();kc(s,i,u,h)}function kc(s,i,u,h){var g={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Bd(s))P4(i,g);else{var v=s.alternate;if(s.lanes===0&&(v===null||v.lanes===0)&&(v=i.lastRenderedReducer,v!==null))try{var T=i.lastRenderedState,B=v(T,u);if(g.hasEagerState=!0,g.eagerState=B,Jr(B,T))return xd(s,i,g,0),mn===null&&pd(),!1}catch{}finally{}if(u=_h(s,i,g,h),u!==null)return Fr(u,s,h),F4(u,i,h),!0}return!1}function mf(s,i,u,h){if(h={lane:2,revertLane:$f(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Bd(s)){if(i)throw Error(a(479))}else i=_h(s,u,h,2),i!==null&&Fr(i,s,2)}function Bd(s){var i=s.alternate;return s===ht||i!==null&&i===ht}function P4(s,i){eo=Md=!0;var u=s.pending;u===null?i.next=i:(i.next=u.next,u.next=i),s.pending=i}function F4(s,i,u){if((u&4194048)!==0){var h=i.lanes;h&=s.pendingLanes,u|=h,i.lanes=u,$g(s,u)}}var Cc={readContext:cr,use:Dd,useCallback:En,useContext:En,useEffect:En,useImperativeHandle:En,useLayoutEffect:En,useInsertionEffect:En,useMemo:En,useReducer:En,useRef:En,useState:En,useDebugValue:En,useDeferredValue:En,useTransition:En,useSyncExternalStore:En,useId:En,useHostTransitionStatus:En,useFormState:En,useActionState:En,useOptimistic:En,useMemoCache:En,useCacheRefresh:En};Cc.useEffectEvent=En;var I4={readContext:cr,use:Dd,useCallback:function(s,i){return kr().memoizedState=[s,i===void 0?null:i],s},useContext:cr,useEffect:N4,useImperativeHandle:function(s,i,u){u=u!=null?u.concat([s]):null,Od(4194308,4,T4.bind(null,i,s),u)},useLayoutEffect:function(s,i){return Od(4194308,4,s,i)},useInsertionEffect:function(s,i){Od(4,2,s,i)},useMemo:function(s,i){var u=kr();i=i===void 0?null:i;var h=s();if(Jl){dt(!0);try{s()}finally{dt(!1)}}return u.memoizedState=[h,i],h},useReducer:function(s,i,u){var h=kr();if(u!==void 0){var g=u(i);if(Jl){dt(!0);try{u(i)}finally{dt(!1)}}}else g=i;return h.memoizedState=h.baseState=g,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:g},h.queue=s,s=s.dispatch=Sk.bind(null,ht,s),[h.memoizedState,s]},useRef:function(s){var i=kr();return s={current:s},i.memoizedState=s},useState:function(s){s=af(s);var i=s.queue,u=L4.bind(null,ht,i);return i.dispatch=u,[s.memoizedState,u]},useDebugValue:of,useDeferredValue:function(s,i){var u=kr();return cf(u,s,i)},useTransition:function(){var s=af(!1);return s=D4.bind(null,ht,s.queue,!0,!1),kr().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,i,u){var h=ht,g=kr();if(zt){if(u===void 0)throw Error(a(407));u=u()}else{if(u=i(),mn===null)throw Error(a(349));(At&127)!==0||i4(h,i,u)}g.memoizedState=u;var v={value:u,getSnapshot:i};return g.queue=v,N4(c4.bind(null,h,v,s),[s]),h.flags|=2048,no(9,{destroy:void 0},o4.bind(null,h,v,u,i),null),u},useId:function(){var s=kr(),i=mn.identifierPrefix;if(zt){var u=Va,h=$a;u=(h&~(1<<32-mt(h)-1)).toString(32)+u,i="_"+i+"R_"+u,u=Ed++,0<\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof h.is=="string"?T.createElement("select",{is:h.is}):T.createElement("select"),h.multiple?v.multiple=!0:h.size&&(v.size=h.size);break;default:v=typeof h.is=="string"?T.createElement(g,{is:h.is}):T.createElement(g)}}v[ir]=i,v[zr]=h;e:for(T=i.child;T!==null;){if(T.tag===5||T.tag===6)v.appendChild(T.stateNode);else if(T.tag!==4&&T.tag!==27&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===i)break e;for(;T.sibling===null;){if(T.return===null||T.return===i)break e;T=T.return}T.sibling.return=T.return,T=T.sibling}i.stateNode=v;e:switch(dr(v,g,h),g){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&bs(i)}}return wn(i),Cf(i,i.type,s===null?null:s.memoizedProps,i.pendingProps,u),null;case 6:if(s&&i.stateNode!=null)s.memoizedProps!==h&&bs(i);else{if(typeof h!="string"&&i.stateNode===null)throw Error(a(166));if(s=Ce.current,Yi(i)){if(s=i.stateNode,u=i.memoizedProps,h=null,g=or,g!==null)switch(g.tag){case 27:case 5:h=g.memoizedProps}s[ir]=i,s=!!(s.nodeValue===u||h!==null&&h.suppressHydrationWarning===!0||sy(s.nodeValue,u)),s||Ks(i,!0)}else s=n0(s).createTextNode(h),s[ir]=i,i.stateNode=s}return wn(i),null;case 31:if(u=i.memoizedState,s===null||s.memoizedState!==null){if(h=Yi(i),u!==null){if(s===null){if(!h)throw Error(a(318));if(s=i.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(557));s[ir]=i}else Gl(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;wn(i),s=!1}else u=Rh(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return i.flags&256?(na(i),i):(na(i),null);if((i.flags&128)!==0)throw Error(a(558))}return wn(i),null;case 13:if(h=i.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(g=Yi(i),h!==null&&h.dehydrated!==null){if(s===null){if(!g)throw Error(a(318));if(g=i.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(a(317));g[ir]=i}else Gl(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;wn(i),g=!1}else g=Rh(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=g),g=!0;if(!g)return i.flags&256?(na(i),i):(na(i),null)}return na(i),(i.flags&128)!==0?(i.lanes=u,i):(u=h!==null,s=s!==null&&s.memoizedState!==null,u&&(h=i.child,g=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(g=h.alternate.memoizedState.cachePool.pool),v=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(v=h.memoizedState.cachePool.pool),v!==g&&(h.flags|=2048)),u!==s&&u&&(i.child.flags|=8192),qd(i,i.updateQueue),wn(i),null);case 4:return ie(),s===null&&Wf(i.stateNode.containerInfo),wn(i),null;case 10:return xs(i.type),wn(i),null;case 19:if(Z(zn),h=i.memoizedState,h===null)return wn(i),null;if(g=(i.flags&128)!==0,v=h.rendering,v===null)if(g)_c(h,!1);else{if(An!==0||s!==null&&(s.flags&128)!==0)for(s=i.child;s!==null;){if(v=_d(s),v!==null){for(i.flags|=128,_c(h,!1),s=v.updateQueue,i.updateQueue=s,qd(i,s),i.subtreeFlags=0,s=u,u=i.child;u!==null;)Lv(u,s),u=u.sibling;return O(zn,zn.current&1|2),zt&&fs(i,h.treeForkCount),i.child}s=s.sibling}h.tail!==null&&Ue()>Gd&&(i.flags|=128,g=!0,_c(h,!1),i.lanes=4194304)}else{if(!g)if(s=_d(v),s!==null){if(i.flags|=128,g=!0,s=s.updateQueue,i.updateQueue=s,qd(i,s),_c(h,!0),h.tail===null&&h.tailMode==="hidden"&&!v.alternate&&!zt)return wn(i),null}else 2*Ue()-h.renderingStartTime>Gd&&u!==536870912&&(i.flags|=128,g=!0,_c(h,!1),i.lanes=4194304);h.isBackwards?(v.sibling=i.child,i.child=v):(s=h.last,s!==null?s.sibling=v:i.child=v,h.last=v)}return h.tail!==null?(s=h.tail,h.rendering=s,h.tail=s.sibling,h.renderingStartTime=Ue(),s.sibling=null,u=zn.current,O(zn,g?u&1|2:u&1),zt&&fs(i,h.treeForkCount),s):(wn(i),null);case 22:case 23:return na(i),Wh(),h=i.memoizedState!==null,s!==null?s.memoizedState!==null!==h&&(i.flags|=8192):h&&(i.flags|=8192),h?(u&536870912)!==0&&(i.flags&128)===0&&(wn(i),i.subtreeFlags&6&&(i.flags|=8192)):wn(i),u=i.updateQueue,u!==null&&qd(i,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),h=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(h=i.memoizedState.cachePool.pool),h!==u&&(i.flags|=2048),s!==null&&Z(Xl),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),i.memoizedState.cache!==u&&(i.flags|=2048),xs(Pn),wn(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function Mk(s,i){switch(zh(i),i.tag){case 1:return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 3:return xs(Pn),ie(),s=i.flags,(s&65536)!==0&&(s&128)===0?(i.flags=s&-65537|128,i):null;case 26:case 27:case 5:return lt(i),null;case 31:if(i.memoizedState!==null){if(na(i),i.alternate===null)throw Error(a(340));Gl()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 13:if(na(i),s=i.memoizedState,s!==null&&s.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Gl()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 19:return Z(zn),null;case 4:return ie(),null;case 10:return xs(i.type),null;case 22:case 23:return na(i),Wh(),s!==null&&Z(Xl),s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 24:return xs(Pn),null;case 25:return null;default:return null}}function u2(s,i){switch(zh(i),i.tag){case 3:xs(Pn),ie();break;case 26:case 27:case 5:lt(i);break;case 4:ie();break;case 31:i.memoizedState!==null&&na(i);break;case 13:na(i);break;case 19:Z(zn);break;case 10:xs(i.type);break;case 22:case 23:na(i),Wh(),s!==null&&Z(Xl);break;case 24:xs(Pn)}}function Mc(s,i){try{var u=i.updateQueue,h=u!==null?u.lastEffect:null;if(h!==null){var g=h.next;u=g;do{if((u.tag&s)===s){h=void 0;var v=u.create,T=u.inst;h=v(),T.destroy=h}u=u.next}while(u!==g)}}catch(B){Yt(i,i.return,B)}}function rl(s,i,u){try{var h=i.updateQueue,g=h!==null?h.lastEffect:null;if(g!==null){var v=g.next;h=v;do{if((h.tag&s)===s){var T=h.inst,B=T.destroy;if(B!==void 0){T.destroy=void 0,g=i;var X=u,de=B;try{de()}catch(be){Yt(g,X,be)}}}h=h.next}while(h!==v)}}catch(be){Yt(i,i.return,be)}}function d2(s){var i=s.updateQueue;if(i!==null){var u=s.stateNode;try{t4(i,u)}catch(h){Yt(s,s.return,h)}}}function m2(s,i,u){u.props=ei(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(h){Yt(s,i,h)}}function Ec(s,i){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var h=s.stateNode;break;case 30:h=s.stateNode;break;default:h=s.stateNode}typeof u=="function"?s.refCleanup=u(h):u.current=h}}catch(g){Yt(s,i,g)}}function Ga(s,i){var u=s.ref,h=s.refCleanup;if(u!==null)if(typeof h=="function")try{h()}catch(g){Yt(s,i,g)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(g){Yt(s,i,g)}else u.current=null}function h2(s){var i=s.type,u=s.memoizedProps,h=s.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":u.autoFocus&&h.focus();break e;case"img":u.src?h.src=u.src:u.srcSet&&(h.srcset=u.srcSet)}}catch(g){Yt(s,s.return,g)}}function Tf(s,i,u){try{var h=s.stateNode;Qk(h,s.type,u,i),h[zr]=i}catch(g){Yt(s,s.return,g)}}function f2(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&ul(s.type)||s.tag===4}function _f(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||f2(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&ul(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Mf(s,i,u){var h=s.tag;if(h===5||h===6)s=s.stateNode,i?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(s,i):(i=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,i.appendChild(s),u=u._reactRootContainer,u!=null||i.onclick!==null||(i.onclick=ds));else if(h!==4&&(h===27&&ul(s.type)&&(u=s.stateNode,i=null),s=s.child,s!==null))for(Mf(s,i,u),s=s.sibling;s!==null;)Mf(s,i,u),s=s.sibling}function Hd(s,i,u){var h=s.tag;if(h===5||h===6)s=s.stateNode,i?u.insertBefore(s,i):u.appendChild(s);else if(h!==4&&(h===27&&ul(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(Hd(s,i,u),s=s.sibling;s!==null;)Hd(s,i,u),s=s.sibling}function p2(s){var i=s.stateNode,u=s.memoizedProps;try{for(var h=s.type,g=i.attributes;g.length;)i.removeAttributeNode(g[0]);dr(i,h,u),i[ir]=s,i[zr]=u}catch(v){Yt(s,s.return,v)}}var ws=!1,qn=!1,Ef=!1,x2=typeof WeakSet=="function"?WeakSet:Set,er=null;function Ek(s,i){if(s=s.containerInfo,Qf=c0,s=_v(s),jh(s)){if("selectionStart"in s)var u={start:s.selectionStart,end:s.selectionEnd};else e:{u=(u=s.ownerDocument)&&u.defaultView||window;var h=u.getSelection&&u.getSelection();if(h&&h.rangeCount!==0){u=h.anchorNode;var g=h.anchorOffset,v=h.focusNode;h=h.focusOffset;try{u.nodeType,v.nodeType}catch{u=null;break e}var T=0,B=-1,X=-1,de=0,be=0,ke=s,fe=null;t:for(;;){for(var xe;ke!==u||g!==0&&ke.nodeType!==3||(B=T+g),ke!==v||h!==0&&ke.nodeType!==3||(X=T+h),ke.nodeType===3&&(T+=ke.nodeValue.length),(xe=ke.firstChild)!==null;)fe=ke,ke=xe;for(;;){if(ke===s)break t;if(fe===u&&++de===g&&(B=T),fe===v&&++be===h&&(X=T),(xe=ke.nextSibling)!==null)break;ke=fe,fe=ke.parentNode}ke=xe}u=B===-1||X===-1?null:{start:B,end:X}}else u=null}u=u||{start:0,end:0}}else u=null;for(Zf={focusedElem:s,selectionRange:u},c0=!1,er=i;er!==null;)if(i=er,s=i.child,(i.subtreeFlags&1028)!==0&&s!==null)s.return=i,er=s;else for(;er!==null;){switch(i=er,v=i.alternate,s=i.flags,i.tag){case 0:if((s&4)!==0&&(s=i.updateQueue,s=s!==null?s.events:null,s!==null))for(u=0;u title"))),dr(v,h,u),v[ir]=s,Jn(v),h=v;break e;case"link":var T=jy("link","href",g).get(h+(u.href||""));if(T){for(var B=0;Bsn&&(T=sn,sn=rt,rt=T);var le=Cv(B,rt),ee=Cv(B,sn);if(le&&ee&&(xe.rangeCount!==1||xe.anchorNode!==le.node||xe.anchorOffset!==le.offset||xe.focusNode!==ee.node||xe.focusOffset!==ee.offset)){var ce=ke.createRange();ce.setStart(le.node,le.offset),xe.removeAllRanges(),rt>sn?(xe.addRange(ce),xe.extend(ee.node,ee.offset)):(ce.setEnd(ee.node,ee.offset),xe.addRange(ce))}}}}for(ke=[],xe=B;xe=xe.parentNode;)xe.nodeType===1&&ke.push({element:xe,left:xe.scrollLeft,top:xe.scrollTop});for(typeof B.focus=="function"&&B.focus(),B=0;Bu?32:u,U.T=null,u=Lf,Lf=null;var v=il,T=Cs;if(Yn=0,io=il=null,Cs=0,($t&6)!==0)throw Error(a(331));var B=$t;if($t|=4,T2(v.current),S2(v,v.current,T,u),$t=B,Bc(0,!1),Me&&typeof Me.onPostCommitFiberRoot=="function")try{Me.onPostCommitFiberRoot(he,v)}catch{}return!0}finally{q.p=g,U.T=h,V2(s,i)}}function Y2(s,i,u){i=ga(u,i),i=xf(s.stateNode,i,2),s=el(s,i,2),s!==null&&(nc(s,2),Ya(s))}function Yt(s,i,u){if(s.tag===3)Y2(s,s,u);else for(;i!==null;){if(i.tag===3){Y2(i,s,u);break}else if(i.tag===1){var h=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(ll===null||!ll.has(h))){s=ga(u,s),u=W4(2),h=el(i,u,2),h!==null&&(X4(u,h,i,s),nc(h,2),Ya(h));break}}i=i.return}}function qf(s,i,u){var h=s.pingCache;if(h===null){h=s.pingCache=new zk;var g=new Set;h.set(i,g)}else g=h.get(i),g===void 0&&(g=new Set,h.set(i,g));g.has(u)||(zf=!0,g.add(u),s=Pk.bind(null,s,i,u),i.then(s,s))}function Pk(s,i,u){var h=s.pingCache;h!==null&&h.delete(i),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,mn===s&&(At&u)===u&&(An===4||An===3&&(At&62914560)===At&&300>Ue()-Vd?($t&2)===0&&oo(s,0):Of|=u,lo===At&&(lo=0)),Ya(s)}function W2(s,i){i===0&&(i=Ei()),s=$l(s,i),s!==null&&(nc(s,i),Ya(s))}function Fk(s){var i=s.memoizedState,u=0;i!==null&&(u=i.retryLane),W2(s,u)}function Ik(s,i){var u=0;switch(s.tag){case 31:case 13:var h=s.stateNode,g=s.memoizedState;g!==null&&(u=g.retryLane);break;case 19:h=s.stateNode;break;case 22:h=s.stateNode._retryCache;break;default:throw Error(a(314))}h!==null&&h.delete(i),W2(s,u)}function qk(s,i){return Sr(s,i)}var Zd=null,uo=null,Hf=!1,Jd=!1,Uf=!1,cl=0;function Ya(s){s!==uo&&s.next===null&&(uo===null?Zd=uo=s:uo=uo.next=s),Jd=!0,Hf||(Hf=!0,Uk())}function Bc(s,i){if(!Uf&&Jd){Uf=!0;do for(var u=!1,h=Zd;h!==null;){if(s!==0){var g=h.pendingLanes;if(g===0)var v=0;else{var T=h.suspendedLanes,B=h.pingedLanes;v=(1<<31-mt(42|s)+1)-1,v&=g&~(T&~B),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(u=!0,Z2(h,v))}else v=At,v=Mi(h,h===mn?v:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(v&3)===0||Pl(h,v)||(u=!0,Z2(h,v));h=h.next}while(u);Uf=!1}}function Hk(){X2()}function X2(){Jd=Hf=!1;var s=0;cl!==0&&Jk()&&(s=cl);for(var i=Ue(),u=null,h=Zd;h!==null;){var g=h.next,v=K2(h,i);v===0?(h.next=null,u===null?Zd=g:u.next=g,g===null&&(uo=u)):(u=h,(s!==0||(v&3)!==0)&&(Jd=!0)),h=g}Yn!==0&&Yn!==5||Bc(s),cl!==0&&(cl=0)}function K2(s,i){for(var u=s.suspendedLanes,h=s.pingedLanes,g=s.expirationTimes,v=s.pendingLanes&-62914561;0B)break;var be=X.transferSize,ke=X.initiatorType;be&&ly(ke)&&(X=X.responseEnd,T+=be*(X"u"?null:document;function vy(s,i,u){var h=mo;if(h&&typeof i=="string"&&i){var g=pa(i);g='link[rel="'+s+'"][href="'+g+'"]',typeof u=="string"&&(g+='[crossorigin="'+u+'"]'),gy.has(g)||(gy.add(g),s={rel:s,crossOrigin:u,href:i},h.querySelector(g)===null&&(i=h.createElement("link"),dr(i,"link",s),Jn(i),h.head.appendChild(i)))}}function oC(s){Ts.D(s),vy("dns-prefetch",s,null)}function cC(s,i){Ts.C(s,i),vy("preconnect",s,i)}function uC(s,i,u){Ts.L(s,i,u);var h=mo;if(h&&s&&i){var g='link[rel="preload"][as="'+pa(i)+'"]';i==="image"&&u&&u.imageSrcSet?(g+='[imagesrcset="'+pa(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(g+='[imagesizes="'+pa(u.imageSizes)+'"]')):g+='[href="'+pa(s)+'"]';var v=g;switch(i){case"style":v=ho(s);break;case"script":v=fo(s)}Na.has(v)||(s=x({rel:"preload",href:i==="image"&&u&&u.imageSrcSet?void 0:s,as:i},u),Na.set(v,s),h.querySelector(g)!==null||i==="style"&&h.querySelector(Ic(v))||i==="script"&&h.querySelector(qc(v))||(i=h.createElement("link"),dr(i,"link",s),Jn(i),h.head.appendChild(i)))}}function dC(s,i){Ts.m(s,i);var u=mo;if(u&&s){var h=i&&typeof i.as=="string"?i.as:"script",g='link[rel="modulepreload"][as="'+pa(h)+'"][href="'+pa(s)+'"]',v=g;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=fo(s)}if(!Na.has(v)&&(s=x({rel:"modulepreload",href:s},i),Na.set(v,s),u.querySelector(g)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(qc(v)))return}h=u.createElement("link"),dr(h,"link",s),Jn(h),u.head.appendChild(h)}}}function mC(s,i,u){Ts.S(s,i,u);var h=mo;if(h&&s){var g=Oi(h).hoistableStyles,v=ho(s);i=i||"default";var T=g.get(v);if(!T){var B={loading:0,preload:null};if(T=h.querySelector(Ic(v)))B.loading=5;else{s=x({rel:"stylesheet",href:s,"data-precedence":i},u),(u=Na.get(v))&&sp(s,u);var X=T=h.createElement("link");Jn(X),dr(X,"link",s),X._p=new Promise(function(de,be){X.onload=de,X.onerror=be}),X.addEventListener("load",function(){B.loading|=1}),X.addEventListener("error",function(){B.loading|=2}),B.loading|=4,a0(T,i,h)}T={type:"stylesheet",instance:T,count:1,state:B},g.set(v,T)}}}function hC(s,i){Ts.X(s,i);var u=mo;if(u&&s){var h=Oi(u).hoistableScripts,g=fo(s),v=h.get(g);v||(v=u.querySelector(qc(g)),v||(s=x({src:s,async:!0},i),(i=Na.get(g))&&lp(s,i),v=u.createElement("script"),Jn(v),dr(v,"link",s),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(g,v))}}function fC(s,i){Ts.M(s,i);var u=mo;if(u&&s){var h=Oi(u).hoistableScripts,g=fo(s),v=h.get(g);v||(v=u.querySelector(qc(g)),v||(s=x({src:s,async:!0,type:"module"},i),(i=Na.get(g))&&lp(s,i),v=u.createElement("script"),Jn(v),dr(v,"link",s),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(g,v))}}function yy(s,i,u,h){var g=(g=Ce.current)?r0(g):null;if(!g)throw Error(a(446));switch(s){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(i=ho(u.href),u=Oi(g).hoistableStyles,h=u.get(i),h||(h={type:"style",instance:null,count:0,state:null},u.set(i,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){s=ho(u.href);var v=Oi(g).hoistableStyles,T=v.get(s);if(T||(g=g.ownerDocument||g,T={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(s,T),(v=g.querySelector(Ic(s)))&&!v._p&&(T.instance=v,T.state.loading=5),Na.has(s)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Na.set(s,u),v||pC(g,s,u,T.state))),i&&h===null)throw Error(a(528,""));return T}if(i&&h!==null)throw Error(a(529,""));return null;case"script":return i=u.async,u=u.src,typeof u=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=fo(u),u=Oi(g).hoistableScripts,h=u.get(i),h||(h={type:"script",instance:null,count:0,state:null},u.set(i,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,s))}}function ho(s){return'href="'+pa(s)+'"'}function Ic(s){return'link[rel="stylesheet"]['+s+"]"}function by(s){return x({},s,{"data-precedence":s.precedence,precedence:null})}function pC(s,i,u,h){s.querySelector('link[rel="preload"][as="style"]['+i+"]")?h.loading=1:(i=s.createElement("link"),h.preload=i,i.addEventListener("load",function(){return h.loading|=1}),i.addEventListener("error",function(){return h.loading|=2}),dr(i,"link",u),Jn(i),s.head.appendChild(i))}function fo(s){return'[src="'+pa(s)+'"]'}function qc(s){return"script[async]"+s}function wy(s,i,u){if(i.count++,i.instance===null)switch(i.type){case"style":var h=s.querySelector('style[data-href~="'+pa(u.href)+'"]');if(h)return i.instance=h,Jn(h),h;var g=x({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return h=(s.ownerDocument||s).createElement("style"),Jn(h),dr(h,"style",g),a0(h,u.precedence,s),i.instance=h;case"stylesheet":g=ho(u.href);var v=s.querySelector(Ic(g));if(v)return i.state.loading|=4,i.instance=v,Jn(v),v;h=by(u),(g=Na.get(g))&&sp(h,g),v=(s.ownerDocument||s).createElement("link"),Jn(v);var T=v;return T._p=new Promise(function(B,X){T.onload=B,T.onerror=X}),dr(v,"link",h),i.state.loading|=4,a0(v,u.precedence,s),i.instance=v;case"script":return v=fo(u.src),(g=s.querySelector(qc(v)))?(i.instance=g,Jn(g),g):(h=u,(g=Na.get(v))&&(h=x({},u),lp(h,g)),s=s.ownerDocument||s,g=s.createElement("script"),Jn(g),dr(g,"link",h),s.head.appendChild(g),i.instance=g);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(h=i.instance,i.state.loading|=4,a0(h,u.precedence,s));return i.instance}function a0(s,i,u){for(var h=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=h.length?h[h.length-1]:null,v=g,T=0;T title"):null)}function xC(s,i,u){if(u===1||i.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return s=i.disabled,typeof i.precedence=="string"&&s==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function Sy(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function gC(s,i,u,h){if(u.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var g=ho(h.href),v=i.querySelector(Ic(g));if(v){i=v._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(s.count++,s=l0.bind(s),i.then(s,s)),u.state.loading|=4,u.instance=v,Jn(v);return}v=i.ownerDocument||i,h=by(h),(g=Na.get(g))&&sp(h,g),v=v.createElement("link"),Jn(v);var T=v;T._p=new Promise(function(B,X){T.onload=B,T.onerror=X}),dr(v,"link",h),u.instance=v}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(u,i),(i=u.state.preload)&&(u.state.loading&3)===0&&(s.count++,u=l0.bind(s),i.addEventListener("load",u),i.addEventListener("error",u))}}var ip=0;function vC(s,i){return s.stylesheets&&s.count===0&&o0(s,s.stylesheets),0ip?50:800)+i);return s.unsuspend=u,function(){s.unsuspend=null,clearTimeout(h),clearTimeout(g)}}:null}function l0(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)o0(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var i0=null;function o0(s,i){s.stylesheets=null,s.unsuspend!==null&&(s.count++,i0=new Map,i.forEach(yC,s),i0=null,l0.call(s))}function yC(s,i){if(!(i.state.loading&4)){var u=i0.get(s);if(u)var h=u.get(null);else{u=new Map,i0.set(s,u);for(var g=s.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),pp.exports=ET(),pp.exports}var DT=AT();function r6(e,t){return function(){return e.apply(t,arguments)}}const{toString:zT}=Object.prototype,{getPrototypeOf:w1}=Object,{iterator:Sm,toStringTag:a6}=Symbol,km=(e=>t=>{const n=zT.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ua=e=>(e=e.toLowerCase(),t=>km(t)===e),Cm=e=>t=>typeof t===e,{isArray:$o}=Array,Lo=Cm("undefined");function Du(e){return e!==null&&!Lo(e)&&e.constructor!==null&&!Lo(e.constructor)&&$r(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const s6=Ua("ArrayBuffer");function OT(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&s6(e.buffer),t}const RT=Cm("string"),$r=Cm("function"),l6=Cm("number"),zu=e=>e!==null&&typeof e=="object",BT=e=>e===!0||e===!1,q0=e=>{if(km(e)!=="object")return!1;const t=w1(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(a6 in e)&&!(Sm in e)},LT=e=>{if(!zu(e)||Du(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},PT=Ua("Date"),FT=Ua("File"),IT=Ua("Blob"),qT=Ua("FileList"),HT=e=>zu(e)&&$r(e.pipe),UT=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||$r(e.append)&&((t=km(e))==="formdata"||t==="object"&&$r(e.toString)&&e.toString()==="[object FormData]"))},$T=Ua("URLSearchParams"),[VT,GT,YT,WT]=["ReadableStream","Request","Response","Headers"].map(Ua),XT=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ou(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let a,l;if(typeof e!="object"&&(e=[e]),$o(e))for(a=0,l=e.length;a0;)if(l=n[a],t===l.toLowerCase())return l;return null}const oi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,o6=e=>!Lo(e)&&e!==oi;function bx(){const{caseless:e,skipUndefined:t}=o6(this)&&this||{},n={},a=(l,o)=>{const c=e&&i6(n,o)||o;q0(n[c])&&q0(l)?n[c]=bx(n[c],l):q0(l)?n[c]=bx({},l):$o(l)?n[c]=l.slice():(!t||!Lo(l))&&(n[c]=l)};for(let l=0,o=arguments.length;l(Ou(t,(l,o)=>{n&&$r(l)?e[o]=r6(l,n):e[o]=l},{allOwnKeys:a}),e),QT=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),ZT=(e,t,n,a)=>{e.prototype=Object.create(t.prototype,a),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},JT=(e,t,n,a)=>{let l,o,c;const d={};if(t=t||{},e==null)return t;do{for(l=Object.getOwnPropertyNames(e),o=l.length;o-- >0;)c=l[o],(!a||a(c,e,t))&&!d[c]&&(t[c]=e[c],d[c]=!0);e=n!==!1&&w1(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},e_=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const a=e.indexOf(t,n);return a!==-1&&a===n},t_=e=>{if(!e)return null;if($o(e))return e;let t=e.length;if(!l6(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},n_=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&w1(Uint8Array)),r_=(e,t)=>{const a=(e&&e[Sm]).call(e);let l;for(;(l=a.next())&&!l.done;){const o=l.value;t.call(e,o[0],o[1])}},a_=(e,t)=>{let n;const a=[];for(;(n=e.exec(t))!==null;)a.push(n);return a},s_=Ua("HTMLFormElement"),l_=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,a,l){return a.toUpperCase()+l}),Wy=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),i_=Ua("RegExp"),c6=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),a={};Ou(n,(l,o)=>{let c;(c=t(l,o,e))!==!1&&(a[o]=c||l)}),Object.defineProperties(e,a)},o_=e=>{c6(e,(t,n)=>{if($r(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const a=e[n];if($r(a)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},c_=(e,t)=>{const n={},a=l=>{l.forEach(o=>{n[o]=!0})};return $o(e)?a(e):a(String(e).split(t)),n},u_=()=>{},d_=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function m_(e){return!!(e&&$r(e.append)&&e[a6]==="FormData"&&e[Sm])}const h_=e=>{const t=new Array(10),n=(a,l)=>{if(zu(a)){if(t.indexOf(a)>=0)return;if(Du(a))return a;if(!("toJSON"in a)){t[l]=a;const o=$o(a)?[]:{};return Ou(a,(c,d)=>{const m=n(c,l+1);!Lo(m)&&(o[d]=m)}),t[l]=void 0,o}}return a};return n(e,0)},f_=Ua("AsyncFunction"),p_=e=>e&&(zu(e)||$r(e))&&$r(e.then)&&$r(e.catch),u6=((e,t)=>e?setImmediate:t?((n,a)=>(oi.addEventListener("message",({source:l,data:o})=>{l===oi&&o===n&&a.length&&a.shift()()},!1),l=>{a.push(l),oi.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",$r(oi.postMessage)),x_=typeof queueMicrotask<"u"?queueMicrotask.bind(oi):typeof process<"u"&&process.nextTick||u6,g_=e=>e!=null&&$r(e[Sm]),pe={isArray:$o,isArrayBuffer:s6,isBuffer:Du,isFormData:UT,isArrayBufferView:OT,isString:RT,isNumber:l6,isBoolean:BT,isObject:zu,isPlainObject:q0,isEmptyObject:LT,isReadableStream:VT,isRequest:GT,isResponse:YT,isHeaders:WT,isUndefined:Lo,isDate:PT,isFile:FT,isBlob:IT,isRegExp:i_,isFunction:$r,isStream:HT,isURLSearchParams:$T,isTypedArray:n_,isFileList:qT,forEach:Ou,merge:bx,extend:KT,trim:XT,stripBOM:QT,inherits:ZT,toFlatObject:JT,kindOf:km,kindOfTest:Ua,endsWith:e_,toArray:t_,forEachEntry:r_,matchAll:a_,isHTMLForm:s_,hasOwnProperty:Wy,hasOwnProp:Wy,reduceDescriptors:c6,freezeMethods:o_,toObjectSet:c_,toCamelCase:l_,noop:u_,toFiniteNumber:d_,findKey:i6,global:oi,isContextDefined:o6,isSpecCompliantForm:m_,toJSONObject:h_,isAsyncFn:f_,isThenable:p_,setImmediate:u6,asap:x_,isIterable:g_};function ft(e,t,n,a,l){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),a&&(this.request=a),l&&(this.response=l,this.status=l.status?l.status:null)}pe.inherits(ft,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:pe.toJSONObject(this.config),code:this.code,status:this.status}}});const d6=ft.prototype,m6={};["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(e=>{m6[e]={value:e}});Object.defineProperties(ft,m6);Object.defineProperty(d6,"isAxiosError",{value:!0});ft.from=(e,t,n,a,l,o)=>{const c=Object.create(d6);pe.toFlatObject(e,c,function(p){return p!==Error.prototype},f=>f!=="isAxiosError");const d=e&&e.message?e.message:"Error",m=t==null&&e?e.code:t;return ft.call(c,d,m,n,a,l),e&&c.cause==null&&Object.defineProperty(c,"cause",{value:e,configurable:!0}),c.name=e&&e.name||"Error",o&&Object.assign(c,o),c};const v_=null;function wx(e){return pe.isPlainObject(e)||pe.isArray(e)}function h6(e){return pe.endsWith(e,"[]")?e.slice(0,-2):e}function Xy(e,t,n){return e?e.concat(t).map(function(l,o){return l=h6(l),!n&&o?"["+l+"]":l}).join(n?".":""):t}function y_(e){return pe.isArray(e)&&!e.some(wx)}const b_=pe.toFlatObject(pe,{},null,function(t){return/^is[A-Z]/.test(t)});function Tm(e,t,n){if(!pe.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=pe.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(k,S){return!pe.isUndefined(S[k])});const a=n.metaTokens,l=n.visitor||p,o=n.dots,c=n.indexes,m=(n.Blob||typeof Blob<"u"&&Blob)&&pe.isSpecCompliantForm(t);if(!pe.isFunction(l))throw new TypeError("visitor must be a function");function f(j){if(j===null)return"";if(pe.isDate(j))return j.toISOString();if(pe.isBoolean(j))return j.toString();if(!m&&pe.isBlob(j))throw new ft("Blob is not supported. Use a Buffer instead.");return pe.isArrayBuffer(j)||pe.isTypedArray(j)?m&&typeof Blob=="function"?new Blob([j]):Buffer.from(j):j}function p(j,k,S){let _=j;if(j&&!S&&typeof j=="object"){if(pe.endsWith(k,"{}"))k=a?k:k.slice(0,-2),j=JSON.stringify(j);else if(pe.isArray(j)&&y_(j)||(pe.isFileList(j)||pe.endsWith(k,"[]"))&&(_=pe.toArray(j)))return k=h6(k),_.forEach(function(D,z){!(pe.isUndefined(D)||D===null)&&t.append(c===!0?Xy([k],z,o):c===null?k:k+"[]",f(D))}),!1}return wx(j)?!0:(t.append(Xy(S,k,o),f(j)),!1)}const x=[],y=Object.assign(b_,{defaultVisitor:p,convertValue:f,isVisitable:wx});function b(j,k){if(!pe.isUndefined(j)){if(x.indexOf(j)!==-1)throw Error("Circular reference detected in "+k.join("."));x.push(j),pe.forEach(j,function(_,M){(!(pe.isUndefined(_)||_===null)&&l.call(t,_,pe.isString(M)?M.trim():M,k,y))===!0&&b(_,k?k.concat(M):[M])}),x.pop()}}if(!pe.isObject(e))throw new TypeError("data must be an object");return b(e),t}function Ky(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(a){return t[a]})}function j1(e,t){this._pairs=[],e&&Tm(e,this,t)}const f6=j1.prototype;f6.append=function(t,n){this._pairs.push([t,n])};f6.toString=function(t){const n=t?function(a){return t.call(this,a,Ky)}:Ky;return this._pairs.map(function(l){return n(l[0])+"="+n(l[1])},"").join("&")};function w_(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function p6(e,t,n){if(!t)return e;const a=n&&n.encode||w_;pe.isFunction(n)&&(n={serialize:n});const l=n&&n.serialize;let o;if(l?o=l(t,n):o=pe.isURLSearchParams(t)?t.toString():new j1(t,n).toString(a),o){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Qy{constructor(){this.handlers=[]}use(t,n,a){return this.handlers.push({fulfilled:t,rejected:n,synchronous:a?a.synchronous:!1,runWhen:a?a.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){pe.forEach(this.handlers,function(a){a!==null&&t(a)})}}const x6={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},j_=typeof URLSearchParams<"u"?URLSearchParams:j1,N_=typeof FormData<"u"?FormData:null,S_=typeof Blob<"u"?Blob:null,k_={isBrowser:!0,classes:{URLSearchParams:j_,FormData:N_,Blob:S_},protocols:["http","https","file","blob","url","data"]},N1=typeof window<"u"&&typeof document<"u",jx=typeof navigator=="object"&&navigator||void 0,C_=N1&&(!jx||["ReactNative","NativeScript","NS"].indexOf(jx.product)<0),T_=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",__=N1&&window.location.href||"http://localhost",M_=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:N1,hasStandardBrowserEnv:C_,hasStandardBrowserWebWorkerEnv:T_,navigator:jx,origin:__},Symbol.toStringTag,{value:"Module"})),vr={...M_,...k_};function E_(e,t){return Tm(e,new vr.classes.URLSearchParams,{visitor:function(n,a,l,o){return vr.isNode&&pe.isBuffer(n)?(this.append(a,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function A_(e){return pe.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function D_(e){const t={},n=Object.keys(e);let a;const l=n.length;let o;for(a=0;a=n.length;return c=!c&&pe.isArray(l)?l.length:c,m?(pe.hasOwnProp(l,c)?l[c]=[l[c],a]:l[c]=a,!d):((!l[c]||!pe.isObject(l[c]))&&(l[c]=[]),t(n,a,l[c],o)&&pe.isArray(l[c])&&(l[c]=D_(l[c])),!d)}if(pe.isFormData(e)&&pe.isFunction(e.entries)){const n={};return pe.forEachEntry(e,(a,l)=>{t(A_(a),l,n,0)}),n}return null}function z_(e,t,n){if(pe.isString(e))try{return(t||JSON.parse)(e),pe.trim(e)}catch(a){if(a.name!=="SyntaxError")throw a}return(n||JSON.stringify)(e)}const Ru={transitional:x6,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const a=n.getContentType()||"",l=a.indexOf("application/json")>-1,o=pe.isObject(t);if(o&&pe.isHTMLForm(t)&&(t=new FormData(t)),pe.isFormData(t))return l?JSON.stringify(g6(t)):t;if(pe.isArrayBuffer(t)||pe.isBuffer(t)||pe.isStream(t)||pe.isFile(t)||pe.isBlob(t)||pe.isReadableStream(t))return t;if(pe.isArrayBufferView(t))return t.buffer;if(pe.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let d;if(o){if(a.indexOf("application/x-www-form-urlencoded")>-1)return E_(t,this.formSerializer).toString();if((d=pe.isFileList(t))||a.indexOf("multipart/form-data")>-1){const m=this.env&&this.env.FormData;return Tm(d?{"files[]":t}:t,m&&new m,this.formSerializer)}}return o||l?(n.setContentType("application/json",!1),z_(t)):t}],transformResponse:[function(t){const n=this.transitional||Ru.transitional,a=n&&n.forcedJSONParsing,l=this.responseType==="json";if(pe.isResponse(t)||pe.isReadableStream(t))return t;if(t&&pe.isString(t)&&(a&&!this.responseType||l)){const c=!(n&&n.silentJSONParsing)&&l;try{return JSON.parse(t,this.parseReviver)}catch(d){if(c)throw d.name==="SyntaxError"?ft.from(d,ft.ERR_BAD_RESPONSE,this,null,this.response):d}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:vr.classes.FormData,Blob:vr.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};pe.forEach(["delete","get","head","post","put","patch"],e=>{Ru.headers[e]={}});const O_=pe.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"]),R_=e=>{const t={};let n,a,l;return e&&e.split(` -`).forEach(function(c){l=c.indexOf(":"),n=c.substring(0,l).trim().toLowerCase(),a=c.substring(l+1).trim(),!(!n||t[n]&&O_[n])&&(n==="set-cookie"?t[n]?t[n].push(a):t[n]=[a]:t[n]=t[n]?t[n]+", "+a:a)}),t},Zy=Symbol("internals");function Wc(e){return e&&String(e).trim().toLowerCase()}function H0(e){return e===!1||e==null?e:pe.isArray(e)?e.map(H0):String(e)}function B_(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let a;for(;a=n.exec(e);)t[a[1]]=a[2];return t}const L_=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function vp(e,t,n,a,l){if(pe.isFunction(a))return a.call(this,t,n);if(l&&(t=n),!!pe.isString(t)){if(pe.isString(a))return t.indexOf(a)!==-1;if(pe.isRegExp(a))return a.test(t)}}function P_(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,a)=>n.toUpperCase()+a)}function F_(e,t){const n=pe.toCamelCase(" "+t);["get","set","has"].forEach(a=>{Object.defineProperty(e,a+n,{value:function(l,o,c){return this[a].call(this,t,l,o,c)},configurable:!0})})}let Vr=class{constructor(t){t&&this.set(t)}set(t,n,a){const l=this;function o(d,m,f){const p=Wc(m);if(!p)throw new Error("header name must be a non-empty string");const x=pe.findKey(l,p);(!x||l[x]===void 0||f===!0||f===void 0&&l[x]!==!1)&&(l[x||m]=H0(d))}const c=(d,m)=>pe.forEach(d,(f,p)=>o(f,p,m));if(pe.isPlainObject(t)||t instanceof this.constructor)c(t,n);else if(pe.isString(t)&&(t=t.trim())&&!L_(t))c(R_(t),n);else if(pe.isObject(t)&&pe.isIterable(t)){let d={},m,f;for(const p of t){if(!pe.isArray(p))throw TypeError("Object iterator must return a key-value pair");d[f=p[0]]=(m=d[f])?pe.isArray(m)?[...m,p[1]]:[m,p[1]]:p[1]}c(d,n)}else t!=null&&o(n,t,a);return this}get(t,n){if(t=Wc(t),t){const a=pe.findKey(this,t);if(a){const l=this[a];if(!n)return l;if(n===!0)return B_(l);if(pe.isFunction(n))return n.call(this,l,a);if(pe.isRegExp(n))return n.exec(l);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Wc(t),t){const a=pe.findKey(this,t);return!!(a&&this[a]!==void 0&&(!n||vp(this,this[a],a,n)))}return!1}delete(t,n){const a=this;let l=!1;function o(c){if(c=Wc(c),c){const d=pe.findKey(a,c);d&&(!n||vp(a,a[d],d,n))&&(delete a[d],l=!0)}}return pe.isArray(t)?t.forEach(o):o(t),l}clear(t){const n=Object.keys(this);let a=n.length,l=!1;for(;a--;){const o=n[a];(!t||vp(this,this[o],o,t,!0))&&(delete this[o],l=!0)}return l}normalize(t){const n=this,a={};return pe.forEach(this,(l,o)=>{const c=pe.findKey(a,o);if(c){n[c]=H0(l),delete n[o];return}const d=t?P_(o):String(o).trim();d!==o&&delete n[o],n[d]=H0(l),a[d]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return pe.forEach(this,(a,l)=>{a!=null&&a!==!1&&(n[l]=t&&pe.isArray(a)?a.join(", "):a)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` -`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const a=new this(t);return n.forEach(l=>a.set(l)),a}static accessor(t){const a=(this[Zy]=this[Zy]={accessors:{}}).accessors,l=this.prototype;function o(c){const d=Wc(c);a[d]||(F_(l,c),a[d]=!0)}return pe.isArray(t)?t.forEach(o):o(t),this}};Vr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);pe.reduceDescriptors(Vr.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(a){this[n]=a}}});pe.freezeMethods(Vr);function yp(e,t){const n=this||Ru,a=t||n,l=Vr.from(a.headers);let o=a.data;return pe.forEach(e,function(d){o=d.call(n,o,l.normalize(),t?t.status:void 0)}),l.normalize(),o}function v6(e){return!!(e&&e.__CANCEL__)}function Vo(e,t,n){ft.call(this,e??"canceled",ft.ERR_CANCELED,t,n),this.name="CanceledError"}pe.inherits(Vo,ft,{__CANCEL__:!0});function y6(e,t,n){const a=n.config.validateStatus;!n.status||!a||a(n.status)?e(n):t(new ft("Request failed with status code "+n.status,[ft.ERR_BAD_REQUEST,ft.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function I_(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function q_(e,t){e=e||10;const n=new Array(e),a=new Array(e);let l=0,o=0,c;return t=t!==void 0?t:1e3,function(m){const f=Date.now(),p=a[o];c||(c=f),n[l]=m,a[l]=f;let x=o,y=0;for(;x!==l;)y+=n[x++],x=x%e;if(l=(l+1)%e,l===o&&(o=(o+1)%e),f-c{n=p,l=null,o&&(clearTimeout(o),o=null),e(...f)};return[(...f)=>{const p=Date.now(),x=p-n;x>=a?c(f,p):(l=f,o||(o=setTimeout(()=>{o=null,c(l)},a-x)))},()=>l&&c(l)]}const tm=(e,t,n=3)=>{let a=0;const l=q_(50,250);return H_(o=>{const c=o.loaded,d=o.lengthComputable?o.total:void 0,m=c-a,f=l(m),p=c<=d;a=c;const x={loaded:c,total:d,progress:d?c/d:void 0,bytes:m,rate:f||void 0,estimated:f&&d&&p?(d-c)/f:void 0,event:o,lengthComputable:d!=null,[t?"download":"upload"]:!0};e(x)},n)},Jy=(e,t)=>{const n=e!=null;return[a=>t[0]({lengthComputable:n,total:e,loaded:a}),t[1]]},eb=e=>(...t)=>pe.asap(()=>e(...t)),U_=vr.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,vr.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(vr.origin),vr.navigator&&/(msie|trident)/i.test(vr.navigator.userAgent)):()=>!0,$_=vr.hasStandardBrowserEnv?{write(e,t,n,a,l,o,c){if(typeof document>"u")return;const d=[`${e}=${encodeURIComponent(t)}`];pe.isNumber(n)&&d.push(`expires=${new Date(n).toUTCString()}`),pe.isString(a)&&d.push(`path=${a}`),pe.isString(l)&&d.push(`domain=${l}`),o===!0&&d.push("secure"),pe.isString(c)&&d.push(`SameSite=${c}`),document.cookie=d.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function V_(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function G_(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function b6(e,t,n){let a=!V_(t);return e&&(a||n==!1)?G_(e,t):t}const tb=e=>e instanceof Vr?{...e}:e;function pi(e,t){t=t||{};const n={};function a(f,p,x,y){return pe.isPlainObject(f)&&pe.isPlainObject(p)?pe.merge.call({caseless:y},f,p):pe.isPlainObject(p)?pe.merge({},p):pe.isArray(p)?p.slice():p}function l(f,p,x,y){if(pe.isUndefined(p)){if(!pe.isUndefined(f))return a(void 0,f,x,y)}else return a(f,p,x,y)}function o(f,p){if(!pe.isUndefined(p))return a(void 0,p)}function c(f,p){if(pe.isUndefined(p)){if(!pe.isUndefined(f))return a(void 0,f)}else return a(void 0,p)}function d(f,p,x){if(x in t)return a(f,p);if(x in e)return a(void 0,f)}const m={url:o,method:o,data:o,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:d,headers:(f,p,x)=>l(tb(f),tb(p),x,!0)};return pe.forEach(Object.keys({...e,...t}),function(p){const x=m[p]||l,y=x(e[p],t[p],p);pe.isUndefined(y)&&x!==d||(n[p]=y)}),n}const w6=e=>{const t=pi({},e);let{data:n,withXSRFToken:a,xsrfHeaderName:l,xsrfCookieName:o,headers:c,auth:d}=t;if(t.headers=c=Vr.from(c),t.url=p6(b6(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),d&&c.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):""))),pe.isFormData(n)){if(vr.hasStandardBrowserEnv||vr.hasStandardBrowserWebWorkerEnv)c.setContentType(void 0);else if(pe.isFunction(n.getHeaders)){const m=n.getHeaders(),f=["content-type","content-length"];Object.entries(m).forEach(([p,x])=>{f.includes(p.toLowerCase())&&c.set(p,x)})}}if(vr.hasStandardBrowserEnv&&(a&&pe.isFunction(a)&&(a=a(t)),a||a!==!1&&U_(t.url))){const m=l&&o&&$_.read(o);m&&c.set(l,m)}return t},Y_=typeof XMLHttpRequest<"u",W_=Y_&&function(e){return new Promise(function(n,a){const l=w6(e);let o=l.data;const c=Vr.from(l.headers).normalize();let{responseType:d,onUploadProgress:m,onDownloadProgress:f}=l,p,x,y,b,j;function k(){b&&b(),j&&j(),l.cancelToken&&l.cancelToken.unsubscribe(p),l.signal&&l.signal.removeEventListener("abort",p)}let S=new XMLHttpRequest;S.open(l.method.toUpperCase(),l.url,!0),S.timeout=l.timeout;function _(){if(!S)return;const D=Vr.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),L={data:!d||d==="text"||d==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:D,config:e,request:S};y6(function(R){n(R),k()},function(R){a(R),k()},L),S=null}"onloadend"in S?S.onloadend=_:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(_)},S.onabort=function(){S&&(a(new ft("Request aborted",ft.ECONNABORTED,e,S)),S=null)},S.onerror=function(z){const L=z&&z.message?z.message:"Network Error",E=new ft(L,ft.ERR_NETWORK,e,S);E.event=z||null,a(E),S=null},S.ontimeout=function(){let z=l.timeout?"timeout of "+l.timeout+"ms exceeded":"timeout exceeded";const L=l.transitional||x6;l.timeoutErrorMessage&&(z=l.timeoutErrorMessage),a(new ft(z,L.clarifyTimeoutError?ft.ETIMEDOUT:ft.ECONNABORTED,e,S)),S=null},o===void 0&&c.setContentType(null),"setRequestHeader"in S&&pe.forEach(c.toJSON(),function(z,L){S.setRequestHeader(L,z)}),pe.isUndefined(l.withCredentials)||(S.withCredentials=!!l.withCredentials),d&&d!=="json"&&(S.responseType=l.responseType),f&&([y,j]=tm(f,!0),S.addEventListener("progress",y)),m&&S.upload&&([x,b]=tm(m),S.upload.addEventListener("progress",x),S.upload.addEventListener("loadend",b)),(l.cancelToken||l.signal)&&(p=D=>{S&&(a(!D||D.type?new Vo(null,e,S):D),S.abort(),S=null)},l.cancelToken&&l.cancelToken.subscribe(p),l.signal&&(l.signal.aborted?p():l.signal.addEventListener("abort",p)));const M=I_(l.url);if(M&&vr.protocols.indexOf(M)===-1){a(new ft("Unsupported protocol "+M+":",ft.ERR_BAD_REQUEST,e));return}S.send(o||null)})},X_=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let a=new AbortController,l;const o=function(f){if(!l){l=!0,d();const p=f instanceof Error?f:this.reason;a.abort(p instanceof ft?p:new Vo(p instanceof Error?p.message:p))}};let c=t&&setTimeout(()=>{c=null,o(new ft(`timeout ${t} of ms exceeded`,ft.ETIMEDOUT))},t);const d=()=>{e&&(c&&clearTimeout(c),c=null,e.forEach(f=>{f.unsubscribe?f.unsubscribe(o):f.removeEventListener("abort",o)}),e=null)};e.forEach(f=>f.addEventListener("abort",o));const{signal:m}=a;return m.unsubscribe=()=>pe.asap(d),m}},K_=function*(e,t){let n=e.byteLength;if(n{const l=Q_(e,t);let o=0,c,d=m=>{c||(c=!0,a&&a(m))};return new ReadableStream({async pull(m){try{const{done:f,value:p}=await l.next();if(f){d(),m.close();return}let x=p.byteLength;if(n){let y=o+=x;n(y)}m.enqueue(new Uint8Array(p))}catch(f){throw d(f),f}},cancel(m){return d(m),l.return()}},{highWaterMark:2})},rb=64*1024,{isFunction:y0}=pe,J_=(({Request:e,Response:t})=>({Request:e,Response:t}))(pe.global),{ReadableStream:ab,TextEncoder:sb}=pe.global,lb=(e,...t)=>{try{return!!e(...t)}catch{return!1}},eM=e=>{e=pe.merge.call({skipUndefined:!0},J_,e);const{fetch:t,Request:n,Response:a}=e,l=t?y0(t):typeof fetch=="function",o=y0(n),c=y0(a);if(!l)return!1;const d=l&&y0(ab),m=l&&(typeof sb=="function"?(j=>k=>j.encode(k))(new sb):async j=>new Uint8Array(await new n(j).arrayBuffer())),f=o&&d&&lb(()=>{let j=!1;const k=new n(vr.origin,{body:new ab,method:"POST",get duplex(){return j=!0,"half"}}).headers.has("Content-Type");return j&&!k}),p=c&&d&&lb(()=>pe.isReadableStream(new a("").body)),x={stream:p&&(j=>j.body)};l&&["text","arrayBuffer","blob","formData","stream"].forEach(j=>{!x[j]&&(x[j]=(k,S)=>{let _=k&&k[j];if(_)return _.call(k);throw new ft(`Response type '${j}' is not supported`,ft.ERR_NOT_SUPPORT,S)})});const y=async j=>{if(j==null)return 0;if(pe.isBlob(j))return j.size;if(pe.isSpecCompliantForm(j))return(await new n(vr.origin,{method:"POST",body:j}).arrayBuffer()).byteLength;if(pe.isArrayBufferView(j)||pe.isArrayBuffer(j))return j.byteLength;if(pe.isURLSearchParams(j)&&(j=j+""),pe.isString(j))return(await m(j)).byteLength},b=async(j,k)=>{const S=pe.toFiniteNumber(j.getContentLength());return S??y(k)};return async j=>{let{url:k,method:S,data:_,signal:M,cancelToken:D,timeout:z,onDownloadProgress:L,onUploadProgress:E,responseType:R,headers:H,withCredentials:$="same-origin",fetchOptions:I}=w6(j),G=t||fetch;R=R?(R+"").toLowerCase():"text";let te=X_([M,D&&D.toAbortSignal()],z),we=null;const J=te&&te.unsubscribe&&(()=>{te.unsubscribe()});let ae;try{if(E&&f&&S!=="get"&&S!=="head"&&(ae=await b(H,_))!==0){let je=new n(k,{method:"POST",body:_,duplex:"half"}),Z;if(pe.isFormData(_)&&(Z=je.headers.get("content-type"))&&H.setContentType(Z),je.body){const[O,Ne]=Jy(ae,tm(eb(E)));_=nb(je.body,rb,O,Ne)}}pe.isString($)||($=$?"include":"omit");const U=o&&"credentials"in n.prototype,q={...I,signal:te,method:S.toUpperCase(),headers:H.normalize().toJSON(),body:_,duplex:"half",credentials:U?$:void 0};we=o&&new n(k,q);let W=await(o?G(we,I):G(k,q));const oe=p&&(R==="stream"||R==="response");if(p&&(L||oe&&J)){const je={};["status","statusText","headers"].forEach(se=>{je[se]=W[se]});const Z=pe.toFiniteNumber(W.headers.get("content-length")),[O,Ne]=L&&Jy(Z,tm(eb(L),!0))||[];W=new a(nb(W.body,rb,O,()=>{Ne&&Ne(),J&&J()}),je)}R=R||"text";let P=await x[pe.findKey(x,R)||"text"](W,j);return!oe&&J&&J(),await new Promise((je,Z)=>{y6(je,Z,{data:P,headers:Vr.from(W.headers),status:W.status,statusText:W.statusText,config:j,request:we})})}catch(U){throw J&&J(),U&&U.name==="TypeError"&&/Load failed|fetch/i.test(U.message)?Object.assign(new ft("Network Error",ft.ERR_NETWORK,j,we),{cause:U.cause||U}):ft.from(U,U&&U.code,j,we)}}},tM=new Map,j6=e=>{let t=e&&e.env||{};const{fetch:n,Request:a,Response:l}=t,o=[a,l,n];let c=o.length,d=c,m,f,p=tM;for(;d--;)m=o[d],f=p.get(m),f===void 0&&p.set(m,f=d?new Map:eM(t)),p=f;return f};j6();const S1={http:v_,xhr:W_,fetch:{get:j6}};pe.forEach(S1,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const ib=e=>`- ${e}`,nM=e=>pe.isFunction(e)||e===null||e===!1;function rM(e,t){e=pe.isArray(e)?e:[e];const{length:n}=e;let a,l;const o={};for(let c=0;c`adapter ${m} `+(f===!1?"is not supported by the environment":"is not available in the build"));let d=n?c.length>1?`since : -`+c.map(ib).join(` -`):" "+ib(c[0]):"as no adapter specified";throw new ft("There is no suitable adapter to dispatch the request "+d,"ERR_NOT_SUPPORT")}return l}const N6={getAdapter:rM,adapters:S1};function bp(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Vo(null,e)}function ob(e){return bp(e),e.headers=Vr.from(e.headers),e.data=yp.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),N6.getAdapter(e.adapter||Ru.adapter,e)(e).then(function(a){return bp(e),a.data=yp.call(e,e.transformResponse,a),a.headers=Vr.from(a.headers),a},function(a){return v6(a)||(bp(e),a&&a.response&&(a.response.data=yp.call(e,e.transformResponse,a.response),a.response.headers=Vr.from(a.response.headers))),Promise.reject(a)})}const S6="1.13.2",_m={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{_m[e]=function(a){return typeof a===e||"a"+(t<1?"n ":" ")+e}});const cb={};_m.transitional=function(t,n,a){function l(o,c){return"[Axios v"+S6+"] Transitional option '"+o+"'"+c+(a?". "+a:"")}return(o,c,d)=>{if(t===!1)throw new ft(l(c," has been removed"+(n?" in "+n:"")),ft.ERR_DEPRECATED);return n&&!cb[c]&&(cb[c]=!0,console.warn(l(c," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,c,d):!0}};_m.spelling=function(t){return(n,a)=>(console.warn(`${a} is likely a misspelling of ${t}`),!0)};function aM(e,t,n){if(typeof e!="object")throw new ft("options must be an object",ft.ERR_BAD_OPTION_VALUE);const a=Object.keys(e);let l=a.length;for(;l-- >0;){const o=a[l],c=t[o];if(c){const d=e[o],m=d===void 0||c(d,o,e);if(m!==!0)throw new ft("option "+o+" must be "+m,ft.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ft("Unknown option "+o,ft.ERR_BAD_OPTION)}}const U0={assertOptions:aM,validators:_m},Wa=U0.validators;let mi=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Qy,response:new Qy}}async request(t,n){try{return await this._request(t,n)}catch(a){if(a instanceof Error){let l={};Error.captureStackTrace?Error.captureStackTrace(l):l=new Error;const o=l.stack?l.stack.replace(/^.+\n/,""):"";try{a.stack?o&&!String(a.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(a.stack+=` -`+o):a.stack=o}catch{}}throw a}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=pi(this.defaults,n);const{transitional:a,paramsSerializer:l,headers:o}=n;a!==void 0&&U0.assertOptions(a,{silentJSONParsing:Wa.transitional(Wa.boolean),forcedJSONParsing:Wa.transitional(Wa.boolean),clarifyTimeoutError:Wa.transitional(Wa.boolean)},!1),l!=null&&(pe.isFunction(l)?n.paramsSerializer={serialize:l}:U0.assertOptions(l,{encode:Wa.function,serialize:Wa.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),U0.assertOptions(n,{baseUrl:Wa.spelling("baseURL"),withXsrfToken:Wa.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let c=o&&pe.merge(o.common,o[n.method]);o&&pe.forEach(["delete","get","head","post","put","patch","common"],j=>{delete o[j]}),n.headers=Vr.concat(c,o);const d=[];let m=!0;this.interceptors.request.forEach(function(k){typeof k.runWhen=="function"&&k.runWhen(n)===!1||(m=m&&k.synchronous,d.unshift(k.fulfilled,k.rejected))});const f=[];this.interceptors.response.forEach(function(k){f.push(k.fulfilled,k.rejected)});let p,x=0,y;if(!m){const j=[ob.bind(this),void 0];for(j.unshift(...d),j.push(...f),y=j.length,p=Promise.resolve(n);x{if(!a._listeners)return;let o=a._listeners.length;for(;o-- >0;)a._listeners[o](l);a._listeners=null}),this.promise.then=l=>{let o;const c=new Promise(d=>{a.subscribe(d),o=d}).then(l);return c.cancel=function(){a.unsubscribe(o)},c},t(function(o,c,d){a.reason||(a.reason=new Vo(o,c,d),n(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=a=>{t.abort(a)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new k6(function(l){t=l}),cancel:t}}};function lM(e){return function(n){return e.apply(null,n)}}function iM(e){return pe.isObject(e)&&e.isAxiosError===!0}const Nx={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Nx).forEach(([e,t])=>{Nx[t]=e});function C6(e){const t=new mi(e),n=r6(mi.prototype.request,t);return pe.extend(n,mi.prototype,t,{allOwnKeys:!0}),pe.extend(n,t,null,{allOwnKeys:!0}),n.create=function(l){return C6(pi(e,l))},n}const Mn=C6(Ru);Mn.Axios=mi;Mn.CanceledError=Vo;Mn.CancelToken=sM;Mn.isCancel=v6;Mn.VERSION=S6;Mn.toFormData=Tm;Mn.AxiosError=ft;Mn.Cancel=Mn.CanceledError;Mn.all=function(t){return Promise.all(t)};Mn.spread=lM;Mn.isAxiosError=iM;Mn.mergeConfig=pi;Mn.AxiosHeaders=Vr;Mn.formToJSON=e=>g6(pe.isHTMLForm(e)?new FormData(e):e);Mn.getAdapter=N6.getAdapter;Mn.HttpStatusCode=Nx;Mn.default=Mn;const{Axios:aK,AxiosError:sK,CanceledError:lK,isCancel:iK,CancelToken:oK,VERSION:cK,all:uK,Cancel:dK,isAxiosError:mK,spread:hK,toFormData:fK,AxiosHeaders:pK,HttpStatusCode:xK,formToJSON:gK,getAdapter:vK,mergeConfig:yK}=Mn,oM=(e,t)=>{const n=new Array(e.length+t.length);for(let a=0;a({classGroupId:e,validator:t}),T6=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),nm="-",ub=[],uM="arbitrary..",dM=e=>{const t=hM(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return mM(c);const d=c.split(nm),m=d[0]===""&&d.length>1?1:0;return _6(d,m,t)},getConflictingClassGroupIds:(c,d)=>{if(d){const m=a[c],f=n[c];return m?f?oM(f,m):m:f||ub}return n[c]||ub}}},_6=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const l=e[t],o=n.nextPart.get(l);if(o){const f=_6(e,t+1,o);if(f)return f}const c=n.validators;if(c===null)return;const d=t===0?e.join(nm):e.slice(t).join(nm),m=c.length;for(let f=0;fe.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),a=t.slice(0,n);return a?uM+a:void 0})(),hM=e=>{const{theme:t,classGroups:n}=e;return fM(n,t)},fM=(e,t)=>{const n=T6();for(const a in e){const l=e[a];k1(l,n,a,t)}return n},k1=(e,t,n,a)=>{const l=e.length;for(let o=0;o{if(typeof e=="string"){xM(e,t,n);return}if(typeof e=="function"){gM(e,t,n,a);return}vM(e,t,n,a)},xM=(e,t,n)=>{const a=e===""?t:M6(t,e);a.classGroupId=n},gM=(e,t,n,a)=>{if(yM(e)){k1(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(cM(n,e))},vM=(e,t,n,a)=>{const l=Object.entries(e),o=l.length;for(let c=0;c{let n=e;const a=t.split(nm),l=a.length;for(let o=0;o"isThemeGetter"in e&&e.isThemeGetter===!0,bM=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),a=Object.create(null);const l=(o,c)=>{n[o]=c,t++,t>e&&(t=0,a=n,n=Object.create(null))};return{get(o){let c=n[o];if(c!==void 0)return c;if((c=a[o])!==void 0)return l(o,c),c},set(o,c){o in n?n[o]=c:l(o,c)}}},Sx="!",db=":",wM=[],mb=(e,t,n,a,l)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:l}),jM=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=l=>{const o=[];let c=0,d=0,m=0,f;const p=l.length;for(let k=0;km?f-m:void 0;return mb(o,b,y,j)};if(t){const l=t+db,o=a;a=c=>c.startsWith(l)?o(c.slice(l.length)):mb(wM,!1,c,void 0,!0)}if(n){const l=a;a=o=>n({className:o,parseClassName:l})}return a},NM=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,a)=>{t.set(n,1e6+a)}),n=>{const a=[];let l=[];for(let o=0;o0&&(l.sort(),a.push(...l),l=[]),a.push(c)):l.push(c)}return l.length>0&&(l.sort(),a.push(...l)),a}},SM=e=>({cache:bM(e.cacheSize),parseClassName:jM(e),sortModifiers:NM(e),...dM(e)}),kM=/\s+/,CM=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:l,sortModifiers:o}=t,c=[],d=e.trim().split(kM);let m="";for(let f=d.length-1;f>=0;f-=1){const p=d[f],{isExternal:x,modifiers:y,hasImportantModifier:b,baseClassName:j,maybePostfixModifierPosition:k}=n(p);if(x){m=p+(m.length>0?" "+m:m);continue}let S=!!k,_=a(S?j.substring(0,k):j);if(!_){if(!S){m=p+(m.length>0?" "+m:m);continue}if(_=a(j),!_){m=p+(m.length>0?" "+m:m);continue}S=!1}const M=y.length===0?"":y.length===1?y[0]:o(y).join(":"),D=b?M+Sx:M,z=D+_;if(c.indexOf(z)>-1)continue;c.push(z);const L=l(_,S);for(let E=0;E0?" "+m:m)}return m},TM=(...e)=>{let t=0,n,a,l="";for(;t{if(typeof e=="string")return e;let t,n="";for(let a=0;a{let n,a,l,o;const c=m=>{const f=t.reduce((p,x)=>x(p),e());return n=SM(f),a=n.cache.get,l=n.cache.set,o=d,d(m)},d=m=>{const f=a(m);if(f)return f;const p=CM(m,n);return l(m,p),p};return o=c,(...m)=>o(TM(...m))},MM=[],Wn=e=>{const t=n=>n[e]||MM;return t.isThemeGetter=!0,t},A6=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,D6=/^\((?:(\w[\w-]*):)?(.+)\)$/i,EM=/^\d+\/\d+$/,AM=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,DM=/\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$/,zM=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,OM=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,RM=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,xo=e=>EM.test(e),wt=e=>!!e&&!Number.isNaN(Number(e)),xl=e=>!!e&&Number.isInteger(Number(e)),wp=e=>e.endsWith("%")&&wt(e.slice(0,-1)),_s=e=>AM.test(e),BM=()=>!0,LM=e=>DM.test(e)&&!zM.test(e),z6=()=>!1,PM=e=>OM.test(e),FM=e=>RM.test(e),IM=e=>!$e(e)&&!Ve(e),qM=e=>Go(e,B6,z6),$e=e=>A6.test(e),ri=e=>Go(e,L6,LM),jp=e=>Go(e,GM,wt),hb=e=>Go(e,O6,z6),HM=e=>Go(e,R6,FM),b0=e=>Go(e,P6,PM),Ve=e=>D6.test(e),Xc=e=>Yo(e,L6),UM=e=>Yo(e,YM),fb=e=>Yo(e,O6),$M=e=>Yo(e,B6),VM=e=>Yo(e,R6),w0=e=>Yo(e,P6,!0),Go=(e,t,n)=>{const a=A6.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},Yo=(e,t,n=!1)=>{const a=D6.exec(e);return a?a[1]?t(a[1]):n:!1},O6=e=>e==="position"||e==="percentage",R6=e=>e==="image"||e==="url",B6=e=>e==="length"||e==="size"||e==="bg-size",L6=e=>e==="length",GM=e=>e==="number",YM=e=>e==="family-name",P6=e=>e==="shadow",WM=()=>{const e=Wn("color"),t=Wn("font"),n=Wn("text"),a=Wn("font-weight"),l=Wn("tracking"),o=Wn("leading"),c=Wn("breakpoint"),d=Wn("container"),m=Wn("spacing"),f=Wn("radius"),p=Wn("shadow"),x=Wn("inset-shadow"),y=Wn("text-shadow"),b=Wn("drop-shadow"),j=Wn("blur"),k=Wn("perspective"),S=Wn("aspect"),_=Wn("ease"),M=Wn("animate"),D=()=>["auto","avoid","all","avoid-page","page","left","right","column"],z=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...z(),Ve,$e],E=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],H=()=>[Ve,$e,m],$=()=>[xo,"full","auto",...H()],I=()=>[xl,"none","subgrid",Ve,$e],G=()=>["auto",{span:["full",xl,Ve,$e]},xl,Ve,$e],te=()=>[xl,"auto",Ve,$e],we=()=>["auto","min","max","fr",Ve,$e],J=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ae=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...H()],q=()=>[xo,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...H()],W=()=>[e,Ve,$e],oe=()=>[...z(),fb,hb,{position:[Ve,$e]}],P=()=>["no-repeat",{repeat:["","x","y","space","round"]}],je=()=>["auto","cover","contain",$M,qM,{size:[Ve,$e]}],Z=()=>[wp,Xc,ri],O=()=>["","none","full",f,Ve,$e],Ne=()=>["",wt,Xc,ri],se=()=>["solid","dashed","dotted","double"],Ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ye=()=>[wt,wp,fb,hb],Be=()=>["","none",j,Ve,$e],ie=()=>["none",wt,Ve,$e],He=()=>["none",wt,Ve,$e],lt=()=>[wt,Ve,$e],ve=()=>[xo,"full",...H()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[_s],breakpoint:[_s],color:[BM],container:[_s],"drop-shadow":[_s],ease:["in","out","in-out"],font:[IM],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[_s],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[_s],shadow:[_s],spacing:["px",wt],text:[_s],"text-shadow":[_s],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",xo,$e,Ve,S]}],container:["container"],columns:[{columns:[wt,$e,Ve,d]}],"break-after":[{"break-after":D()}],"break-before":[{"break-before":D()}],"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"],sr:["sr-only","not-sr-only"],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:L()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:$()}],"inset-x":[{"inset-x":$()}],"inset-y":[{"inset-y":$()}],start:[{start:$()}],end:[{end:$()}],top:[{top:$()}],right:[{right:$()}],bottom:[{bottom:$()}],left:[{left:$()}],visibility:["visible","invisible","collapse"],z:[{z:[xl,"auto",Ve,$e]}],basis:[{basis:[xo,"full","auto",d,...H()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[wt,xo,"auto","initial","none",$e]}],grow:[{grow:["",wt,Ve,$e]}],shrink:[{shrink:["",wt,Ve,$e]}],order:[{order:[xl,"first","last","none",Ve,$e]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:G()}],"col-start":[{"col-start":te()}],"col-end":[{"col-end":te()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:G()}],"row-start":[{"row-start":te()}],"row-end":[{"row-end":te()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":we()}],"auto-rows":[{"auto-rows":we()}],gap:[{gap:H()}],"gap-x":[{"gap-x":H()}],"gap-y":[{"gap-y":H()}],"justify-content":[{justify:[...J(),"normal"]}],"justify-items":[{"justify-items":[...ae(),"normal"]}],"justify-self":[{"justify-self":["auto",...ae()]}],"align-content":[{content:["normal",...J()]}],"align-items":[{items:[...ae(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ae(),{baseline:["","last"]}]}],"place-content":[{"place-content":J()}],"place-items":[{"place-items":[...ae(),"baseline"]}],"place-self":[{"place-self":["auto",...ae()]}],p:[{p:H()}],px:[{px:H()}],py:[{py:H()}],ps:[{ps:H()}],pe:[{pe:H()}],pt:[{pt:H()}],pr:[{pr:H()}],pb:[{pb:H()}],pl:[{pl:H()}],m:[{m:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":H()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":H()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],w:[{w:[d,"screen",...q()]}],"min-w":[{"min-w":[d,"screen","none",...q()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[c]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh",...q()]}],"font-size":[{text:["base",n,Xc,ri]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,Ve,jp]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",wp,$e]}],"font-family":[{font:[UM,$e,t]}],"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-fractions"],tracking:[{tracking:[l,Ve,$e]}],"line-clamp":[{"line-clamp":[wt,"none",Ve,jp]}],leading:[{leading:[o,...H()]}],"list-image":[{"list-image":["none",Ve,$e]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ve,$e]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[wt,"from-font","auto",Ve,ri]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[wt,"auto",Ve,$e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ve,$e]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ve,$e]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:oe()}],"bg-repeat":[{bg:P()}],"bg-size":[{bg:je()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},xl,Ve,$e],radial:["",Ve,$e],conic:[xl,Ve,$e]},VM,HM]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:Z()}],"gradient-via-pos":[{via:Z()}],"gradient-to-pos":[{to:Z()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],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:Ne()}],"border-w-x":[{"border-x":Ne()}],"border-w-y":[{"border-y":Ne()}],"border-w-s":[{"border-s":Ne()}],"border-w-e":[{"border-e":Ne()}],"border-w-t":[{"border-t":Ne()}],"border-w-r":[{"border-r":Ne()}],"border-w-b":[{"border-b":Ne()}],"border-w-l":[{"border-l":Ne()}],"divide-x":[{"divide-x":Ne()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Ne()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[wt,Ve,$e]}],"outline-w":[{outline:["",wt,Xc,ri]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",p,w0,b0]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",x,w0,b0]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:Ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[wt,ri]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":Ne()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",y,w0,b0]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[wt,Ve,$e]}],"mix-blend":[{"mix-blend":[...Ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ce()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[wt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ye()}],"mask-image-linear-to-pos":[{"mask-linear-to":ye()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":ye()}],"mask-image-t-to-pos":[{"mask-t-to":ye()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":ye()}],"mask-image-r-to-pos":[{"mask-r-to":ye()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":ye()}],"mask-image-b-to-pos":[{"mask-b-to":ye()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":ye()}],"mask-image-l-to-pos":[{"mask-l-to":ye()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":ye()}],"mask-image-x-to-pos":[{"mask-x-to":ye()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":ye()}],"mask-image-y-to-pos":[{"mask-y-to":ye()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[Ve,$e]}],"mask-image-radial-from-pos":[{"mask-radial-from":ye()}],"mask-image-radial-to-pos":[{"mask-radial-to":ye()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":z()}],"mask-image-conic-pos":[{"mask-conic":[wt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ye()}],"mask-image-conic-to-pos":[{"mask-conic-to":ye()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:oe()}],"mask-repeat":[{mask:P()}],"mask-size":[{mask:je()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ve,$e]}],filter:[{filter:["","none",Ve,$e]}],blur:[{blur:Be()}],brightness:[{brightness:[wt,Ve,$e]}],contrast:[{contrast:[wt,Ve,$e]}],"drop-shadow":[{"drop-shadow":["","none",b,w0,b0]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",wt,Ve,$e]}],"hue-rotate":[{"hue-rotate":[wt,Ve,$e]}],invert:[{invert:["",wt,Ve,$e]}],saturate:[{saturate:[wt,Ve,$e]}],sepia:[{sepia:["",wt,Ve,$e]}],"backdrop-filter":[{"backdrop-filter":["","none",Ve,$e]}],"backdrop-blur":[{"backdrop-blur":Be()}],"backdrop-brightness":[{"backdrop-brightness":[wt,Ve,$e]}],"backdrop-contrast":[{"backdrop-contrast":[wt,Ve,$e]}],"backdrop-grayscale":[{"backdrop-grayscale":["",wt,Ve,$e]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[wt,Ve,$e]}],"backdrop-invert":[{"backdrop-invert":["",wt,Ve,$e]}],"backdrop-opacity":[{"backdrop-opacity":[wt,Ve,$e]}],"backdrop-saturate":[{"backdrop-saturate":[wt,Ve,$e]}],"backdrop-sepia":[{"backdrop-sepia":["",wt,Ve,$e]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":H()}],"border-spacing-x":[{"border-spacing-x":H()}],"border-spacing-y":[{"border-spacing-y":H()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ve,$e]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[wt,"initial",Ve,$e]}],ease:[{ease:["linear","initial",_,Ve,$e]}],delay:[{delay:[wt,Ve,$e]}],animate:[{animate:["none",M,Ve,$e]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,Ve,$e]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:ie()}],"rotate-x":[{"rotate-x":ie()}],"rotate-y":[{"rotate-y":ie()}],"rotate-z":[{"rotate-z":ie()}],scale:[{scale:He()}],"scale-x":[{"scale-x":He()}],"scale-y":[{"scale-y":He()}],"scale-z":[{"scale-z":He()}],"scale-3d":["scale-3d"],skew:[{skew:lt()}],"skew-x":[{"skew-x":lt()}],"skew-y":[{"skew-y":lt()}],transform:[{transform:[Ve,$e,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",Ve,$e]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"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",Ve,$e]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[wt,Xc,ri,jp]}],stroke:[{stroke:["none",...W()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},XM=_M(WM);function me(...e){return XM(E5(e))}const ot=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:me("rounded-xl border bg-card text-card-foreground shadow",e),...t}));ot.displayName="Card";const Bt=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:me("flex flex-col space-y-1.5 p-6",e),...t}));Bt.displayName="CardHeader";const Lt=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:me("font-semibold leading-none tracking-tight",e),...t}));Lt.displayName="CardTitle";const tr=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:me("text-sm text-muted-foreground",e),...t}));tr.displayName="CardDescription";const Vt=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:me("p-6 pt-0",e),...t}));Vt.displayName="CardContent";const F6=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:me("flex items-center p-6 pt-0",e),...t}));F6.displayName="CardFooter";var Np="rovingFocusGroup.onEntryFocus",KM={bubbles:!1,cancelable:!0},Bu="RovingFocusGroup",[kx,I6,QM]=vm(Bu),[ZM,Mm]=Ha(Bu,[QM]),[JM,eE]=ZM(Bu),q6=w.forwardRef((e,t)=>r.jsx(kx.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(kx.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(tE,{...e,ref:t})})}));q6.displayName=Bu;var tE=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:a,loop:l=!1,dir:o,currentTabStopId:c,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:m,onEntryFocus:f,preventScrollOnEntryFocus:p=!1,...x}=e,y=w.useRef(null),b=dn(t,y),j=Tu(o),[k,S]=Dl({prop:c,defaultProp:d??null,onChange:m,caller:Bu}),[_,M]=w.useState(!1),D=gr(f),z=I6(n),L=w.useRef(!1),[E,R]=w.useState(0);return w.useEffect(()=>{const H=y.current;if(H)return H.addEventListener(Np,D),()=>H.removeEventListener(Np,D)},[D]),r.jsx(JM,{scope:n,orientation:a,dir:j,loop:l,currentTabStopId:k,onItemFocus:w.useCallback(H=>S(H),[S]),onItemShiftTab:w.useCallback(()=>M(!0),[]),onFocusableItemAdd:w.useCallback(()=>R(H=>H+1),[]),onFocusableItemRemove:w.useCallback(()=>R(H=>H-1),[]),children:r.jsx(Ft.div,{tabIndex:_||E===0?-1:0,"data-orientation":a,...x,ref:b,style:{outline:"none",...e.style},onMouseDown:Pe(e.onMouseDown,()=>{L.current=!0}),onFocus:Pe(e.onFocus,H=>{const $=!L.current;if(H.target===H.currentTarget&&$&&!_){const I=new CustomEvent(Np,KM);if(H.currentTarget.dispatchEvent(I),!I.defaultPrevented){const G=z().filter(U=>U.focusable),te=G.find(U=>U.active),we=G.find(U=>U.id===k),ae=[te,we,...G].filter(Boolean).map(U=>U.ref.current);$6(ae,p)}}L.current=!1}),onBlur:Pe(e.onBlur,()=>M(!1))})})}),H6="RovingFocusGroupItem",U6=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:a=!0,active:l=!1,tabStopId:o,children:c,...d}=e,m=Ta(),f=o||m,p=eE(H6,n),x=p.currentTabStopId===f,y=I6(n),{onFocusableItemAdd:b,onFocusableItemRemove:j,currentTabStopId:k}=p;return w.useEffect(()=>{if(a)return b(),()=>j()},[a,b,j]),r.jsx(kx.ItemSlot,{scope:n,id:f,focusable:a,active:l,children:r.jsx(Ft.span,{tabIndex:x?0:-1,"data-orientation":p.orientation,...d,ref:t,onMouseDown:Pe(e.onMouseDown,S=>{a?p.onItemFocus(f):S.preventDefault()}),onFocus:Pe(e.onFocus,()=>p.onItemFocus(f)),onKeyDown:Pe(e.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){p.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const _=aE(S,p.orientation,p.dir);if(_!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let D=y().filter(z=>z.focusable).map(z=>z.ref.current);if(_==="last")D.reverse();else if(_==="prev"||_==="next"){_==="prev"&&D.reverse();const z=D.indexOf(S.currentTarget);D=p.loop?sE(D,z+1):D.slice(z+1)}setTimeout(()=>$6(D))}}),children:typeof c=="function"?c({isCurrentTabStop:x,hasTabStop:k!=null}):c})})});U6.displayName=H6;var nE={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function rE(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function aE(e,t,n){const a=rE(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(a))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(a)))return nE[a]}function $6(e,t=!1){const n=document.activeElement;for(const a of e)if(a===n||(a.focus({preventScroll:t}),document.activeElement!==n))return}function sE(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var V6=q6,G6=U6,Em="Tabs",[lE]=Ha(Em,[Mm]),Y6=Mm(),[iE,C1]=lE(Em),W6=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,onValueChange:l,defaultValue:o,orientation:c="horizontal",dir:d,activationMode:m="automatic",...f}=e,p=Tu(d),[x,y]=Dl({prop:a,onChange:l,defaultProp:o??"",caller:Em});return r.jsx(iE,{scope:n,baseId:Ta(),value:x,onValueChange:y,orientation:c,dir:p,activationMode:m,children:r.jsx(Ft.div,{dir:p,"data-orientation":c,...f,ref:t})})});W6.displayName=Em;var X6="TabsList",K6=w.forwardRef((e,t)=>{const{__scopeTabs:n,loop:a=!0,...l}=e,o=C1(X6,n),c=Y6(n);return r.jsx(V6,{asChild:!0,...c,orientation:o.orientation,dir:o.dir,loop:a,children:r.jsx(Ft.div,{role:"tablist","aria-orientation":o.orientation,...l,ref:t})})});K6.displayName=X6;var Q6="TabsTrigger",Z6=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,disabled:l=!1,...o}=e,c=C1(Q6,n),d=Y6(n),m=tw(c.baseId,a),f=nw(c.baseId,a),p=a===c.value;return r.jsx(G6,{asChild:!0,...d,focusable:!l,active:p,children:r.jsx(Ft.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":f,"data-state":p?"active":"inactive","data-disabled":l?"":void 0,disabled:l,id:m,...o,ref:t,onMouseDown:Pe(e.onMouseDown,x=>{!l&&x.button===0&&x.ctrlKey===!1?c.onValueChange(a):x.preventDefault()}),onKeyDown:Pe(e.onKeyDown,x=>{[" ","Enter"].includes(x.key)&&c.onValueChange(a)}),onFocus:Pe(e.onFocus,()=>{const x=c.activationMode!=="manual";!p&&!l&&x&&c.onValueChange(a)})})})});Z6.displayName=Q6;var J6="TabsContent",ew=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,forceMount:l,children:o,...c}=e,d=C1(J6,n),m=tw(d.baseId,a),f=nw(d.baseId,a),p=a===d.value,x=w.useRef(p);return w.useEffect(()=>{const y=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(y)},[]),r.jsx(Wr,{present:l||p,children:({present:y})=>r.jsx(Ft.div,{"data-state":p?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":m,hidden:!y,id:f,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:x.current?"0s":void 0},children:y&&o})})});ew.displayName=J6;function tw(e,t){return`${e}-trigger-${t}`}function nw(e,t){return`${e}-content-${t}`}var oE=W6,rw=K6,aw=Z6,sw=ew;const Sl=oE,Ls=w.forwardRef(({className:e,...t},n)=>r.jsx(rw,{ref:n,className:me("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));Ls.displayName=rw.displayName;const Rt=w.forwardRef(({className:e,...t},n)=>r.jsx(aw,{ref:n,className:me("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 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",e),...t}));Rt.displayName=aw.displayName;const ln=w.forwardRef(({className:e,...t},n)=>r.jsx(sw,{ref:n,className:me("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",e),...t}));ln.displayName=sw.displayName;function cE(e,t){return w.useReducer((n,a)=>t[n][a]??n,e)}var T1="ScrollArea",[lw]=Ha(T1),[uE,Aa]=lw(T1),iw=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:a="hover",dir:l,scrollHideDelay:o=600,...c}=e,[d,m]=w.useState(null),[f,p]=w.useState(null),[x,y]=w.useState(null),[b,j]=w.useState(null),[k,S]=w.useState(null),[_,M]=w.useState(0),[D,z]=w.useState(0),[L,E]=w.useState(!1),[R,H]=w.useState(!1),$=dn(t,G=>m(G)),I=Tu(l);return r.jsx(uE,{scope:n,type:a,dir:I,scrollHideDelay:o,scrollArea:d,viewport:f,onViewportChange:p,content:x,onContentChange:y,scrollbarX:b,onScrollbarXChange:j,scrollbarXEnabled:L,onScrollbarXEnabledChange:E,scrollbarY:k,onScrollbarYChange:S,scrollbarYEnabled:R,onScrollbarYEnabledChange:H,onCornerWidthChange:M,onCornerHeightChange:z,children:r.jsx(Ft.div,{dir:I,...c,ref:$,style:{position:"relative","--radix-scroll-area-corner-width":_+"px","--radix-scroll-area-corner-height":D+"px",...e.style}})})});iw.displayName=T1;var ow="ScrollAreaViewport",cw=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:a,nonce:l,...o}=e,c=Aa(ow,n),d=w.useRef(null),m=dn(t,d,c.onViewportChange);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:l}),r.jsx(Ft.div,{"data-radix-scroll-area-viewport":"",...o,ref:m,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...e.style},children:r.jsx("div",{ref:c.onContentChange,style:{minWidth:"100%",display:"table"},children:a})})]})});cw.displayName=ow;var as="ScrollAreaScrollbar",_1=w.forwardRef((e,t)=>{const{forceMount:n,...a}=e,l=Aa(as,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:c}=l,d=e.orientation==="horizontal";return w.useEffect(()=>(d?o(!0):c(!0),()=>{d?o(!1):c(!1)}),[d,o,c]),l.type==="hover"?r.jsx(dE,{...a,ref:t,forceMount:n}):l.type==="scroll"?r.jsx(mE,{...a,ref:t,forceMount:n}):l.type==="auto"?r.jsx(uw,{...a,ref:t,forceMount:n}):l.type==="always"?r.jsx(M1,{...a,ref:t}):null});_1.displayName=as;var dE=w.forwardRef((e,t)=>{const{forceMount:n,...a}=e,l=Aa(as,e.__scopeScrollArea),[o,c]=w.useState(!1);return w.useEffect(()=>{const d=l.scrollArea;let m=0;if(d){const f=()=>{window.clearTimeout(m),c(!0)},p=()=>{m=window.setTimeout(()=>c(!1),l.scrollHideDelay)};return d.addEventListener("pointerenter",f),d.addEventListener("pointerleave",p),()=>{window.clearTimeout(m),d.removeEventListener("pointerenter",f),d.removeEventListener("pointerleave",p)}}},[l.scrollArea,l.scrollHideDelay]),r.jsx(Wr,{present:n||o,children:r.jsx(uw,{"data-state":o?"visible":"hidden",...a,ref:t})})}),mE=w.forwardRef((e,t)=>{const{forceMount:n,...a}=e,l=Aa(as,e.__scopeScrollArea),o=e.orientation==="horizontal",c=Dm(()=>m("SCROLL_END"),100),[d,m]=cE("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 w.useEffect(()=>{if(d==="idle"){const f=window.setTimeout(()=>m("HIDE"),l.scrollHideDelay);return()=>window.clearTimeout(f)}},[d,l.scrollHideDelay,m]),w.useEffect(()=>{const f=l.viewport,p=o?"scrollLeft":"scrollTop";if(f){let x=f[p];const y=()=>{const b=f[p];x!==b&&(m("SCROLL"),c()),x=b};return f.addEventListener("scroll",y),()=>f.removeEventListener("scroll",y)}},[l.viewport,o,m,c]),r.jsx(Wr,{present:n||d!=="hidden",children:r.jsx(M1,{"data-state":d==="hidden"?"hidden":"visible",...a,ref:t,onPointerEnter:Pe(e.onPointerEnter,()=>m("POINTER_ENTER")),onPointerLeave:Pe(e.onPointerLeave,()=>m("POINTER_LEAVE"))})})}),uw=w.forwardRef((e,t)=>{const n=Aa(as,e.__scopeScrollArea),{forceMount:a,...l}=e,[o,c]=w.useState(!1),d=e.orientation==="horizontal",m=Dm(()=>{if(n.viewport){const f=n.viewport.offsetWidth{const{orientation:n="vertical",...a}=e,l=Aa(as,e.__scopeScrollArea),o=w.useRef(null),c=w.useRef(0),[d,m]=w.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),f=pw(d.viewport,d.content),p={...a,sizes:d,onSizesChange:m,hasThumb:f>0&&f<1,onThumbChange:y=>o.current=y,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:y=>c.current=y};function x(y,b){return vE(y,c.current,d,b)}return n==="horizontal"?r.jsx(hE,{...p,ref:t,onThumbPositionChange:()=>{if(l.viewport&&o.current){const y=l.viewport.scrollLeft,b=pb(y,d,l.dir);o.current.style.transform=`translate3d(${b}px, 0, 0)`}},onWheelScroll:y=>{l.viewport&&(l.viewport.scrollLeft=y)},onDragScroll:y=>{l.viewport&&(l.viewport.scrollLeft=x(y,l.dir))}}):n==="vertical"?r.jsx(fE,{...p,ref:t,onThumbPositionChange:()=>{if(l.viewport&&o.current){const y=l.viewport.scrollTop,b=pb(y,d);o.current.style.transform=`translate3d(0, ${b}px, 0)`}},onWheelScroll:y=>{l.viewport&&(l.viewport.scrollTop=y)},onDragScroll:y=>{l.viewport&&(l.viewport.scrollTop=x(y))}}):null}),hE=w.forwardRef((e,t)=>{const{sizes:n,onSizesChange:a,...l}=e,o=Aa(as,e.__scopeScrollArea),[c,d]=w.useState(),m=w.useRef(null),f=dn(t,m,o.onScrollbarXChange);return w.useEffect(()=>{m.current&&d(getComputedStyle(m.current))},[m]),r.jsx(mw,{"data-orientation":"horizontal",...l,ref:f,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":Am(n)+"px",...e.style},onThumbPointerDown:p=>e.onThumbPointerDown(p.x),onDragScroll:p=>e.onDragScroll(p.x),onWheelScroll:(p,x)=>{if(o.viewport){const y=o.viewport.scrollLeft+p.deltaX;e.onWheelScroll(y),gw(y,x)&&p.preventDefault()}},onResize:()=>{m.current&&o.viewport&&c&&a({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:m.current.clientWidth,paddingStart:am(c.paddingLeft),paddingEnd:am(c.paddingRight)}})}})}),fE=w.forwardRef((e,t)=>{const{sizes:n,onSizesChange:a,...l}=e,o=Aa(as,e.__scopeScrollArea),[c,d]=w.useState(),m=w.useRef(null),f=dn(t,m,o.onScrollbarYChange);return w.useEffect(()=>{m.current&&d(getComputedStyle(m.current))},[m]),r.jsx(mw,{"data-orientation":"vertical",...l,ref:f,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":Am(n)+"px",...e.style},onThumbPointerDown:p=>e.onThumbPointerDown(p.y),onDragScroll:p=>e.onDragScroll(p.y),onWheelScroll:(p,x)=>{if(o.viewport){const y=o.viewport.scrollTop+p.deltaY;e.onWheelScroll(y),gw(y,x)&&p.preventDefault()}},onResize:()=>{m.current&&o.viewport&&c&&a({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:m.current.clientHeight,paddingStart:am(c.paddingTop),paddingEnd:am(c.paddingBottom)}})}})}),[pE,dw]=lw(as),mw=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:a,hasThumb:l,onThumbChange:o,onThumbPointerUp:c,onThumbPointerDown:d,onThumbPositionChange:m,onDragScroll:f,onWheelScroll:p,onResize:x,...y}=e,b=Aa(as,n),[j,k]=w.useState(null),S=dn(t,$=>k($)),_=w.useRef(null),M=w.useRef(""),D=b.viewport,z=a.content-a.viewport,L=gr(p),E=gr(m),R=Dm(x,10);function H($){if(_.current){const I=$.clientX-_.current.left,G=$.clientY-_.current.top;f({x:I,y:G})}}return w.useEffect(()=>{const $=I=>{const G=I.target;j?.contains(G)&&L(I,z)};return document.addEventListener("wheel",$,{passive:!1}),()=>document.removeEventListener("wheel",$,{passive:!1})},[D,j,z,L]),w.useEffect(E,[a,E]),Po(j,R),Po(b.content,R),r.jsx(pE,{scope:n,scrollbar:j,hasThumb:l,onThumbChange:gr(o),onThumbPointerUp:gr(c),onThumbPositionChange:E,onThumbPointerDown:gr(d),children:r.jsx(Ft.div,{...y,ref:S,style:{position:"absolute",...y.style},onPointerDown:Pe(e.onPointerDown,$=>{$.button===0&&($.target.setPointerCapture($.pointerId),_.current=j.getBoundingClientRect(),M.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",b.viewport&&(b.viewport.style.scrollBehavior="auto"),H($))}),onPointerMove:Pe(e.onPointerMove,H),onPointerUp:Pe(e.onPointerUp,$=>{const I=$.target;I.hasPointerCapture($.pointerId)&&I.releasePointerCapture($.pointerId),document.body.style.webkitUserSelect=M.current,b.viewport&&(b.viewport.style.scrollBehavior=""),_.current=null})})})}),rm="ScrollAreaThumb",hw=w.forwardRef((e,t)=>{const{forceMount:n,...a}=e,l=dw(rm,e.__scopeScrollArea);return r.jsx(Wr,{present:n||l.hasThumb,children:r.jsx(xE,{ref:t,...a})})}),xE=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:a,...l}=e,o=Aa(rm,n),c=dw(rm,n),{onThumbPositionChange:d}=c,m=dn(t,x=>c.onThumbChange(x)),f=w.useRef(void 0),p=Dm(()=>{f.current&&(f.current(),f.current=void 0)},100);return w.useEffect(()=>{const x=o.viewport;if(x){const y=()=>{if(p(),!f.current){const b=yE(x,d);f.current=b,d()}};return d(),x.addEventListener("scroll",y),()=>x.removeEventListener("scroll",y)}},[o.viewport,p,d]),r.jsx(Ft.div,{"data-state":c.hasThumb?"visible":"hidden",...l,ref:m,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...a},onPointerDownCapture:Pe(e.onPointerDownCapture,x=>{const b=x.target.getBoundingClientRect(),j=x.clientX-b.left,k=x.clientY-b.top;c.onThumbPointerDown({x:j,y:k})}),onPointerUp:Pe(e.onPointerUp,c.onThumbPointerUp)})});hw.displayName=rm;var E1="ScrollAreaCorner",fw=w.forwardRef((e,t)=>{const n=Aa(E1,e.__scopeScrollArea),a=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&a?r.jsx(gE,{...e,ref:t}):null});fw.displayName=E1;var gE=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,...a}=e,l=Aa(E1,n),[o,c]=w.useState(0),[d,m]=w.useState(0),f=!!(o&&d);return Po(l.scrollbarX,()=>{const p=l.scrollbarX?.offsetHeight||0;l.onCornerHeightChange(p),m(p)}),Po(l.scrollbarY,()=>{const p=l.scrollbarY?.offsetWidth||0;l.onCornerWidthChange(p),c(p)}),f?r.jsx(Ft.div,{...a,ref:t,style:{width:o,height:d,position:"absolute",right:l.dir==="ltr"?0:void 0,left:l.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function am(e){return e?parseInt(e,10):0}function pw(e,t){const n=e/t;return isNaN(n)?0:n}function Am(e){const t=pw(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,a=(e.scrollbar.size-n)*t;return Math.max(a,18)}function vE(e,t,n,a="ltr"){const l=Am(n),o=l/2,c=t||o,d=l-c,m=n.scrollbar.paddingStart+c,f=n.scrollbar.size-n.scrollbar.paddingEnd-d,p=n.content-n.viewport,x=a==="ltr"?[0,p]:[p*-1,0];return xw([m,f],x)(e)}function pb(e,t,n="ltr"){const a=Am(t),l=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-l,c=t.content-t.viewport,d=o-a,m=n==="ltr"?[0,c]:[c*-1,0],f=o1(e,m);return xw([0,c],[0,d])(f)}function xw(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const a=(t[1]-t[0])/(e[1]-e[0]);return t[0]+a*(n-e[0])}}function gw(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},a=0;return(function l(){const o={left:e.scrollLeft,top:e.scrollTop},c=n.left!==o.left,d=n.top!==o.top;(c||d)&&t(),n=o,a=window.requestAnimationFrame(l)})(),()=>window.cancelAnimationFrame(a)};function Dm(e,t){const n=gr(e),a=w.useRef(0);return w.useEffect(()=>()=>window.clearTimeout(a.current),[]),w.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(n,t)},[n,t])}function Po(e,t){const n=gr(t);A5(()=>{let a=0;if(e){const l=new ResizeObserver(()=>{cancelAnimationFrame(a),a=window.requestAnimationFrame(n)});return l.observe(e),()=>{window.cancelAnimationFrame(a),l.unobserve(e)}}},[e,n])}var vw=iw,bE=cw,wE=fw;const Xt=w.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(vw,{ref:a,className:me("relative overflow-hidden",e),...n,children:[r.jsx(bE,{className:"h-full w-full rounded-[inherit]",children:t}),r.jsx(yw,{}),r.jsx(wE,{})]}));Xt.displayName=vw.displayName;const yw=w.forwardRef(({className:e,orientation:t="vertical",...n},a)=>r.jsx(_1,{ref:a,orientation:t,className:me("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:r.jsx(hw,{className:"relative flex-1 rounded-full bg-border"})}));yw.displayName=_1.displayName;function xb({className:e,...t}){return r.jsx("div",{className:me("animate-pulse rounded-md bg-primary/10",e),...t})}function jE(e,t=[]){let n=[];function a(o,c){const d=w.createContext(c);d.displayName=o+"Context";const m=n.length;n=[...n,c];const f=x=>{const{scope:y,children:b,...j}=x,k=y?.[e]?.[m]||d,S=w.useMemo(()=>j,Object.values(j));return r.jsx(k.Provider,{value:S,children:b})};f.displayName=o+"Provider";function p(x,y){const b=y?.[e]?.[m]||d,j=w.useContext(b);if(j)return j;if(c!==void 0)return c;throw new Error(`\`${x}\` must be used within \`${o}\``)}return[f,p]}const l=()=>{const o=n.map(c=>w.createContext(c));return function(d){const m=d?.[e]||o;return w.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])}};return l.scopeName=e,[a,NE(l,...t)]}function NE(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(o){const c=a.reduce((d,{useScope:m,scopeName:f})=>{const x=m(o)[`__scope${f}`];return{...d,...x}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var SE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],bw=SE.reduce((e,t)=>{const n=c1(`Primitive.${t}`),a=w.forwardRef((l,o)=>{const{asChild:c,...d}=l,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(m,{...d,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),A1="Progress",D1=100,[kE]=jE(A1),[CE,TE]=kE(A1),ww=w.forwardRef((e,t)=>{const{__scopeProgress:n,value:a=null,max:l,getValueLabel:o=_E,...c}=e;(l||l===0)&&!gb(l)&&console.error(ME(`${l}`,"Progress"));const d=gb(l)?l:D1;a!==null&&!vb(a,d)&&console.error(EE(`${a}`,"Progress"));const m=vb(a,d)?a:null,f=sm(m)?o(m,d):void 0;return r.jsx(CE,{scope:n,value:m,max:d,children:r.jsx(bw.div,{"aria-valuemax":d,"aria-valuemin":0,"aria-valuenow":sm(m)?m:void 0,"aria-valuetext":f,role:"progressbar","data-state":Sw(m,d),"data-value":m??void 0,"data-max":d,...c,ref:t})})});ww.displayName=A1;var jw="ProgressIndicator",Nw=w.forwardRef((e,t)=>{const{__scopeProgress:n,...a}=e,l=TE(jw,n);return r.jsx(bw.div,{"data-state":Sw(l.value,l.max),"data-value":l.value??void 0,"data-max":l.max,...a,ref:t})});Nw.displayName=jw;function _E(e,t){return`${Math.round(e/t*100)}%`}function Sw(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function sm(e){return typeof e=="number"}function gb(e){return sm(e)&&!isNaN(e)&&e>0}function vb(e,t){return sm(e)&&!isNaN(e)&&e<=t&&e>=0}function ME(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${D1}\`.`}function EE(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: - - a positive number - - less than the value passed to \`max\` (or ${D1} if no \`max\` prop is set) - - \`null\` or \`undefined\` if the progress is indeterminate. - -Defaulting to \`null\`.`}var kw=ww,AE=Nw;const Lu=w.forwardRef(({className:e,value:t,...n},a)=>r.jsx(kw,{ref:a,className:me("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...n,children:r.jsx(AE,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Lu.displayName=kw.displayName;const DE={light:"",dark:".dark"},Cw=w.createContext(null);function Tw(){const e=w.useContext(Cw);if(!e)throw new Error("useChart must be used within a ");return e}const jo=w.forwardRef(({id:e,className:t,children:n,config:a,...l},o)=>{const c=w.useId(),d=`chart-${e||c.replace(/:/g,"")}`;return r.jsx(Cw.Provider,{value:{config:a},children:r.jsxs("div",{"data-chart":d,ref:o,className:me("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",t),...l,children:[r.jsx(zE,{id:d,config:a}),r.jsx(LC,{children:n})]})})});jo.displayName="Chart";const zE=({id:e,config:t})=>{const n=Object.entries(t).filter(([,a])=>a.theme||a.color);return n.length?r.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(DE).map(([a,l])=>` -${l} [data-chart=${e}] { -${n.map(([o,c])=>{const d=c.theme?.[a]||c.color;return d?` --color-${o}: ${d};`:null}).join(` -`)} -} -`).join(` -`)}}):null},Kc=PC,No=w.forwardRef(({active:e,payload:t,className:n,indicator:a="dot",hideLabel:l=!1,hideIndicator:o=!1,label:c,labelFormatter:d,labelClassName:m,formatter:f,color:p,nameKey:x,labelKey:y},b)=>{const{config:j}=Tw(),k=w.useMemo(()=>{if(l||!t?.length)return null;const[_]=t,M=`${y||_?.dataKey||_?.name||"value"}`,D=Cx(j,_,M),z=!y&&typeof c=="string"?j[c]?.label||c:D?.label;return d?r.jsx("div",{className:me("font-medium",m),children:d(z,t)}):z?r.jsx("div",{className:me("font-medium",m),children:z}):null},[c,d,t,l,m,j,y]);if(!e||!t?.length)return null;const S=t.length===1&&a!=="dot";return r.jsxs("div",{ref:b,className:me("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[S?null:k,r.jsx("div",{className:"grid gap-1.5",children:t.filter(_=>_.type!=="none").map((_,M)=>{const D=`${x||_.name||_.dataKey||"value"}`,z=Cx(j,_,D),L=p||_.payload.fill||_.color;return r.jsx("div",{className:me("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",a==="dot"&&"items-center"),children:f&&_?.value!==void 0&&_.name?f(_.value,_.name,_,M,_.payload):r.jsxs(r.Fragment,{children:[z?.icon?r.jsx(z.icon,{}):!o&&r.jsx("div",{className:me("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":a==="dot","w-1":a==="line","w-0 border-[1.5px] border-dashed bg-transparent":a==="dashed","my-0.5":S&&a==="dashed"}),style:{"--color-bg":L,"--color-border":L}}),r.jsxs("div",{className:me("flex flex-1 justify-between leading-none",S?"items-end":"items-center"),children:[r.jsxs("div",{className:"grid gap-1.5",children:[S?k:null,r.jsx("span",{className:"text-muted-foreground",children:z?.label||_.name})]}),_.value&&r.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:_.value.toLocaleString()})]})]})},_.dataKey)})})]})});No.displayName="ChartTooltip";const OE=FC,_w=w.forwardRef(({className:e,hideIcon:t=!1,payload:n,verticalAlign:a="bottom",nameKey:l},o)=>{const{config:c}=Tw();return n?.length?r.jsx("div",{ref:o,className:me("flex items-center justify-center gap-4",a==="top"?"pb-3":"pt-3",e),children:n.filter(d=>d.type!=="none").map(d=>{const m=`${l||d.dataKey||"value"}`,f=Cx(c,d,m);return r.jsxs("div",{className:me("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[f?.icon&&!t?r.jsx(f.icon,{}):r.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:d.color}}),f?.label]},d.value)})}):null});_w.displayName="ChartLegend";function Cx(e,t,n){if(typeof t!="object"||t===null)return;const a="payload"in t&&typeof t.payload=="object"&&t.payload!==null?t.payload:void 0;let l=n;return n in t&&typeof t[n]=="string"?l=t[n]:a&&n in a&&typeof a[n]=="string"&&(l=a[n]),l in e?e[l]:e[n]}const yb=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,bb=E5,Wo=(e,t)=>n=>{var a;if(t?.variants==null)return bb(e,n?.class,n?.className);const{variants:l,defaultVariants:o}=t,c=Object.keys(l).map(f=>{const p=n?.[f],x=o?.[f];if(p===null)return null;const y=yb(p)||yb(x);return l[f][y]}),d=n&&Object.entries(n).reduce((f,p)=>{let[x,y]=p;return y===void 0||(f[x]=y),f},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((f,p)=>{let{class:x,className:y,...b}=p;return Object.entries(b).every(j=>{let[k,S]=j;return Array.isArray(S)?S.includes({...o,...d}[k]):{...o,...d}[k]===S})?[...f,x,y]:f},[]);return bb(e,c,m,n?.class,n?.className)},pu=Wo("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring 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 shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),re=w.forwardRef(({className:e,variant:t,size:n,asChild:a=!1,...l},o)=>{const c=a?VC:"button";return r.jsx(c,{className:me(pu({variant:t,size:n,className:e})),ref:o,...l})});re.displayName="Button";function RE(){const[e,t]=w.useState(null),[n,a]=w.useState(!0),[l,o]=w.useState(0),[c,d]=w.useState(24),[m,f]=w.useState(!0),[p,x]=w.useState(null),[y,b]=w.useState(!0),j=w.useCallback(async()=>{try{b(!0);const $=await Mn.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");x({hitokoto:$.data.hitokoto,from:$.data.from||$.data.from_who||"未知"})}catch($){console.error("获取一言失败:",$),x({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{b(!1)}},[]),k=w.useCallback(async()=>{try{const $=localStorage.getItem("access-token"),I=await Mn.get(`/api/webui/statistics/dashboard?hours=${c}`,{headers:{Authorization:`Bearer ${$}`}});t(I.data),a(!1),o(100)}catch($){console.error("Failed to fetch dashboard data:",$),a(!1),o(100)}},[c]);if(w.useEffect(()=>{if(!n)return;o(0);const $=setTimeout(()=>o(15),200),I=setTimeout(()=>o(30),800),G=setTimeout(()=>o(45),2e3),te=setTimeout(()=>o(60),4e3),we=setTimeout(()=>o(75),6500),J=setTimeout(()=>o(85),9e3),ae=setTimeout(()=>o(92),11e3);return()=>{clearTimeout($),clearTimeout(I),clearTimeout(G),clearTimeout(te),clearTimeout(we),clearTimeout(J),clearTimeout(ae)}},[n]),w.useEffect(()=>{k(),j()},[k,j]),w.useEffect(()=>{if(!m)return;const $=setInterval(()=>{k()},3e4);return()=>clearInterval($)},[m,k]),n||!e)return r.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:r.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[r.jsx(Os,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Lu,{value:l,className:"h-2"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[l,"%"]})]})]})});const{summary:S,model_stats:_,hourly_data:M,daily_data:D,recent_activity:z}=e,L=$=>{const I=Math.floor($/3600),G=Math.floor($%3600/60);return`${I}小时${G}分钟`},E=$=>new Date($).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),R=_.slice(0,6).map($=>({name:$.model_name,value:$.request_count,fill:`hsl(var(--chart-${_.indexOf($)%5+1}))`})),H={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return r.jsx(Xt,{className:"h-full",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(Sl,{value:c.toString(),onValueChange:$=>d(Number($)),children:r.jsxs(Ls,{className:"grid grid-cols-3 w-full sm:w-auto",children:[r.jsx(Rt,{value:"24",children:"24小时"}),r.jsx(Rt,{value:"168",children:"7天"}),r.jsx(Rt,{value:"720",children:"30天"})]})}),r.jsxs(re,{variant:m?"default":"outline",size:"sm",onClick:()=>f(!m),className:"gap-2",children:[r.jsx(Os,{className:`h-4 w-4 ${m?"animate-spin":""}`}),r.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),r.jsx(re,{variant:"outline",size:"sm",onClick:k,children:r.jsx(Os,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[r.jsxs(ot,{children:[r.jsxs(Bt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Lt,{className:"text-sm font-medium",children:"总请求数"}),r.jsx(aT,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Vt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:S.total_requests.toLocaleString()}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",c<48?c+"小时":Math.floor(c/24)+"天"]})]})]}),r.jsxs(ot,{children:[r.jsxs(Bt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Lt,{className:"text-sm font-medium",children:"总花费"}),r.jsx(sT,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Vt,{children:[r.jsxs("div",{className:"text-2xl font-bold",children:["¥",S.total_cost.toFixed(2)]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.cost_per_hour>0?`¥${S.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),r.jsxs(ot,{children:[r.jsxs(Bt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Lt,{className:"text-sm font-medium",children:"Token消耗"}),r.jsx(lT,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Vt,{children:[r.jsxs("div",{className:"text-2xl font-bold",children:[(S.total_tokens/1e3).toFixed(1),"K"]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.tokens_per_hour>0?`${(S.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),r.jsxs(ot,{children:[r.jsxs(Bt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Lt,{className:"text-sm font-medium",children:"平均响应"}),r.jsx(mu,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Vt,{children:[r.jsxs("div",{className:"text-2xl font-bold",children:[S.avg_response_time.toFixed(2),"s"]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),r.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[r.jsxs(ot,{children:[r.jsxs(Bt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Lt,{className:"text-sm font-medium",children:"在线时长"}),r.jsx(ui,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Vt,{children:r.jsx("div",{className:"text-xl font-bold",children:L(S.online_time)})})]}),r.jsxs(ot,{children:[r.jsxs(Bt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Lt,{className:"text-sm font-medium",children:"消息处理"}),r.jsx(_u,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Vt,{children:[r.jsx("div",{className:"text-xl font-bold",children:S.total_messages.toLocaleString()}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",S.total_replies.toLocaleString()," 条"]})]})]}),r.jsxs(ot,{children:[r.jsxs(Bt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Lt,{className:"text-sm font-medium",children:"成本效率"}),r.jsx(iT,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Vt,{children:[r.jsx("div",{className:"text-xl font-bold",children:S.total_messages>0?`¥${(S.total_cost/S.total_messages*100).toFixed(2)}`:"¥0.00"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),r.jsxs(Sl,{defaultValue:"trends",className:"space-y-4",children:[r.jsxs(Ls,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[r.jsx(Rt,{value:"trends",children:"趋势"}),r.jsx(Rt,{value:"models",children:"模型"}),r.jsx(Rt,{value:"activity",children:"活动"}),r.jsx(Rt,{value:"daily",children:"日统计"})]}),r.jsxs(ln,{value:"trends",className:"space-y-4",children:[r.jsxs(ot,{children:[r.jsxs(Bt,{children:[r.jsx(Lt,{children:"请求趋势"}),r.jsxs(tr,{children:["最近",c,"小时的请求量变化"]})]}),r.jsx(Vt,{children:r.jsx(jo,{config:H,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:r.jsxs(IC,{data:M,children:[r.jsx(x0,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),r.jsx(g0,{dataKey:"timestamp",tickFormatter:$=>E($),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Gc,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Kc,{content:r.jsx(No,{labelFormatter:$=>E($)})}),r.jsx(qC,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),r.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[r.jsxs(ot,{children:[r.jsxs(Bt,{children:[r.jsx(Lt,{children:"花费趋势"}),r.jsx(tr,{children:"API调用成本变化"})]}),r.jsx(Vt,{children:r.jsx(jo,{config:H,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:r.jsxs(fp,{data:M,children:[r.jsx(x0,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),r.jsx(g0,{dataKey:"timestamp",tickFormatter:$=>E($),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Gc,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Kc,{content:r.jsx(No,{labelFormatter:$=>E($)})}),r.jsx(v0,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),r.jsxs(ot,{children:[r.jsxs(Bt,{children:[r.jsx(Lt,{children:"Token消耗"}),r.jsx(tr,{children:"Token使用量变化"})]}),r.jsx(Vt,{children:r.jsx(jo,{config:H,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:r.jsxs(fp,{data:M,children:[r.jsx(x0,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),r.jsx(g0,{dataKey:"timestamp",tickFormatter:$=>E($),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Gc,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Kc,{content:r.jsx(No,{labelFormatter:$=>E($)})}),r.jsx(v0,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),r.jsx(ln,{value:"models",className:"space-y-4",children:r.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[r.jsxs(ot,{children:[r.jsxs(Bt,{children:[r.jsx(Lt,{children:"模型请求分布"}),r.jsx(tr,{children:"各模型使用占比"})]}),r.jsx(Vt,{children:r.jsx(jo,{config:Object.fromEntries(_.slice(0,6).map(($,I)=>[$.model_name,{label:$.model_name,color:`hsl(var(--chart-${I%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:r.jsxs(HC,{children:[r.jsx(Kc,{content:r.jsx(No,{})}),r.jsx(UC,{data:R,cx:"50%",cy:"50%",labelLine:!1,label:({name:$,percent:I})=>`${$} ${I?(I*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:R.map(($,I)=>r.jsx($C,{fill:$.fill},`cell-${I}`))})]})})})]}),r.jsxs(ot,{children:[r.jsxs(Bt,{children:[r.jsx(Lt,{children:"模型详细统计"}),r.jsx(tr,{children:"请求数、花费和性能"})]}),r.jsx(Vt,{children:r.jsx(Xt,{className:"h-[300px] sm:h-[400px]",children:r.jsx("div",{className:"space-y-3",children:_.map(($,I)=>r.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:$.model_name}),r.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${I%5+1}))`}})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),r.jsx("span",{className:"ml-1 font-medium",children:$.request_count.toLocaleString()})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"花费:"}),r.jsxs("span",{className:"ml-1 font-medium",children:["¥",$.total_cost.toFixed(2)]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),r.jsxs("span",{className:"ml-1 font-medium",children:[($.total_tokens/1e3).toFixed(1),"K"]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),r.jsxs("span",{className:"ml-1 font-medium",children:[$.avg_response_time.toFixed(2),"s"]})]})]})]},I))})})})]})]})}),r.jsx(ln,{value:"activity",children:r.jsxs(ot,{children:[r.jsxs(Bt,{children:[r.jsx(Lt,{children:"最近活动"}),r.jsx(tr,{children:"最新的API调用记录"})]}),r.jsx(Vt,{children:r.jsx(Xt,{className:"h-[400px] sm:h-[500px]",children:r.jsx("div",{className:"space-y-2",children:z.map(($,I)=>r.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium text-sm truncate",children:$.model}),r.jsx("div",{className:"text-xs text-muted-foreground",children:$.request_type})]}),r.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:E($.timestamp)})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),r.jsx("span",{className:"ml-1",children:$.tokens})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"花费:"}),r.jsxs("span",{className:"ml-1",children:["¥",$.cost.toFixed(4)]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),r.jsxs("span",{className:"ml-1",children:[$.time_cost.toFixed(2),"s"]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"状态:"}),r.jsx("span",{className:`ml-1 ${$.status==="success"?"text-green-600":"text-red-600"}`,children:$.status})]})]})]},I))})})})]})}),r.jsx(ln,{value:"daily",children:r.jsxs(ot,{children:[r.jsxs(Bt,{children:[r.jsx(Lt,{children:"每日统计"}),r.jsx(tr,{children:"最近7天的数据汇总"})]}),r.jsx(Vt,{children:r.jsx(jo,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:r.jsxs(fp,{data:D,children:[r.jsx(x0,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),r.jsx(g0,{dataKey:"timestamp",tickFormatter:$=>{const I=new Date($);return`${I.getMonth()+1}/${I.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Gc,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Gc,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Kc,{content:r.jsx(No,{labelFormatter:$=>new Date($).toLocaleDateString("zh-CN")})}),r.jsx(OE,{content:r.jsx(_w,{})}),r.jsx(v0,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),r.jsx(v0,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),r.jsxs(ot,{className:"border-2 border-primary/20",children:[r.jsx(Bt,{className:"pb-3",children:r.jsx(Lt,{className:"text-lg",children:"每日一言"})}),r.jsx(Vt,{children:y?r.jsxs("div",{className:"space-y-2",children:[r.jsx(xb,{className:"h-6 w-3/4"}),r.jsx(xb,{className:"h-4 w-1/4"})]}):p?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-lg font-medium leading-relaxed italic",children:['"',p.hitokoto,'"']}),r.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["—— ",p.from]})]}):null})]})]})})}const BE={theme:"system",setTheme:()=>null},Mw=w.createContext(BE),z1=()=>{const e=w.useContext(Mw);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},LE=(e,t,n)=>{const a=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||a){t(e);return}const l=n.clientX,o=n.clientY,c=Math.hypot(Math.max(l,innerWidth-l),Math.max(o,innerHeight-o));document.startViewTransition(()=>{t(e)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${l}px ${o}px)`,`circle(${c}px at ${l}px ${o}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},Ew=w.createContext(void 0),Aw=()=>{const e=w.useContext(Ew);if(e===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return e};var zm="Switch",[PE]=Ha(zm),[FE,IE]=PE(zm),Dw=w.forwardRef((e,t)=>{const{__scopeSwitch:n,name:a,checked:l,defaultChecked:o,required:c,disabled:d,value:m="on",onCheckedChange:f,form:p,...x}=e,[y,b]=w.useState(null),j=dn(t,D=>b(D)),k=w.useRef(!1),S=y?p||!!y.closest("form"):!0,[_,M]=Dl({prop:l,defaultProp:o??!1,onChange:f,caller:zm});return r.jsxs(FE,{scope:n,checked:_,disabled:d,children:[r.jsx(Ft.button,{type:"button",role:"switch","aria-checked":_,"aria-required":c,"data-state":Bw(_),"data-disabled":d?"":void 0,disabled:d,value:m,...x,ref:j,onClick:Pe(e.onClick,D=>{M(z=>!z),S&&(k.current=D.isPropagationStopped(),k.current||D.stopPropagation())})}),S&&r.jsx(Rw,{control:y,bubbles:!k.current,name:a,value:m,checked:_,required:c,disabled:d,form:p,style:{transform:"translateX(-100%)"}})]})});Dw.displayName=zm;var zw="SwitchThumb",Ow=w.forwardRef((e,t)=>{const{__scopeSwitch:n,...a}=e,l=IE(zw,n);return r.jsx(Ft.span,{"data-state":Bw(l.checked),"data-disabled":l.disabled?"":void 0,...a,ref:t})});Ow.displayName=zw;var qE="SwitchBubbleInput",Rw=w.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:a=!0,...l},o)=>{const c=w.useRef(null),d=dn(c,o),m=D5(n),f=z5(t);return w.useEffect(()=>{const p=c.current;if(!p)return;const x=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(x,"checked").set;if(m!==n&&b){const j=new Event("click",{bubbles:a});b.call(p,n),p.dispatchEvent(j)}},[m,n,a]),r.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...l,tabIndex:-1,ref:d,style:{...l.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Rw.displayName=qE;function Bw(e){return e?"checked":"unchecked"}var Lw=Dw,HE=Ow;const gt=w.forwardRef(({className:e,...t},n)=>r.jsx(Lw,{className:me("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm 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",e),...t,ref:n,children:r.jsx(HE,{className:me("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));gt.displayName=Lw.displayName;const UE=Wo("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Q=w.forwardRef(({className:e,...t},n)=>r.jsx(O5,{ref:n,className:me(UE(),e),...t}));Q.displayName=O5.displayName;const Te=w.forwardRef(({className:e,type:t,...n},a)=>r.jsx("input",{type:t,className:me("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors 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-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:a,...n}));Te.displayName="Input";const $E=1,VE=1e6;let Sp=0;function GE(){return Sp=(Sp+1)%Number.MAX_SAFE_INTEGER,Sp.toString()}const kp=new Map,wb=e=>{if(kp.has(e))return;const t=setTimeout(()=>{kp.delete(e),iu({type:"REMOVE_TOAST",toastId:e})},VE);kp.set(e,t)},YE=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,$E)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?wb(n):e.toasts.forEach(a=>{wb(a.id)}),{...e,toasts:e.toasts.map(a=>a.id===n||n===void 0?{...a,open:!1}:a)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},$0=[];let V0={toasts:[]};function iu(e){V0=YE(V0,e),$0.forEach(t=>{t(V0)})}function WE({...e}){const t=GE(),n=l=>iu({type:"UPDATE_TOAST",toast:{...l,id:t}}),a=()=>iu({type:"DISMISS_TOAST",toastId:t});return iu({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:l=>{l||a()}}}),{id:t,dismiss:a,update:n}}function pr(){const[e,t]=w.useState(V0);return w.useEffect(()=>($0.push(t),()=>{const n=$0.indexOf(t);n>-1&&$0.splice(n,1)}),[e]),{...e,toast:WE,dismiss:n=>iu({type:"DISMISS_TOAST",toastId:n})}}const XE=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:e=>e.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:e=>/[A-Z]/.test(e)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:e=>/[a-z]/.test(e)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:e=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(e)}];function KE(e){const t=XE.map(a=>({id:a.id,label:a.label,description:a.description,passed:a.validate(e)}));return{isValid:t.every(a=>a.passed),rules:t}}const O1="0.11.5 Beta",R1="MaiBot Dashboard",QE=`${R1} v${O1}`,ZE=(e="v")=>`${e}${O1}`,hr=f1,Pw=R5,JE=u1,Fw=w.forwardRef(({className:e,...t},n)=>r.jsx(ym,{ref:n,className:me("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",e),...t}));Fw.displayName=ym.displayName;const nr=w.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(JE,{children:[r.jsx(Fw,{}),r.jsxs(bm,{ref:a,className:me("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",e),...n,children:[t,r.jsxs(d1,{className:"absolute right-4 top-4 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:[r.jsx(Mu,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));nr.displayName=bm.displayName;const rr=({className:e,...t})=>r.jsx("div",{className:me("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});rr.displayName="DialogHeader";const Yr=({className:e,...t})=>r.jsx("div",{className:me("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Yr.displayName="DialogFooter";const ar=w.forwardRef(({className:e,...t},n)=>r.jsx(m1,{ref:n,className:me("text-lg font-semibold leading-none tracking-tight",e),...t}));ar.displayName=m1.displayName;const wr=w.forwardRef(({className:e,...t},n)=>r.jsx(h1,{ref:n,className:me("text-sm text-muted-foreground",e),...t}));wr.displayName=h1.displayName;var eA=Symbol("radix.slottable");function tA(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=eA,t}var Iw="AlertDialog",[nA]=Ha(Iw,[B5]),Hs=B5(),qw=e=>{const{__scopeAlertDialog:t,...n}=e,a=Hs(t);return r.jsx(f1,{...a,...n,modal:!0})};qw.displayName=Iw;var rA="AlertDialogTrigger",Hw=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...a}=e,l=Hs(n);return r.jsx(R5,{...l,...a,ref:t})});Hw.displayName=rA;var aA="AlertDialogPortal",Uw=e=>{const{__scopeAlertDialog:t,...n}=e,a=Hs(t);return r.jsx(u1,{...a,...n})};Uw.displayName=aA;var sA="AlertDialogOverlay",$w=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...a}=e,l=Hs(n);return r.jsx(ym,{...l,...a,ref:t})});$w.displayName=sA;var Eo="AlertDialogContent",[lA,iA]=nA(Eo),oA=tA("AlertDialogContent"),Vw=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:a,...l}=e,o=Hs(n),c=w.useRef(null),d=dn(t,c),m=w.useRef(null);return r.jsx(GC,{contentName:Eo,titleName:Gw,docsSlug:"alert-dialog",children:r.jsx(lA,{scope:n,cancelRef:m,children:r.jsxs(bm,{role:"alertdialog",...o,...l,ref:d,onOpenAutoFocus:Pe(l.onOpenAutoFocus,f=>{f.preventDefault(),m.current?.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[r.jsx(oA,{children:a}),r.jsx(uA,{contentRef:c})]})})})});Vw.displayName=Eo;var Gw="AlertDialogTitle",Yw=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...a}=e,l=Hs(n);return r.jsx(m1,{...l,...a,ref:t})});Yw.displayName=Gw;var Ww="AlertDialogDescription",Xw=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...a}=e,l=Hs(n);return r.jsx(h1,{...l,...a,ref:t})});Xw.displayName=Ww;var cA="AlertDialogAction",Kw=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...a}=e,l=Hs(n);return r.jsx(d1,{...l,...a,ref:t})});Kw.displayName=cA;var Qw="AlertDialogCancel",Zw=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...a}=e,{cancelRef:l}=iA(Qw,n),o=Hs(n),c=dn(t,l);return r.jsx(d1,{...o,...a,ref:c})});Zw.displayName=Qw;var uA=({contentRef:e})=>{const t=`\`${Eo}\` requires a description for the component to be accessible for screen reader users. - -You can add a description to the \`${Eo}\` by passing a \`${Ww}\` 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 \`${Eo}\`. 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 w.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},dA=qw,mA=Hw,hA=Uw,Jw=$w,e7=Vw,t7=Kw,n7=Zw,r7=Yw,a7=Xw;const cn=dA,Xn=mA,fA=hA,s7=w.forwardRef(({className:e,...t},n)=>r.jsx(Jw,{className:me("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",e),...t,ref:n}));s7.displayName=Jw.displayName;const Kt=w.forwardRef(({className:e,...t},n)=>r.jsxs(fA,{children:[r.jsx(s7,{}),r.jsx(e7,{ref:n,className:me("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",e),...t})]}));Kt.displayName=e7.displayName;const Qt=({className:e,...t})=>r.jsx("div",{className:me("flex flex-col space-y-2 text-center sm:text-left",e),...t});Qt.displayName="AlertDialogHeader";const Zt=({className:e,...t})=>r.jsx("div",{className:me("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Zt.displayName="AlertDialogFooter";const Jt=w.forwardRef(({className:e,...t},n)=>r.jsx(r7,{ref:n,className:me("text-lg font-semibold",e),...t}));Jt.displayName=r7.displayName;const en=w.forwardRef(({className:e,...t},n)=>r.jsx(a7,{ref:n,className:me("text-sm text-muted-foreground",e),...t}));en.displayName=a7.displayName;const tn=w.forwardRef(({className:e,...t},n)=>r.jsx(t7,{ref:n,className:me(pu(),e),...t}));tn.displayName=t7.displayName;const nn=w.forwardRef(({className:e,...t},n)=>r.jsx(n7,{ref:n,className:me(pu({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));nn.displayName=n7.displayName;function pA(){return r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),r.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),r.jsxs(Sl,{defaultValue:"appearance",className:"w-full",children:[r.jsxs(Ls,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[r.jsxs(Rt,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[r.jsx(Q5,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),r.jsx("span",{children:"外观"})]}),r.jsxs(Rt,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[r.jsx(oT,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),r.jsx("span",{children:"安全"})]}),r.jsxs(Rt,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[r.jsx(Pa,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),r.jsx("span",{children:"其他"})]}),r.jsxs(Rt,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[r.jsx(hi,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),r.jsx("span",{children:"关于"})]})]}),r.jsxs(Xt,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[r.jsx(ln,{value:"appearance",className:"mt-0",children:r.jsx(xA,{})}),r.jsx(ln,{value:"security",className:"mt-0",children:r.jsx(gA,{})}),r.jsx(ln,{value:"other",className:"mt-0",children:r.jsx(vA,{})}),r.jsx(ln,{value:"about",className:"mt-0",children:r.jsx(yA,{})})]})]})]})}function jb(e){const t=document.documentElement,a={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[e];if(a)t.style.setProperty("--primary",a.hsl),a.gradient?(t.style.setProperty("--primary-gradient",a.gradient),t.classList.add("has-gradient")):(t.style.removeProperty("--primary-gradient"),t.classList.remove("has-gradient"));else if(e.startsWith("#")){const l=o=>{o=o.replace("#","");const c=parseInt(o.substring(0,2),16)/255,d=parseInt(o.substring(2,4),16)/255,m=parseInt(o.substring(4,6),16)/255,f=Math.max(c,d,m),p=Math.min(c,d,m);let x=0,y=0;const b=(f+p)/2;if(f!==p){const j=f-p;switch(y=b>.5?j/(2-f-p):j/(f+p),f){case c:x=((d-m)/j+(dlocalStorage.getItem("accent-color")||"blue");w.useEffect(()=>{const f=localStorage.getItem("accent-color")||"blue";jb(f)},[]);const m=f=>{d(f),localStorage.setItem("accent-color",f),jb(f)};return r.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[r.jsx(Cp,{value:"light",current:e,onChange:t,label:"浅色",description:"始终使用浅色主题"}),r.jsx(Cp,{value:"dark",current:e,onChange:t,label:"深色",description:"始终使用深色主题"}),r.jsx(Cp,{value:"system",current:e,onChange:t,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),r.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),r.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[r.jsx(Sa,{value:"blue",current:c,onChange:m,label:"蓝色",colorClass:"bg-blue-500"}),r.jsx(Sa,{value:"purple",current:c,onChange:m,label:"紫色",colorClass:"bg-purple-500"}),r.jsx(Sa,{value:"green",current:c,onChange:m,label:"绿色",colorClass:"bg-green-500"}),r.jsx(Sa,{value:"orange",current:c,onChange:m,label:"橙色",colorClass:"bg-orange-500"}),r.jsx(Sa,{value:"pink",current:c,onChange:m,label:"粉色",colorClass:"bg-pink-500"}),r.jsx(Sa,{value:"red",current:c,onChange:m,label:"红色",colorClass:"bg-red-500"})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),r.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[r.jsx(Sa,{value:"gradient-sunset",current:c,onChange:m,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),r.jsx(Sa,{value:"gradient-ocean",current:c,onChange:m,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),r.jsx(Sa,{value:"gradient-forest",current:c,onChange:m,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),r.jsx(Sa,{value:"gradient-aurora",current:c,onChange:m,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),r.jsx(Sa,{value:"gradient-fire",current:c,onChange:m,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),r.jsx(Sa,{value:"gradient-twilight",current:c,onChange:m,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[r.jsx("div",{className:"flex-1",children:r.jsx("input",{type:"color",value:c.startsWith("#")?c:"#3b82f6",onChange:f=>m(f.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),r.jsx("div",{className:"flex-1",children:r.jsx(Te,{type:"text",value:c,onChange:f=>m(f.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),r.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),r.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[r.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5 flex-1",children:[r.jsx(Q,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),r.jsx(gt,{id:"animations",checked:n,onCheckedChange:a})]})}),r.jsx("div",{className:"rounded-lg border bg-card p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5 flex-1",children:[r.jsx(Q,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),r.jsx(gt,{id:"waves-background",checked:l,onCheckedChange:o})]})})]})]})]})}function gA(){const e=rs(),[t,n]=w.useState(""),[a,l]=w.useState(""),[o,c]=w.useState(!1),[d,m]=w.useState(!1),[f,p]=w.useState(!1),[x,y]=w.useState(!1),[b,j]=w.useState(!1),[k,S]=w.useState(!1),[_,M]=w.useState(""),[D,z]=w.useState(!1),{toast:L}=pr(),E=w.useMemo(()=>KE(a),[a]),R=()=>localStorage.getItem("access-token")||"",H=async J=>{try{await navigator.clipboard.writeText(J),j(!0),L({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>j(!1),2e3)}catch{L({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},$=async()=>{if(!a.trim()){L({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!E.isValid){const J=E.rules.filter(ae=>!ae.passed).map(ae=>ae.label).join(", ");L({title:"格式错误",description:`Token 不符合要求: ${J}`,variant:"destructive"});return}p(!0);try{const J=R(),ae=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${J}`},body:JSON.stringify({new_token:a.trim()})}),U=await ae.json();ae.ok&&U.success?(localStorage.setItem("access-token",a.trim()),l(""),t&&n(a.trim()),L({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),e({to:"/auth"})},1500)):L({title:"更新失败",description:U.message||"无法更新 Token",variant:"destructive"})}catch(J){console.error("更新 Token 错误:",J),L({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{p(!1)}},I=async()=>{y(!0);try{const J=R(),ae=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${J}`}}),U=await ae.json();ae.ok&&U.success?(localStorage.setItem("access-token",U.token),n(U.token),M(U.token),S(!0),z(!1),L({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):L({title:"生成失败",description:U.message||"无法生成新 Token",variant:"destructive"})}catch(J){console.error("生成 Token 错误:",J),L({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{y(!1)}},G=async()=>{try{await navigator.clipboard.writeText(_),z(!0),L({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{L({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},te=()=>{S(!1),setTimeout(()=>{M(""),z(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),e({to:"/auth"})},500)},we=J=>{J||te()};return r.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[r.jsx(hr,{open:k,onOpenChange:we,children:r.jsxs(nr,{className:"sm:max-w-md",children:[r.jsxs(rr,{children:[r.jsxs(ar,{className:"flex items-center gap-2",children:[r.jsx(Mo,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),r.jsx(wr,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[r.jsx(Q,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),r.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:_})]}),r.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Mo,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[r.jsx("p",{className:"font-semibold",children:"重要提示"}),r.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[r.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),r.jsx("li",{children:"请立即复制并保存到安全的位置"}),r.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),r.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),r.jsxs(Yr,{className:"gap-2 sm:gap-0",children:[r.jsx(re,{variant:"outline",onClick:G,className:"gap-2",children:D?r.jsxs(r.Fragment,{children:[r.jsx(di,{className:"h-4 w-4 text-green-500"}),"已复制"]}):r.jsxs(r.Fragment,{children:[r.jsx(hx,{className:"h-4 w-4"}),"复制 Token"]})}),r.jsx(re,{onClick:te,children:"我已保存,关闭"})]})]})}),r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),r.jsx("div",{className:"space-y-3 sm:space-y-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Te,{id:"current-token",type:o?"text":"password",value:t||R(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),r.jsx("button",{onClick:()=>{t||n(R()),c(!o)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:o?"隐藏":"显示",children:o?r.jsx(fx,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(qa,{className:"h-4 w-4 text-muted-foreground"})})]}),r.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[r.jsx(re,{variant:"outline",size:"icon",onClick:()=>H(R()),title:"复制到剪贴板",className:"flex-shrink-0",children:b?r.jsx(di,{className:"h-4 w-4 text-green-500"}):r.jsx(hx,{className:"h-4 w-4"})}),r.jsxs(cn,{children:[r.jsx(Xn,{asChild:!0,children:r.jsxs(re,{variant:"outline",disabled:x,className:"gap-2 flex-1 sm:flex-none",children:[r.jsx(Os,{className:me("h-4 w-4",x&&"animate-spin")}),r.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),r.jsx("span",{className:"sm:hidden",children:"生成"})]})}),r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认重新生成 Token"}),r.jsx(en,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:I,children:"确认生成"})]})]})]})]})]}),r.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),r.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),r.jsxs("div",{className:"relative",children:[r.jsx(Te,{id:"new-token",type:d?"text":"password",value:a,onChange:J=>l(J.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),r.jsx("button",{onClick:()=>m(!d),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:d?"隐藏":"显示",children:d?r.jsx(fx,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(qa,{className:"h-4 w-4 text-muted-foreground"})})]}),a&&r.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),r.jsx("div",{className:"space-y-1.5",children:E.rules.map(J=>r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[J.passed?r.jsx(Ur,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):r.jsx(px,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx("span",{className:me(J.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:J.label})]},J.id))}),E.isValid&&r.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:r.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[r.jsx(di,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),r.jsx(re,{onClick:$,disabled:f||!E.isValid||!a,className:"w-full sm:w-auto",children:f?"更新中...":"更新自定义 Token"})]})]}),r.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[r.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),r.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[r.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),r.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),r.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),r.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),r.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),r.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function vA(){const e=rs(),{toast:t}=pr(),[n,a]=w.useState(!1),l=async()=>{a(!0);try{const o=localStorage.getItem("access-token"),c=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${o}`}}),d=await c.json();c.ok&&d.success?(t({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{e({to:"/setup"})},1e3)):t({title:"重置失败",description:d.message||"无法重置配置状态",variant:"destructive"})}catch(o){console.error("重置配置状态错误:",o),t({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{a(!1)}};return r.jsx("div",{className:"space-y-4 sm:space-y-6",children:r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),r.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[r.jsx("div",{className:"space-y-2",children:r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),r.jsxs(cn,{children:[r.jsx(Xn,{asChild:!0,children:r.jsxs(re,{variant:"outline",disabled:n,className:"gap-2",children:[r.jsx(cT,{className:me("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认重新配置"}),r.jsx(en,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:l,children:"确认重置"})]})]})]})]})]})})}function yA(){return r.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",R1]}),r.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[r.jsxs("p",{children:["版本: ",O1]}),r.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),r.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",r.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),r.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[r.jsx("li",{children:"React 19.2.0"}),r.jsx("li",{children:"TypeScript 5.7.2"}),r.jsx("li",{children:"Vite 6.0.7"}),r.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),r.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[r.jsx("li",{children:"shadcn/ui"}),r.jsx("li",{children:"Radix UI"}),r.jsx("li",{children:"Tailwind CSS 3.4.17"}),r.jsx("li",{children:"Lucide Icons"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("p",{className:"font-medium text-foreground",children:"后端"}),r.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[r.jsx("li",{children:"Python 3.12+"}),r.jsx("li",{children:"FastAPI"}),r.jsx("li",{children:"Uvicorn"}),r.jsx("li",{children:"WebSocket"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),r.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[r.jsx("li",{children:"Bun / npm"}),r.jsx("li",{children:"ESLint 9.17.0"}),r.jsx("li",{children:"PostCSS"})]})]})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),r.jsx(Xt,{className:"h-[300px] sm:h-[400px]",children:r.jsxs("div",{className:"space-y-4 pr-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(kn,{name:"React",description:"用户界面构建库",license:"MIT"}),r.jsx(kn,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),r.jsx(kn,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),r.jsx(kn,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),r.jsx(kn,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(kn,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),r.jsx(kn,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(kn,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),r.jsx(kn,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(kn,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),r.jsx(kn,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),r.jsx(kn,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),r.jsx(kn,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(kn,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),r.jsx(kn,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(kn,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),r.jsx(kn,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),r.jsx(kn,{name:"Pydantic",description:"数据验证库",license:"MIT"}),r.jsx(kn,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(kn,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),r.jsx(kn,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),r.jsx(kn,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),r.jsx(kn,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:r.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[r.jsx("div",{className:"flex-shrink-0 mt-0.5",children:r.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:r.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function kn({name:e,description:t,license:n}){return r.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-foreground truncate",children:e}),r.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:t})]}),r.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:n})]})}function Cp({value:e,current:t,onChange:n,label:a,description:l}){const o=t===e;return r.jsxs("button",{onClick:()=>n(e),className:me("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",o?"border-primary bg-accent":"border-border"),children:[o&&r.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-sm sm:text-base font-medium",children:a}),r.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:l})]}),r.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[e==="light"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),r.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),r.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),e==="dark"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),r.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),r.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),e==="system"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),r.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),r.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function Sa({value:e,current:t,onChange:n,label:a,colorClass:l}){const o=t===e;return r.jsxs("button",{onClick:()=>n(e),className:me("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",o?"border-primary bg-accent":"border-border"),children:[o&&r.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),r.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[r.jsx("div",{className:me("h-8 w-8 sm:h-10 sm:w-10 rounded-full",l)}),r.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:a})]})]})}class bA{grad3;p;perm;constructor(t=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let n=0;n<256;n++)this.p[n]=Math.floor(Math.random()*256);this.perm=[];for(let n=0;n<512;n++)this.perm[n]=this.p[n&255]}dot(t,n,a){return t[0]*n+t[1]*a}mix(t,n,a){return(1-a)*t+a*n}fade(t){return t*t*t*(t*(t*6-15)+10)}perlin2(t,n){const a=Math.floor(t)&255,l=Math.floor(n)&255;t-=Math.floor(t),n-=Math.floor(n);const o=this.fade(t),c=this.fade(n),d=this.perm[a]+l,m=this.perm[d],f=this.perm[d+1],p=this.perm[a+1]+l,x=this.perm[p],y=this.perm[p+1];return this.mix(this.mix(this.dot(this.grad3[m%12],t,n),this.dot(this.grad3[x%12],t-1,n),o),this.mix(this.dot(this.grad3[f%12],t,n-1),this.dot(this.grad3[y%12],t-1,n-1),o),c)}}function wA(){const e=w.useRef(null),t=w.useRef(null),n=w.useRef(void 0),a=w.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new bA(Math.random()),bounding:null});return w.useEffect(()=>{const l=t.current,o=e.current;if(!l||!o)return;const c=a.current,d=()=>{const k=l.getBoundingClientRect();c.bounding=k,o.style.width=`${k.width}px`,o.style.height=`${k.height}px`},m=()=>{if(!c.bounding)return;const{width:k,height:S}=c.bounding;c.lines=[],c.paths.forEach($=>$.remove()),c.paths=[];const _=10,M=32,D=k+200,z=S+30,L=Math.ceil(D/_),E=Math.ceil(z/M),R=(k-_*L)/2,H=(S-M*E)/2;for(let $=0;$<=L;$++){const I=[];for(let te=0;te<=E;te++){const we={x:R+_*$,y:H+M*te,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};I.push(we)}const G=document.createElementNS("http://www.w3.org/2000/svg","path");o.appendChild(G),c.paths.push(G),c.lines.push(I)}},f=k=>{const{lines:S,mouse:_,noise:M}=c;S.forEach(D=>{D.forEach(z=>{const L=M.perlin2((z.x+k*.0125)*.002,(z.y+k*.005)*.0015)*12;z.wave.x=Math.cos(L)*32,z.wave.y=Math.sin(L)*16;const E=z.x-_.sx,R=z.y-_.sy,H=Math.hypot(E,R),$=Math.max(175,_.vs);if(H<$){const I=1-H/$,G=Math.cos(H*.001)*I;z.cursor.vx+=Math.cos(_.a)*G*$*_.vs*65e-5,z.cursor.vy+=Math.sin(_.a)*G*$*_.vs*65e-5}z.cursor.vx+=(0-z.cursor.x)*.005,z.cursor.vy+=(0-z.cursor.y)*.005,z.cursor.vx*=.925,z.cursor.vy*=.925,z.cursor.x+=z.cursor.vx*2,z.cursor.y+=z.cursor.vy*2,z.cursor.x=Math.min(100,Math.max(-100,z.cursor.x)),z.cursor.y=Math.min(100,Math.max(-100,z.cursor.y))})})},p=(k,S=!0)=>{const _={x:k.x+k.wave.x+(S?k.cursor.x:0),y:k.y+k.wave.y+(S?k.cursor.y:0)};return _.x=Math.round(_.x*10)/10,_.y=Math.round(_.y*10)/10,_},x=()=>{const{lines:k,paths:S}=c;k.forEach((_,M)=>{let D=p(_[0],!1),z=`M ${D.x} ${D.y}`;_.forEach((L,E)=>{const R=E===_.length-1;D=p(L,!R),z+=`L ${D.x} ${D.y}`}),S[M].setAttribute("d",z)})},y=k=>{const{mouse:S}=c;S.sx+=(S.x-S.sx)*.1,S.sy+=(S.y-S.sy)*.1;const _=S.x-S.lx,M=S.y-S.ly,D=Math.hypot(_,M);S.v=D,S.vs+=(D-S.vs)*.1,S.vs=Math.min(100,S.vs),S.lx=S.x,S.ly=S.y,S.a=Math.atan2(M,_),l&&(l.style.setProperty("--x",`${S.sx}px`),l.style.setProperty("--y",`${S.sy}px`)),f(k),x(),n.current=requestAnimationFrame(y)},b=k=>{if(!c.bounding)return;const{mouse:S}=c;S.x=k.pageX-c.bounding.left,S.y=k.pageY-c.bounding.top+window.scrollY,S.set||(S.sx=S.x,S.sy=S.y,S.lx=S.x,S.ly=S.y,S.set=!0)},j=()=>{d(),m()};return d(),m(),window.addEventListener("resize",j),window.addEventListener("mousemove",b),n.current=requestAnimationFrame(y),()=>{window.removeEventListener("resize",j),window.removeEventListener("mousemove",b),n.current&&cancelAnimationFrame(n.current)}},[]),r.jsxs("div",{ref:t,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[r.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),r.jsx("svg",{ref:e,style:{display:"block",width:"100%",height:"100%"},children:r.jsx("style",{children:` - path { - fill: none; - stroke: hsl(var(--primary) / 0.20); - stroke-width: 1px; - } - `})})]})}function jA(){const e=rs();w.useEffect(()=>{localStorage.getItem("access-token")||e({to:"/auth"})},[e])}function l7(){return!!localStorage.getItem("access-token")}function NA(){const[e,t]=w.useState(""),[n,a]=w.useState(!1),[l,o]=w.useState(""),c=rs(),{enableWavesBackground:d,setEnableWavesBackground:m}=Aw(),{theme:f,setTheme:p}=z1();w.useEffect(()=>{l7()&&c({to:"/"})},[c]);const y=f==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":f,b=()=>{p(y==="dark"?"light":"dark")},j=async k=>{if(k.preventDefault(),o(""),!e.trim()){o("请输入 Access Token");return}a(!0);try{const S=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e.trim()})}),_=await S.json();if(S.ok&&_.valid){localStorage.setItem("access-token",e.trim());const M=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${e.trim()}`}}),D=await M.json();M.ok&&D.is_first_setup?c({to:"/setup"}):c({to:"/"})}else o(_.message||"Token 验证失败,请检查后重试")}catch(S){console.error("Token 验证错误:",S),o("连接服务器失败,请检查网络连接")}finally{a(!1)}};return r.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[d&&r.jsx(wA,{}),r.jsxs(ot,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[r.jsx("button",{onClick:b,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:y==="dark"?"切换到浅色模式":"切换到深色模式",children:y==="dark"?r.jsx(xx,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):r.jsx(gx,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),r.jsxs(Bt,{className:"space-y-4 text-center",children:[r.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:r.jsx(Py,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Lt,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),r.jsx(tr,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),r.jsx(Vt,{children:r.jsxs("form",{onSubmit:j,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),r.jsxs("div",{className:"relative",children:[r.jsx(uT,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),r.jsx(Te,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:e,onChange:k=>t(k.target.value),className:me("pl-10",l&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),l&&r.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[r.jsx(fi,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),r.jsx("span",{children:l})]}),r.jsx(re,{type:"submit",className:"w-full",disabled:n,children:n?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),r.jsxs(hr,{children:[r.jsx(Pw,{asChild:!0,children:r.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[r.jsx(dT,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),r.jsxs(nr,{className:"sm:max-w-md",children:[r.jsxs(rr,{children:[r.jsxs(ar,{className:"flex items-center gap-2",children:[r.jsx(Py,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),r.jsx(wr,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(mT,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),r.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[r.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),r.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),r.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(jl,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),r.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:r.jsx("code",{className:"text-primary",children:"data/webui.json"})}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",r.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),r.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(fi,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),r.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[r.jsx("p",{className:"font-semibold",children:"安全提示"}),r.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[r.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),r.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),r.jsxs(cn,{children:[r.jsx(Xn,{asChild:!0,children:r.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[r.jsx(mu,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsxs(Jt,{className:"flex items-center gap-2",children:[r.jsx(mu,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),r.jsx(en,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),r.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:()=>m(!1),children:"关闭动画"})]})]})]})]})})]}),r.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:r.jsx("p",{children:QE})})]})}const vn=w.forwardRef(({className:e,...t},n)=>r.jsx("textarea",{className:me("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));vn.displayName="Textarea";var SA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],kA=SA.reduce((e,t)=>{const n=c1(`Primitive.${t}`),a=w.forwardRef((l,o)=>{const{asChild:c,...d}=l,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(m,{...d,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),CA="Separator",Nb="horizontal",TA=["horizontal","vertical"],i7=w.forwardRef((e,t)=>{const{decorative:n,orientation:a=Nb,...l}=e,o=_A(a)?a:Nb,d=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return r.jsx(kA.div,{"data-orientation":o,...d,...l,ref:t})});i7.displayName=CA;function _A(e){return TA.includes(e)}var o7=i7;const xu=w.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...a},l)=>r.jsx(o7,{ref:l,decorative:n,orientation:t,className:me("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...a}));xu.displayName=o7.displayName;const MA=Wo("inline-flex items-center rounded-md 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 shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function on({className:e,variant:t,...n}){return r.jsx("div",{className:me(MA({variant:t}),e),...n})}function EA({config:e,onChange:t}){const n=l=>{l.trim()&&!e.alias_names.includes(l.trim())&&t({...e,alias_names:[...e.alias_names,l.trim()]})},a=l=>{t({...e,alias_names:e.alias_names.filter((o,c)=>c!==l)})};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"qq_account",children:"QQ账号 *"}),r.jsx(Te,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:e.qq_account||"",onChange:l=>t({...e,qq_account:Number(l.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"nickname",children:"昵称 *"}),r.jsx(Te,{id:"nickname",placeholder:"请输入机器人的昵称",value:e.nickname,onChange:l=>t({...e,nickname:l.target.value})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{children:"别名"}),r.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:e.alias_names.map((l,o)=>r.jsxs(on,{variant:"secondary",className:"gap-1",children:[l,r.jsx("button",{type:"button",onClick:()=>a(o),className:"ml-1 hover:text-destructive",children:r.jsx(Mu,{className:"h-3 w-3"})})]},o))}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:l=>{l.key==="Enter"&&(n(l.target.value),l.target.value="")}}),r.jsx(re,{type:"button",variant:"outline",onClick:()=>{const l=document.getElementById("alias_input");l&&(n(l.value),l.value="")},children:"添加"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function AA({config:e,onChange:t}){return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"personality",children:"人格特征 *"}),r.jsx(vn,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:e.personality,onChange:n=>t({...e,personality:n.target.value}),rows:3}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"reply_style",children:"表达风格 *"}),r.jsx(vn,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:e.reply_style,onChange:n=>t({...e,reply_style:n.target.value}),rows:3}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"interest",children:"兴趣 *"}),r.jsx(vn,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:e.interest,onChange:n=>t({...e,interest:n.target.value}),rows:2}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),r.jsx(xu,{}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"plan_style",children:"群聊说话规则 *"}),r.jsx(vn,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:e.plan_style,onChange:n=>t({...e,plan_style:n.target.value}),rows:4}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),r.jsx(vn,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:e.private_plan_style,onChange:n=>t({...e,private_plan_style:n.target.value}),rows:3}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function DA({config:e,onChange:t}){return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{htmlFor:"emoji_chance",children:"表情包激活概率"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[(e.emoji_chance*100).toFixed(0),"%"]})]}),r.jsx(Te,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:e.emoji_chance,onChange:n=>t({...e,emoji_chance:Number(n.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"max_reg_num",children:"最大表情包数量"}),r.jsx(Te,{id:"max_reg_num",type:"number",min:"1",max:"200",value:e.max_reg_num,onChange:n=>t({...e,max_reg_num:Number(n.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Q,{htmlFor:"do_replace",children:"达到最大数量时替换"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),r.jsx(gt,{id:"do_replace",checked:e.do_replace,onCheckedChange:n=>t({...e,do_replace:n})})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),r.jsx(Te,{id:"check_interval",type:"number",min:"1",max:"120",value:e.check_interval,onChange:n=>t({...e,check_interval:Number(n.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),r.jsx(xu,{}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Q,{htmlFor:"steal_emoji",children:"偷取表情包"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),r.jsx(gt,{id:"steal_emoji",checked:e.steal_emoji,onCheckedChange:n=>t({...e,steal_emoji:n})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Q,{htmlFor:"content_filtration",children:"启用表情包过滤"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),r.jsx(gt,{id:"content_filtration",checked:e.content_filtration,onCheckedChange:n=>t({...e,content_filtration:n})})]}),e.content_filtration&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"filtration_prompt",children:"过滤要求"}),r.jsx(Te,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:e.filtration_prompt,onChange:n=>t({...e,filtration_prompt:n.target.value})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function zA({config:e,onChange:t}){return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Q,{htmlFor:"enable_tool",children:"启用工具系统"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),r.jsx(gt,{id:"enable_tool",checked:e.enable_tool,onCheckedChange:n=>t({...e,enable_tool:n})})]}),r.jsx(xu,{}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Q,{htmlFor:"enable_mood",children:"启用情绪系统"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),r.jsx(gt,{id:"enable_mood",checked:e.enable_mood,onCheckedChange:n=>t({...e,enable_mood:n})})]}),e.enable_mood&&r.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),r.jsx(Te,{id:"mood_update_threshold",type:"number",min:"0.1",max:"10",step:"0.1",value:e.mood_update_threshold||1,onChange:n=>t({...e,mood_update_threshold:Number(n.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"emotion_style",children:"情感特征"}),r.jsx(vn,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:e.emotion_style||"",onChange:n=>t({...e,emotion_style:n.target.value}),rows:2}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),r.jsx(xu,{}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Q,{htmlFor:"all_global",children:"启用全局黑话模式"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),r.jsx(gt,{id:"all_global",checked:e.all_global,onCheckedChange:n=>t({...e,all_global:n})})]})]})}async function ut(e,t){const n=await fetch(e,t);if(n.status===401)throw localStorage.removeItem("access-token"),window.location.href="/auth",new Error("认证失败,请重新登录");return n}function yt(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function OA(){const e=await ut("/api/webui/config/bot",{method:"GET",headers:yt()});if(!e.ok)throw new Error("读取Bot配置失败");const n=(await e.json()).config.bot||{};return{qq_account:n.qq_account||0,nickname:n.nickname||"",alias_names:n.alias_names||[]}}async function RA(){const e=await ut("/api/webui/config/bot",{method:"GET",headers:yt()});if(!e.ok)throw new Error("读取人格配置失败");const n=(await e.json()).config.personality||{};return{personality:n.personality||"",reply_style:n.reply_style||"",interest:n.interest||"",plan_style:n.plan_style||"",private_plan_style:n.private_plan_style||""}}async function BA(){const e=await ut("/api/webui/config/bot",{method:"GET",headers:yt()});if(!e.ok)throw new Error("读取表情包配置失败");const n=(await e.json()).config.emoji||{};return{emoji_chance:n.emoji_chance??.4,max_reg_num:n.max_reg_num??40,do_replace:n.do_replace??!0,check_interval:n.check_interval??10,steal_emoji:n.steal_emoji??!0,content_filtration:n.content_filtration??!1,filtration_prompt:n.filtration_prompt||""}}async function LA(){const e=await ut("/api/webui/config/bot",{method:"GET",headers:yt()});if(!e.ok)throw new Error("读取其他配置失败");const n=(await e.json()).config,a=n.tool||{},l=n.mood||{},o=n.jargon||{};return{enable_tool:a.enable_tool??!0,enable_mood:l.enable_mood??!1,mood_update_threshold:l.mood_update_threshold,emotion_style:l.emotion_style,all_global:o.all_global??!0}}async function PA(e){const t=await ut("/api/webui/config/bot/section/bot",{method:"POST",headers:yt(),body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await t.json()}async function FA(e){const t=await ut("/api/webui/config/bot/section/personality",{method:"POST",headers:yt(),body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.detail||"保存人格配置失败")}return await t.json()}async function IA(e){const t=await ut("/api/webui/config/bot/section/emoji",{method:"POST",headers:yt(),body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.detail||"保存表情包配置失败")}return await t.json()}async function qA(e){const t=[];t.push(ut("/api/webui/config/bot/section/tool",{method:"POST",headers:yt(),body:JSON.stringify({enable_tool:e.enable_tool})})),t.push(ut("/api/webui/config/bot/section/jargon",{method:"POST",headers:yt(),body:JSON.stringify({all_global:e.all_global})}));const n={enable_mood:e.enable_mood};e.enable_mood&&(n.mood_update_threshold=e.mood_update_threshold||1,n.emotion_style=e.emotion_style||""),t.push(ut("/api/webui/config/bot/section/mood",{method:"POST",headers:yt(),body:JSON.stringify(n)}));const a=await Promise.all(t);for(const l of a)if(!l.ok){const o=await l.json();throw new Error(o.detail||"保存其他配置失败")}return{success:!0}}async function Sb(){const e=localStorage.getItem("access-token"),t=await ut("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${e}`}});if(!t.ok){const n=await t.json();throw new Error(n.message||"标记配置完成失败")}return await t.json()}function HA(){const e=rs(),{toast:t}=pr(),[n,a]=w.useState(0),[l,o]=w.useState(!1),[c,d]=w.useState(!1),[m,f]=w.useState(!0),[p,x]=w.useState({qq_account:0,nickname:"",alias_names:[]}),[y,b]=w.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 -2.如果相同的内容已经被执行,请不要重复执行 -3.请控制你的发言频率,不要太过频繁的发言 -4.如果有人对你感到厌烦,请减少回复 -5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 -2.如果相同的内容已经被执行,请不要重复执行 -3.某句话如果已经被回复过,不要重复回复`}),[j,k]=w.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[S,_]=w.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遭遇特定事件的时候起伏较大",all_global:!0}),M=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:fT},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:Z5},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:v1},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:Pa},{id:"complete",title:"完成设置",description:"后续配置提示",icon:mu}],D=(n+1)/M.length*100;w.useEffect(()=>{(async()=>{try{f(!0);const[G,te,we,J]=await Promise.all([OA(),RA(),BA(),LA()]);x(G),b(te),k(we),_(J)}catch(G){t({title:"加载配置失败",description:G instanceof Error?G.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{f(!1)}})()},[t]);const z=async()=>{d(!0);try{switch(n){case 0:await PA(p);break;case 1:await FA(y);break;case 2:await IA(j);break;case 3:await qA(S);break}return t({title:"保存成功",description:`${M[n].title}配置已保存`}),!0}catch(I){return t({title:"保存失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"}),!1}finally{d(!1)}},L=async()=>{await z()&&n{n>0&&a(n-1)},R=async()=>{o(!0);try{if(!await z()){o(!1);return}await Sb(),t({title:"配置完成",description:"所有配置已保存,正在跳转..."}),setTimeout(()=>{e({to:"/"})},500)}catch(I){t({title:"完成失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"})}finally{o(!1)}},H=async()=>{try{await Sb(),e({to:"/"})}catch(I){t({title:"跳过失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"})}},$=()=>{switch(n){case 0:return r.jsx(EA,{config:p,onChange:x});case 1:return r.jsx(AA,{config:y,onChange:b});case 2:return r.jsx(DA,{config:j,onChange:k});case 3:return r.jsx(zA,{config:S,onChange:_});case 4:return r.jsxs("div",{className:"space-y-6 text-center py-8",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(mu,{className:"h-8 w-8 text-primary",strokeWidth:2})}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"text-xl font-semibold",children:"模型配置"}),r.jsx("p",{className:"text-muted-foreground max-w-md mx-auto",children:"为了让机器人正常工作,您需要配置 AI 模型提供商和模型。"})]}),r.jsxs("div",{className:"rounded-lg border bg-muted/50 p-6 max-w-md mx-auto text-left space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"mt-0.5",children:r.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"1"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"配置 API 提供商"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → API 提供商"中添加您的 API 提供商信息'})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"mt-0.5",children:r.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"2"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"添加模型"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型列表"中添加需要使用的模型'})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"mt-0.5",children:r.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"3"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"配置模型任务"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型任务配置"中为不同任务分配模型'})]})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"💡 提示:完成向导后,您可以在系统设置中进行详细的模型配置"})]});default:return null}};return r.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),r.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),m?r.jsxs("div",{className:"relative z-10 text-center",children:[r.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:r.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),r.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[r.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[r.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:r.jsx(hT,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),r.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),r.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",R1," 的初始配置"]})]}),r.jsxs("div",{className:"mb-6 md:mb-8",children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[r.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",M.length]}),r.jsxs("span",{className:"font-medium text-primary",children:[Math.round(D),"%"]})]}),r.jsx(Lu,{value:D,className:"h-2"})]}),r.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:M.map((I,G)=>{const te=I.icon;return r.jsxs("div",{className:me("flex flex-1 flex-col items-center gap-1 md:gap-2",Ge({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[r.jsx(K0,{className:"h-4 w-4"}),"返回首页"]}),r.jsxs(re,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[r.jsx(J5,{className:"h-4 w-4"}),"返回上一页"]})]}),r.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var u7=["PageUp","PageDown"],d7=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],m7={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Xo="Slider",[Tx,UA,$A]=vm(Xo),[h7]=Ha(Xo,[$A]),[VA,Om]=h7(Xo),f7=w.forwardRef((e,t)=>{const{name:n,min:a=0,max:l=100,step:o=1,orientation:c="horizontal",disabled:d=!1,minStepsBetweenThumbs:m=0,defaultValue:f=[a],value:p,onValueChange:x=()=>{},onValueCommit:y=()=>{},inverted:b=!1,form:j,...k}=e,S=w.useRef(new Set),_=w.useRef(0),D=c==="horizontal"?GA:YA,[z=[],L]=Dl({prop:p,defaultProp:f,onChange:G=>{[...S.current][_.current]?.focus(),x(G)}}),E=w.useRef(z);function R(G){const te=ZA(z,G);I(G,te)}function H(G){I(G,_.current)}function $(){const G=E.current[_.current];z[_.current]!==G&&y(z)}function I(G,te,{commit:we}={commit:!1}){const J=nD(o),ae=rD(Math.round((G-a)/o)*o+a,J),U=o1(ae,[a,l]);L((q=[])=>{const W=KA(q,U,te);if(tD(W,m*o)){_.current=W.indexOf(U);const oe=String(W)!==String(q);return oe&&we&&y(W),oe?W:q}else return q})}return r.jsx(VA,{scope:e.__scopeSlider,name:n,disabled:d,min:a,max:l,valueIndexToChangeRef:_,thumbs:S.current,values:z,orientation:c,form:j,children:r.jsx(Tx.Provider,{scope:e.__scopeSlider,children:r.jsx(Tx.Slot,{scope:e.__scopeSlider,children:r.jsx(D,{"aria-disabled":d,"data-disabled":d?"":void 0,...k,ref:t,onPointerDown:Pe(k.onPointerDown,()=>{d||(E.current=z)}),min:a,max:l,inverted:b,onSlideStart:d?void 0:R,onSlideMove:d?void 0:H,onSlideEnd:d?void 0:$,onHomeKeyDown:()=>!d&&I(a,0,{commit:!0}),onEndKeyDown:()=>!d&&I(l,z.length-1,{commit:!0}),onStepKeyDown:({event:G,direction:te})=>{if(!d){const ae=u7.includes(G.key)||G.shiftKey&&d7.includes(G.key)?10:1,U=_.current,q=z[U],W=o*ae*te;I(q+W,U,{commit:!0})}}})})})})});f7.displayName=Xo;var[p7,x7]=h7(Xo,{startEdge:"left",endEdge:"right",size:"width",direction:1}),GA=w.forwardRef((e,t)=>{const{min:n,max:a,dir:l,inverted:o,onSlideStart:c,onSlideMove:d,onSlideEnd:m,onStepKeyDown:f,...p}=e,[x,y]=w.useState(null),b=dn(t,D=>y(D)),j=w.useRef(void 0),k=Tu(l),S=k==="ltr",_=S&&!o||!S&&o;function M(D){const z=j.current||x.getBoundingClientRect(),L=[0,z.width],R=B1(L,_?[n,a]:[a,n]);return j.current=z,R(D-z.left)}return r.jsx(p7,{scope:e.__scopeSlider,startEdge:_?"left":"right",endEdge:_?"right":"left",direction:_?1:-1,size:"width",children:r.jsx(g7,{dir:k,"data-orientation":"horizontal",...p,ref:b,style:{...p.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:D=>{const z=M(D.clientX);c?.(z)},onSlideMove:D=>{const z=M(D.clientX);d?.(z)},onSlideEnd:()=>{j.current=void 0,m?.()},onStepKeyDown:D=>{const L=m7[_?"from-left":"from-right"].includes(D.key);f?.({event:D,direction:L?-1:1})}})})}),YA=w.forwardRef((e,t)=>{const{min:n,max:a,inverted:l,onSlideStart:o,onSlideMove:c,onSlideEnd:d,onStepKeyDown:m,...f}=e,p=w.useRef(null),x=dn(t,p),y=w.useRef(void 0),b=!l;function j(k){const S=y.current||p.current.getBoundingClientRect(),_=[0,S.height],D=B1(_,b?[a,n]:[n,a]);return y.current=S,D(k-S.top)}return r.jsx(p7,{scope:e.__scopeSlider,startEdge:b?"bottom":"top",endEdge:b?"top":"bottom",size:"height",direction:b?1:-1,children:r.jsx(g7,{"data-orientation":"vertical",...f,ref:x,style:{...f.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:k=>{const S=j(k.clientY);o?.(S)},onSlideMove:k=>{const S=j(k.clientY);c?.(S)},onSlideEnd:()=>{y.current=void 0,d?.()},onStepKeyDown:k=>{const _=m7[b?"from-bottom":"from-top"].includes(k.key);m?.({event:k,direction:_?-1:1})}})})}),g7=w.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:a,onSlideMove:l,onSlideEnd:o,onHomeKeyDown:c,onEndKeyDown:d,onStepKeyDown:m,...f}=e,p=Om(Xo,n);return r.jsx(Ft.span,{...f,ref:t,onKeyDown:Pe(e.onKeyDown,x=>{x.key==="Home"?(c(x),x.preventDefault()):x.key==="End"?(d(x),x.preventDefault()):u7.concat(d7).includes(x.key)&&(m(x),x.preventDefault())}),onPointerDown:Pe(e.onPointerDown,x=>{const y=x.target;y.setPointerCapture(x.pointerId),x.preventDefault(),p.thumbs.has(y)?y.focus():a(x)}),onPointerMove:Pe(e.onPointerMove,x=>{x.target.hasPointerCapture(x.pointerId)&&l(x)}),onPointerUp:Pe(e.onPointerUp,x=>{const y=x.target;y.hasPointerCapture(x.pointerId)&&(y.releasePointerCapture(x.pointerId),o(x))})})}),v7="SliderTrack",y7=w.forwardRef((e,t)=>{const{__scopeSlider:n,...a}=e,l=Om(v7,n);return r.jsx(Ft.span,{"data-disabled":l.disabled?"":void 0,"data-orientation":l.orientation,...a,ref:t})});y7.displayName=v7;var _x="SliderRange",b7=w.forwardRef((e,t)=>{const{__scopeSlider:n,...a}=e,l=Om(_x,n),o=x7(_x,n),c=w.useRef(null),d=dn(t,c),m=l.values.length,f=l.values.map(y=>N7(y,l.min,l.max)),p=m>1?Math.min(...f):0,x=100-Math.max(...f);return r.jsx(Ft.span,{"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,...a,ref:d,style:{...e.style,[o.startEdge]:p+"%",[o.endEdge]:x+"%"}})});b7.displayName=_x;var Mx="SliderThumb",w7=w.forwardRef((e,t)=>{const n=UA(e.__scopeSlider),[a,l]=w.useState(null),o=dn(t,d=>l(d)),c=w.useMemo(()=>a?n().findIndex(d=>d.ref.current===a):-1,[n,a]);return r.jsx(WA,{...e,ref:o,index:c})}),WA=w.forwardRef((e,t)=>{const{__scopeSlider:n,index:a,name:l,...o}=e,c=Om(Mx,n),d=x7(Mx,n),[m,f]=w.useState(null),p=dn(t,M=>f(M)),x=m?c.form||!!m.closest("form"):!0,y=z5(m),b=c.values[a],j=b===void 0?0:N7(b,c.min,c.max),k=QA(a,c.values.length),S=y?.[d.size],_=S?JA(S,j,d.direction):0;return w.useEffect(()=>{if(m)return c.thumbs.add(m),()=>{c.thumbs.delete(m)}},[m,c.thumbs]),r.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[d.startEdge]:`calc(${j}% + ${_}px)`},children:[r.jsx(Tx.ItemSlot,{scope:e.__scopeSlider,children:r.jsx(Ft.span,{role:"slider","aria-label":e["aria-label"]||k,"aria-valuemin":c.min,"aria-valuenow":b,"aria-valuemax":c.max,"aria-orientation":c.orientation,"data-orientation":c.orientation,"data-disabled":c.disabled?"":void 0,tabIndex:c.disabled?void 0:0,...o,ref:p,style:b===void 0?{display:"none"}:e.style,onFocus:Pe(e.onFocus,()=>{c.valueIndexToChangeRef.current=a})})}),x&&r.jsx(j7,{name:l??(c.name?c.name+(c.values.length>1?"[]":""):void 0),form:c.form,value:b},a)]})});w7.displayName=Mx;var XA="RadioBubbleInput",j7=w.forwardRef(({__scopeSlider:e,value:t,...n},a)=>{const l=w.useRef(null),o=dn(l,a),c=D5(t);return w.useEffect(()=>{const d=l.current;if(!d)return;const m=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(m,"value").set;if(c!==t&&p){const x=new Event("input",{bubbles:!0});p.call(d,t),d.dispatchEvent(x)}},[c,t]),r.jsx(Ft.input,{style:{display:"none"},...n,ref:o,defaultValue:t})});j7.displayName=XA;function KA(e=[],t,n){const a=[...e];return a[n]=t,a.sort((l,o)=>l-o)}function N7(e,t,n){const o=100/(n-t)*(e-t);return o1(o,[0,100])}function QA(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function ZA(e,t){if(e.length===1)return 0;const n=e.map(l=>Math.abs(l-t)),a=Math.min(...n);return n.indexOf(a)}function JA(e,t,n){const a=e/2,o=B1([0,50],[0,a]);return(a-o(t)*n)*n}function eD(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function tD(e,t){if(t>0){const n=eD(e);return Math.min(...n)>=t}return!0}function B1(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const a=(t[1]-t[0])/(e[1]-e[0]);return t[0]+a*(n-e[0])}}function nD(e){return(String(e).split(".")[1]||"").length}function rD(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var S7=f7,aD=y7,sD=b7,lD=w7;const Rm=w.forwardRef(({className:e,...t},n)=>r.jsxs(S7,{ref:n,className:me("relative flex w-full touch-none select-none items-center",e),...t,children:[r.jsx(aD,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:r.jsx(sD,{className:"absolute h-full bg-primary"})}),r.jsx(lD,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));Rm.displayName=S7.displayName;const _t=ZC,Mt=JC,jt=w.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(L5,{ref:a,className:me("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,r.jsx(YC,{asChild:!0,children:r.jsx(hu,{className:"h-4 w-4 opacity-50"})})]}));jt.displayName=L5.displayName;const k7=w.forwardRef(({className:e,...t},n)=>r.jsx(P5,{ref:n,className:me("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(vx,{className:"h-4 w-4"})}));k7.displayName=P5.displayName;const C7=w.forwardRef(({className:e,...t},n)=>r.jsx(F5,{ref:n,className:me("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(hu,{className:"h-4 w-4"})}));C7.displayName=F5.displayName;const Nt=w.forwardRef(({className:e,children:t,position:n="popper",...a},l)=>r.jsx(WC,{children:r.jsxs(I5,{ref:l,className:me("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 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 origin-[--radix-select-content-transform-origin]",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",e),position:n,...a,children:[r.jsx(k7,{}),r.jsx(XC,{className:me("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(C7,{})]})}));Nt.displayName=I5.displayName;const iD=w.forwardRef(({className:e,...t},n)=>r.jsx(q5,{ref:n,className:me("px-2 py-1.5 text-sm font-semibold",e),...t}));iD.displayName=q5.displayName;const ze=w.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(H5,{ref:a,className:me("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(KC,{children:r.jsx(di,{className:"h-4 w-4"})})}),r.jsx(QC,{children:t})]}));ze.displayName=H5.displayName;const oD=w.forwardRef(({className:e,...t},n)=>r.jsx(U5,{ref:n,className:me("-mx-1 my-1 h-px bg-muted",e),...t}));oD.displayName=U5.displayName;function cD(e){const t=uD(e),n=w.forwardRef((a,l)=>{const{children:o,...c}=a,d=w.Children.toArray(o),m=d.find(mD);if(m){const f=m.props.children,p=d.map(x=>x===m?w.Children.count(f)>1?w.Children.only(null):w.isValidElement(f)?f.props.children:null:x);return r.jsx(t,{...c,ref:l,children:w.isValidElement(f)?w.cloneElement(f,void 0,p):null})}return r.jsx(t,{...c,ref:l,children:o})});return n.displayName=`${e}.Slot`,n}function uD(e){const t=w.forwardRef((n,a)=>{const{children:l,...o}=n;if(w.isValidElement(l)){const c=fD(l),d=hD(o,l.props);return l.type!==w.Fragment&&(d.ref=a?Nl(a,c):c),w.cloneElement(l,d)}return w.Children.count(l)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var dD=Symbol("radix.slottable");function mD(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===dD}function hD(e,t){const n={...t};for(const a in t){const l=e[a],o=t[a];/^on[A-Z]/.test(a)?l&&o?n[a]=(...d)=>{const m=o(...d);return l(...d),m}:l&&(n[a]=l):a==="style"?n[a]={...l,...o}:a==="className"&&(n[a]=[l,o].filter(Boolean).join(" "))}return{...e,...n}}function fD(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Bm="Popover",[T7]=Ha(Bm,[Uo]),Pu=Uo(),[pD,zl]=T7(Bm),_7=e=>{const{__scopePopover:t,children:n,open:a,defaultOpen:l,onOpenChange:o,modal:c=!1}=e,d=Pu(t),m=w.useRef(null),[f,p]=w.useState(!1),[x,y]=Dl({prop:a,defaultProp:l??!1,onChange:o,caller:Bm});return r.jsx(jm,{...d,children:r.jsx(pD,{scope:t,contentId:Ta(),triggerRef:m,open:x,onOpenChange:y,onOpenToggle:w.useCallback(()=>y(b=>!b),[y]),hasCustomAnchor:f,onCustomAnchorAdd:w.useCallback(()=>p(!0),[]),onCustomAnchorRemove:w.useCallback(()=>p(!1),[]),modal:c,children:n})})};_7.displayName=Bm;var M7="PopoverAnchor",xD=w.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,l=zl(M7,n),o=Pu(n),{onCustomAnchorAdd:c,onCustomAnchorRemove:d}=l;return w.useEffect(()=>(c(),()=>d()),[c,d]),r.jsx(Nm,{...o,...a,ref:t})});xD.displayName=M7;var E7="PopoverTrigger",A7=w.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,l=zl(E7,n),o=Pu(n),c=dn(t,l.triggerRef),d=r.jsx(Ft.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":B7(l.open),...a,ref:c,onClick:Pe(e.onClick,l.onOpenToggle)});return l.hasCustomAnchor?d:r.jsx(Nm,{asChild:!0,...o,children:d})});A7.displayName=E7;var L1="PopoverPortal",[gD,vD]=T7(L1,{forceMount:void 0}),D7=e=>{const{__scopePopover:t,forceMount:n,children:a,container:l}=e,o=zl(L1,t);return r.jsx(gD,{scope:t,forceMount:n,children:r.jsx(Wr,{present:n||o.open,children:r.jsx(wm,{asChild:!0,container:l,children:a})})})};D7.displayName=L1;var Fo="PopoverContent",z7=w.forwardRef((e,t)=>{const n=vD(Fo,e.__scopePopover),{forceMount:a=n.forceMount,...l}=e,o=zl(Fo,e.__scopePopover);return r.jsx(Wr,{present:a||o.open,children:o.modal?r.jsx(bD,{...l,ref:t}):r.jsx(wD,{...l,ref:t})})});z7.displayName=Fo;var yD=cD("PopoverContent.RemoveScroll"),bD=w.forwardRef((e,t)=>{const n=zl(Fo,e.__scopePopover),a=w.useRef(null),l=dn(t,a),o=w.useRef(!1);return w.useEffect(()=>{const c=a.current;if(c)return $5(c)},[]),r.jsx(V5,{as:yD,allowPinchZoom:!0,children:r.jsx(O7,{...e,ref:l,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Pe(e.onCloseAutoFocus,c=>{c.preventDefault(),o.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Pe(e.onPointerDownOutside,c=>{const d=c.detail.originalEvent,m=d.button===0&&d.ctrlKey===!0,f=d.button===2||m;o.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:Pe(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1})})})}),wD=w.forwardRef((e,t)=>{const n=zl(Fo,e.__scopePopover),a=w.useRef(!1),l=w.useRef(!1);return r.jsx(O7,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(a.current||n.triggerRef.current?.focus(),o.preventDefault()),a.current=!1,l.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(a.current=!0,o.detail.originalEvent.type==="pointerdown"&&(l.current=!0));const c=o.target;n.triggerRef.current?.contains(c)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&l.current&&o.preventDefault()}})}),O7=w.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:o,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:f,onInteractOutside:p,...x}=e,y=zl(Fo,n),b=Pu(n);return G5(),r.jsx(Y5,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:l,onUnmountAutoFocus:o,children:r.jsx(p1,{asChild:!0,disableOutsidePointerEvents:c,onInteractOutside:p,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:f,onDismiss:()=>y.onOpenChange(!1),children:r.jsx(x1,{"data-state":B7(y.open),role:"dialog",id:y.contentId,...b,...x,ref:t,style:{...x.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),R7="PopoverClose",jD=w.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,l=zl(R7,n);return r.jsx(Ft.button,{type:"button",...a,ref:t,onClick:Pe(e.onClick,()=>l.onOpenChange(!1))})});jD.displayName=R7;var ND="PopoverArrow",SD=w.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,l=Pu(n);return r.jsx(g1,{...l,...a,ref:t})});SD.displayName=ND;function B7(e){return e?"open":"closed"}var kD=_7,CD=A7,TD=D7,L7=z7;const kl=kD,Cl=CD,Ps=w.forwardRef(({className:e,align:t="center",sideOffset:n=4,...a},l)=>r.jsx(TD,{children:r.jsx(L7,{ref:l,align:t,sideOffset:n,className:me("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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 origin-[--radix-popover-content-transform-origin]",e),...a})}));Ps.displayName=L7.displayName;const Ko="/api/webui/config";async function _D(){const t=await(await ut(`${Ko}/bot`)).json();if(!t.success)throw new Error("获取配置数据失败");return t.config}async function Ao(){const t=await(await ut(`${Ko}/model`)).json();if(!t.success)throw new Error("获取模型配置数据失败");return t.config}async function kb(e){const n=await(await ut(`${Ko}/bot`,{method:"POST",headers:yt(),body:JSON.stringify(e)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function lm(e){const n=await(await ut(`${Ko}/model`,{method:"POST",headers:yt(),body:JSON.stringify(e)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function MD(e,t){const a=await(await ut(`${Ko}/bot/section/${e}`,{method:"POST",headers:yt(),body:JSON.stringify(t)})).json();if(!a.success)throw new Error(a.message||`保存配置节 ${e} 失败`)}async function Ex(e,t){const a=await(await ut(`${Ko}/model/section/${e}`,{method:"POST",headers:yt(),body:JSON.stringify(t)})).json();if(!a.success)throw new Error(a.message||`保存配置节 ${e} 失败`)}const ED=Mn.create({baseURL:"",timeout:1e4});async function P1(){try{return(await ED.post("/api/webui/system/restart")).data}catch(e){throw console.error("重启麦麦失败:",e),e}}const AD=Wo("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Fu=w.forwardRef(({className:e,variant:t,...n},a)=>r.jsx("div",{ref:a,role:"alert",className:me(AD({variant:t}),e),...n}));Fu.displayName="Alert";const DD=w.forwardRef(({className:e,...t},n)=>r.jsx("h5",{ref:n,className:me("mb-1 font-medium leading-none tracking-tight",e),...t}));DD.displayName="AlertTitle";const Iu=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:me("text-sm [&_p]:leading-relaxed",e),...t}));Iu.displayName="AlertDescription";function F1({onRestartComplete:e,onRestartFailed:t}){const[n,a]=w.useState(0),[l,o]=w.useState("restarting"),[c,d]=w.useState(0),[m,f]=w.useState(0);w.useEffect(()=>{const y=setInterval(()=>{a(k=>k>=90?k:k+1)},200),b=setInterval(()=>{d(k=>k+1)},1e3),j=setTimeout(()=>{o("checking"),p()},3e3);return()=>{clearInterval(y),clearInterval(b),clearTimeout(j)}},[]);const p=()=>{const b=async()=>{try{if(f(k=>k+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)a(100),o("success"),setTimeout(()=>{e?.()},1500);else throw new Error("Status check failed")}catch{m<60?setTimeout(b,2e3):(o("failed"),t?.())}};b()},x=y=>{const b=Math.floor(y/60),j=y%60;return`${b}:${j.toString().padStart(2,"0")}`};return r.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:r.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[r.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[l==="restarting"&&r.jsxs(r.Fragment,{children:[r.jsx(fu,{className:"h-16 w-16 text-primary animate-spin"}),r.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),r.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),l==="checking"&&r.jsxs(r.Fragment,{children:[r.jsx(fu,{className:"h-16 w-16 text-primary animate-spin"}),r.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),r.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",m,"/60)"]})]}),l==="success"&&r.jsxs(r.Fragment,{children:[r.jsx(Ur,{className:"h-16 w-16 text-green-500"}),r.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),r.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),l==="failed"&&r.jsxs(r.Fragment,{children:[r.jsx(fi,{className:"h-16 w-16 text-destructive"}),r.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),r.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),l!=="failed"&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Lu,{value:n,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[n,"%"]}),r.jsxs("span",{children:["已用时: ",x(c)]})]})]}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:r.jsxs("p",{className:"text-sm text-muted-foreground",children:[l==="restarting"&&"🔄 配置已保存,正在重启主程序...",l==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",l==="success"&&"✅ 配置已生效,服务运行正常",l==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),l==="failed"&&r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),r.jsx("button",{onClick:()=>{o("checking"),f(0),p()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}function zD(){const[e,t]=w.useState(!0),[n,a]=w.useState(!1),[l,o]=w.useState(!1),[c,d]=w.useState(!1),[m,f]=w.useState(!1),[p,x]=w.useState(!1),{toast:y}=pr(),[b,j]=w.useState(null),[k,S]=w.useState(null),[_,M]=w.useState(null),[D,z]=w.useState(null),[L,E]=w.useState(null),[R,H]=w.useState(null),[$,I]=w.useState(null),[G,te]=w.useState(null),[we,J]=w.useState(null),[ae,U]=w.useState(null),[q,W]=w.useState(null),[oe,P]=w.useState(null),[je,Z]=w.useState(null),[O,Ne]=w.useState(null),[se,Ce]=w.useState(null),[ye,Be]=w.useState(null),[ie,He]=w.useState(null),[lt,ve]=w.useState(null),Ze=w.useRef(null),We=w.useRef(!0),pn=w.useRef({}),Bn=w.useCallback(async()=>{try{t(!0);const Ue=await _D();pn.current=Ue,j(Ue.bot),S(Ue.personality);const Ln=Ue.chat;Ln.talk_value_rules||(Ln.talk_value_rules=[]),M(Ln),z(Ue.expression),E(Ue.emoji),H(Ue.memory),I(Ue.tool),te(Ue.mood),J(Ue.voice),U(Ue.lpmm_knowledge),W(Ue.keyword_reaction),P(Ue.response_post_process),Z(Ue.chinese_typo),Ne(Ue.response_splitter),Ce(Ue.log),Be(Ue.debug),He(Ue.maim_message),ve(Ue.telemetry),d(!1),We.current=!1}catch(Ue){console.error("加载配置失败:",Ue),y({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{t(!1)}},[y]);w.useEffect(()=>{Bn()},[Bn]);const sr=w.useCallback(async(Ue,Ln)=>{if(!We.current)try{o(!0),await MD(Ue,Ln),d(!1)}catch(K){console.error(`自动保存 ${Ue} 失败:`,K),d(!0)}finally{o(!1)}},[]),Qe=w.useCallback((Ue,Ln)=>{We.current||(d(!0),Ze.current&&clearTimeout(Ze.current),Ze.current=setTimeout(()=>{sr(Ue,Ln)},2e3))},[sr]);w.useEffect(()=>{b&&!We.current&&Qe("bot",b)},[b,Qe]),w.useEffect(()=>{k&&!We.current&&Qe("personality",k)},[k,Qe]),w.useEffect(()=>{_&&!We.current&&Qe("chat",_)},[_,Qe]),w.useEffect(()=>{D&&!We.current&&Qe("expression",D)},[D,Qe]),w.useEffect(()=>{L&&!We.current&&Qe("emoji",L)},[L,Qe]),w.useEffect(()=>{R&&!We.current&&Qe("memory",R)},[R,Qe]),w.useEffect(()=>{$&&!We.current&&Qe("tool",$)},[$,Qe]),w.useEffect(()=>{G&&!We.current&&Qe("mood",G)},[G,Qe]),w.useEffect(()=>{we&&!We.current&&Qe("voice",we)},[we,Qe]),w.useEffect(()=>{ae&&!We.current&&Qe("lpmm_knowledge",ae)},[ae,Qe]),w.useEffect(()=>{q&&!We.current&&Qe("keyword_reaction",q)},[q,Qe]),w.useEffect(()=>{oe&&!We.current&&Qe("response_post_process",oe)},[oe,Qe]),w.useEffect(()=>{je&&!We.current&&Qe("chinese_typo",je)},[je,Qe]),w.useEffect(()=>{O&&!We.current&&Qe("response_splitter",O)},[O,Qe]),w.useEffect(()=>{se&&!We.current&&Qe("log",se)},[se,Qe]),w.useEffect(()=>{ye&&!We.current&&Qe("debug",ye)},[ye,Qe]),w.useEffect(()=>{ie&&!We.current&&Qe("maim_message",ie)},[ie,Qe]),w.useEffect(()=>{lt&&!We.current&&Qe("telemetry",lt)},[lt,Qe]);const Gn=async()=>{try{a(!0),Ze.current&&clearTimeout(Ze.current);const Ue={...pn.current,bot:b,personality:k,chat:_,expression:D,emoji:L,memory:R,tool:$,mood:G,voice:we,lpmm_knowledge:ae,keyword_reaction:q,response_post_process:oe,chinese_typo:je,response_splitter:O,log:se,debug:ye,maim_message:ie,telemetry:lt};await kb(Ue),d(!1),y({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(Ue){console.error("保存配置失败:",Ue),y({title:"保存失败",description:Ue.message,variant:"destructive"})}finally{a(!1)}},Sr=async()=>{try{f(!0),P1().catch(()=>{}),x(!0)}catch(Ue){console.error("重启失败:",Ue),x(!1),y({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),f(!1)}},Er=async()=>{try{a(!0),Ze.current&&clearTimeout(Ze.current);const Ue={...pn.current,bot:b,personality:k,chat:_,expression:D,emoji:L,memory:R,tool:$,mood:G,voice:we,lpmm_knowledge:ae,keyword_reaction:q,response_post_process:oe,chinese_typo:je,response_splitter:O,log:se,debug:ye,maim_message:ie,telemetry:lt};await kb(Ue),d(!1),y({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(Ln=>setTimeout(Ln,500)),await Sr()}catch(Ue){console.error("保存失败:",Ue),y({title:"保存失败",description:Ue.message,variant:"destructive"})}finally{a(!1)}},Sn=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},lr=()=>{x(!1),f(!1),y({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return e?r.jsx(Xt,{className:"h-full",children:r.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):r.jsx(Xt,{className:"h-full",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),r.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),r.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[r.jsxs(re,{onClick:Gn,disabled:n||l||!c||m,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[r.jsx(y1,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":l?"自动保存中...":c?"保存配置":"已保存"]}),r.jsxs(cn,{children:[r.jsx(Xn,{asChild:!0,children:r.jsxs(re,{disabled:n||l||m,size:"sm",className:"flex-1 sm:flex-none",children:[r.jsx(b1,{className:"mr-2 h-4 w-4"}),m?"重启中...":c?"保存并重启":"重启麦麦"]})}),r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认重启麦麦?"}),r.jsx(en,{children:c?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:c?Er:Sr,children:c?"保存并重启":"确认重启"})]})]})]})]})]}),r.jsxs(Fu,{children:[r.jsx(hi,{className:"h-4 w-4"}),r.jsxs(Iu,{children:["配置更新后需要",r.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),r.jsxs(Sl,{defaultValue:"bot",className:"w-full",children:[r.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:r.jsxs(Ls,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[r.jsx(Rt,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),r.jsx(Rt,{value:"personality",className:"flex-shrink-0",children:"人格"}),r.jsx(Rt,{value:"chat",className:"flex-shrink-0",children:"聊天"}),r.jsx(Rt,{value:"expression",className:"flex-shrink-0",children:"表达"}),r.jsx(Rt,{value:"features",className:"flex-shrink-0",children:"功能"}),r.jsx(Rt,{value:"processing",className:"flex-shrink-0",children:"处理"}),r.jsx(Rt,{value:"mood",className:"flex-shrink-0",children:"情绪"}),r.jsx(Rt,{value:"voice",className:"flex-shrink-0",children:"语音"}),r.jsx(Rt,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),r.jsx(Rt,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),r.jsx(ln,{value:"bot",className:"space-y-4",children:b&&r.jsx(OD,{config:b,onChange:j})}),r.jsx(ln,{value:"personality",className:"space-y-4",children:k&&r.jsx(RD,{config:k,onChange:S})}),r.jsx(ln,{value:"chat",className:"space-y-4",children:_&&r.jsx(BD,{config:_,onChange:M})}),r.jsx(ln,{value:"expression",className:"space-y-4",children:D&&r.jsx(LD,{config:D,onChange:z})}),r.jsx(ln,{value:"features",className:"space-y-4",children:L&&R&&$&&r.jsx(PD,{emojiConfig:L,memoryConfig:R,toolConfig:$,onEmojiChange:E,onMemoryChange:H,onToolChange:I})}),r.jsx(ln,{value:"processing",className:"space-y-4",children:q&&oe&&je&&O&&r.jsx(FD,{keywordReactionConfig:q,responsePostProcessConfig:oe,chineseTypoConfig:je,responseSplitterConfig:O,onKeywordReactionChange:W,onResponsePostProcessChange:P,onChineseTypoChange:Z,onResponseSplitterChange:Ne})}),r.jsx(ln,{value:"mood",className:"space-y-4",children:G&&r.jsx(ID,{config:G,onChange:te})}),r.jsx(ln,{value:"voice",className:"space-y-4",children:we&&r.jsx(qD,{config:we,onChange:J})}),r.jsx(ln,{value:"lpmm",className:"space-y-4",children:ae&&r.jsx(HD,{config:ae,onChange:U})}),r.jsxs(ln,{value:"other",className:"space-y-4",children:[se&&r.jsx(UD,{config:se,onChange:Ce}),ye&&r.jsx($D,{config:ye,onChange:Be}),ie&&r.jsx(VD,{config:ie,onChange:He}),lt&&r.jsx(GD,{config:lt,onChange:ve})]})]}),p&&r.jsx(F1,{onRestartComplete:Sn,onRestartFailed:lr})]})})}function OD({config:e,onChange:t}){const n=()=>{t({...e,platforms:[...e.platforms,""]})},a=m=>{t({...e,platforms:e.platforms.filter((f,p)=>p!==m)})},l=(m,f)=>{const p=[...e.platforms];p[m]=f,t({...e,platforms:p})},o=()=>{t({...e,alias_names:[...e.alias_names,""]})},c=m=>{t({...e,alias_names:e.alias_names.filter((f,p)=>p!==m)})},d=(m,f)=>{const p=[...e.alias_names];p[m]=f,t({...e,alias_names:p})};return r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"platform",children:"平台"}),r.jsx(Te,{id:"platform",value:e.platform,onChange:m=>t({...e,platform:m.target.value}),placeholder:"qq"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"qq_account",children:"QQ账号"}),r.jsx(Te,{id:"qq_account",value:e.qq_account,onChange:m=>t({...e,qq_account:m.target.value}),placeholder:"123456789"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"nickname",children:"昵称"}),r.jsx(Te,{id:"nickname",value:e.nickname,onChange:m=>t({...e,nickname:m.target.value}),placeholder:"麦麦"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{children:"其他平台账号"}),r.jsxs(re,{onClick:n,size:"sm",variant:"outline",children:[r.jsx(mr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),r.jsxs("div",{className:"space-y-2",children:[e.platforms.map((m,f)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{value:m,onChange:p=>l(f,p.target.value),placeholder:"wx:114514"}),r.jsxs(cn,{children:[r.jsx(Xn,{asChild:!0,children:r.jsx(re,{size:"icon",variant:"outline",children:r.jsx(Ot,{className:"h-4 w-4"})})}),r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认删除"}),r.jsxs(en,{children:['确定要删除平台账号 "',m||"(空)",'" 吗?此操作无法撤销。']})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:()=>a(f),children:"删除"})]})]})]})]},f)),e.platforms.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{children:"别名"}),r.jsxs(re,{onClick:o,size:"sm",variant:"outline",children:[r.jsx(mr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),r.jsxs("div",{className:"space-y-2",children:[e.alias_names.map((m,f)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{value:m,onChange:p=>d(f,p.target.value),placeholder:"小麦"}),r.jsxs(cn,{children:[r.jsx(Xn,{asChild:!0,children:r.jsx(re,{size:"icon",variant:"outline",children:r.jsx(Ot,{className:"h-4 w-4"})})}),r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认删除"}),r.jsxs(en,{children:['确定要删除别名 "',m||"(空)",'" 吗?此操作无法撤销。']})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:()=>c(f),children:"删除"})]})]})]})]},f)),e.alias_names.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function RD({config:e,onChange:t}){const n=()=>{t({...e,states:[...e.states,""]})},a=o=>{t({...e,states:e.states.filter((c,d)=>d!==o)})},l=(o,c)=>{const d=[...e.states];d[o]=c,t({...e,states:d})};return r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"personality",children:"人格特质"}),r.jsx(vn,{id:"personality",value:e.personality,onChange:o=>t({...e,personality:o.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"reply_style",children:"表达风格"}),r.jsx(vn,{id:"reply_style",value:e.reply_style,onChange:o=>t({...e,reply_style:o.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"interest",children:"兴趣"}),r.jsx(vn,{id:"interest",value:e.interest,onChange:o=>t({...e,interest:o.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"plan_style",children:"说话规则与行为风格"}),r.jsx(vn,{id:"plan_style",value:e.plan_style,onChange:o=>t({...e,plan_style:o.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"visual_style",children:"识图规则"}),r.jsx(vn,{id:"visual_style",value:e.visual_style,onChange:o=>t({...e,visual_style:o.target.value}),placeholder:"识图时的处理规则",rows:3})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"private_plan_style",children:"私聊规则"}),r.jsx(vn,{id:"private_plan_style",value:e.private_plan_style,onChange:o=>t({...e,private_plan_style:o.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{children:"状态列表(人格多样性)"}),r.jsxs(re,{onClick:n,size:"sm",variant:"outline",children:[r.jsx(mr,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),r.jsx("div",{className:"space-y-2",children:e.states.map((o,c)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(vn,{value:o,onChange:d=>l(c,d.target.value),placeholder:"描述一个人格状态",rows:2}),r.jsxs(cn,{children:[r.jsx(Xn,{asChild:!0,children:r.jsx(re,{size:"icon",variant:"outline",children:r.jsx(Ot,{className:"h-4 w-4"})})}),r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认删除"}),r.jsx(en,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:()=>a(c),children:"删除"})]})]})]})]},c))})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"state_probability",children:"状态替换概率"}),r.jsx(Te,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:e.state_probability,onChange:o=>t({...e,state_probability:parseFloat(o.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function BD({config:e,onChange:t}){const n=()=>{t({...e,talk_value_rules:[...e.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},a=d=>{t({...e,talk_value_rules:e.talk_value_rules.filter((m,f)=>f!==d)})},l=(d,m,f)=>{const p=[...e.talk_value_rules];p[d]={...p[d],[m]:f},t({...e,talk_value_rules:p})},o=({value:d,onChange:m})=>{const[f,p]=w.useState("00"),[x,y]=w.useState("00"),[b,j]=w.useState("23"),[k,S]=w.useState("59");w.useEffect(()=>{const M=d.split("-");if(M.length===2){const[D,z]=M,[L,E]=D.split(":"),[R,H]=z.split(":");L&&p(L.padStart(2,"0")),E&&y(E.padStart(2,"0")),R&&j(R.padStart(2,"0")),H&&S(H.padStart(2,"0"))}},[d]);const _=(M,D,z,L)=>{const E=`${M}:${D}-${z}:${L}`;m(E)};return r.jsxs(kl,{children:[r.jsx(Cl,{asChild:!0,children:r.jsxs(re,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[r.jsx(ui,{className:"h-4 w-4 mr-2"}),d||"选择时间段"]})}),r.jsx(Ps,{className:"w-80",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-xs",children:"小时"}),r.jsxs(_t,{value:f,onValueChange:M=>{p(M),_(M,x,b,k)},children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsx(Nt,{children:Array.from({length:24},(M,D)=>D).map(M=>r.jsx(ze,{value:M.toString().padStart(2,"0"),children:M.toString().padStart(2,"0")},M))})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-xs",children:"分钟"}),r.jsxs(_t,{value:x,onValueChange:M=>{y(M),_(f,M,b,k)},children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsx(Nt,{children:Array.from({length:60},(M,D)=>D).map(M=>r.jsx(ze,{value:M.toString().padStart(2,"0"),children:M.toString().padStart(2,"0")},M))})]})]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-xs",children:"小时"}),r.jsxs(_t,{value:b,onValueChange:M=>{j(M),_(f,x,M,k)},children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsx(Nt,{children:Array.from({length:24},(M,D)=>D).map(M=>r.jsx(ze,{value:M.toString().padStart(2,"0"),children:M.toString().padStart(2,"0")},M))})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-xs",children:"分钟"}),r.jsxs(_t,{value:k,onValueChange:M=>{S(M),_(f,x,b,M)},children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsx(Nt,{children:Array.from({length:60},(M,D)=>D).map(M=>r.jsx(ze,{value:M.toString().padStart(2,"0"),children:M.toString().padStart(2,"0")},M))})]})]})]})]})]})})]})},c=({rule:d})=>{const m=`{ target = "${d.target}", time = "${d.time}", value = ${d.value.toFixed(1)} }`;return r.jsxs(kl,{children:[r.jsx(Cl,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",children:[r.jsx(qa,{className:"h-4 w-4 mr-1"}),"预览"]})}),r.jsx(Ps,{className:"w-96",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),r.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:m}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),r.jsx(Te,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:e.talk_value,onChange:d=>t({...e,talk_value:parseFloat(d.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"mentioned_bot_reply",children:"提及回复增幅"}),r.jsx(Te,{id:"mentioned_bot_reply",type:"number",step:"0.1",min:"0",max:"1",value:e.mentioned_bot_reply,onChange:d=>t({...e,mentioned_bot_reply:parseFloat(d.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"提及时回复概率增幅,1 为 100% 回复"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"max_context_size",children:"上下文长度"}),r.jsx(Te,{id:"max_context_size",type:"number",min:"1",value:e.max_context_size,onChange:d=>t({...e,max_context_size:parseInt(d.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"planner_smooth",children:"规划器平滑"}),r.jsx(Te,{id:"planner_smooth",type:"number",step:"1",min:"0",value:e.planner_smooth,onChange:d=>t({...e,planner_smooth:parseFloat(d.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gt,{id:"enable_talk_value_rules",checked:e.enable_talk_value_rules,onCheckedChange:d=>t({...e,enable_talk_value_rules:d})}),r.jsx(Q,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gt,{id:"include_planner_reasoning",checked:e.include_planner_reasoning,onCheckedChange:d=>t({...e,include_planner_reasoning:d})}),r.jsx(Q,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),e.enable_talk_value_rules&&r.jsxs("div",{className:"border-t pt-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),r.jsxs(re,{onClick:n,size:"sm",children:[r.jsx(mr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),e.talk_value_rules&&e.talk_value_rules.length>0?r.jsx("div",{className:"space-y-4",children:e.talk_value_rules.map((d,m)=>r.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",m+1]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(c,{rule:d}),r.jsxs(cn,{children:[r.jsx(Xn,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"sm",children:r.jsx(Ot,{className:"h-4 w-4 text-destructive"})})}),r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认删除"}),r.jsxs(en,{children:["确定要删除规则 #",m+1," 吗?此操作无法撤销。"]})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:()=>a(m),children:"删除"})]})]})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"配置类型"}),r.jsxs(_t,{value:d.target===""?"global":"specific",onValueChange:f=>{f==="global"?l(m,"target",""):l(m,"target","qq::group")},children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"global",children:"全局配置"}),r.jsx(ze,{value:"specific",children:"详细配置"})]})]})]}),d.target!==""&&(()=>{const f=d.target.split(":"),p=f[0]||"qq",x=f[1]||"",y=f[2]||"group";return r.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"平台"}),r.jsxs(_t,{value:p,onValueChange:b=>{l(m,"target",`${b}:${x}:${y}`)},children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"qq",children:"QQ"}),r.jsx(ze,{value:"wx",children:"微信"})]})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"群 ID"}),r.jsx(Te,{value:x,onChange:b=>{l(m,"target",`${p}:${b.target.value}:${y}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"类型"}),r.jsxs(_t,{value:y,onValueChange:b=>{l(m,"target",`${p}:${x}:${b}`)},children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"group",children:"群组(group)"}),r.jsx(ze,{value:"private",children:"私聊(private)"})]})]})]})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",d.target||"(未设置)"]})]})})(),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"时间段 (Time)"}),r.jsx(o,{value:d.time,onChange:f=>l(m,"time",f)}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{htmlFor:`rule-value-${m}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),r.jsx(Te,{id:`rule-value-${m}`,type:"number",step:"0.01",min:"0",max:"1",value:d.value,onChange:f=>{const p=parseFloat(f.target.value);isNaN(p)||l(m,"value",Math.max(0,Math.min(1,p)))},className:"w-20 h-8 text-xs"})]}),r.jsx(Rm,{value:[d.value],onValueChange:f=>l(m,"value",f[0]),min:0,max:1,step:.01,className:"w-full"}),r.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[r.jsx("span",{children:"0 (完全沉默)"}),r.jsx("span",{children:"0.5"}),r.jsx("span",{children:"1.0 (正常)"})]})]})]})]},m))}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:r.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),r.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[r.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),r.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[r.jsxs("li",{children:["• ",r.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),r.jsxs("li",{children:["• ",r.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),r.jsxs("li",{children:["• ",r.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),r.jsxs("li",{children:["• ",r.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),r.jsxs("li",{children:["• ",r.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function LD({config:e,onChange:t}){const n=()=>{t({...e,learning_list:[...e.learning_list,["","enable","enable","1.0"]]})},a=y=>{t({...e,learning_list:e.learning_list.filter((b,j)=>j!==y)})},l=(y,b,j)=>{const k=[...e.learning_list];k[y][b]=j,t({...e,learning_list:k})},o=({rule:y})=>{const b=`["${y[0]}", "${y[1]}", "${y[2]}", "${y[3]}"]`;return r.jsxs(kl,{children:[r.jsx(Cl,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",children:[r.jsx(qa,{className:"h-4 w-4 mr-1"}),"预览"]})}),r.jsx(Ps,{className:"w-96",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),r.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:b}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},c=({member:y,groupIndex:b,memberIndex:j,availableChatIds:k})=>{const S=k.includes(y)||y==="*",[_,M]=w.useState(!S);return r.jsxs("div",{className:"flex gap-2",children:[r.jsx("div",{className:"flex-1 flex gap-2",children:_?r.jsxs(r.Fragment,{children:[r.jsx(Te,{value:y,onChange:D=>x(b,j,D.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),k.length>0&&r.jsx(re,{size:"sm",variant:"outline",onClick:()=>M(!1),title:"切换到下拉选择",children:"下拉"})]}):r.jsxs(r.Fragment,{children:[r.jsxs(_t,{value:y,onValueChange:D=>x(b,j,D),children:[r.jsx(jt,{className:"flex-1",children:r.jsx(Mt,{placeholder:"选择聊天流"})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"*",children:"* (全局共享)"}),k.map((D,z)=>r.jsx(ze,{value:D,children:D},z))]})]}),r.jsx(re,{size:"sm",variant:"outline",onClick:()=>M(!0),title:"切换到手动输入",children:"输入"})]})}),r.jsxs(cn,{children:[r.jsx(Xn,{asChild:!0,children:r.jsx(re,{size:"icon",variant:"outline",children:r.jsx(Ot,{className:"h-4 w-4"})})}),r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认删除"}),r.jsxs(en,{children:['确定要删除组成员 "',y||"(空)",'" 吗?此操作无法撤销。']})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:()=>p(b,j),children:"删除"})]})]})]})]})},d=()=>{t({...e,expression_groups:[...e.expression_groups,[]]})},m=y=>{t({...e,expression_groups:e.expression_groups.filter((b,j)=>j!==y)})},f=y=>{const b=[...e.expression_groups];b[y]=[...b[y],""],t({...e,expression_groups:b})},p=(y,b)=>{const j=[...e.expression_groups];j[y]=j[y].filter((k,S)=>S!==b),t({...e,expression_groups:j})},x=(y,b,j)=>{const k=[...e.expression_groups];k[y][b]=j,t({...e,expression_groups:k})};return r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),r.jsxs(re,{onClick:n,size:"sm",variant:"outline",children:[r.jsx(mr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),r.jsxs("div",{className:"space-y-4",children:[e.learning_list.map((y,b)=>{const j=e.learning_list.some((z,L)=>L!==b&&z[0]===""),k=y[0]==="",S=y[0].split(":"),_=S[0]||"qq",M=S[1]||"",D=S[2]||"group";return r.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-sm font-medium",children:["规则 ",b+1," ",k&&"(全局配置)"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(o,{rule:y}),r.jsxs(cn,{children:[r.jsx(Xn,{asChild:!0,children:r.jsx(re,{size:"sm",variant:"ghost",children:r.jsx(Ot,{className:"h-4 w-4"})})}),r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认删除"}),r.jsxs(en,{children:["确定要删除学习规则 ",b+1," 吗?此操作无法撤销。"]})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:()=>a(b),children:"删除"})]})]})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"配置类型"}),r.jsxs(_t,{value:k?"global":"specific",onValueChange:z=>{z==="global"?l(b,0,""):l(b,0,"qq::group")},disabled:j&&!k,children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"global",children:"全局配置"}),r.jsx(ze,{value:"specific",disabled:j&&!k,children:"详细配置"})]})]}),j&&!k&&r.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!k&&r.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"平台"}),r.jsxs(_t,{value:_,onValueChange:z=>{l(b,0,`${z}:${M}:${D}`)},children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"qq",children:"QQ"}),r.jsx(ze,{value:"wx",children:"微信"})]})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"群 ID"}),r.jsx(Te,{value:M,onChange:z=>{l(b,0,`${_}:${z.target.value}:${D}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"类型"}),r.jsxs(_t,{value:D,onValueChange:z=>{l(b,0,`${_}:${M}:${z}`)},children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"group",children:"群组(group)"}),r.jsx(ze,{value:"private",children:"私聊(private)"})]})]})]})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",y[0]||"(未设置)"]})]}),r.jsx("div",{className:"grid gap-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-xs font-medium",children:"使用学到的表达"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),r.jsx(gt,{checked:y[1]==="enable",onCheckedChange:z=>l(b,1,z?"enable":"disable")})]})}),r.jsx("div",{className:"grid gap-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-xs font-medium",children:"学习表达"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),r.jsx(gt,{checked:y[2]==="enable",onCheckedChange:z=>l(b,2,z?"enable":"disable")})]})}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{className:"text-xs font-medium",children:"学习强度"}),r.jsx(Te,{type:"number",step:"0.1",min:"0",max:"5",value:y[3],onChange:z=>{const L=parseFloat(z.target.value);isNaN(L)||l(b,3,Math.max(0,Math.min(5,L)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),r.jsx(Rm,{value:[parseFloat(y[3])||1],onValueChange:z=>l(b,3,z[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),r.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[r.jsx("span",{children:"0 (不学习)"}),r.jsx("span",{children:"2.5"}),r.jsx("span",{children:"5.0 (快速学习)"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},b)}),e.learning_list.length===0&&r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),r.jsxs(re,{onClick:d,size:"sm",variant:"outline",children:[r.jsx(mr,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),r.jsxs("div",{className:"space-y-4",children:[e.expression_groups.map((y,b)=>{const j=e.learning_list.map(k=>k[0]).filter(k=>k!=="");return r.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",b+1,y.length===1&&y[0]==="*"&&"(全局共享)"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(re,{onClick:()=>f(b),size:"sm",variant:"outline",children:r.jsx(mr,{className:"h-4 w-4"})}),r.jsxs(cn,{children:[r.jsx(Xn,{asChild:!0,children:r.jsx(re,{size:"sm",variant:"ghost",children:r.jsx(Ot,{className:"h-4 w-4"})})}),r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认删除"}),r.jsxs(en,{children:["确定要删除共享组 ",b+1," 吗?此操作无法撤销。"]})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:()=>m(b),children:"删除"})]})]})]})]})]}),r.jsx("div",{className:"space-y-2",children:y.map((k,S)=>r.jsx(c,{member:k,groupIndex:b,memberIndex:S,availableChatIds:j},S))}),r.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},b)}),e.expression_groups.length===0&&r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function PD({emojiConfig:e,memoryConfig:t,toolConfig:n,onEmojiChange:a,onMemoryChange:l,onToolChange:o}){return r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gt,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:c=>o({...n,enable_tool:c})}),r.jsx(Q,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),r.jsx(Te,{id:"max_agent_iterations",type:"number",min:"1",value:t.max_agent_iterations,onChange:c=>l({...t,max_agent_iterations:parseInt(c.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"emoji_chance",children:"表情包激活概率"}),r.jsx(Te,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:e.emoji_chance,onChange:c=>a({...e,emoji_chance:parseFloat(c.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"max_reg_num",children:"最大注册数量"}),r.jsx(Te,{id:"max_reg_num",type:"number",min:"1",value:e.max_reg_num,onChange:c=>a({...e,max_reg_num:parseInt(c.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),r.jsx(Te,{id:"check_interval",type:"number",min:"1",value:e.check_interval,onChange:c=>a({...e,check_interval:parseInt(c.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gt,{id:"do_replace",checked:e.do_replace,onCheckedChange:c=>a({...e,do_replace:c})}),r.jsx(Q,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gt,{id:"steal_emoji",checked:e.steal_emoji,onCheckedChange:c=>a({...e,steal_emoji:c})}),r.jsx(Q,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),r.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gt,{id:"content_filtration",checked:e.content_filtration,onCheckedChange:c=>a({...e,content_filtration:c})}),r.jsx(Q,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),e.content_filtration&&r.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[r.jsx(Q,{htmlFor:"filtration_prompt",children:"过滤要求"}),r.jsx(Te,{id:"filtration_prompt",value:e.filtration_prompt,onChange:c=>a({...e,filtration_prompt:c.target.value}),placeholder:"符合公序良俗"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function FD({keywordReactionConfig:e,responsePostProcessConfig:t,chineseTypoConfig:n,responseSplitterConfig:a,onKeywordReactionChange:l,onResponsePostProcessChange:o,onChineseTypoChange:c,onResponseSplitterChange:d}){const m=()=>{l({...e,regex_rules:[...e.regex_rules,{regex:[""],reaction:""}]})},f=z=>{l({...e,regex_rules:e.regex_rules.filter((L,E)=>E!==z)})},p=(z,L,E)=>{const R=[...e.regex_rules];L==="regex"&&typeof E=="string"?R[z]={...R[z],regex:[E]}:L==="reaction"&&typeof E=="string"&&(R[z]={...R[z],reaction:E}),l({...e,regex_rules:R})},x=({regex:z,reaction:L,onRegexChange:E,onReactionChange:R})=>{const[H,$]=w.useState(!1),[I,G]=w.useState(""),[te,we]=w.useState(null),[J,ae]=w.useState(""),[U,q]=w.useState({}),[W,oe]=w.useState(""),P=w.useRef(null),[je,Z]=w.useState("build"),O=ye=>ye.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),Ne=(ye,Be=0)=>{const ie=P.current;if(!ie)return;const He=ie.selectionStart||0,lt=ie.selectionEnd||0,ve=z.substring(0,He)+ye+z.substring(lt);E(ve),setTimeout(()=>{const Ze=He+ye.length+Be;ie.setSelectionRange(Ze,Ze),ie.focus()},0)};w.useEffect(()=>{if(!z||!I){we(null),q({}),oe(L),ae("");return}try{const ye=O(z),Be=new RegExp(ye,"g"),ie=I.match(Be);we(ie),ae("");const lt=new RegExp(ye).exec(I);if(lt&<.groups){q(lt.groups);let ve=L;Object.entries(lt.groups).forEach(([Ze,We])=>{ve=ve.replace(new RegExp(`\\[${Ze}\\]`,"g"),We||"")}),oe(ve)}else q({}),oe(L)}catch(ye){ae(ye.message),we(null),q({}),oe(L)}},[z,I,L]);const se=()=>{if(!I||!te||te.length===0)return r.jsx("span",{className:"text-muted-foreground",children:I||"请输入测试文本"});try{const ye=O(z),Be=new RegExp(ye,"g");let ie=0;const He=[];let lt;for(;(lt=Be.exec(I))!==null;)lt.index>ie&&He.push(r.jsx("span",{children:I.substring(ie,lt.index)},`text-${ie}`)),He.push(r.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:lt[0]},`match-${lt.index}`)),ie=lt.index+lt[0].length;return ie)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return r.jsxs(hr,{open:H,onOpenChange:$,children:[r.jsx(Pw,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",children:[r.jsx(Q0,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),r.jsxs(nr,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[r.jsxs(rr,{children:[r.jsx(ar,{children:"正则表达式编辑器"}),r.jsx(wr,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),r.jsx(Xt,{className:"max-h-[calc(90vh-120px)]",children:r.jsxs(Sl,{value:je,onValueChange:ye=>Z(ye),className:"w-full",children:[r.jsxs(Ls,{className:"grid w-full grid-cols-2",children:[r.jsx(Rt,{value:"build",children:"🔧 构建器"}),r.jsx(Rt,{value:"test",children:"🧪 测试器"})]}),r.jsxs(ln,{value:"build",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{className:"text-sm font-medium",children:"正则表达式"}),r.jsx(Te,{ref:P,value:z,onChange:ye=>E(ye.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{className:"text-sm font-medium",children:"Reaction 内容"}),r.jsx(vn,{value:L,onChange:ye=>R(ye.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),r.jsxs("div",{className:"space-y-4 border-t pt-4",children:[Ce.map(ye=>r.jsxs("div",{className:"space-y-2",children:[r.jsx("h5",{className:"text-xs font-semibold text-primary",children:ye.category}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:ye.items.map(Be=>r.jsx(re,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>Ne(Be.pattern,Be.moveCursor||0),children:r.jsxs("div",{className:"flex flex-col items-start w-full",children:[r.jsxs("div",{className:"flex items-center gap-2 w-full",children:[r.jsx("span",{className:"text-xs font-medium",children:Be.label}),r.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:Be.pattern})]}),r.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:Be.desc})]})},Be.label))})]},ye.category)),r.jsxs("div",{className:"space-y-2 border-t pt-4",children:[r.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(re,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("^(?P\\S{1,20})是这样的$"),children:r.jsxs("div",{className:"flex flex-col items-start w-full",children:[r.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),r.jsx(re,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:r.jsxs("div",{className:"flex flex-col items-start w-full",children:[r.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),r.jsx(re,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?P.+?)(?:是|为什么|怎么)"),children:r.jsxs("div",{className:"flex flex-col items-start w-full",children:[r.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),r.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[r.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),r.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[r.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),r.jsxs("li",{children:["命名捕获组格式:",r.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),r.jsxs("li",{children:["在 reaction 中使用 ",r.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),r.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),r.jsxs(ln,{value:"test",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{className:"text-sm font-medium",children:"当前正则表达式"}),r.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:z||"(未设置)"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),r.jsx(vn,{id:"test-text",value:I,onChange:ye=>G(ye.target.value),placeholder:`在此输入要测试的文本... -例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),J&&r.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[r.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),r.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:J})]}),!J&&I&&r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex items-center gap-2",children:te&&te.length>0?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),r.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",te.length," 处)"]})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),r.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{className:"text-sm font-medium",children:"匹配高亮"}),r.jsx(Xt,{className:"h-40 rounded-md bg-muted p-3",children:r.jsx("div",{className:"text-sm break-words",children:se()})})]}),Object.keys(U).length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{className:"text-sm font-medium",children:"命名捕获组"}),r.jsx(Xt,{className:"h-32 rounded-md border p-3",children:r.jsx("div",{className:"space-y-2",children:Object.entries(U).map(([ye,Be])=>r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[r.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",ye,"]"]}),r.jsx("span",{className:"text-muted-foreground",children:"="}),r.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:Be})]},ye))})})]}),Object.keys(U).length>0&&L&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{className:"text-sm font-medium",children:"Reaction 替换预览"}),r.jsx(Xt,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:r.jsx("div",{className:"text-sm break-words",children:W})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),r.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[r.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),r.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[r.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),r.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),r.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),r.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},y=()=>{l({...e,keyword_rules:[...e.keyword_rules,{keywords:[],reaction:""}]})},b=z=>{l({...e,keyword_rules:e.keyword_rules.filter((L,E)=>E!==z)})},j=(z,L,E)=>{const R=[...e.keyword_rules];typeof E=="string"&&(R[z]={...R[z],reaction:E}),l({...e,keyword_rules:R})},k=z=>{const L=[...e.keyword_rules];L[z]={...L[z],keywords:[...L[z].keywords||[],""]},l({...e,keyword_rules:L})},S=(z,L)=>{const E=[...e.keyword_rules];E[z]={...E[z],keywords:(E[z].keywords||[]).filter((R,H)=>H!==L)},l({...e,keyword_rules:E})},_=(z,L,E)=>{const R=[...e.keyword_rules],H=[...R[z].keywords||[]];H[L]=E,R[z]={...R[z],keywords:H},l({...e,keyword_rules:R})},M=({rule:z})=>{const L=`{ regex = [${(z.regex||[]).map(E=>`"${E}"`).join(", ")}], reaction = "${z.reaction}" }`;return r.jsxs(kl,{children:[r.jsx(Cl,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",children:[r.jsx(qa,{className:"h-4 w-4 mr-1"}),"预览"]})}),r.jsx(Ps,{className:"w-[95vw] sm:w-[500px]",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),r.jsx(Xt,{className:"h-60 rounded-md bg-muted p-3",children:r.jsx("pre",{className:"font-mono text-xs break-all",children:L})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},D=({rule:z})=>{const L=`[[keyword_reaction.keyword_rules]] -keywords = [${(z.keywords||[]).map(E=>`"${E}"`).join(", ")}] -reaction = "${z.reaction}"`;return r.jsxs(kl,{children:[r.jsx(Cl,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",children:[r.jsx(qa,{className:"h-4 w-4 mr-1"}),"预览"]})}),r.jsx(Ps,{className:"w-[95vw] sm:w-[500px]",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),r.jsx(Xt,{className:"h-60 rounded-md bg-muted p-3",children:r.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:L})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),r.jsxs(re,{onClick:m,size:"sm",variant:"outline",children:[r.jsx(mr,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),r.jsxs("div",{className:"space-y-3",children:[e.regex_rules.map((z,L)=>r.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",L+1]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(x,{regex:z.regex&&z.regex[0]||"",reaction:z.reaction,onRegexChange:E=>p(L,"regex",E),onReactionChange:E=>p(L,"reaction",E)}),r.jsx(M,{rule:z}),r.jsxs(cn,{children:[r.jsx(Xn,{asChild:!0,children:r.jsx(re,{size:"sm",variant:"ghost",children:r.jsx(Ot,{className:"h-4 w-4"})})}),r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认删除"}),r.jsxs(en,{children:["确定要删除正则规则 ",L+1," 吗?此操作无法撤销。"]})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:()=>f(L),children:"删除"})]})]})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),r.jsx(Te,{value:z.regex&&z.regex[0]||"",onChange:E=>p(L,"regex",E.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"反应内容"}),r.jsx(vn,{value:z.reaction,onChange:E=>p(L,"reaction",E.target.value),placeholder:`触发后麦麦的反应... -可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},L)),e.regex_rules.length===0&&r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),r.jsxs("div",{className:"space-y-4 border-t pt-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),r.jsxs(re,{onClick:y,size:"sm",variant:"outline",children:[r.jsx(mr,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),r.jsxs("div",{className:"space-y-3",children:[e.keyword_rules.map((z,L)=>r.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",L+1]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(D,{rule:z}),r.jsxs(cn,{children:[r.jsx(Xn,{asChild:!0,children:r.jsx(re,{size:"sm",variant:"ghost",children:r.jsx(Ot,{className:"h-4 w-4"})})}),r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认删除"}),r.jsxs(en,{children:["确定要删除关键词规则 ",L+1," 吗?此操作无法撤销。"]})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:()=>b(L),children:"删除"})]})]})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{className:"text-xs font-medium",children:"关键词列表"}),r.jsxs(re,{onClick:()=>k(L),size:"sm",variant:"ghost",children:[r.jsx(mr,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),r.jsxs("div",{className:"space-y-2",children:[(z.keywords||[]).map((E,R)=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te,{value:E,onChange:H=>_(L,R,H.target.value),placeholder:"关键词",className:"flex-1"}),r.jsx(re,{onClick:()=>S(L,R),size:"sm",variant:"ghost",children:r.jsx(Ot,{className:"h-4 w-4"})})]},R)),(!z.keywords||z.keywords.length===0)&&r.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"反应内容"}),r.jsx(vn,{value:z.reaction,onChange:E=>j(L,"reaction",E.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},L)),e.keyword_rules.length===0&&r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gt,{id:"enable_response_post_process",checked:t.enable_response_post_process,onCheckedChange:z=>o({...t,enable_response_post_process:z})}),r.jsx(Q,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),t.enable_response_post_process&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"border-t pt-6 space-y-4",children:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[r.jsx(gt,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:z=>c({...n,enable:z})}),r.jsx(Q,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),r.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&r.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),r.jsx(Te,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:z=>c({...n,error_rate:parseFloat(z.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),r.jsx(Te,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:z=>c({...n,min_freq:parseInt(z.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),r.jsx(Te,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:z=>c({...n,tone_error_rate:parseFloat(z.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),r.jsx(Te,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:z=>c({...n,word_replace_rate:parseFloat(z.target.value)})})]})]})]})}),r.jsx("div",{className:"border-t pt-6 space-y-4",children:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[r.jsx(gt,{id:"enable_response_splitter",checked:a.enable,onCheckedChange:z=>d({...a,enable:z})}),r.jsx(Q,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),r.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),a.enable&&r.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),r.jsx(Te,{id:"max_length",type:"number",min:"1",value:a.max_length,onChange:z=>d({...a,max_length:parseInt(z.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),r.jsx(Te,{id:"max_sentence_num",type:"number",min:"1",value:a.max_sentence_num,onChange:z=>d({...a,max_sentence_num:parseInt(z.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gt,{id:"enable_kaomoji_protection",checked:a.enable_kaomoji_protection,onCheckedChange:z=>d({...a,enable_kaomoji_protection:z})}),r.jsx(Q,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gt,{id:"enable_overflow_return_all",checked:a.enable_overflow_return_all,onCheckedChange:z=>d({...a,enable_overflow_return_all:z})}),r.jsx(Q,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),r.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function ID({config:e,onChange:t}){return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gt,{checked:e.enable_mood,onCheckedChange:n=>t({...e,enable_mood:n})}),r.jsx(Q,{className:"cursor-pointer",children:"启用情绪系统"})]}),e.enable_mood&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"情绪更新阈值"}),r.jsx(Te,{type:"number",min:"1",value:e.mood_update_threshold,onChange:n=>t({...e,mood_update_threshold:parseInt(n.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"情感特征"}),r.jsx(vn,{value:e.emotion_style,onChange:n=>t({...e,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function qD({config:e,onChange:t}){return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gt,{checked:e.enable_asr,onCheckedChange:n=>t({...e,enable_asr:n})}),r.jsx(Q,{className:"cursor-pointer",children:"启用语音识别"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function HD({config:e,onChange:t}){return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gt,{checked:e.enable,onCheckedChange:n=>t({...e,enable:n})}),r.jsx(Q,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),e.enable&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"LPMM 模式"}),r.jsxs(_t,{value:e.lpmm_mode,onValueChange:n=>t({...e,lpmm_mode:n}),children:[r.jsx(jt,{children:r.jsx(Mt,{placeholder:"选择 LPMM 模式"})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"classic",children:"经典模式"}),r.jsx(ze,{value:"agent",children:"Agent 模式"})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"同义词搜索 TopK"}),r.jsx(Te,{type:"number",min:"1",value:e.rag_synonym_search_top_k,onChange:n=>t({...e,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"同义词阈值"}),r.jsx(Te,{type:"number",step:"0.1",min:"0",max:"1",value:e.rag_synonym_threshold,onChange:n=>t({...e,rag_synonym_threshold:parseFloat(n.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"实体提取线程数"}),r.jsx(Te,{type:"number",min:"1",value:e.info_extraction_workers,onChange:n=>t({...e,info_extraction_workers:parseInt(n.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"嵌入向量维度"}),r.jsx(Te,{type:"number",min:"1",value:e.embedding_dimension,onChange:n=>t({...e,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function UD({config:e,onChange:t}){const[n,a]=w.useState(""),[l,o]=w.useState("WARNING"),c=()=>{n&&!e.suppress_libraries.includes(n)&&(t({...e,suppress_libraries:[...e.suppress_libraries,n]}),a(""))},d=b=>{t({...e,suppress_libraries:e.suppress_libraries.filter(j=>j!==b)})},m=()=>{n&&!e.library_log_levels[n]&&(t({...e,library_log_levels:{...e.library_log_levels,[n]:l}}),a(""),o("WARNING"))},f=b=>{const j={...e.library_log_levels};delete j[b],t({...e,library_log_levels:j})},p=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],x=["FULL","compact","lite"],y=["none","title","full"];return r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"日期格式"}),r.jsx(Te,{value:e.date_style,onChange:b=>t({...e,date_style:b.target.value}),placeholder:"例如: m-d H:i:s"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"日志级别样式"}),r.jsxs(_t,{value:e.log_level_style,onValueChange:b=>t({...e,log_level_style:b}),children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsx(Nt,{children:x.map(b=>r.jsx(ze,{value:b,children:b},b))})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"日志文本颜色"}),r.jsxs(_t,{value:e.color_text,onValueChange:b=>t({...e,color_text:b}),children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsx(Nt,{children:y.map(b=>r.jsx(ze,{value:b,children:b},b))})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"全局日志级别"}),r.jsxs(_t,{value:e.log_level,onValueChange:b=>t({...e,log_level:b}),children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsx(Nt,{children:p.map(b=>r.jsx(ze,{value:b,children:b},b))})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"控制台日志级别"}),r.jsxs(_t,{value:e.console_log_level,onValueChange:b=>t({...e,console_log_level:b}),children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsx(Nt,{children:p.map(b=>r.jsx(ze,{value:b,children:b},b))})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"文件日志级别"}),r.jsxs(_t,{value:e.file_log_level,onValueChange:b=>t({...e,file_log_level:b}),children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsx(Nt,{children:p.map(b=>r.jsx(ze,{value:b,children:b},b))})]})]})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"mb-2 block",children:"完全屏蔽的库"}),r.jsxs("div",{className:"flex gap-2 mb-2",children:[r.jsx(Te,{value:n,onChange:b=>a(b.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),c())}}),r.jsx(re,{onClick:c,size:"sm",className:"flex-shrink-0",children:r.jsx(mr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:e.suppress_libraries.map(b=>r.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[r.jsx("span",{className:"text-sm",children:b}),r.jsx(re,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>d(b),children:r.jsx(Ot,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},b))})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"mb-2 block",children:"特定库的日志级别"}),r.jsxs("div",{className:"flex gap-2 mb-2",children:[r.jsx(Te,{value:n,onChange:b=>a(b.target.value),placeholder:"输入库名",className:"flex-1"}),r.jsxs(_t,{value:l,onValueChange:o,children:[r.jsx(jt,{className:"w-32",children:r.jsx(Mt,{})}),r.jsx(Nt,{children:p.map(b=>r.jsx(ze,{value:b,children:b},b))})]}),r.jsx(re,{onClick:m,size:"sm",children:r.jsx(mr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),r.jsx("div",{className:"space-y-2",children:Object.entries(e.library_log_levels).map(([b,j])=>r.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[r.jsx("span",{className:"text-sm font-medium",children:b}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:j}),r.jsx(re,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>f(b),children:r.jsx(Ot,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},b))})]})]})}function $D({config:e,onChange:t}){return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Q,{children:"显示 Prompt"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),r.jsx(gt,{checked:e.show_prompt,onCheckedChange:n=>t({...e,show_prompt:n})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Q,{children:"显示回复器 Prompt"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),r.jsx(gt,{checked:e.show_replyer_prompt,onCheckedChange:n=>t({...e,show_replyer_prompt:n})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Q,{children:"显示回复器推理"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),r.jsx(gt,{checked:e.show_replyer_reasoning,onCheckedChange:n=>t({...e,show_replyer_reasoning:n})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Q,{children:"显示 Jargon Prompt"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),r.jsx(gt,{checked:e.show_jargon_prompt,onCheckedChange:n=>t({...e,show_jargon_prompt:n})})]})]})]})}function VD({config:e,onChange:t}){const[n,a]=w.useState(""),l=()=>{n&&!e.auth_token.includes(n)&&(t({...e,auth_token:[...e.auth_token,n]}),a(""))},o=c=>{t({...e,auth_token:e.auth_token.filter((d,m)=>m!==c)})};return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Q,{children:"启用自定义服务器"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),r.jsx(gt,{checked:e.use_custom,onCheckedChange:c=>t({...e,use_custom:c})})]}),e.use_custom&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"主机地址"}),r.jsx(Te,{value:e.host,onChange:c=>t({...e,host:c.target.value}),placeholder:"127.0.0.1"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"端口号"}),r.jsx(Te,{type:"number",value:e.port,onChange:c=>t({...e,port:parseInt(c.target.value)}),placeholder:"8090"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"连接模式"}),r.jsxs(_t,{value:e.mode,onValueChange:c=>t({...e,mode:c}),children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"ws",children:"WebSocket (ws)"}),r.jsx(ze,{value:"tcp",children:"TCP"})]})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gt,{checked:e.use_wss,onCheckedChange:c=>t({...e,use_wss:c}),disabled:e.mode!=="ws"}),r.jsx(Q,{children:"使用 WSS 安全连接"})]})]}),e.use_wss&&e.mode==="ws"&&r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"SSL 证书文件路径"}),r.jsx(Te,{value:e.cert_file,onChange:c=>t({...e,cert_file:c.target.value}),placeholder:"cert.pem"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"SSL 密钥文件路径"}),r.jsx(Te,{value:e.key_file,onChange:c=>t({...e,key_file:c.target.value}),placeholder:"key.pem"})]})]})]})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"mb-2 block",children:"认证令牌"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),r.jsxs("div",{className:"flex gap-2 mb-2",children:[r.jsx(Te,{value:n,onChange:c=>a(c.target.value),placeholder:"输入认证令牌",onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),l())}}),r.jsx(re,{onClick:l,size:"sm",children:r.jsx(mr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),r.jsx("div",{className:"space-y-2",children:e.auth_token.map((c,d)=>r.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[r.jsx("span",{className:"text-sm font-mono",children:c}),r.jsx(re,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>o(d),children:r.jsx(Ot,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},d))})]})]})}function GD({config:e,onChange:t}){return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Q,{children:"启用统计信息发送"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),r.jsx(gt,{checked:e.enable,onCheckedChange:n=>t({...e,enable:n})})]})]})}const bi=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{className:"relative w-full overflow-auto",children:r.jsx("table",{ref:n,className:me("w-full caption-bottom text-sm",e),...t})}));bi.displayName="Table";const wi=w.forwardRef(({className:e,...t},n)=>r.jsx("thead",{ref:n,className:me("[&_tr]:border-b",e),...t}));wi.displayName="TableHeader";const ji=w.forwardRef(({className:e,...t},n)=>r.jsx("tbody",{ref:n,className:me("[&_tr:last-child]:border-0",e),...t}));ji.displayName="TableBody";const YD=w.forwardRef(({className:e,...t},n)=>r.jsx("tfoot",{ref:n,className:me("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));YD.displayName="TableFooter";const Un=w.forwardRef(({className:e,...t},n)=>r.jsx("tr",{ref:n,className:me("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Un.displayName="TableRow";const ct=w.forwardRef(({className:e,...t},n)=>r.jsx("th",{ref:n,className:me("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));ct.displayName="TableHead";const et=w.forwardRef(({className:e,...t},n)=>r.jsx("td",{ref:n,className:me("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));et.displayName="TableCell";const WD=w.forwardRef(({className:e,...t},n)=>r.jsx("caption",{ref:n,className:me("mt-4 text-sm text-muted-foreground",e),...t}));WD.displayName="TableCaption";const br=w.forwardRef(({className:e,...t},n)=>r.jsx(W5,{ref:n,className:me("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:r.jsx(eT,{className:me("grid place-content-center text-current"),children:r.jsx(di,{className:"h-4 w-4"})})}));br.displayName=W5.displayName;function XD(){const[e,t]=w.useState([]),[n,a]=w.useState(!0),[l,o]=w.useState(!1),[c,d]=w.useState(!1),[m,f]=w.useState(!1),[p,x]=w.useState(!1),[y,b]=w.useState(!1),[j,k]=w.useState(!1),[S,_]=w.useState(null),[M,D]=w.useState(null),[z,L]=w.useState(!1),[E,R]=w.useState(null),[H,$]=w.useState(!1),[I,G]=w.useState(""),[te,we]=w.useState(new Set),[J,ae]=w.useState(!1),[U,q]=w.useState(1),[W,oe]=w.useState(20),[P,je]=w.useState(""),{toast:Z}=pr(),O=w.useRef(null),Ne=w.useRef(!0);w.useEffect(()=>{se()},[]);const se=async()=>{try{a(!0);const K=await Ao();t(K.api_providers||[]),f(!1),Ne.current=!1}catch(K){console.error("加载配置失败:",K)}finally{a(!1)}},Ce=async()=>{try{x(!0),P1().catch(()=>{}),b(!0)}catch(K){console.error("重启失败:",K),b(!1),Z({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),x(!1)}},ye=async()=>{try{o(!0),O.current&&clearTimeout(O.current);const K=await Ao();K.api_providers=e,await lm(K),f(!1),Z({title:"保存成功",description:"正在重启麦麦..."}),await Ce()}catch(K){console.error("保存配置失败:",K),Z({title:"保存失败",description:K.message,variant:"destructive"}),o(!1)}},Be=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},ie=()=>{b(!1),x(!1),Z({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},He=w.useCallback(async K=>{if(!Ne.current)try{d(!0),await Ex("api_providers",K),f(!1)}catch(ge){console.error("自动保存失败:",ge),f(!0)}finally{d(!1)}},[]);w.useEffect(()=>{if(!Ne.current)return f(!0),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{He(e)},2e3),()=>{O.current&&clearTimeout(O.current)}},[e,He]);const lt=async()=>{try{o(!0),O.current&&clearTimeout(O.current);const K=await Ao();K.api_providers=e,await lm(K),f(!1),Z({title:"保存成功",description:"模型提供商配置已保存"})}catch(K){console.error("保存配置失败:",K),Z({title:"保存失败",description:K.message,variant:"destructive"})}finally{o(!1)}},ve=(K,ge)=>{_(K||{name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),D(ge),$(!1),k(!0)},Ze=async()=>{if(S?.api_key)try{await navigator.clipboard.writeText(S.api_key),Z({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{Z({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},We=()=>{if(!S)return;const K={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};if(M!==null){const ge=[...e];ge[M]=K,t(ge)}else t([...e,K]);k(!1),_(null),D(null)},pn=K=>{if(!K&&S){const ge={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};_(ge)}k(K)},Bn=K=>{R(K),L(!0)},sr=()=>{if(E!==null){const K=e.filter((ge,Oe)=>Oe!==E);t(K),Z({title:"删除成功",description:"提供商已从列表中移除"})}L(!1),R(null)},Qe=K=>{const ge=new Set(te);ge.has(K)?ge.delete(K):ge.add(K),we(ge)},Gn=()=>{if(te.size===Sn.length)we(new Set);else{const K=Sn.map((ge,Oe)=>e.findIndex(nt=>nt===Sn[Oe]));we(new Set(K))}},Sr=()=>{if(te.size===0){Z({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}ae(!0)},Er=()=>{const K=e.filter((ge,Oe)=>!te.has(Oe));t(K),we(new Set),ae(!1),Z({title:"批量删除成功",description:`已删除 ${te.size} 个提供商`})},Sn=e.filter(K=>{if(!I)return!0;const ge=I.toLowerCase();return K.name.toLowerCase().includes(ge)||K.base_url.toLowerCase().includes(ge)||K.client_type.toLowerCase().includes(ge)}),lr=Math.ceil(Sn.length/W),Ue=Sn.slice((U-1)*W,U*W),Ln=()=>{const K=parseInt(P);K>=1&&K<=lr&&(q(K),je(""))};return n?r.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型提供商配置"}),r.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 API 提供商配置"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[te.size>0&&r.jsxs(re,{onClick:Sr,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[r.jsx(Ot,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",te.size,")"]}),r.jsxs(re,{onClick:()=>ve(null,null),size:"sm",className:"w-full sm:w-auto",children:[r.jsx(mr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),r.jsxs(re,{onClick:lt,disabled:l||c||!m||p,size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[r.jsx(y1,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),l?"保存中...":c?"自动保存中...":m?"保存配置":"已保存"]}),r.jsxs(cn,{children:[r.jsx(Xn,{asChild:!0,children:r.jsxs(re,{disabled:l||c||p,size:"sm",className:"w-full sm:w-auto",children:[r.jsx(b1,{className:"mr-2 h-4 w-4"}),p?"重启中...":m?"保存并重启":"重启麦麦"]})}),r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认重启麦麦?"}),r.jsx(en,{children:m?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:m?ye:Ce,children:m?"保存并重启":"确认重启"})]})]})]})]})]}),r.jsxs(Fu,{children:[r.jsx(hi,{className:"h-4 w-4"}),r.jsxs(Iu,{children:["配置更新后需要",r.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),r.jsxs(Xt,{className:"h-[calc(100vh-260px)]",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[r.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[r.jsx(Gr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{placeholder:"搜索提供商名称、URL 或类型...",value:I,onChange:K=>G(K.target.value),className:"pl-9"})]}),I&&r.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Sn.length," 个结果"]})]}),r.jsx("div",{className:"md:hidden space-y-3",children:Sn.length===0?r.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:I?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):Ue.map((K,ge)=>{const Oe=e.findIndex(nt=>nt===K);return r.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold text-base truncate",children:K.name}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:K.base_url})]}),r.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[r.jsxs(re,{variant:"default",size:"sm",onClick:()=>ve(K,Oe),children:[r.jsx(Ro,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),r.jsxs(re,{size:"sm",onClick:()=>Bn(Oe),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(Ot,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),r.jsx("p",{className:"font-medium",children:K.client_type})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),r.jsx("p",{className:"font-medium",children:K.max_retry})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),r.jsx("p",{className:"font-medium",children:K.timeout})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),r.jsx("p",{className:"font-medium",children:K.retry_interval})]})]})]},ge)})}),r.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:r.jsxs(bi,{children:[r.jsx(wi,{children:r.jsxs(Un,{children:[r.jsx(ct,{className:"w-12",children:r.jsx(br,{checked:te.size===Sn.length&&Sn.length>0,onCheckedChange:Gn})}),r.jsx(ct,{children:"名称"}),r.jsx(ct,{children:"基础URL"}),r.jsx(ct,{children:"客户端类型"}),r.jsx(ct,{className:"text-right",children:"最大重试"}),r.jsx(ct,{className:"text-right",children:"超时(秒)"}),r.jsx(ct,{className:"text-right",children:"重试间隔(秒)"}),r.jsx(ct,{className:"text-right",children:"操作"})]})}),r.jsx(ji,{children:Ue.length===0?r.jsx(Un,{children:r.jsx(et,{colSpan:8,className:"text-center text-muted-foreground py-8",children:I?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):Ue.map((K,ge)=>{const Oe=e.findIndex(nt=>nt===K);return r.jsxs(Un,{children:[r.jsx(et,{children:r.jsx(br,{checked:te.has(Oe),onCheckedChange:()=>Qe(Oe)})}),r.jsx(et,{className:"font-medium",children:K.name}),r.jsx(et,{className:"max-w-xs truncate",title:K.base_url,children:K.base_url}),r.jsx(et,{children:K.client_type}),r.jsx(et,{className:"text-right",children:K.max_retry}),r.jsx(et,{className:"text-right",children:K.timeout}),r.jsx(et,{className:"text-right",children:K.retry_interval}),r.jsx(et,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsxs(re,{variant:"default",size:"sm",onClick:()=>ve(K,Oe),children:[r.jsx(Ro,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),r.jsxs(re,{size:"sm",onClick:()=>Bn(Oe),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(Ot,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},ge)})})]})}),Sn.length>0&&r.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),r.jsxs(_t,{value:W.toString(),onValueChange:K=>{oe(parseInt(K)),q(1),we(new Set)},children:[r.jsx(jt,{id:"page-size-provider",className:"w-20",children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"10",children:"10"}),r.jsx(ze,{value:"20",children:"20"}),r.jsx(ze,{value:"50",children:"50"}),r.jsx(ze,{value:"100",children:"100"})]})]}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(U-1)*W+1," 到"," ",Math.min(U*W,Sn.length)," 条,共 ",Sn.length," 条"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(re,{variant:"outline",size:"sm",onClick:()=>q(1),disabled:U===1,className:"hidden sm:flex",children:r.jsx(Eu,{className:"h-4 w-4"})}),r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>q(K=>Math.max(1,K-1)),disabled:U===1,children:[r.jsx(vi,{className:"h-4 w-4 sm:mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te,{type:"number",value:P,onChange:K=>je(K.target.value),onKeyDown:K=>K.key==="Enter"&&Ln(),placeholder:U.toString(),className:"w-16 h-8 text-center",min:1,max:lr}),r.jsx(re,{variant:"outline",size:"sm",onClick:Ln,disabled:!P,className:"h-8",children:"跳转"})]}),r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>q(K=>K+1),disabled:U>=lr,children:[r.jsx("span",{className:"hidden sm:inline",children:"下一页"}),r.jsx(yi,{className:"h-4 w-4 sm:ml-1"})]}),r.jsx(re,{variant:"outline",size:"sm",onClick:()=>q(lr),disabled:U>=lr,className:"hidden sm:flex",children:r.jsx(Au,{className:"h-4 w-4"})})]})]})]}),r.jsx(hr,{open:j,onOpenChange:pn,children:r.jsxs(nr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(rr,{children:[r.jsx(ar,{children:M!==null?"编辑提供商":"添加提供商"}),r.jsx(wr,{children:"配置 API 提供商的连接信息和参数"})]}),r.jsxs("div",{className:"grid gap-4 py-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"name",children:"名称 *"}),r.jsx(Te,{id:"name",value:S?.name||"",onChange:K=>_(ge=>ge?{...ge,name:K.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"base_url",children:"基础 URL *"}),r.jsx(Te,{id:"base_url",value:S?.base_url||"",onChange:K=>_(ge=>ge?{...ge,base_url:K.target.value}:null),placeholder:"https://api.example.com/v1"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"api_key",children:"API Key *"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{id:"api_key",type:H?"text":"password",value:S?.api_key||"",onChange:K=>_(ge=>ge?{...ge,api_key:K.target.value}:null),placeholder:"sk-...",className:"flex-1"}),r.jsx(re,{type:"button",variant:"outline",size:"icon",onClick:()=>$(!H),title:H?"隐藏密钥":"显示密钥",children:H?r.jsx(fx,{className:"h-4 w-4"}):r.jsx(qa,{className:"h-4 w-4"})}),r.jsx(re,{type:"button",variant:"outline",size:"icon",onClick:Ze,title:"复制密钥",children:r.jsx(hx,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"client_type",children:"客户端类型"}),r.jsxs(_t,{value:S?.client_type||"openai",onValueChange:K=>_(ge=>ge?{...ge,client_type:K}:null),children:[r.jsx(jt,{id:"client_type",children:r.jsx(Mt,{placeholder:"选择客户端类型"})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"openai",children:"OpenAI"}),r.jsx(ze,{value:"gemini",children:"Gemini"})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"max_retry",children:"最大重试"}),r.jsx(Te,{id:"max_retry",type:"number",min:"0",value:S?.max_retry??"",onChange:K=>{const ge=K.target.value===""?null:parseInt(K.target.value);_(Oe=>Oe?{...Oe,max_retry:ge}:null)},placeholder:"默认: 2"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"timeout",children:"超时(秒)"}),r.jsx(Te,{id:"timeout",type:"number",min:"1",value:S?.timeout??"",onChange:K=>{const ge=K.target.value===""?null:parseInt(K.target.value);_(Oe=>Oe?{...Oe,timeout:ge}:null)},placeholder:"默认: 30"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),r.jsx(Te,{id:"retry_interval",type:"number",min:"1",value:S?.retry_interval??"",onChange:K=>{const ge=K.target.value===""?null:parseInt(K.target.value);_(Oe=>Oe?{...Oe,retry_interval:ge}:null)},placeholder:"默认: 10"})]})]})]}),r.jsxs(Yr,{children:[r.jsx(re,{variant:"outline",onClick:()=>k(!1),children:"取消"}),r.jsx(re,{onClick:We,children:"保存"})]})]})}),r.jsx(cn,{open:z,onOpenChange:L,children:r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认删除"}),r.jsxs(en,{children:['确定要删除提供商 "',E!==null?e[E]?.name:"",'" 吗? 此操作无法撤销。']})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:sr,children:"删除"})]})]})}),r.jsx(cn,{open:J,onOpenChange:ae,children:r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认批量删除"}),r.jsxs(en,{children:["确定要删除选中的 ",te.size," 个提供商吗? 此操作无法撤销。"]})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:Er,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),y&&r.jsx(F1,{onRestartComplete:Be,onRestartFailed:ie})]})}var Cb=1,KD=.9,QD=.8,ZD=.17,Tp=.1,_p=.999,JD=.9999,ez=.99,tz=/[\\\/_+.#"@\[\(\{&]/,nz=/[\\\/_+.#"@\[\(\{&]/g,rz=/[\s-]/,P7=/[\s-]/g;function Ax(e,t,n,a,l,o,c){if(o===t.length)return l===e.length?Cb:ez;var d=`${l},${o}`;if(c[d]!==void 0)return c[d];for(var m=a.charAt(o),f=n.indexOf(m,l),p=0,x,y,b,j;f>=0;)x=Ax(e,t,n,a,f+1,o+1,c),x>p&&(f===l?x*=Cb:tz.test(e.charAt(f-1))?(x*=QD,b=e.slice(l,f-1).match(nz),b&&l>0&&(x*=Math.pow(_p,b.length))):rz.test(e.charAt(f-1))?(x*=KD,j=e.slice(l,f-1).match(P7),j&&l>0&&(x*=Math.pow(_p,j.length))):(x*=ZD,l>0&&(x*=Math.pow(_p,f-l))),e.charAt(f)!==t.charAt(o)&&(x*=JD)),(xx&&(x=y*Tp)),x>p&&(p=x),f=n.indexOf(m,f+1);return c[d]=p,p}function Tb(e){return e.toLowerCase().replace(P7," ")}function az(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Ax(e,t,Tb(e),Tb(t),0,0,{})}var sz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ol=sz.reduce((e,t)=>{const n=c1(`Primitive.${t}`),a=w.forwardRef((l,o)=>{const{asChild:c,...d}=l,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(m,{...d,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),Qc='[cmdk-group=""]',Mp='[cmdk-group-items=""]',lz='[cmdk-group-heading=""]',F7='[cmdk-item=""]',_b=`${F7}:not([aria-disabled="true"])`,Dx="cmdk-item-select",So="data-value",iz=(e,t,n)=>az(e,t,n),I7=w.createContext(void 0),qu=()=>w.useContext(I7),q7=w.createContext(void 0),I1=()=>w.useContext(q7),H7=w.createContext(void 0),U7=w.forwardRef((e,t)=>{let n=ko(()=>{var Z,O;return{search:"",value:(O=(Z=e.value)!=null?Z:e.defaultValue)!=null?O:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=ko(()=>new Set),l=ko(()=>new Map),o=ko(()=>new Map),c=ko(()=>new Set),d=$7(e),{label:m,children:f,value:p,onValueChange:x,filter:y,shouldFilter:b,loop:j,disablePointerSelection:k=!1,vimBindings:S=!0,..._}=e,M=Ta(),D=Ta(),z=Ta(),L=w.useRef(null),E=vz();xi(()=>{if(p!==void 0){let Z=p.trim();n.current.value=Z,R.emit()}},[p]),xi(()=>{E(6,we)},[]);let R=w.useMemo(()=>({subscribe:Z=>(c.current.add(Z),()=>c.current.delete(Z)),snapshot:()=>n.current,setState:(Z,O,Ne)=>{var se,Ce,ye,Be;if(!Object.is(n.current[Z],O)){if(n.current[Z]=O,Z==="search")te(),I(),E(1,G);else if(Z==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ie=document.getElementById(z);ie?ie.focus():(se=document.getElementById(M))==null||se.focus()}if(E(7,()=>{var ie;n.current.selectedItemId=(ie=J())==null?void 0:ie.id,R.emit()}),Ne||E(5,we),((Ce=d.current)==null?void 0:Ce.value)!==void 0){let ie=O??"";(Be=(ye=d.current).onValueChange)==null||Be.call(ye,ie);return}}R.emit()}},emit:()=>{c.current.forEach(Z=>Z())}}),[]),H=w.useMemo(()=>({value:(Z,O,Ne)=>{var se;O!==((se=o.current.get(Z))==null?void 0:se.value)&&(o.current.set(Z,{value:O,keywords:Ne}),n.current.filtered.items.set(Z,$(O,Ne)),E(2,()=>{I(),R.emit()}))},item:(Z,O)=>(a.current.add(Z),O&&(l.current.has(O)?l.current.get(O).add(Z):l.current.set(O,new Set([Z]))),E(3,()=>{te(),I(),n.current.value||G(),R.emit()}),()=>{o.current.delete(Z),a.current.delete(Z),n.current.filtered.items.delete(Z);let Ne=J();E(4,()=>{te(),Ne?.getAttribute("id")===Z&&G(),R.emit()})}),group:Z=>(l.current.has(Z)||l.current.set(Z,new Set),()=>{o.current.delete(Z),l.current.delete(Z)}),filter:()=>d.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:M,inputId:z,labelId:D,listInnerRef:L}),[]);function $(Z,O){var Ne,se;let Ce=(se=(Ne=d.current)==null?void 0:Ne.filter)!=null?se:iz;return Z?Ce(Z,n.current.search,O):0}function I(){if(!n.current.search||d.current.shouldFilter===!1)return;let Z=n.current.filtered.items,O=[];n.current.filtered.groups.forEach(se=>{let Ce=l.current.get(se),ye=0;Ce.forEach(Be=>{let ie=Z.get(Be);ye=Math.max(ie,ye)}),O.push([se,ye])});let Ne=L.current;ae().sort((se,Ce)=>{var ye,Be;let ie=se.getAttribute("id"),He=Ce.getAttribute("id");return((ye=Z.get(He))!=null?ye:0)-((Be=Z.get(ie))!=null?Be:0)}).forEach(se=>{let Ce=se.closest(Mp);Ce?Ce.appendChild(se.parentElement===Ce?se:se.closest(`${Mp} > *`)):Ne.appendChild(se.parentElement===Ne?se:se.closest(`${Mp} > *`))}),O.sort((se,Ce)=>Ce[1]-se[1]).forEach(se=>{var Ce;let ye=(Ce=L.current)==null?void 0:Ce.querySelector(`${Qc}[${So}="${encodeURIComponent(se[0])}"]`);ye?.parentElement.appendChild(ye)})}function G(){let Z=ae().find(Ne=>Ne.getAttribute("aria-disabled")!=="true"),O=Z?.getAttribute(So);R.setState("value",O||void 0)}function te(){var Z,O,Ne,se;if(!n.current.search||d.current.shouldFilter===!1){n.current.filtered.count=a.current.size;return}n.current.filtered.groups=new Set;let Ce=0;for(let ye of a.current){let Be=(O=(Z=o.current.get(ye))==null?void 0:Z.value)!=null?O:"",ie=(se=(Ne=o.current.get(ye))==null?void 0:Ne.keywords)!=null?se:[],He=$(Be,ie);n.current.filtered.items.set(ye,He),He>0&&Ce++}for(let[ye,Be]of l.current)for(let ie of Be)if(n.current.filtered.items.get(ie)>0){n.current.filtered.groups.add(ye);break}n.current.filtered.count=Ce}function we(){var Z,O,Ne;let se=J();se&&(((Z=se.parentElement)==null?void 0:Z.firstChild)===se&&((Ne=(O=se.closest(Qc))==null?void 0:O.querySelector(lz))==null||Ne.scrollIntoView({block:"nearest"})),se.scrollIntoView({block:"nearest"}))}function J(){var Z;return(Z=L.current)==null?void 0:Z.querySelector(`${F7}[aria-selected="true"]`)}function ae(){var Z;return Array.from(((Z=L.current)==null?void 0:Z.querySelectorAll(_b))||[])}function U(Z){let O=ae()[Z];O&&R.setState("value",O.getAttribute(So))}function q(Z){var O;let Ne=J(),se=ae(),Ce=se.findIndex(Be=>Be===Ne),ye=se[Ce+Z];(O=d.current)!=null&&O.loop&&(ye=Ce+Z<0?se[se.length-1]:Ce+Z===se.length?se[0]:se[Ce+Z]),ye&&R.setState("value",ye.getAttribute(So))}function W(Z){let O=J(),Ne=O?.closest(Qc),se;for(;Ne&&!se;)Ne=Z>0?xz(Ne,Qc):gz(Ne,Qc),se=Ne?.querySelector(_b);se?R.setState("value",se.getAttribute(So)):q(Z)}let oe=()=>U(ae().length-1),P=Z=>{Z.preventDefault(),Z.metaKey?oe():Z.altKey?W(1):q(1)},je=Z=>{Z.preventDefault(),Z.metaKey?U(0):Z.altKey?W(-1):q(-1)};return w.createElement(Ol.div,{ref:t,tabIndex:-1,..._,"cmdk-root":"",onKeyDown:Z=>{var O;(O=_.onKeyDown)==null||O.call(_,Z);let Ne=Z.nativeEvent.isComposing||Z.keyCode===229;if(!(Z.defaultPrevented||Ne))switch(Z.key){case"n":case"j":{S&&Z.ctrlKey&&P(Z);break}case"ArrowDown":{P(Z);break}case"p":case"k":{S&&Z.ctrlKey&&je(Z);break}case"ArrowUp":{je(Z);break}case"Home":{Z.preventDefault(),U(0);break}case"End":{Z.preventDefault(),oe();break}case"Enter":{Z.preventDefault();let se=J();if(se){let Ce=new Event(Dx);se.dispatchEvent(Ce)}}}}},w.createElement("label",{"cmdk-label":"",htmlFor:H.inputId,id:H.labelId,style:bz},m),Lm(e,Z=>w.createElement(q7.Provider,{value:R},w.createElement(I7.Provider,{value:H},Z))))}),oz=w.forwardRef((e,t)=>{var n,a;let l=Ta(),o=w.useRef(null),c=w.useContext(H7),d=qu(),m=$7(e),f=(a=(n=m.current)==null?void 0:n.forceMount)!=null?a:c?.forceMount;xi(()=>{if(!f)return d.item(l,c?.id)},[f]);let p=V7(l,o,[e.value,e.children,o],e.keywords),x=I1(),y=Tl(E=>E.value&&E.value===p.current),b=Tl(E=>f||d.filter()===!1?!0:E.search?E.filtered.items.get(l)>0:!0);w.useEffect(()=>{let E=o.current;if(!(!E||e.disabled))return E.addEventListener(Dx,j),()=>E.removeEventListener(Dx,j)},[b,e.onSelect,e.disabled]);function j(){var E,R;k(),(R=(E=m.current).onSelect)==null||R.call(E,p.current)}function k(){x.setState("value",p.current,!0)}if(!b)return null;let{disabled:S,value:_,onSelect:M,forceMount:D,keywords:z,...L}=e;return w.createElement(Ol.div,{ref:Nl(o,t),...L,id:l,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!y,"data-disabled":!!S,"data-selected":!!y,onPointerMove:S||d.getDisablePointerSelection()?void 0:k,onClick:S?void 0:j},e.children)}),cz=w.forwardRef((e,t)=>{let{heading:n,children:a,forceMount:l,...o}=e,c=Ta(),d=w.useRef(null),m=w.useRef(null),f=Ta(),p=qu(),x=Tl(b=>l||p.filter()===!1?!0:b.search?b.filtered.groups.has(c):!0);xi(()=>p.group(c),[]),V7(c,d,[e.value,e.heading,m]);let y=w.useMemo(()=>({id:c,forceMount:l}),[l]);return w.createElement(Ol.div,{ref:Nl(d,t),...o,"cmdk-group":"",role:"presentation",hidden:x?void 0:!0},n&&w.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),Lm(e,b=>w.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},w.createElement(H7.Provider,{value:y},b))))}),uz=w.forwardRef((e,t)=>{let{alwaysRender:n,...a}=e,l=w.useRef(null),o=Tl(c=>!c.search);return!n&&!o?null:w.createElement(Ol.div,{ref:Nl(l,t),...a,"cmdk-separator":"",role:"separator"})}),dz=w.forwardRef((e,t)=>{let{onValueChange:n,...a}=e,l=e.value!=null,o=I1(),c=Tl(f=>f.search),d=Tl(f=>f.selectedItemId),m=qu();return w.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),w.createElement(Ol.input,{ref:t,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":d,id:m.inputId,type:"text",value:l?e.value:c,onChange:f=>{l||o.setState("search",f.target.value),n?.(f.target.value)}})}),mz=w.forwardRef((e,t)=>{let{children:n,label:a="Suggestions",...l}=e,o=w.useRef(null),c=w.useRef(null),d=Tl(f=>f.selectedItemId),m=qu();return w.useEffect(()=>{if(c.current&&o.current){let f=c.current,p=o.current,x,y=new ResizeObserver(()=>{x=requestAnimationFrame(()=>{let b=f.offsetHeight;p.style.setProperty("--cmdk-list-height",b.toFixed(1)+"px")})});return y.observe(f),()=>{cancelAnimationFrame(x),y.unobserve(f)}}},[]),w.createElement(Ol.div,{ref:Nl(o,t),...l,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":a,id:m.listId},Lm(e,f=>w.createElement("div",{ref:Nl(c,m.listInnerRef),"cmdk-list-sizer":""},f)))}),hz=w.forwardRef((e,t)=>{let{open:n,onOpenChange:a,overlayClassName:l,contentClassName:o,container:c,...d}=e;return w.createElement(f1,{open:n,onOpenChange:a},w.createElement(u1,{container:c},w.createElement(ym,{"cmdk-overlay":"",className:l}),w.createElement(bm,{"aria-label":e.label,"cmdk-dialog":"",className:o},w.createElement(U7,{ref:t,...d}))))}),fz=w.forwardRef((e,t)=>Tl(n=>n.filtered.count===0)?w.createElement(Ol.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),pz=w.forwardRef((e,t)=>{let{progress:n,children:a,label:l="Loading...",...o}=e;return w.createElement(Ol.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":l},Lm(e,c=>w.createElement("div",{"aria-hidden":!0},c)))}),Xr=Object.assign(U7,{List:mz,Item:oz,Input:dz,Group:cz,Separator:uz,Dialog:hz,Empty:fz,Loading:pz});function xz(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function gz(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function $7(e){let t=w.useRef(e);return xi(()=>{t.current=e}),t}var xi=typeof window>"u"?w.useEffect:w.useLayoutEffect;function ko(e){let t=w.useRef();return t.current===void 0&&(t.current=e()),t}function Tl(e){let t=I1(),n=()=>e(t.snapshot());return w.useSyncExternalStore(t.subscribe,n,n)}function V7(e,t,n,a=[]){let l=w.useRef(),o=qu();return xi(()=>{var c;let d=(()=>{var f;for(let p of n){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(f=p.current.textContent)==null?void 0:f.trim():l.current}})(),m=a.map(f=>f.trim());o.value(e,d,m),(c=t.current)==null||c.setAttribute(So,d),l.current=d}),l}var vz=()=>{let[e,t]=w.useState(),n=ko(()=>new Map);return xi(()=>{n.current.forEach(a=>a()),n.current=new Map},[e]),(a,l)=>{n.current.set(a,l),t({})}};function yz(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Lm({asChild:e,children:t},n){return e&&w.isValidElement(t)?w.cloneElement(yz(t),{ref:t.ref},n(t.props.children)):n(t)}var bz={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const G7=w.forwardRef(({className:e,...t},n)=>r.jsx(Xr,{ref:n,className:me("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));G7.displayName=Xr.displayName;const Y7=w.forwardRef(({className:e,...t},n)=>r.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[r.jsx(Gr,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),r.jsx(Xr.Input,{ref:n,className:me("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));Y7.displayName=Xr.Input.displayName;const W7=w.forwardRef(({className:e,...t},n)=>r.jsx(Xr.List,{ref:n,className:me("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));W7.displayName=Xr.List.displayName;const X7=w.forwardRef((e,t)=>r.jsx(Xr.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));X7.displayName=Xr.Empty.displayName;const K7=w.forwardRef(({className:e,...t},n)=>r.jsx(Xr.Group,{ref:n,className:me("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));K7.displayName=Xr.Group.displayName;const wz=w.forwardRef(({className:e,...t},n)=>r.jsx(Xr.Separator,{ref:n,className:me("-mx-1 h-px bg-border",e),...t}));wz.displayName=Xr.Separator.displayName;const Q7=w.forwardRef(({className:e,...t},n)=>r.jsx(Xr.Item,{ref:n,className:me("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));Q7.displayName=Xr.Item.displayName;function jz({options:e,selected:t,onChange:n,placeholder:a="选择选项...",emptyText:l="未找到选项",className:o}){const[c,d]=w.useState(!1),m=p=>{t.includes(p)?n(t.filter(x=>x!==p)):n([...t,p])},f=p=>{n(t.filter(x=>x!==p))};return r.jsxs(kl,{open:c,onOpenChange:d,children:[r.jsx(Cl,{asChild:!0,children:r.jsxs(re,{variant:"outline",role:"combobox","aria-expanded":c,className:me("w-full justify-between min-h-10 h-auto",o),children:[r.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:t.length===0?r.jsx("span",{className:"text-muted-foreground",children:a}):t.map(p=>{const x=e.find(y=>y.value===p);return r.jsxs(on,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80",onClick:y=>{y.stopPropagation(),f(p)},children:[x?.label||p,r.jsx(Mu,{className:"ml-1 h-3 w-3",strokeWidth:2,fill:"none"})]},p)})}),r.jsx(gT,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),r.jsx(Ps,{className:"w-full p-0",align:"start",children:r.jsxs(G7,{children:[r.jsx(Y7,{placeholder:"搜索...",className:"h-9"}),r.jsxs(W7,{children:[r.jsx(X7,{children:l}),r.jsx(K7,{children:e.map(p=>{const x=t.includes(p.value);return r.jsxs(Q7,{value:p.value,onSelect:()=>m(p.value),children:[r.jsx("div",{className:me("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",x?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:r.jsx(di,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),r.jsx("span",{children:p.label})]},p.value)})})]})]})})]})}function Nz(){const[e,t]=w.useState([]),[n,a]=w.useState([]),[l,o]=w.useState([]),[c,d]=w.useState(null),[m,f]=w.useState(!0),[p,x]=w.useState(!1),[y,b]=w.useState(!1),[j,k]=w.useState(!1),[S,_]=w.useState(!1),[M,D]=w.useState(!1),[z,L]=w.useState(!1),[E,R]=w.useState(null),[H,$]=w.useState(null),[I,G]=w.useState(!1),[te,we]=w.useState(null),[J,ae]=w.useState(""),[U,q]=w.useState(new Set),[W,oe]=w.useState(!1),[P,je]=w.useState(1),[Z,O]=w.useState(20),[Ne,se]=w.useState(""),{toast:Ce}=pr(),ye=w.useRef(null),Be=w.useRef(null),ie=w.useRef(!0);w.useEffect(()=>{He()},[]);const He=async()=>{try{f(!0);const he=await Ao(),Me=he.models||[];t(Me),o(Me.map(mt=>mt.name));const dt=he.api_providers||[];a(dt.map(mt=>mt.name)),d(he.model_task_config||null),k(!1),ie.current=!1}catch(he){console.error("加载配置失败:",he)}finally{f(!1)}},lt=async()=>{try{_(!0),P1().catch(()=>{}),D(!0)}catch(he){console.error("重启失败:",he),D(!1),Ce({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),_(!1)}},ve=async()=>{try{x(!0),ye.current&&clearTimeout(ye.current),Be.current&&clearTimeout(Be.current);const he=await Ao();he.models=e,he.model_task_config=c,await lm(he),k(!1),Ce({title:"保存成功",description:"正在重启麦麦..."}),await lt()}catch(he){console.error("保存配置失败:",he),Ce({title:"保存失败",description:he.message,variant:"destructive"}),x(!1)}},Ze=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},We=()=>{D(!1),_(!1),Ce({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},pn=w.useCallback(async he=>{if(!ie.current)try{b(!0),await Ex("models",he),k(!1)}catch(Me){console.error("自动保存模型列表失败:",Me),k(!0)}finally{b(!1)}},[]),Bn=w.useCallback(async he=>{if(!ie.current)try{b(!0),await Ex("model_task_config",he),k(!1)}catch(Me){console.error("自动保存任务配置失败:",Me),k(!0)}finally{b(!1)}},[]);w.useEffect(()=>{if(!ie.current)return k(!0),ye.current&&clearTimeout(ye.current),ye.current=setTimeout(()=>{pn(e)},2e3),()=>{ye.current&&clearTimeout(ye.current)}},[e,pn]),w.useEffect(()=>{if(!(ie.current||!c))return k(!0),Be.current&&clearTimeout(Be.current),Be.current=setTimeout(()=>{Bn(c)},2e3),()=>{Be.current&&clearTimeout(Be.current)}},[c,Bn]);const sr=async()=>{try{x(!0),ye.current&&clearTimeout(ye.current),Be.current&&clearTimeout(Be.current);const he=await Ao();he.models=e,he.model_task_config=c,await lm(he),k(!1),Ce({title:"保存成功",description:"模型配置已保存"}),await He()}catch(he){console.error("保存配置失败:",he),Ce({title:"保存失败",description:he.message,variant:"destructive"})}finally{x(!1)}},Qe=(he,Me)=>{R(he||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),$(Me),L(!0)},Gn=()=>{if(!E)return;const he={...E,price_in:E.price_in??0,price_out:E.price_out??0};let Me;H!==null?(Me=[...e],Me[H]=he):Me=[...e,he],t(Me),o(Me.map(dt=>dt.name)),L(!1),R(null),$(null)},Sr=he=>{if(!he&&E){const Me={...E,price_in:E.price_in??0,price_out:E.price_out??0};R(Me)}L(he)},Er=he=>{we(he),G(!0)},Sn=()=>{if(te!==null){const he=e.filter((Me,dt)=>dt!==te);t(he),o(he.map(Me=>Me.name)),Ce({title:"删除成功",description:"模型已从列表中移除"})}G(!1),we(null)},lr=he=>{const Me=new Set(U);Me.has(he)?Me.delete(he):Me.add(he),q(Me)},Ue=()=>{if(U.size===Oe.length)q(new Set);else{const he=Oe.map((Me,dt)=>e.findIndex(mt=>mt===Oe[dt]));q(new Set(he))}},Ln=()=>{if(U.size===0){Ce({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}oe(!0)},K=()=>{const he=e.filter((Me,dt)=>!U.has(dt));t(he),o(he.map(Me=>Me.name)),q(new Set),oe(!1),Ce({title:"批量删除成功",description:`已删除 ${U.size} 个模型`})},ge=(he,Me,dt)=>{c&&d({...c,[he]:{...c[he],[Me]:dt}})},Oe=e.filter(he=>{if(!J)return!0;const Me=J.toLowerCase();return he.name.toLowerCase().includes(Me)||he.model_identifier.toLowerCase().includes(Me)||he.api_provider.toLowerCase().includes(Me)}),nt=Math.ceil(Oe.length/Z),kt=Oe.slice((P-1)*Z,P*Z),Qn=()=>{const he=parseInt(Ne);he>=1&&he<=nt&&(je(he),se(""))},Ar=he=>c?[c.utils?.model_list||[],c.utils_small?.model_list||[],c.tool_use?.model_list||[],c.replyer?.model_list||[],c.planner?.model_list||[],c.vlm?.model_list||[],c.voice?.model_list||[],c.embedding?.model_list||[],c.lpmm_entity_extract?.model_list||[],c.lpmm_rdf_build?.model_list||[],c.lpmm_qa?.model_list||[]].some(dt=>dt.includes(he)):!1;return m?r.jsx(Xt,{className:"h-full",children:r.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):r.jsx(Xt,{className:"h-full",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型配置"}),r.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理模型和任务配置"})]}),r.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[r.jsxs(re,{onClick:sr,disabled:p||y||!j||S,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[r.jsx(y1,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),p?"保存中...":y?"自动保存中...":j?"保存配置":"已保存"]}),r.jsxs(cn,{children:[r.jsx(Xn,{asChild:!0,children:r.jsxs(re,{disabled:p||y||S,size:"sm",className:"flex-1 sm:flex-none",children:[r.jsx(b1,{className:"mr-2 h-4 w-4"}),S?"重启中...":j?"保存并重启":"重启麦麦"]})}),r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认重启麦麦?"}),r.jsx(en,{children:j?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:j?ve:lt,children:j?"保存并重启":"确认重启"})]})]})]})]})]}),r.jsxs(Fu,{children:[r.jsx(hi,{className:"h-4 w-4"}),r.jsxs(Iu,{children:["配置更新后需要",r.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),r.jsxs(Sl,{defaultValue:"models",className:"w-full",children:[r.jsxs(Ls,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[r.jsx(Rt,{value:"models",children:"模型配置"}),r.jsx(Rt,{value:"tasks",children:"模型任务配置"})]}),r.jsxs(ln,{value:"models",className:"space-y-4 mt-0",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),r.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[U.size>0&&r.jsxs(re,{onClick:Ln,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[r.jsx(Ot,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",U.size,")"]}),r.jsxs(re,{onClick:()=>Qe(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[r.jsx(mr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[r.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[r.jsx(Gr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{placeholder:"搜索模型名称、标识符或提供商...",value:J,onChange:he=>ae(he.target.value),className:"pl-9"})]}),J&&r.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Oe.length," 个结果"]})]}),r.jsx("div",{className:"md:hidden space-y-3",children:kt.length===0?r.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:J?"未找到匹配的模型":"暂无模型配置"}):kt.map((he,Me)=>{const dt=e.findIndex(Dr=>Dr===he),mt=Ar(he.name);return r.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-base",children:he.name}),r.jsx(on,{variant:mt?"default":"secondary",className:mt?"bg-green-600 hover:bg-green-700":"",children:mt?"已使用":"未使用"})]}),r.jsx("p",{className:"text-xs text-muted-foreground break-all",title:he.model_identifier,children:he.model_identifier})]}),r.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[r.jsxs(re,{variant:"default",size:"sm",onClick:()=>Qe(he,dt),children:[r.jsx(Ro,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),r.jsxs(re,{size:"sm",onClick:()=>Er(dt),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(Ot,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),r.jsx("p",{className:"font-medium",children:he.api_provider})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),r.jsx("p",{className:"font-medium",children:he.force_stream_mode?"是":"否"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),r.jsxs("p",{className:"font-medium",children:["¥",he.price_in,"/M"]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),r.jsxs("p",{className:"font-medium",children:["¥",he.price_out,"/M"]})]})]})]},Me)})}),r.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:r.jsxs(bi,{children:[r.jsx(wi,{children:r.jsxs(Un,{children:[r.jsx(ct,{className:"w-12",children:r.jsx(br,{checked:U.size===Oe.length&&Oe.length>0,onCheckedChange:Ue})}),r.jsx(ct,{className:"w-24",children:"使用状态"}),r.jsx(ct,{children:"模型名称"}),r.jsx(ct,{children:"模型标识符"}),r.jsx(ct,{children:"提供商"}),r.jsx(ct,{className:"text-right",children:"输入价格"}),r.jsx(ct,{className:"text-right",children:"输出价格"}),r.jsx(ct,{className:"text-center",children:"强制流式"}),r.jsx(ct,{className:"text-right",children:"操作"})]})}),r.jsx(ji,{children:kt.length===0?r.jsx(Un,{children:r.jsx(et,{colSpan:9,className:"text-center text-muted-foreground py-8",children:J?"未找到匹配的模型":"暂无模型配置"})}):kt.map((he,Me)=>{const dt=e.findIndex(Dr=>Dr===he),mt=Ar(he.name);return r.jsxs(Un,{children:[r.jsx(et,{children:r.jsx(br,{checked:U.has(dt),onCheckedChange:()=>lr(dt)})}),r.jsx(et,{children:r.jsx(on,{variant:mt?"default":"secondary",className:mt?"bg-green-600 hover:bg-green-700":"",children:mt?"已使用":"未使用"})}),r.jsx(et,{className:"font-medium",children:he.name}),r.jsx(et,{className:"max-w-xs truncate",title:he.model_identifier,children:he.model_identifier}),r.jsx(et,{children:he.api_provider}),r.jsxs(et,{className:"text-right",children:["¥",he.price_in,"/M"]}),r.jsxs(et,{className:"text-right",children:["¥",he.price_out,"/M"]}),r.jsx(et,{className:"text-center",children:he.force_stream_mode?"是":"否"}),r.jsx(et,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsxs(re,{variant:"default",size:"sm",onClick:()=>Qe(he,dt),children:[r.jsx(Ro,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),r.jsxs(re,{size:"sm",onClick:()=>Er(dt),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(Ot,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Me)})})]})}),Oe.length>0&&r.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),r.jsxs(_t,{value:Z.toString(),onValueChange:he=>{O(parseInt(he)),je(1),q(new Set)},children:[r.jsx(jt,{id:"page-size-model",className:"w-20",children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"10",children:"10"}),r.jsx(ze,{value:"20",children:"20"}),r.jsx(ze,{value:"50",children:"50"}),r.jsx(ze,{value:"100",children:"100"})]})]}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(P-1)*Z+1," 到"," ",Math.min(P*Z,Oe.length)," 条,共 ",Oe.length," 条"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(re,{variant:"outline",size:"sm",onClick:()=>je(1),disabled:P===1,className:"hidden sm:flex",children:r.jsx(Eu,{className:"h-4 w-4"})}),r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>je(he=>Math.max(1,he-1)),disabled:P===1,children:[r.jsx(vi,{className:"h-4 w-4 sm:mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te,{type:"number",value:Ne,onChange:he=>se(he.target.value),onKeyDown:he=>he.key==="Enter"&&Qn(),placeholder:P.toString(),className:"w-16 h-8 text-center",min:1,max:nt}),r.jsx(re,{variant:"outline",size:"sm",onClick:Qn,disabled:!Ne,className:"h-8",children:"跳转"})]}),r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>je(he=>he+1),disabled:P>=nt,children:[r.jsx("span",{className:"hidden sm:inline",children:"下一页"}),r.jsx(yi,{className:"h-4 w-4 sm:ml-1"})]}),r.jsx(re,{variant:"outline",size:"sm",onClick:()=>je(nt),disabled:P>=nt,className:"hidden sm:flex",children:r.jsx(Au,{className:"h-4 w-4"})})]})]})]}),r.jsxs(ln,{value:"tasks",className:"space-y-6 mt-0",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),c&&r.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[r.jsx(Ra,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:c.utils,modelNames:l,onChange:(he,Me)=>ge("utils",he,Me)}),r.jsx(Ra,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:c.utils_small,modelNames:l,onChange:(he,Me)=>ge("utils_small",he,Me)}),r.jsx(Ra,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:c.tool_use,modelNames:l,onChange:(he,Me)=>ge("tool_use",he,Me)}),r.jsx(Ra,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:c.replyer,modelNames:l,onChange:(he,Me)=>ge("replyer",he,Me)}),r.jsx(Ra,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:c.planner,modelNames:l,onChange:(he,Me)=>ge("planner",he,Me)}),r.jsx(Ra,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:c.vlm,modelNames:l,onChange:(he,Me)=>ge("vlm",he,Me),hideTemperature:!0}),r.jsx(Ra,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:c.voice,modelNames:l,onChange:(he,Me)=>ge("voice",he,Me),hideTemperature:!0,hideMaxTokens:!0}),r.jsx(Ra,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:c.embedding,modelNames:l,onChange:(he,Me)=>ge("embedding",he,Me),hideTemperature:!0,hideMaxTokens:!0}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),r.jsx(Ra,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:c.lpmm_entity_extract,modelNames:l,onChange:(he,Me)=>ge("lpmm_entity_extract",he,Me)}),r.jsx(Ra,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:c.lpmm_rdf_build,modelNames:l,onChange:(he,Me)=>ge("lpmm_rdf_build",he,Me)}),r.jsx(Ra,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:c.lpmm_qa,modelNames:l,onChange:(he,Me)=>ge("lpmm_qa",he,Me)})]})]})]})]}),r.jsx(hr,{open:z,onOpenChange:Sr,children:r.jsxs(nr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(rr,{children:[r.jsx(ar,{children:H!==null?"编辑模型":"添加模型"}),r.jsx(wr,{children:"配置模型的基本信息和参数"})]}),r.jsxs("div",{className:"grid gap-4 py-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"model_name",children:"模型名称 *"}),r.jsx(Te,{id:"model_name",value:E?.name||"",onChange:he=>R(Me=>Me?{...Me,name:he.target.value}:null),placeholder:"例如: qwen3-30b"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"model_identifier",children:"模型标识符 *"}),r.jsx(Te,{id:"model_identifier",value:E?.model_identifier||"",onChange:he=>R(Me=>Me?{...Me,model_identifier:he.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"API 提供商提供的模型 ID"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"api_provider",children:"API 提供商 *"}),r.jsxs(_t,{value:E?.api_provider||"",onValueChange:he=>R(Me=>Me?{...Me,api_provider:he}:null),children:[r.jsx(jt,{id:"api_provider",children:r.jsx(Mt,{placeholder:"选择提供商"})}),r.jsx(Nt,{children:n.map(he=>r.jsx(ze,{value:he,children:he},he))})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),r.jsx(Te,{id:"price_in",type:"number",step:"0.1",min:"0",value:E?.price_in??"",onChange:he=>{const Me=he.target.value===""?null:parseFloat(he.target.value);R(dt=>dt?{...dt,price_in:Me}:null)},placeholder:"默认: 0"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),r.jsx(Te,{id:"price_out",type:"number",step:"0.1",min:"0",value:E?.price_out??"",onChange:he=>{const Me=he.target.value===""?null:parseFloat(he.target.value);R(dt=>dt?{...dt,price_out:Me}:null)},placeholder:"默认: 0"})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gt,{id:"force_stream_mode",checked:E?.force_stream_mode||!1,onCheckedChange:he=>R(Me=>Me?{...Me,force_stream_mode:he}:null)}),r.jsx(Q,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),r.jsxs(Yr,{children:[r.jsx(re,{variant:"outline",onClick:()=>L(!1),children:"取消"}),r.jsx(re,{onClick:Gn,children:"保存"})]})]})}),r.jsx(cn,{open:I,onOpenChange:G,children:r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认删除"}),r.jsxs(en,{children:['确定要删除模型 "',te!==null?e[te]?.name:"",'" 吗? 此操作无法撤销。']})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:Sn,children:"删除"})]})]})}),r.jsx(cn,{open:W,onOpenChange:oe,children:r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认批量删除"}),r.jsxs(en,{children:["确定要删除选中的 ",U.size," 个模型吗? 此操作无法撤销。"]})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:K,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),M&&r.jsx(F1,{onRestartComplete:Ze,onRestartFailed:We})]})})}function Ra({title:e,description:t,taskConfig:n,modelNames:a,onChange:l,hideTemperature:o=!1,hideMaxTokens:c=!1}){const d=m=>{l("model_list",m)};return r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:e}),r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:t})]}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"模型列表"}),r.jsx(jz,{options:a.map(m=>({label:m,value:m})),selected:n.model_list||[],onChange:d,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!o&&r.jsxs("div",{className:"grid gap-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{children:"温度"}),r.jsx(Te,{type:"number",step:"0.1",min:"0",max:"1",value:n.temperature??.3,onChange:m=>{const f=parseFloat(m.target.value);!isNaN(f)&&f>=0&&f<=1&&l("temperature",f)},className:"w-20 h-8 text-sm"})]}),r.jsx(Rm,{value:[n.temperature??.3],onValueChange:m=>l("temperature",m[0]),min:0,max:1,step:.1,className:"w-full"})]}),!c&&r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"最大 Token"}),r.jsx(Te,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:m=>l("max_tokens",parseInt(m.target.value))})]})]})]})]})}const la={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}};function Sz(){const[e,t]=w.useState(null),[n,a]=w.useState(""),l=w.useRef(null),{toast:o}=pr(),c=x=>{const y=JSON.parse(JSON.stringify(la)),b=x.split(` -`);let j="";for(const k of b){const S=k.trim();if(!S||S.startsWith("#"))continue;const _=S.match(/^\[(\w+)\]$/);if(_){j=_[1];continue}const M=S.match(/^(\w+)\s*=\s*(.+)$/);if(M&&j){const[,D,z]=M,L=z.trim();let E;if(L==="true")E=!0;else if(L==="false")E=!1;else if(L.startsWith("[")&&L.endsWith("]")){const R=L.slice(1,-1).trim();if(R){const H=R.split(",").map(I=>{const G=I.trim();return isNaN(Number(G))?G.replace(/"/g,""):Number(G)}),$=typeof H[0];E=H.every(I=>typeof I===$)?H:H.filter(I=>typeof I=="number")}else E=[]}else L.startsWith('"')&&L.endsWith('"')?E=L.slice(1,-1):isNaN(Number(L))?E=L.replace(/"/g,""):E=Number(L);if(j in y){const R=y[j];R[D]=E}}}return y},d=x=>{const y=[],b=(j,k)=>j===""||j===null||j===void 0?k:j;return y.push("[inner]"),y.push(`version = "${b(x.inner.version,la.inner.version)}" # 版本号`),y.push("# 请勿修改版本号,除非你知道自己在做什么"),y.push(""),y.push("[nickname] # 现在没用"),y.push(`nickname = "${b(x.nickname.nickname,la.nickname.nickname)}"`),y.push(""),y.push("[napcat_server] # Napcat连接的ws服务设置"),y.push(`host = "${b(x.napcat_server.host,la.napcat_server.host)}" # Napcat设定的主机地址`),y.push(`port = ${b(x.napcat_server.port||0,la.napcat_server.port)} # Napcat设定的端口`),y.push(`token = "${b(x.napcat_server.token,la.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),y.push(`heartbeat_interval = ${b(x.napcat_server.heartbeat_interval||0,la.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),y.push(""),y.push("[maibot_server] # 连接麦麦的ws服务设置"),y.push(`host = "${b(x.maibot_server.host,la.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),y.push(`port = ${b(x.maibot_server.port||0,la.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),y.push(""),y.push("[chat] # 黑白名单功能"),y.push(`group_list_type = "${b(x.chat.group_list_type,la.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),y.push(`group_list = [${x.chat.group_list.join(", ")}] # 群组名单`),y.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),y.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),y.push(`private_list_type = "${b(x.chat.private_list_type,la.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),y.push(`private_list = [${x.chat.private_list.join(", ")}] # 私聊名单`),y.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),y.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),y.push(`ban_user_id = [${x.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),y.push(`ban_qq_bot = ${x.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),y.push(`enable_poke = ${x.chat.enable_poke} # 是否启用戳一戳功能`),y.push(""),y.push("[voice] # 发送语音设置"),y.push(`use_tts = ${x.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),y.push(""),y.push("[debug]"),y.push(`level = "${b(x.debug.level,la.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),y.join(` -`)},m=x=>{const y=x.target.files?.[0];if(!y)return;const b=new FileReader;b.onload=j=>{try{const k=j.target?.result,S=c(k);t(S),a(y.name),o({title:"上传成功",description:`已加载配置文件:${y.name}`})}catch(k){console.error("解析配置文件失败:",k),o({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},b.readAsText(y)},f=()=>{if(!e)return;const x=d(e),y=new Blob([x],{type:"text/plain;charset=utf-8"}),b=URL.createObjectURL(y),j=document.createElement("a");j.href=b,j.download=n||"config.toml",document.body.appendChild(j),j.click(),document.body.removeChild(j),URL.revokeObjectURL(b),o({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},p=()=>{t(JSON.parse(JSON.stringify(la))),a("config.toml"),o({title:"已加载默认配置",description:"可以开始编辑配置"})};return r.jsx(Xt,{className:"h-full",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),r.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]}),r.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[!e&&r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:l,type:"file",accept:".toml",className:"hidden",onChange:m}),r.jsxs(re,{onClick:()=>l.current?.click(),size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[r.jsx(vT,{className:"mr-2 h-4 w-4"}),"上传配置"]}),r.jsxs(re,{onClick:p,size:"sm",className:"flex-1 sm:flex-none",children:[r.jsx(jl,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),e&&r.jsxs(re,{onClick:f,size:"sm",children:[r.jsx(Z0,{className:"mr-2 h-4 w-4"}),"下载配置"]})]})]}),r.jsxs(Fu,{children:[r.jsx(hi,{className:"h-4 w-4"}),r.jsxs(Iu,{children:["适配器独立运行,需要"," ",r.jsx("strong",{children:"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"}),"。"]})]}),e?r.jsxs(Sl,{defaultValue:"napcat",className:"w-full",children:[r.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:r.jsxs(Ls,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[r.jsx(Rt,{value:"napcat",className:"flex-shrink-0",children:"Napcat 连接"}),r.jsx(Rt,{value:"maibot",className:"flex-shrink-0",children:"麦麦连接"}),r.jsx(Rt,{value:"chat",className:"flex-shrink-0",children:"聊天控制"}),r.jsx(Rt,{value:"voice",className:"flex-shrink-0",children:"语音设置"}),r.jsx(Rt,{value:"debug",className:"flex-shrink-0",children:"调试"})]})}),r.jsx(ln,{value:"napcat",className:"space-y-4",children:r.jsx(kz,{config:e,onChange:t})}),r.jsx(ln,{value:"maibot",className:"space-y-4",children:r.jsx(Cz,{config:e,onChange:t})}),r.jsx(ln,{value:"chat",className:"space-y-4",children:r.jsx(Tz,{config:e,onChange:t})}),r.jsx(ln,{value:"voice",className:"space-y-4",children:r.jsx(_z,{config:e,onChange:t})}),r.jsx(ln,{value:"debug",className:"space-y-4",children:r.jsx(Mz,{config:e,onChange:t})})]}):r.jsx("div",{className:"rounded-lg border bg-card p-12",children:r.jsxs("div",{className:"text-center space-y-4",children:[r.jsx(jl,{className:"h-16 w-16 mx-auto text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold",children:"尚未加载配置"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"请上传现有配置文件,或使用默认配置开始编辑"})]})]})})]})})}function kz({config:e,onChange:t}){return r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Napcat WebSocket 服务设置"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"napcat-host",children:"主机地址"}),r.jsx(Te,{id:"napcat-host",value:e.napcat_server.host,onChange:n=>t({...e,napcat_server:{...e.napcat_server,host:n.target.value}}),placeholder:"localhost"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"napcat-port",children:"端口"}),r.jsx(Te,{id:"napcat-port",type:"number",value:e.napcat_server.port||"",onChange:n=>t({...e,napcat_server:{...e.napcat_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8095"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"napcat-token",children:"访问令牌(Token)"}),r.jsx(Te,{id:"napcat-token",type:"password",value:e.napcat_server.token,onChange:n=>t({...e,napcat_server:{...e.napcat_server,token:n.target.value}}),placeholder:"留空表示无需令牌"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"napcat-heartbeat",children:"心跳间隔(秒)"}),r.jsx(Te,{id:"napcat-heartbeat",type:"number",value:e.napcat_server.heartbeat_interval||"",onChange:n=>t({...e,napcat_server:{...e.napcat_server,heartbeat_interval:n.target.value?parseInt(n.target.value):0}}),placeholder:"30"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function Cz({config:e,onChange:t}){return r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"麦麦 WebSocket 服务设置"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"maibot-host",children:"主机地址"}),r.jsx(Te,{id:"maibot-host",value:e.maibot_server.host,onChange:n=>t({...e,maibot_server:{...e.maibot_server,host:n.target.value}}),placeholder:"localhost"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"maibot-port",children:"端口"}),r.jsx(Te,{id:"maibot-port",type:"number",value:e.maibot_server.port||"",onChange:n=>t({...e,maibot_server:{...e.maibot_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8000"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function Tz({config:e,onChange:t}){const n=o=>{const c={...e};o==="group"?c.chat.group_list=[...c.chat.group_list,0]:o==="private"?c.chat.private_list=[...c.chat.private_list,0]:c.chat.ban_user_id=[...c.chat.ban_user_id,0],t(c)},a=(o,c)=>{const d={...e};o==="group"?d.chat.group_list=d.chat.group_list.filter((m,f)=>f!==c):o==="private"?d.chat.private_list=d.chat.private_list.filter((m,f)=>f!==c):d.chat.ban_user_id=d.chat.ban_user_id.filter((m,f)=>f!==c),t(d)},l=(o,c,d)=>{const m={...e};o==="group"?m.chat.group_list[c]=d:o==="private"?m.chat.private_list[c]=d:m.chat.ban_user_id[c]=d,t(m)};return r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天黑白名单功能"}),r.jsxs("div",{className:"grid gap-6",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"群组名单类型"}),r.jsxs(_t,{value:e.chat.group_list_type,onValueChange:o=>t({...e,chat:{...e.chat,group_list_type:o}}),children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),r.jsx(ze,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{children:"群组列表"}),r.jsxs(re,{onClick:()=>n("group"),size:"sm",variant:"outline",children:[r.jsx(jl,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),e.chat.group_list.map((o,c)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{type:"number",value:o,onChange:d=>l("group",c,parseInt(d.target.value)||0),placeholder:"输入群号"}),r.jsxs(cn,{children:[r.jsx(Xn,{asChild:!0,children:r.jsx(re,{size:"icon",variant:"outline",children:r.jsx(Ot,{className:"h-4 w-4"})})}),r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认删除"}),r.jsxs(en,{children:["确定要删除群号 ",o," 吗?此操作无法撤销。"]})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:()=>a("group",c),children:"删除"})]})]})]})]},c)),e.chat.group_list.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"私聊名单类型"}),r.jsxs(_t,{value:e.chat.private_list_type,onValueChange:o=>t({...e,chat:{...e.chat,private_list_type:o}}),children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),r.jsx(ze,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{children:"私聊列表"}),r.jsxs(re,{onClick:()=>n("private"),size:"sm",variant:"outline",children:[r.jsx(jl,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),e.chat.private_list.map((o,c)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{type:"number",value:o,onChange:d=>l("private",c,parseInt(d.target.value)||0),placeholder:"输入QQ号"}),r.jsxs(cn,{children:[r.jsx(Xn,{asChild:!0,children:r.jsx(re,{size:"icon",variant:"outline",children:r.jsx(Ot,{className:"h-4 w-4"})})}),r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认删除"}),r.jsxs(en,{children:["确定要删除用户 ",o," 吗?此操作无法撤销。"]})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:()=>a("private",c),children:"删除"})]})]})]})]},c)),e.chat.private_list.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Q,{children:"全局禁止名单"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),r.jsxs(re,{onClick:()=>n("ban"),size:"sm",variant:"outline",children:[r.jsx(jl,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),e.chat.ban_user_id.map((o,c)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{type:"number",value:o,onChange:d=>l("ban",c,parseInt(d.target.value)||0),placeholder:"输入QQ号"}),r.jsxs(cn,{children:[r.jsx(Xn,{asChild:!0,children:r.jsx(re,{size:"icon",variant:"outline",children:r.jsx(Ot,{className:"h-4 w-4"})})}),r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认删除"}),r.jsxs(en,{children:["确定要从全局禁止名单中删除用户 ",o," 吗?此操作无法撤销。"]})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:()=>a("ban",c),children:"删除"})]})]})]})]},c)),e.chat.ban_user_id.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Q,{children:"屏蔽QQ官方机器人"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),r.jsx(gt,{checked:e.chat.ban_qq_bot,onCheckedChange:o=>t({...e,chat:{...e.chat,ban_qq_bot:o}})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Q,{children:"启用戳一戳功能"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),r.jsx(gt,{checked:e.chat.enable_poke,onCheckedChange:o=>t({...e,chat:{...e.chat,enable_poke:o}})})]})]})]})})}function _z({config:e,onChange:t}){return r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"发送语音设置"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Q,{children:"使用 TTS 语音"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),r.jsx(gt,{checked:e.voice.use_tts,onCheckedChange:n=>t({...e,voice:{use_tts:n}})})]})]})})}function Mz({config:e,onChange:t}){return r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"调试设置"}),r.jsx("div",{className:"grid gap-4",children:r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"日志等级"}),r.jsxs(_t,{value:e.debug.level,onValueChange:n=>t({...e,debug:{level:n}}),children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"DEBUG",children:"DEBUG(调试)"}),r.jsx(ze,{value:"INFO",children:"INFO(信息)"}),r.jsx(ze,{value:"WARNING",children:"WARNING(警告)"}),r.jsx(ze,{value:"ERROR",children:"ERROR(错误)"}),r.jsx(ze,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function Mb(e){const t=[],n=String(e||"");let a=n.indexOf(","),l=0,o=!1;for(;!o;){a===-1&&(a=n.length,o=!0);const c=n.slice(l,a).trim();(c||!o)&&t.push(c),l=a+1,a=n.indexOf(",",l)}return t}function Ez(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Az=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Dz=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,zz={};function Eb(e,t){return(zz.jsx?Dz:Az).test(e)}const Oz=/[ \t\n\f\r]/g;function Rz(e){return typeof e=="object"?e.type==="text"?Ab(e.value):!1:Ab(e)}function Ab(e){return e.replace(Oz,"")===""}class Hu{constructor(t,n,a){this.normal=n,this.property=t,a&&(this.space=a)}}Hu.prototype.normal={};Hu.prototype.property={};Hu.prototype.space=void 0;function Z7(e,t){const n={},a={};for(const l of e)Object.assign(n,l.property),Object.assign(a,l.normal);return new Hu(n,a,t)}function gu(e){return e.toLowerCase()}class Kr{constructor(t,n){this.attribute=n,this.property=t}}Kr.prototype.attribute="";Kr.prototype.booleanish=!1;Kr.prototype.boolean=!1;Kr.prototype.commaOrSpaceSeparated=!1;Kr.prototype.commaSeparated=!1;Kr.prototype.defined=!1;Kr.prototype.mustUseProperty=!1;Kr.prototype.number=!1;Kr.prototype.overloadedBoolean=!1;Kr.prototype.property="";Kr.prototype.spaceSeparated=!1;Kr.prototype.space=void 0;let Bz=0;const xt=Ni(),Hn=Ni(),zx=Ni(),De=Ni(),gn=Ni(),Do=Ni(),ia=Ni();function Ni(){return 2**++Bz}const Ox=Object.freeze(Object.defineProperty({__proto__:null,boolean:xt,booleanish:Hn,commaOrSpaceSeparated:ia,commaSeparated:Do,number:De,overloadedBoolean:zx,spaceSeparated:gn},Symbol.toStringTag,{value:"Module"})),Ep=Object.keys(Ox);class q1 extends Kr{constructor(t,n,a,l){let o=-1;if(super(t,n),Db(this,"space",l),typeof a=="number")for(;++o4&&n.slice(0,4)==="data"&&qz.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(zb,Uz);a="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!zb.test(o)){let c=o.replace(Iz,Hz);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}l=q1}return new l(a,t)}function Hz(e){return"-"+e.toLowerCase()}function Uz(e){return e.charAt(1).toUpperCase()}const lj=Z7([J7,Lz,nj,rj,aj],"html"),Pm=Z7([J7,Pz,nj,rj,aj],"svg");function Ob(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function $z(e){return e.join(" ").trim()}var go={},Ap,Rb;function Vz(){if(Rb)return Ap;Rb=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,d=/^\s+|\s+$/g,m=` -`,f="/",p="*",x="",y="comment",b="declaration";function j(S,_){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];_=_||{};var M=1,D=1;function z(J){var ae=J.match(t);ae&&(M+=ae.length);var U=J.lastIndexOf(m);D=~U?J.length-U:D+J.length}function L(){var J={line:M,column:D};return function(ae){return ae.position=new E(J),$(),ae}}function E(J){this.start=J,this.end={line:M,column:D},this.source=_.source}E.prototype.content=S;function R(J){var ae=new Error(_.source+":"+M+":"+D+": "+J);if(ae.reason=J,ae.filename=_.source,ae.line=M,ae.column=D,ae.source=S,!_.silent)throw ae}function H(J){var ae=J.exec(S);if(ae){var U=ae[0];return z(U),S=S.slice(U.length),ae}}function $(){H(n)}function I(J){var ae;for(J=J||[];ae=G();)ae!==!1&&J.push(ae);return J}function G(){var J=L();if(!(f!=S.charAt(0)||p!=S.charAt(1))){for(var ae=2;x!=S.charAt(ae)&&(p!=S.charAt(ae)||f!=S.charAt(ae+1));)++ae;if(ae+=2,x===S.charAt(ae-1))return R("End of comment missing");var U=S.slice(2,ae-2);return D+=2,z(U),S=S.slice(ae),D+=2,J({type:y,comment:U})}}function te(){var J=L(),ae=H(a);if(ae){if(G(),!H(l))return R("property missing ':'");var U=H(o),q=J({type:b,property:k(ae[0].replace(e,x)),value:U?k(U[0].replace(e,x)):x});return H(c),q}}function we(){var J=[];I(J);for(var ae;ae=te();)ae!==!1&&(J.push(ae),I(J));return J}return $(),we()}function k(S){return S?S.replace(d,x):x}return Ap=j,Ap}var Bb;function Gz(){if(Bb)return go;Bb=1;var e=go&&go.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(go,"__esModule",{value:!0}),go.default=n;const t=e(Vz());function n(a,l){let o=null;if(!a||typeof a!="string")return o;const c=(0,t.default)(a),d=typeof l=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:f,value:p}=m;d?l(f,p,m):p&&(o=o||{},o[f]=p)}),o}return go}var Zc={},Lb;function Yz(){if(Lb)return Zc;Lb=1,Object.defineProperty(Zc,"__esModule",{value:!0}),Zc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,o=function(f){return!f||n.test(f)||e.test(f)},c=function(f,p){return p.toUpperCase()},d=function(f,p){return"".concat(p,"-")},m=function(f,p){return p===void 0&&(p={}),o(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(l,d):f=f.replace(a,d),f.replace(t,c))};return Zc.camelCase=m,Zc}var Jc,Pb;function Wz(){if(Pb)return Jc;Pb=1;var e=Jc&&Jc.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(Gz()),n=Yz();function a(l,o){var c={};return!l||typeof l!="string"||(0,t.default)(l,function(d,m){d&&m&&(c[(0,n.camelCase)(d,o)]=m)}),c}return a.default=a,Jc=a,Jc}var Xz=Wz();const Kz=M5(Xz),ij=oj("end"),H1=oj("start");function oj(e){return t;function t(n){const a=n&&n.position&&n.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function Qz(e){const t=H1(e),n=ij(e);if(t&&n)return{start:t,end:n}}function ou(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Fb(e.position):"start"in e||"end"in e?Fb(e):"line"in e||"column"in e?Rx(e):""}function Rx(e){return Ib(e&&e.line)+":"+Ib(e&&e.column)}function Fb(e){return Rx(e&&e.start)+"-"+Rx(e&&e.end)}function Ib(e){return e&&typeof e=="number"?e:1}class jr extends Error{constructor(t,n,a){super(),typeof n=="string"&&(a=n,n=void 0);let l="",o={},c=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?l=t:!o.cause&&t&&(c=!0,l=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof a=="string"){const m=a.indexOf(":");m===-1?o.ruleId=a:(o.source=a.slice(0,m),o.ruleId=a.slice(m+1))}if(!o.place&&o.ancestors&&o.ancestors){const m=o.ancestors[o.ancestors.length-1];m&&(o.place=m.position)}const d=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=d?d.line:void 0,this.name=ou(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=c&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}jr.prototype.file="";jr.prototype.name="";jr.prototype.reason="";jr.prototype.message="";jr.prototype.stack="";jr.prototype.column=void 0;jr.prototype.line=void 0;jr.prototype.ancestors=void 0;jr.prototype.cause=void 0;jr.prototype.fatal=void 0;jr.prototype.place=void 0;jr.prototype.ruleId=void 0;jr.prototype.source=void 0;const U1={}.hasOwnProperty,Zz=new Map,Jz=/[A-Z]/g,eO=new Set(["table","tbody","thead","tfoot","tr"]),tO=new Set(["td","th"]),cj="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function nO(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let a;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=uO(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=cO(n,t.jsx,t.jsxs)}const l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:a,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Pm:lj,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=uj(l,e,void 0);return o&&typeof o!="string"?o:l.create(e,l.Fragment,{children:o||void 0},void 0)}function uj(e,t,n){if(t.type==="element")return rO(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return aO(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return lO(e,t,n);if(t.type==="mdxjsEsm")return sO(e,t);if(t.type==="root")return iO(e,t,n);if(t.type==="text")return oO(e,t)}function rO(e,t,n){const a=e.schema;let l=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(l=Pm,e.schema=l),e.ancestors.push(t);const o=mj(e,t.tagName,!1),c=dO(e,t);let d=V1(e,t);return eO.has(t.tagName)&&(d=d.filter(function(m){return typeof m=="string"?!Rz(m):!0})),dj(e,c,o,t),$1(c,d),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function aO(e,t){if(t.data&&t.data.estree&&e.evaluater){const a=t.data.estree.body[0];return a.type,e.evaluater.evaluateExpression(a.expression)}vu(e,t.position)}function sO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);vu(e,t.position)}function lO(e,t,n){const a=e.schema;let l=a;t.name==="svg"&&a.space==="html"&&(l=Pm,e.schema=l),e.ancestors.push(t);const o=t.name===null?e.Fragment:mj(e,t.name,!0),c=mO(e,t),d=V1(e,t);return dj(e,c,o,t),$1(c,d),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function iO(e,t,n){const a={};return $1(a,V1(e,t)),e.create(t,e.Fragment,a,n)}function oO(e,t){return t.value}function dj(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function $1(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function cO(e,t,n){return a;function a(l,o,c,d){const f=Array.isArray(c.children)?n:t;return d?f(o,c,d):f(o,c)}}function uO(e,t){return n;function n(a,l,o,c){const d=Array.isArray(o.children),m=H1(a);return t(l,o,c,d,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function dO(e,t){const n={};let a,l;for(l in t.properties)if(l!=="children"&&U1.call(t.properties,l)){const o=hO(e,l,t.properties[l]);if(o){const[c,d]=o;e.tableCellAlignToStyle&&c==="align"&&typeof d=="string"&&tO.has(t.tagName)?a=d:n[c]=d}}if(a){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return n}function mO(e,t){const n={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const o=a.data.estree.body[0];o.type;const c=o.expression;c.type;const d=c.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else vu(e,t.position);else{const l=a.name;let o;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const d=a.value.data.estree.body[0];d.type,o=e.evaluater.evaluateExpression(d.expression)}else vu(e,t.position);else o=a.value===null?!0:a.value;n[l]=o}return n}function V1(e,t){const n=[];let a=-1;const l=e.passKeys?new Map:Zz;for(;++al?0:l+t:t=t>l?l:t,n=n>0?n:0,a.length<1e4)c=Array.from(a),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);o0?(ua(e,e.length,0,t),e):t}const Ub={}.hasOwnProperty;function fj(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ia(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Tr=Rl(/[A-Za-z]/),yr=Rl(/[\dA-Za-z]/),jO=Rl(/[#-'*+\--9=?A-Z^-~]/);function im(e){return e!==null&&(e<32||e===127)}const Bx=Rl(/\d/),NO=Rl(/[\dA-Fa-f]/),SO=Rl(/[!-/:-@[-`{-~]/);function Ye(e){return e!==null&&e<-2}function hn(e){return e!==null&&(e<0||e===32)}function Et(e){return e===-2||e===-1||e===32}const Fm=Rl(new RegExp("\\p{P}|\\p{S}","u")),gi=Rl(/\s/);function Rl(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Zo(e){const t=[];let n=-1,a=0,l=0;for(;++n55295&&o<57344){const d=e.charCodeAt(n+1);o<56320&&d>56319&&d<57344?(c=String.fromCharCode(o,d),l=1):c="�"}else c=String.fromCharCode(o);c&&(t.push(e.slice(a,n),encodeURIComponent(c)),a=n+l+1,c=""),l&&(n+=l,l=0)}return t.join("")+e.slice(a)}function St(e,t,n,a){const l=a?a-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(m){return Et(m)?(e.enter(n),d(m)):t(m)}function d(m){return Et(m)&&o++c))return;const R=t.events.length;let H=R,$,I;for(;H--;)if(t.events[H][0]==="exit"&&t.events[H][1].type==="chunkFlow"){if($){I=t.events[H][1].end;break}$=!0}for(_(a),E=R;ED;){const L=n[z];t.containerState=L[1],L[0].exit.call(t,e)}n.length=D}function M(){l.write([null]),o=void 0,l=void 0,t.containerState._closeFlow=void 0}}function MO(e,t,n){return St(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Io(e){if(e===null||hn(e)||gi(e))return 1;if(Fm(e))return 2}function Im(e,t,n){const a=[];let l=-1;for(;++l1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const x={...e[a][1].end},y={...e[n][1].start};Vb(x,-m),Vb(y,m),c={type:m>1?"strongSequence":"emphasisSequence",start:x,end:{...e[a][1].end}},d={type:m>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},o={type:m>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},l={type:m>1?"strong":"emphasis",start:{...c.start},end:{...d.end}},e[a][1].end={...c.start},e[n][1].start={...d.end},f=[],e[a][1].end.offset-e[a][1].start.offset&&(f=ka(f,[["enter",e[a][1],t],["exit",e[a][1],t]])),f=ka(f,[["enter",l,t],["enter",c,t],["exit",c,t],["enter",o,t]]),f=ka(f,Im(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),f=ka(f,[["exit",o,t],["enter",d,t],["exit",d,t],["exit",l,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,f=ka(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,ua(e,a-1,n-a+3,f),n=a+f.length-p-2;break}}for(n=-1;++n0&&Et(E)?St(e,M,"linePrefix",o+1)(E):M(E)}function M(E){return E===null||Ye(E)?e.check(Gb,k,z)(E):(e.enter("codeFlowValue"),D(E))}function D(E){return E===null||Ye(E)?(e.exit("codeFlowValue"),M(E)):(e.consume(E),D)}function z(E){return e.exit("codeFenced"),t(E)}function L(E,R,H){let $=0;return I;function I(ae){return E.enter("lineEnding"),E.consume(ae),E.exit("lineEnding"),G}function G(ae){return E.enter("codeFencedFence"),Et(ae)?St(E,te,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ae):te(ae)}function te(ae){return ae===d?(E.enter("codeFencedFenceSequence"),we(ae)):H(ae)}function we(ae){return ae===d?($++,E.consume(ae),we):$>=c?(E.exit("codeFencedFenceSequence"),Et(ae)?St(E,J,"whitespace")(ae):J(ae)):H(ae)}function J(ae){return ae===null||Ye(ae)?(E.exit("codeFencedFence"),R(ae)):H(ae)}}}function qO(e,t,n){const a=this;return l;function l(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o)}function o(c){return a.parser.lazy[a.now().line]?n(c):t(c)}}const zp={name:"codeIndented",tokenize:UO},HO={partial:!0,tokenize:$O};function UO(e,t,n){const a=this;return l;function l(f){return e.enter("codeIndented"),St(e,o,"linePrefix",5)(f)}function o(f){const p=a.events[a.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?c(f):n(f)}function c(f){return f===null?m(f):Ye(f)?e.attempt(HO,c,m)(f):(e.enter("codeFlowValue"),d(f))}function d(f){return f===null||Ye(f)?(e.exit("codeFlowValue"),c(f)):(e.consume(f),d)}function m(f){return e.exit("codeIndented"),t(f)}}function $O(e,t,n){const a=this;return l;function l(c){return a.parser.lazy[a.now().line]?n(c):Ye(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):St(e,o,"linePrefix",5)(c)}function o(c){const d=a.events[a.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(c):Ye(c)?l(c):n(c)}}const VO={name:"codeText",previous:YO,resolve:GO,tokenize:WO};function GO(e){let t=e.length-4,n=3,a,l;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(a=n;++a=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(t,n,a){const l=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return a&&eu(this.left,a),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),eu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),eu(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(c):e.interrupt(a.parser.constructs.flow,n,t)(c)}}function bj(e,t,n,a,l,o,c,d,m){const f=m||Number.POSITIVE_INFINITY;let p=0;return x;function x(_){return _===60?(e.enter(a),e.enter(l),e.enter(o),e.consume(_),e.exit(o),y):_===null||_===32||_===41||im(_)?n(_):(e.enter(a),e.enter(c),e.enter(d),e.enter("chunkString",{contentType:"string"}),k(_))}function y(_){return _===62?(e.enter(o),e.consume(_),e.exit(o),e.exit(l),e.exit(a),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),b(_))}function b(_){return _===62?(e.exit("chunkString"),e.exit(d),y(_)):_===null||_===60||Ye(_)?n(_):(e.consume(_),_===92?j:b)}function j(_){return _===60||_===62||_===92?(e.consume(_),b):b(_)}function k(_){return!p&&(_===null||_===41||hn(_))?(e.exit("chunkString"),e.exit(d),e.exit(c),e.exit(a),t(_)):p999||b===null||b===91||b===93&&!m||b===94&&!d&&"_hiddenFootnoteSupport"in c.parser.constructs?n(b):b===93?(e.exit(o),e.enter(l),e.consume(b),e.exit(l),e.exit(a),t):Ye(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),x(b))}function x(b){return b===null||b===91||b===93||Ye(b)||d++>999?(e.exit("chunkString"),p(b)):(e.consume(b),m||(m=!Et(b)),b===92?y:x)}function y(b){return b===91||b===92||b===93?(e.consume(b),d++,x):x(b)}}function jj(e,t,n,a,l,o){let c;return d;function d(y){return y===34||y===39||y===40?(e.enter(a),e.enter(l),e.consume(y),e.exit(l),c=y===40?41:y,m):n(y)}function m(y){return y===c?(e.enter(l),e.consume(y),e.exit(l),e.exit(a),t):(e.enter(o),f(y))}function f(y){return y===c?(e.exit(o),m(c)):y===null?n(y):Ye(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),St(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===c||y===null||Ye(y)?(e.exit("chunkString"),f(y)):(e.consume(y),y===92?x:p)}function x(y){return y===c||y===92?(e.consume(y),p):p(y)}}function cu(e,t){let n;return a;function a(l){return Ye(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),n=!0,a):Et(l)?St(e,a,n?"linePrefix":"lineSuffix")(l):t(l)}}const nR={name:"definition",tokenize:aR},rR={partial:!0,tokenize:sR};function aR(e,t,n){const a=this;let l;return o;function o(b){return e.enter("definition"),c(b)}function c(b){return wj.call(a,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function d(b){return l=Ia(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),m):n(b)}function m(b){return hn(b)?cu(e,f)(b):f(b)}function f(b){return bj(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function p(b){return e.attempt(rR,x,x)(b)}function x(b){return Et(b)?St(e,y,"whitespace")(b):y(b)}function y(b){return b===null||Ye(b)?(e.exit("definition"),a.parser.defined.push(l),t(b)):n(b)}}function sR(e,t,n){return a;function a(d){return hn(d)?cu(e,l)(d):n(d)}function l(d){return jj(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function o(d){return Et(d)?St(e,c,"whitespace")(d):c(d)}function c(d){return d===null||Ye(d)?t(d):n(d)}}const lR={name:"hardBreakEscape",tokenize:iR};function iR(e,t,n){return a;function a(o){return e.enter("hardBreakEscape"),e.consume(o),l}function l(o){return Ye(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const oR={name:"headingAtx",resolve:cR,tokenize:uR};function cR(e,t){let n=e.length-2,a=3,l,o;return e[a][1].type==="whitespace"&&(a+=2),n-2>a&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(a===n-1||n-4>a&&e[n-2][1].type==="whitespace")&&(n-=a+1===n?2:4),n>a&&(l={type:"atxHeadingText",start:e[a][1].start,end:e[n][1].end},o={type:"chunkText",start:e[a][1].start,end:e[n][1].end,contentType:"text"},ua(e,a,n-a+1,[["enter",l,t],["enter",o,t],["exit",o,t],["exit",l,t]])),e}function uR(e,t,n){let a=0;return l;function l(p){return e.enter("atxHeading"),o(p)}function o(p){return e.enter("atxHeadingSequence"),c(p)}function c(p){return p===35&&a++<6?(e.consume(p),c):p===null||hn(p)?(e.exit("atxHeadingSequence"),d(p)):n(p)}function d(p){return p===35?(e.enter("atxHeadingSequence"),m(p)):p===null||Ye(p)?(e.exit("atxHeading"),t(p)):Et(p)?St(e,d,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function m(p){return p===35?(e.consume(p),m):(e.exit("atxHeadingSequence"),d(p))}function f(p){return p===null||p===35||hn(p)?(e.exit("atxHeadingText"),d(p)):(e.consume(p),f)}}const dR=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Wb=["pre","script","style","textarea"],mR={concrete:!0,name:"htmlFlow",resolveTo:pR,tokenize:xR},hR={partial:!0,tokenize:vR},fR={partial:!0,tokenize:gR};function pR(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function xR(e,t,n){const a=this;let l,o,c,d,m;return f;function f(O){return p(O)}function p(O){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(O),x}function x(O){return O===33?(e.consume(O),y):O===47?(e.consume(O),o=!0,k):O===63?(e.consume(O),l=3,a.interrupt?t:P):Tr(O)?(e.consume(O),c=String.fromCharCode(O),S):n(O)}function y(O){return O===45?(e.consume(O),l=2,b):O===91?(e.consume(O),l=5,d=0,j):Tr(O)?(e.consume(O),l=4,a.interrupt?t:P):n(O)}function b(O){return O===45?(e.consume(O),a.interrupt?t:P):n(O)}function j(O){const Ne="CDATA[";return O===Ne.charCodeAt(d++)?(e.consume(O),d===Ne.length?a.interrupt?t:te:j):n(O)}function k(O){return Tr(O)?(e.consume(O),c=String.fromCharCode(O),S):n(O)}function S(O){if(O===null||O===47||O===62||hn(O)){const Ne=O===47,se=c.toLowerCase();return!Ne&&!o&&Wb.includes(se)?(l=1,a.interrupt?t(O):te(O)):dR.includes(c.toLowerCase())?(l=6,Ne?(e.consume(O),_):a.interrupt?t(O):te(O)):(l=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(O):o?M(O):D(O))}return O===45||yr(O)?(e.consume(O),c+=String.fromCharCode(O),S):n(O)}function _(O){return O===62?(e.consume(O),a.interrupt?t:te):n(O)}function M(O){return Et(O)?(e.consume(O),M):I(O)}function D(O){return O===47?(e.consume(O),I):O===58||O===95||Tr(O)?(e.consume(O),z):Et(O)?(e.consume(O),D):I(O)}function z(O){return O===45||O===46||O===58||O===95||yr(O)?(e.consume(O),z):L(O)}function L(O){return O===61?(e.consume(O),E):Et(O)?(e.consume(O),L):D(O)}function E(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(e.consume(O),m=O,R):Et(O)?(e.consume(O),E):H(O)}function R(O){return O===m?(e.consume(O),m=null,$):O===null||Ye(O)?n(O):(e.consume(O),R)}function H(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||hn(O)?L(O):(e.consume(O),H)}function $(O){return O===47||O===62||Et(O)?D(O):n(O)}function I(O){return O===62?(e.consume(O),G):n(O)}function G(O){return O===null||Ye(O)?te(O):Et(O)?(e.consume(O),G):n(O)}function te(O){return O===45&&l===2?(e.consume(O),U):O===60&&l===1?(e.consume(O),q):O===62&&l===4?(e.consume(O),je):O===63&&l===3?(e.consume(O),P):O===93&&l===5?(e.consume(O),oe):Ye(O)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(hR,Z,we)(O)):O===null||Ye(O)?(e.exit("htmlFlowData"),we(O)):(e.consume(O),te)}function we(O){return e.check(fR,J,Z)(O)}function J(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),ae}function ae(O){return O===null||Ye(O)?we(O):(e.enter("htmlFlowData"),te(O))}function U(O){return O===45?(e.consume(O),P):te(O)}function q(O){return O===47?(e.consume(O),c="",W):te(O)}function W(O){if(O===62){const Ne=c.toLowerCase();return Wb.includes(Ne)?(e.consume(O),je):te(O)}return Tr(O)&&c.length<8?(e.consume(O),c+=String.fromCharCode(O),W):te(O)}function oe(O){return O===93?(e.consume(O),P):te(O)}function P(O){return O===62?(e.consume(O),je):O===45&&l===2?(e.consume(O),P):te(O)}function je(O){return O===null||Ye(O)?(e.exit("htmlFlowData"),Z(O)):(e.consume(O),je)}function Z(O){return e.exit("htmlFlow"),t(O)}}function gR(e,t,n){const a=this;return l;function l(c){return Ye(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):n(c)}function o(c){return a.parser.lazy[a.now().line]?n(c):t(c)}}function vR(e,t,n){return a;function a(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Uu,t,n)}}const yR={name:"htmlText",tokenize:bR};function bR(e,t,n){const a=this;let l,o,c;return d;function d(P){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(P),m}function m(P){return P===33?(e.consume(P),f):P===47?(e.consume(P),L):P===63?(e.consume(P),D):Tr(P)?(e.consume(P),H):n(P)}function f(P){return P===45?(e.consume(P),p):P===91?(e.consume(P),o=0,j):Tr(P)?(e.consume(P),M):n(P)}function p(P){return P===45?(e.consume(P),b):n(P)}function x(P){return P===null?n(P):P===45?(e.consume(P),y):Ye(P)?(c=x,q(P)):(e.consume(P),x)}function y(P){return P===45?(e.consume(P),b):x(P)}function b(P){return P===62?U(P):P===45?y(P):x(P)}function j(P){const je="CDATA[";return P===je.charCodeAt(o++)?(e.consume(P),o===je.length?k:j):n(P)}function k(P){return P===null?n(P):P===93?(e.consume(P),S):Ye(P)?(c=k,q(P)):(e.consume(P),k)}function S(P){return P===93?(e.consume(P),_):k(P)}function _(P){return P===62?U(P):P===93?(e.consume(P),_):k(P)}function M(P){return P===null||P===62?U(P):Ye(P)?(c=M,q(P)):(e.consume(P),M)}function D(P){return P===null?n(P):P===63?(e.consume(P),z):Ye(P)?(c=D,q(P)):(e.consume(P),D)}function z(P){return P===62?U(P):D(P)}function L(P){return Tr(P)?(e.consume(P),E):n(P)}function E(P){return P===45||yr(P)?(e.consume(P),E):R(P)}function R(P){return Ye(P)?(c=R,q(P)):Et(P)?(e.consume(P),R):U(P)}function H(P){return P===45||yr(P)?(e.consume(P),H):P===47||P===62||hn(P)?$(P):n(P)}function $(P){return P===47?(e.consume(P),U):P===58||P===95||Tr(P)?(e.consume(P),I):Ye(P)?(c=$,q(P)):Et(P)?(e.consume(P),$):U(P)}function I(P){return P===45||P===46||P===58||P===95||yr(P)?(e.consume(P),I):G(P)}function G(P){return P===61?(e.consume(P),te):Ye(P)?(c=G,q(P)):Et(P)?(e.consume(P),G):$(P)}function te(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),l=P,we):Ye(P)?(c=te,q(P)):Et(P)?(e.consume(P),te):(e.consume(P),J)}function we(P){return P===l?(e.consume(P),l=void 0,ae):P===null?n(P):Ye(P)?(c=we,q(P)):(e.consume(P),we)}function J(P){return P===null||P===34||P===39||P===60||P===61||P===96?n(P):P===47||P===62||hn(P)?$(P):(e.consume(P),J)}function ae(P){return P===47||P===62||hn(P)?$(P):n(P)}function U(P){return P===62?(e.consume(P),e.exit("htmlTextData"),e.exit("htmlText"),t):n(P)}function q(P){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),W}function W(P){return Et(P)?St(e,oe,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):oe(P)}function oe(P){return e.enter("htmlTextData"),c(P)}}const W1={name:"labelEnd",resolveAll:SR,resolveTo:kR,tokenize:CR},wR={tokenize:TR},jR={tokenize:_R},NR={tokenize:MR};function SR(e){let t=-1;const n=[];for(;++t=3&&(f===null||Ye(f))?(e.exit("thematicBreak"),t(f)):n(f)}function m(f){return f===l?(e.consume(f),a++,m):(e.exit("thematicBreakSequence"),Et(f)?St(e,d,"whitespace")(f):d(f))}}const Ir={continuation:{tokenize:FR},exit:qR,name:"list",tokenize:PR},BR={partial:!0,tokenize:HR},LR={partial:!0,tokenize:IR};function PR(e,t,n){const a=this,l=a.events[a.events.length-1];let o=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,c=0;return d;function d(b){const j=a.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(j==="listUnordered"?!a.containerState.marker||b===a.containerState.marker:Bx(b)){if(a.containerState.type||(a.containerState.type=j,e.enter(j,{_container:!0})),j==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(G0,n,f)(b):f(b);if(!a.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(b)}return n(b)}function m(b){return Bx(b)&&++c<10?(e.consume(b),m):(!a.interrupt||c<2)&&(a.containerState.marker?b===a.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),f(b)):n(b)}function f(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||b,e.check(Uu,a.interrupt?n:p,e.attempt(BR,y,x))}function p(b){return a.containerState.initialBlankLine=!0,o++,y(b)}function x(b){return Et(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return a.containerState.size=o+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function FR(e,t,n){const a=this;return a.containerState._closeFlow=void 0,e.check(Uu,l,o);function l(d){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,St(e,t,"listItemIndent",a.containerState.size+1)(d)}function o(d){return a.containerState.furtherBlankLines||!Et(d)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,c(d)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(LR,t,c)(d))}function c(d){return a.containerState._closeFlow=!0,a.interrupt=void 0,St(e,e.attempt(Ir,t,n),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function IR(e,t,n){const a=this;return St(e,l,"listItemIndent",a.containerState.size+1);function l(o){const c=a.events[a.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===a.containerState.size?t(o):n(o)}}function qR(e){e.exit(this.containerState.type)}function HR(e,t,n){const a=this;return St(e,l,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(o){const c=a.events[a.events.length-1];return!Et(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const Xb={name:"setextUnderline",resolveTo:UR,tokenize:$R};function UR(e,t){let n=e.length,a,l,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){a=n;break}e[n][1].type==="paragraph"&&(l=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const c={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",o?(e.splice(l,0,["enter",c,t]),e.splice(o+1,0,["exit",e[a][1],t]),e[a][1].end={...e[o][1].end}):e[a][1]=c,e.push(["exit",c,t]),e}function $R(e,t,n){const a=this;let l;return o;function o(f){let p=a.events.length,x;for(;p--;)if(a.events[p][1].type!=="lineEnding"&&a.events[p][1].type!=="linePrefix"&&a.events[p][1].type!=="content"){x=a.events[p][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||x)?(e.enter("setextHeadingLine"),l=f,c(f)):n(f)}function c(f){return e.enter("setextHeadingLineSequence"),d(f)}function d(f){return f===l?(e.consume(f),d):(e.exit("setextHeadingLineSequence"),Et(f)?St(e,m,"lineSuffix")(f):m(f))}function m(f){return f===null||Ye(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const VR={tokenize:GR};function GR(e){const t=this,n=e.attempt(Uu,a,e.attempt(this.parser.constructs.flowInitial,l,St(e,e.attempt(this.parser.constructs.flow,l,e.attempt(QO,l)),"linePrefix")));return n;function a(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function l(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const YR={resolveAll:Sj()},WR=Nj("string"),XR=Nj("text");function Nj(e){return{resolveAll:Sj(e==="text"?KR:void 0),tokenize:t};function t(n){const a=this,l=this.parser.constructs[e],o=n.attempt(l,c,d);return c;function c(p){return f(p)?o(p):d(p)}function d(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),m}function m(p){return f(p)?(n.exit("data"),o(p)):(n.consume(p),m)}function f(p){if(p===null)return!0;const x=l[p];let y=-1;if(x)for(;++y-1){const d=c[0];typeof d=="string"?c[0]=d.slice(a):c.shift()}o>0&&c.push(e[l].slice(0,o))}return c}function cB(e,t){let n=-1;const a=[];let l;for(;++n0){const Qn=Oe.tokenStack[Oe.tokenStack.length-1];(Qn[1]||Qb).call(Oe,void 0,Qn[0])}for(ge.position={start:gl(K.length>0?K[0][1].start:{line:1,column:1,offset:0}),end:gl(K.length>0?K[K.length-2][1].end:{line:1,column:1,offset:0})},kt=-1;++kt1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,m);const f={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(t,f),e.applyData(t,f)}function CB(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function TB(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Tj(e,t){const n=t.referenceType;let a="]";if(n==="collapsed"?a+="[]":n==="full"&&(a+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+a}];const l=e.all(t),o=l[0];o&&o.type==="text"?o.value="["+o.value:l.unshift({type:"text",value:"["});const c=l[l.length-1];return c&&c.type==="text"?c.value+=a:l.push({type:"text",value:a}),l}function _B(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return Tj(e,t);const l={src:Zo(a.url||""),alt:t.alt};a.title!==null&&a.title!==void 0&&(l.title=a.title);const o={type:"element",tagName:"img",properties:l,children:[]};return e.patch(t,o),e.applyData(t,o)}function MB(e,t){const n={src:Zo(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,a),e.applyData(t,a)}function EB(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const a={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,a),e.applyData(t,a)}function AB(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return Tj(e,t);const l={href:Zo(a.url||"")};a.title!==null&&a.title!==void 0&&(l.title=a.title);const o={type:"element",tagName:"a",properties:l,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function DB(e,t){const n={href:Zo(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function zB(e,t,n){const a=e.all(t),l=n?OB(n):_j(t),o={},c=[];if(typeof t.checked=="boolean"){const p=a[0];let x;p&&p.type==="element"&&p.tagName==="p"?x=p:(x={type:"element",tagName:"p",properties:{},children:[]},a.unshift(x)),x.children.length>0&&x.children.unshift({type:"text",value:" "}),x.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let d=-1;for(;++d1}function RB(e,t){const n={},a=e.all(t);let l=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++l0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},d=H1(t.children[1]),m=ij(t.children[t.children.length-1]);d&&m&&(c.position={start:d,end:m}),l.push(c)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(t,o),e.applyData(t,o)}function IB(e,t,n){const a=n?n.children:void 0,o=(a?a.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,d=c?c.length:t.children.length;let m=-1;const f=[];for(;++m0,!0),a[0]),l=a.index+a[0].length,a=n.exec(t);return o.push(e3(t.slice(l),l>0,!1)),o.join("")}function e3(e,t,n){let a=0,l=e.length;if(t){let o=e.codePointAt(a);for(;o===Zb||o===Jb;)a++,o=e.codePointAt(a)}if(n){let o=e.codePointAt(l-1);for(;o===Zb||o===Jb;)l--,o=e.codePointAt(l-1)}return l>a?e.slice(a,l):""}function UB(e,t){const n={type:"text",value:HB(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function $B(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const VB={blockquote:bB,break:wB,code:jB,delete:NB,emphasis:SB,footnoteReference:kB,heading:CB,html:TB,imageReference:_B,image:MB,inlineCode:EB,linkReference:AB,link:DB,listItem:zB,list:RB,paragraph:BB,root:LB,strong:PB,table:FB,tableCell:qB,tableRow:IB,text:UB,thematicBreak:$B,toml:j0,yaml:j0,definition:j0,footnoteDefinition:j0};function j0(){}const Mj=-1,qm=0,uu=1,om=2,X1=3,K1=4,Q1=5,Z1=6,Ej=7,Aj=8,t3=typeof self=="object"?self:globalThis,GB=(e,t)=>{const n=(l,o)=>(e.set(o,l),l),a=l=>{if(e.has(l))return e.get(l);const[o,c]=t[l];switch(o){case qm:case Mj:return n(c,l);case uu:{const d=n([],l);for(const m of c)d.push(a(m));return d}case om:{const d=n({},l);for(const[m,f]of c)d[a(m)]=a(f);return d}case X1:return n(new Date(c),l);case K1:{const{source:d,flags:m}=c;return n(new RegExp(d,m),l)}case Q1:{const d=n(new Map,l);for(const[m,f]of c)d.set(a(m),a(f));return d}case Z1:{const d=n(new Set,l);for(const m of c)d.add(a(m));return d}case Ej:{const{name:d,message:m}=c;return n(new t3[d](m),l)}case Aj:return n(BigInt(c),l);case"BigInt":return n(Object(BigInt(c)),l);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:d}=new Uint8Array(c);return n(new DataView(d),c)}}return n(new t3[o](c),l)};return a},n3=e=>GB(new Map,e)(0),vo="",{toString:YB}={},{keys:WB}=Object,tu=e=>{const t=typeof e;if(t!=="object"||!e)return[qm,t];const n=YB.call(e).slice(8,-1);switch(n){case"Array":return[uu,vo];case"Object":return[om,vo];case"Date":return[X1,vo];case"RegExp":return[K1,vo];case"Map":return[Q1,vo];case"Set":return[Z1,vo];case"DataView":return[uu,n]}return n.includes("Array")?[uu,n]:n.includes("Error")?[Ej,n]:[om,n]},N0=([e,t])=>e===qm&&(t==="function"||t==="symbol"),XB=(e,t,n,a)=>{const l=(c,d)=>{const m=a.push(c)-1;return n.set(d,m),m},o=c=>{if(n.has(c))return n.get(c);let[d,m]=tu(c);switch(d){case qm:{let p=c;switch(m){case"bigint":d=Aj,p=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);p=null;break;case"undefined":return l([Mj],c)}return l([d,p],c)}case uu:{if(m){let y=c;return m==="DataView"?y=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(y=new Uint8Array(c)),l([m,[...y]],c)}const p=[],x=l([d,p],c);for(const y of c)p.push(o(y));return x}case om:{if(m)switch(m){case"BigInt":return l([m,c.toString()],c);case"Boolean":case"Number":case"String":return l([m,c.valueOf()],c)}if(t&&"toJSON"in c)return o(c.toJSON());const p=[],x=l([d,p],c);for(const y of WB(c))(e||!N0(tu(c[y])))&&p.push([o(y),o(c[y])]);return x}case X1:return l([d,c.toISOString()],c);case K1:{const{source:p,flags:x}=c;return l([d,{source:p,flags:x}],c)}case Q1:{const p=[],x=l([d,p],c);for(const[y,b]of c)(e||!(N0(tu(y))||N0(tu(b))))&&p.push([o(y),o(b)]);return x}case Z1:{const p=[],x=l([d,p],c);for(const y of c)(e||!N0(tu(y)))&&p.push(o(y));return x}}const{message:f}=c;return l([d,{name:m,message:f}],c)};return o},r3=(e,{json:t,lossy:n}={})=>{const a=[];return XB(!(t||n),!!t,new Map,a)(e),a},cm=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?n3(r3(e,t)):structuredClone(e):(e,t)=>n3(r3(e,t));function KB(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function QB(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function ZB(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||KB,a=e.options.footnoteBackLabel||QB,l=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let m=-1;for(;++m0&&j.push({type:"text",value:" "});let M=typeof n=="string"?n:n(m,b);typeof M=="string"&&(M={type:"text",value:M}),j.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,b),className:["data-footnote-backref"]},children:Array.isArray(M)?M:[M]})}const S=p[p.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const M=S.children[S.children.length-1];M&&M.type==="text"?M.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...j)}else p.push(...j);const _={type:"element",tagName:"li",properties:{id:t+"fn-"+y},children:e.wrap(p,!0)};e.patch(f,_),d.push(_)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...cm(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:` -`},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:` -`}]}}const $u=(function(e){if(e==null)return nL;if(typeof e=="function")return Hm(e);if(typeof e=="object")return Array.isArray(e)?JB(e):eL(e);if(typeof e=="string")return tL(e);throw new Error("Expected function, string, or object as test")});function JB(e){const t=[];let n=-1;for(;++n":""))+")"})}return y;function y(){let b=Dj,j,k,S;if((!t||o(m,f,p[p.length-1]||void 0))&&(b=sL(n(m,p)),b[0]===Px))return b;if("children"in m&&m.children){const _=m;if(_.children&&b[0]!==zj)for(k=(a?_.children.length:-1)+c,S=p.concat(_);k>-1&&k<_.children.length;){const M=_.children[k];if(j=d(M,k,S)(),j[0]===Px)return j;k=typeof j[1]=="number"?j[1]:k+c}}return b}}}function sL(e){return Array.isArray(e)?e:typeof e=="number"?[aL,e]:e==null?Dj:[e]}function eg(e,t,n,a){let l,o,c;typeof t=="function"&&typeof n!="function"?(o=void 0,c=t,l=n):(o=t,c=n,l=a),J1(e,o,d,l);function d(m,f){const p=f[f.length-1],x=p?p.children.indexOf(m):void 0;return c(m,x,p)}}const Fx={}.hasOwnProperty,lL={};function iL(e,t){const n=t||lL,a=new Map,l=new Map,o=new Map,c={...VB,...n.handlers},d={all:f,applyData:cL,definitionById:a,footnoteById:l,footnoteCounts:o,footnoteOrder:[],handlers:c,one:m,options:n,patch:oL,wrap:dL};return eg(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const x=p.type==="definition"?a:l,y=String(p.identifier).toUpperCase();x.has(y)||x.set(y,p)}}),d;function m(p,x){const y=p.type,b=d.handlers[y];if(Fx.call(d.handlers,y)&&b)return b(d,p,x);if(d.options.passThrough&&d.options.passThrough.includes(y)){if("children"in p){const{children:k,...S}=p,_=cm(S);return _.children=d.all(p),_}return cm(p)}return(d.options.unknownHandler||uL)(d,p,x)}function f(p){const x=[];if("children"in p){const y=p.children;let b=-1;for(;++b0&&n.push({type:"text",value:` -`}),n}function a3(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function s3(e,t){const n=iL(e,t),a=n.one(e,void 0),l=ZB(n),o=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return l&&o.children.push({type:"text",value:` -`},l),o}function mL(e,t){return e&&"run"in e?async function(n,a){const l=s3(n,{file:a,...t});await e.run(l,a)}:function(n,a){return s3(n,{file:a,...e||t})}}function l3(e){if(e)throw e}var Rp,i3;function hL(){if(i3)return Rp;i3=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},o=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var p=e.call(f,"constructor"),x=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!x)return!1;var y;for(y in f);return typeof y>"u"||e.call(f,y)},c=function(f,p){n&&p.name==="__proto__"?n(f,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):f[p.name]=p.newValue},d=function(f,p){if(p==="__proto__")if(e.call(f,p)){if(a)return a(f,p).value}else return;return f[p]};return Rp=function m(){var f,p,x,y,b,j,k=arguments[0],S=1,_=arguments.length,M=!1;for(typeof k=="boolean"&&(M=k,k=arguments[1]||{},S=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});S<_;++S)if(f=arguments[S],f!=null)for(p in f)x=d(k,p),y=d(f,p),k!==y&&(M&&y&&(o(y)||(b=l(y)))?(b?(b=!1,j=x&&l(x)?x:[]):j=x&&o(x)?x:{},c(k,{name:p,newValue:m(M,j,y)})):typeof y<"u"&&c(k,{name:p,newValue:y}));return k},Rp}var fL=hL();const Bp=M5(fL);function Ix(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function pL(){const e=[],t={run:n,use:a};return t;function n(...l){let o=-1;const c=l.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);d(null,...l);function d(m,...f){const p=e[++o];let x=-1;if(m){c(m);return}for(;++xc.length;let m;d&&c.push(l);try{m=e.apply(this,c)}catch(f){const p=f;if(d&&n)throw p;return l(p)}d||(m&&m.then&&typeof m.then=="function"?m.then(o,l):m instanceof Error?l(m):o(m))}function l(c,...d){n||(n=!0,t(c,...d))}function o(c){l(null,c)}}const Xa={basename:gL,dirname:vL,extname:yL,join:bL,sep:"/"};function gL(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Vu(e);let n=0,a=-1,l=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(o){n=l+1;break}}else a<0&&(o=!0,a=l+1);return a<0?"":e.slice(n,a)}if(t===e)return"";let c=-1,d=t.length-1;for(;l--;)if(e.codePointAt(l)===47){if(o){n=l+1;break}}else c<0&&(o=!0,c=l+1),d>-1&&(e.codePointAt(l)===t.codePointAt(d--)?d<0&&(a=l):(d=-1,a=c));return n===a?a=c:a<0&&(a=e.length),e.slice(n,a)}function vL(e){if(Vu(e),e.length===0)return".";let t=-1,n=e.length,a;for(;--n;)if(e.codePointAt(n)===47){if(a){t=n;break}}else a||(a=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function yL(e){Vu(e);let t=e.length,n=-1,a=0,l=-1,o=0,c;for(;t--;){const d=e.codePointAt(t);if(d===47){if(c){a=t+1;break}continue}n<0&&(c=!0,n=t+1),d===46?l<0?l=t:o!==1&&(o=1):l>-1&&(o=-1)}return l<0||n<0||o===0||o===1&&l===n-1&&l===a+1?"":e.slice(l,n)}function bL(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function jL(e,t){let n="",a=0,l=-1,o=0,c=-1,d,m;for(;++c<=e.length;){if(c2){if(m=n.lastIndexOf("/"),m!==n.length-1){m<0?(n="",a=0):(n=n.slice(0,m),a=n.length-1-n.lastIndexOf("/")),l=c,o=0;continue}}else if(n.length>0){n="",a=0,l=c,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",a=2)}else n.length>0?n+="/"+e.slice(l+1,c):n=e.slice(l+1,c),a=c-l-1;l=c,o=0}else d===46&&o>-1?o++:o=-1}return n}function Vu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const NL={cwd:SL};function SL(){return"/"}function qx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function kL(e){if(typeof e=="string")e=new URL(e);else if(!qx(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return CL(e)}function CL(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const t=e.pathname;let n=-1;for(;++n0){let[b,...j]=p;const k=a[y][1];Ix(k)&&Ix(b)&&(b=Bp(!0,k,b)),a[y]=[f,b,...j]}}}}const EL=new tg().freeze();function Ip(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function qp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Hp(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function c3(e){if(!Ix(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function u3(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function S0(e){return AL(e)?e:new Oj(e)}function AL(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function DL(e){return typeof e=="string"||zL(e)}function zL(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const OL="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",d3=[],m3={allowDangerousHtml:!0},RL=/^(https?|ircs?|mailto|xmpp)$/i,BL=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function LL(e){const t=PL(e),n=FL(e);return IL(t.runSync(t.parse(n),n),e)}function PL(e){const t=e.rehypePlugins||d3,n=e.remarkPlugins||d3,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...m3}:m3;return EL().use(yB).use(n).use(mL,a).use(t)}function FL(e){const t=e.children||"",n=new Oj;return typeof t=="string"&&(n.value=t),n}function IL(e,t){const n=t.allowedElements,a=t.allowElement,l=t.components,o=t.disallowedElements,c=t.skipHtml,d=t.unwrapDisallowed,m=t.urlTransform||qL;for(const p of BL)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+OL+p.id,void 0);return eg(e,f),nO(e,{Fragment:r.Fragment,components:l,ignoreInvalidStyle:!0,jsx:r.jsx,jsxs:r.jsxs,passKeys:!0,passNode:!0});function f(p,x,y){if(p.type==="raw"&&y&&typeof x=="number")return c?y.children.splice(x,1):y.children[x]={type:"text",value:p.value},x;if(p.type==="element"){let b;for(b in Dp)if(Object.hasOwn(Dp,b)&&Object.hasOwn(p.properties,b)){const j=p.properties[b],k=Dp[b];(k===null||k.includes(p.tagName))&&(p.properties[b]=m(String(j||""),b,p))}}if(p.type==="element"){let b=n?!n.includes(p.tagName):o?o.includes(p.tagName):!1;if(!b&&a&&typeof x=="number"&&(b=!a(p,x,y)),b&&y&&typeof x=="number")return d&&p.children?y.children.splice(x,1,...p.children):y.children.splice(x,1),x}}}function qL(e){const t=e.indexOf(":"),n=e.indexOf("?"),a=e.indexOf("#"),l=e.indexOf("/");return t===-1||l!==-1&&t>l||n!==-1&&t>n||a!==-1&&t>a||RL.test(e.slice(0,t))?e:""}function h3(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let a=0,l=n.indexOf(t);for(;l!==-1;)a++,l=n.indexOf(t,l+t.length);return a}function HL(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function UL(e,t,n){const l=$u((n||{}).ignore||[]),o=$L(t);let c=-1;for(;++c0?{type:"text",value:E}:void 0),E===!1?y.lastIndex=z+1:(j!==z&&M.push({type:"text",value:f.value.slice(j,z)}),Array.isArray(E)?M.push(...E):E&&M.push(E),j=z+D[0].length,_=!0),!y.global)break;D=y.exec(f.value)}return _?(j?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],a=n.indexOf(")");const l=h3(e,"(");let o=h3(e,")");for(;a!==-1&&l>o;)e+=n.slice(0,a+1),n=n.slice(a+1),a=n.indexOf(")"),o++;return[e,n]}function Rj(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||gi(n)||Fm(n))&&(!t||n!==47)}Bj.peek=hP;function sP(){this.buffer()}function lP(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function iP(){this.buffer()}function oP(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function cP(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ia(this.sliceSerialize(e)).toLowerCase(),n.label=t}function uP(e){this.exit(e)}function dP(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ia(this.sliceSerialize(e)).toLowerCase(),n.label=t}function mP(e){this.exit(e)}function hP(){return"["}function Bj(e,t,n,a){const l=n.createTracker(a);let o=l.move("[^");const c=n.enter("footnoteReference"),d=n.enter("reference");return o+=l.move(n.safe(n.associationId(e),{after:"]",before:o})),d(),c(),o+=l.move("]"),o}function fP(){return{enter:{gfmFootnoteCallString:sP,gfmFootnoteCall:lP,gfmFootnoteDefinitionLabelString:iP,gfmFootnoteDefinition:oP},exit:{gfmFootnoteCallString:cP,gfmFootnoteCall:uP,gfmFootnoteDefinitionLabelString:dP,gfmFootnoteDefinition:mP}}}function pP(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Bj},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(a,l,o,c){const d=o.createTracker(c);let m=d.move("[^");const f=o.enter("footnoteDefinition"),p=o.enter("label");return m+=d.move(o.safe(o.associationId(a),{before:m,after:"]"})),p(),m+=d.move("]:"),a.children&&a.children.length>0&&(d.shift(4),m+=d.move((t?` -`:" ")+o.indentLines(o.containerFlow(a,d.current()),t?Lj:xP))),f(),m}}function xP(e,t,n){return t===0?e:Lj(e,t,n)}function Lj(e,t,n){return(n?"":" ")+e}const gP=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Pj.peek=jP;function vP(){return{canContainEols:["delete"],enter:{strikethrough:bP},exit:{strikethrough:wP}}}function yP(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:gP}],handlers:{delete:Pj}}}function bP(e){this.enter({type:"delete",children:[]},e)}function wP(e){this.exit(e)}function Pj(e,t,n,a){const l=n.createTracker(a),o=n.enter("strikethrough");let c=l.move("~~");return c+=n.containerPhrasing(e,{...l.current(),before:c,after:"~"}),c+=l.move("~~"),o(),c}function jP(){return"~"}function NP(e){return e.length}function SP(e,t){const n=t||{},a=(n.align||[]).concat(),l=n.stringLength||NP,o=[],c=[],d=[],m=[];let f=0,p=-1;for(;++pf&&(f=e[p].length);++_m[_])&&(m[_]=D)}k.push(M)}c[p]=k,d[p]=S}let x=-1;if(typeof a=="object"&&"length"in a)for(;++xm[x]&&(m[x]=M),b[x]=M),y[x]=D}c.splice(1,0,y),d.splice(1,0,b),p=-1;const j=[];for(;++p "),o.shift(2);const c=n.indentLines(n.containerFlow(e,o.current()),TP);return l(),c}function TP(e,t,n){return">"+(n?"":" ")+e}function _P(e,t){return p3(e,t.inConstruct,!0)&&!p3(e,t.notInConstruct,!1)}function p3(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let a=-1;for(;++ac&&(c=o):o=1,l=a+t.length,a=n.indexOf(t,l);return c}function MP(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function EP(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function AP(e,t,n,a){const l=EP(n),o=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(MP(e,n)){const x=n.enter("codeIndented"),y=n.indentLines(o,DP);return x(),y}const d=n.createTracker(a),m=l.repeat(Math.max(Fj(o,l)+1,3)),f=n.enter("codeFenced");let p=d.move(m);if(e.lang){const x=n.enter(`codeFencedLang${c}`);p+=d.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...d.current()})),x()}if(e.lang&&e.meta){const x=n.enter(`codeFencedMeta${c}`);p+=d.move(" "),p+=d.move(n.safe(e.meta,{before:p,after:` -`,encode:["`"],...d.current()})),x()}return p+=d.move(` -`),o&&(p+=d.move(o+` -`)),p+=d.move(m),f(),p}function DP(e,t,n){return(n?"":" ")+e}function ng(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function zP(e,t,n,a){const l=ng(n),o=l==='"'?"Quote":"Apostrophe",c=n.enter("definition");let d=n.enter("label");const m=n.createTracker(a);let f=m.move("[");return f+=m.move(n.safe(n.associationId(e),{before:f,after:"]",...m.current()})),f+=m.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),f+=m.move("<"),f+=m.move(n.safe(e.url,{before:f,after:">",...m.current()})),f+=m.move(">")):(d=n.enter("destinationRaw"),f+=m.move(n.safe(e.url,{before:f,after:e.title?" ":` -`,...m.current()}))),d(),e.title&&(d=n.enter(`title${o}`),f+=m.move(" "+l),f+=m.move(n.safe(e.title,{before:f,after:l,...m.current()})),f+=m.move(l),d()),c(),f}function OP(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function yu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function um(e,t,n){const a=Io(e),l=Io(t);return a===void 0?l===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Ij.peek=RP;function Ij(e,t,n,a){const l=OP(n),o=n.enter("emphasis"),c=n.createTracker(a),d=c.move(l);let m=c.move(n.containerPhrasing(e,{after:l,before:d,...c.current()}));const f=m.charCodeAt(0),p=um(a.before.charCodeAt(a.before.length-1),f,l);p.inside&&(m=yu(f)+m.slice(1));const x=m.charCodeAt(m.length-1),y=um(a.after.charCodeAt(0),x,l);y.inside&&(m=m.slice(0,-1)+yu(x));const b=c.move(l);return o(),n.attentionEncodeSurroundingInfo={after:y.outside,before:p.outside},d+m+b}function RP(e,t,n){return n.options.emphasis||"*"}function BP(e,t){let n=!1;return eg(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return n=!0,Px}),!!((!e.depth||e.depth<3)&&G1(e)&&(t.options.setext||n))}function LP(e,t,n,a){const l=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(a);if(BP(e,n)){const p=n.enter("headingSetext"),x=n.enter("phrasing"),y=n.containerPhrasing(e,{...o.current(),before:` -`,after:` -`});return x(),p(),y+` -`+(l===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(` -`))+1))}const c="#".repeat(l),d=n.enter("headingAtx"),m=n.enter("phrasing");o.move(c+" ");let f=n.containerPhrasing(e,{before:"# ",after:` -`,...o.current()});return/^[\t ]/.test(f)&&(f=yu(f.charCodeAt(0))+f.slice(1)),f=f?c+" "+f:c,n.options.closeAtx&&(f+=" "+c),m(),d(),f}qj.peek=PP;function qj(e){return e.value||""}function PP(){return"<"}Hj.peek=FP;function Hj(e,t,n,a){const l=ng(n),o=l==='"'?"Quote":"Apostrophe",c=n.enter("image");let d=n.enter("label");const m=n.createTracker(a);let f=m.move("![");return f+=m.move(n.safe(e.alt,{before:f,after:"]",...m.current()})),f+=m.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),f+=m.move("<"),f+=m.move(n.safe(e.url,{before:f,after:">",...m.current()})),f+=m.move(">")):(d=n.enter("destinationRaw"),f+=m.move(n.safe(e.url,{before:f,after:e.title?" ":")",...m.current()}))),d(),e.title&&(d=n.enter(`title${o}`),f+=m.move(" "+l),f+=m.move(n.safe(e.title,{before:f,after:l,...m.current()})),f+=m.move(l),d()),f+=m.move(")"),c(),f}function FP(){return"!"}Uj.peek=IP;function Uj(e,t,n,a){const l=e.referenceType,o=n.enter("imageReference");let c=n.enter("label");const d=n.createTracker(a);let m=d.move("![");const f=n.safe(e.alt,{before:m,after:"]",...d.current()});m+=d.move(f+"]["),c();const p=n.stack;n.stack=[],c=n.enter("reference");const x=n.safe(n.associationId(e),{before:m,after:"]",...d.current()});return c(),n.stack=p,o(),l==="full"||!f||f!==x?m+=d.move(x+"]"):l==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function IP(){return"!"}$j.peek=qP;function $j(e,t,n){let a=e.value||"",l="`",o=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(a);)l+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++o\u007F]/.test(e.url))}Gj.peek=HP;function Gj(e,t,n,a){const l=ng(n),o=l==='"'?"Quote":"Apostrophe",c=n.createTracker(a);let d,m;if(Vj(e,n)){const p=n.stack;n.stack=[],d=n.enter("autolink");let x=c.move("<");return x+=c.move(n.containerPhrasing(e,{before:x,after:">",...c.current()})),x+=c.move(">"),d(),n.stack=p,x}d=n.enter("link"),m=n.enter("label");let f=c.move("[");return f+=c.move(n.containerPhrasing(e,{before:f,after:"](",...c.current()})),f+=c.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=n.enter("destinationLiteral"),f+=c.move("<"),f+=c.move(n.safe(e.url,{before:f,after:">",...c.current()})),f+=c.move(">")):(m=n.enter("destinationRaw"),f+=c.move(n.safe(e.url,{before:f,after:e.title?" ":")",...c.current()}))),m(),e.title&&(m=n.enter(`title${o}`),f+=c.move(" "+l),f+=c.move(n.safe(e.title,{before:f,after:l,...c.current()})),f+=c.move(l),m()),f+=c.move(")"),d(),f}function HP(e,t,n){return Vj(e,n)?"<":"["}Yj.peek=UP;function Yj(e,t,n,a){const l=e.referenceType,o=n.enter("linkReference");let c=n.enter("label");const d=n.createTracker(a);let m=d.move("[");const f=n.containerPhrasing(e,{before:m,after:"]",...d.current()});m+=d.move(f+"]["),c();const p=n.stack;n.stack=[],c=n.enter("reference");const x=n.safe(n.associationId(e),{before:m,after:"]",...d.current()});return c(),n.stack=p,o(),l==="full"||!f||f!==x?m+=d.move(x+"]"):l==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function UP(){return"["}function rg(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function $P(e){const t=rg(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function VP(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Wj(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function GP(e,t,n,a){const l=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?VP(n):rg(n);const d=e.ordered?c==="."?")":".":$P(n);let m=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(m=!0),Wj(n)===c&&p){let x=-1;for(;++x-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let c=o.length+1;(l==="tab"||l==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const d=n.createTracker(a);d.move(o+" ".repeat(c-o.length)),d.shift(c);const m=n.enter("listItem"),f=n.indentLines(n.containerFlow(e,d.current()),p);return m(),f;function p(x,y,b){return y?(b?"":" ".repeat(c))+x:(b?o:o+" ".repeat(c-o.length))+x}}function XP(e,t,n,a){const l=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,a);return o(),l(),c}const KP=$u(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function QP(e,t,n,a){return(e.children.some(function(c){return KP(c)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function ZP(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Xj.peek=JP;function Xj(e,t,n,a){const l=ZP(n),o=n.enter("strong"),c=n.createTracker(a),d=c.move(l+l);let m=c.move(n.containerPhrasing(e,{after:l,before:d,...c.current()}));const f=m.charCodeAt(0),p=um(a.before.charCodeAt(a.before.length-1),f,l);p.inside&&(m=yu(f)+m.slice(1));const x=m.charCodeAt(m.length-1),y=um(a.after.charCodeAt(0),x,l);y.inside&&(m=m.slice(0,-1)+yu(x));const b=c.move(l+l);return o(),n.attentionEncodeSurroundingInfo={after:y.outside,before:p.outside},d+m+b}function JP(e,t,n){return n.options.strong||"*"}function eF(e,t,n,a){return n.safe(e.value,a)}function tF(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function nF(e,t,n){const a=(Wj(n)+(n.options.ruleSpaces?" ":"")).repeat(tF(n));return n.options.ruleSpaces?a.slice(0,-1):a}const Kj={blockquote:CP,break:x3,code:AP,definition:zP,emphasis:Ij,hardBreak:x3,heading:LP,html:qj,image:Hj,imageReference:Uj,inlineCode:$j,link:Gj,linkReference:Yj,list:GP,listItem:WP,paragraph:XP,root:QP,strong:Xj,text:eF,thematicBreak:nF};function rF(){return{enter:{table:aF,tableData:g3,tableHeader:g3,tableRow:lF},exit:{codeText:iF,table:sF,tableData:Gp,tableHeader:Gp,tableRow:Gp}}}function aF(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function sF(e){this.exit(e),this.data.inTable=void 0}function lF(e){this.enter({type:"tableRow",children:[]},e)}function Gp(e){this.exit(e)}function g3(e){this.enter({type:"tableCell",children:[]},e)}function iF(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,oF));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function oF(e,t){return t==="|"?t:e}function cF(e){const t=e||{},n=t.tableCellPadding,a=t.tablePipeAlign,l=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` -`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:c,tableCell:m,tableRow:d}};function c(b,j,k,S){return f(p(b,k,S),b.align)}function d(b,j,k,S){const _=x(b,k,S),M=f([_]);return M.slice(0,M.indexOf(` -`))}function m(b,j,k,S){const _=k.enter("tableCell"),M=k.enter("phrasing"),D=k.containerPhrasing(b,{...S,before:o,after:o});return M(),_(),D}function f(b,j){return SP(b,{align:j,alignDelimiters:a,padding:n,stringLength:l})}function p(b,j,k){const S=b.children;let _=-1;const M=[],D=j.enter("table");for(;++_0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const TF={tokenize:RF,partial:!0};function _F(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:DF,continuation:{tokenize:zF},exit:OF}},text:{91:{name:"gfmFootnoteCall",tokenize:AF},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:MF,resolveTo:EF}}}}function MF(e,t,n){const a=this;let l=a.events.length;const o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let c;for(;l--;){const m=a.events[l][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return d;function d(m){if(!c||!c._balanced)return n(m);const f=Ia(a.sliceSerialize({start:c.end,end:a.now()}));return f.codePointAt(0)!==94||!o.includes(f.slice(1))?n(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),t(m))}}function EF(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},d=[e[n+1],e[n+2],["enter",a,t],e[n+3],e[n+4],["enter",l,t],["exit",l,t],["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(n,e.length-n+1,...d),e}function AF(e,t,n){const a=this,l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o=0,c;return d;function d(x){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),m}function m(x){return x!==94?n(x):(e.enter("gfmFootnoteCallMarker"),e.consume(x),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(x){if(o>999||x===93&&!c||x===null||x===91||hn(x))return n(x);if(x===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return l.includes(Ia(a.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(x)}return hn(x)||(c=!0),o++,e.consume(x),x===92?p:f}function p(x){return x===91||x===92||x===93?(e.consume(x),o++,f):f(x)}}function DF(e,t,n){const a=this,l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o,c=0,d;return m;function m(j){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(j),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(j){return j===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(j),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(j)}function p(j){if(c>999||j===93&&!d||j===null||j===91||hn(j))return n(j);if(j===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=Ia(a.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(j),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return hn(j)||(d=!0),c++,e.consume(j),j===92?x:p}function x(j){return j===91||j===92||j===93?(e.consume(j),c++,p):p(j)}function y(j){return j===58?(e.enter("definitionMarker"),e.consume(j),e.exit("definitionMarker"),l.includes(o)||l.push(o),St(e,b,"gfmFootnoteDefinitionWhitespace")):n(j)}function b(j){return t(j)}}function zF(e,t,n){return e.check(Uu,t,e.attempt(TF,t,n))}function OF(e){e.exit("gfmFootnoteDefinition")}function RF(e,t,n){const a=this;return St(e,l,"gfmFootnoteDefinitionIndent",5);function l(o){const c=a.events[a.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(o):n(o)}}function BF(e){let n=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:o,resolveAll:l};return n==null&&(n=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function l(c,d){let m=-1;for(;++m1?m(j):(c.consume(j),x++,b);if(x<2&&!n)return m(j);const S=c.exit("strikethroughSequenceTemporary"),_=Io(j);return S._open=!_||_===2&&!!k,S._close=!k||k===2&&!!_,d(j)}}}class LF{constructor(){this.map=[]}add(t,n,a){PF(this,t,n,a)}consume(t){if(this.map.sort(function(o,c){return o[0]-c[0]}),this.map.length===0)return;let n=this.map.length;const a=[];for(;n>0;)n-=1,a.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];a.push(t.slice()),t.length=0;let l=a.pop();for(;l;){for(const o of l)t.push(o);l=a.pop()}this.map.length=0}}function PF(e,t,n,a){let l=0;if(!(n===0&&a.length===0)){for(;l-1;){const J=a.events[G][1].type;if(J==="lineEnding"||J==="linePrefix")G--;else break}const te=G>-1?a.events[G][1].type:null,we=te==="tableHead"||te==="tableRow"?E:m;return we===E&&a.parser.lazy[a.now().line]?n(I):we(I)}function m(I){return e.enter("tableHead"),e.enter("tableRow"),f(I)}function f(I){return I===124||(c=!0,o+=1),p(I)}function p(I){return I===null?n(I):Ye(I)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),b):n(I):Et(I)?St(e,p,"whitespace")(I):(o+=1,c&&(c=!1,l+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),c=!0,p):(e.enter("data"),x(I)))}function x(I){return I===null||I===124||hn(I)?(e.exit("data"),p(I)):(e.consume(I),I===92?y:x)}function y(I){return I===92||I===124?(e.consume(I),x):x(I)}function b(I){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(I):(e.enter("tableDelimiterRow"),c=!1,Et(I)?St(e,j,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):j(I))}function j(I){return I===45||I===58?S(I):I===124?(c=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),k):L(I)}function k(I){return Et(I)?St(e,S,"whitespace")(I):S(I)}function S(I){return I===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),_):I===45?(o+=1,_(I)):I===null||Ye(I)?z(I):L(I)}function _(I){return I===45?(e.enter("tableDelimiterFiller"),M(I)):L(I)}function M(I){return I===45?(e.consume(I),M):I===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),D):(e.exit("tableDelimiterFiller"),D(I))}function D(I){return Et(I)?St(e,z,"whitespace")(I):z(I)}function z(I){return I===124?j(I):I===null||Ye(I)?!c||l!==o?L(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):L(I)}function L(I){return n(I)}function E(I){return e.enter("tableRow"),R(I)}function R(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),R):I===null||Ye(I)?(e.exit("tableRow"),t(I)):Et(I)?St(e,R,"whitespace")(I):(e.enter("data"),H(I))}function H(I){return I===null||I===124||hn(I)?(e.exit("data"),R(I)):(e.consume(I),I===92?$:H)}function $(I){return I===92||I===124?(e.consume(I),H):H(I)}}function HF(e,t){let n=-1,a=!0,l=0,o=[0,0,0,0],c=[0,0,0,0],d=!1,m=0,f,p,x;const y=new LF;for(;++nn[2]+1){const j=n[2]+1,k=n[3]-n[2]-1;e.add(j,k,[])}}e.add(n[3]+1,0,[["exit",x,t]])}return l!==void 0&&(o.end=Object.assign({},Co(t.events,l)),e.add(l,0,[["exit",o,t]]),o=void 0),o}function y3(e,t,n,a,l){const o=[],c=Co(t.events,n);l&&(l.end=Object.assign({},c),o.push(["exit",l,t])),a.end=Object.assign({},c),o.push(["exit",a,t]),e.add(n+1,0,o)}function Co(e,t){const n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}const UF={name:"tasklistCheck",tokenize:VF};function $F(){return{text:{91:UF}}}function VF(e,t,n){const a=this;return l;function l(m){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?n(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),o)}function o(m){return hn(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):n(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),d):n(m)}function d(m){return Ye(m)?t(m):Et(m)?e.check({tokenize:GF},t,n)(m):n(m)}}function GF(e,t,n){return St(e,a,"whitespace");function a(l){return l===null?n(l):t(l)}}function YF(e){return fj([vF(),_F(),BF(e),IF(),$F()])}const WF={};function XF(e){const t=this,n=e||WF,a=t.data(),l=a.micromarkExtensions||(a.micromarkExtensions=[]),o=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);l.push(YF(n)),o.push(fF()),c.push(pF(n))}function KF(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:o},exit:{mathFlow:l,mathFlowFence:a,mathFlowFenceMeta:n,mathFlowValue:d,mathText:c,mathTextData:d}};function e(m){const f={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[f]}},m)}function t(){this.buffer()}function n(){const m=this.resume(),f=this.stack[this.stack.length-1];f.type,f.meta=m}function a(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function l(m){const f=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),p=this.stack[this.stack.length-1];p.type,this.exit(m),p.value=f;const x=p.data.hChildren[0];x.type,x.tagName,x.children.push({type:"text",value:f}),this.data.mathFlowInside=void 0}function o(m){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},m),this.buffer()}function c(m){const f=this.resume(),p=this.stack[this.stack.length-1];p.type,this.exit(m),p.value=f,p.data.hChildren.push({type:"text",value:f})}function d(m){this.config.enter.data.call(this,m),this.config.exit.data.call(this,m)}}function QF(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),a.peek=l,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` -`,inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:a}};function n(o,c,d,m){const f=o.value||"",p=d.createTracker(m),x="$".repeat(Math.max(Fj(f,"$")+1,2)),y=d.enter("mathFlow");let b=p.move(x);if(o.meta){const j=d.enter("mathFlowMeta");b+=p.move(d.safe(o.meta,{after:` -`,before:b,encode:["$"],...p.current()})),j()}return b+=p.move(` -`),f&&(b+=p.move(f+` -`)),b+=p.move(x),y(),b}function a(o,c,d){let m=o.value||"",f=1;for(t||f++;new RegExp("(^|[^$])"+"\\$".repeat(f)+"([^$]|$)").test(m);)f++;const p="$".repeat(f);/[^ \r\n]/.test(m)&&(/^[ \r\n]/.test(m)&&/[ \r\n]$/.test(m)||/^\$|\$$/.test(m))&&(m=" "+m+" ");let x=-1;for(;++x15?f="…"+d.slice(l-15,l):f=d.slice(0,l);var p;o+15":">","<":"<",'"':""","'":"'"},cI=/[&><"']/g;function uI(e){return String(e).replace(cI,t=>oI[t])}var s8=function e(t){return t.type==="ordgroup"||t.type==="color"?t.body.length===1?e(t.body[0]):t:t.type==="font"?e(t.body):t},dI=function(t){var n=s8(t);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},mI=function(t){if(!t)throw new Error("Expected non-null, but got "+String(t));return t},hI=function(t){var n=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(t);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},Ht={deflt:sI,escape:uI,hyphenate:iI,getBaseElem:s8,isCharacterBox:dI,protocolFromUrl:hI},Y0={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand ",cliProcessor:e=>e==="Infinity"?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function fI(e){if(e.default)return e.default;var t=e.type,n=Array.isArray(t)?t[0]:t;if(typeof n!="string")return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class sg{constructor(t){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,t=t||{};for(var n in Y0)if(Y0.hasOwnProperty(n)){var a=Y0[n];this[n]=t[n]!==void 0?a.processor?a.processor(t[n]):t[n]:fI(a)}}reportNonstrict(t,n,a){var l=this.strict;if(typeof l=="function"&&(l=l(t,n,a)),!(!l||l==="ignore")){if(l===!0||l==="error")throw new Ae("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+t+"]"),a);l==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+l+"': "+n+" ["+t+"]"))}}useStrictBehavior(t,n,a){var l=this.strict;if(typeof l=="function")try{l=l(t,n,a)}catch{l="error"}return!l||l==="ignore"?!1:l===!0||l==="error"?!0:l==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+l+"': "+n+" ["+t+"]")),!1)}isTrusted(t){if(t.url&&!t.protocol){var n=Ht.protocolFromUrl(t.url);if(n==null)return!1;t.protocol=n}var a=typeof this.trust=="function"?this.trust(t):this.trust;return!!a}}class vl{constructor(t,n,a){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=n,this.cramped=a}sup(){return Qa[pI[this.id]]}sub(){return Qa[xI[this.id]]}fracNum(){return Qa[gI[this.id]]}fracDen(){return Qa[vI[this.id]]}cramp(){return Qa[yI[this.id]]}text(){return Qa[bI[this.id]]}isTight(){return this.size>=2}}var lg=0,dm=1,zo=2,Rs=3,bu=4,Ca=5,qo=6,_r=7,Qa=[new vl(lg,0,!1),new vl(dm,0,!0),new vl(zo,1,!1),new vl(Rs,1,!0),new vl(bu,2,!1),new vl(Ca,2,!0),new vl(qo,3,!1),new vl(_r,3,!0)],pI=[bu,Ca,bu,Ca,qo,_r,qo,_r],xI=[Ca,Ca,Ca,Ca,_r,_r,_r,_r],gI=[zo,Rs,bu,Ca,qo,_r,qo,_r],vI=[Rs,Rs,Ca,Ca,_r,_r,_r,_r],yI=[dm,dm,Rs,Rs,Ca,Ca,_r,_r],bI=[lg,dm,zo,Rs,zo,Rs,zo,Rs],tt={DISPLAY:Qa[lg],TEXT:Qa[zo],SCRIPT:Qa[bu],SCRIPTSCRIPT:Qa[qo]},Ux=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function wI(e){for(var t=0;t=l[0]&&e<=l[1])return n.name}return null}var W0=[];Ux.forEach(e=>e.blocks.forEach(t=>W0.push(...t)));function l8(e){for(var t=0;t=W0[t]&&e<=W0[t+1])return!0;return!1}var yo=80,jI=function(t,n){return"M95,"+(622+t+n)+` -c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 -c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 -c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 -s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429 -c69,-144,104.5,-217.7,106.5,-221 -l`+t/2.075+" -"+t+` -c5.3,-9.3,12,-14,20,-14 -H400000v`+(40+t)+`H845.2724 -s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 -c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z -M`+(834+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},NI=function(t,n){return"M263,"+(601+t+n)+`c0.7,0,18,39.7,52,119 -c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 -c340,-704.7,510.7,-1060.3,512,-1067 -l`+t/2.084+" -"+t+` -c4.7,-7.3,11,-11,19,-11 -H40000v`+(40+t)+`H1012.3 -s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232 -c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 -s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 -c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z -M`+(1001+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},SI=function(t,n){return"M983 "+(10+t+n)+` -l`+t/3.13+" -"+t+` -c4,-6.7,10,-10,18,-10 H400000v`+(40+t)+` -H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 -s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744 -c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 -c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 -c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 -c53.7,-170.3,84.5,-266.8,92.5,-289.5z -M`+(1001+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},kI=function(t,n){return"M424,"+(2398+t+n)+` -c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 -c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 -s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 -s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081 -l`+t/4.223+" -"+t+`c4,-6.7,10,-10,18,-10 H400000 -v`+(40+t)+`H1014.6 -s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 -c-2,6,-10,9,-24,9 -c-8,0,-12,-0.7,-12,-2z M`+(1001+t)+" "+n+` -h400000v`+(40+t)+"h-400000z"},CI=function(t,n){return"M473,"+(2713+t+n)+` -c339.3,-1799.3,509.3,-2700,510,-2702 l`+t/5.298+" -"+t+` -c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+t)+`H1017.7 -s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 -c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 -c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 -s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, -606zM`+(1001+t)+" "+n+"h400000v"+(40+t)+"H1017.7z"},TI=function(t){var n=t/2;return"M400000 "+t+" H0 L"+n+" 0 l65 45 L145 "+(t-80)+" H400000z"},_I=function(t,n,a){var l=a-54-n-t;return"M702 "+(t+n)+"H400000"+(40+t)+` -H742v`+l+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 -h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 -c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 -219 661 l218 661zM702 `+n+"H400000v"+(40+t)+"H742z"},MI=function(t,n,a){n=1e3*n;var l="";switch(t){case"sqrtMain":l=jI(n,yo);break;case"sqrtSize1":l=NI(n,yo);break;case"sqrtSize2":l=SI(n,yo);break;case"sqrtSize3":l=kI(n,yo);break;case"sqrtSize4":l=CI(n,yo);break;case"sqrtTall":l=_I(n,yo,a)}return l},EI=function(t,n){switch(t){case"⎜":return"M291 0 H417 V"+n+" H291z M291 0 H417 V"+n+" H291z";case"∣":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z";case"∥":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z"+("M367 0 H410 V"+n+" H367z M367 0 H410 V"+n+" H367z");case"⎟":return"M457 0 H583 V"+n+" H457z M457 0 H583 V"+n+" H457z";case"⎢":return"M319 0 H403 V"+n+" H319z M319 0 H403 V"+n+" H319z";case"⎥":return"M263 0 H347 V"+n+" H263z M263 0 H347 V"+n+" H263z";case"⎪":return"M384 0 H504 V"+n+" H384z M384 0 H504 V"+n+" H384z";case"⏐":return"M312 0 H355 V"+n+" H312z M312 0 H355 V"+n+" H312z";case"‖":return"M257 0 H300 V"+n+" H257z M257 0 H300 V"+n+" H257z"+("M478 0 H521 V"+n+" H478z M478 0 H521 V"+n+" H478z");default:return""}},w3={doubleleftarrow:`M262 157 -l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3 - 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28 - 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5 -c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5 - 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87 --86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7 --2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z -m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l --10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5 - 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88 --33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68 --17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18 --13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782 -c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3 --107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120 - 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8 --5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247 -c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208 - 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3 - 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202 - l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117 --45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7 - 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13 - 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688 - 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7 --331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80 -H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0 - 435 0h399565z`,leftgroupunder:`M400000 262 -H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219 - 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3 --3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5 --18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7 --196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5 - 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3 --4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7 --10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z -m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333 - 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5 - 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667 --152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12 - 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7 --2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0 -v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5 --83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3 --68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21 - 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z -M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z -M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23 --.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8 -c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3 - 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z -M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334 -c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14 --53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7 - 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11 - 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214 -c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14 - 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3 - 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0 --5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6 --320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z -m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8 -60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8 --451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z -m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2 -c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6 --480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z -m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0 -85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8 --707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z -m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1 -c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128 --16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 - 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 - 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85 --40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 --12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 - 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l --6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5 -s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1 -c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3 - 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237 --174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0 - 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18 - 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3 --3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2 --10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 - 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11 --18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7 - 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z -m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8 - 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5 --7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95 --27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8 - 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 - 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3 --64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z -m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3 - 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0 --13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21 - 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z -M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23 - 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32 --52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142 --167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40 - 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69 --70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3 --40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19 --37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101 - 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167 -c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3 - 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42 - 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333 --19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70 - 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7 --2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0 - 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0 - 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128 --68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418 --8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9 - 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114 -c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751 - 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457 --11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0 - 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697 - 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696 - -338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345 --11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409 - 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9 - 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409 - -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5 -3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11 -10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63 --1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1 --7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59 -H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359 -c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22 -c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10 --11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10 --11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10 --11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1, --5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, --11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, --11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, --11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202 -c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5 -c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130 -s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47 -121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6 -s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11 -c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z -M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32 --27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0 -13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39 --84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5 --119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 --12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 -151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 -c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17 -c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21 -c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40 -c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z -M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0 -c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, --231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 -c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z -M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 -c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9, -1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7, --152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z -M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0 -c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, --231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 -c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z -M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},AI=function(t,n){switch(t){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v1759 h347 v-84 -H403z M403 1759 V0 H319 V1759 v`+n+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v1759 H0 v84 H347z -M347 1759 V0 H263 V1759 v`+n+" v1759 h84z";case"vert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15 -c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 -c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+" v585 h43z";case"doublevert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15 -c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 -c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+` v585 h43z -M367 15 v585 v`+n+` v585 c2.667,10,9.667,15,21,15 -c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 -c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+n+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+n+` v1715 h263 v84 H319z -MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+n+` v1799 H0 v-84 H319z -MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v602 h84z -M403 1759 V0 H319 V1759 v`+n+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v602 h84z -M347 1759 V0 h-84 V1759 v`+n+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1 -c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349, --36,557 l0,`+(n+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210, -949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9 -c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5, --544.7,-112.5,-882c-2,-104,-3,-167,-3,-189 -l0,-`+(n+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3, --210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3, -63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5 -c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(n+9)+` -c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664 -c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11 -c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 -c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 -l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, --470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class Gu{constructor(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){for(var t=document.createDocumentFragment(),n=0;nn.toText();return this.children.map(t).join("")}}var es={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},C0={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},j3={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function DI(e,t){es[e]=t}function ig(e,t,n){if(!es[t])throw new Error("Font metrics not found for font: "+t+".");var a=e.charCodeAt(0),l=es[t][a];if(!l&&e[0]in j3&&(a=j3[e[0]].charCodeAt(0),l=es[t][a]),!l&&n==="text"&&l8(a)&&(l=es[t][77]),l)return{depth:l[0],height:l[1],italic:l[2],skew:l[3],width:l[4]}}var Yp={};function zI(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!Yp[t]){var n=Yp[t]={cssEmPerMu:C0.quad[t]/18};for(var a in C0)C0.hasOwnProperty(a)&&(n[a]=C0[a][t])}return Yp[t]}var OI=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],N3=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],S3=function(t,n){return n.size<2?t:OI[t-1][n.size-1]};class As{constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||As.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.sizeMultiplier=N3[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}extend(t){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var a in t)t.hasOwnProperty(a)&&(n[a]=t[a]);return new As(n)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:S3(this.textSize,t)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(t){return this.size===t&&this.textSize===t?this:this.extend({style:this.style.text(),size:t,textSize:t,sizeMultiplier:N3[t-1]})}havingBaseStyle(t){t=t||this.style.text();var n=S3(As.BASESIZE,t);return this.size===n&&this.textSize===As.BASESIZE&&this.style===t?this:this.extend({style:t,size:n})}havingBaseSizing(){var t;switch(this.style.id){case 4:case 5:t=3;break;case 6:case 7:t=1;break;default:t=6}return this.extend({style:this.style.text(),size:t})}withColor(t){return this.extend({color:t})}withPhantom(){return this.extend({phantom:!0})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}sizingClasses(t){return t.size!==this.size?["sizing","reset-size"+t.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==As.BASESIZE?["sizing","reset-size"+this.size,"size"+As.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=zI(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}As.BASESIZE=6;var $x={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},RI={ex:!0,em:!0,mu:!0},i8=function(t){return typeof t!="string"&&(t=t.unit),t in $x||t in RI||t==="ex"},_n=function(t,n){var a;if(t.unit in $x)a=$x[t.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(t.unit==="mu")a=n.fontMetrics().cssEmPerMu;else{var l;if(n.style.isTight()?l=n.havingStyle(n.style.text()):l=n,t.unit==="ex")a=l.fontMetrics().xHeight;else if(t.unit==="em")a=l.fontMetrics().quad;else throw new Ae("Invalid unit: '"+t.unit+"'");l!==n&&(a*=l.sizeMultiplier/n.sizeMultiplier)}return Math.min(t.number*a,n.maxSize)},Re=function(t){return+t.toFixed(4)+"em"},_l=function(t){return t.filter(n=>n).join(" ")},o8=function(t,n,a){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=a||{},n){n.style.isTight()&&this.classes.push("mtight");var l=n.getColor();l&&(this.style.color=l)}},c8=function(t){var n=document.createElement(t);n.className=_l(this.classes);for(var a in this.style)this.style.hasOwnProperty(a)&&(n.style[a]=this.style[a]);for(var l in this.attributes)this.attributes.hasOwnProperty(l)&&n.setAttribute(l,this.attributes[l]);for(var o=0;o/=\x00-\x1f]/,u8=function(t){var n="<"+t;this.classes.length&&(n+=' class="'+Ht.escape(_l(this.classes))+'"');var a="";for(var l in this.style)this.style.hasOwnProperty(l)&&(a+=Ht.hyphenate(l)+":"+this.style[l]+";");a&&(n+=' style="'+Ht.escape(a)+'"');for(var o in this.attributes)if(this.attributes.hasOwnProperty(o)){if(BI.test(o))throw new Ae("Invalid attribute name '"+o+"'");n+=" "+o+'="'+Ht.escape(this.attributes[o])+'"'}n+=">";for(var c=0;c",n};class Yu{constructor(t,n,a,l){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,o8.call(this,t,a,l),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return c8.call(this,"span")}toMarkup(){return u8.call(this,"span")}}class og{constructor(t,n,a,l){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,o8.call(this,n,l),this.children=a||[],this.setAttribute("href",t)}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return c8.call(this,"a")}toMarkup(){return u8.call(this,"a")}}class LI{constructor(t,n,a){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=t,this.classes=["mord"],this.style=a}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createElement("img");t.src=this.src,t.alt=this.alt,t.className="mord";for(var n in this.style)this.style.hasOwnProperty(n)&&(t.style[n]=this.style[n]);return t}toMarkup(){var t=''+Ht.escape(this.alt)+'0&&(n=document.createElement("span"),n.style.marginRight=Re(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=_l(this.classes));for(var a in this.style)this.style.hasOwnProperty(a)&&(n=n||document.createElement("span"),n.style[a]=this.style[a]);return n?(n.appendChild(t),n):t}toMarkup(){var t=!1,n="0&&(a+="margin-right:"+this.italic+"em;");for(var l in this.style)this.style.hasOwnProperty(l)&&(a+=Ht.hyphenate(l)+":"+this.style[l]+";");a&&(t=!0,n+=' style="'+Ht.escape(a)+'"');var o=Ht.escape(this.text);return t?(n+=">",n+=o,n+="",n):o}}class Fs{constructor(t,n){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=n||{}}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");for(var a in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,a)&&n.setAttribute(a,this.attributes[a]);for(var l=0;l':''}}class Vx{constructor(t){this.attributes=void 0,this.attributes=t||{}}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"line");for(var a in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,a)&&n.setAttribute(a,this.attributes[a]);return n}toMarkup(){var t=" but got "+String(e)+".")}var II={bin:1,close:1,inner:1,open:1,punct:1,rel:1},qI={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},yn={math:{},text:{}};function N(e,t,n,a,l,o){yn[e][l]={font:t,group:n,replace:a},o&&a&&(yn[e][a]=yn[e][l])}var C="math",_e="text",A="main",V="ams",Nn="accent-token",Ie="bin",Mr="close",Jo="inner",Je="mathord",Vn="op-token",ha="open",Um="punct",Y="rel",$s="spacing",ne="textord";N(C,A,Y,"≡","\\equiv",!0);N(C,A,Y,"≺","\\prec",!0);N(C,A,Y,"≻","\\succ",!0);N(C,A,Y,"∼","\\sim",!0);N(C,A,Y,"⊥","\\perp");N(C,A,Y,"⪯","\\preceq",!0);N(C,A,Y,"⪰","\\succeq",!0);N(C,A,Y,"≃","\\simeq",!0);N(C,A,Y,"∣","\\mid",!0);N(C,A,Y,"≪","\\ll",!0);N(C,A,Y,"≫","\\gg",!0);N(C,A,Y,"≍","\\asymp",!0);N(C,A,Y,"∥","\\parallel");N(C,A,Y,"⋈","\\bowtie",!0);N(C,A,Y,"⌣","\\smile",!0);N(C,A,Y,"⊑","\\sqsubseteq",!0);N(C,A,Y,"⊒","\\sqsupseteq",!0);N(C,A,Y,"≐","\\doteq",!0);N(C,A,Y,"⌢","\\frown",!0);N(C,A,Y,"∋","\\ni",!0);N(C,A,Y,"∝","\\propto",!0);N(C,A,Y,"⊢","\\vdash",!0);N(C,A,Y,"⊣","\\dashv",!0);N(C,A,Y,"∋","\\owns");N(C,A,Um,".","\\ldotp");N(C,A,Um,"⋅","\\cdotp");N(C,A,ne,"#","\\#");N(_e,A,ne,"#","\\#");N(C,A,ne,"&","\\&");N(_e,A,ne,"&","\\&");N(C,A,ne,"ℵ","\\aleph",!0);N(C,A,ne,"∀","\\forall",!0);N(C,A,ne,"ℏ","\\hbar",!0);N(C,A,ne,"∃","\\exists",!0);N(C,A,ne,"∇","\\nabla",!0);N(C,A,ne,"♭","\\flat",!0);N(C,A,ne,"ℓ","\\ell",!0);N(C,A,ne,"♮","\\natural",!0);N(C,A,ne,"♣","\\clubsuit",!0);N(C,A,ne,"℘","\\wp",!0);N(C,A,ne,"♯","\\sharp",!0);N(C,A,ne,"♢","\\diamondsuit",!0);N(C,A,ne,"ℜ","\\Re",!0);N(C,A,ne,"♡","\\heartsuit",!0);N(C,A,ne,"ℑ","\\Im",!0);N(C,A,ne,"♠","\\spadesuit",!0);N(C,A,ne,"§","\\S",!0);N(_e,A,ne,"§","\\S");N(C,A,ne,"¶","\\P",!0);N(_e,A,ne,"¶","\\P");N(C,A,ne,"†","\\dag");N(_e,A,ne,"†","\\dag");N(_e,A,ne,"†","\\textdagger");N(C,A,ne,"‡","\\ddag");N(_e,A,ne,"‡","\\ddag");N(_e,A,ne,"‡","\\textdaggerdbl");N(C,A,Mr,"⎱","\\rmoustache",!0);N(C,A,ha,"⎰","\\lmoustache",!0);N(C,A,Mr,"⟯","\\rgroup",!0);N(C,A,ha,"⟮","\\lgroup",!0);N(C,A,Ie,"∓","\\mp",!0);N(C,A,Ie,"⊖","\\ominus",!0);N(C,A,Ie,"⊎","\\uplus",!0);N(C,A,Ie,"⊓","\\sqcap",!0);N(C,A,Ie,"∗","\\ast");N(C,A,Ie,"⊔","\\sqcup",!0);N(C,A,Ie,"◯","\\bigcirc",!0);N(C,A,Ie,"∙","\\bullet",!0);N(C,A,Ie,"‡","\\ddagger");N(C,A,Ie,"≀","\\wr",!0);N(C,A,Ie,"⨿","\\amalg");N(C,A,Ie,"&","\\And");N(C,A,Y,"⟵","\\longleftarrow",!0);N(C,A,Y,"⇐","\\Leftarrow",!0);N(C,A,Y,"⟸","\\Longleftarrow",!0);N(C,A,Y,"⟶","\\longrightarrow",!0);N(C,A,Y,"⇒","\\Rightarrow",!0);N(C,A,Y,"⟹","\\Longrightarrow",!0);N(C,A,Y,"↔","\\leftrightarrow",!0);N(C,A,Y,"⟷","\\longleftrightarrow",!0);N(C,A,Y,"⇔","\\Leftrightarrow",!0);N(C,A,Y,"⟺","\\Longleftrightarrow",!0);N(C,A,Y,"↦","\\mapsto",!0);N(C,A,Y,"⟼","\\longmapsto",!0);N(C,A,Y,"↗","\\nearrow",!0);N(C,A,Y,"↩","\\hookleftarrow",!0);N(C,A,Y,"↪","\\hookrightarrow",!0);N(C,A,Y,"↘","\\searrow",!0);N(C,A,Y,"↼","\\leftharpoonup",!0);N(C,A,Y,"⇀","\\rightharpoonup",!0);N(C,A,Y,"↙","\\swarrow",!0);N(C,A,Y,"↽","\\leftharpoondown",!0);N(C,A,Y,"⇁","\\rightharpoondown",!0);N(C,A,Y,"↖","\\nwarrow",!0);N(C,A,Y,"⇌","\\rightleftharpoons",!0);N(C,V,Y,"≮","\\nless",!0);N(C,V,Y,"","\\@nleqslant");N(C,V,Y,"","\\@nleqq");N(C,V,Y,"⪇","\\lneq",!0);N(C,V,Y,"≨","\\lneqq",!0);N(C,V,Y,"","\\@lvertneqq");N(C,V,Y,"⋦","\\lnsim",!0);N(C,V,Y,"⪉","\\lnapprox",!0);N(C,V,Y,"⊀","\\nprec",!0);N(C,V,Y,"⋠","\\npreceq",!0);N(C,V,Y,"⋨","\\precnsim",!0);N(C,V,Y,"⪹","\\precnapprox",!0);N(C,V,Y,"≁","\\nsim",!0);N(C,V,Y,"","\\@nshortmid");N(C,V,Y,"∤","\\nmid",!0);N(C,V,Y,"⊬","\\nvdash",!0);N(C,V,Y,"⊭","\\nvDash",!0);N(C,V,Y,"⋪","\\ntriangleleft");N(C,V,Y,"⋬","\\ntrianglelefteq",!0);N(C,V,Y,"⊊","\\subsetneq",!0);N(C,V,Y,"","\\@varsubsetneq");N(C,V,Y,"⫋","\\subsetneqq",!0);N(C,V,Y,"","\\@varsubsetneqq");N(C,V,Y,"≯","\\ngtr",!0);N(C,V,Y,"","\\@ngeqslant");N(C,V,Y,"","\\@ngeqq");N(C,V,Y,"⪈","\\gneq",!0);N(C,V,Y,"≩","\\gneqq",!0);N(C,V,Y,"","\\@gvertneqq");N(C,V,Y,"⋧","\\gnsim",!0);N(C,V,Y,"⪊","\\gnapprox",!0);N(C,V,Y,"⊁","\\nsucc",!0);N(C,V,Y,"⋡","\\nsucceq",!0);N(C,V,Y,"⋩","\\succnsim",!0);N(C,V,Y,"⪺","\\succnapprox",!0);N(C,V,Y,"≆","\\ncong",!0);N(C,V,Y,"","\\@nshortparallel");N(C,V,Y,"∦","\\nparallel",!0);N(C,V,Y,"⊯","\\nVDash",!0);N(C,V,Y,"⋫","\\ntriangleright");N(C,V,Y,"⋭","\\ntrianglerighteq",!0);N(C,V,Y,"","\\@nsupseteqq");N(C,V,Y,"⊋","\\supsetneq",!0);N(C,V,Y,"","\\@varsupsetneq");N(C,V,Y,"⫌","\\supsetneqq",!0);N(C,V,Y,"","\\@varsupsetneqq");N(C,V,Y,"⊮","\\nVdash",!0);N(C,V,Y,"⪵","\\precneqq",!0);N(C,V,Y,"⪶","\\succneqq",!0);N(C,V,Y,"","\\@nsubseteqq");N(C,V,Ie,"⊴","\\unlhd");N(C,V,Ie,"⊵","\\unrhd");N(C,V,Y,"↚","\\nleftarrow",!0);N(C,V,Y,"↛","\\nrightarrow",!0);N(C,V,Y,"⇍","\\nLeftarrow",!0);N(C,V,Y,"⇏","\\nRightarrow",!0);N(C,V,Y,"↮","\\nleftrightarrow",!0);N(C,V,Y,"⇎","\\nLeftrightarrow",!0);N(C,V,Y,"△","\\vartriangle");N(C,V,ne,"ℏ","\\hslash");N(C,V,ne,"▽","\\triangledown");N(C,V,ne,"◊","\\lozenge");N(C,V,ne,"Ⓢ","\\circledS");N(C,V,ne,"®","\\circledR");N(_e,V,ne,"®","\\circledR");N(C,V,ne,"∡","\\measuredangle",!0);N(C,V,ne,"∄","\\nexists");N(C,V,ne,"℧","\\mho");N(C,V,ne,"Ⅎ","\\Finv",!0);N(C,V,ne,"⅁","\\Game",!0);N(C,V,ne,"‵","\\backprime");N(C,V,ne,"▲","\\blacktriangle");N(C,V,ne,"▼","\\blacktriangledown");N(C,V,ne,"■","\\blacksquare");N(C,V,ne,"⧫","\\blacklozenge");N(C,V,ne,"★","\\bigstar");N(C,V,ne,"∢","\\sphericalangle",!0);N(C,V,ne,"∁","\\complement",!0);N(C,V,ne,"ð","\\eth",!0);N(_e,A,ne,"ð","ð");N(C,V,ne,"╱","\\diagup");N(C,V,ne,"╲","\\diagdown");N(C,V,ne,"□","\\square");N(C,V,ne,"□","\\Box");N(C,V,ne,"◊","\\Diamond");N(C,V,ne,"¥","\\yen",!0);N(_e,V,ne,"¥","\\yen",!0);N(C,V,ne,"✓","\\checkmark",!0);N(_e,V,ne,"✓","\\checkmark");N(C,V,ne,"ℶ","\\beth",!0);N(C,V,ne,"ℸ","\\daleth",!0);N(C,V,ne,"ℷ","\\gimel",!0);N(C,V,ne,"ϝ","\\digamma",!0);N(C,V,ne,"ϰ","\\varkappa");N(C,V,ha,"┌","\\@ulcorner",!0);N(C,V,Mr,"┐","\\@urcorner",!0);N(C,V,ha,"└","\\@llcorner",!0);N(C,V,Mr,"┘","\\@lrcorner",!0);N(C,V,Y,"≦","\\leqq",!0);N(C,V,Y,"⩽","\\leqslant",!0);N(C,V,Y,"⪕","\\eqslantless",!0);N(C,V,Y,"≲","\\lesssim",!0);N(C,V,Y,"⪅","\\lessapprox",!0);N(C,V,Y,"≊","\\approxeq",!0);N(C,V,Ie,"⋖","\\lessdot");N(C,V,Y,"⋘","\\lll",!0);N(C,V,Y,"≶","\\lessgtr",!0);N(C,V,Y,"⋚","\\lesseqgtr",!0);N(C,V,Y,"⪋","\\lesseqqgtr",!0);N(C,V,Y,"≑","\\doteqdot");N(C,V,Y,"≓","\\risingdotseq",!0);N(C,V,Y,"≒","\\fallingdotseq",!0);N(C,V,Y,"∽","\\backsim",!0);N(C,V,Y,"⋍","\\backsimeq",!0);N(C,V,Y,"⫅","\\subseteqq",!0);N(C,V,Y,"⋐","\\Subset",!0);N(C,V,Y,"⊏","\\sqsubset",!0);N(C,V,Y,"≼","\\preccurlyeq",!0);N(C,V,Y,"⋞","\\curlyeqprec",!0);N(C,V,Y,"≾","\\precsim",!0);N(C,V,Y,"⪷","\\precapprox",!0);N(C,V,Y,"⊲","\\vartriangleleft");N(C,V,Y,"⊴","\\trianglelefteq");N(C,V,Y,"⊨","\\vDash",!0);N(C,V,Y,"⊪","\\Vvdash",!0);N(C,V,Y,"⌣","\\smallsmile");N(C,V,Y,"⌢","\\smallfrown");N(C,V,Y,"≏","\\bumpeq",!0);N(C,V,Y,"≎","\\Bumpeq",!0);N(C,V,Y,"≧","\\geqq",!0);N(C,V,Y,"⩾","\\geqslant",!0);N(C,V,Y,"⪖","\\eqslantgtr",!0);N(C,V,Y,"≳","\\gtrsim",!0);N(C,V,Y,"⪆","\\gtrapprox",!0);N(C,V,Ie,"⋗","\\gtrdot");N(C,V,Y,"⋙","\\ggg",!0);N(C,V,Y,"≷","\\gtrless",!0);N(C,V,Y,"⋛","\\gtreqless",!0);N(C,V,Y,"⪌","\\gtreqqless",!0);N(C,V,Y,"≖","\\eqcirc",!0);N(C,V,Y,"≗","\\circeq",!0);N(C,V,Y,"≜","\\triangleq",!0);N(C,V,Y,"∼","\\thicksim");N(C,V,Y,"≈","\\thickapprox");N(C,V,Y,"⫆","\\supseteqq",!0);N(C,V,Y,"⋑","\\Supset",!0);N(C,V,Y,"⊐","\\sqsupset",!0);N(C,V,Y,"≽","\\succcurlyeq",!0);N(C,V,Y,"⋟","\\curlyeqsucc",!0);N(C,V,Y,"≿","\\succsim",!0);N(C,V,Y,"⪸","\\succapprox",!0);N(C,V,Y,"⊳","\\vartriangleright");N(C,V,Y,"⊵","\\trianglerighteq");N(C,V,Y,"⊩","\\Vdash",!0);N(C,V,Y,"∣","\\shortmid");N(C,V,Y,"∥","\\shortparallel");N(C,V,Y,"≬","\\between",!0);N(C,V,Y,"⋔","\\pitchfork",!0);N(C,V,Y,"∝","\\varpropto");N(C,V,Y,"◀","\\blacktriangleleft");N(C,V,Y,"∴","\\therefore",!0);N(C,V,Y,"∍","\\backepsilon");N(C,V,Y,"▶","\\blacktriangleright");N(C,V,Y,"∵","\\because",!0);N(C,V,Y,"⋘","\\llless");N(C,V,Y,"⋙","\\gggtr");N(C,V,Ie,"⊲","\\lhd");N(C,V,Ie,"⊳","\\rhd");N(C,V,Y,"≂","\\eqsim",!0);N(C,A,Y,"⋈","\\Join");N(C,V,Y,"≑","\\Doteq",!0);N(C,V,Ie,"∔","\\dotplus",!0);N(C,V,Ie,"∖","\\smallsetminus");N(C,V,Ie,"⋒","\\Cap",!0);N(C,V,Ie,"⋓","\\Cup",!0);N(C,V,Ie,"⩞","\\doublebarwedge",!0);N(C,V,Ie,"⊟","\\boxminus",!0);N(C,V,Ie,"⊞","\\boxplus",!0);N(C,V,Ie,"⋇","\\divideontimes",!0);N(C,V,Ie,"⋉","\\ltimes",!0);N(C,V,Ie,"⋊","\\rtimes",!0);N(C,V,Ie,"⋋","\\leftthreetimes",!0);N(C,V,Ie,"⋌","\\rightthreetimes",!0);N(C,V,Ie,"⋏","\\curlywedge",!0);N(C,V,Ie,"⋎","\\curlyvee",!0);N(C,V,Ie,"⊝","\\circleddash",!0);N(C,V,Ie,"⊛","\\circledast",!0);N(C,V,Ie,"⋅","\\centerdot");N(C,V,Ie,"⊺","\\intercal",!0);N(C,V,Ie,"⋒","\\doublecap");N(C,V,Ie,"⋓","\\doublecup");N(C,V,Ie,"⊠","\\boxtimes",!0);N(C,V,Y,"⇢","\\dashrightarrow",!0);N(C,V,Y,"⇠","\\dashleftarrow",!0);N(C,V,Y,"⇇","\\leftleftarrows",!0);N(C,V,Y,"⇆","\\leftrightarrows",!0);N(C,V,Y,"⇚","\\Lleftarrow",!0);N(C,V,Y,"↞","\\twoheadleftarrow",!0);N(C,V,Y,"↢","\\leftarrowtail",!0);N(C,V,Y,"↫","\\looparrowleft",!0);N(C,V,Y,"⇋","\\leftrightharpoons",!0);N(C,V,Y,"↶","\\curvearrowleft",!0);N(C,V,Y,"↺","\\circlearrowleft",!0);N(C,V,Y,"↰","\\Lsh",!0);N(C,V,Y,"⇈","\\upuparrows",!0);N(C,V,Y,"↿","\\upharpoonleft",!0);N(C,V,Y,"⇃","\\downharpoonleft",!0);N(C,A,Y,"⊶","\\origof",!0);N(C,A,Y,"⊷","\\imageof",!0);N(C,V,Y,"⊸","\\multimap",!0);N(C,V,Y,"↭","\\leftrightsquigarrow",!0);N(C,V,Y,"⇉","\\rightrightarrows",!0);N(C,V,Y,"⇄","\\rightleftarrows",!0);N(C,V,Y,"↠","\\twoheadrightarrow",!0);N(C,V,Y,"↣","\\rightarrowtail",!0);N(C,V,Y,"↬","\\looparrowright",!0);N(C,V,Y,"↷","\\curvearrowright",!0);N(C,V,Y,"↻","\\circlearrowright",!0);N(C,V,Y,"↱","\\Rsh",!0);N(C,V,Y,"⇊","\\downdownarrows",!0);N(C,V,Y,"↾","\\upharpoonright",!0);N(C,V,Y,"⇂","\\downharpoonright",!0);N(C,V,Y,"⇝","\\rightsquigarrow",!0);N(C,V,Y,"⇝","\\leadsto");N(C,V,Y,"⇛","\\Rrightarrow",!0);N(C,V,Y,"↾","\\restriction");N(C,A,ne,"‘","`");N(C,A,ne,"$","\\$");N(_e,A,ne,"$","\\$");N(_e,A,ne,"$","\\textdollar");N(C,A,ne,"%","\\%");N(_e,A,ne,"%","\\%");N(C,A,ne,"_","\\_");N(_e,A,ne,"_","\\_");N(_e,A,ne,"_","\\textunderscore");N(C,A,ne,"∠","\\angle",!0);N(C,A,ne,"∞","\\infty",!0);N(C,A,ne,"′","\\prime");N(C,A,ne,"△","\\triangle");N(C,A,ne,"Γ","\\Gamma",!0);N(C,A,ne,"Δ","\\Delta",!0);N(C,A,ne,"Θ","\\Theta",!0);N(C,A,ne,"Λ","\\Lambda",!0);N(C,A,ne,"Ξ","\\Xi",!0);N(C,A,ne,"Π","\\Pi",!0);N(C,A,ne,"Σ","\\Sigma",!0);N(C,A,ne,"Υ","\\Upsilon",!0);N(C,A,ne,"Φ","\\Phi",!0);N(C,A,ne,"Ψ","\\Psi",!0);N(C,A,ne,"Ω","\\Omega",!0);N(C,A,ne,"A","Α");N(C,A,ne,"B","Β");N(C,A,ne,"E","Ε");N(C,A,ne,"Z","Ζ");N(C,A,ne,"H","Η");N(C,A,ne,"I","Ι");N(C,A,ne,"K","Κ");N(C,A,ne,"M","Μ");N(C,A,ne,"N","Ν");N(C,A,ne,"O","Ο");N(C,A,ne,"P","Ρ");N(C,A,ne,"T","Τ");N(C,A,ne,"X","Χ");N(C,A,ne,"¬","\\neg",!0);N(C,A,ne,"¬","\\lnot");N(C,A,ne,"⊤","\\top");N(C,A,ne,"⊥","\\bot");N(C,A,ne,"∅","\\emptyset");N(C,V,ne,"∅","\\varnothing");N(C,A,Je,"α","\\alpha",!0);N(C,A,Je,"β","\\beta",!0);N(C,A,Je,"γ","\\gamma",!0);N(C,A,Je,"δ","\\delta",!0);N(C,A,Je,"ϵ","\\epsilon",!0);N(C,A,Je,"ζ","\\zeta",!0);N(C,A,Je,"η","\\eta",!0);N(C,A,Je,"θ","\\theta",!0);N(C,A,Je,"ι","\\iota",!0);N(C,A,Je,"κ","\\kappa",!0);N(C,A,Je,"λ","\\lambda",!0);N(C,A,Je,"μ","\\mu",!0);N(C,A,Je,"ν","\\nu",!0);N(C,A,Je,"ξ","\\xi",!0);N(C,A,Je,"ο","\\omicron",!0);N(C,A,Je,"π","\\pi",!0);N(C,A,Je,"ρ","\\rho",!0);N(C,A,Je,"σ","\\sigma",!0);N(C,A,Je,"τ","\\tau",!0);N(C,A,Je,"υ","\\upsilon",!0);N(C,A,Je,"ϕ","\\phi",!0);N(C,A,Je,"χ","\\chi",!0);N(C,A,Je,"ψ","\\psi",!0);N(C,A,Je,"ω","\\omega",!0);N(C,A,Je,"ε","\\varepsilon",!0);N(C,A,Je,"ϑ","\\vartheta",!0);N(C,A,Je,"ϖ","\\varpi",!0);N(C,A,Je,"ϱ","\\varrho",!0);N(C,A,Je,"ς","\\varsigma",!0);N(C,A,Je,"φ","\\varphi",!0);N(C,A,Ie,"∗","*",!0);N(C,A,Ie,"+","+");N(C,A,Ie,"−","-",!0);N(C,A,Ie,"⋅","\\cdot",!0);N(C,A,Ie,"∘","\\circ",!0);N(C,A,Ie,"÷","\\div",!0);N(C,A,Ie,"±","\\pm",!0);N(C,A,Ie,"×","\\times",!0);N(C,A,Ie,"∩","\\cap",!0);N(C,A,Ie,"∪","\\cup",!0);N(C,A,Ie,"∖","\\setminus",!0);N(C,A,Ie,"∧","\\land");N(C,A,Ie,"∨","\\lor");N(C,A,Ie,"∧","\\wedge",!0);N(C,A,Ie,"∨","\\vee",!0);N(C,A,ne,"√","\\surd");N(C,A,ha,"⟨","\\langle",!0);N(C,A,ha,"∣","\\lvert");N(C,A,ha,"∥","\\lVert");N(C,A,Mr,"?","?");N(C,A,Mr,"!","!");N(C,A,Mr,"⟩","\\rangle",!0);N(C,A,Mr,"∣","\\rvert");N(C,A,Mr,"∥","\\rVert");N(C,A,Y,"=","=");N(C,A,Y,":",":");N(C,A,Y,"≈","\\approx",!0);N(C,A,Y,"≅","\\cong",!0);N(C,A,Y,"≥","\\ge");N(C,A,Y,"≥","\\geq",!0);N(C,A,Y,"←","\\gets");N(C,A,Y,">","\\gt",!0);N(C,A,Y,"∈","\\in",!0);N(C,A,Y,"","\\@not");N(C,A,Y,"⊂","\\subset",!0);N(C,A,Y,"⊃","\\supset",!0);N(C,A,Y,"⊆","\\subseteq",!0);N(C,A,Y,"⊇","\\supseteq",!0);N(C,V,Y,"⊈","\\nsubseteq",!0);N(C,V,Y,"⊉","\\nsupseteq",!0);N(C,A,Y,"⊨","\\models");N(C,A,Y,"←","\\leftarrow",!0);N(C,A,Y,"≤","\\le");N(C,A,Y,"≤","\\leq",!0);N(C,A,Y,"<","\\lt",!0);N(C,A,Y,"→","\\rightarrow",!0);N(C,A,Y,"→","\\to");N(C,V,Y,"≱","\\ngeq",!0);N(C,V,Y,"≰","\\nleq",!0);N(C,A,$s," ","\\ ");N(C,A,$s," ","\\space");N(C,A,$s," ","\\nobreakspace");N(_e,A,$s," ","\\ ");N(_e,A,$s," "," ");N(_e,A,$s," ","\\space");N(_e,A,$s," ","\\nobreakspace");N(C,A,$s,null,"\\nobreak");N(C,A,$s,null,"\\allowbreak");N(C,A,Um,",",",");N(C,A,Um,";",";");N(C,V,Ie,"⊼","\\barwedge",!0);N(C,V,Ie,"⊻","\\veebar",!0);N(C,A,Ie,"⊙","\\odot",!0);N(C,A,Ie,"⊕","\\oplus",!0);N(C,A,Ie,"⊗","\\otimes",!0);N(C,A,ne,"∂","\\partial",!0);N(C,A,Ie,"⊘","\\oslash",!0);N(C,V,Ie,"⊚","\\circledcirc",!0);N(C,V,Ie,"⊡","\\boxdot",!0);N(C,A,Ie,"△","\\bigtriangleup");N(C,A,Ie,"▽","\\bigtriangledown");N(C,A,Ie,"†","\\dagger");N(C,A,Ie,"⋄","\\diamond");N(C,A,Ie,"⋆","\\star");N(C,A,Ie,"◃","\\triangleleft");N(C,A,Ie,"▹","\\triangleright");N(C,A,ha,"{","\\{");N(_e,A,ne,"{","\\{");N(_e,A,ne,"{","\\textbraceleft");N(C,A,Mr,"}","\\}");N(_e,A,ne,"}","\\}");N(_e,A,ne,"}","\\textbraceright");N(C,A,ha,"{","\\lbrace");N(C,A,Mr,"}","\\rbrace");N(C,A,ha,"[","\\lbrack",!0);N(_e,A,ne,"[","\\lbrack",!0);N(C,A,Mr,"]","\\rbrack",!0);N(_e,A,ne,"]","\\rbrack",!0);N(C,A,ha,"(","\\lparen",!0);N(C,A,Mr,")","\\rparen",!0);N(_e,A,ne,"<","\\textless",!0);N(_e,A,ne,">","\\textgreater",!0);N(C,A,ha,"⌊","\\lfloor",!0);N(C,A,Mr,"⌋","\\rfloor",!0);N(C,A,ha,"⌈","\\lceil",!0);N(C,A,Mr,"⌉","\\rceil",!0);N(C,A,ne,"\\","\\backslash");N(C,A,ne,"∣","|");N(C,A,ne,"∣","\\vert");N(_e,A,ne,"|","\\textbar",!0);N(C,A,ne,"∥","\\|");N(C,A,ne,"∥","\\Vert");N(_e,A,ne,"∥","\\textbardbl");N(_e,A,ne,"~","\\textasciitilde");N(_e,A,ne,"\\","\\textbackslash");N(_e,A,ne,"^","\\textasciicircum");N(C,A,Y,"↑","\\uparrow",!0);N(C,A,Y,"⇑","\\Uparrow",!0);N(C,A,Y,"↓","\\downarrow",!0);N(C,A,Y,"⇓","\\Downarrow",!0);N(C,A,Y,"↕","\\updownarrow",!0);N(C,A,Y,"⇕","\\Updownarrow",!0);N(C,A,Vn,"∐","\\coprod");N(C,A,Vn,"⋁","\\bigvee");N(C,A,Vn,"⋀","\\bigwedge");N(C,A,Vn,"⨄","\\biguplus");N(C,A,Vn,"⋂","\\bigcap");N(C,A,Vn,"⋃","\\bigcup");N(C,A,Vn,"∫","\\int");N(C,A,Vn,"∫","\\intop");N(C,A,Vn,"∬","\\iint");N(C,A,Vn,"∭","\\iiint");N(C,A,Vn,"∏","\\prod");N(C,A,Vn,"∑","\\sum");N(C,A,Vn,"⨂","\\bigotimes");N(C,A,Vn,"⨁","\\bigoplus");N(C,A,Vn,"⨀","\\bigodot");N(C,A,Vn,"∮","\\oint");N(C,A,Vn,"∯","\\oiint");N(C,A,Vn,"∰","\\oiiint");N(C,A,Vn,"⨆","\\bigsqcup");N(C,A,Vn,"∫","\\smallint");N(_e,A,Jo,"…","\\textellipsis");N(C,A,Jo,"…","\\mathellipsis");N(_e,A,Jo,"…","\\ldots",!0);N(C,A,Jo,"…","\\ldots",!0);N(C,A,Jo,"⋯","\\@cdots",!0);N(C,A,Jo,"⋱","\\ddots",!0);N(C,A,ne,"⋮","\\varvdots");N(_e,A,ne,"⋮","\\varvdots");N(C,A,Nn,"ˊ","\\acute");N(C,A,Nn,"ˋ","\\grave");N(C,A,Nn,"¨","\\ddot");N(C,A,Nn,"~","\\tilde");N(C,A,Nn,"ˉ","\\bar");N(C,A,Nn,"˘","\\breve");N(C,A,Nn,"ˇ","\\check");N(C,A,Nn,"^","\\hat");N(C,A,Nn,"⃗","\\vec");N(C,A,Nn,"˙","\\dot");N(C,A,Nn,"˚","\\mathring");N(C,A,Je,"","\\@imath");N(C,A,Je,"","\\@jmath");N(C,A,ne,"ı","ı");N(C,A,ne,"ȷ","ȷ");N(_e,A,ne,"ı","\\i",!0);N(_e,A,ne,"ȷ","\\j",!0);N(_e,A,ne,"ß","\\ss",!0);N(_e,A,ne,"æ","\\ae",!0);N(_e,A,ne,"œ","\\oe",!0);N(_e,A,ne,"ø","\\o",!0);N(_e,A,ne,"Æ","\\AE",!0);N(_e,A,ne,"Œ","\\OE",!0);N(_e,A,ne,"Ø","\\O",!0);N(_e,A,Nn,"ˊ","\\'");N(_e,A,Nn,"ˋ","\\`");N(_e,A,Nn,"ˆ","\\^");N(_e,A,Nn,"˜","\\~");N(_e,A,Nn,"ˉ","\\=");N(_e,A,Nn,"˘","\\u");N(_e,A,Nn,"˙","\\.");N(_e,A,Nn,"¸","\\c");N(_e,A,Nn,"˚","\\r");N(_e,A,Nn,"ˇ","\\v");N(_e,A,Nn,"¨",'\\"');N(_e,A,Nn,"˝","\\H");N(_e,A,Nn,"◯","\\textcircled");var d8={"--":!0,"---":!0,"``":!0,"''":!0};N(_e,A,ne,"–","--",!0);N(_e,A,ne,"–","\\textendash");N(_e,A,ne,"—","---",!0);N(_e,A,ne,"—","\\textemdash");N(_e,A,ne,"‘","`",!0);N(_e,A,ne,"‘","\\textquoteleft");N(_e,A,ne,"’","'",!0);N(_e,A,ne,"’","\\textquoteright");N(_e,A,ne,"“","``",!0);N(_e,A,ne,"“","\\textquotedblleft");N(_e,A,ne,"”","''",!0);N(_e,A,ne,"”","\\textquotedblright");N(C,A,ne,"°","\\degree",!0);N(_e,A,ne,"°","\\degree");N(_e,A,ne,"°","\\textdegree",!0);N(C,A,ne,"£","\\pounds");N(C,A,ne,"£","\\mathsterling",!0);N(_e,A,ne,"£","\\pounds");N(_e,A,ne,"£","\\textsterling",!0);N(C,V,ne,"✠","\\maltese");N(_e,V,ne,"✠","\\maltese");var C3='0123456789/@."';for(var Wp=0;Wp0)return La(o,f,l,n,c.concat(p));if(m){var x,y;if(m==="boldsymbol"){var b=$I(o,l,n,c,a);x=b.fontName,y=[b.fontClass]}else d?(x=f8[m].fontName,y=[m]):(x=E0(m,n.fontWeight,n.fontShape),y=[m,n.fontWeight,n.fontShape]);if($m(o,x,l).metrics)return La(o,x,l,n,c.concat(y));if(d8.hasOwnProperty(o)&&x.slice(0,10)==="Typewriter"){for(var j=[],k=0;k{if(_l(e.classes)!==_l(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize)return!1;if(e.classes.length===1){var n=e.classes[0];if(n==="mbin"||n==="mord")return!1}for(var a in e.style)if(e.style.hasOwnProperty(a)&&e.style[a]!==t.style[a])return!1;for(var l in t.style)if(t.style.hasOwnProperty(l)&&e.style[l]!==t.style[l])return!1;return!0},YI=e=>{for(var t=0;tn&&(n=c.height),c.depth>a&&(a=c.depth),c.maxFontSize>l&&(l=c.maxFontSize)}t.height=n,t.depth=a,t.maxFontSize=l},qr=function(t,n,a,l){var o=new Yu(t,n,a,l);return cg(o),o},m8=(e,t,n,a)=>new Yu(e,t,n,a),WI=function(t,n,a){var l=qr([t],[],n);return l.height=Math.max(a||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),l.style.borderBottomWidth=Re(l.height),l.maxFontSize=1,l},XI=function(t,n,a,l){var o=new og(t,n,a,l);return cg(o),o},h8=function(t){var n=new Gu(t);return cg(n),n},KI=function(t,n){return t instanceof Gu?qr([],[t],n):t},QI=function(t){if(t.positionType==="individualShift"){for(var n=t.children,a=[n[0]],l=-n[0].shift-n[0].elem.depth,o=l,c=1;c{var n=qr(["mspace"],[],t),a=_n(e,t);return n.style.marginRight=Re(a),n},E0=function(t,n,a){var l="";switch(t){case"amsrm":l="AMS";break;case"textrm":l="Main";break;case"textsf":l="SansSerif";break;case"texttt":l="Typewriter";break;default:l=t}var o;return n==="textbf"&&a==="textit"?o="BoldItalic":n==="textbf"?o="Bold":n==="textit"?o="Italic":o="Regular",l+"-"+o},f8={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},p8={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},eq=function(t,n){var[a,l,o]=p8[t],c=new Ml(a),d=new Fs([c],{width:Re(l),height:Re(o),style:"width:"+Re(l),viewBox:"0 0 "+1e3*l+" "+1e3*o,preserveAspectRatio:"xMinYMin"}),m=m8(["overlay"],[d],n);return m.height=o,m.style.height=Re(o),m.style.width=Re(l),m},ue={fontMap:f8,makeSymbol:La,mathsym:UI,makeSpan:qr,makeSvgSpan:m8,makeLineSpan:WI,makeAnchor:XI,makeFragment:h8,wrapFragment:KI,makeVList:ZI,makeOrd:VI,makeGlue:JI,staticSvg:eq,svgData:p8,tryCombineChars:YI},Cn={number:3,unit:"mu"},li={number:4,unit:"mu"},Ms={number:5,unit:"mu"},tq={mord:{mop:Cn,mbin:li,mrel:Ms,minner:Cn},mop:{mord:Cn,mop:Cn,mrel:Ms,minner:Cn},mbin:{mord:li,mop:li,mopen:li,minner:li},mrel:{mord:Ms,mop:Ms,mopen:Ms,minner:Ms},mopen:{},mclose:{mop:Cn,mbin:li,mrel:Ms,minner:Cn},mpunct:{mord:Cn,mop:Cn,mrel:Ms,mopen:Cn,mclose:Cn,mpunct:Cn,minner:Cn},minner:{mord:Cn,mop:Cn,mbin:li,mrel:Ms,mopen:Cn,mpunct:Cn,minner:Cn}},nq={mord:{mop:Cn},mop:{mord:Cn,mop:Cn},mbin:{},mrel:{},mopen:{},mclose:{mop:Cn},mpunct:{},minner:{mop:Cn}},x8={},hm={},fm={};function Le(e){for(var{type:t,names:n,props:a,handler:l,htmlBuilder:o,mathmlBuilder:c}=e,d={type:t,numArgs:a.numArgs,argTypes:a.argTypes,allowedInArgument:!!a.allowedInArgument,allowedInText:!!a.allowedInText,allowedInMath:a.allowedInMath===void 0?!0:a.allowedInMath,numOptionalArgs:a.numOptionalArgs||0,infix:!!a.infix,primitive:!!a.primitive,handler:l},m=0;m{var S=k.classes[0],_=j.classes[0];S==="mbin"&&aq.includes(_)?k.classes[0]="mord":_==="mbin"&&rq.includes(S)&&(j.classes[0]="mord")},{node:x},y,b),A3(o,(j,k)=>{var S=Yx(k),_=Yx(j),M=S&&_?j.hasClass("mtight")?nq[S][_]:tq[S][_]:null;if(M)return ue.makeGlue(M,f)},{node:x},y,b),o},A3=function e(t,n,a,l,o){l&&t.push(l);for(var c=0;cy=>{t.splice(x+1,0,y),c++})(c)}l&&t.pop()},g8=function(t){return t instanceof Gu||t instanceof og||t instanceof Yu&&t.hasClass("enclosing")?t:null},iq=function e(t,n){var a=g8(t);if(a){var l=a.children;if(l.length){if(n==="right")return e(l[l.length-1],"right");if(n==="left")return e(l[0],"left")}}return t},Yx=function(t,n){return t?(n&&(t=iq(t,n)),lq[t.classes[0]]||null):null},wu=function(t,n){var a=["nulldelimiter"].concat(t.baseSizingClasses());return Is(n.concat(a))},Pt=function(t,n,a){if(!t)return Is();if(hm[t.type]){var l=hm[t.type](t,n);if(a&&n.size!==a.size){l=Is(n.sizingClasses(a),[l],n);var o=n.sizeMultiplier/a.sizeMultiplier;l.height*=o,l.depth*=o}return l}else throw new Ae("Got group of unknown type: '"+t.type+"'")};function A0(e,t){var n=Is(["base"],e,t),a=Is(["strut"]);return a.style.height=Re(n.height+n.depth),n.depth&&(a.style.verticalAlign=Re(-n.depth)),n.children.unshift(a),n}function Wx(e,t){var n=null;e.length===1&&e[0].type==="tag"&&(n=e[0].tag,e=e[0].body);var a=Kn(e,t,"root"),l;a.length===2&&a[1].hasClass("tag")&&(l=a.pop());for(var o=[],c=[],d=0;d0&&(o.push(A0(c,t)),c=[]),o.push(a[d]));c.length>0&&o.push(A0(c,t));var f;n?(f=A0(Kn(n,t,!0)),f.classes=["tag"],o.push(f)):l&&o.push(l);var p=Is(["katex-html"],o);if(p.setAttribute("aria-hidden","true"),f){var x=f.children[0];x.style.height=Re(p.height+p.depth),p.depth&&(x.style.verticalAlign=Re(-p.depth))}return p}function v8(e){return new Gu(e)}class ca{constructor(t,n,a){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=t,this.attributes={},this.children=n||[],this.classes=a||[]}setAttribute(t,n){this.attributes[t]=n}getAttribute(t){return this.attributes[t]}toNode(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);this.classes.length>0&&(t.className=_l(this.classes));for(var a=0;a0&&(t+=' class ="'+Ht.escape(_l(this.classes))+'"'),t+=">";for(var a=0;a",t}toText(){return this.children.map(t=>t.toText()).join("")}}class ts{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return Ht.escape(this.toText())}toText(){return this.text}}class oq{constructor(t){this.width=void 0,this.character=void 0,this.width=t,t>=.05555&&t<=.05556?this.character=" ":t>=.1666&&t<=.1667?this.character=" ":t>=.2222&&t<=.2223?this.character=" ":t>=.2777&&t<=.2778?this.character="  ":t>=-.05556&&t<=-.05555?this.character=" ⁣":t>=-.1667&&t<=-.1666?this.character=" ⁣":t>=-.2223&&t<=-.2222?this.character=" ⁣":t>=-.2778&&t<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",Re(this.width)),t}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var Ee={MathNode:ca,TextNode:ts,SpaceNode:oq,newDocumentFragment:v8},Ea=function(t,n,a){return yn[n][t]&&yn[n][t].replace&&t.charCodeAt(0)!==55349&&!(d8.hasOwnProperty(t)&&a&&(a.fontFamily&&a.fontFamily.slice(4,6)==="tt"||a.font&&a.font.slice(4,6)==="tt"))&&(t=yn[n][t].replace),new Ee.TextNode(t)},ug=function(t){return t.length===1?t[0]:new Ee.MathNode("mrow",t)},dg=function(t,n){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold";var a=n.font;if(!a||a==="mathnormal")return null;var l=t.mode;if(a==="mathit")return"italic";if(a==="boldsymbol")return t.type==="textord"?"bold":"bold-italic";if(a==="mathbf")return"bold";if(a==="mathbb")return"double-struck";if(a==="mathsfit")return"sans-serif-italic";if(a==="mathfrak")return"fraktur";if(a==="mathscr"||a==="mathcal")return"script";if(a==="mathsf")return"sans-serif";if(a==="mathtt")return"monospace";var o=t.text;if(["\\imath","\\jmath"].includes(o))return null;yn[l][o]&&yn[l][o].replace&&(o=yn[l][o].replace);var c=ue.fontMap[a].fontName;return ig(o,c,l)?ue.fontMap[a].variant:null};function Zp(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof ts&&t.text==="."}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){var n=e.children[0];return n instanceof ts&&n.text===","}else return!1}var Qr=function(t,n,a){if(t.length===1){var l=fn(t[0],n);return a&&l instanceof ca&&l.type==="mo"&&(l.setAttribute("lspace","0em"),l.setAttribute("rspace","0em")),[l]}for(var o=[],c,d=0;d=1&&(c.type==="mn"||Zp(c))){var f=m.children[0];f instanceof ca&&f.type==="mn"&&(f.children=[...c.children,...f.children],o.pop())}else if(c.type==="mi"&&c.children.length===1){var p=c.children[0];if(p instanceof ts&&p.text==="̸"&&(m.type==="mo"||m.type==="mi"||m.type==="mn")){var x=m.children[0];x instanceof ts&&x.text.length>0&&(x.text=x.text.slice(0,1)+"̸"+x.text.slice(1),o.pop())}}}o.push(m),c=m}return o},El=function(t,n,a){return ug(Qr(t,n,a))},fn=function(t,n){if(!t)return new Ee.MathNode("mrow");if(fm[t.type]){var a=fm[t.type](t,n);return a}else throw new Ae("Got group of unknown type: '"+t.type+"'")};function D3(e,t,n,a,l){var o=Qr(e,n),c;o.length===1&&o[0]instanceof ca&&["mrow","mtable"].includes(o[0].type)?c=o[0]:c=new Ee.MathNode("mrow",o);var d=new Ee.MathNode("annotation",[new Ee.TextNode(t)]);d.setAttribute("encoding","application/x-tex");var m=new Ee.MathNode("semantics",[c,d]),f=new Ee.MathNode("math",[m]);f.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),a&&f.setAttribute("display","block");var p=l?"katex":"katex-mathml";return ue.makeSpan([p],[f])}var y8=function(t){return new As({style:t.displayMode?tt.DISPLAY:tt.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},b8=function(t,n){if(n.displayMode){var a=["katex-display"];n.leqno&&a.push("leqno"),n.fleqn&&a.push("fleqn"),t=ue.makeSpan(a,[t])}return t},cq=function(t,n,a){var l=y8(a),o;if(a.output==="mathml")return D3(t,n,l,a.displayMode,!0);if(a.output==="html"){var c=Wx(t,l);o=ue.makeSpan(["katex"],[c])}else{var d=D3(t,n,l,a.displayMode,!1),m=Wx(t,l);o=ue.makeSpan(["katex"],[d,m])}return b8(o,a)},uq=function(t,n,a){var l=y8(a),o=Wx(t,l),c=ue.makeSpan(["katex"],[o]);return b8(c,a)},dq={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},mq=function(t){var n=new Ee.MathNode("mo",[new Ee.TextNode(dq[t.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},hq={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},fq=function(t){return t.type==="ordgroup"?t.body.length:1},pq=function(t,n){function a(){var d=4e5,m=t.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(m)){var f=t,p=fq(f.base),x,y,b;if(p>5)m==="widehat"||m==="widecheck"?(x=420,d=2364,b=.42,y=m+"4"):(x=312,d=2340,b=.34,y="tilde4");else{var j=[1,1,2,2,3,3][p];m==="widehat"||m==="widecheck"?(d=[0,1062,2364,2364,2364][j],x=[0,239,300,360,420][j],b=[0,.24,.3,.3,.36,.42][j],y=m+j):(d=[0,600,1033,2339,2340][j],x=[0,260,286,306,312][j],b=[0,.26,.286,.3,.306,.34][j],y="tilde"+j)}var k=new Ml(y),S=new Fs([k],{width:"100%",height:Re(b),viewBox:"0 0 "+d+" "+x,preserveAspectRatio:"none"});return{span:ue.makeSvgSpan([],[S],n),minWidth:0,height:b}}else{var _=[],M=hq[m],[D,z,L]=M,E=L/1e3,R=D.length,H,$;if(R===1){var I=M[3];H=["hide-tail"],$=[I]}else if(R===2)H=["halfarrow-left","halfarrow-right"],$=["xMinYMin","xMaxYMin"];else if(R===3)H=["brace-left","brace-center","brace-right"],$=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support - `+R+" children.");for(var G=0;G0&&(l.style.minWidth=Re(o)),l},xq=function(t,n,a,l,o){var c,d=t.height+t.depth+a+l;if(/fbox|color|angl/.test(n)){if(c=ue.makeSpan(["stretchy",n],[],o),n==="fbox"){var m=o.color&&o.getColor();m&&(c.style.borderColor=m)}}else{var f=[];/^[bx]cancel$/.test(n)&&f.push(new Vx({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&f.push(new Vx({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var p=new Fs(f,{width:"100%",height:Re(d)});c=ue.makeSvgSpan([],[p],o)}return c.height=d,c.style.height=Re(d),c},qs={encloseSpan:xq,mathMLnode:mq,svgSpan:pq};function vt(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function mg(e){var t=Vm(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function Vm(e){return e&&(e.type==="atom"||qI.hasOwnProperty(e.type))?e:null}var hg=(e,t)=>{var n,a,l;e&&e.type==="supsub"?(a=vt(e.base,"accent"),n=a.base,e.base=n,l=FI(Pt(e,t)),e.base=a):(a=vt(e,"accent"),n=a.base);var o=Pt(n,t.havingCrampedStyle()),c=a.isShifty&&Ht.isCharacterBox(n),d=0;if(c){var m=Ht.getBaseElem(n),f=Pt(m,t.havingCrampedStyle());d=k3(f).skew}var p=a.label==="\\c",x=p?o.height+o.depth:Math.min(o.height,t.fontMetrics().xHeight),y;if(a.isStretchy)y=qs.svgSpan(a,t),y=ue.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"elem",elem:y,wrapperClasses:["svg-align"],wrapperStyle:d>0?{width:"calc(100% - "+Re(2*d)+")",marginLeft:Re(2*d)}:void 0}]},t);else{var b,j;a.label==="\\vec"?(b=ue.staticSvg("vec",t),j=ue.svgData.vec[1]):(b=ue.makeOrd({mode:a.mode,text:a.label},t,"textord"),b=k3(b),b.italic=0,j=b.width,p&&(x+=b.depth)),y=ue.makeSpan(["accent-body"],[b]);var k=a.label==="\\textcircled";k&&(y.classes.push("accent-full"),x=o.height);var S=d;k||(S-=j/2),y.style.left=Re(S),a.label==="\\textcircled"&&(y.style.top=".2em"),y=ue.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"kern",size:-x},{type:"elem",elem:y}]},t)}var _=ue.makeSpan(["mord","accent"],[y],t);return l?(l.children[0]=_,l.height=Math.max(_.height,l.height),l.classes[0]="mord",l):_},w8=(e,t)=>{var n=e.isStretchy?qs.mathMLnode(e.label):new Ee.MathNode("mo",[Ea(e.label,e.mode)]),a=new Ee.MathNode("mover",[fn(e.base,t),n]);return a.setAttribute("accent","true"),a},gq=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));Le({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{var n=pm(t[0]),a=!gq.test(e.funcName),l=!a||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:a,isShifty:l,base:n}},htmlBuilder:hg,mathmlBuilder:w8});Le({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var n=t[0],a=e.parser.mode;return a==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),a="text"),{type:"accent",mode:a,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:hg,mathmlBuilder:w8});Le({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=t[0];return{type:"accentUnder",mode:n.mode,label:a,base:l}},htmlBuilder:(e,t)=>{var n=Pt(e.base,t),a=qs.svgSpan(e,t),l=e.label==="\\utilde"?.12:0,o=ue.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:a,wrapperClasses:["svg-align"]},{type:"kern",size:l},{type:"elem",elem:n}]},t);return ue.makeSpan(["mord","accentunder"],[o],t)},mathmlBuilder:(e,t)=>{var n=qs.mathMLnode(e.label),a=new Ee.MathNode("munder",[fn(e.base,t),n]);return a.setAttribute("accentunder","true"),a}});var D0=e=>{var t=new Ee.MathNode("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};Le({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:a,funcName:l}=e;return{type:"xArrow",mode:a.mode,label:l,body:t[0],below:n[0]}},htmlBuilder(e,t){var n=t.style,a=t.havingStyle(n.sup()),l=ue.wrapFragment(Pt(e.body,a,t),t),o=e.label.slice(0,2)==="\\x"?"x":"cd";l.classes.push(o+"-arrow-pad");var c;e.below&&(a=t.havingStyle(n.sub()),c=ue.wrapFragment(Pt(e.below,a,t),t),c.classes.push(o+"-arrow-pad"));var d=qs.svgSpan(e,t),m=-t.fontMetrics().axisHeight+.5*d.height,f=-t.fontMetrics().axisHeight-.5*d.height-.111;(l.depth>.25||e.label==="\\xleftequilibrium")&&(f-=l.depth);var p;if(c){var x=-t.fontMetrics().axisHeight+c.height+.5*d.height+.111;p=ue.makeVList({positionType:"individualShift",children:[{type:"elem",elem:l,shift:f},{type:"elem",elem:d,shift:m},{type:"elem",elem:c,shift:x}]},t)}else p=ue.makeVList({positionType:"individualShift",children:[{type:"elem",elem:l,shift:f},{type:"elem",elem:d,shift:m}]},t);return p.children[0].children[0].children[1].classes.push("svg-align"),ue.makeSpan(["mrel","x-arrow"],[p],t)},mathmlBuilder(e,t){var n=qs.mathMLnode(e.label);n.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var a;if(e.body){var l=D0(fn(e.body,t));if(e.below){var o=D0(fn(e.below,t));a=new Ee.MathNode("munderover",[n,o,l])}else a=new Ee.MathNode("mover",[n,l])}else if(e.below){var c=D0(fn(e.below,t));a=new Ee.MathNode("munder",[n,c])}else a=D0(),a=new Ee.MathNode("mover",[n,a]);return a}});var vq=ue.makeSpan;function j8(e,t){var n=Kn(e.body,t,!0);return vq([e.mclass],n,t)}function N8(e,t){var n,a=Qr(e.body,t);return e.mclass==="minner"?n=new Ee.MathNode("mpadded",a):e.mclass==="mord"?e.isCharacterBox?(n=a[0],n.type="mi"):n=new Ee.MathNode("mi",a):(e.isCharacterBox?(n=a[0],n.type="mo"):n=new Ee.MathNode("mo",a),e.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):e.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):e.mclass==="mopen"||e.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):e.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}Le({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:n,funcName:a}=e,l=t[0];return{type:"mclass",mode:n.mode,mclass:"m"+a.slice(5),body:Rn(l),isCharacterBox:Ht.isCharacterBox(l)}},htmlBuilder:j8,mathmlBuilder:N8});var Gm=e=>{var t=e.type==="ordgroup"&&e.body.length?e.body[0]:e;return t.type==="atom"&&(t.family==="bin"||t.family==="rel")?"m"+t.family:"mord"};Le({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:Gm(t[0]),body:Rn(t[1]),isCharacterBox:Ht.isCharacterBox(t[1])}}});Le({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:n,funcName:a}=e,l=t[1],o=t[0],c;a!=="\\stackrel"?c=Gm(l):c="mrel";var d={type:"op",mode:l.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:a!=="\\stackrel",body:Rn(l)},m={type:"supsub",mode:o.mode,base:d,sup:a==="\\underset"?null:o,sub:a==="\\underset"?o:null};return{type:"mclass",mode:n.mode,mclass:c,body:[m],isCharacterBox:Ht.isCharacterBox(m)}},htmlBuilder:j8,mathmlBuilder:N8});Le({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:Gm(t[0]),body:Rn(t[0])}},htmlBuilder(e,t){var n=Kn(e.body,t,!0),a=ue.makeSpan([e.mclass],n,t);return a.style.textShadow="0.02em 0.01em 0.04px",a},mathmlBuilder(e,t){var n=Qr(e.body,t),a=new Ee.MathNode("mstyle",n);return a.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),a}});var yq={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},z3=()=>({type:"styling",body:[],mode:"math",style:"display"}),O3=e=>e.type==="textord"&&e.text==="@",bq=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function wq(e,t,n){var a=yq[e];switch(a){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(a,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var l=n.callFunction("\\\\cdleft",[t[0]],[]),o={type:"atom",text:a,mode:"math",family:"rel"},c=n.callFunction("\\Big",[o],[]),d=n.callFunction("\\\\cdright",[t[1]],[]),m={type:"ordgroup",mode:"math",body:[l,c,d]};return n.callFunction("\\\\cdparent",[m],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var f={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[f],[])}default:return{type:"textord",text:" ",mode:"math"}}}function jq(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var n=e.fetch().text;if(n==="&"||n==="\\\\")e.consume();else if(n==="\\end"){t[t.length-1].length===0&&t.pop();break}else throw new Ae("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var a=[],l=[a],o=0;o-1))if("<>AV".indexOf(f)>-1)for(var x=0;x<2;x++){for(var y=!0,b=m+1;bAV=|." after @',c[m]);var j=wq(f,p,e),k={type:"styling",body:[j],mode:"math",style:"display"};a.push(k),d=z3()}o%2===0?a.push(d):a.shift(),a=[],l.push(a)}e.gullet.endGroup(),e.gullet.endGroup();var S=new Array(l[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:l,arraystretch:1,addJot:!0,rowGaps:[null],cols:S,colSeparationType:"CD",hLinesBeforeRow:new Array(l.length+1).fill([])}}Le({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:a}=e;return{type:"cdlabel",mode:n.mode,side:a.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),a=ue.wrapFragment(Pt(e.label,n,t),t);return a.classes.push("cd-label-"+e.side),a.style.bottom=Re(.8-a.depth),a.height=0,a.depth=0,a},mathmlBuilder(e,t){var n=new Ee.MathNode("mrow",[fn(e.label,t)]);return n=new Ee.MathNode("mpadded",[n]),n.setAttribute("width","0"),e.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Ee.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Le({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:n}=e;return{type:"cdlabelparent",mode:n.mode,fragment:t[0]}},htmlBuilder(e,t){var n=ue.wrapFragment(Pt(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(e,t){return new Ee.MathNode("mrow",[fn(e.fragment,t)])}});Le({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,a=vt(t[0],"ordgroup"),l=a.body,o="",c=0;c=1114111)throw new Ae("\\@char with invalid code point "+o);return m<=65535?f=String.fromCharCode(m):(m-=65536,f=String.fromCharCode((m>>10)+55296,(m&1023)+56320)),{type:"textord",mode:n.mode,text:f}}});var S8=(e,t)=>{var n=Kn(e.body,t.withColor(e.color),!1);return ue.makeFragment(n)},k8=(e,t)=>{var n=Qr(e.body,t.withColor(e.color)),a=new Ee.MathNode("mstyle",n);return a.setAttribute("mathcolor",e.color),a};Le({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,a=vt(t[0],"color-token").color,l=t[1];return{type:"color",mode:n.mode,color:a,body:Rn(l)}},htmlBuilder:S8,mathmlBuilder:k8});Le({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:a}=e,l=vt(t[0],"color-token").color;n.gullet.macros.set("\\current@color",l);var o=n.parseExpression(!0,a);return{type:"color",mode:n.mode,color:l,body:o}},htmlBuilder:S8,mathmlBuilder:k8});Le({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,n){var{parser:a}=e,l=a.gullet.future().text==="["?a.parseSizeGroup(!0):null,o=!a.settings.displayMode||!a.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:a.mode,newLine:o,size:l&&vt(l,"size").value}},htmlBuilder(e,t){var n=ue.makeSpan(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=Re(_n(e.size,t)))),n},mathmlBuilder(e,t){var n=new Ee.MathNode("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",Re(_n(e.size,t)))),n}});var Xx={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},C8=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new Ae("Expected a control sequence",e);return t},Nq=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},T8=(e,t,n,a)=>{var l=e.gullet.macros.get(n.text);l==null&&(n.noexpand=!0,l={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,l,a)};Le({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:n}=e;t.consumeSpaces();var a=t.fetch();if(Xx[a.text])return(n==="\\global"||n==="\\\\globallong")&&(a.text=Xx[a.text]),vt(t.parseFunction(),"internal");throw new Ae("Invalid token after macro prefix",a)}});Le({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,a=t.gullet.popToken(),l=a.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(l))throw new Ae("Expected a control sequence",a);for(var o=0,c,d=[[]];t.gullet.future().text!=="{";)if(a=t.gullet.popToken(),a.text==="#"){if(t.gullet.future().text==="{"){c=t.gullet.future(),d[o].push("{");break}if(a=t.gullet.popToken(),!/^[1-9]$/.test(a.text))throw new Ae('Invalid argument number "'+a.text+'"');if(parseInt(a.text)!==o+1)throw new Ae('Argument number "'+a.text+'" out of order');o++,d.push([])}else{if(a.text==="EOF")throw new Ae("Expected a macro definition");d[o].push(a.text)}var{tokens:m}=t.gullet.consumeArg();return c&&m.unshift(c),(n==="\\edef"||n==="\\xdef")&&(m=t.gullet.expandTokens(m),m.reverse()),t.gullet.macros.set(l,{tokens:m,numArgs:o,delimiters:d},n===Xx[n]),{type:"internal",mode:t.mode}}});Le({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,a=C8(t.gullet.popToken());t.gullet.consumeSpaces();var l=Nq(t);return T8(t,a,l,n==="\\\\globallet"),{type:"internal",mode:t.mode}}});Le({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,a=C8(t.gullet.popToken()),l=t.gullet.popToken(),o=t.gullet.popToken();return T8(t,a,o,n==="\\\\globalfuture"),t.gullet.pushToken(o),t.gullet.pushToken(l),{type:"internal",mode:t.mode}}});var nu=function(t,n,a){var l=yn.math[t]&&yn.math[t].replace,o=ig(l||t,n,a);if(!o)throw new Error("Unsupported symbol "+t+" and font size "+n+".");return o},fg=function(t,n,a,l){var o=a.havingBaseStyle(n),c=ue.makeSpan(l.concat(o.sizingClasses(a)),[t],a),d=o.sizeMultiplier/a.sizeMultiplier;return c.height*=d,c.depth*=d,c.maxFontSize=o.sizeMultiplier,c},_8=function(t,n,a){var l=n.havingBaseStyle(a),o=(1-n.sizeMultiplier/l.sizeMultiplier)*n.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=Re(o),t.height-=o,t.depth+=o},Sq=function(t,n,a,l,o,c){var d=ue.makeSymbol(t,"Main-Regular",o,l),m=fg(d,n,l,c);return a&&_8(m,l,n),m},kq=function(t,n,a,l){return ue.makeSymbol(t,"Size"+n+"-Regular",a,l)},M8=function(t,n,a,l,o,c){var d=kq(t,n,o,l),m=fg(ue.makeSpan(["delimsizing","size"+n],[d],l),tt.TEXT,l,c);return a&&_8(m,l,tt.TEXT),m},Jp=function(t,n,a){var l;n==="Size1-Regular"?l="delim-size1":l="delim-size4";var o=ue.makeSpan(["delimsizinginner",l],[ue.makeSpan([],[ue.makeSymbol(t,n,a)])]);return{type:"elem",elem:o}},ex=function(t,n,a){var l=es["Size4-Regular"][t.charCodeAt(0)]?es["Size4-Regular"][t.charCodeAt(0)][4]:es["Size1-Regular"][t.charCodeAt(0)][4],o=new Ml("inner",EI(t,Math.round(1e3*n))),c=new Fs([o],{width:Re(l),height:Re(n),style:"width:"+Re(l),viewBox:"0 0 "+1e3*l+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),d=ue.makeSvgSpan([],[c],a);return d.height=n,d.style.height=Re(n),d.style.width=Re(l),{type:"elem",elem:d}},Kx=.008,z0={type:"kern",size:-1*Kx},Cq=["|","\\lvert","\\rvert","\\vert"],Tq=["\\|","\\lVert","\\rVert","\\Vert"],E8=function(t,n,a,l,o,c){var d,m,f,p,x="",y=0;d=f=p=t,m=null;var b="Size1-Regular";t==="\\uparrow"?f=p="⏐":t==="\\Uparrow"?f=p="‖":t==="\\downarrow"?d=f="⏐":t==="\\Downarrow"?d=f="‖":t==="\\updownarrow"?(d="\\uparrow",f="⏐",p="\\downarrow"):t==="\\Updownarrow"?(d="\\Uparrow",f="‖",p="\\Downarrow"):Cq.includes(t)?(f="∣",x="vert",y=333):Tq.includes(t)?(f="∥",x="doublevert",y=556):t==="["||t==="\\lbrack"?(d="⎡",f="⎢",p="⎣",b="Size4-Regular",x="lbrack",y=667):t==="]"||t==="\\rbrack"?(d="⎤",f="⎥",p="⎦",b="Size4-Regular",x="rbrack",y=667):t==="\\lfloor"||t==="⌊"?(f=d="⎢",p="⎣",b="Size4-Regular",x="lfloor",y=667):t==="\\lceil"||t==="⌈"?(d="⎡",f=p="⎢",b="Size4-Regular",x="lceil",y=667):t==="\\rfloor"||t==="⌋"?(f=d="⎥",p="⎦",b="Size4-Regular",x="rfloor",y=667):t==="\\rceil"||t==="⌉"?(d="⎤",f=p="⎥",b="Size4-Regular",x="rceil",y=667):t==="("||t==="\\lparen"?(d="⎛",f="⎜",p="⎝",b="Size4-Regular",x="lparen",y=875):t===")"||t==="\\rparen"?(d="⎞",f="⎟",p="⎠",b="Size4-Regular",x="rparen",y=875):t==="\\{"||t==="\\lbrace"?(d="⎧",m="⎨",p="⎩",f="⎪",b="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(d="⎫",m="⎬",p="⎭",f="⎪",b="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(d="⎧",p="⎩",f="⎪",b="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(d="⎫",p="⎭",f="⎪",b="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(d="⎧",p="⎭",f="⎪",b="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(d="⎫",p="⎩",f="⎪",b="Size4-Regular");var j=nu(d,b,o),k=j.height+j.depth,S=nu(f,b,o),_=S.height+S.depth,M=nu(p,b,o),D=M.height+M.depth,z=0,L=1;if(m!==null){var E=nu(m,b,o);z=E.height+E.depth,L=2}var R=k+D+z,H=Math.max(0,Math.ceil((n-R)/(L*_))),$=R+H*L*_,I=l.fontMetrics().axisHeight;a&&(I*=l.sizeMultiplier);var G=$/2-I,te=[];if(x.length>0){var we=$-k-D,J=Math.round($*1e3),ae=AI(x,Math.round(we*1e3)),U=new Ml(x,ae),q=(y/1e3).toFixed(3)+"em",W=(J/1e3).toFixed(3)+"em",oe=new Fs([U],{width:q,height:W,viewBox:"0 0 "+y+" "+J}),P=ue.makeSvgSpan([],[oe],l);P.height=J/1e3,P.style.width=q,P.style.height=W,te.push({type:"elem",elem:P})}else{if(te.push(Jp(p,b,o)),te.push(z0),m===null){var je=$-k-D+2*Kx;te.push(ex(f,je,l))}else{var Z=($-k-D-z)/2+2*Kx;te.push(ex(f,Z,l)),te.push(z0),te.push(Jp(m,b,o)),te.push(z0),te.push(ex(f,Z,l))}te.push(z0),te.push(Jp(d,b,o))}var O=l.havingBaseStyle(tt.TEXT),Ne=ue.makeVList({positionType:"bottom",positionData:G,children:te},O);return fg(ue.makeSpan(["delimsizing","mult"],[Ne],O),tt.TEXT,l,c)},tx=80,nx=.08,rx=function(t,n,a,l,o){var c=MI(t,l,a),d=new Ml(t,c),m=new Fs([d],{width:"400em",height:Re(n),viewBox:"0 0 400000 "+a,preserveAspectRatio:"xMinYMin slice"});return ue.makeSvgSpan(["hide-tail"],[m],o)},_q=function(t,n){var a=n.havingBaseSizing(),l=O8("\\surd",t*a.sizeMultiplier,z8,a),o=a.sizeMultiplier,c=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),d,m=0,f=0,p=0,x;return l.type==="small"?(p=1e3+1e3*c+tx,t<1?o=1:t<1.4&&(o=.7),m=(1+c+nx)/o,f=(1+c)/o,d=rx("sqrtMain",m,p,c,n),d.style.minWidth="0.853em",x=.833/o):l.type==="large"?(p=(1e3+tx)*du[l.size],f=(du[l.size]+c)/o,m=(du[l.size]+c+nx)/o,d=rx("sqrtSize"+l.size,m,p,c,n),d.style.minWidth="1.02em",x=1/o):(m=t+c+nx,f=t+c,p=Math.floor(1e3*t+c)+tx,d=rx("sqrtTall",m,p,c,n),d.style.minWidth="0.742em",x=1.056),d.height=f,d.style.height=Re(m),{span:d,advanceWidth:x,ruleWidth:(n.fontMetrics().sqrtRuleThickness+c)*o}},A8=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Mq=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],D8=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],du=[0,1.2,1.8,2.4,3],Eq=function(t,n,a,l,o){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),A8.includes(t)||D8.includes(t))return M8(t,n,!1,a,l,o);if(Mq.includes(t))return E8(t,du[n],!1,a,l,o);throw new Ae("Illegal delimiter: '"+t+"'")},Aq=[{type:"small",style:tt.SCRIPTSCRIPT},{type:"small",style:tt.SCRIPT},{type:"small",style:tt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Dq=[{type:"small",style:tt.SCRIPTSCRIPT},{type:"small",style:tt.SCRIPT},{type:"small",style:tt.TEXT},{type:"stack"}],z8=[{type:"small",style:tt.SCRIPTSCRIPT},{type:"small",style:tt.SCRIPT},{type:"small",style:tt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],zq=function(t){if(t.type==="small")return"Main-Regular";if(t.type==="large")return"Size"+t.size+"-Regular";if(t.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+t.type+"' here.")},O8=function(t,n,a,l){for(var o=Math.min(2,3-l.style.size),c=o;cn)return a[c]}return a[a.length-1]},R8=function(t,n,a,l,o,c){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var d;D8.includes(t)?d=Aq:A8.includes(t)?d=z8:d=Dq;var m=O8(t,n,d,l);return m.type==="small"?Sq(t,m.style,a,l,o,c):m.type==="large"?M8(t,m.size,a,l,o,c):E8(t,n,a,l,o,c)},Oq=function(t,n,a,l,o,c){var d=l.fontMetrics().axisHeight*l.sizeMultiplier,m=901,f=5/l.fontMetrics().ptPerEm,p=Math.max(n-d,a+d),x=Math.max(p/500*m,2*p-f);return R8(t,x,!0,l,o,c)},Bs={sqrtImage:_q,sizedDelim:Eq,sizeToMaxHeight:du,customSizedDelim:R8,leftRightDelim:Oq},R3={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Rq=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function Ym(e,t){var n=Vm(e);if(n&&Rq.includes(n.text))return n;throw n?new Ae("Invalid delimiter '"+n.text+"' after '"+t.funcName+"'",e):new Ae("Invalid delimiter type '"+e.type+"'",e)}Le({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{var n=Ym(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:R3[e.funcName].size,mclass:R3[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim==="."?ue.makeSpan([e.mclass]):Bs.sizedDelim(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(Ea(e.delim,e.mode));var n=new Ee.MathNode("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var a=Re(Bs.sizeToMaxHeight[e.size]);return n.setAttribute("minsize",a),n.setAttribute("maxsize",a),n}});function B3(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Le({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=e.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new Ae("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:Ym(t[0],e).text,color:n}}});Le({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Ym(t[0],e),a=e.parser;++a.leftrightDepth;var l=a.parseExpression(!1);--a.leftrightDepth,a.expect("\\right",!1);var o=vt(a.parseFunction(),"leftright-right");return{type:"leftright",mode:a.mode,body:l,left:n.text,right:o.delim,rightColor:o.color}},htmlBuilder:(e,t)=>{B3(e);for(var n=Kn(e.body,t,!0,["mopen","mclose"]),a=0,l=0,o=!1,c=0;c{B3(e);var n=Qr(e.body,t);if(e.left!=="."){var a=new Ee.MathNode("mo",[Ea(e.left,e.mode)]);a.setAttribute("fence","true"),n.unshift(a)}if(e.right!=="."){var l=new Ee.MathNode("mo",[Ea(e.right,e.mode)]);l.setAttribute("fence","true"),e.rightColor&&l.setAttribute("mathcolor",e.rightColor),n.push(l)}return ug(n)}});Le({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Ym(t[0],e);if(!e.parser.leftrightDepth)throw new Ae("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;if(e.delim===".")n=wu(t,[]);else{n=Bs.sizedDelim(e.delim,1,t,e.mode,[]);var a={delim:e.delim,options:t};n.isMiddle=a}return n},mathmlBuilder:(e,t)=>{var n=e.delim==="\\vert"||e.delim==="|"?Ea("|","text"):Ea(e.delim,e.mode),a=new Ee.MathNode("mo",[n]);return a.setAttribute("fence","true"),a.setAttribute("lspace","0.05em"),a.setAttribute("rspace","0.05em"),a}});var pg=(e,t)=>{var n=ue.wrapFragment(Pt(e.body,t),t),a=e.label.slice(1),l=t.sizeMultiplier,o,c=0,d=Ht.isCharacterBox(e.body);if(a==="sout")o=ue.makeSpan(["stretchy","sout"]),o.height=t.fontMetrics().defaultRuleThickness/l,c=-.5*t.fontMetrics().xHeight;else if(a==="phase"){var m=_n({number:.6,unit:"pt"},t),f=_n({number:.35,unit:"ex"},t),p=t.havingBaseSizing();l=l/p.sizeMultiplier;var x=n.height+n.depth+m+f;n.style.paddingLeft=Re(x/2+m);var y=Math.floor(1e3*x*l),b=TI(y),j=new Fs([new Ml("phase",b)],{width:"400em",height:Re(y/1e3),viewBox:"0 0 400000 "+y,preserveAspectRatio:"xMinYMin slice"});o=ue.makeSvgSpan(["hide-tail"],[j],t),o.style.height=Re(x),c=n.depth+m+f}else{/cancel/.test(a)?d||n.classes.push("cancel-pad"):a==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var k=0,S=0,_=0;/box/.test(a)?(_=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),k=t.fontMetrics().fboxsep+(a==="colorbox"?0:_),S=k):a==="angl"?(_=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),k=4*_,S=Math.max(0,.25-n.depth)):(k=d?.2:0,S=k),o=qs.encloseSpan(n,a,k,S,t),/fbox|boxed|fcolorbox/.test(a)?(o.style.borderStyle="solid",o.style.borderWidth=Re(_)):a==="angl"&&_!==.049&&(o.style.borderTopWidth=Re(_),o.style.borderRightWidth=Re(_)),c=n.depth+S,e.backgroundColor&&(o.style.backgroundColor=e.backgroundColor,e.borderColor&&(o.style.borderColor=e.borderColor))}var M;if(e.backgroundColor)M=ue.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:c},{type:"elem",elem:n,shift:0}]},t);else{var D=/cancel|phase/.test(a)?["svg-align"]:[];M=ue.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:o,shift:c,wrapperClasses:D}]},t)}return/cancel/.test(a)&&(M.height=n.height,M.depth=n.depth),/cancel/.test(a)&&!d?ue.makeSpan(["mord","cancel-lap"],[M],t):ue.makeSpan(["mord"],[M],t)},xg=(e,t)=>{var n=0,a=new Ee.MathNode(e.label.indexOf("colorbox")>-1?"mpadded":"menclose",[fn(e.body,t)]);switch(e.label){case"\\cancel":a.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":a.setAttribute("notation","downdiagonalstrike");break;case"\\phase":a.setAttribute("notation","phasorangle");break;case"\\sout":a.setAttribute("notation","horizontalstrike");break;case"\\fbox":a.setAttribute("notation","box");break;case"\\angl":a.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,a.setAttribute("width","+"+2*n+"pt"),a.setAttribute("height","+"+2*n+"pt"),a.setAttribute("lspace",n+"pt"),a.setAttribute("voffset",n+"pt"),e.label==="\\fcolorbox"){var l=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);a.setAttribute("style","border: "+l+"em solid "+String(e.borderColor))}break;case"\\xcancel":a.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&a.setAttribute("mathbackground",e.backgroundColor),a};Le({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(e,t,n){var{parser:a,funcName:l}=e,o=vt(t[0],"color-token").color,c=t[1];return{type:"enclose",mode:a.mode,label:l,backgroundColor:o,body:c}},htmlBuilder:pg,mathmlBuilder:xg});Le({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(e,t,n){var{parser:a,funcName:l}=e,o=vt(t[0],"color-token").color,c=vt(t[1],"color-token").color,d=t[2];return{type:"enclose",mode:a.mode,label:l,backgroundColor:c,borderColor:o,body:d}},htmlBuilder:pg,mathmlBuilder:xg});Le({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\fbox",body:t[0]}}});Le({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:a}=e,l=t[0];return{type:"enclose",mode:n.mode,label:a,body:l}},htmlBuilder:pg,mathmlBuilder:xg});Le({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\angl",body:t[0]}}});var B8={};function ls(e){for(var{type:t,names:n,props:a,handler:l,htmlBuilder:o,mathmlBuilder:c}=e,d={type:t,numArgs:a.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:l},m=0;m{var t=e.parser.settings;if(!t.displayMode)throw new Ae("{"+e.envName+"} can be used only in display mode.")};function gg(e){if(e.indexOf("ed")===-1)return e.indexOf("*")===-1}function Bl(e,t,n){var{hskipBeforeAndAfter:a,addJot:l,cols:o,arraystretch:c,colSeparationType:d,autoTag:m,singleRow:f,emptySingleRow:p,maxNumCols:x,leqno:y}=t;if(e.gullet.beginGroup(),f||e.gullet.macros.set("\\cr","\\\\\\relax"),!c){var b=e.gullet.expandMacroAsText("\\arraystretch");if(b==null)c=1;else if(c=parseFloat(b),!c||c<0)throw new Ae("Invalid \\arraystretch: "+b)}e.gullet.beginGroup();var j=[],k=[j],S=[],_=[],M=m!=null?[]:void 0;function D(){m&&e.gullet.macros.set("\\@eqnsw","1",!0)}function z(){M&&(e.gullet.macros.get("\\df@tag")?(M.push(e.subparse([new da("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):M.push(!!m&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(D(),_.push(L3(e));;){var L=e.parseExpression(!1,f?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup(),L={type:"ordgroup",mode:e.mode,body:L},n&&(L={type:"styling",mode:e.mode,style:n,body:[L]}),j.push(L);var E=e.fetch().text;if(E==="&"){if(x&&j.length===x){if(f||d)throw new Ae("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(E==="\\end"){z(),j.length===1&&L.type==="styling"&&L.body[0].body.length===0&&(k.length>1||!p)&&k.pop(),_.length0&&(D+=.25),f.push({pos:D,isDashed:Qe[Gn]})}for(z(c[0]),a=0;a0&&(G+=M,RQe))for(a=0;a=d)){var ye=void 0;(l>0||t.hskipBeforeAndAfter)&&(ye=Ht.deflt(Z.pregap,y),ye!==0&&(ae=ue.makeSpan(["arraycolsep"],[]),ae.style.width=Re(ye),J.push(ae)));var Be=[];for(a=0;a0){for(var ve=ue.makeLineSpan("hline",n,p),Ze=ue.makeLineSpan("hdashline",n,p),We=[{type:"elem",elem:m,shift:0}];f.length>0;){var pn=f.pop(),Bn=pn.pos-te;pn.isDashed?We.push({type:"elem",elem:Ze,shift:Bn}):We.push({type:"elem",elem:ve,shift:Bn})}m=ue.makeVList({positionType:"individualShift",children:We},n)}if(q.length===0)return ue.makeSpan(["mord"],[m],n);var sr=ue.makeVList({positionType:"individualShift",children:q},n);return sr=ue.makeSpan(["tag"],[sr],n),ue.makeFragment([m,sr])},Bq={c:"center ",l:"left ",r:"right "},os=function(t,n){for(var a=[],l=new Ee.MathNode("mtd",[],["mtr-glue"]),o=new Ee.MathNode("mtd",[],["mml-eqn-num"]),c=0;c0){var j=t.cols,k="",S=!1,_=0,M=j.length;j[0].type==="separator"&&(y+="top ",_=1),j[j.length-1].type==="separator"&&(y+="bottom ",M-=1);for(var D=_;D0?"left ":"",y+=H[H.length-1].length>0?"right ":"";for(var $=1;$-1?"alignat":"align",o=t.envName==="split",c=Bl(t.parser,{cols:a,addJot:!0,autoTag:o?void 0:gg(t.envName),emptySingleRow:!0,colSeparationType:l,maxNumCols:o?2:void 0,leqno:t.parser.settings.leqno},"display"),d,m=0,f={type:"ordgroup",mode:t.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var p="",x=0;x0&&b&&(S=1),a[j]={type:"align",align:k,pregap:S,postgap:0}}return c.colSeparationType=b?"align":"alignat",c};ls({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=Vm(t[0]),a=n?[t[0]]:vt(t[0],"ordgroup").body,l=a.map(function(c){var d=mg(c),m=d.text;if("lcr".indexOf(m)!==-1)return{type:"align",align:m};if(m==="|")return{type:"separator",separator:"|"};if(m===":")return{type:"separator",separator:":"};throw new Ae("Unknown column alignment: "+m,c)}),o={cols:l,hskipBeforeAndAfter:!0,maxNumCols:l.length};return Bl(e.parser,o,vg(e.envName))},htmlBuilder:is,mathmlBuilder:os});ls({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],n="c",a={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(e.envName.charAt(e.envName.length-1)==="*"){var l=e.parser;if(l.consumeSpaces(),l.fetch().text==="["){if(l.consume(),l.consumeSpaces(),n=l.fetch().text,"lcr".indexOf(n)===-1)throw new Ae("Expected l or c or r",l.nextToken);l.consume(),l.consumeSpaces(),l.expect("]"),l.consume(),a.cols=[{type:"align",align:n}]}}var o=Bl(e.parser,a,vg(e.envName)),c=Math.max(0,...o.body.map(d=>d.length));return o.cols=new Array(c).fill({type:"align",align:n}),t?{type:"leftright",mode:e.mode,body:[o],left:t[0],right:t[1],rightColor:void 0}:o},htmlBuilder:is,mathmlBuilder:os});ls({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},n=Bl(e.parser,t,"script");return n.colSeparationType="small",n},htmlBuilder:is,mathmlBuilder:os});ls({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=Vm(t[0]),a=n?[t[0]]:vt(t[0],"ordgroup").body,l=a.map(function(c){var d=mg(c),m=d.text;if("lc".indexOf(m)!==-1)return{type:"align",align:m};throw new Ae("Unknown column alignment: "+m,c)});if(l.length>1)throw new Ae("{subarray} can contain only one column");var o={cols:l,hskipBeforeAndAfter:!1,arraystretch:.5};if(o=Bl(e.parser,o,"script"),o.body.length>0&&o.body[0].length>1)throw new Ae("{subarray} can contain only one column");return o},htmlBuilder:is,mathmlBuilder:os});ls({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=Bl(e.parser,t,vg(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:is,mathmlBuilder:os});ls({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:P8,htmlBuilder:is,mathmlBuilder:os});ls({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){["gather","gather*"].includes(e.envName)&&Wm(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:gg(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Bl(e.parser,t,"display")},htmlBuilder:is,mathmlBuilder:os});ls({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:P8,htmlBuilder:is,mathmlBuilder:os});ls({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){Wm(e);var t={autoTag:gg(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Bl(e.parser,t,"display")},htmlBuilder:is,mathmlBuilder:os});ls({type:"array",names:["CD"],props:{numArgs:0},handler(e){return Wm(e),jq(e.parser)},htmlBuilder:is,mathmlBuilder:os});F("\\nonumber","\\gdef\\@eqnsw{0}");F("\\notag","\\nonumber");Le({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new Ae(e.funcName+" valid only within array environment")}});var P3=B8;Le({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:n,funcName:a}=e,l=t[0];if(l.type!=="ordgroup")throw new Ae("Invalid environment name",l);for(var o="",c=0;c{var n=e.font,a=t.withFont(n);return Pt(e.body,a)},I8=(e,t)=>{var n=e.font,a=t.withFont(n);return fn(e.body,a)},F3={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Le({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=pm(t[0]),o=a;return o in F3&&(o=F3[o]),{type:"font",mode:n.mode,font:o.slice(1),body:l}},htmlBuilder:F8,mathmlBuilder:I8});Le({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:n}=e,a=t[0],l=Ht.isCharacterBox(a);return{type:"mclass",mode:n.mode,mclass:Gm(a),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:a}],isCharacterBox:l}}});Le({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:a,breakOnTokenText:l}=e,{mode:o}=n,c=n.parseExpression(!0,l),d="math"+a.slice(1);return{type:"font",mode:o,font:d,body:{type:"ordgroup",mode:n.mode,body:c}}},htmlBuilder:F8,mathmlBuilder:I8});var q8=(e,t)=>{var n=t;return e==="display"?n=n.id>=tt.SCRIPT.id?n.text():tt.DISPLAY:e==="text"&&n.size===tt.DISPLAY.size?n=tt.TEXT:e==="script"?n=tt.SCRIPT:e==="scriptscript"&&(n=tt.SCRIPTSCRIPT),n},yg=(e,t)=>{var n=q8(e.size,t.style),a=n.fracNum(),l=n.fracDen(),o;o=t.havingStyle(a);var c=Pt(e.numer,o,t);if(e.continued){var d=8.5/t.fontMetrics().ptPerEm,m=3.5/t.fontMetrics().ptPerEm;c.height=c.height0?j=3*y:j=7*y,k=t.fontMetrics().denom1):(x>0?(b=t.fontMetrics().num2,j=y):(b=t.fontMetrics().num3,j=3*y),k=t.fontMetrics().denom2);var S;if(p){var M=t.fontMetrics().axisHeight;b-c.depth-(M+.5*x){var n=new Ee.MathNode("mfrac",[fn(e.numer,t),fn(e.denom,t)]);if(!e.hasBarLine)n.setAttribute("linethickness","0px");else if(e.barSize){var a=_n(e.barSize,t);n.setAttribute("linethickness",Re(a))}var l=q8(e.size,t.style);if(l.size!==t.style.size){n=new Ee.MathNode("mstyle",[n]);var o=l.size===tt.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",o),n.setAttribute("scriptlevel","0")}if(e.leftDelim!=null||e.rightDelim!=null){var c=[];if(e.leftDelim!=null){var d=new Ee.MathNode("mo",[new Ee.TextNode(e.leftDelim.replace("\\",""))]);d.setAttribute("fence","true"),c.push(d)}if(c.push(n),e.rightDelim!=null){var m=new Ee.MathNode("mo",[new Ee.TextNode(e.rightDelim.replace("\\",""))]);m.setAttribute("fence","true"),c.push(m)}return ug(c)}return n};Le({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=t[0],o=t[1],c,d=null,m=null,f="auto";switch(a){case"\\dfrac":case"\\frac":case"\\tfrac":c=!0;break;case"\\\\atopfrac":c=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":c=!1,d="(",m=")";break;case"\\\\bracefrac":c=!1,d="\\{",m="\\}";break;case"\\\\brackfrac":c=!1,d="[",m="]";break;default:throw new Error("Unrecognized genfrac command")}switch(a){case"\\dfrac":case"\\dbinom":f="display";break;case"\\tfrac":case"\\tbinom":f="text";break}return{type:"genfrac",mode:n.mode,continued:!1,numer:l,denom:o,hasBarLine:c,leftDelim:d,rightDelim:m,size:f,barSize:null}},htmlBuilder:yg,mathmlBuilder:bg});Le({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=t[0],o=t[1];return{type:"genfrac",mode:n.mode,continued:!0,numer:l,denom:o,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});Le({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:n,token:a}=e,l;switch(n){case"\\over":l="\\frac";break;case"\\choose":l="\\binom";break;case"\\atop":l="\\\\atopfrac";break;case"\\brace":l="\\\\bracefrac";break;case"\\brack":l="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:l,token:a}}});var I3=["display","text","script","scriptscript"],q3=function(t){var n=null;return t.length>0&&(n=t,n=n==="."?null:n),n};Le({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:n}=e,a=t[4],l=t[5],o=pm(t[0]),c=o.type==="atom"&&o.family==="open"?q3(o.text):null,d=pm(t[1]),m=d.type==="atom"&&d.family==="close"?q3(d.text):null,f=vt(t[2],"size"),p,x=null;f.isBlank?p=!0:(x=f.value,p=x.number>0);var y="auto",b=t[3];if(b.type==="ordgroup"){if(b.body.length>0){var j=vt(b.body[0],"textord");y=I3[Number(j.text)]}}else b=vt(b,"textord"),y=I3[Number(b.text)];return{type:"genfrac",mode:n.mode,numer:a,denom:l,continued:!1,hasBarLine:p,barSize:x,leftDelim:c,rightDelim:m,size:y}},htmlBuilder:yg,mathmlBuilder:bg});Le({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:n,funcName:a,token:l}=e;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:vt(t[0],"size").value,token:l}}});Le({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=t[0],o=mI(vt(t[1],"infix").size),c=t[2],d=o.number>0;return{type:"genfrac",mode:n.mode,numer:l,denom:c,continued:!1,hasBarLine:d,barSize:o,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:yg,mathmlBuilder:bg});var H8=(e,t)=>{var n=t.style,a,l;e.type==="supsub"?(a=e.sup?Pt(e.sup,t.havingStyle(n.sup()),t):Pt(e.sub,t.havingStyle(n.sub()),t),l=vt(e.base,"horizBrace")):l=vt(e,"horizBrace");var o=Pt(l.base,t.havingBaseStyle(tt.DISPLAY)),c=qs.svgSpan(l,t),d;if(l.isOver?(d=ue.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"kern",size:.1},{type:"elem",elem:c}]},t),d.children[0].children[0].children[1].classes.push("svg-align")):(d=ue.makeVList({positionType:"bottom",positionData:o.depth+.1+c.height,children:[{type:"elem",elem:c},{type:"kern",size:.1},{type:"elem",elem:o}]},t),d.children[0].children[0].children[0].classes.push("svg-align")),a){var m=ue.makeSpan(["mord",l.isOver?"mover":"munder"],[d],t);l.isOver?d=ue.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:m},{type:"kern",size:.2},{type:"elem",elem:a}]},t):d=ue.makeVList({positionType:"bottom",positionData:m.depth+.2+a.height+a.depth,children:[{type:"elem",elem:a},{type:"kern",size:.2},{type:"elem",elem:m}]},t)}return ue.makeSpan(["mord",l.isOver?"mover":"munder"],[d],t)},Lq=(e,t)=>{var n=qs.mathMLnode(e.label);return new Ee.MathNode(e.isOver?"mover":"munder",[fn(e.base,t),n])};Le({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:a}=e;return{type:"horizBrace",mode:n.mode,label:a,isOver:/^\\over/.test(a),base:t[0]}},htmlBuilder:H8,mathmlBuilder:Lq});Le({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,a=t[1],l=vt(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:l})?{type:"href",mode:n.mode,href:l,body:Rn(a)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=Kn(e.body,t,!1);return ue.makeAnchor(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=El(e.body,t);return n instanceof ca||(n=new ca("mrow",[n])),n.setAttribute("href",e.href),n}});Le({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,a=vt(t[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:a}))return n.formatUnsupportedCmd("\\url");for(var l=[],o=0;o{var{parser:n,funcName:a,token:l}=e,o=vt(t[0],"raw").string,c=t[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var d,m={};switch(a){case"\\htmlClass":m.class=o,d={command:"\\htmlClass",class:o};break;case"\\htmlId":m.id=o,d={command:"\\htmlId",id:o};break;case"\\htmlStyle":m.style=o,d={command:"\\htmlStyle",style:o};break;case"\\htmlData":{for(var f=o.split(","),p=0;p{var n=Kn(e.body,t,!1),a=["enclosing"];e.attributes.class&&a.push(...e.attributes.class.trim().split(/\s+/));var l=ue.makeSpan(a,n,t);for(var o in e.attributes)o!=="class"&&e.attributes.hasOwnProperty(o)&&l.setAttribute(o,e.attributes[o]);return l},mathmlBuilder:(e,t)=>El(e.body,t)});Le({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"htmlmathml",mode:n.mode,html:Rn(t[0]),mathml:Rn(t[1])}},htmlBuilder:(e,t)=>{var n=Kn(e.html,t,!1);return ue.makeFragment(n)},mathmlBuilder:(e,t)=>El(e.mathml,t)});var ax=function(t){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(t))return{number:+t,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t);if(!n)throw new Ae("Invalid size: '"+t+"' in \\includegraphics");var a={number:+(n[1]+n[2]),unit:n[3]};if(!i8(a))throw new Ae("Invalid unit: '"+a.unit+"' in \\includegraphics.");return a};Le({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,n)=>{var{parser:a}=e,l={number:0,unit:"em"},o={number:.9,unit:"em"},c={number:0,unit:"em"},d="";if(n[0])for(var m=vt(n[0],"raw").string,f=m.split(","),p=0;p{var n=_n(e.height,t),a=0;e.totalheight.number>0&&(a=_n(e.totalheight,t)-n);var l=0;e.width.number>0&&(l=_n(e.width,t));var o={height:Re(n+a)};l>0&&(o.width=Re(l)),a>0&&(o.verticalAlign=Re(-a));var c=new LI(e.src,e.alt,o);return c.height=n,c.depth=a,c},mathmlBuilder:(e,t)=>{var n=new Ee.MathNode("mglyph",[]);n.setAttribute("alt",e.alt);var a=_n(e.height,t),l=0;if(e.totalheight.number>0&&(l=_n(e.totalheight,t)-a,n.setAttribute("valign",Re(-l))),n.setAttribute("height",Re(a+l)),e.width.number>0){var o=_n(e.width,t);n.setAttribute("width",Re(o))}return n.setAttribute("src",e.src),n}});Le({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:a}=e,l=vt(t[0],"size");if(n.settings.strict){var o=a[1]==="m",c=l.value.unit==="mu";o?(c||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" supports only mu units, "+("not "+l.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" works only in math mode")):c&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:l.value}},htmlBuilder(e,t){return ue.makeGlue(e.dimension,t)},mathmlBuilder(e,t){var n=_n(e.dimension,t);return new Ee.SpaceNode(n)}});Le({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=t[0];return{type:"lap",mode:n.mode,alignment:a.slice(5),body:l}},htmlBuilder:(e,t)=>{var n;e.alignment==="clap"?(n=ue.makeSpan([],[Pt(e.body,t)]),n=ue.makeSpan(["inner"],[n],t)):n=ue.makeSpan(["inner"],[Pt(e.body,t)]);var a=ue.makeSpan(["fix"],[]),l=ue.makeSpan([e.alignment],[n,a],t),o=ue.makeSpan(["strut"]);return o.style.height=Re(l.height+l.depth),l.depth&&(o.style.verticalAlign=Re(-l.depth)),l.children.unshift(o),l=ue.makeSpan(["thinbox"],[l],t),ue.makeSpan(["mord","vbox"],[l],t)},mathmlBuilder:(e,t)=>{var n=new Ee.MathNode("mpadded",[fn(e.body,t)]);if(e.alignment!=="rlap"){var a=e.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",a+"width")}return n.setAttribute("width","0px"),n}});Le({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:n,parser:a}=e,l=a.mode;a.switchMode("math");var o=n==="\\("?"\\)":"$",c=a.parseExpression(!1,o);return a.expect(o),a.switchMode(l),{type:"styling",mode:a.mode,style:"text",body:c}}});Le({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new Ae("Mismatched "+e.funcName)}});var H3=(e,t)=>{switch(t.style.size){case tt.DISPLAY.size:return e.display;case tt.TEXT.size:return e.text;case tt.SCRIPT.size:return e.script;case tt.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};Le({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:Rn(t[0]),text:Rn(t[1]),script:Rn(t[2]),scriptscript:Rn(t[3])}},htmlBuilder:(e,t)=>{var n=H3(e,t),a=Kn(n,t,!1);return ue.makeFragment(a)},mathmlBuilder:(e,t)=>{var n=H3(e,t);return El(n,t)}});var U8=(e,t,n,a,l,o,c)=>{e=ue.makeSpan([],[e]);var d=n&&Ht.isCharacterBox(n),m,f;if(t){var p=Pt(t,a.havingStyle(l.sup()),a);f={elem:p,kern:Math.max(a.fontMetrics().bigOpSpacing1,a.fontMetrics().bigOpSpacing3-p.depth)}}if(n){var x=Pt(n,a.havingStyle(l.sub()),a);m={elem:x,kern:Math.max(a.fontMetrics().bigOpSpacing2,a.fontMetrics().bigOpSpacing4-x.height)}}var y;if(f&&m){var b=a.fontMetrics().bigOpSpacing5+m.elem.height+m.elem.depth+m.kern+e.depth+c;y=ue.makeVList({positionType:"bottom",positionData:b,children:[{type:"kern",size:a.fontMetrics().bigOpSpacing5},{type:"elem",elem:m.elem,marginLeft:Re(-o)},{type:"kern",size:m.kern},{type:"elem",elem:e},{type:"kern",size:f.kern},{type:"elem",elem:f.elem,marginLeft:Re(o)},{type:"kern",size:a.fontMetrics().bigOpSpacing5}]},a)}else if(m){var j=e.height-c;y=ue.makeVList({positionType:"top",positionData:j,children:[{type:"kern",size:a.fontMetrics().bigOpSpacing5},{type:"elem",elem:m.elem,marginLeft:Re(-o)},{type:"kern",size:m.kern},{type:"elem",elem:e}]},a)}else if(f){var k=e.depth+c;y=ue.makeVList({positionType:"bottom",positionData:k,children:[{type:"elem",elem:e},{type:"kern",size:f.kern},{type:"elem",elem:f.elem,marginLeft:Re(o)},{type:"kern",size:a.fontMetrics().bigOpSpacing5}]},a)}else return e;var S=[y];if(m&&o!==0&&!d){var _=ue.makeSpan(["mspace"],[],a);_.style.marginRight=Re(o),S.unshift(_)}return ue.makeSpan(["mop","op-limits"],S,a)},$8=["\\smallint"],ec=(e,t)=>{var n,a,l=!1,o;e.type==="supsub"?(n=e.sup,a=e.sub,o=vt(e.base,"op"),l=!0):o=vt(e,"op");var c=t.style,d=!1;c.size===tt.DISPLAY.size&&o.symbol&&!$8.includes(o.name)&&(d=!0);var m;if(o.symbol){var f=d?"Size2-Regular":"Size1-Regular",p="";if((o.name==="\\oiint"||o.name==="\\oiiint")&&(p=o.name.slice(1),o.name=p==="oiint"?"\\iint":"\\iiint"),m=ue.makeSymbol(o.name,f,"math",t,["mop","op-symbol",d?"large-op":"small-op"]),p.length>0){var x=m.italic,y=ue.staticSvg(p+"Size"+(d?"2":"1"),t);m=ue.makeVList({positionType:"individualShift",children:[{type:"elem",elem:m,shift:0},{type:"elem",elem:y,shift:d?.08:0}]},t),o.name="\\"+p,m.classes.unshift("mop"),m.italic=x}}else if(o.body){var b=Kn(o.body,t,!0);b.length===1&&b[0]instanceof Ma?(m=b[0],m.classes[0]="mop"):m=ue.makeSpan(["mop"],b,t)}else{for(var j=[],k=1;k{var n;if(e.symbol)n=new ca("mo",[Ea(e.name,e.mode)]),$8.includes(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new ca("mo",Qr(e.body,t));else{n=new ca("mi",[new ts(e.name.slice(1))]);var a=new ca("mo",[Ea("⁡","text")]);e.parentIsSupSub?n=new ca("mrow",[n,a]):n=v8([n,a])}return n},Pq={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Le({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=a;return l.length===1&&(l=Pq[l]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:l}},htmlBuilder:ec,mathmlBuilder:Wu});Le({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:n}=e,a=t[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Rn(a)}},htmlBuilder:ec,mathmlBuilder:Wu});var Fq={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Le({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:ec,mathmlBuilder:Wu});Le({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:ec,mathmlBuilder:Wu});Le({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e,a=n;return a.length===1&&(a=Fq[a]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:a}},htmlBuilder:ec,mathmlBuilder:Wu});var V8=(e,t)=>{var n,a,l=!1,o;e.type==="supsub"?(n=e.sup,a=e.sub,o=vt(e.base,"operatorname"),l=!0):o=vt(e,"operatorname");var c;if(o.body.length>0){for(var d=o.body.map(x=>{var y=x.text;return typeof y=="string"?{type:"textord",mode:x.mode,text:y}:x}),m=Kn(d,t.withFont("mathrm"),!0),f=0;f{for(var n=Qr(e.body,t.withFont("mathrm")),a=!0,l=0;lp.toText()).join("");n=[new Ee.TextNode(d)]}var m=new Ee.MathNode("mi",n);m.setAttribute("mathvariant","normal");var f=new Ee.MathNode("mo",[Ea("⁡","text")]);return e.parentIsSupSub?new Ee.MathNode("mrow",[m,f]):Ee.newDocumentFragment([m,f])};Le({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=t[0];return{type:"operatorname",mode:n.mode,body:Rn(l),alwaysHandleSupSub:a==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:V8,mathmlBuilder:Iq});F("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Si({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?ue.makeFragment(Kn(e.body,t,!1)):ue.makeSpan(["mord"],Kn(e.body,t,!0),t)},mathmlBuilder(e,t){return El(e.body,t,!0)}});Le({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:n}=e,a=t[0];return{type:"overline",mode:n.mode,body:a}},htmlBuilder(e,t){var n=Pt(e.body,t.havingCrampedStyle()),a=ue.makeLineSpan("overline-line",t),l=t.fontMetrics().defaultRuleThickness,o=ue.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*l},{type:"elem",elem:a},{type:"kern",size:l}]},t);return ue.makeSpan(["mord","overline"],[o],t)},mathmlBuilder(e,t){var n=new Ee.MathNode("mo",[new Ee.TextNode("‾")]);n.setAttribute("stretchy","true");var a=new Ee.MathNode("mover",[fn(e.body,t),n]);return a.setAttribute("accent","true"),a}});Le({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,a=t[0];return{type:"phantom",mode:n.mode,body:Rn(a)}},htmlBuilder:(e,t)=>{var n=Kn(e.body,t.withPhantom(),!1);return ue.makeFragment(n)},mathmlBuilder:(e,t)=>{var n=Qr(e.body,t);return new Ee.MathNode("mphantom",n)}});Le({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,a=t[0];return{type:"hphantom",mode:n.mode,body:a}},htmlBuilder:(e,t)=>{var n=ue.makeSpan([],[Pt(e.body,t.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var a=0;a{var n=Qr(Rn(e.body),t),a=new Ee.MathNode("mphantom",n),l=new Ee.MathNode("mpadded",[a]);return l.setAttribute("height","0px"),l.setAttribute("depth","0px"),l}});Le({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,a=t[0];return{type:"vphantom",mode:n.mode,body:a}},htmlBuilder:(e,t)=>{var n=ue.makeSpan(["inner"],[Pt(e.body,t.withPhantom())]),a=ue.makeSpan(["fix"],[]);return ue.makeSpan(["mord","rlap"],[n,a],t)},mathmlBuilder:(e,t)=>{var n=Qr(Rn(e.body),t),a=new Ee.MathNode("mphantom",n),l=new Ee.MathNode("mpadded",[a]);return l.setAttribute("width","0px"),l}});Le({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,a=vt(t[0],"size").value,l=t[1];return{type:"raisebox",mode:n.mode,dy:a,body:l}},htmlBuilder(e,t){var n=Pt(e.body,t),a=_n(e.dy,t);return ue.makeVList({positionType:"shift",positionData:-a,children:[{type:"elem",elem:n}]},t)},mathmlBuilder(e,t){var n=new Ee.MathNode("mpadded",[fn(e.body,t)]),a=e.dy.number+e.dy.unit;return n.setAttribute("voffset",a),n}});Le({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});Le({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,n){var{parser:a}=e,l=n[0],o=vt(t[0],"size"),c=vt(t[1],"size");return{type:"rule",mode:a.mode,shift:l&&vt(l,"size").value,width:o.value,height:c.value}},htmlBuilder(e,t){var n=ue.makeSpan(["mord","rule"],[],t),a=_n(e.width,t),l=_n(e.height,t),o=e.shift?_n(e.shift,t):0;return n.style.borderRightWidth=Re(a),n.style.borderTopWidth=Re(l),n.style.bottom=Re(o),n.width=a,n.height=l+o,n.depth=-o,n.maxFontSize=l*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=_n(e.width,t),a=_n(e.height,t),l=e.shift?_n(e.shift,t):0,o=t.color&&t.getColor()||"black",c=new Ee.MathNode("mspace");c.setAttribute("mathbackground",o),c.setAttribute("width",Re(n)),c.setAttribute("height",Re(a));var d=new Ee.MathNode("mpadded",[c]);return l>=0?d.setAttribute("height",Re(l)):(d.setAttribute("height",Re(l)),d.setAttribute("depth",Re(-l))),d.setAttribute("voffset",Re(l)),d}});function G8(e,t,n){for(var a=Kn(e,t,!1),l=t.sizeMultiplier/n.sizeMultiplier,o=0;o{var n=t.havingSize(e.size);return G8(e.body,n,t)};Le({type:"sizing",names:U3,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:n,funcName:a,parser:l}=e,o=l.parseExpression(!1,n);return{type:"sizing",mode:l.mode,size:U3.indexOf(a)+1,body:o}},htmlBuilder:qq,mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),a=Qr(e.body,n),l=new Ee.MathNode("mstyle",a);return l.setAttribute("mathsize",Re(n.sizeMultiplier)),l}});Le({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:a}=e,l=!1,o=!1,c=n[0]&&vt(n[0],"ordgroup");if(c)for(var d="",m=0;m{var n=ue.makeSpan([],[Pt(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return n;if(e.smashHeight&&(n.height=0,n.children))for(var a=0;a{var n=new Ee.MathNode("mpadded",[fn(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});Le({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:a}=e,l=n[0],o=t[0];return{type:"sqrt",mode:a.mode,body:o,index:l}},htmlBuilder(e,t){var n=Pt(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=ue.wrapFragment(n,t);var a=t.fontMetrics(),l=a.defaultRuleThickness,o=l;t.style.idn.height+n.depth+c&&(c=(c+x-n.height-n.depth)/2);var y=m.height-n.height-c-f;n.style.paddingLeft=Re(p);var b=ue.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+y)},{type:"elem",elem:m},{type:"kern",size:f}]},t);if(e.index){var j=t.havingStyle(tt.SCRIPTSCRIPT),k=Pt(e.index,j,t),S=.6*(b.height-b.depth),_=ue.makeVList({positionType:"shift",positionData:-S,children:[{type:"elem",elem:k}]},t),M=ue.makeSpan(["root"],[_]);return ue.makeSpan(["mord","sqrt"],[M,b],t)}else return ue.makeSpan(["mord","sqrt"],[b],t)},mathmlBuilder(e,t){var{body:n,index:a}=e;return a?new Ee.MathNode("mroot",[fn(n,t),fn(a,t)]):new Ee.MathNode("msqrt",[fn(n,t)])}});var $3={display:tt.DISPLAY,text:tt.TEXT,script:tt.SCRIPT,scriptscript:tt.SCRIPTSCRIPT};Le({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:n,funcName:a,parser:l}=e,o=l.parseExpression(!0,n),c=a.slice(1,a.length-5);return{type:"styling",mode:l.mode,style:c,body:o}},htmlBuilder(e,t){var n=$3[e.style],a=t.havingStyle(n).withFont("");return G8(e.body,a,t)},mathmlBuilder(e,t){var n=$3[e.style],a=t.havingStyle(n),l=Qr(e.body,a),o=new Ee.MathNode("mstyle",l),c={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},d=c[e.style];return o.setAttribute("scriptlevel",d[0]),o.setAttribute("displaystyle",d[1]),o}});var Hq=function(t,n){var a=t.base;if(a)if(a.type==="op"){var l=a.limits&&(n.style.size===tt.DISPLAY.size||a.alwaysHandleSupSub);return l?ec:null}else if(a.type==="operatorname"){var o=a.alwaysHandleSupSub&&(n.style.size===tt.DISPLAY.size||a.limits);return o?V8:null}else{if(a.type==="accent")return Ht.isCharacterBox(a.base)?hg:null;if(a.type==="horizBrace"){var c=!t.sub;return c===a.isOver?H8:null}else return null}else return null};Si({type:"supsub",htmlBuilder(e,t){var n=Hq(e,t);if(n)return n(e,t);var{base:a,sup:l,sub:o}=e,c=Pt(a,t),d,m,f=t.fontMetrics(),p=0,x=0,y=a&&Ht.isCharacterBox(a);if(l){var b=t.havingStyle(t.style.sup());d=Pt(l,b,t),y||(p=c.height-b.fontMetrics().supDrop*b.sizeMultiplier/t.sizeMultiplier)}if(o){var j=t.havingStyle(t.style.sub());m=Pt(o,j,t),y||(x=c.depth+j.fontMetrics().subDrop*j.sizeMultiplier/t.sizeMultiplier)}var k;t.style===tt.DISPLAY?k=f.sup1:t.style.cramped?k=f.sup3:k=f.sup2;var S=t.sizeMultiplier,_=Re(.5/f.ptPerEm/S),M=null;if(m){var D=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");(c instanceof Ma||D)&&(M=Re(-c.italic))}var z;if(d&&m){p=Math.max(p,k,d.depth+.25*f.xHeight),x=Math.max(x,f.sub2);var L=f.defaultRuleThickness,E=4*L;if(p-d.depth-(m.height-x)0&&(p+=R,x-=R)}var H=[{type:"elem",elem:m,shift:x,marginRight:_,marginLeft:M},{type:"elem",elem:d,shift:-p,marginRight:_}];z=ue.makeVList({positionType:"individualShift",children:H},t)}else if(m){x=Math.max(x,f.sub1,m.height-.8*f.xHeight);var $=[{type:"elem",elem:m,marginLeft:M,marginRight:_}];z=ue.makeVList({positionType:"shift",positionData:x,children:$},t)}else if(d)p=Math.max(p,k,d.depth+.25*f.xHeight),z=ue.makeVList({positionType:"shift",positionData:-p,children:[{type:"elem",elem:d,marginRight:_}]},t);else throw new Error("supsub must have either sup or sub.");var I=Yx(c,"right")||"mord";return ue.makeSpan([I],[c,ue.makeSpan(["msupsub"],[z])],t)},mathmlBuilder(e,t){var n=!1,a,l;e.base&&e.base.type==="horizBrace"&&(l=!!e.sup,l===e.base.isOver&&(n=!0,a=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var o=[fn(e.base,t)];e.sub&&o.push(fn(e.sub,t)),e.sup&&o.push(fn(e.sup,t));var c;if(n)c=a?"mover":"munder";else if(e.sub)if(e.sup){var f=e.base;f&&f.type==="op"&&f.limits&&t.style===tt.DISPLAY||f&&f.type==="operatorname"&&f.alwaysHandleSupSub&&(t.style===tt.DISPLAY||f.limits)?c="munderover":c="msubsup"}else{var m=e.base;m&&m.type==="op"&&m.limits&&(t.style===tt.DISPLAY||m.alwaysHandleSupSub)||m&&m.type==="operatorname"&&m.alwaysHandleSupSub&&(m.limits||t.style===tt.DISPLAY)?c="munder":c="msub"}else{var d=e.base;d&&d.type==="op"&&d.limits&&(t.style===tt.DISPLAY||d.alwaysHandleSupSub)||d&&d.type==="operatorname"&&d.alwaysHandleSupSub&&(d.limits||t.style===tt.DISPLAY)?c="mover":c="msup"}return new Ee.MathNode(c,o)}});Si({type:"atom",htmlBuilder(e,t){return ue.mathsym(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var n=new Ee.MathNode("mo",[Ea(e.text,e.mode)]);if(e.family==="bin"){var a=dg(e,t);a==="bold-italic"&&n.setAttribute("mathvariant",a)}else e.family==="punct"?n.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&n.setAttribute("stretchy","false");return n}});var Y8={mi:"italic",mn:"normal",mtext:"normal"};Si({type:"mathord",htmlBuilder(e,t){return ue.makeOrd(e,t,"mathord")},mathmlBuilder(e,t){var n=new Ee.MathNode("mi",[Ea(e.text,e.mode,t)]),a=dg(e,t)||"italic";return a!==Y8[n.type]&&n.setAttribute("mathvariant",a),n}});Si({type:"textord",htmlBuilder(e,t){return ue.makeOrd(e,t,"textord")},mathmlBuilder(e,t){var n=Ea(e.text,e.mode,t),a=dg(e,t)||"normal",l;return e.mode==="text"?l=new Ee.MathNode("mtext",[n]):/[0-9]/.test(e.text)?l=new Ee.MathNode("mn",[n]):e.text==="\\prime"?l=new Ee.MathNode("mo",[n]):l=new Ee.MathNode("mi",[n]),a!==Y8[l.type]&&l.setAttribute("mathvariant",a),l}});var sx={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},lx={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Si({type:"spacing",htmlBuilder(e,t){if(lx.hasOwnProperty(e.text)){var n=lx[e.text].className||"";if(e.mode==="text"){var a=ue.makeOrd(e,t,"textord");return a.classes.push(n),a}else return ue.makeSpan(["mspace",n],[ue.mathsym(e.text,e.mode,t)],t)}else{if(sx.hasOwnProperty(e.text))return ue.makeSpan(["mspace",sx[e.text]],[],t);throw new Ae('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var n;if(lx.hasOwnProperty(e.text))n=new Ee.MathNode("mtext",[new Ee.TextNode(" ")]);else{if(sx.hasOwnProperty(e.text))return new Ee.MathNode("mspace");throw new Ae('Unknown type of space "'+e.text+'"')}return n}});var V3=()=>{var e=new Ee.MathNode("mtd",[]);return e.setAttribute("width","50%"),e};Si({type:"tag",mathmlBuilder(e,t){var n=new Ee.MathNode("mtable",[new Ee.MathNode("mtr",[V3(),new Ee.MathNode("mtd",[El(e.body,t)]),V3(),new Ee.MathNode("mtd",[El(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var G3={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},Y3={"\\textbf":"textbf","\\textmd":"textmd"},Uq={"\\textit":"textit","\\textup":"textup"},W3=(e,t)=>{var n=e.font;if(n){if(G3[n])return t.withTextFontFamily(G3[n]);if(Y3[n])return t.withTextFontWeight(Y3[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(Uq[n])};Le({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:a}=e,l=t[0];return{type:"text",mode:n.mode,body:Rn(l),font:a}},htmlBuilder(e,t){var n=W3(e,t),a=Kn(e.body,n,!0);return ue.makeSpan(["mord","text"],a,n)},mathmlBuilder(e,t){var n=W3(e,t);return El(e.body,n)}});Le({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"underline",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=Pt(e.body,t),a=ue.makeLineSpan("underline-line",t),l=t.fontMetrics().defaultRuleThickness,o=ue.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:l},{type:"elem",elem:a},{type:"kern",size:3*l},{type:"elem",elem:n}]},t);return ue.makeSpan(["mord","underline"],[o],t)},mathmlBuilder(e,t){var n=new Ee.MathNode("mo",[new Ee.TextNode("‾")]);n.setAttribute("stretchy","true");var a=new Ee.MathNode("munder",[fn(e.body,t),n]);return a.setAttribute("accentunder","true"),a}});Le({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"vcenter",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=Pt(e.body,t),a=t.fontMetrics().axisHeight,l=.5*(n.height-a-(n.depth+a));return ue.makeVList({positionType:"shift",positionData:l,children:[{type:"elem",elem:n}]},t)},mathmlBuilder(e,t){return new Ee.MathNode("mpadded",[fn(e.body,t)],["vcenter"])}});Le({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new Ae("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=X3(e),a=[],l=t.havingStyle(t.style.text()),o=0;oe.body.replace(/ /g,e.star?"␣":" "),wl=x8,W8=`[ \r - ]`,$q="\\\\[a-zA-Z@]+",Vq="\\\\[^\uD800-\uDFFF]",Gq="("+$q+")"+W8+"*",Yq=`\\\\( -|[ \r ]+ -?)[ \r ]*`,Qx="[̀-ͯ]",Wq=new RegExp(Qx+"+$"),Xq="("+W8+"+)|"+(Yq+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(Qx+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(Qx+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+Gq)+("|"+Vq+")");class K3{constructor(t,n){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=t,this.settings=n,this.tokenRegex=new RegExp(Xq,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,n){this.catcodes[t]=n}lex(){var t=this.input,n=this.tokenRegex.lastIndex;if(n===t.length)return new da("EOF",new Hr(this,n,n));var a=this.tokenRegex.exec(t);if(a===null||a.index!==n)throw new Ae("Unexpected character: '"+t[n]+"'",new da(t[n],new Hr(this,n,n+1)));var l=a[6]||a[3]||(a[2]?"\\ ":" ");if(this.catcodes[l]===14){var o=t.indexOf(` -`,this.tokenRegex.lastIndex);return o===-1?(this.tokenRegex.lastIndex=t.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=o+1,this.lex()}return new da(l,new Hr(this,n,this.tokenRegex.lastIndex))}}class Kq{constructor(t,n){t===void 0&&(t={}),n===void 0&&(n={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=n,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new Ae("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var t=this.undefStack.pop();for(var n in t)t.hasOwnProperty(n)&&(t[n]==null?delete this.current[n]:this.current[n]=t[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,n,a){if(a===void 0&&(a=!1),a){for(var l=0;l0&&(this.undefStack[this.undefStack.length-1][t]=n)}else{var o=this.undefStack[this.undefStack.length-1];o&&!o.hasOwnProperty(t)&&(o[t]=this.current[t])}n==null?delete this.current[t]:this.current[t]=n}}var Qq=L8;F("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});F("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});F("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});F("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});F("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var n=e.future();return t[0].length===1&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});F("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");F("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var Q3={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};F("\\char",function(e){var t=e.popToken(),n,a="";if(t.text==="'")n=8,t=e.popToken();else if(t.text==='"')n=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")a=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new Ae("\\char` missing argument");a=t.text.charCodeAt(0)}else n=10;if(n){if(a=Q3[t.text],a==null||a>=n)throw new Ae("Invalid base-"+n+" digit "+t.text);for(var l;(l=Q3[e.future().text])!=null&&l{var l=e.consumeArg().tokens;if(l.length!==1)throw new Ae("\\newcommand's first argument must be a macro name");var o=l[0].text,c=e.isDefined(o);if(c&&!t)throw new Ae("\\newcommand{"+o+"} attempting to redefine "+(o+"; use \\renewcommand"));if(!c&&!n)throw new Ae("\\renewcommand{"+o+"} when command "+o+" does not yet exist; use \\newcommand");var d=0;if(l=e.consumeArg().tokens,l.length===1&&l[0].text==="["){for(var m="",f=e.expandNextToken();f.text!=="]"&&f.text!=="EOF";)m+=f.text,f=e.expandNextToken();if(!m.match(/^\s*[0-9]+\s*$/))throw new Ae("Invalid number of arguments: "+m);d=parseInt(m),l=e.consumeArg().tokens}return c&&a||e.macros.set(o,{tokens:l,numArgs:d}),""};F("\\newcommand",e=>wg(e,!1,!0,!1));F("\\renewcommand",e=>wg(e,!0,!1,!1));F("\\providecommand",e=>wg(e,!0,!0,!0));F("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(n=>n.text).join("")),""});F("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(n=>n.text).join("")),""});F("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),wl[n],yn.math[n],yn.text[n]),""});F("\\bgroup","{");F("\\egroup","}");F("~","\\nobreakspace");F("\\lq","`");F("\\rq","'");F("\\aa","\\r a");F("\\AA","\\r A");F("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");F("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");F("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");F("ℬ","\\mathscr{B}");F("ℰ","\\mathscr{E}");F("ℱ","\\mathscr{F}");F("ℋ","\\mathscr{H}");F("ℐ","\\mathscr{I}");F("ℒ","\\mathscr{L}");F("ℳ","\\mathscr{M}");F("ℛ","\\mathscr{R}");F("ℭ","\\mathfrak{C}");F("ℌ","\\mathfrak{H}");F("ℨ","\\mathfrak{Z}");F("\\Bbbk","\\Bbb{k}");F("·","\\cdotp");F("\\llap","\\mathllap{\\textrm{#1}}");F("\\rlap","\\mathrlap{\\textrm{#1}}");F("\\clap","\\mathclap{\\textrm{#1}}");F("\\mathstrut","\\vphantom{(}");F("\\underbar","\\underline{\\text{#1}}");F("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');F("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");F("\\ne","\\neq");F("≠","\\neq");F("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");F("∉","\\notin");F("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");F("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");F("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");F("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");F("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");F("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");F("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");F("⟂","\\perp");F("‼","\\mathclose{!\\mkern-0.8mu!}");F("∌","\\notni");F("⌜","\\ulcorner");F("⌝","\\urcorner");F("⌞","\\llcorner");F("⌟","\\lrcorner");F("©","\\copyright");F("®","\\textregistered");F("️","\\textregistered");F("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');F("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');F("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');F("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');F("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");F("⋮","\\vdots");F("\\varGamma","\\mathit{\\Gamma}");F("\\varDelta","\\mathit{\\Delta}");F("\\varTheta","\\mathit{\\Theta}");F("\\varLambda","\\mathit{\\Lambda}");F("\\varXi","\\mathit{\\Xi}");F("\\varPi","\\mathit{\\Pi}");F("\\varSigma","\\mathit{\\Sigma}");F("\\varUpsilon","\\mathit{\\Upsilon}");F("\\varPhi","\\mathit{\\Phi}");F("\\varPsi","\\mathit{\\Psi}");F("\\varOmega","\\mathit{\\Omega}");F("\\substack","\\begin{subarray}{c}#1\\end{subarray}");F("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");F("\\boxed","\\fbox{$\\displaystyle{#1}$}");F("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");F("\\implies","\\DOTSB\\;\\Longrightarrow\\;");F("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");F("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");F("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var Z3={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};F("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in Z3?t=Z3[n]:(n.slice(0,4)==="\\not"||n in yn.math&&["bin","rel"].includes(yn.math[n].group))&&(t="\\dotsb"),t});var jg={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};F("\\dotso",function(e){var t=e.future().text;return t in jg?"\\ldots\\,":"\\ldots"});F("\\dotsc",function(e){var t=e.future().text;return t in jg&&t!==","?"\\ldots\\,":"\\ldots"});F("\\cdots",function(e){var t=e.future().text;return t in jg?"\\@cdots\\,":"\\@cdots"});F("\\dotsb","\\cdots");F("\\dotsm","\\cdots");F("\\dotsi","\\!\\cdots");F("\\dotsx","\\ldots\\,");F("\\DOTSI","\\relax");F("\\DOTSB","\\relax");F("\\DOTSX","\\relax");F("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");F("\\,","\\tmspace+{3mu}{.1667em}");F("\\thinspace","\\,");F("\\>","\\mskip{4mu}");F("\\:","\\tmspace+{4mu}{.2222em}");F("\\medspace","\\:");F("\\;","\\tmspace+{5mu}{.2777em}");F("\\thickspace","\\;");F("\\!","\\tmspace-{3mu}{.1667em}");F("\\negthinspace","\\!");F("\\negmedspace","\\tmspace-{4mu}{.2222em}");F("\\negthickspace","\\tmspace-{5mu}{.277em}");F("\\enspace","\\kern.5em ");F("\\enskip","\\hskip.5em\\relax");F("\\quad","\\hskip1em\\relax");F("\\qquad","\\hskip2em\\relax");F("\\tag","\\@ifstar\\tag@literal\\tag@paren");F("\\tag@paren","\\tag@literal{({#1})}");F("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new Ae("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});F("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");F("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");F("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");F("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");F("\\newline","\\\\\\relax");F("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var X8=Re(es["Main-Regular"][84][1]-.7*es["Main-Regular"][65][1]);F("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+X8+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");F("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+X8+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");F("\\hspace","\\@ifstar\\@hspacer\\@hspace");F("\\@hspace","\\hskip #1\\relax");F("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");F("\\ordinarycolon",":");F("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");F("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');F("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');F("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');F("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');F("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');F("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');F("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');F("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');F("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');F("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');F("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');F("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');F("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');F("∷","\\dblcolon");F("∹","\\eqcolon");F("≔","\\coloneqq");F("≕","\\eqqcolon");F("⩴","\\Coloneqq");F("\\ratio","\\vcentcolon");F("\\coloncolon","\\dblcolon");F("\\colonequals","\\coloneqq");F("\\coloncolonequals","\\Coloneqq");F("\\equalscolon","\\eqqcolon");F("\\equalscoloncolon","\\Eqqcolon");F("\\colonminus","\\coloneq");F("\\coloncolonminus","\\Coloneq");F("\\minuscolon","\\eqcolon");F("\\minuscoloncolon","\\Eqcolon");F("\\coloncolonapprox","\\Colonapprox");F("\\coloncolonsim","\\Colonsim");F("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");F("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");F("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");F("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");F("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");F("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");F("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");F("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");F("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");F("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");F("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");F("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");F("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");F("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");F("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");F("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");F("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");F("\\nleqq","\\html@mathml{\\@nleqq}{≰}");F("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");F("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");F("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");F("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");F("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");F("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");F("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");F("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");F("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");F("\\imath","\\html@mathml{\\@imath}{ı}");F("\\jmath","\\html@mathml{\\@jmath}{ȷ}");F("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");F("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");F("⟦","\\llbracket");F("⟧","\\rrbracket");F("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");F("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");F("⦃","\\lBrace");F("⦄","\\rBrace");F("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");F("⦵","\\minuso");F("\\darr","\\downarrow");F("\\dArr","\\Downarrow");F("\\Darr","\\Downarrow");F("\\lang","\\langle");F("\\rang","\\rangle");F("\\uarr","\\uparrow");F("\\uArr","\\Uparrow");F("\\Uarr","\\Uparrow");F("\\N","\\mathbb{N}");F("\\R","\\mathbb{R}");F("\\Z","\\mathbb{Z}");F("\\alef","\\aleph");F("\\alefsym","\\aleph");F("\\Alpha","\\mathrm{A}");F("\\Beta","\\mathrm{B}");F("\\bull","\\bullet");F("\\Chi","\\mathrm{X}");F("\\clubs","\\clubsuit");F("\\cnums","\\mathbb{C}");F("\\Complex","\\mathbb{C}");F("\\Dagger","\\ddagger");F("\\diamonds","\\diamondsuit");F("\\empty","\\emptyset");F("\\Epsilon","\\mathrm{E}");F("\\Eta","\\mathrm{H}");F("\\exist","\\exists");F("\\harr","\\leftrightarrow");F("\\hArr","\\Leftrightarrow");F("\\Harr","\\Leftrightarrow");F("\\hearts","\\heartsuit");F("\\image","\\Im");F("\\infin","\\infty");F("\\Iota","\\mathrm{I}");F("\\isin","\\in");F("\\Kappa","\\mathrm{K}");F("\\larr","\\leftarrow");F("\\lArr","\\Leftarrow");F("\\Larr","\\Leftarrow");F("\\lrarr","\\leftrightarrow");F("\\lrArr","\\Leftrightarrow");F("\\Lrarr","\\Leftrightarrow");F("\\Mu","\\mathrm{M}");F("\\natnums","\\mathbb{N}");F("\\Nu","\\mathrm{N}");F("\\Omicron","\\mathrm{O}");F("\\plusmn","\\pm");F("\\rarr","\\rightarrow");F("\\rArr","\\Rightarrow");F("\\Rarr","\\Rightarrow");F("\\real","\\Re");F("\\reals","\\mathbb{R}");F("\\Reals","\\mathbb{R}");F("\\Rho","\\mathrm{P}");F("\\sdot","\\cdot");F("\\sect","\\S");F("\\spades","\\spadesuit");F("\\sub","\\subset");F("\\sube","\\subseteq");F("\\supe","\\supseteq");F("\\Tau","\\mathrm{T}");F("\\thetasym","\\vartheta");F("\\weierp","\\wp");F("\\Zeta","\\mathrm{Z}");F("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");F("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");F("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");F("\\bra","\\mathinner{\\langle{#1}|}");F("\\ket","\\mathinner{|{#1}\\rangle}");F("\\braket","\\mathinner{\\langle{#1}\\rangle}");F("\\Bra","\\left\\langle#1\\right|");F("\\Ket","\\left|#1\\right\\rangle");var K8=e=>t=>{var n=t.consumeArg().tokens,a=t.consumeArg().tokens,l=t.consumeArg().tokens,o=t.consumeArg().tokens,c=t.macros.get("|"),d=t.macros.get("\\|");t.macros.beginGroup();var m=x=>y=>{e&&(y.macros.set("|",c),l.length&&y.macros.set("\\|",d));var b=x;if(!x&&l.length){var j=y.future();j.text==="|"&&(y.popToken(),b=!0)}return{tokens:b?l:a,numArgs:0}};t.macros.set("|",m(!1)),l.length&&t.macros.set("\\|",m(!0));var f=t.consumeArg().tokens,p=t.expandTokens([...o,...f,...n]);return t.macros.endGroup(),{tokens:p.reverse(),numArgs:0}};F("\\bra@ket",K8(!1));F("\\bra@set",K8(!0));F("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");F("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");F("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");F("\\angln","{\\angl n}");F("\\blue","\\textcolor{##6495ed}{#1}");F("\\orange","\\textcolor{##ffa500}{#1}");F("\\pink","\\textcolor{##ff00af}{#1}");F("\\red","\\textcolor{##df0030}{#1}");F("\\green","\\textcolor{##28ae7b}{#1}");F("\\gray","\\textcolor{gray}{#1}");F("\\purple","\\textcolor{##9d38bd}{#1}");F("\\blueA","\\textcolor{##ccfaff}{#1}");F("\\blueB","\\textcolor{##80f6ff}{#1}");F("\\blueC","\\textcolor{##63d9ea}{#1}");F("\\blueD","\\textcolor{##11accd}{#1}");F("\\blueE","\\textcolor{##0c7f99}{#1}");F("\\tealA","\\textcolor{##94fff5}{#1}");F("\\tealB","\\textcolor{##26edd5}{#1}");F("\\tealC","\\textcolor{##01d1c1}{#1}");F("\\tealD","\\textcolor{##01a995}{#1}");F("\\tealE","\\textcolor{##208170}{#1}");F("\\greenA","\\textcolor{##b6ffb0}{#1}");F("\\greenB","\\textcolor{##8af281}{#1}");F("\\greenC","\\textcolor{##74cf70}{#1}");F("\\greenD","\\textcolor{##1fab54}{#1}");F("\\greenE","\\textcolor{##0d923f}{#1}");F("\\goldA","\\textcolor{##ffd0a9}{#1}");F("\\goldB","\\textcolor{##ffbb71}{#1}");F("\\goldC","\\textcolor{##ff9c39}{#1}");F("\\goldD","\\textcolor{##e07d10}{#1}");F("\\goldE","\\textcolor{##a75a05}{#1}");F("\\redA","\\textcolor{##fca9a9}{#1}");F("\\redB","\\textcolor{##ff8482}{#1}");F("\\redC","\\textcolor{##f9685d}{#1}");F("\\redD","\\textcolor{##e84d39}{#1}");F("\\redE","\\textcolor{##bc2612}{#1}");F("\\maroonA","\\textcolor{##ffbde0}{#1}");F("\\maroonB","\\textcolor{##ff92c6}{#1}");F("\\maroonC","\\textcolor{##ed5fa6}{#1}");F("\\maroonD","\\textcolor{##ca337c}{#1}");F("\\maroonE","\\textcolor{##9e034e}{#1}");F("\\purpleA","\\textcolor{##ddd7ff}{#1}");F("\\purpleB","\\textcolor{##c6b9fc}{#1}");F("\\purpleC","\\textcolor{##aa87ff}{#1}");F("\\purpleD","\\textcolor{##7854ab}{#1}");F("\\purpleE","\\textcolor{##543b78}{#1}");F("\\mintA","\\textcolor{##f5f9e8}{#1}");F("\\mintB","\\textcolor{##edf2df}{#1}");F("\\mintC","\\textcolor{##e0e5cc}{#1}");F("\\grayA","\\textcolor{##f6f7f7}{#1}");F("\\grayB","\\textcolor{##f0f1f2}{#1}");F("\\grayC","\\textcolor{##e3e5e6}{#1}");F("\\grayD","\\textcolor{##d6d8da}{#1}");F("\\grayE","\\textcolor{##babec2}{#1}");F("\\grayF","\\textcolor{##888d93}{#1}");F("\\grayG","\\textcolor{##626569}{#1}");F("\\grayH","\\textcolor{##3b3e40}{#1}");F("\\grayI","\\textcolor{##21242c}{#1}");F("\\kaBlue","\\textcolor{##314453}{#1}");F("\\kaGreen","\\textcolor{##71B307}{#1}");var Q8={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Zq{constructor(t,n,a){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(t),this.macros=new Kq(Qq,n.macros),this.mode=a,this.stack=[]}feed(t){this.lexer=new K3(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var n,a,l;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:l,end:a}=this.consumeArg(["]"])}else({tokens:l,start:n,end:a}=this.consumeArg());return this.pushToken(new da("EOF",a.loc)),this.pushTokens(l),new da("",Hr.range(n,a))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var n=[],a=t&&t.length>0;a||this.consumeSpaces();var l=this.future(),o,c=0,d=0;do{if(o=this.popToken(),n.push(o),o.text==="{")++c;else if(o.text==="}"){if(--c,c===-1)throw new Ae("Extra }",o)}else if(o.text==="EOF")throw new Ae("Unexpected end of input in a macro argument, expected '"+(t&&a?t[d]:"}")+"'",o);if(t&&a)if((c===0||c===1&&t[d]==="{")&&o.text===t[d]){if(++d,d===t.length){n.splice(-d,d);break}}else d=0}while(c!==0||a);return l.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:l,end:o}}consumeArgs(t,n){if(n){if(n.length!==t+1)throw new Ae("The length of delimiters doesn't match the number of args!");for(var a=n[0],l=0;lthis.settings.maxExpand)throw new Ae("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var n=this.popToken(),a=n.text,l=n.noexpand?null:this._getExpansion(a);if(l==null||t&&l.unexpandable){if(t&&l==null&&a[0]==="\\"&&!this.isDefined(a))throw new Ae("Undefined control sequence: "+a);return this.pushToken(n),!1}this.countExpansion(1);var o=l.tokens,c=this.consumeArgs(l.numArgs,l.delimiters);if(l.numArgs){o=o.slice();for(var d=o.length-1;d>=0;--d){var m=o[d];if(m.text==="#"){if(d===0)throw new Ae("Incomplete placeholder at end of macro body",m);if(m=o[--d],m.text==="#")o.splice(d+1,1);else if(/^[1-9]$/.test(m.text))o.splice(d,2,...c[+m.text-1]);else throw new Ae("Not a valid argument number",m)}}}return this.pushTokens(o),o.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}throw new Error}expandMacro(t){return this.macros.has(t)?this.expandTokens([new da(t)]):void 0}expandTokens(t){var n=[],a=this.stack.length;for(this.pushTokens(t);this.stack.length>a;)if(this.expandOnce(!0)===!1){var l=this.stack.pop();l.treatAsRelax&&(l.noexpand=!1,l.treatAsRelax=!1),n.push(l)}return this.countExpansion(n.length),n}expandMacroAsText(t){var n=this.expandMacro(t);return n&&n.map(a=>a.text).join("")}_getExpansion(t){var n=this.macros.get(t);if(n==null)return n;if(t.length===1){var a=this.lexer.catcodes[t];if(a!=null&&a!==13)return}var l=typeof n=="function"?n(this):n;if(typeof l=="string"){var o=0;if(l.indexOf("#")!==-1)for(var c=l.replace(/##/g,"");c.indexOf("#"+(o+1))!==-1;)++o;for(var d=new K3(l,this.settings),m=[],f=d.lex();f.text!=="EOF";)m.push(f),f=d.lex();m.reverse();var p={tokens:m,numArgs:o};return p}return l}isDefined(t){return this.macros.has(t)||wl.hasOwnProperty(t)||yn.math.hasOwnProperty(t)||yn.text.hasOwnProperty(t)||Q8.hasOwnProperty(t)}isExpandable(t){var n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:wl.hasOwnProperty(t)&&!wl[t].primitive}}var J3=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,O0=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),ix={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},e5={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Xm{constructor(t,n){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new Zq(t,n,this.mode),this.settings=n,this.leftrightDepth=0}expect(t,n){if(n===void 0&&(n=!0),this.fetch().text!==t)throw new Ae("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t}finally{this.gullet.endGroups()}}subparse(t){var n=this.nextToken;this.consume(),this.gullet.pushToken(new da("}")),this.gullet.pushTokens(t);var a=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,a}parseExpression(t,n){for(var a=[];;){this.mode==="math"&&this.consumeSpaces();var l=this.fetch();if(Xm.endOfExpression.indexOf(l.text)!==-1||n&&l.text===n||t&&wl[l.text]&&wl[l.text].infix)break;var o=this.parseAtom(n);if(o){if(o.type==="internal")continue}else break;a.push(o)}return this.mode==="text"&&this.formLigatures(a),this.handleInfixNodes(a)}handleInfixNodes(t){for(var n=-1,a,l=0;l=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',t);var d=yn[this.mode][n].group,m=Hr.range(t),f;if(II.hasOwnProperty(d)){var p=d;f={type:"atom",mode:this.mode,family:p,loc:m,text:n}}else f={type:d,mode:this.mode,loc:m,text:n};c=f}else if(n.charCodeAt(0)>=128)this.settings.strict&&(l8(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),t)),c={type:"textord",mode:"text",loc:Hr.range(t),text:n};else return null;if(this.consume(),o)for(var x=0;xf&&(f=p):p&&(f!==void 0&&f>-1&&m.push(` -`.repeat(f)||" "),f=-1,m.push(p))}return m.join("")}function a9(e,t,n){return e.type==="element"?MH(e,t,n):e.type==="text"?n.whitespace==="normal"?s9(e,n):EH(e):[]}function MH(e,t,n){const a=l9(e,n),l=e.children||[];let o=-1,c=[];if(TH(e))return c;let d,m;for(Jx(e)||c5(e)&&s5(t,e,c5)?m=` -`:CH(e)?(d=2,m=2):r9(e)&&(d=1,m=1);++o{try{o(!0);const ve=await IH({page:c,page_size:p,search:y||void 0,is_registered:j==="all"?void 0:j==="registered",is_banned:S==="all"?void 0:S==="banned",format:M==="all"?void 0:M,sort_by:"usage_count",sort_order:"desc"});t(ve.data),f(ve.total)}catch(ve){const Ze=ve instanceof Error?ve.message:"加载表情包列表失败";W({title:"错误",description:Ze,variant:"destructive"})}finally{o(!1)}},[c,p,y,j,S,M,W]),P=async()=>{try{const ve=await $H();a(ve.data)}catch(ve){console.error("加载统计数据失败:",ve)}};w.useEffect(()=>{oe()},[oe]),w.useEffect(()=>{P()},[]);const je=async ve=>{try{const Ze=await qH(ve.id);L(Ze.data),R(!0)}catch(Ze){const We=Ze instanceof Error?Ze.message:"加载详情失败";W({title:"错误",description:We,variant:"destructive"})}},Z=ve=>{L(ve),$(!0)},O=ve=>{L(ve),G(!0)},Ne=async()=>{if(z)try{await UH(z.id),W({title:"成功",description:"表情包已删除"}),G(!1),L(null),oe(),P()}catch(ve){const Ze=ve instanceof Error?ve.message:"删除失败";W({title:"错误",description:Ze,variant:"destructive"})}},se=async ve=>{try{await VH(ve.id),W({title:"成功",description:"表情包已注册"}),oe(),P()}catch(Ze){const We=Ze instanceof Error?Ze.message:"注册失败";W({title:"错误",description:We,variant:"destructive"})}},Ce=async ve=>{try{await GH(ve.id),W({title:"成功",description:"表情包已封禁"}),oe(),P()}catch(Ze){const We=Ze instanceof Error?Ze.message:"封禁失败";W({title:"错误",description:We,variant:"destructive"})}},ye=ve=>{const Ze=new Set(te);Ze.has(ve)?Ze.delete(ve):Ze.add(ve),we(Ze)},Be=()=>{te.size===e.length&&e.length>0?we(new Set):we(new Set(e.map(ve=>ve.id)))},ie=async()=>{try{const ve=await YH(Array.from(te));W({title:"批量删除完成",description:ve.message}),we(new Set),ae(!1),oe(),P()}catch(ve){W({title:"批量删除失败",description:ve instanceof Error?ve.message:"批量删除失败",variant:"destructive"})}},He=()=>{const ve=parseInt(U),Ze=Math.ceil(m/p);ve>=1&&ve<=Ze?(d(ve),q("")):W({title:"无效的页码",description:`请输入1-${Ze}之间的页码`,variant:"destructive"})},lt=n?.formats?Object.keys(n.formats):[];return r.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[r.jsxs("div",{className:"mb-4 sm:mb-6",children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),r.jsx(Xt,{className:"flex-1",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&r.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[r.jsx(ot,{children:r.jsxs(Bt,{className:"pb-2",children:[r.jsx(tr,{children:"总数"}),r.jsx(Lt,{className:"text-2xl",children:n.total})]})}),r.jsx(ot,{children:r.jsxs(Bt,{className:"pb-2",children:[r.jsx(tr,{children:"已注册"}),r.jsx(Lt,{className:"text-2xl text-green-600",children:n.registered})]})}),r.jsx(ot,{children:r.jsxs(Bt,{className:"pb-2",children:[r.jsx(tr,{children:"已封禁"}),r.jsx(Lt,{className:"text-2xl text-red-600",children:n.banned})]})}),r.jsx(ot,{children:r.jsxs(Bt,{className:"pb-2",children:[r.jsx(tr,{children:"未注册"}),r.jsx(Lt,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),r.jsxs(ot,{children:[r.jsx(Bt,{children:r.jsxs(Lt,{className:"flex items-center gap-2",children:[r.jsx(yx,{className:"h-5 w-5"}),"搜索和筛选"]})}),r.jsxs(Vt,{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{children:"搜索"}),r.jsxs("div",{className:"relative",children:[r.jsx(Gr,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{placeholder:"描述或哈希值...",value:y,onChange:ve=>{b(ve.target.value),d(1)},className:"pl-8"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{children:"注册状态"}),r.jsxs(_t,{value:j,onValueChange:ve=>{k(ve),d(1)},children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"all",children:"全部"}),r.jsx(ze,{value:"registered",children:"已注册"}),r.jsx(ze,{value:"unregistered",children:"未注册"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{children:"封禁状态"}),r.jsxs(_t,{value:S,onValueChange:ve=>{_(ve),d(1)},children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"all",children:"全部"}),r.jsx(ze,{value:"banned",children:"已封禁"}),r.jsx(ze,{value:"unbanned",children:"未封禁"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{children:"格式"}),r.jsxs(_t,{value:M,onValueChange:ve=>{D(ve),d(1)},children:[r.jsx(jt,{children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"all",children:"全部"}),lt.map(ve=>r.jsxs(ze,{value:ve,children:[ve.toUpperCase()," (",n?.formats[ve],")"]},ve))]})]})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[r.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:te.size>0&&r.jsxs("span",{children:["已选择 ",te.size," 个表情包"]})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),r.jsxs(_t,{value:p.toString(),onValueChange:ve=>{x(parseInt(ve)),d(1),we(new Set)},children:[r.jsx(jt,{id:"emoji-page-size",className:"w-20",children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"10",children:"10"}),r.jsx(ze,{value:"20",children:"20"}),r.jsx(ze,{value:"50",children:"50"}),r.jsx(ze,{value:"100",children:"100"})]})]}),te.size>0&&r.jsxs(r.Fragment,{children:[r.jsx(re,{variant:"outline",size:"sm",onClick:()=>we(new Set),children:"取消选择"}),r.jsxs(re,{variant:"destructive",size:"sm",onClick:()=>ae(!0),children:[r.jsx(Ot,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),r.jsx("div",{className:"flex justify-end pt-4 border-t",children:r.jsxs(re,{variant:"outline",size:"sm",onClick:oe,disabled:l,children:[r.jsx(Os,{className:`h-4 w-4 mr-2 ${l?"animate-spin":""}`}),"刷新"]})})]})]}),r.jsxs(ot,{children:[r.jsxs(Bt,{children:[r.jsx(Lt,{children:"表情包列表"}),r.jsxs(tr,{children:["共 ",m," 个表情包,当前第 ",c," 页"]})]}),r.jsxs(Vt,{children:[r.jsx("div",{className:"hidden md:block rounded-md border overflow-hidden",children:r.jsxs(bi,{children:[r.jsx(wi,{children:r.jsxs(Un,{children:[r.jsx(ct,{className:"w-12",children:r.jsx(br,{checked:e.length>0&&te.size===e.length,onCheckedChange:Be,"aria-label":"全选"})}),r.jsx(ct,{className:"w-16",children:"预览"}),r.jsx(ct,{children:"描述"}),r.jsx(ct,{children:"格式"}),r.jsx(ct,{children:"情绪标签"}),r.jsx(ct,{className:"text-center",children:"状态"}),r.jsx(ct,{className:"text-right",children:"使用次数"}),r.jsx(ct,{className:"text-right",children:"操作"})]})}),r.jsx(ji,{children:e.length===0?r.jsx(Un,{children:r.jsx(et,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):e.map(ve=>r.jsxs(Un,{children:[r.jsx(et,{children:r.jsx(br,{checked:te.has(ve.id),onCheckedChange:()=>ye(ve.id),"aria-label":`选择 ${ve.description}`})}),r.jsx(et,{children:r.jsx("div",{className:"w-20 h-20 bg-muted rounded flex items-center justify-center overflow-hidden",children:r.jsx("img",{src:e1(ve.id),alt:ve.description||"表情包",className:"w-full h-full object-cover",onError:Ze=>{const We=Ze.target;We.style.display="none";const pn=We.parentElement;pn&&(pn.innerHTML='')}})})}),r.jsx(et,{children:r.jsxs("div",{className:"space-y-1 max-w-xs",children:[r.jsx("div",{className:"font-medium truncate",title:ve.description||"无描述",children:ve.description||"无描述"}),r.jsxs("div",{className:"text-xs text-muted-foreground font-mono",children:[ve.emoji_hash.slice(0,16),"..."]})]})}),r.jsx(et,{children:r.jsx(on,{variant:"outline",children:ve.format.toUpperCase()})}),r.jsx(et,{children:r.jsx(u5,{emotions:ve.emotion})}),r.jsx(et,{className:"align-middle",children:r.jsxs("div",{className:"flex gap-2 justify-center",children:[ve.is_registered&&r.jsxs(on,{variant:"default",className:"bg-green-600",children:[r.jsx(Ur,{className:"h-3 w-3 mr-1"}),"已注册"]}),ve.is_banned&&r.jsxs(on,{variant:"destructive",children:[r.jsx(px,{className:"h-3 w-3 mr-1"}),"已封禁"]})]})}),r.jsx(et,{className:"text-right font-mono",children:ve.usage_count}),r.jsx(et,{children:r.jsxs("div",{className:"flex items-center justify-end gap-1 flex-wrap",children:[r.jsxs(re,{variant:"default",size:"sm",onClick:()=>je(ve),children:[r.jsx(hi,{className:"h-4 w-4 mr-1"}),"详情"]}),r.jsxs(re,{variant:"default",size:"sm",onClick:()=>Z(ve),children:[r.jsx(Bo,{className:"h-4 w-4 mr-1"}),"编辑"]}),!ve.is_registered&&r.jsxs(re,{size:"sm",onClick:()=>se(ve),className:"bg-green-600 hover:bg-green-700 text-white",children:[r.jsx(Ur,{className:"h-4 w-4 mr-1"}),"注册"]}),!ve.is_banned&&r.jsxs(re,{size:"sm",onClick:()=>Ce(ve),className:"bg-orange-600 hover:bg-orange-700 text-white",children:[r.jsx(Fy,{className:"h-4 w-4 mr-1"}),"封禁"]}),r.jsxs(re,{size:"sm",onClick:()=>O(ve),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(Ot,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},ve.id))})]})}),r.jsx("div",{className:"md:hidden space-y-3",children:e.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):e.map(ve=>r.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-16 h-16 bg-muted rounded flex items-center justify-center overflow-hidden",children:r.jsx("img",{src:e1(ve.id),alt:ve.description||"表情包",className:"w-full h-full object-cover",onError:Ze=>{const We=Ze.target;We.style.display="none";const pn=We.parentElement;pn&&(pn.innerHTML='')}})})}),r.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[r.jsxs("div",{className:"min-w-0 w-full overflow-hidden",children:[r.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",title:ve.description||"无描述",children:ve.description||"无描述"}),r.jsxs("p",{className:"text-xs text-muted-foreground font-mono line-clamp-1 w-full break-all",children:[ve.emoji_hash.slice(0,16),"..."]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 items-center min-w-0",children:[r.jsx(on,{variant:"outline",className:"text-xs flex-shrink-0",children:ve.format.toUpperCase()}),ve.is_registered&&r.jsxs(on,{variant:"default",className:"bg-green-600 text-xs flex-shrink-0",children:[r.jsx(Ur,{className:"h-3 w-3 mr-1"}),"已注册"]}),ve.is_banned&&r.jsxs(on,{variant:"destructive",className:"text-xs flex-shrink-0",children:[r.jsx(px,{className:"h-3 w-3 mr-1"}),"已封禁"]}),r.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:["使用: ",ve.usage_count]})]}),ve.emotion&&ve.emotion.length>0&&r.jsx("div",{className:"min-w-0 overflow-hidden",children:r.jsx(u5,{emotions:ve.emotion})})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[r.jsxs(re,{variant:"default",size:"sm",onClick:()=>je(ve),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[r.jsx(hi,{className:"h-3 w-3 mr-1"}),"详情"]}),r.jsxs(re,{variant:"default",size:"sm",onClick:()=>Z(ve),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[r.jsx(Bo,{className:"h-3 w-3 mr-1"}),"编辑"]}),!ve.is_registered&&r.jsxs(re,{size:"sm",onClick:()=>se(ve),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-green-600 hover:bg-green-700 text-white",children:[r.jsx(Ur,{className:"h-3 w-3 mr-1"}),"注册"]}),!ve.is_banned&&r.jsxs(re,{size:"sm",onClick:()=>Ce(ve),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-orange-600 hover:bg-orange-700 text-white",children:[r.jsx(Fy,{className:"h-3 w-3 mr-1"}),"封禁"]}),r.jsxs(re,{size:"sm",onClick:()=>O(ve),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(Ot,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},ve.id))}),m>0&&r.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(c-1)*p+1," 到"," ",Math.min(c*p,m)," 条,共 ",m," 条"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(re,{variant:"outline",size:"sm",onClick:()=>d(1),disabled:c===1,className:"hidden sm:flex",children:r.jsx(Eu,{className:"h-4 w-4"})}),r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>d(ve=>Math.max(1,ve-1)),disabled:c===1,children:[r.jsx(vi,{className:"h-4 w-4 sm:mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te,{type:"number",value:U,onChange:ve=>q(ve.target.value),onKeyDown:ve=>ve.key==="Enter"&&He(),placeholder:c.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(m/p)}),r.jsx(re,{variant:"outline",size:"sm",onClick:He,disabled:!U,className:"h-8",children:"跳转"})]}),r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>d(ve=>ve+1),disabled:c>=Math.ceil(m/p),children:[r.jsx("span",{className:"hidden sm:inline",children:"下一页"}),r.jsx(yi,{className:"h-4 w-4 sm:ml-1"})]}),r.jsx(re,{variant:"outline",size:"sm",onClick:()=>d(Math.ceil(m/p)),disabled:c>=Math.ceil(m/p),className:"hidden sm:flex",children:r.jsx(Au,{className:"h-4 w-4"})})]})]})]})]}),r.jsx(XH,{emoji:z,open:E,onOpenChange:R}),r.jsx(KH,{emoji:z,open:H,onOpenChange:$,onSuccess:()=>{oe(),P()}})]})}),r.jsx(cn,{open:J,onOpenChange:ae,children:r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认批量删除"}),r.jsxs(en,{children:["你确定要删除选中的 ",te.size," 个表情包吗?此操作不可撤销。"]})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:ie,children:"确认删除"})]})]})}),r.jsx(hr,{open:I,onOpenChange:G,children:r.jsxs(nr,{children:[r.jsxs(rr,{children:[r.jsx(ar,{children:"确认删除"}),r.jsx(wr,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),r.jsxs(Yr,{children:[r.jsx(re,{variant:"outline",onClick:()=>G(!1),children:"取消"}),r.jsx(re,{variant:"destructive",onClick:Ne,children:"删除"})]})]})})]})}function XH({emoji:e,open:t,onOpenChange:n}){if(!e)return null;const a=l=>l?new Date(l*1e3).toLocaleString("zh-CN"):"-";return r.jsx(hr,{open:t,onOpenChange:n,children:r.jsxs(nr,{className:"max-w-2xl max-h-[90vh]",children:[r.jsx(rr,{children:r.jsx(ar,{children:"表情包详情"})}),r.jsx(Xt,{className:"max-h-[calc(90vh-8rem)] pr-4",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex justify-center",children:r.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:r.jsx("img",{src:e1(e.id),alt:e.description||"表情包",className:"w-full h-full object-cover",onError:l=>{const o=l.target;o.style.display="none";const c=o.parentElement;c&&(c.innerHTML='')}})})}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"ID"}),r.jsx("div",{className:"mt-1 font-mono",children:e.id})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"格式"}),r.jsx("div",{className:"mt-1",children:r.jsx(on,{variant:"outline",children:e.format.toUpperCase()})})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"文件路径"}),r.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:e.full_path})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"哈希值"}),r.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:e.emoji_hash})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"描述"}),e.description?r.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:r.jsx(FH,{className:"prose-sm",children:e.description})}):r.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"情绪标签"}),r.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:(()=>{const l=e.emotion?e.emotion.split(/[,,]/).map(o=>o.trim()).filter(Boolean):[];return l.length>0?l.map((o,c)=>r.jsx(on,{variant:"secondary",children:o},c)):r.jsx("span",{className:"text-sm text-muted-foreground",children:"无"})})()})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"状态"}),r.jsxs("div",{className:"mt-2 flex gap-2",children:[e.is_registered&&r.jsx(on,{variant:"default",className:"bg-green-600",children:"已注册"}),e.is_banned&&r.jsx(on,{variant:"destructive",children:"已封禁"}),!e.is_registered&&!e.is_banned&&r.jsx(on,{variant:"outline",children:"未注册"})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"使用次数"}),r.jsx("div",{className:"mt-1 font-mono text-lg",children:e.usage_count})]})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"记录时间"}),r.jsx("div",{className:"mt-1 text-sm",children:a(e.record_time)})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"注册时间"}),r.jsx("div",{className:"mt-1 text-sm",children:a(e.register_time)})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"最后使用"}),r.jsx("div",{className:"mt-1 text-sm",children:a(e.last_used_time)})]})]})})]})})}function KH({emoji:e,open:t,onOpenChange:n,onSuccess:a}){const[l,o]=w.useState(""),[c,d]=w.useState(""),[m,f]=w.useState(!1),[p,x]=w.useState(!1),[y,b]=w.useState(!1),{toast:j}=pr();w.useEffect(()=>{e&&(o(e.description||""),d(e.emotion||""),f(e.is_registered),x(e.is_banned))},[e]);const k=async()=>{if(e)try{b(!0);const S=c.split(/[,,]/).map(_=>_.trim()).filter(Boolean).join(",");await HH(e.id,{description:l||void 0,emotion:S||void 0,is_registered:m,is_banned:p}),j({title:"成功",description:"表情包信息已更新"}),n(!1),a()}catch(S){const _=S instanceof Error?S.message:"保存失败";j({title:"错误",description:_,variant:"destructive"})}finally{b(!1)}};return e?r.jsx(hr,{open:t,onOpenChange:n,children:r.jsxs(nr,{className:"max-w-2xl",children:[r.jsxs(rr,{children:[r.jsx(ar,{children:"编辑表情包"}),r.jsx(wr,{children:"修改表情包的描述和标签信息"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Q,{children:"描述"}),r.jsx(vn,{value:l,onChange:S=>o(S.target.value),placeholder:"输入表情包描述...",rows:3,className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx(Q,{children:"情绪标签"}),r.jsx(Te,{value:c,onChange:S=>d(S.target.value),placeholder:"使用逗号分隔多个标签,如:开心, 微笑, 快乐",className:"mt-1"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入多个标签时使用逗号分隔(支持中英文逗号)"})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(br,{id:"is_registered",checked:m,onCheckedChange:S=>f(S===!0)}),r.jsx(Q,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(br,{id:"is_banned",checked:p,onCheckedChange:S=>x(S===!0)}),r.jsx(Q,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),r.jsxs(Yr,{children:[r.jsx(re,{variant:"outline",onClick:()=>n(!1),children:"取消"}),r.jsx(re,{onClick:k,disabled:y,children:y?"保存中...":"保存"})]})]})}):null}function u5({emotions:e}){const t=e?e.split(/[,,]/).map(o=>o.trim()).filter(Boolean):[];if(t.length===0)return r.jsx("span",{className:"text-xs text-muted-foreground",children:"-"});const n=(o,c=6)=>o.length<=c?o:o.slice(0,c)+"...",a=t.slice(0,3),l=t.length-3;return r.jsxs("div",{className:"flex flex-wrap gap-1 max-w-full overflow-hidden",children:[a.map((o,c)=>r.jsx(on,{variant:"secondary",className:"text-xs flex-shrink-0",title:o,children:n(o)},c)),l>0&&r.jsxs(on,{variant:"outline",className:"text-xs flex-shrink-0",title:`还有 ${l} 个标签: ${t.slice(3).join(", ")}`,children:["+",l]})]})}const Ci="/api/webui/expression";async function QH(e){const t=new URLSearchParams;e.page&&t.append("page",e.page.toString()),e.page_size&&t.append("page_size",e.page_size.toString()),e.search&&t.append("search",e.search),e.chat_id&&t.append("chat_id",e.chat_id);const n=await ut(`${Ci}/list?${t}`,{headers:yt()});if(!n.ok){const a=await n.json();throw new Error(a.detail||"获取表达方式列表失败")}return n.json()}async function ZH(e){const t=await ut(`${Ci}/${e}`,{headers:yt()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"获取表达方式详情失败")}return t.json()}async function JH(e){const t=await ut(`${Ci}/`,{method:"POST",headers:yt(),body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.detail||"创建表达方式失败")}return t.json()}async function eU(e,t){const n=await ut(`${Ci}/${e}`,{method:"PATCH",headers:yt(),body:JSON.stringify(t)});if(!n.ok){const a=await n.json();throw new Error(a.detail||"更新表达方式失败")}return n.json()}async function tU(e){const t=await ut(`${Ci}/${e}`,{method:"DELETE",headers:yt()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"删除表达方式失败")}return t.json()}async function nU(e){const t=await ut(`${Ci}/batch/delete`,{method:"POST",headers:yt(),body:JSON.stringify({ids:e})});if(!t.ok){const n=await t.json();throw new Error(n.detail||"批量删除表达方式失败")}return t.json()}async function rU(){const e=await ut(`${Ci}/stats/summary`,{headers:yt()});if(!e.ok){const t=await e.json();throw new Error(t.detail||"获取统计数据失败")}return e.json()}function aU(){const[e,t]=w.useState([]),[n,a]=w.useState(!0),[l,o]=w.useState(0),[c,d]=w.useState(1),[m,f]=w.useState(20),[p,x]=w.useState(""),[y,b]=w.useState(null),[j,k]=w.useState(!1),[S,_]=w.useState(!1),[M,D]=w.useState(!1),[z,L]=w.useState(null),[E,R]=w.useState(new Set),[H,$]=w.useState(!1),[I,G]=w.useState(""),[te,we]=w.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),{toast:J}=pr(),ae=async()=>{try{a(!0);const se=await QH({page:c,page_size:m,search:p||void 0});t(se.data),o(se.total)}catch(se){J({title:"加载失败",description:se instanceof Error?se.message:"无法加载表达方式",variant:"destructive"})}finally{a(!1)}},U=async()=>{try{const se=await rU();we(se.data)}catch(se){console.error("加载统计数据失败:",se)}};w.useEffect(()=>{ae(),U()},[c,m,p]);const q=async se=>{try{const Ce=await ZH(se.id);b(Ce.data),k(!0)}catch(Ce){J({title:"加载详情失败",description:Ce instanceof Error?Ce.message:"无法加载表达方式详情",variant:"destructive"})}},W=se=>{b(se),_(!0)},oe=async se=>{try{await tU(se.id),J({title:"删除成功",description:`已删除表达方式: ${se.situation}`}),L(null),ae(),U()}catch(Ce){J({title:"删除失败",description:Ce instanceof Error?Ce.message:"无法删除表达方式",variant:"destructive"})}},P=se=>{const Ce=new Set(E);Ce.has(se)?Ce.delete(se):Ce.add(se),R(Ce)},je=()=>{E.size===e.length&&e.length>0?R(new Set):R(new Set(e.map(se=>se.id)))},Z=async()=>{try{await nU(Array.from(E)),J({title:"批量删除成功",description:`已删除 ${E.size} 个表达方式`}),R(new Set),$(!1),ae(),U()}catch(se){J({title:"批量删除失败",description:se instanceof Error?se.message:"无法批量删除表达方式",variant:"destructive"})}},O=()=>{const se=parseInt(I),Ce=Math.ceil(l/m);se>=1&&se<=Ce?(d(se),G("")):J({title:"无效的页码",description:`请输入1-${Ce}之间的页码`,variant:"destructive"})},Ne=se=>se?new Date(se*1e3).toLocaleString("zh-CN"):"-";return r.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[r.jsx("div",{className:"mb-4 sm:mb-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[r.jsx(_u,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),r.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),r.jsxs(re,{onClick:()=>D(!0),className:"gap-2",children:[r.jsx(mr,{className:"h-4 w-4"}),"新增表达方式"]})]})}),r.jsx(Xt,{className:"flex-1",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),r.jsx("div",{className:"text-2xl font-bold mt-1",children:te.total})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),r.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:te.recent_7days})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),r.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:te.chat_count})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx(Q,{htmlFor:"search",children:"搜索"}),r.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:r.jsxs("div",{className:"flex-1 relative",children:[r.jsx(Gr,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{id:"search",placeholder:"搜索情境、风格或上下文...",value:p,onChange:se=>x(se.target.value),className:"pl-9"})]})}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[r.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:E.size>0&&r.jsxs("span",{children:["已选择 ",E.size," 个表达方式"]})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),r.jsxs(_t,{value:m.toString(),onValueChange:se=>{f(parseInt(se)),d(1),R(new Set)},children:[r.jsx(jt,{id:"page-size",className:"w-20",children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"10",children:"10"}),r.jsx(ze,{value:"20",children:"20"}),r.jsx(ze,{value:"50",children:"50"}),r.jsx(ze,{value:"100",children:"100"})]})]}),E.size>0&&r.jsxs(r.Fragment,{children:[r.jsx(re,{variant:"outline",size:"sm",onClick:()=>R(new Set),children:"取消选择"}),r.jsxs(re,{variant:"destructive",size:"sm",onClick:()=>$(!0),children:[r.jsx(Ot,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card",children:[r.jsx("div",{className:"hidden md:block",children:r.jsxs(bi,{children:[r.jsx(wi,{children:r.jsxs(Un,{children:[r.jsx(ct,{className:"w-12",children:r.jsx(br,{checked:E.size===e.length&&e.length>0,onCheckedChange:je})}),r.jsx(ct,{children:"情境"}),r.jsx(ct,{children:"风格"}),r.jsx(ct,{children:"聊天ID"}),r.jsx(ct,{children:"最后活跃"}),r.jsx(ct,{className:"text-right",children:"操作"})]})}),r.jsx(ji,{children:n?r.jsx(Un,{children:r.jsx(et,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):e.length===0?r.jsx(Un,{children:r.jsx(et,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):e.map(se=>r.jsxs(Un,{children:[r.jsx(et,{children:r.jsx(br,{checked:E.has(se.id),onCheckedChange:()=>P(se.id)})}),r.jsx(et,{className:"font-medium max-w-xs truncate",children:se.situation}),r.jsx(et,{className:"max-w-xs truncate",children:se.style}),r.jsx(et,{className:"font-mono text-sm",children:se.chat_id}),r.jsx(et,{className:"text-sm text-muted-foreground",children:Ne(se.last_active_time)}),r.jsx(et,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsxs(re,{variant:"default",size:"sm",onClick:()=>q(se),children:[r.jsx(qa,{className:"h-4 w-4 mr-1"}),"详情"]}),r.jsxs(re,{variant:"default",size:"sm",onClick:()=>W(se),children:[r.jsx(Bo,{className:"h-4 w-4 mr-1"}),"编辑"]}),r.jsxs(re,{size:"sm",onClick:()=>L(se),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(Ot,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},se.id))})]})}),r.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):e.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):e.map(se=>r.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(br,{checked:E.has(se.id),onCheckedChange:()=>P(se.id),className:"mt-1"}),r.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),r.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:se.situation,children:se.situation})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),r.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:se.style,children:se.style})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天ID"}),r.jsx("p",{className:"font-mono text-xs truncate",children:se.chat_id})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后活跃"}),r.jsx("p",{className:"text-xs",children:Ne(se.last_active_time)})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>q(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[r.jsx(qa,{className:"h-3 w-3 mr-1"}),"查看"]}),r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>W(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[r.jsx(Bo,{className:"h-3 w-3 mr-1"}),"编辑"]}),r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>L(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[r.jsx(Ot,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},se.id))}),l>0&&r.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",l," 条记录,第 ",c," / ",Math.ceil(l/m)," 页"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(re,{variant:"outline",size:"sm",onClick:()=>d(1),disabled:c===1,className:"hidden sm:flex",children:r.jsx(Eu,{className:"h-4 w-4"})}),r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>d(c-1),disabled:c===1,children:[r.jsx(vi,{className:"h-4 w-4 sm:mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te,{type:"number",value:I,onChange:se=>G(se.target.value),onKeyDown:se=>se.key==="Enter"&&O(),placeholder:c.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(l/m)}),r.jsx(re,{variant:"outline",size:"sm",onClick:O,disabled:!I,className:"h-8",children:"跳转"})]}),r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>d(c+1),disabled:c>=Math.ceil(l/m),children:[r.jsx("span",{className:"hidden sm:inline",children:"下一页"}),r.jsx(yi,{className:"h-4 w-4 sm:ml-1"})]}),r.jsx(re,{variant:"outline",size:"sm",onClick:()=>d(Math.ceil(l/m)),disabled:c>=Math.ceil(l/m),className:"hidden sm:flex",children:r.jsx(Au,{className:"h-4 w-4"})})]})]})]})]})}),r.jsx(sU,{expression:y,open:j,onOpenChange:k}),r.jsx(lU,{open:M,onOpenChange:D,onSuccess:()=>{ae(),U(),D(!1)}}),r.jsx(iU,{expression:y,open:S,onOpenChange:_,onSuccess:()=>{ae(),U(),_(!1)}}),r.jsx(cn,{open:!!z,onOpenChange:()=>L(null),children:r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认删除"}),r.jsxs(en,{children:['确定要删除表达方式 "',z?.situation,'" 吗? 此操作不可撤销。']})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:()=>z&&oe(z),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),r.jsx(oU,{open:H,onOpenChange:$,onConfirm:Z,count:E.size})]})}function sU({expression:e,open:t,onOpenChange:n}){if(!e)return null;const a=l=>l?new Date(l*1e3).toLocaleString("zh-CN"):"-";return r.jsx(hr,{open:t,onOpenChange:n,children:r.jsxs(nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(rr,{children:[r.jsx(ar,{children:"表达方式详情"}),r.jsx(wr,{children:"查看表达方式的完整信息"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(bo,{label:"情境",value:e.situation}),r.jsx(bo,{label:"风格",value:e.style}),r.jsx(bo,{icon:J0,label:"聊天ID",value:e.chat_id,mono:!0}),r.jsx(bo,{icon:J0,label:"记录ID",value:e.id.toString(),mono:!0})]}),e.context&&r.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[r.jsx(Q,{className:"text-xs text-muted-foreground",children:"上下文"}),r.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:e.context})]}),e.up_content&&r.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[r.jsx(Q,{className:"text-xs text-muted-foreground",children:"上文内容"}),r.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:e.up_content})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(bo,{icon:ui,label:"最后活跃",value:a(e.last_active_time)}),r.jsx(bo,{icon:ui,label:"创建时间",value:a(e.create_date)})]})]}),r.jsx(Yr,{children:r.jsx(re,{onClick:()=>n(!1),children:"关闭"})})]})})}function bo({icon:e,label:t,value:n,mono:a=!1}){return r.jsxs("div",{className:"space-y-1",children:[r.jsxs(Q,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e&&r.jsx(e,{className:"h-3 w-3"}),t]}),r.jsx("div",{className:me("text-sm",a&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function lU({open:e,onOpenChange:t,onSuccess:n}){const[a,l]=w.useState({situation:"",style:"",context:"",up_content:"",chat_id:""}),[o,c]=w.useState(!1),{toast:d}=pr(),m=async()=>{if(!a.situation||!a.style||!a.chat_id){d({title:"验证失败",description:"请填写必填字段:情境、风格和聊天ID",variant:"destructive"});return}try{c(!0),await JH(a),d({title:"创建成功",description:"表达方式已创建"}),l({situation:"",style:"",context:"",up_content:"",chat_id:""}),n()}catch(f){d({title:"创建失败",description:f instanceof Error?f.message:"无法创建表达方式",variant:"destructive"})}finally{c(!1)}};return r.jsx(hr,{open:e,onOpenChange:t,children:r.jsxs(nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(rr,{children:[r.jsx(ar,{children:"新增表达方式"}),r.jsx(wr,{children:"创建新的表达方式记录"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Q,{htmlFor:"situation",children:["情境 ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsx(Te,{id:"situation",value:a.situation,onChange:f=>l({...a,situation:f.target.value}),placeholder:"描述使用场景"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Q,{htmlFor:"style",children:["风格 ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsx(Te,{id:"style",value:a.style,onChange:f=>l({...a,style:f.target.value}),placeholder:"描述表达风格"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Q,{htmlFor:"chat_id",children:["聊天ID ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsx(Te,{id:"chat_id",value:a.chat_id,onChange:f=>l({...a,chat_id:f.target.value}),placeholder:"关联的聊天ID"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"context",children:"上下文"}),r.jsx(vn,{id:"context",value:a.context,onChange:f=>l({...a,context:f.target.value}),placeholder:"上下文信息(可选)",rows:3})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"up_content",children:"上文内容"}),r.jsx(vn,{id:"up_content",value:a.up_content,onChange:f=>l({...a,up_content:f.target.value}),placeholder:"上文内容(可选)",rows:3})]})]}),r.jsxs(Yr,{children:[r.jsx(re,{variant:"outline",onClick:()=>t(!1),children:"取消"}),r.jsx(re,{onClick:m,disabled:o,children:o?"创建中...":"创建"})]})]})})}function iU({expression:e,open:t,onOpenChange:n,onSuccess:a}){const[l,o]=w.useState({}),[c,d]=w.useState(!1),{toast:m}=pr();w.useEffect(()=>{e&&o({situation:e.situation,style:e.style,context:e.context||"",up_content:e.up_content||"",chat_id:e.chat_id})},[e]);const f=async()=>{if(e)try{d(!0),await eU(e.id,l),m({title:"保存成功",description:"表达方式已更新"}),a()}catch(p){m({title:"保存失败",description:p instanceof Error?p.message:"无法更新表达方式",variant:"destructive"})}finally{d(!1)}};return e?r.jsx(hr,{open:t,onOpenChange:n,children:r.jsxs(nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(rr,{children:[r.jsx(ar,{children:"编辑表达方式"}),r.jsx(wr,{children:"修改表达方式的信息"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit_situation",children:"情境"}),r.jsx(Te,{id:"edit_situation",value:l.situation||"",onChange:p=>o({...l,situation:p.target.value}),placeholder:"描述使用场景"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit_style",children:"风格"}),r.jsx(Te,{id:"edit_style",value:l.style||"",onChange:p=>o({...l,style:p.target.value}),placeholder:"描述表达风格"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit_chat_id",children:"聊天ID"}),r.jsx(Te,{id:"edit_chat_id",value:l.chat_id||"",onChange:p=>o({...l,chat_id:p.target.value}),placeholder:"关联的聊天ID"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit_context",children:"上下文"}),r.jsx(vn,{id:"edit_context",value:l.context||"",onChange:p=>o({...l,context:p.target.value}),placeholder:"上下文信息",rows:3})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit_up_content",children:"上文内容"}),r.jsx(vn,{id:"edit_up_content",value:l.up_content||"",onChange:p=>o({...l,up_content:p.target.value}),placeholder:"上文内容",rows:3})]})]}),r.jsxs(Yr,{children:[r.jsx(re,{variant:"outline",onClick:()=>n(!1),children:"取消"}),r.jsx(re,{onClick:f,disabled:c,children:c?"保存中...":"保存"})]})]})}):null}function oU({open:e,onOpenChange:t,onConfirm:n,count:a}){return r.jsx(cn,{open:e,onOpenChange:t,children:r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认批量删除"}),r.jsxs(en,{children:["您即将删除 ",a," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const tc="/api/webui/person";async function cU(e){const t=new URLSearchParams;e.page&&t.append("page",e.page.toString()),e.page_size&&t.append("page_size",e.page_size.toString()),e.search&&t.append("search",e.search),e.is_known!==void 0&&t.append("is_known",e.is_known.toString()),e.platform&&t.append("platform",e.platform);const n=await ut(`${tc}/list?${t}`,{headers:yt()});if(!n.ok){const a=await n.json();throw new Error(a.detail||"获取人物列表失败")}return n.json()}async function uU(e){const t=await ut(`${tc}/${e}`,{headers:yt()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"获取人物详情失败")}return t.json()}async function dU(e,t){const n=await ut(`${tc}/${e}`,{method:"PATCH",headers:yt(),body:JSON.stringify(t)});if(!n.ok){const a=await n.json();throw new Error(a.detail||"更新人物信息失败")}return n.json()}async function mU(e){const t=await ut(`${tc}/${e}`,{method:"DELETE",headers:yt()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"删除人物信息失败")}return t.json()}async function hU(){const e=await ut(`${tc}/stats/summary`,{headers:yt()});if(!e.ok){const t=await e.json();throw new Error(t.detail||"获取统计数据失败")}return e.json()}async function fU(e){const t=await ut(`${tc}/batch/delete`,{method:"POST",headers:yt(),body:JSON.stringify({person_ids:e})});if(!t.ok){const n=await t.json();throw new Error(n.detail||"批量删除失败")}return t.json()}function pU(){const[e,t]=w.useState([]),[n,a]=w.useState(!0),[l,o]=w.useState(0),[c,d]=w.useState(1),[m,f]=w.useState(20),[p,x]=w.useState(""),[y,b]=w.useState(void 0),[j,k]=w.useState(void 0),[S,_]=w.useState(null),[M,D]=w.useState(!1),[z,L]=w.useState(!1),[E,R]=w.useState(null),[H,$]=w.useState({total:0,known:0,unknown:0,platforms:{}}),[I,G]=w.useState(new Set),[te,we]=w.useState(!1),[J,ae]=w.useState(""),{toast:U}=pr(),q=async()=>{try{a(!0);const ie=await cU({page:c,page_size:m,search:p||void 0,is_known:y,platform:j});t(ie.data),o(ie.total)}catch(ie){U({title:"加载失败",description:ie instanceof Error?ie.message:"无法加载人物信息",variant:"destructive"})}finally{a(!1)}},W=async()=>{try{const ie=await hU();$(ie.data)}catch(ie){console.error("加载统计数据失败:",ie)}};w.useEffect(()=>{q(),W()},[c,m,p,y,j]);const oe=async ie=>{try{const He=await uU(ie.person_id);_(He.data),D(!0)}catch(He){U({title:"加载详情失败",description:He instanceof Error?He.message:"无法加载人物详情",variant:"destructive"})}},P=ie=>{_(ie),L(!0)},je=async ie=>{try{await mU(ie.person_id),U({title:"删除成功",description:`已删除人物信息: ${ie.person_name||ie.nickname||ie.user_id}`}),R(null),q(),W()}catch(He){U({title:"删除失败",description:He instanceof Error?He.message:"无法删除人物信息",variant:"destructive"})}},Z=w.useMemo(()=>Object.keys(H.platforms),[H.platforms]),O=ie=>{const He=new Set(I);He.has(ie)?He.delete(ie):He.add(ie),G(He)},Ne=()=>{I.size===e.length&&e.length>0?G(new Set):G(new Set(e.map(ie=>ie.person_id)))},se=()=>{if(I.size===0){U({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}we(!0)},Ce=async()=>{try{const ie=await fU(Array.from(I));U({title:"批量删除完成",description:ie.message}),G(new Set),we(!1),q(),W()}catch(ie){U({title:"批量删除失败",description:ie instanceof Error?ie.message:"批量删除失败",variant:"destructive"})}},ye=()=>{const ie=parseInt(J),He=Math.ceil(l/m);ie>=1&&ie<=He?(d(ie),ae("")):U({title:"无效的页码",description:`请输入1-${He}之间的页码`,variant:"destructive"})},Be=ie=>ie?new Date(ie*1e3).toLocaleString("zh-CN"):"-";return r.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[r.jsx("div",{className:"mb-4 sm:mb-6",children:r.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:r.jsxs("div",{children:[r.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[r.jsx(yT,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),r.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),r.jsx(Xt,{className:"flex-1",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),r.jsx("div",{className:"text-2xl font-bold mt-1",children:H.total})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),r.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:H.known})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),r.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:H.unknown})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"sm:col-span-2",children:[r.jsx(Q,{htmlFor:"search",children:"搜索"}),r.jsxs("div",{className:"relative mt-1.5",children:[r.jsx(Gr,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:p,onChange:ie=>x(ie.target.value),className:"pl-9"})]})]}),r.jsxs("div",{children:[r.jsx(Q,{htmlFor:"filter-known",children:"认识状态"}),r.jsxs(_t,{value:y===void 0?"all":y.toString(),onValueChange:ie=>{b(ie==="all"?void 0:ie==="true"),d(1)},children:[r.jsx(jt,{id:"filter-known",className:"mt-1.5",children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"all",children:"全部"}),r.jsx(ze,{value:"true",children:"已认识"}),r.jsx(ze,{value:"false",children:"未认识"})]})]})]}),r.jsxs("div",{children:[r.jsx(Q,{htmlFor:"filter-platform",children:"平台"}),r.jsxs(_t,{value:j||"all",onValueChange:ie=>{k(ie==="all"?void 0:ie),d(1)},children:[r.jsx(jt,{id:"filter-platform",className:"mt-1.5",children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"all",children:"全部平台"}),Z.map(ie=>r.jsxs(ze,{value:ie,children:[ie," (",H.platforms[ie],")"]},ie))]})]})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[r.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:I.size>0&&r.jsxs("span",{children:["已选择 ",I.size," 个人物"]})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),r.jsxs(_t,{value:m.toString(),onValueChange:ie=>{f(parseInt(ie)),d(1),G(new Set)},children:[r.jsx(jt,{id:"page-size",className:"w-20",children:r.jsx(Mt,{})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"10",children:"10"}),r.jsx(ze,{value:"20",children:"20"}),r.jsx(ze,{value:"50",children:"50"}),r.jsx(ze,{value:"100",children:"100"})]})]}),I.size>0&&r.jsxs(r.Fragment,{children:[r.jsx(re,{variant:"outline",size:"sm",onClick:()=>G(new Set),children:"取消选择"}),r.jsxs(re,{variant:"destructive",size:"sm",onClick:se,children:[r.jsx(Ot,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card",children:[r.jsx("div",{className:"hidden md:block",children:r.jsxs(bi,{children:[r.jsx(wi,{children:r.jsxs(Un,{children:[r.jsx(ct,{className:"w-12",children:r.jsx(br,{checked:e.length>0&&I.size===e.length,onCheckedChange:Ne,"aria-label":"全选"})}),r.jsx(ct,{children:"状态"}),r.jsx(ct,{children:"名称"}),r.jsx(ct,{children:"昵称"}),r.jsx(ct,{children:"平台"}),r.jsx(ct,{children:"用户ID"}),r.jsx(ct,{children:"最后更新"}),r.jsx(ct,{className:"text-right",children:"操作"})]})}),r.jsx(ji,{children:n?r.jsx(Un,{children:r.jsx(et,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):e.length===0?r.jsx(Un,{children:r.jsx(et,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):e.map(ie=>r.jsxs(Un,{children:[r.jsx(et,{children:r.jsx(br,{checked:I.has(ie.person_id),onCheckedChange:()=>O(ie.person_id),"aria-label":`选择 ${ie.person_name||ie.nickname||ie.user_id}`})}),r.jsx(et,{children:r.jsx("div",{className:me("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",ie.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:ie.is_known?"已认识":"未认识"})}),r.jsx(et,{className:"font-medium",children:ie.person_name||r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(et,{children:ie.nickname||"-"}),r.jsx(et,{children:ie.platform}),r.jsx(et,{className:"font-mono text-sm",children:ie.user_id}),r.jsx(et,{className:"text-sm text-muted-foreground",children:Be(ie.last_know)}),r.jsx(et,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsxs(re,{variant:"default",size:"sm",onClick:()=>oe(ie),children:[r.jsx(qa,{className:"h-4 w-4 mr-1"}),"详情"]}),r.jsxs(re,{variant:"default",size:"sm",onClick:()=>P(ie),children:[r.jsx(Bo,{className:"h-4 w-4 mr-1"}),"编辑"]}),r.jsxs(re,{size:"sm",onClick:()=>R(ie),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(Ot,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},ie.id))})]})}),r.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):e.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):e.map(ie=>r.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(br,{checked:I.has(ie.person_id),onCheckedChange:()=>O(ie.person_id),className:"mt-1"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:me("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",ie.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:ie.is_known?"已认识":"未认识"}),r.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:ie.person_name||r.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),ie.nickname&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",ie.nickname]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),r.jsx("p",{className:"font-medium text-xs",children:ie.platform})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),r.jsx("p",{className:"font-mono text-xs truncate",title:ie.user_id,children:ie.user_id})]}),r.jsxs("div",{className:"col-span-2",children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),r.jsx("p",{className:"text-xs",children:Be(ie.last_know)})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>oe(ie),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[r.jsx(qa,{className:"h-3 w-3 mr-1"}),"查看"]}),r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>P(ie),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[r.jsx(Bo,{className:"h-3 w-3 mr-1"}),"编辑"]}),r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>R(ie),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[r.jsx(Ot,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},ie.id))}),l>0&&r.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",l," 条记录,第 ",c," / ",Math.ceil(l/m)," 页"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(re,{variant:"outline",size:"sm",onClick:()=>d(1),disabled:c===1,className:"hidden sm:flex",children:r.jsx(Eu,{className:"h-4 w-4"})}),r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>d(c-1),disabled:c===1,children:[r.jsx(vi,{className:"h-4 w-4 sm:mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te,{type:"number",value:J,onChange:ie=>ae(ie.target.value),onKeyDown:ie=>ie.key==="Enter"&&ye(),placeholder:c.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(l/m)}),r.jsx(re,{variant:"outline",size:"sm",onClick:ye,disabled:!J,className:"h-8",children:"跳转"})]}),r.jsxs(re,{variant:"outline",size:"sm",onClick:()=>d(c+1),disabled:c>=Math.ceil(l/m),children:[r.jsx("span",{className:"hidden sm:inline",children:"下一页"}),r.jsx(yi,{className:"h-4 w-4 sm:ml-1"})]}),r.jsx(re,{variant:"outline",size:"sm",onClick:()=>d(Math.ceil(l/m)),disabled:c>=Math.ceil(l/m),className:"hidden sm:flex",children:r.jsx(Au,{className:"h-4 w-4"})})]})]})]})]})}),r.jsx(xU,{person:S,open:M,onOpenChange:D}),r.jsx(gU,{person:S,open:z,onOpenChange:L,onSuccess:()=>{q(),W(),L(!1)}}),r.jsx(cn,{open:!!E,onOpenChange:()=>R(null),children:r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认删除"}),r.jsxs(en,{children:['确定要删除人物信息 "',E?.person_name||E?.nickname||E?.user_id,'" 吗? 此操作不可撤销。']})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:()=>E&&je(E),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),r.jsx(cn,{open:te,onOpenChange:we,children:r.jsxs(Kt,{children:[r.jsxs(Qt,{children:[r.jsx(Jt,{children:"确认批量删除"}),r.jsxs(en,{children:["确定要删除选中的 ",I.size," 个人物信息吗? 此操作不可撤销。"]})]}),r.jsxs(Zt,{children:[r.jsx(nn,{children:"取消"}),r.jsx(tn,{onClick:Ce,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function xU({person:e,open:t,onOpenChange:n}){if(!e)return null;const a=l=>l?new Date(l*1e3).toLocaleString("zh-CN"):"-";return r.jsx(hr,{open:t,onOpenChange:n,children:r.jsxs(nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(rr,{children:[r.jsx(ar,{children:"人物详情"}),r.jsxs(wr,{children:["查看 ",e.person_name||e.nickname||e.user_id," 的完整信息"]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(Es,{icon:Z5,label:"人物名称",value:e.person_name}),r.jsx(Es,{icon:_u,label:"昵称",value:e.nickname}),r.jsx(Es,{icon:J0,label:"用户ID",value:e.user_id,mono:!0}),r.jsx(Es,{icon:J0,label:"人物ID",value:e.person_id,mono:!0}),r.jsx(Es,{label:"平台",value:e.platform}),r.jsx(Es,{label:"状态",value:e.is_known?"已认识":"未认识"})]}),e.name_reason&&r.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[r.jsx(Q,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),r.jsx("p",{className:"mt-1 text-sm",children:e.name_reason})]}),e.memory_points&&r.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[r.jsx(Q,{className:"text-xs text-muted-foreground",children:"个人印象"}),r.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:e.memory_points})]}),e.group_nick_name&&e.group_nick_name.length>0&&r.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[r.jsx(Q,{className:"text-xs text-muted-foreground",children:"群昵称"}),r.jsx("div",{className:"mt-2 space-y-1",children:e.group_nick_name.map((l,o)=>r.jsxs("div",{className:"text-sm flex items-center gap-2",children:[r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:l.group_id}),r.jsx("span",{children:"→"}),r.jsx("span",{children:l.group_nick_name})]},o))})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsx(Es,{icon:ui,label:"认识时间",value:a(e.know_times)}),r.jsx(Es,{icon:ui,label:"首次记录",value:a(e.know_since)}),r.jsx(Es,{icon:ui,label:"最后更新",value:a(e.last_know)})]})]}),r.jsx(Yr,{children:r.jsx(re,{onClick:()=>n(!1),children:"关闭"})})]})})}function Es({icon:e,label:t,value:n,mono:a=!1}){return r.jsxs("div",{className:"space-y-1",children:[r.jsxs(Q,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e&&r.jsx(e,{className:"h-3 w-3"}),t]}),r.jsx("div",{className:me("text-sm",a&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function gU({person:e,open:t,onOpenChange:n,onSuccess:a}){const[l,o]=w.useState({}),[c,d]=w.useState(!1),{toast:m}=pr();w.useEffect(()=>{e&&o({person_name:e.person_name||"",name_reason:e.name_reason||"",nickname:e.nickname||"",memory_points:e.memory_points||"",is_known:e.is_known})},[e]);const f=async()=>{if(e)try{d(!0),await dU(e.person_id,l),m({title:"保存成功",description:"人物信息已更新"}),a()}catch(p){m({title:"保存失败",description:p instanceof Error?p.message:"无法更新人物信息",variant:"destructive"})}finally{d(!1)}};return e?r.jsx(hr,{open:t,onOpenChange:n,children:r.jsxs(nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(rr,{children:[r.jsx(ar,{children:"编辑人物信息"}),r.jsxs(wr,{children:["修改 ",e.person_name||e.nickname||e.user_id," 的信息"]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"person_name",children:"人物名称"}),r.jsx(Te,{id:"person_name",value:l.person_name||"",onChange:p=>o({...l,person_name:p.target.value}),placeholder:"为这个人设置一个名称"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"nickname",children:"昵称"}),r.jsx(Te,{id:"nickname",value:l.nickname||"",onChange:p=>o({...l,nickname:p.target.value}),placeholder:"昵称"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"name_reason",children:"名称设定原因"}),r.jsx(vn,{id:"name_reason",value:l.name_reason||"",onChange:p=>o({...l,name_reason:p.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"memory_points",children:"个人印象"}),r.jsx(vn,{id:"memory_points",value:l.memory_points||"",onChange:p=>o({...l,memory_points:p.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{children:[r.jsx(Q,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),r.jsx(gt,{id:"is_known",checked:l.is_known,onCheckedChange:p=>o({...l,is_known:p})})]})]}),r.jsxs(Yr,{children:[r.jsx(re,{variant:"outline",onClick:()=>n(!1),children:"取消"}),r.jsx(re,{onClick:f,disabled:c,children:c?"保存中...":"保存"})]})]})}):null}function vU(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}const yU={},ru={};function ci(e,t){try{const a=(yU[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];return a in ru?ru[a]:d5(a,a.split(":"))}catch{if(e in ru)return ru[e];const n=e?.match(bU);return n?d5(e,n.slice(1)):NaN}}const bU=/([+-]\d\d):?(\d\d)?/;function d5(e,t){const n=+(t[0]||0),a=+(t[1]||0),l=+(t[2]||0)/60;return ru[e]=n*60+a>0?n*60+a+l:n*60-a-l}class ns extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(ci(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),i9(this),t1(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new ns(...n,t):new ns(Date.now(),t)}withTimeZone(t){return new ns(+this,t)}getTimezoneOffset(){const t=-ci(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),t1(this),+this}[Symbol.for("constructDateFrom")](t){return new ns(+new Date(t),this.timeZone)}}const m5=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!m5.test(e))return;const t=e.replace(m5,"$1UTC");ns.prototype[t]&&(e.startsWith("get")?ns.prototype[e]=function(){return this.internal[t]()}:(ns.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),wU(this),+this},ns.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),t1(this),+this}))});function t1(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-ci(e.timeZone,e)*60))}function wU(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),i9(e)}function i9(e){const t=ci(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),a=new Date(+e);a.setUTCHours(a.getUTCHours()-1);const l=-new Date(+e).getTimezoneOffset(),o=-new Date(+a).getTimezoneOffset(),c=l-o,d=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();c&&d&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+c);const m=l-n;m&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+m);const f=new Date(+e);f.setUTCSeconds(0);const p=l>0?f.getSeconds():(f.getSeconds()-60)%60,x=Math.round(-(ci(e.timeZone,e)*60))%60;(x||p)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+x),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+x+p));const y=ci(e.timeZone,e),b=y>0?Math.floor(y):Math.ceil(y),k=-new Date(+e).getTimezoneOffset()-b,S=b!==n,_=k-m;if(S&&_){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+_);const M=ci(e.timeZone,e),D=M>0?Math.floor(M):Math.ceil(M),z=b-D;z&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+z),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+z))}}class xr extends ns{static tz(t,...n){return n.length?new xr(...n,t):new xr(Date.now(),t)}toISOString(){const[t,n,a]=this.tzComponents(),l=`${t}${n}:${a}`;return this.internal.toISOString().slice(0,-1)+l}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,a,l]=this.internal.toUTCString().split(" ");return`${t?.slice(0,-1)} ${a} ${n} ${l}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,a,l]=this.tzComponents();return`${t} GMT${n}${a}${l} (${vU(this.timeZone,this)})`}toLocaleString(t,n){return Date.prototype.toLocaleString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(t,n){return Date.prototype.toLocaleDateString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(t,n){return Date.prototype.toLocaleTimeString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),n=t>0?"-":"+",a=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),l=String(Math.abs(t)%60).padStart(2,"0");return[n,a,l]}withTimeZone(t){return new xr(+this,t)}[Symbol.for("constructDateFrom")](t){return new xr(+new Date(t),this.timeZone)}}const o9=6048e5,jU=864e5,h5=Symbol.for("constructDateFrom");function $n(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&h5 in e?e[h5](t):e instanceof Date?new e.constructor(t):new Date(t)}function un(e,t){return $n(t||e,e)}function c9(e,t,n){const a=un(e,n?.in);return isNaN(t)?$n(e,NaN):(t&&a.setDate(a.getDate()+t),a)}function u9(e,t,n){const a=un(e,n?.in);if(isNaN(t))return $n(e,NaN);if(!t)return a;const l=a.getDate(),o=$n(e,a.getTime());o.setMonth(a.getMonth()+t+1,0);const c=o.getDate();return l>=c?o:(a.setFullYear(o.getFullYear(),o.getMonth(),l),a)}let NU={};function Xu(){return NU}function Al(e,t){const n=Xu(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,l=un(e,t?.in),o=l.getDay(),c=(o=o.getTime()?a+1:n.getTime()>=d.getTime()?a:a-1}function f5(e){const t=un(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Ti(e,...t){const n=$n.bind(null,e||t.find(a=>typeof a=="object"));return t.map(n)}function Nu(e,t){const n=un(e,t?.in);return n.setHours(0,0,0,0),n}function m9(e,t,n){const[a,l]=Ti(n?.in,e,t),o=Nu(a),c=Nu(l),d=+o-f5(o),m=+c-f5(c);return Math.round((d-m)/jU)}function SU(e,t){const n=d9(e,t),a=$n(e,0);return a.setFullYear(n,0,4),a.setHours(0,0,0,0),ju(a)}function kU(e,t,n){return c9(e,t*7,n)}function CU(e,t,n){return u9(e,t*12,n)}function TU(e,t){let n,a=t?.in;return e.forEach(l=>{!a&&typeof l=="object"&&(a=$n.bind(null,l));const o=un(l,a);(!n||n{!a&&typeof l=="object"&&(a=$n.bind(null,l));const o=un(l,a);(!n||n>o||isNaN(+o))&&(n=o)}),$n(a,n||NaN)}function MU(e,t,n){const[a,l]=Ti(n?.in,e,t);return+Nu(a)==+Nu(l)}function h9(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function EU(e){return!(!h9(e)&&typeof e!="number"||isNaN(+un(e)))}function AU(e,t,n){const[a,l]=Ti(n?.in,e,t),o=a.getFullYear()-l.getFullYear(),c=a.getMonth()-l.getMonth();return o*12+c}function DU(e,t){const n=un(e,t?.in),a=n.getMonth();return n.setFullYear(n.getFullYear(),a+1,0),n.setHours(23,59,59,999),n}function f9(e,t){const[n,a]=Ti(e,t.start,t.end);return{start:n,end:a}}function zU(e,t){const{start:n,end:a}=f9(t?.in,e);let l=+n>+a;const o=l?+n:+a,c=l?a:n;c.setHours(0,0,0,0),c.setDate(1);let d=1;const m=[];for(;+c<=o;)m.push($n(n,c)),c.setMonth(c.getMonth()+d);return l?m.reverse():m}function OU(e,t){const n=un(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function RU(e,t){const n=un(e,t?.in),a=n.getFullYear();return n.setFullYear(a+1,0,0),n.setHours(23,59,59,999),n}function p9(e,t){const n=un(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function BU(e,t){const{start:n,end:a}=f9(t?.in,e);let l=+n>+a;const o=l?+n:+a,c=l?a:n;c.setHours(0,0,0,0),c.setMonth(0,1);let d=1;const m=[];for(;+c<=o;)m.push($n(n,c)),c.setFullYear(c.getFullYear()+d);return l?m.reverse():m}function x9(e,t){const n=Xu(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,l=un(e,t?.in),o=l.getDay(),c=(o{let a;const l=PU[e];return typeof l=="string"?a=l:t===1?a=l.one:a=l.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a};function Oo(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const IU={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},qU={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},HU={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},UU={date:Oo({formats:IU,defaultWidth:"full"}),time:Oo({formats:qU,defaultWidth:"full"}),dateTime:Oo({formats:HU,defaultWidth:"full"})},$U={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},VU=(e,t,n,a)=>$U[e];function Za(e){return(t,n)=>{const a=n?.context?String(n.context):"standalone";let l;if(a==="formatting"&&e.formattingValues){const c=e.defaultFormattingWidth||e.defaultWidth,d=n?.width?String(n.width):c;l=e.formattingValues[d]||e.formattingValues[c]}else{const c=e.defaultWidth,d=n?.width?String(n.width):e.defaultWidth;l=e.values[d]||e.values[c]}const o=e.argumentCallback?e.argumentCallback(t):t;return l[o]}}const GU={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},YU={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},WU={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},XU={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},KU={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},QU={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ZU=(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},JU={ordinalNumber:ZU,era:Za({values:GU,defaultWidth:"wide"}),quarter:Za({values:YU,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Za({values:WU,defaultWidth:"wide"}),day:Za({values:XU,defaultWidth:"wide"}),dayPeriod:Za({values:KU,defaultWidth:"wide",formattingValues:QU,defaultFormattingWidth:"wide"})};function Ja(e){return(t,n={})=>{const a=n.width,l=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],o=t.match(l);if(!o)return null;const c=o[0],d=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],m=Array.isArray(d)?t$(d,x=>x.test(c)):e$(d,x=>x.test(c));let f;f=e.valueCallback?e.valueCallback(m):m,f=n.valueCallback?n.valueCallback(f):f;const p=t.slice(c.length);return{value:f,rest:p}}}function e$(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function t$(e,t){for(let n=0;n{const a=t.match(e.matchPattern);if(!a)return null;const l=a[0],o=t.match(e.parsePattern);if(!o)return null;let c=e.valueCallback?e.valueCallback(o[0]):o[0];c=n.valueCallback?n.valueCallback(c):c;const d=t.slice(l.length);return{value:c,rest:d}}}const n$=/^(\d+)(th|st|nd|rd)?/i,r$=/\d+/i,a$={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},s$={any:[/^b/i,/^(a|c)/i]},l$={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},i$={any:[/1/i,/2/i,/3/i,/4/i]},o$={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},c$={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},u$={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},d$={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},m$={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},h$={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},f$={ordinalNumber:g9({matchPattern:n$,parsePattern:r$,valueCallback:e=>parseInt(e,10)}),era:Ja({matchPatterns:a$,defaultMatchWidth:"wide",parsePatterns:s$,defaultParseWidth:"any"}),quarter:Ja({matchPatterns:l$,defaultMatchWidth:"wide",parsePatterns:i$,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ja({matchPatterns:o$,defaultMatchWidth:"wide",parsePatterns:c$,defaultParseWidth:"any"}),day:Ja({matchPatterns:u$,defaultMatchWidth:"wide",parsePatterns:d$,defaultParseWidth:"any"}),dayPeriod:Ja({matchPatterns:m$,defaultMatchWidth:"any",parsePatterns:h$,defaultParseWidth:"any"})},Cg={code:"en-US",formatDistance:FU,formatLong:UU,formatRelative:VU,localize:JU,match:f$,options:{weekStartsOn:0,firstWeekContainsDate:1}};function p$(e,t){const n=un(e,t?.in);return m9(n,p9(n))+1}function v9(e,t){const n=un(e,t?.in),a=+ju(n)-+SU(n);return Math.round(a/o9)+1}function y9(e,t){const n=un(e,t?.in),a=n.getFullYear(),l=Xu(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??l.firstWeekContainsDate??l.locale?.options?.firstWeekContainsDate??1,c=$n(t?.in||e,0);c.setFullYear(a+1,0,o),c.setHours(0,0,0,0);const d=Al(c,t),m=$n(t?.in||e,0);m.setFullYear(a,0,o),m.setHours(0,0,0,0);const f=Al(m,t);return+n>=+d?a+1:+n>=+f?a:a-1}function x$(e,t){const n=Xu(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,l=y9(e,t),o=$n(t?.in||e,0);return o.setFullYear(l,0,a),o.setHours(0,0,0,0),Al(o,t)}function b9(e,t){const n=un(e,t?.in),a=+Al(n,t)-+x$(n,t);return Math.round(a/o9)+1}function Wt(e,t){const n=e<0?"-":"",a=Math.abs(e).toString().padStart(t,"0");return n+a}const bl={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return Wt(t==="yy"?a%100:a,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):Wt(n+1,2)},d(e,t){return Wt(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return Wt(e.getHours()%12||12,t.length)},H(e,t){return Wt(e.getHours(),t.length)},m(e,t){return Wt(e.getMinutes(),t.length)},s(e,t){return Wt(e.getSeconds(),t.length)},S(e,t){const n=t.length,a=e.getMilliseconds(),l=Math.trunc(a*Math.pow(10,n-3));return Wt(l,t.length)}},wo={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},p5={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});case"GGGG":default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const a=e.getFullYear(),l=a>0?a:1-a;return n.ordinalNumber(l,{unit:"year"})}return bl.y(e,t)},Y:function(e,t,n,a){const l=y9(e,a),o=l>0?l:1-l;if(t==="YY"){const c=o%100;return Wt(c,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):Wt(o,t.length)},R:function(e,t){const n=d9(e);return Wt(n,t.length)},u:function(e,t){const n=e.getFullYear();return Wt(n,t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return Wt(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return Wt(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return bl.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return Wt(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const l=b9(e,a);return t==="wo"?n.ordinalNumber(l,{unit:"week"}):Wt(l,t.length)},I:function(e,t,n){const a=v9(e);return t==="Io"?n.ordinalNumber(a,{unit:"week"}):Wt(a,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):bl.d(e,t)},D:function(e,t,n){const a=p$(e);return t==="Do"?n.ordinalNumber(a,{unit:"dayOfYear"}):Wt(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});case"EEEE":default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const l=e.getDay(),o=(l-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return Wt(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(l,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(l,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(l,{width:"short",context:"formatting"});case"eeee":default:return n.day(l,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const l=e.getDay(),o=(l-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return Wt(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(l,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(l,{width:"narrow",context:"standalone"});case"cccccc":return n.day(l,{width:"short",context:"standalone"});case"cccc":default:return n.day(l,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),l=a===0?7:a;switch(t){case"i":return String(l);case"ii":return Wt(l,t.length);case"io":return n.ordinalNumber(l,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});case"iiii":default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const l=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let l;switch(a===12?l=wo.noon:a===0?l=wo.midnight:l=a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let l;switch(a>=17?l=wo.evening:a>=12?l=wo.afternoon:a>=4?l=wo.morning:l=wo.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let a=e.getHours()%12;return a===0&&(a=12),n.ordinalNumber(a,{unit:"hour"})}return bl.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):bl.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return t==="Ko"?n.ordinalNumber(a,{unit:"hour"}):Wt(a,t.length)},k:function(e,t,n){let a=e.getHours();return a===0&&(a=24),t==="ko"?n.ordinalNumber(a,{unit:"hour"}):Wt(a,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):bl.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):bl.s(e,t)},S:function(e,t){return bl.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(a===0)return"Z";switch(t){case"X":return g5(a);case"XXXX":case"XX":return ii(a);case"XXXXX":case"XXX":default:return ii(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return g5(a);case"xxxx":case"xx":return ii(a);case"xxxxx":case"xxx":default:return ii(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+x5(a,":");case"OOOO":default:return"GMT"+ii(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+x5(a,":");case"zzzz":default:return"GMT"+ii(a,":")}},t:function(e,t,n){const a=Math.trunc(+e/1e3);return Wt(a,t.length)},T:function(e,t,n){return Wt(+e,t.length)}};function x5(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),l=Math.trunc(a/60),o=a%60;return o===0?n+String(l):n+String(l)+t+Wt(o,2)}function g5(e,t){return e%60===0?(e>0?"-":"+")+Wt(Math.abs(e)/60,2):ii(e,t)}function ii(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),l=Wt(Math.trunc(a/60),2),o=Wt(a%60,2);return n+l+t+o}const v5=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},w9=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},g$=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],l=n[2];if(!l)return v5(e,t);let o;switch(a){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",v5(a,t)).replace("{{time}}",w9(l,t))},v$={p:w9,P:g$},y$=/^D+$/,b$=/^Y+$/,w$=["D","DD","YY","YYYY"];function j$(e){return y$.test(e)}function N$(e){return b$.test(e)}function S$(e,t,n){const a=k$(e,t,n);if(console.warn(a),w$.includes(e))throw new RangeError(a)}function k$(e,t,n){const a=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const C$=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,T$=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,_$=/^'([^]*?)'?$/,M$=/''/g,E$=/[a-zA-Z]/;function X0(e,t,n){const a=Xu(),l=n?.locale??a.locale??Cg,o=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,c=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,d=un(e,n?.in);if(!EU(d))throw new RangeError("Invalid time value");let m=t.match(T$).map(p=>{const x=p[0];if(x==="p"||x==="P"){const y=v$[x];return y(p,l.formatLong)}return p}).join("").match(C$).map(p=>{if(p==="''")return{isToken:!1,value:"'"};const x=p[0];if(x==="'")return{isToken:!1,value:A$(p)};if(p5[x])return{isToken:!0,value:p};if(x.match(E$))throw new RangeError("Format string contains an unescaped latin alphabet character `"+x+"`");return{isToken:!1,value:p}});l.localize.preprocessor&&(m=l.localize.preprocessor(d,m));const f={firstWeekContainsDate:o,weekStartsOn:c,locale:l};return m.map(p=>{if(!p.isToken)return p.value;const x=p.value;(!n?.useAdditionalWeekYearTokens&&N$(x)||!n?.useAdditionalDayOfYearTokens&&j$(x))&&S$(x,t,String(e));const y=p5[x[0]];return y(d,x,l.localize,f)}).join("")}function A$(e){const t=e.match(_$);return t?t[1].replace(M$,"'"):e}function D$(e,t){const n=un(e,t?.in),a=n.getFullYear(),l=n.getMonth(),o=$n(n,0);return o.setFullYear(a,l+1,0),o.setHours(0,0,0,0),o.getDate()}function z$(e,t){return un(e,t?.in).getMonth()}function O$(e,t){return un(e,t?.in).getFullYear()}function R$(e,t){return+un(e)>+un(t)}function B$(e,t){return+un(e)<+un(t)}function L$(e,t,n){const[a,l]=Ti(n?.in,e,t);return+Al(a,n)==+Al(l,n)}function P$(e,t,n){const[a,l]=Ti(n?.in,e,t);return a.getFullYear()===l.getFullYear()&&a.getMonth()===l.getMonth()}function F$(e,t,n){const[a,l]=Ti(n?.in,e,t);return a.getFullYear()===l.getFullYear()}function I$(e,t,n){const a=un(e,n?.in),l=a.getFullYear(),o=a.getDate(),c=$n(e,0);c.setFullYear(l,t,15),c.setHours(0,0,0,0);const d=D$(c);return a.setMonth(t,Math.min(o,d)),a}function q$(e,t,n){const a=un(e,n?.in);return isNaN(+a)?$n(e,NaN):(a.setFullYear(t),a)}const y5=5,H$=4;function U$(e,t){const n=t.startOfMonth(e),a=n.getDay()>0?n.getDay():7,l=t.addDays(e,-a+1),o=t.addDays(l,y5*7-1);return t.getMonth(e)===t.getMonth(o)?y5:H$}function j9(e,t){const n=t.startOfMonth(e),a=n.getDay();return a===1?n:a===0?t.addDays(n,-6):t.addDays(n,-1*(a-1))}function $$(e,t){const n=j9(e,t),a=U$(e,t);return t.addDays(n,a*7-1)}class ma{constructor(t,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?xr.tz(this.options.timeZone):new this.Date,this.newDate=(a,l,o)=>this.overrides?.newDate?this.overrides.newDate(a,l,o):this.options.timeZone?new xr(a,l,o,this.options.timeZone):new Date(a,l,o),this.addDays=(a,l)=>this.overrides?.addDays?this.overrides.addDays(a,l):c9(a,l),this.addMonths=(a,l)=>this.overrides?.addMonths?this.overrides.addMonths(a,l):u9(a,l),this.addWeeks=(a,l)=>this.overrides?.addWeeks?this.overrides.addWeeks(a,l):kU(a,l),this.addYears=(a,l)=>this.overrides?.addYears?this.overrides.addYears(a,l):CU(a,l),this.differenceInCalendarDays=(a,l)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(a,l):m9(a,l),this.differenceInCalendarMonths=(a,l)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(a,l):AU(a,l),this.eachMonthOfInterval=a=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(a):zU(a),this.eachYearOfInterval=a=>{const l=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(a):BU(a),o=new Set(l.map(d=>this.getYear(d)));if(o.size===l.length)return l;const c=[];return o.forEach(d=>{c.push(new Date(d,0,1))}),c},this.endOfBroadcastWeek=a=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(a):$$(a,this),this.endOfISOWeek=a=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(a):LU(a),this.endOfMonth=a=>this.overrides?.endOfMonth?this.overrides.endOfMonth(a):DU(a),this.endOfWeek=(a,l)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(a,l):x9(a,this.options),this.endOfYear=a=>this.overrides?.endOfYear?this.overrides.endOfYear(a):RU(a),this.format=(a,l,o)=>{const c=this.overrides?.format?this.overrides.format(a,l,this.options):X0(a,l,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(c):c},this.getISOWeek=a=>this.overrides?.getISOWeek?this.overrides.getISOWeek(a):v9(a),this.getMonth=(a,l)=>this.overrides?.getMonth?this.overrides.getMonth(a,this.options):z$(a,this.options),this.getYear=(a,l)=>this.overrides?.getYear?this.overrides.getYear(a,this.options):O$(a,this.options),this.getWeek=(a,l)=>this.overrides?.getWeek?this.overrides.getWeek(a,this.options):b9(a,this.options),this.isAfter=(a,l)=>this.overrides?.isAfter?this.overrides.isAfter(a,l):R$(a,l),this.isBefore=(a,l)=>this.overrides?.isBefore?this.overrides.isBefore(a,l):B$(a,l),this.isDate=a=>this.overrides?.isDate?this.overrides.isDate(a):h9(a),this.isSameDay=(a,l)=>this.overrides?.isSameDay?this.overrides.isSameDay(a,l):MU(a,l),this.isSameMonth=(a,l)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(a,l):P$(a,l),this.isSameYear=(a,l)=>this.overrides?.isSameYear?this.overrides.isSameYear(a,l):F$(a,l),this.max=a=>this.overrides?.max?this.overrides.max(a):TU(a),this.min=a=>this.overrides?.min?this.overrides.min(a):_U(a),this.setMonth=(a,l)=>this.overrides?.setMonth?this.overrides.setMonth(a,l):I$(a,l),this.setYear=(a,l)=>this.overrides?.setYear?this.overrides.setYear(a,l):q$(a,l),this.startOfBroadcastWeek=(a,l)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(a,this):j9(a,this),this.startOfDay=a=>this.overrides?.startOfDay?this.overrides.startOfDay(a):Nu(a),this.startOfISOWeek=a=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(a):ju(a),this.startOfMonth=a=>this.overrides?.startOfMonth?this.overrides.startOfMonth(a):OU(a),this.startOfWeek=(a,l)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(a,this.options):Al(a,this.options),this.startOfYear=a=>this.overrides?.startOfYear?this.overrides.startOfYear(a):p9(a),this.options={locale:Cg,...t},this.overrides=n}getDigitMap(){const{numerals:t="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:t}),a={};for(let l=0;l<10;l++)a[l.toString()]=n.format(l);return a}replaceDigits(t){const n=this.getDigitMap();return t.replace(/\d/g,a=>n[a]||a)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){const t=this.options.locale?.code;return t&&ma.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:n,timeZone:a,numerals:l}=this.options,o=n?.code;if(o&&ma.yearFirstLocales.has(o))try{return new Intl.DateTimeFormat(o,{month:"long",year:"numeric",timeZone:a,numberingSystem:l}).format(t)}catch{}const c=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,c)}}ma.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const cs=new ma;class N9{constructor(t,n,a=cs){this.date=t,this.displayMonth=n,this.outside=!!(n&&!a.isSameMonth(t,n)),this.dateLib=a}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class V${constructor(t,n){this.date=t,this.weeks=n}}class G${constructor(t,n){this.days=n,this.weekNumber=t}}function Y$(e){return Fe.createElement("button",{...e})}function W$(e){return Fe.createElement("span",{...e})}function X$(e){const{size:t=24,orientation:n="left",className:a}=e;return Fe.createElement("svg",{className:a,width:t,height:t,viewBox:"0 0 24 24"},n==="up"&&Fe.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&Fe.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&Fe.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&Fe.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function K$(e){const{day:t,modifiers:n,...a}=e;return Fe.createElement("td",{...a})}function Q$(e){const{day:t,modifiers:n,...a}=e,l=Fe.useRef(null);return Fe.useEffect(()=>{n.focused&&l.current?.focus()},[n.focused]),Fe.createElement("button",{ref:l,...a})}var Xe;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(Xe||(Xe={}));var Tn;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(Tn||(Tn={}));var Fa;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(Fa||(Fa={}));var oa;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(oa||(oa={}));function Z$(e){const{options:t,className:n,components:a,classNames:l,...o}=e,c=[l[Xe.Dropdown],n].join(" "),d=t?.find(({value:m})=>m===o.value);return Fe.createElement("span",{"data-disabled":o.disabled,className:l[Xe.DropdownRoot]},Fe.createElement(a.Select,{className:c,...o},t?.map(({value:m,label:f,disabled:p})=>Fe.createElement(a.Option,{key:m,value:m,disabled:p},f))),Fe.createElement("span",{className:l[Xe.CaptionLabel],"aria-hidden":!0},d?.label,Fe.createElement(a.Chevron,{orientation:"down",size:18,className:l[Xe.Chevron]})))}function J$(e){return Fe.createElement("div",{...e})}function eV(e){return Fe.createElement("div",{...e})}function tV(e){const{calendarMonth:t,displayIndex:n,...a}=e;return Fe.createElement("div",{...a},e.children)}function nV(e){const{calendarMonth:t,displayIndex:n,...a}=e;return Fe.createElement("div",{...a})}function rV(e){return Fe.createElement("table",{...e})}function aV(e){return Fe.createElement("div",{...e})}const S9=w.createContext(void 0);function Ku(){const e=w.useContext(S9);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function sV(e){const{components:t}=Ku();return Fe.createElement(t.Dropdown,{...e})}function lV(e){const{onPreviousClick:t,onNextClick:n,previousMonth:a,nextMonth:l,...o}=e,{components:c,classNames:d,labels:{labelPrevious:m,labelNext:f}}=Ku(),p=w.useCallback(y=>{l&&n?.(y)},[l,n]),x=w.useCallback(y=>{a&&t?.(y)},[a,t]);return Fe.createElement("nav",{...o},Fe.createElement(c.PreviousMonthButton,{type:"button",className:d[Xe.PreviousMonthButton],tabIndex:a?void 0:-1,"aria-disabled":a?void 0:!0,"aria-label":m(a),onClick:x},Fe.createElement(c.Chevron,{disabled:a?void 0:!0,className:d[Xe.Chevron],orientation:"left"})),Fe.createElement(c.NextMonthButton,{type:"button",className:d[Xe.NextMonthButton],tabIndex:l?void 0:-1,"aria-disabled":l?void 0:!0,"aria-label":f(l),onClick:p},Fe.createElement(c.Chevron,{disabled:l?void 0:!0,orientation:"right",className:d[Xe.Chevron]})))}function iV(e){const{components:t}=Ku();return Fe.createElement(t.Button,{...e})}function oV(e){return Fe.createElement("option",{...e})}function cV(e){const{components:t}=Ku();return Fe.createElement(t.Button,{...e})}function uV(e){const{rootRef:t,...n}=e;return Fe.createElement("div",{...n,ref:t})}function dV(e){return Fe.createElement("select",{...e})}function mV(e){const{week:t,...n}=e;return Fe.createElement("tr",{...n})}function hV(e){return Fe.createElement("th",{...e})}function fV(e){return Fe.createElement("thead",{"aria-hidden":!0},Fe.createElement("tr",{...e}))}function pV(e){const{week:t,...n}=e;return Fe.createElement("th",{...n})}function xV(e){return Fe.createElement("th",{...e})}function gV(e){return Fe.createElement("tbody",{...e})}function vV(e){const{components:t}=Ku();return Fe.createElement(t.Dropdown,{...e})}const yV=Object.freeze(Object.defineProperty({__proto__:null,Button:Y$,CaptionLabel:W$,Chevron:X$,Day:K$,DayButton:Q$,Dropdown:Z$,DropdownNav:J$,Footer:eV,Month:tV,MonthCaption:nV,MonthGrid:rV,Months:aV,MonthsDropdown:sV,Nav:lV,NextMonthButton:iV,Option:oV,PreviousMonthButton:cV,Root:uV,Select:dV,Week:mV,WeekNumber:pV,WeekNumberHeader:xV,Weekday:hV,Weekdays:fV,Weeks:gV,YearsDropdown:vV},Symbol.toStringTag,{value:"Module"}));function Ds(e,t,n=!1,a=cs){let{from:l,to:o}=e;const{differenceInCalendarDays:c,isSameDay:d}=a;return l&&o?(c(o,l)<0&&([l,o]=[o,l]),c(t,l)>=(n?1:0)&&c(o,t)>=(n?1:0)):!n&&o?d(o,t):!n&&l?d(l,t):!1}function k9(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function Tg(e){return!!(e&&typeof e=="object"&&"from"in e)}function C9(e){return!!(e&&typeof e=="object"&&"after"in e)}function T9(e){return!!(e&&typeof e=="object"&&"before"in e)}function _9(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function M9(e,t){return Array.isArray(e)&&e.every(t.isDate)}function zs(e,t,n=cs){const a=Array.isArray(t)?t:[t],{isSameDay:l,differenceInCalendarDays:o,isAfter:c}=n;return a.some(d=>{if(typeof d=="boolean")return d;if(n.isDate(d))return l(e,d);if(M9(d,n))return d.includes(e);if(Tg(d))return Ds(d,e,!1,n);if(_9(d))return Array.isArray(d.dayOfWeek)?d.dayOfWeek.includes(e.getDay()):d.dayOfWeek===e.getDay();if(k9(d)){const m=o(d.before,e),f=o(d.after,e),p=m>0,x=f<0;return c(d.before,d.after)?x&&p:p||x}return C9(d)?o(e,d.after)>0:T9(d)?o(d.before,e)>0:typeof d=="function"?d(e):!1})}function bV(e,t,n,a,l){const{disabled:o,hidden:c,modifiers:d,showOutsideDays:m,broadcastCalendar:f,today:p}=t,{isSameDay:x,isSameMonth:y,startOfMonth:b,isBefore:j,endOfMonth:k,isAfter:S}=l,_=n&&b(n),M=a&&k(a),D={[Tn.focused]:[],[Tn.outside]:[],[Tn.disabled]:[],[Tn.hidden]:[],[Tn.today]:[]},z={};for(const L of e){const{date:E,displayMonth:R}=L,H=!!(R&&!y(E,R)),$=!!(_&&j(E,_)),I=!!(M&&S(E,M)),G=!!(o&&zs(E,o,l)),te=!!(c&&zs(E,c,l))||$||I||!f&&!m&&H||f&&m===!1&&H,we=x(E,p??l.today());H&&D.outside.push(L),G&&D.disabled.push(L),te&&D.hidden.push(L),we&&D.today.push(L),d&&Object.keys(d).forEach(J=>{const ae=d?.[J];ae&&zs(E,ae,l)&&(z[J]?z[J].push(L):z[J]=[L])})}return L=>{const E={[Tn.focused]:!1,[Tn.disabled]:!1,[Tn.hidden]:!1,[Tn.outside]:!1,[Tn.today]:!1},R={};for(const H in D){const $=D[H];E[H]=$.some(I=>I===L)}for(const H in z)R[H]=z[H].some($=>$===L);return{...E,...R}}}function wV(e,t,n={}){return Object.entries(e).filter(([,l])=>l===!0).reduce((l,[o])=>(n[o]?l.push(n[o]):t[Tn[o]]?l.push(t[Tn[o]]):t[Fa[o]]&&l.push(t[Fa[o]]),l),[t[Xe.Day]])}function jV(e){return{...yV,...e}}function NV(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([n,a])=>{n.startsWith("data-")&&(t[n]=a)}),t}function _g(){const e={};for(const t in Xe)e[Xe[t]]=`rdp-${Xe[t]}`;for(const t in Tn)e[Tn[t]]=`rdp-${Tn[t]}`;for(const t in Fa)e[Fa[t]]=`rdp-${Fa[t]}`;for(const t in oa)e[oa[t]]=`rdp-${oa[t]}`;return e}function E9(e,t,n){return(n??new ma(t)).formatMonthYear(e)}const SV=E9;function kV(e,t,n){return(n??new ma(t)).format(e,"d")}function CV(e,t=cs){return t.format(e,"LLLL")}function TV(e,t,n){return(n??new ma(t)).format(e,"cccccc")}function _V(e,t=cs){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function MV(){return""}function A9(e,t=cs){return t.format(e,"yyyy")}const EV=A9,AV=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:E9,formatDay:kV,formatMonthCaption:SV,formatMonthDropdown:CV,formatWeekNumber:_V,formatWeekNumberHeader:MV,formatWeekdayName:TV,formatYearCaption:EV,formatYearDropdown:A9},Symbol.toStringTag,{value:"Module"}));function DV(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...AV,...e}}function zV(e,t,n,a,l){const{startOfMonth:o,startOfYear:c,endOfYear:d,eachMonthOfInterval:m,getMonth:f}=l;return m({start:c(e),end:d(e)}).map(y=>{const b=a.formatMonthDropdown(y,l),j=f(y),k=t&&yo(n)||!1;return{value:j,label:b,disabled:k}})}function OV(e,t={},n={}){let a={...t?.[Xe.Day]};return Object.entries(e).filter(([,l])=>l===!0).forEach(([l])=>{a={...a,...n?.[l]}}),a}function RV(e,t,n){const a=e.today(),l=t?e.startOfISOWeek(a):e.startOfWeek(a),o=[];for(let c=0;c<7;c++){const d=e.addDays(l,c);o.push(d)}return o}function BV(e,t,n,a,l=!1){if(!e||!t)return;const{startOfYear:o,endOfYear:c,eachYearOfInterval:d,getYear:m}=a,f=o(e),p=c(t),x=d({start:f,end:p});return l&&x.reverse(),x.map(y=>{const b=n.formatYearDropdown(y,a);return{value:m(y),label:b,disabled:!1}})}function D9(e,t,n,a){let l=(a??new ma(n)).format(e,"PPPP");return t.today&&(l=`Today, ${l}`),t.selected&&(l=`${l}, selected`),l}const LV=D9;function z9(e,t,n){return(n??new ma(t)).formatMonthYear(e)}const PV=z9;function FV(e,t,n,a){let l=(a??new ma(n)).format(e,"PPPP");return t?.today&&(l=`Today, ${l}`),l}function IV(e){return"Choose the Month"}function qV(){return""}function HV(e){return"Go to the Next Month"}function UV(e){return"Go to the Previous Month"}function $V(e,t,n){return(n??new ma(t)).format(e,"cccc")}function VV(e,t){return`Week ${e}`}function GV(e){return"Week Number"}function YV(e){return"Choose the Year"}const WV=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:PV,labelDay:LV,labelDayButton:D9,labelGrid:z9,labelGridcell:FV,labelMonthDropdown:IV,labelNav:qV,labelNext:HV,labelPrevious:UV,labelWeekNumber:VV,labelWeekNumberHeader:GV,labelWeekday:$V,labelYearDropdown:YV},Symbol.toStringTag,{value:"Module"})),Qu=e=>e instanceof HTMLElement?e:null,cx=e=>[...e.querySelectorAll("[data-animated-month]")??[]],XV=e=>Qu(e.querySelector("[data-animated-month]")),ux=e=>Qu(e.querySelector("[data-animated-caption]")),dx=e=>Qu(e.querySelector("[data-animated-weeks]")),KV=e=>Qu(e.querySelector("[data-animated-nav]")),QV=e=>Qu(e.querySelector("[data-animated-weekdays]"));function ZV(e,t,{classNames:n,months:a,focused:l,dateLib:o}){const c=w.useRef(null),d=w.useRef(a),m=w.useRef(!1);w.useLayoutEffect(()=>{const f=d.current;if(d.current=a,!t||!e.current||!(e.current instanceof HTMLElement)||a.length===0||f.length===0||a.length!==f.length)return;const p=o.isSameMonth(a[0].date,f[0].date),x=o.isAfter(a[0].date,f[0].date),y=x?n[oa.caption_after_enter]:n[oa.caption_before_enter],b=x?n[oa.weeks_after_enter]:n[oa.weeks_before_enter],j=c.current,k=e.current.cloneNode(!0);if(k instanceof HTMLElement?(cx(k).forEach(D=>{if(!(D instanceof HTMLElement))return;const z=XV(D);z&&D.contains(z)&&D.removeChild(z);const L=ux(D);L&&L.classList.remove(y);const E=dx(D);E&&E.classList.remove(b)}),c.current=k):c.current=null,m.current||p||l)return;const S=j instanceof HTMLElement?cx(j):[],_=cx(e.current);if(_?.every(M=>M instanceof HTMLElement)&&S&&S.every(M=>M instanceof HTMLElement)){m.current=!0,e.current.style.isolation="isolate";const M=KV(e.current);M&&(M.style.zIndex="1"),_.forEach((D,z)=>{const L=S[z];if(!L)return;D.style.position="relative",D.style.overflow="hidden";const E=ux(D);E&&E.classList.add(y);const R=dx(D);R&&R.classList.add(b);const H=()=>{m.current=!1,e.current&&(e.current.style.isolation=""),M&&(M.style.zIndex=""),E&&E.classList.remove(y),R&&R.classList.remove(b),D.style.position="",D.style.overflow="",D.contains(L)&&D.removeChild(L)};L.style.pointerEvents="none",L.style.position="absolute",L.style.overflow="hidden",L.setAttribute("aria-hidden","true");const $=QV(L);$&&($.style.opacity="0");const I=ux(L);I&&(I.classList.add(x?n[oa.caption_before_exit]:n[oa.caption_after_exit]),I.addEventListener("animationend",H));const G=dx(L);G&&G.classList.add(x?n[oa.weeks_before_exit]:n[oa.weeks_after_exit]),D.insertBefore(L,D.firstChild)})}})}function JV(e,t,n,a){const l=e[0],o=e[e.length-1],{ISOWeek:c,fixedWeeks:d,broadcastCalendar:m}=n??{},{addDays:f,differenceInCalendarDays:p,differenceInCalendarMonths:x,endOfBroadcastWeek:y,endOfISOWeek:b,endOfMonth:j,endOfWeek:k,isAfter:S,startOfBroadcastWeek:_,startOfISOWeek:M,startOfWeek:D}=a,z=m?_(l,a):c?M(l):D(l),L=m?y(o):c?b(j(o)):k(j(o)),E=p(L,z),R=x(o,l)+1,H=[];for(let G=0;G<=E;G++){const te=f(z,G);if(t&&S(te,t))break;H.push(te)}const I=(m?35:42)*R;if(d&&H.length{const l=a.weeks.reduce((o,c)=>o.concat(c.days.slice()),t.slice());return n.concat(l.slice())},t.slice())}function tG(e,t,n,a){const{numberOfMonths:l=1}=n,o=[];for(let c=0;ct)break;o.push(d)}return o}function b5(e,t,n,a){const{month:l,defaultMonth:o,today:c=a.today(),numberOfMonths:d=1}=e;let m=l||o||c;const{differenceInCalendarMonths:f,addMonths:p,startOfMonth:x}=a;if(n&&f(n,m){const _=n.broadcastCalendar?x(S,a):n.ISOWeek?y(S):b(S),M=n.broadcastCalendar?o(S):n.ISOWeek?c(d(S)):m(d(S)),D=t.filter(R=>R>=_&&R<=M),z=n.broadcastCalendar?35:42;if(n.fixedWeeks&&D.length{const $=z-D.length;return H>M&&H<=l(M,$)});D.push(...R)}const L=D.reduce((R,H)=>{const $=n.ISOWeek?f(H):p(H),I=R.find(te=>te.weekNumber===$),G=new N9(H,S,a);return I?I.days.push(G):R.push(new G$($,[G])),R},[]),E=new V$(S,L);return k.push(E),k},[]);return n.reverseMonths?j.reverse():j}function rG(e,t){let{startMonth:n,endMonth:a}=e;const{startOfYear:l,startOfDay:o,startOfMonth:c,endOfMonth:d,addYears:m,endOfYear:f,newDate:p,today:x}=t,{fromYear:y,toYear:b,fromMonth:j,toMonth:k}=e;!n&&j&&(n=j),!n&&y&&(n=t.newDate(y,0,1)),!a&&k&&(a=k),!a&&b&&(a=p(b,11,31));const S=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return n?n=c(n):y?n=p(y,0,1):!n&&S&&(n=l(m(e.today??x(),-100))),a?a=d(a):b?a=p(b,11,31):!a&&S&&(a=f(e.today??x())),[n&&o(n),a&&o(a)]}function aG(e,t,n,a){if(n.disableNavigation)return;const{pagedNavigation:l,numberOfMonths:o=1}=n,{startOfMonth:c,addMonths:d,differenceInCalendarMonths:m}=a,f=l?o:1,p=c(e);if(!t)return d(p,f);if(!(m(t,e)n.concat(a.weeks.slice()),t.slice())}function Km(e,t){const[n,a]=w.useState(e);return[t===void 0?n:t,a]}function iG(e,t){const[n,a]=rG(e,t),{startOfMonth:l,endOfMonth:o}=t,c=b5(e,n,a,t),[d,m]=Km(c,e.month?c:void 0);w.useEffect(()=>{const E=b5(e,n,a,t);m(E)},[e.timeZone]);const f=tG(d,a,e,t),p=JV(f,e.endMonth?o(e.endMonth):void 0,e,t),x=nG(f,p,e,t),y=lG(x),b=eG(x),j=sG(d,n,e,t),k=aG(d,a,e,t),{disableNavigation:S,onMonthChange:_}=e,M=E=>y.some(R=>R.days.some(H=>H.isEqualTo(E))),D=E=>{if(S)return;let R=l(E);n&&Rl(a)&&(R=l(a)),m(R),_?.(R)};return{months:x,weeks:y,days:b,navStart:n,navEnd:a,previousMonth:j,nextMonth:k,goToMonth:D,goToDay:E=>{M(E)||D(E.date)}}}var Ka;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(Ka||(Ka={}));function w5(e){return!e[Tn.disabled]&&!e[Tn.hidden]&&!e[Tn.outside]}function oG(e,t,n,a){let l,o=-1;for(const c of e){const d=t(c);w5(d)&&(d[Tn.focused]&&ow5(t(c)))),l}function cG(e,t,n,a,l,o,c){const{ISOWeek:d,broadcastCalendar:m}=o,{addDays:f,addMonths:p,addWeeks:x,addYears:y,endOfBroadcastWeek:b,endOfISOWeek:j,endOfWeek:k,max:S,min:_,startOfBroadcastWeek:M,startOfISOWeek:D,startOfWeek:z}=c;let E={day:f,week:x,month:p,year:y,startOfWeek:R=>m?M(R,c):d?D(R):z(R),endOfWeek:R=>m?b(R):d?j(R):k(R)}[e](n,t==="after"?1:-1);return t==="before"&&a?E=S([a,E]):t==="after"&&l&&(E=_([l,E])),E}function O9(e,t,n,a,l,o,c,d=0){if(d>365)return;const m=cG(e,t,n.date,a,l,o,c),f=!!(o.disabled&&zs(m,o.disabled,c)),p=!!(o.hidden&&zs(m,o.hidden,c)),x=m,y=new N9(m,x,c);return!f&&!p?y:O9(e,t,y,a,l,o,c,d+1)}function uG(e,t,n,a,l){const{autoFocus:o}=e,[c,d]=w.useState(),m=oG(t.days,n,a||(()=>!1),c),[f,p]=w.useState(o?m:void 0);return{isFocusTarget:k=>!!m?.isEqualTo(k),setFocused:p,focused:f,blur:()=>{d(f),p(void 0)},moveFocus:(k,S)=>{if(!f)return;const _=O9(k,S,f,t.navStart,t.navEnd,e,l);_&&(e.disableNavigation&&!t.days.some(D=>D.isEqualTo(_))||(t.goToDay(_),p(_)))}}}function dG(e,t){const{selected:n,required:a,onSelect:l}=e,[o,c]=Km(n,l?n:void 0),d=l?n:o,{isSameDay:m}=t,f=b=>d?.some(j=>m(j,b))??!1,{min:p,max:x}=e;return{selected:d,select:(b,j,k)=>{let S=[...d??[]];if(f(b)){if(d?.length===p||a&&d?.length===1)return;S=d?.filter(_=>!m(_,b))}else d?.length===x?S=[b]:S=[...S,b];return l||c(S),l?.(S,b,j,k),S},isSelected:f}}function mG(e,t,n=0,a=0,l=!1,o=cs){const{from:c,to:d}=t||{},{isSameDay:m,isAfter:f,isBefore:p}=o;let x;if(!c&&!d)x={from:e,to:n>0?void 0:e};else if(c&&!d)m(c,e)?n===0?x={from:c,to:e}:l?x={from:c,to:void 0}:x=void 0:p(e,c)?x={from:e,to:c}:x={from:c,to:e};else if(c&&d)if(m(c,e)&&m(d,e))l?x={from:c,to:d}:x=void 0;else if(m(c,e))x={from:c,to:n>0?void 0:e};else if(m(d,e))x={from:e,to:n>0?void 0:e};else if(p(e,c))x={from:e,to:d};else if(f(e,c))x={from:c,to:e};else if(f(e,d))x={from:c,to:e};else throw new Error("Invalid range");if(x?.from&&x?.to){const y=o.differenceInCalendarDays(x.to,x.from);a>0&&y>a?x={from:e,to:void 0}:n>1&&ytypeof d!="function").some(d=>typeof d=="boolean"?d:n.isDate(d)?Ds(e,d,!1,n):M9(d,n)?d.some(m=>Ds(e,m,!1,n)):Tg(d)?d.from&&d.to?j5(e,{from:d.from,to:d.to},n):!1:_9(d)?hG(e,d.dayOfWeek,n):k9(d)?n.isAfter(d.before,d.after)?j5(e,{from:n.addDays(d.after,1),to:n.addDays(d.before,-1)},n):zs(e.from,d,n)||zs(e.to,d,n):C9(d)||T9(d)?zs(e.from,d,n)||zs(e.to,d,n):!1))return!0;const c=a.filter(d=>typeof d=="function");if(c.length){let d=e.from;const m=n.differenceInCalendarDays(e.to,e.from);for(let f=0;f<=m;f++){if(c.some(p=>p(d)))return!0;d=n.addDays(d,1)}}return!1}function pG(e,t){const{disabled:n,excludeDisabled:a,selected:l,required:o,onSelect:c}=e,[d,m]=Km(l,c?l:void 0),f=c?l:d;return{selected:f,select:(y,b,j)=>{const{min:k,max:S}=e,_=y?mG(y,f,k,S,o,t):void 0;return a&&n&&_?.from&&_.to&&fG({from:_.from,to:_.to},n,t)&&(_.from=y,_.to=void 0),c||m(_),c?.(_,y,b,j),_},isSelected:y=>f&&Ds(f,y,!1,t)}}function xG(e,t){const{selected:n,required:a,onSelect:l}=e,[o,c]=Km(n,l?n:void 0),d=l?n:o,{isSameDay:m}=t;return{selected:d,select:(x,y,b)=>{let j=x;return!a&&d&&d&&m(x,d)&&(j=void 0),l||c(j),l?.(j,x,y,b),j},isSelected:x=>d?m(d,x):!1}}function gG(e,t){const n=xG(e,t),a=dG(e,t),l=pG(e,t);switch(e.mode){case"single":return n;case"multiple":return a;case"range":return l;default:return}}function vG(e){let t=e;t.timeZone&&(t={...e},t.today&&(t.today=new xr(t.today,t.timeZone)),t.month&&(t.month=new xr(t.month,t.timeZone)),t.defaultMonth&&(t.defaultMonth=new xr(t.defaultMonth,t.timeZone)),t.startMonth&&(t.startMonth=new xr(t.startMonth,t.timeZone)),t.endMonth&&(t.endMonth=new xr(t.endMonth,t.timeZone)),t.mode==="single"&&t.selected?t.selected=new xr(t.selected,t.timeZone):t.mode==="multiple"&&t.selected?t.selected=t.selected?.map(at=>new xr(at,t.timeZone)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?new xr(t.selected.from,t.timeZone):void 0,to:t.selected.to?new xr(t.selected.to,t.timeZone):void 0}));const{components:n,formatters:a,labels:l,dateLib:o,locale:c,classNames:d}=w.useMemo(()=>{const at={...Cg,...t.locale};return{dateLib:new ma({locale:at,weekStartsOn:t.broadcastCalendar?1:t.weekStartsOn,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},t.dateLib),components:jV(t.components),formatters:DV(t.formatters),labels:{...WV,...t.labels},locale:at,classNames:{..._g(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.components,t.formatters,t.labels,t.classNames]),{captionLayout:m,mode:f,navLayout:p,numberOfMonths:x=1,onDayBlur:y,onDayClick:b,onDayFocus:j,onDayKeyDown:k,onDayMouseEnter:S,onDayMouseLeave:_,onNextClick:M,onPrevClick:D,showWeekNumber:z,styles:L}=t,{formatCaption:E,formatDay:R,formatMonthDropdown:H,formatWeekNumber:$,formatWeekNumberHeader:I,formatWeekdayName:G,formatYearDropdown:te}=a,we=iG(t,o),{days:J,months:ae,navStart:U,navEnd:q,previousMonth:W,nextMonth:oe,goToMonth:P}=we,je=bV(J,t,U,q,o),{isSelected:Z,select:O,selected:Ne}=gG(t,o)??{},{blur:se,focused:Ce,isFocusTarget:ye,moveFocus:Be,setFocused:ie}=uG(t,we,je,Z??(()=>!1),o),{labelDayButton:He,labelGridcell:lt,labelGrid:ve,labelMonthDropdown:Ze,labelNav:We,labelPrevious:pn,labelNext:Bn,labelWeekday:sr,labelWeekNumber:Qe,labelWeekNumberHeader:Gn,labelYearDropdown:Sr}=l,Er=w.useMemo(()=>RV(o,t.ISOWeek),[o,t.ISOWeek]),Sn=f!==void 0||b!==void 0,lr=w.useCallback(()=>{W&&(P(W),D?.(W))},[W,P,D]),Ue=w.useCallback(()=>{oe&&(P(oe),M?.(oe))},[P,oe,M]),Ln=w.useCallback((at,xn)=>it=>{it.preventDefault(),it.stopPropagation(),ie(at),O?.(at.date,xn,it),b?.(at.date,xn,it)},[O,b,ie]),K=w.useCallback((at,xn)=>it=>{ie(at),j?.(at.date,xn,it)},[j,ie]),ge=w.useCallback((at,xn)=>it=>{se(),y?.(at.date,xn,it)},[se,y]),Oe=w.useCallback((at,xn)=>it=>{const Ut={ArrowLeft:[it.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[it.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[it.shiftKey?"year":"week","after"],ArrowUp:[it.shiftKey?"year":"week","before"],PageUp:[it.shiftKey?"year":"month","before"],PageDown:[it.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Ut[it.key]){it.preventDefault(),it.stopPropagation();const[Zn,bt]=Ut[it.key];Be(Zn,bt)}k?.(at.date,xn,it)},[Be,k,t.dir]),nt=w.useCallback((at,xn)=>it=>{S?.(at.date,xn,it)},[S]),kt=w.useCallback((at,xn)=>it=>{_?.(at.date,xn,it)},[_]),Qn=w.useCallback(at=>xn=>{const it=Number(xn.target.value),Ut=o.setMonth(o.startOfMonth(at),it);P(Ut)},[o,P]),Ar=w.useCallback(at=>xn=>{const it=Number(xn.target.value),Ut=o.setYear(o.startOfMonth(at),it);P(Ut)},[o,P]),{className:he,style:Me}=w.useMemo(()=>({className:[d[Xe.Root],t.className].filter(Boolean).join(" "),style:{...L?.[Xe.Root],...t.style}}),[d,t.className,t.style,L]),dt=NV(t),mt=w.useRef(null);ZV(mt,!!t.animate,{classNames:d,months:ae,focused:Ce,dateLib:o});const Dr={dayPickerProps:t,selected:Ne,select:O,isSelected:Z,months:ae,nextMonth:oe,previousMonth:W,goToMonth:P,getModifiers:je,components:n,classNames:d,styles:L,labels:l,formatters:a};return Fe.createElement(S9.Provider,{value:Dr},Fe.createElement(n.Root,{rootRef:t.animate?mt:void 0,className:he,style:Me,dir:t.dir,id:t.id,lang:t.lang,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...dt},Fe.createElement(n.Months,{className:d[Xe.Months],style:L?.[Xe.Months]},!t.hideNavigation&&!p&&Fe.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:d[Xe.Nav],style:L?.[Xe.Nav],"aria-label":We(),onPreviousClick:lr,onNextClick:Ue,previousMonth:W,nextMonth:oe}),ae.map((at,xn)=>Fe.createElement(n.Month,{"data-animated-month":t.animate?"true":void 0,className:d[Xe.Month],style:L?.[Xe.Month],key:xn,displayIndex:xn,calendarMonth:at},p==="around"&&!t.hideNavigation&&xn===0&&Fe.createElement(n.PreviousMonthButton,{type:"button",className:d[Xe.PreviousMonthButton],tabIndex:W?void 0:-1,"aria-disabled":W?void 0:!0,"aria-label":pn(W),onClick:lr,"data-animated-button":t.animate?"true":void 0},Fe.createElement(n.Chevron,{disabled:W?void 0:!0,className:d[Xe.Chevron],orientation:t.dir==="rtl"?"right":"left"})),Fe.createElement(n.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:d[Xe.MonthCaption],style:L?.[Xe.MonthCaption],calendarMonth:at,displayIndex:xn},m?.startsWith("dropdown")?Fe.createElement(n.DropdownNav,{className:d[Xe.Dropdowns],style:L?.[Xe.Dropdowns]},(()=>{const it=m==="dropdown"||m==="dropdown-months"?Fe.createElement(n.MonthsDropdown,{key:"month",className:d[Xe.MonthsDropdown],"aria-label":Ze(),classNames:d,components:n,disabled:!!t.disableNavigation,onChange:Qn(at.date),options:zV(at.date,U,q,a,o),style:L?.[Xe.Dropdown],value:o.getMonth(at.date)}):Fe.createElement("span",{key:"month"},H(at.date,o)),Ut=m==="dropdown"||m==="dropdown-years"?Fe.createElement(n.YearsDropdown,{key:"year",className:d[Xe.YearsDropdown],"aria-label":Sr(o.options),classNames:d,components:n,disabled:!!t.disableNavigation,onChange:Ar(at.date),options:BV(U,q,a,o,!!t.reverseYears),style:L?.[Xe.Dropdown],value:o.getYear(at.date)}):Fe.createElement("span",{key:"year"},te(at.date,o));return o.getMonthYearOrder()==="year-first"?[Ut,it]:[it,Ut]})(),Fe.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},E(at.date,o.options,o))):Fe.createElement(n.CaptionLabel,{className:d[Xe.CaptionLabel],role:"status","aria-live":"polite"},E(at.date,o.options,o))),p==="around"&&!t.hideNavigation&&xn===x-1&&Fe.createElement(n.NextMonthButton,{type:"button",className:d[Xe.NextMonthButton],tabIndex:oe?void 0:-1,"aria-disabled":oe?void 0:!0,"aria-label":Bn(oe),onClick:Ue,"data-animated-button":t.animate?"true":void 0},Fe.createElement(n.Chevron,{disabled:oe?void 0:!0,className:d[Xe.Chevron],orientation:t.dir==="rtl"?"left":"right"})),xn===x-1&&p==="after"&&!t.hideNavigation&&Fe.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:d[Xe.Nav],style:L?.[Xe.Nav],"aria-label":We(),onPreviousClick:lr,onNextClick:Ue,previousMonth:W,nextMonth:oe}),Fe.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":f==="multiple"||f==="range","aria-label":ve(at.date,o.options,o)||void 0,className:d[Xe.MonthGrid],style:L?.[Xe.MonthGrid]},!t.hideWeekdays&&Fe.createElement(n.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:d[Xe.Weekdays],style:L?.[Xe.Weekdays]},z&&Fe.createElement(n.WeekNumberHeader,{"aria-label":Gn(o.options),className:d[Xe.WeekNumberHeader],style:L?.[Xe.WeekNumberHeader],scope:"col"},I()),Er.map(it=>Fe.createElement(n.Weekday,{"aria-label":sr(it,o.options,o),className:d[Xe.Weekday],key:String(it),style:L?.[Xe.Weekday],scope:"col"},G(it,o.options,o)))),Fe.createElement(n.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:d[Xe.Weeks],style:L?.[Xe.Weeks]},at.weeks.map(it=>Fe.createElement(n.Week,{className:d[Xe.Week],key:it.weekNumber,style:L?.[Xe.Week],week:it},z&&Fe.createElement(n.WeekNumber,{week:it,style:L?.[Xe.WeekNumber],"aria-label":Qe(it.weekNumber,{locale:c}),className:d[Xe.WeekNumber],scope:"row",role:"rowheader"},$(it.weekNumber,o)),it.days.map(Ut=>{const{date:Zn}=Ut,bt=je(Ut);if(bt[Tn.focused]=!bt.hidden&&!!Ce?.isEqualTo(Ut),bt[Fa.selected]=Z?.(Zn)||bt.selected,Tg(Ne)){const{from:Ei,to:Fl}=Ne;bt[Fa.range_start]=!!(Ei&&Fl&&o.isSameDay(Zn,Ei)),bt[Fa.range_end]=!!(Ei&&Fl&&o.isSameDay(Zn,Fl)),bt[Fa.range_middle]=Ds(Ne,Zn,!0,o)}const Mi=OV(bt,L,t.modifiersStyles),Pl=wV(bt,d,t.modifiersClassNames),th=!Sn&&!bt.hidden?lt(Zn,bt,o.options,o):void 0;return Fe.createElement(n.Day,{key:`${o.format(Zn,"yyyy-MM-dd")}_${o.format(Ut.displayMonth,"yyyy-MM")}`,day:Ut,modifiers:bt,className:Pl.join(" "),style:Mi,role:"gridcell","aria-selected":bt.selected||void 0,"aria-label":th,"data-day":o.format(Zn,"yyyy-MM-dd"),"data-month":Ut.outside?o.format(Zn,"yyyy-MM"):void 0,"data-selected":bt.selected||void 0,"data-disabled":bt.disabled||void 0,"data-hidden":bt.hidden||void 0,"data-outside":Ut.outside||void 0,"data-focused":bt.focused||void 0,"data-today":bt.today||void 0},!bt.hidden&&Sn?Fe.createElement(n.DayButton,{className:d[Xe.DayButton],style:L?.[Xe.DayButton],type:"button",day:Ut,modifiers:bt,disabled:bt.disabled||void 0,tabIndex:ye(Ut)?0:-1,"aria-label":He(Zn,bt,o.options,o),onClick:Ln(Ut,bt),onBlur:ge(Ut,bt),onFocus:K(Ut,bt),onKeyDown:Oe(Ut,bt),onMouseEnter:nt(Ut,bt),onMouseLeave:kt(Ut,bt)},R(Zn,o.options,o)):!bt.hidden&&R(Ut.date,o.options,o))})))))))),t.footer&&Fe.createElement(n.Footer,{className:d[Xe.Footer],style:L?.[Xe.Footer],role:"status","aria-live":"polite"},t.footer)))}function N5({className:e,classNames:t,showOutsideDays:n=!0,captionLayout:a="label",buttonVariant:l="ghost",formatters:o,components:c,...d}){const m=_g();return r.jsx(vG,{showOutsideDays:n,className:me("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:a,formatters:{formatMonthDropdown:f=>f.toLocaleString("default",{month:"short"}),...o},classNames:{root:me("w-fit",m.root),months:me("relative flex flex-col gap-4 md:flex-row",m.months),month:me("flex w-full flex-col gap-4",m.month),nav:me("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",m.nav),button_previous:me(pu({variant:l}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",m.button_previous),button_next:me(pu({variant:l}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",m.button_next),month_caption:me("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",m.month_caption),dropdowns:me("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",m.dropdowns),dropdown_root:me("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",m.dropdown_root),dropdown:me("bg-popover absolute inset-0 opacity-0",m.dropdown),caption_label:me("select-none font-medium",a==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",m.caption_label),table:"w-full border-collapse",weekdays:me("flex",m.weekdays),weekday:me("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",m.weekday),week:me("mt-2 flex w-full",m.week),week_number_header:me("w-[--cell-size] select-none",m.week_number_header),week_number:me("text-muted-foreground select-none text-[0.8rem]",m.week_number),day:me("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",m.day),range_start:me("bg-accent rounded-l-md",m.range_start),range_middle:me("rounded-none",m.range_middle),range_end:me("bg-accent rounded-r-md",m.range_end),today:me("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",m.today),outside:me("text-muted-foreground aria-selected:text-muted-foreground",m.outside),disabled:me("text-muted-foreground opacity-50",m.disabled),hidden:me("invisible",m.hidden),...t},components:{Root:({className:f,rootRef:p,...x})=>r.jsx("div",{"data-slot":"calendar",ref:p,className:me(f),...x}),Chevron:({className:f,orientation:p,...x})=>p==="left"?r.jsx(vi,{className:me("size-4",f),...x}):p==="right"?r.jsx(yi,{className:me("size-4",f),...x}):r.jsx(hu,{className:me("size-4",f),...x}),DayButton:yG,WeekNumber:({children:f,...p})=>r.jsx("td",{...p,children:r.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:f})}),...c},...d})}function yG({className:e,day:t,modifiers:n,...a}){const l=_g(),o=w.useRef(null);return w.useEffect(()=>{n.focused&&o.current?.focus()},[n.focused]),r.jsx(re,{ref:o,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:me("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",l.day,e),...a})}class bG{ws=null;reconnectTimeout=null;reconnectAttempts=0;maxReconnectAttempts=10;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];maxCacheSize=1e3;getWebSocketUrl(){{const t=window.location.protocol==="https:"?"wss:":"ws:",n=window.location.host;return`${t}//${n}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const t=this.getWebSocketUrl();try{this.ws=new WebSocket(t),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=n=>{try{if(n.data==="pong")return;const a=JSON.parse(n.data);this.notifyLog(a)}catch(a){console.error("解析日志消息失败:",a)}},this.ws.onerror=n=>{console.error("❌ WebSocket 错误:",n),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(n){console.error("创建 WebSocket 连接失败:",n),this.attemptReconnect()}}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return;this.reconnectAttempts+=1;const t=Math.min(1e3*this.reconnectAttempts,1e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},t)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(t){return this.logCallbacks.add(t),()=>this.logCallbacks.delete(t)}onConnectionChange(t){return this.connectionCallbacks.add(t),t(this.isConnected),()=>this.connectionCallbacks.delete(t)}notifyLog(t){this.logCache.some(a=>a.id===t.id)||(this.logCache.push(t),this.logCache.length>this.maxCacheSize&&(this.logCache=this.logCache.slice(-this.maxCacheSize)),this.logCallbacks.forEach(a=>{try{a(t)}catch(l){console.error("日志回调执行失败:",l)}}))}notifyConnection(t){this.connectionCallbacks.forEach(n=>{try{n(t)}catch(a){console.error("连接状态回调执行失败:",a)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const To=new bG;typeof window<"u"&&To.connect();const wG={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},jG=(e,t,n)=>{let a;const l=wG[e];return typeof l=="string"?a=l:t===1?a=l.one:a=l.other.replace("{{count}}",String(t)),n?.addSuffix?n.comparison&&n.comparison>0?a+"内":a+"前":a},NG={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},SG={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},kG={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},CG={date:Oo({formats:NG,defaultWidth:"full"}),time:Oo({formats:SG,defaultWidth:"full"}),dateTime:Oo({formats:kG,defaultWidth:"full"})};function S5(e,t,n){const a="eeee p";return L$(e,t,n)?a:e.getTime()>t.getTime()?"'下个'"+a:"'上个'"+a}const TG={lastWeek:S5,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:S5,other:"PP p"},_G=(e,t,n,a)=>{const l=TG[e];return typeof l=="function"?l(t,n,a):l},MG={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},EG={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},AG={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},DG={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},zG={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},OG={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},RG=(e,t)=>{const n=Number(e);switch(t?.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},BG={ordinalNumber:RG,era:Za({values:MG,defaultWidth:"wide"}),quarter:Za({values:EG,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Za({values:AG,defaultWidth:"wide"}),day:Za({values:DG,defaultWidth:"wide"}),dayPeriod:Za({values:zG,defaultWidth:"wide",formattingValues:OG,defaultFormattingWidth:"wide"})},LG=/^(第\s*)?\d+(日|时|分|秒)?/i,PG=/\d+/i,FG={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},IG={any:[/^(前)/i,/^(公元)/i]},qG={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},HG={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},UG={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},$G={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},VG={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},GG={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},YG={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},WG={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},XG={ordinalNumber:g9({matchPattern:LG,parsePattern:PG,valueCallback:e=>parseInt(e,10)}),era:Ja({matchPatterns:FG,defaultMatchWidth:"wide",parsePatterns:IG,defaultParseWidth:"any"}),quarter:Ja({matchPatterns:qG,defaultMatchWidth:"wide",parsePatterns:HG,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ja({matchPatterns:UG,defaultMatchWidth:"wide",parsePatterns:$G,defaultParseWidth:"any"}),day:Ja({matchPatterns:VG,defaultMatchWidth:"wide",parsePatterns:GG,defaultParseWidth:"any"}),dayPeriod:Ja({matchPatterns:YG,defaultMatchWidth:"any",parsePatterns:WG,defaultParseWidth:"any"})},R0={code:"zh-CN",formatDistance:jG,formatLong:CG,formatRelative:_G,localize:BG,match:XG,options:{weekStartsOn:1,firstWeekContainsDate:4}};function KG(){const[e,t]=w.useState([]),[n,a]=w.useState(""),[l,o]=w.useState("all"),[c,d]=w.useState("all"),[m,f]=w.useState(void 0),[p,x]=w.useState(void 0),[y,b]=w.useState(!0),[j,k]=w.useState(!1),S=w.useRef(null),_=w.useRef(null);w.useEffect(()=>{const G=To.getAllLogs();t(G);const te=To.onLog(()=>{t(To.getAllLogs())}),we=To.onConnectionChange(J=>{k(J)});return()=>{te(),we()}},[]),w.useEffect(()=>{y&&_.current&&_.current.scrollIntoView({behavior:"smooth",block:"end"})},[e,y]);const M=w.useMemo(()=>{const G=new Set(e.map(te=>te.module));return Array.from(G).sort()},[e]),D=G=>{switch(G){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},z=G=>{switch(G){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},L=()=>{window.location.reload()},E=()=>{To.clearLogs(),t([])},R=()=>{const G=I.map(ae=>`${ae.timestamp} [${ae.level.padEnd(8)}] [${ae.module}] ${ae.message}`).join(` -`),te=new Blob([G],{type:"text/plain;charset=utf-8"}),we=URL.createObjectURL(te),J=document.createElement("a");J.href=we,J.download=`logs-${X0(new Date,"yyyy-MM-dd-HHmmss")}.txt`,J.click(),URL.revokeObjectURL(we)},H=()=>{b(!y)},$=()=>{f(void 0),x(void 0)},I=w.useMemo(()=>e.filter(G=>{const te=n===""||G.message.toLowerCase().includes(n.toLowerCase())||G.module.toLowerCase().includes(n.toLowerCase()),we=l==="all"||G.level===l,J=c==="all"||G.module===c;let ae=!0;if(m||p){const U=new Date(G.timestamp);if(m){const q=new Date(m);q.setHours(0,0,0,0),ae=ae&&U>=q}if(p){const q=new Date(p);q.setHours(23,59,59,999),ae=ae&&U<=q}}return te&&we&&J&&ae}),[e,n,l,c,m,p]);return r.jsx(Xt,{className:"h-full",children:r.jsxs("div",{className:"space-y-4 p-3 sm:p-4 lg:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:me("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",j?"bg-green-500 animate-pulse":"bg-red-500")}),r.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:j?"已连接":"未连接"})]})]}),r.jsx(ot,{className:"p-3 sm:p-4",children:r.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[r.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[r.jsxs("div",{className:"flex-1 relative",children:[r.jsx(Gr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{placeholder:"搜索日志...",value:n,onChange:G=>a(G.target.value),className:"pl-9 h-9 text-sm"})]}),r.jsxs(_t,{value:l,onValueChange:o,children:[r.jsxs(jt,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[r.jsx(yx,{className:"h-4 w-4 mr-2"}),r.jsx(Mt,{placeholder:"级别"})]}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"all",children:"全部级别"}),r.jsx(ze,{value:"DEBUG",children:"DEBUG"}),r.jsx(ze,{value:"INFO",children:"INFO"}),r.jsx(ze,{value:"WARNING",children:"WARNING"}),r.jsx(ze,{value:"ERROR",children:"ERROR"}),r.jsx(ze,{value:"CRITICAL",children:"CRITICAL"})]})]}),r.jsxs(_t,{value:c,onValueChange:d,children:[r.jsxs(jt,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[r.jsx(yx,{className:"h-4 w-4 mr-2"}),r.jsx(Mt,{placeholder:"模块"})]}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"all",children:"全部模块"}),M.map(G=>r.jsx(ze,{value:G,children:G},G))]})]})]}),r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[r.jsxs(kl,{children:[r.jsx(Cl,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",className:me("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!m&&"text-muted-foreground"),children:[r.jsx(Iy,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"text-xs sm:text-sm",children:m?X0(m,"PPP",{locale:R0}):"开始日期"})]})}),r.jsx(Ps,{className:"w-auto p-0",align:"start",children:r.jsx(N5,{mode:"single",selected:m,onSelect:f,initialFocus:!0,locale:R0})})]}),r.jsxs(kl,{children:[r.jsx(Cl,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",className:me("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!p&&"text-muted-foreground"),children:[r.jsx(Iy,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"text-xs sm:text-sm",children:p?X0(p,"PPP",{locale:R0}):"结束日期"})]})}),r.jsx(Ps,{className:"w-auto p-0",align:"start",children:r.jsx(N5,{mode:"single",selected:p,onSelect:x,initialFocus:!0,locale:R0})})]}),(m||p)&&r.jsxs(re,{variant:"outline",size:"sm",onClick:$,className:"w-full sm:w-auto h-9",children:[r.jsx(Mu,{className:"h-4 w-4 sm:mr-2"}),r.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),r.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(re,{variant:y?"default":"outline",size:"sm",onClick:H,className:"flex-1 sm:flex-none h-9",children:[y?r.jsx(bT,{className:"h-4 w-4"}):r.jsx(wT,{className:"h-4 w-4"}),r.jsx("span",{className:"ml-2 text-sm",children:y?"自动滚动":"已暂停"})]}),r.jsxs(re,{variant:"outline",size:"sm",onClick:L,className:"flex-1 sm:flex-none h-9",children:[r.jsx(Os,{className:"h-4 w-4"}),r.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),r.jsxs(re,{variant:"outline",size:"sm",onClick:E,className:"flex-1 sm:flex-none h-9",children:[r.jsx(Ot,{className:"h-4 w-4"}),r.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),r.jsxs(re,{variant:"outline",size:"sm",onClick:R,className:"flex-1 sm:flex-none h-9",children:[r.jsx(Z0,{className:"h-4 w-4"}),r.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),r.jsx("div",{className:"flex-1 hidden sm:block"}),r.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[r.jsxs("span",{className:"font-mono",children:[I.length," / ",e.length]}),r.jsx("span",{className:"ml-1",children:"条日志"})]})]})]})}),r.jsx(ot,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900",children:r.jsx(Xt,{className:"h-[calc(100vh-280px)] sm:h-[calc(100vh-320px)] lg:h-[calc(100vh-400px)]",children:r.jsxs("div",{ref:S,className:"p-2 sm:p-3 lg:p-4 font-mono text-xs sm:text-sm space-y-1",children:[I.length===0?r.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):I.map(G=>r.jsxs("div",{className:me("py-2 px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",z(G.level)),children:[r.jsxs("div",{className:"flex flex-col gap-1 sm:hidden",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-gray-500 dark:text-gray-600 text-xs",children:G.timestamp}),r.jsxs("span",{className:me("text-xs font-semibold",D(G.level)),children:["[",G.level,"]"]})]}),r.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 text-xs truncate",children:G.module}),r.jsx("div",{className:"text-gray-300 dark:text-gray-400 text-xs break-all",children:G.message})]}),r.jsxs("div",{className:"hidden sm:flex gap-3 items-start",children:[r.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[140px] lg:w-[180px] text-xs lg:text-sm",children:G.timestamp}),r.jsxs("span",{className:me("flex-shrink-0 w-[70px] lg:w-[80px] font-semibold text-xs lg:text-sm",D(G.level)),children:["[",G.level,"]"]}),r.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[120px] lg:w-[150px] truncate text-xs lg:text-sm",children:G.module}),r.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 break-all text-xs lg:text-sm",children:G.message})]})]},G.id)),r.jsx("div",{ref:_,className:"h-4"})]})})})]})})}const QG="Mai-with-u",ZG="plugin-repo",JG="main",eY="plugin_details.json";async function tY(){try{const e=await ut("/api/webui/plugins/fetch-raw",{method:"POST",headers:yt(),body:JSON.stringify({owner:QG,repo:ZG,branch:JG,file_path:eY})});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const t=await e.json();if(!t.success||!t.data)throw new Error(t.error||"获取插件列表失败");return JSON.parse(t.data).filter(l=>!l?.id||!l?.manifest?(console.warn("跳过无效插件数据:",l),!1):!l.manifest.name||!l.manifest.version?(console.warn("跳过缺少必需字段的插件:",l.id),!1):!0).map(l=>({id:l.id,manifest:{manifest_version:l.manifest.manifest_version||1,name:l.manifest.name,version:l.manifest.version,description:l.manifest.description||"",author:l.manifest.author||{name:"Unknown"},license:l.manifest.license||"Unknown",host_application:l.manifest.host_application||{min_version:"0.0.0"},homepage_url:l.manifest.homepage_url,repository_url:l.manifest.repository_url,keywords:l.manifest.keywords||[],categories:l.manifest.categories||[],default_locale:l.manifest.default_locale||"zh-CN",locales_path:l.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(e){throw console.error("Failed to fetch plugin list:",e),e}}async function nY(){try{const e=await ut("/api/webui/plugins/git-status");if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch(e){return console.error("Failed to check Git status:",e),{installed:!1,error:"无法检测 Git 安装状态"}}}async function rY(){try{const e=await ut("/api/webui/plugins/version");if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch(e){return console.error("Failed to get Maimai version:",e),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function aY(e,t,n){const a=e.split(".").map(d=>parseInt(d)||0),l=a[0]||0,o=a[1]||0,c=a[2]||0;if(n.version_majorparseInt(x)||0),m=d[0]||0,f=d[1]||0,p=d[2]||0;if(n.version_major>m||n.version_major===m&&n.version_minor>f||n.version_major===m&&n.version_minor===f&&n.version_patch>p)return!1}return!0}function sY(e,t){const n=window.location.protocol==="https:"?"wss:":"ws:",a=window.location.host,l=new WebSocket(`${n}//${a}/api/webui/ws/plugin-progress`);return l.onopen=()=>{console.log("Plugin progress WebSocket connected");const o=setInterval(()=>{l.readyState===WebSocket.OPEN?l.send("ping"):clearInterval(o)},3e4)},l.onmessage=o=>{try{if(o.data==="pong")return;const c=JSON.parse(o.data);e(c)}catch(c){console.error("Failed to parse progress data:",c)}},l.onerror=o=>{console.error("Plugin progress WebSocket error:",o),t?.(o)},l.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},l}async function B0(){try{const e=await ut("/api/webui/plugins/installed",{headers:yt()});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const t=await e.json();if(!t.success)throw new Error(t.message||"获取已安装插件列表失败");return t.plugins||[]}catch(e){return console.error("Failed to get installed plugins:",e),[]}}function L0(e,t){return t.some(n=>n.id===e)}function P0(e,t){const n=t.find(a=>a.id===e);if(n)return n.manifest?.version||n.version}async function lY(e,t,n="main"){const a=await ut("/api/webui/plugins/install",{method:"POST",headers:yt(),body:JSON.stringify({plugin_id:e,repository_url:t,branch:n})});if(!a.ok){const l=await a.json();throw new Error(l.detail||"安装失败")}return await a.json()}async function iY(e){const t=await ut("/api/webui/plugins/uninstall",{method:"POST",headers:yt(),body:JSON.stringify({plugin_id:e})});if(!t.ok){const n=await t.json();throw new Error(n.detail||"卸载失败")}return await t.json()}async function oY(e,t,n="main"){const a=await ut("/api/webui/plugins/update",{method:"POST",headers:yt(),body:JSON.stringify({plugin_id:e,repository_url:t,branch:n})});if(!a.ok){const l=await a.json();throw new Error(l.detail||"更新失败")}return await a.json()}const k5={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function cY(){const e=rs(),[t,n]=w.useState(null),[a,l]=w.useState(""),[o,c]=w.useState("all"),[d,m]=w.useState("all"),[f,p]=w.useState(!1),[x,y]=w.useState([]),[b,j]=w.useState(!0),[k,S]=w.useState(null),[_,M]=w.useState(null),[D,z]=w.useState(null),[L,E]=w.useState(null),[,R]=w.useState([]),{toast:H}=pr();w.useEffect(()=>{let q=null,W=!1;return(async()=>{if(q=sY(P=>{W||(z(P),P.stage==="success"?setTimeout(()=>{W||z(null)},2e3):P.stage==="error"&&(j(!1),S(P.error||"加载失败")))},P=>{console.error("WebSocket error:",P),W||H({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(P=>{if(!q){P();return}const je=()=>{q&&q.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),P()):q&&q.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),P()):setTimeout(je,100)};je()}),!W){const P=await nY();M(P),P.installed||H({title:"Git 未安装",description:P.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!W){const P=await rY();E(P)}if(!W)try{j(!0),S(null);const P=await tY();if(!W){const je=await B0();R(je);const Z=P.map(O=>{const Ne=L0(O.id,je),se=P0(O.id,je);return{...O,installed:Ne,installed_version:se}});for(const O of je)!Z.some(se=>se.id===O.id)&&O.manifest&&Z.push({id:O.id,manifest:{manifest_version:O.manifest.manifest_version||1,name:O.manifest.name,version:O.manifest.version,description:O.manifest.description||"",author:O.manifest.author,license:O.manifest.license||"Unknown",host_application:O.manifest.host_application,homepage_url:O.manifest.homepage_url,repository_url:O.manifest.repository_url,keywords:O.manifest.keywords||[],categories:O.manifest.categories||[],default_locale:O.manifest.default_locale||"zh-CN",locales_path:O.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:O.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});y(Z)}}catch(P){if(!W){const je=P instanceof Error?P.message:"加载插件列表失败";S(je),H({title:"加载失败",description:je,variant:"destructive"})}}finally{W||j(!1)}})(),()=>{W=!0,q&&q.close()}},[H]);const $=q=>{if(!q.installed&&L&&!I(q))return r.jsxs(on,{variant:"destructive",className:"gap-1",children:[r.jsx(fi,{className:"h-3 w-3"}),"不兼容"]});if(q.installed){const W=q.installed_version?.trim(),oe=q.manifest.version?.trim();if(W!==oe){const P=W?.split(".").map(Number)||[0,0,0],je=oe?.split(".").map(Number)||[0,0,0];for(let Z=0;Z<3;Z++){if((je[Z]||0)>(P[Z]||0))return r.jsxs(on,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[r.jsx(fi,{className:"h-3 w-3"}),"可更新"]});if((je[Z]||0)<(P[Z]||0))break}}return r.jsxs(on,{variant:"default",className:"gap-1",children:[r.jsx(Ur,{className:"h-3 w-3"}),"已安装"]})}return null},I=q=>!L||!q.manifest?.host_application?!0:aY(q.manifest.host_application.min_version,q.manifest.host_application.max_version,L),G=q=>{if(!q.installed||!q.installed_version||!q.manifest?.version)return!1;const W=q.installed_version.trim(),oe=q.manifest.version.trim();if(W===oe)return!1;const P=W.split(".").map(Number),je=oe.split(".").map(Number);for(let Z=0;Z<3;Z++){if((je[Z]||0)>(P[Z]||0))return!0;if((je[Z]||0)<(P[Z]||0))return!1}return!1},te=x.filter(q=>{if(!q.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",q.id),!1;const W=a===""||q.manifest.name?.toLowerCase().includes(a.toLowerCase())||q.manifest.description?.toLowerCase().includes(a.toLowerCase())||q.manifest.keywords&&q.manifest.keywords.some(Z=>Z.toLowerCase().includes(a.toLowerCase())),oe=o==="all"||q.manifest.categories&&q.manifest.categories.includes(o);let P=!0;d==="installed"?P=q.installed===!0:d==="updates"&&(P=q.installed===!0&&G(q));const je=!f||!L||I(q);return W&&oe&&P&&je}),we=()=>{n(null)},J=async q=>{if(!_?.installed){H({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(L&&!I(q)){H({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await lY(q.id,q.manifest.repository_url||"","main"),H({title:"安装成功",description:`${q.manifest.name} 已成功安装`});const W=await B0();R(W),y(oe=>oe.map(P=>{if(P.id===q.id){const je=L0(P.id,W),Z=P0(P.id,W);return{...P,installed:je,installed_version:Z}}return P}))}catch(W){H({title:"安装失败",description:W instanceof Error?W.message:"未知错误",variant:"destructive"})}},ae=async q=>{try{await iY(q.id),H({title:"卸载成功",description:`${q.manifest.name} 已成功卸载`});const W=await B0();R(W),y(oe=>oe.map(P=>{if(P.id===q.id){const je=L0(P.id,W),Z=P0(P.id,W);return{...P,installed:je,installed_version:Z}}return P}))}catch(W){H({title:"卸载失败",description:W instanceof Error?W.message:"未知错误",variant:"destructive"})}},U=async q=>{if(!_?.installed){H({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const W=await oY(q.id,q.manifest.repository_url||"","main");H({title:"更新成功",description:`${q.manifest.name} 已从 ${W.old_version} 更新到 ${W.new_version}`});const oe=await B0();R(oe),y(P=>P.map(je=>{if(je.id===q.id){const Z=L0(je.id,oe),O=P0(je.id,oe);return{...je,installed:Z,installed_version:O}}return je}))}catch(W){H({title:"更新失败",description:W instanceof Error?W.message:"未知错误",variant:"destructive"})}};return r.jsx(Xt,{className:"h-full",children:r.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),r.jsxs(re,{onClick:()=>e({to:"/plugin-mirrors"}),children:[r.jsx(jT,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),_&&!_.installed&&r.jsxs(ot,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[r.jsx(Bt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Mo,{className:"h-5 w-5 text-orange-600"}),r.jsxs("div",{children:[r.jsx(Lt,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),r.jsx(tr,{className:"text-orange-800 dark:text-orange-200",children:_.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),r.jsx(Vt,{children:r.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",r.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),r.jsx(ot,{className:"p-4",children:r.jsxs("div",{className:"flex flex-col gap-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"flex-1 relative",children:[r.jsx(Gr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{placeholder:"搜索插件...",value:a,onChange:q=>l(q.target.value),className:"pl-9"})]}),r.jsxs(_t,{value:o,onValueChange:c,children:[r.jsx(jt,{className:"w-full sm:w-[200px]",children:r.jsx(Mt,{placeholder:"选择分类"})}),r.jsxs(Nt,{children:[r.jsx(ze,{value:"all",children:"全部分类"}),r.jsx(ze,{value:"Group Management",children:"群组管理"}),r.jsx(ze,{value:"Entertainment & Interaction",children:"娱乐互动"}),r.jsx(ze,{value:"Utility Tools",children:"实用工具"}),r.jsx(ze,{value:"Content Generation",children:"内容生成"}),r.jsx(ze,{value:"Multimedia",children:"多媒体"}),r.jsx(ze,{value:"External Integration",children:"外部集成"}),r.jsx(ze,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),r.jsx(ze,{value:"Other",children:"其他"})]})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(br,{id:"compatible-only",checked:f,onCheckedChange:q=>p(q===!0)}),r.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),r.jsx(Sl,{value:d,onValueChange:m,className:"w-full",children:r.jsxs(Ls,{className:"grid w-full grid-cols-3",children:[r.jsxs(Rt,{value:"all",children:["全部插件 (",x.length,")"]}),r.jsxs(Rt,{value:"installed",children:["已安装 (",x.filter(q=>q.installed).length,")"]}),r.jsxs(Rt,{value:"updates",children:["可更新 (",x.filter(q=>q.installed&&G(q)).length,")"]})]})}),D&&D.stage==="loading"&&r.jsx(ot,{className:"p-4",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(fu,{className:"h-4 w-4 animate-spin"}),r.jsxs("span",{className:"text-sm font-medium",children:[D.operation==="fetch"&&"加载插件列表",D.operation==="install"&&`安装插件${D.plugin_id?`: ${D.plugin_id}`:""}`,D.operation==="uninstall"&&`卸载插件${D.plugin_id?`: ${D.plugin_id}`:""}`,D.operation==="update"&&`更新插件${D.plugin_id?`: ${D.plugin_id}`:""}`]})]}),r.jsxs("span",{className:"text-sm font-medium",children:[D.progress,"%"]})]}),r.jsx(Lu,{value:D.progress,className:"h-2"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:D.message}),D.operation==="fetch"&&D.total_plugins>0&&r.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",D.loaded_plugins," / ",D.total_plugins," 个插件"]})]})}),D&&D.stage==="error"&&D.error&&r.jsx(ot,{className:"border-destructive bg-destructive/10",children:r.jsx(Bt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Mo,{className:"h-5 w-5 text-destructive"}),r.jsxs("div",{children:[r.jsx(Lt,{className:"text-lg text-destructive",children:"加载失败"}),r.jsx(tr,{className:"text-destructive/80",children:D.error})]})]})})}),b?r.jsxs("div",{className:"flex items-center justify-center py-12",children:[r.jsx(fu,{className:"h-8 w-8 animate-spin text-muted-foreground"}),r.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):k?r.jsx(ot,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[r.jsx(Mo,{className:"h-12 w-12 text-destructive mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:k}),r.jsx(re,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):te.length===0?r.jsx(ot,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[r.jsx(Gr,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:a||o!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:te.map(q=>r.jsxs(ot,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[r.jsxs(Bt,{children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx(Lt,{className:"text-xl",children:q.manifest?.name||q.id}),r.jsxs("div",{className:"flex flex-col gap-1",children:[q.manifest?.categories&&q.manifest.categories[0]&&r.jsx(on,{variant:"secondary",className:"text-xs whitespace-nowrap",children:k5[q.manifest.categories[0]]||q.manifest.categories[0]}),$(q)]})]}),r.jsx(tr,{className:"line-clamp-2",children:q.manifest?.description||"无描述"})]}),r.jsx(Vt,{className:"flex-1",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Z0,{className:"h-4 w-4"}),r.jsx("span",{children:q.downloads.toLocaleString()})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(qy,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),r.jsx("span",{children:q.rating.toFixed(1)})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[q.manifest?.keywords&&q.manifest.keywords.slice(0,3).map(W=>r.jsx(on,{variant:"outline",className:"text-xs",children:W},W)),q.manifest?.keywords&&q.manifest.keywords.length>3&&r.jsxs(on,{variant:"outline",className:"text-xs",children:["+",q.manifest.keywords.length-3]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[r.jsxs("div",{children:["v",q.manifest?.version||"unknown"," · ",q.manifest?.author?.name||"Unknown"]}),q.manifest?.host_application&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("span",{children:"支持:"}),r.jsxs("span",{className:"font-medium",children:[q.manifest.host_application.min_version,q.manifest.host_application.max_version?` - ${q.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),r.jsx(F6,{className:"pt-4",children:r.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[r.jsx(re,{variant:"outline",size:"sm",onClick:()=>n(q),children:"查看详情"}),q.installed?G(q)?r.jsxs(re,{size:"sm",disabled:!_?.installed,title:_?.installed?void 0:"Git 未安装",onClick:()=>U(q),children:[r.jsx(Os,{className:"h-4 w-4 mr-1"}),"更新"]}):r.jsxs(re,{variant:"destructive",size:"sm",disabled:!_?.installed,title:_?.installed?void 0:"Git 未安装",onClick:()=>ae(q),children:[r.jsx(Ot,{className:"h-4 w-4 mr-1"}),"卸载"]}):r.jsxs(re,{size:"sm",disabled:!_?.installed||D?.operation==="install"||L!==null&&!I(q),title:_?.installed?L!==null&&!I(q)?`不兼容当前版本 (需要 ${q.manifest?.host_application?.min_version||"未知"}${q.manifest?.host_application?.max_version?` - ${q.manifest.host_application.max_version}`:"+"},当前 ${L?.version})`:void 0:"Git 未安装",onClick:()=>J(q),children:[r.jsx(Z0,{className:"h-4 w-4 mr-1"}),D?.operation==="install"&&D?.plugin_id===q.id?"安装中...":"安装"]})]})})]},q.id))}),r.jsx(hr,{open:t!==null,onOpenChange:we,children:t&&t.manifest&&r.jsxs(nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsx(rr,{children:r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"space-y-2 flex-1",children:[r.jsx(ar,{className:"text-2xl",children:t.manifest.name}),r.jsxs(wr,{children:["作者: ",t.manifest.author?.name||"Unknown",t.manifest.author?.url&&r.jsx("a",{href:t.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:r.jsx(lu,{className:"h-3 w-3 inline"})})]})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[t.manifest.categories&&t.manifest.categories[0]&&r.jsx(on,{variant:"secondary",children:k5[t.manifest.categories[0]]||t.manifest.categories[0]}),$(t)]})]})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"版本"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",t.manifest?.version||"unknown"]}),t.installed&&t.installed_version&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",t.installed_version]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"下载量"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:t.downloads.toLocaleString()})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"评分"}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(qy,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.rating.toFixed(1)," (",t.review_count,")"]})]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"许可证"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:t.manifest.license||"Unknown"})]}),r.jsxs("div",{className:"col-span-2",children:[r.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.manifest.host_application?.min_version||"未知",t.manifest.host_application?.max_version?` - ${t.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:t.manifest.keywords&&t.manifest.keywords.map(q=>r.jsx(on,{variant:"outline",children:q},q))})]}),t.detailed_description&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:t.detailed_description})]}),!t.detailed_description&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:t.manifest.description||"无描述"})]}),r.jsxs("div",{className:"space-y-2",children:[t.manifest.homepage_url&&r.jsxs("div",{className:"text-sm",children:[r.jsx("span",{className:"font-medium",children:"主页: "}),r.jsx("a",{href:t.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:t.manifest.homepage_url})]}),t.manifest.repository_url&&r.jsxs("div",{className:"text-sm",children:[r.jsx("span",{className:"font-medium",children:"仓库: "}),r.jsx("a",{href:t.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:t.manifest.repository_url})]})]})]}),r.jsxs(Yr,{children:[t.manifest.homepage_url&&r.jsxs(re,{onClick:()=>window.open(t.manifest.homepage_url,"_blank"),children:[r.jsx(lu,{className:"h-4 w-4 mr-2"}),"访问主页"]}),t.manifest.repository_url&&r.jsxs(re,{variant:"outline",onClick:()=>window.open(t.manifest.repository_url,"_blank"),children:[r.jsx(lu,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function uY(){return r.jsx(Xt,{className:"h-full",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),r.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(re,{variant:"outline",size:"sm",children:[r.jsx(Os,{className:"h-4 w-4 mr-2"}),"刷新"]}),r.jsxs(re,{size:"sm",children:[r.jsx(Pa,{className:"h-4 w-4 mr-2"}),"全局设置"]})]})]}),r.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[r.jsxs(ot,{children:[r.jsxs(Bt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Lt,{className:"text-sm font-medium",children:"已安装插件"}),r.jsx(em,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Vt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:"0"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"正在加载..."})]})]}),r.jsxs(ot,{children:[r.jsxs(Bt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Lt,{className:"text-sm font-medium",children:"已启用"}),r.jsx(Ur,{className:"h-4 w-4 text-green-600"})]}),r.jsxs(Vt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:"0"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),r.jsxs(ot,{children:[r.jsxs(Bt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Lt,{className:"text-sm font-medium",children:"已禁用"}),r.jsx(fi,{className:"h-4 w-4 text-orange-600"})]}),r.jsxs(Vt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:"0"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]}),r.jsxs(ot,{children:[r.jsxs(Bt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Lt,{className:"text-sm font-medium",children:"可更新"}),r.jsx(Os,{className:"h-4 w-4 text-blue-600"})]}),r.jsxs(Vt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:"0"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"有新版本可用"})]})]})]}),r.jsxs(ot,{children:[r.jsxs(Bt,{children:[r.jsx(Lt,{children:"已安装的插件"}),r.jsx(tr,{children:"查看和管理已安装插件的配置"})]}),r.jsx(Vt,{children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[r.jsx(em,{className:"h-16 w-16 text-muted-foreground/50"}),r.jsxs("div",{className:"text-center space-y-2",children:[r.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"插件配置功能开发中"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"即将支持插件的启用/禁用、参数配置等功能"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsx(re,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:"/plugins",children:[r.jsx(lu,{className:"h-4 w-4 mr-2"}),"前往插件市场"]})})})]})})]}),r.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[r.jsxs(ot,{children:[r.jsx(Bt,{children:r.jsx(Lt,{className:"text-base",children:"即将推出的功能"})}),r.jsx(Vt,{children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:r.jsx(Ur,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"插件启用/禁用"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"快速切换插件运行状态"})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:r.jsx(Ur,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"配置参数编辑"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"可视化编辑插件配置文件"})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:r.jsx(Ur,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"依赖管理"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"查看和安装插件依赖包"})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:r.jsx(Ur,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"插件日志"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"查看插件运行日志和错误信息"})]})]})]})})]}),r.jsxs(ot,{children:[r.jsx(Bt,{children:r.jsx(Lt,{className:"text-base",children:"开发者工具"})}),r.jsx(Vt,{children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:r.jsx(Pa,{className:"h-4 w-4 text-blue-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"热重载"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"无需重启即可重新加载插件"})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:r.jsx(Pa,{className:"h-4 w-4 text-blue-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"配置验证"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"检查配置文件格式和完整性"})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:r.jsx(Pa,{className:"h-4 w-4 text-blue-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"性能监控"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"监控插件的资源占用情况"})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:r.jsx(Pa,{className:"h-4 w-4 text-blue-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"调试模式"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"详细的调试信息和错误追踪"})]})]})]})})]})]}),r.jsx(ot,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:r.jsx(Vt,{className:"pt-6",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(fi,{className:"h-5 w-5 text-blue-600 mt-0.5 flex-shrink-0"}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"开发进行中"}),r.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["插件配置功能正在积极开发中。目前您可以通过",r.jsx("strong",{children:"插件市场"}),"安装和卸载插件,完整的配置管理功能即将推出。"]})]})]})})})]})})}function dY(){const e=rs(),{toast:t}=pr(),[n,a]=w.useState([]),[l,o]=w.useState(!0),[c,d]=w.useState(null),[m,f]=w.useState(null),[p,x]=w.useState(!1),[y,b]=w.useState(!1),[j,k]=w.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S=w.useCallback(async()=>{try{o(!0),d(null);const R=localStorage.getItem("access-token"),H=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${R}`}});if(!H.ok)throw new Error("获取镜像源列表失败");const $=await H.json();a($.mirrors||[])}catch(R){const H=R instanceof Error?R.message:"加载镜像源失败";d(H),t({title:"加载失败",description:H,variant:"destructive"})}finally{o(!1)}},[t]);w.useEffect(()=>{S()},[S]);const _=async()=>{try{const R=localStorage.getItem("access-token"),H=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${R}`,"Content-Type":"application/json"},body:JSON.stringify(j)});if(!H.ok){const $=await H.json();throw new Error($.detail||"添加镜像源失败")}t({title:"添加成功",description:"镜像源已添加"}),x(!1),k({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S()}catch(R){t({title:"添加失败",description:R instanceof Error?R.message:"未知错误",variant:"destructive"})}},M=async()=>{if(m)try{const R=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${m.id}`,{method:"PUT",headers:{Authorization:`Bearer ${R}`,"Content-Type":"application/json"},body:JSON.stringify({name:j.name,raw_prefix:j.raw_prefix,clone_prefix:j.clone_prefix,enabled:j.enabled,priority:j.priority})})).ok)throw new Error("更新镜像源失败");t({title:"更新成功",description:"镜像源已更新"}),b(!1),f(null),S()}catch(R){t({title:"更新失败",description:R instanceof Error?R.message:"未知错误",variant:"destructive"})}},D=async R=>{if(confirm("确定要删除这个镜像源吗?"))try{const H=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${R}`,{method:"DELETE",headers:{Authorization:`Bearer ${H}`}})).ok)throw new Error("删除镜像源失败");t({title:"删除成功",description:"镜像源已删除"}),S()}catch(H){t({title:"删除失败",description:H instanceof Error?H.message:"未知错误",variant:"destructive"})}},z=async R=>{try{const H=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${R.id}`,{method:"PUT",headers:{Authorization:`Bearer ${H}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!R.enabled})})).ok)throw new Error("更新状态失败");S()}catch(H){t({title:"更新失败",description:H instanceof Error?H.message:"未知错误",variant:"destructive"})}},L=R=>{f(R),k({id:R.id,name:R.name,raw_prefix:R.raw_prefix,clone_prefix:R.clone_prefix,enabled:R.enabled,priority:R.priority}),b(!0)},E=async(R,H)=>{const $=H==="up"?R.priority-1:R.priority+1;if(!($<1))try{const I=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${R.id}`,{method:"PUT",headers:{Authorization:`Bearer ${I}`,"Content-Type":"application/json"},body:JSON.stringify({priority:$})})).ok)throw new Error("更新优先级失败");S()}catch(I){t({title:"更新失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"})}};return r.jsx(Xt,{className:"h-full",children:r.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(re,{variant:"ghost",size:"icon",onClick:()=>e({to:"/plugins"}),children:r.jsx(J5,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),r.jsxs(re,{onClick:()=>x(!0),children:[r.jsx(mr,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),l?r.jsx(ot,{className:"p-6",children:r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(fu,{className:"h-8 w-8 animate-spin text-primary"})})}):c?r.jsx(ot,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[r.jsx(Mo,{className:"h-12 w-12 text-destructive mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:c}),r.jsx(re,{onClick:S,children:"重新加载"})]})}):r.jsxs(ot,{children:[r.jsx("div",{className:"hidden md:block",children:r.jsxs(bi,{children:[r.jsx(wi,{children:r.jsxs(Un,{children:[r.jsx(ct,{children:"状态"}),r.jsx(ct,{children:"名称"}),r.jsx(ct,{children:"ID"}),r.jsx(ct,{children:"优先级"}),r.jsx(ct,{className:"text-right",children:"操作"})]})}),r.jsx(ji,{children:n.map(R=>r.jsxs(Un,{children:[r.jsx(et,{children:r.jsx(gt,{checked:R.enabled,onCheckedChange:()=>z(R)})}),r.jsx(et,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:R.name}),r.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",R.raw_prefix]})]})}),r.jsx(et,{children:r.jsx(on,{variant:"outline",children:R.id})}),r.jsx(et,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-mono",children:R.priority}),r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(re,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(R,"up"),disabled:R.priority===1,children:r.jsx(vx,{className:"h-3 w-3"})}),r.jsx(re,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(R,"down"),children:r.jsx(hu,{className:"h-3 w-3"})})]})]})}),r.jsx(et,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(re,{variant:"ghost",size:"icon",onClick:()=>L(R),children:r.jsx(Ro,{className:"h-4 w-4"})}),r.jsx(re,{variant:"ghost",size:"icon",onClick:()=>D(R.id),children:r.jsx(Ot,{className:"h-4 w-4 text-destructive"})})]})})]},R.id))})]})}),r.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(R=>r.jsx(ot,{className:"p-4",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"font-semibold",children:R.name}),R.enabled&&r.jsx(on,{variant:"default",className:"text-xs",children:"启用"})]}),r.jsx(on,{variant:"outline",className:"mt-1 text-xs",children:R.id})]}),r.jsx(gt,{checked:R.enabled,onCheckedChange:()=>z(R)})]}),r.jsxs("div",{className:"text-sm space-y-1",children:[r.jsxs("div",{className:"text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Raw: "}),r.jsx("span",{className:"break-all",children:R.raw_prefix})]}),r.jsxs("div",{className:"text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"优先级: "}),r.jsx("span",{className:"font-mono",children:R.priority})]})]}),r.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[r.jsxs(re,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>L(R),children:[r.jsx(Ro,{className:"h-4 w-4 mr-1"}),"编辑"]}),r.jsx(re,{variant:"outline",size:"sm",onClick:()=>E(R,"up"),disabled:R.priority===1,children:r.jsx(vx,{className:"h-4 w-4"})}),r.jsx(re,{variant:"outline",size:"sm",onClick:()=>E(R,"down"),children:r.jsx(hu,{className:"h-4 w-4"})}),r.jsx(re,{variant:"destructive",size:"sm",onClick:()=>D(R.id),children:r.jsx(Ot,{className:"h-4 w-4"})})]})]})},R.id))})]}),r.jsx(hr,{open:p,onOpenChange:x,children:r.jsxs(nr,{className:"max-w-lg",children:[r.jsxs(rr,{children:[r.jsx(ar,{children:"添加镜像源"}),r.jsx(wr,{children:"添加新的 Git 镜像源配置"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"add-id",children:"镜像源 ID *"}),r.jsx(Te,{id:"add-id",placeholder:"例如: my-mirror",value:j.id,onChange:R=>k({...j,id:R.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"add-name",children:"名称 *"}),r.jsx(Te,{id:"add-name",placeholder:"例如: 我的镜像源",value:j.name,onChange:R=>k({...j,name:R.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),r.jsx(Te,{id:"add-raw",placeholder:"https://example.com/raw",value:j.raw_prefix,onChange:R=>k({...j,raw_prefix:R.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"add-clone",children:"克隆前缀 *"}),r.jsx(Te,{id:"add-clone",placeholder:"https://example.com/clone",value:j.clone_prefix,onChange:R=>k({...j,clone_prefix:R.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"add-priority",children:"优先级"}),r.jsx(Te,{id:"add-priority",type:"number",min:"1",value:j.priority,onChange:R=>k({...j,priority:parseInt(R.target.value)||1})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gt,{id:"add-enabled",checked:j.enabled,onCheckedChange:R=>k({...j,enabled:R})}),r.jsx(Q,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),r.jsxs(Yr,{children:[r.jsx(re,{variant:"outline",onClick:()=>x(!1),children:"取消"}),r.jsx(re,{onClick:_,children:"添加"})]})]})}),r.jsx(hr,{open:y,onOpenChange:b,children:r.jsxs(nr,{className:"max-w-lg",children:[r.jsxs(rr,{children:[r.jsx(ar,{children:"编辑镜像源"}),r.jsx(wr,{children:"修改镜像源配置"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{children:"镜像源 ID"}),r.jsx(Te,{value:j.id,disabled:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit-name",children:"名称 *"}),r.jsx(Te,{id:"edit-name",value:j.name,onChange:R=>k({...j,name:R.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),r.jsx(Te,{id:"edit-raw",value:j.raw_prefix,onChange:R=>k({...j,raw_prefix:R.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit-clone",children:"克隆前缀 *"}),r.jsx(Te,{id:"edit-clone",value:j.clone_prefix,onChange:R=>k({...j,clone_prefix:R.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit-priority",children:"优先级"}),r.jsx(Te,{id:"edit-priority",type:"number",min:"1",value:j.priority,onChange:R=>k({...j,priority:parseInt(R.target.value)||1})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(gt,{id:"edit-enabled",checked:j.enabled,onCheckedChange:R=>k({...j,enabled:R})}),r.jsx(Q,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),r.jsxs(Yr,{children:[r.jsx(re,{variant:"outline",onClick:()=>b(!1),children:"取消"}),r.jsx(re,{onClick:M,children:"保存"})]})]})})]})})}const mY=Wo("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),R9=w.forwardRef(({className:e,size:t,abbrTitle:n,children:a,...l},o)=>r.jsx("kbd",{className:me(mY({size:t,className:e})),ref:o,...l,children:n?r.jsx("abbr",{title:n,children:a}):a}));R9.displayName="Kbd";const hY=[{icon:K0,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:jl,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:e6,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:t6,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:v1,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:_u,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:n6,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:NT,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:em,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:Q0,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:Pa,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function fY({open:e,onOpenChange:t}){const[n,a]=w.useState(""),[l,o]=w.useState(0),c=rs(),d=hY.filter(p=>p.title.toLowerCase().includes(n.toLowerCase())||p.description.toLowerCase().includes(n.toLowerCase())||p.category.toLowerCase().includes(n.toLowerCase()));w.useEffect(()=>{e&&(a(""),o(0))},[e]);const m=w.useCallback(p=>{c({to:p}),t(!1)},[c,t]),f=w.useCallback(p=>{p.key==="ArrowDown"?(p.preventDefault(),o(x=>(x+1)%d.length)):p.key==="ArrowUp"?(p.preventDefault(),o(x=>(x-1+d.length)%d.length)):p.key==="Enter"&&d[l]&&(p.preventDefault(),m(d[l].path))},[d,l,m]);return r.jsx(hr,{open:e,onOpenChange:t,children:r.jsxs(nr,{className:"max-w-2xl p-0 gap-0",children:[r.jsxs(rr,{className:"px-4 pt-4 pb-0",children:[r.jsx(ar,{className:"sr-only",children:"搜索"}),r.jsxs("div",{className:"relative",children:[r.jsx(Gr,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),r.jsx(Te,{value:n,onChange:p=>{a(p.target.value),o(0)},onKeyDown:f,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),r.jsx("div",{className:"border-t",children:r.jsx(Xt,{className:"h-[400px]",children:d.length>0?r.jsx("div",{className:"p-2",children:d.map((p,x)=>{const y=p.icon;return r.jsxs("button",{onClick:()=>m(p.path),onMouseEnter:()=>o(x),className:me("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",x===l?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[r.jsx(y,{className:"h-5 w-5 flex-shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium text-sm",children:p.title}),r.jsx("div",{className:"text-xs text-muted-foreground truncate",children:p.description})]}),r.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:p.category})]},p.path)})}):r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Gr,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),r.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),r.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function pY(e){const t=xY(e),n=w.forwardRef((a,l)=>{const{children:o,...c}=a,d=w.Children.toArray(o),m=d.find(vY);if(m){const f=m.props.children,p=d.map(x=>x===m?w.Children.count(f)>1?w.Children.only(null):w.isValidElement(f)?f.props.children:null:x);return r.jsx(t,{...c,ref:l,children:w.isValidElement(f)?w.cloneElement(f,void 0,p):null})}return r.jsx(t,{...c,ref:l,children:o})});return n.displayName=`${e}.Slot`,n}function xY(e){const t=w.forwardRef((n,a)=>{const{children:l,...o}=n;if(w.isValidElement(l)){const c=bY(l),d=yY(o,l.props);return l.type!==w.Fragment&&(d.ref=a?Nl(a,c):c),w.cloneElement(l,d)}return w.Children.count(l)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var gY=Symbol("radix.slottable");function vY(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===gY}function yY(e,t){const n={...t};for(const a in t){const l=e[a],o=t[a];/^on[A-Z]/.test(a)?l&&o?n[a]=(...d)=>{const m=o(...d);return l(...d),m}:l&&(n[a]=l):a==="style"?n[a]={...l,...o}:a==="className"&&(n[a]=[l,o].filter(Boolean).join(" "))}return{...e,...n}}function bY(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var n1=["Enter"," "],wY=["ArrowDown","PageUp","Home"],B9=["ArrowUp","PageDown","End"],jY=[...wY,...B9],NY={ltr:[...n1,"ArrowRight"],rtl:[...n1,"ArrowLeft"]},SY={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Zu="Menu",[Su,kY,CY]=vm(Zu),[_i,L9]=Ha(Zu,[CY,Uo,Mm]),Ju=Uo(),P9=Mm(),[F9,Ll]=_i(Zu),[TY,ed]=_i(Zu),I9=e=>{const{__scopeMenu:t,open:n=!1,children:a,dir:l,onOpenChange:o,modal:c=!0}=e,d=Ju(t),[m,f]=w.useState(null),p=w.useRef(!1),x=gr(o),y=Tu(l);return w.useEffect(()=>{const b=()=>{p.current=!0,document.addEventListener("pointerdown",j,{capture:!0,once:!0}),document.addEventListener("pointermove",j,{capture:!0,once:!0})},j=()=>p.current=!1;return document.addEventListener("keydown",b,{capture:!0}),()=>{document.removeEventListener("keydown",b,{capture:!0}),document.removeEventListener("pointerdown",j,{capture:!0}),document.removeEventListener("pointermove",j,{capture:!0})}},[]),r.jsx(jm,{...d,children:r.jsx(F9,{scope:t,open:n,onOpenChange:x,content:m,onContentChange:f,children:r.jsx(TY,{scope:t,onClose:w.useCallback(()=>x(!1),[x]),isUsingKeyboardRef:p,dir:y,modal:c,children:a})})})};I9.displayName=Zu;var _Y="MenuAnchor",Mg=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,l=Ju(n);return r.jsx(Nm,{...l,...a,ref:t})});Mg.displayName=_Y;var Eg="MenuPortal",[MY,q9]=_i(Eg,{forceMount:void 0}),H9=e=>{const{__scopeMenu:t,forceMount:n,children:a,container:l}=e,o=Ll(Eg,t);return r.jsx(MY,{scope:t,forceMount:n,children:r.jsx(Wr,{present:n||o.open,children:r.jsx(wm,{asChild:!0,container:l,children:a})})})};H9.displayName=Eg;var _a="MenuContent",[EY,Ag]=_i(_a),U9=w.forwardRef((e,t)=>{const n=q9(_a,e.__scopeMenu),{forceMount:a=n.forceMount,...l}=e,o=Ll(_a,e.__scopeMenu),c=ed(_a,e.__scopeMenu);return r.jsx(Su.Provider,{scope:e.__scopeMenu,children:r.jsx(Wr,{present:a||o.open,children:r.jsx(Su.Slot,{scope:e.__scopeMenu,children:c.modal?r.jsx(AY,{...l,ref:t}):r.jsx(DY,{...l,ref:t})})})})}),AY=w.forwardRef((e,t)=>{const n=Ll(_a,e.__scopeMenu),a=w.useRef(null),l=dn(t,a);return w.useEffect(()=>{const o=a.current;if(o)return $5(o)},[]),r.jsx(Dg,{...e,ref:l,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Pe(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),DY=w.forwardRef((e,t)=>{const n=Ll(_a,e.__scopeMenu);return r.jsx(Dg,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),zY=pY("MenuContent.ScrollLock"),Dg=w.forwardRef((e,t)=>{const{__scopeMenu:n,loop:a=!1,trapFocus:l,onOpenAutoFocus:o,onCloseAutoFocus:c,disableOutsidePointerEvents:d,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:p,onFocusOutside:x,onInteractOutside:y,onDismiss:b,disableOutsideScroll:j,...k}=e,S=Ll(_a,n),_=ed(_a,n),M=Ju(n),D=P9(n),z=kY(n),[L,E]=w.useState(null),R=w.useRef(null),H=dn(t,R,S.onContentChange),$=w.useRef(0),I=w.useRef(""),G=w.useRef(0),te=w.useRef(null),we=w.useRef("right"),J=w.useRef(0),ae=j?V5:w.Fragment,U=j?{as:zY,allowPinchZoom:!0}:void 0,q=oe=>{const P=I.current+oe,je=z().filter(ye=>!ye.disabled),Z=document.activeElement,O=je.find(ye=>ye.ref.current===Z)?.textValue,Ne=je.map(ye=>ye.textValue),se=VY(Ne,P,O),Ce=je.find(ye=>ye.textValue===se)?.ref.current;(function ye(Be){I.current=Be,window.clearTimeout($.current),Be!==""&&($.current=window.setTimeout(()=>ye(""),1e3))})(P),Ce&&setTimeout(()=>Ce.focus())};w.useEffect(()=>()=>window.clearTimeout($.current),[]),G5();const W=w.useCallback(oe=>we.current===te.current?.side&&YY(oe,te.current?.area),[]);return r.jsx(EY,{scope:n,searchRef:I,onItemEnter:w.useCallback(oe=>{W(oe)&&oe.preventDefault()},[W]),onItemLeave:w.useCallback(oe=>{W(oe)||(R.current?.focus(),E(null))},[W]),onTriggerLeave:w.useCallback(oe=>{W(oe)&&oe.preventDefault()},[W]),pointerGraceTimerRef:G,onPointerGraceIntentChange:w.useCallback(oe=>{te.current=oe},[]),children:r.jsx(ae,{...U,children:r.jsx(Y5,{asChild:!0,trapped:l,onMountAutoFocus:Pe(o,oe=>{oe.preventDefault(),R.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:c,children:r.jsx(p1,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:f,onPointerDownOutside:p,onFocusOutside:x,onInteractOutside:y,onDismiss:b,children:r.jsx(V6,{asChild:!0,...D,dir:_.dir,orientation:"vertical",loop:a,currentTabStopId:L,onCurrentTabStopIdChange:E,onEntryFocus:Pe(m,oe=>{_.isUsingKeyboardRef.current||oe.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(x1,{role:"menu","aria-orientation":"vertical","data-state":lN(S.open),"data-radix-menu-content":"",dir:_.dir,...M,...k,ref:H,style:{outline:"none",...k.style},onKeyDown:Pe(k.onKeyDown,oe=>{const je=oe.target.closest("[data-radix-menu-content]")===oe.currentTarget,Z=oe.ctrlKey||oe.altKey||oe.metaKey,O=oe.key.length===1;je&&(oe.key==="Tab"&&oe.preventDefault(),!Z&&O&&q(oe.key));const Ne=R.current;if(oe.target!==Ne||!jY.includes(oe.key))return;oe.preventDefault();const Ce=z().filter(ye=>!ye.disabled).map(ye=>ye.ref.current);B9.includes(oe.key)&&Ce.reverse(),UY(Ce)}),onBlur:Pe(e.onBlur,oe=>{oe.currentTarget.contains(oe.target)||(window.clearTimeout($.current),I.current="")}),onPointerMove:Pe(e.onPointerMove,ku(oe=>{const P=oe.target,je=J.current!==oe.clientX;if(oe.currentTarget.contains(P)&&je){const Z=oe.clientX>J.current?"right":"left";we.current=Z,J.current=oe.clientX}}))})})})})})})});U9.displayName=_a;var OY="MenuGroup",zg=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return r.jsx(Ft.div,{role:"group",...a,ref:t})});zg.displayName=OY;var RY="MenuLabel",$9=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return r.jsx(Ft.div,{...a,ref:t})});$9.displayName=RY;var xm="MenuItem",C5="menu.itemSelect",Qm=w.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:a,...l}=e,o=w.useRef(null),c=ed(xm,e.__scopeMenu),d=Ag(xm,e.__scopeMenu),m=dn(t,o),f=w.useRef(!1),p=()=>{const x=o.current;if(!n&&x){const y=new CustomEvent(C5,{bubbles:!0,cancelable:!0});x.addEventListener(C5,b=>a?.(b),{once:!0}),X5(x,y),y.defaultPrevented?f.current=!1:c.onClose()}};return r.jsx(V9,{...l,ref:m,disabled:n,onClick:Pe(e.onClick,p),onPointerDown:x=>{e.onPointerDown?.(x),f.current=!0},onPointerUp:Pe(e.onPointerUp,x=>{f.current||x.currentTarget?.click()}),onKeyDown:Pe(e.onKeyDown,x=>{const y=d.searchRef.current!=="";n||y&&x.key===" "||n1.includes(x.key)&&(x.currentTarget.click(),x.preventDefault())})})});Qm.displayName=xm;var V9=w.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:a=!1,textValue:l,...o}=e,c=Ag(xm,n),d=P9(n),m=w.useRef(null),f=dn(t,m),[p,x]=w.useState(!1),[y,b]=w.useState("");return w.useEffect(()=>{const j=m.current;j&&b((j.textContent??"").trim())},[o.children]),r.jsx(Su.ItemSlot,{scope:n,disabled:a,textValue:l??y,children:r.jsx(G6,{asChild:!0,...d,focusable:!a,children:r.jsx(Ft.div,{role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...o,ref:f,onPointerMove:Pe(e.onPointerMove,ku(j=>{a?c.onItemLeave(j):(c.onItemEnter(j),j.defaultPrevented||j.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Pe(e.onPointerLeave,ku(j=>c.onItemLeave(j))),onFocus:Pe(e.onFocus,()=>x(!0)),onBlur:Pe(e.onBlur,()=>x(!1))})})})}),BY="MenuCheckboxItem",G9=w.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:a,...l}=e;return r.jsx(Q9,{scope:e.__scopeMenu,checked:n,children:r.jsx(Qm,{role:"menuitemcheckbox","aria-checked":gm(n)?"mixed":n,...l,ref:t,"data-state":Bg(n),onSelect:Pe(l.onSelect,()=>a?.(gm(n)?!0:!n),{checkForDefaultPrevented:!1})})})});G9.displayName=BY;var Y9="MenuRadioGroup",[LY,PY]=_i(Y9,{value:void 0,onValueChange:()=>{}}),W9=w.forwardRef((e,t)=>{const{value:n,onValueChange:a,...l}=e,o=gr(a);return r.jsx(LY,{scope:e.__scopeMenu,value:n,onValueChange:o,children:r.jsx(zg,{...l,ref:t})})});W9.displayName=Y9;var X9="MenuRadioItem",K9=w.forwardRef((e,t)=>{const{value:n,...a}=e,l=PY(X9,e.__scopeMenu),o=n===l.value;return r.jsx(Q9,{scope:e.__scopeMenu,checked:o,children:r.jsx(Qm,{role:"menuitemradio","aria-checked":o,...a,ref:t,"data-state":Bg(o),onSelect:Pe(a.onSelect,()=>l.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});K9.displayName=X9;var Og="MenuItemIndicator",[Q9,FY]=_i(Og,{checked:!1}),Z9=w.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:a,...l}=e,o=FY(Og,n);return r.jsx(Wr,{present:a||gm(o.checked)||o.checked===!0,children:r.jsx(Ft.span,{...l,ref:t,"data-state":Bg(o.checked)})})});Z9.displayName=Og;var IY="MenuSeparator",J9=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return r.jsx(Ft.div,{role:"separator","aria-orientation":"horizontal",...a,ref:t})});J9.displayName=IY;var qY="MenuArrow",eN=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,l=Ju(n);return r.jsx(g1,{...l,...a,ref:t})});eN.displayName=qY;var Rg="MenuSub",[HY,tN]=_i(Rg),nN=e=>{const{__scopeMenu:t,children:n,open:a=!1,onOpenChange:l}=e,o=Ll(Rg,t),c=Ju(t),[d,m]=w.useState(null),[f,p]=w.useState(null),x=gr(l);return w.useEffect(()=>(o.open===!1&&x(!1),()=>x(!1)),[o.open,x]),r.jsx(jm,{...c,children:r.jsx(F9,{scope:t,open:a,onOpenChange:x,content:f,onContentChange:p,children:r.jsx(HY,{scope:t,contentId:Ta(),triggerId:Ta(),trigger:d,onTriggerChange:m,children:n})})})};nN.displayName=Rg;var au="MenuSubTrigger",rN=w.forwardRef((e,t)=>{const n=Ll(au,e.__scopeMenu),a=ed(au,e.__scopeMenu),l=tN(au,e.__scopeMenu),o=Ag(au,e.__scopeMenu),c=w.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:m}=o,f={__scopeMenu:e.__scopeMenu},p=w.useCallback(()=>{c.current&&window.clearTimeout(c.current),c.current=null},[]);return w.useEffect(()=>p,[p]),w.useEffect(()=>{const x=d.current;return()=>{window.clearTimeout(x),m(null)}},[d,m]),r.jsx(Mg,{asChild:!0,...f,children:r.jsx(V9,{id:l.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":l.contentId,"data-state":lN(n.open),...e,ref:Nl(t,l.onTriggerChange),onClick:x=>{e.onClick?.(x),!(e.disabled||x.defaultPrevented)&&(x.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Pe(e.onPointerMove,ku(x=>{o.onItemEnter(x),!x.defaultPrevented&&!e.disabled&&!n.open&&!c.current&&(o.onPointerGraceIntentChange(null),c.current=window.setTimeout(()=>{n.onOpenChange(!0),p()},100))})),onPointerLeave:Pe(e.onPointerLeave,ku(x=>{p();const y=n.content?.getBoundingClientRect();if(y){const b=n.content?.dataset.side,j=b==="right",k=j?-5:5,S=y[j?"left":"right"],_=y[j?"right":"left"];o.onPointerGraceIntentChange({area:[{x:x.clientX+k,y:x.clientY},{x:S,y:y.top},{x:_,y:y.top},{x:_,y:y.bottom},{x:S,y:y.bottom}],side:b}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(x),x.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Pe(e.onKeyDown,x=>{const y=o.searchRef.current!=="";e.disabled||y&&x.key===" "||NY[a.dir].includes(x.key)&&(n.onOpenChange(!0),n.content?.focus(),x.preventDefault())})})})});rN.displayName=au;var aN="MenuSubContent",sN=w.forwardRef((e,t)=>{const n=q9(_a,e.__scopeMenu),{forceMount:a=n.forceMount,...l}=e,o=Ll(_a,e.__scopeMenu),c=ed(_a,e.__scopeMenu),d=tN(aN,e.__scopeMenu),m=w.useRef(null),f=dn(t,m);return r.jsx(Su.Provider,{scope:e.__scopeMenu,children:r.jsx(Wr,{present:a||o.open,children:r.jsx(Su.Slot,{scope:e.__scopeMenu,children:r.jsx(Dg,{id:d.contentId,"aria-labelledby":d.triggerId,...l,ref:f,align:"start",side:c.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{c.isUsingKeyboardRef.current&&m.current?.focus(),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:Pe(e.onFocusOutside,p=>{p.target!==d.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Pe(e.onEscapeKeyDown,p=>{c.onClose(),p.preventDefault()}),onKeyDown:Pe(e.onKeyDown,p=>{const x=p.currentTarget.contains(p.target),y=SY[c.dir].includes(p.key);x&&y&&(o.onOpenChange(!1),d.trigger?.focus(),p.preventDefault())})})})})})});sN.displayName=aN;function lN(e){return e?"open":"closed"}function gm(e){return e==="indeterminate"}function Bg(e){return gm(e)?"indeterminate":e?"checked":"unchecked"}function UY(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function $Y(e,t){return e.map((n,a)=>e[(t+a)%e.length])}function VY(e,t,n){const l=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let c=$Y(e,Math.max(o,0));l.length===1&&(c=c.filter(f=>f!==n));const m=c.find(f=>f.toLowerCase().startsWith(l.toLowerCase()));return m!==n?m:void 0}function GY(e,t){const{x:n,y:a}=e;let l=!1;for(let o=0,c=t.length-1;oa!=y>a&&n<(x-f)*(a-p)/(y-p)+f&&(l=!l)}return l}function YY(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return GY(n,t)}function ku(e){return t=>t.pointerType==="mouse"?e(t):void 0}var WY=I9,XY=Mg,KY=H9,QY=U9,ZY=zg,JY=$9,eW=Qm,tW=G9,nW=W9,rW=K9,aW=Z9,sW=J9,lW=eN,iW=nN,oW=rN,cW=sN,Lg="ContextMenu",[uW]=Ha(Lg,[L9]),Nr=L9(),[dW,iN]=uW(Lg),oN=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:a,dir:l,modal:o=!0}=e,[c,d]=w.useState(!1),m=Nr(t),f=gr(a),p=w.useCallback(x=>{d(x),f(x)},[f]);return r.jsx(dW,{scope:t,open:c,onOpenChange:p,modal:o,children:r.jsx(WY,{...m,dir:l,open:c,onOpenChange:p,modal:o,children:n})})};oN.displayName=Lg;var cN="ContextMenuTrigger",uN=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:a=!1,...l}=e,o=iN(cN,n),c=Nr(n),d=w.useRef({x:0,y:0}),m=w.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...d.current})}),f=w.useRef(0),p=w.useCallback(()=>window.clearTimeout(f.current),[]),x=y=>{d.current={x:y.clientX,y:y.clientY},o.onOpenChange(!0)};return w.useEffect(()=>p,[p]),w.useEffect(()=>void(a&&p()),[a,p]),r.jsxs(r.Fragment,{children:[r.jsx(XY,{...c,virtualRef:m}),r.jsx(Ft.span,{"data-state":o.open?"open":"closed","data-disabled":a?"":void 0,...l,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:a?e.onContextMenu:Pe(e.onContextMenu,y=>{p(),x(y),y.preventDefault()}),onPointerDown:a?e.onPointerDown:Pe(e.onPointerDown,F0(y=>{p(),f.current=window.setTimeout(()=>x(y),700)})),onPointerMove:a?e.onPointerMove:Pe(e.onPointerMove,F0(p)),onPointerCancel:a?e.onPointerCancel:Pe(e.onPointerCancel,F0(p)),onPointerUp:a?e.onPointerUp:Pe(e.onPointerUp,F0(p))})]})});uN.displayName=cN;var mW="ContextMenuPortal",dN=e=>{const{__scopeContextMenu:t,...n}=e,a=Nr(t);return r.jsx(KY,{...a,...n})};dN.displayName=mW;var mN="ContextMenuContent",hN=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=iN(mN,n),o=Nr(n),c=w.useRef(!1);return r.jsx(QY,{...o,...a,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:d=>{e.onCloseAutoFocus?.(d),!d.defaultPrevented&&c.current&&d.preventDefault(),c.current=!1},onInteractOutside:d=>{e.onInteractOutside?.(d),!d.defaultPrevented&&!l.modal&&(c.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});hN.displayName=mN;var hW="ContextMenuGroup",fW=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Nr(n);return r.jsx(ZY,{...l,...a,ref:t})});fW.displayName=hW;var pW="ContextMenuLabel",fN=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Nr(n);return r.jsx(JY,{...l,...a,ref:t})});fN.displayName=pW;var xW="ContextMenuItem",pN=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Nr(n);return r.jsx(eW,{...l,...a,ref:t})});pN.displayName=xW;var gW="ContextMenuCheckboxItem",xN=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Nr(n);return r.jsx(tW,{...l,...a,ref:t})});xN.displayName=gW;var vW="ContextMenuRadioGroup",yW=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Nr(n);return r.jsx(nW,{...l,...a,ref:t})});yW.displayName=vW;var bW="ContextMenuRadioItem",gN=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Nr(n);return r.jsx(rW,{...l,...a,ref:t})});gN.displayName=bW;var wW="ContextMenuItemIndicator",vN=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Nr(n);return r.jsx(aW,{...l,...a,ref:t})});vN.displayName=wW;var jW="ContextMenuSeparator",yN=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Nr(n);return r.jsx(sW,{...l,...a,ref:t})});yN.displayName=jW;var NW="ContextMenuArrow",SW=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Nr(n);return r.jsx(lW,{...l,...a,ref:t})});SW.displayName=NW;var bN="ContextMenuSub",wN=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:a,open:l,defaultOpen:o}=e,c=Nr(t),[d,m]=Dl({prop:l,defaultProp:o??!1,onChange:a,caller:bN});return r.jsx(iW,{...c,open:d,onOpenChange:m,children:n})};wN.displayName=bN;var kW="ContextMenuSubTrigger",jN=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Nr(n);return r.jsx(oW,{...l,...a,ref:t})});jN.displayName=kW;var CW="ContextMenuSubContent",NN=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Nr(n);return r.jsx(cW,{...l,...a,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});NN.displayName=CW;function F0(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var TW=oN,_W=uN,MW=dN,SN=hN,kN=fN,CN=pN,TN=xN,_N=gN,MN=vN,EN=yN,EW=wN,AN=jN,DN=NN;const AW=TW,DW=_W,zW=EW,zN=w.forwardRef(({className:e,inset:t,children:n,...a},l)=>r.jsxs(AN,{ref:l,className:me("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...a,children:[n,r.jsx(yi,{className:"ml-auto h-4 w-4"})]}));zN.displayName=AN.displayName;const ON=w.forwardRef(({className:e,...t},n)=>r.jsx(DN,{ref:n,className:me("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 origin-[--radix-context-menu-content-transform-origin]",e),...t}));ON.displayName=DN.displayName;const RN=w.forwardRef(({className:e,...t},n)=>r.jsx(MW,{children:r.jsx(SN,{ref:n,className:me("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-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 origin-[--radix-context-menu-content-transform-origin]",e),...t})}));RN.displayName=SN.displayName;const Ba=w.forwardRef(({className:e,inset:t,...n},a)=>r.jsx(CN,{ref:a,className:me("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Ba.displayName=CN.displayName;const OW=w.forwardRef(({className:e,children:t,checked:n,...a},l)=>r.jsxs(TN,{ref:l,className:me("relative flex 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",e),checked:n,...a,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(MN,{children:r.jsx(di,{className:"h-4 w-4"})})}),t]}));OW.displayName=TN.displayName;const RW=w.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(_N,{ref:a,className:me("relative flex 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",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(MN,{children:r.jsx(ST,{className:"h-2 w-2 fill-current"})})}),t]}));RW.displayName=_N.displayName;const BW=w.forwardRef(({className:e,inset:t,...n},a)=>r.jsx(kN,{ref:a,className:me("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...n}));BW.displayName=kN.displayName;const su=w.forwardRef(({className:e,...t},n)=>r.jsx(EN,{ref:n,className:me("-mx-1 my-1 h-px bg-border",e),...t}));su.displayName=EN.displayName;const _o=({className:e,...t})=>r.jsx("span",{className:me("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});_o.displayName="ContextMenuShortcut";var LW=Symbol("radix.slottable");function PW(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=LW,t}var[Zm]=Ha("Tooltip",[Uo]),Jm=Uo(),BN="TooltipProvider",FW=700,r1="tooltip.open",[IW,Pg]=Zm(BN),LN=e=>{const{__scopeTooltip:t,delayDuration:n=FW,skipDelayDuration:a=300,disableHoverableContent:l=!1,children:o}=e,c=w.useRef(!0),d=w.useRef(!1),m=w.useRef(0);return w.useEffect(()=>{const f=m.current;return()=>window.clearTimeout(f)},[]),r.jsx(IW,{scope:t,isOpenDelayedRef:c,delayDuration:n,onOpen:w.useCallback(()=>{window.clearTimeout(m.current),c.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>c.current=!0,a)},[a]),isPointerInTransitRef:d,onPointerInTransitChange:w.useCallback(f=>{d.current=f},[]),disableHoverableContent:l,children:o})};LN.displayName=BN;var Cu="Tooltip",[qW,td]=Zm(Cu),PN=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:l,onOpenChange:o,disableHoverableContent:c,delayDuration:d}=e,m=Pg(Cu,e.__scopeTooltip),f=Jm(t),[p,x]=w.useState(null),y=Ta(),b=w.useRef(0),j=c??m.disableHoverableContent,k=d??m.delayDuration,S=w.useRef(!1),[_,M]=Dl({prop:a,defaultProp:l??!1,onChange:R=>{R?(m.onOpen(),document.dispatchEvent(new CustomEvent(r1))):m.onClose(),o?.(R)},caller:Cu}),D=w.useMemo(()=>_?S.current?"delayed-open":"instant-open":"closed",[_]),z=w.useCallback(()=>{window.clearTimeout(b.current),b.current=0,S.current=!1,M(!0)},[M]),L=w.useCallback(()=>{window.clearTimeout(b.current),b.current=0,M(!1)},[M]),E=w.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{S.current=!0,M(!0),b.current=0},k)},[k,M]);return w.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),r.jsx(jm,{...f,children:r.jsx(qW,{scope:t,contentId:y,open:_,stateAttribute:D,trigger:p,onTriggerChange:x,onTriggerEnter:w.useCallback(()=>{m.isOpenDelayedRef.current?E():z()},[m.isOpenDelayedRef,E,z]),onTriggerLeave:w.useCallback(()=>{j?L():(window.clearTimeout(b.current),b.current=0)},[L,j]),onOpen:z,onClose:L,disableHoverableContent:j,children:n})})};PN.displayName=Cu;var a1="TooltipTrigger",FN=w.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,l=td(a1,n),o=Pg(a1,n),c=Jm(n),d=w.useRef(null),m=dn(t,d,l.onTriggerChange),f=w.useRef(!1),p=w.useRef(!1),x=w.useCallback(()=>f.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",x),[x]),r.jsx(Nm,{asChild:!0,...c,children:r.jsx(Ft.button,{"aria-describedby":l.open?l.contentId:void 0,"data-state":l.stateAttribute,...a,ref:m,onPointerMove:Pe(e.onPointerMove,y=>{y.pointerType!=="touch"&&!p.current&&!o.isPointerInTransitRef.current&&(l.onTriggerEnter(),p.current=!0)}),onPointerLeave:Pe(e.onPointerLeave,()=>{l.onTriggerLeave(),p.current=!1}),onPointerDown:Pe(e.onPointerDown,()=>{l.open&&l.onClose(),f.current=!0,document.addEventListener("pointerup",x,{once:!0})}),onFocus:Pe(e.onFocus,()=>{f.current||l.onOpen()}),onBlur:Pe(e.onBlur,l.onClose),onClick:Pe(e.onClick,l.onClose)})})});FN.displayName=a1;var Fg="TooltipPortal",[HW,UW]=Zm(Fg,{forceMount:void 0}),IN=e=>{const{__scopeTooltip:t,forceMount:n,children:a,container:l}=e,o=td(Fg,t);return r.jsx(HW,{scope:t,forceMount:n,children:r.jsx(Wr,{present:n||o.open,children:r.jsx(wm,{asChild:!0,container:l,children:a})})})};IN.displayName=Fg;var Ho="TooltipContent",qN=w.forwardRef((e,t)=>{const n=UW(Ho,e.__scopeTooltip),{forceMount:a=n.forceMount,side:l="top",...o}=e,c=td(Ho,e.__scopeTooltip);return r.jsx(Wr,{present:a||c.open,children:c.disableHoverableContent?r.jsx(HN,{side:l,...o,ref:t}):r.jsx($W,{side:l,...o,ref:t})})}),$W=w.forwardRef((e,t)=>{const n=td(Ho,e.__scopeTooltip),a=Pg(Ho,e.__scopeTooltip),l=w.useRef(null),o=dn(t,l),[c,d]=w.useState(null),{trigger:m,onClose:f}=n,p=l.current,{onPointerInTransitChange:x}=a,y=w.useCallback(()=>{d(null),x(!1)},[x]),b=w.useCallback((j,k)=>{const S=j.currentTarget,_={x:j.clientX,y:j.clientY},M=XW(_,S.getBoundingClientRect()),D=KW(_,M),z=QW(k.getBoundingClientRect()),L=JW([...D,...z]);d(L),x(!0)},[x]);return w.useEffect(()=>()=>y(),[y]),w.useEffect(()=>{if(m&&p){const j=S=>b(S,p),k=S=>b(S,m);return m.addEventListener("pointerleave",j),p.addEventListener("pointerleave",k),()=>{m.removeEventListener("pointerleave",j),p.removeEventListener("pointerleave",k)}}},[m,p,b,y]),w.useEffect(()=>{if(c){const j=k=>{const S=k.target,_={x:k.clientX,y:k.clientY},M=m?.contains(S)||p?.contains(S),D=!ZW(_,c);M?y():D&&(y(),f())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[m,p,c,f,y]),r.jsx(HN,{...e,ref:o})}),[VW,GW]=Zm(Cu,{isInside:!1}),YW=PW("TooltipContent"),HN=w.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":l,onEscapeKeyDown:o,onPointerDownOutside:c,...d}=e,m=td(Ho,n),f=Jm(n),{onClose:p}=m;return w.useEffect(()=>(document.addEventListener(r1,p),()=>document.removeEventListener(r1,p)),[p]),w.useEffect(()=>{if(m.trigger){const x=y=>{y.target?.contains(m.trigger)&&p()};return window.addEventListener("scroll",x,{capture:!0}),()=>window.removeEventListener("scroll",x,{capture:!0})}},[m.trigger,p]),r.jsx(p1,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:x=>x.preventDefault(),onDismiss:p,children:r.jsxs(x1,{"data-state":m.stateAttribute,...f,...d,ref:t,style:{...d.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:[r.jsx(YW,{children:a}),r.jsx(VW,{scope:n,isInside:!0,children:r.jsx(tT,{id:m.contentId,role:"tooltip",children:l||a})})]})})});qN.displayName=Ho;var UN="TooltipArrow",WW=w.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,l=Jm(n);return GW(UN,n).isInside?null:r.jsx(g1,{...l,...a,ref:t})});WW.displayName=UN;function XW(e,t){const n=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),l=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,a,l,o)){case o:return"left";case l:return"right";case n:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function KW(e,t,n=5){const a=[];switch(t){case"top":a.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":a.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":a.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":a.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return a}function QW(e){const{top:t,right:n,bottom:a,left:l}=e;return[{x:l,y:t},{x:n,y:t},{x:n,y:a},{x:l,y:a}]}function ZW(e,t){const{x:n,y:a}=e;let l=!1;for(let o=0,c=t.length-1;oa!=y>a&&n<(x-f)*(a-p)/(y-p)+f&&(l=!l)}return l}function JW(e){const t=e.slice();return t.sort((n,a)=>n.xa.x?1:n.ya.y?1:0),eX(t)}function eX(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a=2;){const o=t[t.length-1],c=t[t.length-2];if((o.x-c.x)*(l.y-c.y)>=(o.y-c.y)*(l.x-c.x))t.pop();else break}t.push(l)}t.pop();const n=[];for(let a=e.length-1;a>=0;a--){const l=e[a];for(;n.length>=2;){const o=n[n.length-1],c=n[n.length-2];if((o.x-c.x)*(l.y-c.y)>=(o.y-c.y)*(l.x-c.x))n.pop();else break}n.push(l)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var tX=LN,nX=PN,rX=FN,aX=IN,$N=qN;const sX=tX,lX=nX,iX=rX,VN=w.forwardRef(({className:e,sideOffset:t=4,...n},a)=>r.jsx(aX,{children:r.jsx($N,{ref:a,sideOffset:t,className:me("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...n})}));VN.displayName=$N.displayName;function oX({children:e}){jA();const[t,n]=w.useState(!0),[a,l]=w.useState(!1),[o,c]=w.useState(!1),{theme:d,setTheme:m}=z1(),f=_C(),p=rs();w.useEffect(()=>{const k=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),c(!0))};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[]);const x=[{title:"概览",items:[{icon:K0,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:jl,label:"麦麦主程序配置",path:"/config/bot"},{icon:e6,label:"麦麦模型提供商配置",path:"/config/modelProvider"},{icon:t6,label:"麦麦模型配置",path:"/config/model"},{icon:Hy,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:v1,label:"表情包管理",path:"/resource/emoji"},{icon:_u,label:"表达方式管理",path:"/resource/expression"},{icon:n6,label:"人物信息管理",path:"/resource/person"}]},{title:"扩展与监控",items:[{icon:em,label:"插件市场",path:"/plugins"},{icon:Hy,label:"插件配置",path:"/plugin-config"},{icon:Q0,label:"日志查看器",path:"/logs"}]},{title:"系统",items:[{icon:Pa,label:"系统设置",path:"/settings"}]}],b=d==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":d,j=()=>{localStorage.removeItem("access-token"),p({to:"/auth"})};return r.jsx(sX,{delayDuration:300,children:r.jsxs("div",{className:"flex h-screen overflow-hidden",children:[r.jsxs("aside",{className:me("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",t?"lg:w-64":"lg:w-16",a?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[r.jsx("div",{className:"flex h-16 items-center border-b px-4",children:r.jsxs("div",{className:me("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!t&&"lg:flex-none lg:w-8"),children:[r.jsxs("div",{className:me("flex items-baseline gap-2",!t&&"lg:hidden"),children:[r.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),r.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:ZE()})]}),!t&&r.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),r.jsx("nav",{className:"flex-1 overflow-y-auto p-4",children:r.jsx("ul",{className:me("space-y-6",!t&&"lg:space-y-3"),children:x.map((k,S)=>r.jsxs("li",{children:[r.jsx("div",{className:me("px-3 h-[1.25rem]","mb-2",!t&&"lg:mb-1 lg:invisible"),children:r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:k.title})}),!t&&S>0&&r.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),r.jsx("ul",{className:"space-y-1",children:k.items.map(_=>{const M=f({to:_.path}),D=_.icon,z=r.jsxs(r.Fragment,{children:[M&&r.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),r.jsxs("div",{className:me("flex items-center transition-all duration-300",t?"gap-3":"lg:gap-0"),children:[r.jsx(D,{className:me("h-5 w-5 flex-shrink-0",M&&"text-primary"),strokeWidth:2,fill:"none"}),r.jsx("span",{className:me("text-sm font-medium whitespace-nowrap transition-all duration-300",M&&"font-semibold",t?"opacity-100 max-w-[200px]":"lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:_.label})]})]});return r.jsx("li",{className:"relative",children:r.jsxs(lX,{children:[r.jsx(iX,{asChild:!0,children:r.jsx(MC,{to:_.path,className:me("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",M?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",t?"px-3":"lg:px-0 lg:justify-center"),onClick:()=>l(!1),children:z})}),!t&&r.jsx(VN,{side:"right",className:"hidden lg:block",children:r.jsx("p",{children:_.label})})]})},_.path)})})]},k.title))})})]}),a&&r.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>l(!1)}),r.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[r.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("button",{onClick:()=>l(!a),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:r.jsx(kT,{className:"h-5 w-5"})}),r.jsx("button",{onClick:()=>n(!t),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:t?"收起侧边栏":"展开侧边栏",children:r.jsx(vi,{className:me("h-5 w-5 transition-transform",!t&&"rotate-180")})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("button",{onClick:()=>c(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[r.jsx(Gr,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),r.jsxs(R9,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[r.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),r.jsx(fY,{open:o,onOpenChange:c}),r.jsxs(re,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[r.jsx(CT,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),r.jsx("button",{onClick:k=>{LE(b==="dark"?"light":"dark",m,k)},className:"rounded-lg p-2 hover:bg-accent",title:b==="dark"?"切换到浅色模式":"切换到深色模式",children:b==="dark"?r.jsx(xx,{className:"h-5 w-5"}):r.jsx(gx,{className:"h-5 w-5"})}),r.jsx("div",{className:"h-6 w-px bg-border"}),r.jsxs(re,{variant:"ghost",size:"sm",onClick:j,className:"gap-2",title:"登出系统",children:[r.jsx(Uy,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),r.jsxs(AW,{children:[r.jsx(DW,{asChild:!0,children:r.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:e})}),r.jsxs(RN,{className:"w-64",children:[r.jsxs(Ba,{onClick:()=>p({to:"/"}),children:[r.jsx(K0,{className:"mr-2 h-4 w-4"}),"首页"]}),r.jsxs(Ba,{onClick:()=>p({to:"/settings"}),children:[r.jsx(Pa,{className:"mr-2 h-4 w-4"}),"系统设置"]}),r.jsxs(Ba,{onClick:()=>p({to:"/logs"}),children:[r.jsx(Q0,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),r.jsx(su,{}),r.jsxs(zW,{children:[r.jsxs(zN,{children:[r.jsx(Q5,{className:"mr-2 h-4 w-4"}),"切换主题"]}),r.jsxs(ON,{className:"w-48",children:[r.jsxs(Ba,{onClick:()=>m("light"),disabled:d==="light",children:[r.jsx(xx,{className:"mr-2 h-4 w-4"}),"浅色",d==="light"&&r.jsx(_o,{children:"✓"})]}),r.jsxs(Ba,{onClick:()=>m("dark"),disabled:d==="dark",children:[r.jsx(gx,{className:"mr-2 h-4 w-4"}),"深色",d==="dark"&&r.jsx(_o,{children:"✓"})]}),r.jsxs(Ba,{onClick:()=>m("system"),disabled:d==="system",children:[r.jsx(Pa,{className:"mr-2 h-4 w-4"}),"跟随系统",d==="system"&&r.jsx(_o,{children:"✓"})]})]})]}),r.jsx(su,{}),r.jsxs(Ba,{onClick:()=>window.location.reload(),children:[r.jsx(TT,{className:"mr-2 h-4 w-4"}),"刷新页面",r.jsx(_o,{children:"⌘R"})]}),r.jsxs(Ba,{onClick:()=>c(!0),children:[r.jsx(Gr,{className:"mr-2 h-4 w-4"}),"搜索",r.jsx(_o,{children:"⌘K"})]}),r.jsx(su,{}),r.jsxs(Ba,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[r.jsx(lu,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),r.jsx(su,{}),r.jsxs(Ba,{onClick:j,className:"text-destructive focus:text-destructive",children:[r.jsx(Uy,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}const nd=EC({component:()=>r.jsxs(r.Fragment,{children:[r.jsx(_5,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!l7())throw DC({to:"/auth"})}}),cX=fr({getParentRoute:()=>nd,path:"/auth",component:NA}),uX=fr({getParentRoute:()=>nd,path:"/setup",component:HA}),Zr=fr({getParentRoute:()=>nd,id:"protected",component:()=>r.jsx(oX,{children:r.jsx(_5,{})})}),dX=fr({getParentRoute:()=>Zr,path:"/",component:RE}),mX=fr({getParentRoute:()=>Zr,path:"/config/bot",component:zD}),hX=fr({getParentRoute:()=>Zr,path:"/config/modelProvider",component:XD}),fX=fr({getParentRoute:()=>Zr,path:"/config/model",component:Nz}),pX=fr({getParentRoute:()=>Zr,path:"/config/adapter",component:Sz}),xX=fr({getParentRoute:()=>Zr,path:"/resource/emoji",component:WH}),gX=fr({getParentRoute:()=>Zr,path:"/resource/expression",component:aU}),vX=fr({getParentRoute:()=>Zr,path:"/resource/person",component:pU}),yX=fr({getParentRoute:()=>Zr,path:"/logs",component:KG}),bX=fr({getParentRoute:()=>Zr,path:"/plugins",component:cY}),wX=fr({getParentRoute:()=>Zr,path:"/plugin-config",component:uY}),jX=fr({getParentRoute:()=>Zr,path:"/plugin-mirrors",component:dY}),NX=fr({getParentRoute:()=>Zr,path:"/settings",component:pA}),SX=fr({getParentRoute:()=>nd,path:"*",component:c7}),kX=nd.addChildren([cX,uX,Zr.addChildren([dX,mX,hX,fX,pX,xX,gX,vX,bX,wX,jX,yX,NX]),SX]),CX=AC({routeTree:kX,defaultNotFoundComponent:c7});function TX({children:e,defaultTheme:t="system",storageKey:n="ui-theme",...a}){const[l,o]=w.useState(()=>localStorage.getItem(n)||t);w.useEffect(()=>{const d=window.document.documentElement;if(d.classList.remove("light","dark"),l==="system"){const m=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";d.classList.add(m);return}d.classList.add(l)},[l]),w.useEffect(()=>{const d=localStorage.getItem("accent-color");if(d){const m=document.documentElement,p={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[d];p&&(m.style.setProperty("--primary",p.hsl),p.gradient?(m.style.setProperty("--primary-gradient",p.gradient),m.classList.add("has-gradient")):(m.style.removeProperty("--primary-gradient"),m.classList.remove("has-gradient")))}},[]);const c={theme:l,setTheme:d=>{localStorage.setItem(n,d),o(d)}};return r.jsx(Mw.Provider,{...a,value:c,children:e})}function _X({children:e,defaultEnabled:t=!0,defaultWavesEnabled:n=!0,storageKey:a="enable-animations",wavesStorageKey:l="enable-waves-background"}){const[o,c]=w.useState(()=>{const p=localStorage.getItem(a);return p!==null?p==="true":t}),[d,m]=w.useState(()=>{const p=localStorage.getItem(l);return p!==null?p==="true":n});w.useEffect(()=>{const p=document.documentElement;o?p.classList.remove("no-animations"):p.classList.add("no-animations"),localStorage.setItem(a,String(o))},[o,a]),w.useEffect(()=>{localStorage.setItem(l,String(d))},[d,l]);const f={enableAnimations:o,setEnableAnimations:c,enableWavesBackground:d,setEnableWavesBackground:m};return r.jsx(Ew.Provider,{value:f,children:e})}var Ig="ToastProvider",[qg,MX,EX]=vm("Toast"),[GN]=Ha("Toast",[EX]),[AX,eh]=GN(Ig),YN=e=>{const{__scopeToast:t,label:n="Notification",duration:a=5e3,swipeDirection:l="right",swipeThreshold:o=50,children:c}=e,[d,m]=w.useState(null),[f,p]=w.useState(0),x=w.useRef(!1),y=w.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Ig}\`. Expected non-empty \`string\`.`),r.jsx(qg.Provider,{scope:t,children:r.jsx(AX,{scope:t,label:n,duration:a,swipeDirection:l,swipeThreshold:o,toastCount:f,viewport:d,onViewportChange:m,onToastAdd:w.useCallback(()=>p(b=>b+1),[]),onToastRemove:w.useCallback(()=>p(b=>b-1),[]),isFocusedToastEscapeKeyDownRef:x,isClosePausedRef:y,children:c})})};YN.displayName=Ig;var WN="ToastViewport",DX=["F8"],s1="toast.viewportPause",l1="toast.viewportResume",XN=w.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:a=DX,label:l="Notifications ({hotkey})",...o}=e,c=eh(WN,n),d=MX(n),m=w.useRef(null),f=w.useRef(null),p=w.useRef(null),x=w.useRef(null),y=dn(t,x,c.onViewportChange),b=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),j=c.toastCount>0;w.useEffect(()=>{const S=_=>{a.length!==0&&a.every(D=>_[D]||_.code===D)&&x.current?.focus()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[a]),w.useEffect(()=>{const S=m.current,_=x.current;if(j&&S&&_){const M=()=>{if(!c.isClosePausedRef.current){const E=new CustomEvent(s1);_.dispatchEvent(E),c.isClosePausedRef.current=!0}},D=()=>{if(c.isClosePausedRef.current){const E=new CustomEvent(l1);_.dispatchEvent(E),c.isClosePausedRef.current=!1}},z=E=>{!S.contains(E.relatedTarget)&&D()},L=()=>{S.contains(document.activeElement)||D()};return S.addEventListener("focusin",M),S.addEventListener("focusout",z),S.addEventListener("pointermove",M),S.addEventListener("pointerleave",L),window.addEventListener("blur",M),window.addEventListener("focus",D),()=>{S.removeEventListener("focusin",M),S.removeEventListener("focusout",z),S.removeEventListener("pointermove",M),S.removeEventListener("pointerleave",L),window.removeEventListener("blur",M),window.removeEventListener("focus",D)}}},[j,c.isClosePausedRef]);const k=w.useCallback(({tabbingDirection:S})=>{const M=d().map(D=>{const z=D.ref.current,L=[z,...VX(z)];return S==="forwards"?L:L.reverse()});return(S==="forwards"?M.reverse():M).flat()},[d]);return w.useEffect(()=>{const S=x.current;if(S){const _=M=>{const D=M.altKey||M.ctrlKey||M.metaKey;if(M.key==="Tab"&&!D){const L=document.activeElement,E=M.shiftKey;if(M.target===S&&E){f.current?.focus();return}const $=k({tabbingDirection:E?"backwards":"forwards"}),I=$.findIndex(G=>G===L);mx($.slice(I+1))?M.preventDefault():E?f.current?.focus():p.current?.focus()}};return S.addEventListener("keydown",_),()=>S.removeEventListener("keydown",_)}},[d,k]),r.jsxs(nT,{ref:m,role:"region","aria-label":l.replace("{hotkey}",b),tabIndex:-1,style:{pointerEvents:j?void 0:"none"},children:[j&&r.jsx(i1,{ref:f,onFocusFromOutsideViewport:()=>{const S=k({tabbingDirection:"forwards"});mx(S)}}),r.jsx(qg.Slot,{scope:n,children:r.jsx(Ft.ol,{tabIndex:-1,...o,ref:y})}),j&&r.jsx(i1,{ref:p,onFocusFromOutsideViewport:()=>{const S=k({tabbingDirection:"backwards"});mx(S)}})]})});XN.displayName=WN;var KN="ToastFocusProxy",i1=w.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:a,...l}=e,o=eh(KN,n);return r.jsx(K5,{tabIndex:0,...l,ref:t,style:{position:"fixed"},onFocus:c=>{const d=c.relatedTarget;!o.viewport?.contains(d)&&a()}})});i1.displayName=KN;var rd="Toast",zX="toast.swipeStart",OX="toast.swipeMove",RX="toast.swipeCancel",BX="toast.swipeEnd",QN=w.forwardRef((e,t)=>{const{forceMount:n,open:a,defaultOpen:l,onOpenChange:o,...c}=e,[d,m]=Dl({prop:a,defaultProp:l??!0,onChange:o,caller:rd});return r.jsx(Wr,{present:n||d,children:r.jsx(FX,{open:d,...c,ref:t,onClose:()=>m(!1),onPause:gr(e.onPause),onResume:gr(e.onResume),onSwipeStart:Pe(e.onSwipeStart,f=>{f.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Pe(e.onSwipeMove,f=>{const{x:p,y:x}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","move"),f.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${p}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${x}px`)}),onSwipeCancel:Pe(e.onSwipeCancel,f=>{f.currentTarget.setAttribute("data-swipe","cancel"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Pe(e.onSwipeEnd,f=>{const{x:p,y:x}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","end"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${p}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${x}px`),m(!1)})})})});QN.displayName=rd;var[LX,PX]=GN(rd,{onClose(){}}),FX=w.forwardRef((e,t)=>{const{__scopeToast:n,type:a="foreground",duration:l,open:o,onClose:c,onEscapeKeyDown:d,onPause:m,onResume:f,onSwipeStart:p,onSwipeMove:x,onSwipeCancel:y,onSwipeEnd:b,...j}=e,k=eh(rd,n),[S,_]=w.useState(null),M=dn(t,J=>_(J)),D=w.useRef(null),z=w.useRef(null),L=l||k.duration,E=w.useRef(0),R=w.useRef(L),H=w.useRef(0),{onToastAdd:$,onToastRemove:I}=k,G=gr(()=>{S?.contains(document.activeElement)&&k.viewport?.focus(),c()}),te=w.useCallback(J=>{!J||J===1/0||(window.clearTimeout(H.current),E.current=new Date().getTime(),H.current=window.setTimeout(G,J))},[G]);w.useEffect(()=>{const J=k.viewport;if(J){const ae=()=>{te(R.current),f?.()},U=()=>{const q=new Date().getTime()-E.current;R.current=R.current-q,window.clearTimeout(H.current),m?.()};return J.addEventListener(s1,U),J.addEventListener(l1,ae),()=>{J.removeEventListener(s1,U),J.removeEventListener(l1,ae)}}},[k.viewport,L,m,f,te]),w.useEffect(()=>{o&&!k.isClosePausedRef.current&&te(L)},[o,L,k.isClosePausedRef,te]),w.useEffect(()=>($(),()=>I()),[$,I]);const we=w.useMemo(()=>S?aS(S):null,[S]);return k.viewport?r.jsxs(r.Fragment,{children:[we&&r.jsx(IX,{__scopeToast:n,role:"status","aria-live":a==="foreground"?"assertive":"polite",children:we}),r.jsx(LX,{scope:n,onClose:G,children:zC.createPortal(r.jsx(qg.ItemSlot,{scope:n,children:r.jsx(rT,{asChild:!0,onEscapeKeyDown:Pe(d,()=>{k.isFocusedToastEscapeKeyDownRef.current||G(),k.isFocusedToastEscapeKeyDownRef.current=!1}),children:r.jsx(Ft.li,{tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":k.swipeDirection,...j,ref:M,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Pe(e.onKeyDown,J=>{J.key==="Escape"&&(d?.(J.nativeEvent),J.nativeEvent.defaultPrevented||(k.isFocusedToastEscapeKeyDownRef.current=!0,G()))}),onPointerDown:Pe(e.onPointerDown,J=>{J.button===0&&(D.current={x:J.clientX,y:J.clientY})}),onPointerMove:Pe(e.onPointerMove,J=>{if(!D.current)return;const ae=J.clientX-D.current.x,U=J.clientY-D.current.y,q=!!z.current,W=["left","right"].includes(k.swipeDirection),oe=["left","up"].includes(k.swipeDirection)?Math.min:Math.max,P=W?oe(0,ae):0,je=W?0:oe(0,U),Z=J.pointerType==="touch"?10:2,O={x:P,y:je},Ne={originalEvent:J,delta:O};q?(z.current=O,I0(OX,x,Ne,{discrete:!1})):T5(O,k.swipeDirection,Z)?(z.current=O,I0(zX,p,Ne,{discrete:!1}),J.target.setPointerCapture(J.pointerId)):(Math.abs(ae)>Z||Math.abs(U)>Z)&&(D.current=null)}),onPointerUp:Pe(e.onPointerUp,J=>{const ae=z.current,U=J.target;if(U.hasPointerCapture(J.pointerId)&&U.releasePointerCapture(J.pointerId),z.current=null,D.current=null,ae){const q=J.currentTarget,W={originalEvent:J,delta:ae};T5(ae,k.swipeDirection,k.swipeThreshold)?I0(BX,b,W,{discrete:!0}):I0(RX,y,W,{discrete:!0}),q.addEventListener("click",oe=>oe.preventDefault(),{once:!0})}})})})}),k.viewport)})]}):null}),IX=e=>{const{__scopeToast:t,children:n,...a}=e,l=eh(rd,t),[o,c]=w.useState(!1),[d,m]=w.useState(!1);return UX(()=>c(!0)),w.useEffect(()=>{const f=window.setTimeout(()=>m(!0),1e3);return()=>window.clearTimeout(f)},[]),d?null:r.jsx(wm,{asChild:!0,children:r.jsx(K5,{...a,children:o&&r.jsxs(r.Fragment,{children:[l.label," ",n]})})})},qX="ToastTitle",ZN=w.forwardRef((e,t)=>{const{__scopeToast:n,...a}=e;return r.jsx(Ft.div,{...a,ref:t})});ZN.displayName=qX;var HX="ToastDescription",JN=w.forwardRef((e,t)=>{const{__scopeToast:n,...a}=e;return r.jsx(Ft.div,{...a,ref:t})});JN.displayName=HX;var eS="ToastAction",tS=w.forwardRef((e,t)=>{const{altText:n,...a}=e;return n.trim()?r.jsx(rS,{altText:n,asChild:!0,children:r.jsx(Hg,{...a,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${eS}\`. Expected non-empty \`string\`.`),null)});tS.displayName=eS;var nS="ToastClose",Hg=w.forwardRef((e,t)=>{const{__scopeToast:n,...a}=e,l=PX(nS,n);return r.jsx(rS,{asChild:!0,children:r.jsx(Ft.button,{type:"button",...a,ref:t,onClick:Pe(e.onClick,l.onClose)})})});Hg.displayName=nS;var rS=w.forwardRef((e,t)=>{const{__scopeToast:n,altText:a,...l}=e;return r.jsx(Ft.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":a||void 0,...l,ref:t})});function aS(e){const t=[];return Array.from(e.childNodes).forEach(a=>{if(a.nodeType===a.TEXT_NODE&&a.textContent&&t.push(a.textContent),$X(a)){const l=a.ariaHidden||a.hidden||a.style.display==="none",o=a.dataset.radixToastAnnounceExclude==="";if(!l)if(o){const c=a.dataset.radixToastAnnounceAlt;c&&t.push(c)}else t.push(...aS(a))}}),t}function I0(e,t,n,{discrete:a}){const l=n.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&l.addEventListener(e,t,{once:!0}),a?X5(l,o):l.dispatchEvent(o)}var T5=(e,t,n=0)=>{const a=Math.abs(e.x),l=Math.abs(e.y),o=a>l;return t==="left"||t==="right"?o&&a>n:!o&&l>n};function UX(e=()=>{}){const t=gr(e);A5(()=>{let n=0,a=0;return n=window.requestAnimationFrame(()=>a=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(a)}},[t])}function $X(e){return e.nodeType===e.ELEMENT_NODE}function VX(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const l=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||l?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function mx(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var GX=YN,sS=XN,lS=QN,iS=ZN,oS=JN,cS=tS,uS=Hg;const YX=GX,dS=w.forwardRef(({className:e,...t},n)=>r.jsx(sS,{ref:n,className:me("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));dS.displayName=sS.displayName;const WX=Wo("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),mS=w.forwardRef(({className:e,variant:t,...n},a)=>r.jsx(lS,{ref:a,className:me(WX({variant:t}),e),...n}));mS.displayName=lS.displayName;const XX=w.forwardRef(({className:e,...t},n)=>r.jsx(cS,{ref:n,className:me("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));XX.displayName=cS.displayName;const hS=w.forwardRef(({className:e,...t},n)=>r.jsx(uS,{ref:n,className:me("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:r.jsx(Mu,{className:"h-4 w-4"})}));hS.displayName=uS.displayName;const fS=w.forwardRef(({className:e,...t},n)=>r.jsx(iS,{ref:n,className:me("text-sm font-semibold [&+div]:text-xs",e),...t}));fS.displayName=iS.displayName;const pS=w.forwardRef(({className:e,...t},n)=>r.jsx(oS,{ref:n,className:me("text-sm opacity-90",e),...t}));pS.displayName=oS.displayName;function KX(){const{toasts:e}=pr();return r.jsxs(YX,{children:[e.map(function({id:t,title:n,description:a,action:l,...o}){return r.jsxs(mS,{...o,children:[r.jsxs("div",{className:"grid gap-1",children:[n&&r.jsx(fS,{children:n}),a&&r.jsx(pS,{children:a})]}),l,r.jsx(hS,{})]},t)}),r.jsx(dS,{})]})}DT.createRoot(document.getElementById("root")).render(r.jsx(w.StrictMode,{children:r.jsx(TX,{defaultTheme:"system",children:r.jsxs(_X,{children:[r.jsx(OC,{router:CX}),r.jsx(KX,{})]})})})); diff --git a/webui/dist/index.html b/webui/dist/index.html index 379c953d..38883573 100644 --- a/webui/dist/index.html +++ b/webui/dist/index.html @@ -5,13 +5,13 @@ MaiBot Dashboard - + - - + +
From 028d747d7d5354a096f9575b95c0c3339fb67524 Mon Sep 17 00:00:00 2001 From: SengokuCola <1026294844@qq.com> Date: Thu, 20 Nov 2025 15:18:15 +0800 Subject: [PATCH 05/11] =?UTF-8?q?better=EF=BC=9A=E4=BC=98=E5=8C=96planner?= =?UTF-8?q?=E5=92=8Creplyer=E5=8D=8F=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chat/planner_actions/planner.py | 49 ++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/src/chat/planner_actions/planner.py b/src/chat/planner_actions/planner.py index 7af3291a..5771feed 100644 --- a/src/chat/planner_actions/planner.py +++ b/src/chat/planner_actions/planner.py @@ -7,7 +7,6 @@ from typing import Dict, Optional, Tuple, List, TYPE_CHECKING, Union from rich.traceback import install from datetime import datetime from json_repair import repair_json - from src.llm_models.utils_model import LLMRequest from src.config.config import global_config, model_config from src.common.logger import get_logger @@ -164,6 +163,45 @@ class ActionPlanner: return item[1] return None + def _replace_message_ids_with_text( + self, text: Optional[str], message_id_list: List[Tuple[str, "DatabaseMessages"]] + ) -> Optional[str]: + """将文本中的 m+数字 消息ID替换为原消息内容,并添加双引号""" + if not text: + return text + + id_to_message = {msg_id: msg for msg_id, msg in message_id_list} + + # 匹配m后带2-4位数字,前后不是字母数字下划线 + pattern = r"(? str: + msg_id = match.group(0) + message = id_to_message.get(msg_id) + if not message: + logger.warning(f"{self.log_prefix}planner理由引用 {msg_id} 未找到对应消息,保持原样") + return msg_id + + msg_text = (message.processed_plain_text or message.display_message or "").strip() + if not msg_text: + logger.warning(f"{self.log_prefix}planner理由引用 {msg_id} 的消息内容为空,保持原样") + return msg_id + + preview = msg_text if len(msg_text) <= 100 else f"{msg_text[:97]}..." + logger.info(f"{self.log_prefix}planner理由引用 {msg_id} -> 消息({preview})") + return f"消息({msg_text})" + + return re.sub(pattern, _replace, text) + def _parse_single_action( self, action_json: dict, @@ -176,7 +214,10 @@ class ActionPlanner: try: action = action_json.get("action", "no_reply") - reasoning = action_json.get("reason", "未提供原因") + original_reasoning = action_json.get("reason", "未提供原因") + reasoning = self._replace_message_ids_with_text(original_reasoning, message_id_list) + if reasoning is None: + reasoning = original_reasoning action_data = {key: value for key, value in action_json.items() if key not in ["action", "reason"]} # 非no_reply动作需要target_message_id target_message = None @@ -573,9 +614,6 @@ class ActionPlanner: # 调用LLM llm_content, (reasoning_content, _, _) = await self.planner_llm.generate_response_async(prompt=prompt) - # logger.info(f"{self.log_prefix}规划器原始提示词: {prompt}") - # logger.info(f"{self.log_prefix}规划器原始响应: {llm_content}") - if global_config.debug.show_planner_prompt: logger.info(f"{self.log_prefix}规划器原始提示词: {prompt}") logger.info(f"{self.log_prefix}规划器原始响应: {llm_content}") @@ -604,6 +642,7 @@ class ActionPlanner: if llm_content: try: json_objects, extracted_reasoning = self._extract_json_from_markdown(llm_content) + extracted_reasoning = self._replace_message_ids_with_text(extracted_reasoning, message_id_list) or "" if json_objects: logger.debug(f"{self.log_prefix}从响应中提取到{len(json_objects)}个JSON对象") filtered_actions_list = list(filtered_actions.items()) From 5c2ee7378f489b64efe7ed629ed6c476412beab5 Mon Sep 17 00:00:00 2001 From: SengokuCola <1026294844@qq.com> Date: Thu, 20 Nov 2025 15:19:32 +0800 Subject: [PATCH 06/11] Update changelog.md --- changelogs/changelog.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/changelogs/changelog.md b/changelogs/changelog.md index ba6921be..6f60b468 100644 --- a/changelogs/changelog.md +++ b/changelogs/changelog.md @@ -1,7 +1,10 @@ # Changelog ## [0.11.5] - 2025-11-21 +### 功能更改和修复 +- 优化planner和replyer的协同 +- 细化debug的log -## [0.11.4] - 2025-11-20 +## [0.11.4] - 2025-11-19 ### 🌟 主要更新内容 - **首个官方 Web 管理界面上线**:在此版本之前,MaiBot 没有 WebUI,所有配置需手动编辑 TOML 文件 - **认证系统**:Token 安全登录(支持系统生成 64 位随机令牌 / 自定义 Token),首次配置向导 @@ -41,7 +44,7 @@ 告别手动编辑配置文件,享受现代化图形界面! -## [0.11.3] - 2025-11-19 +## [0.11.3] - 2025-11-18 ### 功能更改和修复 - 优化记忆提取策略 - 优化黑话提取 From 948978631d7117b117d8844f3afa3b8a1ade4cec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Thu, 20 Nov 2025 15:45:56 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=92=8C=E6=9B=B4=E6=96=B0=E9=BA=A6=E9=BA=A6=E4=B8=BB=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E9=85=8D=E7=BD=AE=E5=8E=9F=E5=A7=8B=20TOML=20?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/webui/config_routes.py | 52 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/webui/config_routes.py b/src/webui/config_routes.py index 40801f91..84c660ae 100644 --- a/src/webui/config_routes.py +++ b/src/webui/config_routes.py @@ -319,6 +319,58 @@ async def update_bot_config_section(section_name: str, section_data: Any = Body( raise HTTPException(status_code=500, detail=f"更新配置节失败: {str(e)}") +# ===== 原始 TOML 文件操作接口 ===== + + +@router.get("/bot/raw") +async def get_bot_config_raw(): + """获取麦麦主程序配置的原始 TOML 内容""" + try: + config_path = os.path.join(CONFIG_DIR, "bot_config.toml") + if not os.path.exists(config_path): + raise HTTPException(status_code=404, detail="配置文件不存在") + + with open(config_path, "r", encoding="utf-8") as f: + raw_content = f.read() + + return {"success": True, "content": raw_content} + except HTTPException: + raise + except Exception as e: + logger.error(f"读取配置文件失败: {e}") + raise HTTPException(status_code=500, detail=f"读取配置文件失败: {str(e)}") + + +@router.post("/bot/raw") +async def update_bot_config_raw(raw_content: str = Body(..., embed=True)): + """更新麦麦主程序配置(直接保存原始 TOML 内容,会先验证格式)""" + try: + # 验证 TOML 格式 + try: + config_data = tomlkit.loads(raw_content) + except Exception as e: + raise HTTPException(status_code=400, detail=f"TOML 格式错误: {str(e)}") + + # 验证配置数据结构 + try: + Config.from_dict(config_data) + except Exception as e: + raise HTTPException(status_code=400, detail=f"配置数据验证失败: {str(e)}") + + # 保存配置文件 + config_path = os.path.join(CONFIG_DIR, "bot_config.toml") + with open(config_path, "w", encoding="utf-8") as f: + f.write(raw_content) + + logger.info("麦麦主程序配置已更新(原始模式)") + return {"success": True, "message": "配置已保存"} + except HTTPException: + raise + except Exception as e: + logger.error(f"保存配置文件失败: {e}") + raise HTTPException(status_code=500, detail=f"保存配置文件失败: {str(e)}") + + @router.post("/model/section/{section_name}") async def update_model_config_section(section_name: str, section_data: Any = Body(...)): """更新模型配置的指定节(保留注释和格式)""" From 89db47d9406a63cd5d0ca8897d5c7511c36e1340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Thu, 20 Nov 2025 15:47:46 +0800 Subject: [PATCH 08/11] upload WebUI 0.11.5 Beta.909beab DashBoard after Build Files commit hash : 909beabe843b471d69bb7da9021237c0fb7536c8 --- ...{charts-DU5SeejN.js => charts-B1JvyJzO.js} | 70 ++-- webui/dist/assets/icons-8vbl1orV.js | 1 - webui/dist/assets/icons-D6w7t-x9.js | 1 + webui/dist/assets/index-B-xgVyqE.js | 359 ++++++++++++++++++ webui/dist/assets/index-BExEVKIA.js | 344 ----------------- webui/dist/index.html | 6 +- 6 files changed, 398 insertions(+), 383 deletions(-) rename webui/dist/assets/{charts-DU5SeejN.js => charts-B1JvyJzO.js} (72%) delete mode 100644 webui/dist/assets/icons-8vbl1orV.js create mode 100644 webui/dist/assets/icons-D6w7t-x9.js create mode 100644 webui/dist/assets/index-B-xgVyqE.js delete mode 100644 webui/dist/assets/index-BExEVKIA.js diff --git a/webui/dist/assets/charts-DU5SeejN.js b/webui/dist/assets/charts-B1JvyJzO.js similarity index 72% rename from webui/dist/assets/charts-DU5SeejN.js rename to webui/dist/assets/charts-B1JvyJzO.js index 4b6aaf32..7d2ae929 100644 --- a/webui/dist/assets/charts-DU5SeejN.js +++ b/webui/dist/assets/charts-B1JvyJzO.js @@ -1,49 +1,49 @@ -import{r as N,R as S,i as Qt}from"./router-BWgTyY51.js";import{c as vi,g as oe}from"./react-vendor-Dtc2IqVY.js";function zb(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t-1}return Ho=t,Ho}var Ko,Op;function PO(){if(Op)return Ko;Op=1;var e=ja();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return Ko=t,Ko}var Go,_p;function Ma(){if(_p)return Go;_p=1;var e=OO(),t=_O(),r=AO(),n=SO(),i=PO();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u0?1:-1},Gt=function(t){return er(t)&&t.indexOf("%")===t.length-1},q=function(t){return XO(t)&&!oi(t)},YO=function(t){return Y(t)},Ae=function(t){return q(t)||er(t)},ZO=0,Zr=function(t){var r=++ZO;return"".concat(t||"").concat(r)},Ie=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!q(t)&&!er(t))return n;var a;if(Gt(t)){var o=t.indexOf("%");a=r*parseFloat(t.slice(0,o))/100}else a=+t;return oi(a)&&(a=n),i&&a>r&&(a=r),a},Mt=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},JO=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function a_(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function ml(e){"@babel/helpers - typeof";return ml=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ml(e)}var Zp={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},bt=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},Jp=null,bu=null,Kf=function e(t){if(t===Jp&&Array.isArray(bu))return bu;var r=[];return N.Children.forEach(t,function(n){Y(n)||(HO.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),bu=r,Jp=t,r};function Ke(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(i){return bt(i)}):n=[bt(t)],Kf(e).forEach(function(i){var a=He(i,"type.displayName")||He(i,"type.name");n.indexOf(a)!==-1&&r.push(i)}),r}function We(e,t){var r=Ke(e,t);return r&&r[0]}var Qp=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,i=r.height;return!(!q(n)||n<=0||!q(i)||i<=0)},o_=["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"],u_=function(t){return t&&t.type&&er(t.type)&&o_.indexOf(t.type)>=0},c_=function(t){return t&&ml(t)==="object"&&"clipDot"in t},s_=function(t,r,n,i){var a,o=(a=gu?.[i])!==null&&a!==void 0?a:[];return r.startsWith("data-")||!X(t)&&(i&&o.includes(r)||t_.includes(r))||n&&Hf.includes(r)},H=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(N.isValidElement(t)&&(i=t.props),!Yr(i))return null;var a={};return Object.keys(i).forEach(function(o){var u;s_((u=i)===null||u===void 0?void 0:u[o],o,r,n)&&(a[o]=i[o])}),a},gl=function e(t,r){if(t===r)return!0;var n=N.Children.count(t);if(n!==N.Children.count(r))return!1;if(n===0)return!0;if(n===1)return ed(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function d_(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function xl(e){var t=e.children,r=e.width,n=e.height,i=e.viewBox,a=e.className,o=e.style,u=e.title,c=e.desc,s=p_(e,h_),f=i||{width:r,height:n,x:0,y:0},l=J("recharts-surface",a);return S.createElement("svg",bl({},H(s,!0,"svg"),{className:l,width:r,height:n,style:o,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height)}),S.createElement("title",null,u),S.createElement("desc",null,c),t)}var v_=["children","className"];function wl(){return wl=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function m_(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var te=S.forwardRef(function(e,t){var r=e.children,n=e.className,i=y_(e,v_),a=J("recharts-layer",n);return S.createElement("g",wl({className:a},H(i,!0),{ref:t}),r)}),it=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;aa?0:a+r),n=n>a?a:n,n<0&&(n+=a),a=r>n?0:n-r>>>0,r>>>=0;for(var o=Array(a);++i=a?r:e(r,n,i)}return wu=t,wu}var Ou,id;function Zb(){if(id)return Ou;id=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="\\u200d",u=RegExp("["+o+e+i+a+"]");function c(s){return u.test(s)}return Ou=c,Ou}var _u,ad;function x_(){if(ad)return _u;ad=1;function e(t){return t.split("")}return _u=e,_u}var Au,od;function w_(){if(od)return Au;od=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="["+e+"]",u="["+i+"]",c="\\ud83c[\\udffb-\\udfff]",s="(?:"+u+"|"+c+")",f="[^"+e+"]",l="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",d="\\u200d",y=s+"?",v="["+a+"]?",p="(?:"+d+"(?:"+[f,l,h].join("|")+")"+v+y+")*",g=v+y+p,x="(?:"+[f+u+"?",u,l,h,o].join("|")+")",w=RegExp(c+"(?="+c+")|"+x+g,"g");function O(m){return m.match(w)||[]}return Au=O,Au}var Su,ud;function O_(){if(ud)return Su;ud=1;var e=x_(),t=Zb(),r=w_();function n(i){return t(i)?r(i):e(i)}return Su=n,Su}var Pu,cd;function __(){if(cd)return Pu;cd=1;var e=b_(),t=Zb(),r=O_(),n=Gb();function i(a){return function(o){o=n(o);var u=t(o)?r(o):void 0,c=u?u[0]:o.charAt(0),s=u?e(u,1).join(""):o.slice(1);return c[a]()+s}}return Pu=i,Pu}var Tu,sd;function A_(){if(sd)return Tu;sd=1;var e=__(),t=e("toUpperCase");return Tu=t,Tu}var S_=A_();const Ia=oe(S_);function se(e){return function(){return e}}const Jb=Math.cos,Ci=Math.sin,at=Math.sqrt,Ii=Math.PI,ka=2*Ii,Ol=Math.PI,_l=2*Ol,Ut=1e-6,P_=_l-Ut;function Qb(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Qb;const r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;iUt)if(!(Math.abs(l*c-s*f)>Ut)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let d=n-o,y=i-u,v=c*c+s*s,p=d*d+y*y,g=Math.sqrt(v),x=Math.sqrt(h),w=a*Math.tan((Ol-Math.acos((v+h-p)/(2*g*x)))/2),O=w/x,m=w/g;Math.abs(O-1)>Ut&&this._append`L${t+O*f},${r+O*l}`,this._append`A${a},${a},0,0,${+(l*d>f*y)},${this._x1=t+m*c},${this._y1=r+m*s}`}}arc(t,r,n,i,a,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let u=n*Math.cos(i),c=n*Math.sin(i),s=t+u,f=r+c,l=1^o,h=o?i-a:a-i;this._x1===null?this._append`M${s},${f}`:(Math.abs(this._x1-s)>Ut||Math.abs(this._y1-f)>Ut)&&this._append`L${s},${f}`,n&&(h<0&&(h=h%_l+_l),h>P_?this._append`A${n},${n},0,1,${l},${t-u},${r-c}A${n},${n},0,1,${l},${this._x1=s},${this._y1=f}`:h>Ut&&this._append`A${n},${n},0,${+(h>=Ol)},${l},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function Gf(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new E_(t)}function Vf(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function e0(e){this._context=e}e0.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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Ra(e){return new e0(e)}function t0(e){return e[0]}function r0(e){return e[1]}function n0(e,t){var r=se(!0),n=null,i=Ra,a=null,o=Gf(u);e=typeof e=="function"?e:e===void 0?t0:se(e),t=typeof t=="function"?t:t===void 0?r0:se(t);function u(c){var s,f=(c=Vf(c)).length,l,h=!1,d;for(n==null&&(a=i(d=o())),s=0;s<=f;++s)!(s=d;--y)u.point(w[y],O[y]);u.lineEnd(),u.areaEnd()}g&&(w[h]=+e(p,h,l),O[h]=+t(p,h,l),u.point(n?+n(p,h,l):w[h],r?+r(p,h,l):O[h]))}if(x)return u=null,x+""||null}function f(){return n0().defined(i).curve(o).context(a)}return s.x=function(l){return arguments.length?(e=typeof l=="function"?l:se(+l),n=null,s):e},s.x0=function(l){return arguments.length?(e=typeof l=="function"?l:se(+l),s):e},s.x1=function(l){return arguments.length?(n=l==null?null:typeof l=="function"?l:se(+l),s):n},s.y=function(l){return arguments.length?(t=typeof l=="function"?l:se(+l),r=null,s):t},s.y0=function(l){return arguments.length?(t=typeof l=="function"?l:se(+l),s):t},s.y1=function(l){return arguments.length?(r=l==null?null:typeof l=="function"?l:se(+l),s):r},s.lineX0=s.lineY0=function(){return f().x(e).y(t)},s.lineY1=function(){return f().x(e).y(r)},s.lineX1=function(){return f().x(n).y(t)},s.defined=function(l){return arguments.length?(i=typeof l=="function"?l:se(!!l),s):i},s.curve=function(l){return arguments.length?(o=l,a!=null&&(u=o(a)),s):o},s.context=function(l){return arguments.length?(l==null?a=u=null:u=o(a=l),s):a},s}class i0{constructor(t,r){this._context=t,this._x=r}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(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function j_(e){return new i0(e,!0)}function M_(e){return new i0(e,!1)}const Xf={draw(e,t){const r=at(t/Ii);e.moveTo(r,0),e.arc(0,0,r,0,ka)}},$_={draw(e,t){const r=at(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},a0=at(1/3),C_=a0*2,I_={draw(e,t){const r=at(t/C_),n=r*a0;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},k_={draw(e,t){const r=at(t),n=-r/2;e.rect(n,n,r,r)}},R_=.8908130915292852,o0=Ci(Ii/10)/Ci(7*Ii/10),D_=Ci(ka/10)*o0,N_=-Jb(ka/10)*o0,q_={draw(e,t){const r=at(t*R_),n=D_*r,i=N_*r;e.moveTo(0,-r),e.lineTo(n,i);for(let a=1;a<5;++a){const o=ka*a/5,u=Jb(o),c=Ci(o);e.lineTo(c*r,-u*r),e.lineTo(u*n-c*i,c*n+u*i)}e.closePath()}},Eu=at(3),L_={draw(e,t){const r=-at(t/(Eu*3));e.moveTo(0,r*2),e.lineTo(-Eu*r,-r),e.lineTo(Eu*r,-r),e.closePath()}},Ge=-.5,Ve=at(3)/2,Al=1/at(12),B_=(Al/2+1)*3,F_={draw(e,t){const r=at(t/B_),n=r/2,i=r*Al,a=n,o=r*Al+r,u=-a,c=o;e.moveTo(n,i),e.lineTo(a,o),e.lineTo(u,c),e.lineTo(Ge*n-Ve*i,Ve*n+Ge*i),e.lineTo(Ge*a-Ve*o,Ve*a+Ge*o),e.lineTo(Ge*u-Ve*c,Ve*u+Ge*c),e.lineTo(Ge*n+Ve*i,Ge*i-Ve*n),e.lineTo(Ge*a+Ve*o,Ge*o-Ve*a),e.lineTo(Ge*u+Ve*c,Ge*c-Ve*u),e.closePath()}};function W_(e,t){let r=null,n=Gf(i);e=typeof e=="function"?e:se(e||Xf),t=typeof t=="function"?t:se(t===void 0?64:+t);function i(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:se(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:se(+a),i):t},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function ki(){}function Ri(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function u0(e){this._context=e}u0.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:Ri(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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);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:Ri(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function z_(e){return new u0(e)}function c0(e){this._context=e}c0.prototype={areaStart:ki,areaEnd:ki,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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Ri(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function U_(e){return new c0(e)}function s0(e){this._context=e}s0.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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Ri(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function H_(e){return new s0(e)}function l0(e){this._context=e}l0.prototype={areaStart:ki,areaEnd:ki,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function K_(e){return new l0(e)}function ld(e){return e<0?-1:1}function fd(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),u=(a*i+o*n)/(n+i);return(ld(a)+ld(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(u))||0}function hd(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function ju(e,t,r){var n=e._x0,i=e._y0,a=e._x1,o=e._y1,u=(a-n)/3;e._context.bezierCurveTo(n+u,i+u*t,a-u,o-u*r,a,o)}function Di(e){this._context=e}Di.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:ju(this,this._t0,hd(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,ju(this,hd(this,r=fd(this,e,t)),r);break;default:ju(this,this._t0,r=fd(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function f0(e){this._context=new h0(e)}(f0.prototype=Object.create(Di.prototype)).point=function(e,t){Di.prototype.point.call(this,t,e)};function h0(e){this._context=e}h0.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}};function G_(e){return new Di(e)}function V_(e){return new f0(e)}function p0(e){this._context=e}p0.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=pd(e),i=pd(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function Y_(e){return new Da(e,.5)}function Z_(e){return new Da(e,0)}function J_(e){return new Da(e,1)}function Ar(e,t){if((o=e.length)>1)for(var r=1,n,i,a=e[t[0]],o,u=a.length;r=0;)r[t]=t;return r}function Q_(e,t){return e[t]}function e1(e){const t=[];return t.key=e,t}function t1(){var e=se([]),t=Sl,r=Ar,n=Q_;function i(a){var o=Array.from(e.apply(this,arguments),e1),u,c=o.length,s=-1,f;for(const l of a)for(u=0,++s;u0){for(var r,n,i=0,a=e[0].length,o;i0){for(var r=0,n=e[t[0]],i,a=n.length;r0)||!((a=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,a,o;n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function l1(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var d0={symbolCircle:Xf,symbolCross:$_,symbolDiamond:I_,symbolSquare:k_,symbolStar:q_,symbolTriangle:L_,symbolWye:F_},f1=Math.PI/180,h1=function(t){var r="symbol".concat(Ia(t));return d0[r]||Xf},p1=function(t,r,n){if(r==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*f1;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},d1=function(t,r){d0["symbol".concat(Ia(t))]=r},Yf=function(t){var r=t.type,n=r===void 0?"circle":r,i=t.size,a=i===void 0?64:i,o=t.sizeType,u=o===void 0?"area":o,c=s1(t,a1),s=vd(vd({},c),{},{type:n,size:a,sizeType:u}),f=function(){var p=h1(n),g=W_().type(p).size(p1(a,u,n));return g()},l=s.className,h=s.cx,d=s.cy,y=H(s,!0);return h===+h&&d===+d&&a===+a?S.createElement("path",Pl({},y,{className:J("recharts-symbols",l),transform:"translate(".concat(h,", ").concat(d,")"),d:f()})):null};Yf.registerSymbol=d1;function Sr(e){"@babel/helpers - typeof";return Sr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sr(e)}function Tl(){return Tl=Object.assign?Object.assign.bind():function(e){for(var t=1;t-1}return Ho=t,Ho}var Ko,Op;function TO(){if(Op)return Ko;Op=1;var e=ja();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return Ko=t,Ko}var Go,_p;function Ma(){if(_p)return Go;_p=1;var e=_O(),t=AO(),r=SO(),n=PO(),i=TO();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u0?1:-1},Gt=function(t){return er(t)&&t.indexOf("%")===t.length-1},q=function(t){return YO(t)&&!oi(t)},ZO=function(t){return Y(t)},Ae=function(t){return q(t)||er(t)},JO=0,Zr=function(t){var r=++JO;return"".concat(t||"").concat(r)},Ie=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!q(t)&&!er(t))return n;var a;if(Gt(t)){var o=t.indexOf("%");a=r*parseFloat(t.slice(0,o))/100}else a=+t;return oi(a)&&(a=n),i&&a>r&&(a=r),a},Mt=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},QO=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function o_(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function ml(e){"@babel/helpers - typeof";return ml=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ml(e)}var Zp={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},bt=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},Jp=null,bu=null,Kf=function e(t){if(t===Jp&&Array.isArray(bu))return bu;var r=[];return N.Children.forEach(t,function(n){Y(n)||(KO.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),bu=r,Jp=t,r};function Ke(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(i){return bt(i)}):n=[bt(t)],Kf(e).forEach(function(i){var a=He(i,"type.displayName")||He(i,"type.name");n.indexOf(a)!==-1&&r.push(i)}),r}function We(e,t){var r=Ke(e,t);return r&&r[0]}var Qp=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,i=r.height;return!(!q(n)||n<=0||!q(i)||i<=0)},u_=["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"],c_=function(t){return t&&t.type&&er(t.type)&&u_.indexOf(t.type)>=0},s_=function(t){return t&&ml(t)==="object"&&"clipDot"in t},l_=function(t,r,n,i){var a,o=(a=gu?.[i])!==null&&a!==void 0?a:[];return r.startsWith("data-")||!X(t)&&(i&&o.includes(r)||r_.includes(r))||n&&Hf.includes(r)},H=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(N.isValidElement(t)&&(i=t.props),!Yr(i))return null;var a={};return Object.keys(i).forEach(function(o){var u;l_((u=i)===null||u===void 0?void 0:u[o],o,r,n)&&(a[o]=i[o])}),a},gl=function e(t,r){if(t===r)return!0;var n=N.Children.count(t);if(n!==N.Children.count(r))return!1;if(n===0)return!0;if(n===1)return ed(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function v_(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function xl(e){var t=e.children,r=e.width,n=e.height,i=e.viewBox,a=e.className,o=e.style,u=e.title,c=e.desc,s=d_(e,p_),f=i||{width:r,height:n,x:0,y:0},l=J("recharts-surface",a);return S.createElement("svg",bl({},H(s,!0,"svg"),{className:l,width:r,height:n,style:o,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height)}),S.createElement("title",null,u),S.createElement("desc",null,c),t)}var y_=["children","className"];function wl(){return wl=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function g_(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var te=S.forwardRef(function(e,t){var r=e.children,n=e.className,i=m_(e,y_),a=J("recharts-layer",n);return S.createElement("g",wl({className:a},H(i,!0),{ref:t}),r)}),it=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;aa?0:a+r),n=n>a?a:n,n<0&&(n+=a),a=r>n?0:n-r>>>0,r>>>=0;for(var o=Array(a);++i=a?r:e(r,n,i)}return wu=t,wu}var Ou,id;function Jb(){if(id)return Ou;id=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="\\u200d",u=RegExp("["+o+e+i+a+"]");function c(s){return u.test(s)}return Ou=c,Ou}var _u,ad;function w_(){if(ad)return _u;ad=1;function e(t){return t.split("")}return _u=e,_u}var Au,od;function O_(){if(od)return Au;od=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="["+e+"]",u="["+i+"]",c="\\ud83c[\\udffb-\\udfff]",s="(?:"+u+"|"+c+")",f="[^"+e+"]",l="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",d="\\u200d",y=s+"?",v="["+a+"]?",p="(?:"+d+"(?:"+[f,l,h].join("|")+")"+v+y+")*",g=v+y+p,x="(?:"+[f+u+"?",u,l,h,o].join("|")+")",w=RegExp(c+"(?="+c+")|"+x+g,"g");function O(m){return m.match(w)||[]}return Au=O,Au}var Su,ud;function __(){if(ud)return Su;ud=1;var e=w_(),t=Jb(),r=O_();function n(i){return t(i)?r(i):e(i)}return Su=n,Su}var Pu,cd;function A_(){if(cd)return Pu;cd=1;var e=x_(),t=Jb(),r=__(),n=Vb();function i(a){return function(o){o=n(o);var u=t(o)?r(o):void 0,c=u?u[0]:o.charAt(0),s=u?e(u,1).join(""):o.slice(1);return c[a]()+s}}return Pu=i,Pu}var Tu,sd;function S_(){if(sd)return Tu;sd=1;var e=A_(),t=e("toUpperCase");return Tu=t,Tu}var P_=S_();const Ia=oe(P_);function se(e){return function(){return e}}const Qb=Math.cos,Ci=Math.sin,at=Math.sqrt,Ii=Math.PI,ka=2*Ii,Ol=Math.PI,_l=2*Ol,Ut=1e-6,T_=_l-Ut;function e0(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return e0;const r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;iUt)if(!(Math.abs(l*c-s*f)>Ut)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let d=n-o,y=i-u,v=c*c+s*s,p=d*d+y*y,g=Math.sqrt(v),x=Math.sqrt(h),w=a*Math.tan((Ol-Math.acos((v+h-p)/(2*g*x)))/2),O=w/x,m=w/g;Math.abs(O-1)>Ut&&this._append`L${t+O*f},${r+O*l}`,this._append`A${a},${a},0,0,${+(l*d>f*y)},${this._x1=t+m*c},${this._y1=r+m*s}`}}arc(t,r,n,i,a,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let u=n*Math.cos(i),c=n*Math.sin(i),s=t+u,f=r+c,l=1^o,h=o?i-a:a-i;this._x1===null?this._append`M${s},${f}`:(Math.abs(this._x1-s)>Ut||Math.abs(this._y1-f)>Ut)&&this._append`L${s},${f}`,n&&(h<0&&(h=h%_l+_l),h>T_?this._append`A${n},${n},0,1,${l},${t-u},${r-c}A${n},${n},0,1,${l},${this._x1=s},${this._y1=f}`:h>Ut&&this._append`A${n},${n},0,${+(h>=Ol)},${l},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function Gf(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new j_(t)}function Vf(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function t0(e){this._context=e}t0.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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Ra(e){return new t0(e)}function r0(e){return e[0]}function n0(e){return e[1]}function i0(e,t){var r=se(!0),n=null,i=Ra,a=null,o=Gf(u);e=typeof e=="function"?e:e===void 0?r0:se(e),t=typeof t=="function"?t:t===void 0?n0:se(t);function u(c){var s,f=(c=Vf(c)).length,l,h=!1,d;for(n==null&&(a=i(d=o())),s=0;s<=f;++s)!(s=d;--y)u.point(w[y],O[y]);u.lineEnd(),u.areaEnd()}g&&(w[h]=+e(p,h,l),O[h]=+t(p,h,l),u.point(n?+n(p,h,l):w[h],r?+r(p,h,l):O[h]))}if(x)return u=null,x+""||null}function f(){return i0().defined(i).curve(o).context(a)}return s.x=function(l){return arguments.length?(e=typeof l=="function"?l:se(+l),n=null,s):e},s.x0=function(l){return arguments.length?(e=typeof l=="function"?l:se(+l),s):e},s.x1=function(l){return arguments.length?(n=l==null?null:typeof l=="function"?l:se(+l),s):n},s.y=function(l){return arguments.length?(t=typeof l=="function"?l:se(+l),r=null,s):t},s.y0=function(l){return arguments.length?(t=typeof l=="function"?l:se(+l),s):t},s.y1=function(l){return arguments.length?(r=l==null?null:typeof l=="function"?l:se(+l),s):r},s.lineX0=s.lineY0=function(){return f().x(e).y(t)},s.lineY1=function(){return f().x(e).y(r)},s.lineX1=function(){return f().x(n).y(t)},s.defined=function(l){return arguments.length?(i=typeof l=="function"?l:se(!!l),s):i},s.curve=function(l){return arguments.length?(o=l,a!=null&&(u=o(a)),s):o},s.context=function(l){return arguments.length?(l==null?a=u=null:u=o(a=l),s):a},s}class a0{constructor(t,r){this._context=t,this._x=r}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(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function M_(e){return new a0(e,!0)}function $_(e){return new a0(e,!1)}const Xf={draw(e,t){const r=at(t/Ii);e.moveTo(r,0),e.arc(0,0,r,0,ka)}},C_={draw(e,t){const r=at(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},o0=at(1/3),I_=o0*2,k_={draw(e,t){const r=at(t/I_),n=r*o0;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},R_={draw(e,t){const r=at(t),n=-r/2;e.rect(n,n,r,r)}},D_=.8908130915292852,u0=Ci(Ii/10)/Ci(7*Ii/10),N_=Ci(ka/10)*u0,q_=-Qb(ka/10)*u0,L_={draw(e,t){const r=at(t*D_),n=N_*r,i=q_*r;e.moveTo(0,-r),e.lineTo(n,i);for(let a=1;a<5;++a){const o=ka*a/5,u=Qb(o),c=Ci(o);e.lineTo(c*r,-u*r),e.lineTo(u*n-c*i,c*n+u*i)}e.closePath()}},Eu=at(3),B_={draw(e,t){const r=-at(t/(Eu*3));e.moveTo(0,r*2),e.lineTo(-Eu*r,-r),e.lineTo(Eu*r,-r),e.closePath()}},Ge=-.5,Ve=at(3)/2,Al=1/at(12),F_=(Al/2+1)*3,W_={draw(e,t){const r=at(t/F_),n=r/2,i=r*Al,a=n,o=r*Al+r,u=-a,c=o;e.moveTo(n,i),e.lineTo(a,o),e.lineTo(u,c),e.lineTo(Ge*n-Ve*i,Ve*n+Ge*i),e.lineTo(Ge*a-Ve*o,Ve*a+Ge*o),e.lineTo(Ge*u-Ve*c,Ve*u+Ge*c),e.lineTo(Ge*n+Ve*i,Ge*i-Ve*n),e.lineTo(Ge*a+Ve*o,Ge*o-Ve*a),e.lineTo(Ge*u+Ve*c,Ge*c-Ve*u),e.closePath()}};function z_(e,t){let r=null,n=Gf(i);e=typeof e=="function"?e:se(e||Xf),t=typeof t=="function"?t:se(t===void 0?64:+t);function i(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:se(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:se(+a),i):t},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function ki(){}function Ri(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function c0(e){this._context=e}c0.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:Ri(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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);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:Ri(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function U_(e){return new c0(e)}function s0(e){this._context=e}s0.prototype={areaStart:ki,areaEnd:ki,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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Ri(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function H_(e){return new s0(e)}function l0(e){this._context=e}l0.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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Ri(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function K_(e){return new l0(e)}function f0(e){this._context=e}f0.prototype={areaStart:ki,areaEnd:ki,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function G_(e){return new f0(e)}function ld(e){return e<0?-1:1}function fd(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),u=(a*i+o*n)/(n+i);return(ld(a)+ld(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(u))||0}function hd(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function ju(e,t,r){var n=e._x0,i=e._y0,a=e._x1,o=e._y1,u=(a-n)/3;e._context.bezierCurveTo(n+u,i+u*t,a-u,o-u*r,a,o)}function Di(e){this._context=e}Di.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:ju(this,this._t0,hd(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,ju(this,hd(this,r=fd(this,e,t)),r);break;default:ju(this,this._t0,r=fd(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function h0(e){this._context=new p0(e)}(h0.prototype=Object.create(Di.prototype)).point=function(e,t){Di.prototype.point.call(this,t,e)};function p0(e){this._context=e}p0.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}};function V_(e){return new Di(e)}function X_(e){return new h0(e)}function d0(e){this._context=e}d0.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=pd(e),i=pd(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function Z_(e){return new Da(e,.5)}function J_(e){return new Da(e,0)}function Q_(e){return new Da(e,1)}function Ar(e,t){if((o=e.length)>1)for(var r=1,n,i,a=e[t[0]],o,u=a.length;r=0;)r[t]=t;return r}function e1(e,t){return e[t]}function t1(e){const t=[];return t.key=e,t}function r1(){var e=se([]),t=Sl,r=Ar,n=e1;function i(a){var o=Array.from(e.apply(this,arguments),t1),u,c=o.length,s=-1,f;for(const l of a)for(u=0,++s;u0){for(var r,n,i=0,a=e[0].length,o;i0){for(var r=0,n=e[t[0]],i,a=n.length;r0)||!((a=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,a,o;n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function f1(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var v0={symbolCircle:Xf,symbolCross:C_,symbolDiamond:k_,symbolSquare:R_,symbolStar:L_,symbolTriangle:B_,symbolWye:W_},h1=Math.PI/180,p1=function(t){var r="symbol".concat(Ia(t));return v0[r]||Xf},d1=function(t,r,n){if(r==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*h1;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},v1=function(t,r){v0["symbol".concat(Ia(t))]=r},Yf=function(t){var r=t.type,n=r===void 0?"circle":r,i=t.size,a=i===void 0?64:i,o=t.sizeType,u=o===void 0?"area":o,c=l1(t,o1),s=vd(vd({},c),{},{type:n,size:a,sizeType:u}),f=function(){var p=p1(n),g=z_().type(p).size(d1(a,u,n));return g()},l=s.className,h=s.cx,d=s.cy,y=H(s,!0);return h===+h&&d===+d&&a===+a?S.createElement("path",Pl({},y,{className:J("recharts-symbols",l),transform:"translate(".concat(h,", ").concat(d,")"),d:f()})):null};Yf.registerSymbol=v1;function Sr(e){"@babel/helpers - typeof";return Sr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sr(e)}function Tl(){return Tl=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var x=d.inactive?s:d.color;return S.createElement("li",Tl({className:p,style:l,key:"legend-item-".concat(y)},tr(n.props,d,y)),S.createElement(xl,{width:o,height:o,viewBox:f,style:h},n.renderIcon(d)),S.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},v?v(g,d,y):g))})}},{key:"render",value:function(){var n=this.props,i=n.payload,a=n.layout,o=n.align;if(!i||!i.length)return null;var u={padding:0,margin:0,textAlign:a==="horizontal"?o:"left"};return S.createElement("ul",{className:"recharts-default-legend",style:u},this.renderItems())}}])})(N.PureComponent);Sn(Zf,"displayName","Legend");Sn(Zf,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var Mu,md;function A1(){if(md)return Mu;md=1;var e=Ma();function t(){this.__data__=new e,this.size=0}return Mu=t,Mu}var $u,gd;function S1(){if(gd)return $u;gd=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return $u=e,$u}var Cu,bd;function P1(){if(bd)return Cu;bd=1;function e(t){return this.__data__.get(t)}return Cu=e,Cu}var Iu,xd;function T1(){if(xd)return Iu;xd=1;function e(t){return this.__data__.has(t)}return Iu=e,Iu}var ku,wd;function E1(){if(wd)return ku;wd=1;var e=Ma(),t=Ff(),r=Wf(),n=200;function i(a,o){var u=this.__data__;if(u instanceof e){var c=u.__data__;if(!t||c.lengthd))return!1;var v=l.get(o),p=l.get(u);if(v&&p)return v==u&&p==o;var g=-1,x=!0,w=c&i?new e:void 0;for(l.set(o,u),l.set(u,o);++g-1&&n%1==0&&n-1&&r%1==0&&r<=e}return rc=t,rc}var nc,Hd;function F1(){if(Hd)return nc;Hd=1;var e=St(),t=th(),r=Pt(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",o="[object Date]",u="[object Error]",c="[object Function]",s="[object Map]",f="[object Number]",l="[object Object]",h="[object RegExp]",d="[object Set]",y="[object String]",v="[object WeakMap]",p="[object ArrayBuffer]",g="[object DataView]",x="[object Float32Array]",w="[object Float64Array]",O="[object Int8Array]",m="[object Int16Array]",b="[object Int32Array]",_="[object Uint8Array]",A="[object Uint8ClampedArray]",T="[object Uint16Array]",M="[object Uint32Array]",P={};P[x]=P[w]=P[O]=P[m]=P[b]=P[_]=P[A]=P[T]=P[M]=!0,P[n]=P[i]=P[p]=P[a]=P[g]=P[o]=P[u]=P[c]=P[s]=P[f]=P[l]=P[h]=P[d]=P[y]=P[v]=!1;function E(j){return r(j)&&t(j.length)&&!!P[e(j)]}return nc=E,nc}var ic,Kd;function A0(){if(Kd)return ic;Kd=1;function e(t){return function(r){return t(r)}}return ic=e,ic}var vn={exports:{}};vn.exports;var Gd;function W1(){return Gd||(Gd=1,(function(e,t){var r=Ub(),n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===n,o=a&&r.process,u=(function(){try{var c=i&&i.require&&i.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}})();e.exports=u})(vn,vn.exports)),vn.exports}var ac,Vd;function S0(){if(Vd)return ac;Vd=1;var e=F1(),t=A0(),r=W1(),n=r&&r.isTypedArray,i=n?t(n):e;return ac=i,ac}var oc,Xd;function z1(){if(Xd)return oc;Xd=1;var e=q1(),t=Qf(),r=qe(),n=_0(),i=eh(),a=S0(),o=Object.prototype,u=o.hasOwnProperty;function c(s,f){var l=r(s),h=!l&&t(s),d=!l&&!h&&n(s),y=!l&&!h&&!d&&a(s),v=l||h||d||y,p=v?e(s.length,String):[],g=p.length;for(var x in s)(f||u.call(s,x))&&!(v&&(x=="length"||d&&(x=="offset"||x=="parent")||y&&(x=="buffer"||x=="byteLength"||x=="byteOffset")||i(x,g)))&&p.push(x);return p}return oc=c,oc}var uc,Yd;function U1(){if(Yd)return uc;Yd=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,i=typeof n=="function"&&n.prototype||e;return r===i}return uc=t,uc}var cc,Zd;function P0(){if(Zd)return cc;Zd=1;function e(t,r){return function(n){return t(r(n))}}return cc=e,cc}var sc,Jd;function H1(){if(Jd)return sc;Jd=1;var e=P0(),t=e(Object.keys,Object);return sc=t,sc}var lc,Qd;function K1(){if(Qd)return lc;Qd=1;var e=U1(),t=H1(),r=Object.prototype,n=r.hasOwnProperty;function i(a){if(!e(a))return t(a);var o=[];for(var u in Object(a))n.call(a,u)&&u!="constructor"&&o.push(u);return o}return lc=i,lc}var fc,ev;function ui(){if(ev)return fc;ev=1;var e=Lf(),t=th();function r(n){return n!=null&&t(n.length)&&!e(n)}return fc=r,fc}var hc,tv;function Na(){if(tv)return hc;tv=1;var e=z1(),t=K1(),r=ui();function n(i){return r(i)?e(i):t(i)}return hc=n,hc}var pc,rv;function G1(){if(rv)return pc;rv=1;var e=k1(),t=N1(),r=Na();function n(i){return e(i,r,t)}return pc=n,pc}var dc,nv;function V1(){if(nv)return dc;nv=1;var e=G1(),t=1,r=Object.prototype,n=r.hasOwnProperty;function i(a,o,u,c,s,f){var l=u&t,h=e(a),d=h.length,y=e(o),v=y.length;if(d!=v&&!l)return!1;for(var p=d;p--;){var g=h[p];if(!(l?g in o:n.call(o,g)))return!1}var x=f.get(a),w=f.get(o);if(x&&w)return x==o&&w==a;var O=!0;f.set(a,o),f.set(o,a);for(var m=l;++p-1}return Bc=t,Bc}var Fc,Mv;function dA(){if(Mv)return Fc;Mv=1;function e(t,r,n){for(var i=-1,a=t==null?0:t.length;++i=o){var g=s?null:i(c);if(g)return a(g);y=!1,h=n,p=new e}else p=s?[]:v;e:for(;++l=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function jA(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function MA(e){return e.value}function $A(e,t){if(S.isValidElement(e))return S.cloneElement(e,t);if(typeof e=="function")return S.createElement(e,t);t.ref;var r=EA(t,xA);return S.createElement(Zf,r)}var qv=1,wr=(function(e){function t(){var r;wA(this,t);for(var n=arguments.length,i=new Array(n),a=0;aqv||Math.abs(i.height-this.lastBoundingBox.height)>qv)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,n&&n(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?pt({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var i=this.props,a=i.layout,o=i.align,u=i.verticalAlign,c=i.margin,s=i.chartWidth,f=i.chartHeight,l,h;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(o==="center"&&a==="vertical"){var d=this.getBBoxSnapshot();l={left:((s||0)-d.width)/2}}else l=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(u==="middle"){var y=this.getBBoxSnapshot();h={top:((f||0)-y.height)/2}}else h=u==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return pt(pt({},l),h)}},{key:"render",value:function(){var n=this,i=this.props,a=i.content,o=i.width,u=i.height,c=i.wrapperStyle,s=i.payloadUniqBy,f=i.payload,l=pt(pt({position:"absolute",width:o||"auto",height:u||"auto"},this.getDefaultPosition(c)),c);return S.createElement("div",{className:"recharts-legend-wrapper",style:l,ref:function(d){n.wrapperNode=d}},$A(a,pt(pt({},this.props),{},{payload:$0(f,s,MA)})))}}],[{key:"getWithHeight",value:function(n,i){var a=pt(pt({},this.defaultProps),n.props),o=a.layout;return o==="vertical"&&q(n.props.height)?{height:n.props.height}:o==="horizontal"?{width:n.props.width||i}:null}}])})(N.PureComponent);qa(wr,"displayName","Legend");qa(wr,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var Kc,Lv;function CA(){if(Lv)return Kc;Lv=1;var e=ai(),t=Qf(),r=qe(),n=e?e.isConcatSpreadable:void 0;function i(a){return r(a)||t(a)||!!(n&&a&&a[n])}return Kc=i,Kc}var Gc,Bv;function k0(){if(Bv)return Gc;Bv=1;var e=O0(),t=CA();function r(n,i,a,o,u){var c=-1,s=n.length;for(a||(a=t),u||(u=[]);++c0&&a(f)?i>1?r(f,i-1,a,o,u):e(u,f):o||(u[u.length]=f)}return u}return Gc=r,Gc}var Vc,Fv;function IA(){if(Fv)return Vc;Fv=1;function e(t){return function(r,n,i){for(var a=-1,o=Object(r),u=i(r),c=u.length;c--;){var s=u[t?c:++a];if(n(o[s],s,o)===!1)break}return r}}return Vc=e,Vc}var Xc,Wv;function kA(){if(Wv)return Xc;Wv=1;var e=IA(),t=e();return Xc=t,Xc}var Yc,zv;function R0(){if(zv)return Yc;zv=1;var e=kA(),t=Na();function r(n,i){return n&&e(n,i,t)}return Yc=r,Yc}var Zc,Uv;function RA(){if(Uv)return Zc;Uv=1;var e=ui();function t(r,n){return function(i,a){if(i==null)return i;if(!e(i))return r(i,a);for(var o=i.length,u=n?o:-1,c=Object(i);(n?u--:++un||u&&c&&f&&!s&&!l||a&&c&&f||!i&&f||!o)return 1;if(!a&&!u&&!l&&r=s)return f;var l=i[a];return f*(l=="desc"?-1:1)}}return r.index-n.index}return rs=t,rs}var ns,Yv;function LA(){if(Yv)return ns;Yv=1;var e=zf(),t=Uf(),r=ht(),n=D0(),i=DA(),a=A0(),o=qA(),u=Jr(),c=qe();function s(f,l,h){l.length?l=e(l,function(v){return c(v)?function(p){return t(p,v.length===1?v[0]:v)}:v}):l=[u];var d=-1;l=e(l,a(r));var y=n(f,function(v,p,g){var x=e(l,function(w){return w(v)});return{criteria:x,index:++d,value:v}});return i(y,function(v,p){return o(v,p,h)})}return ns=s,ns}var is,Zv;function BA(){if(Zv)return is;Zv=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return is=e,is}var as,Jv;function FA(){if(Jv)return as;Jv=1;var e=BA(),t=Math.max;function r(n,i,a){return i=t(i===void 0?n.length-1:i,0),function(){for(var o=arguments,u=-1,c=t(o.length-i,0),s=Array(c);++u0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return ss=n,ss}var ls,ny;function HA(){if(ny)return ls;ny=1;var e=zA(),t=UA(),r=t(e);return ls=r,ls}var fs,iy;function KA(){if(iy)return fs;iy=1;var e=Jr(),t=FA(),r=HA();function n(i,a){return r(t(i,a,e),i+"")}return fs=n,fs}var hs,ay;function La(){if(ay)return hs;ay=1;var e=Bf(),t=ui(),r=eh(),n=It();function i(a,o,u){if(!n(u))return!1;var c=typeof o;return(c=="number"?t(u)&&r(o,u.length):c=="string"&&o in u)?e(u[o],a):!1}return hs=i,hs}var ps,oy;function GA(){if(oy)return ps;oy=1;var e=k0(),t=LA(),r=KA(),n=La(),i=r(function(a,o){if(a==null)return[];var u=o.length;return u>1&&n(a,o[0],o[1])?o=[]:u>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),t(a,e(o,1),[])});return ps=i,ps}var VA=GA();const ih=oe(VA);function Pn(e){"@babel/helpers - typeof";return Pn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pn(e)}function Ml(){return Ml=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=t.x),"".concat(an,"-left"),q(r)&&t&&q(t.x)&&r=t.y),"".concat(an,"-top"),q(n)&&t&&q(t.y)&&nv?Math.max(f,c[n]):Math.max(l,c[n])}function sS(e){var t=e.translateX,r=e.translateY,n=e.useTranslate3d;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function lS(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.offsetTopLeft,i=e.position,a=e.reverseDirection,o=e.tooltipBox,u=e.useTranslate3d,c=e.viewBox,s,f,l;return o.height>0&&o.width>0&&r?(f=sy({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),l=sy({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),s=sS({translateX:f,translateY:l,useTranslate3d:u})):s=uS,{cssProperties:s,cssClasses:cS({translateX:f,translateY:l,coordinate:r})}}function Tr(e){"@babel/helpers - typeof";return Tr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tr(e)}function ly(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function fy(e){for(var t=1;thy||Math.abs(n.height-this.state.lastBoundingBox.height)>hy)&&this.setState({lastBoundingBox:{width:n.width,height:n.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 n,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.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 n=this,i=this.props,a=i.active,o=i.allowEscapeViewBox,u=i.animationDuration,c=i.animationEasing,s=i.children,f=i.coordinate,l=i.hasPayload,h=i.isAnimationActive,d=i.offset,y=i.position,v=i.reverseDirection,p=i.useTranslate3d,g=i.viewBox,x=i.wrapperStyle,w=lS({allowEscapeViewBox:o,coordinate:f,offsetTopLeft:d,position:y,reverseDirection:v,tooltipBox:this.state.lastBoundingBox,useTranslate3d:p,viewBox:g}),O=w.cssClasses,m=w.cssProperties,b=fy(fy({transition:h&&a?"transform ".concat(u,"ms ").concat(c):void 0},m),{},{pointerEvents:"none",visibility:!this.state.dismissed&&a&&l?"visible":"hidden",position:"absolute",top:0,left:0},x);return S.createElement("div",{tabIndex:-1,className:O,style:b,ref:function(A){n.wrapperNode=A}},s)}}])})(N.PureComponent),xS=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},or={isSsr:xS()};function Er(e){"@babel/helpers - typeof";return Er=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Er(e)}function py(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function dy(e){for(var t=1;t0;return S.createElement(bS,{allowEscapeViewBox:o,animationDuration:u,animationEasing:c,isAnimationActive:h,active:a,coordinate:f,hasPayload:b,offset:d,position:p,reverseDirection:g,useTranslate3d:x,viewBox:w,wrapperStyle:O},MS(s,dy(dy({},this.props),{},{payload:m})))}}])})(N.PureComponent);ah(dt,"displayName","Tooltip");ah(dt,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!or.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 vs,vy;function $S(){if(vy)return vs;vy=1;var e=ft(),t=function(){return e.Date.now()};return vs=t,vs}var ys,yy;function CS(){if(yy)return ys;yy=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return ys=t,ys}var ms,my;function IS(){if(my)return ms;my=1;var e=CS(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return ms=r,ms}var gs,gy;function W0(){if(gy)return gs;gy=1;var e=IS(),t=It(),r=Xr(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,u=parseInt;function c(s){if(typeof s=="number")return s;if(r(s))return n;if(t(s)){var f=typeof s.valueOf=="function"?s.valueOf():s;s=t(f)?f+"":f}if(typeof s!="string")return s===0?s:+s;s=e(s);var l=a.test(s);return l||o.test(s)?u(s.slice(2),l?2:8):i.test(s)?n:+s}return gs=c,gs}var bs,by;function kS(){if(by)return bs;by=1;var e=It(),t=$S(),r=W0(),n="Expected a function",i=Math.max,a=Math.min;function o(u,c,s){var f,l,h,d,y,v,p=0,g=!1,x=!1,w=!0;if(typeof u!="function")throw new TypeError(n);c=r(c)||0,e(s)&&(g=!!s.leading,x="maxWait"in s,h=x?i(r(s.maxWait)||0,c):h,w="trailing"in s?!!s.trailing:w);function O(j){var C=f,$=l;return f=l=void 0,p=j,d=u.apply($,C),d}function m(j){return p=j,y=setTimeout(A,c),g?O(j):d}function b(j){var C=j-v,$=j-p,k=c-C;return x?a(k,h-$):k}function _(j){var C=j-v,$=j-p;return v===void 0||C>=c||C<0||x&&$>=h}function A(){var j=t();if(_(j))return T(j);y=setTimeout(A,b(j))}function T(j){return y=void 0,w&&f?O(j):(f=l=void 0,d)}function M(){y!==void 0&&clearTimeout(y),p=0,f=v=l=y=void 0}function P(){return y===void 0?d:T(t())}function E(){var j=t(),C=_(j);if(f=arguments,l=this,v=j,C){if(y===void 0)return m(v);if(x)return clearTimeout(y),y=setTimeout(A,c),O(v)}return y===void 0&&(y=setTimeout(A,c)),d}return E.cancel=M,E.flush=P,E}return bs=o,bs}var xs,xy;function RS(){if(xy)return xs;xy=1;var e=kS(),t=It(),r="Expected a function";function n(i,a,o){var u=!0,c=!0;if(typeof i!="function")throw new TypeError(r);return t(o)&&(u="leading"in o?!!o.leading:u,c="trailing"in o?!!o.trailing:c),e(i,a,{leading:u,maxWait:a,trailing:c})}return xs=n,xs}var DS=RS();const z0=oe(DS);function En(e){"@babel/helpers - typeof";return En=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},En(e)}function wy(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function gi(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&(j=z0(j,v,{trailing:!0,leading:!1}));var C=new ResizeObserver(j),$=m.current.getBoundingClientRect(),k=$.width,R=$.height;return P(k,R),C.observe(m.current),function(){C.disconnect()}},[P,v]);var E=N.useMemo(function(){var j=T.containerWidth,C=T.containerHeight;if(j<0||C<0)return null;it(Gt(o)||Gt(c),`The width(%s) and height(%s) are both fixed numbers, + A`).concat(o,",").concat(o,",0,1,1,").concat(u,",").concat(a),className:"recharts-legend-icon"});if(n.type==="rect")return S.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(Xe/8,"h").concat(Xe,"v").concat(Xe*3/4,"h").concat(-Xe,"z"),className:"recharts-legend-icon"});if(S.isValidElement(n.legendIcon)){var s=y1({},n);return delete s.legendIcon,S.cloneElement(n.legendIcon,s)}return S.createElement(Yf,{fill:c,cx:a,cy:a,size:Xe,sizeType:"diameter",type:n.type})}},{key:"renderItems",value:function(){var n=this,i=this.props,a=i.payload,o=i.iconSize,u=i.layout,c=i.formatter,s=i.inactiveColor,f={x:0,y:0,width:Xe,height:Xe},l={display:u==="horizontal"?"inline-block":"block",marginRight:10},h={display:"inline-block",verticalAlign:"middle",marginRight:4};return a.map(function(d,y){var v=d.formatter||c,p=J(Sn(Sn({"recharts-legend-item":!0},"legend-item-".concat(y),!0),"inactive",d.inactive));if(d.type==="none")return null;var g=X(d.value)?null:d.value;it(!X(d.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: `);var x=d.inactive?s:d.color;return S.createElement("li",Tl({className:p,style:l,key:"legend-item-".concat(y)},tr(n.props,d,y)),S.createElement(xl,{width:o,height:o,viewBox:f,style:h},n.renderIcon(d)),S.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},v?v(g,d,y):g))})}},{key:"render",value:function(){var n=this.props,i=n.payload,a=n.layout,o=n.align;if(!i||!i.length)return null;var u={padding:0,margin:0,textAlign:a==="horizontal"?o:"left"};return S.createElement("ul",{className:"recharts-default-legend",style:u},this.renderItems())}}])})(N.PureComponent);Sn(Zf,"displayName","Legend");Sn(Zf,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var Mu,md;function S1(){if(md)return Mu;md=1;var e=Ma();function t(){this.__data__=new e,this.size=0}return Mu=t,Mu}var $u,gd;function P1(){if(gd)return $u;gd=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return $u=e,$u}var Cu,bd;function T1(){if(bd)return Cu;bd=1;function e(t){return this.__data__.get(t)}return Cu=e,Cu}var Iu,xd;function E1(){if(xd)return Iu;xd=1;function e(t){return this.__data__.has(t)}return Iu=e,Iu}var ku,wd;function j1(){if(wd)return ku;wd=1;var e=Ma(),t=Ff(),r=Wf(),n=200;function i(a,o){var u=this.__data__;if(u instanceof e){var c=u.__data__;if(!t||c.lengthd))return!1;var v=l.get(o),p=l.get(u);if(v&&p)return v==u&&p==o;var g=-1,x=!0,w=c&i?new e:void 0;for(l.set(o,u),l.set(u,o);++g-1&&n%1==0&&n-1&&r%1==0&&r<=e}return rc=t,rc}var nc,Hd;function W1(){if(Hd)return nc;Hd=1;var e=St(),t=th(),r=Pt(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",o="[object Date]",u="[object Error]",c="[object Function]",s="[object Map]",f="[object Number]",l="[object Object]",h="[object RegExp]",d="[object Set]",y="[object String]",v="[object WeakMap]",p="[object ArrayBuffer]",g="[object DataView]",x="[object Float32Array]",w="[object Float64Array]",O="[object Int8Array]",m="[object Int16Array]",b="[object Int32Array]",_="[object Uint8Array]",A="[object Uint8ClampedArray]",T="[object Uint16Array]",M="[object Uint32Array]",P={};P[x]=P[w]=P[O]=P[m]=P[b]=P[_]=P[A]=P[T]=P[M]=!0,P[n]=P[i]=P[p]=P[a]=P[g]=P[o]=P[u]=P[c]=P[s]=P[f]=P[l]=P[h]=P[d]=P[y]=P[v]=!1;function E(j){return r(j)&&t(j.length)&&!!P[e(j)]}return nc=E,nc}var ic,Kd;function S0(){if(Kd)return ic;Kd=1;function e(t){return function(r){return t(r)}}return ic=e,ic}var vn={exports:{}};vn.exports;var Gd;function z1(){return Gd||(Gd=1,(function(e,t){var r=Hb(),n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===n,o=a&&r.process,u=(function(){try{var c=i&&i.require&&i.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}})();e.exports=u})(vn,vn.exports)),vn.exports}var ac,Vd;function P0(){if(Vd)return ac;Vd=1;var e=W1(),t=S0(),r=z1(),n=r&&r.isTypedArray,i=n?t(n):e;return ac=i,ac}var oc,Xd;function U1(){if(Xd)return oc;Xd=1;var e=L1(),t=Qf(),r=qe(),n=A0(),i=eh(),a=P0(),o=Object.prototype,u=o.hasOwnProperty;function c(s,f){var l=r(s),h=!l&&t(s),d=!l&&!h&&n(s),y=!l&&!h&&!d&&a(s),v=l||h||d||y,p=v?e(s.length,String):[],g=p.length;for(var x in s)(f||u.call(s,x))&&!(v&&(x=="length"||d&&(x=="offset"||x=="parent")||y&&(x=="buffer"||x=="byteLength"||x=="byteOffset")||i(x,g)))&&p.push(x);return p}return oc=c,oc}var uc,Yd;function H1(){if(Yd)return uc;Yd=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,i=typeof n=="function"&&n.prototype||e;return r===i}return uc=t,uc}var cc,Zd;function T0(){if(Zd)return cc;Zd=1;function e(t,r){return function(n){return t(r(n))}}return cc=e,cc}var sc,Jd;function K1(){if(Jd)return sc;Jd=1;var e=T0(),t=e(Object.keys,Object);return sc=t,sc}var lc,Qd;function G1(){if(Qd)return lc;Qd=1;var e=H1(),t=K1(),r=Object.prototype,n=r.hasOwnProperty;function i(a){if(!e(a))return t(a);var o=[];for(var u in Object(a))n.call(a,u)&&u!="constructor"&&o.push(u);return o}return lc=i,lc}var fc,ev;function ui(){if(ev)return fc;ev=1;var e=Lf(),t=th();function r(n){return n!=null&&t(n.length)&&!e(n)}return fc=r,fc}var hc,tv;function Na(){if(tv)return hc;tv=1;var e=U1(),t=G1(),r=ui();function n(i){return r(i)?e(i):t(i)}return hc=n,hc}var pc,rv;function V1(){if(rv)return pc;rv=1;var e=R1(),t=q1(),r=Na();function n(i){return e(i,r,t)}return pc=n,pc}var dc,nv;function X1(){if(nv)return dc;nv=1;var e=V1(),t=1,r=Object.prototype,n=r.hasOwnProperty;function i(a,o,u,c,s,f){var l=u&t,h=e(a),d=h.length,y=e(o),v=y.length;if(d!=v&&!l)return!1;for(var p=d;p--;){var g=h[p];if(!(l?g in o:n.call(o,g)))return!1}var x=f.get(a),w=f.get(o);if(x&&w)return x==o&&w==a;var O=!0;f.set(a,o),f.set(o,a);for(var m=l;++p-1}return Bc=t,Bc}var Fc,Mv;function vA(){if(Mv)return Fc;Mv=1;function e(t,r,n){for(var i=-1,a=t==null?0:t.length;++i=o){var g=s?null:i(c);if(g)return a(g);y=!1,h=n,p=new e}else p=s?[]:v;e:for(;++l=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function MA(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function $A(e){return e.value}function CA(e,t){if(S.isValidElement(e))return S.cloneElement(e,t);if(typeof e=="function")return S.createElement(e,t);t.ref;var r=jA(t,wA);return S.createElement(Zf,r)}var qv=1,wr=(function(e){function t(){var r;OA(this,t);for(var n=arguments.length,i=new Array(n),a=0;aqv||Math.abs(i.height-this.lastBoundingBox.height)>qv)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,n&&n(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?pt({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var i=this.props,a=i.layout,o=i.align,u=i.verticalAlign,c=i.margin,s=i.chartWidth,f=i.chartHeight,l,h;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(o==="center"&&a==="vertical"){var d=this.getBBoxSnapshot();l={left:((s||0)-d.width)/2}}else l=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(u==="middle"){var y=this.getBBoxSnapshot();h={top:((f||0)-y.height)/2}}else h=u==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return pt(pt({},l),h)}},{key:"render",value:function(){var n=this,i=this.props,a=i.content,o=i.width,u=i.height,c=i.wrapperStyle,s=i.payloadUniqBy,f=i.payload,l=pt(pt({position:"absolute",width:o||"auto",height:u||"auto"},this.getDefaultPosition(c)),c);return S.createElement("div",{className:"recharts-legend-wrapper",style:l,ref:function(d){n.wrapperNode=d}},CA(a,pt(pt({},this.props),{},{payload:C0(f,s,$A)})))}}],[{key:"getWithHeight",value:function(n,i){var a=pt(pt({},this.defaultProps),n.props),o=a.layout;return o==="vertical"&&q(n.props.height)?{height:n.props.height}:o==="horizontal"?{width:n.props.width||i}:null}}])})(N.PureComponent);qa(wr,"displayName","Legend");qa(wr,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var Kc,Lv;function IA(){if(Lv)return Kc;Lv=1;var e=ai(),t=Qf(),r=qe(),n=e?e.isConcatSpreadable:void 0;function i(a){return r(a)||t(a)||!!(n&&a&&a[n])}return Kc=i,Kc}var Gc,Bv;function R0(){if(Bv)return Gc;Bv=1;var e=_0(),t=IA();function r(n,i,a,o,u){var c=-1,s=n.length;for(a||(a=t),u||(u=[]);++c0&&a(f)?i>1?r(f,i-1,a,o,u):e(u,f):o||(u[u.length]=f)}return u}return Gc=r,Gc}var Vc,Fv;function kA(){if(Fv)return Vc;Fv=1;function e(t){return function(r,n,i){for(var a=-1,o=Object(r),u=i(r),c=u.length;c--;){var s=u[t?c:++a];if(n(o[s],s,o)===!1)break}return r}}return Vc=e,Vc}var Xc,Wv;function RA(){if(Wv)return Xc;Wv=1;var e=kA(),t=e();return Xc=t,Xc}var Yc,zv;function D0(){if(zv)return Yc;zv=1;var e=RA(),t=Na();function r(n,i){return n&&e(n,i,t)}return Yc=r,Yc}var Zc,Uv;function DA(){if(Uv)return Zc;Uv=1;var e=ui();function t(r,n){return function(i,a){if(i==null)return i;if(!e(i))return r(i,a);for(var o=i.length,u=n?o:-1,c=Object(i);(n?u--:++un||u&&c&&f&&!s&&!l||a&&c&&f||!i&&f||!o)return 1;if(!a&&!u&&!l&&r=s)return f;var l=i[a];return f*(l=="desc"?-1:1)}}return r.index-n.index}return rs=t,rs}var ns,Yv;function BA(){if(Yv)return ns;Yv=1;var e=zf(),t=Uf(),r=ht(),n=N0(),i=NA(),a=S0(),o=LA(),u=Jr(),c=qe();function s(f,l,h){l.length?l=e(l,function(v){return c(v)?function(p){return t(p,v.length===1?v[0]:v)}:v}):l=[u];var d=-1;l=e(l,a(r));var y=n(f,function(v,p,g){var x=e(l,function(w){return w(v)});return{criteria:x,index:++d,value:v}});return i(y,function(v,p){return o(v,p,h)})}return ns=s,ns}var is,Zv;function FA(){if(Zv)return is;Zv=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return is=e,is}var as,Jv;function WA(){if(Jv)return as;Jv=1;var e=FA(),t=Math.max;function r(n,i,a){return i=t(i===void 0?n.length-1:i,0),function(){for(var o=arguments,u=-1,c=t(o.length-i,0),s=Array(c);++u0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return ss=n,ss}var ls,ny;function KA(){if(ny)return ls;ny=1;var e=UA(),t=HA(),r=t(e);return ls=r,ls}var fs,iy;function GA(){if(iy)return fs;iy=1;var e=Jr(),t=WA(),r=KA();function n(i,a){return r(t(i,a,e),i+"")}return fs=n,fs}var hs,ay;function La(){if(ay)return hs;ay=1;var e=Bf(),t=ui(),r=eh(),n=It();function i(a,o,u){if(!n(u))return!1;var c=typeof o;return(c=="number"?t(u)&&r(o,u.length):c=="string"&&o in u)?e(u[o],a):!1}return hs=i,hs}var ps,oy;function VA(){if(oy)return ps;oy=1;var e=R0(),t=BA(),r=GA(),n=La(),i=r(function(a,o){if(a==null)return[];var u=o.length;return u>1&&n(a,o[0],o[1])?o=[]:u>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),t(a,e(o,1),[])});return ps=i,ps}var XA=VA();const ih=oe(XA);function Pn(e){"@babel/helpers - typeof";return Pn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pn(e)}function Ml(){return Ml=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=t.x),"".concat(an,"-left"),q(r)&&t&&q(t.x)&&r=t.y),"".concat(an,"-top"),q(n)&&t&&q(t.y)&&nv?Math.max(f,c[n]):Math.max(l,c[n])}function lS(e){var t=e.translateX,r=e.translateY,n=e.useTranslate3d;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function fS(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.offsetTopLeft,i=e.position,a=e.reverseDirection,o=e.tooltipBox,u=e.useTranslate3d,c=e.viewBox,s,f,l;return o.height>0&&o.width>0&&r?(f=sy({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),l=sy({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),s=lS({translateX:f,translateY:l,useTranslate3d:u})):s=cS,{cssProperties:s,cssClasses:sS({translateX:f,translateY:l,coordinate:r})}}function Tr(e){"@babel/helpers - typeof";return Tr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tr(e)}function ly(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function fy(e){for(var t=1;thy||Math.abs(n.height-this.state.lastBoundingBox.height)>hy)&&this.setState({lastBoundingBox:{width:n.width,height:n.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 n,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.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 n=this,i=this.props,a=i.active,o=i.allowEscapeViewBox,u=i.animationDuration,c=i.animationEasing,s=i.children,f=i.coordinate,l=i.hasPayload,h=i.isAnimationActive,d=i.offset,y=i.position,v=i.reverseDirection,p=i.useTranslate3d,g=i.viewBox,x=i.wrapperStyle,w=fS({allowEscapeViewBox:o,coordinate:f,offsetTopLeft:d,position:y,reverseDirection:v,tooltipBox:this.state.lastBoundingBox,useTranslate3d:p,viewBox:g}),O=w.cssClasses,m=w.cssProperties,b=fy(fy({transition:h&&a?"transform ".concat(u,"ms ").concat(c):void 0},m),{},{pointerEvents:"none",visibility:!this.state.dismissed&&a&&l?"visible":"hidden",position:"absolute",top:0,left:0},x);return S.createElement("div",{tabIndex:-1,className:O,style:b,ref:function(A){n.wrapperNode=A}},s)}}])})(N.PureComponent),wS=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},or={isSsr:wS()};function Er(e){"@babel/helpers - typeof";return Er=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Er(e)}function py(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function dy(e){for(var t=1;t0;return S.createElement(xS,{allowEscapeViewBox:o,animationDuration:u,animationEasing:c,isAnimationActive:h,active:a,coordinate:f,hasPayload:b,offset:d,position:p,reverseDirection:g,useTranslate3d:x,viewBox:w,wrapperStyle:O},$S(s,dy(dy({},this.props),{},{payload:m})))}}])})(N.PureComponent);ah(dt,"displayName","Tooltip");ah(dt,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!or.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 vs,vy;function CS(){if(vy)return vs;vy=1;var e=ft(),t=function(){return e.Date.now()};return vs=t,vs}var ys,yy;function IS(){if(yy)return ys;yy=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return ys=t,ys}var ms,my;function kS(){if(my)return ms;my=1;var e=IS(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return ms=r,ms}var gs,gy;function z0(){if(gy)return gs;gy=1;var e=kS(),t=It(),r=Xr(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,u=parseInt;function c(s){if(typeof s=="number")return s;if(r(s))return n;if(t(s)){var f=typeof s.valueOf=="function"?s.valueOf():s;s=t(f)?f+"":f}if(typeof s!="string")return s===0?s:+s;s=e(s);var l=a.test(s);return l||o.test(s)?u(s.slice(2),l?2:8):i.test(s)?n:+s}return gs=c,gs}var bs,by;function RS(){if(by)return bs;by=1;var e=It(),t=CS(),r=z0(),n="Expected a function",i=Math.max,a=Math.min;function o(u,c,s){var f,l,h,d,y,v,p=0,g=!1,x=!1,w=!0;if(typeof u!="function")throw new TypeError(n);c=r(c)||0,e(s)&&(g=!!s.leading,x="maxWait"in s,h=x?i(r(s.maxWait)||0,c):h,w="trailing"in s?!!s.trailing:w);function O(j){var C=f,$=l;return f=l=void 0,p=j,d=u.apply($,C),d}function m(j){return p=j,y=setTimeout(A,c),g?O(j):d}function b(j){var C=j-v,$=j-p,k=c-C;return x?a(k,h-$):k}function _(j){var C=j-v,$=j-p;return v===void 0||C>=c||C<0||x&&$>=h}function A(){var j=t();if(_(j))return T(j);y=setTimeout(A,b(j))}function T(j){return y=void 0,w&&f?O(j):(f=l=void 0,d)}function M(){y!==void 0&&clearTimeout(y),p=0,f=v=l=y=void 0}function P(){return y===void 0?d:T(t())}function E(){var j=t(),C=_(j);if(f=arguments,l=this,v=j,C){if(y===void 0)return m(v);if(x)return clearTimeout(y),y=setTimeout(A,c),O(v)}return y===void 0&&(y=setTimeout(A,c)),d}return E.cancel=M,E.flush=P,E}return bs=o,bs}var xs,xy;function DS(){if(xy)return xs;xy=1;var e=RS(),t=It(),r="Expected a function";function n(i,a,o){var u=!0,c=!0;if(typeof i!="function")throw new TypeError(r);return t(o)&&(u="leading"in o?!!o.leading:u,c="trailing"in o?!!o.trailing:c),e(i,a,{leading:u,maxWait:a,trailing:c})}return xs=n,xs}var NS=DS();const U0=oe(NS);function En(e){"@babel/helpers - typeof";return En=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},En(e)}function wy(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function gi(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&(j=U0(j,v,{trailing:!0,leading:!1}));var C=new ResizeObserver(j),$=m.current.getBoundingClientRect(),k=$.width,R=$.height;return P(k,R),C.observe(m.current),function(){C.disconnect()}},[P,v]);var E=N.useMemo(function(){var j=T.containerWidth,C=T.containerHeight;if(j<0||C<0)return null;it(Gt(o)||Gt(c),`The width(%s) and height(%s) are both fixed numbers, maybe you don't need to use a ResponsiveContainer.`,o,c),it(!r||r>0,"The aspect(%s) must be greater than zero.",r);var $=Gt(o)?j:o,k=Gt(c)?C:c;r&&r>0&&($?k=$/r:k&&($=k*r),h&&k>h&&(k=h)),it($>0||k>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.`,$,k,o,c,f,l,r);var R=!Array.isArray(d)&&bt(d.type).endsWith("Chart");return S.Children.map(d,function(L){return S.isValidElement(L)?N.cloneElement(L,gi({width:$,height:k},R?{style:gi({height:"100%",width:"100%",maxHeight:k,maxWidth:$},L.props.style)}:{})):L})},[r,d,c,h,l,f,T,o]);return S.createElement("div",{id:p?"".concat(p):void 0,className:J("recharts-responsive-container",g),style:gi(gi({},O),{},{width:o,height:c,minWidth:f,minHeight:l,maxHeight:h}),ref:m},E)}),oh=function(t){return null};oh.displayName="Cell";function jn(e){"@babel/helpers - typeof";return jn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jn(e)}function _y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function kl(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||or.isSsr)return{width:0,height:0};var n=YS(r),i=JSON.stringify({text:t,copyStyle:n});if(fr.widthCache[i])return fr.widthCache[i];try{var a=document.getElementById(Ay);a||(a=document.createElement("span"),a.setAttribute("id",Ay),a.setAttribute("aria-hidden","true"),document.body.appendChild(a));var o=kl(kl({},XS),n);Object.assign(a.style,o),a.textContent="".concat(t);var u=a.getBoundingClientRect(),c={width:u.width,height:u.height};return fr.widthCache[i]=c,++fr.cacheCount>VS&&(fr.cacheCount=0,fr.widthCache={}),c}catch{return{width:0,height:0}}},ZS=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Mn(e){"@babel/helpers - typeof";return Mn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mn(e)}function Fi(e,t){return tP(e)||eP(e,t)||QS(e,t)||JS()}function JS(){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 QS(e,t){if(e){if(typeof e=="string")return Sy(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Sy(e,t)}}function Sy(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function vP(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function $y(e,t){return bP(e)||gP(e,t)||mP(e,t)||yP()}function yP(){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 mP(e,t){if(e){if(typeof e=="string")return Cy(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Cy(e,t)}}function Cy(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&arguments[0]!==void 0?arguments[0]:[];return $.reduce(function(k,R){var L=R.word,B=R.width,U=k[k.length-1];if(U&&(i==null||a||U.width+B+nR.width?k:R})};if(!f)return d;for(var v="…",p=function($){var k=l.slice(0,$),R=G0({breakAll:s,style:c,children:k+v}).wordsWithComputedWidth,L=h(R),B=L.length>o||y(L).width>Number(i);return[B,L]},g=0,x=l.length-1,w=0,O;g<=x&&w<=l.length-1;){var m=Math.floor((g+x)/2),b=m-1,_=p(b),A=$y(_,2),T=A[0],M=A[1],P=p(m),E=$y(P,1),j=E[0];if(!T&&!j&&(g=m+1),T&&j&&(x=m-1),!T&&j){O=M;break}w++}return O||d},Iy=function(t){var r=Y(t)?[]:t.toString().split(K0);return[{words:r}]},wP=function(t){var r=t.width,n=t.scaleToFit,i=t.children,a=t.style,o=t.breakAll,u=t.maxLines;if((r||n)&&!or.isSsr){var c,s,f=G0({breakAll:o,children:i,style:a});if(f){var l=f.wordsWithComputedWidth,h=f.spaceWidth;c=l,s=h}else return Iy(i);return xP({breakAll:o,children:i,maxLines:u,style:a},c,s,r,n)}return Iy(i)},ky="#808080",rr=function(t){var r=t.x,n=r===void 0?0:r,i=t.y,a=i===void 0?0:i,o=t.lineHeight,u=o===void 0?"1em":o,c=t.capHeight,s=c===void 0?"0.71em":c,f=t.scaleToFit,l=f===void 0?!1:f,h=t.textAnchor,d=h===void 0?"start":h,y=t.verticalAnchor,v=y===void 0?"end":y,p=t.fill,g=p===void 0?ky:p,x=My(t,pP),w=N.useMemo(function(){return wP({breakAll:x.breakAll,children:x.children,maxLines:x.maxLines,scaleToFit:l,style:x.style,width:x.width})},[x.breakAll,x.children,x.maxLines,l,x.style,x.width]),O=x.dx,m=x.dy,b=x.angle,_=x.className,A=x.breakAll,T=My(x,dP);if(!Ae(n)||!Ae(a))return null;var M=n+(q(O)?O:0),P=a+(q(m)?m:0),E;switch(v){case"start":E=ws("calc(".concat(s,")"));break;case"middle":E=ws("calc(".concat((w.length-1)/2," * -").concat(u," + (").concat(s," / 2))"));break;default:E=ws("calc(".concat(w.length-1," * -").concat(u,")"));break}var j=[];if(l){var C=w[0].width,$=x.width;j.push("scale(".concat((q($)?$/C:1)/C,")"))}return b&&j.push("rotate(".concat(b,", ").concat(M,", ").concat(P,")")),j.length&&(T.transform=j.join(" ")),S.createElement("text",Rl({},H(T,!0),{x:M,y:P,className:J("recharts-text",_),textAnchor:d,fill:g.includes("url")?ky:g}),w.map(function(k,R){var L=k.words.join(A?"":" ");return S.createElement("tspan",{x:M,dy:R===0?E:u,key:"".concat(L,"-").concat(R)},L)}))};function Ct(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function OP(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function uh(e){let t,r,n;e.length!==2?(t=Ct,r=(u,c)=>Ct(e(u),c),n=(u,c)=>e(u)-c):(t=e===Ct||e===OP?e:_P,r=e,n=e);function i(u,c,s=0,f=u.length){if(s>>1;r(u[l],c)<0?s=l+1:f=l}while(s>>1;r(u[l],c)<=0?s=l+1:f=l}while(ss&&n(u[l-1],c)>-n(u[l],c)?l-1:l}return{left:i,center:o,right:a}}function _P(){return 0}function V0(e){return e===null?NaN:+e}function*AP(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const SP=uh(Ct),ci=SP.right;uh(V0).center;class Ry extends Map{constructor(t,r=EP){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,i]of t)this.set(n,i)}get(t){return super.get(Dy(this,t))}has(t){return super.has(Dy(this,t))}set(t,r){return super.set(PP(this,t),r)}delete(t){return super.delete(TP(this,t))}}function Dy({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function PP({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function TP({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function EP(e){return e!==null&&typeof e=="object"?e.valueOf():e}function jP(e=Ct){if(e===Ct)return X0;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function X0(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const MP=Math.sqrt(50),$P=Math.sqrt(10),CP=Math.sqrt(2);function Wi(e,t,r){const n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),a=n/Math.pow(10,i),o=a>=MP?10:a>=$P?5:a>=CP?2:1;let u,c,s;return i<0?(s=Math.pow(10,-i)/o,u=Math.round(e*s),c=Math.round(t*s),u/st&&--c,s=-s):(s=Math.pow(10,i)*o,u=Math.round(e/s),c=Math.round(t/s),u*st&&--c),c0))return[];if(e===t)return[e];const n=t=i))return[];const u=a-i+1,c=new Array(u);if(n)if(o<0)for(let s=0;s=n)&&(r=n);return r}function qy(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function Y0(e,t,r=0,n=1/0,i){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(i=i===void 0?X0:jP(i);n>r;){if(n-r>600){const c=n-r+1,s=t-r+1,f=Math.log(c),l=.5*Math.exp(2*f/3),h=.5*Math.sqrt(f*l*(c-l)/c)*(s-c/2<0?-1:1),d=Math.max(r,Math.floor(t-s*l/c+h)),y=Math.min(n,Math.floor(t+(c-s)*l/c+h));Y0(e,t,d,y,i)}const a=e[t];let o=r,u=n;for(on(e,r,t),i(e[n],a)>0&&on(e,r,n);o0;)--u}i(e[r],a)===0?on(e,r,u):(++u,on(e,u,n)),u<=t&&(r=u+1),t<=u&&(n=u-1)}return e}function on(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function IP(e,t,r){if(e=Float64Array.from(AP(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return qy(e);if(t>=1)return Ny(e);var n,i=(n-1)*t,a=Math.floor(i),o=Ny(Y0(e,a).subarray(0,a+1)),u=qy(e.subarray(a+1));return o+(u-o)*(i-a)}}function kP(e,t,r=V0){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,a=Math.floor(i),o=+r(e[a],a,e),u=+r(e[a+1],a+1,e);return o+(u-o)*(i-a)}}function RP(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,a=new Array(i);++n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?xi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?xi(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=NP.exec(e))?new Ne(t[1],t[2],t[3],1):(t=qP.exec(e))?new Ne(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=LP.exec(e))?xi(t[1],t[2],t[3],t[4]):(t=BP.exec(e))?xi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=FP.exec(e))?Hy(t[1],t[2]/100,t[3]/100,1):(t=WP.exec(e))?Hy(t[1],t[2]/100,t[3]/100,t[4]):Ly.hasOwnProperty(e)?Wy(Ly[e]):e==="transparent"?new Ne(NaN,NaN,NaN,0):null}function Wy(e){return new Ne(e>>16&255,e>>8&255,e&255,1)}function xi(e,t,r,n){return n<=0&&(e=t=r=NaN),new Ne(e,t,r,n)}function HP(e){return e instanceof si||(e=kn(e)),e?(e=e.rgb(),new Ne(e.r,e.g,e.b,e.opacity)):new Ne}function Bl(e,t,r,n){return arguments.length===1?HP(e):new Ne(e,t,r,n??1)}function Ne(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}sh(Ne,Bl,J0(si,{brighter(e){return e=e==null?zi:Math.pow(zi,e),new Ne(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Cn:Math.pow(Cn,e),new Ne(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ne(Zt(this.r),Zt(this.g),Zt(this.b),Ui(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:zy,formatHex:zy,formatHex8:KP,formatRgb:Uy,toString:Uy}));function zy(){return`#${Vt(this.r)}${Vt(this.g)}${Vt(this.b)}`}function KP(){return`#${Vt(this.r)}${Vt(this.g)}${Vt(this.b)}${Vt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Uy(){const e=Ui(this.opacity);return`${e===1?"rgb(":"rgba("}${Zt(this.r)}, ${Zt(this.g)}, ${Zt(this.b)}${e===1?")":`, ${e})`}`}function Ui(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Zt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Vt(e){return e=Zt(e),(e<16?"0":"")+e.toString(16)}function Hy(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new nt(e,t,r,n)}function Q0(e){if(e instanceof nt)return new nt(e.h,e.s,e.l,e.opacity);if(e instanceof si||(e=kn(e)),!e)return new nt;if(e instanceof nt)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,u=a-i,c=(a+i)/2;return u?(t===a?o=(r-n)/u+(r0&&c<1?0:o,new nt(o,u,c,e.opacity)}function GP(e,t,r,n){return arguments.length===1?Q0(e):new nt(e,t,r,n??1)}function nt(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}sh(nt,GP,J0(si,{brighter(e){return e=e==null?zi:Math.pow(zi,e),new nt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Cn:Math.pow(Cn,e),new nt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new Ne(Os(e>=240?e-240:e+120,i,n),Os(e,i,n),Os(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new nt(Ky(this.h),wi(this.s),wi(this.l),Ui(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 e=Ui(this.opacity);return`${e===1?"hsl(":"hsla("}${Ky(this.h)}, ${wi(this.s)*100}%, ${wi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ky(e){return e=(e||0)%360,e<0?e+360:e}function wi(e){return Math.max(0,Math.min(1,e||0))}function Os(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const lh=e=>()=>e;function VP(e,t){return function(r){return e+r*t}}function XP(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function YP(e){return(e=+e)==1?ex:function(t,r){return r-t?XP(t,r,e):lh(isNaN(t)?r:t)}}function ex(e,t){var r=t-e;return r?VP(e,r):lh(isNaN(e)?t:e)}const Gy=(function e(t){var r=YP(t);function n(i,a){var o=r((i=Bl(i)).r,(a=Bl(a)).r),u=r(i.g,a.g),c=r(i.b,a.b),s=ex(i.opacity,a.opacity);return function(f){return i.r=o(f),i.g=u(f),i.b=c(f),i.opacity=s(f),i+""}}return n.gamma=e,n})(1);function ZP(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(a){for(i=0;ir&&(a=t.slice(r,a),u[o]?u[o]+=a:u[++o]=a),(n=n[0])===(i=i[0])?u[o]?u[o]+=i:u[++o]=i:(u[++o]=null,c.push({i:o,x:Hi(n,i)})),r=_s.lastIndex;return rt&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function cT(e,t,r){var n=e[0],i=e[1],a=t[0],o=t[1];return i2?sT:cT,c=s=null,l}function l(h){return h==null||isNaN(h=+h)?a:(c||(c=u(e.map(n),t,r)))(n(o(h)))}return l.invert=function(h){return o(i((s||(s=u(t,e.map(n),Hi)))(h)))},l.domain=function(h){return arguments.length?(e=Array.from(h,Ki),f()):e.slice()},l.range=function(h){return arguments.length?(t=Array.from(h),f()):t.slice()},l.rangeRound=function(h){return t=Array.from(h),r=fh,f()},l.clamp=function(h){return arguments.length?(o=h?!0:ke,f()):o!==ke},l.interpolate=function(h){return arguments.length?(r=h,f()):r},l.unknown=function(h){return arguments.length?(a=h,l):a},function(h,d){return n=h,i=d,f()}}function hh(){return Ba()(ke,ke)}function lT(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Gi(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function jr(e){return e=Gi(Math.abs(e)),e?e[1]:NaN}function fT(e,t){return function(r,n){for(var i=r.length,a=[],o=0,u=e[0],c=0;i>0&&u>0&&(c+u+1>n&&(u=Math.max(1,n-c)),a.push(r.substring(i-=u,i+u)),!((c+=u+1)>n));)u=e[o=(o+1)%e.length];return a.reverse().join(t)}}function hT(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var pT=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Rn(e){if(!(t=pT.exec(e)))throw new Error("invalid format: "+e);var t;return new ph({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Rn.prototype=ph.prototype;function ph(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}ph.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 dT(e){e:for(var t=e.length,r=1,n=-1,i;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var tx;function vT(e,t){var r=Gi(e,t);if(!r)return e+"";var n=r[0],i=r[1],a=i-(tx=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=n.length;return a===o?n:a>o?n+new Array(a-o+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+Gi(e,Math.max(0,t+a-1))[0]}function Xy(e,t){var r=Gi(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const Yy={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:lT,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Xy(e*100,t),r:Xy,s:vT,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Zy(e){return e}var Jy=Array.prototype.map,Qy=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function yT(e){var t=e.grouping===void 0||e.thousands===void 0?Zy:fT(Jy.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?Zy:hT(Jy.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",u=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function s(l){l=Rn(l);var h=l.fill,d=l.align,y=l.sign,v=l.symbol,p=l.zero,g=l.width,x=l.comma,w=l.precision,O=l.trim,m=l.type;m==="n"?(x=!0,m="g"):Yy[m]||(w===void 0&&(w=12),O=!0,m="g"),(p||h==="0"&&d==="=")&&(p=!0,h="0",d="=");var b=v==="$"?r:v==="#"&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",_=v==="$"?n:/[%p]/.test(m)?o:"",A=Yy[m],T=/[defgprs%]/.test(m);w=w===void 0?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function M(P){var E=b,j=_,C,$,k;if(m==="c")j=A(P)+j,P="";else{P=+P;var R=P<0||1/P<0;if(P=isNaN(P)?c:A(Math.abs(P),w),O&&(P=dT(P)),R&&+P==0&&y!=="+"&&(R=!1),E=(R?y==="("?y:u:y==="-"||y==="("?"":y)+E,j=(m==="s"?Qy[8+tx/3]:"")+j+(R&&y==="("?")":""),T){for(C=-1,$=P.length;++C<$;)if(k=P.charCodeAt(C),48>k||k>57){j=(k===46?i+P.slice(C+1):P.slice(C))+j,P=P.slice(0,C);break}}}x&&!p&&(P=t(P,1/0));var L=E.length+P.length+j.length,B=L>1)+E+P+j+B.slice(L);break;default:P=B+E+P+j;break}return a(P)}return M.toString=function(){return l+""},M}function f(l,h){var d=s((l=Rn(l),l.type="f",l)),y=Math.max(-8,Math.min(8,Math.floor(jr(h)/3)))*3,v=Math.pow(10,-y),p=Qy[8+y/3];return function(g){return d(v*g)+p}}return{format:s,formatPrefix:f}}var Oi,dh,rx;mT({thousands:",",grouping:[3],currency:["$",""]});function mT(e){return Oi=yT(e),dh=Oi.format,rx=Oi.formatPrefix,Oi}function gT(e){return Math.max(0,-jr(Math.abs(e)))}function bT(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(jr(t)/3)))*3-jr(Math.abs(e)))}function xT(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,jr(t)-jr(e))+1}function nx(e,t,r,n){var i=ql(e,t,r),a;switch(n=Rn(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(a=bT(i,o))&&(n.precision=a),rx(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=xT(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=gT(i))&&(n.precision=a-(n.type==="%")*2);break}}return dh(n)}function kt(e){var t=e.domain;return e.ticks=function(r){var n=t();return Dl(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return nx(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,a=n.length-1,o=n[i],u=n[a],c,s,f=10;for(u0;){if(s=Nl(o,u,r),s===c)return n[i]=o,n[a]=u,t(n);if(s>0)o=Math.floor(o/s)*s,u=Math.ceil(u/s)*s;else if(s<0)o=Math.ceil(o*s)/s,u=Math.floor(u*s)/s;else break;c=s}return e},e}function Vi(){var e=hh();return e.copy=function(){return li(e,Vi())},Qe.apply(e,arguments),kt(e)}function ix(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,Ki),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return ix(e).unknown(t)},e=arguments.length?Array.from(e,Ki):[0,1],kt(r)}function ax(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],a=e[n],o;return aMath.pow(e,t)}function ST(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function rm(e){return(t,r)=>-e(-t,r)}function vh(e){const t=e(em,tm),r=t.domain;let n=10,i,a;function o(){return i=ST(n),a=AT(n),r()[0]<0?(i=rm(i),a=rm(a),e(wT,OT)):e(em,tm),t}return t.base=function(u){return arguments.length?(n=+u,o()):n},t.domain=function(u){return arguments.length?(r(u),o()):r()},t.ticks=u=>{const c=r();let s=c[0],f=c[c.length-1];const l=f0){for(;h<=d;++h)for(y=1;yf)break;g.push(v)}}else for(;h<=d;++h)for(y=n-1;y>=1;--y)if(v=h>0?y/a(-h):y*a(h),!(vf)break;g.push(v)}g.length*2{if(u==null&&(u=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=Rn(c)).precision==null&&(c.trim=!0),c=dh(c)),u===1/0)return c;const s=Math.max(1,n*u/t.ticks().length);return f=>{let l=f/a(Math.round(i(f)));return l*nr(ax(r(),{floor:u=>a(Math.floor(i(u))),ceil:u=>a(Math.ceil(i(u)))})),t}function ox(){const e=vh(Ba()).domain([1,10]);return e.copy=()=>li(e,ox()).base(e.base()),Qe.apply(e,arguments),e}function nm(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function im(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function yh(e){var t=1,r=e(nm(t),im(t));return r.constant=function(n){return arguments.length?e(nm(t=+n),im(t)):t},kt(r)}function ux(){var e=yh(Ba());return e.copy=function(){return li(e,ux()).constant(e.constant())},Qe.apply(e,arguments)}function am(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function PT(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function TT(e){return e<0?-e*e:e*e}function mh(e){var t=e(ke,ke),r=1;function n(){return r===1?e(ke,ke):r===.5?e(PT,TT):e(am(r),am(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},kt(t)}function gh(){var e=mh(Ba());return e.copy=function(){return li(e,gh()).exponent(e.exponent())},Qe.apply(e,arguments),e}function ET(){return gh.apply(null,arguments).exponent(.5)}function om(e){return Math.sign(e)*e*e}function jT(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function cx(){var e=hh(),t=[0,1],r=!1,n;function i(a){var o=jT(e(a));return isNaN(o)?n:r?Math.round(o):o}return i.invert=function(a){return e.invert(om(a))},i.domain=function(a){return arguments.length?(e.domain(a),i):e.domain()},i.range=function(a){return arguments.length?(e.range((t=Array.from(a,Ki)).map(om)),i):t.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(r=!!a,i):r},i.clamp=function(a){return arguments.length?(e.clamp(a),i):e.clamp()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return cx(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},Qe.apply(i,arguments),kt(i)}function sx(){var e=[],t=[],r=[],n;function i(){var o=0,u=Math.max(1,t.length);for(r=new Array(u-1);++o0?r[u-1]:e[0],u=r?[n[r-1],t]:[n[s-1],n[s]]},o.unknown=function(c){return arguments.length&&(a=c),o},o.thresholds=function(){return n.slice()},o.copy=function(){return lx().domain([e,t]).range(i).unknown(a)},Qe.apply(kt(o),arguments)}function fx(){var e=[.5],t=[0,1],r,n=1;function i(a){return a!=null&&a<=a?t[ci(e,a,0,n)]:r}return i.domain=function(a){return arguments.length?(e=Array.from(a),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(a){return arguments.length?(t=Array.from(a),n=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(a){var o=t.indexOf(a);return[e[o-1],e[o]]},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return fx().domain(e).range(t).unknown(r)},Qe.apply(i,arguments)}const As=new Date,Ss=new Date;function Se(e,t,r,n){function i(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),i.round=a=>{const o=i(a),u=i.ceil(a);return a-o(t(a=new Date(+a),o==null?1:Math.floor(o)),a),i.range=(a,o,u)=>{const c=[];if(a=i.ceil(a),u=u==null?1:Math.floor(u),!(a0))return c;let s;do c.push(s=new Date(+a)),t(a,u),e(a);while(sSe(o=>{if(o>=o)for(;e(o),!a(o);)o.setTime(o-1)},(o,u)=>{if(o>=o)if(u<0)for(;++u<=0;)for(;t(o,-1),!a(o););else for(;--u>=0;)for(;t(o,1),!a(o););}),r&&(i.count=(a,o)=>(As.setTime(+a),Ss.setTime(+o),e(As),e(Ss),Math.floor(r(As,Ss))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(n?o=>n(o)%a===0:o=>i.count(0,o)%a===0):i)),i}const Xi=Se(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Xi.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Se(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):Xi);Xi.range;const yt=1e3,Ze=yt*60,mt=Ze*60,Ot=mt*24,bh=Ot*7,um=Ot*30,Ps=Ot*365,Xt=Se(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*yt)},(e,t)=>(t-e)/yt,e=>e.getUTCSeconds());Xt.range;const xh=Se(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*yt)},(e,t)=>{e.setTime(+e+t*Ze)},(e,t)=>(t-e)/Ze,e=>e.getMinutes());xh.range;const wh=Se(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Ze)},(e,t)=>(t-e)/Ze,e=>e.getUTCMinutes());wh.range;const Oh=Se(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*yt-e.getMinutes()*Ze)},(e,t)=>{e.setTime(+e+t*mt)},(e,t)=>(t-e)/mt,e=>e.getHours());Oh.range;const _h=Se(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*mt)},(e,t)=>(t-e)/mt,e=>e.getUTCHours());_h.range;const fi=Se(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Ze)/Ot,e=>e.getDate()-1);fi.range;const Fa=Se(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ot,e=>e.getUTCDate()-1);Fa.range;const hx=Se(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ot,e=>Math.floor(e/Ot));hx.range;function ur(e){return Se(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*Ze)/bh)}const Wa=ur(0),Yi=ur(1),MT=ur(2),$T=ur(3),Mr=ur(4),CT=ur(5),IT=ur(6);Wa.range;Yi.range;MT.range;$T.range;Mr.range;CT.range;IT.range;function cr(e){return Se(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/bh)}const za=cr(0),Zi=cr(1),kT=cr(2),RT=cr(3),$r=cr(4),DT=cr(5),NT=cr(6);za.range;Zi.range;kT.range;RT.range;$r.range;DT.range;NT.range;const Ah=Se(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Ah.range;const Sh=Se(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Sh.range;const _t=Se(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());_t.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Se(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});_t.range;const At=Se(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());At.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Se(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});At.range;function px(e,t,r,n,i,a){const o=[[Xt,1,yt],[Xt,5,5*yt],[Xt,15,15*yt],[Xt,30,30*yt],[a,1,Ze],[a,5,5*Ze],[a,15,15*Ze],[a,30,30*Ze],[i,1,mt],[i,3,3*mt],[i,6,6*mt],[i,12,12*mt],[n,1,Ot],[n,2,2*Ot],[r,1,bh],[t,1,um],[t,3,3*um],[e,1,Ps]];function u(s,f,l){const h=fp).right(o,h);if(d===o.length)return e.every(ql(s/Ps,f/Ps,l));if(d===0)return Xi.every(Math.max(ql(s,f,l),1));const[y,v]=o[h/o[d-1][2]53)return null;"w"in D||(D.w=1),"Z"in D?(ee=Es(un(D.y,0,1)),be=ee.getUTCDay(),ee=be>4||be===0?Zi.ceil(ee):Zi(ee),ee=Fa.offset(ee,(D.V-1)*7),D.y=ee.getUTCFullYear(),D.m=ee.getUTCMonth(),D.d=ee.getUTCDate()+(D.w+6)%7):(ee=Ts(un(D.y,0,1)),be=ee.getDay(),ee=be>4||be===0?Yi.ceil(ee):Yi(ee),ee=fi.offset(ee,(D.V-1)*7),D.y=ee.getFullYear(),D.m=ee.getMonth(),D.d=ee.getDate()+(D.w+6)%7)}else("W"in D||"U"in D)&&("w"in D||(D.w="u"in D?D.u%7:"W"in D?1:0),be="Z"in D?Es(un(D.y,0,1)).getUTCDay():Ts(un(D.y,0,1)).getDay(),D.m=0,D.d="W"in D?(D.w+6)%7+D.W*7-(be+5)%7:D.w+D.U*7-(be+6)%7);return"Z"in D?(D.H+=D.Z/100|0,D.M+=D.Z%100,Es(D)):Ts(D)}}function A(F,Z,Q,D){for(var de=0,ee=Z.length,be=Q.length,xe,De;de=be)return-1;if(xe=Z.charCodeAt(de++),xe===37){if(xe=Z.charAt(de++),De=m[xe in cm?Z.charAt(de++):xe],!De||(D=De(F,Q,D))<0)return-1}else if(xe!=Q.charCodeAt(D++))return-1}return D}function T(F,Z,Q){var D=s.exec(Z.slice(Q));return D?(F.p=f.get(D[0].toLowerCase()),Q+D[0].length):-1}function M(F,Z,Q){var D=d.exec(Z.slice(Q));return D?(F.w=y.get(D[0].toLowerCase()),Q+D[0].length):-1}function P(F,Z,Q){var D=l.exec(Z.slice(Q));return D?(F.w=h.get(D[0].toLowerCase()),Q+D[0].length):-1}function E(F,Z,Q){var D=g.exec(Z.slice(Q));return D?(F.m=x.get(D[0].toLowerCase()),Q+D[0].length):-1}function j(F,Z,Q){var D=v.exec(Z.slice(Q));return D?(F.m=p.get(D[0].toLowerCase()),Q+D[0].length):-1}function C(F,Z,Q){return A(F,t,Z,Q)}function $(F,Z,Q){return A(F,r,Z,Q)}function k(F,Z,Q){return A(F,n,Z,Q)}function R(F){return o[F.getDay()]}function L(F){return a[F.getDay()]}function B(F){return c[F.getMonth()]}function U(F){return u[F.getMonth()]}function G(F){return i[+(F.getHours()>=12)]}function W(F){return 1+~~(F.getMonth()/3)}function V(F){return o[F.getUTCDay()]}function fe(F){return a[F.getUTCDay()]}function ye(F){return c[F.getUTCMonth()]}function Le(F){return u[F.getUTCMonth()]}function qt(F){return i[+(F.getUTCHours()>=12)]}function Re(F){return 1+~~(F.getUTCMonth()/3)}return{format:function(F){var Z=b(F+="",w);return Z.toString=function(){return F},Z},parse:function(F){var Z=_(F+="",!1);return Z.toString=function(){return F},Z},utcFormat:function(F){var Z=b(F+="",O);return Z.toString=function(){return F},Z},utcParse:function(F){var Z=_(F+="",!0);return Z.toString=function(){return F},Z}}}var cm={"-":"",_:" ",0:"0"},Ee=/^\s*\d+/,zT=/^%/,UT=/[\\^$*+?|[\]().{}]/g;function re(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",a=i.length;return n+(a[t.toLowerCase(),r]))}function KT(e,t,r){var n=Ee.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function GT(e,t,r){var n=Ee.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function VT(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function XT(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function YT(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function sm(e,t,r){var n=Ee.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function lm(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function ZT(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function JT(e,t,r){var n=Ee.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function QT(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function fm(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function eE(e,t,r){var n=Ee.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function hm(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function tE(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function rE(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function nE(e,t,r){var n=Ee.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function iE(e,t,r){var n=Ee.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function aE(e,t,r){var n=zT.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function oE(e,t,r){var n=Ee.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function uE(e,t,r){var n=Ee.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function pm(e,t){return re(e.getDate(),t,2)}function cE(e,t){return re(e.getHours(),t,2)}function sE(e,t){return re(e.getHours()%12||12,t,2)}function lE(e,t){return re(1+fi.count(_t(e),e),t,3)}function dx(e,t){return re(e.getMilliseconds(),t,3)}function fE(e,t){return dx(e,t)+"000"}function hE(e,t){return re(e.getMonth()+1,t,2)}function pE(e,t){return re(e.getMinutes(),t,2)}function dE(e,t){return re(e.getSeconds(),t,2)}function vE(e){var t=e.getDay();return t===0?7:t}function yE(e,t){return re(Wa.count(_t(e)-1,e),t,2)}function vx(e){var t=e.getDay();return t>=4||t===0?Mr(e):Mr.ceil(e)}function mE(e,t){return e=vx(e),re(Mr.count(_t(e),e)+(_t(e).getDay()===4),t,2)}function gE(e){return e.getDay()}function bE(e,t){return re(Yi.count(_t(e)-1,e),t,2)}function xE(e,t){return re(e.getFullYear()%100,t,2)}function wE(e,t){return e=vx(e),re(e.getFullYear()%100,t,2)}function OE(e,t){return re(e.getFullYear()%1e4,t,4)}function _E(e,t){var r=e.getDay();return e=r>=4||r===0?Mr(e):Mr.ceil(e),re(e.getFullYear()%1e4,t,4)}function AE(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+re(t/60|0,"0",2)+re(t%60,"0",2)}function dm(e,t){return re(e.getUTCDate(),t,2)}function SE(e,t){return re(e.getUTCHours(),t,2)}function PE(e,t){return re(e.getUTCHours()%12||12,t,2)}function TE(e,t){return re(1+Fa.count(At(e),e),t,3)}function yx(e,t){return re(e.getUTCMilliseconds(),t,3)}function EE(e,t){return yx(e,t)+"000"}function jE(e,t){return re(e.getUTCMonth()+1,t,2)}function ME(e,t){return re(e.getUTCMinutes(),t,2)}function $E(e,t){return re(e.getUTCSeconds(),t,2)}function CE(e){var t=e.getUTCDay();return t===0?7:t}function IE(e,t){return re(za.count(At(e)-1,e),t,2)}function mx(e){var t=e.getUTCDay();return t>=4||t===0?$r(e):$r.ceil(e)}function kE(e,t){return e=mx(e),re($r.count(At(e),e)+(At(e).getUTCDay()===4),t,2)}function RE(e){return e.getUTCDay()}function DE(e,t){return re(Zi.count(At(e)-1,e),t,2)}function NE(e,t){return re(e.getUTCFullYear()%100,t,2)}function qE(e,t){return e=mx(e),re(e.getUTCFullYear()%100,t,2)}function LE(e,t){return re(e.getUTCFullYear()%1e4,t,4)}function BE(e,t){var r=e.getUTCDay();return e=r>=4||r===0?$r(e):$r.ceil(e),re(e.getUTCFullYear()%1e4,t,4)}function FE(){return"+0000"}function vm(){return"%"}function ym(e){return+e}function mm(e){return Math.floor(+e/1e3)}var hr,gx,bx;WE({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 WE(e){return hr=WT(e),gx=hr.format,hr.parse,bx=hr.utcFormat,hr.utcParse,hr}function zE(e){return new Date(e)}function UE(e){return e instanceof Date?+e:+new Date(+e)}function Ph(e,t,r,n,i,a,o,u,c,s){var f=hh(),l=f.invert,h=f.domain,d=s(".%L"),y=s(":%S"),v=s("%I:%M"),p=s("%I %p"),g=s("%a %d"),x=s("%b %d"),w=s("%B"),O=s("%Y");function m(b){return(c(b)t(i/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(i,a)=>IP(e,a/n))},r.copy=function(){return _x(t).domain(e)},Tt.apply(r,arguments)}function Ha(){var e=0,t=.5,r=1,n=1,i,a,o,u,c,s=ke,f,l=!1,h;function d(v){return isNaN(v=+v)?h:(v=.5+((v=+f(v))-a)*(n*vr}return Ms=e,Ms}var $s,wm;function XE(){if(wm)return $s;wm=1;var e=Ka(),t=Tx(),r=Jr();function n(i){return i&&i.length?e(i,r,t):void 0}return $s=n,$s}var YE=XE();const Ga=oe(YE);var Cs,Om;function Ex(){if(Om)return Cs;Om=1;function e(t,r){return te.e^a.s<0?1:-1;for(n=a.d.length,i=e.d.length,t=0,r=ne.d[t]^a.s<0?1:-1;return n===i?0:n>i^a.s<0?1:-1};z.decimalPlaces=z.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*he;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};z.dividedBy=z.div=function(e){return xt(this,new this.constructor(e))};z.dividedToIntegerBy=z.idiv=function(e){var t=this,r=t.constructor;return ue(xt(t,new r(e),0,1),r.precision)};z.equals=z.eq=function(e){return!this.cmp(e)};z.exponent=function(){return ge(this)};z.greaterThan=z.gt=function(e){return this.cmp(e)>0};z.greaterThanOrEqualTo=z.gte=function(e){return this.cmp(e)>=0};z.isInteger=z.isint=function(){return this.e>this.d.length-2};z.isNegative=z.isneg=function(){return this.s<0};z.isPositive=z.ispos=function(){return this.s>0};z.isZero=function(){return this.s===0};z.lessThan=z.lt=function(e){return this.cmp(e)<0};z.lessThanOrEqualTo=z.lte=function(e){return this.cmp(e)<1};z.logarithm=z.log=function(e){var t,r=this,n=r.constructor,i=n.precision,a=i+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(Ue))throw Error(Je+"NaN");if(r.s<1)throw Error(Je+(r.s?"NaN":"-Infinity"));return r.eq(Ue)?new n(0):(pe=!1,t=xt(Dn(r,a),Dn(e,a),a),pe=!0,ue(t,i))};z.minus=z.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?Cx(t,e):Mx(t,(e.s=-e.s,e))};z.modulo=z.mod=function(e){var t,r=this,n=r.constructor,i=n.precision;if(e=new n(e),!e.s)throw Error(Je+"NaN");return r.s?(pe=!1,t=xt(r,e,0,1).times(e),pe=!0,r.minus(t)):ue(new n(r),i)};z.naturalExponential=z.exp=function(){return $x(this)};z.naturalLogarithm=z.ln=function(){return Dn(this)};z.negated=z.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};z.plus=z.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?Mx(t,e):Cx(t,(e.s=-e.s,e))};z.precision=z.sd=function(e){var t,r,n,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Jt+e);if(t=ge(i)+1,n=i.d.length-1,r=n*he+1,n=i.d[n],n){for(;n%10==0;n/=10)r--;for(n=i.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};z.squareRoot=z.sqrt=function(){var e,t,r,n,i,a,o,u=this,c=u.constructor;if(u.s<1){if(!u.s)return new c(0);throw Error(Je+"NaN")}for(e=ge(u),pe=!1,i=Math.sqrt(+u),i==0||i==1/0?(t=ot(u.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=tn((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new c(t)):n=new c(i.toString()),r=c.precision,i=o=r+3;;)if(a=n,n=a.plus(xt(u,a,o+2)).times(.5),ot(a.d).slice(0,o)===(t=ot(n.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(ue(a,r+1,0),a.times(a).eq(u)){n=a;break}}else if(t!="9999")break;o+=4}return pe=!0,ue(n,r)};z.times=z.mul=function(e){var t,r,n,i,a,o,u,c,s,f=this,l=f.constructor,h=f.d,d=(e=new l(e)).d;if(!f.s||!e.s)return new l(0);for(e.s*=f.s,r=f.e+e.e,c=h.length,s=d.length,c=0;){for(t=0,i=c+n;i>n;)u=a[i]+d[n]*h[i-n-1]+t,a[i--]=u%Pe|0,t=u/Pe|0;a[i]=(a[i]+t)%Pe|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=r,pe?ue(e,l.precision):e};z.toDecimalPlaces=z.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(st(e,0,en),t===void 0?t=n.rounding:st(t,0,8),ue(r,e+ge(r)+1,t))};z.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=nr(n,!0):(st(e,0,en),t===void 0?t=i.rounding:st(t,0,8),n=ue(new i(n),e+1,t),r=nr(n,!0,e+1)),r};z.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return e===void 0?nr(i):(st(e,0,en),t===void 0?t=a.rounding:st(t,0,8),n=ue(new a(i),e+ge(i)+1,t),r=nr(n.abs(),!1,e+ge(n)+1),i.isneg()&&!i.isZero()?"-"+r:r)};z.toInteger=z.toint=function(){var e=this,t=e.constructor;return ue(new t(e),ge(e)+1,t.rounding)};z.toNumber=function(){return+this};z.toPower=z.pow=function(e){var t,r,n,i,a,o,u=this,c=u.constructor,s=12,f=+(e=new c(e));if(!e.s)return new c(Ue);if(u=new c(u),!u.s){if(e.s<1)throw Error(Je+"Infinity");return u}if(u.eq(Ue))return u;if(n=c.precision,e.eq(Ue))return ue(u,n);if(t=e.e,r=e.d.length-1,o=t>=r,a=u.s,o){if((r=f<0?-f:f)<=jx){for(i=new c(Ue),t=Math.ceil(n/he+4),pe=!1;r%2&&(i=i.times(u),Em(i.d,t)),r=tn(r/2),r!==0;)u=u.times(u),Em(u.d,t);return pe=!0,e.s<0?new c(Ue).div(i):ue(i,n)}}else if(a<0)throw Error(Je+"NaN");return a=a<0&&e.d[Math.max(t,r)]&1?-1:1,u.s=1,pe=!1,i=e.times(Dn(u,n+s)),pe=!0,i=$x(i),i.s=a,i};z.toPrecision=function(e,t){var r,n,i=this,a=i.constructor;return e===void 0?(r=ge(i),n=nr(i,r<=a.toExpNeg||r>=a.toExpPos)):(st(e,1,en),t===void 0?t=a.rounding:st(t,0,8),i=ue(new a(i),e,t),r=ge(i),n=nr(i,e<=r||r<=a.toExpNeg,e)),n};z.toSignificantDigits=z.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(st(e,1,en),t===void 0?t=n.rounding:st(t,0,8)),ue(new n(r),e,t)};z.toString=z.valueOf=z.val=z.toJSON=z[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=ge(e),r=e.constructor;return nr(e,t<=r.toExpNeg||t>=r.toExpPos)};function Mx(e,t){var r,n,i,a,o,u,c,s,f=e.constructor,l=f.precision;if(!e.s||!t.s)return t.s||(t=new f(e)),pe?ue(t,l):t;if(c=e.d,s=t.d,o=e.e,i=t.e,c=c.slice(),a=o-i,a){for(a<0?(n=c,a=-a,u=s.length):(n=s,i=o,u=c.length),o=Math.ceil(l/he),u=o>u?o+1:u+1,a>u&&(a=u,n.length=1),n.reverse();a--;)n.push(0);n.reverse()}for(u=c.length,a=s.length,u-a<0&&(a=u,n=s,s=c,c=n),r=0;a;)r=(c[--a]=c[a]+s[a]+r)/Pe|0,c[a]%=Pe;for(r&&(c.unshift(r),++i),u=c.length;c[--u]==0;)c.pop();return t.d=c,t.e=i,pe?ue(t,l):t}function st(e,t,r){if(e!==~~e||er)throw Error(Jt+e)}function ot(e){var t,r,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;to?1:-1;else for(u=c=0;ui[u]?1:-1;break}return c}function r(n,i,a){for(var o=0;a--;)n[a]-=o,o=n[a]1;)n.shift()}return function(n,i,a,o){var u,c,s,f,l,h,d,y,v,p,g,x,w,O,m,b,_,A,T=n.constructor,M=n.s==i.s?1:-1,P=n.d,E=i.d;if(!n.s)return new T(n);if(!i.s)throw Error(Je+"Division by zero");for(c=n.e-i.e,_=E.length,m=P.length,d=new T(M),y=d.d=[],s=0;E[s]==(P[s]||0);)++s;if(E[s]>(P[s]||0)&&--c,a==null?x=a=T.precision:o?x=a+(ge(n)-ge(i))+1:x=a,x<0)return new T(0);if(x=x/he+2|0,s=0,_==1)for(f=0,E=E[0],x++;(s1&&(E=e(E,f),P=e(P,f),_=E.length,m=P.length),O=_,v=P.slice(0,_),p=v.length;p<_;)v[p++]=0;A=E.slice(),A.unshift(0),b=E[0],E[1]>=Pe/2&&++b;do f=0,u=t(E,v,_,p),u<0?(g=v[0],_!=p&&(g=g*Pe+(v[1]||0)),f=g/b|0,f>1?(f>=Pe&&(f=Pe-1),l=e(E,f),h=l.length,p=v.length,u=t(l,v,h,p),u==1&&(f--,r(l,_16)throw Error(jh+ge(e));if(!e.s)return new f(Ue);for(pe=!1,u=l,o=new f(.03125);e.abs().gte(.1);)e=e.times(o),s+=5;for(n=Math.log(Ht(2,s))/Math.LN10*2+5|0,u+=n,r=i=a=new f(Ue),f.precision=u;;){if(i=ue(i.times(e),u),r=r.times(++c),o=a.plus(xt(i,r,u)),ot(o.d).slice(0,u)===ot(a.d).slice(0,u)){for(;s--;)a=ue(a.times(a),u);return f.precision=l,t==null?(pe=!0,ue(a,l)):a}a=o}}function ge(e){for(var t=e.e*he,r=e.d[0];r>=10;r/=10)t++;return t}function Ns(e,t,r){if(t>e.LN10.sd())throw pe=!0,r&&(e.precision=r),Error(Je+"LN10 precision limit exceeded");return ue(new e(e.LN10),t)}function jt(e){for(var t="";e--;)t+="0";return t}function Dn(e,t){var r,n,i,a,o,u,c,s,f,l=1,h=10,d=e,y=d.d,v=d.constructor,p=v.precision;if(d.s<1)throw Error(Je+(d.s?"NaN":"-Infinity"));if(d.eq(Ue))return new v(0);if(t==null?(pe=!1,s=p):s=t,d.eq(10))return t==null&&(pe=!0),Ns(v,s);if(s+=h,v.precision=s,r=ot(y),n=r.charAt(0),a=ge(d),Math.abs(a)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)d=d.times(e),r=ot(d.d),n=r.charAt(0),l++;a=ge(d),n>1?(d=new v("0."+r),a++):d=new v(n+"."+r.slice(1))}else return c=Ns(v,s+2,p).times(a+""),d=Dn(new v(n+"."+r.slice(1)),s-h).plus(c),v.precision=p,t==null?(pe=!0,ue(d,p)):d;for(u=o=d=xt(d.minus(Ue),d.plus(Ue),s),f=ue(d.times(d),s),i=3;;){if(o=ue(o.times(f),s),c=u.plus(xt(o,new v(i),s)),ot(c.d).slice(0,s)===ot(u.d).slice(0,s))return u=u.times(2),a!==0&&(u=u.plus(Ns(v,s+2,p).times(a+""))),u=xt(u,new v(l),s),v.precision=p,t==null?(pe=!0,ue(u,p)):u;u=c,i+=2}}function Tm(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(n,i),t){if(i-=n,r=r-n-1,e.e=tn(r/he),e.d=[],n=(r+1)%he,r<0&&(n+=he),nJi||e.e<-Ji))throw Error(jh+r)}else e.s=0,e.e=0,e.d=[0];return e}function ue(e,t,r){var n,i,a,o,u,c,s,f,l=e.d;for(o=1,a=l[0];a>=10;a/=10)o++;if(n=t-o,n<0)n+=he,i=t,s=l[f=0];else{if(f=Math.ceil((n+1)/he),a=l.length,f>=a)return e;for(s=a=l[f],o=1;a>=10;a/=10)o++;n%=he,i=n-he+o}if(r!==void 0&&(a=Ht(10,o-i-1),u=s/a%10|0,c=t<0||l[f+1]!==void 0||s%a,c=r<4?(u||c)&&(r==0||r==(e.s<0?3:2)):u>5||u==5&&(r==4||c||r==6&&(n>0?i>0?s/Ht(10,o-i):0:l[f-1])%10&1||r==(e.s<0?8:7))),t<1||!l[0])return c?(a=ge(e),l.length=1,t=t-a-1,l[0]=Ht(10,(he-t%he)%he),e.e=tn(-t/he)||0):(l.length=1,l[0]=e.e=e.s=0),e;if(n==0?(l.length=f,a=1,f--):(l.length=f+1,a=Ht(10,he-n),l[f]=i>0?(s/Ht(10,o-i)%Ht(10,i)|0)*a:0),c)for(;;)if(f==0){(l[0]+=a)==Pe&&(l[0]=1,++e.e);break}else{if(l[f]+=a,l[f]!=Pe)break;l[f--]=0,a=1}for(n=l.length;l[--n]===0;)l.pop();if(pe&&(e.e>Ji||e.e<-Ji))throw Error(jh+ge(e));return e}function Cx(e,t){var r,n,i,a,o,u,c,s,f,l,h=e.constructor,d=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),pe?ue(t,d):t;if(c=e.d,l=t.d,n=t.e,s=e.e,c=c.slice(),o=s-n,o){for(f=o<0,f?(r=c,o=-o,u=l.length):(r=l,n=s,u=c.length),i=Math.max(Math.ceil(d/he),u)+2,o>i&&(o=i,r.length=1),r.reverse(),i=o;i--;)r.push(0);r.reverse()}else{for(i=c.length,u=l.length,f=i0;--i)c[u++]=0;for(i=l.length;i>o;){if(c[--i]0?a=a.charAt(0)+"."+a.slice(1)+jt(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+jt(-i-1)+a,r&&(n=r-o)>0&&(a+=jt(n))):i>=o?(a+=jt(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+jt(n))):((n=i+1)0&&(i+1===o&&(a+="."),a+=jt(n))),e.s<0?"-"+a:a}function Em(e,t){if(e.length>t)return e.length=t,!0}function Ix(e){var t,r,n;function i(a){var o=this;if(!(o instanceof i))return new i(a);if(o.constructor=i,a instanceof i){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(Jt+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return Tm(o,a.toString())}else if(typeof a!="string")throw Error(Jt+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,oj.test(a))Tm(o,a);else throw Error(Jt+a)}if(i.prototype=z,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=Ix,i.config=i.set=uj,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&n<=i[t+2])this[r]=n;else throw Error(Jt+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(Jt+r+": "+n);return this}var Mh=Ix(aj);Ue=new Mh(1);const ae=Mh;function cj(e){return hj(e)||fj(e)||lj(e)||sj()}function sj(){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 lj(e,t){if(e){if(typeof e=="string")return zl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zl(e,t)}}function fj(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function hj(e){if(Array.isArray(e))return zl(e)}function zl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=t?r.apply(void 0,i):e(t-o,jm(function(){for(var u=arguments.length,c=new Array(u),s=0;se.length)&&(t=e.length);for(var r=0,n=new Array(t);r"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),u;!(n=(u=o.next()).done)&&(r.push(u.value),!(t&&r.length===t));n=!0);}catch(c){i=!0,a=c}finally{try{!n&&o.return!=null&&o.return()}finally{if(i)throw a}}return r}}function Tj(e){if(Array.isArray(e))return e}function qx(e){var t=Nn(e,2),r=t[0],n=t[1],i=r,a=n;return r>n&&(i=n,a=r),[i,a]}function Lx(e,t,r){if(e.lte(0))return new ae(0);var n=Ya.getDigitCount(e.toNumber()),i=new ae(10).pow(n),a=e.div(i),o=n!==1?.05:.1,u=new ae(Math.ceil(a.div(o).toNumber())).add(r).mul(o),c=u.mul(i);return t?c:new ae(Math.ceil(c))}function Ej(e,t,r){var n=1,i=new ae(e);if(!i.isint()&&r){var a=Math.abs(e);a<1?(n=new ae(10).pow(Ya.getDigitCount(e)-1),i=new ae(Math.floor(i.div(n).toNumber())).mul(n)):a>1&&(i=new ae(Math.floor(e)))}else e===0?i=new ae(Math.floor((t-1)/2)):r||(i=new ae(Math.floor(e)));var o=Math.floor((t-1)/2),u=yj(vj(function(c){return i.add(new ae(c-o).mul(n)).toNumber()}),Ul);return u(0,t)}function Bx(e,t,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(r-1)))return{step:new ae(0),tickMin:new ae(0),tickMax:new ae(0)};var a=Lx(new ae(t).sub(e).div(r-1),n,i),o;e<=0&&t>=0?o=new ae(0):(o=new ae(e).add(t).div(2),o=o.sub(new ae(o).mod(a)));var u=Math.ceil(o.sub(e).div(a).toNumber()),c=Math.ceil(new ae(t).sub(o).div(a).toNumber()),s=u+c+1;return s>r?Bx(e,t,r,n,i+1):(s0?c+(r-s):c,u=t>0?u:u+(r-s)),{step:a,tickMin:o.sub(new ae(u).mul(a)),tickMax:o.add(new ae(c).mul(a))})}function jj(e){var t=Nn(e,2),r=t[0],n=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),u=qx([r,n]),c=Nn(u,2),s=c[0],f=c[1];if(s===-1/0||f===1/0){var l=f===1/0?[s].concat(Kl(Ul(0,i-1).map(function(){return 1/0}))):[].concat(Kl(Ul(0,i-1).map(function(){return-1/0})),[f]);return r>n?Hl(l):l}if(s===f)return Ej(s,i,a);var h=Bx(s,f,o,a),d=h.step,y=h.tickMin,v=h.tickMax,p=Ya.rangeStep(y,v.add(new ae(.1).mul(d)),d);return r>n?Hl(p):p}function Mj(e,t){var r=Nn(e,2),n=r[0],i=r[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=qx([n,i]),u=Nn(o,2),c=u[0],s=u[1];if(c===-1/0||s===1/0)return[n,i];if(c===s)return[c];var f=Math.max(t,2),l=Lx(new ae(s).sub(c).div(f-1),a,0),h=[].concat(Kl(Ya.rangeStep(new ae(c),new ae(s).sub(new ae(.99).mul(l)),l)),[s]);return n>i?Hl(h):h}var $j=Dx(jj),Cj=Dx(Mj),Ij=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Cr(e){"@babel/helpers - typeof";return Cr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cr(e)}function Qi(){return Qi=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Bj(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Fj(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wj(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,o=-1,u=(r=n?.length)!==null&&r!==void 0?r:0;if(u<=1)return 0;if(a&&a.axisType==="angleAxis"&&Math.abs(Math.abs(a.range[1]-a.range[0])-360)<=1e-6)for(var c=a.range,s=0;s0?i[s-1].coordinate:i[u-1].coordinate,l=i[s].coordinate,h=s>=u-1?i[0].coordinate:i[s+1].coordinate,d=void 0;if(Ce(l-f)!==Ce(h-l)){var y=[];if(Ce(h-l)===Ce(c[1]-c[0])){d=h;var v=l+c[1]-c[0];y[0]=Math.min(v,(v+f)/2),y[1]=Math.max(v,(v+f)/2)}else{d=f;var p=h+c[1]-c[0];y[0]=Math.min(l,(p+l)/2),y[1]=Math.max(l,(p+l)/2)}var g=[Math.min(l,(d+l)/2),Math.max(l,(d+l)/2)];if(t>g[0]&&t<=g[1]||t>=y[0]&&t<=y[1]){o=i[s].index;break}}else{var x=Math.min(f,h),w=Math.max(f,h);if(t>(x+l)/2&&t<=(w+l)/2){o=i[s].index;break}}}else for(var O=0;O0&&O(n[O].coordinate+n[O-1].coordinate)/2&&t<=(n[O].coordinate+n[O+1].coordinate)/2||O===u-1&&t>(n[O].coordinate+n[O-1].coordinate)/2){o=n[O].index;break}return o},$h=function(t){var r,n=t,i=n.type.displayName,a=(r=t.type)!==null&&r!==void 0&&r.defaultProps?ve(ve({},t.type.defaultProps),t.props):t.props,o=a.stroke,u=a.fill,c;switch(i){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:u;break;default:c=u;break}return c},aM=function(t){var r=t.barSize,n=t.totalSize,i=t.stackGroups,a=i===void 0?{}:i;if(!a)return{};for(var o={},u=Object.keys(a),c=0,s=u.length;c=0});if(g&&g.length){var x=g[0].type.defaultProps,w=x!==void 0?ve(ve({},x),g[0].props):g[0].props,O=w.barSize,m=w[p];o[m]||(o[m]=[]);var b=Y(O)?r:O;o[m].push({item:g[0],stackList:g.slice(1),barSize:Y(b)?void 0:Ie(b,n,0)})}}return o},oM=function(t){var r=t.barGap,n=t.barCategoryGap,i=t.bandSize,a=t.sizeList,o=a===void 0?[]:a,u=t.maxBarSize,c=o.length;if(c<1)return null;var s=Ie(r,i,0,!0),f,l=[];if(o[0].barSize===+o[0].barSize){var h=!1,d=i/c,y=o.reduce(function(O,m){return O+m.barSize||0},0);y+=(c-1)*s,y>=i&&(y-=(c-1)*s,s=0),y>=i&&d>0&&(h=!0,d*=.9,y=c*d);var v=(i-y)/2>>0,p={offset:v-s,size:0};f=o.reduce(function(O,m){var b={item:m.item,position:{offset:p.offset+p.size+s,size:h?d:m.barSize}},_=[].concat(Cm(O),[b]);return p=_[_.length-1].position,m.stackList&&m.stackList.length&&m.stackList.forEach(function(A){_.push({item:A,position:p})}),_},l)}else{var g=Ie(n,i,0,!0);i-2*g-(c-1)*s<=0&&(s=0);var x=(i-2*g-(c-1)*s)/c;x>1&&(x>>=0);var w=u===+u?Math.min(x,u):x;f=o.reduce(function(O,m,b){var _=[].concat(Cm(O),[{item:m.item,position:{offset:g+(x+s)*b+(x-w)/2,size:w}}]);return m.stackList&&m.stackList.length&&m.stackList.forEach(function(A){_.push({item:A,position:_[_.length-1].position})}),_},l)}return f},uM=function(t,r,n,i){var a=n.children,o=n.width,u=n.margin,c=o-(u.left||0)-(u.right||0),s=Ux({children:a,legendWidth:c});if(s){var f=i||{},l=f.width,h=f.height,d=s.align,y=s.verticalAlign,v=s.layout;if((v==="vertical"||v==="horizontal"&&y==="middle")&&d!=="center"&&q(t[d]))return ve(ve({},t),{},_r({},d,t[d]+(l||0)));if((v==="horizontal"||v==="vertical"&&d==="center")&&y!=="middle"&&q(t[y]))return ve(ve({},t),{},_r({},y,t[y]+(h||0)))}return t},cM=function(t,r,n){return Y(r)?!0:t==="horizontal"?r==="yAxis":t==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},Hx=function(t,r,n,i,a){var o=r.props.children,u=Ke(o,pi).filter(function(s){return cM(i,a,s.props.direction)});if(u&&u.length){var c=u.map(function(s){return s.props.dataKey});return t.reduce(function(s,f){var l=_e(f,n);if(Y(l))return s;var h=Array.isArray(l)?[Va(l),Ga(l)]:[l,l],d=c.reduce(function(y,v){var p=_e(f,v,0),g=h[0]-Math.abs(Array.isArray(p)?p[0]:p),x=h[1]+Math.abs(Array.isArray(p)?p[1]:p);return[Math.min(g,y[0]),Math.max(x,y[1])]},[1/0,-1/0]);return[Math.min(d[0],s[0]),Math.max(d[1],s[1])]},[1/0,-1/0])}return null},sM=function(t,r,n,i,a){var o=r.map(function(u){return Hx(t,u,n,a,i)}).filter(function(u){return!Y(u)});return o&&o.length?o.reduce(function(u,c){return[Math.min(u[0],c[0]),Math.max(u[1],c[1])]},[1/0,-1/0]):null},Kx=function(t,r,n,i,a){var o=r.map(function(c){var s=c.props.dataKey;return n==="number"&&s&&Hx(t,c,s,i)||bn(t,s,n,a)});if(n==="number")return o.reduce(function(c,s){return[Math.min(c[0],s[0]),Math.max(c[1],s[1])]},[1/0,-1/0]);var u={};return o.reduce(function(c,s){for(var f=0,l=s.length;f=2?Ce(u[0]-u[1])*2*s:s,r&&(t.ticks||t.niceTicks)){var f=(t.ticks||t.niceTicks).map(function(l){var h=a?a.indexOf(l):l;return{coordinate:i(h)+s,value:l,offset:s}});return f.filter(function(l){return!oi(l.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(l,h){return{coordinate:i(l)+s,value:l,index:h,offset:s}}):i.ticks&&!n?i.ticks(t.tickCount).map(function(l){return{coordinate:i(l)+s,value:l,offset:s}}):i.domain().map(function(l,h){return{coordinate:i(l)+s,value:a?a[l]:l,index:h,offset:s}})},qs=new WeakMap,_i=function(t,r){if(typeof r!="function")return t;qs.has(t)||qs.set(t,new WeakMap);var n=qs.get(t);if(n.has(r))return n.get(r);var i=function(){t.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,i),i},Xx=function(t,r,n){var i=t.scale,a=t.type,o=t.layout,u=t.axisType;if(i==="auto")return o==="radial"&&u==="radiusAxis"?{scale:$n(),realScaleType:"band"}:o==="radial"&&u==="angleAxis"?{scale:Vi(),realScaleType:"linear"}:a==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:gn(),realScaleType:"point"}:a==="category"?{scale:$n(),realScaleType:"band"}:{scale:Vi(),realScaleType:"linear"};if(er(i)){var c="scale".concat(Ia(i));return{scale:(gm[c]||gn)(),realScaleType:gm[c]?c:"point"}}return X(i)?{scale:i}:{scale:gn(),realScaleType:"point"}},km=1e-4,Yx=function(t){var r=t.domain();if(!(!r||r.length<=2)){var n=r.length,i=t.range(),a=Math.min(i[0],i[1])-km,o=Math.max(i[0],i[1])+km,u=t(r[0]),c=t(r[n-1]);(uo||co)&&t.domain([r[0],r[n-1]])}},lM=function(t,r){if(!t)return null;for(var n=0,i=t.length;ni)&&(a[1]=i),a[0]>i&&(a[0]=i),a[1]=0?(t[u][n][0]=a,t[u][n][1]=a+c,a=t[u][n][1]):(t[u][n][0]=o,t[u][n][1]=o+c,o=t[u][n][1])}},pM=function(t){var r=t.length;if(!(r<=0))for(var n=0,i=t[0].length;n=0?(t[o][n][0]=a,t[o][n][1]=a+u,a=t[o][n][1]):(t[o][n][0]=0,t[o][n][1]=0)}},dM={sign:hM,expand:r1,none:Ar,silhouette:n1,wiggle:i1,positive:pM},vM=function(t,r,n){var i=r.map(function(u){return u.props.dataKey}),a=dM[n],o=t1().keys(i).value(function(u,c){return+_e(u,c,0)}).order(Sl).offset(a);return o(t)},yM=function(t,r,n,i,a,o){if(!t)return null;var u=o?r.reverse():r,c={},s=u.reduce(function(l,h){var d,y=(d=h.type)!==null&&d!==void 0&&d.defaultProps?ve(ve({},h.type.defaultProps),h.props):h.props,v=y.stackId,p=y.hide;if(p)return l;var g=y[n],x=l[g]||{hasStack:!1,stackGroups:{}};if(Ae(v)){var w=x.stackGroups[v]||{numericAxisId:n,cateAxisId:i,items:[]};w.items.push(h),x.hasStack=!0,x.stackGroups[v]=w}else x.stackGroups[Zr("_stackId_")]={numericAxisId:n,cateAxisId:i,items:[h]};return ve(ve({},l),{},_r({},g,x))},c),f={};return Object.keys(s).reduce(function(l,h){var d=s[h];if(d.hasStack){var y={};d.stackGroups=Object.keys(d.stackGroups).reduce(function(v,p){var g=d.stackGroups[p];return ve(ve({},v),{},_r({},p,{numericAxisId:n,cateAxisId:i,items:g.items,stackedData:vM(t,g.items,a)}))},y)}return ve(ve({},l),{},_r({},h,d))},f)},Zx=function(t,r){var n=r.realScaleType,i=r.type,a=r.tickCount,o=r.originalDomain,u=r.allowDecimals,c=n||r.scale;if(c!=="auto"&&c!=="linear")return null;if(a&&i==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var s=t.domain();if(!s.length)return null;var f=$j(s,a,u);return t.domain([Va(f),Ga(f)]),{niceTicks:f}}if(a&&i==="number"){var l=t.domain(),h=Cj(l,a,u);return{niceTicks:h}}return null};function Rm(e){var t=e.axis,r=e.ticks,n=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Y(i[t.dataKey])){var u=Mi(r,"value",i[t.dataKey]);if(u)return u.coordinate+n/2}return r[a]?r[a].coordinate+n/2:null}var c=_e(i,Y(o)?t.dataKey:o);return Y(c)?null:t.scale(c)}var Dm=function(t){var r=t.axis,n=t.ticks,i=t.offset,a=t.bandSize,o=t.entry,u=t.index;if(r.type==="category")return n[u]?n[u].coordinate+i:null;var c=_e(o,r.dataKey,r.domain[u]);return Y(c)?null:r.scale(c)-a/2+i},mM=function(t){var r=t.numericAxis,n=r.scale.domain();if(r.type==="number"){var i=Math.min(n[0],n[1]),a=Math.max(n[0],n[1]);return i<=0&&a>=0?0:a<0?a:i}return n[0]},gM=function(t,r){var n,i=(n=t.type)!==null&&n!==void 0&&n.defaultProps?ve(ve({},t.type.defaultProps),t.props):t.props,a=i.stackId;if(Ae(a)){var o=r[a];if(o){var u=o.items.indexOf(t);return u>=0?o.stackedData[u]:null}}return null},bM=function(t){return t.reduce(function(r,n){return[Va(n.concat([r[0]]).filter(q)),Ga(n.concat([r[1]]).filter(q))]},[1/0,-1/0])},Jx=function(t,r,n){return Object.keys(t).reduce(function(i,a){var o=t[a],u=o.stackedData,c=u.reduce(function(s,f){var l=bM(f.slice(r,n+1));return[Math.min(s[0],l[0]),Math.max(s[1],l[1])]},[1/0,-1/0]);return[Math.min(c[0],i[0]),Math.max(c[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},Nm=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,qm=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Yl=function(t,r,n){if(X(t))return t(r,n);if(!Array.isArray(t))return r;var i=[];if(q(t[0]))i[0]=n?t[0]:Math.min(t[0],r[0]);else if(Nm.test(t[0])){var a=+Nm.exec(t[0])[1];i[0]=r[0]-a}else X(t[0])?i[0]=t[0](r[0]):i[0]=r[0];if(q(t[1]))i[1]=n?t[1]:Math.max(t[1],r[1]);else if(qm.test(t[1])){var o=+qm.exec(t[1])[1];i[1]=r[1]+o}else X(t[1])?i[1]=t[1](r[1]):i[1]=r[1];return i},ta=function(t,r,n){if(t&&t.scale&&t.scale.bandwidth){var i=t.scale.bandwidth();if(!n||i>0)return i}if(t&&r&&r.length>=2){for(var a=ih(r,function(l){return l.coordinate}),o=1/0,u=1,c=a.length;ue.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},EM=function(t,r,n,i,a){var o=t.width,u=t.height,c=t.startAngle,s=t.endAngle,f=Ie(t.cx,o,o/2),l=Ie(t.cy,u,u/2),h=tw(o,u,n),d=Ie(t.innerRadius,h,0),y=Ie(t.outerRadius,h,h*.8),v=Object.keys(r);return v.reduce(function(p,g){var x=r[g],w=x.domain,O=x.reversed,m;if(Y(x.range))i==="angleAxis"?m=[c,s]:i==="radiusAxis"&&(m=[d,y]),O&&(m=[m[1],m[0]]);else{m=x.range;var b=m,_=OM(b,2);c=_[0],s=_[1]}var A=Xx(x,a),T=A.realScaleType,M=A.scale;M.domain(w).range(m),Yx(M);var P=Zx(M,vt(vt({},x),{},{realScaleType:T})),E=vt(vt(vt({},x),P),{},{range:m,radius:y,realScaleType:T,scale:M,cx:f,cy:l,innerRadius:d,outerRadius:y,startAngle:c,endAngle:s});return vt(vt({},p),{},ew({},g,E))},{})},jM=function(t,r){var n=t.x,i=t.y,a=r.x,o=r.y;return Math.sqrt(Math.pow(n-a,2)+Math.pow(i-o,2))},MM=function(t,r){var n=t.x,i=t.y,a=r.cx,o=r.cy,u=jM({x:n,y:i},{x:a,y:o});if(u<=0)return{radius:u};var c=(n-a)/u,s=Math.acos(c);return i>o&&(s=2*Math.PI-s),{radius:u,angle:TM(s),angleInRadian:s}},$M=function(t){var r=t.startAngle,n=t.endAngle,i=Math.floor(r/360),a=Math.floor(n/360),o=Math.min(i,a);return{startAngle:r-o*360,endAngle:n-o*360}},CM=function(t,r){var n=r.startAngle,i=r.endAngle,a=Math.floor(n/360),o=Math.floor(i/360),u=Math.min(a,o);return t+u*360},Wm=function(t,r){var n=t.x,i=t.y,a=MM({x:n,y:i},r),o=a.radius,u=a.angle,c=r.innerRadius,s=r.outerRadius;if(os)return!1;if(o===0)return!0;var f=$M(r),l=f.startAngle,h=f.endAngle,d=u,y;if(l<=h){for(;d>h;)d-=360;for(;d=l&&d<=h}else{for(;d>l;)d-=360;for(;d=h&&d<=l}return y?vt(vt({},r),{},{radius:o,angle:CM(d,r)}):null},rw=function(t){return!N.isValidElement(t)&&!X(t)&&typeof t!="boolean"?t.className:""};function Fn(e){"@babel/helpers - typeof";return Fn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fn(e)}var IM=["offset"];function kM(e){return qM(e)||NM(e)||DM(e)||RM()}function RM(){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 DM(e,t){if(e){if(typeof e=="string")return Zl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Zl(e,t)}}function NM(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function qM(e){if(Array.isArray(e))return Zl(e)}function Zl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function BM(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function zm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Oe(e){for(var t=1;t=0?1:-1,w,O;i==="insideStart"?(w=d+x*o,O=v):i==="insideEnd"?(w=y-x*o,O=!v):i==="end"&&(w=y+x*o,O=v),O=g<=0?O:!O;var m=le(s,f,p,w),b=le(s,f,p,w+(O?1:-1)*359),_="M".concat(m.x,",").concat(m.y,` + height and width.`,$,k,o,c,f,l,r);var R=!Array.isArray(d)&&bt(d.type).endsWith("Chart");return S.Children.map(d,function(L){return S.isValidElement(L)?N.cloneElement(L,gi({width:$,height:k},R?{style:gi({height:"100%",width:"100%",maxHeight:k,maxWidth:$},L.props.style)}:{})):L})},[r,d,c,h,l,f,T,o]);return S.createElement("div",{id:p?"".concat(p):void 0,className:J("recharts-responsive-container",g),style:gi(gi({},O),{},{width:o,height:c,minWidth:f,minHeight:l,maxHeight:h}),ref:m},E)}),oh=function(t){return null};oh.displayName="Cell";function jn(e){"@babel/helpers - typeof";return jn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jn(e)}function _y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function kl(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||or.isSsr)return{width:0,height:0};var n=ZS(r),i=JSON.stringify({text:t,copyStyle:n});if(fr.widthCache[i])return fr.widthCache[i];try{var a=document.getElementById(Ay);a||(a=document.createElement("span"),a.setAttribute("id",Ay),a.setAttribute("aria-hidden","true"),document.body.appendChild(a));var o=kl(kl({},YS),n);Object.assign(a.style,o),a.textContent="".concat(t);var u=a.getBoundingClientRect(),c={width:u.width,height:u.height};return fr.widthCache[i]=c,++fr.cacheCount>XS&&(fr.cacheCount=0,fr.widthCache={}),c}catch{return{width:0,height:0}}},JS=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Mn(e){"@babel/helpers - typeof";return Mn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mn(e)}function Fi(e,t){return rP(e)||tP(e,t)||eP(e,t)||QS()}function QS(){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 eP(e,t){if(e){if(typeof e=="string")return Sy(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Sy(e,t)}}function Sy(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function yP(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function $y(e,t){return xP(e)||bP(e,t)||gP(e,t)||mP()}function mP(){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 gP(e,t){if(e){if(typeof e=="string")return Cy(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Cy(e,t)}}function Cy(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&arguments[0]!==void 0?arguments[0]:[];return $.reduce(function(k,R){var L=R.word,B=R.width,U=k[k.length-1];if(U&&(i==null||a||U.width+B+nR.width?k:R})};if(!f)return d;for(var v="…",p=function($){var k=l.slice(0,$),R=V0({breakAll:s,style:c,children:k+v}).wordsWithComputedWidth,L=h(R),B=L.length>o||y(L).width>Number(i);return[B,L]},g=0,x=l.length-1,w=0,O;g<=x&&w<=l.length-1;){var m=Math.floor((g+x)/2),b=m-1,_=p(b),A=$y(_,2),T=A[0],M=A[1],P=p(m),E=$y(P,1),j=E[0];if(!T&&!j&&(g=m+1),T&&j&&(x=m-1),!T&&j){O=M;break}w++}return O||d},Iy=function(t){var r=Y(t)?[]:t.toString().split(G0);return[{words:r}]},OP=function(t){var r=t.width,n=t.scaleToFit,i=t.children,a=t.style,o=t.breakAll,u=t.maxLines;if((r||n)&&!or.isSsr){var c,s,f=V0({breakAll:o,children:i,style:a});if(f){var l=f.wordsWithComputedWidth,h=f.spaceWidth;c=l,s=h}else return Iy(i);return wP({breakAll:o,children:i,maxLines:u,style:a},c,s,r,n)}return Iy(i)},ky="#808080",rr=function(t){var r=t.x,n=r===void 0?0:r,i=t.y,a=i===void 0?0:i,o=t.lineHeight,u=o===void 0?"1em":o,c=t.capHeight,s=c===void 0?"0.71em":c,f=t.scaleToFit,l=f===void 0?!1:f,h=t.textAnchor,d=h===void 0?"start":h,y=t.verticalAnchor,v=y===void 0?"end":y,p=t.fill,g=p===void 0?ky:p,x=My(t,dP),w=N.useMemo(function(){return OP({breakAll:x.breakAll,children:x.children,maxLines:x.maxLines,scaleToFit:l,style:x.style,width:x.width})},[x.breakAll,x.children,x.maxLines,l,x.style,x.width]),O=x.dx,m=x.dy,b=x.angle,_=x.className,A=x.breakAll,T=My(x,vP);if(!Ae(n)||!Ae(a))return null;var M=n+(q(O)?O:0),P=a+(q(m)?m:0),E;switch(v){case"start":E=ws("calc(".concat(s,")"));break;case"middle":E=ws("calc(".concat((w.length-1)/2," * -").concat(u," + (").concat(s," / 2))"));break;default:E=ws("calc(".concat(w.length-1," * -").concat(u,")"));break}var j=[];if(l){var C=w[0].width,$=x.width;j.push("scale(".concat((q($)?$/C:1)/C,")"))}return b&&j.push("rotate(".concat(b,", ").concat(M,", ").concat(P,")")),j.length&&(T.transform=j.join(" ")),S.createElement("text",Rl({},H(T,!0),{x:M,y:P,className:J("recharts-text",_),textAnchor:d,fill:g.includes("url")?ky:g}),w.map(function(k,R){var L=k.words.join(A?"":" ");return S.createElement("tspan",{x:M,dy:R===0?E:u,key:"".concat(L,"-").concat(R)},L)}))};function Ct(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function _P(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function uh(e){let t,r,n;e.length!==2?(t=Ct,r=(u,c)=>Ct(e(u),c),n=(u,c)=>e(u)-c):(t=e===Ct||e===_P?e:AP,r=e,n=e);function i(u,c,s=0,f=u.length){if(s>>1;r(u[l],c)<0?s=l+1:f=l}while(s>>1;r(u[l],c)<=0?s=l+1:f=l}while(ss&&n(u[l-1],c)>-n(u[l],c)?l-1:l}return{left:i,center:o,right:a}}function AP(){return 0}function X0(e){return e===null?NaN:+e}function*SP(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const PP=uh(Ct),ci=PP.right;uh(X0).center;class Ry extends Map{constructor(t,r=jP){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,i]of t)this.set(n,i)}get(t){return super.get(Dy(this,t))}has(t){return super.has(Dy(this,t))}set(t,r){return super.set(TP(this,t),r)}delete(t){return super.delete(EP(this,t))}}function Dy({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function TP({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function EP({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function jP(e){return e!==null&&typeof e=="object"?e.valueOf():e}function MP(e=Ct){if(e===Ct)return Y0;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function Y0(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const $P=Math.sqrt(50),CP=Math.sqrt(10),IP=Math.sqrt(2);function Wi(e,t,r){const n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),a=n/Math.pow(10,i),o=a>=$P?10:a>=CP?5:a>=IP?2:1;let u,c,s;return i<0?(s=Math.pow(10,-i)/o,u=Math.round(e*s),c=Math.round(t*s),u/st&&--c,s=-s):(s=Math.pow(10,i)*o,u=Math.round(e/s),c=Math.round(t/s),u*st&&--c),c0))return[];if(e===t)return[e];const n=t=i))return[];const u=a-i+1,c=new Array(u);if(n)if(o<0)for(let s=0;s=n)&&(r=n);return r}function qy(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function Z0(e,t,r=0,n=1/0,i){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(i=i===void 0?Y0:MP(i);n>r;){if(n-r>600){const c=n-r+1,s=t-r+1,f=Math.log(c),l=.5*Math.exp(2*f/3),h=.5*Math.sqrt(f*l*(c-l)/c)*(s-c/2<0?-1:1),d=Math.max(r,Math.floor(t-s*l/c+h)),y=Math.min(n,Math.floor(t+(c-s)*l/c+h));Z0(e,t,d,y,i)}const a=e[t];let o=r,u=n;for(on(e,r,t),i(e[n],a)>0&&on(e,r,n);o0;)--u}i(e[r],a)===0?on(e,r,u):(++u,on(e,u,n)),u<=t&&(r=u+1),t<=u&&(n=u-1)}return e}function on(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function kP(e,t,r){if(e=Float64Array.from(SP(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return qy(e);if(t>=1)return Ny(e);var n,i=(n-1)*t,a=Math.floor(i),o=Ny(Z0(e,a).subarray(0,a+1)),u=qy(e.subarray(a+1));return o+(u-o)*(i-a)}}function RP(e,t,r=X0){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,a=Math.floor(i),o=+r(e[a],a,e),u=+r(e[a+1],a+1,e);return o+(u-o)*(i-a)}}function DP(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,a=new Array(i);++n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?xi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?xi(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=qP.exec(e))?new Ne(t[1],t[2],t[3],1):(t=LP.exec(e))?new Ne(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=BP.exec(e))?xi(t[1],t[2],t[3],t[4]):(t=FP.exec(e))?xi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=WP.exec(e))?Hy(t[1],t[2]/100,t[3]/100,1):(t=zP.exec(e))?Hy(t[1],t[2]/100,t[3]/100,t[4]):Ly.hasOwnProperty(e)?Wy(Ly[e]):e==="transparent"?new Ne(NaN,NaN,NaN,0):null}function Wy(e){return new Ne(e>>16&255,e>>8&255,e&255,1)}function xi(e,t,r,n){return n<=0&&(e=t=r=NaN),new Ne(e,t,r,n)}function KP(e){return e instanceof si||(e=kn(e)),e?(e=e.rgb(),new Ne(e.r,e.g,e.b,e.opacity)):new Ne}function Bl(e,t,r,n){return arguments.length===1?KP(e):new Ne(e,t,r,n??1)}function Ne(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}sh(Ne,Bl,Q0(si,{brighter(e){return e=e==null?zi:Math.pow(zi,e),new Ne(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Cn:Math.pow(Cn,e),new Ne(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ne(Zt(this.r),Zt(this.g),Zt(this.b),Ui(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:zy,formatHex:zy,formatHex8:GP,formatRgb:Uy,toString:Uy}));function zy(){return`#${Vt(this.r)}${Vt(this.g)}${Vt(this.b)}`}function GP(){return`#${Vt(this.r)}${Vt(this.g)}${Vt(this.b)}${Vt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Uy(){const e=Ui(this.opacity);return`${e===1?"rgb(":"rgba("}${Zt(this.r)}, ${Zt(this.g)}, ${Zt(this.b)}${e===1?")":`, ${e})`}`}function Ui(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Zt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Vt(e){return e=Zt(e),(e<16?"0":"")+e.toString(16)}function Hy(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new nt(e,t,r,n)}function ex(e){if(e instanceof nt)return new nt(e.h,e.s,e.l,e.opacity);if(e instanceof si||(e=kn(e)),!e)return new nt;if(e instanceof nt)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,u=a-i,c=(a+i)/2;return u?(t===a?o=(r-n)/u+(r0&&c<1?0:o,new nt(o,u,c,e.opacity)}function VP(e,t,r,n){return arguments.length===1?ex(e):new nt(e,t,r,n??1)}function nt(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}sh(nt,VP,Q0(si,{brighter(e){return e=e==null?zi:Math.pow(zi,e),new nt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Cn:Math.pow(Cn,e),new nt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new Ne(Os(e>=240?e-240:e+120,i,n),Os(e,i,n),Os(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new nt(Ky(this.h),wi(this.s),wi(this.l),Ui(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 e=Ui(this.opacity);return`${e===1?"hsl(":"hsla("}${Ky(this.h)}, ${wi(this.s)*100}%, ${wi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ky(e){return e=(e||0)%360,e<0?e+360:e}function wi(e){return Math.max(0,Math.min(1,e||0))}function Os(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const lh=e=>()=>e;function XP(e,t){return function(r){return e+r*t}}function YP(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function ZP(e){return(e=+e)==1?tx:function(t,r){return r-t?YP(t,r,e):lh(isNaN(t)?r:t)}}function tx(e,t){var r=t-e;return r?XP(e,r):lh(isNaN(e)?t:e)}const Gy=(function e(t){var r=ZP(t);function n(i,a){var o=r((i=Bl(i)).r,(a=Bl(a)).r),u=r(i.g,a.g),c=r(i.b,a.b),s=tx(i.opacity,a.opacity);return function(f){return i.r=o(f),i.g=u(f),i.b=c(f),i.opacity=s(f),i+""}}return n.gamma=e,n})(1);function JP(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(a){for(i=0;ir&&(a=t.slice(r,a),u[o]?u[o]+=a:u[++o]=a),(n=n[0])===(i=i[0])?u[o]?u[o]+=i:u[++o]=i:(u[++o]=null,c.push({i:o,x:Hi(n,i)})),r=_s.lastIndex;return rt&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function sT(e,t,r){var n=e[0],i=e[1],a=t[0],o=t[1];return i2?lT:sT,c=s=null,l}function l(h){return h==null||isNaN(h=+h)?a:(c||(c=u(e.map(n),t,r)))(n(o(h)))}return l.invert=function(h){return o(i((s||(s=u(t,e.map(n),Hi)))(h)))},l.domain=function(h){return arguments.length?(e=Array.from(h,Ki),f()):e.slice()},l.range=function(h){return arguments.length?(t=Array.from(h),f()):t.slice()},l.rangeRound=function(h){return t=Array.from(h),r=fh,f()},l.clamp=function(h){return arguments.length?(o=h?!0:ke,f()):o!==ke},l.interpolate=function(h){return arguments.length?(r=h,f()):r},l.unknown=function(h){return arguments.length?(a=h,l):a},function(h,d){return n=h,i=d,f()}}function hh(){return Ba()(ke,ke)}function fT(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Gi(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function jr(e){return e=Gi(Math.abs(e)),e?e[1]:NaN}function hT(e,t){return function(r,n){for(var i=r.length,a=[],o=0,u=e[0],c=0;i>0&&u>0&&(c+u+1>n&&(u=Math.max(1,n-c)),a.push(r.substring(i-=u,i+u)),!((c+=u+1)>n));)u=e[o=(o+1)%e.length];return a.reverse().join(t)}}function pT(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var dT=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Rn(e){if(!(t=dT.exec(e)))throw new Error("invalid format: "+e);var t;return new ph({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Rn.prototype=ph.prototype;function ph(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}ph.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 vT(e){e:for(var t=e.length,r=1,n=-1,i;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var rx;function yT(e,t){var r=Gi(e,t);if(!r)return e+"";var n=r[0],i=r[1],a=i-(rx=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=n.length;return a===o?n:a>o?n+new Array(a-o+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+Gi(e,Math.max(0,t+a-1))[0]}function Xy(e,t){var r=Gi(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const Yy={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:fT,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Xy(e*100,t),r:Xy,s:yT,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Zy(e){return e}var Jy=Array.prototype.map,Qy=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function mT(e){var t=e.grouping===void 0||e.thousands===void 0?Zy:hT(Jy.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?Zy:pT(Jy.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",u=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function s(l){l=Rn(l);var h=l.fill,d=l.align,y=l.sign,v=l.symbol,p=l.zero,g=l.width,x=l.comma,w=l.precision,O=l.trim,m=l.type;m==="n"?(x=!0,m="g"):Yy[m]||(w===void 0&&(w=12),O=!0,m="g"),(p||h==="0"&&d==="=")&&(p=!0,h="0",d="=");var b=v==="$"?r:v==="#"&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",_=v==="$"?n:/[%p]/.test(m)?o:"",A=Yy[m],T=/[defgprs%]/.test(m);w=w===void 0?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function M(P){var E=b,j=_,C,$,k;if(m==="c")j=A(P)+j,P="";else{P=+P;var R=P<0||1/P<0;if(P=isNaN(P)?c:A(Math.abs(P),w),O&&(P=vT(P)),R&&+P==0&&y!=="+"&&(R=!1),E=(R?y==="("?y:u:y==="-"||y==="("?"":y)+E,j=(m==="s"?Qy[8+rx/3]:"")+j+(R&&y==="("?")":""),T){for(C=-1,$=P.length;++C<$;)if(k=P.charCodeAt(C),48>k||k>57){j=(k===46?i+P.slice(C+1):P.slice(C))+j,P=P.slice(0,C);break}}}x&&!p&&(P=t(P,1/0));var L=E.length+P.length+j.length,B=L>1)+E+P+j+B.slice(L);break;default:P=B+E+P+j;break}return a(P)}return M.toString=function(){return l+""},M}function f(l,h){var d=s((l=Rn(l),l.type="f",l)),y=Math.max(-8,Math.min(8,Math.floor(jr(h)/3)))*3,v=Math.pow(10,-y),p=Qy[8+y/3];return function(g){return d(v*g)+p}}return{format:s,formatPrefix:f}}var Oi,dh,nx;gT({thousands:",",grouping:[3],currency:["$",""]});function gT(e){return Oi=mT(e),dh=Oi.format,nx=Oi.formatPrefix,Oi}function bT(e){return Math.max(0,-jr(Math.abs(e)))}function xT(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(jr(t)/3)))*3-jr(Math.abs(e)))}function wT(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,jr(t)-jr(e))+1}function ix(e,t,r,n){var i=ql(e,t,r),a;switch(n=Rn(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(a=xT(i,o))&&(n.precision=a),nx(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=wT(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=bT(i))&&(n.precision=a-(n.type==="%")*2);break}}return dh(n)}function kt(e){var t=e.domain;return e.ticks=function(r){var n=t();return Dl(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return ix(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,a=n.length-1,o=n[i],u=n[a],c,s,f=10;for(u0;){if(s=Nl(o,u,r),s===c)return n[i]=o,n[a]=u,t(n);if(s>0)o=Math.floor(o/s)*s,u=Math.ceil(u/s)*s;else if(s<0)o=Math.ceil(o*s)/s,u=Math.floor(u*s)/s;else break;c=s}return e},e}function Vi(){var e=hh();return e.copy=function(){return li(e,Vi())},Qe.apply(e,arguments),kt(e)}function ax(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,Ki),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return ax(e).unknown(t)},e=arguments.length?Array.from(e,Ki):[0,1],kt(r)}function ox(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],a=e[n],o;return aMath.pow(e,t)}function PT(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function rm(e){return(t,r)=>-e(-t,r)}function vh(e){const t=e(em,tm),r=t.domain;let n=10,i,a;function o(){return i=PT(n),a=ST(n),r()[0]<0?(i=rm(i),a=rm(a),e(OT,_T)):e(em,tm),t}return t.base=function(u){return arguments.length?(n=+u,o()):n},t.domain=function(u){return arguments.length?(r(u),o()):r()},t.ticks=u=>{const c=r();let s=c[0],f=c[c.length-1];const l=f0){for(;h<=d;++h)for(y=1;yf)break;g.push(v)}}else for(;h<=d;++h)for(y=n-1;y>=1;--y)if(v=h>0?y/a(-h):y*a(h),!(vf)break;g.push(v)}g.length*2{if(u==null&&(u=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=Rn(c)).precision==null&&(c.trim=!0),c=dh(c)),u===1/0)return c;const s=Math.max(1,n*u/t.ticks().length);return f=>{let l=f/a(Math.round(i(f)));return l*nr(ox(r(),{floor:u=>a(Math.floor(i(u))),ceil:u=>a(Math.ceil(i(u)))})),t}function ux(){const e=vh(Ba()).domain([1,10]);return e.copy=()=>li(e,ux()).base(e.base()),Qe.apply(e,arguments),e}function nm(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function im(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function yh(e){var t=1,r=e(nm(t),im(t));return r.constant=function(n){return arguments.length?e(nm(t=+n),im(t)):t},kt(r)}function cx(){var e=yh(Ba());return e.copy=function(){return li(e,cx()).constant(e.constant())},Qe.apply(e,arguments)}function am(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function TT(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function ET(e){return e<0?-e*e:e*e}function mh(e){var t=e(ke,ke),r=1;function n(){return r===1?e(ke,ke):r===.5?e(TT,ET):e(am(r),am(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},kt(t)}function gh(){var e=mh(Ba());return e.copy=function(){return li(e,gh()).exponent(e.exponent())},Qe.apply(e,arguments),e}function jT(){return gh.apply(null,arguments).exponent(.5)}function om(e){return Math.sign(e)*e*e}function MT(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function sx(){var e=hh(),t=[0,1],r=!1,n;function i(a){var o=MT(e(a));return isNaN(o)?n:r?Math.round(o):o}return i.invert=function(a){return e.invert(om(a))},i.domain=function(a){return arguments.length?(e.domain(a),i):e.domain()},i.range=function(a){return arguments.length?(e.range((t=Array.from(a,Ki)).map(om)),i):t.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(r=!!a,i):r},i.clamp=function(a){return arguments.length?(e.clamp(a),i):e.clamp()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return sx(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},Qe.apply(i,arguments),kt(i)}function lx(){var e=[],t=[],r=[],n;function i(){var o=0,u=Math.max(1,t.length);for(r=new Array(u-1);++o0?r[u-1]:e[0],u=r?[n[r-1],t]:[n[s-1],n[s]]},o.unknown=function(c){return arguments.length&&(a=c),o},o.thresholds=function(){return n.slice()},o.copy=function(){return fx().domain([e,t]).range(i).unknown(a)},Qe.apply(kt(o),arguments)}function hx(){var e=[.5],t=[0,1],r,n=1;function i(a){return a!=null&&a<=a?t[ci(e,a,0,n)]:r}return i.domain=function(a){return arguments.length?(e=Array.from(a),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(a){return arguments.length?(t=Array.from(a),n=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(a){var o=t.indexOf(a);return[e[o-1],e[o]]},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return hx().domain(e).range(t).unknown(r)},Qe.apply(i,arguments)}const As=new Date,Ss=new Date;function Se(e,t,r,n){function i(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),i.round=a=>{const o=i(a),u=i.ceil(a);return a-o(t(a=new Date(+a),o==null?1:Math.floor(o)),a),i.range=(a,o,u)=>{const c=[];if(a=i.ceil(a),u=u==null?1:Math.floor(u),!(a0))return c;let s;do c.push(s=new Date(+a)),t(a,u),e(a);while(sSe(o=>{if(o>=o)for(;e(o),!a(o);)o.setTime(o-1)},(o,u)=>{if(o>=o)if(u<0)for(;++u<=0;)for(;t(o,-1),!a(o););else for(;--u>=0;)for(;t(o,1),!a(o););}),r&&(i.count=(a,o)=>(As.setTime(+a),Ss.setTime(+o),e(As),e(Ss),Math.floor(r(As,Ss))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(n?o=>n(o)%a===0:o=>i.count(0,o)%a===0):i)),i}const Xi=Se(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Xi.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Se(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):Xi);Xi.range;const yt=1e3,Ze=yt*60,mt=Ze*60,Ot=mt*24,bh=Ot*7,um=Ot*30,Ps=Ot*365,Xt=Se(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*yt)},(e,t)=>(t-e)/yt,e=>e.getUTCSeconds());Xt.range;const xh=Se(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*yt)},(e,t)=>{e.setTime(+e+t*Ze)},(e,t)=>(t-e)/Ze,e=>e.getMinutes());xh.range;const wh=Se(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Ze)},(e,t)=>(t-e)/Ze,e=>e.getUTCMinutes());wh.range;const Oh=Se(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*yt-e.getMinutes()*Ze)},(e,t)=>{e.setTime(+e+t*mt)},(e,t)=>(t-e)/mt,e=>e.getHours());Oh.range;const _h=Se(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*mt)},(e,t)=>(t-e)/mt,e=>e.getUTCHours());_h.range;const fi=Se(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Ze)/Ot,e=>e.getDate()-1);fi.range;const Fa=Se(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ot,e=>e.getUTCDate()-1);Fa.range;const px=Se(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ot,e=>Math.floor(e/Ot));px.range;function ur(e){return Se(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*Ze)/bh)}const Wa=ur(0),Yi=ur(1),$T=ur(2),CT=ur(3),Mr=ur(4),IT=ur(5),kT=ur(6);Wa.range;Yi.range;$T.range;CT.range;Mr.range;IT.range;kT.range;function cr(e){return Se(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/bh)}const za=cr(0),Zi=cr(1),RT=cr(2),DT=cr(3),$r=cr(4),NT=cr(5),qT=cr(6);za.range;Zi.range;RT.range;DT.range;$r.range;NT.range;qT.range;const Ah=Se(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Ah.range;const Sh=Se(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Sh.range;const _t=Se(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());_t.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Se(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});_t.range;const At=Se(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());At.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Se(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});At.range;function dx(e,t,r,n,i,a){const o=[[Xt,1,yt],[Xt,5,5*yt],[Xt,15,15*yt],[Xt,30,30*yt],[a,1,Ze],[a,5,5*Ze],[a,15,15*Ze],[a,30,30*Ze],[i,1,mt],[i,3,3*mt],[i,6,6*mt],[i,12,12*mt],[n,1,Ot],[n,2,2*Ot],[r,1,bh],[t,1,um],[t,3,3*um],[e,1,Ps]];function u(s,f,l){const h=fp).right(o,h);if(d===o.length)return e.every(ql(s/Ps,f/Ps,l));if(d===0)return Xi.every(Math.max(ql(s,f,l),1));const[y,v]=o[h/o[d-1][2]53)return null;"w"in D||(D.w=1),"Z"in D?(ee=Es(un(D.y,0,1)),be=ee.getUTCDay(),ee=be>4||be===0?Zi.ceil(ee):Zi(ee),ee=Fa.offset(ee,(D.V-1)*7),D.y=ee.getUTCFullYear(),D.m=ee.getUTCMonth(),D.d=ee.getUTCDate()+(D.w+6)%7):(ee=Ts(un(D.y,0,1)),be=ee.getDay(),ee=be>4||be===0?Yi.ceil(ee):Yi(ee),ee=fi.offset(ee,(D.V-1)*7),D.y=ee.getFullYear(),D.m=ee.getMonth(),D.d=ee.getDate()+(D.w+6)%7)}else("W"in D||"U"in D)&&("w"in D||(D.w="u"in D?D.u%7:"W"in D?1:0),be="Z"in D?Es(un(D.y,0,1)).getUTCDay():Ts(un(D.y,0,1)).getDay(),D.m=0,D.d="W"in D?(D.w+6)%7+D.W*7-(be+5)%7:D.w+D.U*7-(be+6)%7);return"Z"in D?(D.H+=D.Z/100|0,D.M+=D.Z%100,Es(D)):Ts(D)}}function A(F,Z,Q,D){for(var de=0,ee=Z.length,be=Q.length,xe,De;de=be)return-1;if(xe=Z.charCodeAt(de++),xe===37){if(xe=Z.charAt(de++),De=m[xe in cm?Z.charAt(de++):xe],!De||(D=De(F,Q,D))<0)return-1}else if(xe!=Q.charCodeAt(D++))return-1}return D}function T(F,Z,Q){var D=s.exec(Z.slice(Q));return D?(F.p=f.get(D[0].toLowerCase()),Q+D[0].length):-1}function M(F,Z,Q){var D=d.exec(Z.slice(Q));return D?(F.w=y.get(D[0].toLowerCase()),Q+D[0].length):-1}function P(F,Z,Q){var D=l.exec(Z.slice(Q));return D?(F.w=h.get(D[0].toLowerCase()),Q+D[0].length):-1}function E(F,Z,Q){var D=g.exec(Z.slice(Q));return D?(F.m=x.get(D[0].toLowerCase()),Q+D[0].length):-1}function j(F,Z,Q){var D=v.exec(Z.slice(Q));return D?(F.m=p.get(D[0].toLowerCase()),Q+D[0].length):-1}function C(F,Z,Q){return A(F,t,Z,Q)}function $(F,Z,Q){return A(F,r,Z,Q)}function k(F,Z,Q){return A(F,n,Z,Q)}function R(F){return o[F.getDay()]}function L(F){return a[F.getDay()]}function B(F){return c[F.getMonth()]}function U(F){return u[F.getMonth()]}function G(F){return i[+(F.getHours()>=12)]}function W(F){return 1+~~(F.getMonth()/3)}function V(F){return o[F.getUTCDay()]}function fe(F){return a[F.getUTCDay()]}function ye(F){return c[F.getUTCMonth()]}function Le(F){return u[F.getUTCMonth()]}function qt(F){return i[+(F.getUTCHours()>=12)]}function Re(F){return 1+~~(F.getUTCMonth()/3)}return{format:function(F){var Z=b(F+="",w);return Z.toString=function(){return F},Z},parse:function(F){var Z=_(F+="",!1);return Z.toString=function(){return F},Z},utcFormat:function(F){var Z=b(F+="",O);return Z.toString=function(){return F},Z},utcParse:function(F){var Z=_(F+="",!0);return Z.toString=function(){return F},Z}}}var cm={"-":"",_:" ",0:"0"},Ee=/^\s*\d+/,UT=/^%/,HT=/[\\^$*+?|[\]().{}]/g;function re(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",a=i.length;return n+(a[t.toLowerCase(),r]))}function GT(e,t,r){var n=Ee.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function VT(e,t,r){var n=Ee.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function XT(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function YT(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function ZT(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function sm(e,t,r){var n=Ee.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function lm(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function JT(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function QT(e,t,r){var n=Ee.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function eE(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function fm(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function tE(e,t,r){var n=Ee.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function hm(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function rE(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function nE(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function iE(e,t,r){var n=Ee.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function aE(e,t,r){var n=Ee.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function oE(e,t,r){var n=UT.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function uE(e,t,r){var n=Ee.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function cE(e,t,r){var n=Ee.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function pm(e,t){return re(e.getDate(),t,2)}function sE(e,t){return re(e.getHours(),t,2)}function lE(e,t){return re(e.getHours()%12||12,t,2)}function fE(e,t){return re(1+fi.count(_t(e),e),t,3)}function vx(e,t){return re(e.getMilliseconds(),t,3)}function hE(e,t){return vx(e,t)+"000"}function pE(e,t){return re(e.getMonth()+1,t,2)}function dE(e,t){return re(e.getMinutes(),t,2)}function vE(e,t){return re(e.getSeconds(),t,2)}function yE(e){var t=e.getDay();return t===0?7:t}function mE(e,t){return re(Wa.count(_t(e)-1,e),t,2)}function yx(e){var t=e.getDay();return t>=4||t===0?Mr(e):Mr.ceil(e)}function gE(e,t){return e=yx(e),re(Mr.count(_t(e),e)+(_t(e).getDay()===4),t,2)}function bE(e){return e.getDay()}function xE(e,t){return re(Yi.count(_t(e)-1,e),t,2)}function wE(e,t){return re(e.getFullYear()%100,t,2)}function OE(e,t){return e=yx(e),re(e.getFullYear()%100,t,2)}function _E(e,t){return re(e.getFullYear()%1e4,t,4)}function AE(e,t){var r=e.getDay();return e=r>=4||r===0?Mr(e):Mr.ceil(e),re(e.getFullYear()%1e4,t,4)}function SE(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+re(t/60|0,"0",2)+re(t%60,"0",2)}function dm(e,t){return re(e.getUTCDate(),t,2)}function PE(e,t){return re(e.getUTCHours(),t,2)}function TE(e,t){return re(e.getUTCHours()%12||12,t,2)}function EE(e,t){return re(1+Fa.count(At(e),e),t,3)}function mx(e,t){return re(e.getUTCMilliseconds(),t,3)}function jE(e,t){return mx(e,t)+"000"}function ME(e,t){return re(e.getUTCMonth()+1,t,2)}function $E(e,t){return re(e.getUTCMinutes(),t,2)}function CE(e,t){return re(e.getUTCSeconds(),t,2)}function IE(e){var t=e.getUTCDay();return t===0?7:t}function kE(e,t){return re(za.count(At(e)-1,e),t,2)}function gx(e){var t=e.getUTCDay();return t>=4||t===0?$r(e):$r.ceil(e)}function RE(e,t){return e=gx(e),re($r.count(At(e),e)+(At(e).getUTCDay()===4),t,2)}function DE(e){return e.getUTCDay()}function NE(e,t){return re(Zi.count(At(e)-1,e),t,2)}function qE(e,t){return re(e.getUTCFullYear()%100,t,2)}function LE(e,t){return e=gx(e),re(e.getUTCFullYear()%100,t,2)}function BE(e,t){return re(e.getUTCFullYear()%1e4,t,4)}function FE(e,t){var r=e.getUTCDay();return e=r>=4||r===0?$r(e):$r.ceil(e),re(e.getUTCFullYear()%1e4,t,4)}function WE(){return"+0000"}function vm(){return"%"}function ym(e){return+e}function mm(e){return Math.floor(+e/1e3)}var hr,bx,xx;zE({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 zE(e){return hr=zT(e),bx=hr.format,hr.parse,xx=hr.utcFormat,hr.utcParse,hr}function UE(e){return new Date(e)}function HE(e){return e instanceof Date?+e:+new Date(+e)}function Ph(e,t,r,n,i,a,o,u,c,s){var f=hh(),l=f.invert,h=f.domain,d=s(".%L"),y=s(":%S"),v=s("%I:%M"),p=s("%I %p"),g=s("%a %d"),x=s("%b %d"),w=s("%B"),O=s("%Y");function m(b){return(c(b)t(i/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(i,a)=>kP(e,a/n))},r.copy=function(){return Ax(t).domain(e)},Tt.apply(r,arguments)}function Ha(){var e=0,t=.5,r=1,n=1,i,a,o,u,c,s=ke,f,l=!1,h;function d(v){return isNaN(v=+v)?h:(v=.5+((v=+f(v))-a)*(n*vr}return Ms=e,Ms}var $s,wm;function YE(){if(wm)return $s;wm=1;var e=Ka(),t=Ex(),r=Jr();function n(i){return i&&i.length?e(i,r,t):void 0}return $s=n,$s}var ZE=YE();const Ga=oe(ZE);var Cs,Om;function jx(){if(Om)return Cs;Om=1;function e(t,r){return te.e^a.s<0?1:-1;for(n=a.d.length,i=e.d.length,t=0,r=ne.d[t]^a.s<0?1:-1;return n===i?0:n>i^a.s<0?1:-1};z.decimalPlaces=z.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*he;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};z.dividedBy=z.div=function(e){return xt(this,new this.constructor(e))};z.dividedToIntegerBy=z.idiv=function(e){var t=this,r=t.constructor;return ue(xt(t,new r(e),0,1),r.precision)};z.equals=z.eq=function(e){return!this.cmp(e)};z.exponent=function(){return ge(this)};z.greaterThan=z.gt=function(e){return this.cmp(e)>0};z.greaterThanOrEqualTo=z.gte=function(e){return this.cmp(e)>=0};z.isInteger=z.isint=function(){return this.e>this.d.length-2};z.isNegative=z.isneg=function(){return this.s<0};z.isPositive=z.ispos=function(){return this.s>0};z.isZero=function(){return this.s===0};z.lessThan=z.lt=function(e){return this.cmp(e)<0};z.lessThanOrEqualTo=z.lte=function(e){return this.cmp(e)<1};z.logarithm=z.log=function(e){var t,r=this,n=r.constructor,i=n.precision,a=i+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(Ue))throw Error(Je+"NaN");if(r.s<1)throw Error(Je+(r.s?"NaN":"-Infinity"));return r.eq(Ue)?new n(0):(pe=!1,t=xt(Dn(r,a),Dn(e,a),a),pe=!0,ue(t,i))};z.minus=z.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?Ix(t,e):$x(t,(e.s=-e.s,e))};z.modulo=z.mod=function(e){var t,r=this,n=r.constructor,i=n.precision;if(e=new n(e),!e.s)throw Error(Je+"NaN");return r.s?(pe=!1,t=xt(r,e,0,1).times(e),pe=!0,r.minus(t)):ue(new n(r),i)};z.naturalExponential=z.exp=function(){return Cx(this)};z.naturalLogarithm=z.ln=function(){return Dn(this)};z.negated=z.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};z.plus=z.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?$x(t,e):Ix(t,(e.s=-e.s,e))};z.precision=z.sd=function(e){var t,r,n,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Jt+e);if(t=ge(i)+1,n=i.d.length-1,r=n*he+1,n=i.d[n],n){for(;n%10==0;n/=10)r--;for(n=i.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};z.squareRoot=z.sqrt=function(){var e,t,r,n,i,a,o,u=this,c=u.constructor;if(u.s<1){if(!u.s)return new c(0);throw Error(Je+"NaN")}for(e=ge(u),pe=!1,i=Math.sqrt(+u),i==0||i==1/0?(t=ot(u.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=tn((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new c(t)):n=new c(i.toString()),r=c.precision,i=o=r+3;;)if(a=n,n=a.plus(xt(u,a,o+2)).times(.5),ot(a.d).slice(0,o)===(t=ot(n.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(ue(a,r+1,0),a.times(a).eq(u)){n=a;break}}else if(t!="9999")break;o+=4}return pe=!0,ue(n,r)};z.times=z.mul=function(e){var t,r,n,i,a,o,u,c,s,f=this,l=f.constructor,h=f.d,d=(e=new l(e)).d;if(!f.s||!e.s)return new l(0);for(e.s*=f.s,r=f.e+e.e,c=h.length,s=d.length,c=0;){for(t=0,i=c+n;i>n;)u=a[i]+d[n]*h[i-n-1]+t,a[i--]=u%Pe|0,t=u/Pe|0;a[i]=(a[i]+t)%Pe|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=r,pe?ue(e,l.precision):e};z.toDecimalPlaces=z.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(st(e,0,en),t===void 0?t=n.rounding:st(t,0,8),ue(r,e+ge(r)+1,t))};z.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=nr(n,!0):(st(e,0,en),t===void 0?t=i.rounding:st(t,0,8),n=ue(new i(n),e+1,t),r=nr(n,!0,e+1)),r};z.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return e===void 0?nr(i):(st(e,0,en),t===void 0?t=a.rounding:st(t,0,8),n=ue(new a(i),e+ge(i)+1,t),r=nr(n.abs(),!1,e+ge(n)+1),i.isneg()&&!i.isZero()?"-"+r:r)};z.toInteger=z.toint=function(){var e=this,t=e.constructor;return ue(new t(e),ge(e)+1,t.rounding)};z.toNumber=function(){return+this};z.toPower=z.pow=function(e){var t,r,n,i,a,o,u=this,c=u.constructor,s=12,f=+(e=new c(e));if(!e.s)return new c(Ue);if(u=new c(u),!u.s){if(e.s<1)throw Error(Je+"Infinity");return u}if(u.eq(Ue))return u;if(n=c.precision,e.eq(Ue))return ue(u,n);if(t=e.e,r=e.d.length-1,o=t>=r,a=u.s,o){if((r=f<0?-f:f)<=Mx){for(i=new c(Ue),t=Math.ceil(n/he+4),pe=!1;r%2&&(i=i.times(u),Em(i.d,t)),r=tn(r/2),r!==0;)u=u.times(u),Em(u.d,t);return pe=!0,e.s<0?new c(Ue).div(i):ue(i,n)}}else if(a<0)throw Error(Je+"NaN");return a=a<0&&e.d[Math.max(t,r)]&1?-1:1,u.s=1,pe=!1,i=e.times(Dn(u,n+s)),pe=!0,i=Cx(i),i.s=a,i};z.toPrecision=function(e,t){var r,n,i=this,a=i.constructor;return e===void 0?(r=ge(i),n=nr(i,r<=a.toExpNeg||r>=a.toExpPos)):(st(e,1,en),t===void 0?t=a.rounding:st(t,0,8),i=ue(new a(i),e,t),r=ge(i),n=nr(i,e<=r||r<=a.toExpNeg,e)),n};z.toSignificantDigits=z.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(st(e,1,en),t===void 0?t=n.rounding:st(t,0,8)),ue(new n(r),e,t)};z.toString=z.valueOf=z.val=z.toJSON=z[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=ge(e),r=e.constructor;return nr(e,t<=r.toExpNeg||t>=r.toExpPos)};function $x(e,t){var r,n,i,a,o,u,c,s,f=e.constructor,l=f.precision;if(!e.s||!t.s)return t.s||(t=new f(e)),pe?ue(t,l):t;if(c=e.d,s=t.d,o=e.e,i=t.e,c=c.slice(),a=o-i,a){for(a<0?(n=c,a=-a,u=s.length):(n=s,i=o,u=c.length),o=Math.ceil(l/he),u=o>u?o+1:u+1,a>u&&(a=u,n.length=1),n.reverse();a--;)n.push(0);n.reverse()}for(u=c.length,a=s.length,u-a<0&&(a=u,n=s,s=c,c=n),r=0;a;)r=(c[--a]=c[a]+s[a]+r)/Pe|0,c[a]%=Pe;for(r&&(c.unshift(r),++i),u=c.length;c[--u]==0;)c.pop();return t.d=c,t.e=i,pe?ue(t,l):t}function st(e,t,r){if(e!==~~e||er)throw Error(Jt+e)}function ot(e){var t,r,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;to?1:-1;else for(u=c=0;ui[u]?1:-1;break}return c}function r(n,i,a){for(var o=0;a--;)n[a]-=o,o=n[a]1;)n.shift()}return function(n,i,a,o){var u,c,s,f,l,h,d,y,v,p,g,x,w,O,m,b,_,A,T=n.constructor,M=n.s==i.s?1:-1,P=n.d,E=i.d;if(!n.s)return new T(n);if(!i.s)throw Error(Je+"Division by zero");for(c=n.e-i.e,_=E.length,m=P.length,d=new T(M),y=d.d=[],s=0;E[s]==(P[s]||0);)++s;if(E[s]>(P[s]||0)&&--c,a==null?x=a=T.precision:o?x=a+(ge(n)-ge(i))+1:x=a,x<0)return new T(0);if(x=x/he+2|0,s=0,_==1)for(f=0,E=E[0],x++;(s1&&(E=e(E,f),P=e(P,f),_=E.length,m=P.length),O=_,v=P.slice(0,_),p=v.length;p<_;)v[p++]=0;A=E.slice(),A.unshift(0),b=E[0],E[1]>=Pe/2&&++b;do f=0,u=t(E,v,_,p),u<0?(g=v[0],_!=p&&(g=g*Pe+(v[1]||0)),f=g/b|0,f>1?(f>=Pe&&(f=Pe-1),l=e(E,f),h=l.length,p=v.length,u=t(l,v,h,p),u==1&&(f--,r(l,_16)throw Error(jh+ge(e));if(!e.s)return new f(Ue);for(pe=!1,u=l,o=new f(.03125);e.abs().gte(.1);)e=e.times(o),s+=5;for(n=Math.log(Ht(2,s))/Math.LN10*2+5|0,u+=n,r=i=a=new f(Ue),f.precision=u;;){if(i=ue(i.times(e),u),r=r.times(++c),o=a.plus(xt(i,r,u)),ot(o.d).slice(0,u)===ot(a.d).slice(0,u)){for(;s--;)a=ue(a.times(a),u);return f.precision=l,t==null?(pe=!0,ue(a,l)):a}a=o}}function ge(e){for(var t=e.e*he,r=e.d[0];r>=10;r/=10)t++;return t}function Ns(e,t,r){if(t>e.LN10.sd())throw pe=!0,r&&(e.precision=r),Error(Je+"LN10 precision limit exceeded");return ue(new e(e.LN10),t)}function jt(e){for(var t="";e--;)t+="0";return t}function Dn(e,t){var r,n,i,a,o,u,c,s,f,l=1,h=10,d=e,y=d.d,v=d.constructor,p=v.precision;if(d.s<1)throw Error(Je+(d.s?"NaN":"-Infinity"));if(d.eq(Ue))return new v(0);if(t==null?(pe=!1,s=p):s=t,d.eq(10))return t==null&&(pe=!0),Ns(v,s);if(s+=h,v.precision=s,r=ot(y),n=r.charAt(0),a=ge(d),Math.abs(a)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)d=d.times(e),r=ot(d.d),n=r.charAt(0),l++;a=ge(d),n>1?(d=new v("0."+r),a++):d=new v(n+"."+r.slice(1))}else return c=Ns(v,s+2,p).times(a+""),d=Dn(new v(n+"."+r.slice(1)),s-h).plus(c),v.precision=p,t==null?(pe=!0,ue(d,p)):d;for(u=o=d=xt(d.minus(Ue),d.plus(Ue),s),f=ue(d.times(d),s),i=3;;){if(o=ue(o.times(f),s),c=u.plus(xt(o,new v(i),s)),ot(c.d).slice(0,s)===ot(u.d).slice(0,s))return u=u.times(2),a!==0&&(u=u.plus(Ns(v,s+2,p).times(a+""))),u=xt(u,new v(l),s),v.precision=p,t==null?(pe=!0,ue(u,p)):u;u=c,i+=2}}function Tm(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(n,i),t){if(i-=n,r=r-n-1,e.e=tn(r/he),e.d=[],n=(r+1)%he,r<0&&(n+=he),nJi||e.e<-Ji))throw Error(jh+r)}else e.s=0,e.e=0,e.d=[0];return e}function ue(e,t,r){var n,i,a,o,u,c,s,f,l=e.d;for(o=1,a=l[0];a>=10;a/=10)o++;if(n=t-o,n<0)n+=he,i=t,s=l[f=0];else{if(f=Math.ceil((n+1)/he),a=l.length,f>=a)return e;for(s=a=l[f],o=1;a>=10;a/=10)o++;n%=he,i=n-he+o}if(r!==void 0&&(a=Ht(10,o-i-1),u=s/a%10|0,c=t<0||l[f+1]!==void 0||s%a,c=r<4?(u||c)&&(r==0||r==(e.s<0?3:2)):u>5||u==5&&(r==4||c||r==6&&(n>0?i>0?s/Ht(10,o-i):0:l[f-1])%10&1||r==(e.s<0?8:7))),t<1||!l[0])return c?(a=ge(e),l.length=1,t=t-a-1,l[0]=Ht(10,(he-t%he)%he),e.e=tn(-t/he)||0):(l.length=1,l[0]=e.e=e.s=0),e;if(n==0?(l.length=f,a=1,f--):(l.length=f+1,a=Ht(10,he-n),l[f]=i>0?(s/Ht(10,o-i)%Ht(10,i)|0)*a:0),c)for(;;)if(f==0){(l[0]+=a)==Pe&&(l[0]=1,++e.e);break}else{if(l[f]+=a,l[f]!=Pe)break;l[f--]=0,a=1}for(n=l.length;l[--n]===0;)l.pop();if(pe&&(e.e>Ji||e.e<-Ji))throw Error(jh+ge(e));return e}function Ix(e,t){var r,n,i,a,o,u,c,s,f,l,h=e.constructor,d=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),pe?ue(t,d):t;if(c=e.d,l=t.d,n=t.e,s=e.e,c=c.slice(),o=s-n,o){for(f=o<0,f?(r=c,o=-o,u=l.length):(r=l,n=s,u=c.length),i=Math.max(Math.ceil(d/he),u)+2,o>i&&(o=i,r.length=1),r.reverse(),i=o;i--;)r.push(0);r.reverse()}else{for(i=c.length,u=l.length,f=i0;--i)c[u++]=0;for(i=l.length;i>o;){if(c[--i]0?a=a.charAt(0)+"."+a.slice(1)+jt(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+jt(-i-1)+a,r&&(n=r-o)>0&&(a+=jt(n))):i>=o?(a+=jt(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+jt(n))):((n=i+1)0&&(i+1===o&&(a+="."),a+=jt(n))),e.s<0?"-"+a:a}function Em(e,t){if(e.length>t)return e.length=t,!0}function kx(e){var t,r,n;function i(a){var o=this;if(!(o instanceof i))return new i(a);if(o.constructor=i,a instanceof i){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(Jt+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return Tm(o,a.toString())}else if(typeof a!="string")throw Error(Jt+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,uj.test(a))Tm(o,a);else throw Error(Jt+a)}if(i.prototype=z,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=kx,i.config=i.set=cj,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&n<=i[t+2])this[r]=n;else throw Error(Jt+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(Jt+r+": "+n);return this}var Mh=kx(oj);Ue=new Mh(1);const ae=Mh;function sj(e){return pj(e)||hj(e)||fj(e)||lj()}function lj(){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 fj(e,t){if(e){if(typeof e=="string")return zl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zl(e,t)}}function hj(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function pj(e){if(Array.isArray(e))return zl(e)}function zl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=t?r.apply(void 0,i):e(t-o,jm(function(){for(var u=arguments.length,c=new Array(u),s=0;se.length)&&(t=e.length);for(var r=0,n=new Array(t);r"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),u;!(n=(u=o.next()).done)&&(r.push(u.value),!(t&&r.length===t));n=!0);}catch(c){i=!0,a=c}finally{try{!n&&o.return!=null&&o.return()}finally{if(i)throw a}}return r}}function Ej(e){if(Array.isArray(e))return e}function Lx(e){var t=Nn(e,2),r=t[0],n=t[1],i=r,a=n;return r>n&&(i=n,a=r),[i,a]}function Bx(e,t,r){if(e.lte(0))return new ae(0);var n=Ya.getDigitCount(e.toNumber()),i=new ae(10).pow(n),a=e.div(i),o=n!==1?.05:.1,u=new ae(Math.ceil(a.div(o).toNumber())).add(r).mul(o),c=u.mul(i);return t?c:new ae(Math.ceil(c))}function jj(e,t,r){var n=1,i=new ae(e);if(!i.isint()&&r){var a=Math.abs(e);a<1?(n=new ae(10).pow(Ya.getDigitCount(e)-1),i=new ae(Math.floor(i.div(n).toNumber())).mul(n)):a>1&&(i=new ae(Math.floor(e)))}else e===0?i=new ae(Math.floor((t-1)/2)):r||(i=new ae(Math.floor(e)));var o=Math.floor((t-1)/2),u=mj(yj(function(c){return i.add(new ae(c-o).mul(n)).toNumber()}),Ul);return u(0,t)}function Fx(e,t,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(r-1)))return{step:new ae(0),tickMin:new ae(0),tickMax:new ae(0)};var a=Bx(new ae(t).sub(e).div(r-1),n,i),o;e<=0&&t>=0?o=new ae(0):(o=new ae(e).add(t).div(2),o=o.sub(new ae(o).mod(a)));var u=Math.ceil(o.sub(e).div(a).toNumber()),c=Math.ceil(new ae(t).sub(o).div(a).toNumber()),s=u+c+1;return s>r?Fx(e,t,r,n,i+1):(s0?c+(r-s):c,u=t>0?u:u+(r-s)),{step:a,tickMin:o.sub(new ae(u).mul(a)),tickMax:o.add(new ae(c).mul(a))})}function Mj(e){var t=Nn(e,2),r=t[0],n=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),u=Lx([r,n]),c=Nn(u,2),s=c[0],f=c[1];if(s===-1/0||f===1/0){var l=f===1/0?[s].concat(Kl(Ul(0,i-1).map(function(){return 1/0}))):[].concat(Kl(Ul(0,i-1).map(function(){return-1/0})),[f]);return r>n?Hl(l):l}if(s===f)return jj(s,i,a);var h=Fx(s,f,o,a),d=h.step,y=h.tickMin,v=h.tickMax,p=Ya.rangeStep(y,v.add(new ae(.1).mul(d)),d);return r>n?Hl(p):p}function $j(e,t){var r=Nn(e,2),n=r[0],i=r[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Lx([n,i]),u=Nn(o,2),c=u[0],s=u[1];if(c===-1/0||s===1/0)return[n,i];if(c===s)return[c];var f=Math.max(t,2),l=Bx(new ae(s).sub(c).div(f-1),a,0),h=[].concat(Kl(Ya.rangeStep(new ae(c),new ae(s).sub(new ae(.99).mul(l)),l)),[s]);return n>i?Hl(h):h}var Cj=Nx(Mj),Ij=Nx($j),kj=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Cr(e){"@babel/helpers - typeof";return Cr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cr(e)}function Qi(){return Qi=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Fj(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Wj(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zj(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,o=-1,u=(r=n?.length)!==null&&r!==void 0?r:0;if(u<=1)return 0;if(a&&a.axisType==="angleAxis"&&Math.abs(Math.abs(a.range[1]-a.range[0])-360)<=1e-6)for(var c=a.range,s=0;s0?i[s-1].coordinate:i[u-1].coordinate,l=i[s].coordinate,h=s>=u-1?i[0].coordinate:i[s+1].coordinate,d=void 0;if(Ce(l-f)!==Ce(h-l)){var y=[];if(Ce(h-l)===Ce(c[1]-c[0])){d=h;var v=l+c[1]-c[0];y[0]=Math.min(v,(v+f)/2),y[1]=Math.max(v,(v+f)/2)}else{d=f;var p=h+c[1]-c[0];y[0]=Math.min(l,(p+l)/2),y[1]=Math.max(l,(p+l)/2)}var g=[Math.min(l,(d+l)/2),Math.max(l,(d+l)/2)];if(t>g[0]&&t<=g[1]||t>=y[0]&&t<=y[1]){o=i[s].index;break}}else{var x=Math.min(f,h),w=Math.max(f,h);if(t>(x+l)/2&&t<=(w+l)/2){o=i[s].index;break}}}else for(var O=0;O0&&O(n[O].coordinate+n[O-1].coordinate)/2&&t<=(n[O].coordinate+n[O+1].coordinate)/2||O===u-1&&t>(n[O].coordinate+n[O-1].coordinate)/2){o=n[O].index;break}return o},$h=function(t){var r,n=t,i=n.type.displayName,a=(r=t.type)!==null&&r!==void 0&&r.defaultProps?ve(ve({},t.type.defaultProps),t.props):t.props,o=a.stroke,u=a.fill,c;switch(i){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:u;break;default:c=u;break}return c},oM=function(t){var r=t.barSize,n=t.totalSize,i=t.stackGroups,a=i===void 0?{}:i;if(!a)return{};for(var o={},u=Object.keys(a),c=0,s=u.length;c=0});if(g&&g.length){var x=g[0].type.defaultProps,w=x!==void 0?ve(ve({},x),g[0].props):g[0].props,O=w.barSize,m=w[p];o[m]||(o[m]=[]);var b=Y(O)?r:O;o[m].push({item:g[0],stackList:g.slice(1),barSize:Y(b)?void 0:Ie(b,n,0)})}}return o},uM=function(t){var r=t.barGap,n=t.barCategoryGap,i=t.bandSize,a=t.sizeList,o=a===void 0?[]:a,u=t.maxBarSize,c=o.length;if(c<1)return null;var s=Ie(r,i,0,!0),f,l=[];if(o[0].barSize===+o[0].barSize){var h=!1,d=i/c,y=o.reduce(function(O,m){return O+m.barSize||0},0);y+=(c-1)*s,y>=i&&(y-=(c-1)*s,s=0),y>=i&&d>0&&(h=!0,d*=.9,y=c*d);var v=(i-y)/2>>0,p={offset:v-s,size:0};f=o.reduce(function(O,m){var b={item:m.item,position:{offset:p.offset+p.size+s,size:h?d:m.barSize}},_=[].concat(Cm(O),[b]);return p=_[_.length-1].position,m.stackList&&m.stackList.length&&m.stackList.forEach(function(A){_.push({item:A,position:p})}),_},l)}else{var g=Ie(n,i,0,!0);i-2*g-(c-1)*s<=0&&(s=0);var x=(i-2*g-(c-1)*s)/c;x>1&&(x>>=0);var w=u===+u?Math.min(x,u):x;f=o.reduce(function(O,m,b){var _=[].concat(Cm(O),[{item:m.item,position:{offset:g+(x+s)*b+(x-w)/2,size:w}}]);return m.stackList&&m.stackList.length&&m.stackList.forEach(function(A){_.push({item:A,position:_[_.length-1].position})}),_},l)}return f},cM=function(t,r,n,i){var a=n.children,o=n.width,u=n.margin,c=o-(u.left||0)-(u.right||0),s=Hx({children:a,legendWidth:c});if(s){var f=i||{},l=f.width,h=f.height,d=s.align,y=s.verticalAlign,v=s.layout;if((v==="vertical"||v==="horizontal"&&y==="middle")&&d!=="center"&&q(t[d]))return ve(ve({},t),{},_r({},d,t[d]+(l||0)));if((v==="horizontal"||v==="vertical"&&d==="center")&&y!=="middle"&&q(t[y]))return ve(ve({},t),{},_r({},y,t[y]+(h||0)))}return t},sM=function(t,r,n){return Y(r)?!0:t==="horizontal"?r==="yAxis":t==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},Kx=function(t,r,n,i,a){var o=r.props.children,u=Ke(o,pi).filter(function(s){return sM(i,a,s.props.direction)});if(u&&u.length){var c=u.map(function(s){return s.props.dataKey});return t.reduce(function(s,f){var l=_e(f,n);if(Y(l))return s;var h=Array.isArray(l)?[Va(l),Ga(l)]:[l,l],d=c.reduce(function(y,v){var p=_e(f,v,0),g=h[0]-Math.abs(Array.isArray(p)?p[0]:p),x=h[1]+Math.abs(Array.isArray(p)?p[1]:p);return[Math.min(g,y[0]),Math.max(x,y[1])]},[1/0,-1/0]);return[Math.min(d[0],s[0]),Math.max(d[1],s[1])]},[1/0,-1/0])}return null},lM=function(t,r,n,i,a){var o=r.map(function(u){return Kx(t,u,n,a,i)}).filter(function(u){return!Y(u)});return o&&o.length?o.reduce(function(u,c){return[Math.min(u[0],c[0]),Math.max(u[1],c[1])]},[1/0,-1/0]):null},Gx=function(t,r,n,i,a){var o=r.map(function(c){var s=c.props.dataKey;return n==="number"&&s&&Kx(t,c,s,i)||bn(t,s,n,a)});if(n==="number")return o.reduce(function(c,s){return[Math.min(c[0],s[0]),Math.max(c[1],s[1])]},[1/0,-1/0]);var u={};return o.reduce(function(c,s){for(var f=0,l=s.length;f=2?Ce(u[0]-u[1])*2*s:s,r&&(t.ticks||t.niceTicks)){var f=(t.ticks||t.niceTicks).map(function(l){var h=a?a.indexOf(l):l;return{coordinate:i(h)+s,value:l,offset:s}});return f.filter(function(l){return!oi(l.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(l,h){return{coordinate:i(l)+s,value:l,index:h,offset:s}}):i.ticks&&!n?i.ticks(t.tickCount).map(function(l){return{coordinate:i(l)+s,value:l,offset:s}}):i.domain().map(function(l,h){return{coordinate:i(l)+s,value:a?a[l]:l,index:h,offset:s}})},qs=new WeakMap,_i=function(t,r){if(typeof r!="function")return t;qs.has(t)||qs.set(t,new WeakMap);var n=qs.get(t);if(n.has(r))return n.get(r);var i=function(){t.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,i),i},Yx=function(t,r,n){var i=t.scale,a=t.type,o=t.layout,u=t.axisType;if(i==="auto")return o==="radial"&&u==="radiusAxis"?{scale:$n(),realScaleType:"band"}:o==="radial"&&u==="angleAxis"?{scale:Vi(),realScaleType:"linear"}:a==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:gn(),realScaleType:"point"}:a==="category"?{scale:$n(),realScaleType:"band"}:{scale:Vi(),realScaleType:"linear"};if(er(i)){var c="scale".concat(Ia(i));return{scale:(gm[c]||gn)(),realScaleType:gm[c]?c:"point"}}return X(i)?{scale:i}:{scale:gn(),realScaleType:"point"}},km=1e-4,Zx=function(t){var r=t.domain();if(!(!r||r.length<=2)){var n=r.length,i=t.range(),a=Math.min(i[0],i[1])-km,o=Math.max(i[0],i[1])+km,u=t(r[0]),c=t(r[n-1]);(uo||co)&&t.domain([r[0],r[n-1]])}},fM=function(t,r){if(!t)return null;for(var n=0,i=t.length;ni)&&(a[1]=i),a[0]>i&&(a[0]=i),a[1]=0?(t[u][n][0]=a,t[u][n][1]=a+c,a=t[u][n][1]):(t[u][n][0]=o,t[u][n][1]=o+c,o=t[u][n][1])}},dM=function(t){var r=t.length;if(!(r<=0))for(var n=0,i=t[0].length;n=0?(t[o][n][0]=a,t[o][n][1]=a+u,a=t[o][n][1]):(t[o][n][0]=0,t[o][n][1]=0)}},vM={sign:pM,expand:n1,none:Ar,silhouette:i1,wiggle:a1,positive:dM},yM=function(t,r,n){var i=r.map(function(u){return u.props.dataKey}),a=vM[n],o=r1().keys(i).value(function(u,c){return+_e(u,c,0)}).order(Sl).offset(a);return o(t)},mM=function(t,r,n,i,a,o){if(!t)return null;var u=o?r.reverse():r,c={},s=u.reduce(function(l,h){var d,y=(d=h.type)!==null&&d!==void 0&&d.defaultProps?ve(ve({},h.type.defaultProps),h.props):h.props,v=y.stackId,p=y.hide;if(p)return l;var g=y[n],x=l[g]||{hasStack:!1,stackGroups:{}};if(Ae(v)){var w=x.stackGroups[v]||{numericAxisId:n,cateAxisId:i,items:[]};w.items.push(h),x.hasStack=!0,x.stackGroups[v]=w}else x.stackGroups[Zr("_stackId_")]={numericAxisId:n,cateAxisId:i,items:[h]};return ve(ve({},l),{},_r({},g,x))},c),f={};return Object.keys(s).reduce(function(l,h){var d=s[h];if(d.hasStack){var y={};d.stackGroups=Object.keys(d.stackGroups).reduce(function(v,p){var g=d.stackGroups[p];return ve(ve({},v),{},_r({},p,{numericAxisId:n,cateAxisId:i,items:g.items,stackedData:yM(t,g.items,a)}))},y)}return ve(ve({},l),{},_r({},h,d))},f)},Jx=function(t,r){var n=r.realScaleType,i=r.type,a=r.tickCount,o=r.originalDomain,u=r.allowDecimals,c=n||r.scale;if(c!=="auto"&&c!=="linear")return null;if(a&&i==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var s=t.domain();if(!s.length)return null;var f=Cj(s,a,u);return t.domain([Va(f),Ga(f)]),{niceTicks:f}}if(a&&i==="number"){var l=t.domain(),h=Ij(l,a,u);return{niceTicks:h}}return null};function Rm(e){var t=e.axis,r=e.ticks,n=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Y(i[t.dataKey])){var u=Mi(r,"value",i[t.dataKey]);if(u)return u.coordinate+n/2}return r[a]?r[a].coordinate+n/2:null}var c=_e(i,Y(o)?t.dataKey:o);return Y(c)?null:t.scale(c)}var Dm=function(t){var r=t.axis,n=t.ticks,i=t.offset,a=t.bandSize,o=t.entry,u=t.index;if(r.type==="category")return n[u]?n[u].coordinate+i:null;var c=_e(o,r.dataKey,r.domain[u]);return Y(c)?null:r.scale(c)-a/2+i},gM=function(t){var r=t.numericAxis,n=r.scale.domain();if(r.type==="number"){var i=Math.min(n[0],n[1]),a=Math.max(n[0],n[1]);return i<=0&&a>=0?0:a<0?a:i}return n[0]},bM=function(t,r){var n,i=(n=t.type)!==null&&n!==void 0&&n.defaultProps?ve(ve({},t.type.defaultProps),t.props):t.props,a=i.stackId;if(Ae(a)){var o=r[a];if(o){var u=o.items.indexOf(t);return u>=0?o.stackedData[u]:null}}return null},xM=function(t){return t.reduce(function(r,n){return[Va(n.concat([r[0]]).filter(q)),Ga(n.concat([r[1]]).filter(q))]},[1/0,-1/0])},Qx=function(t,r,n){return Object.keys(t).reduce(function(i,a){var o=t[a],u=o.stackedData,c=u.reduce(function(s,f){var l=xM(f.slice(r,n+1));return[Math.min(s[0],l[0]),Math.max(s[1],l[1])]},[1/0,-1/0]);return[Math.min(c[0],i[0]),Math.max(c[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},Nm=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,qm=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Yl=function(t,r,n){if(X(t))return t(r,n);if(!Array.isArray(t))return r;var i=[];if(q(t[0]))i[0]=n?t[0]:Math.min(t[0],r[0]);else if(Nm.test(t[0])){var a=+Nm.exec(t[0])[1];i[0]=r[0]-a}else X(t[0])?i[0]=t[0](r[0]):i[0]=r[0];if(q(t[1]))i[1]=n?t[1]:Math.max(t[1],r[1]);else if(qm.test(t[1])){var o=+qm.exec(t[1])[1];i[1]=r[1]+o}else X(t[1])?i[1]=t[1](r[1]):i[1]=r[1];return i},ta=function(t,r,n){if(t&&t.scale&&t.scale.bandwidth){var i=t.scale.bandwidth();if(!n||i>0)return i}if(t&&r&&r.length>=2){for(var a=ih(r,function(l){return l.coordinate}),o=1/0,u=1,c=a.length;ue.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},jM=function(t,r,n,i,a){var o=t.width,u=t.height,c=t.startAngle,s=t.endAngle,f=Ie(t.cx,o,o/2),l=Ie(t.cy,u,u/2),h=rw(o,u,n),d=Ie(t.innerRadius,h,0),y=Ie(t.outerRadius,h,h*.8),v=Object.keys(r);return v.reduce(function(p,g){var x=r[g],w=x.domain,O=x.reversed,m;if(Y(x.range))i==="angleAxis"?m=[c,s]:i==="radiusAxis"&&(m=[d,y]),O&&(m=[m[1],m[0]]);else{m=x.range;var b=m,_=_M(b,2);c=_[0],s=_[1]}var A=Yx(x,a),T=A.realScaleType,M=A.scale;M.domain(w).range(m),Zx(M);var P=Jx(M,vt(vt({},x),{},{realScaleType:T})),E=vt(vt(vt({},x),P),{},{range:m,radius:y,realScaleType:T,scale:M,cx:f,cy:l,innerRadius:d,outerRadius:y,startAngle:c,endAngle:s});return vt(vt({},p),{},tw({},g,E))},{})},MM=function(t,r){var n=t.x,i=t.y,a=r.x,o=r.y;return Math.sqrt(Math.pow(n-a,2)+Math.pow(i-o,2))},$M=function(t,r){var n=t.x,i=t.y,a=r.cx,o=r.cy,u=MM({x:n,y:i},{x:a,y:o});if(u<=0)return{radius:u};var c=(n-a)/u,s=Math.acos(c);return i>o&&(s=2*Math.PI-s),{radius:u,angle:EM(s),angleInRadian:s}},CM=function(t){var r=t.startAngle,n=t.endAngle,i=Math.floor(r/360),a=Math.floor(n/360),o=Math.min(i,a);return{startAngle:r-o*360,endAngle:n-o*360}},IM=function(t,r){var n=r.startAngle,i=r.endAngle,a=Math.floor(n/360),o=Math.floor(i/360),u=Math.min(a,o);return t+u*360},Wm=function(t,r){var n=t.x,i=t.y,a=$M({x:n,y:i},r),o=a.radius,u=a.angle,c=r.innerRadius,s=r.outerRadius;if(os)return!1;if(o===0)return!0;var f=CM(r),l=f.startAngle,h=f.endAngle,d=u,y;if(l<=h){for(;d>h;)d-=360;for(;d=l&&d<=h}else{for(;d>l;)d-=360;for(;d=h&&d<=l}return y?vt(vt({},r),{},{radius:o,angle:IM(d,r)}):null},nw=function(t){return!N.isValidElement(t)&&!X(t)&&typeof t!="boolean"?t.className:""};function Fn(e){"@babel/helpers - typeof";return Fn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fn(e)}var kM=["offset"];function RM(e){return LM(e)||qM(e)||NM(e)||DM()}function DM(){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 NM(e,t){if(e){if(typeof e=="string")return Zl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Zl(e,t)}}function qM(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function LM(e){if(Array.isArray(e))return Zl(e)}function Zl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function FM(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function zm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Oe(e){for(var t=1;t=0?1:-1,w,O;i==="insideStart"?(w=d+x*o,O=v):i==="insideEnd"?(w=y-x*o,O=!v):i==="end"&&(w=y+x*o,O=v),O=g<=0?O:!O;var m=le(s,f,p,w),b=le(s,f,p,w+(O?1:-1)*359),_="M".concat(m.x,",").concat(m.y,` A`).concat(p,",").concat(p,",0,1,").concat(O?0:1,`, - `).concat(b.x,",").concat(b.y),A=Y(t.id)?Zr("recharts-radial-line-"):t.id;return S.createElement("text",Wn({},n,{dominantBaseline:"central",className:J("recharts-radial-bar-label",u)}),S.createElement("defs",null,S.createElement("path",{id:A,d:_})),S.createElement("textPath",{xlinkHref:"#".concat(A)},r))},GM=function(t){var r=t.viewBox,n=t.offset,i=t.position,a=r,o=a.cx,u=a.cy,c=a.innerRadius,s=a.outerRadius,f=a.startAngle,l=a.endAngle,h=(f+l)/2;if(i==="outside"){var d=le(o,u,s+n,h),y=d.x,v=d.y;return{x:y,y:v,textAnchor:y>=o?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"end"};var p=(c+s)/2,g=le(o,u,p,h),x=g.x,w=g.y;return{x,y:w,textAnchor:"middle",verticalAnchor:"middle"}},VM=function(t){var r=t.viewBox,n=t.parentViewBox,i=t.offset,a=t.position,o=r,u=o.x,c=o.y,s=o.width,f=o.height,l=f>=0?1:-1,h=l*i,d=l>0?"end":"start",y=l>0?"start":"end",v=s>=0?1:-1,p=v*i,g=v>0?"end":"start",x=v>0?"start":"end";if(a==="top"){var w={x:u+s/2,y:c-l*i,textAnchor:"middle",verticalAnchor:d};return Oe(Oe({},w),n?{height:Math.max(c-n.y,0),width:s}:{})}if(a==="bottom"){var O={x:u+s/2,y:c+f+h,textAnchor:"middle",verticalAnchor:y};return Oe(Oe({},O),n?{height:Math.max(n.y+n.height-(c+f),0),width:s}:{})}if(a==="left"){var m={x:u-p,y:c+f/2,textAnchor:g,verticalAnchor:"middle"};return Oe(Oe({},m),n?{width:Math.max(m.x-n.x,0),height:f}:{})}if(a==="right"){var b={x:u+s+p,y:c+f/2,textAnchor:x,verticalAnchor:"middle"};return Oe(Oe({},b),n?{width:Math.max(n.x+n.width-b.x,0),height:f}:{})}var _=n?{width:s,height:f}:{};return a==="insideLeft"?Oe({x:u+p,y:c+f/2,textAnchor:x,verticalAnchor:"middle"},_):a==="insideRight"?Oe({x:u+s-p,y:c+f/2,textAnchor:g,verticalAnchor:"middle"},_):a==="insideTop"?Oe({x:u+s/2,y:c+h,textAnchor:"middle",verticalAnchor:y},_):a==="insideBottom"?Oe({x:u+s/2,y:c+f-h,textAnchor:"middle",verticalAnchor:d},_):a==="insideTopLeft"?Oe({x:u+p,y:c+h,textAnchor:x,verticalAnchor:y},_):a==="insideTopRight"?Oe({x:u+s-p,y:c+h,textAnchor:g,verticalAnchor:y},_):a==="insideBottomLeft"?Oe({x:u+p,y:c+f-h,textAnchor:x,verticalAnchor:d},_):a==="insideBottomRight"?Oe({x:u+s-p,y:c+f-h,textAnchor:g,verticalAnchor:d},_):Yr(a)&&(q(a.x)||Gt(a.x))&&(q(a.y)||Gt(a.y))?Oe({x:u+Ie(a.x,s),y:c+Ie(a.y,f),textAnchor:"end",verticalAnchor:"end"},_):Oe({x:u+s/2,y:c+f/2,textAnchor:"middle",verticalAnchor:"middle"},_)},XM=function(t){return"cx"in t&&q(t.cx)};function Te(e){var t=e.offset,r=t===void 0?5:t,n=LM(e,IM),i=Oe({offset:r},n),a=i.viewBox,o=i.position,u=i.value,c=i.children,s=i.content,f=i.className,l=f===void 0?"":f,h=i.textBreakAll;if(!a||Y(u)&&Y(c)&&!N.isValidElement(s)&&!X(s))return null;if(N.isValidElement(s))return N.cloneElement(s,i);var d;if(X(s)){if(d=N.createElement(s,i),N.isValidElement(d))return d}else d=UM(i);var y=XM(a),v=H(i,!0);if(y&&(o==="insideStart"||o==="insideEnd"||o==="end"))return KM(i,d,v);var p=y?GM(i):VM(i);return S.createElement(rr,Wn({className:J("recharts-label",l)},v,p,{breakAll:h}),d)}Te.displayName="Label";var nw=function(t){var r=t.cx,n=t.cy,i=t.angle,a=t.startAngle,o=t.endAngle,u=t.r,c=t.radius,s=t.innerRadius,f=t.outerRadius,l=t.x,h=t.y,d=t.top,y=t.left,v=t.width,p=t.height,g=t.clockWise,x=t.labelViewBox;if(x)return x;if(q(v)&&q(p)){if(q(l)&&q(h))return{x:l,y:h,width:v,height:p};if(q(d)&&q(y))return{x:d,y,width:v,height:p}}return q(l)&&q(h)?{x:l,y:h,width:0,height:0}:q(r)&&q(n)?{cx:r,cy:n,startAngle:a||i||0,endAngle:o||i||0,innerRadius:s||0,outerRadius:f||c||u||0,clockWise:g}:t.viewBox?t.viewBox:{}},YM=function(t,r){return t?t===!0?S.createElement(Te,{key:"label-implicit",viewBox:r}):Ae(t)?S.createElement(Te,{key:"label-implicit",viewBox:r,value:t}):N.isValidElement(t)?t.type===Te?N.cloneElement(t,{key:"label-implicit",viewBox:r}):S.createElement(Te,{key:"label-implicit",content:t,viewBox:r}):X(t)?S.createElement(Te,{key:"label-implicit",content:t,viewBox:r}):Yr(t)?S.createElement(Te,Wn({viewBox:r},t,{key:"label-implicit"})):null:null},ZM=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var i=t.children,a=nw(t),o=Ke(i,Te).map(function(c,s){return N.cloneElement(c,{viewBox:r||a,key:"label-".concat(s)})});if(!n)return o;var u=YM(t.label,r||a);return[u].concat(kM(o))};Te.parseViewBox=nw;Te.renderCallByParent=ZM;var Ls,Um;function JM(){if(Um)return Ls;Um=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return Ls=e,Ls}var QM=JM();const e$=oe(QM);function zn(e){"@babel/helpers - typeof";return zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zn(e)}var t$=["valueAccessor"],r$=["data","dataKey","clockWise","id","textBreakAll"];function n$(e){return u$(e)||o$(e)||a$(e)||i$()}function i$(){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 a$(e,t){if(e){if(typeof e=="string")return Jl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Jl(e,t)}}function o$(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function u$(e){if(Array.isArray(e))return Jl(e)}function Jl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function f$(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var h$=function(t){return Array.isArray(t.value)?e$(t.value):t.value};function wt(e){var t=e.valueAccessor,r=t===void 0?h$:t,n=Gm(e,t$),i=n.data,a=n.dataKey,o=n.clockWise,u=n.id,c=n.textBreakAll,s=Gm(n,r$);return!i||!i.length?null:S.createElement(te,{className:"recharts-label-list"},i.map(function(f,l){var h=Y(a)?r(f,l):_e(f&&f.payload,a),d=Y(u)?{}:{id:"".concat(u,"-").concat(l)};return S.createElement(Te,na({},H(f,!0),s,d,{parentViewBox:f.parentViewBox,value:h,textBreakAll:c,viewBox:Te.parseViewBox(Y(o)?f:Km(Km({},f),{},{clockWise:o})),key:"label-".concat(l),index:l}))}))}wt.displayName="LabelList";function p$(e,t){return e?e===!0?S.createElement(wt,{key:"labelList-implicit",data:t}):S.isValidElement(e)||X(e)?S.createElement(wt,{key:"labelList-implicit",data:t,content:e}):Yr(e)?S.createElement(wt,na({data:t},e,{key:"labelList-implicit"})):null:null}function d$(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var n=e.children,i=Ke(n,wt).map(function(o,u){return N.cloneElement(o,{data:t,key:"labelList-".concat(u)})});if(!r)return i;var a=p$(e.label,t);return[a].concat(n$(i))}wt.renderCallByParent=d$;function Un(e){"@babel/helpers - typeof";return Un=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Un(e)}function Ql(){return Ql=Object.assign?Object.assign.bind():function(e){for(var t=1;t=o?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"end"};var p=(c+s)/2,g=le(o,u,p,h),x=g.x,w=g.y;return{x,y:w,textAnchor:"middle",verticalAnchor:"middle"}},XM=function(t){var r=t.viewBox,n=t.parentViewBox,i=t.offset,a=t.position,o=r,u=o.x,c=o.y,s=o.width,f=o.height,l=f>=0?1:-1,h=l*i,d=l>0?"end":"start",y=l>0?"start":"end",v=s>=0?1:-1,p=v*i,g=v>0?"end":"start",x=v>0?"start":"end";if(a==="top"){var w={x:u+s/2,y:c-l*i,textAnchor:"middle",verticalAnchor:d};return Oe(Oe({},w),n?{height:Math.max(c-n.y,0),width:s}:{})}if(a==="bottom"){var O={x:u+s/2,y:c+f+h,textAnchor:"middle",verticalAnchor:y};return Oe(Oe({},O),n?{height:Math.max(n.y+n.height-(c+f),0),width:s}:{})}if(a==="left"){var m={x:u-p,y:c+f/2,textAnchor:g,verticalAnchor:"middle"};return Oe(Oe({},m),n?{width:Math.max(m.x-n.x,0),height:f}:{})}if(a==="right"){var b={x:u+s+p,y:c+f/2,textAnchor:x,verticalAnchor:"middle"};return Oe(Oe({},b),n?{width:Math.max(n.x+n.width-b.x,0),height:f}:{})}var _=n?{width:s,height:f}:{};return a==="insideLeft"?Oe({x:u+p,y:c+f/2,textAnchor:x,verticalAnchor:"middle"},_):a==="insideRight"?Oe({x:u+s-p,y:c+f/2,textAnchor:g,verticalAnchor:"middle"},_):a==="insideTop"?Oe({x:u+s/2,y:c+h,textAnchor:"middle",verticalAnchor:y},_):a==="insideBottom"?Oe({x:u+s/2,y:c+f-h,textAnchor:"middle",verticalAnchor:d},_):a==="insideTopLeft"?Oe({x:u+p,y:c+h,textAnchor:x,verticalAnchor:y},_):a==="insideTopRight"?Oe({x:u+s-p,y:c+h,textAnchor:g,verticalAnchor:y},_):a==="insideBottomLeft"?Oe({x:u+p,y:c+f-h,textAnchor:x,verticalAnchor:d},_):a==="insideBottomRight"?Oe({x:u+s-p,y:c+f-h,textAnchor:g,verticalAnchor:d},_):Yr(a)&&(q(a.x)||Gt(a.x))&&(q(a.y)||Gt(a.y))?Oe({x:u+Ie(a.x,s),y:c+Ie(a.y,f),textAnchor:"end",verticalAnchor:"end"},_):Oe({x:u+s/2,y:c+f/2,textAnchor:"middle",verticalAnchor:"middle"},_)},YM=function(t){return"cx"in t&&q(t.cx)};function Te(e){var t=e.offset,r=t===void 0?5:t,n=BM(e,kM),i=Oe({offset:r},n),a=i.viewBox,o=i.position,u=i.value,c=i.children,s=i.content,f=i.className,l=f===void 0?"":f,h=i.textBreakAll;if(!a||Y(u)&&Y(c)&&!N.isValidElement(s)&&!X(s))return null;if(N.isValidElement(s))return N.cloneElement(s,i);var d;if(X(s)){if(d=N.createElement(s,i),N.isValidElement(d))return d}else d=HM(i);var y=YM(a),v=H(i,!0);if(y&&(o==="insideStart"||o==="insideEnd"||o==="end"))return GM(i,d,v);var p=y?VM(i):XM(i);return S.createElement(rr,Wn({className:J("recharts-label",l)},v,p,{breakAll:h}),d)}Te.displayName="Label";var iw=function(t){var r=t.cx,n=t.cy,i=t.angle,a=t.startAngle,o=t.endAngle,u=t.r,c=t.radius,s=t.innerRadius,f=t.outerRadius,l=t.x,h=t.y,d=t.top,y=t.left,v=t.width,p=t.height,g=t.clockWise,x=t.labelViewBox;if(x)return x;if(q(v)&&q(p)){if(q(l)&&q(h))return{x:l,y:h,width:v,height:p};if(q(d)&&q(y))return{x:d,y,width:v,height:p}}return q(l)&&q(h)?{x:l,y:h,width:0,height:0}:q(r)&&q(n)?{cx:r,cy:n,startAngle:a||i||0,endAngle:o||i||0,innerRadius:s||0,outerRadius:f||c||u||0,clockWise:g}:t.viewBox?t.viewBox:{}},ZM=function(t,r){return t?t===!0?S.createElement(Te,{key:"label-implicit",viewBox:r}):Ae(t)?S.createElement(Te,{key:"label-implicit",viewBox:r,value:t}):N.isValidElement(t)?t.type===Te?N.cloneElement(t,{key:"label-implicit",viewBox:r}):S.createElement(Te,{key:"label-implicit",content:t,viewBox:r}):X(t)?S.createElement(Te,{key:"label-implicit",content:t,viewBox:r}):Yr(t)?S.createElement(Te,Wn({viewBox:r},t,{key:"label-implicit"})):null:null},JM=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var i=t.children,a=iw(t),o=Ke(i,Te).map(function(c,s){return N.cloneElement(c,{viewBox:r||a,key:"label-".concat(s)})});if(!n)return o;var u=ZM(t.label,r||a);return[u].concat(RM(o))};Te.parseViewBox=iw;Te.renderCallByParent=JM;var Ls,Um;function QM(){if(Um)return Ls;Um=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return Ls=e,Ls}var e$=QM();const t$=oe(e$);function zn(e){"@babel/helpers - typeof";return zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zn(e)}var r$=["valueAccessor"],n$=["data","dataKey","clockWise","id","textBreakAll"];function i$(e){return c$(e)||u$(e)||o$(e)||a$()}function a$(){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 o$(e,t){if(e){if(typeof e=="string")return Jl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Jl(e,t)}}function u$(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c$(e){if(Array.isArray(e))return Jl(e)}function Jl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function h$(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var p$=function(t){return Array.isArray(t.value)?t$(t.value):t.value};function wt(e){var t=e.valueAccessor,r=t===void 0?p$:t,n=Gm(e,r$),i=n.data,a=n.dataKey,o=n.clockWise,u=n.id,c=n.textBreakAll,s=Gm(n,n$);return!i||!i.length?null:S.createElement(te,{className:"recharts-label-list"},i.map(function(f,l){var h=Y(a)?r(f,l):_e(f&&f.payload,a),d=Y(u)?{}:{id:"".concat(u,"-").concat(l)};return S.createElement(Te,na({},H(f,!0),s,d,{parentViewBox:f.parentViewBox,value:h,textBreakAll:c,viewBox:Te.parseViewBox(Y(o)?f:Km(Km({},f),{},{clockWise:o})),key:"label-".concat(l),index:l}))}))}wt.displayName="LabelList";function d$(e,t){return e?e===!0?S.createElement(wt,{key:"labelList-implicit",data:t}):S.isValidElement(e)||X(e)?S.createElement(wt,{key:"labelList-implicit",data:t,content:e}):Yr(e)?S.createElement(wt,na({data:t},e,{key:"labelList-implicit"})):null:null}function v$(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var n=e.children,i=Ke(n,wt).map(function(o,u){return N.cloneElement(o,{data:t,key:"labelList-".concat(u)})});if(!r)return i;var a=d$(e.label,t);return[a].concat(i$(i))}wt.renderCallByParent=v$;function Un(e){"@babel/helpers - typeof";return Un=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Un(e)}function Ql(){return Ql=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(o>s),`, `).concat(l.x,",").concat(l.y,` `);if(i>0){var d=le(r,n,i,o),y=le(r,n,i,s);h+="L ".concat(y.x,",").concat(y.y,` A `).concat(i,",").concat(i,`,0, `).concat(+(Math.abs(c)>180),",").concat(+(o<=s),`, - `).concat(d.x,",").concat(d.y," Z")}else h+="L ".concat(r,",").concat(n," Z");return h},b$=function(t){var r=t.cx,n=t.cy,i=t.innerRadius,a=t.outerRadius,o=t.cornerRadius,u=t.forceCornerRadius,c=t.cornerIsExternal,s=t.startAngle,f=t.endAngle,l=Ce(f-s),h=Ai({cx:r,cy:n,radius:a,angle:s,sign:l,cornerRadius:o,cornerIsExternal:c}),d=h.circleTangency,y=h.lineTangency,v=h.theta,p=Ai({cx:r,cy:n,radius:a,angle:f,sign:-l,cornerRadius:o,cornerIsExternal:c}),g=p.circleTangency,x=p.lineTangency,w=p.theta,O=c?Math.abs(s-f):Math.abs(s-f)-v-w;if(O<0)return u?"M ".concat(y.x,",").concat(y.y,` + `).concat(d.x,",").concat(d.y," Z")}else h+="L ".concat(r,",").concat(n," Z");return h},x$=function(t){var r=t.cx,n=t.cy,i=t.innerRadius,a=t.outerRadius,o=t.cornerRadius,u=t.forceCornerRadius,c=t.cornerIsExternal,s=t.startAngle,f=t.endAngle,l=Ce(f-s),h=Ai({cx:r,cy:n,radius:a,angle:s,sign:l,cornerRadius:o,cornerIsExternal:c}),d=h.circleTangency,y=h.lineTangency,v=h.theta,p=Ai({cx:r,cy:n,radius:a,angle:f,sign:-l,cornerRadius:o,cornerIsExternal:c}),g=p.circleTangency,x=p.lineTangency,w=p.theta,O=c?Math.abs(s-f):Math.abs(s-f)-v-w;if(O<0)return u?"M ".concat(y.x,",").concat(y.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 - `):iw({cx:r,cy:n,innerRadius:i,outerRadius:a,startAngle:s,endAngle:f});var m="M ".concat(y.x,",").concat(y.y,` + `):aw({cx:r,cy:n,innerRadius:i,outerRadius:a,startAngle:s,endAngle:f});var m="M ".concat(y.x,",").concat(y.y,` A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(d.x,",").concat(d.y,` A`).concat(a,",").concat(a,",0,").concat(+(O>180),",").concat(+(l<0),",").concat(g.x,",").concat(g.y,` A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(x.x,",").concat(x.y,` `);if(i>0){var b=Ai({cx:r,cy:n,radius:i,angle:s,sign:l,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),_=b.circleTangency,A=b.lineTangency,T=b.theta,M=Ai({cx:r,cy:n,radius:i,angle:f,sign:-l,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),P=M.circleTangency,E=M.lineTangency,j=M.theta,C=c?Math.abs(s-f):Math.abs(s-f)-T-j;if(C<0&&o===0)return"".concat(m,"L").concat(r,",").concat(n,"Z");m+="L".concat(E.x,",").concat(E.y,` A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(P.x,",").concat(P.y,` A`).concat(i,",").concat(i,",0,").concat(+(C>180),",").concat(+(l>0),",").concat(_.x,",").concat(_.y,` - A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(A.x,",").concat(A.y,"Z")}else m+="L".concat(r,",").concat(n,"Z");return m},x$={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},aw=function(t){var r=Xm(Xm({},x$),t),n=r.cx,i=r.cy,a=r.innerRadius,o=r.outerRadius,u=r.cornerRadius,c=r.forceCornerRadius,s=r.cornerIsExternal,f=r.startAngle,l=r.endAngle,h=r.className;if(o0&&Math.abs(f-l)<360?p=b$({cx:n,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(v,y/2),forceCornerRadius:c,cornerIsExternal:s,startAngle:f,endAngle:l}):p=iw({cx:n,cy:i,innerRadius:a,outerRadius:o,startAngle:f,endAngle:l}),S.createElement("path",Ql({},H(r,!0),{className:d,d:p,role:"img"}))};function Hn(e){"@babel/helpers - typeof";return Hn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hn(e)}function ef(){return ef=Object.assign?Object.assign.bind():function(e){for(var t=1;t0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function L$(e,t){return sr(e.getTime(),t.getTime())}function B$(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function F$(e,t){return e===t}function og(e,t,r){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var i=new Array(n),a=e.entries(),o,u,c=0;(o=a.next())&&!o.done;){for(var s=t.entries(),f=!1,l=0;(u=s.next())&&!u.done;){if(i[l]){l++;continue}var h=o.value,d=u.value;if(r.equals(h[0],d[0],c,l,e,t,r)&&r.equals(h[1],d[1],h[0],d[0],e,t,r)){f=i[l]=!0;break}l++}if(!f)return!1;c++}return!0}var W$=sr;function z$(e,t,r){var n=ag(e),i=n.length;if(ag(t).length!==i)return!1;for(;i-- >0;)if(!ow(e,t,r,n[i]))return!1;return!0}function hn(e,t,r){var n=ng(e),i=n.length;if(ng(t).length!==i)return!1;for(var a,o,u;i-- >0;)if(a=n[i],!ow(e,t,r,a)||(o=ig(e,a),u=ig(t,a),(o||u)&&(!o||!u||o.configurable!==u.configurable||o.enumerable!==u.enumerable||o.writable!==u.writable)))return!1;return!0}function U$(e,t){return sr(e.valueOf(),t.valueOf())}function H$(e,t){return e.source===t.source&&e.flags===t.flags}function ug(e,t,r){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var i=new Array(n),a=e.values(),o,u;(o=a.next())&&!o.done;){for(var c=t.values(),s=!1,f=0;(u=c.next())&&!u.done;){if(!i[f]&&r.equals(o.value,u.value,o.value,u.value,e,t,r)){s=i[f]=!0;break}f++}if(!s)return!1}return!0}function K$(e,t){var r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}function G$(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function ow(e,t,r,n){return(n===N$||n===D$||n===R$)&&(e.$$typeof||t.$$typeof)?!0:k$(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var V$="[object Arguments]",X$="[object Boolean]",Y$="[object Date]",Z$="[object Error]",J$="[object Map]",Q$="[object Number]",eC="[object Object]",tC="[object RegExp]",rC="[object Set]",nC="[object String]",iC="[object URL]",aC=Array.isArray,cg=typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView:null,sg=Object.assign,oC=Object.prototype.toString.call.bind(Object.prototype.toString);function uC(e){var t=e.areArraysEqual,r=e.areDatesEqual,n=e.areErrorsEqual,i=e.areFunctionsEqual,a=e.areMapsEqual,o=e.areNumbersEqual,u=e.areObjectsEqual,c=e.arePrimitiveWrappersEqual,s=e.areRegExpsEqual,f=e.areSetsEqual,l=e.areTypedArraysEqual,h=e.areUrlsEqual,d=e.unknownTagComparators;return function(v,p,g){if(v===p)return!0;if(v==null||p==null)return!1;var x=typeof v;if(x!==typeof p)return!1;if(x!=="object")return x==="number"?o(v,p,g):x==="function"?i(v,p,g):!1;var w=v.constructor;if(w!==p.constructor)return!1;if(w===Object)return u(v,p,g);if(aC(v))return t(v,p,g);if(cg!=null&&cg(v))return l(v,p,g);if(w===Date)return r(v,p,g);if(w===RegExp)return s(v,p,g);if(w===Map)return a(v,p,g);if(w===Set)return f(v,p,g);var O=oC(v);if(O===Y$)return r(v,p,g);if(O===tC)return s(v,p,g);if(O===J$)return a(v,p,g);if(O===rC)return f(v,p,g);if(O===eC)return typeof v.then!="function"&&typeof p.then!="function"&&u(v,p,g);if(O===iC)return h(v,p,g);if(O===Z$)return n(v,p,g);if(O===V$)return u(v,p,g);if(O===X$||O===Q$||O===nC)return c(v,p,g);if(d){var m=d[O];if(!m){var b=I$(v);b&&(m=d[b])}if(m)return m(v,p,g)}return!1}}function cC(e){var t=e.circular,r=e.createCustomConfig,n=e.strict,i={areArraysEqual:n?hn:q$,areDatesEqual:L$,areErrorsEqual:B$,areFunctionsEqual:F$,areMapsEqual:n?rg(og,hn):og,areNumbersEqual:W$,areObjectsEqual:n?hn:z$,arePrimitiveWrappersEqual:U$,areRegExpsEqual:H$,areSetsEqual:n?rg(ug,hn):ug,areTypedArraysEqual:n?hn:K$,areUrlsEqual:G$,unknownTagComparators:void 0};if(r&&(i=sg({},i,r(i))),t){var a=Pi(i.areArraysEqual),o=Pi(i.areMapsEqual),u=Pi(i.areObjectsEqual),c=Pi(i.areSetsEqual);i=sg({},i,{areArraysEqual:a,areMapsEqual:o,areObjectsEqual:u,areSetsEqual:c})}return i}function sC(e){return function(t,r,n,i,a,o,u){return e(t,r,u)}}function lC(e){var t=e.circular,r=e.comparator,n=e.createState,i=e.equals,a=e.strict;if(n)return function(c,s){var f=n(),l=f.cache,h=l===void 0?t?new WeakMap:void 0:l,d=f.meta;return r(c,s,{cache:h,equals:i,meta:d,strict:a})};if(t)return function(c,s){return r(c,s,{cache:new WeakMap,equals:i,meta:void 0,strict:a})};var o={cache:void 0,equals:i,meta:void 0,strict:a};return function(c,s){return r(c,s,o)}}var fC=Dt();Dt({strict:!0});Dt({circular:!0});Dt({circular:!0,strict:!0});Dt({createInternalComparator:function(){return sr}});Dt({strict:!0,createInternalComparator:function(){return sr}});Dt({circular:!0,createInternalComparator:function(){return sr}});Dt({circular:!0,createInternalComparator:function(){return sr},strict:!0});function Dt(e){e===void 0&&(e={});var t=e.circular,r=t===void 0?!1:t,n=e.createInternalComparator,i=e.createState,a=e.strict,o=a===void 0?!1:a,u=cC(e),c=uC(u),s=n?n(c):sC(c);return lC({circular:r,comparator:c,createState:i,equals:s,strict:o})}function hC(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function lg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function i(a){r<0&&(r=a),a-r>t?(e(a),r=-1):hC(i)};requestAnimationFrame(n)}function tf(e){"@babel/helpers - typeof";return tf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tf(e)}function pC(e){return mC(e)||yC(e)||vC(e)||dC()}function dC(){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 vC(e,t){if(e){if(typeof e=="string")return fg(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return fg(e,t)}}function fg(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);re.length)&&(t=e.length);for(var r=0,n=new Array(t);r1?1:g<0?0:g},v=function(g){for(var x=g>1?1:g,w=x,O=0;O<8;++O){var m=l(w)-x,b=d(w);if(Math.abs(m-x)0&&arguments[0]!==void 0?arguments[0]:{},r=t.stiff,n=r===void 0?100:r,i=t.damping,a=i===void 0?8:i,o=t.dt,u=o===void 0?17:o,c=function(f,l,h){var d=-(f-l)*n,y=h*a,v=h+(d-y)*u/1e3,p=h*u/1e3+f;return Math.abs(p-l)e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function VC(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,a;for(a=0;a=0)&&(r[i]=e[i]);return r}function zs(e){return JC(e)||ZC(e)||YC(e)||XC()}function XC(){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 YC(e,t){if(e){if(typeof e=="string")return uf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return uf(e,t)}}function ZC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function JC(e){if(Array.isArray(e))return uf(e)}function uf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r"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 ua(e){return ua=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ua(e)}var lt=(function(e){nI(r,e);var t=iI(r);function r(n,i){var a;QC(this,r),a=t.call(this,n,i);var o=a.props,u=o.isActive,c=o.attributeName,s=o.from,f=o.to,l=o.steps,h=o.children,d=o.duration;if(a.handleStyleChange=a.handleStyleChange.bind(lf(a)),a.changeStyle=a.changeStyle.bind(lf(a)),!u||d<=0)return a.state={style:{}},typeof h=="function"&&(a.state={style:f}),sf(a);if(l&&l.length)a.state={style:l[0].style};else if(s){if(typeof h=="function")return a.state={style:s},sf(a);a.state={style:c?yn({},c,s):s}}else a.state={style:{}};return a}return tI(r,[{key:"componentDidMount",value:function(){var i=this.props,a=i.isActive,o=i.canBegin;this.mounted=!0,!(!a||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var a=this.props,o=a.isActive,u=a.canBegin,c=a.attributeName,s=a.shouldReAnimate,f=a.to,l=a.from,h=this.state.style;if(u){if(!o){var d={style:c?yn({},c,f):f};this.state&&h&&(c&&h[c]!==f||!c&&h!==f)&&this.setState(d);return}if(!(fC(i.to,f)&&i.canBegin&&i.isActive)){var y=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var v=y||s?l:i.to;if(this.state&&h){var p={style:c?yn({},c,v):v};(c&&h[c]!==v||!c&&h!==v)&&this.setState(p)}this.runAnimation(et(et({},this.props),{},{from:v,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 a=this,o=i.from,u=i.to,c=i.duration,s=i.easing,f=i.begin,l=i.onAnimationEnd,h=i.onAnimationStart,d=HC(o,u,kC(s),c,this.changeStyle),y=function(){a.stopJSAnimation=d()};this.manager.start([h,f,y,c,l])}},{key:"runStepAnimation",value:function(i){var a=this,o=i.steps,u=i.begin,c=i.onAnimationStart,s=o[0],f=s.style,l=s.duration,h=l===void 0?0:l,d=function(v,p,g){if(g===0)return v;var x=p.duration,w=p.easing,O=w===void 0?"ease":w,m=p.style,b=p.properties,_=p.onAnimationEnd,A=g>0?o[g-1]:p,T=b||Object.keys(m);if(typeof O=="function"||O==="spring")return[].concat(zs(v),[a.runJSAnimation.bind(a,{from:A.style,to:m,duration:x,easing:O}),x]);var M=dg(T,x,O),P=et(et(et({},A.style),m),{},{transition:M});return[].concat(zs(v),[P,x,_]).filter(OC)};return this.manager.start([c].concat(zs(o.reduce(d,[f,Math.max(h,u)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=gC());var a=i.begin,o=i.duration,u=i.attributeName,c=i.to,s=i.easing,f=i.onAnimationStart,l=i.onAnimationEnd,h=i.steps,d=i.children,y=this.manager;if(this.unSubscribe=y.subscribe(this.handleStyleChange),typeof s=="function"||typeof d=="function"||s==="spring"){this.runJSAnimation(i);return}if(h.length>1){this.runStepAnimation(i);return}var v=u?yn({},u,c):c,p=dg(Object.keys(v),o,s);y.start([f,a,et(et({},v),{},{transition:p}),o,l])}},{key:"render",value:function(){var i=this.props,a=i.children;i.begin;var o=i.duration;i.attributeName,i.easing;var u=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var c=GC(i,KC),s=N.Children.count(a),f=this.state.style;if(typeof a=="function")return a(f);if(!u||s===0||o<=0)return a;var l=function(d){var y=d.props,v=y.style,p=v===void 0?{}:v,g=y.className,x=N.cloneElement(d,et(et({},c),{},{style:et(et({},p),f),className:g}));return x};return s===1?l(N.Children.only(a)):S.createElement("div",null,N.Children.map(a,function(h){return l(h)}))}}]),r})(N.PureComponent);lt.displayName="Animate";lt.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};lt.propTypes={from:ie.oneOfType([ie.object,ie.string]),to:ie.oneOfType([ie.object,ie.string]),attributeName:ie.string,duration:ie.number,begin:ie.number,easing:ie.oneOfType([ie.string,ie.func]),steps:ie.arrayOf(ie.shape({duration:ie.number.isRequired,style:ie.object.isRequired,easing:ie.oneOfType([ie.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),ie.func]),properties:ie.arrayOf("string"),onAnimationEnd:ie.func})),children:ie.oneOfType([ie.node,ie.func]),isActive:ie.bool,canBegin:ie.bool,onAnimationEnd:ie.func,shouldReAnimate:ie.bool,onAnimationStart:ie.func,onAnimationReStart:ie.func};function Vn(e){"@babel/helpers - typeof";return Vn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vn(e)}function ca(){return ca=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0?1:-1,c=n>=0?1:-1,s=i>=0&&n>=0||i<0&&n<0?1:0,f;if(o>0&&a instanceof Array){for(var l=[0,0,0,0],h=0,d=4;ho?o:a[h];f="M".concat(t,",").concat(r+u*l[0]),l[0]>0&&(f+="A ".concat(l[0],",").concat(l[0],",0,0,").concat(s,",").concat(t+c*l[0],",").concat(r)),f+="L ".concat(t+n-c*l[1],",").concat(r),l[1]>0&&(f+="A ".concat(l[1],",").concat(l[1],",0,0,").concat(s,`, + A`).concat(o,",").concat(o,",0,0,").concat(+(l<0),",").concat(A.x,",").concat(A.y,"Z")}else m+="L".concat(r,",").concat(n,"Z");return m},w$={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},ow=function(t){var r=Xm(Xm({},w$),t),n=r.cx,i=r.cy,a=r.innerRadius,o=r.outerRadius,u=r.cornerRadius,c=r.forceCornerRadius,s=r.cornerIsExternal,f=r.startAngle,l=r.endAngle,h=r.className;if(o0&&Math.abs(f-l)<360?p=x$({cx:n,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(v,y/2),forceCornerRadius:c,cornerIsExternal:s,startAngle:f,endAngle:l}):p=aw({cx:n,cy:i,innerRadius:a,outerRadius:o,startAngle:f,endAngle:l}),S.createElement("path",Ql({},H(r,!0),{className:d,d:p,role:"img"}))};function Hn(e){"@babel/helpers - typeof";return Hn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hn(e)}function ef(){return ef=Object.assign?Object.assign.bind():function(e){for(var t=1;t0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function B$(e,t){return sr(e.getTime(),t.getTime())}function F$(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function W$(e,t){return e===t}function og(e,t,r){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var i=new Array(n),a=e.entries(),o,u,c=0;(o=a.next())&&!o.done;){for(var s=t.entries(),f=!1,l=0;(u=s.next())&&!u.done;){if(i[l]){l++;continue}var h=o.value,d=u.value;if(r.equals(h[0],d[0],c,l,e,t,r)&&r.equals(h[1],d[1],h[0],d[0],e,t,r)){f=i[l]=!0;break}l++}if(!f)return!1;c++}return!0}var z$=sr;function U$(e,t,r){var n=ag(e),i=n.length;if(ag(t).length!==i)return!1;for(;i-- >0;)if(!uw(e,t,r,n[i]))return!1;return!0}function hn(e,t,r){var n=ng(e),i=n.length;if(ng(t).length!==i)return!1;for(var a,o,u;i-- >0;)if(a=n[i],!uw(e,t,r,a)||(o=ig(e,a),u=ig(t,a),(o||u)&&(!o||!u||o.configurable!==u.configurable||o.enumerable!==u.enumerable||o.writable!==u.writable)))return!1;return!0}function H$(e,t){return sr(e.valueOf(),t.valueOf())}function K$(e,t){return e.source===t.source&&e.flags===t.flags}function ug(e,t,r){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var i=new Array(n),a=e.values(),o,u;(o=a.next())&&!o.done;){for(var c=t.values(),s=!1,f=0;(u=c.next())&&!u.done;){if(!i[f]&&r.equals(o.value,u.value,o.value,u.value,e,t,r)){s=i[f]=!0;break}f++}if(!s)return!1}return!0}function G$(e,t){var r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}function V$(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function uw(e,t,r,n){return(n===q$||n===N$||n===D$)&&(e.$$typeof||t.$$typeof)?!0:R$(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var X$="[object Arguments]",Y$="[object Boolean]",Z$="[object Date]",J$="[object Error]",Q$="[object Map]",eC="[object Number]",tC="[object Object]",rC="[object RegExp]",nC="[object Set]",iC="[object String]",aC="[object URL]",oC=Array.isArray,cg=typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView:null,sg=Object.assign,uC=Object.prototype.toString.call.bind(Object.prototype.toString);function cC(e){var t=e.areArraysEqual,r=e.areDatesEqual,n=e.areErrorsEqual,i=e.areFunctionsEqual,a=e.areMapsEqual,o=e.areNumbersEqual,u=e.areObjectsEqual,c=e.arePrimitiveWrappersEqual,s=e.areRegExpsEqual,f=e.areSetsEqual,l=e.areTypedArraysEqual,h=e.areUrlsEqual,d=e.unknownTagComparators;return function(v,p,g){if(v===p)return!0;if(v==null||p==null)return!1;var x=typeof v;if(x!==typeof p)return!1;if(x!=="object")return x==="number"?o(v,p,g):x==="function"?i(v,p,g):!1;var w=v.constructor;if(w!==p.constructor)return!1;if(w===Object)return u(v,p,g);if(oC(v))return t(v,p,g);if(cg!=null&&cg(v))return l(v,p,g);if(w===Date)return r(v,p,g);if(w===RegExp)return s(v,p,g);if(w===Map)return a(v,p,g);if(w===Set)return f(v,p,g);var O=uC(v);if(O===Z$)return r(v,p,g);if(O===rC)return s(v,p,g);if(O===Q$)return a(v,p,g);if(O===nC)return f(v,p,g);if(O===tC)return typeof v.then!="function"&&typeof p.then!="function"&&u(v,p,g);if(O===aC)return h(v,p,g);if(O===J$)return n(v,p,g);if(O===X$)return u(v,p,g);if(O===Y$||O===eC||O===iC)return c(v,p,g);if(d){var m=d[O];if(!m){var b=k$(v);b&&(m=d[b])}if(m)return m(v,p,g)}return!1}}function sC(e){var t=e.circular,r=e.createCustomConfig,n=e.strict,i={areArraysEqual:n?hn:L$,areDatesEqual:B$,areErrorsEqual:F$,areFunctionsEqual:W$,areMapsEqual:n?rg(og,hn):og,areNumbersEqual:z$,areObjectsEqual:n?hn:U$,arePrimitiveWrappersEqual:H$,areRegExpsEqual:K$,areSetsEqual:n?rg(ug,hn):ug,areTypedArraysEqual:n?hn:G$,areUrlsEqual:V$,unknownTagComparators:void 0};if(r&&(i=sg({},i,r(i))),t){var a=Pi(i.areArraysEqual),o=Pi(i.areMapsEqual),u=Pi(i.areObjectsEqual),c=Pi(i.areSetsEqual);i=sg({},i,{areArraysEqual:a,areMapsEqual:o,areObjectsEqual:u,areSetsEqual:c})}return i}function lC(e){return function(t,r,n,i,a,o,u){return e(t,r,u)}}function fC(e){var t=e.circular,r=e.comparator,n=e.createState,i=e.equals,a=e.strict;if(n)return function(c,s){var f=n(),l=f.cache,h=l===void 0?t?new WeakMap:void 0:l,d=f.meta;return r(c,s,{cache:h,equals:i,meta:d,strict:a})};if(t)return function(c,s){return r(c,s,{cache:new WeakMap,equals:i,meta:void 0,strict:a})};var o={cache:void 0,equals:i,meta:void 0,strict:a};return function(c,s){return r(c,s,o)}}var hC=Dt();Dt({strict:!0});Dt({circular:!0});Dt({circular:!0,strict:!0});Dt({createInternalComparator:function(){return sr}});Dt({strict:!0,createInternalComparator:function(){return sr}});Dt({circular:!0,createInternalComparator:function(){return sr}});Dt({circular:!0,createInternalComparator:function(){return sr},strict:!0});function Dt(e){e===void 0&&(e={});var t=e.circular,r=t===void 0?!1:t,n=e.createInternalComparator,i=e.createState,a=e.strict,o=a===void 0?!1:a,u=sC(e),c=cC(u),s=n?n(c):lC(c);return fC({circular:r,comparator:c,createState:i,equals:s,strict:o})}function pC(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function lg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function i(a){r<0&&(r=a),a-r>t?(e(a),r=-1):pC(i)};requestAnimationFrame(n)}function tf(e){"@babel/helpers - typeof";return tf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tf(e)}function dC(e){return gC(e)||mC(e)||yC(e)||vC()}function vC(){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 yC(e,t){if(e){if(typeof e=="string")return fg(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return fg(e,t)}}function fg(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);re.length)&&(t=e.length);for(var r=0,n=new Array(t);r1?1:g<0?0:g},v=function(g){for(var x=g>1?1:g,w=x,O=0;O<8;++O){var m=l(w)-x,b=d(w);if(Math.abs(m-x)0&&arguments[0]!==void 0?arguments[0]:{},r=t.stiff,n=r===void 0?100:r,i=t.damping,a=i===void 0?8:i,o=t.dt,u=o===void 0?17:o,c=function(f,l,h){var d=-(f-l)*n,y=h*a,v=h+(d-y)*u/1e3,p=h*u/1e3+f;return Math.abs(p-l)e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function XC(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,a;for(a=0;a=0)&&(r[i]=e[i]);return r}function zs(e){return QC(e)||JC(e)||ZC(e)||YC()}function YC(){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 ZC(e,t){if(e){if(typeof e=="string")return uf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return uf(e,t)}}function JC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function QC(e){if(Array.isArray(e))return uf(e)}function uf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r"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 ua(e){return ua=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ua(e)}var lt=(function(e){iI(r,e);var t=aI(r);function r(n,i){var a;eI(this,r),a=t.call(this,n,i);var o=a.props,u=o.isActive,c=o.attributeName,s=o.from,f=o.to,l=o.steps,h=o.children,d=o.duration;if(a.handleStyleChange=a.handleStyleChange.bind(lf(a)),a.changeStyle=a.changeStyle.bind(lf(a)),!u||d<=0)return a.state={style:{}},typeof h=="function"&&(a.state={style:f}),sf(a);if(l&&l.length)a.state={style:l[0].style};else if(s){if(typeof h=="function")return a.state={style:s},sf(a);a.state={style:c?yn({},c,s):s}}else a.state={style:{}};return a}return rI(r,[{key:"componentDidMount",value:function(){var i=this.props,a=i.isActive,o=i.canBegin;this.mounted=!0,!(!a||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var a=this.props,o=a.isActive,u=a.canBegin,c=a.attributeName,s=a.shouldReAnimate,f=a.to,l=a.from,h=this.state.style;if(u){if(!o){var d={style:c?yn({},c,f):f};this.state&&h&&(c&&h[c]!==f||!c&&h!==f)&&this.setState(d);return}if(!(hC(i.to,f)&&i.canBegin&&i.isActive)){var y=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var v=y||s?l:i.to;if(this.state&&h){var p={style:c?yn({},c,v):v};(c&&h[c]!==v||!c&&h!==v)&&this.setState(p)}this.runAnimation(et(et({},this.props),{},{from:v,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 a=this,o=i.from,u=i.to,c=i.duration,s=i.easing,f=i.begin,l=i.onAnimationEnd,h=i.onAnimationStart,d=KC(o,u,RC(s),c,this.changeStyle),y=function(){a.stopJSAnimation=d()};this.manager.start([h,f,y,c,l])}},{key:"runStepAnimation",value:function(i){var a=this,o=i.steps,u=i.begin,c=i.onAnimationStart,s=o[0],f=s.style,l=s.duration,h=l===void 0?0:l,d=function(v,p,g){if(g===0)return v;var x=p.duration,w=p.easing,O=w===void 0?"ease":w,m=p.style,b=p.properties,_=p.onAnimationEnd,A=g>0?o[g-1]:p,T=b||Object.keys(m);if(typeof O=="function"||O==="spring")return[].concat(zs(v),[a.runJSAnimation.bind(a,{from:A.style,to:m,duration:x,easing:O}),x]);var M=dg(T,x,O),P=et(et(et({},A.style),m),{},{transition:M});return[].concat(zs(v),[P,x,_]).filter(_C)};return this.manager.start([c].concat(zs(o.reduce(d,[f,Math.max(h,u)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=bC());var a=i.begin,o=i.duration,u=i.attributeName,c=i.to,s=i.easing,f=i.onAnimationStart,l=i.onAnimationEnd,h=i.steps,d=i.children,y=this.manager;if(this.unSubscribe=y.subscribe(this.handleStyleChange),typeof s=="function"||typeof d=="function"||s==="spring"){this.runJSAnimation(i);return}if(h.length>1){this.runStepAnimation(i);return}var v=u?yn({},u,c):c,p=dg(Object.keys(v),o,s);y.start([f,a,et(et({},v),{},{transition:p}),o,l])}},{key:"render",value:function(){var i=this.props,a=i.children;i.begin;var o=i.duration;i.attributeName,i.easing;var u=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var c=VC(i,GC),s=N.Children.count(a),f=this.state.style;if(typeof a=="function")return a(f);if(!u||s===0||o<=0)return a;var l=function(d){var y=d.props,v=y.style,p=v===void 0?{}:v,g=y.className,x=N.cloneElement(d,et(et({},c),{},{style:et(et({},p),f),className:g}));return x};return s===1?l(N.Children.only(a)):S.createElement("div",null,N.Children.map(a,function(h){return l(h)}))}}]),r})(N.PureComponent);lt.displayName="Animate";lt.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};lt.propTypes={from:ie.oneOfType([ie.object,ie.string]),to:ie.oneOfType([ie.object,ie.string]),attributeName:ie.string,duration:ie.number,begin:ie.number,easing:ie.oneOfType([ie.string,ie.func]),steps:ie.arrayOf(ie.shape({duration:ie.number.isRequired,style:ie.object.isRequired,easing:ie.oneOfType([ie.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),ie.func]),properties:ie.arrayOf("string"),onAnimationEnd:ie.func})),children:ie.oneOfType([ie.node,ie.func]),isActive:ie.bool,canBegin:ie.bool,onAnimationEnd:ie.func,shouldReAnimate:ie.bool,onAnimationStart:ie.func,onAnimationReStart:ie.func};function xg(){return xg=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0?1:-1,c=n>=0?1:-1,s=i>=0&&n>=0||i<0&&n<0?1:0,f;if(o>0&&a instanceof Array){for(var l=[0,0,0,0],h=0,d=4;ho?o:a[h];f="M".concat(t,",").concat(r+u*l[0]),l[0]>0&&(f+="A ".concat(l[0],",").concat(l[0],",0,0,").concat(s,",").concat(t+c*l[0],",").concat(r)),f+="L ".concat(t+n-c*l[1],",").concat(r),l[1]>0&&(f+="A ".concat(l[1],",").concat(l[1],",0,0,").concat(s,`, `).concat(t+n,",").concat(r+u*l[1])),f+="L ".concat(t+n,",").concat(r+i-u*l[2]),l[2]>0&&(f+="A ".concat(l[2],",").concat(l[2],",0,0,").concat(s,`, `).concat(t+n-c*l[2],",").concat(r+i)),f+="L ".concat(t+c*l[3],",").concat(r+i),l[3]>0&&(f+="A ".concat(l[3],",").concat(l[3],",0,0,").concat(s,`, `).concat(t,",").concat(r+i-u*l[3])),f+="Z"}else if(o>0&&a===+a&&a>0){var y=Math.min(o,a);f="M ".concat(t,",").concat(r+u*y,` @@ -53,13 +53,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho L `).concat(t+n,",").concat(r+i-u*y,` A `).concat(y,",").concat(y,",0,0,").concat(s,",").concat(t+n-c*y,",").concat(r+i,` L `).concat(t+c*y,",").concat(r+i,` - A `).concat(y,",").concat(y,",0,0,").concat(s,",").concat(t,",").concat(r+i-u*y," Z")}else f="M ".concat(t,",").concat(r," h ").concat(n," v ").concat(i," h ").concat(-n," Z");return f},dI=function(t,r){if(!t||!r)return!1;var n=t.x,i=t.y,a=r.x,o=r.y,u=r.width,c=r.height;if(Math.abs(u)>0&&Math.abs(c)>0){var s=Math.min(a,a+u),f=Math.max(a,a+u),l=Math.min(o,o+c),h=Math.max(o,o+c);return n>=s&&n<=f&&i>=l&&i<=h}return!1},vI={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Ch=function(t){var r=Og(Og({},vI),t),n=N.useRef(),i=N.useState(-1),a=oI(i,2),o=a[0],u=a[1];N.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var O=n.current.getTotalLength();O&&u(O)}catch{}},[]);var c=r.x,s=r.y,f=r.width,l=r.height,h=r.radius,d=r.className,y=r.animationEasing,v=r.animationDuration,p=r.animationBegin,g=r.isAnimationActive,x=r.isUpdateAnimationActive;if(c!==+c||s!==+s||f!==+f||l!==+l||f===0||l===0)return null;var w=J("recharts-rectangle",d);return x?S.createElement(lt,{canBegin:o>0,from:{width:f,height:l,x:c,y:s},to:{width:f,height:l,x:c,y:s},duration:v,animationEasing:y,isActive:x},function(O){var m=O.width,b=O.height,_=O.x,A=O.y;return S.createElement(lt,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:p,duration:v,isActive:g,easing:y},S.createElement("path",ca({},H(r,!0),{className:w,d:_g(_,A,m,b,h),ref:n})))}):S.createElement("path",ca({},H(r,!0),{className:w,d:_g(c,s,f,l,h)}))},yI=["points","className","baseLinePoints","connectNulls"];function yr(){return yr=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function gI(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Ag(e){return OI(e)||wI(e)||xI(e)||bI()}function bI(){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 xI(e,t){if(e){if(typeof e=="string")return ff(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ff(e,t)}}function wI(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function OI(e){if(Array.isArray(e))return ff(e)}function ff(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return t.forEach(function(n){Sg(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),Sg(t[0])&&r[r.length-1].push(t[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},wn=function(t,r){var n=_I(t);r&&(n=[n.reduce(function(a,o){return[].concat(Ag(a),Ag(o))},[])]);var i=n.map(function(a){return a.reduce(function(o,u,c){return"".concat(o).concat(c===0?"M":"L").concat(u.x,",").concat(u.y)},"")}).join("");return n.length===1?"".concat(i,"Z"):i},AI=function(t,r,n){var i=wn(t,n);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(wn(r.reverse(),n).slice(1))},SI=function(t){var r=t.points,n=t.className,i=t.baseLinePoints,a=t.connectNulls,o=mI(t,yI);if(!r||!r.length)return null;var u=J("recharts-polygon",n);if(i&&i.length){var c=o.stroke&&o.stroke!=="none",s=AI(r,i,a);return S.createElement("g",{className:u},S.createElement("path",yr({},H(o,!0),{fill:s.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:s})),c?S.createElement("path",yr({},H(o,!0),{fill:"none",d:wn(r,a)})):null,c?S.createElement("path",yr({},H(o,!0),{fill:"none",d:wn(i,a)})):null)}var f=wn(r,a);return S.createElement("path",yr({},H(o,!0),{fill:f.slice(-1)==="Z"?o.fill:"none",className:u,d:f}))};function hf(){return hf=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function CI(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var II=function(t,r,n,i,a,o){return"M".concat(t,",").concat(a,"v").concat(i,"M").concat(o,",").concat(r,"h").concat(n)},kI=function(t){var r=t.x,n=r===void 0?0:r,i=t.y,a=i===void 0?0:i,o=t.top,u=o===void 0?0:o,c=t.left,s=c===void 0?0:c,f=t.width,l=f===void 0?0:f,h=t.height,d=h===void 0?0:h,y=t.className,v=$I(t,PI),p=TI({x:n,y:a,top:u,left:s,width:l,height:d},v);return!q(n)||!q(a)||!q(l)||!q(d)||!q(u)||!q(s)?null:S.createElement("path",pf({},H(p,!0),{className:J("recharts-cross",y),d:II(n,a,l,d,u,s)}))},Us,Tg;function RI(){if(Tg)return Us;Tg=1;var e=Ka(),t=Tx(),r=ht();function n(i,a){return i&&i.length?e(i,r(a,2),t):void 0}return Us=n,Us}var DI=RI();const NI=oe(DI);var Hs,Eg;function qI(){if(Eg)return Hs;Eg=1;var e=Ka(),t=ht(),r=Ex();function n(i,a){return i&&i.length?e(i,t(a,2),r):void 0}return Hs=n,Hs}var LI=qI();const BI=oe(LI);var FI=["cx","cy","angle","ticks","axisLine"],WI=["ticks","tick","angle","tickFormatter","stroke"];function kr(e){"@babel/helpers - typeof";return kr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kr(e)}function On(){return On=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function zI(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function UI(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $g(e,t){for(var r=0;rkg?o=i==="outer"?"start":"end":a<-kg?o=i==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var n=this.props,i=n.cx,a=n.cy,o=n.radius,u=n.axisLine,c=n.axisLineType,s=zt(zt({},H(this.props,!1)),{},{fill:"none"},H(u,!1));if(c==="circle")return S.createElement(Za,Kt({className:"recharts-polar-angle-axis-line"},s,{cx:i,cy:a,r:o}));var f=this.props.ticks,l=f.map(function(h){return le(i,a,o,h.coordinate)});return S.createElement(SI,Kt({className:"recharts-polar-angle-axis-line"},s,{points:l}))}},{key:"renderTicks",value:function(){var n=this,i=this.props,a=i.ticks,o=i.tick,u=i.tickLine,c=i.tickFormatter,s=i.stroke,f=H(this.props,!1),l=H(o,!1),h=zt(zt({},f),{},{fill:"none"},H(u,!1)),d=a.map(function(y,v){var p=n.getTickLineCoord(y),g=n.getTickTextAnchor(y),x=zt(zt(zt({textAnchor:g},f),{},{stroke:"none",fill:s},l),{},{index:v,payload:y,x:p.x2,y:p.y2});return S.createElement(te,Kt({className:J("recharts-polar-angle-axis-tick",rw(o)),key:"tick-".concat(y.coordinate)},tr(n.props,y,v)),u&&S.createElement("line",Kt({className:"recharts-polar-angle-axis-tick-line"},h,p)),o&&t.renderTickItem(o,x,c?c(y.value,v):y.value))});return S.createElement(te,{className:"recharts-polar-angle-axis-ticks"},d)}},{key:"render",value:function(){var n=this.props,i=n.ticks,a=n.radius,o=n.axisLine;return a<=0||!i||!i.length?null:S.createElement(te,{className:J("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,i,a){var o;return S.isValidElement(n)?o=S.cloneElement(n,i):X(n)?o=n(i):o=S.createElement(rr,Kt({},i,{className:"recharts-polar-angle-axis-tick-value"}),a),o}}])})(N.PureComponent);eo(to,"displayName","PolarAngleAxis");eo(to,"axisType","angleAxis");eo(to,"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 Ks,Rg;function ak(){if(Rg)return Ks;Rg=1;var e=P0(),t=e(Object.getPrototypeOf,Object);return Ks=t,Ks}var Gs,Dg;function ok(){if(Dg)return Gs;Dg=1;var e=St(),t=ak(),r=Pt(),n="[object Object]",i=Function.prototype,a=Object.prototype,o=i.toString,u=a.hasOwnProperty,c=o.call(Object);function s(f){if(!r(f)||e(f)!=n)return!1;var l=t(f);if(l===null)return!0;var h=u.call(l,"constructor")&&l.constructor;return typeof h=="function"&&h instanceof h&&o.call(h)==c}return Gs=s,Gs}var uk=ok();const ck=oe(uk);var Vs,Ng;function sk(){if(Ng)return Vs;Ng=1;var e=St(),t=Pt(),r="[object Boolean]";function n(i){return i===!0||i===!1||t(i)&&e(i)==r}return Vs=n,Vs}var lk=sk();const fk=oe(lk);function Yn(e){"@babel/helpers - typeof";return Yn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yn(e)}function fa(){return fa=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0,from:{upperWidth:0,lowerWidth:0,height:h,x:c,y:s},to:{upperWidth:f,lowerWidth:l,height:h,x:c,y:s},duration:v,animationEasing:y,isActive:g},function(w){var O=w.upperWidth,m=w.lowerWidth,b=w.height,_=w.x,A=w.y;return S.createElement(lt,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:p,duration:v,easing:y},S.createElement("path",fa({},H(r,!0),{className:x,d:Fg(_,A,O,m,b),ref:n})))}):S.createElement("g",null,S.createElement("path",fa({},H(r,!0),{className:x,d:Fg(c,s,f,l,h)})))},Ok=["option","shapeType","propTransformer","activeClassName","isActive"];function Zn(e){"@babel/helpers - typeof";return Zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zn(e)}function _k(e,t){if(e==null)return{};var r=Ak(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Ak(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Wg(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ha(e){for(var t=1;t0?He(w,"paddingAngle",0):0;if(m){var _=ze(m.endAngle-m.startAngle,w.endAngle-w.startAngle),A=ce(ce({},w),{},{startAngle:x+b,endAngle:x+_(v)+b});p.push(A),x=A.endAngle}else{var T=w.endAngle,M=w.startAngle,P=ze(0,T-M),E=P(v),j=ce(ce({},w),{},{startAngle:x+b,endAngle:x+E+b});p.push(j),x=j.endAngle}}),S.createElement(te,null,n.renderSectorsStatically(p))})}},{key:"attachKeyboardHandlers",value:function(n){var i=this;n.onkeydown=function(a){if(!a.altKey)switch(a.key){case"ArrowLeft":{var o=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[o].focus(),i.setState({sectorToFocus:o});break}case"ArrowRight":{var u=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[u].focus(),i.setState({sectorToFocus:u});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var n=this.props,i=n.sectors,a=n.isAnimationActive,o=this.state.prevSectors;return a&&i&&i.length&&(!o||!hi(o,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var n=this,i=this.props,a=i.hide,o=i.sectors,u=i.className,c=i.label,s=i.cx,f=i.cy,l=i.innerRadius,h=i.outerRadius,d=i.isAnimationActive,y=this.state.isAnimationFinished;if(a||!o||!o.length||!q(s)||!q(f)||!q(l)||!q(h))return null;var v=J("recharts-pie",u);return S.createElement(te,{tabIndex:this.props.rootTabIndex,className:v,ref:function(g){n.pieRef=g}},this.renderSectors(),c&&this.renderLabels(o),Te.renderCallByParent(this.props,null,!1),(!d||y)&&wt.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return i.prevIsAnimationActive!==n.isAnimationActive?{prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:[],isAnimationFinished:!0}:n.isAnimationActive&&n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:n.sectors!==i.curSectors?{curSectors:n.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(n,i){return n>i?"start":n0&&Math.abs(c)>0){var s=Math.min(a,a+u),f=Math.max(a,a+u),l=Math.min(o,o+c),h=Math.max(o,o+c);return n>=s&&n<=f&&i>=l&&i<=h}return!1},yI={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Ch=function(t){var r=_g(_g({},yI),t),n=N.useRef(),i=N.useState(-1),a=uI(i,2),o=a[0],u=a[1];N.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var O=n.current.getTotalLength();O&&u(O)}catch{}},[]);var c=r.x,s=r.y,f=r.width,l=r.height,h=r.radius,d=r.className,y=r.animationEasing,v=r.animationDuration,p=r.animationBegin,g=r.isAnimationActive,x=r.isUpdateAnimationActive;if(c!==+c||s!==+s||f!==+f||l!==+l||f===0||l===0)return null;var w=J("recharts-rectangle",d);return x?S.createElement(lt,{canBegin:o>0,from:{width:f,height:l,x:c,y:s},to:{width:f,height:l,x:c,y:s},duration:v,animationEasing:y,isActive:x},function(O){var m=O.width,b=O.height,_=O.x,A=O.y;return S.createElement(lt,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:p,duration:v,isActive:g,easing:y},S.createElement("path",ca({},H(r,!0),{className:w,d:Ag(_,A,m,b,h),ref:n})))}):S.createElement("path",ca({},H(r,!0),{className:w,d:Ag(c,s,f,l,h)}))},mI=["points","className","baseLinePoints","connectNulls"];function yr(){return yr=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function bI(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Sg(e){return _I(e)||OI(e)||wI(e)||xI()}function xI(){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 wI(e,t){if(e){if(typeof e=="string")return ff(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ff(e,t)}}function OI(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function _I(e){if(Array.isArray(e))return ff(e)}function ff(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return t.forEach(function(n){Pg(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),Pg(t[0])&&r[r.length-1].push(t[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},wn=function(t,r){var n=AI(t);r&&(n=[n.reduce(function(a,o){return[].concat(Sg(a),Sg(o))},[])]);var i=n.map(function(a){return a.reduce(function(o,u,c){return"".concat(o).concat(c===0?"M":"L").concat(u.x,",").concat(u.y)},"")}).join("");return n.length===1?"".concat(i,"Z"):i},SI=function(t,r,n){var i=wn(t,n);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(wn(r.reverse(),n).slice(1))},PI=function(t){var r=t.points,n=t.className,i=t.baseLinePoints,a=t.connectNulls,o=gI(t,mI);if(!r||!r.length)return null;var u=J("recharts-polygon",n);if(i&&i.length){var c=o.stroke&&o.stroke!=="none",s=SI(r,i,a);return S.createElement("g",{className:u},S.createElement("path",yr({},H(o,!0),{fill:s.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:s})),c?S.createElement("path",yr({},H(o,!0),{fill:"none",d:wn(r,a)})):null,c?S.createElement("path",yr({},H(o,!0),{fill:"none",d:wn(i,a)})):null)}var f=wn(r,a);return S.createElement("path",yr({},H(o,!0),{fill:f.slice(-1)==="Z"?o.fill:"none",className:u,d:f}))};function hf(){return hf=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function II(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var kI=function(t,r,n,i,a,o){return"M".concat(t,",").concat(a,"v").concat(i,"M").concat(o,",").concat(r,"h").concat(n)},RI=function(t){var r=t.x,n=r===void 0?0:r,i=t.y,a=i===void 0?0:i,o=t.top,u=o===void 0?0:o,c=t.left,s=c===void 0?0:c,f=t.width,l=f===void 0?0:f,h=t.height,d=h===void 0?0:h,y=t.className,v=CI(t,TI),p=EI({x:n,y:a,top:u,left:s,width:l,height:d},v);return!q(n)||!q(a)||!q(l)||!q(d)||!q(u)||!q(s)?null:S.createElement("path",pf({},H(p,!0),{className:J("recharts-cross",y),d:kI(n,a,l,d,u,s)}))},Us,Eg;function DI(){if(Eg)return Us;Eg=1;var e=Ka(),t=Ex(),r=ht();function n(i,a){return i&&i.length?e(i,r(a,2),t):void 0}return Us=n,Us}var NI=DI();const qI=oe(NI);var Hs,jg;function LI(){if(jg)return Hs;jg=1;var e=Ka(),t=ht(),r=jx();function n(i,a){return i&&i.length?e(i,t(a,2),r):void 0}return Hs=n,Hs}var BI=LI();const FI=oe(BI);var WI=["cx","cy","angle","ticks","axisLine"],zI=["ticks","tick","angle","tickFormatter","stroke"];function kr(e){"@babel/helpers - typeof";return kr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kr(e)}function On(){return On=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function UI(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function HI(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cg(e,t){for(var r=0;rRg?o=i==="outer"?"start":"end":a<-Rg?o=i==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var n=this.props,i=n.cx,a=n.cy,o=n.radius,u=n.axisLine,c=n.axisLineType,s=zt(zt({},H(this.props,!1)),{},{fill:"none"},H(u,!1));if(c==="circle")return S.createElement(Za,Kt({className:"recharts-polar-angle-axis-line"},s,{cx:i,cy:a,r:o}));var f=this.props.ticks,l=f.map(function(h){return le(i,a,o,h.coordinate)});return S.createElement(PI,Kt({className:"recharts-polar-angle-axis-line"},s,{points:l}))}},{key:"renderTicks",value:function(){var n=this,i=this.props,a=i.ticks,o=i.tick,u=i.tickLine,c=i.tickFormatter,s=i.stroke,f=H(this.props,!1),l=H(o,!1),h=zt(zt({},f),{},{fill:"none"},H(u,!1)),d=a.map(function(y,v){var p=n.getTickLineCoord(y),g=n.getTickTextAnchor(y),x=zt(zt(zt({textAnchor:g},f),{},{stroke:"none",fill:s},l),{},{index:v,payload:y,x:p.x2,y:p.y2});return S.createElement(te,Kt({className:J("recharts-polar-angle-axis-tick",nw(o)),key:"tick-".concat(y.coordinate)},tr(n.props,y,v)),u&&S.createElement("line",Kt({className:"recharts-polar-angle-axis-tick-line"},h,p)),o&&t.renderTickItem(o,x,c?c(y.value,v):y.value))});return S.createElement(te,{className:"recharts-polar-angle-axis-ticks"},d)}},{key:"render",value:function(){var n=this.props,i=n.ticks,a=n.radius,o=n.axisLine;return a<=0||!i||!i.length?null:S.createElement(te,{className:J("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,i,a){var o;return S.isValidElement(n)?o=S.cloneElement(n,i):X(n)?o=n(i):o=S.createElement(rr,Kt({},i,{className:"recharts-polar-angle-axis-tick-value"}),a),o}}])})(N.PureComponent);eo(to,"displayName","PolarAngleAxis");eo(to,"axisType","angleAxis");eo(to,"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 Ks,Dg;function ok(){if(Dg)return Ks;Dg=1;var e=T0(),t=e(Object.getPrototypeOf,Object);return Ks=t,Ks}var Gs,Ng;function uk(){if(Ng)return Gs;Ng=1;var e=St(),t=ok(),r=Pt(),n="[object Object]",i=Function.prototype,a=Object.prototype,o=i.toString,u=a.hasOwnProperty,c=o.call(Object);function s(f){if(!r(f)||e(f)!=n)return!1;var l=t(f);if(l===null)return!0;var h=u.call(l,"constructor")&&l.constructor;return typeof h=="function"&&h instanceof h&&o.call(h)==c}return Gs=s,Gs}var ck=uk();const sk=oe(ck);var Vs,qg;function lk(){if(qg)return Vs;qg=1;var e=St(),t=Pt(),r="[object Boolean]";function n(i){return i===!0||i===!1||t(i)&&e(i)==r}return Vs=n,Vs}var fk=lk();const hk=oe(fk);function Yn(e){"@babel/helpers - typeof";return Yn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yn(e)}function fa(){return fa=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0,from:{upperWidth:0,lowerWidth:0,height:h,x:c,y:s},to:{upperWidth:f,lowerWidth:l,height:h,x:c,y:s},duration:v,animationEasing:y,isActive:g},function(w){var O=w.upperWidth,m=w.lowerWidth,b=w.height,_=w.x,A=w.y;return S.createElement(lt,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:p,duration:v,easing:y},S.createElement("path",fa({},H(r,!0),{className:x,d:Wg(_,A,O,m,b),ref:n})))}):S.createElement("g",null,S.createElement("path",fa({},H(r,!0),{className:x,d:Wg(c,s,f,l,h)})))},_k=["option","shapeType","propTransformer","activeClassName","isActive"];function Zn(e){"@babel/helpers - typeof";return Zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zn(e)}function Ak(e,t){if(e==null)return{};var r=Sk(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Sk(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function zg(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ha(e){for(var t=1;t0?He(w,"paddingAngle",0):0;if(m){var _=ze(m.endAngle-m.startAngle,w.endAngle-w.startAngle),A=ce(ce({},w),{},{startAngle:x+b,endAngle:x+_(v)+b});p.push(A),x=A.endAngle}else{var T=w.endAngle,M=w.startAngle,P=ze(0,T-M),E=P(v),j=ce(ce({},w),{},{startAngle:x+b,endAngle:x+E+b});p.push(j),x=j.endAngle}}),S.createElement(te,null,n.renderSectorsStatically(p))})}},{key:"attachKeyboardHandlers",value:function(n){var i=this;n.onkeydown=function(a){if(!a.altKey)switch(a.key){case"ArrowLeft":{var o=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[o].focus(),i.setState({sectorToFocus:o});break}case"ArrowRight":{var u=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[u].focus(),i.setState({sectorToFocus:u});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var n=this.props,i=n.sectors,a=n.isAnimationActive,o=this.state.prevSectors;return a&&i&&i.length&&(!o||!hi(o,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var n=this,i=this.props,a=i.hide,o=i.sectors,u=i.className,c=i.label,s=i.cx,f=i.cy,l=i.innerRadius,h=i.outerRadius,d=i.isAnimationActive,y=this.state.isAnimationFinished;if(a||!o||!o.length||!q(s)||!q(f)||!q(l)||!q(h))return null;var v=J("recharts-pie",u);return S.createElement(te,{tabIndex:this.props.rootTabIndex,className:v,ref:function(g){n.pieRef=g}},this.renderSectors(),c&&this.renderLabels(o),Te.renderCallByParent(this.props,null,!1),(!d||y)&&wt.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return i.prevIsAnimationActive!==n.isAnimationActive?{prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:[],isAnimationFinished:!0}:n.isAnimationActive&&n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:n.sectors!==i.curSectors?{curSectors:n.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(n,i){return n>i?"start":n=360?x:x-1)*c,O=p-x*d-w,m=i.reduce(function(A,T){var M=_e(T,g,0);return A+(q(M)?M:0)},0),b;if(m>0){var _;b=i.map(function(A,T){var M=_e(A,g,0),P=_e(A,f,T),E=(q(M)?M:0)/m,j;T?j=_.endAngle+Ce(v)*c*(M!==0?1:0):j=o;var C=j+Ce(v)*((M!==0?d:0)+E*O),$=(j+C)/2,k=(y.innerRadius+y.outerRadius)/2,R=[{name:P,value:M,payload:A,dataKey:g,type:h}],L=le(y.cx,y.cy,k,$);return _=ce(ce(ce({percent:E,cornerRadius:a,name:P,tooltipPayload:R,midAngle:$,middleRadius:k,tooltipPosition:L},A),y),{},{value:_e(A,g),startAngle:j,endAngle:C,payload:A,paddingAngle:Ce(v)*c}),_})}return ce(ce({},y),{},{sectors:b,data:i})});var Xs,Kg;function Hk(){if(Kg)return Xs;Kg=1;var e=Math.ceil,t=Math.max;function r(n,i,a,o){for(var u=-1,c=t(e((i-n)/(a||1)),0),s=Array(c);c--;)s[o?c:++u]=n,n+=a;return s}return Xs=r,Xs}var Ys,Gg;function xw(){if(Gg)return Ys;Gg=1;var e=W0(),t=1/0,r=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var a=i<0?-1:1;return a*r}return i===i?i:0}return Ys=n,Ys}var Zs,Vg;function Kk(){if(Vg)return Zs;Vg=1;var e=Hk(),t=La(),r=xw();function n(i){return function(a,o,u){return u&&typeof u!="number"&&t(a,o,u)&&(o=u=void 0),a=r(a),o===void 0?(o=a,a=0):o=r(o),u=u===void 0?a0&&n.handleDrag(i.changedTouches[0])}),Fe(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=n.props,a=i.endIndex,o=i.onDragEnd,u=i.startIndex;o?.({endIndex:a,startIndex:u})}),n.detachDragEndListener()}),Fe(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),Fe(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),Fe(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),Fe(n,"handleSlideDragStart",function(i){var a=eb(i)?i.changedTouches[0]:i;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:a.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return iR(t,e),eR(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var i=n.startX,a=n.endX,o=this.state.scaleValues,u=this.props,c=u.gap,s=u.data,f=s.length-1,l=Math.min(i,a),h=Math.max(i,a),d=t.getIndexInRange(o,l),y=t.getIndexInRange(o,h);return{startIndex:d-d%c,endIndex:y===f?f:y-y%c}}},{key:"getTextOfTick",value:function(n){var i=this.props,a=i.data,o=i.tickFormatter,u=i.dataKey,c=_e(a[n],u,n);return X(o)?o(c,n):c}},{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(n){var i=this.state,a=i.slideMoveStartX,o=i.startX,u=i.endX,c=this.props,s=c.x,f=c.width,l=c.travellerWidth,h=c.startIndex,d=c.endIndex,y=c.onChange,v=n.pageX-a;v>0?v=Math.min(v,s+f-l-u,s+f-l-o):v<0&&(v=Math.max(v,s-o,s-u));var p=this.getIndex({startX:o+v,endX:u+v});(p.startIndex!==h||p.endIndex!==d)&&y&&y(p),this.setState({startX:o+v,endX:u+v,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,i){var a=eb(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:a.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var i=this.state,a=i.brushMoveStartX,o=i.movingTravellerId,u=i.endX,c=i.startX,s=this.state[o],f=this.props,l=f.x,h=f.width,d=f.travellerWidth,y=f.onChange,v=f.gap,p=f.data,g={startX:this.state.startX,endX:this.state.endX},x=n.pageX-a;x>0?x=Math.min(x,l+h-d-s):x<0&&(x=Math.max(x,l-s)),g[o]=s+x;var w=this.getIndex(g),O=w.startIndex,m=w.endIndex,b=function(){var A=p.length-1;return o==="startX"&&(u>c?O%v===0:m%v===0)||uc?m%v===0:O%v===0)||u>c&&m===A};this.setState(Fe(Fe({},o,s+x),"brushMoveStartX",n.pageX),function(){y&&b()&&y(w)})}},{key:"handleTravellerMoveKeyboard",value:function(n,i){var a=this,o=this.state,u=o.scaleValues,c=o.startX,s=o.endX,f=this.state[i],l=u.indexOf(f);if(l!==-1){var h=l+n;if(!(h===-1||h>=u.length)){var d=u[h];i==="startX"&&d>=s||i==="endX"&&d<=c||this.setState(Fe({},i,d),function(){a.props.onChange(a.getIndex({startX:a.state.startX,endX:a.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,u=n.height,c=n.fill,s=n.stroke;return S.createElement("rect",{stroke:s,fill:c,x:i,y:a,width:o,height:u})}},{key:"renderPanorama",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,u=n.height,c=n.data,s=n.children,f=n.padding,l=N.Children.only(s);return l?S.cloneElement(l,{x:i,y:a,width:o,height:u,margin:f,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(n,i){var a,o,u=this,c=this.props,s=c.y,f=c.travellerWidth,l=c.height,h=c.traveller,d=c.ariaLabel,y=c.data,v=c.startIndex,p=c.endIndex,g=Math.max(n,this.props.x),x=Qs(Qs({},H(this.props,!1)),{},{x:g,y:s,width:f,height:l}),w=d||"Min value: ".concat((a=y[v])===null||a===void 0?void 0:a.name,", Max value: ").concat((o=y[p])===null||o===void 0?void 0:o.name);return S.createElement(te,{tabIndex:0,role:"slider","aria-label":w,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(m){["ArrowLeft","ArrowRight"].includes(m.key)&&(m.preventDefault(),m.stopPropagation(),u.handleTravellerMoveKeyboard(m.key==="ArrowRight"?1:-1,i))},onFocus:function(){u.setState({isTravellerFocused:!0})},onBlur:function(){u.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(h,x))}},{key:"renderSlide",value:function(n,i){var a=this.props,o=a.y,u=a.height,c=a.stroke,s=a.travellerWidth,f=Math.min(n,i)+s,l=Math.max(Math.abs(i-n)-s,0);return S.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:f,y:o,width:l,height:u})}},{key:"renderText",value:function(){var n=this.props,i=n.startIndex,a=n.endIndex,o=n.y,u=n.height,c=n.travellerWidth,s=n.stroke,f=this.state,l=f.startX,h=f.endX,d=5,y={pointerEvents:"none",fill:s};return S.createElement(te,{className:"recharts-brush-texts"},S.createElement(rr,va({textAnchor:"end",verticalAnchor:"middle",x:Math.min(l,h)-d,y:o+u/2},y),this.getTextOfTick(i)),S.createElement(rr,va({textAnchor:"start",verticalAnchor:"middle",x:Math.max(l,h)+c+d,y:o+u/2},y),this.getTextOfTick(a)))}},{key:"render",value:function(){var n=this.props,i=n.data,a=n.className,o=n.children,u=n.x,c=n.y,s=n.width,f=n.height,l=n.alwaysShowText,h=this.state,d=h.startX,y=h.endX,v=h.isTextActive,p=h.isSlideMoving,g=h.isTravellerMoving,x=h.isTravellerFocused;if(!i||!i.length||!q(u)||!q(c)||!q(s)||!q(f)||s<=0||f<=0)return null;var w=J("recharts-brush",a),O=S.Children.count(o)===1,m=Jk("userSelect","none");return S.createElement(te,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:m},this.renderBackground(),O&&this.renderPanorama(),this.renderSlide(d,y),this.renderTravellerLayer(d,"startX"),this.renderTravellerLayer(y,"endX"),(v||p||g||x||l)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var i=n.x,a=n.y,o=n.width,u=n.height,c=n.stroke,s=Math.floor(a+u/2)-1;return S.createElement(S.Fragment,null,S.createElement("rect",{x:i,y:a,width:o,height:u,fill:c,stroke:"none"}),S.createElement("line",{x1:i+1,y1:s,x2:i+o-1,y2:s,fill:"none",stroke:"#fff"}),S.createElement("line",{x1:i+1,y1:s+2,x2:i+o-1,y2:s+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,i){var a;return S.isValidElement(n)?a=S.cloneElement(n,i):X(n)?a=n(i):a=t.renderDefaultTraveller(i),a}},{key:"getDerivedStateFromProps",value:function(n,i){var a=n.data,o=n.width,u=n.x,c=n.travellerWidth,s=n.updateId,f=n.startIndex,l=n.endIndex;if(a!==i.prevData||s!==i.prevUpdateId)return Qs({prevData:a,prevTravellerWidth:c,prevUpdateId:s,prevX:u,prevWidth:o},a&&a.length?oR({data:a,width:o,x:u,travellerWidth:c,startIndex:f,endIndex:l}):{scale:null,scaleValues:null});if(i.scale&&(o!==i.prevWidth||u!==i.prevX||c!==i.prevTravellerWidth)){i.scale.range([u,u+o-c]);var h=i.scale.domain().map(function(d){return i.scale(d)});return{prevData:a,prevTravellerWidth:c,prevUpdateId:s,prevX:u,prevWidth:o,startX:i.scale(n.startIndex),endX:i.scale(n.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(n,i){for(var a=n.length,o=0,u=a-1;u-o>1;){var c=Math.floor((o+u)/2);n[c]>i?u=c:o=c}return i>=n[u]?u:o}}])})(N.PureComponent);Fe(qr,"displayName","Brush");Fe(qr,"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 el,tb;function uR(){if(tb)return el;tb=1;var e=nh();function t(r,n){var i;return e(r,function(a,o,u){return i=n(a,o,u),!i}),!!i}return el=t,el}var tl,rb;function cR(){if(rb)return tl;rb=1;var e=b0(),t=ht(),r=uR(),n=qe(),i=La();function a(o,u,c){var s=n(o)?e:r;return c&&i(o,u,c)&&(u=void 0),s(o,t(u,3))}return tl=a,tl}var sR=cR();const lR=oe(sR);var ct=function(t,r){var n=t.alwaysShow,i=t.ifOverflow;return n&&(i="extendDomain"),i===r},rl,nb;function fR(){if(nb)return rl;nb=1;var e=N0();function t(r,n,i){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[n]=i}return rl=t,rl}var nl,ib;function hR(){if(ib)return nl;ib=1;var e=fR(),t=R0(),r=ht();function n(i,a){var o={};return a=r(a,3),t(i,function(u,c,s){e(o,c,a(u,c,s))}),o}return nl=n,nl}var pR=hR();const dR=oe(pR);var il,ab;function vR(){if(ab)return il;ab=1;function e(t,r){for(var n=-1,i=t==null?0:t.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function AR(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function SR(e,t){var r=e.x,n=e.y,i=_R(e,bR),a="".concat(r),o=parseInt(a,10),u="".concat(n),c=parseInt(u,10),s="".concat(t.height||i.height),f=parseInt(s,10),l="".concat(t.width||i.width),h=parseInt(l,10);return pn(pn(pn(pn(pn({},t),i),o?{x:o}:{}),c?{y:c}:{}),{},{height:f,width:h,name:t.name,radius:t.radius})}function sb(e){return S.createElement(mw,gf({shapeType:"rectangle",propTransformer:SR,activeClassName:"recharts-active-bar"},e))}var PR=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,i){if(typeof t=="number")return t;var a=q(n)||YO(n);return a?t(n,i):(a||Qt(!1),r)}},TR=["value","background"],Sw;function Lr(e){"@babel/helpers - typeof";return Lr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lr(e)}function ER(e,t){if(e==null)return{};var r=jR(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function jR(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function ma(){return ma=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs($)0&&Math.abs(C)0&&(j=Math.min((fe||0)-(C[ye-1]||0),j))}),Number.isFinite(j)){var $=j/E,k=v.layout==="vertical"?n.height:n.width;if(v.padding==="gap"&&(_=$*k/2),v.padding==="no-gap"){var R=Ie(t.barCategoryGap,$*k),L=$*k/2;_=L-R-(L-R)/k*R}}}i==="xAxis"?A=[n.left+(w.left||0)+(_||0),n.left+n.width-(w.right||0)-(_||0)]:i==="yAxis"?A=c==="horizontal"?[n.top+n.height-(w.bottom||0),n.top+(w.top||0)]:[n.top+(w.top||0)+(_||0),n.top+n.height-(w.bottom||0)-(_||0)]:A=v.range,m&&(A=[A[1],A[0]]);var B=Xx(v,a,h),U=B.scale,G=B.realScaleType;U.domain(g).range(A),Yx(U);var W=Zx(U,tt(tt({},v),{},{realScaleType:G}));i==="xAxis"?(P=p==="top"&&!O||p==="bottom"&&O,T=n.left,M=l[b]-P*v.height):i==="yAxis"&&(P=p==="left"&&!O||p==="right"&&O,T=l[b]-P*v.width,M=n.top);var V=tt(tt(tt({},v),W),{},{realScaleType:G,x:T,y:M,scale:U,width:i==="xAxis"?n.width:v.width,height:i==="yAxis"?n.height:v.height});return V.bandSize=ta(V,W),!v.hide&&i==="xAxis"?l[b]+=(P?-1:1)*V.height:v.hide||(l[b]+=(P?-1:1)*V.width),tt(tt({},d),{},io({},y,V))},{})},Mw=function(t,r){var n=t.x,i=t.y,a=r.x,o=r.y;return{x:Math.min(n,a),y:Math.min(i,o),width:Math.abs(a-n),height:Math.abs(o-i)}},BR=function(t){var r=t.x1,n=t.y1,i=t.x2,a=t.y2;return Mw({x:r,y:n},{x:i,y:a})},$w=(function(){function e(t){NR(this,e),this.scale=t}return qR(e,[{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(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.bandAware,a=n.position;if(r!==void 0){if(a)switch(a){case"start":return this.scale(r);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+o}case"end":{var u=this.bandwidth?this.bandwidth():0;return this.scale(r)+u}default:return this.scale(r)}if(i){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+c}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),i=n[0],a=n[n.length-1];return i<=a?r>=i&&r<=a:r>=a&&r<=i}}],[{key:"create",value:function(r){return new e(r)}}])})();io($w,"EPS",1e-4);var Ih=function(t){var r=Object.keys(t).reduce(function(n,i){return tt(tt({},n),{},io({},i,$w.create(t[i])))},{});return tt(tt({},r),{},{apply:function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=a.bandAware,u=a.position;return dR(i,function(c,s){return r[s].apply(c,{bandAware:o,position:u})})},isInRange:function(i){return Aw(i,function(a,o){return r[o].isInRange(a)})}})};function FR(e){return(e%180+180)%180}var WR=function(t){var r=t.width,n=t.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=FR(i),o=a*Math.PI/180,u=Math.atan(n/r),c=o>u&&o-1?c[s?a[f]:f]:void 0}}return ul=n,ul}var cl,vb;function UR(){if(vb)return cl;vb=1;var e=xw();function t(r){var n=e(r),i=n%1;return n===n?i?n-i:n:0}return cl=t,cl}var sl,yb;function HR(){if(yb)return sl;yb=1;var e=M0(),t=ht(),r=UR(),n=Math.max;function i(a,o,u){var c=a==null?0:a.length;if(!c)return-1;var s=u==null?0:r(u);return s<0&&(s=n(c+s,0)),e(a,t(o,3),s)}return sl=i,sl}var ll,mb;function KR(){if(mb)return ll;mb=1;var e=zR(),t=HR(),r=e(t);return ll=r,ll}var GR=KR();const VR=oe(GR);var XR=Kb();const YR=oe(XR);var ZR=YR(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),kh=N.createContext(void 0),Rh=N.createContext(void 0),Cw=N.createContext(void 0),Iw=N.createContext({}),kw=N.createContext(void 0),Rw=N.createContext(0),Dw=N.createContext(0),gb=function(t){var r=t.state,n=r.xAxisMap,i=r.yAxisMap,a=r.offset,o=t.clipPathId,u=t.children,c=t.width,s=t.height,f=ZR(a);return S.createElement(kh.Provider,{value:n},S.createElement(Rh.Provider,{value:i},S.createElement(Iw.Provider,{value:a},S.createElement(Cw.Provider,{value:f},S.createElement(kw.Provider,{value:o},S.createElement(Rw.Provider,{value:s},S.createElement(Dw.Provider,{value:c},u)))))))},JR=function(){return N.useContext(kw)},Nw=function(t){var r=N.useContext(kh);r==null&&Qt(!1);var n=r[t];return n==null&&Qt(!1),n},QR=function(){var t=N.useContext(kh);return Mt(t)},eD=function(){var t=N.useContext(Rh),r=VR(t,function(n){return Aw(n.domain,Number.isFinite)});return r||Mt(t)},qw=function(t){var r=N.useContext(Rh);r==null&&Qt(!1);var n=r[t];return n==null&&Qt(!1),n},tD=function(){var t=N.useContext(Cw);return t},rD=function(){return N.useContext(Iw)},Dh=function(){return N.useContext(Dw)},Nh=function(){return N.useContext(Rw)};function Br(e){"@babel/helpers - typeof";return Br=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Br(e)}function nD(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function iD(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);re*i)return!1;var a=r();return e*(t-e*a/2-n)>=0&&e*(t+e*a/2-i)<=0}function LD(e,t){return Hw(e,t+1)}function BD(e,t,r,n,i){for(var a=(n||[]).slice(),o=t.start,u=t.end,c=0,s=1,f=o,l=function(){var y=n?.[c];if(y===void 0)return{v:Hw(n,s)};var v=c,p,g=function(){return p===void 0&&(p=r(y,v)),p},x=y.coordinate,w=c===0||Oa(e,x,g,f,u);w||(c=0,f=o,s+=1),w&&(f=x+e*(g()/2+i),c+=s)},h;s<=a.length;)if(h=l(),h)return h.v;return[]}function ri(e){"@babel/helpers - typeof";return ri=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ri(e)}function Pb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Me(e){for(var t=1;t0?d.coordinate-p*e:d.coordinate})}else a[h]=d=Me(Me({},d),{},{tickCoord:d.coordinate});var g=Oa(e,d.tickCoord,v,u,c);g&&(c=d.tickCoord-e*(v()/2+i),a[h]=Me(Me({},d),{},{isShow:!0}))},f=o-1;f>=0;f--)s(f);return a}function HD(e,t,r,n,i,a){var o=(n||[]).slice(),u=o.length,c=t.start,s=t.end;if(a){var f=n[u-1],l=r(f,u-1),h=e*(f.coordinate+e*l/2-s);o[u-1]=f=Me(Me({},f),{},{tickCoord:h>0?f.coordinate-h*e:f.coordinate});var d=Oa(e,f.tickCoord,function(){return l},c,s);d&&(s=f.tickCoord-e*(l/2+i),o[u-1]=Me(Me({},f),{},{isShow:!0}))}for(var y=a?u-1:u,v=function(x){var w=o[x],O,m=function(){return O===void 0&&(O=r(w,x)),O};if(x===0){var b=e*(w.coordinate-e*m()/2-c);o[x]=w=Me(Me({},w),{},{tickCoord:b<0?w.coordinate-b*e:w.coordinate})}else o[x]=w=Me(Me({},w),{},{tickCoord:w.coordinate});var _=Oa(e,w.tickCoord,m,c,s);_&&(c=w.tickCoord+e*(m()/2+i),o[x]=Me(Me({},w),{},{isShow:!0}))},p=0;p=2?Ce(i[1].coordinate-i[0].coordinate):1,g=qD(a,p,d);return c==="equidistantPreserveStart"?BD(p,g,v,i,o):(c==="preserveStart"||c==="preserveStartEnd"?h=HD(p,g,v,i,o,c==="preserveStartEnd"):h=UD(p,g,v,i,o),h.filter(function(x){return x.isShow}))}var KD=["viewBox"],GD=["viewBox"],VD=["ticks"];function zr(e){"@babel/helpers - typeof";return zr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zr(e)}function gr(){return gr=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function XD(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function YD(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Eb(e,t){for(var r=0;r0?c(this.props):c(d)),o<=0||u<=0||!y||!y.length?null:S.createElement(te,{className:J("recharts-cartesian-axis",s),ref:function(p){n.layerReference=p}},a&&this.renderAxisLine(),this.renderTicks(y,this.state.fontSize,this.state.letterSpacing),Te.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,i,a){var o,u=J(i.className,"recharts-cartesian-axis-tick-value");return S.isValidElement(n)?o=S.cloneElement(n,we(we({},i),{},{className:u})):X(n)?o=n(we(we({},i),{},{className:u})):o=S.createElement(rr,gr({},i,{className:"recharts-cartesian-axis-tick-value"}),a),o}}])})(N.Component);Fh(nn,"displayName","CartesianAxis");Fh(nn,"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 nN=["x1","y1","x2","y2","key"],iN=["offset"];function ir(e){"@babel/helpers - typeof";return ir=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ir(e)}function jb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function $e(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function cN(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var sN=function(t){var r=t.fill;if(!r||r==="none")return null;var n=t.fillOpacity,i=t.x,a=t.y,o=t.width,u=t.height,c=t.ry;return S.createElement("rect",{x:i,y:a,ry:c,width:o,height:u,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function Vw(e,t){var r;if(S.isValidElement(e))r=S.cloneElement(e,t);else if(X(e))r=e(t);else{var n=t.x1,i=t.y1,a=t.x2,o=t.y2,u=t.key,c=Mb(t,nN),s=H(c,!1);s.offset;var f=Mb(s,iN);r=S.createElement("line",Yt({},f,{x1:n,y1:i,x2:a,y2:o,fill:"none",key:u}))}return r}function lN(e){var t=e.x,r=e.width,n=e.horizontal,i=n===void 0?!0:n,a=e.horizontalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(u,c){var s=$e($e({},e),{},{x1:t,y1:u,x2:t+r,y2:u,key:"line-".concat(c),index:c});return Vw(i,s)});return S.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function fN(e){var t=e.y,r=e.height,n=e.vertical,i=n===void 0?!0:n,a=e.verticalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(u,c){var s=$e($e({},e),{},{x1:u,y1:t,x2:u,y2:t+r,key:"line-".concat(c),index:c});return Vw(i,s)});return S.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function hN(e){var t=e.horizontalFill,r=e.fillOpacity,n=e.x,i=e.y,a=e.width,o=e.height,u=e.horizontalPoints,c=e.horizontal,s=c===void 0?!0:c;if(!s||!t||!t.length)return null;var f=u.map(function(h){return Math.round(h+i-i)}).sort(function(h,d){return h-d});i!==f[0]&&f.unshift(0);var l=f.map(function(h,d){var y=!f[d+1],v=y?i+o-h:f[d+1]-h;if(v<=0)return null;var p=d%t.length;return S.createElement("rect",{key:"react-".concat(d),y:h,x:n,height:v,width:a,stroke:"none",fill:t[p],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return S.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},l)}function pN(e){var t=e.vertical,r=t===void 0?!0:t,n=e.verticalFill,i=e.fillOpacity,a=e.x,o=e.y,u=e.width,c=e.height,s=e.verticalPoints;if(!r||!n||!n.length)return null;var f=s.map(function(h){return Math.round(h+a-a)}).sort(function(h,d){return h-d});a!==f[0]&&f.unshift(0);var l=f.map(function(h,d){var y=!f[d+1],v=y?a+u-h:f[d+1]-h;if(v<=0)return null;var p=d%n.length;return S.createElement("rect",{key:"react-".concat(d),x:h,y:o,width:v,height:c,stroke:"none",fill:n[p],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return S.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},l)}var dN=function(t,r){var n=t.xAxis,i=t.width,a=t.height,o=t.offset;return Vx(Bh($e($e($e({},nn.defaultProps),n),{},{ticks:gt(n,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.left,o.left+o.width,r)},vN=function(t,r){var n=t.yAxis,i=t.width,a=t.height,o=t.offset;return Vx(Bh($e($e($e({},nn.defaultProps),n),{},{ticks:gt(n,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.top,o.top+o.height,r)},pr={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function yN(e){var t,r,n,i,a,o,u=Dh(),c=Nh(),s=rD(),f=$e($e({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:pr.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:pr.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:pr.horizontal,horizontalFill:(i=e.horizontalFill)!==null&&i!==void 0?i:pr.horizontalFill,vertical:(a=e.vertical)!==null&&a!==void 0?a:pr.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:pr.verticalFill,x:q(e.x)?e.x:s.left,y:q(e.y)?e.y:s.top,width:q(e.width)?e.width:s.width,height:q(e.height)?e.height:s.height}),l=f.x,h=f.y,d=f.width,y=f.height,v=f.syncWithTicks,p=f.horizontalValues,g=f.verticalValues,x=QR(),w=eD();if(!q(d)||d<=0||!q(y)||y<=0||!q(l)||l!==+l||!q(h)||h!==+h)return null;var O=f.verticalCoordinatesGenerator||dN,m=f.horizontalCoordinatesGenerator||vN,b=f.horizontalPoints,_=f.verticalPoints;if((!b||!b.length)&&X(m)){var A=p&&p.length,T=m({yAxis:w?$e($e({},w),{},{ticks:A?p:w.ticks}):void 0,width:u,height:c,offset:s},A?!0:v);it(Array.isArray(T),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(ir(T),"]")),Array.isArray(T)&&(b=T)}if((!_||!_.length)&&X(O)){var M=g&&g.length,P=O({xAxis:x?$e($e({},x),{},{ticks:M?g:x.ticks}):void 0,width:u,height:c,offset:s},M?!0:v);it(Array.isArray(P),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(ir(P),"]")),Array.isArray(P)&&(_=P)}return S.createElement("g",{className:"recharts-cartesian-grid"},S.createElement(sN,{fill:f.fill,fillOpacity:f.fillOpacity,x:f.x,y:f.y,width:f.width,height:f.height,ry:f.ry}),S.createElement(lN,Yt({},f,{offset:s,horizontalPoints:b,xAxis:x,yAxis:w})),S.createElement(fN,Yt({},f,{offset:s,verticalPoints:_,xAxis:x,yAxis:w})),S.createElement(hN,Yt({},f,{horizontalPoints:b})),S.createElement(pN,Yt({},f,{verticalPoints:_})))}yN.displayName="CartesianGrid";var mN=["type","layout","connectNulls","ref"],gN=["key"];function Ur(e){"@babel/helpers - typeof";return Ur=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ur(e)}function $b(e,t){if(e==null)return{};var r=bN(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function bN(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function _n(){return _n=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);rl){d=[].concat(dr(c.slice(0,y)),[l-v]);break}var p=d.length%2===0?[0,h]:[h];return[].concat(dr(t.repeat(c,f)),dr(d),p).map(function(g){return"".concat(g,"px")}).join(", ")}),rt(r,"id",Zr("recharts-line-")),rt(r,"pathRef",function(o){r.mainCurve=o}),rt(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),rt(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return jN(t,e),SN(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.points,u=a.xAxis,c=a.yAxis,s=a.layout,f=a.children,l=Ke(f,pi);if(!l)return null;var h=function(v,p){return{x:v.x,y:v.y,value:v.value,errorVal:_e(v.payload,p)}},d={clipPath:n?"url(#clipPath-".concat(i,")"):null};return S.createElement(te,d,l.map(function(y){return S.cloneElement(y,{key:"bar-".concat(y.props.dataKey),data:o,xAxis:u,yAxis:c,layout:s,dataPointFormatter:h})}))}},{key:"renderDots",value:function(n,i,a){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var u=this.props,c=u.dot,s=u.points,f=u.dataKey,l=H(this.props,!1),h=H(c,!0),d=s.map(function(v,p){var g=Be(Be(Be({key:"dot-".concat(p),r:3},l),h),{},{index:p,cx:v.x,cy:v.y,value:v.value,dataKey:f,payload:v.payload,points:s});return t.renderDotItem(c,g)}),y={clipPath:n?"url(#clipPath-".concat(i?"":"dots-").concat(a,")"):null};return S.createElement(te,_n({className:"recharts-line-dots",key:"dots"},y),d)}},{key:"renderCurveStatically",value:function(n,i,a,o){var u=this.props,c=u.type,s=u.layout,f=u.connectNulls;u.ref;var l=$b(u,mN),h=Be(Be(Be({},H(l,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(a,")"):null,points:n},o),{},{type:c,layout:s,connectNulls:f});return S.createElement(ia,_n({},h,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,i){var a=this,o=this.props,u=o.points,c=o.strokeDasharray,s=o.isAnimationActive,f=o.animationBegin,l=o.animationDuration,h=o.animationEasing,d=o.animationId,y=o.animateNewValues,v=o.width,p=o.height,g=this.state,x=g.prevPoints,w=g.totalLength;return S.createElement(lt,{begin:f,duration:l,isActive:s,easing:h,from:{t:0},to:{t:1},key:"line-".concat(d),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(O){var m=O.t;if(x){var b=x.length/u.length,_=u.map(function(E,j){var C=Math.floor(j*b);if(x[C]){var $=x[C],k=ze($.x,E.x),R=ze($.y,E.y);return Be(Be({},E),{},{x:k(m),y:R(m)})}if(y){var L=ze(v*2,E.x),B=ze(p/2,E.y);return Be(Be({},E),{},{x:L(m),y:B(m)})}return Be(Be({},E),{},{x:E.x,y:E.y})});return a.renderCurveStatically(_,n,i)}var A=ze(0,w),T=A(m),M;if(c){var P="".concat(c).split(/[,\s]+/gim).map(function(E){return parseFloat(E)});M=a.getStrokeDasharray(T,w,P)}else M=a.generateSimpleStrokeDasharray(w,T);return a.renderCurveStatically(u,n,i,{strokeDasharray:M})})}},{key:"renderCurve",value:function(n,i){var a=this.props,o=a.points,u=a.isAnimationActive,c=this.state,s=c.prevPoints,f=c.totalLength;return u&&o&&o.length&&(!s&&f>0||!hi(s,o))?this.renderCurveWithAnimation(n,i):this.renderCurveStatically(o,n,i)}},{key:"render",value:function(){var n,i=this.props,a=i.hide,o=i.dot,u=i.points,c=i.className,s=i.xAxis,f=i.yAxis,l=i.top,h=i.left,d=i.width,y=i.height,v=i.isAnimationActive,p=i.id;if(a||!u||!u.length)return null;var g=this.state.isAnimationFinished,x=u.length===1,w=J("recharts-line",c),O=s&&s.allowDataOverflow,m=f&&f.allowDataOverflow,b=O||m,_=Y(p)?this.id:p,A=(n=H(o,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},T=A.r,M=T===void 0?3:T,P=A.strokeWidth,E=P===void 0?2:P,j=c_(o)?o:{},C=j.clipDot,$=C===void 0?!0:C,k=M*2+E;return S.createElement(te,{className:w},O||m?S.createElement("defs",null,S.createElement("clipPath",{id:"clipPath-".concat(_)},S.createElement("rect",{x:O?h:h-d/2,y:m?l:l-y/2,width:O?d:d*2,height:m?y:y*2})),!$&&S.createElement("clipPath",{id:"clipPath-dots-".concat(_)},S.createElement("rect",{x:h-k/2,y:l-k/2,width:d+k,height:y+k}))):null,!x&&this.renderCurve(b,_),this.renderErrorBar(b,_),(x||o)&&this.renderDots(b,$,_),(!v||g)&&wt.renderCallByParent(this.props,u))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:i.curPoints}:n.points!==i.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,i){for(var a=n.length%2!==0?[].concat(dr(n),[0]):n,o=[],u=0;ue.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function b2(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function x2(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w2(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0?o:t&&t.length&&q(i)&&q(a)?t.slice(i,a+1):[]};function sO(e){return e==="number"?[0,"auto"]:void 0}var Nf=function(t,r,n,i){var a=t.graphicalItems,o=t.tooltipAxis,u=ho(r,t);return n<0||!a||!a.length||n>=u.length?null:a.reduce(function(c,s){var f,l=(f=s.props.data)!==null&&f!==void 0?f:r;l&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(l=l.slice(t.dataStartIndex,t.dataEndIndex+1));var h;if(o.dataKey&&!o.allowDuplicatedCategory){var d=l===void 0?u:l;h=Mi(d,o.dataKey,i)}else h=l&&l[n]||u[n];return h?[].concat(Vr(c),[Qx(s,h)]):c},[])},Bb=function(t,r,n,i){var a=i||{x:t.chartX,y:t.chartY},o=I2(a,n),u=t.orderedTooltipTicks,c=t.tooltipAxis,s=t.tooltipTicks,f=iM(o,u,s,c);if(f>=0&&s){var l=s[f]&&s[f].value,h=Nf(t,r,f,l),d=k2(n,u,f,a);return{activeTooltipIndex:f,activeLabel:l,activePayload:h,activeCoordinate:d}}return null},R2=function(t,r){var n=r.axes,i=r.graphicalItems,a=r.axisType,o=r.axisIdKey,u=r.stackGroups,c=r.dataStartIndex,s=r.dataEndIndex,f=t.layout,l=t.children,h=t.stackOffset,d=Gx(f,a);return n.reduce(function(y,v){var p,g=v.type.defaultProps!==void 0?I(I({},v.type.defaultProps),v.props):v.props,x=g.type,w=g.dataKey,O=g.allowDataOverflow,m=g.allowDuplicatedCategory,b=g.scale,_=g.ticks,A=g.includeHidden,T=g[o];if(y[T])return y;var M=ho(t.data,{graphicalItems:i.filter(function(W){var V,fe=o in W.props?W.props[o]:(V=W.type.defaultProps)===null||V===void 0?void 0:V[o];return fe===T}),dataStartIndex:c,dataEndIndex:s}),P=M.length,E,j,C;u2(g.domain,O,x)&&(E=Yl(g.domain,null,O),d&&(x==="number"||b!=="auto")&&(C=bn(M,w,"category")));var $=sO(x);if(!E||E.length===0){var k,R=(k=g.domain)!==null&&k!==void 0?k:$;if(w){if(E=bn(M,w,x),x==="category"&&d){var L=JO(E);m&&L?(j=E,E=da(0,P)):m||(E=Lm(R,E,v).reduce(function(W,V){return W.indexOf(V)>=0?W:[].concat(Vr(W),[V])},[]))}else if(x==="category")m?E=E.filter(function(W){return W!==""&&!Y(W)}):E=Lm(R,E,v).reduce(function(W,V){return W.indexOf(V)>=0||V===""||Y(V)?W:[].concat(Vr(W),[V])},[]);else if(x==="number"){var B=sM(M,i.filter(function(W){var V,fe,ye=o in W.props?W.props[o]:(V=W.type.defaultProps)===null||V===void 0?void 0:V[o],Le="hide"in W.props?W.props.hide:(fe=W.type.defaultProps)===null||fe===void 0?void 0:fe.hide;return ye===T&&(A||!Le)}),w,a,f);B&&(E=B)}d&&(x==="number"||b!=="auto")&&(C=bn(M,w,"category"))}else d?E=da(0,P):u&&u[T]&&u[T].hasStack&&x==="number"?E=h==="expand"?[0,1]:Jx(u[T].stackGroups,c,s):E=Kx(M,i.filter(function(W){var V=o in W.props?W.props[o]:W.type.defaultProps[o],fe="hide"in W.props?W.props.hide:W.type.defaultProps.hide;return V===T&&(A||!fe)}),x,f,!0);if(x==="number")E=kf(l,E,T,a,_),R&&(E=Yl(R,E,O));else if(x==="category"&&R){var U=R,G=E.every(function(W){return U.indexOf(W)>=0});G&&(E=U)}}return I(I({},y),{},K({},T,I(I({},g),{},{axisType:a,domain:E,categoricalDomain:C,duplicateDomain:j,originalDomain:(p=g.domain)!==null&&p!==void 0?p:$,isCategorical:d,layout:f})))},{})},D2=function(t,r){var n=r.graphicalItems,i=r.Axis,a=r.axisType,o=r.axisIdKey,u=r.stackGroups,c=r.dataStartIndex,s=r.dataEndIndex,f=t.layout,l=t.children,h=ho(t.data,{graphicalItems:n,dataStartIndex:c,dataEndIndex:s}),d=h.length,y=Gx(f,a),v=-1;return n.reduce(function(p,g){var x=g.type.defaultProps!==void 0?I(I({},g.type.defaultProps),g.props):g.props,w=x[o],O=sO("number");if(!p[w]){v++;var m;return y?m=da(0,d):u&&u[w]&&u[w].hasStack?(m=Jx(u[w].stackGroups,c,s),m=kf(l,m,w,a)):(m=Yl(O,Kx(h,n.filter(function(b){var _,A,T=o in b.props?b.props[o]:(_=b.type.defaultProps)===null||_===void 0?void 0:_[o],M="hide"in b.props?b.props.hide:(A=b.type.defaultProps)===null||A===void 0?void 0:A.hide;return T===w&&!M}),"number",f),i.defaultProps.allowDataOverflow),m=kf(l,m,w,a)),I(I({},p),{},K({},w,I(I({axisType:a},i.defaultProps),{},{hide:!0,orientation:He($2,"".concat(a,".").concat(v%2),null),domain:m,originalDomain:O,isCategorical:y,layout:f})))}return p},{})},N2=function(t,r){var n=r.axisType,i=n===void 0?"xAxis":n,a=r.AxisComp,o=r.graphicalItems,u=r.stackGroups,c=r.dataStartIndex,s=r.dataEndIndex,f=t.children,l="".concat(i,"Id"),h=Ke(f,a),d={};return h&&h.length?d=R2(t,{axes:h,graphicalItems:o,axisType:i,axisIdKey:l,stackGroups:u,dataStartIndex:c,dataEndIndex:s}):o&&o.length&&(d=D2(t,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:l,stackGroups:u,dataStartIndex:c,dataEndIndex:s})),d},q2=function(t){var r=Mt(t),n=gt(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:ih(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:ta(r,n)}},Fb=function(t){var r=t.children,n=t.defaultShowTooltip,i=We(r,qr),a=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},L2=function(t){return!t||!t.length?!1:t.some(function(r){var n=bt(r&&r.type);return n&&n.indexOf("Bar")>=0})},Wb=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},B2=function(t,r){var n=t.props,i=t.graphicalItems,a=t.xAxisMap,o=a===void 0?{}:a,u=t.yAxisMap,c=u===void 0?{}:u,s=n.width,f=n.height,l=n.children,h=n.margin||{},d=We(l,qr),y=We(l,wr),v=Object.keys(c).reduce(function(m,b){var _=c[b],A=_.orientation;return!_.mirror&&!_.hide?I(I({},m),{},K({},A,m[A]+_.width)):m},{left:h.left||0,right:h.right||0}),p=Object.keys(o).reduce(function(m,b){var _=o[b],A=_.orientation;return!_.mirror&&!_.hide?I(I({},m),{},K({},A,He(m,"".concat(A))+_.height)):m},{top:h.top||0,bottom:h.bottom||0}),g=I(I({},p),v),x=g.bottom;d&&(g.bottom+=d.props.height||qr.defaultProps.height),y&&r&&(g=uM(g,i,n,r));var w=s-g.left-g.right,O=f-g.top-g.bottom;return I(I({brushBottom:x},g),{},{width:Math.max(w,0),height:Math.max(O,0)})},F2=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},Wh=function(t){var r=t.chartName,n=t.GraphicalChild,i=t.defaultTooltipEventType,a=i===void 0?"axis":i,o=t.validateTooltipEventTypes,u=o===void 0?["axis"]:o,c=t.axisComponents,s=t.legendContent,f=t.formatAxisMap,l=t.defaultProps,h=function(g,x){var w=x.graphicalItems,O=x.stackGroups,m=x.offset,b=x.updateId,_=x.dataStartIndex,A=x.dataEndIndex,T=g.barSize,M=g.layout,P=g.barGap,E=g.barCategoryGap,j=g.maxBarSize,C=Wb(M),$=C.numericAxisName,k=C.cateAxisName,R=L2(w),L=[];return w.forEach(function(B,U){var G=ho(g.data,{graphicalItems:[B],dataStartIndex:_,dataEndIndex:A}),W=B.type.defaultProps!==void 0?I(I({},B.type.defaultProps),B.props):B.props,V=W.dataKey,fe=W.maxBarSize,ye=W["".concat($,"Id")],Le=W["".concat(k,"Id")],qt={},Re=c.reduce(function(Lt,Bt){var po=x["".concat(Bt.axisType,"Map")],zh=W["".concat(Bt.axisType,"Id")];po&&po[zh]||Bt.axisType==="zAxis"||Qt(!1);var Uh=po[zh];return I(I({},Lt),{},K(K({},Bt.axisType,Uh),"".concat(Bt.axisType,"Ticks"),gt(Uh)))},qt),F=Re[k],Z=Re["".concat(k,"Ticks")],Q=O&&O[ye]&&O[ye].hasStack&&gM(B,O[ye].stackGroups),D=bt(B.type).indexOf("Bar")>=0,de=ta(F,Z),ee=[],be=R&&aM({barSize:T,stackGroups:O,totalSize:F2(Re,k)});if(D){var xe,De,Et=Y(fe)?j:fe,lr=(xe=(De=ta(F,Z,!0))!==null&&De!==void 0?De:Et)!==null&&xe!==void 0?xe:0;ee=oM({barGap:P,barCategoryGap:E,bandSize:lr!==de?lr:de,sizeList:be[Le],maxBarSize:Et}),lr!==de&&(ee=ee.map(function(Lt){return I(I({},Lt),{},{position:I(I({},Lt.position),{},{offset:Lt.position.offset-lr/2})})}))}var di=B&&B.type&&B.type.getComposedData;di&&L.push({props:I(I({},di(I(I({},Re),{},{displayedData:G,props:g,dataKey:V,item:B,bandSize:de,barPosition:ee,offset:m,stackedData:Q,layout:M,dataStartIndex:_,dataEndIndex:A}))),{},K(K(K({key:B.key||"item-".concat(U)},$,Re[$]),k,Re[k]),"animationId",b)),childIndex:f_(B,g.children),item:B})}),L},d=function(g,x){var w=g.props,O=g.dataStartIndex,m=g.dataEndIndex,b=g.updateId;if(!Qp({props:w}))return null;var _=w.children,A=w.layout,T=w.stackOffset,M=w.data,P=w.reverseStackOrder,E=Wb(A),j=E.numericAxisName,C=E.cateAxisName,$=Ke(_,n),k=yM(M,$,"".concat(j,"Id"),"".concat(C,"Id"),T,P),R=c.reduce(function(W,V){var fe="".concat(V.axisType,"Map");return I(I({},W),{},K({},fe,N2(w,I(I({},V),{},{graphicalItems:$,stackGroups:V.axisType===j&&k,dataStartIndex:O,dataEndIndex:m}))))},{}),L=B2(I(I({},R),{},{props:w,graphicalItems:$}),x?.legendBBox);Object.keys(R).forEach(function(W){R[W]=f(w,R[W],L,W.replace("Map",""),r)});var B=R["".concat(C,"Map")],U=q2(B),G=h(w,I(I({},R),{},{dataStartIndex:O,dataEndIndex:m,updateId:b,graphicalItems:$,stackGroups:k,offset:L}));return I(I({formattedGraphicalItems:G,graphicalItems:$,offset:L,stackGroups:k},U),R)},y=(function(p){function g(x){var w,O,m;return x2(this,g),m=_2(this,g,[x]),K(m,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),K(m,"accessibilityManager",new o2),K(m,"handleLegendBBoxUpdate",function(b){if(b){var _=m.state,A=_.dataStartIndex,T=_.dataEndIndex,M=_.updateId;m.setState(I({legendBBox:b},d({props:m.props,dataStartIndex:A,dataEndIndex:T,updateId:M},I(I({},m.state),{},{legendBBox:b}))))}}),K(m,"handleReceiveSyncEvent",function(b,_,A){if(m.props.syncId===b){if(A===m.eventEmitterSymbol&&typeof m.props.syncMethod!="function")return;m.applySyncEvent(_)}}),K(m,"handleBrushChange",function(b){var _=b.startIndex,A=b.endIndex;if(_!==m.state.dataStartIndex||A!==m.state.dataEndIndex){var T=m.state.updateId;m.setState(function(){return I({dataStartIndex:_,dataEndIndex:A},d({props:m.props,dataStartIndex:_,dataEndIndex:A,updateId:T},m.state))}),m.triggerSyncEvent({dataStartIndex:_,dataEndIndex:A})}}),K(m,"handleMouseEnter",function(b){var _=m.getMouseInfo(b);if(_){var A=I(I({},_),{},{isTooltipActive:!0});m.setState(A),m.triggerSyncEvent(A);var T=m.props.onMouseEnter;X(T)&&T(A,b)}}),K(m,"triggeredAfterMouseMove",function(b){var _=m.getMouseInfo(b),A=_?I(I({},_),{},{isTooltipActive:!0}):{isTooltipActive:!1};m.setState(A),m.triggerSyncEvent(A);var T=m.props.onMouseMove;X(T)&&T(A,b)}),K(m,"handleItemMouseEnter",function(b){m.setState(function(){return{isTooltipActive:!0,activeItem:b,activePayload:b.tooltipPayload,activeCoordinate:b.tooltipPosition||{x:b.cx,y:b.cy}}})}),K(m,"handleItemMouseLeave",function(){m.setState(function(){return{isTooltipActive:!1}})}),K(m,"handleMouseMove",function(b){b.persist(),m.throttleTriggeredAfterMouseMove(b)}),K(m,"handleMouseLeave",function(b){m.throttleTriggeredAfterMouseMove.cancel();var _={isTooltipActive:!1};m.setState(_),m.triggerSyncEvent(_);var A=m.props.onMouseLeave;X(A)&&A(_,b)}),K(m,"handleOuterEvent",function(b){var _=l_(b),A=He(m.props,"".concat(_));if(_&&X(A)){var T,M;/.*touch.*/i.test(_)?M=m.getMouseInfo(b.changedTouches[0]):M=m.getMouseInfo(b),A((T=M)!==null&&T!==void 0?T:{},b)}}),K(m,"handleClick",function(b){var _=m.getMouseInfo(b);if(_){var A=I(I({},_),{},{isTooltipActive:!0});m.setState(A),m.triggerSyncEvent(A);var T=m.props.onClick;X(T)&&T(A,b)}}),K(m,"handleMouseDown",function(b){var _=m.props.onMouseDown;if(X(_)){var A=m.getMouseInfo(b);_(A,b)}}),K(m,"handleMouseUp",function(b){var _=m.props.onMouseUp;if(X(_)){var A=m.getMouseInfo(b);_(A,b)}}),K(m,"handleTouchMove",function(b){b.changedTouches!=null&&b.changedTouches.length>0&&m.throttleTriggeredAfterMouseMove(b.changedTouches[0])}),K(m,"handleTouchStart",function(b){b.changedTouches!=null&&b.changedTouches.length>0&&m.handleMouseDown(b.changedTouches[0])}),K(m,"handleTouchEnd",function(b){b.changedTouches!=null&&b.changedTouches.length>0&&m.handleMouseUp(b.changedTouches[0])}),K(m,"handleDoubleClick",function(b){var _=m.props.onDoubleClick;if(X(_)){var A=m.getMouseInfo(b);_(A,b)}}),K(m,"handleContextMenu",function(b){var _=m.props.onContextMenu;if(X(_)){var A=m.getMouseInfo(b);_(A,b)}}),K(m,"triggerSyncEvent",function(b){m.props.syncId!==void 0&&pl.emit(dl,m.props.syncId,b,m.eventEmitterSymbol)}),K(m,"applySyncEvent",function(b){var _=m.props,A=_.layout,T=_.syncMethod,M=m.state.updateId,P=b.dataStartIndex,E=b.dataEndIndex;if(b.dataStartIndex!==void 0||b.dataEndIndex!==void 0)m.setState(I({dataStartIndex:P,dataEndIndex:E},d({props:m.props,dataStartIndex:P,dataEndIndex:E,updateId:M},m.state)));else if(b.activeTooltipIndex!==void 0){var j=b.chartX,C=b.chartY,$=b.activeTooltipIndex,k=m.state,R=k.offset,L=k.tooltipTicks;if(!R)return;if(typeof T=="function")$=T(L,b);else if(T==="value"){$=-1;for(var B=0;B=0){var Q,D;if(j.dataKey&&!j.allowDuplicatedCategory){var de=typeof j.dataKey=="function"?Z:"payload.".concat(j.dataKey.toString());Q=Mi(B,de,$),D=U&&G&&Mi(G,de,$)}else Q=B?.[C],D=U&&G&&G[C];if(Le||ye){var ee=b.props.activeIndex!==void 0?b.props.activeIndex:C;return[N.cloneElement(b,I(I(I({},T.props),Re),{},{activeIndex:ee})),null,null]}if(!Y(Q))return[F].concat(Vr(m.renderActivePoints({item:T,activePoint:Q,basePoint:D,childIndex:C,isRange:U})))}else{var be,xe=(be=m.getItemByXY(m.state.activeCoordinate))!==null&&be!==void 0?be:{graphicalItem:F},De=xe.graphicalItem,Et=De.item,lr=Et===void 0?b:Et,di=De.childIndex,Lt=I(I(I({},T.props),Re),{},{activeIndex:di});return[N.cloneElement(lr,Lt),null,null]}return U?[F,null,null]:[F,null]}),K(m,"renderCustomized",function(b,_,A){return N.cloneElement(b,I(I({key:"recharts-customized-".concat(A)},m.props),m.state))}),K(m,"renderMap",{CartesianGrid:{handler:Ei,once:!0},ReferenceArea:{handler:m.renderReferenceElement},ReferenceLine:{handler:Ei},ReferenceDot:{handler:m.renderReferenceElement},XAxis:{handler:Ei},YAxis:{handler:Ei},Brush:{handler:m.renderBrush,once:!0},Bar:{handler:m.renderGraphicChild},Line:{handler:m.renderGraphicChild},Area:{handler:m.renderGraphicChild},Radar:{handler:m.renderGraphicChild},RadialBar:{handler:m.renderGraphicChild},Scatter:{handler:m.renderGraphicChild},Pie:{handler:m.renderGraphicChild},Funnel:{handler:m.renderGraphicChild},Tooltip:{handler:m.renderCursor,once:!0},PolarGrid:{handler:m.renderPolarGrid,once:!0},PolarAngleAxis:{handler:m.renderPolarAxis},PolarRadiusAxis:{handler:m.renderPolarAxis},Customized:{handler:m.renderCustomized}}),m.clipPathId="".concat((w=x.id)!==null&&w!==void 0?w:Zr("recharts"),"-clip"),m.throttleTriggeredAfterMouseMove=z0(m.triggeredAfterMouseMove,(O=x.throttleDelay)!==null&&O!==void 0?O:1e3/60),m.state={},m}return P2(g,p),O2(g,[{key:"componentDidMount",value:function(){var w,O;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(w=this.props.margin.left)!==null&&w!==void 0?w:0,top:(O=this.props.margin.top)!==null&&O!==void 0?O:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var w=this.props,O=w.children,m=w.data,b=w.height,_=w.layout,A=We(O,dt);if(A){var T=A.props.defaultIndex;if(!(typeof T!="number"||T<0||T>this.state.tooltipTicks.length-1)){var M=this.state.tooltipTicks[T]&&this.state.tooltipTicks[T].value,P=Nf(this.state,m,T,M),E=this.state.tooltipTicks[T].coordinate,j=(this.state.offset.top+b)/2,C=_==="horizontal",$=C?{x:E,y:j}:{y:E,x:j},k=this.state.formattedGraphicalItems.find(function(L){var B=L.item;return B.type.name==="Scatter"});k&&($=I(I({},$),k.props.points[T].tooltipPosition),P=k.props.points[T].tooltipPayload);var R={activeTooltipIndex:T,isTooltipActive:!0,activeLabel:M,activePayload:P,activeCoordinate:$};this.setState(R),this.renderCursor(A),this.accessibilityManager.setIndex(T)}}}},{key:"getSnapshotBeforeUpdate",value:function(w,O){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==O.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==w.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==w.margin){var m,b;this.accessibilityManager.setDetails({offset:{left:(m=this.props.margin.left)!==null&&m!==void 0?m:0,top:(b=this.props.margin.top)!==null&&b!==void 0?b:0}})}return null}},{key:"componentDidUpdate",value:function(w){gl([We(w.children,dt)],[We(this.props.children,dt)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var w=We(this.props.children,dt);if(w&&typeof w.props.shared=="boolean"){var O=w.props.shared?"axis":"item";return u.indexOf(O)>=0?O:a}return a}},{key:"getMouseInfo",value:function(w){if(!this.container)return null;var O=this.container,m=O.getBoundingClientRect(),b=ZS(m),_={chartX:Math.round(w.pageX-b.left),chartY:Math.round(w.pageY-b.top)},A=m.width/O.offsetWidth||1,T=this.inRange(_.chartX,_.chartY,A);if(!T)return null;var M=this.state,P=M.xAxisMap,E=M.yAxisMap,j=this.getTooltipEventType(),C=Bb(this.state,this.props.data,this.props.layout,T);if(j!=="axis"&&P&&E){var $=Mt(P).scale,k=Mt(E).scale,R=$&&$.invert?$.invert(_.chartX):null,L=k&&k.invert?k.invert(_.chartY):null;return I(I({},_),{},{xValue:R,yValue:L},C)}return C?I(I({},_),C):null}},{key:"inRange",value:function(w,O){var m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,b=this.props.layout,_=w/m,A=O/m;if(b==="horizontal"||b==="vertical"){var T=this.state.offset,M=_>=T.left&&_<=T.left+T.width&&A>=T.top&&A<=T.top+T.height;return M?{x:_,y:A}:null}var P=this.state,E=P.angleAxisMap,j=P.radiusAxisMap;if(E&&j){var C=Mt(E);return Wm({x:_,y:A},C)}return null}},{key:"parseEventsOfWrapper",value:function(){var w=this.props.children,O=this.getTooltipEventType(),m=We(w,dt),b={};m&&O==="axis"&&(m.props.trigger==="click"?b={onClick:this.handleClick}:b={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var _=$i(this.props,this.handleOuterEvent);return I(I({},_),b)}},{key:"addListener",value:function(){pl.on(dl,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){pl.removeListener(dl,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(w,O,m){for(var b=this.state.formattedGraphicalItems,_=0,A=b.length;_=360?x:x-1)*c,O=p-x*d-w,m=i.reduce(function(A,T){var M=_e(T,g,0);return A+(q(M)?M:0)},0),b;if(m>0){var _;b=i.map(function(A,T){var M=_e(A,g,0),P=_e(A,f,T),E=(q(M)?M:0)/m,j;T?j=_.endAngle+Ce(v)*c*(M!==0?1:0):j=o;var C=j+Ce(v)*((M!==0?d:0)+E*O),$=(j+C)/2,k=(y.innerRadius+y.outerRadius)/2,R=[{name:P,value:M,payload:A,dataKey:g,type:h}],L=le(y.cx,y.cy,k,$);return _=ce(ce(ce({percent:E,cornerRadius:a,name:P,tooltipPayload:R,midAngle:$,middleRadius:k,tooltipPosition:L},A),y),{},{value:_e(A,g),startAngle:j,endAngle:C,payload:A,paddingAngle:Ce(v)*c}),_})}return ce(ce({},y),{},{sectors:b,data:i})});var Xs,Gg;function Kk(){if(Gg)return Xs;Gg=1;var e=Math.ceil,t=Math.max;function r(n,i,a,o){for(var u=-1,c=t(e((i-n)/(a||1)),0),s=Array(c);c--;)s[o?c:++u]=n,n+=a;return s}return Xs=r,Xs}var Ys,Vg;function ww(){if(Vg)return Ys;Vg=1;var e=z0(),t=1/0,r=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var a=i<0?-1:1;return a*r}return i===i?i:0}return Ys=n,Ys}var Zs,Xg;function Gk(){if(Xg)return Zs;Xg=1;var e=Kk(),t=La(),r=ww();function n(i){return function(a,o,u){return u&&typeof u!="number"&&t(a,o,u)&&(o=u=void 0),a=r(a),o===void 0?(o=a,a=0):o=r(o),u=u===void 0?a0&&n.handleDrag(i.changedTouches[0])}),Fe(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=n.props,a=i.endIndex,o=i.onDragEnd,u=i.startIndex;o?.({endIndex:a,startIndex:u})}),n.detachDragEndListener()}),Fe(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),Fe(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),Fe(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),Fe(n,"handleSlideDragStart",function(i){var a=tb(i)?i.changedTouches[0]:i;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:a.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return aR(t,e),tR(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var i=n.startX,a=n.endX,o=this.state.scaleValues,u=this.props,c=u.gap,s=u.data,f=s.length-1,l=Math.min(i,a),h=Math.max(i,a),d=t.getIndexInRange(o,l),y=t.getIndexInRange(o,h);return{startIndex:d-d%c,endIndex:y===f?f:y-y%c}}},{key:"getTextOfTick",value:function(n){var i=this.props,a=i.data,o=i.tickFormatter,u=i.dataKey,c=_e(a[n],u,n);return X(o)?o(c,n):c}},{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(n){var i=this.state,a=i.slideMoveStartX,o=i.startX,u=i.endX,c=this.props,s=c.x,f=c.width,l=c.travellerWidth,h=c.startIndex,d=c.endIndex,y=c.onChange,v=n.pageX-a;v>0?v=Math.min(v,s+f-l-u,s+f-l-o):v<0&&(v=Math.max(v,s-o,s-u));var p=this.getIndex({startX:o+v,endX:u+v});(p.startIndex!==h||p.endIndex!==d)&&y&&y(p),this.setState({startX:o+v,endX:u+v,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,i){var a=tb(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:a.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var i=this.state,a=i.brushMoveStartX,o=i.movingTravellerId,u=i.endX,c=i.startX,s=this.state[o],f=this.props,l=f.x,h=f.width,d=f.travellerWidth,y=f.onChange,v=f.gap,p=f.data,g={startX:this.state.startX,endX:this.state.endX},x=n.pageX-a;x>0?x=Math.min(x,l+h-d-s):x<0&&(x=Math.max(x,l-s)),g[o]=s+x;var w=this.getIndex(g),O=w.startIndex,m=w.endIndex,b=function(){var A=p.length-1;return o==="startX"&&(u>c?O%v===0:m%v===0)||uc?m%v===0:O%v===0)||u>c&&m===A};this.setState(Fe(Fe({},o,s+x),"brushMoveStartX",n.pageX),function(){y&&b()&&y(w)})}},{key:"handleTravellerMoveKeyboard",value:function(n,i){var a=this,o=this.state,u=o.scaleValues,c=o.startX,s=o.endX,f=this.state[i],l=u.indexOf(f);if(l!==-1){var h=l+n;if(!(h===-1||h>=u.length)){var d=u[h];i==="startX"&&d>=s||i==="endX"&&d<=c||this.setState(Fe({},i,d),function(){a.props.onChange(a.getIndex({startX:a.state.startX,endX:a.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,u=n.height,c=n.fill,s=n.stroke;return S.createElement("rect",{stroke:s,fill:c,x:i,y:a,width:o,height:u})}},{key:"renderPanorama",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,u=n.height,c=n.data,s=n.children,f=n.padding,l=N.Children.only(s);return l?S.cloneElement(l,{x:i,y:a,width:o,height:u,margin:f,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(n,i){var a,o,u=this,c=this.props,s=c.y,f=c.travellerWidth,l=c.height,h=c.traveller,d=c.ariaLabel,y=c.data,v=c.startIndex,p=c.endIndex,g=Math.max(n,this.props.x),x=Qs(Qs({},H(this.props,!1)),{},{x:g,y:s,width:f,height:l}),w=d||"Min value: ".concat((a=y[v])===null||a===void 0?void 0:a.name,", Max value: ").concat((o=y[p])===null||o===void 0?void 0:o.name);return S.createElement(te,{tabIndex:0,role:"slider","aria-label":w,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(m){["ArrowLeft","ArrowRight"].includes(m.key)&&(m.preventDefault(),m.stopPropagation(),u.handleTravellerMoveKeyboard(m.key==="ArrowRight"?1:-1,i))},onFocus:function(){u.setState({isTravellerFocused:!0})},onBlur:function(){u.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(h,x))}},{key:"renderSlide",value:function(n,i){var a=this.props,o=a.y,u=a.height,c=a.stroke,s=a.travellerWidth,f=Math.min(n,i)+s,l=Math.max(Math.abs(i-n)-s,0);return S.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:f,y:o,width:l,height:u})}},{key:"renderText",value:function(){var n=this.props,i=n.startIndex,a=n.endIndex,o=n.y,u=n.height,c=n.travellerWidth,s=n.stroke,f=this.state,l=f.startX,h=f.endX,d=5,y={pointerEvents:"none",fill:s};return S.createElement(te,{className:"recharts-brush-texts"},S.createElement(rr,va({textAnchor:"end",verticalAnchor:"middle",x:Math.min(l,h)-d,y:o+u/2},y),this.getTextOfTick(i)),S.createElement(rr,va({textAnchor:"start",verticalAnchor:"middle",x:Math.max(l,h)+c+d,y:o+u/2},y),this.getTextOfTick(a)))}},{key:"render",value:function(){var n=this.props,i=n.data,a=n.className,o=n.children,u=n.x,c=n.y,s=n.width,f=n.height,l=n.alwaysShowText,h=this.state,d=h.startX,y=h.endX,v=h.isTextActive,p=h.isSlideMoving,g=h.isTravellerMoving,x=h.isTravellerFocused;if(!i||!i.length||!q(u)||!q(c)||!q(s)||!q(f)||s<=0||f<=0)return null;var w=J("recharts-brush",a),O=S.Children.count(o)===1,m=Qk("userSelect","none");return S.createElement(te,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:m},this.renderBackground(),O&&this.renderPanorama(),this.renderSlide(d,y),this.renderTravellerLayer(d,"startX"),this.renderTravellerLayer(y,"endX"),(v||p||g||x||l)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var i=n.x,a=n.y,o=n.width,u=n.height,c=n.stroke,s=Math.floor(a+u/2)-1;return S.createElement(S.Fragment,null,S.createElement("rect",{x:i,y:a,width:o,height:u,fill:c,stroke:"none"}),S.createElement("line",{x1:i+1,y1:s,x2:i+o-1,y2:s,fill:"none",stroke:"#fff"}),S.createElement("line",{x1:i+1,y1:s+2,x2:i+o-1,y2:s+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,i){var a;return S.isValidElement(n)?a=S.cloneElement(n,i):X(n)?a=n(i):a=t.renderDefaultTraveller(i),a}},{key:"getDerivedStateFromProps",value:function(n,i){var a=n.data,o=n.width,u=n.x,c=n.travellerWidth,s=n.updateId,f=n.startIndex,l=n.endIndex;if(a!==i.prevData||s!==i.prevUpdateId)return Qs({prevData:a,prevTravellerWidth:c,prevUpdateId:s,prevX:u,prevWidth:o},a&&a.length?uR({data:a,width:o,x:u,travellerWidth:c,startIndex:f,endIndex:l}):{scale:null,scaleValues:null});if(i.scale&&(o!==i.prevWidth||u!==i.prevX||c!==i.prevTravellerWidth)){i.scale.range([u,u+o-c]);var h=i.scale.domain().map(function(d){return i.scale(d)});return{prevData:a,prevTravellerWidth:c,prevUpdateId:s,prevX:u,prevWidth:o,startX:i.scale(n.startIndex),endX:i.scale(n.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(n,i){for(var a=n.length,o=0,u=a-1;u-o>1;){var c=Math.floor((o+u)/2);n[c]>i?u=c:o=c}return i>=n[u]?u:o}}])})(N.PureComponent);Fe(qr,"displayName","Brush");Fe(qr,"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 el,rb;function cR(){if(rb)return el;rb=1;var e=nh();function t(r,n){var i;return e(r,function(a,o,u){return i=n(a,o,u),!i}),!!i}return el=t,el}var tl,nb;function sR(){if(nb)return tl;nb=1;var e=x0(),t=ht(),r=cR(),n=qe(),i=La();function a(o,u,c){var s=n(o)?e:r;return c&&i(o,u,c)&&(u=void 0),s(o,t(u,3))}return tl=a,tl}var lR=sR();const fR=oe(lR);var ct=function(t,r){var n=t.alwaysShow,i=t.ifOverflow;return n&&(i="extendDomain"),i===r},rl,ib;function hR(){if(ib)return rl;ib=1;var e=q0();function t(r,n,i){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[n]=i}return rl=t,rl}var nl,ab;function pR(){if(ab)return nl;ab=1;var e=hR(),t=D0(),r=ht();function n(i,a){var o={};return a=r(a,3),t(i,function(u,c,s){e(o,c,a(u,c,s))}),o}return nl=n,nl}var dR=pR();const vR=oe(dR);var il,ob;function yR(){if(ob)return il;ob=1;function e(t,r){for(var n=-1,i=t==null?0:t.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function SR(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function PR(e,t){var r=e.x,n=e.y,i=AR(e,xR),a="".concat(r),o=parseInt(a,10),u="".concat(n),c=parseInt(u,10),s="".concat(t.height||i.height),f=parseInt(s,10),l="".concat(t.width||i.width),h=parseInt(l,10);return pn(pn(pn(pn(pn({},t),i),o?{x:o}:{}),c?{y:c}:{}),{},{height:f,width:h,name:t.name,radius:t.radius})}function lb(e){return S.createElement(gw,gf({shapeType:"rectangle",propTransformer:PR,activeClassName:"recharts-active-bar"},e))}var TR=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,i){if(typeof t=="number")return t;var a=q(n)||ZO(n);return a?t(n,i):(a||Qt(!1),r)}},ER=["value","background"],Pw;function Lr(e){"@babel/helpers - typeof";return Lr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lr(e)}function jR(e,t){if(e==null)return{};var r=MR(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function MR(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function ma(){return ma=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs($)0&&Math.abs(C)0&&(j=Math.min((fe||0)-(C[ye-1]||0),j))}),Number.isFinite(j)){var $=j/E,k=v.layout==="vertical"?n.height:n.width;if(v.padding==="gap"&&(_=$*k/2),v.padding==="no-gap"){var R=Ie(t.barCategoryGap,$*k),L=$*k/2;_=L-R-(L-R)/k*R}}}i==="xAxis"?A=[n.left+(w.left||0)+(_||0),n.left+n.width-(w.right||0)-(_||0)]:i==="yAxis"?A=c==="horizontal"?[n.top+n.height-(w.bottom||0),n.top+(w.top||0)]:[n.top+(w.top||0)+(_||0),n.top+n.height-(w.bottom||0)-(_||0)]:A=v.range,m&&(A=[A[1],A[0]]);var B=Yx(v,a,h),U=B.scale,G=B.realScaleType;U.domain(g).range(A),Zx(U);var W=Jx(U,tt(tt({},v),{},{realScaleType:G}));i==="xAxis"?(P=p==="top"&&!O||p==="bottom"&&O,T=n.left,M=l[b]-P*v.height):i==="yAxis"&&(P=p==="left"&&!O||p==="right"&&O,T=l[b]-P*v.width,M=n.top);var V=tt(tt(tt({},v),W),{},{realScaleType:G,x:T,y:M,scale:U,width:i==="xAxis"?n.width:v.width,height:i==="yAxis"?n.height:v.height});return V.bandSize=ta(V,W),!v.hide&&i==="xAxis"?l[b]+=(P?-1:1)*V.height:v.hide||(l[b]+=(P?-1:1)*V.width),tt(tt({},d),{},io({},y,V))},{})},$w=function(t,r){var n=t.x,i=t.y,a=r.x,o=r.y;return{x:Math.min(n,a),y:Math.min(i,o),width:Math.abs(a-n),height:Math.abs(o-i)}},FR=function(t){var r=t.x1,n=t.y1,i=t.x2,a=t.y2;return $w({x:r,y:n},{x:i,y:a})},Cw=(function(){function e(t){qR(this,e),this.scale=t}return LR(e,[{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(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.bandAware,a=n.position;if(r!==void 0){if(a)switch(a){case"start":return this.scale(r);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+o}case"end":{var u=this.bandwidth?this.bandwidth():0;return this.scale(r)+u}default:return this.scale(r)}if(i){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+c}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),i=n[0],a=n[n.length-1];return i<=a?r>=i&&r<=a:r>=a&&r<=i}}],[{key:"create",value:function(r){return new e(r)}}])})();io(Cw,"EPS",1e-4);var Ih=function(t){var r=Object.keys(t).reduce(function(n,i){return tt(tt({},n),{},io({},i,Cw.create(t[i])))},{});return tt(tt({},r),{},{apply:function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=a.bandAware,u=a.position;return vR(i,function(c,s){return r[s].apply(c,{bandAware:o,position:u})})},isInRange:function(i){return Sw(i,function(a,o){return r[o].isInRange(a)})}})};function WR(e){return(e%180+180)%180}var zR=function(t){var r=t.width,n=t.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=WR(i),o=a*Math.PI/180,u=Math.atan(n/r),c=o>u&&o-1?c[s?a[f]:f]:void 0}}return ul=n,ul}var cl,yb;function HR(){if(yb)return cl;yb=1;var e=ww();function t(r){var n=e(r),i=n%1;return n===n?i?n-i:n:0}return cl=t,cl}var sl,mb;function KR(){if(mb)return sl;mb=1;var e=$0(),t=ht(),r=HR(),n=Math.max;function i(a,o,u){var c=a==null?0:a.length;if(!c)return-1;var s=u==null?0:r(u);return s<0&&(s=n(c+s,0)),e(a,t(o,3),s)}return sl=i,sl}var ll,gb;function GR(){if(gb)return ll;gb=1;var e=UR(),t=KR(),r=e(t);return ll=r,ll}var VR=GR();const XR=oe(VR);var YR=Gb();const ZR=oe(YR);var JR=ZR(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),kh=N.createContext(void 0),Rh=N.createContext(void 0),Iw=N.createContext(void 0),kw=N.createContext({}),Rw=N.createContext(void 0),Dw=N.createContext(0),Nw=N.createContext(0),bb=function(t){var r=t.state,n=r.xAxisMap,i=r.yAxisMap,a=r.offset,o=t.clipPathId,u=t.children,c=t.width,s=t.height,f=JR(a);return S.createElement(kh.Provider,{value:n},S.createElement(Rh.Provider,{value:i},S.createElement(kw.Provider,{value:a},S.createElement(Iw.Provider,{value:f},S.createElement(Rw.Provider,{value:o},S.createElement(Dw.Provider,{value:s},S.createElement(Nw.Provider,{value:c},u)))))))},QR=function(){return N.useContext(Rw)},qw=function(t){var r=N.useContext(kh);r==null&&Qt(!1);var n=r[t];return n==null&&Qt(!1),n},eD=function(){var t=N.useContext(kh);return Mt(t)},tD=function(){var t=N.useContext(Rh),r=XR(t,function(n){return Sw(n.domain,Number.isFinite)});return r||Mt(t)},Lw=function(t){var r=N.useContext(Rh);r==null&&Qt(!1);var n=r[t];return n==null&&Qt(!1),n},rD=function(){var t=N.useContext(Iw);return t},nD=function(){return N.useContext(kw)},Dh=function(){return N.useContext(Nw)},Nh=function(){return N.useContext(Dw)};function Br(e){"@babel/helpers - typeof";return Br=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Br(e)}function iD(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function aD(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);re*i)return!1;var a=r();return e*(t-e*a/2-n)>=0&&e*(t+e*a/2-i)<=0}function BD(e,t){return Kw(e,t+1)}function FD(e,t,r,n,i){for(var a=(n||[]).slice(),o=t.start,u=t.end,c=0,s=1,f=o,l=function(){var y=n?.[c];if(y===void 0)return{v:Kw(n,s)};var v=c,p,g=function(){return p===void 0&&(p=r(y,v)),p},x=y.coordinate,w=c===0||Oa(e,x,g,f,u);w||(c=0,f=o,s+=1),w&&(f=x+e*(g()/2+i),c+=s)},h;s<=a.length;)if(h=l(),h)return h.v;return[]}function ri(e){"@babel/helpers - typeof";return ri=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ri(e)}function Tb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Me(e){for(var t=1;t0?d.coordinate-p*e:d.coordinate})}else a[h]=d=Me(Me({},d),{},{tickCoord:d.coordinate});var g=Oa(e,d.tickCoord,v,u,c);g&&(c=d.tickCoord-e*(v()/2+i),a[h]=Me(Me({},d),{},{isShow:!0}))},f=o-1;f>=0;f--)s(f);return a}function KD(e,t,r,n,i,a){var o=(n||[]).slice(),u=o.length,c=t.start,s=t.end;if(a){var f=n[u-1],l=r(f,u-1),h=e*(f.coordinate+e*l/2-s);o[u-1]=f=Me(Me({},f),{},{tickCoord:h>0?f.coordinate-h*e:f.coordinate});var d=Oa(e,f.tickCoord,function(){return l},c,s);d&&(s=f.tickCoord-e*(l/2+i),o[u-1]=Me(Me({},f),{},{isShow:!0}))}for(var y=a?u-1:u,v=function(x){var w=o[x],O,m=function(){return O===void 0&&(O=r(w,x)),O};if(x===0){var b=e*(w.coordinate-e*m()/2-c);o[x]=w=Me(Me({},w),{},{tickCoord:b<0?w.coordinate-b*e:w.coordinate})}else o[x]=w=Me(Me({},w),{},{tickCoord:w.coordinate});var _=Oa(e,w.tickCoord,m,c,s);_&&(c=w.tickCoord+e*(m()/2+i),o[x]=Me(Me({},w),{},{isShow:!0}))},p=0;p=2?Ce(i[1].coordinate-i[0].coordinate):1,g=LD(a,p,d);return c==="equidistantPreserveStart"?FD(p,g,v,i,o):(c==="preserveStart"||c==="preserveStartEnd"?h=KD(p,g,v,i,o,c==="preserveStartEnd"):h=HD(p,g,v,i,o),h.filter(function(x){return x.isShow}))}var GD=["viewBox"],VD=["viewBox"],XD=["ticks"];function zr(e){"@babel/helpers - typeof";return zr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zr(e)}function gr(){return gr=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function YD(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function ZD(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jb(e,t){for(var r=0;r0?c(this.props):c(d)),o<=0||u<=0||!y||!y.length?null:S.createElement(te,{className:J("recharts-cartesian-axis",s),ref:function(p){n.layerReference=p}},a&&this.renderAxisLine(),this.renderTicks(y,this.state.fontSize,this.state.letterSpacing),Te.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,i,a){var o,u=J(i.className,"recharts-cartesian-axis-tick-value");return S.isValidElement(n)?o=S.cloneElement(n,we(we({},i),{},{className:u})):X(n)?o=n(we(we({},i),{},{className:u})):o=S.createElement(rr,gr({},i,{className:"recharts-cartesian-axis-tick-value"}),a),o}}])})(N.Component);Fh(nn,"displayName","CartesianAxis");Fh(nn,"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 iN=["x1","y1","x2","y2","key"],aN=["offset"];function ir(e){"@babel/helpers - typeof";return ir=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ir(e)}function Mb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function $e(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function sN(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var lN=function(t){var r=t.fill;if(!r||r==="none")return null;var n=t.fillOpacity,i=t.x,a=t.y,o=t.width,u=t.height,c=t.ry;return S.createElement("rect",{x:i,y:a,ry:c,width:o,height:u,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function Xw(e,t){var r;if(S.isValidElement(e))r=S.cloneElement(e,t);else if(X(e))r=e(t);else{var n=t.x1,i=t.y1,a=t.x2,o=t.y2,u=t.key,c=$b(t,iN),s=H(c,!1);s.offset;var f=$b(s,aN);r=S.createElement("line",Yt({},f,{x1:n,y1:i,x2:a,y2:o,fill:"none",key:u}))}return r}function fN(e){var t=e.x,r=e.width,n=e.horizontal,i=n===void 0?!0:n,a=e.horizontalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(u,c){var s=$e($e({},e),{},{x1:t,y1:u,x2:t+r,y2:u,key:"line-".concat(c),index:c});return Xw(i,s)});return S.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function hN(e){var t=e.y,r=e.height,n=e.vertical,i=n===void 0?!0:n,a=e.verticalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(u,c){var s=$e($e({},e),{},{x1:u,y1:t,x2:u,y2:t+r,key:"line-".concat(c),index:c});return Xw(i,s)});return S.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function pN(e){var t=e.horizontalFill,r=e.fillOpacity,n=e.x,i=e.y,a=e.width,o=e.height,u=e.horizontalPoints,c=e.horizontal,s=c===void 0?!0:c;if(!s||!t||!t.length)return null;var f=u.map(function(h){return Math.round(h+i-i)}).sort(function(h,d){return h-d});i!==f[0]&&f.unshift(0);var l=f.map(function(h,d){var y=!f[d+1],v=y?i+o-h:f[d+1]-h;if(v<=0)return null;var p=d%t.length;return S.createElement("rect",{key:"react-".concat(d),y:h,x:n,height:v,width:a,stroke:"none",fill:t[p],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return S.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},l)}function dN(e){var t=e.vertical,r=t===void 0?!0:t,n=e.verticalFill,i=e.fillOpacity,a=e.x,o=e.y,u=e.width,c=e.height,s=e.verticalPoints;if(!r||!n||!n.length)return null;var f=s.map(function(h){return Math.round(h+a-a)}).sort(function(h,d){return h-d});a!==f[0]&&f.unshift(0);var l=f.map(function(h,d){var y=!f[d+1],v=y?a+u-h:f[d+1]-h;if(v<=0)return null;var p=d%n.length;return S.createElement("rect",{key:"react-".concat(d),x:h,y:o,width:v,height:c,stroke:"none",fill:n[p],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return S.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},l)}var vN=function(t,r){var n=t.xAxis,i=t.width,a=t.height,o=t.offset;return Xx(Bh($e($e($e({},nn.defaultProps),n),{},{ticks:gt(n,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.left,o.left+o.width,r)},yN=function(t,r){var n=t.yAxis,i=t.width,a=t.height,o=t.offset;return Xx(Bh($e($e($e({},nn.defaultProps),n),{},{ticks:gt(n,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.top,o.top+o.height,r)},pr={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function mN(e){var t,r,n,i,a,o,u=Dh(),c=Nh(),s=nD(),f=$e($e({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:pr.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:pr.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:pr.horizontal,horizontalFill:(i=e.horizontalFill)!==null&&i!==void 0?i:pr.horizontalFill,vertical:(a=e.vertical)!==null&&a!==void 0?a:pr.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:pr.verticalFill,x:q(e.x)?e.x:s.left,y:q(e.y)?e.y:s.top,width:q(e.width)?e.width:s.width,height:q(e.height)?e.height:s.height}),l=f.x,h=f.y,d=f.width,y=f.height,v=f.syncWithTicks,p=f.horizontalValues,g=f.verticalValues,x=eD(),w=tD();if(!q(d)||d<=0||!q(y)||y<=0||!q(l)||l!==+l||!q(h)||h!==+h)return null;var O=f.verticalCoordinatesGenerator||vN,m=f.horizontalCoordinatesGenerator||yN,b=f.horizontalPoints,_=f.verticalPoints;if((!b||!b.length)&&X(m)){var A=p&&p.length,T=m({yAxis:w?$e($e({},w),{},{ticks:A?p:w.ticks}):void 0,width:u,height:c,offset:s},A?!0:v);it(Array.isArray(T),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(ir(T),"]")),Array.isArray(T)&&(b=T)}if((!_||!_.length)&&X(O)){var M=g&&g.length,P=O({xAxis:x?$e($e({},x),{},{ticks:M?g:x.ticks}):void 0,width:u,height:c,offset:s},M?!0:v);it(Array.isArray(P),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(ir(P),"]")),Array.isArray(P)&&(_=P)}return S.createElement("g",{className:"recharts-cartesian-grid"},S.createElement(lN,{fill:f.fill,fillOpacity:f.fillOpacity,x:f.x,y:f.y,width:f.width,height:f.height,ry:f.ry}),S.createElement(fN,Yt({},f,{offset:s,horizontalPoints:b,xAxis:x,yAxis:w})),S.createElement(hN,Yt({},f,{offset:s,verticalPoints:_,xAxis:x,yAxis:w})),S.createElement(pN,Yt({},f,{horizontalPoints:b})),S.createElement(dN,Yt({},f,{verticalPoints:_})))}mN.displayName="CartesianGrid";var gN=["type","layout","connectNulls","ref"],bN=["key"];function Ur(e){"@babel/helpers - typeof";return Ur=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ur(e)}function Cb(e,t){if(e==null)return{};var r=xN(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function xN(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function _n(){return _n=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);rl){d=[].concat(dr(c.slice(0,y)),[l-v]);break}var p=d.length%2===0?[0,h]:[h];return[].concat(dr(t.repeat(c,f)),dr(d),p).map(function(g){return"".concat(g,"px")}).join(", ")}),rt(r,"id",Zr("recharts-line-")),rt(r,"pathRef",function(o){r.mainCurve=o}),rt(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),rt(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return MN(t,e),PN(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.points,u=a.xAxis,c=a.yAxis,s=a.layout,f=a.children,l=Ke(f,pi);if(!l)return null;var h=function(v,p){return{x:v.x,y:v.y,value:v.value,errorVal:_e(v.payload,p)}},d={clipPath:n?"url(#clipPath-".concat(i,")"):null};return S.createElement(te,d,l.map(function(y){return S.cloneElement(y,{key:"bar-".concat(y.props.dataKey),data:o,xAxis:u,yAxis:c,layout:s,dataPointFormatter:h})}))}},{key:"renderDots",value:function(n,i,a){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var u=this.props,c=u.dot,s=u.points,f=u.dataKey,l=H(this.props,!1),h=H(c,!0),d=s.map(function(v,p){var g=Be(Be(Be({key:"dot-".concat(p),r:3},l),h),{},{index:p,cx:v.x,cy:v.y,value:v.value,dataKey:f,payload:v.payload,points:s});return t.renderDotItem(c,g)}),y={clipPath:n?"url(#clipPath-".concat(i?"":"dots-").concat(a,")"):null};return S.createElement(te,_n({className:"recharts-line-dots",key:"dots"},y),d)}},{key:"renderCurveStatically",value:function(n,i,a,o){var u=this.props,c=u.type,s=u.layout,f=u.connectNulls;u.ref;var l=Cb(u,gN),h=Be(Be(Be({},H(l,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(a,")"):null,points:n},o),{},{type:c,layout:s,connectNulls:f});return S.createElement(ia,_n({},h,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,i){var a=this,o=this.props,u=o.points,c=o.strokeDasharray,s=o.isAnimationActive,f=o.animationBegin,l=o.animationDuration,h=o.animationEasing,d=o.animationId,y=o.animateNewValues,v=o.width,p=o.height,g=this.state,x=g.prevPoints,w=g.totalLength;return S.createElement(lt,{begin:f,duration:l,isActive:s,easing:h,from:{t:0},to:{t:1},key:"line-".concat(d),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(O){var m=O.t;if(x){var b=x.length/u.length,_=u.map(function(E,j){var C=Math.floor(j*b);if(x[C]){var $=x[C],k=ze($.x,E.x),R=ze($.y,E.y);return Be(Be({},E),{},{x:k(m),y:R(m)})}if(y){var L=ze(v*2,E.x),B=ze(p/2,E.y);return Be(Be({},E),{},{x:L(m),y:B(m)})}return Be(Be({},E),{},{x:E.x,y:E.y})});return a.renderCurveStatically(_,n,i)}var A=ze(0,w),T=A(m),M;if(c){var P="".concat(c).split(/[,\s]+/gim).map(function(E){return parseFloat(E)});M=a.getStrokeDasharray(T,w,P)}else M=a.generateSimpleStrokeDasharray(w,T);return a.renderCurveStatically(u,n,i,{strokeDasharray:M})})}},{key:"renderCurve",value:function(n,i){var a=this.props,o=a.points,u=a.isAnimationActive,c=this.state,s=c.prevPoints,f=c.totalLength;return u&&o&&o.length&&(!s&&f>0||!hi(s,o))?this.renderCurveWithAnimation(n,i):this.renderCurveStatically(o,n,i)}},{key:"render",value:function(){var n,i=this.props,a=i.hide,o=i.dot,u=i.points,c=i.className,s=i.xAxis,f=i.yAxis,l=i.top,h=i.left,d=i.width,y=i.height,v=i.isAnimationActive,p=i.id;if(a||!u||!u.length)return null;var g=this.state.isAnimationFinished,x=u.length===1,w=J("recharts-line",c),O=s&&s.allowDataOverflow,m=f&&f.allowDataOverflow,b=O||m,_=Y(p)?this.id:p,A=(n=H(o,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},T=A.r,M=T===void 0?3:T,P=A.strokeWidth,E=P===void 0?2:P,j=s_(o)?o:{},C=j.clipDot,$=C===void 0?!0:C,k=M*2+E;return S.createElement(te,{className:w},O||m?S.createElement("defs",null,S.createElement("clipPath",{id:"clipPath-".concat(_)},S.createElement("rect",{x:O?h:h-d/2,y:m?l:l-y/2,width:O?d:d*2,height:m?y:y*2})),!$&&S.createElement("clipPath",{id:"clipPath-dots-".concat(_)},S.createElement("rect",{x:h-k/2,y:l-k/2,width:d+k,height:y+k}))):null,!x&&this.renderCurve(b,_),this.renderErrorBar(b,_),(x||o)&&this.renderDots(b,$,_),(!v||g)&&wt.renderCallByParent(this.props,u))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:i.curPoints}:n.points!==i.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,i){for(var a=n.length%2!==0?[].concat(dr(n),[0]):n,o=[],u=0;ue.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function x2(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function w2(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O2(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0?o:t&&t.length&&q(i)&&q(a)?t.slice(i,a+1):[]};function lO(e){return e==="number"?[0,"auto"]:void 0}var Nf=function(t,r,n,i){var a=t.graphicalItems,o=t.tooltipAxis,u=ho(r,t);return n<0||!a||!a.length||n>=u.length?null:a.reduce(function(c,s){var f,l=(f=s.props.data)!==null&&f!==void 0?f:r;l&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(l=l.slice(t.dataStartIndex,t.dataEndIndex+1));var h;if(o.dataKey&&!o.allowDuplicatedCategory){var d=l===void 0?u:l;h=Mi(d,o.dataKey,i)}else h=l&&l[n]||u[n];return h?[].concat(Vr(c),[ew(s,h)]):c},[])},Fb=function(t,r,n,i){var a=i||{x:t.chartX,y:t.chartY},o=k2(a,n),u=t.orderedTooltipTicks,c=t.tooltipAxis,s=t.tooltipTicks,f=aM(o,u,s,c);if(f>=0&&s){var l=s[f]&&s[f].value,h=Nf(t,r,f,l),d=R2(n,u,f,a);return{activeTooltipIndex:f,activeLabel:l,activePayload:h,activeCoordinate:d}}return null},D2=function(t,r){var n=r.axes,i=r.graphicalItems,a=r.axisType,o=r.axisIdKey,u=r.stackGroups,c=r.dataStartIndex,s=r.dataEndIndex,f=t.layout,l=t.children,h=t.stackOffset,d=Vx(f,a);return n.reduce(function(y,v){var p,g=v.type.defaultProps!==void 0?I(I({},v.type.defaultProps),v.props):v.props,x=g.type,w=g.dataKey,O=g.allowDataOverflow,m=g.allowDuplicatedCategory,b=g.scale,_=g.ticks,A=g.includeHidden,T=g[o];if(y[T])return y;var M=ho(t.data,{graphicalItems:i.filter(function(W){var V,fe=o in W.props?W.props[o]:(V=W.type.defaultProps)===null||V===void 0?void 0:V[o];return fe===T}),dataStartIndex:c,dataEndIndex:s}),P=M.length,E,j,C;c2(g.domain,O,x)&&(E=Yl(g.domain,null,O),d&&(x==="number"||b!=="auto")&&(C=bn(M,w,"category")));var $=lO(x);if(!E||E.length===0){var k,R=(k=g.domain)!==null&&k!==void 0?k:$;if(w){if(E=bn(M,w,x),x==="category"&&d){var L=QO(E);m&&L?(j=E,E=da(0,P)):m||(E=Lm(R,E,v).reduce(function(W,V){return W.indexOf(V)>=0?W:[].concat(Vr(W),[V])},[]))}else if(x==="category")m?E=E.filter(function(W){return W!==""&&!Y(W)}):E=Lm(R,E,v).reduce(function(W,V){return W.indexOf(V)>=0||V===""||Y(V)?W:[].concat(Vr(W),[V])},[]);else if(x==="number"){var B=lM(M,i.filter(function(W){var V,fe,ye=o in W.props?W.props[o]:(V=W.type.defaultProps)===null||V===void 0?void 0:V[o],Le="hide"in W.props?W.props.hide:(fe=W.type.defaultProps)===null||fe===void 0?void 0:fe.hide;return ye===T&&(A||!Le)}),w,a,f);B&&(E=B)}d&&(x==="number"||b!=="auto")&&(C=bn(M,w,"category"))}else d?E=da(0,P):u&&u[T]&&u[T].hasStack&&x==="number"?E=h==="expand"?[0,1]:Qx(u[T].stackGroups,c,s):E=Gx(M,i.filter(function(W){var V=o in W.props?W.props[o]:W.type.defaultProps[o],fe="hide"in W.props?W.props.hide:W.type.defaultProps.hide;return V===T&&(A||!fe)}),x,f,!0);if(x==="number")E=kf(l,E,T,a,_),R&&(E=Yl(R,E,O));else if(x==="category"&&R){var U=R,G=E.every(function(W){return U.indexOf(W)>=0});G&&(E=U)}}return I(I({},y),{},K({},T,I(I({},g),{},{axisType:a,domain:E,categoricalDomain:C,duplicateDomain:j,originalDomain:(p=g.domain)!==null&&p!==void 0?p:$,isCategorical:d,layout:f})))},{})},N2=function(t,r){var n=r.graphicalItems,i=r.Axis,a=r.axisType,o=r.axisIdKey,u=r.stackGroups,c=r.dataStartIndex,s=r.dataEndIndex,f=t.layout,l=t.children,h=ho(t.data,{graphicalItems:n,dataStartIndex:c,dataEndIndex:s}),d=h.length,y=Vx(f,a),v=-1;return n.reduce(function(p,g){var x=g.type.defaultProps!==void 0?I(I({},g.type.defaultProps),g.props):g.props,w=x[o],O=lO("number");if(!p[w]){v++;var m;return y?m=da(0,d):u&&u[w]&&u[w].hasStack?(m=Qx(u[w].stackGroups,c,s),m=kf(l,m,w,a)):(m=Yl(O,Gx(h,n.filter(function(b){var _,A,T=o in b.props?b.props[o]:(_=b.type.defaultProps)===null||_===void 0?void 0:_[o],M="hide"in b.props?b.props.hide:(A=b.type.defaultProps)===null||A===void 0?void 0:A.hide;return T===w&&!M}),"number",f),i.defaultProps.allowDataOverflow),m=kf(l,m,w,a)),I(I({},p),{},K({},w,I(I({axisType:a},i.defaultProps),{},{hide:!0,orientation:He(C2,"".concat(a,".").concat(v%2),null),domain:m,originalDomain:O,isCategorical:y,layout:f})))}return p},{})},q2=function(t,r){var n=r.axisType,i=n===void 0?"xAxis":n,a=r.AxisComp,o=r.graphicalItems,u=r.stackGroups,c=r.dataStartIndex,s=r.dataEndIndex,f=t.children,l="".concat(i,"Id"),h=Ke(f,a),d={};return h&&h.length?d=D2(t,{axes:h,graphicalItems:o,axisType:i,axisIdKey:l,stackGroups:u,dataStartIndex:c,dataEndIndex:s}):o&&o.length&&(d=N2(t,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:l,stackGroups:u,dataStartIndex:c,dataEndIndex:s})),d},L2=function(t){var r=Mt(t),n=gt(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:ih(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:ta(r,n)}},Wb=function(t){var r=t.children,n=t.defaultShowTooltip,i=We(r,qr),a=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},B2=function(t){return!t||!t.length?!1:t.some(function(r){var n=bt(r&&r.type);return n&&n.indexOf("Bar")>=0})},zb=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},F2=function(t,r){var n=t.props,i=t.graphicalItems,a=t.xAxisMap,o=a===void 0?{}:a,u=t.yAxisMap,c=u===void 0?{}:u,s=n.width,f=n.height,l=n.children,h=n.margin||{},d=We(l,qr),y=We(l,wr),v=Object.keys(c).reduce(function(m,b){var _=c[b],A=_.orientation;return!_.mirror&&!_.hide?I(I({},m),{},K({},A,m[A]+_.width)):m},{left:h.left||0,right:h.right||0}),p=Object.keys(o).reduce(function(m,b){var _=o[b],A=_.orientation;return!_.mirror&&!_.hide?I(I({},m),{},K({},A,He(m,"".concat(A))+_.height)):m},{top:h.top||0,bottom:h.bottom||0}),g=I(I({},p),v),x=g.bottom;d&&(g.bottom+=d.props.height||qr.defaultProps.height),y&&r&&(g=cM(g,i,n,r));var w=s-g.left-g.right,O=f-g.top-g.bottom;return I(I({brushBottom:x},g),{},{width:Math.max(w,0),height:Math.max(O,0)})},W2=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},Wh=function(t){var r=t.chartName,n=t.GraphicalChild,i=t.defaultTooltipEventType,a=i===void 0?"axis":i,o=t.validateTooltipEventTypes,u=o===void 0?["axis"]:o,c=t.axisComponents,s=t.legendContent,f=t.formatAxisMap,l=t.defaultProps,h=function(g,x){var w=x.graphicalItems,O=x.stackGroups,m=x.offset,b=x.updateId,_=x.dataStartIndex,A=x.dataEndIndex,T=g.barSize,M=g.layout,P=g.barGap,E=g.barCategoryGap,j=g.maxBarSize,C=zb(M),$=C.numericAxisName,k=C.cateAxisName,R=B2(w),L=[];return w.forEach(function(B,U){var G=ho(g.data,{graphicalItems:[B],dataStartIndex:_,dataEndIndex:A}),W=B.type.defaultProps!==void 0?I(I({},B.type.defaultProps),B.props):B.props,V=W.dataKey,fe=W.maxBarSize,ye=W["".concat($,"Id")],Le=W["".concat(k,"Id")],qt={},Re=c.reduce(function(Lt,Bt){var po=x["".concat(Bt.axisType,"Map")],zh=W["".concat(Bt.axisType,"Id")];po&&po[zh]||Bt.axisType==="zAxis"||Qt(!1);var Uh=po[zh];return I(I({},Lt),{},K(K({},Bt.axisType,Uh),"".concat(Bt.axisType,"Ticks"),gt(Uh)))},qt),F=Re[k],Z=Re["".concat(k,"Ticks")],Q=O&&O[ye]&&O[ye].hasStack&&bM(B,O[ye].stackGroups),D=bt(B.type).indexOf("Bar")>=0,de=ta(F,Z),ee=[],be=R&&oM({barSize:T,stackGroups:O,totalSize:W2(Re,k)});if(D){var xe,De,Et=Y(fe)?j:fe,lr=(xe=(De=ta(F,Z,!0))!==null&&De!==void 0?De:Et)!==null&&xe!==void 0?xe:0;ee=uM({barGap:P,barCategoryGap:E,bandSize:lr!==de?lr:de,sizeList:be[Le],maxBarSize:Et}),lr!==de&&(ee=ee.map(function(Lt){return I(I({},Lt),{},{position:I(I({},Lt.position),{},{offset:Lt.position.offset-lr/2})})}))}var di=B&&B.type&&B.type.getComposedData;di&&L.push({props:I(I({},di(I(I({},Re),{},{displayedData:G,props:g,dataKey:V,item:B,bandSize:de,barPosition:ee,offset:m,stackedData:Q,layout:M,dataStartIndex:_,dataEndIndex:A}))),{},K(K(K({key:B.key||"item-".concat(U)},$,Re[$]),k,Re[k]),"animationId",b)),childIndex:h_(B,g.children),item:B})}),L},d=function(g,x){var w=g.props,O=g.dataStartIndex,m=g.dataEndIndex,b=g.updateId;if(!Qp({props:w}))return null;var _=w.children,A=w.layout,T=w.stackOffset,M=w.data,P=w.reverseStackOrder,E=zb(A),j=E.numericAxisName,C=E.cateAxisName,$=Ke(_,n),k=mM(M,$,"".concat(j,"Id"),"".concat(C,"Id"),T,P),R=c.reduce(function(W,V){var fe="".concat(V.axisType,"Map");return I(I({},W),{},K({},fe,q2(w,I(I({},V),{},{graphicalItems:$,stackGroups:V.axisType===j&&k,dataStartIndex:O,dataEndIndex:m}))))},{}),L=F2(I(I({},R),{},{props:w,graphicalItems:$}),x?.legendBBox);Object.keys(R).forEach(function(W){R[W]=f(w,R[W],L,W.replace("Map",""),r)});var B=R["".concat(C,"Map")],U=L2(B),G=h(w,I(I({},R),{},{dataStartIndex:O,dataEndIndex:m,updateId:b,graphicalItems:$,stackGroups:k,offset:L}));return I(I({formattedGraphicalItems:G,graphicalItems:$,offset:L,stackGroups:k},U),R)},y=(function(p){function g(x){var w,O,m;return w2(this,g),m=A2(this,g,[x]),K(m,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),K(m,"accessibilityManager",new u2),K(m,"handleLegendBBoxUpdate",function(b){if(b){var _=m.state,A=_.dataStartIndex,T=_.dataEndIndex,M=_.updateId;m.setState(I({legendBBox:b},d({props:m.props,dataStartIndex:A,dataEndIndex:T,updateId:M},I(I({},m.state),{},{legendBBox:b}))))}}),K(m,"handleReceiveSyncEvent",function(b,_,A){if(m.props.syncId===b){if(A===m.eventEmitterSymbol&&typeof m.props.syncMethod!="function")return;m.applySyncEvent(_)}}),K(m,"handleBrushChange",function(b){var _=b.startIndex,A=b.endIndex;if(_!==m.state.dataStartIndex||A!==m.state.dataEndIndex){var T=m.state.updateId;m.setState(function(){return I({dataStartIndex:_,dataEndIndex:A},d({props:m.props,dataStartIndex:_,dataEndIndex:A,updateId:T},m.state))}),m.triggerSyncEvent({dataStartIndex:_,dataEndIndex:A})}}),K(m,"handleMouseEnter",function(b){var _=m.getMouseInfo(b);if(_){var A=I(I({},_),{},{isTooltipActive:!0});m.setState(A),m.triggerSyncEvent(A);var T=m.props.onMouseEnter;X(T)&&T(A,b)}}),K(m,"triggeredAfterMouseMove",function(b){var _=m.getMouseInfo(b),A=_?I(I({},_),{},{isTooltipActive:!0}):{isTooltipActive:!1};m.setState(A),m.triggerSyncEvent(A);var T=m.props.onMouseMove;X(T)&&T(A,b)}),K(m,"handleItemMouseEnter",function(b){m.setState(function(){return{isTooltipActive:!0,activeItem:b,activePayload:b.tooltipPayload,activeCoordinate:b.tooltipPosition||{x:b.cx,y:b.cy}}})}),K(m,"handleItemMouseLeave",function(){m.setState(function(){return{isTooltipActive:!1}})}),K(m,"handleMouseMove",function(b){b.persist(),m.throttleTriggeredAfterMouseMove(b)}),K(m,"handleMouseLeave",function(b){m.throttleTriggeredAfterMouseMove.cancel();var _={isTooltipActive:!1};m.setState(_),m.triggerSyncEvent(_);var A=m.props.onMouseLeave;X(A)&&A(_,b)}),K(m,"handleOuterEvent",function(b){var _=f_(b),A=He(m.props,"".concat(_));if(_&&X(A)){var T,M;/.*touch.*/i.test(_)?M=m.getMouseInfo(b.changedTouches[0]):M=m.getMouseInfo(b),A((T=M)!==null&&T!==void 0?T:{},b)}}),K(m,"handleClick",function(b){var _=m.getMouseInfo(b);if(_){var A=I(I({},_),{},{isTooltipActive:!0});m.setState(A),m.triggerSyncEvent(A);var T=m.props.onClick;X(T)&&T(A,b)}}),K(m,"handleMouseDown",function(b){var _=m.props.onMouseDown;if(X(_)){var A=m.getMouseInfo(b);_(A,b)}}),K(m,"handleMouseUp",function(b){var _=m.props.onMouseUp;if(X(_)){var A=m.getMouseInfo(b);_(A,b)}}),K(m,"handleTouchMove",function(b){b.changedTouches!=null&&b.changedTouches.length>0&&m.throttleTriggeredAfterMouseMove(b.changedTouches[0])}),K(m,"handleTouchStart",function(b){b.changedTouches!=null&&b.changedTouches.length>0&&m.handleMouseDown(b.changedTouches[0])}),K(m,"handleTouchEnd",function(b){b.changedTouches!=null&&b.changedTouches.length>0&&m.handleMouseUp(b.changedTouches[0])}),K(m,"handleDoubleClick",function(b){var _=m.props.onDoubleClick;if(X(_)){var A=m.getMouseInfo(b);_(A,b)}}),K(m,"handleContextMenu",function(b){var _=m.props.onContextMenu;if(X(_)){var A=m.getMouseInfo(b);_(A,b)}}),K(m,"triggerSyncEvent",function(b){m.props.syncId!==void 0&&pl.emit(dl,m.props.syncId,b,m.eventEmitterSymbol)}),K(m,"applySyncEvent",function(b){var _=m.props,A=_.layout,T=_.syncMethod,M=m.state.updateId,P=b.dataStartIndex,E=b.dataEndIndex;if(b.dataStartIndex!==void 0||b.dataEndIndex!==void 0)m.setState(I({dataStartIndex:P,dataEndIndex:E},d({props:m.props,dataStartIndex:P,dataEndIndex:E,updateId:M},m.state)));else if(b.activeTooltipIndex!==void 0){var j=b.chartX,C=b.chartY,$=b.activeTooltipIndex,k=m.state,R=k.offset,L=k.tooltipTicks;if(!R)return;if(typeof T=="function")$=T(L,b);else if(T==="value"){$=-1;for(var B=0;B=0){var Q,D;if(j.dataKey&&!j.allowDuplicatedCategory){var de=typeof j.dataKey=="function"?Z:"payload.".concat(j.dataKey.toString());Q=Mi(B,de,$),D=U&&G&&Mi(G,de,$)}else Q=B?.[C],D=U&&G&&G[C];if(Le||ye){var ee=b.props.activeIndex!==void 0?b.props.activeIndex:C;return[N.cloneElement(b,I(I(I({},T.props),Re),{},{activeIndex:ee})),null,null]}if(!Y(Q))return[F].concat(Vr(m.renderActivePoints({item:T,activePoint:Q,basePoint:D,childIndex:C,isRange:U})))}else{var be,xe=(be=m.getItemByXY(m.state.activeCoordinate))!==null&&be!==void 0?be:{graphicalItem:F},De=xe.graphicalItem,Et=De.item,lr=Et===void 0?b:Et,di=De.childIndex,Lt=I(I(I({},T.props),Re),{},{activeIndex:di});return[N.cloneElement(lr,Lt),null,null]}return U?[F,null,null]:[F,null]}),K(m,"renderCustomized",function(b,_,A){return N.cloneElement(b,I(I({key:"recharts-customized-".concat(A)},m.props),m.state))}),K(m,"renderMap",{CartesianGrid:{handler:Ei,once:!0},ReferenceArea:{handler:m.renderReferenceElement},ReferenceLine:{handler:Ei},ReferenceDot:{handler:m.renderReferenceElement},XAxis:{handler:Ei},YAxis:{handler:Ei},Brush:{handler:m.renderBrush,once:!0},Bar:{handler:m.renderGraphicChild},Line:{handler:m.renderGraphicChild},Area:{handler:m.renderGraphicChild},Radar:{handler:m.renderGraphicChild},RadialBar:{handler:m.renderGraphicChild},Scatter:{handler:m.renderGraphicChild},Pie:{handler:m.renderGraphicChild},Funnel:{handler:m.renderGraphicChild},Tooltip:{handler:m.renderCursor,once:!0},PolarGrid:{handler:m.renderPolarGrid,once:!0},PolarAngleAxis:{handler:m.renderPolarAxis},PolarRadiusAxis:{handler:m.renderPolarAxis},Customized:{handler:m.renderCustomized}}),m.clipPathId="".concat((w=x.id)!==null&&w!==void 0?w:Zr("recharts"),"-clip"),m.throttleTriggeredAfterMouseMove=U0(m.triggeredAfterMouseMove,(O=x.throttleDelay)!==null&&O!==void 0?O:1e3/60),m.state={},m}return T2(g,p),_2(g,[{key:"componentDidMount",value:function(){var w,O;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(w=this.props.margin.left)!==null&&w!==void 0?w:0,top:(O=this.props.margin.top)!==null&&O!==void 0?O:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var w=this.props,O=w.children,m=w.data,b=w.height,_=w.layout,A=We(O,dt);if(A){var T=A.props.defaultIndex;if(!(typeof T!="number"||T<0||T>this.state.tooltipTicks.length-1)){var M=this.state.tooltipTicks[T]&&this.state.tooltipTicks[T].value,P=Nf(this.state,m,T,M),E=this.state.tooltipTicks[T].coordinate,j=(this.state.offset.top+b)/2,C=_==="horizontal",$=C?{x:E,y:j}:{y:E,x:j},k=this.state.formattedGraphicalItems.find(function(L){var B=L.item;return B.type.name==="Scatter"});k&&($=I(I({},$),k.props.points[T].tooltipPosition),P=k.props.points[T].tooltipPayload);var R={activeTooltipIndex:T,isTooltipActive:!0,activeLabel:M,activePayload:P,activeCoordinate:$};this.setState(R),this.renderCursor(A),this.accessibilityManager.setIndex(T)}}}},{key:"getSnapshotBeforeUpdate",value:function(w,O){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==O.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==w.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==w.margin){var m,b;this.accessibilityManager.setDetails({offset:{left:(m=this.props.margin.left)!==null&&m!==void 0?m:0,top:(b=this.props.margin.top)!==null&&b!==void 0?b:0}})}return null}},{key:"componentDidUpdate",value:function(w){gl([We(w.children,dt)],[We(this.props.children,dt)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var w=We(this.props.children,dt);if(w&&typeof w.props.shared=="boolean"){var O=w.props.shared?"axis":"item";return u.indexOf(O)>=0?O:a}return a}},{key:"getMouseInfo",value:function(w){if(!this.container)return null;var O=this.container,m=O.getBoundingClientRect(),b=JS(m),_={chartX:Math.round(w.pageX-b.left),chartY:Math.round(w.pageY-b.top)},A=m.width/O.offsetWidth||1,T=this.inRange(_.chartX,_.chartY,A);if(!T)return null;var M=this.state,P=M.xAxisMap,E=M.yAxisMap,j=this.getTooltipEventType(),C=Fb(this.state,this.props.data,this.props.layout,T);if(j!=="axis"&&P&&E){var $=Mt(P).scale,k=Mt(E).scale,R=$&&$.invert?$.invert(_.chartX):null,L=k&&k.invert?k.invert(_.chartY):null;return I(I({},_),{},{xValue:R,yValue:L},C)}return C?I(I({},_),C):null}},{key:"inRange",value:function(w,O){var m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,b=this.props.layout,_=w/m,A=O/m;if(b==="horizontal"||b==="vertical"){var T=this.state.offset,M=_>=T.left&&_<=T.left+T.width&&A>=T.top&&A<=T.top+T.height;return M?{x:_,y:A}:null}var P=this.state,E=P.angleAxisMap,j=P.radiusAxisMap;if(E&&j){var C=Mt(E);return Wm({x:_,y:A},C)}return null}},{key:"parseEventsOfWrapper",value:function(){var w=this.props.children,O=this.getTooltipEventType(),m=We(w,dt),b={};m&&O==="axis"&&(m.props.trigger==="click"?b={onClick:this.handleClick}:b={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var _=$i(this.props,this.handleOuterEvent);return I(I({},_),b)}},{key:"addListener",value:function(){pl.on(dl,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){pl.removeListener(dl,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(w,O,m){for(var b=this.state.formattedGraphicalItems,_=0,A=b.length;_t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,o,c)=>c?c.toUpperCase():o.toLowerCase()),d=t=>{const a=M(t);return a.charAt(0).toUpperCase()+a.slice(1)},r=(...t)=>t.filter((a,o,c)=>!!a&&a.trim()!==""&&c.indexOf(a)===o).join(" ").trim(),m=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var v={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"};const x=s.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:y="",children:n,iconNode:k,...h},i)=>s.createElement("svg",{ref:i,...v,width:a,height:a,stroke:t,strokeWidth:c?Number(o)*24/Number(a):o,className:r("lucide",y),...!n&&!m(h)&&{"aria-hidden":"true"},...h},[...k.map(([p,l])=>s.createElement(p,l)),...Array.isArray(n)?n:[n]]));const e=(t,a)=>{const o=s.forwardRef(({className:c,...y},n)=>s.createElement(x,{ref:n,iconNode:a,className:r(`lucide-${_(d(t))}`,`lucide-${t}`,c),...y}));return o.displayName=d(t),o};const u=[["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"}]],I1=e("activity",u);const $=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],K1=e("arrow-left",$);const g=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],W1=e("arrow-right",g);const N=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Q1=e("ban",N);const w=[["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"}]],X1=e("book-open",w);const f=[["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"}]],G1=e("bot",f);const z=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],J1=e("boxes",z);const C=[["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"}]],Y1=e("calendar",C);const b=[["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"}]],e2=e("chart-column",b);const q=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],a2=e("check",q);const A=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],t2=e("chevron-down",A);const j=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],o2=e("chevron-left",j);const H=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],c2=e("chevron-right",H);const V=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],n2=e("chevron-up",V);const L=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],s2=e("chevrons-left",L);const S=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],y2=e("chevrons-right",S);const P=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],h2=e("chevrons-up-down",P);const U=[["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"}]],d2=e("circle-alert",U);const R=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],r2=e("circle-check",R);const Z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],k2=e("circle-question-mark",Z);const E=[["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"}]],i2=e("circle-user",E);const T=[["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"}]],p2=e("circle-x",T);const B=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],l2=e("circle",B);const D=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],_2=e("clock",D);const F=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],M2=e("copy",F);const O=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],m2=e("database",O);const I=[["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"}]],v2=e("dollar-sign",I);const K=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],x2=e("download",K);const W=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],u2=e("external-link",W);const Q=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],$2=e("eye-off",Q);const X=[["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"}]],g2=e("eye",X);const G=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],N2=e("file-search",G);const J=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],w2=e("file-text",J);const Y=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],f2=e("folder-open",Y);const e1=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],z2=e("funnel",e1);const a1=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],C2=e("hash",a1);const t1=[["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-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],b2=e("house",t1);const o1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],q2=e("info",o1);const c1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],A2=e("key",c1);const n1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],j2=e("loader-circle",n1);const s1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],H2=e("lock",s1);const y1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],V2=e("log-out",y1);const h1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],L2=e("menu",h1);const d1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],S2=e("message-square",d1);const r1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],P2=e("moon",r1);const k1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],U2=e("package",k1);const i1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],R2=e("palette",i1);const p1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Z2=e("pause",p1);const l1=[["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"}]],E2=e("pencil",l1);const _1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],T2=e("play",_1);const M1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],B2=e("plus",M1);const m1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],D2=e("power",m1);const v1=[["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"}]],F2=e("refresh-cw",v1);const x1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],O2=e("rotate-ccw",x1);const u1=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],I2=e("rotate-cw",u1);const $1=[["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"}]],K2=e("save",$1);const g1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],W2=e("search",g1);const N1=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Q2=e("server",N1);const w1=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],X2=e("settings-2",w1);const f1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],G2=e("settings",f1);const z1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],J2=e("shield",z1);const C1=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],Y2=e("skip-forward",C1);const b1=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],e0=e("sliders-vertical",b1);const q1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],a0=e("smile",q1);const A1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],t0=e("sparkles",A1);const j1=[["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"}]],o0=e("square-pen",j1);const H1=[["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"}]],c0=e("star",H1);const V1=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],n0=e("sun",V1);const L1=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],s0=e("terminal",L1);const S1=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],y0=e("thumbs-up",S1);const P1=[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]],h0=e("thumbs-down",P1);const U1=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],d0=e("trash-2",U1);const R1=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],r0=e("trending-up",R1);const Z1=[["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"}]],k0=e("triangle-alert",Z1);const E1=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],i0=e("upload",E1);const T1=[["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"}]],p0=e("user",T1);const B1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],l0=e("users",B1);const D1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],_0=e("x",D1);const F1=[["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"}]],M0=e("zap",F1);export{f2 as $,I1 as A,G1 as B,_2 as C,v2 as D,$2 as E,w2 as F,d0 as G,b2 as H,q2 as I,N2 as J,A2 as K,H2 as L,S2 as M,E2 as N,s2 as O,R2 as P,o2 as Q,F2 as R,J2 as S,r0 as T,p0 as U,c2 as V,y2 as W,_0 as X,h2 as Y,M0 as Z,i0 as _,m2 as a,x2 as a0,z2 as a1,o0 as a2,Q1 as a3,C2 as a4,l0 as a5,Y1 as a6,Z2 as a7,T2 as a8,c0 as a9,y0 as aa,h0 as ab,X2 as ac,u2 as ad,U2 as ae,Q2 as af,J1 as ag,i2 as ah,e2 as ai,l2 as aj,e0 as ak,L2 as al,X1 as am,V2 as an,I2 as ao,G2 as b,k0 as c,a2 as d,M2 as e,g2 as f,r2 as g,p2 as h,O2 as i,n0 as j,P2 as k,d2 as l,k2 as m,s0 as n,t0 as o,a0 as p,Y2 as q,W1 as r,W2 as s,K1 as t,t2 as u,n2 as v,j2 as w,K2 as x,D2 as y,B2 as z}; diff --git a/webui/dist/assets/icons-D6w7t-x9.js b/webui/dist/assets/icons-D6w7t-x9.js new file mode 100644 index 00000000..2cac469f --- /dev/null +++ b/webui/dist/assets/icons-D6w7t-x9.js @@ -0,0 +1 @@ +import{r as s}from"./router-BWgTyY51.js";const _=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,o,c)=>c?c.toUpperCase():o.toLowerCase()),d=t=>{const a=M(t);return a.charAt(0).toUpperCase()+a.slice(1)},r=(...t)=>t.filter((a,o,c)=>!!a&&a.trim()!==""&&c.indexOf(a)===o).join(" ").trim(),m=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var v={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"};const x=s.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:y="",children:n,iconNode:k,...h},i)=>s.createElement("svg",{ref:i,...v,width:a,height:a,stroke:t,strokeWidth:c?Number(o)*24/Number(a):o,className:r("lucide",y),...!n&&!m(h)&&{"aria-hidden":"true"},...h},[...k.map(([p,l])=>s.createElement(p,l)),...Array.isArray(n)?n:[n]]));const e=(t,a)=>{const o=s.forwardRef(({className:c,...y},n)=>s.createElement(x,{ref:n,iconNode:a,className:r(`lucide-${_(d(t))}`,`lucide-${t}`,c),...y}));return o.displayName=d(t),o};const u=[["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"}]],W1=e("activity",u);const g=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],X1=e("arrow-left",g);const $=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Q1=e("arrow-right",$);const N=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],G1=e("ban",N);const f=[["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"}]],J1=e("book-open",f);const w=[["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"}]],Y1=e("bot",w);const z=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],e2=e("boxes",z);const C=[["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"}]],a2=e("calendar",C);const b=[["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"}]],t2=e("chart-column",b);const q=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],o2=e("check",q);const A=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],c2=e("chevron-down",A);const j=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],n2=e("chevron-left",j);const H=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],s2=e("chevron-right",H);const V=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],y2=e("chevron-up",V);const L=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],h2=e("chevrons-left",L);const S=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],d2=e("chevrons-right",S);const P=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],r2=e("chevrons-up-down",P);const U=[["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"}]],k2=e("circle-alert",U);const R=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],i2=e("circle-check",R);const T=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],p2=e("circle-question-mark",T);const Z=[["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"}]],l2=e("circle-user",Z);const E=[["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"}]],_2=e("circle-x",E);const B=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],M2=e("circle",B);const D=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],m2=e("clock",D);const F=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],v2=e("code-xml",F);const O=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],x2=e("copy",O);const I=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],u2=e("database",I);const K=[["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"}]],g2=e("dollar-sign",K);const W=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],$2=e("download",W);const X=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],N2=e("external-link",X);const Q=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],f2=e("eye-off",Q);const G=[["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"}]],w2=e("eye",G);const J=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],z2=e("file-search",J);const Y=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],C2=e("file-text",Y);const e1=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],b2=e("folder-open",e1);const a1=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],q2=e("funnel",a1);const t1=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],A2=e("hash",t1);const o1=[["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-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],j2=e("house",o1);const c1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],H2=e("info",c1);const n1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],V2=e("key",n1);const s1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],L2=e("loader-circle",s1);const y1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],S2=e("lock",y1);const h1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],P2=e("log-out",h1);const d1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],U2=e("menu",d1);const r1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],R2=e("message-square",r1);const k1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],T2=e("moon",k1);const i1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Z2=e("package",i1);const p1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],E2=e("palette",p1);const l1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],B2=e("panels-top-left",l1);const _1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],D2=e("pause",_1);const M1=[["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"}]],F2=e("pencil",M1);const m1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],O2=e("play",m1);const v1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],I2=e("plus",v1);const x1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],K2=e("power",x1);const u1=[["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"}]],W2=e("refresh-cw",u1);const g1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],X2=e("rotate-ccw",g1);const $1=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Q2=e("rotate-cw",$1);const N1=[["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"}]],G2=e("save",N1);const f1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],J2=e("search",f1);const w1=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Y2=e("server",w1);const z1=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],e0=e("settings-2",z1);const C1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],a0=e("settings",C1);const b1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],t0=e("shield",b1);const q1=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],o0=e("skip-forward",q1);const A1=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],c0=e("sliders-vertical",A1);const j1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],n0=e("smile",j1);const H1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],s0=e("sparkles",H1);const V1=[["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"}]],y0=e("square-pen",V1);const L1=[["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"}]],h0=e("star",L1);const S1=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],d0=e("sun",S1);const P1=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],r0=e("terminal",P1);const U1=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],k0=e("thumbs-up",U1);const R1=[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]],i0=e("thumbs-down",R1);const T1=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],p0=e("trash-2",T1);const Z1=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],l0=e("trending-up",Z1);const E1=[["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"}]],_0=e("triangle-alert",E1);const B1=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],M0=e("upload",B1);const D1=[["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"}]],m0=e("user",D1);const F1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],v0=e("users",F1);const O1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],x0=e("x",O1);const I1=[["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"}]],u0=e("zap",I1);export{r2 as $,W1 as A,Y1 as B,m2 as C,g2 as D,f2 as E,C2 as F,K2 as G,j2 as H,H2 as I,I2 as J,V2 as K,S2 as L,R2 as M,p0 as N,z2 as O,E2 as P,F2 as Q,W2 as R,t0 as S,l0 as T,m0 as U,h2 as V,n2 as W,x0 as X,s2 as Y,u0 as Z,d2 as _,u2 as a,M0 as a0,b2 as a1,$2 as a2,q2 as a3,y0 as a4,G1 as a5,A2 as a6,v0 as a7,a2 as a8,D2 as a9,O2 as aa,h0 as ab,k0 as ac,i0 as ad,e0 as ae,N2 as af,Z2 as ag,Y2 as ah,e2 as ai,l2 as aj,t2 as ak,M2 as al,c0 as am,U2 as an,J1 as ao,P2 as ap,Q2 as aq,a0 as b,_0 as c,o2 as d,x2 as e,w2 as f,i2 as g,_2 as h,X2 as i,d0 as j,T2 as k,k2 as l,p2 as m,r0 as n,s0 as o,n0 as p,o0 as q,Q1 as r,J2 as s,X1 as t,c2 as u,y2 as v,L2 as w,B2 as x,v2 as y,G2 as z}; diff --git a/webui/dist/assets/index-B-xgVyqE.js b/webui/dist/assets/index-B-xgVyqE.js new file mode 100644 index 00000000..43d286e9 --- /dev/null +++ b/webui/dist/assets/index-B-xgVyqE.js @@ -0,0 +1,359 @@ +import{r as S,j as a,u as wa,R as Ue,d as AI,L as MI,e as EI,f as Xr,g as _I,h as DI,O as c9,b as RI,k as zI}from"./router-BWgTyY51.js";import{a as PI,b as BI,g as u9}from"./react-vendor-Dtc2IqVY.js";import{c as d9,R as LI,T as II,L as qI,a as FI,C as Vm,X as Wm,Y as Ch,b as QI,B as fy,d as Gm,P as $I,e as HI,f as UI,_ as VI,g as WI}from"./charts-B1JvyJzO.js";import{c as Vi,a as tx,u as ji,P as Zt,b as $e,d as Cn,e as Vf,f as ko,g as es,h as Ls,i as h9,j as F4,k as Q4,S as GI,l as f9,m as m9,R as p9,O as nx,n as $4,C as rx,o as H4,T as U4,D as V4,p as W4,q as g9,r as x9,W as XI,s as v9,I as YI,t as y9,v as b9,w as KI,x as w9,V as ZI,L as S9,y as k9,z as JI,A as eq,B as O9,E as tq,F as nq,G as oo,H as sx,J as wd,K as j9,M as N9,N as C9,Q as T9,U as G4,X as X4,Y as ix,Z as ax,_ as Y4,$ as A9,a0 as rq,a1 as M9,a2 as sq,a3 as iq,a4 as E9,a5 as aq}from"./ui-vendor-nTGLnMlb.js";import{R as Fi,A as lq,D as oq,a as cq,Z as uf,C as dc,M as Wf,T as uq,X as Gf,P as _9,S as dq,b as Ii,I as co,c as Hu,d as hc,e as Xb,E as Yb,f as $i,g as Es,h as Kb,i as hq,j as Zb,k as Jb,L as lO,K as fq,l as xc,m as mq,n as pq,F as ao,o as gq,B as xq,U as D9,p as K4,q as vq,r as yq,s as Bs,H as hg,t as R9,u as df,v as e2,w as hf,x as bq,y as wq,z as lx,G as Z4,J as Wr,N as Ht,O as fg,Q as nd,V as Xf,W as Tc,Y as Ac,_ as Yf,$ as Sq,a0 as oO,a1 as kq,a2 as fc,a3 as t2,a4 as rd,a5 as cO,a6 as mg,a7 as Oq,a8 as uO,a9 as jq,aa as Nq,ab as Jl,ac as my,ad as dO,ae as Cq,af as Yh,ag as pg,ah as z9,ai as P9,aj as B9,ak as Tq,al as Aq,am as hO,an as Mq,ao as Eq,ap as fO,aq as _q}from"./icons-D6w7t-x9.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var py={exports:{}},Th={},gy={exports:{}},xy={};var mO;function Dq(){return mO||(mO=1,(function(t){function e($,ae){var ne=$.length;$.push(ae);e:for(;0>>1,z=$[ce];if(0>>1;ces(P,ne))Ks(H,P)?($[ce]=H,$[K]=ne,ce=K):($[ce]=P,$[Y]=ne,ce=Y);else if(Ks(H,ne))$[ce]=H,$[K]=ne,ce=K;else break e}}return ae}function s($,ae){var ne=$.sortIndex-ae.sortIndex;return ne!==0?ne:$.id-ae.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var l=Date,c=l.now();t.unstable_now=function(){return l.now()-c}}var d=[],h=[],m=1,p=null,x=3,v=!1,b=!1,k=!1,O=!1,j=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function _($){for(var ae=n(h);ae!==null;){if(ae.callback===null)r(h);else if(ae.startTime<=$)r(h),ae.sortIndex=ae.expirationTime,e(d,ae);else break;ae=n(h)}}function D($){if(k=!1,_($),!b)if(n(d)!==null)b=!0,E||(E=!0,V());else{var ae=n(h);ae!==null&&J(D,ae.startTime-$)}}var E=!1,R=-1,Q=5,F=-1;function L(){return O?!0:!(t.unstable_now()-F$&&L());){var ce=p.callback;if(typeof ce=="function"){p.callback=null,x=p.priorityLevel;var z=ce(p.expirationTime<=$);if($=t.unstable_now(),typeof z=="function"){p.callback=z,_($),ae=!0;break t}p===n(d)&&r(d),_($)}else r(d);p=n(d)}if(p!==null)ae=!0;else{var xe=n(h);xe!==null&&J(D,xe.startTime-$),ae=!1}}break e}finally{p=null,x=ne,v=!1}ae=void 0}}finally{ae?V():E=!1}}}var V;if(typeof A=="function")V=function(){A(U)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,W=de.port2;de.port1.onmessage=U,V=function(){W.postMessage(null)}}else V=function(){j(U,0)};function J($,ae){R=j(function(){$(t.unstable_now())},ae)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function($){$.callback=null},t.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<$?Math.floor(1e3/$):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_next=function($){switch(x){case 1:case 2:case 3:var ae=3;break;default:ae=x}var ne=x;x=ae;try{return $()}finally{x=ne}},t.unstable_requestPaint=function(){O=!0},t.unstable_runWithPriority=function($,ae){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var ne=x;x=$;try{return ae()}finally{x=ne}},t.unstable_scheduleCallback=function($,ae,ne){var ce=t.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0ce?($.sortIndex=ne,e(h,$),n(d)===null&&$===n(h)&&(k?(T(R),R=-1):k=!0,J(D,ne-ce))):($.sortIndex=z,e(d,$),b||v||(b=!0,E||(E=!0,V()))),$},t.unstable_shouldYield=L,t.unstable_wrapCallback=function($){var ae=x;return function(){var ne=x;x=ae;try{return $.apply(this,arguments)}finally{x=ne}}}})(xy)),xy}var pO;function Rq(){return pO||(pO=1,gy.exports=Dq()),gy.exports}var gO;function zq(){if(gO)return Th;gO=1;var t=Rq(),e=PI(),n=BI();function r(o){var u="https://react.dev/errors/"+o;if(1z||(o.current=ce[z],ce[z]=null,z--)}function P(o,u){z++,ce[z]=o.current,o.current=u}var K=xe(null),H=xe(null),fe=xe(null),ve=xe(null);function Re(o,u){switch(P(fe,u),P(H,o),P(K,null),u.nodeType){case 9:case 11:o=(o=u.documentElement)&&(o=o.namespaceURI)?Mk(o):0;break;default:if(o=u.tagName,u=u.namespaceURI)u=Mk(u),o=Ek(u,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}Y(K),P(K,o)}function ue(){Y(K),Y(H),Y(fe)}function We(o){o.memoizedState!==null&&P(ve,o);var u=K.current,f=Ek(u,o.type);u!==f&&(P(H,o),P(K,f))}function ct(o){H.current===o&&(Y(K),Y(H)),ve.current===o&&(Y(ve),kh._currentValue=ne)}var Oe,nt;function ut(o){if(Oe===void 0)try{throw Error()}catch(f){var u=f.stack.trim().match(/\n( *(at )?)/);Oe=u&&u[1]||"",nt=-1)":-1y||Z[g]!==ge[y]){var je=` +`+Z[g].replace(" at new "," at ");return o.displayName&&je.includes("")&&(je=je.replace("",o.displayName)),je}while(1<=g&&0<=y);break}}}finally{Ct=!1,Error.prepareStackTrace=f}return(f=o?o.displayName||o.name:"")?ut(f):""}function Tn(o,u){switch(o.tag){case 26:case 27:case 5:return ut(o.type);case 16:return ut("Lazy");case 13:return o.child!==u&&u!==null?ut("Suspense Fallback"):ut("Suspense");case 19:return ut("SuspenseList");case 0:case 15:return In(o.type,!1);case 11:return In(o.type.render,!1);case 1:return In(o.type,!0);case 31:return ut("Activity");default:return""}}function Jn(o){try{var u="",f=null;do u+=Tn(o,f),f=o,o=o.return;while(o);return u}catch(g){return` +Error generating stack: `+g.message+` +`+g.stack}}var nn=Object.prototype.hasOwnProperty,_t=t.unstable_scheduleCallback,Yr=t.unstable_cancelCallback,qn=t.unstable_shouldYield,or=t.unstable_requestPaint,yn=t.unstable_now,ft=t.unstable_getCurrentPriorityLevel,ee=t.unstable_ImmediatePriority,Se=t.unstable_UserBlockingPriority,Be=t.unstable_NormalPriority,rt=t.unstable_LowPriority,Tt=t.unstable_IdlePriority,cr=t.log,Kr=t.unstable_setDisableYieldValue,re=null,Ae=null;function pt(o){if(typeof cr=="function"&&Kr(o),Ae&&typeof Ae.setStrictMode=="function")try{Ae.setStrictMode(re,o)}catch{}}var yt=Math.clz32?Math.clz32:Pn,vs=Math.log,dt=Math.LN2;function Pn(o){return o>>>=0,o===0?32:31-(vs(o)/dt|0)|0}var mt=256,rn=262144,Mr=4194304;function At(o){var u=o&42;if(u!==0)return u;switch(o&-o){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Ic(o,u,f){var g=o.pendingLanes;if(g===0)return 0;var y=0,w=o.suspendedLanes,M=o.pingedLanes;o=o.warmLanes;var I=g&134217727;return I!==0?(g=I&~w,g!==0?y=At(g):(M&=I,M!==0?y=At(M):f||(f=I&~o,f!==0&&(y=At(f))))):(I=g&~w,I!==0?y=At(I):M!==0?y=At(M):f||(f=g&~o,f!==0&&(y=At(f)))),y===0?0:u!==0&&u!==y&&(u&w)===0&&(w=y&-y,f=u&-u,w>=f||w===32&&(f&4194048)!==0)?u:y}function _o(o,u){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&u)===0}function t1(o,u){switch(o){case 1:case 2:case 4:case 8:case 64:return u+250;case 16:case 32: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 u+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function qc(){var o=Mr;return Mr<<=1,(Mr&62914560)===0&&(Mr=4194304),o}function Do(o){for(var u=[],f=0;31>f;f++)u.push(o);return u}function Bd(o,u){o.pendingLanes|=u,u!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function xB(o,u,f,g,y,w){var M=o.pendingLanes;o.pendingLanes=f,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=f,o.entangledLanes&=f,o.errorRecoveryDisabledLanes&=f,o.shellSuspendCounter=0;var I=o.entanglements,Z=o.expirationTimes,ge=o.hiddenUpdates;for(f=M&~f;0"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var kB=/[\n"\\]/g;function ci(o){return o.replace(kB,function(u){return"\\"+u.charCodeAt(0).toString(16)+" "})}function l1(o,u,f,g,y,w,M,I){o.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?o.type=M:o.removeAttribute("type"),u!=null?M==="number"?(u===0&&o.value===""||o.value!=u)&&(o.value=""+oi(u)):o.value!==""+oi(u)&&(o.value=""+oi(u)):M!=="submit"&&M!=="reset"||o.removeAttribute("value"),u!=null?o1(o,M,oi(u)):f!=null?o1(o,M,oi(f)):g!=null&&o.removeAttribute("value"),y==null&&w!=null&&(o.defaultChecked=!!w),y!=null&&(o.checked=y&&typeof y!="function"&&typeof y!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?o.name=""+oi(I):o.removeAttribute("name")}function O3(o,u,f,g,y,w,M,I){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(o.type=w),u!=null||f!=null){if(!(w!=="submit"&&w!=="reset"||u!=null)){a1(o);return}f=f!=null?""+oi(f):"",u=u!=null?""+oi(u):f,I||u===o.value||(o.value=u),o.defaultValue=u}g=g??y,g=typeof g!="function"&&typeof g!="symbol"&&!!g,o.checked=I?o.checked:!!g,o.defaultChecked=!!g,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(o.name=M),a1(o)}function o1(o,u,f){u==="number"&&P0(o.ownerDocument)===o||o.defaultValue===""+f||(o.defaultValue=""+f)}function Vc(o,u,f,g){if(o=o.options,u){u={};for(var y=0;y"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f1=!1;if(Da)try{var Fd={};Object.defineProperty(Fd,"passive",{get:function(){f1=!0}}),window.addEventListener("test",Fd,Fd),window.removeEventListener("test",Fd,Fd)}catch{f1=!1}var jl=null,m1=null,L0=null;function E3(){if(L0)return L0;var o,u=m1,f=u.length,g,y="value"in jl?jl.value:jl.textContent,w=y.length;for(o=0;o=Hd),B3=" ",L3=!1;function I3(o,u){switch(o){case"keyup":return KB.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function q3(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Yc=!1;function JB(o,u){switch(o){case"compositionend":return q3(u);case"keypress":return u.which!==32?null:(L3=!0,B3);case"textInput":return o=u.data,o===B3&&L3?null:o;default:return null}}function eL(o,u){if(Yc)return o==="compositionend"||!y1&&I3(o,u)?(o=E3(),L0=m1=jl=null,Yc=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1=u)return{node:f,offset:u-o};o=g}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=G3(f)}}function Y3(o,u){return o&&u?o===u?!0:o&&o.nodeType===3?!1:u&&u.nodeType===3?Y3(o,u.parentNode):"contains"in o?o.contains(u):o.compareDocumentPosition?!!(o.compareDocumentPosition(u)&16):!1:!1}function K3(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var u=P0(o.document);u instanceof o.HTMLIFrameElement;){try{var f=typeof u.contentWindow.location.href=="string"}catch{f=!1}if(f)o=u.contentWindow;else break;u=P0(o.document)}return u}function S1(o){var u=o&&o.nodeName&&o.nodeName.toLowerCase();return u&&(u==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||u==="textarea"||o.contentEditable==="true")}var oL=Da&&"documentMode"in document&&11>=document.documentMode,Kc=null,k1=null,Gd=null,O1=!1;function Z3(o,u,f){var g=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;O1||Kc==null||Kc!==P0(g)||(g=Kc,"selectionStart"in g&&S1(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Gd&&Wd(Gd,g)||(Gd=g,g=Em(k1,"onSelect"),0>=M,y-=M,Yi=1<<32-yt(u)+y|f<kt?(Qt=Ke,Ke=null):Qt=Ke.sibling;var en=be(oe,Ke,me[kt],Ne);if(en===null){Ke===null&&(Ke=Qt);break}o&&Ke&&en.alternate===null&&u(oe,Ke),se=w(en,se,kt),Jt===null?tt=en:Jt.sibling=en,Jt=en,Ke=Qt}if(kt===me.length)return f(oe,Ke),Ut&&za(oe,kt),tt;if(Ke===null){for(;ktkt?(Qt=Ke,Ke=null):Qt=Ke.sibling;var Wl=be(oe,Ke,en.value,Ne);if(Wl===null){Ke===null&&(Ke=Qt);break}o&&Ke&&Wl.alternate===null&&u(oe,Ke),se=w(Wl,se,kt),Jt===null?tt=Wl:Jt.sibling=Wl,Jt=Wl,Ke=Qt}if(en.done)return f(oe,Ke),Ut&&za(oe,kt),tt;if(Ke===null){for(;!en.done;kt++,en=me.next())en=Te(oe,en.value,Ne),en!==null&&(se=w(en,se,kt),Jt===null?tt=en:Jt.sibling=en,Jt=en);return Ut&&za(oe,kt),tt}for(Ke=g(Ke);!en.done;kt++,en=me.next())en=ke(Ke,oe,kt,en.value,Ne),en!==null&&(o&&en.alternate!==null&&Ke.delete(en.key===null?kt:en.key),se=w(en,se,kt),Jt===null?tt=en:Jt.sibling=en,Jt=en);return o&&Ke.forEach(function(TI){return u(oe,TI)}),Ut&&za(oe,kt),tt}function Sn(oe,se,me,Ne){if(typeof me=="object"&&me!==null&&me.type===k&&me.key===null&&(me=me.props.children),typeof me=="object"&&me!==null){switch(me.$$typeof){case v:e:{for(var tt=me.key;se!==null;){if(se.key===tt){if(tt=me.type,tt===k){if(se.tag===7){f(oe,se.sibling),Ne=y(se,me.props.children),Ne.return=oe,oe=Ne;break e}}else if(se.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===Q&&Ho(tt)===se.type){f(oe,se.sibling),Ne=y(se,me.props),eh(Ne,me),Ne.return=oe,oe=Ne;break e}f(oe,se);break}else u(oe,se);se=se.sibling}me.type===k?(Ne=Io(me.props.children,oe.mode,Ne,me.key),Ne.return=oe,oe=Ne):(Ne=G0(me.type,me.key,me.props,null,oe.mode,Ne),eh(Ne,me),Ne.return=oe,oe=Ne)}return M(oe);case b:e:{for(tt=me.key;se!==null;){if(se.key===tt)if(se.tag===4&&se.stateNode.containerInfo===me.containerInfo&&se.stateNode.implementation===me.implementation){f(oe,se.sibling),Ne=y(se,me.children||[]),Ne.return=oe,oe=Ne;break e}else{f(oe,se);break}else u(oe,se);se=se.sibling}Ne=E1(me,oe.mode,Ne),Ne.return=oe,oe=Ne}return M(oe);case Q:return me=Ho(me),Sn(oe,se,me,Ne)}if(J(me))return Ge(oe,se,me,Ne);if(V(me)){if(tt=V(me),typeof tt!="function")throw Error(r(150));return me=tt.call(me),lt(oe,se,me,Ne)}if(typeof me.then=="function")return Sn(oe,se,tm(me),Ne);if(me.$$typeof===A)return Sn(oe,se,K0(oe,me),Ne);nm(oe,me)}return typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint"?(me=""+me,se!==null&&se.tag===6?(f(oe,se.sibling),Ne=y(se,me),Ne.return=oe,oe=Ne):(f(oe,se),Ne=M1(me,oe.mode,Ne),Ne.return=oe,oe=Ne),M(oe)):f(oe,se)}return function(oe,se,me,Ne){try{Jd=0;var tt=Sn(oe,se,me,Ne);return ou=null,tt}catch(Ke){if(Ke===lu||Ke===J0)throw Ke;var Jt=Hs(29,Ke,null,oe.mode);return Jt.lanes=Ne,Jt.return=oe,Jt}finally{}}}var Vo=w6(!0),S6=w6(!1),Ml=!1;function $1(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function H1(o,u){o=o.updateQueue,u.updateQueue===o&&(u.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function El(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function _l(o,u,f){var g=o.updateQueue;if(g===null)return null;if(g=g.shared,(sn&2)!==0){var y=g.pending;return y===null?u.next=u:(u.next=y.next,y.next=u),g.pending=u,u=W0(o),i6(o,null,f),u}return V0(o,g,u,f),W0(o)}function th(o,u,f){if(u=u.updateQueue,u!==null&&(u=u.shared,(f&4194048)!==0)){var g=u.lanes;g&=o.pendingLanes,f|=g,u.lanes=f,f3(o,f)}}function U1(o,u){var f=o.updateQueue,g=o.alternate;if(g!==null&&(g=g.updateQueue,f===g)){var y=null,w=null;if(f=f.firstBaseUpdate,f!==null){do{var M={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};w===null?y=w=M:w=w.next=M,f=f.next}while(f!==null);w===null?y=w=u:w=w.next=u}else y=w=u;f={baseState:g.baseState,firstBaseUpdate:y,lastBaseUpdate:w,shared:g.shared,callbacks:g.callbacks},o.updateQueue=f;return}o=f.lastBaseUpdate,o===null?f.firstBaseUpdate=u:o.next=u,f.lastBaseUpdate=u}var V1=!1;function nh(){if(V1){var o=au;if(o!==null)throw o}}function rh(o,u,f,g){V1=!1;var y=o.updateQueue;Ml=!1;var w=y.firstBaseUpdate,M=y.lastBaseUpdate,I=y.shared.pending;if(I!==null){y.shared.pending=null;var Z=I,ge=Z.next;Z.next=null,M===null?w=ge:M.next=ge,M=Z;var je=o.alternate;je!==null&&(je=je.updateQueue,I=je.lastBaseUpdate,I!==M&&(I===null?je.firstBaseUpdate=ge:I.next=ge,je.lastBaseUpdate=Z))}if(w!==null){var Te=y.baseState;M=0,je=ge=Z=null,I=w;do{var be=I.lane&-536870913,ke=be!==I.lane;if(ke?(Ft&be)===be:(g&be)===be){be!==0&&be===iu&&(V1=!0),je!==null&&(je=je.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});e:{var Ge=o,lt=I;be=u;var Sn=f;switch(lt.tag){case 1:if(Ge=lt.payload,typeof Ge=="function"){Te=Ge.call(Sn,Te,be);break e}Te=Ge;break e;case 3:Ge.flags=Ge.flags&-65537|128;case 0:if(Ge=lt.payload,be=typeof Ge=="function"?Ge.call(Sn,Te,be):Ge,be==null)break e;Te=p({},Te,be);break e;case 2:Ml=!0}}be=I.callback,be!==null&&(o.flags|=64,ke&&(o.flags|=8192),ke=y.callbacks,ke===null?y.callbacks=[be]:ke.push(be))}else ke={lane:be,tag:I.tag,payload:I.payload,callback:I.callback,next:null},je===null?(ge=je=ke,Z=Te):je=je.next=ke,M|=be;if(I=I.next,I===null){if(I=y.shared.pending,I===null)break;ke=I,I=ke.next,ke.next=null,y.lastBaseUpdate=ke,y.shared.pending=null}}while(!0);je===null&&(Z=Te),y.baseState=Z,y.firstBaseUpdate=ge,y.lastBaseUpdate=je,w===null&&(y.shared.lanes=0),Bl|=M,o.lanes=M,o.memoizedState=Te}}function k6(o,u){if(typeof o!="function")throw Error(r(191,o));o.call(u)}function O6(o,u){var f=o.callbacks;if(f!==null)for(o.callbacks=null,o=0;ow?w:8;var M=$.T,I={};$.T=I,dv(o,!1,u,f);try{var Z=y(),ge=$.S;if(ge!==null&&ge(I,Z),Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var je=xL(Z,g);ah(o,u,je,Xs(o))}else ah(o,u,g,Xs(o))}catch(Te){ah(o,u,{then:function(){},status:"rejected",reason:Te},Xs())}finally{ae.p=w,M!==null&&I.types!==null&&(M.types=I.types),$.T=M}}function kL(){}function cv(o,u,f,g){if(o.tag!==5)throw Error(r(476));var y=nS(o).queue;tS(o,y,u,ne,f===null?kL:function(){return rS(o),f(g)})}function nS(o){var u=o.memoizedState;if(u!==null)return u;u={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ia,lastRenderedState:ne},next:null};var f={};return u.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ia,lastRenderedState:f},next:null},o.memoizedState=u,o=o.alternate,o!==null&&(o.memoizedState=u),u}function rS(o){var u=nS(o);u.next===null&&(u=o.alternate.memoizedState),ah(o,u.next.queue,{},Xs())}function uv(){return qr(kh)}function sS(){return sr().memoizedState}function iS(){return sr().memoizedState}function OL(o){for(var u=o.return;u!==null;){switch(u.tag){case 24:case 3:var f=Xs();o=El(f);var g=_l(u,o,f);g!==null&&(js(g,u,f),th(g,u,f)),u={cache:I1()},o.payload=u;return}u=u.return}}function jL(o,u,f){var g=Xs();f={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},hm(o)?lS(u,f):(f=T1(o,u,f,g),f!==null&&(js(f,o,g),oS(f,u,g)))}function aS(o,u,f){var g=Xs();ah(o,u,f,g)}function ah(o,u,f,g){var y={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(hm(o))lS(u,y);else{var w=o.alternate;if(o.lanes===0&&(w===null||w.lanes===0)&&(w=u.lastRenderedReducer,w!==null))try{var M=u.lastRenderedState,I=w(M,f);if(y.hasEagerState=!0,y.eagerState=I,$s(I,M))return V0(o,u,y,0),An===null&&U0(),!1}catch{}finally{}if(f=T1(o,u,y,g),f!==null)return js(f,o,g),oS(f,u,g),!0}return!1}function dv(o,u,f,g){if(g={lane:2,revertLane:$v(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},hm(o)){if(u)throw Error(r(479))}else u=T1(o,f,g,2),u!==null&&js(u,o,2)}function hm(o){var u=o.alternate;return o===wt||u!==null&&u===wt}function lS(o,u){uu=im=!0;var f=o.pending;f===null?u.next=u:(u.next=f.next,f.next=u),o.pending=u}function oS(o,u,f){if((f&4194048)!==0){var g=u.lanes;g&=o.pendingLanes,f|=g,u.lanes=f,f3(o,f)}}var lh={readContext:qr,use:om,useCallback:er,useContext:er,useEffect:er,useImperativeHandle:er,useLayoutEffect:er,useInsertionEffect:er,useMemo:er,useReducer:er,useRef:er,useState:er,useDebugValue:er,useDeferredValue:er,useTransition:er,useSyncExternalStore:er,useId:er,useHostTransitionStatus:er,useFormState:er,useActionState:er,useOptimistic:er,useMemoCache:er,useCacheRefresh:er};lh.useEffectEvent=er;var cS={readContext:qr,use:om,useCallback:function(o,u){return os().memoizedState=[o,u===void 0?null:u],o},useContext:qr,useEffect:V6,useImperativeHandle:function(o,u,f){f=f!=null?f.concat([o]):null,um(4194308,4,Y6.bind(null,u,o),f)},useLayoutEffect:function(o,u){return um(4194308,4,o,u)},useInsertionEffect:function(o,u){um(4,2,o,u)},useMemo:function(o,u){var f=os();u=u===void 0?null:u;var g=o();if(Wo){pt(!0);try{o()}finally{pt(!1)}}return f.memoizedState=[g,u],g},useReducer:function(o,u,f){var g=os();if(f!==void 0){var y=f(u);if(Wo){pt(!0);try{f(u)}finally{pt(!1)}}}else y=u;return g.memoizedState=g.baseState=y,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:y},g.queue=o,o=o.dispatch=jL.bind(null,wt,o),[g.memoizedState,o]},useRef:function(o){var u=os();return o={current:o},u.memoizedState=o},useState:function(o){o=sv(o);var u=o.queue,f=aS.bind(null,wt,u);return u.dispatch=f,[o.memoizedState,f]},useDebugValue:lv,useDeferredValue:function(o,u){var f=os();return ov(f,o,u)},useTransition:function(){var o=sv(!1);return o=tS.bind(null,wt,o.queue,!0,!1),os().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,u,f){var g=wt,y=os();if(Ut){if(f===void 0)throw Error(r(407));f=f()}else{if(f=u(),An===null)throw Error(r(349));(Ft&127)!==0||M6(g,u,f)}y.memoizedState=f;var w={value:f,getSnapshot:u};return y.queue=w,V6(_6.bind(null,g,w,o),[o]),g.flags|=2048,hu(9,{destroy:void 0},E6.bind(null,g,w,f,u),null),f},useId:function(){var o=os(),u=An.identifierPrefix;if(Ut){var f=Ki,g=Yi;f=(g&~(1<<32-yt(g)-1)).toString(32)+f,u="_"+u+"R_"+f,f=am++,0<\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof g.is=="string"?M.createElement("select",{is:g.is}):M.createElement("select"),g.multiple?w.multiple=!0:g.size&&(w.size=g.size);break;default:w=typeof g.is=="string"?M.createElement(y,{is:g.is}):M.createElement(y)}}w[Lr]=u,w[ys]=g;e:for(M=u.child;M!==null;){if(M.tag===5||M.tag===6)w.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===u)break e;for(;M.sibling===null;){if(M.return===null||M.return===u)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}u.stateNode=w;e:switch(Qr(w,y,g),y){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&Fa(u)}}return Qn(u),jv(u,u.type,o===null?null:o.memoizedProps,u.pendingProps,f),null;case 6:if(o&&u.stateNode!=null)o.memoizedProps!==g&&Fa(u);else{if(typeof g!="string"&&u.stateNode===null)throw Error(r(166));if(o=fe.current,ru(u)){if(o=u.stateNode,f=u.memoizedProps,g=null,y=Ir,y!==null)switch(y.tag){case 27:case 5:g=y.memoizedProps}o[Lr]=u,o=!!(o.nodeValue===f||g!==null&&g.suppressHydrationWarning===!0||Tk(o.nodeValue,f)),o||Tl(u,!0)}else o=_m(o).createTextNode(g),o[Lr]=u,u.stateNode=o}return Qn(u),null;case 31:if(f=u.memoizedState,o===null||o.memoizedState!==null){if(g=ru(u),f!==null){if(o===null){if(!g)throw Error(r(318));if(o=u.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[Lr]=u}else qo(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Qn(u),o=!1}else f=z1(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=f),o=!0;if(!o)return u.flags&256?(Vs(u),u):(Vs(u),null);if((u.flags&128)!==0)throw Error(r(558))}return Qn(u),null;case 13:if(g=u.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(y=ru(u),g!==null&&g.dehydrated!==null){if(o===null){if(!y)throw Error(r(318));if(y=u.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(r(317));y[Lr]=u}else qo(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Qn(u),y=!1}else y=z1(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=y),y=!0;if(!y)return u.flags&256?(Vs(u),u):(Vs(u),null)}return Vs(u),(u.flags&128)!==0?(u.lanes=f,u):(f=g!==null,o=o!==null&&o.memoizedState!==null,f&&(g=u.child,y=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(y=g.alternate.memoizedState.cachePool.pool),w=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(w=g.memoizedState.cachePool.pool),w!==y&&(g.flags|=2048)),f!==o&&f&&(u.child.flags|=8192),xm(u,u.updateQueue),Qn(u),null);case 4:return ue(),o===null&&Wv(u.stateNode.containerInfo),Qn(u),null;case 10:return Ba(u.type),Qn(u),null;case 19:if(Y(rr),g=u.memoizedState,g===null)return Qn(u),null;if(y=(u.flags&128)!==0,w=g.rendering,w===null)if(y)ch(g,!1);else{if(tr!==0||o!==null&&(o.flags&128)!==0)for(o=u.child;o!==null;){if(w=sm(o),w!==null){for(u.flags|=128,ch(g,!1),o=w.updateQueue,u.updateQueue=o,xm(u,o),u.subtreeFlags=0,o=f,f=u.child;f!==null;)a6(f,o),f=f.sibling;return P(rr,rr.current&1|2),Ut&&za(u,g.treeForkCount),u.child}o=o.sibling}g.tail!==null&&yn()>Sm&&(u.flags|=128,y=!0,ch(g,!1),u.lanes=4194304)}else{if(!y)if(o=sm(w),o!==null){if(u.flags|=128,y=!0,o=o.updateQueue,u.updateQueue=o,xm(u,o),ch(g,!0),g.tail===null&&g.tailMode==="hidden"&&!w.alternate&&!Ut)return Qn(u),null}else 2*yn()-g.renderingStartTime>Sm&&f!==536870912&&(u.flags|=128,y=!0,ch(g,!1),u.lanes=4194304);g.isBackwards?(w.sibling=u.child,u.child=w):(o=g.last,o!==null?o.sibling=w:u.child=w,g.last=w)}return g.tail!==null?(o=g.tail,g.rendering=o,g.tail=o.sibling,g.renderingStartTime=yn(),o.sibling=null,f=rr.current,P(rr,y?f&1|2:f&1),Ut&&za(u,g.treeForkCount),o):(Qn(u),null);case 22:case 23:return Vs(u),G1(),g=u.memoizedState!==null,o!==null?o.memoizedState!==null!==g&&(u.flags|=8192):g&&(u.flags|=8192),g?(f&536870912)!==0&&(u.flags&128)===0&&(Qn(u),u.subtreeFlags&6&&(u.flags|=8192)):Qn(u),f=u.updateQueue,f!==null&&xm(u,f.retryQueue),f=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==f&&(u.flags|=2048),o!==null&&Y($o),null;case 24:return f=null,o!==null&&(f=o.memoizedState.cache),u.memoizedState.cache!==f&&(u.flags|=2048),Ba(ur),Qn(u),null;case 25:return null;case 30:return null}throw Error(r(156,u.tag))}function ML(o,u){switch(D1(u),u.tag){case 1:return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 3:return Ba(ur),ue(),o=u.flags,(o&65536)!==0&&(o&128)===0?(u.flags=o&-65537|128,u):null;case 26:case 27:case 5:return ct(u),null;case 31:if(u.memoizedState!==null){if(Vs(u),u.alternate===null)throw Error(r(340));qo()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 13:if(Vs(u),o=u.memoizedState,o!==null&&o.dehydrated!==null){if(u.alternate===null)throw Error(r(340));qo()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 19:return Y(rr),null;case 4:return ue(),null;case 10:return Ba(u.type),null;case 22:case 23:return Vs(u),G1(),o!==null&&Y($o),o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 24:return Ba(ur),null;case 25:return null;default:return null}}function DS(o,u){switch(D1(u),u.tag){case 3:Ba(ur),ue();break;case 26:case 27:case 5:ct(u);break;case 4:ue();break;case 31:u.memoizedState!==null&&Vs(u);break;case 13:Vs(u);break;case 19:Y(rr);break;case 10:Ba(u.type);break;case 22:case 23:Vs(u),G1(),o!==null&&Y($o);break;case 24:Ba(ur)}}function uh(o,u){try{var f=u.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var y=g.next;f=y;do{if((f.tag&o)===o){g=void 0;var w=f.create,M=f.inst;g=w(),M.destroy=g}f=f.next}while(f!==y)}}catch(I){gn(u,u.return,I)}}function zl(o,u,f){try{var g=u.updateQueue,y=g!==null?g.lastEffect:null;if(y!==null){var w=y.next;g=w;do{if((g.tag&o)===o){var M=g.inst,I=M.destroy;if(I!==void 0){M.destroy=void 0,y=u;var Z=f,ge=I;try{ge()}catch(je){gn(y,Z,je)}}}g=g.next}while(g!==w)}}catch(je){gn(u,u.return,je)}}function RS(o){var u=o.updateQueue;if(u!==null){var f=o.stateNode;try{O6(u,f)}catch(g){gn(o,o.return,g)}}}function zS(o,u,f){f.props=Go(o.type,o.memoizedProps),f.state=o.memoizedState;try{f.componentWillUnmount()}catch(g){gn(o,u,g)}}function dh(o,u){try{var f=o.ref;if(f!==null){switch(o.tag){case 26:case 27:case 5:var g=o.stateNode;break;case 30:g=o.stateNode;break;default:g=o.stateNode}typeof f=="function"?o.refCleanup=f(g):f.current=g}}catch(y){gn(o,u,y)}}function Zi(o,u){var f=o.ref,g=o.refCleanup;if(f!==null)if(typeof g=="function")try{g()}catch(y){gn(o,u,y)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(y){gn(o,u,y)}else f.current=null}function PS(o){var u=o.type,f=o.memoizedProps,g=o.stateNode;try{e:switch(u){case"button":case"input":case"select":case"textarea":f.autoFocus&&g.focus();break e;case"img":f.src?g.src=f.src:f.srcSet&&(g.srcset=f.srcSet)}}catch(y){gn(o,o.return,y)}}function Nv(o,u,f){try{var g=o.stateNode;ZL(g,o.type,f,u),g[ys]=u}catch(y){gn(o,o.return,y)}}function BS(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Ql(o.type)||o.tag===4}function Cv(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||BS(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Ql(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Tv(o,u,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,u?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(o,u):(u=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,u.appendChild(o),f=f._reactRootContainer,f!=null||u.onclick!==null||(u.onclick=_a));else if(g!==4&&(g===27&&Ql(o.type)&&(f=o.stateNode,u=null),o=o.child,o!==null))for(Tv(o,u,f),o=o.sibling;o!==null;)Tv(o,u,f),o=o.sibling}function vm(o,u,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,u?f.insertBefore(o,u):f.appendChild(o);else if(g!==4&&(g===27&&Ql(o.type)&&(f=o.stateNode),o=o.child,o!==null))for(vm(o,u,f),o=o.sibling;o!==null;)vm(o,u,f),o=o.sibling}function LS(o){var u=o.stateNode,f=o.memoizedProps;try{for(var g=o.type,y=u.attributes;y.length;)u.removeAttributeNode(y[0]);Qr(u,g,f),u[Lr]=o,u[ys]=f}catch(w){gn(o,o.return,w)}}var Qa=!1,fr=!1,Av=!1,IS=typeof WeakSet=="function"?WeakSet:Set,_r=null;function EL(o,u){if(o=o.containerInfo,Yv=Im,o=K3(o),S1(o)){if("selectionStart"in o)var f={start:o.selectionStart,end:o.selectionEnd};else e:{f=(f=o.ownerDocument)&&f.defaultView||window;var g=f.getSelection&&f.getSelection();if(g&&g.rangeCount!==0){f=g.anchorNode;var y=g.anchorOffset,w=g.focusNode;g=g.focusOffset;try{f.nodeType,w.nodeType}catch{f=null;break e}var M=0,I=-1,Z=-1,ge=0,je=0,Te=o,be=null;t:for(;;){for(var ke;Te!==f||y!==0&&Te.nodeType!==3||(I=M+y),Te!==w||g!==0&&Te.nodeType!==3||(Z=M+g),Te.nodeType===3&&(M+=Te.nodeValue.length),(ke=Te.firstChild)!==null;)be=Te,Te=ke;for(;;){if(Te===o)break t;if(be===f&&++ge===y&&(I=M),be===w&&++je===g&&(Z=M),(ke=Te.nextSibling)!==null)break;Te=be,be=Te.parentNode}Te=ke}f=I===-1||Z===-1?null:{start:I,end:Z}}else f=null}f=f||{start:0,end:0}}else f=null;for(Kv={focusedElem:o,selectionRange:f},Im=!1,_r=u;_r!==null;)if(u=_r,o=u.child,(u.subtreeFlags&1028)!==0&&o!==null)o.return=u,_r=o;else for(;_r!==null;){switch(u=_r,w=u.alternate,o=u.flags,u.tag){case 0:if((o&4)!==0&&(o=u.updateQueue,o=o!==null?o.events:null,o!==null))for(f=0;f title"))),Qr(w,g,f),w[Lr]=o,Er(w),g=w;break e;case"link":var M=Uk("link","href",y).get(g+(f.href||""));if(M){for(var I=0;ISn&&(M=Sn,Sn=lt,lt=M);var oe=X3(I,lt),se=X3(I,Sn);if(oe&&se&&(ke.rangeCount!==1||ke.anchorNode!==oe.node||ke.anchorOffset!==oe.offset||ke.focusNode!==se.node||ke.focusOffset!==se.offset)){var me=Te.createRange();me.setStart(oe.node,oe.offset),ke.removeAllRanges(),lt>Sn?(ke.addRange(me),ke.extend(se.node,se.offset)):(me.setEnd(se.node,se.offset),ke.addRange(me))}}}}for(Te=[],ke=I;ke=ke.parentNode;)ke.nodeType===1&&Te.push({element:ke,left:ke.scrollLeft,top:ke.scrollTop});for(typeof I.focus=="function"&&I.focus(),I=0;If?32:f,$.T=null,f=Pv,Pv=null;var w=Il,M=Wa;if(br=0,xu=Il=null,Wa=0,(sn&6)!==0)throw Error(r(331));var I=sn;if(sn|=4,YS(w.current),WS(w,w.current,M,f),sn=I,xh(0,!1),Ae&&typeof Ae.onPostCommitFiberRoot=="function")try{Ae.onPostCommitFiberRoot(re,w)}catch{}return!0}finally{ae.p=y,$.T=g,mk(o,u)}}function gk(o,u,f){u=di(f,u),u=pv(o.stateNode,u,2),o=_l(o,u,2),o!==null&&(Bd(o,2),Ji(o))}function gn(o,u,f){if(o.tag===3)gk(o,o,f);else for(;u!==null;){if(u.tag===3){gk(u,o,f);break}else if(u.tag===1){var g=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Ll===null||!Ll.has(g))){o=di(f,o),f=xS(2),g=_l(u,f,2),g!==null&&(vS(f,g,u,o),Bd(g,2),Ji(g));break}}u=u.return}}function qv(o,u,f){var g=o.pingCache;if(g===null){g=o.pingCache=new RL;var y=new Set;g.set(u,y)}else y=g.get(u),y===void 0&&(y=new Set,g.set(u,y));y.has(f)||(_v=!0,y.add(f),o=IL.bind(null,o,u,f),u.then(o,o))}function IL(o,u,f){var g=o.pingCache;g!==null&&g.delete(u),o.pingedLanes|=o.suspendedLanes&f,o.warmLanes&=~f,An===o&&(Ft&f)===f&&(tr===4||tr===3&&(Ft&62914560)===Ft&&300>yn()-wm?(sn&2)===0&&vu(o,0):Dv|=f,gu===Ft&&(gu=0)),Ji(o)}function xk(o,u){u===0&&(u=qc()),o=Lo(o,u),o!==null&&(Bd(o,u),Ji(o))}function qL(o){var u=o.memoizedState,f=0;u!==null&&(f=u.retryLane),xk(o,f)}function FL(o,u){var f=0;switch(o.tag){case 31:case 13:var g=o.stateNode,y=o.memoizedState;y!==null&&(f=y.retryLane);break;case 19:g=o.stateNode;break;case 22:g=o.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(u),xk(o,f)}function QL(o,u){return _t(o,u)}var Tm=null,bu=null,Fv=!1,Am=!1,Qv=!1,Fl=0;function Ji(o){o!==bu&&o.next===null&&(bu===null?Tm=bu=o:bu=bu.next=o),Am=!0,Fv||(Fv=!0,HL())}function xh(o,u){if(!Qv&&Am){Qv=!0;do for(var f=!1,g=Tm;g!==null;){if(o!==0){var y=g.pendingLanes;if(y===0)var w=0;else{var M=g.suspendedLanes,I=g.pingedLanes;w=(1<<31-yt(42|o)+1)-1,w&=y&~(M&~I),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(f=!0,wk(g,w))}else w=Ft,w=Ic(g,g===An?w:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(w&3)===0||_o(g,w)||(f=!0,wk(g,w));g=g.next}while(f);Qv=!1}}function $L(){vk()}function vk(){Am=Fv=!1;var o=0;Fl!==0&&eI()&&(o=Fl);for(var u=yn(),f=null,g=Tm;g!==null;){var y=g.next,w=yk(g,u);w===0?(g.next=null,f===null?Tm=y:f.next=y,y===null&&(bu=f)):(f=g,(o!==0||(w&3)!==0)&&(Am=!0)),g=y}br!==0&&br!==5||xh(o),Fl!==0&&(Fl=0)}function yk(o,u){for(var f=o.suspendedLanes,g=o.pingedLanes,y=o.expirationTimes,w=o.pendingLanes&-62914561;0I)break;var je=Z.transferSize,Te=Z.initiatorType;je&&Ak(Te)&&(Z=Z.responseEnd,M+=je*(Z"u"?null:document;function Fk(o,u,f){var g=wu;if(g&&typeof u=="string"&&u){var y=ci(u);y='link[rel="'+o+'"][href="'+y+'"]',typeof f=="string"&&(y+='[crossorigin="'+f+'"]'),qk.has(y)||(qk.add(y),o={rel:o,crossOrigin:f,href:u},g.querySelector(y)===null&&(u=g.createElement("link"),Qr(u,"link",o),Er(u),g.head.appendChild(u)))}}function cI(o){Ga.D(o),Fk("dns-prefetch",o,null)}function uI(o,u){Ga.C(o,u),Fk("preconnect",o,u)}function dI(o,u,f){Ga.L(o,u,f);var g=wu;if(g&&o&&u){var y='link[rel="preload"][as="'+ci(u)+'"]';u==="image"&&f&&f.imageSrcSet?(y+='[imagesrcset="'+ci(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(y+='[imagesizes="'+ci(f.imageSizes)+'"]')):y+='[href="'+ci(o)+'"]';var w=y;switch(u){case"style":w=Su(o);break;case"script":w=ku(o)}xi.has(w)||(o=p({rel:"preload",href:u==="image"&&f&&f.imageSrcSet?void 0:o,as:u},f),xi.set(w,o),g.querySelector(y)!==null||u==="style"&&g.querySelector(wh(w))||u==="script"&&g.querySelector(Sh(w))||(u=g.createElement("link"),Qr(u,"link",o),Er(u),g.head.appendChild(u)))}}function hI(o,u){Ga.m(o,u);var f=wu;if(f&&o){var g=u&&typeof u.as=="string"?u.as:"script",y='link[rel="modulepreload"][as="'+ci(g)+'"][href="'+ci(o)+'"]',w=y;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=ku(o)}if(!xi.has(w)&&(o=p({rel:"modulepreload",href:o},u),xi.set(w,o),f.querySelector(y)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(Sh(w)))return}g=f.createElement("link"),Qr(g,"link",o),Er(g),f.head.appendChild(g)}}}function fI(o,u,f){Ga.S(o,u,f);var g=wu;if(g&&o){var y=Hc(g).hoistableStyles,w=Su(o);u=u||"default";var M=y.get(w);if(!M){var I={loading:0,preload:null};if(M=g.querySelector(wh(w)))I.loading=5;else{o=p({rel:"stylesheet",href:o,"data-precedence":u},f),(f=xi.get(w))&&sy(o,f);var Z=M=g.createElement("link");Er(Z),Qr(Z,"link",o),Z._p=new Promise(function(ge,je){Z.onload=ge,Z.onerror=je}),Z.addEventListener("load",function(){I.loading|=1}),Z.addEventListener("error",function(){I.loading|=2}),I.loading|=4,Rm(M,u,g)}M={type:"stylesheet",instance:M,count:1,state:I},y.set(w,M)}}}function mI(o,u){Ga.X(o,u);var f=wu;if(f&&o){var g=Hc(f).hoistableScripts,y=ku(o),w=g.get(y);w||(w=f.querySelector(Sh(y)),w||(o=p({src:o,async:!0},u),(u=xi.get(y))&&iy(o,u),w=f.createElement("script"),Er(w),Qr(w,"link",o),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(y,w))}}function pI(o,u){Ga.M(o,u);var f=wu;if(f&&o){var g=Hc(f).hoistableScripts,y=ku(o),w=g.get(y);w||(w=f.querySelector(Sh(y)),w||(o=p({src:o,async:!0,type:"module"},u),(u=xi.get(y))&&iy(o,u),w=f.createElement("script"),Er(w),Qr(w,"link",o),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(y,w))}}function Qk(o,u,f,g){var y=(y=fe.current)?Dm(y):null;if(!y)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(u=Su(f.href),f=Hc(y).hoistableStyles,g=f.get(u),g||(g={type:"style",instance:null,count:0,state:null},f.set(u,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){o=Su(f.href);var w=Hc(y).hoistableStyles,M=w.get(o);if(M||(y=y.ownerDocument||y,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(o,M),(w=y.querySelector(wh(o)))&&!w._p&&(M.instance=w,M.state.loading=5),xi.has(o)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},xi.set(o,f),w||gI(y,o,f,M.state))),u&&g===null)throw Error(r(528,""));return M}if(u&&g!==null)throw Error(r(529,""));return null;case"script":return u=f.async,f=f.src,typeof f=="string"&&u&&typeof u!="function"&&typeof u!="symbol"?(u=ku(f),f=Hc(y).hoistableScripts,g=f.get(u),g||(g={type:"script",instance:null,count:0,state:null},f.set(u,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function Su(o){return'href="'+ci(o)+'"'}function wh(o){return'link[rel="stylesheet"]['+o+"]"}function $k(o){return p({},o,{"data-precedence":o.precedence,precedence:null})}function gI(o,u,f,g){o.querySelector('link[rel="preload"][as="style"]['+u+"]")?g.loading=1:(u=o.createElement("link"),g.preload=u,u.addEventListener("load",function(){return g.loading|=1}),u.addEventListener("error",function(){return g.loading|=2}),Qr(u,"link",f),Er(u),o.head.appendChild(u))}function ku(o){return'[src="'+ci(o)+'"]'}function Sh(o){return"script[async]"+o}function Hk(o,u,f){if(u.count++,u.instance===null)switch(u.type){case"style":var g=o.querySelector('style[data-href~="'+ci(f.href)+'"]');if(g)return u.instance=g,Er(g),g;var y=p({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return g=(o.ownerDocument||o).createElement("style"),Er(g),Qr(g,"style",y),Rm(g,f.precedence,o),u.instance=g;case"stylesheet":y=Su(f.href);var w=o.querySelector(wh(y));if(w)return u.state.loading|=4,u.instance=w,Er(w),w;g=$k(f),(y=xi.get(y))&&sy(g,y),w=(o.ownerDocument||o).createElement("link"),Er(w);var M=w;return M._p=new Promise(function(I,Z){M.onload=I,M.onerror=Z}),Qr(w,"link",g),u.state.loading|=4,Rm(w,f.precedence,o),u.instance=w;case"script":return w=ku(f.src),(y=o.querySelector(Sh(w)))?(u.instance=y,Er(y),y):(g=f,(y=xi.get(w))&&(g=p({},f),iy(g,y)),o=o.ownerDocument||o,y=o.createElement("script"),Er(y),Qr(y,"link",g),o.head.appendChild(y),u.instance=y);case"void":return null;default:throw Error(r(443,u.type))}else u.type==="stylesheet"&&(u.state.loading&4)===0&&(g=u.instance,u.state.loading|=4,Rm(g,f.precedence,o));return u.instance}function Rm(o,u,f){for(var g=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=g.length?g[g.length-1]:null,w=y,M=0;M title"):null)}function xI(o,u,f){if(f===1||u.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof u.precedence!="string"||typeof u.href!="string"||u.href==="")break;return!0;case"link":if(typeof u.rel!="string"||typeof u.href!="string"||u.href===""||u.onLoad||u.onError)break;switch(u.rel){case"stylesheet":return o=u.disabled,typeof u.precedence=="string"&&o==null;default:return!0}case"script":if(u.async&&typeof u.async!="function"&&typeof u.async!="symbol"&&!u.onLoad&&!u.onError&&u.src&&typeof u.src=="string")return!0}return!1}function Wk(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function vI(o,u,f,g){if(f.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var y=Su(g.href),w=u.querySelector(wh(y));if(w){u=w._p,u!==null&&typeof u=="object"&&typeof u.then=="function"&&(o.count++,o=Pm.bind(o),u.then(o,o)),f.state.loading|=4,f.instance=w,Er(w);return}w=u.ownerDocument||u,g=$k(g),(y=xi.get(y))&&sy(g,y),w=w.createElement("link"),Er(w);var M=w;M._p=new Promise(function(I,Z){M.onload=I,M.onerror=Z}),Qr(w,"link",g),f.instance=w}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(f,u),(u=f.state.preload)&&(f.state.loading&3)===0&&(o.count++,f=Pm.bind(o),u.addEventListener("load",f),u.addEventListener("error",f))}}var ay=0;function yI(o,u){return o.stylesheets&&o.count===0&&Lm(o,o.stylesheets),0ay?50:800)+u);return o.unsuspend=f,function(){o.unsuspend=null,clearTimeout(g),clearTimeout(y)}}:null}function Pm(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Lm(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Bm=null;function Lm(o,u){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Bm=new Map,u.forEach(bI,o),Bm=null,Pm.call(o))}function bI(o,u){if(!(u.state.loading&4)){var f=Bm.get(o);if(f)var g=f.get(null);else{f=new Map,Bm.set(o,f);for(var y=o.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),py.exports=zq(),py.exports}var Bq=Pq();function L9(t,e){return function(){return t.apply(e,arguments)}}const{toString:Lq}=Object.prototype,{getPrototypeOf:J4}=Object,{iterator:ox,toStringTag:I9}=Symbol,cx=(t=>e=>{const n=Lq.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Wi=t=>(t=t.toLowerCase(),e=>cx(e)===t),ux=t=>e=>typeof e===t,{isArray:Sd}=Array,sd=ux("undefined");function Kf(t){return t!==null&&!sd(t)&&t.constructor!==null&&!sd(t.constructor)&&Rs(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const q9=Wi("ArrayBuffer");function Iq(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&q9(t.buffer),e}const qq=ux("string"),Rs=ux("function"),F9=ux("number"),Zf=t=>t!==null&&typeof t=="object",Fq=t=>t===!0||t===!1,$p=t=>{if(cx(t)!=="object")return!1;const e=J4(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(I9 in t)&&!(ox in t)},Qq=t=>{if(!Zf(t)||Kf(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},$q=Wi("Date"),Hq=Wi("File"),Uq=Wi("Blob"),Vq=Wi("FileList"),Wq=t=>Zf(t)&&Rs(t.pipe),Gq=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Rs(t.append)&&((e=cx(t))==="formdata"||e==="object"&&Rs(t.toString)&&t.toString()==="[object FormData]"))},Xq=Wi("URLSearchParams"),[Yq,Kq,Zq,Jq]=["ReadableStream","Request","Response","Headers"].map(Wi),eF=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Jf(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),Sd(t))for(r=0,s=t.length;r0;)if(s=n[r],e===s.toLowerCase())return s;return null}const ac=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,$9=t=>!sd(t)&&t!==ac;function n2(){const{caseless:t,skipUndefined:e}=$9(this)&&this||{},n={},r=(s,i)=>{const l=t&&Q9(n,i)||i;$p(n[l])&&$p(s)?n[l]=n2(n[l],s):$p(s)?n[l]=n2({},s):Sd(s)?n[l]=s.slice():(!e||!sd(s))&&(n[l]=s)};for(let s=0,i=arguments.length;s(Jf(e,(s,i)=>{n&&Rs(s)?t[i]=L9(s,n):t[i]=s},{allOwnKeys:r}),t),nF=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),rF=(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)},sF=(t,e,n,r)=>{let s,i,l;const c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)l=s[i],(!r||r(l,t,e))&&!c[l]&&(e[l]=t[l],c[l]=!0);t=n!==!1&&J4(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},iF=(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},aF=t=>{if(!t)return null;if(Sd(t))return t;let e=t.length;if(!F9(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},lF=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&J4(Uint8Array)),oF=(t,e)=>{const r=(t&&t[ox]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},cF=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},uF=Wi("HTMLFormElement"),dF=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),vO=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),hF=Wi("RegExp"),H9=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Jf(n,(s,i)=>{let l;(l=e(s,i,t))!==!1&&(r[i]=l||s)}),Object.defineProperties(t,r)},fF=t=>{H9(t,(e,n)=>{if(Rs(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Rs(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+"'")})}})},mF=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Sd(t)?r(t):r(String(t).split(e)),n},pF=()=>{},gF=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function xF(t){return!!(t&&Rs(t.append)&&t[I9]==="FormData"&&t[ox])}const vF=t=>{const e=new Array(10),n=(r,s)=>{if(Zf(r)){if(e.indexOf(r)>=0)return;if(Kf(r))return r;if(!("toJSON"in r)){e[s]=r;const i=Sd(r)?[]:{};return Jf(r,(l,c)=>{const d=n(l,s+1);!sd(d)&&(i[c]=d)}),e[s]=void 0,i}}return r};return n(t,0)},yF=Wi("AsyncFunction"),bF=t=>t&&(Zf(t)||Rs(t))&&Rs(t.then)&&Rs(t.catch),U9=((t,e)=>t?setImmediate:e?((n,r)=>(ac.addEventListener("message",({source:s,data:i})=>{s===ac&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),ac.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Rs(ac.postMessage)),wF=typeof queueMicrotask<"u"?queueMicrotask.bind(ac):typeof process<"u"&&process.nextTick||U9,SF=t=>t!=null&&Rs(t[ox]),we={isArray:Sd,isArrayBuffer:q9,isBuffer:Kf,isFormData:Gq,isArrayBufferView:Iq,isString:qq,isNumber:F9,isBoolean:Fq,isObject:Zf,isPlainObject:$p,isEmptyObject:Qq,isReadableStream:Yq,isRequest:Kq,isResponse:Zq,isHeaders:Jq,isUndefined:sd,isDate:$q,isFile:Hq,isBlob:Uq,isRegExp:hF,isFunction:Rs,isStream:Wq,isURLSearchParams:Xq,isTypedArray:lF,isFileList:Vq,forEach:Jf,merge:n2,extend:tF,trim:eF,stripBOM:nF,inherits:rF,toFlatObject:sF,kindOf:cx,kindOfTest:Wi,endsWith:iF,toArray:aF,forEachEntry:oF,matchAll:cF,isHTMLForm:uF,hasOwnProperty:vO,hasOwnProp:vO,reduceDescriptors:H9,freezeMethods:fF,toObjectSet:mF,toCamelCase:dF,noop:pF,toFiniteNumber:gF,findKey:Q9,global:ac,isContextDefined:$9,isSpecCompliantForm:xF,toJSONObject:vF,isAsyncFn:yF,isThenable:bF,setImmediate:U9,asap:wF,isIterable:SF};function St(t,e,n,r,s){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),s&&(this.response=s,this.status=s.status?s.status:null)}we.inherits(St,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:we.toJSONObject(this.config),code:this.code,status:this.status}}});const V9=St.prototype,W9={};["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=>{W9[t]={value:t}});Object.defineProperties(St,W9);Object.defineProperty(V9,"isAxiosError",{value:!0});St.from=(t,e,n,r,s,i)=>{const l=Object.create(V9);we.toFlatObject(t,l,function(m){return m!==Error.prototype},h=>h!=="isAxiosError");const c=t&&t.message?t.message:"Error",d=e==null&&t?t.code:e;return St.call(l,c,d,n,r,s),t&&l.cause==null&&Object.defineProperty(l,"cause",{value:t,configurable:!0}),l.name=t&&t.name||"Error",i&&Object.assign(l,i),l};const kF=null;function r2(t){return we.isPlainObject(t)||we.isArray(t)}function G9(t){return we.endsWith(t,"[]")?t.slice(0,-2):t}function yO(t,e,n){return t?t.concat(e).map(function(s,i){return s=G9(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function OF(t){return we.isArray(t)&&!t.some(r2)}const jF=we.toFlatObject(we,{},null,function(e){return/^is[A-Z]/.test(e)});function dx(t,e,n){if(!we.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=we.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(k,O){return!we.isUndefined(O[k])});const r=n.metaTokens,s=n.visitor||m,i=n.dots,l=n.indexes,d=(n.Blob||typeof Blob<"u"&&Blob)&&we.isSpecCompliantForm(e);if(!we.isFunction(s))throw new TypeError("visitor must be a function");function h(b){if(b===null)return"";if(we.isDate(b))return b.toISOString();if(we.isBoolean(b))return b.toString();if(!d&&we.isBlob(b))throw new St("Blob is not supported. Use a Buffer instead.");return we.isArrayBuffer(b)||we.isTypedArray(b)?d&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function m(b,k,O){let j=b;if(b&&!O&&typeof b=="object"){if(we.endsWith(k,"{}"))k=r?k:k.slice(0,-2),b=JSON.stringify(b);else if(we.isArray(b)&&OF(b)||(we.isFileList(b)||we.endsWith(k,"[]"))&&(j=we.toArray(b)))return k=G9(k),j.forEach(function(A,_){!(we.isUndefined(A)||A===null)&&e.append(l===!0?yO([k],_,i):l===null?k:k+"[]",h(A))}),!1}return r2(b)?!0:(e.append(yO(O,k,i),h(b)),!1)}const p=[],x=Object.assign(jF,{defaultVisitor:m,convertValue:h,isVisitable:r2});function v(b,k){if(!we.isUndefined(b)){if(p.indexOf(b)!==-1)throw Error("Circular reference detected in "+k.join("."));p.push(b),we.forEach(b,function(j,T){(!(we.isUndefined(j)||j===null)&&s.call(e,j,we.isString(T)?T.trim():T,k,x))===!0&&v(j,k?k.concat(T):[T])}),p.pop()}}if(!we.isObject(t))throw new TypeError("data must be an object");return v(t),e}function bO(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function ew(t,e){this._pairs=[],t&&dx(t,this,e)}const X9=ew.prototype;X9.append=function(e,n){this._pairs.push([e,n])};X9.toString=function(e){const n=e?function(r){return e.call(this,r,bO)}:bO;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function NF(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Y9(t,e,n){if(!e)return t;const r=n&&n.encode||NF;we.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=we.isURLSearchParams(e)?e.toString():new ew(e,n).toString(r),i){const l=t.indexOf("#");l!==-1&&(t=t.slice(0,l)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class wO{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){we.forEach(this.handlers,function(r){r!==null&&e(r)})}}const K9={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},CF=typeof URLSearchParams<"u"?URLSearchParams:ew,TF=typeof FormData<"u"?FormData:null,AF=typeof Blob<"u"?Blob:null,MF={isBrowser:!0,classes:{URLSearchParams:CF,FormData:TF,Blob:AF},protocols:["http","https","file","blob","url","data"]},tw=typeof window<"u"&&typeof document<"u",s2=typeof navigator=="object"&&navigator||void 0,EF=tw&&(!s2||["ReactNative","NativeScript","NS"].indexOf(s2.product)<0),_F=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",DF=tw&&window.location.href||"http://localhost",RF=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:tw,hasStandardBrowserEnv:EF,hasStandardBrowserWebWorkerEnv:_F,navigator:s2,origin:DF},Symbol.toStringTag,{value:"Module"})),ts={...RF,...MF};function zF(t,e){return dx(t,new ts.classes.URLSearchParams,{visitor:function(n,r,s,i){return ts.isNode&&we.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function PF(t){return we.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function BF(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r=n.length;return l=!l&&we.isArray(s)?s.length:l,d?(we.hasOwnProp(s,l)?s[l]=[s[l],r]:s[l]=r,!c):((!s[l]||!we.isObject(s[l]))&&(s[l]=[]),e(n,r,s[l],i)&&we.isArray(s[l])&&(s[l]=BF(s[l])),!c)}if(we.isFormData(t)&&we.isFunction(t.entries)){const n={};return we.forEachEntry(t,(r,s)=>{e(PF(r),s,n,0)}),n}return null}function LF(t,e,n){if(we.isString(t))try{return(e||JSON.parse)(t),we.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const e0={transitional:K9,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=we.isObject(e);if(i&&we.isHTMLForm(e)&&(e=new FormData(e)),we.isFormData(e))return s?JSON.stringify(Z9(e)):e;if(we.isArrayBuffer(e)||we.isBuffer(e)||we.isStream(e)||we.isFile(e)||we.isBlob(e)||we.isReadableStream(e))return e;if(we.isArrayBufferView(e))return e.buffer;if(we.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return zF(e,this.formSerializer).toString();if((c=we.isFileList(e))||r.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return dx(c?{"files[]":e}:e,d&&new d,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),LF(e)):e}],transformResponse:[function(e){const n=this.transitional||e0.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(we.isResponse(e)||we.isReadableStream(e))return e;if(e&&we.isString(e)&&(r&&!this.responseType||s)){const l=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(l)throw c.name==="SyntaxError"?St.from(c,St.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:ts.classes.FormData,Blob:ts.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};we.forEach(["delete","get","head","post","put","patch"],t=>{e0.headers[t]={}});const IF=we.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"]),qF=t=>{const e={};let n,r,s;return t&&t.split(` +`).forEach(function(l){s=l.indexOf(":"),n=l.substring(0,s).trim().toLowerCase(),r=l.substring(s+1).trim(),!(!n||e[n]&&IF[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},SO=Symbol("internals");function Ah(t){return t&&String(t).trim().toLowerCase()}function Hp(t){return t===!1||t==null?t:we.isArray(t)?t.map(Hp):String(t)}function FF(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 QF=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function vy(t,e,n,r,s){if(we.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!we.isString(e)){if(we.isString(r))return e.indexOf(r)!==-1;if(we.isRegExp(r))return r.test(e)}}function $F(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function HF(t,e){const n=we.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,l){return this[r].call(this,e,s,i,l)},configurable:!0})})}let zs=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(c,d,h){const m=Ah(d);if(!m)throw new Error("header name must be a non-empty string");const p=we.findKey(s,m);(!p||s[p]===void 0||h===!0||h===void 0&&s[p]!==!1)&&(s[p||d]=Hp(c))}const l=(c,d)=>we.forEach(c,(h,m)=>i(h,m,d));if(we.isPlainObject(e)||e instanceof this.constructor)l(e,n);else if(we.isString(e)&&(e=e.trim())&&!QF(e))l(qF(e),n);else if(we.isObject(e)&&we.isIterable(e)){let c={},d,h;for(const m of e){if(!we.isArray(m))throw TypeError("Object iterator must return a key-value pair");c[h=m[0]]=(d=c[h])?we.isArray(d)?[...d,m[1]]:[d,m[1]]:m[1]}l(c,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=Ah(e),e){const r=we.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return FF(s);if(we.isFunction(n))return n.call(this,s,r);if(we.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Ah(e),e){const r=we.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||vy(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(l){if(l=Ah(l),l){const c=we.findKey(r,l);c&&(!n||vy(r,r[c],c,n))&&(delete r[c],s=!0)}}return we.isArray(e)?e.forEach(i):i(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!e||vy(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const n=this,r={};return we.forEach(this,(s,i)=>{const l=we.findKey(r,i);if(l){n[l]=Hp(s),delete n[i];return}const c=e?$F(i):String(i).trim();c!==i&&delete n[i],n[c]=Hp(s),r[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return we.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&we.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(s=>r.set(s)),r}static accessor(e){const r=(this[SO]=this[SO]={accessors:{}}).accessors,s=this.prototype;function i(l){const c=Ah(l);r[c]||(HF(s,l),r[c]=!0)}return we.isArray(e)?e.forEach(i):i(e),this}};zs.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);we.reduceDescriptors(zs.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});we.freezeMethods(zs);function yy(t,e){const n=this||e0,r=e||n,s=zs.from(r.headers);let i=r.data;return we.forEach(t,function(c){i=c.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function J9(t){return!!(t&&t.__CANCEL__)}function kd(t,e,n){St.call(this,t??"canceled",St.ERR_CANCELED,e,n),this.name="CanceledError"}we.inherits(kd,St,{__CANCEL__:!0});function eC(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new St("Request failed with status code "+n.status,[St.ERR_BAD_REQUEST,St.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function UF(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function VF(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,l;return e=e!==void 0?e:1e3,function(d){const h=Date.now(),m=r[i];l||(l=h),n[s]=d,r[s]=h;let p=i,x=0;for(;p!==s;)x+=n[p++],p=p%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),h-l{n=m,s=null,i&&(clearTimeout(i),i=null),t(...h)};return[(...h)=>{const m=Date.now(),p=m-n;p>=r?l(h,m):(s=h,i||(i=setTimeout(()=>{i=null,l(s)},r-p)))},()=>s&&l(s)]}const gg=(t,e,n=3)=>{let r=0;const s=VF(50,250);return WF(i=>{const l=i.loaded,c=i.lengthComputable?i.total:void 0,d=l-r,h=s(d),m=l<=c;r=l;const p={loaded:l,total:c,progress:c?l/c:void 0,bytes:d,rate:h||void 0,estimated:h&&c&&m?(c-l)/h:void 0,event:i,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(p)},n)},kO=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},OO=t=>(...e)=>we.asap(()=>t(...e)),GF=ts.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,ts.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(ts.origin),ts.navigator&&/(msie|trident)/i.test(ts.navigator.userAgent)):()=>!0,XF=ts.hasStandardBrowserEnv?{write(t,e,n,r,s,i,l){if(typeof document>"u")return;const c=[`${t}=${encodeURIComponent(e)}`];we.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),we.isString(r)&&c.push(`path=${r}`),we.isString(s)&&c.push(`domain=${s}`),i===!0&&c.push("secure"),we.isString(l)&&c.push(`SameSite=${l}`),document.cookie=c.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function YF(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function KF(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function tC(t,e,n){let r=!YF(e);return t&&(r||n==!1)?KF(t,e):e}const jO=t=>t instanceof zs?{...t}:t;function vc(t,e){e=e||{};const n={};function r(h,m,p,x){return we.isPlainObject(h)&&we.isPlainObject(m)?we.merge.call({caseless:x},h,m):we.isPlainObject(m)?we.merge({},m):we.isArray(m)?m.slice():m}function s(h,m,p,x){if(we.isUndefined(m)){if(!we.isUndefined(h))return r(void 0,h,p,x)}else return r(h,m,p,x)}function i(h,m){if(!we.isUndefined(m))return r(void 0,m)}function l(h,m){if(we.isUndefined(m)){if(!we.isUndefined(h))return r(void 0,h)}else return r(void 0,m)}function c(h,m,p){if(p in e)return r(h,m);if(p in t)return r(void 0,h)}const d={url:i,method:i,data:i,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:c,headers:(h,m,p)=>s(jO(h),jO(m),p,!0)};return we.forEach(Object.keys({...t,...e}),function(m){const p=d[m]||s,x=p(t[m],e[m],m);we.isUndefined(x)&&p!==c||(n[m]=x)}),n}const nC=t=>{const e=vc({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:l,auth:c}=e;if(e.headers=l=zs.from(l),e.url=Y9(tC(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&l.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),we.isFormData(n)){if(ts.hasStandardBrowserEnv||ts.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if(we.isFunction(n.getHeaders)){const d=n.getHeaders(),h=["content-type","content-length"];Object.entries(d).forEach(([m,p])=>{h.includes(m.toLowerCase())&&l.set(m,p)})}}if(ts.hasStandardBrowserEnv&&(r&&we.isFunction(r)&&(r=r(e)),r||r!==!1&&GF(e.url))){const d=s&&i&&XF.read(i);d&&l.set(s,d)}return e},ZF=typeof XMLHttpRequest<"u",JF=ZF&&function(t){return new Promise(function(n,r){const s=nC(t);let i=s.data;const l=zs.from(s.headers).normalize();let{responseType:c,onUploadProgress:d,onDownloadProgress:h}=s,m,p,x,v,b;function k(){v&&v(),b&&b(),s.cancelToken&&s.cancelToken.unsubscribe(m),s.signal&&s.signal.removeEventListener("abort",m)}let O=new XMLHttpRequest;O.open(s.method.toUpperCase(),s.url,!0),O.timeout=s.timeout;function j(){if(!O)return;const A=zs.from("getAllResponseHeaders"in O&&O.getAllResponseHeaders()),D={data:!c||c==="text"||c==="json"?O.responseText:O.response,status:O.status,statusText:O.statusText,headers:A,config:t,request:O};eC(function(R){n(R),k()},function(R){r(R),k()},D),O=null}"onloadend"in O?O.onloadend=j:O.onreadystatechange=function(){!O||O.readyState!==4||O.status===0&&!(O.responseURL&&O.responseURL.indexOf("file:")===0)||setTimeout(j)},O.onabort=function(){O&&(r(new St("Request aborted",St.ECONNABORTED,t,O)),O=null)},O.onerror=function(_){const D=_&&_.message?_.message:"Network Error",E=new St(D,St.ERR_NETWORK,t,O);E.event=_||null,r(E),O=null},O.ontimeout=function(){let _=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const D=s.transitional||K9;s.timeoutErrorMessage&&(_=s.timeoutErrorMessage),r(new St(_,D.clarifyTimeoutError?St.ETIMEDOUT:St.ECONNABORTED,t,O)),O=null},i===void 0&&l.setContentType(null),"setRequestHeader"in O&&we.forEach(l.toJSON(),function(_,D){O.setRequestHeader(D,_)}),we.isUndefined(s.withCredentials)||(O.withCredentials=!!s.withCredentials),c&&c!=="json"&&(O.responseType=s.responseType),h&&([x,b]=gg(h,!0),O.addEventListener("progress",x)),d&&O.upload&&([p,v]=gg(d),O.upload.addEventListener("progress",p),O.upload.addEventListener("loadend",v)),(s.cancelToken||s.signal)&&(m=A=>{O&&(r(!A||A.type?new kd(null,t,O):A),O.abort(),O=null)},s.cancelToken&&s.cancelToken.subscribe(m),s.signal&&(s.signal.aborted?m():s.signal.addEventListener("abort",m)));const T=UF(s.url);if(T&&ts.protocols.indexOf(T)===-1){r(new St("Unsupported protocol "+T+":",St.ERR_BAD_REQUEST,t));return}O.send(i||null)})},eQ=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(h){if(!s){s=!0,c();const m=h instanceof Error?h:this.reason;r.abort(m instanceof St?m:new kd(m instanceof Error?m.message:m))}};let l=e&&setTimeout(()=>{l=null,i(new St(`timeout ${e} of ms exceeded`,St.ETIMEDOUT))},e);const c=()=>{t&&(l&&clearTimeout(l),l=null,t.forEach(h=>{h.unsubscribe?h.unsubscribe(i):h.removeEventListener("abort",i)}),t=null)};t.forEach(h=>h.addEventListener("abort",i));const{signal:d}=r;return d.unsubscribe=()=>we.asap(c),d}},tQ=function*(t,e){let n=t.byteLength;if(n{const s=nQ(t,e);let i=0,l,c=d=>{l||(l=!0,r&&r(d))};return new ReadableStream({async pull(d){try{const{done:h,value:m}=await s.next();if(h){c(),d.close();return}let p=m.byteLength;if(n){let x=i+=p;n(x)}d.enqueue(new Uint8Array(m))}catch(h){throw c(h),h}},cancel(d){return c(d),s.return()}},{highWaterMark:2})},CO=64*1024,{isFunction:Xm}=we,sQ=(({Request:t,Response:e})=>({Request:t,Response:e}))(we.global),{ReadableStream:TO,TextEncoder:AO}=we.global,MO=(t,...e)=>{try{return!!t(...e)}catch{return!1}},iQ=t=>{t=we.merge.call({skipUndefined:!0},sQ,t);const{fetch:e,Request:n,Response:r}=t,s=e?Xm(e):typeof fetch=="function",i=Xm(n),l=Xm(r);if(!s)return!1;const c=s&&Xm(TO),d=s&&(typeof AO=="function"?(b=>k=>b.encode(k))(new AO):async b=>new Uint8Array(await new n(b).arrayBuffer())),h=i&&c&&MO(()=>{let b=!1;const k=new n(ts.origin,{body:new TO,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!k}),m=l&&c&&MO(()=>we.isReadableStream(new r("").body)),p={stream:m&&(b=>b.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!p[b]&&(p[b]=(k,O)=>{let j=k&&k[b];if(j)return j.call(k);throw new St(`Response type '${b}' is not supported`,St.ERR_NOT_SUPPORT,O)})});const x=async b=>{if(b==null)return 0;if(we.isBlob(b))return b.size;if(we.isSpecCompliantForm(b))return(await new n(ts.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(we.isArrayBufferView(b)||we.isArrayBuffer(b))return b.byteLength;if(we.isURLSearchParams(b)&&(b=b+""),we.isString(b))return(await d(b)).byteLength},v=async(b,k)=>{const O=we.toFiniteNumber(b.getContentLength());return O??x(k)};return async b=>{let{url:k,method:O,data:j,signal:T,cancelToken:A,timeout:_,onDownloadProgress:D,onUploadProgress:E,responseType:R,headers:Q,withCredentials:F="same-origin",fetchOptions:L}=nC(b),U=e||fetch;R=R?(R+"").toLowerCase():"text";let V=eQ([T,A&&A.toAbortSignal()],_),de=null;const W=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let J;try{if(E&&h&&O!=="get"&&O!=="head"&&(J=await v(Q,j))!==0){let xe=new n(k,{method:"POST",body:j,duplex:"half"}),Y;if(we.isFormData(j)&&(Y=xe.headers.get("content-type"))&&Q.setContentType(Y),xe.body){const[P,K]=kO(J,gg(OO(E)));j=NO(xe.body,CO,P,K)}}we.isString(F)||(F=F?"include":"omit");const $=i&&"credentials"in n.prototype,ae={...L,signal:V,method:O.toUpperCase(),headers:Q.normalize().toJSON(),body:j,duplex:"half",credentials:$?F:void 0};de=i&&new n(k,ae);let ne=await(i?U(de,L):U(k,ae));const ce=m&&(R==="stream"||R==="response");if(m&&(D||ce&&W)){const xe={};["status","statusText","headers"].forEach(H=>{xe[H]=ne[H]});const Y=we.toFiniteNumber(ne.headers.get("content-length")),[P,K]=D&&kO(Y,gg(OO(D),!0))||[];ne=new r(NO(ne.body,CO,P,()=>{K&&K(),W&&W()}),xe)}R=R||"text";let z=await p[we.findKey(p,R)||"text"](ne,b);return!ce&&W&&W(),await new Promise((xe,Y)=>{eC(xe,Y,{data:z,headers:zs.from(ne.headers),status:ne.status,statusText:ne.statusText,config:b,request:de})})}catch($){throw W&&W(),$&&$.name==="TypeError"&&/Load failed|fetch/i.test($.message)?Object.assign(new St("Network Error",St.ERR_NETWORK,b,de),{cause:$.cause||$}):St.from($,$&&$.code,b,de)}}},aQ=new Map,rC=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,i=[r,s,n];let l=i.length,c=l,d,h,m=aQ;for(;c--;)d=i[c],h=m.get(d),h===void 0&&m.set(d,h=c?new Map:iQ(e)),m=h;return h};rC();const nw={http:kF,xhr:JF,fetch:{get:rC}};we.forEach(nw,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const EO=t=>`- ${t}`,lQ=t=>we.isFunction(t)||t===null||t===!1;function oQ(t,e){t=we.isArray(t)?t:[t];const{length:n}=t;let r,s;const i={};for(let l=0;l`adapter ${d} `+(h===!1?"is not supported by the environment":"is not available in the build"));let c=n?l.length>1?`since : +`+l.map(EO).join(` +`):" "+EO(l[0]):"as no adapter specified";throw new St("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const sC={getAdapter:oQ,adapters:nw};function by(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new kd(null,t)}function _O(t){return by(t),t.headers=zs.from(t.headers),t.data=yy.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),sC.getAdapter(t.adapter||e0.adapter,t)(t).then(function(r){return by(t),r.data=yy.call(t,t.transformResponse,r),r.headers=zs.from(r.headers),r},function(r){return J9(r)||(by(t),r&&r.response&&(r.response.data=yy.call(t,t.transformResponse,r.response),r.response.headers=zs.from(r.response.headers))),Promise.reject(r)})}const iC="1.13.2",hx={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{hx[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const DO={};hx.transitional=function(e,n,r){function s(i,l){return"[Axios v"+iC+"] Transitional option '"+i+"'"+l+(r?". "+r:"")}return(i,l,c)=>{if(e===!1)throw new St(s(l," has been removed"+(n?" in "+n:"")),St.ERR_DEPRECATED);return n&&!DO[l]&&(DO[l]=!0,console.warn(s(l," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,l,c):!0}};hx.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function cQ(t,e,n){if(typeof t!="object")throw new St("options must be an object",St.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const i=r[s],l=e[i];if(l){const c=t[i],d=c===void 0||l(c,i,t);if(d!==!0)throw new St("option "+i+" must be "+d,St.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new St("Unknown option "+i,St.ERR_BAD_OPTION)}}const Up={assertOptions:cQ,validators:hx},ea=Up.validators;let mc=class{constructor(e){this.defaults=e||{},this.interceptors={request:new wO,response:new wO}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=vc(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Up.assertOptions(r,{silentJSONParsing:ea.transitional(ea.boolean),forcedJSONParsing:ea.transitional(ea.boolean),clarifyTimeoutError:ea.transitional(ea.boolean)},!1),s!=null&&(we.isFunction(s)?n.paramsSerializer={serialize:s}:Up.assertOptions(s,{encode:ea.function,serialize:ea.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Up.assertOptions(n,{baseUrl:ea.spelling("baseURL"),withXsrfToken:ea.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=i&&we.merge(i.common,i[n.method]);i&&we.forEach(["delete","get","head","post","put","patch","common"],b=>{delete i[b]}),n.headers=zs.concat(l,i);const c=[];let d=!0;this.interceptors.request.forEach(function(k){typeof k.runWhen=="function"&&k.runWhen(n)===!1||(d=d&&k.synchronous,c.unshift(k.fulfilled,k.rejected))});const h=[];this.interceptors.response.forEach(function(k){h.push(k.fulfilled,k.rejected)});let m,p=0,x;if(!d){const b=[_O.bind(this),void 0];for(b.unshift(...c),b.push(...h),x=b.length,m=Promise.resolve(n);p{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const l=new Promise(c=>{r.subscribe(c),i=c}).then(s);return l.cancel=function(){r.unsubscribe(i)},l},e(function(i,l,c){r.reason||(r.reason=new kd(i,l,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 aC(function(s){e=s}),cancel:e}}};function dQ(t){return function(n){return t.apply(null,n)}}function hQ(t){return we.isObject(t)&&t.isAxiosError===!0}const i2={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(i2).forEach(([t,e])=>{i2[e]=t});function lC(t){const e=new mc(t),n=L9(mc.prototype.request,e);return we.extend(n,mc.prototype,e,{allOwnKeys:!0}),we.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return lC(vc(t,s))},n}const Zn=lC(e0);Zn.Axios=mc;Zn.CanceledError=kd;Zn.CancelToken=uQ;Zn.isCancel=J9;Zn.VERSION=iC;Zn.toFormData=dx;Zn.AxiosError=St;Zn.Cancel=Zn.CanceledError;Zn.all=function(e){return Promise.all(e)};Zn.spread=dQ;Zn.isAxiosError=hQ;Zn.mergeConfig=vc;Zn.AxiosHeaders=zs;Zn.formToJSON=t=>Z9(we.isHTMLForm(t)?new FormData(t):t);Zn.getAdapter=sC.getAdapter;Zn.HttpStatusCode=i2;Zn.default=Zn;const{Axios:Nxe,AxiosError:Cxe,CanceledError:Txe,isCancel:Axe,CancelToken:Mxe,VERSION:Exe,all:_xe,Cancel:Dxe,isAxiosError:Rxe,spread:zxe,toFormData:Pxe,AxiosHeaders:Bxe,HttpStatusCode:Lxe,formToJSON:Ixe,getAdapter:qxe,mergeConfig:Fxe}=Zn,fQ=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),oC=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),xg="-",RO=[],pQ="arbitrary..",gQ=t=>{const e=vQ(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return xQ(l);const c=l.split(xg),d=c[0]===""&&c.length>1?1:0;return cC(c,d,e)},getConflictingClassGroupIds:(l,c)=>{if(c){const d=r[l],h=n[l];return d?h?fQ(h,d):d:h||RO}return n[l]||RO}}},cC=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const h=cC(t,e+1,i);if(h)return h}const l=n.validators;if(l===null)return;const c=e===0?t.join(xg):t.slice(e).join(xg),d=l.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?pQ+r:void 0})(),vQ=t=>{const{theme:e,classGroups:n}=t;return yQ(n,e)},yQ=(t,e)=>{const n=oC();for(const r in t){const s=t[r];rw(s,n,r,e)}return n},rw=(t,e,n,r)=>{const s=t.length;for(let i=0;i{if(typeof t=="string"){wQ(t,e,n);return}if(typeof t=="function"){SQ(t,e,n,r);return}kQ(t,e,n,r)},wQ=(t,e,n)=>{const r=t===""?e:uC(e,t);r.classGroupId=n},SQ=(t,e,n,r)=>{if(OQ(t)){rw(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(mQ(n,t))},kQ=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let l=0;l{let n=t;const r=e.split(xg),s=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,jQ=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,l)=>{n[i]=l,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let l=n[i];if(l!==void 0)return l;if((l=r[i])!==void 0)return s(i,l),l},set(i,l){i in n?n[i]=l:s(i,l)}}},a2="!",zO=":",NQ=[],PO=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),CQ=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let l=0,c=0,d=0,h;const m=s.length;for(let k=0;kd?h-d:void 0;return PO(i,v,x,b)};if(e){const s=e+zO,i=r;r=l=>l.startsWith(s)?i(l.slice(s.length)):PO(NQ,!1,l,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},TQ=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i0&&(s.sort(),r.push(...s),s=[]),r.push(l)):s.push(l)}return s.length>0&&(s.sort(),r.push(...s)),r}},AQ=t=>({cache:jQ(t.cacheSize),parseClassName:CQ(t),sortModifiers:TQ(t),...gQ(t)}),MQ=/\s+/,EQ=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,l=[],c=t.trim().split(MQ);let d="";for(let h=c.length-1;h>=0;h-=1){const m=c[h],{isExternal:p,modifiers:x,hasImportantModifier:v,baseClassName:b,maybePostfixModifierPosition:k}=n(m);if(p){d=m+(d.length>0?" "+d:d);continue}let O=!!k,j=r(O?b.substring(0,k):b);if(!j){if(!O){d=m+(d.length>0?" "+d:d);continue}if(j=r(b),!j){d=m+(d.length>0?" "+d:d);continue}O=!1}const T=x.length===0?"":x.length===1?x[0]:i(x).join(":"),A=v?T+a2:T,_=A+j;if(l.indexOf(_)>-1)continue;l.push(_);const D=s(j,O);for(let E=0;E0?" "+d:d)}return d},_Q=(...t)=>{let e=0,n,r,s="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,s,i;const l=d=>{const h=e.reduce((m,p)=>p(m),t());return n=AQ(h),r=n.cache.get,s=n.cache.set,i=c,c(d)},c=d=>{const h=r(d);if(h)return h;const m=EQ(d,n);return s(d,m),m};return i=l,(...d)=>i(_Q(...d))},RQ=[],wr=t=>{const e=n=>n[t]||RQ;return e.isThemeGetter=!0,e},hC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zQ=/^\d+\/\d+$/,PQ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,BQ=/\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$/,LQ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,IQ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qQ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ju=t=>zQ.test(t),Mt=t=>!!t&&!Number.isNaN(Number(t)),Gl=t=>!!t&&Number.isInteger(Number(t)),wy=t=>t.endsWith("%")&&Mt(t.slice(0,-1)),Xa=t=>PQ.test(t),FQ=()=>!0,QQ=t=>BQ.test(t)&&!LQ.test(t),mC=()=>!1,$Q=t=>IQ.test(t),HQ=t=>qQ.test(t),UQ=t=>!Xe(t)&&!Ye(t),VQ=t=>Od(t,xC,mC),Xe=t=>hC.test(t),Ko=t=>Od(t,vC,QQ),Sy=t=>Od(t,KQ,Mt),BO=t=>Od(t,pC,mC),WQ=t=>Od(t,gC,HQ),Ym=t=>Od(t,yC,$Q),Ye=t=>fC.test(t),Mh=t=>jd(t,vC),GQ=t=>jd(t,ZQ),LO=t=>jd(t,pC),XQ=t=>jd(t,xC),YQ=t=>jd(t,gC),Km=t=>jd(t,yC,!0),Od=(t,e,n)=>{const r=hC.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},jd=(t,e,n=!1)=>{const r=fC.exec(t);return r?r[1]?e(r[1]):n:!1},pC=t=>t==="position"||t==="percentage",gC=t=>t==="image"||t==="url",xC=t=>t==="length"||t==="size"||t==="bg-size",vC=t=>t==="length",KQ=t=>t==="number",ZQ=t=>t==="family-name",yC=t=>t==="shadow",JQ=()=>{const t=wr("color"),e=wr("font"),n=wr("text"),r=wr("font-weight"),s=wr("tracking"),i=wr("leading"),l=wr("breakpoint"),c=wr("container"),d=wr("spacing"),h=wr("radius"),m=wr("shadow"),p=wr("inset-shadow"),x=wr("text-shadow"),v=wr("drop-shadow"),b=wr("blur"),k=wr("perspective"),O=wr("aspect"),j=wr("ease"),T=wr("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[..._(),Ye,Xe],E=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],Q=()=>[Ye,Xe,d],F=()=>[ju,"full","auto",...Q()],L=()=>[Gl,"none","subgrid",Ye,Xe],U=()=>["auto",{span:["full",Gl,Ye,Xe]},Gl,Ye,Xe],V=()=>[Gl,"auto",Ye,Xe],de=()=>["auto","min","max","fr",Ye,Xe],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...Q()],ae=()=>[ju,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...Q()],ne=()=>[t,Ye,Xe],ce=()=>[..._(),LO,BO,{position:[Ye,Xe]}],z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],xe=()=>["auto","cover","contain",XQ,VQ,{size:[Ye,Xe]}],Y=()=>[wy,Mh,Ko],P=()=>["","none","full",h,Ye,Xe],K=()=>["",Mt,Mh,Ko],H=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ve=()=>[Mt,wy,LO,BO],Re=()=>["","none",b,Ye,Xe],ue=()=>["none",Mt,Ye,Xe],We=()=>["none",Mt,Ye,Xe],ct=()=>[Mt,Ye,Xe],Oe=()=>[ju,"full",...Q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xa],breakpoint:[Xa],color:[FQ],container:[Xa],"drop-shadow":[Xa],ease:["in","out","in-out"],font:[UQ],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xa],shadow:[Xa],spacing:["px",Mt],text:[Xa],"text-shadow":[Xa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ju,Xe,Ye,O]}],container:["container"],columns:[{columns:[Mt,Xe,Ye,c]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"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"],sr:["sr-only","not-sr-only"],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:D()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:F()}],"inset-x":[{"inset-x":F()}],"inset-y":[{"inset-y":F()}],start:[{start:F()}],end:[{end:F()}],top:[{top:F()}],right:[{right:F()}],bottom:[{bottom:F()}],left:[{left:F()}],visibility:["visible","invisible","collapse"],z:[{z:[Gl,"auto",Ye,Xe]}],basis:[{basis:[ju,"full","auto",c,...Q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Mt,ju,"auto","initial","none",Xe]}],grow:[{grow:["",Mt,Ye,Xe]}],shrink:[{shrink:["",Mt,Ye,Xe]}],order:[{order:[Gl,"first","last","none",Ye,Xe]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:U()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":de()}],"auto-rows":[{"auto-rows":de()}],gap:[{gap:Q()}],"gap-x":[{"gap-x":Q()}],"gap-y":[{"gap-y":Q()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...J(),"baseline"]}],"place-self":[{"place-self":["auto",...J()]}],p:[{p:Q()}],px:[{px:Q()}],py:[{py:Q()}],ps:[{ps:Q()}],pe:[{pe:Q()}],pt:[{pt:Q()}],pr:[{pr:Q()}],pb:[{pb:Q()}],pl:[{pl:Q()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":Q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":Q()}],"space-y-reverse":["space-y-reverse"],size:[{size:ae()}],w:[{w:[c,"screen",...ae()]}],"min-w":[{"min-w":[c,"screen","none",...ae()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...ae()]}],h:[{h:["screen","lh",...ae()]}],"min-h":[{"min-h":["screen","lh","none",...ae()]}],"max-h":[{"max-h":["screen","lh",...ae()]}],"font-size":[{text:["base",n,Mh,Ko]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Ye,Sy]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",wy,Xe]}],"font-family":[{font:[GQ,Xe,e]}],"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-fractions"],tracking:[{tracking:[s,Ye,Xe]}],"line-clamp":[{"line-clamp":[Mt,"none",Ye,Sy]}],leading:[{leading:[i,...Q()]}],"list-image":[{"list-image":["none",Ye,Xe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ye,Xe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:ne()}],"text-color":[{text:ne()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:[Mt,"from-font","auto",Ye,Ko]}],"text-decoration-color":[{decoration:ne()}],"underline-offset":[{"underline-offset":[Mt,"auto",Ye,Xe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Q()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ye,Xe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ye,Xe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ce()}],"bg-repeat":[{bg:z()}],"bg-size":[{bg:xe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Gl,Ye,Xe],radial:["",Ye,Xe],conic:[Gl,Ye,Xe]},YQ,WQ]}],"bg-color":[{bg:ne()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:ne()}],"gradient-via":[{via:ne()}],"gradient-to":[{to:ne()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...H(),"hidden","none"]}],"divide-style":[{divide:[...H(),"hidden","none"]}],"border-color":[{border:ne()}],"border-color-x":[{"border-x":ne()}],"border-color-y":[{"border-y":ne()}],"border-color-s":[{"border-s":ne()}],"border-color-e":[{"border-e":ne()}],"border-color-t":[{"border-t":ne()}],"border-color-r":[{"border-r":ne()}],"border-color-b":[{"border-b":ne()}],"border-color-l":[{"border-l":ne()}],"divide-color":[{divide:ne()}],"outline-style":[{outline:[...H(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Mt,Ye,Xe]}],"outline-w":[{outline:["",Mt,Mh,Ko]}],"outline-color":[{outline:ne()}],shadow:[{shadow:["","none",m,Km,Ym]}],"shadow-color":[{shadow:ne()}],"inset-shadow":[{"inset-shadow":["none",p,Km,Ym]}],"inset-shadow-color":[{"inset-shadow":ne()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:ne()}],"ring-offset-w":[{"ring-offset":[Mt,Ko]}],"ring-offset-color":[{"ring-offset":ne()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":ne()}],"text-shadow":[{"text-shadow":["none",x,Km,Ym]}],"text-shadow-color":[{"text-shadow":ne()}],opacity:[{opacity:[Mt,Ye,Xe]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Mt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ve()}],"mask-image-linear-to-pos":[{"mask-linear-to":ve()}],"mask-image-linear-from-color":[{"mask-linear-from":ne()}],"mask-image-linear-to-color":[{"mask-linear-to":ne()}],"mask-image-t-from-pos":[{"mask-t-from":ve()}],"mask-image-t-to-pos":[{"mask-t-to":ve()}],"mask-image-t-from-color":[{"mask-t-from":ne()}],"mask-image-t-to-color":[{"mask-t-to":ne()}],"mask-image-r-from-pos":[{"mask-r-from":ve()}],"mask-image-r-to-pos":[{"mask-r-to":ve()}],"mask-image-r-from-color":[{"mask-r-from":ne()}],"mask-image-r-to-color":[{"mask-r-to":ne()}],"mask-image-b-from-pos":[{"mask-b-from":ve()}],"mask-image-b-to-pos":[{"mask-b-to":ve()}],"mask-image-b-from-color":[{"mask-b-from":ne()}],"mask-image-b-to-color":[{"mask-b-to":ne()}],"mask-image-l-from-pos":[{"mask-l-from":ve()}],"mask-image-l-to-pos":[{"mask-l-to":ve()}],"mask-image-l-from-color":[{"mask-l-from":ne()}],"mask-image-l-to-color":[{"mask-l-to":ne()}],"mask-image-x-from-pos":[{"mask-x-from":ve()}],"mask-image-x-to-pos":[{"mask-x-to":ve()}],"mask-image-x-from-color":[{"mask-x-from":ne()}],"mask-image-x-to-color":[{"mask-x-to":ne()}],"mask-image-y-from-pos":[{"mask-y-from":ve()}],"mask-image-y-to-pos":[{"mask-y-to":ve()}],"mask-image-y-from-color":[{"mask-y-from":ne()}],"mask-image-y-to-color":[{"mask-y-to":ne()}],"mask-image-radial":[{"mask-radial":[Ye,Xe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ve()}],"mask-image-radial-to-pos":[{"mask-radial-to":ve()}],"mask-image-radial-from-color":[{"mask-radial-from":ne()}],"mask-image-radial-to-color":[{"mask-radial-to":ne()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[Mt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ve()}],"mask-image-conic-to-pos":[{"mask-conic-to":ve()}],"mask-image-conic-from-color":[{"mask-conic-from":ne()}],"mask-image-conic-to-color":[{"mask-conic-to":ne()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ce()}],"mask-repeat":[{mask:z()}],"mask-size":[{mask:xe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ye,Xe]}],filter:[{filter:["","none",Ye,Xe]}],blur:[{blur:Re()}],brightness:[{brightness:[Mt,Ye,Xe]}],contrast:[{contrast:[Mt,Ye,Xe]}],"drop-shadow":[{"drop-shadow":["","none",v,Km,Ym]}],"drop-shadow-color":[{"drop-shadow":ne()}],grayscale:[{grayscale:["",Mt,Ye,Xe]}],"hue-rotate":[{"hue-rotate":[Mt,Ye,Xe]}],invert:[{invert:["",Mt,Ye,Xe]}],saturate:[{saturate:[Mt,Ye,Xe]}],sepia:[{sepia:["",Mt,Ye,Xe]}],"backdrop-filter":[{"backdrop-filter":["","none",Ye,Xe]}],"backdrop-blur":[{"backdrop-blur":Re()}],"backdrop-brightness":[{"backdrop-brightness":[Mt,Ye,Xe]}],"backdrop-contrast":[{"backdrop-contrast":[Mt,Ye,Xe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Mt,Ye,Xe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Mt,Ye,Xe]}],"backdrop-invert":[{"backdrop-invert":["",Mt,Ye,Xe]}],"backdrop-opacity":[{"backdrop-opacity":[Mt,Ye,Xe]}],"backdrop-saturate":[{"backdrop-saturate":[Mt,Ye,Xe]}],"backdrop-sepia":[{"backdrop-sepia":["",Mt,Ye,Xe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":Q()}],"border-spacing-x":[{"border-spacing-x":Q()}],"border-spacing-y":[{"border-spacing-y":Q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ye,Xe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Mt,"initial",Ye,Xe]}],ease:[{ease:["linear","initial",j,Ye,Xe]}],delay:[{delay:[Mt,Ye,Xe]}],animate:[{animate:["none",T,Ye,Xe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,Ye,Xe]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:ue()}],"rotate-x":[{"rotate-x":ue()}],"rotate-y":[{"rotate-y":ue()}],"rotate-z":[{"rotate-z":ue()}],scale:[{scale:We()}],"scale-x":[{"scale-x":We()}],"scale-y":[{"scale-y":We()}],"scale-z":[{"scale-z":We()}],"scale-3d":["scale-3d"],skew:[{skew:ct()}],"skew-x":[{"skew-x":ct()}],"skew-y":[{"skew-y":ct()}],transform:[{transform:[Ye,Xe,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Oe()}],"translate-x":[{"translate-x":Oe()}],"translate-y":[{"translate-y":Oe()}],"translate-z":[{"translate-z":Oe()}],"translate-none":["translate-none"],accent:[{accent:ne()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:ne()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",Ye,Xe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":Q()}],"scroll-mx":[{"scroll-mx":Q()}],"scroll-my":[{"scroll-my":Q()}],"scroll-ms":[{"scroll-ms":Q()}],"scroll-me":[{"scroll-me":Q()}],"scroll-mt":[{"scroll-mt":Q()}],"scroll-mr":[{"scroll-mr":Q()}],"scroll-mb":[{"scroll-mb":Q()}],"scroll-ml":[{"scroll-ml":Q()}],"scroll-p":[{"scroll-p":Q()}],"scroll-px":[{"scroll-px":Q()}],"scroll-py":[{"scroll-py":Q()}],"scroll-ps":[{"scroll-ps":Q()}],"scroll-pe":[{"scroll-pe":Q()}],"scroll-pt":[{"scroll-pt":Q()}],"scroll-pr":[{"scroll-pr":Q()}],"scroll-pb":[{"scroll-pb":Q()}],"scroll-pl":[{"scroll-pl":Q()}],"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",Ye,Xe]}],fill:[{fill:["none",...ne()]}],"stroke-w":[{stroke:[Mt,Mh,Ko,Sy]}],stroke:[{stroke:["none",...ne()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},e$=DQ(JQ);function ye(...t){return e$(d9(t))}const gt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("rounded-xl border bg-card text-card-foreground shadow",t),...e}));gt.displayName="Card";const Wt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("flex flex-col space-y-1.5 p-6",t),...e}));Wt.displayName="CardHeader";const Gt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("font-semibold leading-none tracking-tight",t),...e}));Gt.displayName="CardTitle";const Sr=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Sr.displayName="CardDescription";const an=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("p-6 pt-0",t),...e}));an.displayName="CardContent";const bC=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("flex items-center p-6 pt-0",t),...e}));bC.displayName="CardFooter";var ky="rovingFocusGroup.onEntryFocus",t$={bubbles:!1,cancelable:!0},t0="RovingFocusGroup",[l2,wC,n$]=tx(t0),[r$,fx]=Vi(t0,[n$]),[s$,i$]=r$(t0),SC=S.forwardRef((t,e)=>a.jsx(l2.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(l2.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(a$,{...t,ref:e})})}));SC.displayName=t0;var a$=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:h,preventScrollOnEntryFocus:m=!1,...p}=t,x=S.useRef(null),v=Cn(e,x),b=Vf(i),[k,O]=ko({prop:l,defaultProp:c??null,onChange:d,caller:t0}),[j,T]=S.useState(!1),A=es(h),_=wC(n),D=S.useRef(!1),[E,R]=S.useState(0);return S.useEffect(()=>{const Q=x.current;if(Q)return Q.addEventListener(ky,A),()=>Q.removeEventListener(ky,A)},[A]),a.jsx(s$,{scope:n,orientation:r,dir:b,loop:s,currentTabStopId:k,onItemFocus:S.useCallback(Q=>O(Q),[O]),onItemShiftTab:S.useCallback(()=>T(!0),[]),onFocusableItemAdd:S.useCallback(()=>R(Q=>Q+1),[]),onFocusableItemRemove:S.useCallback(()=>R(Q=>Q-1),[]),children:a.jsx(Zt.div,{tabIndex:j||E===0?-1:0,"data-orientation":r,...p,ref:v,style:{outline:"none",...t.style},onMouseDown:$e(t.onMouseDown,()=>{D.current=!0}),onFocus:$e(t.onFocus,Q=>{const F=!D.current;if(Q.target===Q.currentTarget&&F&&!j){const L=new CustomEvent(ky,t$);if(Q.currentTarget.dispatchEvent(L),!L.defaultPrevented){const U=_().filter($=>$.focusable),V=U.find($=>$.active),de=U.find($=>$.id===k),J=[V,de,...U].filter(Boolean).map($=>$.ref.current);jC(J,m)}}D.current=!1}),onBlur:$e(t.onBlur,()=>T(!1))})})}),kC="RovingFocusGroupItem",OC=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:l,...c}=t,d=ji(),h=i||d,m=i$(kC,n),p=m.currentTabStopId===h,x=wC(n),{onFocusableItemAdd:v,onFocusableItemRemove:b,currentTabStopId:k}=m;return S.useEffect(()=>{if(r)return v(),()=>b()},[r,v,b]),a.jsx(l2.ItemSlot,{scope:n,id:h,focusable:r,active:s,children:a.jsx(Zt.span,{tabIndex:p?0:-1,"data-orientation":m.orientation,...c,ref:e,onMouseDown:$e(t.onMouseDown,O=>{r?m.onItemFocus(h):O.preventDefault()}),onFocus:$e(t.onFocus,()=>m.onItemFocus(h)),onKeyDown:$e(t.onKeyDown,O=>{if(O.key==="Tab"&&O.shiftKey){m.onItemShiftTab();return}if(O.target!==O.currentTarget)return;const j=c$(O,m.orientation,m.dir);if(j!==void 0){if(O.metaKey||O.ctrlKey||O.altKey||O.shiftKey)return;O.preventDefault();let A=x().filter(_=>_.focusable).map(_=>_.ref.current);if(j==="last")A.reverse();else if(j==="prev"||j==="next"){j==="prev"&&A.reverse();const _=A.indexOf(O.currentTarget);A=m.loop?u$(A,_+1):A.slice(_+1)}setTimeout(()=>jC(A))}}),children:typeof l=="function"?l({isCurrentTabStop:p,hasTabStop:k!=null}):l})})});OC.displayName=kC;var l$={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function o$(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function c$(t,e,n){const r=o$(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return l$[r]}function jC(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function u$(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var NC=SC,CC=OC,mx="Tabs",[d$]=Vi(mx,[fx]),TC=fx(),[h$,sw]=d$(mx),AC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:l="horizontal",dir:c,activationMode:d="automatic",...h}=t,m=Vf(c),[p,x]=ko({prop:r,onChange:s,defaultProp:i??"",caller:mx});return a.jsx(h$,{scope:n,baseId:ji(),value:p,onValueChange:x,orientation:l,dir:m,activationMode:d,children:a.jsx(Zt.div,{dir:m,"data-orientation":l,...h,ref:e})})});AC.displayName=mx;var MC="TabsList",EC=S.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=sw(MC,n),l=TC(n);return a.jsx(NC,{asChild:!0,...l,orientation:i.orientation,dir:i.dir,loop:r,children:a.jsx(Zt.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});EC.displayName=MC;var _C="TabsTrigger",DC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,l=sw(_C,n),c=TC(n),d=PC(l.baseId,r),h=BC(l.baseId,r),m=r===l.value;return a.jsx(CC,{asChild:!0,...c,focusable:!s,active:m,children:a.jsx(Zt.button,{type:"button",role:"tab","aria-selected":m,"aria-controls":h,"data-state":m?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:d,...i,ref:e,onMouseDown:$e(t.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?l.onValueChange(r):p.preventDefault()}),onKeyDown:$e(t.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&l.onValueChange(r)}),onFocus:$e(t.onFocus,()=>{const p=l.activationMode!=="manual";!m&&!s&&p&&l.onValueChange(r)})})})});DC.displayName=_C;var RC="TabsContent",zC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...l}=t,c=sw(RC,n),d=PC(c.baseId,r),h=BC(c.baseId,r),m=r===c.value,p=S.useRef(m);return S.useEffect(()=>{const x=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(x)},[]),a.jsx(Ls,{present:s||m,children:({present:x})=>a.jsx(Zt.div,{"data-state":m?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":d,hidden:!x,id:h,tabIndex:0,...l,ref:e,style:{...t.style,animationDuration:p.current?"0s":void 0},children:x&&i})})});zC.displayName=RC;function PC(t,e){return`${t}-trigger-${e}`}function BC(t,e){return`${t}-content-${e}`}var f$=AC,LC=EC,IC=DC,qC=zC;const hl=f$,ya=S.forwardRef(({className:t,...e},n)=>a.jsx(LC,{ref:n,className:ye("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));ya.displayName=LC.displayName;const $t=S.forwardRef(({className:t,...e},n)=>a.jsx(IC,{ref:n,className:ye("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 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",t),...e}));$t.displayName=IC.displayName;const kn=S.forwardRef(({className:t,...e},n)=>a.jsx(qC,{ref:n,className:ye("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",t),...e}));kn.displayName=qC.displayName;function m$(t,e){return S.useReducer((n,r)=>e[n][r]??n,t)}var iw="ScrollArea",[FC]=Vi(iw),[p$,Ei]=FC(iw),QC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...l}=t,[c,d]=S.useState(null),[h,m]=S.useState(null),[p,x]=S.useState(null),[v,b]=S.useState(null),[k,O]=S.useState(null),[j,T]=S.useState(0),[A,_]=S.useState(0),[D,E]=S.useState(!1),[R,Q]=S.useState(!1),F=Cn(e,U=>d(U)),L=Vf(s);return a.jsx(p$,{scope:n,type:r,dir:L,scrollHideDelay:i,scrollArea:c,viewport:h,onViewportChange:m,content:p,onContentChange:x,scrollbarX:v,onScrollbarXChange:b,scrollbarXEnabled:D,onScrollbarXEnabledChange:E,scrollbarY:k,onScrollbarYChange:O,scrollbarYEnabled:R,onScrollbarYEnabledChange:Q,onCornerWidthChange:T,onCornerHeightChange:_,children:a.jsx(Zt.div,{dir:L,...l,ref:F,style:{position:"relative","--radix-scroll-area-corner-width":j+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})});QC.displayName=iw;var $C="ScrollAreaViewport",HC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,l=Ei($C,n),c=S.useRef(null),d=Cn(e,c,l.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}"},nonce:s}),a.jsx(Zt.div,{"data-radix-scroll-area-viewport":"",...i,ref:d,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:a.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});HC.displayName=$C;var Sa="ScrollAreaScrollbar",aw=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ei(Sa,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:l}=s,c=t.orientation==="horizontal";return S.useEffect(()=>(c?i(!0):l(!0),()=>{c?i(!1):l(!1)}),[c,i,l]),s.type==="hover"?a.jsx(g$,{...r,ref:e,forceMount:n}):s.type==="scroll"?a.jsx(x$,{...r,ref:e,forceMount:n}):s.type==="auto"?a.jsx(UC,{...r,ref:e,forceMount:n}):s.type==="always"?a.jsx(lw,{...r,ref:e}):null});aw.displayName=Sa;var g$=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ei(Sa,t.__scopeScrollArea),[i,l]=S.useState(!1);return S.useEffect(()=>{const c=s.scrollArea;let d=0;if(c){const h=()=>{window.clearTimeout(d),l(!0)},m=()=>{d=window.setTimeout(()=>l(!1),s.scrollHideDelay)};return c.addEventListener("pointerenter",h),c.addEventListener("pointerleave",m),()=>{window.clearTimeout(d),c.removeEventListener("pointerenter",h),c.removeEventListener("pointerleave",m)}}},[s.scrollArea,s.scrollHideDelay]),a.jsx(Ls,{present:n||i,children:a.jsx(UC,{"data-state":i?"visible":"hidden",...r,ref:e})})}),x$=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ei(Sa,t.__scopeScrollArea),i=t.orientation==="horizontal",l=gx(()=>d("SCROLL_END"),100),[c,d]=m$("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 S.useEffect(()=>{if(c==="idle"){const h=window.setTimeout(()=>d("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(h)}},[c,s.scrollHideDelay,d]),S.useEffect(()=>{const h=s.viewport,m=i?"scrollLeft":"scrollTop";if(h){let p=h[m];const x=()=>{const v=h[m];p!==v&&(d("SCROLL"),l()),p=v};return h.addEventListener("scroll",x),()=>h.removeEventListener("scroll",x)}},[s.viewport,i,d,l]),a.jsx(Ls,{present:n||c!=="hidden",children:a.jsx(lw,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:$e(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:$e(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),UC=S.forwardRef((t,e)=>{const n=Ei(Sa,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,l]=S.useState(!1),c=t.orientation==="horizontal",d=gx(()=>{if(n.viewport){const h=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,s=Ei(Sa,t.__scopeScrollArea),i=S.useRef(null),l=S.useRef(0),[c,d]=S.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=YC(c.viewport,c.content),m={...r,sizes:c,onSizesChange:d,hasThumb:h>0&&h<1,onThumbChange:x=>i.current=x,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:x=>l.current=x};function p(x,v){return k$(x,l.current,c,v)}return n==="horizontal"?a.jsx(v$,{...m,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const x=s.viewport.scrollLeft,v=IO(x,c,s.dir);i.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollLeft=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollLeft=p(x,s.dir))}}):n==="vertical"?a.jsx(y$,{...m,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const x=s.viewport.scrollTop,v=IO(x,c);i.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollTop=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollTop=p(x))}}):null}),v$=S.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Ei(Sa,t.__scopeScrollArea),[l,c]=S.useState(),d=S.useRef(null),h=Cn(e,d,i.onScrollbarXChange);return S.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(WC,{"data-orientation":"horizontal",...s,ref:h,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":px(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.x),onDragScroll:m=>t.onDragScroll(m.x),onWheelScroll:(m,p)=>{if(i.viewport){const x=i.viewport.scrollLeft+m.deltaX;t.onWheelScroll(x),ZC(x,p)&&m.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:yg(l.paddingLeft),paddingEnd:yg(l.paddingRight)}})}})}),y$=S.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Ei(Sa,t.__scopeScrollArea),[l,c]=S.useState(),d=S.useRef(null),h=Cn(e,d,i.onScrollbarYChange);return S.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(WC,{"data-orientation":"vertical",...s,ref:h,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":px(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.y),onDragScroll:m=>t.onDragScroll(m.y),onWheelScroll:(m,p)=>{if(i.viewport){const x=i.viewport.scrollTop+m.deltaY;t.onWheelScroll(x),ZC(x,p)&&m.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:yg(l.paddingTop),paddingEnd:yg(l.paddingBottom)}})}})}),[b$,VC]=FC(Sa),WC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:l,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:h,onWheelScroll:m,onResize:p,...x}=t,v=Ei(Sa,n),[b,k]=S.useState(null),O=Cn(e,F=>k(F)),j=S.useRef(null),T=S.useRef(""),A=v.viewport,_=r.content-r.viewport,D=es(m),E=es(d),R=gx(p,10);function Q(F){if(j.current){const L=F.clientX-j.current.left,U=F.clientY-j.current.top;h({x:L,y:U})}}return S.useEffect(()=>{const F=L=>{const U=L.target;b?.contains(U)&&D(L,_)};return document.addEventListener("wheel",F,{passive:!1}),()=>document.removeEventListener("wheel",F,{passive:!1})},[A,b,_,D]),S.useEffect(E,[r,E]),id(b,R),id(v.content,R),a.jsx(b$,{scope:n,scrollbar:b,hasThumb:s,onThumbChange:es(i),onThumbPointerUp:es(l),onThumbPositionChange:E,onThumbPointerDown:es(c),children:a.jsx(Zt.div,{...x,ref:O,style:{position:"absolute",...x.style},onPointerDown:$e(t.onPointerDown,F=>{F.button===0&&(F.target.setPointerCapture(F.pointerId),j.current=b.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),Q(F))}),onPointerMove:$e(t.onPointerMove,Q),onPointerUp:$e(t.onPointerUp,F=>{const L=F.target;L.hasPointerCapture(F.pointerId)&&L.releasePointerCapture(F.pointerId),document.body.style.webkitUserSelect=T.current,v.viewport&&(v.viewport.style.scrollBehavior=""),j.current=null})})})}),vg="ScrollAreaThumb",GC=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=VC(vg,t.__scopeScrollArea);return a.jsx(Ls,{present:n||s.hasThumb,children:a.jsx(w$,{ref:e,...r})})}),w$=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=Ei(vg,n),l=VC(vg,n),{onThumbPositionChange:c}=l,d=Cn(e,p=>l.onThumbChange(p)),h=S.useRef(void 0),m=gx(()=>{h.current&&(h.current(),h.current=void 0)},100);return S.useEffect(()=>{const p=i.viewport;if(p){const x=()=>{if(m(),!h.current){const v=O$(p,c);h.current=v,c()}};return c(),p.addEventListener("scroll",x),()=>p.removeEventListener("scroll",x)}},[i.viewport,m,c]),a.jsx(Zt.div,{"data-state":l.hasThumb?"visible":"hidden",...s,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:$e(t.onPointerDownCapture,p=>{const v=p.target.getBoundingClientRect(),b=p.clientX-v.left,k=p.clientY-v.top;l.onThumbPointerDown({x:b,y:k})}),onPointerUp:$e(t.onPointerUp,l.onThumbPointerUp)})});GC.displayName=vg;var ow="ScrollAreaCorner",XC=S.forwardRef((t,e)=>{const n=Ei(ow,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(S$,{...t,ref:e}):null});XC.displayName=ow;var S$=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=Ei(ow,n),[i,l]=S.useState(0),[c,d]=S.useState(0),h=!!(i&&c);return id(s.scrollbarX,()=>{const m=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(m),d(m)}),id(s.scrollbarY,()=>{const m=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(m),l(m)}),h?a.jsx(Zt.div,{...r,ref:e,style:{width:i,height:c,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function yg(t){return t?parseInt(t,10):0}function YC(t,e){const n=t/e;return isNaN(n)?0:n}function px(t){const e=YC(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function k$(t,e,n,r="ltr"){const s=px(n),i=s/2,l=e||i,c=s-l,d=n.scrollbar.paddingStart+l,h=n.scrollbar.size-n.scrollbar.paddingEnd-c,m=n.content-n.viewport,p=r==="ltr"?[0,m]:[m*-1,0];return KC([d,h],p)(t)}function IO(t,e,n="ltr"){const r=px(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,l=e.content-e.viewport,c=i-r,d=n==="ltr"?[0,l]:[l*-1,0],h=F4(t,d);return KC([0,l],[0,c])(h)}function KC(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 ZC(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function s(){const i={left:t.scrollLeft,top:t.scrollTop},l=n.left!==i.left,c=n.top!==i.top;(l||c)&&e(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function gx(t,e){const n=es(t),r=S.useRef(0);return S.useEffect(()=>()=>window.clearTimeout(r.current),[]),S.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function id(t,e){const n=es(e);h9(()=>{let r=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(t),()=>{window.cancelAnimationFrame(r),s.unobserve(t)}}},[t,n])}var JC=QC,j$=HC,N$=XC;const vn=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(JC,{ref:r,className:ye("relative overflow-hidden",t),...n,children:[a.jsx(j$,{className:"h-full w-full rounded-[inherit]",children:e}),a.jsx(eT,{}),a.jsx(N$,{})]}));vn.displayName=JC.displayName;const eT=S.forwardRef(({className:t,orientation:e="vertical",...n},r)=>a.jsx(aw,{ref:r,orientation:e,className:ye("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(GC,{className:"relative flex-1 rounded-full bg-border"})}));eT.displayName=aw.displayName;function qO({className:t,...e}){return a.jsx("div",{className:ye("animate-pulse rounded-md bg-primary/10",t),...e})}function C$(t,e=[]){let n=[];function r(i,l){const c=S.createContext(l);c.displayName=i+"Context";const d=n.length;n=[...n,l];const h=p=>{const{scope:x,children:v,...b}=p,k=x?.[t]?.[d]||c,O=S.useMemo(()=>b,Object.values(b));return a.jsx(k.Provider,{value:O,children:v})};h.displayName=i+"Provider";function m(p,x){const v=x?.[t]?.[d]||c,b=S.useContext(v);if(b)return b;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[h,m]}const s=()=>{const i=n.map(l=>S.createContext(l));return function(c){const d=c?.[t]||i;return S.useMemo(()=>({[`__scope${t}`]:{...c,[t]:d}}),[c,d])}};return s.scopeName=t,[r,T$(s,...e)]}function T$(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const l=r.reduce((c,{useScope:d,scopeName:h})=>{const p=d(i)[`__scope${h}`];return{...c,...p}},{});return S.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return n.scopeName=e.scopeName,n}var A$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],tT=A$.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),cw="Progress",uw=100,[M$]=C$(cw),[E$,_$]=M$(cw),nT=S.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=D$,...l}=t;(s||s===0)&&!FO(s)&&console.error(R$(`${s}`,"Progress"));const c=FO(s)?s:uw;r!==null&&!QO(r,c)&&console.error(z$(`${r}`,"Progress"));const d=QO(r,c)?r:null,h=bg(d)?i(d,c):void 0;return a.jsx(E$,{scope:n,value:d,max:c,children:a.jsx(tT.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":bg(d)?d:void 0,"aria-valuetext":h,role:"progressbar","data-state":iT(d,c),"data-value":d??void 0,"data-max":c,...l,ref:e})})});nT.displayName=cw;var rT="ProgressIndicator",sT=S.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=_$(rT,n);return a.jsx(tT.div,{"data-state":iT(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});sT.displayName=rT;function D$(t,e){return`${Math.round(t/e*100)}%`}function iT(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function bg(t){return typeof t=="number"}function FO(t){return bg(t)&&!isNaN(t)&&t>0}function QO(t,e){return bg(t)&&!isNaN(t)&&t<=e&&t>=0}function R$(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${uw}\`.`}function z$(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 ${uw} if no \`max\` prop is set) + - \`null\` or \`undefined\` if the progress is indeterminate. + +Defaulting to \`null\`.`}var aT=nT,P$=sT;const n0=S.forwardRef(({className:t,value:e,...n},r)=>a.jsx(aT,{ref:r,className:ye("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:a.jsx(P$,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));n0.displayName=aT.displayName;const B$={light:"",dark:".dark"},lT=S.createContext(null);function oT(){const t=S.useContext(lT);if(!t)throw new Error("useChart must be used within a ");return t}const Eu=S.forwardRef(({id:t,className:e,children:n,config:r,...s},i)=>{const l=S.useId(),c=`chart-${t||l.replace(/:/g,"")}`;return a.jsx(lT.Provider,{value:{config:r},children:a.jsxs("div",{"data-chart":c,ref:i,className:ye("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",e),...s,children:[a.jsx(L$,{id:c,config:r}),a.jsx(LI,{children:n})]})})});Eu.displayName="Chart";const L$=({id:t,config:e})=>{const n=Object.entries(e).filter(([,r])=>r.theme||r.color);return n.length?a.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(B$).map(([r,s])=>` +${s} [data-chart=${t}] { +${n.map(([i,l])=>{const c=l.theme?.[r]||l.color;return c?` --color-${i}: ${c};`:null}).join(` +`)} +} +`).join(` +`)}}):null},Eh=II,_u=S.forwardRef(({active:t,payload:e,className:n,indicator:r="dot",hideLabel:s=!1,hideIndicator:i=!1,label:l,labelFormatter:c,labelClassName:d,formatter:h,color:m,nameKey:p,labelKey:x},v)=>{const{config:b}=oT(),k=S.useMemo(()=>{if(s||!e?.length)return null;const[j]=e,T=`${x||j?.dataKey||j?.name||"value"}`,A=o2(b,j,T),_=!x&&typeof l=="string"?b[l]?.label||l:A?.label;return c?a.jsx("div",{className:ye("font-medium",d),children:c(_,e)}):_?a.jsx("div",{className:ye("font-medium",d),children:_}):null},[l,c,e,s,d,b,x]);if(!t||!e?.length)return null;const O=e.length===1&&r!=="dot";return a.jsxs("div",{ref:v,className:ye("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[O?null:k,a.jsx("div",{className:"grid gap-1.5",children:e.filter(j=>j.type!=="none").map((j,T)=>{const A=`${p||j.name||j.dataKey||"value"}`,_=o2(b,j,A),D=m||j.payload.fill||j.color;return a.jsx("div",{className:ye("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",r==="dot"&&"items-center"),children:h&&j?.value!==void 0&&j.name?h(j.value,j.name,j,T,j.payload):a.jsxs(a.Fragment,{children:[_?.icon?a.jsx(_.icon,{}):!i&&a.jsx("div",{className:ye("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":O&&r==="dashed"}),style:{"--color-bg":D,"--color-border":D}}),a.jsxs("div",{className:ye("flex flex-1 justify-between leading-none",O?"items-end":"items-center"),children:[a.jsxs("div",{className:"grid gap-1.5",children:[O?k:null,a.jsx("span",{className:"text-muted-foreground",children:_?.label||j.name})]}),j.value&&a.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:j.value.toLocaleString()})]})]})},j.dataKey)})})]})});_u.displayName="ChartTooltip";const I$=qI,cT=S.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:s},i)=>{const{config:l}=oT();return n?.length?a.jsx("div",{ref:i,className:ye("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.filter(c=>c.type!=="none").map(c=>{const d=`${s||c.dataKey||"value"}`,h=o2(l,c,d);return a.jsxs("div",{className:ye("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[h?.icon&&!e?a.jsx(h.icon,{}):a.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:c.color}}),h?.label]},c.value)})}):null});cT.displayName="ChartLegend";function o2(t,e,n){if(typeof e!="object"||e===null)return;const r="payload"in e&&typeof e.payload=="object"&&e.payload!==null?e.payload:void 0;let s=n;return n in e&&typeof e[n]=="string"?s=e[n]:r&&n in r&&typeof r[n]=="string"&&(s=r[n]),s in t?t[s]:t[n]}const $O=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,HO=d9,Nd=(t,e)=>n=>{var r;if(e?.variants==null)return HO(t,n?.class,n?.className);const{variants:s,defaultVariants:i}=e,l=Object.keys(s).map(h=>{const m=n?.[h],p=i?.[h];if(m===null)return null;const x=$O(m)||$O(p);return s[h][x]}),c=n&&Object.entries(n).reduce((h,m)=>{let[p,x]=m;return x===void 0||(h[p]=x),h},{}),d=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,m)=>{let{class:p,className:x,...v}=m;return Object.entries(v).every(b=>{let[k,O]=b;return Array.isArray(O)?O.includes({...i,...c}[k]):{...i,...c}[k]===O})?[...h,p,x]:h},[]);return HO(t,l,d,n?.class,n?.className)},ff=Nd("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring 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 shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ie=S.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const l=r?GI:"button";return a.jsx(l,{className:ye(ff({variant:e,size:n,className:t})),ref:i,...s})});ie.displayName="Button";function q$(){const[t,e]=S.useState(null),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(24),[d,h]=S.useState(!0),[m,p]=S.useState(null),[x,v]=S.useState(!0),b=S.useCallback(async()=>{try{v(!0);const F=await Zn.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");p({hitokoto:F.data.hitokoto,from:F.data.from||F.data.from_who||"未知"})}catch(F){console.error("获取一言失败:",F),p({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{v(!1)}},[]),k=S.useCallback(async()=>{try{const F=localStorage.getItem("access-token"),L=await Zn.get(`/api/webui/statistics/dashboard?hours=${l}`,{headers:{Authorization:`Bearer ${F}`}});e(L.data),r(!1),i(100)}catch(F){console.error("Failed to fetch dashboard data:",F),r(!1),i(100)}},[l]);if(S.useEffect(()=>{if(!n)return;i(0);const F=setTimeout(()=>i(15),200),L=setTimeout(()=>i(30),800),U=setTimeout(()=>i(45),2e3),V=setTimeout(()=>i(60),4e3),de=setTimeout(()=>i(75),6500),W=setTimeout(()=>i(85),9e3),J=setTimeout(()=>i(92),11e3);return()=>{clearTimeout(F),clearTimeout(L),clearTimeout(U),clearTimeout(V),clearTimeout(de),clearTimeout(W),clearTimeout(J)}},[n]),S.useEffect(()=>{k(),b()},[k,b]),S.useEffect(()=>{if(!d)return;const F=setInterval(()=>{k()},3e4);return()=>clearInterval(F)},[d,k]),n||!t)return a.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:a.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[a.jsx(Fi,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(n0,{value:s,className:"h-2"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[s,"%"]})]})]})});const{summary:O,model_stats:j,hourly_data:T,daily_data:A,recent_activity:_}=t,D=F=>{const L=Math.floor(F/3600),U=Math.floor(F%3600/60);return`${L}小时${U}分钟`},E=F=>new Date(F).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),R=j.slice(0,6).map(F=>({name:F.model_name,value:F.request_count,fill:`hsl(var(--chart-${j.indexOf(F)%5+1}))`})),Q={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(hl,{value:l.toString(),onValueChange:F=>c(Number(F)),children:a.jsxs(ya,{className:"grid grid-cols-3 w-full sm:w-auto",children:[a.jsx($t,{value:"24",children:"24小时"}),a.jsx($t,{value:"168",children:"7天"}),a.jsx($t,{value:"720",children:"30天"})]})}),a.jsxs(ie,{variant:d?"default":"outline",size:"sm",onClick:()=>h(!d),className:"gap-2",children:[a.jsx(Fi,{className:`h-4 w-4 ${d?"animate-spin":""}`}),a.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:k,children:a.jsx(Fi,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"总请求数"}),a.jsx(lq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:O.total_requests.toLocaleString()}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",l<48?l+"小时":Math.floor(l/24)+"天"]})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"总花费"}),a.jsx(oq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:["¥",O.total_cost.toFixed(2)]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:O.cost_per_hour>0?`¥${O.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"Token消耗"}),a.jsx(cq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:[(O.total_tokens/1e3).toFixed(1),"K"]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:O.tokens_per_hour>0?`${(O.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"平均响应"}),a.jsx(uf,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:[O.avg_response_time.toFixed(2),"s"]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"在线时长"}),a.jsx(dc,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsx(an,{children:a.jsx("div",{className:"text-xl font-bold",children:D(O.online_time)})})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"消息处理"}),a.jsx(Wf,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-xl font-bold",children:O.total_messages.toLocaleString()}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",O.total_replies.toLocaleString()," 条"]})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"成本效率"}),a.jsx(uq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-xl font-bold",children:O.total_messages>0?`¥${(O.total_cost/O.total_messages*100).toFixed(2)}`:"¥0.00"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),a.jsxs(hl,{defaultValue:"trends",className:"space-y-4",children:[a.jsxs(ya,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[a.jsx($t,{value:"trends",children:"趋势"}),a.jsx($t,{value:"models",children:"模型"}),a.jsx($t,{value:"activity",children:"活动"}),a.jsx($t,{value:"daily",children:"日统计"})]}),a.jsxs(kn,{value:"trends",className:"space-y-4",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"请求趋势"}),a.jsxs(Sr,{children:["最近",l,"小时的请求量变化"]})]}),a.jsx(an,{children:a.jsx(Eu,{config:Q,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:a.jsxs(FI,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(QI,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"花费趋势"}),a.jsx(Sr,{children:"API调用成本变化"})]}),a.jsx(an,{children:a.jsx(Eu,{config:Q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:a.jsxs(fy,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(Gm,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"Token消耗"}),a.jsx(Sr,{children:"Token使用量变化"})]}),a.jsx(an,{children:a.jsx(Eu,{config:Q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:a.jsxs(fy,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(Gm,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),a.jsx(kn,{value:"models",className:"space-y-4",children:a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"模型请求分布"}),a.jsx(Sr,{children:"各模型使用占比"})]}),a.jsx(an,{children:a.jsx(Eu,{config:Object.fromEntries(j.slice(0,6).map((F,L)=>[F.model_name,{label:F.model_name,color:`hsl(var(--chart-${L%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:a.jsxs($I,{children:[a.jsx(Eh,{content:a.jsx(_u,{})}),a.jsx(HI,{data:R,cx:"50%",cy:"50%",labelLine:!1,label:({name:F,percent:L})=>`${F} ${L?(L*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:R.map((F,L)=>a.jsx(UI,{fill:F.fill},`cell-${L}`))})]})})})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"模型详细统计"}),a.jsx(Sr,{children:"请求数、花费和性能"})]}),a.jsx(an,{children:a.jsx(vn,{className:"h-[300px] sm:h-[400px]",children:a.jsx("div",{className:"space-y-3",children:j.map((F,L)=>a.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:F.model_name}),a.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${L%5+1}))`}})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),a.jsx("span",{className:"ml-1 font-medium",children:F.request_count.toLocaleString()})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"花费:"}),a.jsxs("span",{className:"ml-1 font-medium",children:["¥",F.total_cost.toFixed(2)]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),a.jsxs("span",{className:"ml-1 font-medium",children:[(F.total_tokens/1e3).toFixed(1),"K"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),a.jsxs("span",{className:"ml-1 font-medium",children:[F.avg_response_time.toFixed(2),"s"]})]})]})]},L))})})})]})]})}),a.jsx(kn,{value:"activity",children:a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"最近活动"}),a.jsx(Sr,{children:"最新的API调用记录"})]}),a.jsx(an,{children:a.jsx(vn,{className:"h-[400px] sm:h-[500px]",children:a.jsx("div",{className:"space-y-2",children:_.map((F,L)=>a.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium text-sm truncate",children:F.model}),a.jsx("div",{className:"text-xs text-muted-foreground",children:F.request_type})]}),a.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:E(F.timestamp)})]}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),a.jsx("span",{className:"ml-1",children:F.tokens})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"花费:"}),a.jsxs("span",{className:"ml-1",children:["¥",F.cost.toFixed(4)]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),a.jsxs("span",{className:"ml-1",children:[F.time_cost.toFixed(2),"s"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"状态:"}),a.jsx("span",{className:`ml-1 ${F.status==="success"?"text-green-600":"text-red-600"}`,children:F.status})]})]})]},L))})})})]})}),a.jsx(kn,{value:"daily",children:a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"每日统计"}),a.jsx(Sr,{children:"最近7天的数据汇总"})]}),a.jsx(an,{children:a.jsx(Eu,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:a.jsxs(fy,{data:A,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>{const L=new Date(F);return`${L.getMonth()+1}/${L.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>new Date(F).toLocaleDateString("zh-CN")})}),a.jsx(I$,{content:a.jsx(cT,{})}),a.jsx(Gm,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),a.jsx(Gm,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),a.jsxs(gt,{className:"border-2 border-primary/20",children:[a.jsx(Wt,{className:"pb-3",children:a.jsx(Gt,{className:"text-lg",children:"每日一言"})}),a.jsx(an,{children:x?a.jsxs("div",{className:"space-y-2",children:[a.jsx(qO,{className:"h-6 w-3/4"}),a.jsx(qO,{className:"h-4 w-1/4"})]}):m?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("p",{className:"text-lg font-medium leading-relaxed italic",children:['"',m.hitokoto,'"']}),a.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["—— ",m.from]})]}):null})]})]})})}const F$={theme:"system",setTheme:()=>null},uT=S.createContext(F$),dw=()=>{const t=S.useContext(uT);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},Q$=(t,e,n)=>{const r=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||r){e(t);return}const s=n.clientX,i=n.clientY,l=Math.hypot(Math.max(s,innerWidth-s),Math.max(i,innerHeight-i));document.startViewTransition(()=>{e(t)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${s}px ${i}px)`,`circle(${l}px at ${s}px ${i}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},dT=S.createContext(void 0),hT=()=>{const t=S.useContext(dT);if(t===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return t};var xx="Switch",[$$]=Vi(xx),[H$,U$]=$$(xx),fT=S.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:l,disabled:c,value:d="on",onCheckedChange:h,form:m,...p}=t,[x,v]=S.useState(null),b=Cn(e,A=>v(A)),k=S.useRef(!1),O=x?m||!!x.closest("form"):!0,[j,T]=ko({prop:s,defaultProp:i??!1,onChange:h,caller:xx});return a.jsxs(H$,{scope:n,checked:j,disabled:c,children:[a.jsx(Zt.button,{type:"button",role:"switch","aria-checked":j,"aria-required":l,"data-state":xT(j),"data-disabled":c?"":void 0,disabled:c,value:d,...p,ref:b,onClick:$e(t.onClick,A=>{T(_=>!_),O&&(k.current=A.isPropagationStopped(),k.current||A.stopPropagation())})}),O&&a.jsx(gT,{control:x,bubbles:!k.current,name:r,value:d,checked:j,required:l,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});fT.displayName=xx;var mT="SwitchThumb",pT=S.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=U$(mT,n);return a.jsx(Zt.span,{"data-state":xT(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});pT.displayName=mT;var V$="SwitchBubbleInput",gT=S.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const l=S.useRef(null),c=Cn(l,i),d=f9(n),h=m9(e);return S.useEffect(()=>{const m=l.current;if(!m)return;const p=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(p,"checked").set;if(d!==n&&v){const b=new Event("click",{bubbles:r});v.call(m,n),m.dispatchEvent(b)}},[d,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:c,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});gT.displayName=V$;function xT(t){return t?"checked":"unchecked"}var vT=fT,W$=pT;const jt=S.forwardRef(({className:t,...e},n)=>a.jsx(vT,{className:ye("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm 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(W$,{className:ye("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));jt.displayName=vT.displayName;const G$=Nd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),te=S.forwardRef(({className:t,...e},n)=>a.jsx(p9,{ref:n,className:ye(G$(),t),...e}));te.displayName=p9.displayName;const Me=S.forwardRef(({className:t,type:e,...n},r)=>a.jsx("input",{type:e,className:ye("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors 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-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Me.displayName="Input";const X$=1,Y$=1e6;let Oy=0;function K$(){return Oy=(Oy+1)%Number.MAX_SAFE_INTEGER,Oy.toString()}const jy=new Map,UO=t=>{if(jy.has(t))return;const e=setTimeout(()=>{jy.delete(t),Kh({type:"REMOVE_TOAST",toastId:t})},Y$);jy.set(t,e)},Z$=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,X$)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?UO(n):t.toasts.forEach(r=>{UO(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},Vp=[];let Wp={toasts:[]};function Kh(t){Wp=Z$(Wp,t),Vp.forEach(e=>{e(Wp)})}function J$({...t}){const e=K$(),n=s=>Kh({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>Kh({type:"DISMISS_TOAST",toastId:e});return Kh({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function Pr(){const[t,e]=S.useState(Wp);return S.useEffect(()=>(Vp.push(e),()=>{const n=Vp.indexOf(e);n>-1&&Vp.splice(n,1)}),[t]),{...t,toast:J$,dismiss:n=>Kh({type:"DISMISS_TOAST",toastId:n})}}const eH=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:t=>t.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:t=>/[A-Z]/.test(t)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:t=>/[a-z]/.test(t)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:t=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(t)}];function tH(t){const e=eH.map(r=>({id:r.id,label:r.label,description:r.description,passed:r.validate(t)}));return{isValid:e.every(r=>r.passed),rules:e}}const hw="0.11.5 Beta",fw="MaiBot Dashboard",nH=`${fw} v${hw}`,rH=(t="v")=>`${t}${hw}`,Rr=W4,mw=g9,sH=$4,yT=S.forwardRef(({className:t,...e},n)=>a.jsx(nx,{ref:n,className:ye("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}));yT.displayName=nx.displayName;const Nr=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(sH,{children:[a.jsx(yT,{}),a.jsxs(rx,{ref:r,className:ye("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(H4,{className:"absolute right-4 top-4 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(Gf,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Nr.displayName=rx.displayName;const Cr=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Cr.displayName="DialogHeader";const ps=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ps.displayName="DialogFooter";const Tr=S.forwardRef(({className:t,...e},n)=>a.jsx(U4,{ref:n,className:ye("text-lg font-semibold leading-none tracking-tight",t),...e}));Tr.displayName=U4.displayName;const Gr=S.forwardRef(({className:t,...e},n)=>a.jsx(V4,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Gr.displayName=V4.displayName;var iH=Symbol("radix.slottable");function aH(t){const e=({children:n})=>a.jsx(a.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=iH,e}var bT="AlertDialog",[lH]=Vi(bT,[x9]),bl=x9(),wT=t=>{const{__scopeAlertDialog:e,...n}=t,r=bl(e);return a.jsx(W4,{...r,...n,modal:!0})};wT.displayName=bT;var oH="AlertDialogTrigger",ST=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(g9,{...s,...r,ref:e})});ST.displayName=oH;var cH="AlertDialogPortal",kT=t=>{const{__scopeAlertDialog:e,...n}=t,r=bl(e);return a.jsx($4,{...r,...n})};kT.displayName=cH;var uH="AlertDialogOverlay",OT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(nx,{...s,...r,ref:e})});OT.displayName=uH;var Uu="AlertDialogContent",[dH,hH]=lH(Uu),fH=aH("AlertDialogContent"),jT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=bl(n),l=S.useRef(null),c=Cn(e,l),d=S.useRef(null);return a.jsx(XI,{contentName:Uu,titleName:NT,docsSlug:"alert-dialog",children:a.jsx(dH,{scope:n,cancelRef:d,children:a.jsxs(rx,{role:"alertdialog",...i,...s,ref:c,onOpenAutoFocus:$e(s.onOpenAutoFocus,h=>{h.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:[a.jsx(fH,{children:r}),a.jsx(pH,{contentRef:l})]})})})});jT.displayName=Uu;var NT="AlertDialogTitle",CT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(U4,{...s,...r,ref:e})});CT.displayName=NT;var TT="AlertDialogDescription",AT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(V4,{...s,...r,ref:e})});AT.displayName=TT;var mH="AlertDialogAction",MT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(H4,{...s,...r,ref:e})});MT.displayName=mH;var ET="AlertDialogCancel",_T=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=hH(ET,n),i=bl(n),l=Cn(e,s);return a.jsx(H4,{...i,...r,ref:l})});_T.displayName=ET;var pH=({contentRef:t})=>{const e=`\`${Uu}\` requires a description for the component to be accessible for screen reader users. + +You can add a description to the \`${Uu}\` by passing a \`${TT}\` 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 \`${Uu}\`. 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 S.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},gH=wT,xH=ST,vH=kT,DT=OT,RT=jT,zT=MT,PT=_T,BT=CT,LT=AT;const mn=gH,jr=xH,yH=vH,IT=S.forwardRef(({className:t,...e},n)=>a.jsx(DT,{className:ye("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}));IT.displayName=DT.displayName;const ln=S.forwardRef(({className:t,...e},n)=>a.jsxs(yH,{children:[a.jsx(IT,{}),a.jsx(RT,{ref:n,className:ye("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})]}));ln.displayName=RT.displayName;const on=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col space-y-2 text-center sm:text-left",t),...e});on.displayName="AlertDialogHeader";const cn=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});cn.displayName="AlertDialogFooter";const un=S.forwardRef(({className:t,...e},n)=>a.jsx(BT,{ref:n,className:ye("text-lg font-semibold",t),...e}));un.displayName=BT.displayName;const dn=S.forwardRef(({className:t,...e},n)=>a.jsx(LT,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));dn.displayName=LT.displayName;const hn=S.forwardRef(({className:t,...e},n)=>a.jsx(zT,{ref:n,className:ye(ff(),t),...e}));hn.displayName=zT.displayName;const fn=S.forwardRef(({className:t,...e},n)=>a.jsx(PT,{ref:n,className:ye(ff({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));fn.displayName=PT.displayName;function bH(){return a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),a.jsxs(hl,{defaultValue:"appearance",className:"w-full",children:[a.jsxs(ya,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[a.jsxs($t,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(_9,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"外观"})]}),a.jsxs($t,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(dq,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"安全"})]}),a.jsxs($t,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(Ii,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"其他"})]}),a.jsxs($t,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(co,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"关于"})]})]}),a.jsxs(vn,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[a.jsx(kn,{value:"appearance",className:"mt-0",children:a.jsx(wH,{})}),a.jsx(kn,{value:"security",className:"mt-0",children:a.jsx(SH,{})}),a.jsx(kn,{value:"other",className:"mt-0",children:a.jsx(kH,{})}),a.jsx(kn,{value:"about",className:"mt-0",children:a.jsx(OH,{})})]})]})]})}function VO(t){const e=document.documentElement,r={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[t];if(r)e.style.setProperty("--primary",r.hsl),r.gradient?(e.style.setProperty("--primary-gradient",r.gradient),e.classList.add("has-gradient")):(e.style.removeProperty("--primary-gradient"),e.classList.remove("has-gradient"));else if(t.startsWith("#")){const s=i=>{i=i.replace("#","");const l=parseInt(i.substring(0,2),16)/255,c=parseInt(i.substring(2,4),16)/255,d=parseInt(i.substring(4,6),16)/255,h=Math.max(l,c,d),m=Math.min(l,c,d);let p=0,x=0;const v=(h+m)/2;if(h!==m){const b=h-m;switch(x=v>.5?b/(2-h-m):b/(h+m),h){case l:p=((c-d)/b+(clocalStorage.getItem("accent-color")||"blue");S.useEffect(()=>{const h=localStorage.getItem("accent-color")||"blue";VO(h)},[]);const d=h=>{c(h),localStorage.setItem("accent-color",h),VO(h)};return a.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[a.jsx(Ny,{value:"light",current:t,onChange:e,label:"浅色",description:"始终使用浅色主题"}),a.jsx(Ny,{value:"dark",current:t,onChange:e,label:"深色",description:"始终使用深色主题"}),a.jsx(Ny,{value:"system",current:t,onChange:e,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),a.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[a.jsx(vi,{value:"blue",current:l,onChange:d,label:"蓝色",colorClass:"bg-blue-500"}),a.jsx(vi,{value:"purple",current:l,onChange:d,label:"紫色",colorClass:"bg-purple-500"}),a.jsx(vi,{value:"green",current:l,onChange:d,label:"绿色",colorClass:"bg-green-500"}),a.jsx(vi,{value:"orange",current:l,onChange:d,label:"橙色",colorClass:"bg-orange-500"}),a.jsx(vi,{value:"pink",current:l,onChange:d,label:"粉色",colorClass:"bg-pink-500"}),a.jsx(vi,{value:"red",current:l,onChange:d,label:"红色",colorClass:"bg-red-500"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),a.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[a.jsx(vi,{value:"gradient-sunset",current:l,onChange:d,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),a.jsx(vi,{value:"gradient-ocean",current:l,onChange:d,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),a.jsx(vi,{value:"gradient-forest",current:l,onChange:d,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),a.jsx(vi,{value:"gradient-aurora",current:l,onChange:d,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),a.jsx(vi,{value:"gradient-fire",current:l,onChange:d,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),a.jsx(vi,{value:"gradient-twilight",current:l,onChange:d,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[a.jsx("div",{className:"flex-1",children:a.jsx("input",{type:"color",value:l.startsWith("#")?l:"#3b82f6",onChange:h=>d(h.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),a.jsx("div",{className:"flex-1",children:a.jsx(Me,{type:"text",value:l,onChange:h=>d(h.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),a.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),a.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[a.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5 flex-1",children:[a.jsx(te,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),a.jsx(jt,{id:"animations",checked:n,onCheckedChange:r})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5 flex-1",children:[a.jsx(te,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),a.jsx(jt,{id:"waves-background",checked:s,onCheckedChange:i})]})})]})]})]})}function SH(){const t=wa(),[e,n]=S.useState(""),[r,s]=S.useState(""),[i,l]=S.useState(!1),[c,d]=S.useState(!1),[h,m]=S.useState(!1),[p,x]=S.useState(!1),[v,b]=S.useState(!1),[k,O]=S.useState(!1),[j,T]=S.useState(""),[A,_]=S.useState(!1),{toast:D}=Pr(),E=S.useMemo(()=>tH(r),[r]),R=()=>localStorage.getItem("access-token")||"",Q=async W=>{try{await navigator.clipboard.writeText(W),b(!0),D({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>b(!1),2e3)}catch{D({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},F=async()=>{if(!r.trim()){D({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!E.isValid){const W=E.rules.filter(J=>!J.passed).map(J=>J.label).join(", ");D({title:"格式错误",description:`Token 不符合要求: ${W}`,variant:"destructive"});return}m(!0);try{const W=R(),J=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${W}`},body:JSON.stringify({new_token:r.trim()})}),$=await J.json();J.ok&&$.success?(localStorage.setItem("access-token",r.trim()),s(""),e&&n(r.trim()),D({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},1500)):D({title:"更新失败",description:$.message||"无法更新 Token",variant:"destructive"})}catch(W){console.error("更新 Token 错误:",W),D({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{m(!1)}},L=async()=>{x(!0);try{const W=R(),J=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${W}`}}),$=await J.json();J.ok&&$.success?(localStorage.setItem("access-token",$.token),n($.token),T($.token),O(!0),_(!1),D({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):D({title:"生成失败",description:$.message||"无法生成新 Token",variant:"destructive"})}catch(W){console.error("生成 Token 错误:",W),D({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{x(!1)}},U=async()=>{try{await navigator.clipboard.writeText(j),_(!0),D({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{D({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},V=()=>{O(!1),setTimeout(()=>{T(""),_(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},500)},de=W=>{W||V()};return a.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[a.jsx(Rr,{open:k,onOpenChange:de,children:a.jsxs(Nr,{className:"sm:max-w-md",children:[a.jsxs(Cr,{children:[a.jsxs(Tr,{className:"flex items-center gap-2",children:[a.jsx(Hu,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),a.jsx(Gr,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[a.jsx(te,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),a.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:j})]}),a.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Hu,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),a.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[a.jsx("p",{className:"font-semibold",children:"重要提示"}),a.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[a.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),a.jsx("li",{children:"请立即复制并保存到安全的位置"}),a.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),a.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),a.jsxs(ps,{className:"gap-2 sm:gap-0",children:[a.jsx(ie,{variant:"outline",onClick:U,className:"gap-2",children:A?a.jsxs(a.Fragment,{children:[a.jsx(hc,{className:"h-4 w-4 text-green-500"}),"已复制"]}):a.jsxs(a.Fragment,{children:[a.jsx(Xb,{className:"h-4 w-4"}),"复制 Token"]})}),a.jsx(ie,{onClick:V,children:"我已保存,关闭"})]})]})}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),a.jsx("div",{className:"space-y-3 sm:space-y-4",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(Me,{id:"current-token",type:i?"text":"password",value:e||R(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),a.jsx("button",{onClick:()=>{e||n(R()),l(!i)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:i?"隐藏":"显示",children:i?a.jsx(Yb,{className:"h-4 w-4 text-muted-foreground"}):a.jsx($i,{className:"h-4 w-4 text-muted-foreground"})})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[a.jsx(ie,{variant:"outline",size:"icon",onClick:()=>Q(R()),title:"复制到剪贴板",className:"flex-shrink-0",children:v?a.jsx(hc,{className:"h-4 w-4 text-green-500"}):a.jsx(Xb,{className:"h-4 w-4"})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{variant:"outline",disabled:p,className:"gap-2 flex-1 sm:flex-none",children:[a.jsx(Fi,{className:ye("h-4 w-4",p&&"animate-spin")}),a.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),a.jsx("span",{className:"sm:hidden",children:"生成"})]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重新生成 Token"}),a.jsx(dn,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:L,children:"确认生成"})]})]})]})]})]}),a.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),a.jsxs("div",{className:"relative",children:[a.jsx(Me,{id:"new-token",type:c?"text":"password",value:r,onChange:W=>s(W.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),a.jsx("button",{onClick:()=>d(!c),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:c?"隐藏":"显示",children:c?a.jsx(Yb,{className:"h-4 w-4 text-muted-foreground"}):a.jsx($i,{className:"h-4 w-4 text-muted-foreground"})})]}),r&&a.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),a.jsx("div",{className:"space-y-1.5",children:E.rules.map(W=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[W.passed?a.jsx(Es,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):a.jsx(Kb,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),a.jsx("span",{className:ye(W.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:W.label})]},W.id))}),E.isValid&&a.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:a.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[a.jsx(hc,{className:"h-4 w-4"}),a.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),a.jsx(ie,{onClick:F,disabled:h||!E.isValid||!r,className:"w-full sm:w-auto",children:h?"更新中...":"更新自定义 Token"})]})]}),a.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[a.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),a.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),a.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),a.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),a.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),a.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),a.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function kH(){const t=wa(),{toast:e}=Pr(),[n,r]=S.useState(!1),s=async()=>{r(!0);try{const i=localStorage.getItem("access-token"),l=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${i}`}}),c=await l.json();l.ok&&c.success?(e({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{t({to:"/setup"})},1e3)):e({title:"重置失败",description:c.message||"无法重置配置状态",variant:"destructive"})}catch(i){console.error("重置配置状态错误:",i),e({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{r(!1)}};return a.jsx("div",{className:"space-y-4 sm:space-y-6",children:a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsx("div",{className:"space-y-2",children:a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{variant:"outline",disabled:n,className:"gap-2",children:[a.jsx(hq,{className:ye("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重新配置"}),a.jsx(dn,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:s,children:"确认重置"})]})]})]})]})]})})}function OH(){return a.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",fw]}),a.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[a.jsxs("p",{children:["版本: ",hw]}),a.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),a.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",a.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"React 19.2.0"}),a.jsx("li",{children:"TypeScript 5.7.2"}),a.jsx("li",{children:"Vite 6.0.7"}),a.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"shadcn/ui"}),a.jsx("li",{children:"Radix UI"}),a.jsx("li",{children:"Tailwind CSS 3.4.17"}),a.jsx("li",{children:"Lucide Icons"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"后端"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"Python 3.12+"}),a.jsx("li",{children:"FastAPI"}),a.jsx("li",{children:"Uvicorn"}),a.jsx("li",{children:"WebSocket"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"Bun / npm"}),a.jsx("li",{children:"ESLint 9.17.0"}),a.jsx("li",{children:"PostCSS"})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),a.jsx(vn,{className:"h-[300px] sm:h-[400px]",children:a.jsxs("div",{className:"space-y-4 pr-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"React",description:"用户界面构建库",license:"MIT"}),a.jsx(Gn,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),a.jsx(Gn,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),a.jsx(Gn,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),a.jsx(Gn,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),a.jsx(Gn,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),a.jsx(Gn,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),a.jsx(Gn,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),a.jsx(Gn,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),a.jsx(Gn,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),a.jsx(Gn,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),a.jsx(Gn,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),a.jsx(Gn,{name:"Pydantic",description:"数据验证库",license:"MIT"}),a.jsx(Gn,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),a.jsx(Gn,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),a.jsx(Gn,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),a.jsx(Gn,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:a.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:a.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Gn({name:t,description:e,license:n}){return a.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium text-foreground truncate",children:t}),a.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:e})]}),a.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:n})]})}function Ny({value:t,current:e,onChange:n,label:r,description:s}){const i=e===t;return a.jsxs("button",{onClick:()=>n(t),className:ye("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&a.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-sm sm:text-base font-medium",children:r}),a.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:s})]}),a.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[t==="light"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),t==="dark"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),t==="system"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function vi({value:t,current:e,onChange:n,label:r,colorClass:s}){const i=e===t;return a.jsxs("button",{onClick:()=>n(t),className:ye("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&a.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),a.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[a.jsx("div",{className:ye("h-8 w-8 sm:h-10 sm:w-10 rounded-full",s)}),a.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:r})]})]})}class jH{grad3;p;perm;constructor(e=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let n=0;n<256;n++)this.p[n]=Math.floor(Math.random()*256);this.perm=[];for(let n=0;n<512;n++)this.perm[n]=this.p[n&255]}dot(e,n,r){return e[0]*n+e[1]*r}mix(e,n,r){return(1-r)*e+r*n}fade(e){return e*e*e*(e*(e*6-15)+10)}perlin2(e,n){const r=Math.floor(e)&255,s=Math.floor(n)&255;e-=Math.floor(e),n-=Math.floor(n);const i=this.fade(e),l=this.fade(n),c=this.perm[r]+s,d=this.perm[c],h=this.perm[c+1],m=this.perm[r+1]+s,p=this.perm[m],x=this.perm[m+1];return this.mix(this.mix(this.dot(this.grad3[d%12],e,n),this.dot(this.grad3[p%12],e-1,n),i),this.mix(this.dot(this.grad3[h%12],e,n-1),this.dot(this.grad3[x%12],e-1,n-1),i),l)}}function NH(){const t=S.useRef(null),e=S.useRef(null),n=S.useRef(void 0),r=S.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new jH(Math.random()),bounding:null});return S.useEffect(()=>{const s=e.current,i=t.current;if(!s||!i)return;const l=r.current,c=()=>{const k=s.getBoundingClientRect();l.bounding=k,i.style.width=`${k.width}px`,i.style.height=`${k.height}px`},d=()=>{if(!l.bounding)return;const{width:k,height:O}=l.bounding;l.lines=[],l.paths.forEach(F=>F.remove()),l.paths=[];const j=10,T=32,A=k+200,_=O+30,D=Math.ceil(A/j),E=Math.ceil(_/T),R=(k-j*D)/2,Q=(O-T*E)/2;for(let F=0;F<=D;F++){const L=[];for(let V=0;V<=E;V++){const de={x:R+j*F,y:Q+T*V,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};L.push(de)}const U=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild(U),l.paths.push(U),l.lines.push(L)}},h=k=>{const{lines:O,mouse:j,noise:T}=l;O.forEach(A=>{A.forEach(_=>{const D=T.perlin2((_.x+k*.0125)*.002,(_.y+k*.005)*.0015)*12;_.wave.x=Math.cos(D)*32,_.wave.y=Math.sin(D)*16;const E=_.x-j.sx,R=_.y-j.sy,Q=Math.hypot(E,R),F=Math.max(175,j.vs);if(Q{const j={x:k.x+k.wave.x+(O?k.cursor.x:0),y:k.y+k.wave.y+(O?k.cursor.y:0)};return j.x=Math.round(j.x*10)/10,j.y=Math.round(j.y*10)/10,j},p=()=>{const{lines:k,paths:O}=l;k.forEach((j,T)=>{let A=m(j[0],!1),_=`M ${A.x} ${A.y}`;j.forEach((D,E)=>{const R=E===j.length-1;A=m(D,!R),_+=`L ${A.x} ${A.y}`}),O[T].setAttribute("d",_)})},x=k=>{const{mouse:O}=l;O.sx+=(O.x-O.sx)*.1,O.sy+=(O.y-O.sy)*.1;const j=O.x-O.lx,T=O.y-O.ly,A=Math.hypot(j,T);O.v=A,O.vs+=(A-O.vs)*.1,O.vs=Math.min(100,O.vs),O.lx=O.x,O.ly=O.y,O.a=Math.atan2(T,j),s&&(s.style.setProperty("--x",`${O.sx}px`),s.style.setProperty("--y",`${O.sy}px`)),h(k),p(),n.current=requestAnimationFrame(x)},v=k=>{if(!l.bounding)return;const{mouse:O}=l;O.x=k.pageX-l.bounding.left,O.y=k.pageY-l.bounding.top+window.scrollY,O.set||(O.sx=O.x,O.sy=O.y,O.lx=O.x,O.ly=O.y,O.set=!0)},b=()=>{c(),d()};return c(),d(),window.addEventListener("resize",b),window.addEventListener("mousemove",v),n.current=requestAnimationFrame(x),()=>{window.removeEventListener("resize",b),window.removeEventListener("mousemove",v),n.current&&cancelAnimationFrame(n.current)}},[]),a.jsxs("div",{ref:e,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[a.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),a.jsx("svg",{ref:t,style:{display:"block",width:"100%",height:"100%"},children:a.jsx("style",{children:` + path { + fill: none; + stroke: hsl(var(--primary) / 0.20); + stroke-width: 1px; + } + `})})]})}function CH(){const t=wa();S.useEffect(()=>{localStorage.getItem("access-token")||t({to:"/auth"})},[t])}function qT(){return!!localStorage.getItem("access-token")}function TH(){const[t,e]=S.useState(""),[n,r]=S.useState(!1),[s,i]=S.useState(""),l=wa(),{enableWavesBackground:c,setEnableWavesBackground:d}=hT(),{theme:h,setTheme:m}=dw();S.useEffect(()=>{qT()&&l({to:"/"})},[l]);const x=h==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":h,v=()=>{m(x==="dark"?"light":"dark")},b=async k=>{if(k.preventDefault(),i(""),!t.trim()){i("请输入 Access Token");return}r(!0);try{const O=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t.trim()})}),j=await O.json();if(O.ok&&j.valid){localStorage.setItem("access-token",t.trim());const T=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${t.trim()}`}}),A=await T.json();T.ok&&A.is_first_setup?l({to:"/setup"}):l({to:"/"})}else i(j.message||"Token 验证失败,请检查后重试")}catch(O){console.error("Token 验证错误:",O),i("连接服务器失败,请检查网络连接")}finally{r(!1)}};return a.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[c&&a.jsx(NH,{}),a.jsxs(gt,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[a.jsx("button",{onClick:v,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:x==="dark"?"切换到浅色模式":"切换到深色模式",children:x==="dark"?a.jsx(Zb,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):a.jsx(Jb,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),a.jsxs(Wt,{className:"space-y-4 text-center",children:[a.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:a.jsx(lO,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Gt,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),a.jsx(Sr,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),a.jsx(an,{children:a.jsxs("form",{onSubmit:b,className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),a.jsxs("div",{className:"relative",children:[a.jsx(fq,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),a.jsx(Me,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:t,onChange:k=>e(k.target.value),className:ye("pl-10",s&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),s&&a.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[a.jsx(xc,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),a.jsx("span",{children:s})]}),a.jsx(ie,{type:"submit",className:"w-full",disabled:n,children:n?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),a.jsxs(Rr,{children:[a.jsx(mw,{asChild:!0,children:a.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[a.jsx(mq,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),a.jsxs(Nr,{className:"sm:max-w-md",children:[a.jsxs(Cr,{children:[a.jsxs(Tr,{className:"flex items-center gap-2",children:[a.jsx(lO,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),a.jsx(Gr,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(pq,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),a.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[a.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),a.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ao,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),a.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:a.jsx("code",{className:"text-primary",children:"data/webui.json"})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",a.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),a.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(xc,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[a.jsx("p",{className:"font-semibold",children:"安全提示"}),a.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[a.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),a.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[a.jsx(uf,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsxs(un,{className:"flex items-center gap-2",children:[a.jsx(uf,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),a.jsx(dn,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>d(!1),children:"关闭动画"})]})]})]})]})})]}),a.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:a.jsx("p",{children:nH})})]})}const _n=S.forwardRef(({className:t,...e},n)=>a.jsx("textarea",{className:ye("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...e}));_n.displayName="Textarea";var AH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],MH=AH.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),EH="Separator",WO="horizontal",_H=["horizontal","vertical"],FT=S.forwardRef((t,e)=>{const{decorative:n,orientation:r=WO,...s}=t,i=DH(r)?r:WO,c=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return a.jsx(MH.div,{"data-orientation":i,...c,...s,ref:e})});FT.displayName=EH;function DH(t){return _H.includes(t)}var QT=FT;const mf=S.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},s)=>a.jsx(QT,{ref:s,decorative:n,orientation:e,className:ye("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));mf.displayName=QT.displayName;const RH=Nd("inline-flex items-center rounded-md 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 shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function On({className:t,variant:e,...n}){return a.jsx("div",{className:ye(RH({variant:e}),t),...n})}function zH({config:t,onChange:e}){const n=s=>{s.trim()&&!t.alias_names.includes(s.trim())&&e({...t,alias_names:[...t.alias_names,s.trim()]})},r=s=>{e({...t,alias_names:t.alias_names.filter((i,l)=>l!==s)})};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"qq_account",children:"QQ账号 *"}),a.jsx(Me,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:t.qq_account||"",onChange:s=>e({...t,qq_account:Number(s.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称 *"}),a.jsx(Me,{id:"nickname",placeholder:"请输入机器人的昵称",value:t.nickname,onChange:s=>e({...t,nickname:s.target.value})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{children:"别名"}),a.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.alias_names.map((s,i)=>a.jsxs(On,{variant:"secondary",className:"gap-1",children:[s,a.jsx("button",{type:"button",onClick:()=>r(i),className:"ml-1 hover:text-destructive",children:a.jsx(Gf,{className:"h-3 w-3"})})]},i))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:s=>{s.key==="Enter"&&(n(s.target.value),s.target.value="")}}),a.jsx(ie,{type:"button",variant:"outline",onClick:()=>{const s=document.getElementById("alias_input");s&&(n(s.value),s.value="")},children:"添加"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function PH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"personality",children:"人格特征 *"}),a.jsx(_n,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:t.personality,onChange:n=>e({...t,personality:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"reply_style",children:"表达风格 *"}),a.jsx(_n,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:t.reply_style,onChange:n=>e({...t,reply_style:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"interest",children:"兴趣 *"}),a.jsx(_n,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:t.interest,onChange:n=>e({...t,interest:n.target.value}),rows:2}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),a.jsx(mf,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"plan_style",children:"群聊说话规则 *"}),a.jsx(_n,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:t.plan_style,onChange:n=>e({...t,plan_style:n.target.value}),rows:4}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),a.jsx(_n,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:t.private_plan_style,onChange:n=>e({...t,private_plan_style:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function BH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{htmlFor:"emoji_chance",children:"表情包激活概率"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[(t.emoji_chance*100).toFixed(0),"%"]})]}),a.jsx(Me,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:t.emoji_chance,onChange:n=>e({...t,emoji_chance:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"max_reg_num",children:"最大表情包数量"}),a.jsx(Me,{id:"max_reg_num",type:"number",min:"1",max:"200",value:t.max_reg_num,onChange:n=>e({...t,max_reg_num:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"do_replace",children:"达到最大数量时替换"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),a.jsx(jt,{id:"do_replace",checked:t.do_replace,onCheckedChange:n=>e({...t,do_replace:n})})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),a.jsx(Me,{id:"check_interval",type:"number",min:"1",max:"120",value:t.check_interval,onChange:n=>e({...t,check_interval:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"steal_emoji",children:"偷取表情包"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),a.jsx(jt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:n=>e({...t,steal_emoji:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"content_filtration",children:"启用表情包过滤"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),a.jsx(jt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:n=>e({...t,content_filtration:n})})]}),t.content_filtration&&a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"filtration_prompt",children:"过滤要求"}),a.jsx(Me,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:t.filtration_prompt,onChange:n=>e({...t,filtration_prompt:n.target.value})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function LH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"enable_tool",children:"启用工具系统"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),a.jsx(jt,{id:"enable_tool",checked:t.enable_tool,onCheckedChange:n=>e({...t,enable_tool:n})})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"enable_mood",children:"启用情绪系统"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),a.jsx(jt,{id:"enable_mood",checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})})]}),t.enable_mood&&a.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),a.jsx(Me,{id:"mood_update_threshold",type:"number",min:"0.1",max:"10",step:"0.1",value:t.mood_update_threshold||1,onChange:n=>e({...t,mood_update_threshold:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"emotion_style",children:"情感特征"}),a.jsx(_n,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:t.emotion_style||"",onChange:n=>e({...t,emotion_style:n.target.value}),rows:2}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"all_global",children:"启用全局黑话模式"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),a.jsx(jt,{id:"all_global",checked:t.all_global,onCheckedChange:n=>e({...t,all_global:n})})]})]})}async function ot(t,e){const n=await fetch(t,e);if(n.status===401)throw localStorage.removeItem("access-token"),window.location.href="/auth",new Error("认证失败,请重新登录");return n}function bt(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function IH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取Bot配置失败");const n=(await t.json()).config.bot||{};return{qq_account:n.qq_account||0,nickname:n.nickname||"",alias_names:n.alias_names||[]}}async function qH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取人格配置失败");const n=(await t.json()).config.personality||{};return{personality:n.personality||"",reply_style:n.reply_style||"",interest:n.interest||"",plan_style:n.plan_style||"",private_plan_style:n.private_plan_style||""}}async function FH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取表情包配置失败");const n=(await t.json()).config.emoji||{};return{emoji_chance:n.emoji_chance??.4,max_reg_num:n.max_reg_num??40,do_replace:n.do_replace??!0,check_interval:n.check_interval??10,steal_emoji:n.steal_emoji??!0,content_filtration:n.content_filtration??!1,filtration_prompt:n.filtration_prompt||""}}async function QH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取其他配置失败");const n=(await t.json()).config,r=n.tool||{},s=n.mood||{},i=n.jargon||{};return{enable_tool:r.enable_tool??!0,enable_mood:s.enable_mood??!1,mood_update_threshold:s.mood_update_threshold,emotion_style:s.emotion_style,all_global:i.all_global??!0}}async function $H(t){const e=await ot("/api/webui/config/bot/section/bot",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await e.json()}async function HH(t){const e=await ot("/api/webui/config/bot/section/personality",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存人格配置失败")}return await e.json()}async function UH(t){const e=await ot("/api/webui/config/bot/section/emoji",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存表情包配置失败")}return await e.json()}async function VH(t){const e=[];e.push(ot("/api/webui/config/bot/section/tool",{method:"POST",headers:bt(),body:JSON.stringify({enable_tool:t.enable_tool})})),e.push(ot("/api/webui/config/bot/section/jargon",{method:"POST",headers:bt(),body:JSON.stringify({all_global:t.all_global})}));const n={enable_mood:t.enable_mood};t.enable_mood&&(n.mood_update_threshold=t.mood_update_threshold||1,n.emotion_style=t.emotion_style||""),e.push(ot("/api/webui/config/bot/section/mood",{method:"POST",headers:bt(),body:JSON.stringify(n)}));const r=await Promise.all(e);for(const s of r)if(!s.ok){const i=await s.json();throw new Error(i.detail||"保存其他配置失败")}return{success:!0}}async function GO(){const t=localStorage.getItem("access-token"),e=await ot("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!e.ok){const n=await e.json();throw new Error(n.message||"标记配置完成失败")}return await e.json()}function WH(){const t=wa(),{toast:e}=Pr(),[n,r]=S.useState(0),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!0),[m,p]=S.useState({qq_account:0,nickname:"",alias_names:[]}),[x,v]=S.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 +2.如果相同的内容已经被执行,请不要重复执行 +3.请控制你的发言频率,不要太过频繁的发言 +4.如果有人对你感到厌烦,请减少回复 +5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 +2.如果相同的内容已经被执行,请不要重复执行 +3.某句话如果已经被回复过,不要重复回复`}),[b,k]=S.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[O,j]=S.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遭遇特定事件的时候起伏较大",all_global:!0}),T=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:xq},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:D9},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:K4},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:Ii},{id:"complete",title:"完成设置",description:"后续配置提示",icon:uf}],A=(n+1)/T.length*100;S.useEffect(()=>{(async()=>{try{h(!0);const[U,V,de,W]=await Promise.all([IH(),qH(),FH(),QH()]);p(U),v(V),k(de),j(W)}catch(U){e({title:"加载配置失败",description:U instanceof Error?U.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{h(!1)}})()},[e]);const _=async()=>{c(!0);try{switch(n){case 0:await $H(m);break;case 1:await HH(x);break;case 2:await UH(b);break;case 3:await VH(O);break}return e({title:"保存成功",description:`${T[n].title}配置已保存`}),!0}catch(L){return e({title:"保存失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"}),!1}finally{c(!1)}},D=async()=>{await _()&&n{n>0&&r(n-1)},R=async()=>{i(!0);try{if(!await _()){i(!1);return}await GO(),e({title:"配置完成",description:"所有配置已保存,正在跳转..."}),setTimeout(()=>{t({to:"/"})},500)}catch(L){e({title:"完成失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}finally{i(!1)}},Q=async()=>{try{await GO(),t({to:"/"})}catch(L){e({title:"跳过失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},F=()=>{switch(n){case 0:return a.jsx(zH,{config:m,onChange:p});case 1:return a.jsx(PH,{config:x,onChange:v});case 2:return a.jsx(BH,{config:b,onChange:k});case 3:return a.jsx(LH,{config:O,onChange:j});case 4:return a.jsxs("div",{className:"space-y-6 text-center py-8",children:[a.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:a.jsx(uf,{className:"h-8 w-8 text-primary",strokeWidth:2})}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h3",{className:"text-xl font-semibold",children:"模型配置"}),a.jsx("p",{className:"text-muted-foreground max-w-md mx-auto",children:"为了让机器人正常工作,您需要配置 AI 模型提供商和模型。"})]}),a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-6 max-w-md mx-auto text-left space-y-4",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"1"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"配置 API 提供商"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → API 提供商"中添加您的 API 提供商信息'})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"2"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"添加模型"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型列表"中添加需要使用的模型'})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"3"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"配置模型任务"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型任务配置"中为不同任务分配模型'})]})]})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"💡 提示:完成向导后,您可以在系统设置中进行详细的模型配置"})]});default:return null}};return a.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[a.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[a.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),a.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),d?a.jsxs("div",{className:"relative z-10 text-center",children:[a.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:a.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),a.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),a.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[a.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[a.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:a.jsx(gq,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),a.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),a.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",fw," 的初始配置"]})]}),a.jsxs("div",{className:"mb-6 md:mb-8",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[a.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",T.length]}),a.jsxs("span",{className:"font-medium text-primary",children:[Math.round(A),"%"]})]}),a.jsx(n0,{value:A,className:"h-2"})]}),a.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:T.map((L,U)=>{const V=L.icon;return a.jsxs("div",{className:ye("flex flex-1 flex-col items-center gap-1 md:gap-2",Ut({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[a.jsx(hg,{className:"h-4 w-4"}),"返回首页"]}),a.jsxs(ie,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[a.jsx(R9,{className:"h-4 w-4"}),"返回上一页"]})]}),a.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var HT=["PageUp","PageDown"],UT=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],VT={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Cd="Slider",[c2,GH,XH]=tx(Cd),[WT]=Vi(Cd,[XH]),[YH,vx]=WT(Cd),GT=S.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:l="horizontal",disabled:c=!1,minStepsBetweenThumbs:d=0,defaultValue:h=[r],value:m,onValueChange:p=()=>{},onValueCommit:x=()=>{},inverted:v=!1,form:b,...k}=t,O=S.useRef(new Set),j=S.useRef(0),A=l==="horizontal"?KH:ZH,[_=[],D]=ko({prop:m,defaultProp:h,onChange:U=>{[...O.current][j.current]?.focus(),p(U)}}),E=S.useRef(_);function R(U){const V=rU(_,U);L(U,V)}function Q(U){L(U,j.current)}function F(){const U=E.current[j.current];_[j.current]!==U&&x(_)}function L(U,V,{commit:de}={commit:!1}){const W=lU(i),J=oU(Math.round((U-r)/i)*i+r,W),$=F4(J,[r,s]);D((ae=[])=>{const ne=tU(ae,$,V);if(aU(ne,d*i)){j.current=ne.indexOf($);const ce=String(ne)!==String(ae);return ce&&de&&x(ne),ce?ne:ae}else return ae})}return a.jsx(YH,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:s,valueIndexToChangeRef:j,thumbs:O.current,values:_,orientation:l,form:b,children:a.jsx(c2.Provider,{scope:t.__scopeSlider,children:a.jsx(c2.Slot,{scope:t.__scopeSlider,children:a.jsx(A,{"aria-disabled":c,"data-disabled":c?"":void 0,...k,ref:e,onPointerDown:$e(k.onPointerDown,()=>{c||(E.current=_)}),min:r,max:s,inverted:v,onSlideStart:c?void 0:R,onSlideMove:c?void 0:Q,onSlideEnd:c?void 0:F,onHomeKeyDown:()=>!c&&L(r,0,{commit:!0}),onEndKeyDown:()=>!c&&L(s,_.length-1,{commit:!0}),onStepKeyDown:({event:U,direction:V})=>{if(!c){const J=HT.includes(U.key)||U.shiftKey&&UT.includes(U.key)?10:1,$=j.current,ae=_[$],ne=i*J*V;L(ae+ne,$,{commit:!0})}}})})})})});GT.displayName=Cd;var[XT,YT]=WT(Cd,{startEdge:"left",endEdge:"right",size:"width",direction:1}),KH=S.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:l,onSlideMove:c,onSlideEnd:d,onStepKeyDown:h,...m}=t,[p,x]=S.useState(null),v=Cn(e,A=>x(A)),b=S.useRef(void 0),k=Vf(s),O=k==="ltr",j=O&&!i||!O&&i;function T(A){const _=b.current||p.getBoundingClientRect(),D=[0,_.width],R=pw(D,j?[n,r]:[r,n]);return b.current=_,R(A-_.left)}return a.jsx(XT,{scope:t.__scopeSlider,startEdge:j?"left":"right",endEdge:j?"right":"left",direction:j?1:-1,size:"width",children:a.jsx(KT,{dir:k,"data-orientation":"horizontal",...m,ref:v,style:{...m.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:A=>{const _=T(A.clientX);l?.(_)},onSlideMove:A=>{const _=T(A.clientX);c?.(_)},onSlideEnd:()=>{b.current=void 0,d?.()},onStepKeyDown:A=>{const D=VT[j?"from-left":"from-right"].includes(A.key);h?.({event:A,direction:D?-1:1})}})})}),ZH=S.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...h}=t,m=S.useRef(null),p=Cn(e,m),x=S.useRef(void 0),v=!s;function b(k){const O=x.current||m.current.getBoundingClientRect(),j=[0,O.height],A=pw(j,v?[r,n]:[n,r]);return x.current=O,A(k-O.top)}return a.jsx(XT,{scope:t.__scopeSlider,startEdge:v?"bottom":"top",endEdge:v?"top":"bottom",size:"height",direction:v?1:-1,children:a.jsx(KT,{"data-orientation":"vertical",...h,ref:p,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:k=>{const O=b(k.clientY);i?.(O)},onSlideMove:k=>{const O=b(k.clientY);l?.(O)},onSlideEnd:()=>{x.current=void 0,c?.()},onStepKeyDown:k=>{const j=VT[v?"from-bottom":"from-top"].includes(k.key);d?.({event:k,direction:j?-1:1})}})})}),KT=S.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:l,onEndKeyDown:c,onStepKeyDown:d,...h}=t,m=vx(Cd,n);return a.jsx(Zt.span,{...h,ref:e,onKeyDown:$e(t.onKeyDown,p=>{p.key==="Home"?(l(p),p.preventDefault()):p.key==="End"?(c(p),p.preventDefault()):HT.concat(UT).includes(p.key)&&(d(p),p.preventDefault())}),onPointerDown:$e(t.onPointerDown,p=>{const x=p.target;x.setPointerCapture(p.pointerId),p.preventDefault(),m.thumbs.has(x)?x.focus():r(p)}),onPointerMove:$e(t.onPointerMove,p=>{p.target.hasPointerCapture(p.pointerId)&&s(p)}),onPointerUp:$e(t.onPointerUp,p=>{const x=p.target;x.hasPointerCapture(p.pointerId)&&(x.releasePointerCapture(p.pointerId),i(p))})})}),ZT="SliderTrack",JT=S.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=vx(ZT,n);return a.jsx(Zt.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});JT.displayName=ZT;var u2="SliderRange",eA=S.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=vx(u2,n),i=YT(u2,n),l=S.useRef(null),c=Cn(e,l),d=s.values.length,h=s.values.map(x=>rA(x,s.min,s.max)),m=d>1?Math.min(...h):0,p=100-Math.max(...h);return a.jsx(Zt.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:m+"%",[i.endEdge]:p+"%"}})});eA.displayName=u2;var d2="SliderThumb",tA=S.forwardRef((t,e)=>{const n=GH(t.__scopeSlider),[r,s]=S.useState(null),i=Cn(e,c=>s(c)),l=S.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return a.jsx(JH,{...t,ref:i,index:l})}),JH=S.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...i}=t,l=vx(d2,n),c=YT(d2,n),[d,h]=S.useState(null),m=Cn(e,T=>h(T)),p=d?l.form||!!d.closest("form"):!0,x=m9(d),v=l.values[r],b=v===void 0?0:rA(v,l.min,l.max),k=nU(r,l.values.length),O=x?.[c.size],j=O?sU(O,b,c.direction):0;return S.useEffect(()=>{if(d)return l.thumbs.add(d),()=>{l.thumbs.delete(d)}},[d,l.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${b}% + ${j}px)`},children:[a.jsx(c2.ItemSlot,{scope:t.__scopeSlider,children:a.jsx(Zt.span,{role:"slider","aria-label":t["aria-label"]||k,"aria-valuemin":l.min,"aria-valuenow":v,"aria-valuemax":l.max,"aria-orientation":l.orientation,"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,tabIndex:l.disabled?void 0:0,...i,ref:m,style:v===void 0?{display:"none"}:t.style,onFocus:$e(t.onFocus,()=>{l.valueIndexToChangeRef.current=r})})}),p&&a.jsx(nA,{name:s??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:v},r)]})});tA.displayName=d2;var eU="RadioBubbleInput",nA=S.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=S.useRef(null),i=Cn(s,r),l=f9(e);return S.useEffect(()=>{const c=s.current;if(!c)return;const d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==e&&m){const p=new Event("input",{bubbles:!0});m.call(c,e),c.dispatchEvent(p)}},[l,e]),a.jsx(Zt.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});nA.displayName=eU;function tU(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,i)=>s-i)}function rA(t,e,n){const i=100/(n-e)*(t-e);return F4(i,[0,100])}function nU(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function rU(t,e){if(t.length===1)return 0;const n=t.map(s=>Math.abs(s-e)),r=Math.min(...n);return n.indexOf(r)}function sU(t,e,n){const r=t/2,i=pw([0,50],[0,r]);return(r-i(e)*n)*n}function iU(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function aU(t,e){if(e>0){const n=iU(t);return Math.min(...n)>=e}return!0}function pw(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 lU(t){return(String(t).split(".")[1]||"").length}function oU(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var sA=GT,cU=JT,uU=eA,dU=tA;const yx=S.forwardRef(({className:t,...e},n)=>a.jsxs(sA,{ref:n,className:ye("relative flex w-full touch-none select-none items-center",t),...e,children:[a.jsx(cU,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:a.jsx(uU,{className:"absolute h-full bg-primary"})}),a.jsx(dU,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));yx.displayName=sA.displayName;const Lt=tq,It=nq,Dt=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(v9,{ref:r,className:ye("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,a.jsx(YI,{asChild:!0,children:a.jsx(df,{className:"h-4 w-4 opacity-50"})})]}));Dt.displayName=v9.displayName;const iA=S.forwardRef(({className:t,...e},n)=>a.jsx(y9,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(e2,{className:"h-4 w-4"})}));iA.displayName=y9.displayName;const aA=S.forwardRef(({className:t,...e},n)=>a.jsx(b9,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(df,{className:"h-4 w-4"})}));aA.displayName=b9.displayName;const Rt=S.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>a.jsx(KI,{children:a.jsxs(w9,{ref:s,className:ye("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 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 origin-[--radix-select-content-transform-origin]",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(iA,{}),a.jsx(ZI,{className:ye("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(aA,{})]})}));Rt.displayName=w9.displayName;const hU=S.forwardRef(({className:t,...e},n)=>a.jsx(S9,{ref:n,className:ye("px-2 py-1.5 text-sm font-semibold",t),...e}));hU.displayName=S9.displayName;const Pe=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(k9,{ref:r,className:ye("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[a.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(JI,{children:a.jsx(hc,{className:"h-4 w-4"})})}),a.jsx(eq,{children:e})]}));Pe.displayName=k9.displayName;const fU=S.forwardRef(({className:t,...e},n)=>a.jsx(O9,{ref:n,className:ye("-mx-1 my-1 h-px bg-muted",t),...e}));fU.displayName=O9.displayName;function mU(t){const e=pU(t),n=S.forwardRef((r,s)=>{const{children:i,...l}=r,c=S.Children.toArray(i),d=c.find(xU);if(d){const h=d.props.children,m=c.map(p=>p===d?S.Children.count(h)>1?S.Children.only(null):S.isValidElement(h)?h.props.children:null:p);return a.jsx(e,{...l,ref:s,children:S.isValidElement(h)?S.cloneElement(h,void 0,m):null})}return a.jsx(e,{...l,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function pU(t){const e=S.forwardRef((n,r)=>{const{children:s,...i}=n;if(S.isValidElement(s)){const l=yU(s),c=vU(i,s.props);return s.type!==S.Fragment&&(c.ref=r?oo(r,l):l),S.cloneElement(s,c)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var gU=Symbol("radix.slottable");function xU(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===gU}function vU(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...c)=>{const d=i(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function yU(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var bx="Popover",[lA]=Vi(bx,[wd]),r0=wd(),[bU,Oo]=lA(bx),oA=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:l=!1}=t,c=r0(e),d=S.useRef(null),[h,m]=S.useState(!1),[p,x]=ko({prop:r,defaultProp:s??!1,onChange:i,caller:bx});return a.jsx(ix,{...c,children:a.jsx(bU,{scope:e,contentId:ji(),triggerRef:d,open:p,onOpenChange:x,onOpenToggle:S.useCallback(()=>x(v=>!v),[x]),hasCustomAnchor:h,onCustomAnchorAdd:S.useCallback(()=>m(!0),[]),onCustomAnchorRemove:S.useCallback(()=>m(!1),[]),modal:l,children:n})})};oA.displayName=bx;var cA="PopoverAnchor",wU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Oo(cA,n),i=r0(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=s;return S.useEffect(()=>(l(),()=>c()),[l,c]),a.jsx(ax,{...i,...r,ref:e})});wU.displayName=cA;var uA="PopoverTrigger",dA=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Oo(uA,n),i=r0(n),l=Cn(e,s.triggerRef),c=a.jsx(Zt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":gA(s.open),...r,ref:l,onClick:$e(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:a.jsx(ax,{asChild:!0,...i,children:c})});dA.displayName=uA;var gw="PopoverPortal",[SU,kU]=lA(gw,{forceMount:void 0}),hA=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=Oo(gw,e);return a.jsx(SU,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};hA.displayName=gw;var ad="PopoverContent",fA=S.forwardRef((t,e)=>{const n=kU(ad,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=Oo(ad,t.__scopePopover);return a.jsx(Ls,{present:r||i.open,children:i.modal?a.jsx(jU,{...s,ref:e}):a.jsx(NU,{...s,ref:e})})});fA.displayName=ad;var OU=mU("PopoverContent.RemoveScroll"),jU=S.forwardRef((t,e)=>{const n=Oo(ad,t.__scopePopover),r=S.useRef(null),s=Cn(e,r),i=S.useRef(!1);return S.useEffect(()=>{const l=r.current;if(l)return j9(l)},[]),a.jsx(N9,{as:OU,allowPinchZoom:!0,children:a.jsx(mA,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:$e(t.onCloseAutoFocus,l=>{l.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:$e(t.onPointerDownOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,h=c.button===2||d;i.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:$e(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),NU=S.forwardRef((t,e)=>{const n=Oo(ad,t.__scopePopover),r=S.useRef(!1),s=S.useRef(!1);return a.jsx(mA,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=i.target;n.triggerRef.current?.contains(l)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),mA=S.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:m,...p}=t,x=Oo(ad,n),v=r0(n);return C9(),a.jsx(T9,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:m,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onDismiss:()=>x.onOpenChange(!1),children:a.jsx(X4,{"data-state":gA(x.open),role:"dialog",id:x.contentId,...v,...p,ref:e,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),pA="PopoverClose",CU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Oo(pA,n);return a.jsx(Zt.button,{type:"button",...r,ref:e,onClick:$e(t.onClick,()=>s.onOpenChange(!1))})});CU.displayName=pA;var TU="PopoverArrow",AU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=r0(n);return a.jsx(Y4,{...s,...r,ref:e})});AU.displayName=TU;function gA(t){return t?"open":"closed"}var MU=oA,EU=dA,_U=hA,xA=fA;const uo=MU,ho=EU,fl=S.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>a.jsx(_U,{children:a.jsx(xA,{ref:s,align:e,sideOffset:n,className:ye("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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 origin-[--radix-popover-content-transform-origin]",t),...r})}));fl.displayName=xA.displayName;const jo="/api/webui/config";async function DU(){const e=await(await ot(`${jo}/bot`)).json();if(!e.success)throw new Error("获取配置数据失败");return e.config}async function Vu(){const e=await(await ot(`${jo}/model`)).json();if(!e.success)throw new Error("获取模型配置数据失败");return e.config}async function XO(t){const n=await(await ot(`${jo}/bot`,{method:"POST",headers:bt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function RU(){const e=await(await ot(`${jo}/bot/raw`)).json();if(!e.success)throw new Error("获取配置源代码失败");return e.content}async function zU(t){const n=await(await ot(`${jo}/bot/raw`,{method:"POST",headers:bt(),body:JSON.stringify({raw_content:t})})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function wg(t){const n=await(await ot(`${jo}/model`,{method:"POST",headers:bt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function PU(t,e){const r=await(await ot(`${jo}/bot/section/${t}`,{method:"POST",headers:bt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function h2(t,e){const r=await(await ot(`${jo}/model/section/${t}`,{method:"POST",headers:bt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}const BU=Zn.create({baseURL:"",timeout:1e4});async function xw(){try{return(await BU.post("/api/webui/system/restart")).data}catch(t){throw console.error("重启麦麦失败:",t),t}}const LU=Nd("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),ld=S.forwardRef(({className:t,variant:e,...n},r)=>a.jsx("div",{ref:r,role:"alert",className:ye(LU({variant:e}),t),...n}));ld.displayName="Alert";const IU=S.forwardRef(({className:t,...e},n)=>a.jsx("h5",{ref:n,className:ye("mb-1 font-medium leading-none tracking-tight",t),...e}));IU.displayName="AlertTitle";const od=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("text-sm [&_p]:leading-relaxed",t),...e}));od.displayName="AlertDescription";function vw({onRestartComplete:t,onRestartFailed:e}){const[n,r]=S.useState(0),[s,i]=S.useState("restarting"),[l,c]=S.useState(0),[d,h]=S.useState(0);S.useEffect(()=>{const x=setInterval(()=>{r(k=>k>=90?k:k+1)},200),v=setInterval(()=>{c(k=>k+1)},1e3),b=setTimeout(()=>{i("checking"),m()},3e3);return()=>{clearInterval(x),clearInterval(v),clearTimeout(b)}},[]);const m=()=>{const v=async()=>{try{if(h(k=>k+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)r(100),i("success"),setTimeout(()=>{t?.()},1500);else throw new Error("Status check failed")}catch{d<60?setTimeout(v,2e3):(i("failed"),e?.())}};v()},p=x=>{const v=Math.floor(x/60),b=x%60;return`${v}:${b.toString().padStart(2,"0")}`};return a.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:a.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[a.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s==="restarting"&&a.jsxs(a.Fragment,{children:[a.jsx(hf,{className:"h-16 w-16 text-primary animate-spin"}),a.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),s==="checking"&&a.jsxs(a.Fragment,{children:[a.jsx(hf,{className:"h-16 w-16 text-primary animate-spin"}),a.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),a.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",d,"/60)"]})]}),s==="success"&&a.jsxs(a.Fragment,{children:[a.jsx(Es,{className:"h-16 w-16 text-green-500"}),a.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),s==="failed"&&a.jsxs(a.Fragment,{children:[a.jsx(xc,{className:"h-16 w-16 text-destructive"}),a.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),s!=="failed"&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(n0,{value:n,className:"h-2"}),a.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[a.jsxs("span",{children:[n,"%"]}),a.jsxs("span",{children:["已用时: ",p(l)]})]})]}),a.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="restarting"&&"🔄 配置已保存,正在重启主程序...",s==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",s==="success"&&"✅ 配置已生效,服务运行正常",s==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),s==="failed"&&a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),a.jsx("button",{onClick:()=>{i("checking"),h(0),m()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}let f2=[],vA=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e>1;if(t=vA[r])e=r+1;else return!0;if(e==n)return!1}}function YO(t){return t>=127462&&t<=127487}const KO=8205;function FU(t,e,n=!0,r=!0){return(n?yA:QU)(t,e,r)}function yA(t,e,n){if(e==t.length)return e;e&&bA(t.charCodeAt(e))&&wA(t.charCodeAt(e-1))&&e--;let r=Cy(t,e);for(e+=ZO(r);e=0&&YO(Cy(t,l));)i++,l-=2;if(i%2==0)break;e+=2}else break}return e}function QU(t,e,n){for(;e>0;){let r=yA(t,e-2,n);if(r=56320&&t<57344}function wA(t){return t>=55296&&t<56320}function ZO(t){return t<65536?1:2}class Xt{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=cd(this,e,n);let s=[];return this.decompose(0,e,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(n,this.length,s,1),Gp.from(s,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=cd(this,e,n);let r=[];return this.decompose(e,n,r,0),Gp.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),s=new Zh(this),i=new Zh(e);for(let l=n,c=n;;){if(s.next(l),i.next(l),l=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(c+=s.value.length,s.done||c>=r)return!0}}iter(e=1){return new Zh(this,e)}iterRange(e,n=this.length){return new SA(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let s=this.line(e).from;r=this.iterRange(s,Math.max(s,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new kA(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Xt.empty:e.length<=32?new ir(e):Gp.from(ir.split(e,[]))}}class ir extends Xt{constructor(e,n=$U(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,s){for(let i=0;;i++){let l=this.text[i],c=s+l.length;if((n?r:c)>=e)return new HU(s,c,r,l);s=c+1,r++}}decompose(e,n,r,s){let i=e<=0&&n>=this.length?this:new ir(JO(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let l=r.pop(),c=Xp(i.text,l.text.slice(),0,i.length);if(c.length<=32)r.push(new ir(c,l.length+i.length));else{let d=c.length>>1;r.push(new ir(c.slice(0,d)),new ir(c.slice(d)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof ir))return super.replace(e,n,r);[e,n]=cd(this,e,n);let s=Xp(this.text,Xp(r.text,JO(this.text,0,e)),n),i=this.length+r.length-(n-e);return s.length<=32?new ir(s,i):Gp.from(ir.split(s,[]),i)}sliceString(e,n=this.length,r=` +`){[e,n]=cd(this,e,n);let s="";for(let i=0,l=0;i<=n&&le&&l&&(s+=r),ei&&(s+=c.slice(Math.max(0,e-i),n-i)),i=d+1}return s}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],s=-1;for(let i of e)r.push(i),s+=i.length+1,r.length==32&&(n.push(new ir(r,s)),r=[],s=-1);return s>-1&&n.push(new ir(r,s)),n}}let Gp=class Du extends Xt{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,s){for(let i=0;;i++){let l=this.children[i],c=s+l.length,d=r+l.lines-1;if((n?d:c)>=e)return l.lineInner(e,n,r,s);s=c+1,r=d+1}}decompose(e,n,r,s){for(let i=0,l=0;l<=n&&i=l){let h=s&((l<=e?1:0)|(d>=n?2:0));l>=e&&d<=n&&!h?r.push(c):c.decompose(e-l,n-l,r,h)}l=d+1}}replace(e,n,r){if([e,n]=cd(this,e,n),r.lines=i&&n<=c){let d=l.replace(e-i,n-i,r),h=this.lines-l.lines+d.lines;if(d.lines>4&&d.lines>h>>6){let m=this.children.slice();return m[s]=d,new Du(m,this.length-(n-e)+r.length)}return super.replace(i,c,d)}i=c+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` +`){[e,n]=cd(this,e,n);let s="";for(let i=0,l=0;ie&&i&&(s+=r),el&&(s+=c.sliceString(e-l,n-l,r)),l=d+1}return s}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Du))return 0;let r=0,[s,i,l,c]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=n,i+=n){if(s==l||i==c)return r;let d=this.children[s],h=e.children[i];if(d!=h)return r+d.scanIdentical(h,n);r+=d.length+1}}static from(e,n=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let v of e)r+=v.lines;if(r<32){let v=[];for(let b of e)b.flatten(v);return new ir(v,n)}let s=Math.max(32,r>>5),i=s<<1,l=s>>1,c=[],d=0,h=-1,m=[];function p(v){let b;if(v.lines>i&&v instanceof Du)for(let k of v.children)p(k);else v.lines>l&&(d>l||!d)?(x(),c.push(v)):v instanceof ir&&d&&(b=m[m.length-1])instanceof ir&&v.lines+b.lines<=32?(d+=v.lines,h+=v.length+1,m[m.length-1]=new ir(b.text.concat(v.text),b.length+1+v.length)):(d+v.lines>s&&x(),d+=v.lines,h+=v.length+1,m.push(v))}function x(){d!=0&&(c.push(m.length==1?m[0]:Du.from(m,h)),h=-1,d=m.length=0)}for(let v of e)p(v);return x(),c.length==1?c[0]:new Du(c,n)}};Xt.empty=new ir([""],0);function $U(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Xp(t,e,n=0,r=1e9){for(let s=0,i=0,l=!0;i=n&&(d>r&&(c=c.slice(0,r-s)),s0?1:(e instanceof ir?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],i=this.offsets[r],l=i>>1,c=s instanceof ir?s.text.length:s.children.length;if(l==(n>0?c:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(s instanceof ir){let d=s.text[l+(n<0?-1:0)];if(this.offsets[r]+=n,d.length>Math.max(0,e))return this.value=e==0?d:n>0?d.slice(e):d.slice(0,d.length-e),this;e-=d.length}else{let d=s.children[l+(n<0?-1:0)];e>d.length?(e-=d.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(d),this.offsets.push(n>0?1:(d instanceof ir?d.text.length:d.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class SA{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new Zh(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*n,this.value=s.length<=r?s:n<0?s.slice(s.length-r):s.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class kA{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:s}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Xt.prototype[Symbol.iterator]=function(){return this.iter()},Zh.prototype[Symbol.iterator]=SA.prototype[Symbol.iterator]=kA.prototype[Symbol.iterator]=function(){return this});class HU{constructor(e,n,r,s){this.from=e,this.to=n,this.number=r,this.text=s}get length(){return this.to-this.from}}function cd(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function Vr(t,e,n=!0,r=!0){return FU(t,e,n,r)}function UU(t){return t>=56320&&t<57344}function VU(t){return t>=55296&&t<56320}function As(t,e){let n=t.charCodeAt(e);if(!VU(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return UU(r)?(n-55296<<10)+(r-56320)+65536:n}function yw(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function oa(t){return t<65536?1:2}const m2=/\r\n?|\n/;var Ur=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(Ur||(Ur={}));class va{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return i+(e-s);i+=c}else{if(r!=Ur.Simple&&h>=e&&(r==Ur.TrackDel&&se||r==Ur.TrackBefore&&se))return null;if(h>e||h==e&&n<0&&!c)return e==s||n<0?i:i+d;i+=d}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return i}touchesRange(e,n=e){for(let r=0,s=0;r=0&&s<=n&&c>=e)return sn?"cover":!0;s=c}return!1}toString(){let e="";for(let n=0;n=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new va(e)}static create(e){return new va(e)}}class kr extends va{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return p2(this,(n,r,s,i,l)=>e=e.replace(s,s+(r-n),l),!1),e}mapDesc(e,n=!1){return g2(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let s=0,i=0;s=0){n[s]=c,n[s+1]=l;let d=s>>1;for(;r.length0&&ro(r,n,i.text),i.forward(m),c+=m}let h=e[l++];for(;c>1].toJSON()))}return e}static of(e,n,r){let s=[],i=[],l=0,c=null;function d(m=!1){if(!m&&!s.length)return;lx||p<0||x>n)throw new RangeError(`Invalid change range ${p} to ${x} (in doc of length ${n})`);let b=v?typeof v=="string"?Xt.of(v.split(r||m2)):v:Xt.empty,k=b.length;if(p==x&&k==0)return;pl&&Jr(s,p-l,-1),Jr(s,x-p,k),ro(i,s,b),l=x}}return h(e),d(!c),c}static empty(e){return new kr(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let s=0;sc&&typeof l!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length=0&&n<=0&&n==t[s+1]?t[s]+=e:s>=0&&e==0&&t[s]==0?t[s+1]+=n:r?(t[s]+=e,t[s+1]+=n):t.push(e,n)}function ro(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r>1])),!(n||l==t.sections.length||t.sections[l+1]<0);)c=t.sections[l++],d=t.sections[l++];e(s,h,i,m,p),s=h,i=m}}}function g2(t,e,n,r=!1){let s=[],i=r?[]:null,l=new pf(t),c=new pf(e);for(let d=-1;;){if(l.done&&c.len||c.done&&l.len)throw new Error("Mismatched change set lengths");if(l.ins==-1&&c.ins==-1){let h=Math.min(l.len,c.len);Jr(s,h,-1),l.forward(h),c.forward(h)}else if(c.ins>=0&&(l.ins<0||d==l.i||l.off==0&&(c.len=0&&d=0){let h=0,m=l.len;for(;m;)if(c.ins==-1){let p=Math.min(m,c.len);h+=p,m-=p,c.forward(p)}else if(c.ins==0&&c.lend||l.ins>=0&&l.len>d)&&(c||r.length>h),i.forward2(d),l.forward(d)}}}}class pf{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?Xt.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?Xt.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class lc{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,s;return this.empty?r=s=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new lc(r,s,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return Ce.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return Ce.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Ce.range(e.anchor,e.head)}static create(e,n,r){return new lc(e,n,r)}}class Ce{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:Ce.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Ce(e.ranges.map(n=>lc.fromJSON(n)),e.main)}static single(e,n=e){return new Ce([Ce.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;se?8:0)|i)}static normalized(e,n=0){let r=e[n];e.sort((s,i)=>s.from-i.from),n=e.indexOf(r);for(let s=1;si.head?Ce.range(d,c):Ce.range(c,d))}}return new Ce(e,n)}}function jA(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let bw=0;class He{constructor(e,n,r,s,i){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=bw++,this.default=e([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(e={}){return new He(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:ww),!!e.static,e.enables)}of(e){return new Yp([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yp(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yp(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function ww(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Yp{constructor(e,n,r,s){this.dependencies=e,this.facet=n,this.type=r,this.value=s,this.id=bw++}dynamicSlot(e){var n;let r=this.value,s=this.facet.compareInput,i=this.id,l=e[i]>>1,c=this.type==2,d=!1,h=!1,m=[];for(let p of this.dependencies)p=="doc"?d=!0:p=="selection"?h=!0:(((n=e[p.id])!==null&&n!==void 0?n:1)&1)==0&&m.push(e[p.id]);return{create(p){return p.values[l]=r(p),1},update(p,x){if(d&&x.docChanged||h&&(x.docChanged||x.selection)||x2(p,m)){let v=r(p);if(c?!ej(v,p.values[l],s):!s(v,p.values[l]))return p.values[l]=v,1}return 0},reconfigure:(p,x)=>{let v,b=x.config.address[i];if(b!=null){let k=kg(x,b);if(this.dependencies.every(O=>O instanceof He?x.facet(O)===p.facet(O):O instanceof Br?x.field(O,!1)==p.field(O,!1):!0)||(c?ej(v=r(p),k,s):s(v=r(p),k)))return p.values[l]=k,0}else v=r(p);return p.values[l]=v,1}}}}function ej(t,e,n){if(t.length!=e.length)return!1;for(let r=0;rt[d.id]),s=n.map(d=>d.type),i=r.filter(d=>!(d&1)),l=t[e.id]>>1;function c(d){let h=[];for(let m=0;mr===s),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Zm).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let i=r.values[n],l=this.updateF(i,s);return this.compareF(i,l)?0:(r.values[n]=l,1)},reconfigure:(r,s)=>{let i=r.facet(Zm),l=s.facet(Zm),c;return(c=i.find(d=>d.field==this))&&c!=l.find(d=>d.field==this)?(r.values[n]=c.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Zm.of({field:this,create:e})]}get extension(){return this}}const sc={lowest:4,low:3,default:2,high:1,highest:0};function _h(t){return e=>new NA(e,t)}const No={highest:_h(sc.highest),high:_h(sc.high),default:_h(sc.default),low:_h(sc.low),lowest:_h(sc.lowest)};class NA{constructor(e,n){this.inner=e,this.prec=n}}class wx{of(e){return new v2(this,e)}reconfigure(e){return wx.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class v2{constructor(e,n){this.compartment=e,this.inner=n}}class Sg{constructor(e,n,r,s,i,l){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=l,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,r){let s=[],i=Object.create(null),l=new Map;for(let x of GU(e,n,l))x instanceof Br?s.push(x):(i[x.facet.id]||(i[x.facet.id]=[])).push(x);let c=Object.create(null),d=[],h=[];for(let x of s)c[x.id]=h.length<<1,h.push(v=>x.slot(v));let m=r?.config.facets;for(let x in i){let v=i[x],b=v[0].facet,k=m&&m[x]||[];if(v.every(O=>O.type==0))if(c[b.id]=d.length<<1|1,ww(k,v))d.push(r.facet(b));else{let O=b.combine(v.map(j=>j.value));d.push(r&&b.compare(O,r.facet(b))?r.facet(b):O)}else{for(let O of v)O.type==0?(c[O.id]=d.length<<1|1,d.push(O.value)):(c[O.id]=h.length<<1,h.push(j=>O.dynamicSlot(j)));c[b.id]=h.length<<1,h.push(O=>WU(O,b,v))}}let p=h.map(x=>x(c));return new Sg(e,l,p,c,d,i)}}function GU(t,e,n){let r=[[],[],[],[],[]],s=new Map;function i(l,c){let d=s.get(l);if(d!=null){if(d<=c)return;let h=r[d].indexOf(l);h>-1&&r[d].splice(h,1),l instanceof v2&&n.delete(l.compartment)}if(s.set(l,c),Array.isArray(l))for(let h of l)i(h,c);else if(l instanceof v2){if(n.has(l.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(l.compartment)||l.inner;n.set(l.compartment,h),i(h,c)}else if(l instanceof NA)i(l.inner,l.prec);else if(l instanceof Br)r[c].push(l),l.provides&&i(l.provides,c);else if(l instanceof Yp)r[c].push(l),l.facet.extensions&&i(l.facet.extensions,sc.default);else{let h=l.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${l}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(h,c)}}return i(t,sc.default),r.reduce((l,c)=>l.concat(c))}function Jh(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let s=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|s}function kg(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const CA=He.define(),y2=He.define({combine:t=>t.some(e=>e),static:!0}),TA=He.define({combine:t=>t.length?t[0]:void 0,static:!0}),AA=He.define(),MA=He.define(),EA=He.define(),_A=He.define({combine:t=>t.length?t[0]:!1});class ka{constructor(e,n){this.type=e,this.value=n}static define(){return new XU}}class XU{of(e){return new ka(this,e)}}class YU{constructor(e){this.map=e}of(e){return new vt(this,e)}}class vt{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new vt(this.type,n)}is(e){return this.type==e}static define(e={}){return new YU(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let s of e){let i=s.map(n);i&&r.push(i)}return r}}vt.reconfigure=vt.define();vt.appendConfig=vt.define();class gr{constructor(e,n,r,s,i,l){this.startState=e,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=l,this._doc=null,this._state=null,r&&jA(r,n.newLength),i.some(c=>c.type==gr.time)||(this.annotations=i.concat(gr.time.of(Date.now())))}static create(e,n,r,s,i,l){return new gr(e,n,r,s,i,l)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(gr.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}gr.time=ka.define();gr.userEvent=ka.define();gr.addToHistory=ka.define();gr.remote=ka.define();function KU(t,e){let n=[];for(let r=0,s=0;;){let i,l;if(r=t[r]))i=t[r++],l=t[r++];else if(s=0;s--){let i=r[s](t);i instanceof gr?t=i:Array.isArray(i)&&i.length==1&&i[0]instanceof gr?t=i[0]:t=RA(e,Wu(i),!1)}return t}function JU(t){let e=t.startState,n=e.facet(EA),r=t;for(let s=n.length-1;s>=0;s--){let i=n[s](t);i&&Object.keys(i).length&&(r=DA(r,b2(e,i,t.changes.newLength),!0))}return r==t?t:gr.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const eV=[];function Wu(t){return t==null?eV:Array.isArray(t)?t:[t]}var Vn=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(Vn||(Vn={}));const tV=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let w2;try{w2=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function nV(t){if(w2)return w2.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||tV.test(n)))return!0}return!1}function rV(t){return e=>{if(!/\S/.test(e))return Vn.Space;if(nV(e))return Vn.Word;for(let n=0;n-1)return Vn.Word;return Vn.Other}}class Vt{constructor(e,n,r,s,i,l){this.config=e,this.doc=n,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=i,l&&(l._state=this);for(let c=0;cs.set(h,d)),n=null),s.set(c.value.compartment,c.value.extension)):c.is(vt.reconfigure)?(n=null,r=c.value):c.is(vt.appendConfig)&&(n=null,r=Wu(r).concat(c.value));let i;n?i=e.startState.values.slice():(n=Sg.resolve(r,s,this),i=new Vt(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(d,h)=>h.reconfigure(d,this),null).values);let l=e.startState.facet(y2)?e.newSelection:e.newSelection.asSingle();new Vt(n,e.newDoc,l,i,(c,d)=>d.update(c,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:Ce.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),s=this.changes(r.changes),i=[r.range],l=Wu(r.effects);for(let c=1;cl.spec.fromJSON(c,d)))}}return Vt.create({doc:e.doc,selection:Ce.fromJSON(e.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(e={}){let n=Sg.resolve(e.extensions||[],new Map),r=e.doc instanceof Xt?e.doc:Xt.of((e.doc||"").split(n.staticFacet(Vt.lineSeparator)||m2)),s=e.selection?e.selection instanceof Ce?e.selection:Ce.single(e.selection.anchor,e.selection.head):Ce.single(0);return jA(s,r.length),n.staticFacet(y2)||(s=s.asSingle()),new Vt(n,r,s,n.dynamicSlots.map(()=>null),(i,l)=>l.create(i),null)}get tabSize(){return this.facet(Vt.tabSize)}get lineBreak(){return this.facet(Vt.lineSeparator)||` +`}get readOnly(){return this.facet(_A)}phrase(e,...n){for(let r of this.facet(Vt.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let i=+(s||1);return!i||i>n.length?r:n[i-1]})),e}languageDataAt(e,n,r=-1){let s=[];for(let i of this.facet(CA))for(let l of i(this,n,r))Object.prototype.hasOwnProperty.call(l,e)&&s.push(l[e]);return s}charCategorizer(e){return rV(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:r,length:s}=this.doc.lineAt(e),i=this.charCategorizer(e),l=e-r,c=e-r;for(;l>0;){let d=Vr(n,l,!1);if(i(n.slice(d,l))!=Vn.Word)break;l=d}for(;ct.length?t[0]:4});Vt.lineSeparator=TA;Vt.readOnly=_A;Vt.phrases=He.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(s=>t[s]==e[s])}});Vt.languageData=CA;Vt.changeFilter=AA;Vt.transactionFilter=MA;Vt.transactionExtender=EA;wx.reconfigure=vt.define();function Oa(t,e,n={}){let r={};for(let s of t)for(let i of Object.keys(s)){let l=s[i],c=r[i];if(c===void 0)r[i]=l;else if(!(c===l||l===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](c,l);else throw new Error("Config merge conflict for field "+i)}for(let s in e)r[s]===void 0&&(r[s]=e[s]);return r}class yc{eq(e){return this==e}range(e,n=e){return S2.create(e,n,this)}}yc.prototype.startSide=yc.prototype.endSide=0;yc.prototype.point=!1;yc.prototype.mapMode=Ur.TrackDel;let S2=class zA{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new zA(e,n,r)}};function k2(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Sw{constructor(e,n,r,s){this.from=e,this.to=n,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,s=0){let i=r?this.to:this.from;for(let l=s,c=i.length;;){if(l==c)return l;let d=l+c>>1,h=i[d]-e||(r?this.value[d].endSide:this.value[d].startSide)-n;if(d==l)return h>=0?l:c;h>=0?c=d:l=d+1}}between(e,n,r,s){for(let i=this.findIndex(n,-1e9,!0),l=this.findIndex(r,1e9,!1,i);iv||x==v&&h.startSide>0&&h.endSide<=0)continue;(v-x||h.endSide-h.startSide)<0||(l<0&&(l=x),h.point&&(c=Math.max(c,v-x)),r.push(h),s.push(x-l),i.push(v-l))}return{mapped:r.length?new Sw(s,i,r,c):null,pos:l}}}class Yt{constructor(e,n,r,s){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=s}static create(e,n,r,s){return new Yt(e,n,r,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:s=0,filterTo:i=this.length}=e,l=e.filter;if(n.length==0&&!l)return this;if(r&&(n=n.slice().sort(k2)),this.isEmpty)return n.length?Yt.of(n):this;let c=new PA(this,null,-1).goto(0),d=0,h=[],m=new ml;for(;c.value||d=0){let p=n[d++];m.addInner(p.from,p.to,p.value)||h.push(p)}else c.rangeIndex==1&&c.chunkIndexthis.chunkEnd(c.chunkIndex)||ic.to||i=i&&e<=i+l.length&&l.between(i,e-i,n-i,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return gf.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return gf.from(e).goto(n)}static compare(e,n,r,s,i=-1){let l=e.filter(p=>p.maxPoint>0||!p.isEmpty&&p.maxPoint>=i),c=n.filter(p=>p.maxPoint>0||!p.isEmpty&&p.maxPoint>=i),d=tj(l,c,r),h=new Dh(l,d,i),m=new Dh(c,d,i);r.iterGaps((p,x,v)=>nj(h,p,m,x,v,s)),r.empty&&r.length==0&&nj(h,0,m,0,0,s)}static eq(e,n,r=0,s){s==null&&(s=999999999);let i=e.filter(m=>!m.isEmpty&&n.indexOf(m)<0),l=n.filter(m=>!m.isEmpty&&e.indexOf(m)<0);if(i.length!=l.length)return!1;if(!i.length)return!0;let c=tj(i,l),d=new Dh(i,c,0).goto(r),h=new Dh(l,c,0).goto(r);for(;;){if(d.to!=h.to||!O2(d.active,h.active)||d.point&&(!h.point||!d.point.eq(h.point)))return!1;if(d.to>s)return!0;d.next(),h.next()}}static spans(e,n,r,s,i=-1){let l=new Dh(e,null,i).goto(n),c=n,d=l.openStart;for(;;){let h=Math.min(l.to,r);if(l.point){let m=l.activeForPoint(l.to),p=l.pointFromc&&(s.span(c,h,l.active,d),d=l.openEnd(h));if(l.to>r)return d+(l.point&&l.to>r?1:0);c=l.to,l.next()}}static of(e,n=!1){let r=new ml;for(let s of e instanceof S2?[e]:n?sV(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return Yt.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=Yt.empty;s=s.nextLayer)n=new Yt(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}Yt.empty=new Yt([],[],null,-1);function sV(t){if(t.length>1)for(let e=t[0],n=1;n0)return t.slice().sort(k2);e=r}return t}Yt.empty.nextLayer=Yt.empty;class ml{finishChunk(e){this.chunks.push(new Sw(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new ml)).add(e,n,r)}addInner(e,n,r){let s=e-this.lastTo||r.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(Yt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=Yt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function tj(t,e,n){let r=new Map;for(let i of t)for(let l=0;l=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&s.push(new PA(l,n,r,i));return s.length==1?s[0]:new gf(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)Ty(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)Ty(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Ty(this.heap,0)}}}function Ty(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let s=t[r];if(r+1=0&&(s=t[r+1],r++),n.compare(s)<0)break;t[r]=n,t[e]=s,e=r}}class Dh{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=gf.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){Jm(this.active,e),Jm(this.activeTo,e),Jm(this.activeRank,e),this.minActive=rj(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:s,rank:i}=this.cursor;for(;n0;)n++;ep(this.active,n,r),ep(this.activeTo,n,s),ep(this.activeRank,n,i),e&&ep(e,n,this.cursor.from),this.minActive=rj(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&Jm(r,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&r[s]=0&&!(this.activeRank[r]e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function nj(t,e,n,r,s,i){t.goto(e),n.goto(r);let l=r+s,c=r,d=r-e;for(;;){let h=t.to+d-n.to,m=h||t.endSide-n.endSide,p=m<0?t.to+d:n.to,x=Math.min(p,l);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&O2(t.activeForPoint(t.to),n.activeForPoint(n.to))||i.comparePoint(c,x,t.point,n.point):x>c&&!O2(t.active,n.active)&&i.compareRange(c,x,t.active,n.active),p>l)break;(h||t.openEnd!=n.openEnd)&&i.boundChange&&i.boundChange(p),c=p,m<=0&&t.next(),m>=0&&n.next()}}function O2(t,e){if(t.length!=e.length)return!1;for(let n=0;n=e;r--)t[r+1]=t[r];t[e]=n}function rj(t,e){let n=-1,r=1e9;for(let s=0;s=e)return s;if(s==t.length)break;i+=t.charCodeAt(s)==9?n-i%n:1,s=Vr(t,s)}return r===!0?-1:t.length}const N2="ͼ",sj=typeof Symbol>"u"?"__"+N2:Symbol.for(N2),C2=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),ij=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class fo{constructor(e,n){this.rules=[];let{finish:r}=n||{};function s(l){return/^@/.test(l)?[l]:l.split(/,\s*/)}function i(l,c,d,h){let m=[],p=/^@(\w+)\b/.exec(l[0]),x=p&&p[1]=="keyframes";if(p&&c==null)return d.push(l[0]+";");for(let v in c){let b=c[v];if(/&/.test(v))i(v.split(/,\s*/).map(k=>l.map(O=>k.replace(/&/,O))).reduce((k,O)=>k.concat(O)),b,d);else if(b&&typeof b=="object"){if(!p)throw new RangeError("The value of a property ("+v+") should be a primitive value.");i(s(v),b,m,x)}else b!=null&&m.push(v.replace(/_.*/,"").replace(/[A-Z]/g,k=>"-"+k.toLowerCase())+": "+b+";")}(m.length||x)&&d.push((r&&!p&&!h?l.map(r):l).join(", ")+" {"+m.join(" ")+"}")}for(let l in e)i(s(l),e[l],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=ij[sj]||1;return ij[sj]=e+1,N2+e.toString(36)}static mount(e,n,r){let s=e[C2],i=r&&r.nonce;s?i&&s.setNonce(i):s=new iV(e,i),s.mount(Array.isArray(n)?n:[n],e)}}let aj=new Map;class iV{constructor(e,n){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let i=aj.get(r);if(i)return e[C2]=i;this.sheet=new s.CSSStyleSheet,aj.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[C2]=this}mount(e,n){let r=this.sheet,s=0,i=0;for(let l=0;l-1&&(this.modules.splice(d,1),i--,d=-1),d==-1){if(this.modules.splice(i++,0,c),r)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},aV=typeof navigator<"u"&&/Mac/.test(navigator.platform),lV=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Hr=0;Hr<10;Hr++)mo[48+Hr]=mo[96+Hr]=String(Hr);for(var Hr=1;Hr<=24;Hr++)mo[Hr+111]="F"+Hr;for(var Hr=65;Hr<=90;Hr++)mo[Hr]=String.fromCharCode(Hr+32),xf[Hr]=String.fromCharCode(Hr);for(var Ay in mo)xf.hasOwnProperty(Ay)||(xf[Ay]=mo[Ay]);function oV(t){var e=aV&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||lV&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?xf:mo)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function Mn(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var s=n[r];typeof s=="string"?t.setAttribute(r,s):s!=null&&(t[r]=s)}e++}for(;e2);var Fe={mac:oj||/Mac/.test(us.platform),windows:/Win/.test(us.platform),linux:/Linux|X11/.test(us.platform),ie:Sx,ie_version:LA?T2.documentMode||6:M2?+M2[1]:A2?+A2[1]:0,gecko:lj,gecko_version:lj?+(/Firefox\/(\d+)/.exec(us.userAgent)||[0,0])[1]:0,chrome:!!My,chrome_version:My?+My[1]:0,ios:oj,android:/Android\b/.test(us.userAgent),webkit_version:cV?+(/\bAppleWebKit\/(\d+)/.exec(us.userAgent)||[0,0])[1]:0,safari:E2,safari_version:E2?+(/\bVersion\/(\d+(\.\d+)?)/.exec(us.userAgent)||[0,0])[1]:0,tabSize:T2.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function vf(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function _2(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Kp(t,e){if(!e.anchorNode)return!1;try{return _2(t,e.anchorNode)}catch{return!1}}function ud(t){return t.nodeType==3?wc(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function ef(t,e,n,r){return n?cj(t,e,n,r,-1)||cj(t,e,n,r,1):!1}function bc(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Og(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function cj(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:ba(t))){if(t.nodeName=="DIV")return!1;let i=t.parentNode;if(!i||i.nodeType!=1)return!1;e=bc(t)+(s<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=s<0?ba(t):0}else return!1}}function ba(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function s0(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function uV(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function IA(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function dV(t,e,n,r,s,i,l,c){let d=t.ownerDocument,h=d.defaultView||window;for(let m=t,p=!1;m&&!p;)if(m.nodeType==1){let x,v=m==d.body,b=1,k=1;if(v)x=uV(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(m).position)&&(p=!0),m.scrollHeight<=m.clientHeight&&m.scrollWidth<=m.clientWidth){m=m.assignedSlot||m.parentNode;continue}let T=m.getBoundingClientRect();({scaleX:b,scaleY:k}=IA(m,T)),x={left:T.left,right:T.left+m.clientWidth*b,top:T.top,bottom:T.top+m.clientHeight*k}}let O=0,j=0;if(s=="nearest")e.top0&&e.bottom>x.bottom+j&&(j=e.bottom-x.bottom+l)):e.bottom>x.bottom&&(j=e.bottom-x.bottom+l,n<0&&e.top-j0&&e.right>x.right+O&&(O=e.right-x.right+i)):e.right>x.right&&(O=e.right-x.right+i,n<0&&e.leftx.bottom||e.leftx.right)&&(e={left:Math.max(e.left,x.left),right:Math.min(e.right,x.right),top:Math.max(e.top,x.top),bottom:Math.min(e.bottom,x.bottom)}),m=m.assignedSlot||m.parentNode}else if(m.nodeType==11)m=m.host;else break}function hV(t){let e=t.ownerDocument,n,r;for(let s=t.parentNode;s&&!(s==e.body||n&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),!n&&s.scrollWidth>s.clientWidth&&(n=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:n,y:r}}class fV{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?ba(n):0),r,Math.min(e.focusOffset,r?ba(r):0))}set(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let nc=null;Fe.safari&&Fe.safari_version>=26&&(nc=!1);function qA(t){if(t.setActive)return t.setActive();if(nc)return t.focus(nc);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(nc==null?{get preventScroll(){return nc={preventScroll:!0},!0}}:void 0),!nc){nc=!1;for(let n=0;nMath.max(1,t.scrollHeight-t.clientHeight-4)}function $A(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=ba(n)}else if(n.parentNode&&!Og(n))r=bc(n),n=n.parentNode;else return null}}function HA(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&rn)return p.domBoundsAround(e,n,h);if(x>=e&&s==-1&&(s=d,i=h),h>n&&p.dom.parentNode==this.dom){l=d,c=m;break}m=x,h=x+p.breakAfter}return{from:i,to:c<0?r+this.length:c,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:l=0?this.children[l].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,r=kw){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}}function VA(t,e,n,r,s,i,l,c,d){let{children:h}=t,m=h.length?h[e]:null,p=i.length?i[i.length-1]:null,x=p?p.breakAfter:l;if(!(e==r&&m&&!l&&!x&&i.length<2&&m.merge(n,s,i.length?p:null,n==0,c,d))){if(r0&&(!l&&i.length&&m.merge(n,m.length,i[0],!1,c,0)?m.breakAfter=i.shift().breakAfter:(ngV||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new Hi(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new ns(this.dom,e)}domBoundsAround(e,n,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return xV(this.dom,e,n)}}class pl extends jn{constructor(e,n=[],r=0){super(),this.mark=e,this.children=n,this.length=r;for(let s of n)s.setParent(this)}setAttrs(e){if(FA(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,r,s,i,l){return r&&(!(r instanceof pl&&r.mark.eq(this.mark))||e&&i<=0||ne&&n.push(r=e&&(s=i),r=d,i++}let l=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new pl(this.mark,n,l)}domAtPos(e){return GA(this,e)}coordsAt(e,n){return YA(this,e,n)}}function xV(t,e,n){let r=t.nodeValue.length;e>r&&(e=r);let s=e,i=e,l=0;e==0&&n<0||e==r&&n>=0?Fe.chrome||Fe.gecko||(e?(s--,l=1):i=0)?0:c.length-1];return Fe.safari&&!l&&d.width==0&&(d=Array.prototype.find.call(c,h=>h.width)||d),l?s0(d,l<0):d||null}class al extends jn{static create(e,n,r){return new al(e,n,r)}constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}split(e){let n=al.create(this.widget,this.length-e,this.side);return this.length-=e,n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,n,r,s,i,l){return r&&(!(r instanceof al)||!this.widget.compare(r.widget)||e>0&&i<=0||n0)?ns.before(this.dom):ns.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);if(r)return r;let s=this.dom.getClientRects(),i=null;if(!s.length)return null;let l=this.side?this.side<0:e>0;for(let c=l?s.length-1:0;i=s[c],!(e>0?c==0:c==s.length-1||i.top0?ns.before(this.dom):ns.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Xt.empty}get isHidden(){return!0}}Hi.prototype.children=al.prototype.children=dd.prototype.children=kw;function GA(t,e){let n=t.dom,{children:r}=t,s=0;for(let i=0;si&&e0;i--){let l=r[i-1];if(l.dom.parentNode==n)return l.domAtPos(l.length)}for(let i=s;i0&&e instanceof pl&&s.length&&(r=s[s.length-1])instanceof pl&&r.mark.eq(e.mark)?XA(r,e.children[0],n-1):(s.push(e),e.setParent(t)),t.length+=e.length}function YA(t,e,n){let r=null,s=-1,i=null,l=-1;function c(h,m){for(let p=0,x=0;p=m&&(v.children.length?c(v,m-x):(!i||i.isHidden&&(n>0||yV(i,v)))&&(b>m||x==b&&v.getSide()>0)?(i=v,l=m-x):(x-1?1:0)!=s.length-(n&&s.indexOf(n)>-1?1:0))return!1;for(let i of r)if(i!=n&&(s.indexOf(i)==-1||t[i]!==e[i]))return!1;return!0}function R2(t,e,n){let r=!1;if(e)for(let s in e)n&&s in n||(r=!0,s=="style"?t.style.cssText="":t.removeAttribute(s));if(n)for(let s in n)e&&e[s]==n[s]||(r=!0,s=="style"?t.style.cssText=n[s]:t.setAttribute(s,n[s]));return r}function bV(t){let e=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new po(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,s;if(e.isBlockGap)r=-5e8,s=4e8;else{let{start:i,end:l}=KA(e,n);r=(i?n?-3e8:-1:5e8)-1,s=(l?n?2e8:1:-6e8)+1}return new po(e,r,s,n,e.widget||null,!0)}static line(e){return new a0(e)}static set(e,n=!1){return Yt.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Je.none=Yt.empty;class i0 extends Je{constructor(e){let{start:n,end:r}=KA(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var n,r;return this==e||e instanceof i0&&this.tagName==e.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&jg(this.attrs,e.attrs,"class")}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}i0.prototype.point=!1;class a0 extends Je{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof a0&&this.spec.class==e.spec.class&&jg(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}a0.prototype.mapMode=Ur.TrackBefore;a0.prototype.point=!0;class po extends Je{constructor(e,n,r,s,i,l){super(n,r,i,e),this.block=s,this.isReplace=l,this.mapMode=s?n<=0?Ur.TrackBefore:Ur.TrackAfter:Ur.TrackDel}get type(){return this.startSide!=this.endSide?fs.WidgetRange:this.startSide<=0?fs.WidgetBefore:fs.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof po&&wV(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}po.prototype.point=!0;function KA(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function wV(t,e){return t==e||!!(t&&e&&t.compare(e))}function Zp(t,e,n,r=0){let s=n.length-1;s>=0&&n[s]+r>=t?n[s]=Math.max(n[s],e):n.push(t,e)}class pr extends jn{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,r,s,i,l){if(r){if(!(r instanceof pr))return!1;this.dom||r.transferDOM(this)}return s&&this.setDeco(r?r.attrs:null),WA(this,e,n,r?r.children.slice():[],i,l),!0}split(e){let n=new pr;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i:r,off:s}=this.childPos(e);s&&(n.append(this.children[r].split(s),0),this.children[r].merge(s,this.children[r].length,null,!1,0,0),r++);for(let i=r;i0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,n}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){jg(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){XA(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=D2(n,this.attrs||{})),r&&(this.attrs=D2({class:r},this.attrs||{}))}domAtPos(e){return GA(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(FA(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(R2(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,n);let s=this.dom.lastChild;for(;s&&jn.get(s)instanceof pl;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((r=jn.get(s))===null||r===void 0?void 0:r.isEditable)==!1&&(!Fe.ios||!this.children.some(i=>i instanceof Hi))){let i=document.createElement("BR");i.cmIgnore=!0,this.dom.appendChild(i)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,n;for(let r of this.children){if(!(r instanceof Hi)||/[^ -~]/.test(r.text))return null;let s=ud(r.dom);if(s.length!=1)return null;e+=s[0].width,n=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:n}:null}coordsAt(e,n){let r=YA(this,e,n);if(!this.children.length&&r&&this.parent){let{heightOracle:s}=this.parent.view.viewState,i=r.bottom-r.top;if(Math.abs(i-s.lineHeight)<2&&s.textHeight=n){if(i instanceof pr)return i;if(l>n)break}s=l+i.breakAfter}return null}}class cl extends jn{constructor(e,n,r){super(),this.widget=e,this.length=n,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,n,r,s,i,l){return r&&(!(r instanceof cl)||!this.widget.compare(r.widget)||e>0&&i<=0||n0}}class z2 extends ja{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class tf{constructor(e,n,r,s){this.doc=e,this.pos=n,this.end=r,this.disallowBlockEffectsFor=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=n}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof cl&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new pr),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(tp(new dd(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof cl)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:l,lineBreak:c,done:d}=this.cursor.next(this.skip);if(this.skip=0,d)throw new Error("Ran out of text content when drawing inline views");if(c){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=l,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e),i=Math.min(s,512);this.flushBuffer(n.slice(n.length-r)),this.getLine().append(tp(new Hi(this.text.slice(this.textOff,this.textOff+i)),n),r),this.atCursorPos=!0,this.textOff+=i,e-=i,r=s<=i?0:n.length}}span(e,n,r,s){this.buildText(n-e,r,s),this.pos=n,this.openStart<0&&(this.openStart=s)}point(e,n,r,s,i,l){if(this.disallowBlockEffectsFor[l]&&r instanceof po){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let c=n-e;if(r instanceof po)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new cl(r.widget||hd.block,c,r));else{let d=al.create(r.widget||hd.inline,c,c?0:r.startSide),h=this.atCursorPos&&!d.isEditable&&i<=s.length&&(e0),m=!d.isEditable&&(es.length||r.startSide<=0),p=this.getLine();this.pendingBuffer==2&&!h&&!d.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),h&&(p.append(tp(new dd(1),s),i),i=s.length+Math.max(0,i-s.length)),p.append(tp(d,s),i),this.atCursorPos=m,this.pendingBuffer=m?es.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);c&&(this.textOff+c<=this.text.length?this.textOff+=c:(this.skip+=c-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=i)}static build(e,n,r,s,i){let l=new tf(e,n,r,i);return l.openEnd=Yt.spans(s,n,r,l),l.openStart<0&&(l.openStart=l.openEnd),l.finish(l.openEnd),l}}function tp(t,e){for(let n of e)t=new pl(n,[t],t.length);return t}class hd extends ja{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}hd.inline=new hd("span");hd.block=new hd("div");var Hn=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(Hn||(Hn={}));const Sc=Hn.LTR,Ow=Hn.RTL;function ZA(t){let e=[];for(let n=0;n=n){if(c.level==r)return l;(i<0||(s!=0?s<0?c.fromn:e[i].level>c.level))&&(i=l)}}if(i<0)throw new RangeError("Index out of range");return i}}function eM(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;k-=3)if(ta[k+1]==-v){let O=ta[k+2],j=O&2?s:O&4?O&1?i:s:0;j&&(En[p]=En[ta[k]]=j),c=k;break}}else{if(ta.length==189)break;ta[c++]=p,ta[c++]=x,ta[c++]=d}else if((b=En[p])==2||b==1){let k=b==s;d=k?0:1;for(let O=c-3;O>=0;O-=3){let j=ta[O+2];if(j&2)break;if(k)ta[O+2]|=2;else{if(j&4)break;ta[O+2]|=4}}}}}function CV(t,e,n,r){for(let s=0,i=r;s<=n.length;s++){let l=s?n[s-1].to:t,c=sd;)b==O&&(b=n[--k].from,O=k?n[k-1].to:t),En[--b]=v;d=m}else i=h,d++}}}function B2(t,e,n,r,s,i,l){let c=r%2?2:1;if(r%2==s%2)for(let d=e,h=0;dd&&l.push(new so(d,k.from,v));let O=k.direction==Sc!=!(v%2);L2(t,O?r+1:r,s,k.inner,k.from,k.to,l),d=k.to}b=k.to}else{if(b==n||(m?En[b]!=c:En[b]==c))break;b++}x?B2(t,d,b,r+1,s,x,l):de;){let m=!0,p=!1;if(!h||d>i[h-1].to){let k=En[d-1];k!=c&&(m=!1,p=k==16)}let x=!m&&c==1?[]:null,v=m?r:r+1,b=d;e:for(;;)if(h&&b==i[h-1].to){if(p)break e;let k=i[--h];if(!m)for(let O=k.from,j=h;;){if(O==e)break e;if(j&&i[j-1].to==O)O=i[--j].from;else{if(En[O-1]==c)break e;break}}if(x)x.push(k);else{k.toEn.length;)En[En.length]=256;let r=[],s=e==Sc?0:1;return L2(t,s,s,n,0,t.length,r),r}function tM(t){return[new so(0,t,0)]}let nM="";function AV(t,e,n,r,s){var i;let l=r.head-t.from,c=so.find(e,l,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),d=e[c],h=d.side(s,n);if(l==h){let x=c+=s?1:-1;if(x<0||x>=e.length)return null;d=e[c=x],l=d.side(!s,n),h=d.side(s,n)}let m=Vr(t.text,l,d.forward(s,n));(md.to)&&(m=h),nM=t.text.slice(Math.min(l,m),Math.max(l,m));let p=c==(s?e.length-1:0)?null:e[c+(s?1:-1)];return p&&m==h&&p.level+(s?0:1)t.some(e=>e)}),uM=He.define({combine:t=>t.some(e=>e)}),dM=He.define();class Xu{constructor(e,n="nearest",r="nearest",s=5,i=5,l=!1){this.range=e,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=l}map(e){return e.empty?this:new Xu(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Xu(Ce.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const np=vt.define({map:(t,e)=>t.map(e)}),hM=vt.define();function _s(t,e,n){let r=t.facet(aM);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const il=He.define({combine:t=>t.length?t[0]:!0});let EV=0;const Fu=He.define({combine(t){return t.filter((e,n)=>{for(let r=0;r{let d=[];return l&&d.push(yf.of(h=>{let m=h.plugin(c);return m?l(m):Je.none})),i&&d.push(i(c)),d})}static fromClass(e,n){return lr.define((r,s)=>new e(r,s),n)}}class Ey{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(_s(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(n){_s(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){_s(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const fM=He.define(),Cw=He.define(),yf=He.define(),mM=He.define(),l0=He.define(),pM=He.define();function fj(t,e){let n=t.state.facet(pM);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(t):i),s=[];return Yt.spans(r,e.from,e.to,{point(){},span(i,l,c,d){let h=i-e.from,m=l-e.from,p=s;for(let x=c.length-1;x>=0;x--,d--){let v=c[x].spec.bidiIsolate,b;if(v==null&&(v=MV(e.text,h,m)),d>0&&p.length&&(b=p[p.length-1]).to==h&&b.direction==v)b.to=m,p=b.inner;else{let k={from:h,to:m,direction:v,inner:[]};p.push(k),p=k.inner}}}}),s}const gM=He.define();function Tw(t){let e=0,n=0,r=0,s=0;for(let i of t.state.facet(gM)){let l=i(t);l&&(l.left!=null&&(e=Math.max(e,l.left)),l.right!=null&&(n=Math.max(n,l.right)),l.top!=null&&(r=Math.max(r,l.top)),l.bottom!=null&&(s=Math.max(s,l.bottom)))}return{left:e,right:n,top:r,bottom:s}}const Qh=He.define();class Ni{constructor(e,n,r,s){this.fromA=e,this.toA=n,this.fromB=r,this.toB=s}join(e){return new Ni(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let s=e[n-1];if(!(s.fromA>r.toA)){if(s.toAm)break;i+=2}if(!d)return r;new Ni(d.fromA,d.toA,d.fromB,d.toB).addToSet(r),l=d.toA,c=d.toB}}}class Ng{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=kr.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,l,c,d)=>s.push(new Ni(i,l,c,d))),this.changedRanges=s}static create(e,n,r){return new Ng(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class mj extends jn{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=Je.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new pr],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Ni(0,0,0,e.state.doc.length)],0,null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:h,toA:m})=>mthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?s=this.domChanged.newSel.head:!LV(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let i=s>-1?DV(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:m}=this.hasComposition;r=new Ni(h,m,e.changes.mapPos(h,-1),e.changes.mapPos(m,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(Fe.ie||Fe.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let l=this.decorations,c=this.updateDeco(),d=PV(l,c,e.changes);return r=Ni.extendWithRanges(r,d),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,r);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let l=Fe.chrome||Fe.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,l),this.flags&=-8,l&&(l.written||s.selectionRange.focusNode!=l.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(l=>l.flags&=-9);let i=[];if(this.view.viewport.from||this.view.viewport.to=0?s[l]:null;if(!c)break;let{fromA:d,toA:h,fromB:m,toB:p}=c,x,v,b,k;if(r&&r.range.fromBm){let _=tf.build(this.view.state.doc,m,r.range.fromB,this.decorations,this.dynamicDecorationMap),D=tf.build(this.view.state.doc,r.range.toB,p,this.decorations,this.dynamicDecorationMap);v=_.breakAtStart,b=_.openStart,k=D.openEnd;let E=this.compositionView(r);D.breakAtStart?E.breakAfter=1:D.content.length&&E.merge(E.length,E.length,D.content[0],!1,D.openStart,0)&&(E.breakAfter=D.content[0].breakAfter,D.content.shift()),_.content.length&&E.merge(0,0,_.content[_.content.length-1],!0,0,_.openEnd)&&_.content.pop(),x=_.content.concat(E).concat(D.content)}else({content:x,breakAtStart:v,openStart:b,openEnd:k}=tf.build(this.view.state.doc,m,p,this.decorations,this.dynamicDecorationMap));let{i:O,off:j}=i.findPos(h,1),{i:T,off:A}=i.findPos(d,-1);VA(this,T,A,O,j,x,v,b,k)}r&&this.fixCompositionDOM(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(hM)&&(this.editContextFormatting=r.value)}compositionView(e){let n=new Hi(e.text.nodeValue);n.flags|=8;for(let{deco:s}of e.marks)n=new pl(s,[n],n.length);let r=new pr;return r.append(n,0),r}fixCompositionDOM(e){let n=(i,l)=>{l.flags|=8|(l.children.some(d=>d.flags&7)?1:0),this.markedForComposition.add(l);let c=jn.get(i);c&&c!=l&&(c.dom=null),l.setDOM(i)},r=this.childPos(e.range.fromB,1),s=this.children[r.i];n(e.line,s);for(let i=e.marks.length-1;i>=-1;i--)r=s.childPos(r.off,1),s=s.children[r.i],n(i>=0?e.marks[i].node:e.text,s)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,s=r==this.dom,i=!s&&!(this.view.state.facet(il)||this.dom.tabIndex>-1)&&Kp(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(s||n||i))return;let l=this.forceSelection;this.forceSelection=!1;let c=this.view.state.selection.main,d=this.moveToLine(this.domAtPos(c.anchor)),h=c.empty?d:this.moveToLine(this.domAtPos(c.head));if(Fe.gecko&&c.empty&&!this.hasComposition&&_V(d)){let p=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(p,d.node.childNodes[d.offset]||null)),d=h=new ns(p,0),l=!0}let m=this.view.observer.selectionRange;(l||!m.focusNode||(!ef(d.node,d.offset,m.anchorNode,m.anchorOffset)||!ef(h.node,h.offset,m.focusNode,m.focusOffset))&&!this.suppressWidgetCursorChange(m,c))&&(this.view.observer.ignore(()=>{Fe.android&&Fe.chrome&&this.dom.contains(m.focusNode)&&BV(m.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let p=vf(this.view.root);if(p)if(c.empty){if(Fe.gecko){let x=RV(d.node,d.offset);if(x&&x!=3){let v=(x==1?$A:HA)(d.node,d.offset);v&&(d=new ns(v.node,v.offset))}}p.collapse(d.node,d.offset),c.bidiLevel!=null&&p.caretBidiLevel!==void 0&&(p.caretBidiLevel=c.bidiLevel)}else if(p.extend){p.collapse(d.node,d.offset);try{p.extend(h.node,h.offset)}catch{}}else{let x=document.createRange();c.anchor>c.head&&([d,h]=[h,d]),x.setEnd(h.node,h.offset),x.setStart(d.node,d.offset),p.removeAllRanges(),p.addRange(x)}i&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(d,h)),this.impreciseAnchor=d.precise?null:new ns(m.anchorNode,m.anchorOffset),this.impreciseHead=h.precise?null:new ns(m.focusNode,m.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&ef(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=vf(e.root),{anchorNode:s,anchorOffset:i}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let l=pr.find(this,n.head);if(!l)return;let c=l.posAtStart;if(n.head==c||n.head==c+l.length)return;let d=this.coordsAt(n.head,-1),h=this.coordsAt(n.head,1);if(!d||!h||d.bottom>h.top)return;let m=this.domAtPos(n.head+n.assoc);r.collapse(m.node,m.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let p=e.observer.selectionRange;e.docView.posFromDOM(p.anchorNode,p.anchorOffset)!=n.from&&r.collapse(s,i)}moveToLine(e){let n=this.dom,r;if(e.node!=n)return e;for(let s=e.offset;!r&&s=0;s--){let i=jn.get(n.childNodes[s]);i instanceof pr&&(r=i.domAtPos(i.length))}return r?new ns(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=jn.get(n);if(r&&r.rootView==this)return r;n=n.parentNode}return null}posFromDOM(e,n){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,n)+r.posAtStart}domAtPos(e){let{i:n,off:r}=this.childCursor().findPos(e,-1);for(;n=0;l--){let c=this.children[l],d=i-c.breakAfter,h=d-c.length;if(de||c.covers(1))&&(!r||c instanceof pr&&!(r instanceof pr&&n>=0)))r=c,s=h;else if(r&&h==e&&d==e&&c instanceof cl&&Math.abs(n)<2){if(c.deco.startSide<0)break;l&&(r=null)}i=h}return r?r.coordsAt(e-s,n):null}coordsForChar(e){let{i:n,off:r}=this.childPos(e,1),s=this.children[n];if(!(s instanceof pr))return null;for(;s.children.length;){let{i:c,off:d}=s.childPos(r,1);for(;;c++){if(c==s.children.length)return null;if((s=s.children[c]).length)break}r=d}if(!(s instanceof Hi))return null;let i=Vr(s.text,r);if(i==r)return null;let l=wc(s.dom,r,i).getClientRects();for(let c=0;cMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,c=-1,d=this.view.textDirection==Hn.LTR;for(let h=0,m=0;ms)break;if(h>=r){let v=p.dom.getBoundingClientRect();if(n.push(v.height),l){let b=p.dom.lastChild,k=b?ud(b):[];if(k.length){let O=k[k.length-1],j=d?O.right-v.left:v.right-O.left;j>c&&(c=j,this.minWidth=i,this.minWidthFrom=h,this.minWidthTo=x)}}}h=x+p.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?Hn.RTL:Hn.LTR}measureTextSize(){for(let i of this.children)if(i instanceof pr){let l=i.measureTextSize();if(l)return l}let e=document.createElement("div"),n,r,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let i=ud(e.firstChild)[0];n=e.getBoundingClientRect().height,r=i?i.width/27:7,s=i?i.height:n,e.remove()}),{lineHeight:n,charWidth:r,textHeight:s}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new UA(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,s=0;;s++){let i=s==n.viewports.length?null:n.viewports[s],l=i?i.from-1:this.length;if(l>r){let c=(n.lineBlockAt(l).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(Je.replace({widget:new z2(c),block:!0,inclusive:!0,isBlockGap:!0}).range(r,l))}if(!i)break;r=i.to+1}return Je.set(e)}updateDeco(){let e=1,n=this.view.state.facet(yf).map(i=>(this.dynamicDecorationMap[e++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(mM).map((i,l)=>{let c=typeof i=="function";return c&&(r=!0),c?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[e++]=r,n.push(Yt.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];en.anchor?-1:1),s;if(!r)return;!n.empty&&(s=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let i=Tw(this.view),l={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:c,offsetHeight:d}=this.view.scrollDOM;dV(this.view.scrollDOM,l,n.heads instanceof al||s.children.some(r);return r(this.children[n])}}function _V(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function xM(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=$A(n.focusNode,n.focusOffset),s=HA(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let c=jn.get(s.node);if(!c||c instanceof Hi&&c.text!=s.node.nodeValue)i=s;else if(t.docView.lastCompositionAfterCursor){let d=jn.get(r.node);!d||d instanceof Hi&&d.text!=r.node.nodeValue||(i=s)}}if(t.docView.lastCompositionAfterCursor=i!=r,!i)return null;let l=e-i.offset;return{from:l,to:l+i.node.nodeValue.length,node:i.node}}function DV(t,e,n){let r=xM(t,n);if(!r)return null;let{node:s,from:i,to:l}=r,c=s.nodeValue;if(/[\n\r]/.test(c)||t.state.doc.sliceString(r.from,r.to)!=c)return null;let d=e.invertedDesc,h=new Ni(d.mapPos(i),d.mapPos(l),i,l),m=[];for(let p=s.parentNode;;p=p.parentNode){let x=jn.get(p);if(x instanceof pl)m.push({node:p,deco:x.mark});else{if(x instanceof pr||p.nodeName=="DIV"&&p.parentNode==t.contentDOM)return{range:h,text:s,marks:m,line:p};if(p!=t.contentDOM)m.push({node:p,deco:new i0({inclusive:!0,attributes:bV(p),tagName:p.tagName.toLowerCase()})});else return null}}}function RV(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{re.from&&(n=!0)}),n}function IV(t,e,n=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),i=e-s.from;if(s.length==0)return Ce.cursor(e);i==0?n=1:i==s.length&&(n=-1);let l=i,c=i;n<0?l=Vr(s.text,i,!1):c=Vr(s.text,i);let d=r(s.text.slice(l,c));for(;l>0;){let h=Vr(s.text,l,!1);if(r(s.text.slice(h,l))!=d)break;l=h}for(;ct?e.left-t:Math.max(0,t-e.right)}function FV(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function _y(t,e){return t.tope.top+1}function pj(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function q2(t,e,n){let r,s,i,l,c=!1,d,h,m,p;for(let b=t.firstChild;b;b=b.nextSibling){let k=ud(b);for(let O=0;OA||l==A&&i>T)&&(r=b,s=j,i=T,l=A,c=T?e0:Oj.bottom&&(!m||m.bottomj.top)&&(h=b,p=j):m&&_y(m,j)?m=gj(m,j.bottom):p&&_y(p,j)&&(p=pj(p,j.top))}}if(m&&m.bottom>=n?(r=d,s=m):p&&p.top<=n&&(r=h,s=p),!r)return{node:t,offset:0};let x=Math.max(s.left,Math.min(s.right,e));if(r.nodeType==3)return xj(r,x,n);if(c&&r.contentEditable!="false")return q2(r,x,n);let v=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(s.left+s.right)/2?1:0);return{node:t,offset:v}}function xj(t,e,n){let r=t.nodeValue.length,s=-1,i=1e9,l=0;for(let c=0;cn?m.top-n:n-m.bottom)-1;if(m.left-1<=e&&m.right+1>=e&&p=(m.left+m.right)/2,v=x;if(Fe.chrome||Fe.gecko){let b=wc(t,c).getBoundingClientRect();Math.abs(b.left-m.right)<.1&&(v=!x)}if(p<=0)return{node:t,offset:c+(v?1:0)};s=c+(v?1:0),i=p}}}return{node:t,offset:s>-1?s:l>0?t.nodeValue.length:0}}function vM(t,e,n,r=-1){var s,i;let l=t.contentDOM.getBoundingClientRect(),c=l.top+t.viewState.paddingTop,d,{docHeight:h}=t.viewState,{x:m,y:p}=e,x=p-c;if(x<0)return 0;if(x>h)return t.state.doc.length;for(let _=t.viewState.heightOracle.textHeight/2,D=!1;d=t.elementAtHeight(x),d.type!=fs.Text;)for(;x=r>0?d.bottom+_:d.top-_,!(x>=0&&x<=h);){if(D)return n?null:0;D=!0,r=-r}p=c+x;let v=d.from;if(vt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:vj(t,l,d,m,p);let b=t.dom.ownerDocument,k=t.root.elementFromPoint?t.root:b,O=k.elementFromPoint(m,p);O&&!t.contentDOM.contains(O)&&(O=null),O||(m=Math.max(l.left+1,Math.min(l.right-1,m)),O=k.elementFromPoint(m,p),O&&!t.contentDOM.contains(O)&&(O=null));let j,T=-1;if(O&&((s=t.docView.nearest(O))===null||s===void 0?void 0:s.isEditable)!=!1){if(b.caretPositionFromPoint){let _=b.caretPositionFromPoint(m,p);_&&({offsetNode:j,offset:T}=_)}else if(b.caretRangeFromPoint){let _=b.caretRangeFromPoint(m,p);_&&({startContainer:j,startOffset:T}=_)}j&&(!t.contentDOM.contains(j)||Fe.safari&&QV(j,T,m)||Fe.chrome&&$V(j,T,m))&&(j=void 0),j&&(T=Math.min(ba(j),T))}if(!j||!t.docView.dom.contains(j)){let _=pr.find(t.docView,v);if(!_)return x>d.top+d.height/2?d.to:d.from;({node:j,offset:T}=q2(_.dom,m,p))}let A=t.docView.nearest(j);if(!A)return null;if(A.isWidget&&((i=A.dom)===null||i===void 0?void 0:i.nodeType)==1){let _=A.dom.getBoundingClientRect();return e.y<_.top||e.y<=_.bottom&&e.x<=(_.left+_.right)/2?A.posAtStart:A.posAtEnd}else return A.localPosFromDOM(j,T)+A.posAtStart}function vj(t,e,n,r,s){let i=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let c=t.viewState.heightOracle.textHeight,d=Math.floor((s-n.top-(t.defaultLineHeight-c)*.5)/c);i+=d*t.viewState.heightOracle.lineLength}let l=t.state.sliceDoc(n.from,n.to);return n.from+j2(l,i,t.state.tabSize)}function yM(t,e,n){let r,s=t;if(t.nodeType!=3||e!=(r=t.nodeValue.length))return!1;for(;;){let i=s.nextSibling;if(i){if(i.nodeName=="BR")break;return!1}else{let l=s.parentNode;if(!l||l.nodeName=="DIV")break;s=l}}return wc(t,r-1,r).getBoundingClientRect().right>n}function QV(t,e,n){return yM(t,e,n)}function $V(t,e,n){if(e!=0)return yM(t,e,n);for(let s=t;;){let i=s.parentNode;if(!i||i.nodeType!=1||i.firstChild!=s)return!1;if(i.classList.contains("cm-line"))break;s=i}let r=t.nodeType==1?t.getBoundingClientRect():wc(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function F2(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let s;for(let i of r.type){if(i.from>e)break;if(!(i.toe)return i;(!s||i.type==fs.Text&&(s.type!=i.type||(n<0?i.frome)))&&(s=i)}}return s||r}return r}function HV(t,e,n,r){let s=F2(t,e.head,e.assoc||-1),i=!r||s.type!=fs.Text||!(t.lineWrapping||s.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(i){let l=t.dom.getBoundingClientRect(),c=t.textDirectionAt(s.from),d=t.posAtCoords({x:n==(c==Hn.LTR)?l.right-1:l.left+1,y:(i.top+i.bottom)/2});if(d!=null)return Ce.cursor(d,n?-1:1)}return Ce.cursor(n?s.to:s.from,n?-1:1)}function yj(t,e,n,r){let s=t.state.doc.lineAt(e.head),i=t.bidiSpans(s),l=t.textDirectionAt(s.from);for(let c=e,d=null;;){let h=AV(s,i,l,c,n),m=nM;if(!h){if(s.number==(n?t.state.doc.lines:1))return c;m=` +`,s=t.state.doc.line(s.number+(n?1:-1)),i=t.bidiSpans(s),h=t.visualLineSide(s,!n)}if(d){if(!d(m))return c}else{if(!r)return h;d=r(m)}c=h}}function UV(t,e,n){let r=t.state.charCategorizer(e),s=r(n);return i=>{let l=r(i);return s==Vn.Space&&(s=l),s==l}}function VV(t,e,n,r){let s=e.head,i=n?1:-1;if(s==(n?t.state.doc.length:0))return Ce.cursor(s,e.assoc);let l=e.goalColumn,c,d=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s,e.assoc||-1),m=t.documentTop;if(h)l==null&&(l=h.left-d.left),c=i<0?h.top:h.bottom;else{let v=t.viewState.lineBlockAt(s);l==null&&(l=Math.min(d.right-d.left,t.defaultCharacterWidth*(s-v.from))),c=(i<0?v.top:v.bottom)+m}let p=d.left+l,x=r??t.viewState.heightOracle.textHeight>>1;for(let v=0;;v+=10){let b=c+(x+v)*i,k=vM(t,{x:p,y:b},!1,i);if(bd.bottom||(i<0?ks)){let O=t.docView.coordsForChar(k),j=!O||b{if(e>i&&es(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:Ce.cursor(r,ri)&&!XV(l,n)&&this.lineBreak(),s=l}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,l=1,c;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),l=this.lineSeparator.length):(c=s.exec(n))&&(i=c.index,l=c[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),l>1)for(let d of this.points)d.node==e&&d.pos>this.text.length&&(d.pos-=l-1);r=i+l}}readNode(e){if(e.cmIgnore)return;let n=jn.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(GV(e,r.node,r.offset)?n:0))}}function GV(t,e,n){for(;;){if(!e||n-1;let{impreciseHead:i,impreciseAnchor:l}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let c=i||l?[]:ZV(e),d=new WV(c,e.state);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=JV(c,this.bounds.from)}else{let c=e.observer.selectionRange,d=i&&i.node==c.focusNode&&i.offset==c.focusOffset||!_2(e.contentDOM,c.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(c.focusNode,c.focusOffset),h=l&&l.node==c.anchorNode&&l.offset==c.anchorOffset||!_2(e.contentDOM,c.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(c.anchorNode,c.anchorOffset),m=e.viewport;if((Fe.ios||Fe.chrome)&&e.state.selection.main.empty&&d!=h&&(m.from>0||m.to-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Ce.range(h,d)):this.newSel=Ce.single(h,d)}}}function wM(t,e){let n,{newSel:r}=e,s=t.state.selection.main,i=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:l,to:c}=e.bounds,d=s.from,h=null;(i===8||Fe.android&&e.text.length=s.from&&n.to<=s.to&&(n.from!=s.from||n.to!=s.to)&&s.to-s.from-(n.to-n.from)<=4?n={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,s.to))}:t.state.doc.lineAt(s.from).toDate.now()-50?n={from:s.from,to:s.to,insert:t.state.toText(t.inputState.insertingText)}:Fe.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` + `&&t.lineWrapping&&(r&&(r=Ce.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:Xt.of([" "])}),n)return Aw(t,n,r,i);if(r&&!r.main.eq(s)){let l=!1,c="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(l=!0),c=t.inputState.lastSelectionOrigin,c=="select.pointer"&&(r=bM(t.state.facet(l0).map(d=>d(t)),r))),t.dispatch({selection:r,scrollIntoView:l,userEvent:c}),!0}else return!1}function Aw(t,e,n,r=-1){if(Fe.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(Fe.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&t.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Gu(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.lengths.head)&&Gu(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Gu(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let l,c=()=>l||(l=KV(t,e,n));return t.state.facet(lM).some(d=>d(t,e.from,e.to,i,c))||t.dispatch(c()),!0}function KV(t,e,n){let r,s=t.state,i=s.selection.main,l=-1;if(e.from==e.to&&e.fromi.to){let d=e.fromp(t)),h,d);e.from==m&&(l=m)}if(l>-1)r={changes:e,selection:Ce.cursor(e.from+e.insert.length,-1)};else if(e.from>=i.from&&e.to<=i.to&&e.to-e.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let d=i.frome.to?s.sliceDoc(e.to,i.to):"";r=s.replaceSelection(t.state.toText(d+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let d=s.changes(e),h=n&&n.main.to<=d.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=i.to+10&&e.to>=i.to-10){let m=t.state.sliceDoc(e.from,e.to),p,x=n&&xM(t,n.main.head);if(x){let b=e.insert.length-(e.to-e.from);p={from:x.from,to:x.to-b}}else p=t.state.doc.lineAt(i.head);let v=i.to-e.to;r=s.changeByRange(b=>{if(b.from==i.from&&b.to==i.to)return{changes:d,range:h||b.map(d)};let k=b.to-v,O=k-m.length;if(t.state.sliceDoc(O,k)!=m||k>=p.from&&O<=p.to)return{range:b};let j=s.changes({from:O,to:k,insert:e.insert}),T=b.to-i.to;return{changes:j,range:h?Ce.range(Math.max(0,h.anchor+T),Math.max(0,h.head+T)):b.map(j)}})}else r={changes:d,selection:h&&s.selection.replaceRange(h)}}let c="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,c+=".compose",t.inputState.compositionFirstChange&&(c+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:c,scrollIntoView:!0})}function SM(t,e,n,r){let s=Math.min(t.length,e.length),i=0;for(;i0&&c>0&&t.charCodeAt(l-1)==e.charCodeAt(c-1);)l--,c--;if(r=="end"){let d=Math.max(0,i-Math.min(l,c));n-=l+d-i}if(l=l?i-n:0;i-=d,c=i+(c-l),l=i}else if(c=c?i-n:0;i-=d,l=i+(l-c),c=i}return{from:i,toA:l,toB:c}}function ZV(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}=t.observer.selectionRange;return n&&(e.push(new bj(n,r)),(s!=n||i!=r)&&e.push(new bj(s,i))),e}function JV(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?Ce.single(n+e,r+e):null}class eW{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Fe.safari&&e.contentDOM.addEventListener("input",()=>null),Fe.gecko&&gW(e.contentDOM.ownerDocument)}handleEvent(e){!oW(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let s of r.observers)s(this.view,n);for(let s of r.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=tW(e),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let l=!n[i].handlers.length,c=r[i];c&&l!=!c.handlers.length&&(s.removeEventListener(i,this.handleEvent),c=null),c||s.addEventListener(i,this.handleEvent,{passive:l})}for(let i in r)i!="scroll"&&!n[i]&&s.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&OM.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Fe.android&&Fe.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return Fe.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=kM.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||nW.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from0?!0:Fe.safari&&!Fe.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function wj(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){_s(n.state,s)}}}function tW(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let s=r.spec,i=s&&s.plugin.domEventHandlers,l=s&&s.plugin.domEventObservers;if(i)for(let c in i){let d=i[c];d&&n(c).handlers.push(wj(r.value,d))}if(l)for(let c in l){let d=l[c];d&&n(c).observers.push(wj(r.value,d))}}for(let r in Ui)n(r).handlers.push(Ui[r]);for(let r in Ti)n(r).observers.push(Ti[r]);return e}const kM=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],nW="dthko",OM=[16,17,18,20,91,92,224,225],rp=6;function sp(t){return Math.max(0,t)*.7+8}function rW(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class sW{constructor(e,n,r,s){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=hV(e.contentDOM),this.atoms=e.state.facet(l0).map(l=>l(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Vt.allowMultipleSelections)&&iW(e,n),this.dragging=lW(e,n)&&CM(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&rW(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,i=0,l=this.view.win.innerWidth,c=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:l}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:c}=this.scrollParents.y.getBoundingClientRect());let d=Tw(this.view);e.clientX-d.left<=s+rp?n=-sp(s-e.clientX):e.clientX+d.right>=l-rp&&(n=sp(e.clientX-l)),e.clientY-d.top<=i+rp?r=-sp(i-e.clientY):e.clientY+d.bottom>=c-rp&&(r=sp(e.clientY-c)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=bM(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function iW(t,e){let n=t.state.facet(rM);return n.length?n[0](e):Fe.mac?e.metaKey:e.ctrlKey}function aW(t,e){let n=t.state.facet(sM);return n.length?n[0](e):Fe.mac?!e.altKey:!e.ctrlKey}function lW(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=vf(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i=e.clientX&&l.top<=e.clientY&&l.bottom>=e.clientY)return!0}return!1}function oW(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=jn.get(n))&&r.ignoreEvent(e))return!1;return!0}const Ui=Object.create(null),Ti=Object.create(null),jM=Fe.ie&&Fe.ie_version<15||Fe.ios&&Fe.webkit_version<604;function cW(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),NM(t,n.value)},50)}function kx(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function NM(t,e){e=kx(t.state,jw,e);let{state:n}=t,r,s=1,i=n.toText(e),l=i.lines==n.selection.ranges.length;if(Q2!=null&&n.selection.ranges.every(d=>d.empty)&&Q2==i.toString()){let d=-1;r=n.changeByRange(h=>{let m=n.doc.lineAt(h.from);if(m.from==d)return{range:h};d=m.from;let p=n.toText((l?i.line(s++).text:e)+n.lineBreak);return{changes:{from:m.from,insert:p},range:Ce.cursor(h.from+p.length)}})}else l?r=n.changeByRange(d=>{let h=i.line(s++);return{changes:{from:d.from,to:d.to,insert:h.text},range:Ce.cursor(d.from+h.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Ti.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};Ui.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Ti.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Ti.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Ui.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(iM))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=hW(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new sW(t,e,n,r)),r&&t.observer.ignore(()=>{qA(t.contentDOM);let i=t.root.activeElement;i&&!i.contains(t.contentDOM)&&i.blur()});let s=t.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function Sj(t,e,n,r){if(r==1)return Ce.cursor(e,n);if(r==2)return IV(t.state,e,n);{let s=pr.find(t.docView,e),i=t.state.doc.lineAt(s?s.posAtEnd:e),l=s?s.posAtStart:i.from,c=s?s.posAtEnd:i.to;return ce>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function uW(t,e,n,r){let s=pr.find(t.docView,e);if(!s)return 1;let i=e-s.posAtStart;if(i==0)return 1;if(i==s.length)return-1;let l=s.coordsAt(i,-1);if(l&&kj(n,r,l))return-1;let c=s.coordsAt(i,1);return c&&kj(n,r,c)?1:l&&l.bottom>=r?-1:1}function Oj(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:uW(t,n,e.clientX,e.clientY)}}const dW=Fe.ie&&Fe.ie_version<=11;let jj=null,Nj=0,Cj=0;function CM(t){if(!dW)return t.detail;let e=jj,n=Cj;return jj=t,Cj=Date.now(),Nj=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Nj+1)%3:1}function hW(t,e){let n=Oj(t,e),r=CM(e),s=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,l,c){let d=Oj(t,i),h,m=Sj(t,d.pos,d.bias,r);if(n.pos!=d.pos&&!l){let p=Sj(t,n.pos,n.bias,r),x=Math.min(p.from,m.from),v=Math.max(p.to,m.to);m=x1&&(h=fW(s,d.pos))?h:c?s.addRange(m):Ce.create([m])}}}function fW(t,e){for(let n=0;n=e)return Ce.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}Ui.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let s=t.docView.nearest(e.target);if(s&&s.isWidget){let i=s.posAtStart,l=i+s.length;(i>=n.to||l<=n.from)&&(n=Ce.range(i,l))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",kx(t.state,Nw,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ui.dragend=t=>(t.inputState.draggedContent=null,!1);function Tj(t,e,n,r){if(n=kx(t.state,jw,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,l=r&&i&&aW(t,e)?{from:i.from,to:i.to}:null,c={from:s,insert:n},d=t.state.changes(l?[l,c]:c);t.focus(),t.dispatch({changes:d,selection:{anchor:d.mapPos(s,-1),head:d.mapPos(s,1)},userEvent:l?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Ui.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,i=()=>{++s==n.length&&Tj(t,e,r.filter(l=>l!=null).join(t.state.lineBreak),!1)};for(let l=0;l{/[\x00-\x08\x0e-\x1f]{2}/.test(c.result)||(r[l]=c.result),i()},c.readAsText(n[l])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Tj(t,e,r,!0),!0}return!1};Ui.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=jM?null:e.clipboardData;return n?(NM(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(cW(t),!1)};function mW(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function pW(t){let e=[],n=[],r=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),n.push(s));if(!e.length){let s=-1;for(let{from:i}of t.selection.ranges){let l=t.doc.lineAt(i);l.number>s&&(e.push(l.text),n.push({from:l.from,to:Math.min(t.doc.length,l.to+1)})),s=l.number}r=!0}return{text:kx(t,Nw,e.join(t.lineBreak)),ranges:n,linewise:r}}let Q2=null;Ui.copy=Ui.cut=(t,e)=>{let{text:n,ranges:r,linewise:s}=pW(t.state);if(!n&&!s)return!1;Q2=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=jM?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(mW(t,n),!1)};const TM=ka.define();function AM(t,e){let n=[];for(let r of t.facet(oM)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:TM.of(!0)}):null}function MM(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=AM(t.state,e);n?t.dispatch(n):t.update([])}},10)}Ti.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),MM(t)};Ti.blur=t=>{t.observer.clearSelectionRange(),MM(t)};Ti.compositionstart=Ti.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Ti.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Fe.chrome&&Fe.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Ti.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Ui.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let i=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),l=e.getTargetRanges();if(i&&l.length){let c=l[0],d=t.posAtDOM(c.startContainer,c.startOffset),h=t.posAtDOM(c.endContainer,c.endOffset);return Aw(t,{from:d,to:h,insert:t.state.toText(i)},null),!0}}let s;if(Fe.chrome&&Fe.android&&(s=kM.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var l;(((l=window.visualViewport)===null||l===void 0?void 0:l.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Fe.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Fe.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Ti.compositionend(t,e),20),!1};const Aj=new Set;function gW(t){Aj.has(t)||(Aj.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const Mj=["pre-wrap","normal","pre-line","break-spaces"];let fd=!1;function Ej(){fd=!1}class xW{constructor(e){this.lineWrapping=e,this.doc=Xt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Mj.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,d=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=c;if(this.lineWrapping=c,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,d){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Jp&&(fd=!0),this.height=e)}replace(e,n,r){return ms.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,s){let i=this,l=r.doc;for(let c=s.length-1;c>=0;c--){let{fromA:d,toA:h,fromB:m,toB:p}=s[c],x=i.lineAt(d,$n.ByPosNoHeight,r.setDoc(n),0,0),v=x.to>=h?x:i.lineAt(h,$n.ByPosNoHeight,r,0,0);for(p+=v.to-h,h=v.to;c>0&&x.from<=s[c-1].toA;)d=s[c-1].fromA,m=s[c-1].fromB,c--,di*2){let c=e[n-1];c.break?e.splice(--n,1,c.left,null,c.right):e.splice(--n,1,c.left,c.right),r+=1+c.break,s-=c.size}else if(i>s*2){let c=e[r];c.break?e.splice(r,1,c.left,null,c.right):e.splice(r,1,c.left,c.right),r+=2+c.break,i-=c.size}else break;else if(s=i&&l(this.blockAt(0,r,s,i))}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class ei extends EM{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,s){return new ca(s,this.length,r,this.height,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof ei||s instanceof $r&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof $r?s=new ei(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):ms.of(r)}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setHeight(s.heights[s.index++]):(r||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class $r extends ms{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,s=e.doc.lineAt(n+this.length).number,i=s-r+1,l,c=0;if(e.lineWrapping){let d=Math.min(this.height,e.lineHeight*i);l=d/i,this.length>i+1&&(c=(this.height-d)/(this.length-i-1))}else l=this.height/i;return{firstLine:r,lastLine:s,perLine:l,perChar:c}}blockAt(e,n,r,s){let{firstLine:i,lastLine:l,perLine:c,perChar:d}=this.heightMetrics(n,s);if(n.lineWrapping){let h=s+(e0){let i=r[r.length-1];i instanceof $r?r[r.length-1]=new $r(i.length+s):r.push(null,new $r(s-1))}if(e>0){let i=r[0];i instanceof $r?r[0]=new $r(e+i.length):r.unshift(new $r(e-1),null)}return ms.of(r)}decomposeLeft(e,n){n.push(new $r(e-1),null)}decomposeRight(e,n){n.push(null,new $r(this.length-e-1))}updateHeight(e,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let l=[],c=Math.max(n,s.from),d=-1;for(s.from>n&&l.push(new $r(s.from-n-1).updateHeight(e,n));c<=i&&s.more;){let m=e.doc.lineAt(c).length;l.length&&l.push(null);let p=s.heights[s.index++];d==-1?d=p:Math.abs(p-d)>=Jp&&(d=-2);let x=new ei(m,p);x.outdated=!1,l.push(x),c+=m+1}c<=i&&l.push(null,new $r(i-c).updateHeight(e,c));let h=ms.of(l);return(d<0||Math.abs(h.height-this.height)>=Jp||Math.abs(d-this.heightMetrics(e,n).perLine)>=Jp)&&(fd=!0),Cg(this,h)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class yW extends ms{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,s){let i=r+this.left.height;return ec))return h;let m=n==$n.ByPosNoHeight?$n.ByPosNoHeight:$n.ByPos;return d?h.join(this.right.lineAt(c,m,r,l,c)):this.left.lineAt(c,m,r,s,i).join(h)}forEachLine(e,n,r,s,i,l){let c=s+this.left.height,d=i+this.left.length+this.break;if(this.break)e=d&&this.right.forEachLine(e,n,r,c,d,l);else{let h=this.lineAt(d,$n.ByPos,r,s,i);e=e&&h.from<=n&&l(h),n>h.to&&this.right.forEachLine(h.to+1,n,r,c,d,l)}}replace(e,n,r){let s=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-s,n-s,r));let i=[];e>0&&this.decomposeLeft(e,i);let l=i.length;for(let c of r)i.push(c);if(e>0&&_j(i,l-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,n);e2*n.size||n.size>2*e.size?ms.of(this.break?[e,null,n]:[e,n]):(this.left=Cg(this.left,e),this.right=Cg(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,s){let{left:i,right:l}=this,c=n+i.length+this.break,d=null;return s&&s.from<=n+i.length&&s.more?d=i=i.updateHeight(e,n,r,s):i.updateHeight(e,n,r),s&&s.from<=c+l.length&&s.more?d=l=l.updateHeight(e,c,r,s):l.updateHeight(e,c,r),d?this.balanced(i,l):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function _j(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof $r&&(r=t[e+1])instanceof $r&&t.splice(e-1,3,new $r(n.length+1+r.length))}const bW=5;class Mw{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof ei?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new ei(r-this.pos,-1)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e=bW)&&this.addLineDeco(s,i,l)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new ei(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new $r(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof ei)return e;let n=new ei(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof ei)&&!this.isCovered?this.nodes.push(new ei(0,-1)):(this.writtenTom.clientHeight||m.scrollWidth>m.clientWidth)&&p.overflow!="visible"){let x=m.getBoundingClientRect();i=Math.max(i,x.left),l=Math.min(l,x.right),c=Math.max(c,x.top),d=Math.min(h==t.parentNode?s.innerHeight:d,x.bottom)}h=p.position=="absolute"||p.position=="fixed"?m.offsetParent:m.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:i-n.left,right:Math.max(i,l)-n.left,top:c-(n.top+e),bottom:Math.max(c,d)-(n.top+e)}}function OW(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function jW(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class Ry{constructor(e,n,r,s){this.from=e,this.to=n,this.size=r,this.displaySize=s}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;rtypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new xW(n),this.stateDeco=e.facet(yf).filter(r=>typeof r!="function"),this.heightMap=ms.empty().applyChanges(this.stateDeco,Xt.empty,this.heightOracle.setDoc(e.doc),[new Ni(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Je.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!e.some(({from:i,to:l})=>s>=i&&s<=l)){let{from:i,to:l}=this.lineBlockAt(s);e.push(new ip(i,l))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Rj:new Ew(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Hh(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(yf).filter(m=>typeof m!="function");let s=e.changedRanges,i=Ni.extendWithRanges(s,wW(r,this.stateDeco,e?e.changes:kr.empty(this.state.doc.length))),l=this.heightMap.height,c=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Ej(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=l||fd)&&(e.flags|=2),c?(this.scrollAnchorPos=e.changes.mapPos(c.from,-1),this.scrollAnchorHeight=c.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=l);let d=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.headd.to)||!this.viewportIsAppropriate(d))&&(d=this.getViewport(0,n));let h=d.from!=this.viewport.from||d.to!=this.viewport.to;this.viewport=d,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(uM)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Hn.RTL:Hn.LTR;let l=this.heightOracle.mustRefreshForWrapping(i),c=n.getBoundingClientRect(),d=l||this.mustMeasureContent||this.contentDOMHeight!=c.height;this.contentDOMHeight=c.height,this.mustMeasureContent=!1;let h=0,m=0;if(c.width&&c.height){let{scaleX:_,scaleY:D}=IA(n,c);(_>.005&&Math.abs(this.scaleX-_)>.005||D>.005&&Math.abs(this.scaleY-D)>.005)&&(this.scaleX=_,this.scaleY=D,h|=16,l=d=!0)}let p=(parseInt(r.paddingTop)||0)*this.scaleY,x=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=p||this.paddingBottom!=x)&&(this.paddingTop=p,this.paddingBottom=x,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(d=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let v=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=v&&(this.scrollAnchorHeight=-1,this.scrollTop=v),this.scrolledToBottom=QA(e.scrollDOM);let b=(this.printing?jW:kW)(n,this.paddingTop),k=b.top-this.pixelViewport.top,O=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let j=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(j!=this.inView&&(this.inView=j,j&&(d=!0)),!this.inView&&!this.scrollTarget&&!OW(e.dom))return 0;let T=c.width;if((this.contentDOMWidth!=T||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=c.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),d){let _=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(_)&&(l=!0),l||s.lineWrapping&&Math.abs(T-this.contentDOMWidth)>s.charWidth){let{lineHeight:D,charWidth:E,textHeight:R}=e.docView.measureTextSize();l=D>0&&s.refresh(i,D,E,R,Math.max(5,T/E),_),l&&(e.docView.minWidth=0,h|=16)}k>0&&O>0?m=Math.max(k,O):k<0&&O<0&&(m=Math.min(k,O)),Ej();for(let D of this.viewports){let E=D.from==this.viewport.from?_:e.docView.measureVisibleLineHeights(D);this.heightMap=(l?ms.empty().applyChanges(this.stateDeco,Xt.empty,this.heightOracle,[new Ni(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,l,new vW(D.from,E))}fd&&(h|=2)}let A=!this.viewportIsAppropriate(this.viewport,m)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return A&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(m,this.scrollTarget),h|=this.updateForViewport()),(h&2||A)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(l?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:l,visibleBottom:c}=this,d=new ip(s.lineAt(l-r*1e3,$n.ByHeight,i,0,0).from,s.lineAt(c+(1-r)*1e3,$n.ByHeight,i,0,0).to);if(n){let{head:h}=n.range;if(hd.to){let m=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),p=s.lineAt(h,$n.ByPos,i,0,0),x;n.y=="center"?x=(p.top+p.bottom)/2-m/2:n.y=="start"||n.y=="nearest"&&h=c+Math.max(10,Math.min(r,250)))&&s>l-2*1e3&&i>1,l=s<<1;if(this.defaultTextDirection!=Hn.LTR&&!r)return[];let c=[],d=(m,p,x,v)=>{if(p-mm&&jj.from>=x.from&&j.to<=x.to&&Math.abs(j.from-m)j.fromT));if(!O){if(pA.from<=p&&A.to>=p)){let A=n.moveToLineBoundary(Ce.cursor(p),!1,!0).head;A>m&&(p=A)}let j=this.gapSize(x,m,p,v),T=r||j<2e6?j:2e6;O=new Ry(m,p,j,T)}c.push(O)},h=m=>{if(m.length2e6)for(let E of e)E.from>=m.from&&E.fromm.from&&d(m.from,v,m,p),bn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];Yt.spans(n,this.viewport.from,this.viewport.to,{span(i,l){r.push({from:i,to:l})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||Hh(this.heightMap.lineAt(e,$n.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||Hh(this.heightMap.lineAt(this.scaler.fromDOM(e),$n.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return Hh(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}let ip=class{constructor(e,n){this.from=e,this.to=n}};function CW(t,e,n){let r=[],s=t,i=0;return Yt.spans(n,t,e,{span(){},point(l,c){l>s&&(r.push({from:s,to:l}),i+=l-s),s=c}},20),s=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let s=0;;s++){let{from:i,to:l}=e[s],c=l-i;if(r<=c)return i+r;r-=c}}function lp(t,e){let n=0;for(let{from:r,to:s}of t.ranges){if(e<=s){n+=e-r;break}n+=s-r}return n/t.total}function TW(t,e){for(let n of t)if(e(n))return n}const Rj={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class Ew{constructor(e,n,r){let s=0,i=0,l=0;this.viewports=r.map(({from:c,to:d})=>{let h=n.lineAt(c,$n.ByPos,e,0,0).top,m=n.lineAt(d,$n.ByPos,e,0,0).bottom;return s+=m-h,{from:c,to:d,top:h,bottom:m,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let c of this.viewports)c.domTop=l+(c.top-i)*this.scale,l=c.domBottom=c.domTop+(c.bottom-c.top),i=c.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let i=nn.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function Hh(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new ca(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>Hh(s,e)):t._content)}const op=He.define({combine:t=>t.join(" ")}),$2=He.define({combine:t=>t.indexOf(!0)>-1}),H2=fo.newName(),_M=fo.newName(),DM=fo.newName(),RM={"&light":"."+_M,"&dark":"."+DM};function U2(t,e,n){return new fo(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return t;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):t+" "+r}})}const AW=U2("."+H2,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},RM),MW={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},zy=Fe.ie&&Fe.ie_version<=11;class EW{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new fV,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(Fe.ie&&Fe.ie_version<=11||Fe.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Fe.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Fe.chrome&&Fe.chrome_version<126)&&(this.editContext=new DW(e),e.state.facet(il)&&(e.contentDOM.editContext=this.editContext.editContext)),zy&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(il)?r.root.activeElement!=this.dom:!Kp(this.dom,s))return;let i=s.anchorNode&&r.docView.nearest(s.anchorNode);if(i&&i.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Fe.ie&&Fe.ie_version<=11||Fe.android&&Fe.chrome)&&!r.state.selection.main.empty&&s.focusNode&&ef(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=vf(e.root);if(!n)return!1;let r=Fe.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&_W(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=Kp(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&Gu(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of e){let l=this.readMutation(i);l&&(l.typeOver&&(s=!0),n==-1?{from:n,to:r}=l:(n=Math.min(l.from,n),r=Math.max(l.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&Kp(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new YV(this.view,e,n,r);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,s=wM(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let r=zj(n,e.previousSibling||e.target.previousSibling,-1),s=zj(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(il)!=e.state.facet(il)&&(e.view.contentDOM.editContext=e.state.facet(il)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function zj(t,e,n){for(;e;){let r=jn.get(e);if(r&&r.parent==t)return r;let s=e.parentNode;e=s!=t.dom?s:n>0?e.nextSibling:e.previousSibling}return null}function Pj(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,l=t.docView.domAtPos(t.state.selection.main.anchor);return ef(l.node,l.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function _W(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return Pj(t,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?Pj(t,n):null}class DW{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let s=e.state.selection.main,{anchor:i,head:l}=s,c=this.toEditorPos(r.updateRangeStart),d=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:c,drifted:!1});let h=d-c>r.text.length;c==this.from&&ithis.to&&(d=i);let m=SM(e.state.sliceDoc(c,d),r.text,(h?s.from:s.to)-c,h?"end":null);if(!m){let x=Ce.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));x.main.eq(s)||e.dispatch({selection:x,userEvent:"select"});return}let p={from:m.from+c,to:m.toA+c,insert:Xt.of(r.text.slice(m.from,m.toB).split(` +`))};if((Fe.mac||Fe.android)&&p.from==l-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(p={from:c,to:d,insert:Xt.of([r.text.replace("."," ")])}),this.pendingContextChange=p,!e.state.readOnly){let x=this.to-this.from+(p.to-p.from+p.insert.length);Aw(e,p,Ce.single(this.toEditorPos(r.selectionStart,x),this.toEditorPos(r.selectionEnd,x)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),p.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let l=this.toEditorPos(r.rangeStart),c=this.toEditorPos(r.rangeEnd);l{let s=[];for(let i of r.getTextFormats()){let l=i.underlineStyle,c=i.underlineThickness;if(!/none/i.test(l)&&!/none/i.test(c)){let d=this.toEditorPos(i.rangeStart),h=this.toEditorPos(i.rangeEnd);if(d{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=vf(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((i,l,c,d,h)=>{if(r)return;let m=h.length-(l-i);if(s&&l>=s.to)if(s.from==i&&s.to==l&&s.insert.eq(h)){s=this.pendingContextChange=null,n+=m,this.to+=m;return}else s=null,this.revertPending(e.state);if(i+=n,l+=n,l<=this.from)this.from+=m,this.to+=m;else if(ithis.to||this.to-this.from+h.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(l),h.toString()),this.to+=m}n+=m}),s&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class qe{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(s=>s.forEach(i=>r(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||mV(e.parent)||document,this.viewState=new Dj(e.state||Vt.create(e)),e.scrollTo&&e.scrollTo.is(np)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Fu).map(s=>new Ey(s));for(let s of this.plugins)s.update(this);this.observer=new EW(this),this.inputState=new eW(this),this.inputState.ensureHandlers(this.plugins),this.docView=new mj(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof gr?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let x of e){if(x.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=x.state}if(this.destroyed){this.viewState.state=i;return}let l=this.hasFocus,c=0,d=null;e.some(x=>x.annotation(TM))?(this.inputState.notifiedFocused=l,c=1):l!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=l,d=AM(i,l),d||(c=1));let h=this.observer.delayedAndroidKey,m=null;if(h?(this.observer.clearDelayedAndroidKey(),m=this.observer.readChange(),(m&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(m=null)):this.observer.clear(),i.facet(Vt.phrases)!=this.state.facet(Vt.phrases))return this.setState(i);s=Ng.create(this,i,e),s.flags|=c;let p=this.viewState.scrollTarget;try{this.updateState=2;for(let x of e){if(p&&(p=p.map(x.changes)),x.scrollIntoView){let{main:v}=x.state.selection;p=new Xu(v.empty?v:Ce.cursor(v.head,v.head>v.anchor?-1:1))}for(let v of x.effects)v.is(np)&&(p=v.value.clip(this.state))}this.viewState.update(s,p),this.bidiCache=Tg.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(Qh)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(x=>x.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(op)!=s.state.facet(op)&&(this.viewState.mustMeasureContent=!0),(n||r||p||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let x of this.state.facet(I2))try{x(s)}catch(v){_s(this.state,v,"update listener")}(d||m)&&Promise.resolve().then(()=>{d&&this.state==d.startState&&this.dispatch(d),m&&!wM(this,m)&&h.force&&Gu(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new Dj(e),this.plugins=e.facet(Fu).map(r=>new Ey(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new mj(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Fu),r=e.state.facet(Fu);if(n!=r){let s=[];for(let i of r){let l=n.indexOf(i);if(l<0)s.push(new Ey(i));else{let c=this.plugins[l];c.mustUpdate=e,s.push(c)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:l}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(l=-1),this.viewState.scrollAnchorHeight=-1;try{for(let c=0;;c++){if(l<0)if(QA(r))i=-1,l=this.viewState.heightMap.height;else{let v=this.viewState.scrollAnchorAt(s);i=v.from,l=v.top}this.updateState=1;let d=this.viewState.measure(this);if(!d&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(c>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];d&4||([this.measureRequests,h]=[h,this.measureRequests]);let m=h.map(v=>{try{return v.read(this)}catch(b){return _s(this.state,b),Bj}}),p=Ng.create(this,this.state,[]),x=!1;p.flags|=d,n?n.flags|=d:n=p,this.updateState=2,p.empty||(this.updatePlugins(p),this.inputState.update(p),this.updateAttrs(),x=this.docView.update(p),x&&this.docViewUpdate());for(let v=0;v1||b<-1){s=s+b,r.scrollTop=s/this.scaleY,l=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let c of this.state.facet(I2))c(n)}get themeClasses(){return H2+" "+(this.state.facet($2)?DM:_M)+" "+this.state.facet(op)}updateAttrs(){let e=Lj(this,fM,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(il)?"true":"false",class:"cm-content",style:`${Fe.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),Lj(this,Cw,n);let r=this.observer.ignore(()=>{let s=R2(this.contentDOM,this.contentAttrs,n),i=R2(this.dom,this.editorAttrs,e);return s||i});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let s of r.effects)if(s.is(qe.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Qh);let e=this.state.facet(qe.cspNonce);fo.mount(this.root,this.styleModules.concat(AW).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;nr.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return Dy(this,e,yj(this,e,n,r))}moveByGroup(e,n){return Dy(this,e,yj(this,e,n,r=>UV(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),i=r[n?r.length-1:0];return Ce.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return HV(this,e,n,r)}moveVertically(e,n,r){return Dy(this,e,VV(this,e,n,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),vM(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(e),i=this.bidiSpans(s),l=i[so.find(i,e-s.from,-1,n)];return s0(r,l.dir==Hn.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(cM)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>RW)return tM(e.length);let n=this.textDirectionAt(e.from),r;for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||eM(i.isolates,r=fj(this,e))))return i.order;r||(r=fj(this,e));let s=TV(e.text,n,r);return this.bidiCache.push(new Tg(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Fe.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{qA(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return np.of(new Xu(typeof e=="number"?Ce.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return np.of(new Xu(Ce.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return lr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return lr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=fo.newName(),s=[op.of(r),Qh.of(U2(`.${r}`,e))];return n&&n.dark&&s.push($2.of(!0)),s}static baseTheme(e){return No.lowest(Qh.of(U2("."+H2,e,RM)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&jn.get(r)||jn.get(e);return((n=s?.rootView)===null||n===void 0?void 0:n.view)||null}}qe.styleModule=Qh;qe.inputHandler=lM;qe.clipboardInputFilter=jw;qe.clipboardOutputFilter=Nw;qe.scrollHandler=dM;qe.focusChangeEffect=oM;qe.perLineTextDirection=cM;qe.exceptionSink=aM;qe.updateListener=I2;qe.editable=il;qe.mouseSelectionStyle=iM;qe.dragMovesSelection=sM;qe.clickAddsSelectionRange=rM;qe.decorations=yf;qe.outerDecorations=mM;qe.atomicRanges=l0;qe.bidiIsolatedRanges=pM;qe.scrollMargins=gM;qe.darkTheme=$2;qe.cspNonce=He.define({combine:t=>t.length?t[0]:""});qe.contentAttributes=Cw;qe.editorAttributes=fM;qe.lineWrapping=qe.contentAttributes.of({class:"cm-lineWrapping"});qe.announce=vt.define();const RW=4096,Bj={};class Tg{constructor(e,n,r,s,i,l){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=l}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:Hn.LTR;for(let i=Math.max(0,e.length-10);i=0;s--){let i=r[s],l=typeof i=="function"?i(t):i;l&&D2(l,n)}return n}const zW=Fe.mac?"mac":Fe.windows?"win":Fe.linux?"linux":"key";function PW(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,l,c;for(let d=0;dr.concat(s),[]))),n}function LW(t,e,n){return PM(zM(t.state),e,t,n)}let no=null;const IW=4e3;function qW(t,e=zW){let n=Object.create(null),r=Object.create(null),s=(l,c)=>{let d=r[l];if(d==null)r[l]=c;else if(d!=c)throw new Error("Key binding "+l+" is used both as a regular binding and as a multi-stroke prefix")},i=(l,c,d,h,m)=>{var p,x;let v=n[l]||(n[l]=Object.create(null)),b=c.split(/ (?!$)/).map(j=>PW(j,e));for(let j=1;j{let _=no={view:A,prefix:T,scope:l};return setTimeout(()=>{no==_&&(no=null)},IW),!0}]})}let k=b.join(" ");s(k,!1);let O=v[k]||(v[k]={preventDefault:!1,stopPropagation:!1,run:((x=(p=v._any)===null||p===void 0?void 0:p.run)===null||x===void 0?void 0:x.slice())||[]});d&&O.run.push(d),h&&(O.preventDefault=!0),m&&(O.stopPropagation=!0)};for(let l of t){let c=l.scope?l.scope.split(" "):["editor"];if(l.any)for(let h of c){let m=n[h]||(n[h]=Object.create(null));m._any||(m._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:p}=l;for(let x in m)m[x].run.push(v=>p(v,V2))}let d=l[e]||l.key;if(d)for(let h of c)i(h,d,l.run,l.preventDefault,l.stopPropagation),l.shift&&i(h,"Shift-"+d,l.shift,l.preventDefault,l.stopPropagation)}return n}let V2=null;function PM(t,e,n,r){V2=e;let s=oV(e),i=As(s,0),l=oa(i)==s.length&&s!=" ",c="",d=!1,h=!1,m=!1;no&&no.view==n&&no.scope==r&&(c=no.prefix+" ",OM.indexOf(e.keyCode)<0&&(h=!0,no=null));let p=new Set,x=O=>{if(O){for(let j of O.run)if(!p.has(j)&&(p.add(j),j(n)))return O.stopPropagation&&(m=!0),!0;O.preventDefault&&(O.stopPropagation&&(m=!0),h=!0)}return!1},v=t[r],b,k;return v&&(x(v[c+cp(s,e,!l)])?d=!0:l&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Fe.windows&&e.ctrlKey&&e.altKey)&&!(Fe.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(b=mo[e.keyCode])&&b!=s?(x(v[c+cp(b,e,!0)])||e.shiftKey&&(k=xf[e.keyCode])!=s&&k!=b&&x(v[c+cp(k,e,!1)]))&&(d=!0):l&&e.shiftKey&&x(v[c+cp(s,e,!0)])&&(d=!0),!d&&x(v._any)&&(d=!0)),h&&(d=!0),d&&m&&e.stopPropagation(),V2=null,d}class c0{constructor(e,n,r,s,i){this.className=e,this.left=n,this.top=r,this.width=s,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let s=e.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let i=BM(e);return[new c0(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return FW(e,n,r)}}function BM(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Hn.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function qj(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let i=t.dom.getBoundingClientRect(),l=(s.top+s.bottom)/2,c=t.posAtCoords({x:i.left+1,y:l}),d=t.posAtCoords({x:i.right-1,y:l});return c==null||d==null?r:{from:Math.max(r.from,Math.min(c,d)),to:Math.min(r.to,Math.max(c,d))}}function FW(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),s=Math.min(n.to,t.viewport.to),i=t.textDirection==Hn.LTR,l=t.contentDOM,c=l.getBoundingClientRect(),d=BM(t),h=l.querySelector(".cm-line"),m=h&&window.getComputedStyle(h),p=c.left+(m?parseInt(m.paddingLeft)+Math.min(0,parseInt(m.textIndent)):0),x=c.right-(m?parseInt(m.paddingRight):0),v=F2(t,r,1),b=F2(t,s,-1),k=v.type==fs.Text?v:null,O=b.type==fs.Text?b:null;if(k&&(t.lineWrapping||v.widgetLineBreaks)&&(k=qj(t,r,1,k)),O&&(t.lineWrapping||b.widgetLineBreaks)&&(O=qj(t,s,-1,O)),k&&O&&k.from==O.from&&k.to==O.to)return T(A(n.from,n.to,k));{let D=k?A(n.from,null,k):_(v,!1),E=O?A(null,n.to,O):_(b,!0),R=[];return(k||v).to<(O||b).from-(k&&O?1:0)||v.widgetLineBreaks>1&&D.bottom+t.defaultLineHeight/2V&&W.from=$)break;z>J&&U(Math.max(ce,J),D==null&&ce<=V,Math.min(z,$),E==null&&z>=de,ne.dir)}if(J=ae.to+1,J>=$)break}return L.length==0&&U(V,D==null,de,E==null,t.textDirection),{top:Q,bottom:F,horizontal:L}}function _(D,E){let R=c.top+(E?D.top:D.bottom);return{top:R,bottom:R,horizontal:[]}}}function QW(t,e){return t.constructor==e.constructor&&t.eq(e)}class $W{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(eg)!=e.state.facet(eg)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(eg);for(;n!QW(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of e)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=e,Fe.safari&&Fe.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const eg=He.define();function LM(t){return[lr.define(e=>new $W(e,t)),eg.of(t)]}const bf=He.define({combine(t){return Oa(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function HW(t={}){return[bf.of(t),UW,VW,WW,uM.of(!0)]}function IM(t){return t.startState.facet(bf)!=t.state.facet(bf)}const UW=LM({above:!0,markers(t){let{state:e}=t,n=e.facet(bf),r=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||n.drawRangeCursor){let l=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",c=s.empty?s:Ce.cursor(s.head,s.head>s.anchor?-1:1);for(let d of c0.forRange(t,l,c))r.push(d)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=IM(t);return n&&Fj(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){Fj(e.state,t)},class:"cm-cursorLayer"});function Fj(t,e){e.style.animationDuration=t.facet(bf).cursorBlinkRate+"ms"}const VW=LM({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:c0.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||IM(t)},class:"cm-selectionLayer"}),WW=No.highest(qe.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),qM=vt.define({map(t,e){return t==null?null:e.mapPos(t)}}),Uh=Br.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(qM)?r.value:n,t)}}),GW=lr.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(Uh);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Uh)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Uh),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Uh)!=t&&this.view.dispatch({effects:qM.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function XW(){return[Uh,GW]}function Qj(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),l=n,c;!i.next().done;l+=i.value.length)if(!i.lineBreak)for(;c=e.exec(i.value);)s(l+c.index,c)}function YW(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:s,to:i}of n)s=Math.max(t.state.doc.lineAt(s).from,s-e),i=Math.min(t.state.doc.lineAt(i).to,i+e),r.length&&r[r.length-1].to>=s?r[r.length-1].to=i:r.push({from:s,to:i});return r}class KW{constructor(e){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:l=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(c,d,h,m)=>s(m,h,h+c[0].length,c,d);else if(typeof r=="function")this.addMatch=(c,d,h,m)=>{let p=r(c,d,h);p&&m(h,h+c[0].length,p)};else if(r)this.addMatch=(c,d,h,m)=>m(h,h+c[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=l}createDeco(e){let n=new ml,r=n.add.bind(n);for(let{from:s,to:i}of YW(e,this.maxLength))Qj(e.state.doc,this.regexp,s,i,(l,c)=>this.addMatch(c,e,l,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,l,c,d)=>{d>=e.view.viewport.from&&c<=e.view.viewport.to&&(r=Math.min(c,r),s=Math.max(d,s))}),e.viewportMoved||s-r>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,n.map(e.changes),r,s):n}updateRange(e,n,r,s){for(let i of e.visibleRanges){let l=Math.max(i.from,r),c=Math.min(i.to,s);if(c>=l){let d=e.state.doc.lineAt(l),h=d.tod.from;l--)if(this.boundary.test(d.text[l-1-d.from])){m=l;break}for(;cx.push(j.range(k,O));if(d==h)for(this.regexp.lastIndex=m-d.from;(v=this.regexp.exec(d.text))&&v.indexthis.addMatch(O,e,k,b));n=n.update({filterFrom:m,filterTo:p,filter:(k,O)=>kp,add:x})}}return n}}const W2=/x/.unicode!=null?"gu":"g",ZW=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,W2),JW={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Py=null;function eG(){var t;if(Py==null&&typeof document<"u"&&document.body){let e=document.body.style;Py=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Py||!1}const tg=He.define({combine(t){let e=Oa(t,{render:null,specialChars:ZW,addSpecialChars:null});return(e.replaceTabs=!eG())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,W2)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,W2)),e}});function tG(t={}){return[tg.of(t),nG()]}let $j=null;function nG(){return $j||($j=lr.fromClass(class{constructor(t){this.view=t,this.decorations=Je.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(tg)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new KW({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=As(e[0],0);if(i==9){let l=s.lineAt(r),c=n.state.tabSize,d=Td(l.text,c,r-l.from);return Je.replace({widget:new aG((c-d%c)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=Je.replace({widget:new iG(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(tg);t.startState.facet(tg)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const rG="•";function sG(t){return t>=32?rG:t==10?"␤":String.fromCharCode(9216+t)}class iG extends ja{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=sG(this.code),r=e.state.phrase("Control character")+" "+(JW[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,n);if(s)return s;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class aG extends ja{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function lG(){return cG}const oG=Je.line({class:"cm-activeLine"}),cG=lr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let s=t.lineBlockAt(r.head);s.from>e&&(n.push(oG.range(s.from)),e=s.from)}return Je.set(n)}},{decorations:t=>t.decorations});class uG extends ja{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?ud(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),s=s0(n[0],r.direction!="rtl"),i=parseInt(r.lineHeight);return s.bottom-s.top>i*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+i}:s}ignoreEvent(){return!1}}function dG(t){let e=lr.fromClass(class{constructor(n){this.view=n,this.placeholder=t?Je.set([Je.widget({widget:new uG(t),side:1}).range(0)]):Je.none}get decorations(){return this.view.state.doc.length?Je.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,qe.contentAttributes.of({"aria-placeholder":t})]:e}const G2=2e3;function hG(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>G2||n.off>G2||e.col<0||n.col<0){let l=Math.min(e.off,n.off),c=Math.max(e.off,n.off);for(let d=r;d<=s;d++){let h=t.doc.line(d);h.length<=c&&i.push(Ce.range(h.from+l,h.to+c))}}else{let l=Math.min(e.col,n.col),c=Math.max(e.col,n.col);for(let d=r;d<=s;d++){let h=t.doc.line(d),m=j2(h.text,l,t.tabSize,!0);if(m<0)i.push(Ce.cursor(h.to));else{let p=j2(h.text,c,t.tabSize);i.push(Ce.range(h.from+m,h.from+p))}}}return i}function fG(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function Hj(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),s=n-r.from,i=s>G2?-1:s==r.length?fG(t,e.clientX):Td(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function mG(t,e){let n=Hj(t,e),r=t.state.selection;return n?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(n.line).from),l=s.state.doc.lineAt(i);n={line:l.number,col:n.col,off:Math.min(n.off,l.length)},r=r.map(s.changes)}},get(s,i,l){let c=Hj(t,s);if(!c)return r;let d=hG(t.state,n,c);return d.length?l?Ce.create(d.concat(r.ranges)):Ce.create(d):r}}:null}function pG(t){let e=(n=>n.altKey&&n.button==0);return qe.mouseSelectionStyle.of((n,r)=>e(r)?mG(n,r):null)}const gG={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},xG={style:"cursor: crosshair"};function vG(t={}){let[e,n]=gG[t.key||"Alt"],r=lr.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||n(s))},keyup(s){(s.keyCode==e||!n(s))&&this.set(!1)},mousemove(s){this.set(n(s))}}});return[r,qe.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?xG:null})]}const up="-10000px";class FM{constructor(e,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=e.state.facet(n),this.tooltips=this.input.filter(l=>l);let i=null;this.tooltipViews=this.tooltips.map(l=>i=r(l,i))}update(e,n){var r;let s=e.state.facet(this.facet),i=s.filter(d=>d);if(s===this.input){for(let d of this.tooltipViews)d.update&&d.update(e);return!1}let l=[],c=n?[]:null;for(let d=0;dn[h]=d),n.length=c.length),this.input=s,this.tooltips=i,this.tooltipViews=l,!0}}function yG(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const By=He.define({combine:t=>{var e,n,r;return{position:Fe.ios?"absolute":((e=t.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(s=>s.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||yG}}}),Uj=new WeakMap,_w=lr.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(By);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new FM(t,Dw,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(By);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",n.dom.appendChild(s)}return n.dom.style.position=this.position,n.dom.style.top=up,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(Fe.safari){let l=i.getBoundingClientRect();n=Math.abs(l.top+1e4)>1||Math.abs(l.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=Tw(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,l)=>{let c=this.manager.tooltipViews[l];return c.getCoords?c.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(By).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let c of this.manager.tooltipViews)c.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,l=[];for(let c=0;c=Math.min(n.bottom,r.bottom)||p.rightMath.min(n.right,r.right)+.1)){m.style.top=up;continue}let v=d.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,b=v?7:0,k=x.right-x.left,O=(e=Uj.get(h))!==null&&e!==void 0?e:x.bottom-x.top,j=h.offset||wG,T=this.view.textDirection==Hn.LTR,A=x.width>r.right-r.left?T?r.left:r.right-x.width:T?Math.max(r.left,Math.min(p.left-(v?14:0)+j.x,r.right-k)):Math.min(Math.max(r.left,p.left-k+(v?14:0)-j.x),r.right-k),_=this.above[c];!d.strictSide&&(_?p.top-O-b-j.yr.bottom)&&_==r.bottom-p.bottom>p.top-r.top&&(_=this.above[c]=!_);let D=(_?p.top-r.top:r.bottom-p.bottom)-b;if(DA&&Q.topE&&(E=_?Q.top-O-2-b:Q.bottom+b+2);if(this.position=="absolute"?(m.style.top=(E-t.parent.top)/i+"px",Vj(m,(A-t.parent.left)/s)):(m.style.top=E/i+"px",Vj(m,A/s)),v){let Q=p.left+(T?j.x:-j.x)-(A+14-7);v.style.left=Q/s+"px"}h.overlap!==!0&&l.push({left:A,top:E,right:R,bottom:E+O}),m.classList.toggle("cm-tooltip-above",_),m.classList.toggle("cm-tooltip-below",!_),h.positioned&&h.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=up}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Vj(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const bG=qe.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),wG={x:0,y:0},Dw=He.define({enables:[_w,bG]}),Ag=He.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Ox{static create(e){return new Ox(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new FM(e,Ag,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let s=r[e];if(s!==void 0){if(n===void 0)n=s;else if(n!==s)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const SG=Dw.compute([Ag],t=>{let e=t.facet(Ag);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:Ox.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class kG{constructor(e,n,r,s,i){this.view=e,this.source=n,this.field=r,this.setHover=s,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;ec.bottom||n.xc.right+e.defaultCharacterWidth)return;let d=e.bidiSpans(e.state.doc.lineAt(s)).find(m=>m.from<=s&&m.to>=s),h=d&&d.dir==Hn.RTL?-1:1;i=n.x{this.pending==c&&(this.pending=null,d&&!(Array.isArray(d)&&!d.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(d)?d:[d])}))},d=>_s(e.state,d,"hover tooltip"))}else l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])})}get tooltip(){let e=this.view.plugin(_w),n=e?e.manager.tooltips.findIndex(r=>r.create==Ox.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:i}=this;if(s.length&&i&&!OG(i.dom,e)||this.pending){let{pos:l}=s[0]||this.pending,c=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:l;(l==c?this.view.posAtCoords(this.lastMove)!=l:!jG(this.view,l,c,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const dp=4;function OG(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),l;if(l=t.querySelector(".cm-tooltip-arrow")){let c=l.getBoundingClientRect();s=Math.min(c.top,s),i=Math.max(c.bottom,i)}return e.clientX>=n-dp&&e.clientX<=r+dp&&e.clientY>=s-dp&&e.clientY<=i+dp}function jG(t,e,n,r,s,i){let l=t.scrollDOM.getBoundingClientRect(),c=t.documentTop+t.documentPadding.top+t.contentHeight;if(l.left>r||l.rights||Math.min(l.bottom,c)=e&&d<=n}function NG(t,e={}){let n=vt.define(),r=Br.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(l=>!e.hideOn(i,l))),i.docChanged)){let l=[];for(let c of s){let d=i.changes.mapPos(c.pos,-1,Ur.TrackDel);if(d!=null){let h=Object.assign(Object.create(null),c);h.pos=d,h.end!=null&&(h.end=i.changes.mapPos(h.end)),l.push(h)}}s=l}for(let l of i.effects)l.is(n)&&(s=l.value),l.is(CG)&&(s=[]);return s},provide:s=>Ag.from(s)});return{active:r,extension:[r,lr.define(s=>new kG(s,t,r,n,e.hoverTime||300)),SG]}}function QM(t,e){let n=t.plugin(_w);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const CG=vt.define(),Wj=He.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function wf(t,e){let n=t.plugin($M),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const $M=lr.fromClass(class{constructor(t){this.input=t.state.facet(Sf),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(Wj);this.top=new hp(t,!0,e.topContainer),this.bottom=new hp(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(Wj);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new hp(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new hp(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Sf);if(n!=this.input){let r=n.filter(d=>d),s=[],i=[],l=[],c=[];for(let d of r){let h=this.specs.indexOf(d),m;h<0?(m=d(t.view),c.push(m)):(m=this.panels[h],m.update&&m.update(t)),s.push(m),(m.top?i:l).push(m)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(l);for(let d of c)d.dom.classList.add("cm-panel"),d.mount&&d.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>qe.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class hp{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=Gj(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=Gj(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Gj(t){let e=t.nextSibling;return t.remove(),e}const Sf=He.define({enables:$M});class gl extends yc{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}gl.prototype.elementClass="";gl.prototype.toDOM=void 0;gl.prototype.mapMode=Ur.TrackBefore;gl.prototype.startSide=gl.prototype.endSide=-1;gl.prototype.point=!0;const ng=He.define(),TG=He.define(),AG={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Yt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},rf=He.define();function MG(t){return[HM(),rf.of({...AG,...t})]}const Xj=He.define({combine:t=>t.some(e=>e)});function HM(t){return[EG]}const EG=lr.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(rf).map(e=>new Kj(t,e)),this.fixed=!t.state.facet(Xj);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Xj)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=Yt.iter(this.view.state.facet(ng),this.view.viewport.from),r=[],s=this.gutters.map(i=>new _G(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let l=!0;for(let c of i.type)if(c.type==fs.Text&&l){X2(n,r,c.from);for(let d of s)d.line(this.view,c,r);l=!1}else if(c.widget)for(let d of s)d.widget(this.view,c)}else if(i.type==fs.Text){X2(n,r,i.from);for(let l of s)l.line(this.view,i,r)}else if(i.widget)for(let l of s)l.widget(this.view,i);for(let i of s)i.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(rf),n=t.state.facet(rf),r=t.docChanged||t.heightChanged||t.viewportChanged||!Yt.eq(t.startState.facet(ng),t.state.facet(ng),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let i of n){let l=e.indexOf(i);l<0?s.push(new Kj(this.view,i)):(this.gutters[l].update(t),s.push(this.gutters[l]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>qe.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,s=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Hn.LTR?{left:r,right:s}:{right:r,left:s}})});function Yj(t){return Array.isArray(t)?t:[t]}function X2(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class _G{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Yt.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,i=(n.top-this.height)/e.scaleY,l=n.height/e.scaleY;if(this.i==s.elements.length){let c=new UM(e,l,i,r);s.elements.push(c),s.dom.appendChild(c.dom)}else s.elements[this.i].update(e,l,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];X2(this.cursor,s,n.from),r.length&&(s=s.concat(r));let i=this.gutter.config.lineMarker(e,n,s);i&&s.unshift(i);let l=this.gutter;s.length==0&&!l.config.renderEmptyElements||this.addElement(e,n,s)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),s=r?[r]:null;for(let i of e.state.facet(TG)){let l=i(e,n.widget,n);l&&(s||(s=[])).push(l)}s&&this.addElement(e,n,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class Kj{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let i=s.target,l;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let d=i.getBoundingClientRect();l=(d.top+d.bottom)/2}else l=s.clientY;let c=e.lineBlockAtHeight(l-e.documentTop);n.domEventHandlers[r](e,c,s)&&s.preventDefault()});this.markers=Yj(n.markers(e)),n.initialSpacer&&(this.spacer=new UM(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=Yj(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let r=e.view.viewport;return!Yt.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class UM{constructor(e,n,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,s)}update(e,n,r,s){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),DG(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,l=0;;){let c=l,d=ii(c,d,h)||l(c,d,h):l}return r}})}});class Ly extends gl{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Iy(t,e){return t.state.facet(Qu).formatNumber(e,t.state)}const PG=rf.compute([Qu],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(RG)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new Ly(Iy(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(zG)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Qu)!=e.state.facet(Qu),initialSpacer(e){return new Ly(Iy(e,Zj(e.state.doc.lines)))},updateSpacer(e,n){let r=Iy(n.view,Zj(n.view.state.doc.lines));return r==e.number?e:new Ly(r)},domEventHandlers:t.facet(Qu).domEventHandlers,side:"before"}));function BG(t={}){return[Qu.of(t),HM(),PG]}function Zj(t){let e=9;for(;e{let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>n&&(n=s,e.push(LG.range(s)))}return Yt.of(e)});function qG(){return IG}const VM=1024;let FG=0;class qy{constructor(e,n){this.from=e,this.to=n}}class Et{constructor(e={}){this.id=FG++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=gs.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Et.closedBy=new Et({deserialize:t=>t.split(" ")});Et.openedBy=new Et({deserialize:t=>t.split(" ")});Et.group=new Et({deserialize:t=>t.split(" ")});Et.isolate=new Et({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Et.contextHash=new Et({perNode:!0});Et.lookAhead=new Et({perNode:!0});Et.mounted=new Et({perNode:!0});class Mg{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[Et.mounted.id]}}const QG=Object.create(null);class gs{constructor(e,n,r,s=0){this.name=e,this.props=n,this.id=r,this.flags=s}static define(e){let n=e.props&&e.props.length?Object.create(null):QG,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new gs(e.name||"",n,e.id,r);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(s)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Et.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let s of r.split(" "))n[s]=e[r];return r=>{for(let s=r.prop(Et.group),i=-1;i<(s?s.length:0);i++){let l=n[i<0?r.name:s[i]];if(l)return l}}}}gs.none=new gs("",Object.create(null),0,8);class jx{constructor(e){this.types=e;for(let n=0;n0;for(let d=this.cursor(l|Or.IncludeAnonymous);;){let h=!1;if(d.from<=i&&d.to>=s&&(!c&&d.type.isAnonymous||n(d)!==!1)){if(d.firstChild())continue;h=!0}for(;h&&r&&(c||!d.type.isAnonymous)&&r(d),!d.nextSibling();){if(!d.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Pw(gs.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new Dn(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new Dn(gs.none,n,r,s)))}static build(e){return VG(e)}}Dn.empty=new Dn(gs.none,[],[],0);class Rw{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Rw(this.buffer,this.index)}}class go{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return gs.none}toString(){let e=[];for(let n=0;n0));d=l[d+3]);return c}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),l=0;for(let c=e,d=0;c=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function kf(t,e,n,r){for(var s;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?c.length:-1;e!=h;e+=n){let m=c[e],p=d[e]+l.from;if(WM(s,r,p,p+m.length)){if(m instanceof go){if(i&Or.ExcludeBuffers)continue;let x=m.findChild(0,m.buffer.length,n,r-p,s);if(x>-1)return new ha(new $G(l,m,e,p),null,x)}else if(i&Or.IncludeAnonymous||!m.type.isAnonymous||zw(m)){let x;if(!(i&Or.IgnoreMounts)&&(x=Mg.get(m))&&!x.overlay)return new Ps(x.tree,p,e,l);let v=new Ps(m,p,e,l);return i&Or.IncludeAnonymous||!v.type.isAnonymous?v:v.nextChild(n<0?m.children.length-1:0,n,r,s)}}}if(i&Or.IncludeAnonymous||!l.type.isAnonymous||(l.index>=0?e=l.index+n:e=n<0?-1:l._parent._tree.children.length,l=l._parent,!l))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let s;if(!(r&Or.IgnoreOverlays)&&(s=Mg.get(this._tree))&&s.overlay){let i=e-this.from;for(let{from:l,to:c}of s.overlay)if((n>0?l<=i:l=i:c>i))return new Ps(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function e7(t,e,n,r){let s=t.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let l=!1;!l;)if(l=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(e)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function Y2(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class $G{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class ha extends GM{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.context.start,r);return i<0?null:new ha(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&Or.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return i<0?null:new ha(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new ha(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new ha(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let l=r.buffer[this.index+1];e.push(r.slice(s,i,l)),n.push(0)}return new Dn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function XM(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;in.from||l.to=e){let c=new Ps(l.tree,l.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(kf(c,e,n,!1))}}return s?XM(s):r}class K2{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ps)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof Ps?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Or.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Or.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Or.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let i=n+e,l=e<0?-1:r._tree.children.length;i!=l;i+=e){let c=r._tree.children[i];if(this.mode&Or.IncludeAnonymous||c instanceof go||!c.type.isAnonymous||zw(c))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let l=e;l;l=l._parent)if(l.index==s){if(s==this.index)return l;n=l,r=i+1;break e}s=this.stack[--i]}for(let s=r;s=0;i--){if(i<0)return Y2(this._tree,e,s);let l=r[n.buffer[this.stack[i]]];if(!l.isAnonymous){if(e[s]&&e[s]!=l.name)return!1;s--}}return!0}}function zw(t){return t.children.some(e=>e instanceof go||!e.type.isAnonymous||zw(e))}function VG(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=VM,reused:i=[],minRepeatType:l=r.types.length}=t,c=Array.isArray(n)?new Rw(n,n.length):n,d=r.types,h=0,m=0;function p(D,E,R,Q,F,L){let{id:U,start:V,end:de,size:W}=c,J=m,$=h;if(W<0)if(c.next(),W==-1){let xe=i[U];R.push(xe),Q.push(V-D);return}else if(W==-3){h=U;return}else if(W==-4){m=U;return}else throw new RangeError(`Unrecognized record size: ${W}`);let ae=d[U],ne,ce,z=V-D;if(de-V<=s&&(ce=O(c.pos-E,F))){let xe=new Uint16Array(ce.size-ce.skip),Y=c.pos-ce.size,P=xe.length;for(;c.pos>Y;)P=j(ce.start,xe,P);ne=new go(xe,de-ce.start,r),z=ce.start-D}else{let xe=c.pos-W;c.next();let Y=[],P=[],K=U>=l?U:-1,H=0,fe=de;for(;c.pos>xe;)K>=0&&c.id==K&&c.size>=0?(c.end<=fe-s&&(b(Y,P,V,H,c.end,fe,K,J,$),H=Y.length,fe=c.end),c.next()):L>2500?x(V,xe,Y,P):p(V,xe,Y,P,K,L+1);if(K>=0&&H>0&&H-1&&H>0){let ve=v(ae,$);ne=Pw(ae,Y,P,0,Y.length,0,de-V,ve,ve)}else ne=k(ae,Y,P,de-V,J-de,$)}R.push(ne),Q.push(z)}function x(D,E,R,Q){let F=[],L=0,U=-1;for(;c.pos>E;){let{id:V,start:de,end:W,size:J}=c;if(J>4)c.next();else{if(U>-1&&de=0;W-=3)V[J++]=F[W],V[J++]=F[W+1]-de,V[J++]=F[W+2]-de,V[J++]=J;R.push(new go(V,F[2]-de,r)),Q.push(de-D)}}function v(D,E){return(R,Q,F)=>{let L=0,U=R.length-1,V,de;if(U>=0&&(V=R[U])instanceof Dn){if(!U&&V.type==D&&V.length==F)return V;(de=V.prop(Et.lookAhead))&&(L=Q[U]+V.length+de)}return k(D,R,Q,F,L,E)}}function b(D,E,R,Q,F,L,U,V,de){let W=[],J=[];for(;D.length>Q;)W.push(D.pop()),J.push(E.pop()+R-F);D.push(k(r.types[U],W,J,L-F,V-L,de)),E.push(F-R)}function k(D,E,R,Q,F,L,U){if(L){let V=[Et.contextHash,L];U=U?[V].concat(U):[V]}if(F>25){let V=[Et.lookAhead,F];U=U?[V].concat(U):[V]}return new Dn(D,E,R,Q,U)}function O(D,E){let R=c.fork(),Q=0,F=0,L=0,U=R.end-s,V={size:0,start:0,skip:0};e:for(let de=R.pos-D;R.pos>de;){let W=R.size;if(R.id==E&&W>=0){V.size=Q,V.start=F,V.skip=L,L+=4,Q+=4,R.next();continue}let J=R.pos-W;if(W<0||J=l?4:0,ae=R.start;for(R.next();R.pos>J;){if(R.size<0)if(R.size==-3)$+=4;else break e;else R.id>=l&&($+=4);R.next()}F=ae,Q+=W,L+=$}return(E<0||Q==D)&&(V.size=Q,V.start=F,V.skip=L),V.size>4?V:void 0}function j(D,E,R){let{id:Q,start:F,end:L,size:U}=c;if(c.next(),U>=0&&Q4){let de=c.pos-(U-4);for(;c.pos>de;)R=j(D,E,R)}E[--R]=V,E[--R]=L-D,E[--R]=F-D,E[--R]=Q}else U==-3?h=Q:U==-4&&(m=Q);return R}let T=[],A=[];for(;c.pos>0;)p(t.start||0,t.bufferStart||0,T,A,-1,0);let _=(e=t.length)!==null&&e!==void 0?e:T.length?A[0]+T[0].length:0;return new Dn(d[t.topID],T.reverse(),A.reverse(),_)}const t7=new WeakMap;function rg(t,e){if(!t.isAnonymous||e instanceof go||e.type!=t)return 1;let n=t7.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Dn)){n=1;break}n+=rg(t,r)}t7.set(e,n)}return n}function Pw(t,e,n,r,s,i,l,c,d){let h=0;for(let b=r;b=m)break;E+=R}if(A==_+1){if(E>m){let R=b[_];v(R.children,R.positions,0,R.children.length,k[_]+T);continue}p.push(b[_])}else{let R=k[A-1]+b[A-1].length-D;p.push(Pw(t,b,k,_,A,D,R,null,d))}x.push(D+T-i)}}return v(e,n,r,s,0),(c||d)(p,x,l)}class WG{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof ha?this.setBuffer(e.context.buffer,e.index,n):e instanceof Ps&&this.map.set(e.tree,n)}get(e){return e instanceof ha?this.getBuffer(e.context.buffer,e.index):e instanceof Ps?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class pc{constructor(e,n,r,s,i=!1,l=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(l?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let s=[new pc(0,e.length,e,0,!1,r)];for(let i of n)i.to>e.length&&s.push(i);return s}static applyChanges(e,n,r=128){if(!n.length)return e;let s=[],i=1,l=e.length?e[0]:null;for(let c=0,d=0,h=0;;c++){let m=c=r)for(;l&&l.from=x.from||p<=x.to||h){let v=Math.max(x.from,d)-h,b=Math.min(x.to,p)-h;x=v>=b?null:new pc(v,b,x.tree,x.offset+h,c>0,!!m)}if(x&&s.push(x),l.to>p)break;l=inew qy(s.from,s.to)):[new qy(0,0)]:[new qy(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let s=this.startParse(e,n,r);for(;;){let i=s.advance();if(i)return i}}};class GG{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new Et({perNode:!0});let XG=0;class yi{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=XG++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof yi&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new yi(r,[],null,[]);if(s.set.push(s),n)for(let i of n.set)s.set.push(i);return s}static defineModifier(e){let n=new Eg(e);return r=>r.modified.indexOf(n)>-1?r:Eg.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let YG=0;class Eg{constructor(e){this.name=e,this.instances=[],this.id=YG++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(c=>c.base==e&&KG(n,c.modified));if(r)return r;let s=[],i=new yi(e.name,s,e,n);for(let c of n)c.instances.push(i);let l=ZG(n);for(let c of e.set)if(!c.modified.length)for(let d of l)s.push(Eg.get(c,d));return i}}function KG(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function ZG(t){let e=[[]];for(let n=0;nr.length-n.length)}function Lw(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],l=2,c=s;for(let p=0;;){if(c=="..."&&p>0&&p+3==s.length){l=1;break}let x=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(c);if(!x)throw new RangeError("Invalid path: "+s);if(i.push(x[0]=="*"?"":x[0][0]=='"'?JSON.parse(x[0]):x[0]),p+=x[0].length,p==s.length)break;let v=s[p++];if(p==s.length&&v=="!"){l=0;break}if(v!="/")throw new RangeError("Invalid path: "+s);c=s.slice(p)}let d=i.length-1,h=i[d];if(!h)throw new RangeError("Invalid path: "+s);let m=new Of(r,l,d>0?i.slice(0,d):null);e[h]=m.sort(e[h])}}return YM.add(e)}const YM=new Et({combine(t,e){let n,r,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let i=new Of(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class Of{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let l=s;for(let c of i)for(let d of c.set){let h=n[d.id];if(h){l=l?l+" "+h:h;break}}return l},scope:r}}function JG(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function eX(t,e,n,r=0,s=t.length){let i=new tX(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class tX{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,s,i){let{type:l,from:c,to:d}=e;if(c>=r||d<=n)return;l.isTop&&(i=this.highlighters.filter(v=>!v.scope||v.scope(l)));let h=s,m=nX(e)||Of.empty,p=JG(i,m.tags);if(p&&(h&&(h+=" "),h+=p,m.mode==1&&(s+=(s?" ":"")+p)),this.startSpan(Math.max(n,c),h),m.opaque)return;let x=e.tree&&e.tree.prop(Et.mounted);if(x&&x.overlay){let v=e.node.enter(x.overlay[0].from+c,1),b=this.highlighters.filter(O=>!O.scope||O.scope(x.tree.type)),k=e.firstChild();for(let O=0,j=c;;O++){let T=O=A||!e.nextSibling())););if(!T||A>r)break;j=T.to+c,j>n&&(this.highlightRange(v.cursor(),Math.max(n,T.from+c),Math.min(r,j),"",b),this.startSpan(Math.min(r,j),h))}k&&e.parent()}else if(e.firstChild()){x&&(s="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,s,i),this.startSpan(Math.min(r,e.to),h)}while(e.nextSibling());e.parent()}}}function nX(t){let e=t.type.prop(YM);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ie=yi.define,mp=Ie(),eo=Ie(),n7=Ie(eo),r7=Ie(eo),to=Ie(),pp=Ie(to),Fy=Ie(to),sa=Ie(),Zo=Ie(sa),na=Ie(),ra=Ie(),Z2=Ie(),Rh=Ie(Z2),gp=Ie(),he={comment:mp,lineComment:Ie(mp),blockComment:Ie(mp),docComment:Ie(mp),name:eo,variableName:Ie(eo),typeName:n7,tagName:Ie(n7),propertyName:r7,attributeName:Ie(r7),className:Ie(eo),labelName:Ie(eo),namespace:Ie(eo),macroName:Ie(eo),literal:to,string:pp,docString:Ie(pp),character:Ie(pp),attributeValue:Ie(pp),number:Fy,integer:Ie(Fy),float:Ie(Fy),bool:Ie(to),regexp:Ie(to),escape:Ie(to),color:Ie(to),url:Ie(to),keyword:na,self:Ie(na),null:Ie(na),atom:Ie(na),unit:Ie(na),modifier:Ie(na),operatorKeyword:Ie(na),controlKeyword:Ie(na),definitionKeyword:Ie(na),moduleKeyword:Ie(na),operator:ra,derefOperator:Ie(ra),arithmeticOperator:Ie(ra),logicOperator:Ie(ra),bitwiseOperator:Ie(ra),compareOperator:Ie(ra),updateOperator:Ie(ra),definitionOperator:Ie(ra),typeOperator:Ie(ra),controlOperator:Ie(ra),punctuation:Z2,separator:Ie(Z2),bracket:Rh,angleBracket:Ie(Rh),squareBracket:Ie(Rh),paren:Ie(Rh),brace:Ie(Rh),content:sa,heading:Zo,heading1:Ie(Zo),heading2:Ie(Zo),heading3:Ie(Zo),heading4:Ie(Zo),heading5:Ie(Zo),heading6:Ie(Zo),contentSeparator:Ie(sa),list:Ie(sa),quote:Ie(sa),emphasis:Ie(sa),strong:Ie(sa),link:Ie(sa),monospace:Ie(sa),strikethrough:Ie(sa),inserted:Ie(),deleted:Ie(),changed:Ie(),invalid:Ie(),meta:gp,documentMeta:Ie(gp),annotation:Ie(gp),processingInstruction:Ie(gp),definition:yi.defineModifier("definition"),constant:yi.defineModifier("constant"),function:yi.defineModifier("function"),standard:yi.defineModifier("standard"),local:yi.defineModifier("local"),special:yi.defineModifier("special")};for(let t in he){let e=he[t];e instanceof yi&&(e.name=t)}KM([{tag:he.link,class:"tok-link"},{tag:he.heading,class:"tok-heading"},{tag:he.emphasis,class:"tok-emphasis"},{tag:he.strong,class:"tok-strong"},{tag:he.keyword,class:"tok-keyword"},{tag:he.atom,class:"tok-atom"},{tag:he.bool,class:"tok-bool"},{tag:he.url,class:"tok-url"},{tag:he.labelName,class:"tok-labelName"},{tag:he.inserted,class:"tok-inserted"},{tag:he.deleted,class:"tok-deleted"},{tag:he.literal,class:"tok-literal"},{tag:he.string,class:"tok-string"},{tag:he.number,class:"tok-number"},{tag:[he.regexp,he.escape,he.special(he.string)],class:"tok-string2"},{tag:he.variableName,class:"tok-variableName"},{tag:he.local(he.variableName),class:"tok-variableName tok-local"},{tag:he.definition(he.variableName),class:"tok-variableName tok-definition"},{tag:he.special(he.variableName),class:"tok-variableName2"},{tag:he.definition(he.propertyName),class:"tok-propertyName tok-definition"},{tag:he.typeName,class:"tok-typeName"},{tag:he.namespace,class:"tok-namespace"},{tag:he.className,class:"tok-className"},{tag:he.macroName,class:"tok-macroName"},{tag:he.propertyName,class:"tok-propertyName"},{tag:he.operator,class:"tok-operator"},{tag:he.comment,class:"tok-comment"},{tag:he.meta,class:"tok-meta"},{tag:he.invalid,class:"tok-invalid"},{tag:he.punctuation,class:"tok-punctuation"}]);var Qy;const oc=new Et;function ZM(t){return He.define({combine:t?e=>e.concat(t):void 0})}const rX=new Et;class wi{constructor(e,n,r=[],s=""){this.data=e,this.name=s,Vt.prototype.hasOwnProperty("tree")||Object.defineProperty(Vt.prototype,"tree",{get(){return zr(this)}}),this.parser=n,this.extension=[xo.of(this),Vt.languageData.of((i,l,c)=>{let d=s7(i,l,c),h=d.type.prop(oc);if(!h)return[];let m=i.facet(h),p=d.type.prop(rX);if(p){let x=d.resolve(l-d.from,c);for(let v of p)if(v.test(x,i)){let b=i.facet(v.facet);return v.type=="replace"?b:b.concat(m)}}return m})].concat(r)}isActiveAt(e,n,r=-1){return s7(e,n,r).type.prop(oc)==this.data}findRegions(e){let n=e.facet(xo);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,l)=>{if(i.prop(oc)==this.data){r.push({from:l,to:l+i.length});return}let c=i.prop(Et.mounted);if(c){if(c.tree.prop(oc)==this.data){if(c.overlay)for(let d of c.overlay)r.push({from:d.from+l,to:d.to+l});else r.push({from:l,to:l+i.length});return}else if(c.overlay){let d=r.length;if(s(c.tree,c.overlay[0].from+l),r.length>d)return}}for(let d=0;dr.isTop?n:void 0)]}),e.name)}configure(e,n){return new jf(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function zr(t){let e=t.field(wi.state,!1);return e?e.tree:Dn.empty}class sX{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let zh=null;class md{constructor(e,n,r=[],s,i,l,c,d){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=l,this.skipped=c,this.scheduleOn=d,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new md(e,n,[],Dn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new sX(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Dn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(pc.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=zh;zh=this;try{return e()}finally{zh=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=i7(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:l,skipped:c}=this;if(this.takeTree(),!e.empty){let d=[];if(e.iterChangedRanges((h,m,p,x)=>d.push({fromA:h,toA:m,fromB:p,toB:x})),r=pc.applyChanges(r,d),s=Dn.empty,i=0,l={from:e.mapPos(l.from,-1),to:e.mapPos(l.to,1)},this.skipped.length){c=[];for(let h of this.skipped){let m=e.mapPos(h.from,1),p=e.mapPos(h.to,-1);me.from&&(this.fragments=i7(this.fragments,s,i),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends Bw{createParse(n,r,s){let i=s[0].from,l=s[s.length-1].to;return{parsedPos:i,advance(){let d=zh;if(d){for(let h of s)d.tempSkipped.push(h);e&&(d.scheduleOn=d.scheduleOn?Promise.all([d.scheduleOn,e]):e)}return this.parsedPos=l,new Dn(gs.none,[],[],l-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return zh}}function i7(t,e,n){return pc.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class pd{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new pd(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=md.create(e.facet(xo).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new pd(r)}}wi.state=Br.define({create:pd.init,update(t,e){for(let n of e.effects)if(n.is(wi.setState))return n.value;return e.startState.facet(xo)!=e.state.facet(xo)?pd.init(e.state):t.apply(e)}});let JM=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(JM=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const $y=typeof navigator<"u"&&(!((Qy=navigator.scheduling)===null||Qy===void 0)&&Qy.isInputPending)?()=>navigator.scheduling.isInputPending():null,iX=lr.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(wi.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(wi.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=JM(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnds+1e3,d=i.context.work(()=>$y&&$y()||Date.now()>l,s+(c?0:1e5));this.chunkBudget-=Date.now()-n,(d||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:wi.setState.of(new pd(i.context))})),this.chunkBudget>0&&!(d&&!c)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>_s(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),xo=He.define({combine(t){return t.length?t[0]:null},enables:t=>[wi.state,iX,qe.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class eE{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const aX=He.define(),u0=He.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function kc(t){let e=t.facet(u0);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Nf(t,e){let n="",r=t.tabSize,s=t.facet(u0)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i=e?lX(t,n,e):null}class Nx{constructor(e,n={}){this.state=e,this.options=n,this.unit=kc(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==e?{text:"",from:e}:(n<0?s-1&&(i+=l-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return Td(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let l=i(s);if(l>-1)return l}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Cx=new Et;function lX(t,e,n){let r=e.resolveStack(n),s=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let l=s;l&&!(l.fromr.node.to||l.from==r.node.from&&l.type==r.node.type);l=l.parent)i.push(l);for(let l=i.length-1;l>=0;l--)r={node:i[l],next:r}}return tE(r,t,n)}function tE(t,e,n){for(let r=t;r;r=r.next){let s=cX(r.node);if(s)return s(qw.create(e,n,r))}return 0}function oX(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function cX(t){let e=t.type.prop(Cx);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Et.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return l=>nE(l,!0,1,void 0,i&&!oX(l)?s.from:void 0)}return t.parent==null?uX:null}function uX(){return 0}class qw extends Nx{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new qw(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(dX(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return tE(this.context.next,this.base,this.pos)}}function dX(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function hX(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let s=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),l=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let c=n.to;;){let d=e.childAfter(c);if(!d||d==r)return null;if(!d.type.isSkipped){if(d.from>=l)return null;let h=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+h}}c=d.to}}function Hy({closing:t,align:e=!0,units:n=1}){return r=>nE(r,e,n,t)}function nE(t,e,n,r,s){let i=t.textAfter,l=i.match(/^\s*/)[0].length,c=r&&i.slice(l,l+r.length)==r||s==t.pos+l,d=e?hX(t):null;return d?c?t.column(d.from):t.column(d.to):t.baseIndent+(c?0:t.unit*n)}function a7({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const fX=200;function mX(){return Vt.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,s=n.lineAt(r);if(r>s.from+fX)return t;let i=n.sliceString(s.from,r);if(!e.some(h=>h.test(i)))return t;let{state:l}=t,c=-1,d=[];for(let{head:h}of l.selection.ranges){let m=l.doc.lineAt(h);if(m.from==c)continue;c=m.from;let p=Iw(l,m.from);if(p==null)continue;let x=/^\s*/.exec(m.text)[0],v=Nf(l,p);x!=v&&d.push({from:m.from,to:m.from+x.length,insert:v})}return d.length?[t,{changes:d,sequential:!0}]:t})}const pX=He.define(),Fw=new Et;function rE(t){let e=t.firstChild,n=t.lastChild;return e&&e.ton)continue;if(i&&c.from=e&&h.to>n&&(i=h)}}return i}function xX(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function _g(t,e,n){for(let r of t.facet(pX)){let s=r(t,e,n);if(s)return s}return gX(t,e,n)}function sE(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const Tx=vt.define({map:sE}),d0=vt.define({map:sE});function iE(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const Oc=Br.define({create(){return Je.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=l7(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(Tx)&&!vX(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(oE),s=r?Je.replace({widget:new jX(r(e.state,n.value))}):o7;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(d0)&&(t=t.update({filter:(r,s)=>n.value.from!=r||n.value.to!=s,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=l7(t,e.selection.main.head)),t},provide:t=>qe.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,s)=>{n.push(r,s)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n{se&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(s,i)=>s>=n||i<=e}):t}function Dg(t,e,n){var r;let s=null;return(r=t.field(Oc,!1))===null||r===void 0||r.between(e,n,(i,l)=>{(!s||s.from>i)&&(s={from:i,to:l})}),s}function vX(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function aE(t,e){return t.field(Oc,!1)?e:e.concat(vt.appendConfig.of(cE()))}const yX=t=>{for(let e of iE(t)){let n=_g(t.state,e.from,e.to);if(n)return t.dispatch({effects:aE(t.state,[Tx.of(n),lE(t,n)])}),!0}return!1},bX=t=>{if(!t.state.field(Oc,!1))return!1;let e=[];for(let n of iE(t)){let r=Dg(t.state,n.from,n.to);r&&e.push(d0.of(r),lE(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function lE(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return qe.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const wX=t=>{let{state:e}=t,n=[];for(let r=0;r{let e=t.state.field(Oc,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(d0.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},kX=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:yX},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:bX},{key:"Ctrl-Alt-[",run:wX},{key:"Ctrl-Alt-]",run:SX}],OX={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},oE=He.define({combine(t){return Oa(t,OX)}});function cE(t){return[Oc,TX]}function uE(t,e){let{state:n}=t,r=n.facet(oE),s=l=>{let c=t.lineBlockAt(t.posAtDOM(l.target)),d=Dg(t.state,c.from,c.to);d&&t.dispatch({effects:d0.of(d)}),l.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,s,e);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const o7=Je.replace({widget:new class extends ja{toDOM(t){return uE(t,null)}}});class jX extends ja{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return uE(e,this.value)}}const NX={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Uy extends gl{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function CX(t={}){let e={...NX,...t},n=new Uy(e,!0),r=new Uy(e,!1),s=lr.fromClass(class{constructor(l){this.from=l.viewport.from,this.markers=this.buildMarkers(l)}update(l){(l.docChanged||l.viewportChanged||l.startState.facet(xo)!=l.state.facet(xo)||l.startState.field(Oc,!1)!=l.state.field(Oc,!1)||zr(l.startState)!=zr(l.state)||e.foldingChanged(l))&&(this.markers=this.buildMarkers(l.view))}buildMarkers(l){let c=new ml;for(let d of l.viewportLineBlocks){let h=Dg(l.state,d.from,d.to)?r:_g(l.state,d.from,d.to)?n:null;h&&c.add(d.from,d.from,h)}return c.finish()}}),{domEventHandlers:i}=e;return[s,MG({class:"cm-foldGutter",markers(l){var c;return((c=l.plugin(s))===null||c===void 0?void 0:c.markers)||Yt.empty},initialSpacer(){return new Uy(e,!1)},domEventHandlers:{...i,click:(l,c,d)=>{if(i.click&&i.click(l,c,d))return!0;let h=Dg(l.state,c.from,c.to);if(h)return l.dispatch({effects:d0.of(h)}),!0;let m=_g(l.state,c.from,c.to);return m?(l.dispatch({effects:Tx.of(m)}),!0):!1}}}),cE()]}const TX=qe.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class h0{constructor(e,n){this.specs=e;let r;function s(c){let d=fo.newName();return(r||(r=Object.create(null)))["."+d]=c,d}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,l=n.scope;this.scope=l instanceof wi?c=>c.prop(oc)==l.data:l?c=>c==l:void 0,this.style=KM(e.map(c=>({tag:c.tag,class:c.class||s(Object.assign({},c,{tag:null}))})),{all:i}).style,this.module=r?new fo(r):null,this.themeType=n.themeType}static define(e,n){return new h0(e,n||{})}}const J2=He.define(),dE=He.define({combine(t){return t.length?[t[0]]:null}});function Vy(t){let e=t.facet(J2);return e.length?e:t.facet(dE)}function hE(t,e){let n=[MX],r;return t instanceof h0&&(t.module&&n.push(qe.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(dE.of(t)):r?n.push(J2.computeN([qe.darkTheme],s=>s.facet(qe.darkTheme)==(r=="dark")?[t]:[])):n.push(J2.of(t)),n}class AX{constructor(e){this.markCache=Object.create(null),this.tree=zr(e.state),this.decorations=this.buildDeco(e,Vy(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=zr(e.state),r=Vy(e.state),s=r!=Vy(e.startState),{viewport:i}=e.view,l=e.changes.mapPos(this.decoratedTo,1);n.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=l):(n!=this.tree||e.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return Je.none;let r=new ml;for(let{from:s,to:i}of e.visibleRanges)eX(this.tree,n,(l,c,d)=>{r.add(l,c,this.markCache[d]||(this.markCache[d]=Je.mark({class:d})))},s,i);return r.finish()}}const MX=No.high(lr.fromClass(AX,{decorations:t=>t.decorations})),EX=h0.define([{tag:he.meta,color:"#404740"},{tag:he.link,textDecoration:"underline"},{tag:he.heading,textDecoration:"underline",fontWeight:"bold"},{tag:he.emphasis,fontStyle:"italic"},{tag:he.strong,fontWeight:"bold"},{tag:he.strikethrough,textDecoration:"line-through"},{tag:he.keyword,color:"#708"},{tag:[he.atom,he.bool,he.url,he.contentSeparator,he.labelName],color:"#219"},{tag:[he.literal,he.inserted],color:"#164"},{tag:[he.string,he.deleted],color:"#a11"},{tag:[he.regexp,he.escape,he.special(he.string)],color:"#e40"},{tag:he.definition(he.variableName),color:"#00f"},{tag:he.local(he.variableName),color:"#30a"},{tag:[he.typeName,he.namespace],color:"#085"},{tag:he.className,color:"#167"},{tag:[he.special(he.variableName),he.macroName],color:"#256"},{tag:he.definition(he.propertyName),color:"#00c"},{tag:he.comment,color:"#940"},{tag:he.invalid,color:"#f00"}]),_X=qe.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),fE=1e4,mE="()[]{}",pE=He.define({combine(t){return Oa(t,{afterCursor:!0,brackets:mE,maxScanDistance:fE,renderMatch:zX})}}),DX=Je.mark({class:"cm-matchingBracket"}),RX=Je.mark({class:"cm-nonmatchingBracket"});function zX(t){let e=[],n=t.matched?DX:RX;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const PX=Br.define({create(){return Je.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(pE);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=fa(e.state,s.head,-1,r)||s.head>0&&fa(e.state,s.head-1,1,r)||r.afterCursor&&(fa(e.state,s.head,1,r)||s.headqe.decorations.from(t)}),BX=[PX,_X];function LX(t={}){return[pE.of(t),BX]}const IX=new Et;function e4(t,e,n){let r=t.prop(e<0?Et.openedBy:Et.closedBy);if(r)return r;if(t.name.length==1){let s=n.indexOf(t.name);if(s>-1&&s%2==(e<0?1:0))return[n[s+e]]}return null}function t4(t){let e=t.type.prop(IX);return e?e(t.node):t}function fa(t,e,n,r={}){let s=r.maxScanDistance||fE,i=r.brackets||mE,l=zr(t),c=l.resolveInner(e,n);for(let d=c;d;d=d.parent){let h=e4(d.type,n,i);if(h&&d.from0?e>=m.from&&em.from&&e<=m.to))return qX(t,e,n,d,m,h,i)}}return FX(t,e,n,l,c.type,s,i)}function qX(t,e,n,r,s,i,l){let c=r.parent,d={from:s.from,to:s.to},h=0,m=c?.cursor();if(m&&(n<0?m.childBefore(r.from):m.childAfter(r.to)))do if(n<0?m.to<=r.from:m.from>=r.to){if(h==0&&i.indexOf(m.type.name)>-1&&m.from0)return null;let h={from:n<0?e-1:e,to:n>0?e+1:e},m=t.doc.iterRange(e,n>0?t.doc.length:0),p=0;for(let x=0;!m.next().done&&x<=i;){let v=m.value;n<0&&(x+=v.length);let b=e+x*n;for(let k=n>0?0:v.length-1,O=n>0?v.length:-1;k!=O;k+=n){let j=l.indexOf(v[k]);if(!(j<0||r.resolveInner(b+k,1).type!=s))if(j%2==0==n>0)p++;else{if(p==1)return{start:h,end:{from:b+k,to:b+k+1},matched:j>>1==d>>1};p--}}n>0&&(x+=v.length)}return m.done?{start:h,matched:!1}:null}function c7(t,e,n,r=0,s=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let i=s;for(let l=r;l=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosr?l.toLowerCase():l,i=this.string.substr(this.pos,e.length);return s(i)==s(e)?(n!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&n!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function QX(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||$X,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||Hw,mergeTokens:t.mergeTokens!==!1}}function $X(t){if(typeof t!="object")return t;let e={};for(let n in t){let r=t[n];e[n]=r instanceof Array?r.slice():r}return e}const u7=new WeakMap;class Qw extends wi{constructor(e){let n=ZM(e.languageData),r=QX(e),s,i=new class extends Bw{createParse(l,c,d){return new UX(s,l,c,d)}};super(n,i,[],e.name),this.topNode=GX(n,this),s=this,this.streamParser=r,this.stateAfter=new Et({perNode:!0}),this.tokenTable=e.tokenTable?new bE(r.tokenTable):WX}static define(e){return new Qw(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=u7.get(e.state),n!=null&&n1e4)return null;for(;i=r&&n+e.length<=s&&e.prop(t.stateAfter);if(i)return{state:t.streamParser.copyState(i),pos:n+e.length};for(let l=e.children.length-1;l>=0;l--){let c=e.children[l],d=n+e.positions[l],h=c instanceof Dn&&d=e.length)return e;!s&&n==0&&e.type==t.topNode&&(s=!0);for(let i=e.children.length-1;i>=0;i--){let l=e.positions[i],c=e.children[i],d;if(ln&&$w(t,i.tree,0-i.offset,n,c),h;if(d&&d.pos<=r&&(h=xE(t,i.tree,n+i.offset,d.pos+i.offset,!1)))return{state:d.state,tree:h}}return{state:t.streamParser.startState(s?kc(s):4),tree:Dn.empty}}let UX=class{constructor(e,n,r,s){this.lang=e,this.input=n,this.fragments=r,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let i=md.get(),l=s[0].from,{state:c,tree:d}=HX(e,r,l,this.to,i?.state);this.state=c,this.parsedPos=this.chunkStart=l+d.length;for(let h=0;hh.from<=i.viewport.from&&h.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(kc(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=md.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos=n?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let n=this.input.chunk(e);if(this.input.lineChunks)n==` +`&&(n="");else{let r=n.indexOf(` +`);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let s=this.rangeIndex;;){let i=this.ranges[s].to;if(i>=r||(n=n.slice(0,i-(r-n.length)),s++,s==this.ranges.length))break;let l=this.ranges[s].from,c=this.lineAfter(l);n+=c,r=l+c.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let s=this.ranges[this.rangeIndex].to,i=e+n;if(r>0?s>i:s>=i)break;let l=this.ranges[++this.rangeIndex].from;n+=l-s}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){s=this.skipGapsTo(n,s,1),n+=s;let c=this.chunk.length;s=this.skipGapsTo(r,s,-1),r+=s,i+=this.chunk.length-c}let l=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&l>=0&&this.chunk[l]==e&&this.chunk[l+2]==n?this.chunk[l+2]=r:this.chunk.push(e,n,r,i),s}parseLine(e){let{line:n,end:r}=this.nextLine(),s=0,{streamParser:i}=this.lang,l=new gE(n,e?e.state.tabSize:4,e?kc(e.state):2);if(l.eol())i.blankLine(this.state,l.indentUnit);else for(;!l.eol();){let c=vE(i.token,l,this.state);if(c&&(s=this.emitToken(this.lang.tokenTable.resolve(c),this.parsedPos+l.start,this.parsedPos+l.pos,s)),l.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const Hw=Object.create(null),Cf=[gs.none],VX=new jx(Cf),d7=[],h7=Object.create(null),yE=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])yE[t]=wE(Hw,e);class bE{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),yE)}resolve(e){return e?this.table[e]||(this.table[e]=wE(this.extra,e)):0}}const WX=new bE(Hw);function Wy(t,e){d7.indexOf(t)>-1||(d7.push(t),console.warn(e))}function wE(t,e){let n=[];for(let c of e.split(" ")){let d=[];for(let h of c.split(".")){let m=t[h]||he[h];m?typeof m=="function"?d.length?d=d.map(m):Wy(h,`Modifier ${h} used at start of tag`):d.length?Wy(h,`Tag ${h} used as modifier`):d=Array.isArray(m)?m:[m]:Wy(h,`Unknown highlighting tag ${h}`)}for(let h of d)n.push(h)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(c=>c.id),i=h7[s];if(i)return i.id;let l=h7[s]=gs.define({id:Cf.length,name:r,props:[Lw({[r]:n})]});return Cf.push(l),l.id}function GX(t,e){let n=gs.define({id:Cf.length,name:"Document",props:[oc.add(()=>t),Cx.add(()=>r=>e.getIndent(r))],top:!0});return Cf.push(n),n}Hn.RTL,Hn.LTR;const XX=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Vw(t.state,n.from);return r.line?YX(t):r.block?ZX(t):!1};function Uw(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=t(e,n);return s?(r(n.update(s)),!0):!1}}const YX=Uw(tY,0),KX=Uw(SE,0),ZX=Uw((t,e)=>SE(t,e,eY(e)),0);function Vw(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Ph=50;function JX(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-Ph,r),l=t.sliceDoc(s,s+Ph),c=/\s*$/.exec(i)[0].length,d=/^\s*/.exec(l)[0].length,h=i.length-c;if(i.slice(h-e.length,h)==e&&l.slice(d,d+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:s+d,margin:d&&1}};let m,p;s-r<=2*Ph?m=p=t.sliceDoc(r,s):(m=t.sliceDoc(r,r+Ph),p=t.sliceDoc(s-Ph,s));let x=/^\s*/.exec(m)[0].length,v=/\s*$/.exec(p)[0].length,b=p.length-v-n.length;return m.slice(x,x+e.length)==e&&p.slice(b,b+n.length)==n?{open:{pos:r+x+e.length,margin:/\s/.test(m.charAt(x+e.length))?1:0},close:{pos:s-v-n.length,margin:/\s/.test(p.charAt(b-1))?1:0}}:null}function eY(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),s=n.to<=r.to?r:t.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>r.from?e[i].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function SE(t,e,n=e.selection.ranges){let r=n.map(i=>Vw(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,l)=>JX(e,r[l],i.from,i.to));if(t!=2&&!s.every(i=>i))return{changes:e.changes(n.map((i,l)=>s[l]?[]:[{from:i.from,insert:r[l].open+" "},{from:i.to,insert:" "+r[l].close}]))};if(t!=1&&s.some(i=>i)){let i=[];for(let l=0,c;ls&&(i==l||l>p.from)){s=p.from;let x=/^\s*/.exec(p.text)[0].length,v=x==p.length,b=p.text.slice(x,x+h.length)==h?x:-1;xi.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:c,token:d,indent:h,empty:m,single:p}of r)(p||!m)&&i.push({from:c.from+h,insert:d+" "});let l=e.changes(i);return{changes:l,selection:e.selection.map(l,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:l,comment:c,token:d}of r)if(c>=0){let h=l.from+c,m=h+d.length;l.text[m-l.from]==" "&&m++,i.push({from:h,to:m})}return{changes:i}}return null}const n4=ka.define(),nY=ka.define(),rY=He.define(),kE=He.define({combine(t){return Oa(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,s)=>e(r,s)||n(r,s)})}}),OE=Br.define({create(){return ma.empty},update(t,e){let n=e.state.facet(kE),r=e.annotation(n4);if(r){let d=Ds.fromTransaction(e,r.selection),h=r.side,m=h==0?t.undone:t.done;return d?m=Rg(m,m.length,n.minDepth,d):m=CE(m,e.startState.selection),new ma(h==0?r.rest:m,h==0?m:r.rest)}let s=e.annotation(nY);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(gr.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=Ds.fromTransaction(e),l=e.annotation(gr.time),c=e.annotation(gr.userEvent);return i?t=t.addChanges(i,l,c,n,e):e.selection&&(t=t.addSelection(e.startState.selection,l,c,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new ma(t.done.map(Ds.fromJSON),t.undone.map(Ds.fromJSON))}});function sY(t={}){return[OE,kE.of(t),qe.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?jE:e.inputType=="historyRedo"?r4:null;return r?(e.preventDefault(),r(n)):!1}})]}function Ax(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(OE,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const jE=Ax(0,!1),r4=Ax(1,!1),iY=Ax(0,!0),aY=Ax(1,!0);class Ds{constructor(e,n,r,s,i){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(e){return new Ds(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new Ds(e.changes&&kr.fromJSON(e.changes),[],e.mapped&&va.fromJSON(e.mapped),e.startSelection&&Ce.fromJSON(e.startSelection),e.selectionsAfter.map(Ce.fromJSON))}static fromTransaction(e,n){let r=Si;for(let s of e.startState.facet(rY)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new Ds(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,Si)}static selection(e){return new Ds(void 0,Si,void 0,void 0,e)}}function Rg(t,e,n,r){let s=e+1>n+20?e-n-1:0,i=t.slice(s,e);return i.push(r),i}function lY(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,l,c)=>{for(let d=0;d=h&&l<=m&&(r=!0)}}),r}function oY(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function NE(t,e){return t.length?e.length?t.concat(e):t:e}const Si=[],cY=200;function CE(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-cY));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Rg(t,t.length-1,1e9,n.setSelAfter(r)))}else return[Ds.selection([e])]}function uY(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Gy(t,e){if(!t.length)return t;let n=t.length,r=Si;for(;n;){let s=dY(t[n-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=t.slice(0,n);return i[n-1]=s,i}else e=s.mapped,n--,r=s.selectionsAfter}return r.length?[Ds.selection(r)]:Si}function dY(t,e,n){let r=NE(t.selectionsAfter.length?t.selectionsAfter.map(c=>c.map(e)):Si,n);if(!t.changes)return Ds.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),l=t.mapped?t.mapped.composeDesc(i):i;return new Ds(s,vt.mapEffects(t.effects,e),l,t.startSelection.map(i),r)}const hY=/^(input\.type|delete)($|\.)/;class ma{constructor(e,n,r=0,s=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new ma(this.done,this.undone):this}addChanges(e,n,r,s,i){let l=this.done,c=l[l.length-1];return c&&c.changes&&!c.changes.empty&&e.changes&&(!r||hY.test(r))&&(!c.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):Mx(n,e))}function is(t){return t.textDirectionAt(t.state.selection.main.head)==Hn.LTR}const AE=t=>TE(t,!is(t)),ME=t=>TE(t,is(t));function EE(t,e){return Xi(t,n=>n.empty?t.moveByGroup(n,e):Mx(n,e))}const mY=t=>EE(t,!is(t)),pY=t=>EE(t,is(t));function gY(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Ex(t,e,n){let r=zr(t).resolveInner(e.head),s=n?Et.closedBy:Et.openedBy;for(let d=e.head;;){let h=n?r.childAfter(d):r.childBefore(d);if(!h)break;gY(t,h,s)?r=h:d=n?h.to:h.from}let i=r.type.prop(s),l,c;return i&&(l=n?fa(t,r.from,1):fa(t,r.to,-1))&&l.matched?c=n?l.end.to:l.end.from:c=n?r.to:r.from,Ce.cursor(c,n?-1:1)}const xY=t=>Xi(t,e=>Ex(t.state,e,!is(t))),vY=t=>Xi(t,e=>Ex(t.state,e,is(t)));function _E(t,e){return Xi(t,n=>{if(!n.empty)return Mx(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const DE=t=>_E(t,!1),RE=t=>_E(t,!0);function zE(t){let e=t.scrollDOM.clientHeightl.empty?t.moveVertically(l,e,n.height):Mx(l,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let l=t.coordsAtPos(r.selection.main.head),c=t.scrollDOM.getBoundingClientRect(),d=c.top+n.marginTop,h=c.bottom-n.marginBottom;l&&l.top>d&&l.bottomPE(t,!1),s4=t=>PE(t,!0);function Co(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(s=Ce.cursor(r.from+i))}return s}const yY=t=>Xi(t,e=>Co(t,e,!0)),bY=t=>Xi(t,e=>Co(t,e,!1)),wY=t=>Xi(t,e=>Co(t,e,!is(t))),SY=t=>Xi(t,e=>Co(t,e,is(t))),kY=t=>Xi(t,e=>Ce.cursor(t.lineBlockAt(e.head).from,1)),OY=t=>Xi(t,e=>Ce.cursor(t.lineBlockAt(e.head).to,-1));function jY(t,e,n){let r=!1,s=Ad(t.selection,i=>{let l=fa(t,i.head,-1)||fa(t,i.head,1)||i.head>0&&fa(t,i.head-1,1)||i.headjY(t,e);function _i(t,e){let n=Ad(t.state.selection,r=>{let s=e(r);return Ce.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(Gi(t.state,n)),!0)}function BE(t,e){return _i(t,n=>t.moveByChar(n,e))}const LE=t=>BE(t,!is(t)),IE=t=>BE(t,is(t));function qE(t,e){return _i(t,n=>t.moveByGroup(n,e))}const CY=t=>qE(t,!is(t)),TY=t=>qE(t,is(t)),AY=t=>_i(t,e=>Ex(t.state,e,!is(t))),MY=t=>_i(t,e=>Ex(t.state,e,is(t)));function FE(t,e){return _i(t,n=>t.moveVertically(n,e))}const QE=t=>FE(t,!1),$E=t=>FE(t,!0);function HE(t,e){return _i(t,n=>t.moveVertically(n,e,zE(t).height))}const m7=t=>HE(t,!1),p7=t=>HE(t,!0),EY=t=>_i(t,e=>Co(t,e,!0)),_Y=t=>_i(t,e=>Co(t,e,!1)),DY=t=>_i(t,e=>Co(t,e,!is(t))),RY=t=>_i(t,e=>Co(t,e,is(t))),zY=t=>_i(t,e=>Ce.cursor(t.lineBlockAt(e.head).from)),PY=t=>_i(t,e=>Ce.cursor(t.lineBlockAt(e.head).to)),g7=({state:t,dispatch:e})=>(e(Gi(t,{anchor:0})),!0),x7=({state:t,dispatch:e})=>(e(Gi(t,{anchor:t.doc.length})),!0),v7=({state:t,dispatch:e})=>(e(Gi(t,{anchor:t.selection.main.anchor,head:0})),!0),y7=({state:t,dispatch:e})=>(e(Gi(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),BY=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),LY=({state:t,dispatch:e})=>{let n=_x(t).map(({from:r,to:s})=>Ce.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Ce.create(n),userEvent:"select"})),!0},IY=({state:t,dispatch:e})=>{let n=Ad(t.selection,r=>{let s=zr(t),i=s.resolveStack(r.from,1);if(r.empty){let l=s.resolveStack(r.from,-1);l.node.from>=i.node.from&&l.node.to<=i.node.to&&(i=l)}for(let l=i;l;l=l.next){let{node:c}=l;if((c.from=r.to||c.to>r.to&&c.from<=r.from)&&l.next)return Ce.range(c.to,c.from)}return r});return n.eq(t.selection)?!1:(e(Gi(t,n)),!0)};function UE(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let l=n.doc.lineAt(i.head);if(e?l.to0)for(let c=i;;){let d=t.moveVertically(c,e);if(d.headl.to){s.some(h=>h.head==d.head)||s.push(d);break}else{if(d.head==c.head)break;c=d}}}return s.length==r.ranges.length?!1:(t.dispatch(Gi(n,Ce.create(s,s.length-1))),!0)}const qY=t=>UE(t,!1),FY=t=>UE(t,!0),QY=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Ce.create([n.main]):n.main.empty||(r=Ce.create([Ce.cursor(n.main.head)])),r?(e(Gi(t,r)),!0):!1};function f0(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:l,to:c}=i;if(l==c){let d=e(i);dl&&(n="delete.forward",d=xp(t,d,!0)),l=Math.min(l,d),c=Math.max(c,d)}else l=xp(t,l,!1),c=xp(t,c,!0);return l==c?{range:i}:{changes:{from:l,to:c},range:Ce.cursor(l,ls(t)))r.between(e,e,(s,i)=>{se&&(e=n?i:s)});return e}const VE=(t,e,n)=>f0(t,r=>{let s=r.from,{state:i}=t,l=i.doc.lineAt(s),c,d;if(n&&!e&&s>l.from&&sVE(t,!1,!0),WE=t=>VE(t,!0,!1),GE=(t,e)=>f0(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),l=s.charCategorizer(r);for(let c=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let d=Vr(i.text,r-i.from,e)+i.from,h=i.text.slice(Math.min(r,d)-i.from,Math.max(r,d)-i.from),m=l(h);if(c!=null&&m!=c)break;(h!=" "||r!=n.head)&&(c=m),r=d}return r}),XE=t=>GE(t,!1),$Y=t=>GE(t,!0),HY=t=>f0(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headf0(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),VY=t=>f0(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Xt.of(["",""])},range:Ce.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},GY=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,i=t.doc.lineAt(s),l=s==i.from?s-1:Vr(i.text,s-i.from,!1)+i.from,c=s==i.to?s+1:Vr(i.text,s-i.from,!0)+i.from;return{changes:{from:l,to:c,insert:t.doc.slice(s,c).append(t.doc.slice(l,s))},range:Ce.cursor(c)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function _x(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=s.number){let l=e[e.length-1];l.to=i.to,l.ranges.push(r)}else e.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return e}function YE(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of _x(t)){if(n?i.to==t.doc.length:i.from==0)continue;let l=t.doc.lineAt(n?i.to+1:i.from-1),c=l.length+1;if(n){r.push({from:i.to,to:l.to},{from:i.from,insert:l.text+t.lineBreak});for(let d of i.ranges)s.push(Ce.range(Math.min(t.doc.length,d.anchor+c),Math.min(t.doc.length,d.head+c)))}else{r.push({from:l.from,to:i.from},{from:i.to,insert:t.lineBreak+l.text});for(let d of i.ranges)s.push(Ce.range(d.anchor-c,d.head-c))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Ce.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const XY=({state:t,dispatch:e})=>YE(t,e,!1),YY=({state:t,dispatch:e})=>YE(t,e,!0);function KE(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of _x(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const KY=({state:t,dispatch:e})=>KE(t,e,!1),ZY=({state:t,dispatch:e})=>KE(t,e,!0),JY=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(_x(e).map(({from:s,to:i})=>(s>0?s--:i{let i;if(t.lineWrapping){let l=t.lineBlockAt(s.head),c=t.coordsAtPos(s.head,s.assoc||1);c&&(i=l.bottom+t.documentTop-c.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function eK(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=zr(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e),i;return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(Et.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const b7=ZE(!1),tK=ZE(!0);function ZE(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:l}=s,c=e.doc.lineAt(i),d=!t&&i==l&&eK(e,i);t&&(i=l=(l<=c.to?c:e.doc.lineAt(l)).to);let h=new Nx(e,{simulateBreak:i,simulateDoubleBreak:!!d}),m=Iw(h,i);for(m==null&&(m=Td(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));lc.from&&i{let s=[];for(let l=r.from;l<=r.to;){let c=t.doc.lineAt(l);c.number>n&&(r.empty||r.to>c.from)&&(e(c,s,r),n=c.number),l=c.to+1}let i=t.changes(s);return{changes:s,range:Ce.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const nK=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Nx(t,{overrideIndentation:i=>{let l=n[i];return l??-1}}),s=Ww(t,(i,l,c)=>{let d=Iw(r,i.from);if(d==null)return;/\S/.test(i.text)||(d=0);let h=/^\s*/.exec(i.text)[0],m=Nf(t,d);(h!=m||c.fromt.readOnly?!1:(e(t.update(Ww(t,(n,r)=>{r.push({from:n.from,insert:t.facet(u0)})}),{userEvent:"input.indent"})),!0),e_=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Ww(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Td(s,t.tabSize),l=0,c=Nf(t,Math.max(0,i-kc(t)));for(;l(t.setTabFocusMode(),!0),sK=[{key:"Ctrl-b",run:AE,shift:LE,preventDefault:!0},{key:"Ctrl-f",run:ME,shift:IE},{key:"Ctrl-p",run:DE,shift:QE},{key:"Ctrl-n",run:RE,shift:$E},{key:"Ctrl-a",run:kY,shift:zY},{key:"Ctrl-e",run:OY,shift:PY},{key:"Ctrl-d",run:WE},{key:"Ctrl-h",run:i4},{key:"Ctrl-k",run:HY},{key:"Ctrl-Alt-h",run:XE},{key:"Ctrl-o",run:WY},{key:"Ctrl-t",run:GY},{key:"Ctrl-v",run:s4}],iK=[{key:"ArrowLeft",run:AE,shift:LE,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:mY,shift:CY,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:wY,shift:DY,preventDefault:!0},{key:"ArrowRight",run:ME,shift:IE,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:pY,shift:TY,preventDefault:!0},{mac:"Cmd-ArrowRight",run:SY,shift:RY,preventDefault:!0},{key:"ArrowUp",run:DE,shift:QE,preventDefault:!0},{mac:"Cmd-ArrowUp",run:g7,shift:v7},{mac:"Ctrl-ArrowUp",run:f7,shift:m7},{key:"ArrowDown",run:RE,shift:$E,preventDefault:!0},{mac:"Cmd-ArrowDown",run:x7,shift:y7},{mac:"Ctrl-ArrowDown",run:s4,shift:p7},{key:"PageUp",run:f7,shift:m7},{key:"PageDown",run:s4,shift:p7},{key:"Home",run:bY,shift:_Y,preventDefault:!0},{key:"Mod-Home",run:g7,shift:v7},{key:"End",run:yY,shift:EY,preventDefault:!0},{key:"Mod-End",run:x7,shift:y7},{key:"Enter",run:b7,shift:b7},{key:"Mod-a",run:BY},{key:"Backspace",run:i4,shift:i4,preventDefault:!0},{key:"Delete",run:WE,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:XE,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:$Y,preventDefault:!0},{mac:"Mod-Backspace",run:UY,preventDefault:!0},{mac:"Mod-Delete",run:VY,preventDefault:!0}].concat(sK.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),aK=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:xY,shift:AY},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:vY,shift:MY},{key:"Alt-ArrowUp",run:XY},{key:"Shift-Alt-ArrowUp",run:KY},{key:"Alt-ArrowDown",run:YY},{key:"Shift-Alt-ArrowDown",run:ZY},{key:"Mod-Alt-ArrowUp",run:qY},{key:"Mod-Alt-ArrowDown",run:FY},{key:"Escape",run:QY},{key:"Mod-Enter",run:tK},{key:"Alt-l",mac:"Ctrl-l",run:LY},{key:"Mod-i",run:IY,preventDefault:!0},{key:"Mod-[",run:e_},{key:"Mod-]",run:JE},{key:"Mod-Alt-\\",run:nK},{key:"Shift-Mod-k",run:JY},{key:"Shift-Mod-\\",run:NY},{key:"Mod-/",run:XX},{key:"Alt-A",run:KX},{key:"Ctrl-m",mac:"Shift-Alt-m",run:rK}].concat(iK),lK={key:"Tab",run:JE,shift:e_},w7=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class gd{constructor(e,n,r=0,s=e.length,i,l){this.test=l,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=i?c=>i(w7(c)):w7,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return As(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=yw(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=oa(e);let s=this.normalize(n);if(s.length)for(let i=0,l=r;;i++){let c=s.charCodeAt(i),d=this.match(c,l,this.bufferPos+this.bufferStart);if(i==s.length-1){if(d)return this.value=d,this;break}l==r&&ithis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=zg(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||s.to<=n){let c=new Yu(n,e.sliceString(n,r));return Xy.set(e,c),c}if(s.from==n&&s.to==r)return s;let{text:i,from:l}=s;return l>n&&(i=e.sliceString(n,l)+i,l=n),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=zg(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Yu.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(n_.prototype[Symbol.iterator]=r_.prototype[Symbol.iterator]=function(){return this});function oK(t){try{return new RegExp(t,Gw),!0}catch{return!1}}function zg(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function a4(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=Mn("input",{class:"cm-textfield",name:"line",value:e}),r=Mn("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),t.dispatch({effects:sf.of(!1)}),t.focus()):i.keyCode==13&&(i.preventDefault(),s())},onsubmit:i=>{i.preventDefault(),s()}},Mn("label",t.state.phrase("Go to line"),": ",n)," ",Mn("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),Mn("button",{name:"close",onclick:()=>{t.dispatch({effects:sf.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function s(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!i)return;let{state:l}=t,c=l.doc.lineAt(l.selection.main.head),[,d,h,m,p]=i,x=m?+m.slice(1):0,v=h?+h:c.number;if(h&&p){let O=v/100;d&&(O=O*(d=="-"?-1:1)+c.number/l.doc.lines),v=Math.round(l.doc.lines*O)}else h&&d&&(v=v*(d=="-"?-1:1)+c.number);let b=l.doc.line(Math.max(1,Math.min(l.doc.lines,v))),k=Ce.cursor(b.from+Math.max(0,Math.min(x,b.length)));t.dispatch({effects:[sf.of(!1),qe.scrollIntoView(k.from,{y:"center"})],selection:k}),t.focus()}return{dom:r}}const sf=vt.define(),S7=Br.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(sf)&&(t=n.value);return t},provide:t=>Sf.from(t,e=>e?a4:null)}),cK=t=>{let e=wf(t,a4);if(!e){let n=[sf.of(!0)];t.state.field(S7,!1)==null&&n.push(vt.appendConfig.of([S7,uK])),t.dispatch({effects:n}),e=wf(t,a4)}return e&&e.dom.querySelector("input").select(),!0},uK=qe.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),dK={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},hK=He.define({combine(t){return Oa(t,dK,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function fK(t){return[vK,xK]}const mK=Je.mark({class:"cm-selectionMatch"}),pK=Je.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function k7(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Vn.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Vn.Word)}function gK(t,e,n,r){return t(e.sliceDoc(n,n+1))==Vn.Word&&t(e.sliceDoc(r-1,r))==Vn.Word}const xK=lr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(hK),{state:n}=t,r=n.selection;if(r.ranges.length>1)return Je.none;let s=r.main,i,l=null;if(s.empty){if(!e.highlightWordAroundCursor)return Je.none;let d=n.wordAt(s.head);if(!d)return Je.none;l=n.charCategorizer(s.head),i=n.sliceDoc(d.from,d.to)}else{let d=s.to-s.from;if(d200)return Je.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),l=n.charCategorizer(s.head),!(k7(l,n,s.from,s.to)&&gK(l,n,s.from,s.to)))return Je.none}else if(i=n.sliceDoc(s.from,s.to),!i)return Je.none}let c=[];for(let d of t.visibleRanges){let h=new gd(n.doc,i,d.from,d.to);for(;!h.next().done;){let{from:m,to:p}=h.value;if((!l||k7(l,n,m,p))&&(s.empty&&m<=s.from&&p>=s.to?c.push(pK.range(m,p)):(m>=s.to||p<=s.from)&&c.push(mK.range(m,p)),c.length>e.maxMatches))return Je.none}}return Je.set(c)}},{decorations:t=>t.decorations}),vK=qe.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),yK=({state:t,dispatch:e})=>{let{selection:n}=t,r=Ce.create(n.ranges.map(s=>t.wordAt(s.head)||Ce.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function bK(t,e){let{main:n,ranges:r}=t.selection,s=t.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let l=!1,c=new gd(t.doc,e,r[r.length-1].to);;)if(c.next(),c.done){if(l)return null;c=new gd(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),l=!0}else{if(l&&r.some(d=>d.from==c.value.from))continue;if(i){let d=t.wordAt(c.value.from);if(!d||d.from!=c.value.from||d.to!=c.value.to)continue}return c.value}}const wK=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return yK({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=r))return!1;let s=bK(t,r);return s?(e(t.update({selection:t.selection.addRange(Ce.range(s.from,s.to),!1),effects:qe.scrollIntoView(s.to)})),!0):!1},Md=He.define({combine(t){return Oa(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new DK(e),scrollToMatch:e=>qe.scrollIntoView(e)})}});class s_{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||oK(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?` +`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new jK(this):new kK(this)}getCursor(e,n=0,r){let s=e.doc?e:Vt.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?zu(this,s,n,r):Ru(this,s,n,r)}}class i_{constructor(e){this.spec=e}}function Ru(t,e,n,r){return new gd(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?SK(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function SK(t,e){return(n,r,s,i)=>((i>n||i+s.length=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=Ru(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}function zu(t,e,n,r){return new n_(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?OK(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function Pg(t,e){return t.slice(Vr(t,e,!1),e)}function Bg(t,e){return t.slice(e,Vr(t,e))}function OK(t){return(e,n,r)=>!r[0].length||(t(Pg(r.input,r.index))!=Vn.Word||t(Bg(r.input,r.index))!=Vn.Word)&&(t(Bg(r.input,r.index+r[0].length))!=Vn.Word||t(Pg(r.input,r.index+r[0].length))!=Vn.Word)}class jK extends i_{nextMatch(e,n,r){let s=zu(this.spec,e,r,e.doc.length).next();return s.done&&(s=zu(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),l=zu(this.spec,e,i,r),c=null;for(;!l.next().done;)c=l.value;if(c&&(i==n||c.from>i+10))return c;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=zu(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}const Tf=vt.define(),Xw=vt.define(),lo=Br.define({create(t){return new Yy(l4(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Tf)?t=new Yy(n.value.create(),t.panel):n.is(Xw)&&(t=new Yy(t.query,n.value?Yw:null));return t},provide:t=>Sf.from(t,e=>e.panel)});class Yy{constructor(e,n){this.query=e,this.panel=n}}const NK=Je.mark({class:"cm-searchMatch"}),CK=Je.mark({class:"cm-searchMatch cm-searchMatch-selected"}),TK=lr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(lo))}update(t){let e=t.state.field(lo);(e!=t.startState.field(lo)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return Je.none;let{view:n}=this,r=new ml;for(let s=0,i=n.visibleRanges,l=i.length;si[s+1].from-500;)d=i[++s].to;t.highlight(n.state,c,d,(h,m)=>{let p=n.state.selection.ranges.some(x=>x.from==h&&x.to==m);r.add(h,m,p?CK:NK)})}return r.finish()}},{decorations:t=>t.decorations});function m0(t){return e=>{let n=e.state.field(lo,!1);return n&&n.query.spec.valid?t(e,n):o_(e)}}const Lg=m0((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=Ce.single(r.from,r.to),i=t.state.facet(Md);return t.dispatch({selection:s,effects:[Kw(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),l_(t),!0}),Ig=m0((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=Ce.single(s.from,s.to),l=t.state.facet(Md);return t.dispatch({selection:i,effects:[Kw(t,s),l.scrollToMatch(i.main,t)],userEvent:"select.search"}),l_(t),!0}),AK=m0((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Ce.create(n.map(r=>Ce.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),MK=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],l=0;for(let c=new gd(t.doc,t.sliceDoc(r,s));!c.next().done;){if(i.length>1e3)return!1;c.value.from==r&&(l=i.length),i.push(Ce.range(c.value.from,c.value.to))}return e(t.update({selection:Ce.create(i,l),userEvent:"select.search.matches"})),!0},O7=m0((t,{query:e})=>{let{state:n}=t,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,r,r);if(!i)return!1;let l=i,c=[],d,h,m=[];l.from==r&&l.to==s&&(h=n.toText(e.getReplacement(l)),c.push({from:l.from,to:l.to,insert:h}),l=e.nextMatch(n,l.from,l.to),m.push(qe.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let p=t.state.changes(c);return l&&(d=Ce.single(l.from,l.to).map(p),m.push(Kw(t,l)),m.push(n.facet(Md).scrollToMatch(d.main,t))),t.dispatch({changes:p,selection:d,effects:m,userEvent:"input.replace"}),!0}),EK=m0((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(s=>{let{from:i,to:l}=s;return{from:i,to:l,insert:e.getReplacement(s)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:qe.announce.of(r),userEvent:"input.replace.all"}),!0});function Yw(t){return t.state.facet(Md).createPanel(t)}function l4(t,e){var n,r,s,i,l;let c=t.selection.main,d=c.empty||c.to>c.from+100?"":t.sliceDoc(c.from,c.to);if(e&&!d)return e;let h=t.facet(Md);return new s_({search:((n=e?.literal)!==null&&n!==void 0?n:h.literal)?d:d.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:h.regexp,wholeWord:(l=e?.wholeWord)!==null&&l!==void 0?l:h.wholeWord})}function a_(t){let e=wf(t,Yw);return e&&e.dom.querySelector("[main-field]")}function l_(t){let e=a_(t);e&&e==t.root.activeElement&&e.select()}const o_=t=>{let e=t.state.field(lo,!1);if(e&&e.panel){let n=a_(t);if(n&&n!=t.root.activeElement){let r=l4(t.state,e.query.spec);r.valid&&t.dispatch({effects:Tf.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[Xw.of(!0),e?Tf.of(l4(t.state,e.query.spec)):vt.appendConfig.of(zK)]});return!0},c_=t=>{let e=t.state.field(lo,!1);if(!e||!e.panel)return!1;let n=wf(t,Yw);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Xw.of(!1)}),!0},_K=[{key:"Mod-f",run:o_,scope:"editor search-panel"},{key:"F3",run:Lg,shift:Ig,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Lg,shift:Ig,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:c_,scope:"editor search-panel"},{key:"Mod-Shift-l",run:MK},{key:"Mod-Alt-g",run:cK},{key:"Mod-d",run:wK,preventDefault:!0}];class DK{constructor(e){this.view=e;let n=this.query=e.state.field(lo).query.spec;this.commit=this.commit.bind(this),this.searchField=Mn("input",{value:n.search,placeholder:Ys(e,"Find"),"aria-label":Ys(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mn("input",{value:n.replace,placeholder:Ys(e,"Replace"),"aria-label":Ys(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mn("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Mn("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Mn("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,l){return Mn("button",{class:"cm-button",name:s,onclick:i,type:"button"},l)}this.dom=Mn("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>Lg(e),[Ys(e,"next")]),r("prev",()=>Ig(e),[Ys(e,"previous")]),r("select",()=>AK(e),[Ys(e,"all")]),Mn("label",null,[this.caseField,Ys(e,"match case")]),Mn("label",null,[this.reField,Ys(e,"regexp")]),Mn("label",null,[this.wordField,Ys(e,"by word")]),...e.state.readOnly?[]:[Mn("br"),this.replaceField,r("replace",()=>O7(e),[Ys(e,"replace")]),r("replaceAll",()=>EK(e),[Ys(e,"replace all")])],Mn("button",{name:"close",onclick:()=>c_(e),"aria-label":Ys(e,"close"),type:"button"},["×"])])}commit(){let e=new s_({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Tf.of(e)}))}keydown(e){LW(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ig:Lg)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),O7(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Tf)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Md).top}}function Ys(t,e){return t.state.phrase(e)}const vp=30,yp=/[\s\.,:;?!]/;function Kw(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),s=t.state.doc.lineAt(n).to,i=Math.max(r.from,e-vp),l=Math.min(s,n+vp),c=t.state.sliceDoc(i,l);if(i!=r.from){for(let d=0;dc.length-vp;d--)if(!yp.test(c[d-1])&&yp.test(c[d])){c=c.slice(0,d);break}}return qe.announce.of(`${t.state.phrase("current match")}. ${c} ${t.state.phrase("on line")} ${r.number}.`)}const RK=qe.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),zK=[lo,No.low(TK),RK];class u_{constructor(e,n,r,s){this.state=e,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=zr(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(h_(e,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function j7(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function PK(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;itypeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:PK(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function BK(t,e){return n=>{for(let r=zr(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}let N7=class{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}};function gc(t){return t.selection.main.from}function h_(t,e){var n;let{source:r}=t,s=e&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const Zw=ka.define();function LK(t,e,n,r){let{main:s}=t.selection,i=n-s.from,l=r-s.from;return{...t.changeByRange(c=>{if(c!=s&&n!=r&&t.sliceDoc(c.from+i,c.from+l)!=t.sliceDoc(n,r))return{range:c};let d=t.toText(e);return{changes:{from:c.from+i,to:r==s.from?c.to:c.from+l,insert:d},range:Ce.cursor(c.from+i+d.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const C7=new WeakMap;function IK(t){if(!Array.isArray(t))return t;let e=C7.get(t);return e||C7.set(t,e=d_(t)),e}const qg=vt.define(),Af=vt.define();class qK{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&D<=57||D>=97&&D<=122?2:D>=65&&D<=90?1:0:(E=yw(D))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!T||R==1&&O||_==0&&R!=0)&&(n[p]==D||r[p]==D&&(x=!0)?l[p++]=T:l.length&&(j=!1)),_=R,T+=oa(D)}return p==d&&l[0]==0&&j?this.result(-100+(x?-200:0),l,e):v==d&&b==0?this.ret(-200-e.length+(k==e.length?0:-100),[0,k]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):v==d?this.ret(-900-e.length,[b,k]):p==d?this.result(-100+(x?-200:0)+-700+(j?0:-1100),l,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let l of n){let c=l+(this.astral?oa(As(r,l)):1);i&&s[i-1]==l?s[i-1]=c:(s[i++]=l,s[i++]=c)}return this.ret(e-r.length,s)}}class FK{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:QK,filterStrict:!1,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>T7(e(r),n(r)),optionClass:(e,n)=>r=>T7(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function T7(t,e){return t?e?t+" "+e:t:e}function QK(t,e,n,r,s,i){let l=t.textDirection==Hn.RTL,c=l,d=!1,h="top",m,p,x=e.left-s.left,v=s.right-e.right,b=r.right-r.left,k=r.bottom-r.top;if(c&&x=k||T>e.top?m=n.bottom-e.top:(h="bottom",m=e.bottom-n.top)}let O=(e.bottom-e.top)/i.offsetHeight,j=(e.right-e.left)/i.offsetWidth;return{style:`${h}: ${m/O}px; max-width: ${p/j}px`,class:"cm-completionInfo-"+(d?l?"left-narrow":"right-narrow":c?"left":"right")}}function $K(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let l=document.createElement("span");l.className="cm-completionLabel";let c=n.displayLabel||n.label,d=0;for(let h=0;hd&&l.appendChild(document.createTextNode(c.slice(d,m)));let x=l.appendChild(document.createElement("span"));x.appendChild(document.createTextNode(c.slice(m,p))),x.className="cm-completionMatchedText",d=p}return dn.position-r.position).map(n=>n.render)}function Ky(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/n);return{from:s*n,to:(s+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class HK{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:d=>this.placeInfo(d),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:l}=s.open,c=e.state.facet(Dr);this.optionContent=$K(c),this.optionClass=c.optionClass,this.tooltipClass=c.tooltipClass,this.range=Ky(i.length,l,c.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",d=>{let{options:h}=e.state.field(n).open;for(let m=d.target,p;m&&m!=this.dom;m=m.parentNode)if(m.nodeName=="LI"&&(p=/-(\d+)$/.exec(m.id))&&+p[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(Dr).closeOnBlur&&d.relatedTarget!=e.contentDOM&&e.dispatch({effects:Af.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:l,disabled:c}=r.open;(!s.open||s.open.options!=i)&&(this.range=Ky(i.length,l,e.state.facet(Dr).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),c!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!c)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=Ky(n.options.length,n.selected,this.view.state.facet(Dr).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let l=typeof i=="string"?document.createTextNode(i):i(s);if(!l)return;"then"in l?l.then(c=>{c&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(c,s)}).catch(c=>_s(this.view.state,c,"completion info")):(this.addInfoPane(l,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&VK(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let l=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:l.clientWidth,bottom:l.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom{l.target==s&&l.preventDefault()});let i=null;for(let l=r.from;lr.from||r.from==0))if(i=x,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let v=s.appendChild(document.createElement("completion-section"));v.textContent=x}}const m=s.appendChild(document.createElement("li"));m.id=n+"-"+l,m.setAttribute("role","option");let p=this.optionClass(c);p&&(m.className=p);for(let x of this.optionContent){let v=x(c,this.view.state,this.view,d);v&&m.appendChild(v)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.tonew HK(n,t,e)}function VK(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.topn.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function A7(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function WK(t,e){let n=[],r=null,s=null,i=m=>{n.push(m);let{section:p}=m.completion;if(p){r||(r=[]);let x=typeof p=="string"?p:p.name;r.some(v=>v.name==x)||r.push(typeof p=="string"?{name:x}:p)}},l=e.facet(Dr);for(let m of t)if(m.hasResult()){let p=m.result.getMatch;if(m.result.filter===!1)for(let x of m.result.options)i(new N7(x,m.source,p?p(x):[],1e9-n.length));else{let x=e.sliceDoc(m.from,m.to),v,b=l.filterStrict?new FK(x):new qK(x);for(let k of m.result.options)if(v=b.match(k.label)){let O=k.displayLabel?p?p(k,v.matched):[]:v.matched,j=v.score+(k.boost||0);if(i(new N7(k,m.source,O,j)),typeof k.section=="object"&&k.section.rank==="dynamic"){let{name:T}=k.section;s||(s=Object.create(null)),s[T]=Math.max(j,s[T]||-1e9)}}}}if(r){let m=Object.create(null),p=0,x=(v,b)=>(v.rank==="dynamic"&&b.rank==="dynamic"?s[b.name]-s[v.name]:0)||(typeof v.rank=="number"?v.rank:1e9)-(typeof b.rank=="number"?b.rank:1e9)||(v.namex.score-p.score||h(p.completion,x.completion))){let p=m.completion;!d||d.label!=p.label||d.detail!=p.detail||d.type!=null&&p.type!=null&&d.type!=p.type||d.apply!=p.apply||d.boost!=p.boost?c.push(m):A7(m.completion)>A7(d)&&(c[c.length-1]=m),d=m.completion}return c}class $u{constructor(e,n,r,s,i,l){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=l}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new $u(this.options,M7(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,l){if(s&&!l&&e.some(h=>h.isPending))return s.setDisabled();let c=WK(e,n);if(!c.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let d=n.facet(Dr).selectOnOpen?0:-1;if(s&&s.selected!=d&&s.selected!=-1){let h=s.options[s.selected].completion;for(let m=0;mm.hasResult()?Math.min(h,m.from):h,1e8),create:JK,above:i.aboveCursor},s?s.timestamp:Date.now(),d,!1)}map(e){return new $u(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new $u(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Fg{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new Fg(KK,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Dr),i=(r.override||n.languageDataAt("autocomplete",gc(n)).map(IK)).map(d=>(this.active.find(m=>m.source==d)||new ki(d,this.active.some(m=>m.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((d,h)=>d==this.active[h])&&(i=this.active);let l=this.open,c=e.effects.some(d=>d.is(Jw));l&&e.docChanged&&(l=l.map(e.changes)),e.selection||i.some(d=>d.hasResult()&&e.changes.touchesRange(d.from,d.to))||!GK(i,this.active)||c?l=$u.build(i,n,this.id,l,r,c):l&&l.disabled&&!i.some(d=>d.isPending)&&(l=null),!l&&i.every(d=>!d.isPending)&&i.some(d=>d.hasResult())&&(i=i.map(d=>d.hasResult()?new ki(d.source,0):d));for(let d of e.effects)d.is(m_)&&(l=l&&l.setSelected(d.value,this.id));return i==this.active&&l==this.open?this:new Fg(i,this.id,l)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?XK:YK}}function GK(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}const KK=[];function f_(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(Zw);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class ki{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=f_(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new ki(s.source,0)),r&4&&s.state==0&&(s=new ki(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(qg))s=new ki(s.source,1,i.value);else if(i.is(Af))s=new ki(s.source,0);else if(i.is(Jw))for(let l of i.value)l.source==s.source&&(s=l);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(gc(e.state))}}class Ku extends ki{constructor(e,n,r,s,i,l){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=l}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),l=e.changes.mapPos(this.to,1),c=gc(e.state);if(c>l||!s||n&2&&(gc(e.startState)==this.from||cn.map(e))}}),m_=vt.define(),Ms=Br.define({create(){return Fg.start()},update(t,e){return t.update(e)},provide:t=>[Dw.from(t,e=>e.tooltip),qe.contentAttributes.from(t,e=>e.attrs)]});function e5(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(Ms).active.find(s=>s.source==e.source);return r instanceof Ku?(typeof n=="string"?t.dispatch({...LK(t.state,n,r.from,r.to),annotations:Zw.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const JK=UK(Ms,e5);function bp(t,e="option"){return n=>{let r=n.state.field(Ms,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+s*(t?1:-1):t?0:l-1;return c<0?c=e=="page"?0:l-1:c>=l&&(c=e=="page"?l-1:0),n.dispatch({effects:m_.of(c)}),!0}}const eZ=t=>{let e=t.state.field(Ms,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(Ms,!1)?(t.dispatch({effects:qg.of(!0)}),!0):!1,tZ=t=>{let e=t.state.field(Ms,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Af.of(null)}),!0)};class nZ{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const rZ=50,sZ=1e3,iZ=lr.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(Ms).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Ms),n=t.state.facet(Dr);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Ms)==e)return;let r=t.transactions.some(i=>{let l=f_(i,n);return l&8||(i.selection||i.docChanged)&&!(l&3)});for(let i=0;irZ&&Date.now()-l.time>sZ){for(let c of l.context.abortListeners)try{c()}catch(d){_s(this.view.state,d)}l.context.abortListeners=null,this.running.splice(i--,1)}else l.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(l=>l.is(qg)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(l=>l.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(Ms);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Dr).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=gc(e),r=new u_(e,n,t.explicit,this.view),s=new nZ(t,r);this.running.push(s),Promise.resolve(t.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:Af.of(null)}),_s(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Dr).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Dr),r=this.view.state.field(Ms);for(let s=0;sc.source==i.active.source);if(l&&l.isPending)if(i.done==null){let c=new ki(i.active.source,0);for(let d of i.updates)c=c.update(d,n);c.isPending||e.push(c)}else this.startQuery(l)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:Jw.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Ms,!1);if(e&&e.tooltip&&this.view.state.facet(Dr).closeOnBlur){let n=e.open&&QM(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Af.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:qg.of(!1)}),20),this.composing=0}}}),aZ=typeof navigator=="object"&&/Win/.test(navigator.platform),lZ=No.highest(qe.domEventHandlers({keydown(t,e){let n=e.state.field(Ms,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(aZ&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(l=>l.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&e5(e,r),!1}})),p_=qe.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class oZ{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class t5{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Ur.TrackDel),r=e.mapPos(this.to,1,Ur.TrackDel);return n==null||r==null?null:new t5(this.field,n,r)}}class n5{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),l=/^\s*/.exec(i.text)[0];for(let d of this.lines){if(r.length){let h=l,m=/^\t*/.exec(d)[0].length;for(let p=0;pnew t5(d.field,s[d.line]+d.from,s[d.line]+d.to));return{text:r,ranges:c}}static parse(e){let n=[],r=[],s=[],i;for(let l of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(l);){let c=i[1]?+i[1]:null,d=i[2]||i[3]||"",h=-1,m=d.replace(/\\[{}]/g,p=>p[1]);for(let p=0;p=h&&x.field++}for(let p of s)if(p.line==r.length&&p.from>i.index){let x=i[2]?3+(i[1]||"").length:2;p.from-=x,p.to-=x}s.push(new oZ(h,r.length,i.index,i.index+m.length)),l=l.slice(0,i.index)+d+l.slice(i.index+i[0].length)}l=l.replace(/\\([{}])/g,(c,d,h)=>{for(let m of s)m.line==r.length&&m.from>h&&(m.from--,m.to--);return d}),r.push(l)}return new n5(r,s)}}let cZ=Je.widget({widget:new class extends ja{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),uZ=Je.mark({class:"cm-snippetField"});class Ed{constructor(e,n){this.ranges=e,this.active=n,this.deco=Je.set(e.map(r=>(r.from==r.to?cZ:uZ).range(r.from,r.to)),!0)}map(e){let n=[];for(let r of this.ranges){let s=r.map(e);if(!s)return null;n.push(s)}return new Ed(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const p0=vt.define({map(t,e){return t&&t.map(e)}}),dZ=vt.define(),Mf=Br.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(p0))return n.value;if(n.is(dZ)&&t)return new Ed(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>qe.decorations.from(t,e=>e?e.deco:Je.none)});function r5(t,e){return Ce.create(t.filter(n=>n.field==e).map(n=>Ce.range(n.from,n.to)))}function hZ(t){let e=n5.parse(t);return(n,r,s,i)=>{let{text:l,ranges:c}=e.instantiate(n.state,s),{main:d}=n.state.selection,h={changes:{from:s,to:i==d.from?d.to:i,insert:Xt.of(l)},scrollIntoView:!0,annotations:r?[Zw.of(r),gr.userEvent.of("input.complete")]:void 0};if(c.length&&(h.selection=r5(c,0)),c.some(m=>m.field>0)){let m=new Ed(c,0),p=h.effects=[p0.of(m)];n.state.field(Mf,!1)===void 0&&p.push(vt.appendConfig.of([Mf,xZ,vZ,p_]))}n.dispatch(n.state.update(h))}}function g_(t){return({state:e,dispatch:n})=>{let r=e.field(Mf,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(l=>l.field==s+t);return n(e.update({selection:r5(r.ranges,s),effects:p0.of(i?null:new Ed(r.ranges,s)),scrollIntoView:!0})),!0}}const fZ=({state:t,dispatch:e})=>t.field(Mf,!1)?(e(t.update({effects:p0.of(null)})),!0):!1,mZ=g_(1),pZ=g_(-1),gZ=[{key:"Tab",run:mZ,shift:pZ},{key:"Escape",run:fZ}],E7=He.define({combine(t){return t.length?t[0]:gZ}}),xZ=No.highest(o0.compute([E7],t=>t.facet(E7)));function Ya(t,e){return{...e,apply:hZ(t)}}const vZ=qe.domEventHandlers({mousedown(t,e){let n=e.state.field(Mf,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let s=n.ranges.find(i=>i.from<=r&&i.to>=r);return!s||s.field==n.active?!1:(e.dispatch({selection:r5(n.ranges,s.field),effects:p0.of(n.ranges.some(i=>i.field>s.field)?new Ed(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),Ef={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},cc=vt.define({map(t,e){let n=e.mapPos(t,-1,Ur.TrackAfter);return n??void 0}}),s5=new class extends yc{};s5.startSide=1;s5.endSide=-1;const x_=Br.define({create(){return Yt.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(cc)&&(t=t.update({add:[s5.range(n.value,n.value+1)]}));return t}});function yZ(){return[wZ,x_]}const Jy="()[]{}<>«»»«[]{}";function v_(t){for(let e=0;e{if((bZ?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&oa(As(r,0))==1||e!=s.from||n!=s.to)return!1;let i=OZ(t.state,r);return i?(t.dispatch(i),!0):!1}),SZ=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=y_(t,t.selection.main.head).brackets||Ef.brackets,s=null,i=t.changeByRange(l=>{if(l.empty){let c=jZ(t.doc,l.head);for(let d of r)if(d==c&&Dx(t.doc,l.head)==v_(As(d,0)))return{changes:{from:l.head-d.length,to:l.head+d.length},range:Ce.cursor(l.head-d.length)}}return{range:s=l}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},kZ=[{key:"Backspace",run:SZ}];function OZ(t,e){let n=y_(t,t.selection.main.head),r=n.brackets||Ef.brackets;for(let s of r){let i=v_(As(s,0));if(e==s)return i==s?TZ(t,s,r.indexOf(s+s+s)>-1,n):NZ(t,s,i,n.before||Ef.before);if(e==i&&b_(t,t.selection.main.from))return CZ(t,s,i)}return null}function b_(t,e){let n=!1;return t.field(x_).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function Dx(t,e){let n=t.sliceString(e,e+2);return n.slice(0,oa(As(n,0)))}function jZ(t,e){let n=t.sliceString(e-2,e);return oa(As(n,0))==n.length?n:n.slice(1)}function NZ(t,e,n,r){let s=null,i=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:n,from:l.to}],effects:cc.of(l.to+e.length),range:Ce.range(l.anchor+e.length,l.head+e.length)};let c=Dx(t.doc,l.head);return!c||/\s/.test(c)||r.indexOf(c)>-1?{changes:{insert:e+n,from:l.head},effects:cc.of(l.head+e.length),range:Ce.cursor(l.head+e.length)}:{range:s=l}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function CZ(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&Dx(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Ce.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function TZ(t,e,n,r){let s=r.stringPrefixes||Ef.stringPrefixes,i=null,l=t.changeByRange(c=>{if(!c.empty)return{changes:[{insert:e,from:c.from},{insert:e,from:c.to}],effects:cc.of(c.to+e.length),range:Ce.range(c.anchor+e.length,c.head+e.length)};let d=c.head,h=Dx(t.doc,d),m;if(h==e){if(_7(t,d))return{changes:{insert:e+e,from:d},effects:cc.of(d+e.length),range:Ce.cursor(d+e.length)};if(b_(t,d)){let x=n&&t.sliceDoc(d,d+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:d,to:d+x.length,insert:x},range:Ce.cursor(d+x.length)}}}else{if(n&&t.sliceDoc(d-2*e.length,d)==e+e&&(m=D7(t,d-2*e.length,s))>-1&&_7(t,m))return{changes:{insert:e+e+e+e,from:d},effects:cc.of(d+e.length),range:Ce.cursor(d+e.length)};if(t.charCategorizer(d)(h)!=Vn.Word&&D7(t,d,s)>-1&&!AZ(t,d,e,s))return{changes:{insert:e+e,from:d},effects:cc.of(d+e.length),range:Ce.cursor(d+e.length)}}return{range:i=c}});return i?null:t.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function _7(t,e){let n=zr(t).resolveInner(e+1);return n.parent&&n.from==e}function AZ(t,e,n,r){let s=zr(t).resolveInner(e,-1),i=r.reduce((l,c)=>Math.max(l,c.length),0);for(let l=0;l<5;l++){let c=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),d=c.indexOf(n);if(!d||d>-1&&r.indexOf(c.slice(0,d))>-1){let m=s.firstChild;for(;m&&m.from==s.from&&m.to-m.from>n.length+d;){if(t.sliceDoc(m.to-n.length,m.to)==n)return!1;m=m.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function D7(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Vn.Word)return e;for(let s of n){let i=e-s.length;if(t.sliceDoc(i,e)==s&&r(t.sliceDoc(i-1,i))!=Vn.Word)return i}return-1}function MZ(t={}){return[lZ,Ms,Dr.of(t),iZ,EZ,p_]}const w_=[{key:"Ctrl-Space",run:Zy},{mac:"Alt-`",run:Zy},{mac:"Alt-i",run:Zy},{key:"Escape",run:tZ},{key:"ArrowDown",run:bp(!0)},{key:"ArrowUp",run:bp(!1)},{key:"PageDown",run:bp(!0,"page")},{key:"PageUp",run:bp(!1,"page")},{key:"Enter",run:eZ}],EZ=No.highest(o0.computeN([Dr],t=>t.facet(Dr).defaultKeymap?[w_]:[]));class R7{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class ic{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(_f).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((v,b)=>v.from-b.from||v.to-b.to),l=new ml,c=[],d=0,h=r.doc.iter(),m=0,p=r.doc.length;for(let v=0;;){let b=v==i.length?null:i[v];if(!b&&!c.length)break;let k,O;if(c.length)k=d,O=c.reduce((A,_)=>Math.min(A,_.to),b&&b.from>k?b.from:1e8);else{if(k=b.from,k>p)break;O=b.to,c.push(b),v++}for(;vA.from||A.to==k))c.push(A),v++,O=Math.min(A.to,O);else{O=Math.min(A.from,O);break}}O=Math.min(O,p);let j=!1;if(c.some(A=>A.from==k&&(A.to==O||O==p))&&(j=k==O,!j&&O-k<10)){let A=k-(m+h.value.length);A>0&&(h.next(A),m=k);for(let _=k;;){if(_>=O){j=!0;break}if(!h.lineBreak&&m+h.value.length>_)break;_=m+h.value.length,m+=h.value.length,h.next()}}let T=HZ(c);if(j)l.add(k,k,Je.widget({widget:new qZ(T),diagnostics:c.slice()}));else{let A=c.reduce((_,D)=>D.markClass?_+" "+D.markClass:_,"");l.add(k,O,Je.mark({class:"cm-lintRange cm-lintRange-"+T+A,diagnostics:c.slice(),inclusiveEnd:c.some(_=>_.to>O)}))}if(d=O,d==p)break;for(let A=0;A{if(!(e&&l.diagnostics.indexOf(e)<0))if(!r)r=new R7(s,i,e||l.diagnostics[0]);else{if(l.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new R7(r.from,i,r.diagnostic)}}),r}function _Z(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(_f).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(l=>l.is(S_))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function DZ(t,e){return t.field(ri,!1)?e:e.concat(vt.appendConfig.of(UZ))}const S_=vt.define(),i5=vt.define(),k_=vt.define(),ri=Br.define({create(){return new ic(Je.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,s=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=xd(n,t.selected.diagnostic,i)||xd(n,null,i)}!n.size&&s&&e.state.facet(_f).autoPanel&&(s=null),t=new ic(n,s,r)}for(let n of e.effects)if(n.is(S_)){let r=e.state.facet(_f).autoPanel?n.value.length?Df.open:null:t.panel;t=ic.init(n.value,r,e.state)}else n.is(i5)?t=new ic(t.diagnostics,n.value?Df.open:null,t.selected):n.is(k_)&&(t=new ic(t.diagnostics,t.panel,n.value));return t},provide:t=>[Sf.from(t,e=>e.panel),qe.decorations.from(t,e=>e.diagnostics)]}),RZ=Je.mark({class:"cm-lintRange cm-lintRange-active"});function zZ(t,e,n){let{diagnostics:r}=t.state.field(ri),s,i=-1,l=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(d,h,{spec:m})=>{if(e>=d&&e<=h&&(d==h||(e>d||n>0)&&(ej_(t,n,!1)))}const BZ=t=>{let e=t.state.field(ri,!1);(!e||!e.panel)&&t.dispatch({effects:DZ(t.state,[i5.of(!0)])});let n=wf(t,Df.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},z7=t=>{let e=t.state.field(ri,!1);return!e||!e.panel?!1:(t.dispatch({effects:i5.of(!1)}),!0)},LZ=t=>{let e=t.state.field(ri,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},IZ=[{key:"Mod-Shift-m",run:BZ,preventDefault:!0},{key:"F8",run:LZ}],_f=He.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...Oa(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:P7,tooltipFilter:P7,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,s,i)=>e(r,s,i)||n(r,s,i):e:n,autoPanel:(e,n)=>e||n})}}});function P7(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function O_(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;ri.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function j_(t,e,n){var r;let s=n?O_(e.actions):[];return Mn("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Mn("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,l)=>{let c=!1,d=v=>{if(v.preventDefault(),c)return;c=!0;let b=xd(t.state.field(ri).diagnostics,e);b&&i.apply(t,b.from,b.to)},{name:h}=i,m=s[l]?h.indexOf(s[l]):-1,p=m<0?h:[h.slice(0,m),Mn("u",h.slice(m,m+1)),h.slice(m+1)],x=i.markClass?" "+i.markClass:"";return Mn("button",{type:"button",class:"cm-diagnosticAction"+x,onclick:d,onmousedown:d,"aria-label":` Action: ${h}${m<0?"":` (access key "${s[l]})"`}.`},p)}),e.source&&Mn("div",{class:"cm-diagnosticSource"},e.source))}class qZ extends ja{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Mn("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class B7{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=j_(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Df{constructor(e){this.view=e,this.items=[];let n=s=>{if(s.keyCode==27)z7(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],l=O_(i.actions);for(let c=0;c{for(let i=0;iz7(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(ri).selected;if(!e)return-1;for(let n=0;n{for(let m of h.diagnostics){if(l.has(m))continue;l.add(m);let p=-1,x;for(let v=r;vr&&(this.items.splice(r,p-r),s=!0)),n&&x.diagnostic==n.diagnostic?x.dom.hasAttribute("aria-selected")||(x.dom.setAttribute("aria-selected","true"),i=x):x.dom.hasAttribute("aria-selected")&&x.dom.removeAttribute("aria-selected"),r++}});r({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:c,panel:d})=>{let h=d.height/this.list.offsetHeight;c.topd.bottom&&(this.list.scrollTop+=(c.bottom-d.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(ri),r=xd(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:k_.of(r)})}static open(e){return new Df(e)}}function FZ(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function wp(t){return FZ(``,'width="6" height="3"')}const QZ=qe.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:wp("#d11")},".cm-lintRange-warning":{backgroundImage:wp("orange")},".cm-lintRange-info":{backgroundImage:wp("#999")},".cm-lintRange-hint":{backgroundImage:wp("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function $Z(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function HZ(t){let e="hint",n=1;for(let r of t){let s=$Z(r.severity);s>n&&(n=s,e=r.severity)}return e}const UZ=[ri,qe.decorations.compute([ri],t=>{let{selected:e,panel:n}=t.field(ri);return!e||!n||e.from==e.to?Je.none:Je.set([RZ.range(e.from,e.to)])}),NG(zZ,{hideOn:_Z}),QZ];var L7=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(kZ)),e.defaultKeymap!==!1&&(r=r.concat(aK)),e.searchKeymap!==!1&&(r=r.concat(_K)),e.historyKeymap!==!1&&(r=r.concat(fY)),e.foldKeymap!==!1&&(r=r.concat(kX)),e.completionKeymap!==!1&&(r=r.concat(w_)),e.lintKeymap!==!1&&(r=r.concat(IZ));var s=[];return e.lineNumbers!==!1&&s.push(BG()),e.highlightActiveLineGutter!==!1&&s.push(qG()),e.highlightSpecialChars!==!1&&s.push(tG()),e.history!==!1&&s.push(sY()),e.foldGutter!==!1&&s.push(CX()),e.drawSelection!==!1&&s.push(HW()),e.dropCursor!==!1&&s.push(XW()),e.allowMultipleSelections!==!1&&s.push(Vt.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(mX()),e.syntaxHighlighting!==!1&&s.push(hE(EX,{fallback:!0})),e.bracketMatching!==!1&&s.push(LX()),e.closeBrackets!==!1&&s.push(yZ()),e.autocompletion!==!1&&s.push(MZ()),e.rectangularSelection!==!1&&s.push(pG()),n!==!1&&s.push(vG()),e.highlightActiveLine!==!1&&s.push(lG()),e.highlightSelectionMatches!==!1&&s.push(fK()),e.tabSize&&typeof e.tabSize=="number"&&s.push(u0.of(" ".repeat(e.tabSize))),s.concat([o0.of(r.flat())]).filter(Boolean)};const VZ="#e5c07b",I7="#e06c75",WZ="#56b6c2",GZ="#ffffff",sg="#abb2bf",o4="#7d8799",XZ="#61afef",YZ="#98c379",q7="#d19a66",KZ="#c678dd",ZZ="#21252b",F7="#2c313a",Q7="#282c34",eb="#353a42",JZ="#3E4451",$7="#528bff",eJ=qe.theme({"&":{color:sg,backgroundColor:Q7},".cm-content":{caretColor:$7},".cm-cursor, .cm-dropCursor":{borderLeftColor:$7},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:JZ},".cm-panels":{backgroundColor:ZZ,color:sg},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Q7,color:o4,border:"none"},".cm-activeLineGutter":{backgroundColor:F7},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:eb},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:eb,borderBottomColor:eb},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:F7,color:sg}}},{dark:!0}),tJ=h0.define([{tag:he.keyword,color:KZ},{tag:[he.name,he.deleted,he.character,he.propertyName,he.macroName],color:I7},{tag:[he.function(he.variableName),he.labelName],color:XZ},{tag:[he.color,he.constant(he.name),he.standard(he.name)],color:q7},{tag:[he.definition(he.name),he.separator],color:sg},{tag:[he.typeName,he.className,he.number,he.changed,he.annotation,he.modifier,he.self,he.namespace],color:VZ},{tag:[he.operator,he.operatorKeyword,he.url,he.escape,he.regexp,he.link,he.special(he.string)],color:WZ},{tag:[he.meta,he.comment],color:o4},{tag:he.strong,fontWeight:"bold"},{tag:he.emphasis,fontStyle:"italic"},{tag:he.strikethrough,textDecoration:"line-through"},{tag:he.link,color:o4,textDecoration:"underline"},{tag:he.heading,fontWeight:"bold",color:I7},{tag:[he.atom,he.bool,he.special(he.variableName)],color:q7},{tag:[he.processingInstruction,he.string,he.inserted],color:YZ},{tag:he.invalid,color:GZ}]),N_=[eJ,hE(tJ)];var nJ=qe.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),rJ=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:i="light",placeholder:l="",basicSetup:c=!0}=e,d=[];switch(n&&d.unshift(o0.of([lK])),c&&(typeof c=="boolean"?d.unshift(L7()):d.unshift(L7(c))),l&&d.unshift(dG(l)),i){case"light":d.push(nJ);break;case"dark":d.push(N_);break;case"none":break;default:d.push(i);break}return r===!1&&d.push(qe.editable.of(!1)),s&&d.push(Vt.readOnly.of(!0)),[...d]},sJ=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class iJ{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class H7{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var tb=null,aJ=()=>typeof window>"u"?new H7:(tb||(tb=new H7),tb),U7=ka.define(),lJ=200,oJ=[];function cJ(t){var{value:e,selection:n,onChange:r,onStatistics:s,onCreateEditor:i,onUpdate:l,extensions:c=oJ,autoFocus:d,theme:h="light",height:m=null,minHeight:p=null,maxHeight:x=null,width:v=null,minWidth:b=null,maxWidth:k=null,placeholder:O="",editable:j=!0,readOnly:T=!1,indentWithTab:A=!0,basicSetup:_=!0,root:D,initialState:E}=t,[R,Q]=S.useState(),[F,L]=S.useState(),[U,V]=S.useState(),de=S.useState(()=>({current:null}))[0],W=S.useState(()=>({current:null}))[0],J=qe.theme({"&":{height:m,minHeight:p,maxHeight:x,width:v,minWidth:b,maxWidth:k},"& .cm-scroller":{height:"100% !important"}}),$=qe.updateListener.of(ce=>{if(ce.docChanged&&typeof r=="function"&&!ce.transactions.some(Y=>Y.annotation(U7))){de.current?de.current.reset():(de.current=new iJ(()=>{if(W.current){var Y=W.current;W.current=null,Y()}de.current=null},lJ),aJ().add(de.current));var z=ce.state.doc,xe=z.toString();r(xe,ce)}s&&s(sJ(ce))}),ae=rJ({theme:h,editable:j,readOnly:T,placeholder:O,indentWithTab:A,basicSetup:_}),ne=[$,J,...ae];return l&&typeof l=="function"&&ne.push(qe.updateListener.of(l)),ne=ne.concat(c),S.useLayoutEffect(()=>{if(R&&!U){var ce={doc:e,selection:n,extensions:ne},z=E?Vt.fromJSON(E.json,ce,E.fields):Vt.create(ce);if(V(z),!F){var xe=new qe({state:z,parent:R,root:D});L(xe),i&&i(xe,z)}}return()=>{F&&(V(void 0),L(void 0))}},[R,U]),S.useEffect(()=>{t.container&&Q(t.container)},[t.container]),S.useEffect(()=>()=>{F&&(F.destroy(),L(void 0)),de.current&&(de.current.cancel(),de.current=null)},[F]),S.useEffect(()=>{d&&F&&F.focus()},[d,F]),S.useEffect(()=>{F&&F.dispatch({effects:vt.reconfigure.of(ne)})},[h,c,m,p,x,v,b,k,O,j,T,A,_,r,l]),S.useEffect(()=>{if(e!==void 0){var ce=F?F.state.doc.toString():"";if(F&&e!==ce){var z=de.current&&!de.current.isDone,xe=()=>{F&&e!==F.state.doc.toString()&&F.dispatch({changes:{from:0,to:F.state.doc.toString().length,insert:e||""},annotations:[U7.of(!0)]})};z?W.current=xe:xe()}}},[e,F]),{state:U,setState:V,view:F,setView:L,container:R,setContainer:Q}}var uJ=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],C_=S.forwardRef((t,e)=>{var{className:n,value:r="",selection:s,extensions:i=[],onChange:l,onStatistics:c,onCreateEditor:d,onUpdate:h,autoFocus:m,theme:p="light",height:x,minHeight:v,maxHeight:b,width:k,minWidth:O,maxWidth:j,basicSetup:T,placeholder:A,indentWithTab:_,editable:D,readOnly:E,root:R,initialState:Q}=t,F=VI(t,uJ),L=S.useRef(null),{state:U,view:V,container:de,setContainer:W}=cJ({root:R,value:r,autoFocus:m,theme:p,height:x,minHeight:v,maxHeight:b,width:k,minWidth:O,maxWidth:j,basicSetup:T,placeholder:A,indentWithTab:_,editable:D,readOnly:E,selection:s,onChange:l,onStatistics:c,onCreateEditor:d,onUpdate:h,extensions:i,initialState:Q});S.useImperativeHandle(e,()=>({editor:L.current,state:U,view:V}),[L,de,U,V]);var J=S.useCallback(ae=>{L.current=ae,W(ae)},[W]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var $=typeof p=="string"?"cm-theme-"+p:"cm-theme";return a.jsx("div",WI({ref:J,className:""+$+(n?" "+n:"")},F))});C_.displayName="CodeMirror";var V7={};class Qg{constructor(e,n,r,s,i,l,c,d,h,m=0,p){this.p=e,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=l,this.buffer=c,this.bufferBase=d,this.curContext=h,this.lookAhead=m,this.parent=p}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let s=e.parser.context;return new Qg(e,[],n,r,r,0,[],0,s?new W7(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,s=e&65535,{parser:i}=this.p,l=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=m):this.p.lastBigReductionSized;)this.stack.pop();this.reduceContext(s,h)}storeNode(e,n,r,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&l.buffer[c-4]==0&&l.buffer[c-1]>-1){if(n==r)return;if(l.buffer[c-2]>=n){l.buffer[c-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,s);else{let l=this.buffer.length;if(l>0&&(this.buffer[l-4]!=0||this.buffer[l-1]<0)){let c=!1;for(let d=l;d>0&&this.buffer[d-2]>r;d-=4)if(this.buffer[d-1]>=0){c=!0;break}if(c)for(;l>0&&this.buffer[l-2]>r;)this.buffer[l]=this.buffer[l-4],this.buffer[l+1]=this.buffer[l-3],this.buffer[l+2]=this.buffer[l-2],this.buffer[l+3]=this.buffer[l-1],l-=4,s>4&&(s-=4)}this.buffer[l]=e,this.buffer[l+1]=n,this.buffer[l+2]=r,this.buffer[l+3]=s}}shift(e,n,r,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:l}=this.p;(s>this.pos||n<=l.maxNode)&&(this.pos=s,l.stateFlag(i,1)||(this.reducePos=s)),this.pushState(i,r),this.shiftContext(n,r),n<=l.maxNode&&this.buffer.push(n,r,s,4)}else this.pos=s,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,s,4)}apply(e,n,r,s){e&65536?this.reduce(e):this.shift(e,n,r,s)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(n,s),this.buffer.push(r,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),s=e.bufferBase+n;for(;e&&s==e.bufferBase;)e=e.parent;return new Qg(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new dJ(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let s=[];for(let i=0,l;id&1&&c==l)||s.push(n[i],l)}n=s}let r=[];for(let s=0;s>19,s=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let l=this.findForcedReduction();if(l==null)return!1;n=l}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(s,i)=>{if(!n.includes(s))return n.push(s),e.allActions(s,l=>{if(!(l&393216))if(l&65536){let c=(l>>19)-i;if(c>1){let d=l&65535,h=this.stack.length-c*3;if(h>=0&&e.getGoto(this.stack[h],d,!1)>=0)return c<<19|65536|d}}else{let c=r(l,i+1);if(c!=null)return c}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;nthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class W7{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class dJ{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=s}}class $g{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new $g(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new $g(this.stack,this.pos,this.index)}}function Sp(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r=92&&l--,l>=34&&l--;let d=l-32;if(d>=46&&(d-=46,c=!0),i+=d,c)break;i*=46}n?n[s++]=i:n=new e(i)}return n}class ig{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const G7=new ig;class hJ{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=G7,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,s=this.rangeIndex,i=this.pos+e;for(;ir.to:i>=r.to;){if(s==this.ranges.length-1)return null;let l=this.ranges[++s];i+=l.from-r.to,r=l}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n=this.chunk2Pos&&rc.to&&(this.chunk2=this.chunk2.slice(0,c.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=G7,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let s of this.ranges){if(s.from>=n)break;s.to>e&&(r+=this.input.read(Math.max(s.from,e),Math.min(s.to,n)))}return r}}class Zu{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;fJ(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Zu.prototype.contextual=Zu.prototype.fallback=Zu.prototype.extend=!1;Zu.prototype.fallback=Zu.prototype.extend=!1;class Rx{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function fJ(t,e,n,r,s,i){let l=0,c=1<0){let b=t[v];if(d.allows(b)&&(e.token.value==-1||e.token.value==b||mJ(b,e.token.value,s,i))){e.acceptToken(b);break}}let m=e.next,p=0,x=t[l+2];if(e.next<0&&x>p&&t[h+x*3-3]==65535){l=t[h+x*3-1];continue e}for(;p>1,b=h+v+(v<<1),k=t[b],O=t[b+1]||65536;if(m=O)p=v+1;else{l=t[b+2],e.advance();continue e}}break}}function X7(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function mJ(t,e,n,r){let s=X7(n,r,e);return s<0||X7(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class pJ{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Y7(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Y7(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=l,null;if(i instanceof Dn){if(l==e){if(l=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(l),this.index.push(0))}else this.index[n]++,this.nextStart=l+i.length}}}class gJ{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new ig)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,l=s.stateSlot(e.state,3),c=e.curContext?e.curContext.hash:0,d=0;for(let h=0;hp.end+25&&(d=Math.max(p.lookAhead,d)),p.value!=0)){let x=n;if(p.extended>-1&&(n=this.addActions(e,p.extended,p.end,n)),n=this.addActions(e,p.value,p.end,n),!m.extend&&(r=p,n>x))break}}for(;this.actions.length>n;)this.actions.pop();return d&&e.setLookAhead(d),!r&&e.pos==this.stream.end&&(r=new ig,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new ig,{pos:r,p:s}=e;return n.start=r,n.end=Math.min(r+1,s.stream.end),n.value=r==s.stream.end?s.parser.eofTerm:0,n}updateCachedToken(e,n,r){let s=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(s,e),r),e.value>-1){let{parser:i}=r.p;for(let l=0;l=0&&r.p.parser.dialect.allows(c>>1)){(c&1)==0?e.value=c>>1:e.extended=c>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;ie.bufferLength*4?new pJ(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],s,i;if(this.bigReductionCount>300&&e.length==1){let[l]=e;for(;l.forceReduce()&&l.stack.length&&l.stack[l.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let l=0;ln)r.push(c);else{if(this.advanceStack(c,r,e))continue;{s||(s=[],i=[]),s.push(c);let d=this.tokens.getMainToken(c);i.push(d.value,d.end)}}break}}if(!r.length){let l=s&&bJ(s);if(l)return Ks&&console.log("Finish with "+this.stackID(l)),this.stackToTree(l);if(this.parser.strict)throw Ks&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&s){let l=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,r);if(l)return Ks&&console.log("Force-finish "+this.stackID(l)),this.stackToTree(l.forceAll())}if(this.recovering){let l=this.recovering==1?1:this.recovering*3;if(r.length>l)for(r.sort((c,d)=>d.score-c.score);r.length>l;)r.pop();r.some(c=>c.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let l=0;l500&&h.buffer.length>500)if((c.score-h.score||c.buffer.length-h.buffer.length)>0)r.splice(d--,1);else{r.splice(l--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let l=1;l ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,m=h?e.curContext.hash:0;for(let p=this.fragments.nodeAt(s);p;){let x=this.parser.nodeSet.types[p.type.id]==p.type?i.getGoto(e.state,p.type.id):-1;if(x>-1&&p.length&&(!h||(p.prop(Et.contextHash)||0)==m))return e.useNode(p,x),Ks&&console.log(l+this.stackID(e)+` (via reuse of ${i.getName(p.type.id)})`),!0;if(!(p instanceof Dn)||p.children.length==0||p.positions[0]>0)break;let v=p.children[0];if(v instanceof Dn&&p.positions[0]==0)p=v;else break}}let c=i.stateSlot(e.state,4);if(c>0)return e.reduce(c),Ks&&console.log(l+this.stackID(e)+` (via always-reduce ${i.getName(c&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let d=this.tokens.getActions(e);for(let h=0;hs?n.push(b):r.push(b)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return K7(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let l=0;l ":"";if(c.deadEnd&&(i||(i=!0,c.restart(),Ks&&console.log(m+this.stackID(c)+" (restarted)"),this.advanceFully(c,r))))continue;let p=c.split(),x=m;for(let v=0;v<10&&p.forceReduce()&&(Ks&&console.log(x+this.stackID(p)+" (via force-reduce)"),!this.advanceFully(p,r));v++)Ks&&(x=this.stackID(p)+" -> ");for(let v of c.recoverByInsert(d))Ks&&console.log(m+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,r);this.stream.end>c.pos?(h==c.pos&&(h++,d=0),c.recoverByDelete(d,h),Ks&&console.log(m+this.stackID(c)+` (via recover-delete ${this.parser.getName(d)})`),K7(c,r)):(!s||s.scoret;class yJ{constructor(e){this.start=e.start,this.shift=e.shift||rb,this.reduce=e.reduce||rb,this.reuse=e.reuse||rb,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Rf extends Bw{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let c=0;ce.topRules[c][1]),s=[];for(let c=0;c=0)i(m,d,c[h++]);else{let p=c[h+-m];for(let x=-m;x>0;x--)i(c[h++],d,p);h++}}}this.nodeSet=new jx(n.map((c,d)=>gs.define({name:d>=this.minRepeatTerm?void 0:c,id:d,props:s[d],top:r.indexOf(d)>-1,error:d==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(d)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=VM;let l=Sp(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let c=0;ctypeof c=="number"?new Zu(l,c):c),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let s=new xJ(this,e,n,r);for(let i of this.wrappers)s=i(s,e,n,r);return s}getGoto(e,n,r=!1){let s=this.goto;if(n>=s[0])return-1;for(let i=s[n+1];;){let l=s[i++],c=l&1,d=s[i++];if(c&&r)return d;for(let h=i+(l>>1);i0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),s=r?n(r):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=rl(this.data,i+2);else break;s=n(rl(this.data,i+1))}return s}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=rl(this.data,r+2);else break;if((this.data[r+2]&1)==0){let s=this.data[r+1];n.some((i,l)=>l&1&&i==s)||n.push(this.data[r],s)}}return n}configure(e){let n=Object.assign(Object.create(Rf.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let s=e.tokenizers.find(i=>i.from==r);return s?s.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,s)=>{let i=e.specializers.find(c=>c.from==r.external);if(!i)return r;let l=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=Z7(l),l})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let l=n.indexOf(i);l>=0&&(r[l]=!0)}let s=null;for(let i=0;ir)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}const wJ=1,T_=194,A_=195,SJ=196,J7=197,kJ=198,OJ=199,jJ=200,NJ=2,M_=3,e8=201,CJ=24,TJ=25,AJ=49,MJ=50,EJ=55,_J=56,DJ=57,RJ=59,zJ=60,PJ=61,BJ=62,LJ=63,IJ=65,qJ=238,FJ=71,QJ=241,$J=242,HJ=243,UJ=244,VJ=245,WJ=246,GJ=247,XJ=248,E_=72,YJ=249,KJ=250,ZJ=251,JJ=252,eee=253,tee=254,nee=255,ree=256,see=73,iee=77,aee=263,lee=112,oee=130,cee=151,uee=152,dee=155,jc=10,zf=13,a5=32,zx=9,l5=35,hee=40,fee=46,c4=123,t8=125,__=39,D_=34,n8=92,mee=111,pee=120,gee=78,xee=117,vee=85,yee=new Set([TJ,AJ,MJ,aee,IJ,oee,_J,DJ,qJ,BJ,LJ,E_,see,iee,zJ,PJ,cee,uee,dee,lee]);function sb(t){return t==jc||t==zf}function ib(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}const bee=new Rx((t,e)=>{let n;if(t.next<0)t.acceptToken(OJ);else if(e.context.flags&ag)sb(t.next)&&t.acceptToken(kJ,1);else if(((n=t.peek(-1))<0||sb(n))&&e.canShift(J7)){let r=0;for(;t.next==a5||t.next==zx;)t.advance(),r++;(t.next==jc||t.next==zf||t.next==l5)&&t.acceptToken(J7,-r)}else sb(t.next)&&t.acceptToken(SJ,1)},{contextual:!0}),wee=new Rx((t,e)=>{let n=e.context;if(n.flags)return;let r=t.peek(-1);if(r==jc||r==zf){let s=0,i=0;for(;;){if(t.next==a5)s++;else if(t.next==zx)s+=8-s%8;else break;t.advance(),i++}s!=n.indent&&t.next!=jc&&t.next!=zf&&t.next!=l5&&(s[t,e|R_])),Oee=new yJ({start:See,reduce(t,e,n,r){return t.flags&ag&&yee.has(e)||(e==FJ||e==E_)&&t.flags&R_?t.parent:t},shift(t,e,n,r){return e==T_?new lg(t,kee(r.read(r.pos,n.pos)),0):e==A_?t.parent:e==CJ||e==EJ||e==RJ||e==M_?new lg(t,0,ag):r8.has(e)?new lg(t,0,r8.get(e)|t.flags&ag):t},hash(t){return t.hash}}),jee=new Rx(t=>{for(let e=0;e<5;e++){if(t.next!="print".charCodeAt(e))return;t.advance()}if(!/\w/.test(String.fromCharCode(t.next)))for(let e=0;;e++){let n=t.peek(e);if(!(n==a5||n==zx)){n!=hee&&n!=fee&&n!=jc&&n!=zf&&n!=l5&&t.acceptToken(wJ);return}}}),Nee=new Rx((t,e)=>{let{flags:n}=e.context,r=n&Ja?D_:__,s=(n&el)>0,i=!(n&tl),l=(n&nl)>0,c=t.pos;for(;!(t.next<0);)if(l&&t.next==c4)if(t.peek(1)==c4)t.advance(2);else{if(t.pos==c){t.acceptToken(M_,1);return}break}else if(i&&t.next==n8){if(t.pos==c){t.advance();let d=t.next;d>=0&&(t.advance(),Cee(t,d)),t.acceptToken(NJ);return}break}else if(t.next==n8&&!i&&t.peek(1)>-1)t.advance(2);else if(t.next==r&&(!s||t.peek(1)==r&&t.peek(2)==r)){if(t.pos==c){t.acceptToken(e8,s?3:1);return}break}else if(t.next==jc){if(s)t.advance();else if(t.pos==c){t.acceptToken(e8);return}break}else t.advance();t.pos>c&&t.acceptToken(jJ)});function Cee(t,e){if(e==mee)for(let n=0;n<2&&t.next>=48&&t.next<=55;n++)t.advance();else if(e==pee)for(let n=0;n<2&&ib(t.next);n++)t.advance();else if(e==xee)for(let n=0;n<4&&ib(t.next);n++)t.advance();else if(e==vee)for(let n=0;n<8&&ib(t.next);n++)t.advance();else if(e==gee&&t.next==c4){for(t.advance();t.next>=0&&t.next!=t8&&t.next!=__&&t.next!=D_&&t.next!=jc;)t.advance();t.next==t8&&t.advance()}}const Tee=Lw({'async "*" "**" FormatConversion FormatSpec':he.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":he.controlKeyword,"in not and or is del":he.operatorKeyword,"from def class global nonlocal lambda":he.definitionKeyword,import:he.moduleKeyword,"with as print":he.keyword,Boolean:he.bool,None:he.null,VariableName:he.variableName,"CallExpression/VariableName":he.function(he.variableName),"FunctionDefinition/VariableName":he.function(he.definition(he.variableName)),"ClassDefinition/VariableName":he.definition(he.className),PropertyName:he.propertyName,"CallExpression/MemberExpression/PropertyName":he.function(he.propertyName),Comment:he.lineComment,Number:he.number,String:he.string,FormatString:he.special(he.string),Escape:he.escape,UpdateOp:he.updateOperator,"ArithOp!":he.arithmeticOperator,BitOp:he.bitwiseOperator,CompareOp:he.compareOperator,AssignOp:he.definitionOperator,Ellipsis:he.punctuation,At:he.meta,"( )":he.paren,"[ ]":he.squareBracket,"{ }":he.brace,".":he.derefOperator,", ;":he.separator}),Aee={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},Mee=Rf.deserialize({version:14,states:"##jO`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[jee,wee,bee,Nee,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:t=>Aee[t]||-1}],tokenPrec:7668}),s8=new WG,z_=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function kp(t){return(e,n,r)=>{if(r)return!1;let s=e.node.getChild("VariableName");return s&&n(s,t),!0}}const Eee={FunctionDefinition:kp("function"),ClassDefinition:kp("class"),ForStatement(t,e,n){if(n){for(let r=t.node.firstChild;r;r=r.nextSibling)if(r.name=="VariableName")e(r,"variable");else if(r.name=="in")break}},ImportStatement(t,e){var n,r;let{node:s}=t,i=((n=s.firstChild)===null||n===void 0?void 0:n.name)=="from";for(let l=s.getChild("import");l;l=l.nextSibling)l.name=="VariableName"&&((r=l.nextSibling)===null||r===void 0?void 0:r.name)!="as"&&e(l,i?"variable":"namespace")},AssignStatement(t,e){for(let n=t.node.firstChild;n;n=n.nextSibling)if(n.name=="VariableName")e(n,"variable");else if(n.name==":"||n.name=="AssignOp")break},ParamList(t,e){for(let n=null,r=t.node.firstChild;r;r=r.nextSibling)r.name=="VariableName"&&(!n||!/\*|AssignOp/.test(n.name))&&e(r,"variable"),n=r},CapturePattern:kp("variable"),AsPattern:kp("variable"),__proto__:null};function P_(t,e){let n=s8.get(e);if(n)return n;let r=[],s=!0;function i(l,c){let d=t.sliceString(l.from,l.to);r.push({label:d,type:c})}return e.cursor(Or.IncludeAnonymous).iterate(l=>{if(l.name){let c=Eee[l.name];if(c&&c(l,i,s)||!s&&z_.has(l.name))return!1;s=!1}else if(l.to-l.from>8192){for(let c of P_(t,l.node))r.push(c);return!1}}),s8.set(e,r),r}const i8=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,B_=["String","FormatString","Comment","PropertyName"];function _ee(t){let e=zr(t.state).resolveInner(t.pos,-1);if(B_.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&i8.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let s=e;s;s=s.parent)z_.has(s.name)&&(r=r.concat(P_(t.state.doc,s)));return{options:r,from:n?e.from:t.pos,validFor:i8}}const Dee=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(t=>({label:t,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(t=>({label:t,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(t=>({label:t,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(t=>({label:t,type:"function"}))),Ree=[Ya("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),Ya("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),Ya("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),Ya("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),Ya(`if \${}: + +`,{label:"if",detail:"block",type:"keyword"}),Ya("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),Ya("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),Ya("import ${module}",{label:"import",detail:"statement",type:"keyword"}),Ya("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],zee=BK(B_,d_(Dee.concat(Ree)));function ab(t){let{node:e,pos:n}=t,r=t.lineIndent(n,-1),s=null;for(;;){let i=e.childBefore(n);if(i)if(i.name=="Comment")n=i.from;else if(i.name=="Body"||i.name=="MatchBody")t.baseIndentFor(i)+t.unit<=r&&(s=i),e=i;else if(i.name=="MatchClause")e=i;else if(i.type.is("Statement"))e=i;else break;else break}return s}function lb(t,e){let n=t.baseIndentFor(e),r=t.lineAt(t.pos,-1),s=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&t.node.ton?null:n+t.unit}const ob=jf.define({name:"python",parser:Mee.configure({props:[Cx.add({Body:t=>{var e;let n=/^\s*(#|$)/.test(t.textAfter)&&ab(t)||t.node;return(e=lb(t,n))!==null&&e!==void 0?e:t.continue()},MatchBody:t=>{var e;let n=ab(t);return(e=lb(t,n||t.node))!==null&&e!==void 0?e:t.continue()},IfStatement:t=>/^\s*(else:|elif )/.test(t.textAfter)?t.baseIndent:t.continue(),"ForStatement WhileStatement":t=>/^\s*else:/.test(t.textAfter)?t.baseIndent:t.continue(),TryStatement:t=>/^\s*(except[ :]|finally:|else:)/.test(t.textAfter)?t.baseIndent:t.continue(),MatchStatement:t=>/^\s*case /.test(t.textAfter)?t.baseIndent+t.unit:t.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":Hy({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Hy({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Hy({closing:"]"}),MemberExpression:t=>t.baseIndent+t.unit,"String FormatString":()=>null,Script:t=>{var e;let n=ab(t);return(e=n&&lb(t,n))!==null&&e!==void 0?e:t.continue()}}),Fw.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":rE,Body:(t,e)=>({from:t.from+1,to:t.to-(t.to==e.doc.length?0:1)}),"String FormatString":(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function Pee(){return new eE(ob,[ob.data.of({autocomplete:_ee}),ob.data.of({autocomplete:zee})])}const Bee=Lw({String:he.string,Number:he.number,"True False":he.bool,PropertyName:he.propertyName,Null:he.null,", :":he.separator,"[ ]":he.squareBracket,"{ }":he.brace}),Lee=Rf.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[Bee],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Iee=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=qee(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function qee(t,e){let n;return(n=t.message.match(/at position (\d+)/))?Math.min(+n[1],e.length):(n=t.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+n[1]).from+ +n[2]-1,e.length):0}const Fee=jf.define({name:"json",parser:Lee.configure({props:[Cx.add({Object:a7({except:/^\s*\}/}),Array:a7({except:/^\s*\]/})}),Fw.add({"Object Array":rE})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Qee(){return new eE(Fee)}const $ee={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(t,e){let n;if(!e.inString&&(n=t.match(/^('''|"""|'|")/))&&(e.stringType=n[0],e.inString=!0),t.sol()&&!e.inString&&e.inArray===0&&(e.lhs=!0),e.inString){for(;e.inString;)if(t.match(e.stringType))e.inString=!1;else if(t.peek()==="\\")t.next(),t.next();else{if(t.eol())break;t.match(/^.[^\\\"\']*/)}return e.lhs?"property":"string"}else{if(e.inArray&&t.peek()==="]")return t.next(),e.inArray--,"bracket";if(e.lhs&&t.peek()==="["&&t.skipTo("]"))return t.next(),t.peek()==="]"&&t.next(),"atom";if(t.peek()==="#")return t.skipToEnd(),"comment";if(t.eatSpace())return null;if(e.lhs&&t.eatWhile(function(r){return r!="="&&r!=" "}))return"property";if(e.lhs&&t.peek()==="=")return t.next(),e.lhs=!1,null;if(!e.lhs&&t.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!e.lhs&&(t.match("true")||t.match("false")))return"atom";if(!e.lhs&&t.peek()==="[")return e.inArray++,t.next(),"bracket";if(!e.lhs&&t.match(/^\-?\d+(?:\.\d+)?/))return"number";t.eatSpace()||t.next()}return null},languageData:{commentTokens:{line:"#"}}},Hee={python:[Pee()],json:[Qee(),Iee()],toml:[Qw.define($ee)],text:[]};function Uee({value:t,onChange:e,language:n="text",readOnly:r=!1,height:s="400px",minHeight:i,maxHeight:l,placeholder:c,theme:d="dark",className:h=""}){const[m,p]=S.useState(!1);if(S.useEffect(()=>{p(!0)},[]),!m)return a.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${h}`,style:{height:s,minHeight:i,maxHeight:l}});const x=[...Hee[n]||[],qe.lineWrapping];return r&&x.push(qe.editable.of(!1)),a.jsx("div",{className:`rounded-md overflow-hidden border ${h}`,children:a.jsx(C_,{value:t,height:s,minHeight:i,maxHeight:l,theme:d==="dark"?N_:void 0,extensions:x,onChange:e,placeholder:c,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function Vee(){const[t,e]=S.useState(!0),[n,r]=S.useState(!1),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState("visual"),[b,k]=S.useState(""),[O,j]=S.useState(!1),{toast:T}=Pr(),[A,_]=S.useState(null),[D,E]=S.useState(null),[R,Q]=S.useState(null),[F,L]=S.useState(null),[U,V]=S.useState(null),[de,W]=S.useState(null),[J,$]=S.useState(null),[ae,ne]=S.useState(null),[ce,z]=S.useState(null),[xe,Y]=S.useState(null),[P,K]=S.useState(null),[H,fe]=S.useState(null),[ve,Re]=S.useState(null),[ue,We]=S.useState(null),[ct,Oe]=S.useState(null),[nt,ut]=S.useState(null),[Ct,In]=S.useState(null),[Tn,Jn]=S.useState(null),nn=S.useRef(null),_t=S.useRef(!0),Yr=S.useRef({}),qn=S.useCallback(async()=>{try{const re=await RU();k(re),j(!1)}catch(re){T({variant:"destructive",title:"加载失败",description:re instanceof Error?re.message:"加载源代码失败"})}},[T]),or=S.useCallback(async()=>{try{e(!0);const re=await DU();Yr.current=re,_(re.bot),E(re.personality);const Ae=re.chat;Ae.talk_value_rules||(Ae.talk_value_rules=[]),Q(Ae),L(re.expression),V(re.emoji),W(re.memory),$(re.tool),ne(re.mood),z(re.voice),Y(re.lpmm_knowledge),K(re.keyword_reaction),fe(re.response_post_process),Re(re.chinese_typo),We(re.response_splitter),Oe(re.log),ut(re.debug),In(re.maim_message),Jn(re.telemetry),c(!1),_t.current=!1,await qn()}catch(re){console.error("加载配置失败:",re),T({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{e(!1)}},[T,qn]);S.useEffect(()=>{or()},[or]);const yn=S.useCallback(async(re,Ae)=>{if(!_t.current)try{i(!0),await PU(re,Ae),c(!1)}catch(pt){console.error(`自动保存 ${re} 失败:`,pt),c(!0)}finally{i(!1)}},[]),ft=S.useCallback((re,Ae)=>{_t.current||(c(!0),nn.current&&clearTimeout(nn.current),nn.current=setTimeout(()=>{yn(re,Ae)},2e3))},[yn]);S.useEffect(()=>{A&&!_t.current&&ft("bot",A)},[A,ft]),S.useEffect(()=>{D&&!_t.current&&ft("personality",D)},[D,ft]),S.useEffect(()=>{R&&!_t.current&&ft("chat",R)},[R,ft]),S.useEffect(()=>{F&&!_t.current&&ft("expression",F)},[F,ft]),S.useEffect(()=>{U&&!_t.current&&ft("emoji",U)},[U,ft]),S.useEffect(()=>{de&&!_t.current&&ft("memory",de)},[de,ft]),S.useEffect(()=>{J&&!_t.current&&ft("tool",J)},[J,ft]),S.useEffect(()=>{ae&&!_t.current&&ft("mood",ae)},[ae,ft]),S.useEffect(()=>{ce&&!_t.current&&ft("voice",ce)},[ce,ft]),S.useEffect(()=>{xe&&!_t.current&&ft("lpmm_knowledge",xe)},[xe,ft]),S.useEffect(()=>{P&&!_t.current&&ft("keyword_reaction",P)},[P,ft]),S.useEffect(()=>{H&&!_t.current&&ft("response_post_process",H)},[H,ft]),S.useEffect(()=>{ve&&!_t.current&&ft("chinese_typo",ve)},[ve,ft]),S.useEffect(()=>{ue&&!_t.current&&ft("response_splitter",ue)},[ue,ft]),S.useEffect(()=>{ct&&!_t.current&&ft("log",ct)},[ct,ft]),S.useEffect(()=>{nt&&!_t.current&&ft("debug",nt)},[nt,ft]),S.useEffect(()=>{Ct&&!_t.current&&ft("maim_message",Ct)},[Ct,ft]),S.useEffect(()=>{Tn&&!_t.current&&ft("telemetry",Tn)},[Tn,ft]);const ee=async()=>{try{r(!0),await zU(b),c(!1),j(!1),T({title:"保存成功",description:"配置已保存"}),await or()}catch(re){j(!0),T({variant:"destructive",title:"保存失败",description:re instanceof Error?re.message:"保存配置失败"})}finally{r(!1)}},Se=async re=>{if(l){T({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}v(re),re==="source"?await qn():await or()},Be=async()=>{try{r(!0),nn.current&&clearTimeout(nn.current);const re={...Yr.current,bot:A,personality:D,chat:R,expression:F,emoji:U,memory:de,tool:J,mood:ae,voice:ce,lpmm_knowledge:xe,keyword_reaction:P,response_post_process:H,chinese_typo:ve,response_splitter:ue,log:ct,debug:nt,maim_message:Ct,telemetry:Tn};await XO(re),c(!1),T({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(re){console.error("保存配置失败:",re),T({title:"保存失败",description:re.message,variant:"destructive"})}finally{r(!1)}},rt=async()=>{try{h(!0),xw().catch(()=>{}),p(!0)}catch(re){console.error("重启失败:",re),p(!1),T({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),h(!1)}},Tt=async()=>{try{r(!0),nn.current&&clearTimeout(nn.current);const re={...Yr.current,bot:A,personality:D,chat:R,expression:F,emoji:U,memory:de,tool:J,mood:ae,voice:ce,lpmm_knowledge:xe,keyword_reaction:P,response_post_process:H,chinese_typo:ve,response_splitter:ue,log:ct,debug:nt,maim_message:Ct,telemetry:Tn};await XO(re),c(!1),T({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(Ae=>setTimeout(Ae,500)),await rt()}catch(re){console.error("保存失败:",re),T({title:"保存失败",description:re.message,variant:"destructive"})}finally{r(!1)}},cr=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Kr=()=>{p(!1),h(!1),T({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return t?a.jsx(vn,{className:"h-full",children:a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto items-center",children:[a.jsx(hl,{value:x,onValueChange:re=>Se(re),className:"w-auto",children:a.jsxs(ya,{className:"h-9",children:[a.jsxs($t,{value:"visual",className:"text-xs sm:text-sm px-2 sm:px-3",children:[a.jsx(bq,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化"]}),a.jsxs($t,{value:"source",className:"text-xs sm:text-sm px-2 sm:px-3",children:[a.jsx(wq,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码"]})]})}),a.jsxs(ie,{onClick:x==="visual"?Be:ee,disabled:n||s||!l||d,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":s?"自动保存中...":l?"保存配置":"已保存"]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:n||s||d,size:"sm",className:"flex-1 sm:flex-none",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),d?"重启中...":l?"保存并重启":"重启麦麦"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重启麦麦?"}),a.jsx(dn,{children:l?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:l?Tt:rt,children:l?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),x==="source"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:[a.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",O&&a.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),a.jsx(Uee,{value:b,onChange:re=>{k(re),c(!0),O&&j(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),x==="visual"&&a.jsx(a.Fragment,{children:a.jsxs(hl,{defaultValue:"bot",className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:a.jsxs(ya,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[a.jsx($t,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),a.jsx($t,{value:"personality",className:"flex-shrink-0",children:"人格"}),a.jsx($t,{value:"chat",className:"flex-shrink-0",children:"聊天"}),a.jsx($t,{value:"expression",className:"flex-shrink-0",children:"表达"}),a.jsx($t,{value:"features",className:"flex-shrink-0",children:"功能"}),a.jsx($t,{value:"processing",className:"flex-shrink-0",children:"处理"}),a.jsx($t,{value:"mood",className:"flex-shrink-0",children:"情绪"}),a.jsx($t,{value:"voice",className:"flex-shrink-0",children:"语音"}),a.jsx($t,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),a.jsx($t,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),a.jsx(kn,{value:"bot",className:"space-y-4",children:A&&a.jsx(Wee,{config:A,onChange:_})}),a.jsx(kn,{value:"personality",className:"space-y-4",children:D&&a.jsx(Gee,{config:D,onChange:E})}),a.jsx(kn,{value:"chat",className:"space-y-4",children:R&&a.jsx(Xee,{config:R,onChange:Q})}),a.jsx(kn,{value:"expression",className:"space-y-4",children:F&&a.jsx(Yee,{config:F,onChange:L})}),a.jsx(kn,{value:"features",className:"space-y-4",children:U&&de&&J&&a.jsx(Kee,{emojiConfig:U,memoryConfig:de,toolConfig:J,onEmojiChange:V,onMemoryChange:W,onToolChange:$})}),a.jsx(kn,{value:"processing",className:"space-y-4",children:P&&H&&ve&&ue&&a.jsx(Zee,{keywordReactionConfig:P,responsePostProcessConfig:H,chineseTypoConfig:ve,responseSplitterConfig:ue,onKeywordReactionChange:K,onResponsePostProcessChange:fe,onChineseTypoChange:Re,onResponseSplitterChange:We})}),a.jsx(kn,{value:"mood",className:"space-y-4",children:ae&&a.jsx(Jee,{config:ae,onChange:ne})}),a.jsx(kn,{value:"voice",className:"space-y-4",children:ce&&a.jsx(ete,{config:ce,onChange:z})}),a.jsx(kn,{value:"lpmm",className:"space-y-4",children:xe&&a.jsx(tte,{config:xe,onChange:Y})}),a.jsxs(kn,{value:"other",className:"space-y-4",children:[ct&&a.jsx(nte,{config:ct,onChange:Oe}),nt&&a.jsx(rte,{config:nt,onChange:ut}),Ct&&a.jsx(ste,{config:Ct,onChange:In}),Tn&&a.jsx(ite,{config:Tn,onChange:Jn})]})]})}),m&&a.jsx(vw,{onRestartComplete:cr,onRestartFailed:Kr})]})})}function Wee({config:t,onChange:e}){const n=()=>{e({...t,platforms:[...t.platforms,""]})},r=d=>{e({...t,platforms:t.platforms.filter((h,m)=>m!==d)})},s=(d,h)=>{const m=[...t.platforms];m[d]=h,e({...t,platforms:m})},i=()=>{e({...t,alias_names:[...t.alias_names,""]})},l=d=>{e({...t,alias_names:t.alias_names.filter((h,m)=>m!==d)})},c=(d,h)=>{const m=[...t.alias_names];m[d]=h,e({...t,alias_names:m})};return a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"platform",children:"平台"}),a.jsx(Me,{id:"platform",value:t.platform,onChange:d=>e({...t,platform:d.target.value}),placeholder:"qq"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"qq_account",children:"QQ账号"}),a.jsx(Me,{id:"qq_account",value:t.qq_account,onChange:d=>e({...t,qq_account:d.target.value}),placeholder:"123456789"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称"}),a.jsx(Me,{id:"nickname",value:t.nickname,onChange:d=>e({...t,nickname:d.target.value}),placeholder:"麦麦"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"其他平台账号"}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),a.jsxs("div",{className:"space-y-2",children:[t.platforms.map((d,h)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{value:d,onChange:m=>s(h,m.target.value),placeholder:"wx:114514"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除平台账号 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(h),children:"删除"})]})]})]})]},h)),t.platforms.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"别名"}),a.jsxs(ie,{onClick:i,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),a.jsxs("div",{className:"space-y-2",children:[t.alias_names.map((d,h)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{value:d,onChange:m=>c(h,m.target.value),placeholder:"小麦"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除别名 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>l(h),children:"删除"})]})]})]})]},h)),t.alias_names.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function Gee({config:t,onChange:e}){const n=()=>{e({...t,states:[...t.states,""]})},r=i=>{e({...t,states:t.states.filter((l,c)=>c!==i)})},s=(i,l)=>{const c=[...t.states];c[i]=l,e({...t,states:c})};return a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"personality",children:"人格特质"}),a.jsx(_n,{id:"personality",value:t.personality,onChange:i=>e({...t,personality:i.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"reply_style",children:"表达风格"}),a.jsx(_n,{id:"reply_style",value:t.reply_style,onChange:i=>e({...t,reply_style:i.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"interest",children:"兴趣"}),a.jsx(_n,{id:"interest",value:t.interest,onChange:i=>e({...t,interest:i.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"plan_style",children:"说话规则与行为风格"}),a.jsx(_n,{id:"plan_style",value:t.plan_style,onChange:i=>e({...t,plan_style:i.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"visual_style",children:"识图规则"}),a.jsx(_n,{id:"visual_style",value:t.visual_style,onChange:i=>e({...t,visual_style:i.target.value}),placeholder:"识图时的处理规则",rows:3})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"private_plan_style",children:"私聊规则"}),a.jsx(_n,{id:"private_plan_style",value:t.private_plan_style,onChange:i=>e({...t,private_plan_style:i.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"状态列表(人格多样性)"}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),a.jsx("div",{className:"space-y-2",children:t.states.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(_n,{value:i,onChange:c=>s(l,c.target.value),placeholder:"描述一个人格状态",rows:2}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsx(dn,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(l),children:"删除"})]})]})]})]},l))})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"state_probability",children:"状态替换概率"}),a.jsx(Me,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:t.state_probability,onChange:i=>e({...t,state_probability:parseFloat(i.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function Xee({config:t,onChange:e}){const n=()=>{e({...t,talk_value_rules:[...t.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},r=c=>{e({...t,talk_value_rules:t.talk_value_rules.filter((d,h)=>h!==c)})},s=(c,d,h)=>{const m=[...t.talk_value_rules];m[c]={...m[c],[d]:h},e({...t,talk_value_rules:m})},i=({value:c,onChange:d})=>{const[h,m]=S.useState("00"),[p,x]=S.useState("00"),[v,b]=S.useState("23"),[k,O]=S.useState("59");S.useEffect(()=>{const T=c.split("-");if(T.length===2){const[A,_]=T,[D,E]=A.split(":"),[R,Q]=_.split(":");D&&m(D.padStart(2,"0")),E&&x(E.padStart(2,"0")),R&&b(R.padStart(2,"0")),Q&&O(Q.padStart(2,"0"))}},[c]);const j=(T,A,_,D)=>{const E=`${T}:${A}-${_}:${D}`;d(E)};return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[a.jsx(dc,{className:"h-4 w-4 mr-2"}),c||"选择时间段"]})}),a.jsx(fl,{className:"w-80",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"小时"}),a.jsxs(Lt,{value:h,onValueChange:T=>{m(T),j(T,p,v,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:24},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"分钟"}),a.jsxs(Lt,{value:p,onValueChange:T=>{x(T),j(h,T,v,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:60},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"小时"}),a.jsxs(Lt,{value:v,onValueChange:T=>{b(T),j(h,p,T,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:24},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"分钟"}),a.jsxs(Lt,{value:k,onValueChange:T=>{O(T),j(h,p,v,T)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:60},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]})]})]})]})})]})},l=({rule:c})=>{const d=`{ target = "${c.target}", time = "${c.time}", value = ${c.value.toFixed(1)} }`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-96",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:d}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),a.jsx(Me,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:t.talk_value,onChange:c=>e({...t,talk_value:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"mentioned_bot_reply",children:"提及回复增幅"}),a.jsx(Me,{id:"mentioned_bot_reply",type:"number",step:"0.1",min:"0",max:"1",value:t.mentioned_bot_reply,onChange:c=>e({...t,mentioned_bot_reply:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"提及时回复概率增幅,1 为 100% 回复"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_context_size",children:"上下文长度"}),a.jsx(Me,{id:"max_context_size",type:"number",min:"1",value:t.max_context_size,onChange:c=>e({...t,max_context_size:parseInt(c.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"planner_smooth",children:"规划器平滑"}),a.jsx(Me,{id:"planner_smooth",type:"number",step:"1",min:"0",value:t.planner_smooth,onChange:c=>e({...t,planner_smooth:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_talk_value_rules",checked:t.enable_talk_value_rules,onCheckedChange:c=>e({...t,enable_talk_value_rules:c})}),a.jsx(te,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"include_planner_reasoning",checked:t.include_planner_reasoning,onCheckedChange:c=>e({...t,include_planner_reasoning:c})}),a.jsx(te,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),t.enable_talk_value_rules&&a.jsxs("div",{className:"border-t pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),a.jsxs(ie,{onClick:n,size:"sm",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),t.talk_value_rules&&t.talk_value_rules.length>0?a.jsx("div",{className:"space-y-4",children:t.talk_value_rules.map((c,d)=>a.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",d+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(l,{rule:c}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{variant:"ghost",size:"sm",children:a.jsx(Ht,{className:"h-4 w-4 text-destructive"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除规则 #",d+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(d),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"配置类型"}),a.jsxs(Lt,{value:c.target===""?"global":"specific",onValueChange:h=>{h==="global"?s(d,"target",""):s(d,"target","qq::group")},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"global",children:"全局配置"}),a.jsx(Pe,{value:"specific",children:"详细配置"})]})]})]}),c.target!==""&&(()=>{const h=c.target.split(":"),m=h[0]||"qq",p=h[1]||"",x=h[2]||"group";return a.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"平台"}),a.jsxs(Lt,{value:m,onValueChange:v=>{s(d,"target",`${v}:${p}:${x}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"qq",children:"QQ"}),a.jsx(Pe,{value:"wx",children:"微信"})]})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"群 ID"}),a.jsx(Me,{value:p,onChange:v=>{s(d,"target",`${m}:${v.target.value}:${x}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"类型"}),a.jsxs(Lt,{value:x,onValueChange:v=>{s(d,"target",`${m}:${p}:${v}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"group",children:"群组(group)"}),a.jsx(Pe,{value:"private",children:"私聊(private)"})]})]})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",c.target||"(未设置)"]})]})})(),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"时间段 (Time)"}),a.jsx(i,{value:c.time,onChange:h=>s(d,"time",h)}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{htmlFor:`rule-value-${d}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),a.jsx(Me,{id:`rule-value-${d}`,type:"number",step:"0.01",min:"0",max:"1",value:c.value,onChange:h=>{const m=parseFloat(h.target.value);isNaN(m)||s(d,"value",Math.max(0,Math.min(1,m)))},className:"w-20 h-8 text-xs"})]}),a.jsx(yx,{value:[c.value],onValueChange:h=>s(d,"value",h[0]),min:0,max:1,step:.01,className:"w-full"}),a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:"0 (完全沉默)"}),a.jsx("span",{children:"0.5"}),a.jsx("span",{children:"1.0 (正常)"})]})]})]})]},d))}):a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:a.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),a.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[a.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),a.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function Yee({config:t,onChange:e}){const n=()=>{e({...t,learning_list:[...t.learning_list,["","enable","enable","1.0"]]})},r=x=>{e({...t,learning_list:t.learning_list.filter((v,b)=>b!==x)})},s=(x,v,b)=>{const k=[...t.learning_list];k[x][v]=b,e({...t,learning_list:k})},i=({rule:x})=>{const v=`["${x[0]}", "${x[1]}", "${x[2]}", "${x[3]}"]`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-96",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:v}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},l=({member:x,groupIndex:v,memberIndex:b,availableChatIds:k})=>{const O=k.includes(x)||x==="*",[j,T]=S.useState(!O);return a.jsxs("div",{className:"flex gap-2",children:[a.jsx("div",{className:"flex-1 flex gap-2",children:j?a.jsxs(a.Fragment,{children:[a.jsx(Me,{value:x,onChange:A=>p(v,b,A.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),k.length>0&&a.jsx(ie,{size:"sm",variant:"outline",onClick:()=>T(!1),title:"切换到下拉选择",children:"下拉"})]}):a.jsxs(a.Fragment,{children:[a.jsxs(Lt,{value:x,onValueChange:A=>p(v,b,A),children:[a.jsx(Dt,{className:"flex-1",children:a.jsx(It,{placeholder:"选择聊天流"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"*",children:"* (全局共享)"}),k.map((A,_)=>a.jsx(Pe,{value:A,children:A},_))]})]}),a.jsx(ie,{size:"sm",variant:"outline",onClick:()=>T(!0),title:"切换到手动输入",children:"输入"})]})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除组成员 "',x||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>m(v,b),children:"删除"})]})]})]})]})},c=()=>{e({...t,expression_groups:[...t.expression_groups,[]]})},d=x=>{e({...t,expression_groups:t.expression_groups.filter((v,b)=>b!==x)})},h=x=>{const v=[...t.expression_groups];v[x]=[...v[x],""],e({...t,expression_groups:v})},m=(x,v)=>{const b=[...t.expression_groups];b[x]=b[x].filter((k,O)=>O!==v),e({...t,expression_groups:b})},p=(x,v,b)=>{const k=[...t.expression_groups];k[x][v]=b,e({...t,expression_groups:k})};return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),a.jsxs("div",{className:"space-y-4",children:[t.learning_list.map((x,v)=>{const b=t.learning_list.some((_,D)=>D!==v&&_[0]===""),k=x[0]==="",O=x[0].split(":"),j=O[0]||"qq",T=O[1]||"",A=O[2]||"group";return a.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["规则 ",v+1," ",k&&"(全局配置)"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(i,{rule:x}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除学习规则 ",v+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(v),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"配置类型"}),a.jsxs(Lt,{value:k?"global":"specific",onValueChange:_=>{_==="global"?s(v,0,""):s(v,0,"qq::group")},disabled:b&&!k,children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"global",children:"全局配置"}),a.jsx(Pe,{value:"specific",disabled:b&&!k,children:"详细配置"})]})]}),b&&!k&&a.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!k&&a.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"平台"}),a.jsxs(Lt,{value:j,onValueChange:_=>{s(v,0,`${_}:${T}:${A}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"qq",children:"QQ"}),a.jsx(Pe,{value:"wx",children:"微信"})]})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"群 ID"}),a.jsx(Me,{value:T,onChange:_=>{s(v,0,`${j}:${_.target.value}:${A}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"类型"}),a.jsxs(Lt,{value:A,onValueChange:_=>{s(v,0,`${j}:${T}:${_}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"group",children:"群组(group)"}),a.jsx(Pe,{value:"private",children:"私聊(private)"})]})]})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",x[0]||"(未设置)"]})]}),a.jsx("div",{className:"grid gap-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs font-medium",children:"使用学到的表达"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),a.jsx(jt,{checked:x[1]==="enable",onCheckedChange:_=>s(v,1,_?"enable":"disable")})]})}),a.jsx("div",{className:"grid gap-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs font-medium",children:"学习表达"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),a.jsx(jt,{checked:x[2]==="enable",onCheckedChange:_=>s(v,2,_?"enable":"disable")})]})}),a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-xs font-medium",children:"学习强度"}),a.jsx(Me,{type:"number",step:"0.1",min:"0",max:"5",value:x[3],onChange:_=>{const D=parseFloat(_.target.value);isNaN(D)||s(v,3,Math.max(0,Math.min(5,D)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),a.jsx(yx,{value:[parseFloat(x[3])||1],onValueChange:_=>s(v,3,_[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:"0 (不学习)"}),a.jsx("span",{children:"2.5"}),a.jsx("span",{children:"5.0 (快速学习)"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},v)}),t.learning_list.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),a.jsxs(ie,{onClick:c,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),a.jsxs("div",{className:"space-y-4",children:[t.expression_groups.map((x,v)=>{const b=t.learning_list.map(k=>k[0]).filter(k=>k!=="");return a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",v+1,x.length===1&&x[0]==="*"&&"(全局共享)"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ie,{onClick:()=>h(v),size:"sm",variant:"outline",children:a.jsx(Wr,{className:"h-4 w-4"})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除共享组 ",v+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>d(v),children:"删除"})]})]})]})]})]}),a.jsx("div",{className:"space-y-2",children:x.map((k,O)=>a.jsx(l,{member:k,groupIndex:v,memberIndex:O,availableChatIds:b},O))}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},v)}),t.expression_groups.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function Kee({emojiConfig:t,memoryConfig:e,toolConfig:n,onEmojiChange:r,onMemoryChange:s,onToolChange:i}){return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:l=>i({...n,enable_tool:l})}),a.jsx(te,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),a.jsx(Me,{id:"max_agent_iterations",type:"number",min:"1",value:e.max_agent_iterations,onChange:l=>s({...e,max_agent_iterations:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"emoji_chance",children:"表情包激活概率"}),a.jsx(Me,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:t.emoji_chance,onChange:l=>r({...t,emoji_chance:parseFloat(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_reg_num",children:"最大注册数量"}),a.jsx(Me,{id:"max_reg_num",type:"number",min:"1",value:t.max_reg_num,onChange:l=>r({...t,max_reg_num:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),a.jsx(Me,{id:"check_interval",type:"number",min:"1",value:t.check_interval,onChange:l=>r({...t,check_interval:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"do_replace",checked:t.do_replace,onCheckedChange:l=>r({...t,do_replace:l})}),a.jsx(te,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:l=>r({...t,steal_emoji:l})}),a.jsx(te,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),a.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:l=>r({...t,content_filtration:l})}),a.jsx(te,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),t.content_filtration&&a.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[a.jsx(te,{htmlFor:"filtration_prompt",children:"过滤要求"}),a.jsx(Me,{id:"filtration_prompt",value:t.filtration_prompt,onChange:l=>r({...t,filtration_prompt:l.target.value}),placeholder:"符合公序良俗"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function Zee({keywordReactionConfig:t,responsePostProcessConfig:e,chineseTypoConfig:n,responseSplitterConfig:r,onKeywordReactionChange:s,onResponsePostProcessChange:i,onChineseTypoChange:l,onResponseSplitterChange:c}){const d=()=>{s({...t,regex_rules:[...t.regex_rules,{regex:[""],reaction:""}]})},h=_=>{s({...t,regex_rules:t.regex_rules.filter((D,E)=>E!==_)})},m=(_,D,E)=>{const R=[...t.regex_rules];D==="regex"&&typeof E=="string"?R[_]={...R[_],regex:[E]}:D==="reaction"&&typeof E=="string"&&(R[_]={...R[_],reaction:E}),s({...t,regex_rules:R})},p=({regex:_,reaction:D,onRegexChange:E,onReactionChange:R})=>{const[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,de]=S.useState(null),[W,J]=S.useState(""),[$,ae]=S.useState({}),[ne,ce]=S.useState(""),z=S.useRef(null),[xe,Y]=S.useState("build"),P=ve=>ve.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),K=(ve,Re=0)=>{const ue=z.current;if(!ue)return;const We=ue.selectionStart||0,ct=ue.selectionEnd||0,Oe=_.substring(0,We)+ve+_.substring(ct);E(Oe),setTimeout(()=>{const nt=We+ve.length+Re;ue.setSelectionRange(nt,nt),ue.focus()},0)};S.useEffect(()=>{if(!_||!L){de(null),ae({}),ce(D),J("");return}try{const ve=P(_),Re=new RegExp(ve,"g"),ue=L.match(Re);de(ue),J("");const ct=new RegExp(ve).exec(L);if(ct&&ct.groups){ae(ct.groups);let Oe=D;Object.entries(ct.groups).forEach(([nt,ut])=>{Oe=Oe.replace(new RegExp(`\\[${nt}\\]`,"g"),ut||"")}),ce(Oe)}else ae({}),ce(D)}catch(ve){J(ve.message),de(null),ae({}),ce(D)}},[_,L,D]);const H=()=>{if(!L||!V||V.length===0)return a.jsx("span",{className:"text-muted-foreground",children:L||"请输入测试文本"});try{const ve=P(_),Re=new RegExp(ve,"g");let ue=0;const We=[];let ct;for(;(ct=Re.exec(L))!==null;)ct.index>ue&&We.push(a.jsx("span",{children:L.substring(ue,ct.index)},`text-${ue}`)),We.push(a.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:ct[0]},`match-${ct.index}`)),ue=ct.index+ct[0].length;return ue)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return a.jsxs(Rr,{open:Q,onOpenChange:F,children:[a.jsx(mw,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(fg,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"正则表达式编辑器"}),a.jsx(Gr,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),a.jsx(vn,{className:"max-h-[calc(90vh-120px)]",children:a.jsxs(hl,{value:xe,onValueChange:ve=>Y(ve),className:"w-full",children:[a.jsxs(ya,{className:"grid w-full grid-cols-2",children:[a.jsx($t,{value:"build",children:"🔧 构建器"}),a.jsx($t,{value:"test",children:"🧪 测试器"})]}),a.jsxs(kn,{value:"build",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"正则表达式"}),a.jsx(Me,{ref:z,value:_,onChange:ve=>E(ve.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"Reaction 内容"}),a.jsx(_n,{value:D,onChange:ve=>R(ve.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),a.jsxs("div",{className:"space-y-4 border-t pt-4",children:[fe.map(ve=>a.jsxs("div",{className:"space-y-2",children:[a.jsx("h5",{className:"text-xs font-semibold text-primary",children:ve.category}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:ve.items.map(Re=>a.jsx(ie,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>K(Re.pattern,Re.moveCursor||0),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsxs("div",{className:"flex items-center gap-2 w-full",children:[a.jsx("span",{className:"text-xs font-medium",children:Re.label}),a.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:Re.pattern})]}),a.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:Re.desc})]})},Re.label))})]},ve.category)),a.jsxs("div",{className:"space-y-2 border-t pt-4",children:[a.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("^(?P\\S{1,20})是这样的$"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?P.+?)(?:是|为什么|怎么)"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),a.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),a.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),a.jsxs("li",{children:["命名捕获组格式:",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),a.jsxs("li",{children:["在 reaction 中使用 ",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),a.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),a.jsxs(kn,{value:"test",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"当前正则表达式"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:_||"(未设置)"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),a.jsx(_n,{id:"test-text",value:L,onChange:ve=>U(ve.target.value),placeholder:`在此输入要测试的文本... +例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),W&&a.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[a.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),a.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:W})]}),!W&&L&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"flex items-center gap-2",children:V&&V.length>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),a.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",V.length," 处)"]})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),a.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"匹配高亮"}),a.jsx(vn,{className:"h-40 rounded-md bg-muted p-3",children:a.jsx("div",{className:"text-sm break-words",children:H()})})]}),Object.keys($).length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"命名捕获组"}),a.jsx(vn,{className:"h-32 rounded-md border p-3",children:a.jsx("div",{className:"space-y-2",children:Object.entries($).map(([ve,Re])=>a.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[a.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",ve,"]"]}),a.jsx("span",{className:"text-muted-foreground",children:"="}),a.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:Re})]},ve))})})]}),Object.keys($).length>0&&D&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"Reaction 替换预览"}),a.jsx(vn,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:a.jsx("div",{className:"text-sm break-words",children:ne})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),a.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),a.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),a.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),a.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),a.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},x=()=>{s({...t,keyword_rules:[...t.keyword_rules,{keywords:[],reaction:""}]})},v=_=>{s({...t,keyword_rules:t.keyword_rules.filter((D,E)=>E!==_)})},b=(_,D,E)=>{const R=[...t.keyword_rules];typeof E=="string"&&(R[_]={...R[_],reaction:E}),s({...t,keyword_rules:R})},k=_=>{const D=[...t.keyword_rules];D[_]={...D[_],keywords:[...D[_].keywords||[],""]},s({...t,keyword_rules:D})},O=(_,D)=>{const E=[...t.keyword_rules];E[_]={...E[_],keywords:(E[_].keywords||[]).filter((R,Q)=>Q!==D)},s({...t,keyword_rules:E})},j=(_,D,E)=>{const R=[...t.keyword_rules],Q=[...R[_].keywords||[]];Q[D]=E,R[_]={...R[_],keywords:Q},s({...t,keyword_rules:R})},T=({rule:_})=>{const D=`{ regex = [${(_.regex||[]).map(E=>`"${E}"`).join(", ")}], reaction = "${_.reaction}" }`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-[95vw] sm:w-[500px]",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx(vn,{className:"h-60 rounded-md bg-muted p-3",children:a.jsx("pre",{className:"font-mono text-xs break-all",children:D})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},A=({rule:_})=>{const D=`[[keyword_reaction.keyword_rules]] +keywords = [${(_.keywords||[]).map(E=>`"${E}"`).join(", ")}] +reaction = "${_.reaction}"`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-[95vw] sm:w-[500px]",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx(vn,{className:"h-60 rounded-md bg-muted p-3",children:a.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:D})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),a.jsxs(ie,{onClick:d,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),a.jsxs("div",{className:"space-y-3",children:[t.regex_rules.map((_,D)=>a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",D+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(p,{regex:_.regex&&_.regex[0]||"",reaction:_.reaction,onRegexChange:E=>m(D,"regex",E),onReactionChange:E=>m(D,"reaction",E)}),a.jsx(T,{rule:_}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除正则规则 ",D+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>h(D),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),a.jsx(Me,{value:_.regex&&_.regex[0]||"",onChange:E=>m(D,"regex",E.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"反应内容"}),a.jsx(_n,{value:_.reaction,onChange:E=>m(D,"reaction",E.target.value),placeholder:`触发后麦麦的反应... +可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},D)),t.regex_rules.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),a.jsxs("div",{className:"space-y-4 border-t pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),a.jsxs(ie,{onClick:x,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),a.jsxs("div",{className:"space-y-3",children:[t.keyword_rules.map((_,D)=>a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",D+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(A,{rule:_}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除关键词规则 ",D+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>v(D),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-xs font-medium",children:"关键词列表"}),a.jsxs(ie,{onClick:()=>k(D),size:"sm",variant:"ghost",children:[a.jsx(Wr,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),a.jsxs("div",{className:"space-y-2",children:[(_.keywords||[]).map((E,R)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{value:E,onChange:Q=>j(D,R,Q.target.value),placeholder:"关键词",className:"flex-1"}),a.jsx(ie,{onClick:()=>O(D,R),size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})]},R)),(!_.keywords||_.keywords.length===0)&&a.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"反应内容"}),a.jsx(_n,{value:_.reaction,onChange:E=>b(D,"reaction",E.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},D)),t.keyword_rules.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_response_post_process",checked:e.enable_response_post_process,onCheckedChange:_=>i({...e,enable_response_post_process:_})}),a.jsx(te,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),e.enable_response_post_process&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"border-t pt-6 space-y-4",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[a.jsx(jt,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:_=>l({...n,enable:_})}),a.jsx(te,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&a.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),a.jsx(Me,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:_=>l({...n,error_rate:parseFloat(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),a.jsx(Me,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:_=>l({...n,min_freq:parseInt(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),a.jsx(Me,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:_=>l({...n,tone_error_rate:parseFloat(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),a.jsx(Me,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:_=>l({...n,word_replace_rate:parseFloat(_.target.value)})})]})]})]})}),a.jsx("div",{className:"border-t pt-6 space-y-4",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[a.jsx(jt,{id:"enable_response_splitter",checked:r.enable,onCheckedChange:_=>c({...r,enable:_})}),a.jsx(te,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),r.enable&&a.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),a.jsx(Me,{id:"max_length",type:"number",min:"1",value:r.max_length,onChange:_=>c({...r,max_length:parseInt(_.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),a.jsx(Me,{id:"max_sentence_num",type:"number",min:"1",value:r.max_sentence_num,onChange:_=>c({...r,max_sentence_num:parseInt(_.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_kaomoji_protection",checked:r.enable_kaomoji_protection,onCheckedChange:_=>c({...r,enable_kaomoji_protection:_})}),a.jsx(te,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_overflow_return_all",checked:r.enable_overflow_return_all,onCheckedChange:_=>c({...r,enable_overflow_return_all:_})}),a.jsx(te,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),a.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function Jee({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用情绪系统"})]}),t.enable_mood&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"情绪更新阈值"}),a.jsx(Me,{type:"number",min:"1",value:t.mood_update_threshold,onChange:n=>e({...t,mood_update_threshold:parseInt(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"情感特征"}),a.jsx(_n,{value:t.emotion_style,onChange:n=>e({...t,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function ete({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable_asr,onCheckedChange:n=>e({...t,enable_asr:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用语音识别"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function tte({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),t.enable&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"LPMM 模式"}),a.jsxs(Lt,{value:t.lpmm_mode,onValueChange:n=>e({...t,lpmm_mode:n}),children:[a.jsx(Dt,{children:a.jsx(It,{placeholder:"选择 LPMM 模式"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"classic",children:"经典模式"}),a.jsx(Pe,{value:"agent",children:"Agent 模式"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"同义词搜索 TopK"}),a.jsx(Me,{type:"number",min:"1",value:t.rag_synonym_search_top_k,onChange:n=>e({...t,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"同义词阈值"}),a.jsx(Me,{type:"number",step:"0.1",min:"0",max:"1",value:t.rag_synonym_threshold,onChange:n=>e({...t,rag_synonym_threshold:parseFloat(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"实体提取线程数"}),a.jsx(Me,{type:"number",min:"1",value:t.info_extraction_workers,onChange:n=>e({...t,info_extraction_workers:parseInt(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"嵌入向量维度"}),a.jsx(Me,{type:"number",min:"1",value:t.embedding_dimension,onChange:n=>e({...t,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function nte({config:t,onChange:e}){const[n,r]=S.useState(""),[s,i]=S.useState("WARNING"),l=()=>{n&&!t.suppress_libraries.includes(n)&&(e({...t,suppress_libraries:[...t.suppress_libraries,n]}),r(""))},c=v=>{e({...t,suppress_libraries:t.suppress_libraries.filter(b=>b!==v)})},d=()=>{n&&!t.library_log_levels[n]&&(e({...t,library_log_levels:{...t.library_log_levels,[n]:s}}),r(""),i("WARNING"))},h=v=>{const b={...t.library_log_levels};delete b[v],e({...t,library_log_levels:b})},m=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],p=["FULL","compact","lite"],x=["none","title","full"];return a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日期格式"}),a.jsx(Me,{value:t.date_style,onChange:v=>e({...t,date_style:v.target.value}),placeholder:"例如: m-d H:i:s"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日志级别样式"}),a.jsxs(Lt,{value:t.log_level_style,onValueChange:v=>e({...t,log_level_style:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:p.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日志文本颜色"}),a.jsxs(Lt,{value:t.color_text,onValueChange:v=>e({...t,color_text:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:x.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"全局日志级别"}),a.jsxs(Lt,{value:t.log_level,onValueChange:v=>e({...t,log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"控制台日志级别"}),a.jsxs(Lt,{value:t.console_log_level,onValueChange:v=>e({...t,console_log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"文件日志级别"}),a.jsxs(Lt,{value:t.file_log_level,onValueChange:v=>e({...t,file_log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"完全屏蔽的库"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Me,{value:n,onChange:v=>r(v.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),l())}}),a.jsx(ie,{onClick:l,size:"sm",className:"flex-shrink-0",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:t.suppress_libraries.map(v=>a.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[a.jsx("span",{className:"text-sm",children:v}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>c(v),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},v))})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"特定库的日志级别"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Me,{value:n,onChange:v=>r(v.target.value),placeholder:"输入库名",className:"flex-1"}),a.jsxs(Lt,{value:s,onValueChange:i,children:[a.jsx(Dt,{className:"w-32",children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]}),a.jsx(ie,{onClick:d,size:"sm",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"space-y-2",children:Object.entries(t.library_log_levels).map(([v,b])=>a.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[a.jsx("span",{className:"text-sm font-medium",children:v}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:b}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>h(v),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},v))})]})]})}function rte({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示 Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),a.jsx(jt,{checked:t.show_prompt,onCheckedChange:n=>e({...t,show_prompt:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示回复器 Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),a.jsx(jt,{checked:t.show_replyer_prompt,onCheckedChange:n=>e({...t,show_replyer_prompt:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示回复器推理"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),a.jsx(jt,{checked:t.show_replyer_reasoning,onCheckedChange:n=>e({...t,show_replyer_reasoning:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示 Jargon Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),a.jsx(jt,{checked:t.show_jargon_prompt,onCheckedChange:n=>e({...t,show_jargon_prompt:n})})]})]})]})}function ste({config:t,onChange:e}){const[n,r]=S.useState(""),s=()=>{n&&!t.auth_token.includes(n)&&(e({...t,auth_token:[...t.auth_token,n]}),r(""))},i=l=>{e({...t,auth_token:t.auth_token.filter((c,d)=>d!==l)})};return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"启用自定义服务器"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),a.jsx(jt,{checked:t.use_custom,onCheckedChange:l=>e({...t,use_custom:l})})]}),t.use_custom&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"主机地址"}),a.jsx(Me,{value:t.host,onChange:l=>e({...t,host:l.target.value}),placeholder:"127.0.0.1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"端口号"}),a.jsx(Me,{type:"number",value:t.port,onChange:l=>e({...t,port:parseInt(l.target.value)}),placeholder:"8090"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"连接模式"}),a.jsxs(Lt,{value:t.mode,onValueChange:l=>e({...t,mode:l}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"ws",children:"WebSocket (ws)"}),a.jsx(Pe,{value:"tcp",children:"TCP"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.use_wss,onCheckedChange:l=>e({...t,use_wss:l}),disabled:t.mode!=="ws"}),a.jsx(te,{children:"使用 WSS 安全连接"})]})]}),t.use_wss&&t.mode==="ws"&&a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"SSL 证书文件路径"}),a.jsx(Me,{value:t.cert_file,onChange:l=>e({...t,cert_file:l.target.value}),placeholder:"cert.pem"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"SSL 密钥文件路径"}),a.jsx(Me,{value:t.key_file,onChange:l=>e({...t,key_file:l.target.value}),placeholder:"key.pem"})]})]})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"认证令牌"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Me,{value:n,onChange:l=>r(l.target.value),placeholder:"输入认证令牌",onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),s())}}),a.jsx(ie,{onClick:s,size:"sm",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"space-y-2",children:t.auth_token.map((l,c)=>a.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[a.jsx("span",{className:"text-sm font-mono",children:l}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>i(c),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},c))})]})]})}function ite({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"启用统计信息发送"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),a.jsx(jt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})})]})]})}const Mc=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{className:"relative w-full overflow-auto",children:a.jsx("table",{ref:n,className:ye("w-full caption-bottom text-sm",t),...e})}));Mc.displayName="Table";const Ec=S.forwardRef(({className:t,...e},n)=>a.jsx("thead",{ref:n,className:ye("[&_tr]:border-b",t),...e}));Ec.displayName="TableHeader";const _c=S.forwardRef(({className:t,...e},n)=>a.jsx("tbody",{ref:n,className:ye("[&_tr:last-child]:border-0",t),...e}));_c.displayName="TableBody";const ate=S.forwardRef(({className:t,...e},n)=>a.jsx("tfoot",{ref:n,className:ye("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));ate.displayName="TableFooter";const xr=S.forwardRef(({className:t,...e},n)=>a.jsx("tr",{ref:n,className:ye("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));xr.displayName="TableRow";const xt=S.forwardRef(({className:t,...e},n)=>a.jsx("th",{ref:n,className:ye("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));xt.displayName="TableHead";const it=S.forwardRef(({className:t,...e},n)=>a.jsx("td",{ref:n,className:ye("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));it.displayName="TableCell";const lte=S.forwardRef(({className:t,...e},n)=>a.jsx("caption",{ref:n,className:ye("mt-4 text-sm text-muted-foreground",t),...e}));lte.displayName="TableCaption";const ss=S.forwardRef(({className:t,...e},n)=>a.jsx(A9,{ref:n,className:ye("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:a.jsx(rq,{className:ye("grid place-content-center text-current"),children:a.jsx(hc,{className:"h-4 w-4"})})}));ss.displayName=A9.displayName;function ote(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(null),[T,A]=S.useState(null),[_,D]=S.useState(!1),[E,R]=S.useState(null),[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,de]=S.useState(new Set),[W,J]=S.useState(!1),[$,ae]=S.useState(1),[ne,ce]=S.useState(20),[z,xe]=S.useState(""),{toast:Y}=Pr(),P=S.useRef(null),K=S.useRef(!0);S.useEffect(()=>{H()},[]);const H=async()=>{try{r(!0);const ee=await Vu();e(ee.api_providers||[]),h(!1),K.current=!1}catch(ee){console.error("加载配置失败:",ee)}finally{r(!1)}},fe=async()=>{try{p(!0),xw().catch(()=>{}),v(!0)}catch(ee){console.error("重启失败:",ee),v(!1),Y({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),p(!1)}},ve=async()=>{try{i(!0),P.current&&clearTimeout(P.current);const ee=await Vu();ee.api_providers=t,await wg(ee),h(!1),Y({title:"保存成功",description:"正在重启麦麦..."}),await fe()}catch(ee){console.error("保存配置失败:",ee),Y({title:"保存失败",description:ee.message,variant:"destructive"}),i(!1)}},Re=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},ue=()=>{v(!1),p(!1),Y({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},We=S.useCallback(async ee=>{if(!K.current)try{c(!0),await h2("api_providers",ee),h(!1)}catch(Se){console.error("自动保存失败:",Se),h(!0)}finally{c(!1)}},[]);S.useEffect(()=>{if(!K.current)return h(!0),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{We(t)},2e3),()=>{P.current&&clearTimeout(P.current)}},[t,We]);const ct=async()=>{try{i(!0),P.current&&clearTimeout(P.current);const ee=await Vu();ee.api_providers=t,await wg(ee),h(!1),Y({title:"保存成功",description:"模型提供商配置已保存"})}catch(ee){console.error("保存配置失败:",ee),Y({title:"保存失败",description:ee.message,variant:"destructive"})}finally{i(!1)}},Oe=(ee,Se)=>{j(ee||{name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),A(Se),F(!1),k(!0)},nt=async()=>{if(O?.api_key)try{await navigator.clipboard.writeText(O.api_key),Y({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{Y({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},ut=()=>{if(!O)return;const ee={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};if(T!==null){const Se=[...t];Se[T]=ee,e(Se)}else e([...t,ee]);k(!1),j(null),A(null)},Ct=ee=>{if(!ee&&O){const Se={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};j(Se)}k(ee)},In=ee=>{R(ee),D(!0)},Tn=()=>{if(E!==null){const ee=t.filter((Se,Be)=>Be!==E);e(ee),Y({title:"删除成功",description:"提供商已从列表中移除"})}D(!1),R(null)},Jn=ee=>{const Se=new Set(V);Se.has(ee)?Se.delete(ee):Se.add(ee),de(Se)},nn=()=>{if(V.size===qn.length)de(new Set);else{const ee=qn.map((Se,Be)=>t.findIndex(rt=>rt===qn[Be]));de(new Set(ee))}},_t=()=>{if(V.size===0){Y({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}J(!0)},Yr=()=>{const ee=t.filter((Se,Be)=>!V.has(Be));e(ee),de(new Set),J(!1),Y({title:"批量删除成功",description:`已删除 ${V.size} 个提供商`})},qn=t.filter(ee=>{if(!L)return!0;const Se=L.toLowerCase();return ee.name.toLowerCase().includes(Se)||ee.base_url.toLowerCase().includes(Se)||ee.client_type.toLowerCase().includes(Se)}),or=Math.ceil(qn.length/ne),yn=qn.slice(($-1)*ne,$*ne),ft=()=>{const ee=parseInt(z);ee>=1&&ee<=or&&(ae(ee),xe(""))};return n?a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型提供商配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 API 提供商配置"})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[V.size>0&&a.jsxs(ie,{onClick:_t,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",V.size,")"]}),a.jsxs(ie,{onClick:()=>Oe(null,null),size:"sm",className:"w-full sm:w-auto",children:[a.jsx(Wr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),a.jsxs(ie,{onClick:ct,disabled:s||l||!d||m,size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),s?"保存中...":l?"自动保存中...":d?"保存配置":"已保存"]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:s||l||m,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),m?"重启中...":d?"保存并重启":"重启麦麦"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重启麦麦?"}),a.jsx(dn,{children:d?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:d?ve:fe,children:d?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),a.jsxs(vn,{className:"h-[calc(100vh-260px)]",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[a.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索提供商名称、URL 或类型...",value:L,onChange:ee=>U(ee.target.value),className:"pl-9"})]}),L&&a.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",qn.length," 个结果"]})]}),a.jsx("div",{className:"md:hidden space-y-3",children:qn.length===0?a.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:L?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):yn.map((ee,Se)=>{const Be=t.findIndex(rt=>rt===ee);return a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h3",{className:"font-semibold text-base truncate",children:ee.name}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:ee.base_url})]}),a.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Oe(ee,Be),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>In(Be),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),a.jsx("p",{className:"font-medium",children:ee.client_type})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),a.jsx("p",{className:"font-medium",children:ee.max_retry})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),a.jsx("p",{className:"font-medium",children:ee.timeout})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),a.jsx("p",{className:"font-medium",children:ee.retry_interval})]})]})]},Se)})}),a.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:V.size===qn.length&&qn.length>0,onCheckedChange:nn})}),a.jsx(xt,{children:"名称"}),a.jsx(xt,{children:"基础URL"}),a.jsx(xt,{children:"客户端类型"}),a.jsx(xt,{className:"text-right",children:"最大重试"}),a.jsx(xt,{className:"text-right",children:"超时(秒)"}),a.jsx(xt,{className:"text-right",children:"重试间隔(秒)"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:yn.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center text-muted-foreground py-8",children:L?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):yn.map((ee,Se)=>{const Be=t.findIndex(rt=>rt===ee);return a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:V.has(Be),onCheckedChange:()=>Jn(Be)})}),a.jsx(it,{className:"font-medium",children:ee.name}),a.jsx(it,{className:"max-w-xs truncate",title:ee.base_url,children:ee.base_url}),a.jsx(it,{children:ee.client_type}),a.jsx(it,{className:"text-right",children:ee.max_retry}),a.jsx(it,{className:"text-right",children:ee.timeout}),a.jsx(it,{className:"text-right",children:ee.retry_interval}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Oe(ee,Be),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>In(Be),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Se)})})]})}),qn.length>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:ne.toString(),onValueChange:ee=>{ce(parseInt(ee)),ae(1),de(new Set)},children:[a.jsx(Dt,{id:"page-size-provider",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",($-1)*ne+1," 到"," ",Math.min($*ne,qn.length)," 条,共 ",qn.length," 条"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ae(1),disabled:$===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(ee=>Math.max(1,ee-1)),disabled:$===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:z,onChange:ee=>xe(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&ft(),placeholder:$.toString(),className:"w-16 h-8 text-center",min:1,max:or}),a.jsx(ie,{variant:"outline",size:"sm",onClick:ft,disabled:!z,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(ee=>ee+1),disabled:$>=or,children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ae(or),disabled:$>=or,className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]}),a.jsx(Rr,{open:b,onOpenChange:Ct,children:a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:T!==null?"编辑提供商":"添加提供商"}),a.jsx(Gr,{children:"配置 API 提供商的连接信息和参数"})]}),a.jsxs("div",{className:"grid gap-4 py-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"name",children:"名称 *"}),a.jsx(Me,{id:"name",value:O?.name||"",onChange:ee=>j(Se=>Se?{...Se,name:ee.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"base_url",children:"基础 URL *"}),a.jsx(Me,{id:"base_url",value:O?.base_url||"",onChange:ee=>j(Se=>Se?{...Se,base_url:ee.target.value}:null),placeholder:"https://api.example.com/v1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"api_key",children:"API Key *"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{id:"api_key",type:Q?"text":"password",value:O?.api_key||"",onChange:ee=>j(Se=>Se?{...Se,api_key:ee.target.value}:null),placeholder:"sk-...",className:"flex-1"}),a.jsx(ie,{type:"button",variant:"outline",size:"icon",onClick:()=>F(!Q),title:Q?"隐藏密钥":"显示密钥",children:Q?a.jsx(Yb,{className:"h-4 w-4"}):a.jsx($i,{className:"h-4 w-4"})}),a.jsx(ie,{type:"button",variant:"outline",size:"icon",onClick:nt,title:"复制密钥",children:a.jsx(Xb,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"client_type",children:"客户端类型"}),a.jsxs(Lt,{value:O?.client_type||"openai",onValueChange:ee=>j(Se=>Se?{...Se,client_type:ee}:null),children:[a.jsx(Dt,{id:"client_type",children:a.jsx(It,{placeholder:"选择客户端类型"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"openai",children:"OpenAI"}),a.jsx(Pe,{value:"gemini",children:"Gemini"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_retry",children:"最大重试"}),a.jsx(Me,{id:"max_retry",type:"number",min:"0",value:O?.max_retry??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,max_retry:Se}:null)},placeholder:"默认: 2"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"timeout",children:"超时(秒)"}),a.jsx(Me,{id:"timeout",type:"number",min:"1",value:O?.timeout??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,timeout:Se}:null)},placeholder:"默认: 30"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),a.jsx(Me,{id:"retry_interval",type:"number",min:"1",value:O?.retry_interval??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,retry_interval:Se}:null)},placeholder:"默认: 10"})]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>k(!1),children:"取消"}),a.jsx(ie,{onClick:ut,children:"保存"})]})]})}),a.jsx(mn,{open:_,onOpenChange:D,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除提供商 "',E!==null?t[E]?.name:"",'" 吗? 此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:Tn,children:"删除"})]})]})}),a.jsx(mn,{open:W,onOpenChange:J,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["确定要删除选中的 ",V.size," 个提供商吗? 此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:Yr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),x&&a.jsx(vw,{onRestartComplete:Re,onRestartFailed:ue})]})}var a8=1,cte=.9,ute=.8,dte=.17,cb=.1,ub=.999,hte=.9999,fte=.99,mte=/[\\\/_+.#"@\[\(\{&]/,pte=/[\\\/_+.#"@\[\(\{&]/g,gte=/[\s-]/,L_=/[\s-]/g;function u4(t,e,n,r,s,i,l){if(i===e.length)return s===t.length?a8:fte;var c=`${s},${i}`;if(l[c]!==void 0)return l[c];for(var d=r.charAt(i),h=n.indexOf(d,s),m=0,p,x,v,b;h>=0;)p=u4(t,e,n,r,h+1,i+1,l),p>m&&(h===s?p*=a8:mte.test(t.charAt(h-1))?(p*=ute,v=t.slice(s,h-1).match(pte),v&&s>0&&(p*=Math.pow(ub,v.length))):gte.test(t.charAt(h-1))?(p*=cte,b=t.slice(s,h-1).match(L_),b&&s>0&&(p*=Math.pow(ub,b.length))):(p*=dte,s>0&&(p*=Math.pow(ub,h-s))),t.charAt(h)!==e.charAt(i)&&(p*=hte)),(pp&&(p=x*cb)),p>m&&(m=p),h=n.indexOf(d,h+1);return l[c]=m,m}function l8(t){return t.toLowerCase().replace(L_," ")}function xte(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,u4(t,e,l8(t),l8(e),0,0,{})}var vte=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],To=vte.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Bh='[cmdk-group=""]',db='[cmdk-group-items=""]',yte='[cmdk-group-heading=""]',I_='[cmdk-item=""]',o8=`${I_}:not([aria-disabled="true"])`,d4="cmdk-item-select",Pu="data-value",bte=(t,e,n)=>xte(t,e,n),q_=S.createContext(void 0),g0=()=>S.useContext(q_),F_=S.createContext(void 0),o5=()=>S.useContext(F_),Q_=S.createContext(void 0),$_=S.forwardRef((t,e)=>{let n=Bu(()=>{var Y,P;return{search:"",value:(P=(Y=t.value)!=null?Y:t.defaultValue)!=null?P:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Bu(()=>new Set),s=Bu(()=>new Map),i=Bu(()=>new Map),l=Bu(()=>new Set),c=H_(t),{label:d,children:h,value:m,onValueChange:p,filter:x,shouldFilter:v,loop:b,disablePointerSelection:k=!1,vimBindings:O=!0,...j}=t,T=ji(),A=ji(),_=ji(),D=S.useRef(null),E=Ete();Nc(()=>{if(m!==void 0){let Y=m.trim();n.current.value=Y,R.emit()}},[m]),Nc(()=>{E(6,de)},[]);let R=S.useMemo(()=>({subscribe:Y=>(l.current.add(Y),()=>l.current.delete(Y)),snapshot:()=>n.current,setState:(Y,P,K)=>{var H,fe,ve,Re;if(!Object.is(n.current[Y],P)){if(n.current[Y]=P,Y==="search")V(),L(),E(1,U);else if(Y==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ue=document.getElementById(_);ue?ue.focus():(H=document.getElementById(T))==null||H.focus()}if(E(7,()=>{var ue;n.current.selectedItemId=(ue=W())==null?void 0:ue.id,R.emit()}),K||E(5,de),((fe=c.current)==null?void 0:fe.value)!==void 0){let ue=P??"";(Re=(ve=c.current).onValueChange)==null||Re.call(ve,ue);return}}R.emit()}},emit:()=>{l.current.forEach(Y=>Y())}}),[]),Q=S.useMemo(()=>({value:(Y,P,K)=>{var H;P!==((H=i.current.get(Y))==null?void 0:H.value)&&(i.current.set(Y,{value:P,keywords:K}),n.current.filtered.items.set(Y,F(P,K)),E(2,()=>{L(),R.emit()}))},item:(Y,P)=>(r.current.add(Y),P&&(s.current.has(P)?s.current.get(P).add(Y):s.current.set(P,new Set([Y]))),E(3,()=>{V(),L(),n.current.value||U(),R.emit()}),()=>{i.current.delete(Y),r.current.delete(Y),n.current.filtered.items.delete(Y);let K=W();E(4,()=>{V(),K?.getAttribute("id")===Y&&U(),R.emit()})}),group:Y=>(s.current.has(Y)||s.current.set(Y,new Set),()=>{i.current.delete(Y),s.current.delete(Y)}),filter:()=>c.current.shouldFilter,label:d||t["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:T,inputId:_,labelId:A,listInnerRef:D}),[]);function F(Y,P){var K,H;let fe=(H=(K=c.current)==null?void 0:K.filter)!=null?H:bte;return Y?fe(Y,n.current.search,P):0}function L(){if(!n.current.search||c.current.shouldFilter===!1)return;let Y=n.current.filtered.items,P=[];n.current.filtered.groups.forEach(H=>{let fe=s.current.get(H),ve=0;fe.forEach(Re=>{let ue=Y.get(Re);ve=Math.max(ue,ve)}),P.push([H,ve])});let K=D.current;J().sort((H,fe)=>{var ve,Re;let ue=H.getAttribute("id"),We=fe.getAttribute("id");return((ve=Y.get(We))!=null?ve:0)-((Re=Y.get(ue))!=null?Re:0)}).forEach(H=>{let fe=H.closest(db);fe?fe.appendChild(H.parentElement===fe?H:H.closest(`${db} > *`)):K.appendChild(H.parentElement===K?H:H.closest(`${db} > *`))}),P.sort((H,fe)=>fe[1]-H[1]).forEach(H=>{var fe;let ve=(fe=D.current)==null?void 0:fe.querySelector(`${Bh}[${Pu}="${encodeURIComponent(H[0])}"]`);ve?.parentElement.appendChild(ve)})}function U(){let Y=J().find(K=>K.getAttribute("aria-disabled")!=="true"),P=Y?.getAttribute(Pu);R.setState("value",P||void 0)}function V(){var Y,P,K,H;if(!n.current.search||c.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let fe=0;for(let ve of r.current){let Re=(P=(Y=i.current.get(ve))==null?void 0:Y.value)!=null?P:"",ue=(H=(K=i.current.get(ve))==null?void 0:K.keywords)!=null?H:[],We=F(Re,ue);n.current.filtered.items.set(ve,We),We>0&&fe++}for(let[ve,Re]of s.current)for(let ue of Re)if(n.current.filtered.items.get(ue)>0){n.current.filtered.groups.add(ve);break}n.current.filtered.count=fe}function de(){var Y,P,K;let H=W();H&&(((Y=H.parentElement)==null?void 0:Y.firstChild)===H&&((K=(P=H.closest(Bh))==null?void 0:P.querySelector(yte))==null||K.scrollIntoView({block:"nearest"})),H.scrollIntoView({block:"nearest"}))}function W(){var Y;return(Y=D.current)==null?void 0:Y.querySelector(`${I_}[aria-selected="true"]`)}function J(){var Y;return Array.from(((Y=D.current)==null?void 0:Y.querySelectorAll(o8))||[])}function $(Y){let P=J()[Y];P&&R.setState("value",P.getAttribute(Pu))}function ae(Y){var P;let K=W(),H=J(),fe=H.findIndex(Re=>Re===K),ve=H[fe+Y];(P=c.current)!=null&&P.loop&&(ve=fe+Y<0?H[H.length-1]:fe+Y===H.length?H[0]:H[fe+Y]),ve&&R.setState("value",ve.getAttribute(Pu))}function ne(Y){let P=W(),K=P?.closest(Bh),H;for(;K&&!H;)K=Y>0?Ate(K,Bh):Mte(K,Bh),H=K?.querySelector(o8);H?R.setState("value",H.getAttribute(Pu)):ae(Y)}let ce=()=>$(J().length-1),z=Y=>{Y.preventDefault(),Y.metaKey?ce():Y.altKey?ne(1):ae(1)},xe=Y=>{Y.preventDefault(),Y.metaKey?$(0):Y.altKey?ne(-1):ae(-1)};return S.createElement(To.div,{ref:e,tabIndex:-1,...j,"cmdk-root":"",onKeyDown:Y=>{var P;(P=j.onKeyDown)==null||P.call(j,Y);let K=Y.nativeEvent.isComposing||Y.keyCode===229;if(!(Y.defaultPrevented||K))switch(Y.key){case"n":case"j":{O&&Y.ctrlKey&&z(Y);break}case"ArrowDown":{z(Y);break}case"p":case"k":{O&&Y.ctrlKey&&xe(Y);break}case"ArrowUp":{xe(Y);break}case"Home":{Y.preventDefault(),$(0);break}case"End":{Y.preventDefault(),ce();break}case"Enter":{Y.preventDefault();let H=W();if(H){let fe=new Event(d4);H.dispatchEvent(fe)}}}}},S.createElement("label",{"cmdk-label":"",htmlFor:Q.inputId,id:Q.labelId,style:Dte},d),Px(t,Y=>S.createElement(F_.Provider,{value:R},S.createElement(q_.Provider,{value:Q},Y))))}),wte=S.forwardRef((t,e)=>{var n,r;let s=ji(),i=S.useRef(null),l=S.useContext(Q_),c=g0(),d=H_(t),h=(r=(n=d.current)==null?void 0:n.forceMount)!=null?r:l?.forceMount;Nc(()=>{if(!h)return c.item(s,l?.id)},[h]);let m=U_(s,i,[t.value,t.children,i],t.keywords),p=o5(),x=vo(E=>E.value&&E.value===m.current),v=vo(E=>h||c.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);S.useEffect(()=>{let E=i.current;if(!(!E||t.disabled))return E.addEventListener(d4,b),()=>E.removeEventListener(d4,b)},[v,t.onSelect,t.disabled]);function b(){var E,R;k(),(R=(E=d.current).onSelect)==null||R.call(E,m.current)}function k(){p.setState("value",m.current,!0)}if(!v)return null;let{disabled:O,value:j,onSelect:T,forceMount:A,keywords:_,...D}=t;return S.createElement(To.div,{ref:oo(i,e),...D,id:s,"cmdk-item":"",role:"option","aria-disabled":!!O,"aria-selected":!!x,"data-disabled":!!O,"data-selected":!!x,onPointerMove:O||c.getDisablePointerSelection()?void 0:k,onClick:O?void 0:b},t.children)}),Ste=S.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,l=ji(),c=S.useRef(null),d=S.useRef(null),h=ji(),m=g0(),p=vo(v=>s||m.filter()===!1?!0:v.search?v.filtered.groups.has(l):!0);Nc(()=>m.group(l),[]),U_(l,c,[t.value,t.heading,d]);let x=S.useMemo(()=>({id:l,forceMount:s}),[s]);return S.createElement(To.div,{ref:oo(c,e),...i,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},n&&S.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),Px(t,v=>S.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},S.createElement(Q_.Provider,{value:x},v))))}),kte=S.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=S.useRef(null),i=vo(l=>!l.search);return!n&&!i?null:S.createElement(To.div,{ref:oo(s,e),...r,"cmdk-separator":"",role:"separator"})}),Ote=S.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=o5(),l=vo(h=>h.search),c=vo(h=>h.selectedItemId),d=g0();return S.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),S.createElement(To.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":c,id:d.inputId,type:"text",value:s?t.value:l,onChange:h=>{s||i.setState("search",h.target.value),n?.(h.target.value)}})}),jte=S.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=S.useRef(null),l=S.useRef(null),c=vo(h=>h.selectedItemId),d=g0();return S.useEffect(()=>{if(l.current&&i.current){let h=l.current,m=i.current,p,x=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let v=h.offsetHeight;m.style.setProperty("--cmdk-list-height",v.toFixed(1)+"px")})});return x.observe(h),()=>{cancelAnimationFrame(p),x.unobserve(h)}}},[]),S.createElement(To.div,{ref:oo(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":r,id:d.listId},Px(t,h=>S.createElement("div",{ref:oo(l,d.listInnerRef),"cmdk-list-sizer":""},h)))}),Nte=S.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:l,...c}=t;return S.createElement(W4,{open:n,onOpenChange:r},S.createElement($4,{container:l},S.createElement(nx,{"cmdk-overlay":"",className:s}),S.createElement(rx,{"aria-label":t.label,"cmdk-dialog":"",className:i},S.createElement($_,{ref:e,...c}))))}),Cte=S.forwardRef((t,e)=>vo(n=>n.filtered.count===0)?S.createElement(To.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),Tte=S.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return S.createElement(To.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Px(t,l=>S.createElement("div",{"aria-hidden":!0},l)))}),Is=Object.assign($_,{List:jte,Item:wte,Input:Ote,Group:Ste,Separator:kte,Dialog:Nte,Empty:Cte,Loading:Tte});function Ate(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function Mte(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function H_(t){let e=S.useRef(t);return Nc(()=>{e.current=t}),e}var Nc=typeof window>"u"?S.useEffect:S.useLayoutEffect;function Bu(t){let e=S.useRef();return e.current===void 0&&(e.current=t()),e}function vo(t){let e=o5(),n=()=>t(e.snapshot());return S.useSyncExternalStore(e.subscribe,n,n)}function U_(t,e,n,r=[]){let s=S.useRef(),i=g0();return Nc(()=>{var l;let c=(()=>{var h;for(let m of n){if(typeof m=="string")return m.trim();if(typeof m=="object"&&"current"in m)return m.current?(h=m.current.textContent)==null?void 0:h.trim():s.current}})(),d=r.map(h=>h.trim());i.value(t,c,d),(l=e.current)==null||l.setAttribute(Pu,c),s.current=c}),s}var Ete=()=>{let[t,e]=S.useState(),n=Bu(()=>new Map);return Nc(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function _te(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function Px({asChild:t,children:e},n){return t&&S.isValidElement(e)?S.cloneElement(_te(e),{ref:e.ref},n(e.props.children)):n(e)}var Dte={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const V_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is,{ref:n,className:ye("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));V_.displayName=Is.displayName;const W_=S.forwardRef(({className:t,...e},n)=>a.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[a.jsx(Bs,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),a.jsx(Is.Input,{ref:n,className:ye("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));W_.displayName=Is.Input.displayName;const G_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.List,{ref:n,className:ye("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));G_.displayName=Is.List.displayName;const X_=S.forwardRef((t,e)=>a.jsx(Is.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));X_.displayName=Is.Empty.displayName;const Y_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.Group,{ref:n,className:ye("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...e}));Y_.displayName=Is.Group.displayName;const Rte=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.Separator,{ref:n,className:ye("-mx-1 h-px bg-border",t),...e}));Rte.displayName=Is.Separator.displayName;const K_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.Item,{ref:n,className:ye("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...e}));K_.displayName=Is.Item.displayName;function zte({options:t,selected:e,onChange:n,placeholder:r="选择选项...",emptyText:s="未找到选项",className:i}){const[l,c]=S.useState(!1),d=m=>{e.includes(m)?n(e.filter(p=>p!==m)):n([...e,m])},h=m=>{n(e.filter(p=>p!==m))};return a.jsxs(uo,{open:l,onOpenChange:c,children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",role:"combobox","aria-expanded":l,className:ye("w-full justify-between min-h-10 h-auto",i),children:[a.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:e.length===0?a.jsx("span",{className:"text-muted-foreground",children:r}):e.map(m=>{const p=t.find(x=>x.value===m);return a.jsxs(On,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80",onClick:x=>{x.stopPropagation(),h(m)},children:[p?.label||m,a.jsx(Gf,{className:"ml-1 h-3 w-3",strokeWidth:2,fill:"none"})]},m)})}),a.jsx(Sq,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),a.jsx(fl,{className:"w-full p-0",align:"start",children:a.jsxs(V_,{children:[a.jsx(W_,{placeholder:"搜索...",className:"h-9"}),a.jsxs(G_,{children:[a.jsx(X_,{children:s}),a.jsx(Y_,{children:t.map(m=>{const p=e.includes(m.value);return a.jsxs(K_,{value:m.value,onSelect:()=>d(m.value),children:[a.jsx("div",{className:ye("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",p?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:a.jsx(hc,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),a.jsx("span",{children:m.label})]},m.value)})})]})]})})]})}function Pte(){const[t,e]=S.useState([]),[n,r]=S.useState([]),[s,i]=S.useState([]),[l,c]=S.useState(null),[d,h]=S.useState(!0),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,A]=S.useState(!1),[_,D]=S.useState(!1),[E,R]=S.useState(null),[Q,F]=S.useState(null),[L,U]=S.useState(!1),[V,de]=S.useState(null),[W,J]=S.useState(""),[$,ae]=S.useState(new Set),[ne,ce]=S.useState(!1),[z,xe]=S.useState(1),[Y,P]=S.useState(20),[K,H]=S.useState(""),{toast:fe}=Pr(),ve=S.useRef(null),Re=S.useRef(null),ue=S.useRef(!0);S.useEffect(()=>{We()},[]);const We=async()=>{try{h(!0);const re=await Vu(),Ae=re.models||[];e(Ae),i(Ae.map(yt=>yt.name));const pt=re.api_providers||[];r(pt.map(yt=>yt.name)),c(re.model_task_config||null),k(!1),ue.current=!1}catch(re){console.error("加载配置失败:",re)}finally{h(!1)}},ct=async()=>{try{j(!0),xw().catch(()=>{}),A(!0)}catch(re){console.error("重启失败:",re),A(!1),fe({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),j(!1)}},Oe=async()=>{try{p(!0),ve.current&&clearTimeout(ve.current),Re.current&&clearTimeout(Re.current);const re=await Vu();re.models=t,re.model_task_config=l,await wg(re),k(!1),fe({title:"保存成功",description:"正在重启麦麦..."}),await ct()}catch(re){console.error("保存配置失败:",re),fe({title:"保存失败",description:re.message,variant:"destructive"}),p(!1)}},nt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},ut=()=>{A(!1),j(!1),fe({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Ct=S.useCallback(async re=>{if(!ue.current)try{v(!0),await h2("models",re),k(!1)}catch(Ae){console.error("自动保存模型列表失败:",Ae),k(!0)}finally{v(!1)}},[]),In=S.useCallback(async re=>{if(!ue.current)try{v(!0),await h2("model_task_config",re),k(!1)}catch(Ae){console.error("自动保存任务配置失败:",Ae),k(!0)}finally{v(!1)}},[]);S.useEffect(()=>{if(!ue.current)return k(!0),ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{Ct(t)},2e3),()=>{ve.current&&clearTimeout(ve.current)}},[t,Ct]),S.useEffect(()=>{if(!(ue.current||!l))return k(!0),Re.current&&clearTimeout(Re.current),Re.current=setTimeout(()=>{In(l)},2e3),()=>{Re.current&&clearTimeout(Re.current)}},[l,In]);const Tn=async()=>{try{p(!0),ve.current&&clearTimeout(ve.current),Re.current&&clearTimeout(Re.current);const re=await Vu();re.models=t,re.model_task_config=l,await wg(re),k(!1),fe({title:"保存成功",description:"模型配置已保存"}),await We()}catch(re){console.error("保存配置失败:",re),fe({title:"保存失败",description:re.message,variant:"destructive"})}finally{p(!1)}},Jn=(re,Ae)=>{R(re||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),F(Ae),D(!0)},nn=()=>{if(!E)return;const re={...E,price_in:E.price_in??0,price_out:E.price_out??0};let Ae;Q!==null?(Ae=[...t],Ae[Q]=re):Ae=[...t,re],e(Ae),i(Ae.map(pt=>pt.name)),D(!1),R(null),F(null)},_t=re=>{if(!re&&E){const Ae={...E,price_in:E.price_in??0,price_out:E.price_out??0};R(Ae)}D(re)},Yr=re=>{de(re),U(!0)},qn=()=>{if(V!==null){const re=t.filter((Ae,pt)=>pt!==V);e(re),i(re.map(Ae=>Ae.name)),fe({title:"删除成功",description:"模型已从列表中移除"})}U(!1),de(null)},or=re=>{const Ae=new Set($);Ae.has(re)?Ae.delete(re):Ae.add(re),ae(Ae)},yn=()=>{if($.size===Be.length)ae(new Set);else{const re=Be.map((Ae,pt)=>t.findIndex(yt=>yt===Be[pt]));ae(new Set(re))}},ft=()=>{if($.size===0){fe({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ce(!0)},ee=()=>{const re=t.filter((Ae,pt)=>!$.has(pt));e(re),i(re.map(Ae=>Ae.name)),ae(new Set),ce(!1),fe({title:"批量删除成功",description:`已删除 ${$.size} 个模型`})},Se=(re,Ae,pt)=>{l&&c({...l,[re]:{...l[re],[Ae]:pt}})},Be=t.filter(re=>{if(!W)return!0;const Ae=W.toLowerCase();return re.name.toLowerCase().includes(Ae)||re.model_identifier.toLowerCase().includes(Ae)||re.api_provider.toLowerCase().includes(Ae)}),rt=Math.ceil(Be.length/Y),Tt=Be.slice((z-1)*Y,z*Y),cr=()=>{const re=parseInt(K);re>=1&&re<=rt&&(xe(re),H(""))},Kr=re=>l?[l.utils?.model_list||[],l.utils_small?.model_list||[],l.tool_use?.model_list||[],l.replyer?.model_list||[],l.planner?.model_list||[],l.vlm?.model_list||[],l.voice?.model_list||[],l.embedding?.model_list||[],l.lpmm_entity_extract?.model_list||[],l.lpmm_rdf_build?.model_list||[],l.lpmm_qa?.model_list||[]].some(pt=>pt.includes(re)):!1;return d?a.jsx(vn,{className:"h-full",children:a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理模型和任务配置"})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[a.jsxs(ie,{onClick:Tn,disabled:m||x||!b||O,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),m?"保存中...":x?"自动保存中...":b?"保存配置":"已保存"]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:m||x||O,size:"sm",className:"flex-1 sm:flex-none",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),O?"重启中...":b?"保存并重启":"重启麦麦"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重启麦麦?"}),a.jsx(dn,{children:b?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:b?Oe:ct,children:b?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),a.jsxs(hl,{defaultValue:"models",className:"w-full",children:[a.jsxs(ya,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[a.jsx($t,{value:"models",children:"模型配置"}),a.jsx($t,{value:"tasks",children:"模型任务配置"})]}),a.jsxs(kn,{value:"models",className:"space-y-4 mt-0",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[$.size>0&&a.jsxs(ie,{onClick:ft,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",$.size,")"]}),a.jsxs(ie,{onClick:()=>Jn(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(Wr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[a.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索模型名称、标识符或提供商...",value:W,onChange:re=>J(re.target.value),className:"pl-9"})]}),W&&a.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Be.length," 个结果"]})]}),a.jsx("div",{className:"md:hidden space-y-3",children:Tt.length===0?a.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:W?"未找到匹配的模型":"暂无模型配置"}):Tt.map((re,Ae)=>{const pt=t.findIndex(vs=>vs===re),yt=Kr(re.name);return a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("h3",{className:"font-semibold text-base",children:re.name}),a.jsx(On,{variant:yt?"default":"secondary",className:yt?"bg-green-600 hover:bg-green-700":"",children:yt?"已使用":"未使用"})]}),a.jsx("p",{className:"text-xs text-muted-foreground break-all",title:re.model_identifier,children:re.model_identifier})]}),a.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Jn(re,pt),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>Yr(pt),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),a.jsx("p",{className:"font-medium",children:re.api_provider})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),a.jsx("p",{className:"font-medium",children:re.force_stream_mode?"是":"否"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),a.jsxs("p",{className:"font-medium",children:["¥",re.price_in,"/M"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),a.jsxs("p",{className:"font-medium",children:["¥",re.price_out,"/M"]})]})]})]},Ae)})}),a.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:$.size===Be.length&&Be.length>0,onCheckedChange:yn})}),a.jsx(xt,{className:"w-24",children:"使用状态"}),a.jsx(xt,{children:"模型名称"}),a.jsx(xt,{children:"模型标识符"}),a.jsx(xt,{children:"提供商"}),a.jsx(xt,{className:"text-right",children:"输入价格"}),a.jsx(xt,{className:"text-right",children:"输出价格"}),a.jsx(xt,{className:"text-center",children:"强制流式"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:Tt.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:9,className:"text-center text-muted-foreground py-8",children:W?"未找到匹配的模型":"暂无模型配置"})}):Tt.map((re,Ae)=>{const pt=t.findIndex(vs=>vs===re),yt=Kr(re.name);return a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:$.has(pt),onCheckedChange:()=>or(pt)})}),a.jsx(it,{children:a.jsx(On,{variant:yt?"default":"secondary",className:yt?"bg-green-600 hover:bg-green-700":"",children:yt?"已使用":"未使用"})}),a.jsx(it,{className:"font-medium",children:re.name}),a.jsx(it,{className:"max-w-xs truncate",title:re.model_identifier,children:re.model_identifier}),a.jsx(it,{children:re.api_provider}),a.jsxs(it,{className:"text-right",children:["¥",re.price_in,"/M"]}),a.jsxs(it,{className:"text-right",children:["¥",re.price_out,"/M"]}),a.jsx(it,{className:"text-center",children:re.force_stream_mode?"是":"否"}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Jn(re,pt),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>Yr(pt),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Ae)})})]})}),Be.length>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:Y.toString(),onValueChange:re=>{P(parseInt(re)),xe(1),ae(new Set)},children:[a.jsx(Dt,{id:"page-size-model",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(z-1)*Y+1," 到"," ",Math.min(z*Y,Be.length)," 条,共 ",Be.length," 条"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>xe(1),disabled:z===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>xe(re=>Math.max(1,re-1)),disabled:z===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:K,onChange:re=>H(re.target.value),onKeyDown:re=>re.key==="Enter"&&cr(),placeholder:z.toString(),className:"w-16 h-8 text-center",min:1,max:rt}),a.jsx(ie,{variant:"outline",size:"sm",onClick:cr,disabled:!K,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>xe(re=>re+1),disabled:z>=rt,children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>xe(rt),disabled:z>=rt,className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]}),a.jsxs(kn,{value:"tasks",className:"space-y-6 mt-0",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),l&&a.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[a.jsx(Pi,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:l.utils,modelNames:s,onChange:(re,Ae)=>Se("utils",re,Ae)}),a.jsx(Pi,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:l.utils_small,modelNames:s,onChange:(re,Ae)=>Se("utils_small",re,Ae)}),a.jsx(Pi,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:l.tool_use,modelNames:s,onChange:(re,Ae)=>Se("tool_use",re,Ae)}),a.jsx(Pi,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:l.replyer,modelNames:s,onChange:(re,Ae)=>Se("replyer",re,Ae)}),a.jsx(Pi,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:l.planner,modelNames:s,onChange:(re,Ae)=>Se("planner",re,Ae)}),a.jsx(Pi,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:l.vlm,modelNames:s,onChange:(re,Ae)=>Se("vlm",re,Ae),hideTemperature:!0}),a.jsx(Pi,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:l.voice,modelNames:s,onChange:(re,Ae)=>Se("voice",re,Ae),hideTemperature:!0,hideMaxTokens:!0}),a.jsx(Pi,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:l.embedding,modelNames:s,onChange:(re,Ae)=>Se("embedding",re,Ae),hideTemperature:!0,hideMaxTokens:!0}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),a.jsx(Pi,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:l.lpmm_entity_extract,modelNames:s,onChange:(re,Ae)=>Se("lpmm_entity_extract",re,Ae)}),a.jsx(Pi,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:l.lpmm_rdf_build,modelNames:s,onChange:(re,Ae)=>Se("lpmm_rdf_build",re,Ae)}),a.jsx(Pi,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:l.lpmm_qa,modelNames:s,onChange:(re,Ae)=>Se("lpmm_qa",re,Ae)})]})]})]})]}),a.jsx(Rr,{open:_,onOpenChange:_t,children:a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:Q!==null?"编辑模型":"添加模型"}),a.jsx(Gr,{children:"配置模型的基本信息和参数"})]}),a.jsxs("div",{className:"grid gap-4 py-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"model_name",children:"模型名称 *"}),a.jsx(Me,{id:"model_name",value:E?.name||"",onChange:re=>R(Ae=>Ae?{...Ae,name:re.target.value}:null),placeholder:"例如: qwen3-30b"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"model_identifier",children:"模型标识符 *"}),a.jsx(Me,{id:"model_identifier",value:E?.model_identifier||"",onChange:re=>R(Ae=>Ae?{...Ae,model_identifier:re.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"API 提供商提供的模型 ID"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"api_provider",children:"API 提供商 *"}),a.jsxs(Lt,{value:E?.api_provider||"",onValueChange:re=>R(Ae=>Ae?{...Ae,api_provider:re}:null),children:[a.jsx(Dt,{id:"api_provider",children:a.jsx(It,{placeholder:"选择提供商"})}),a.jsx(Rt,{children:n.map(re=>a.jsx(Pe,{value:re,children:re},re))})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),a.jsx(Me,{id:"price_in",type:"number",step:"0.1",min:"0",value:E?.price_in??"",onChange:re=>{const Ae=re.target.value===""?null:parseFloat(re.target.value);R(pt=>pt?{...pt,price_in:Ae}:null)},placeholder:"默认: 0"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),a.jsx(Me,{id:"price_out",type:"number",step:"0.1",min:"0",value:E?.price_out??"",onChange:re=>{const Ae=re.target.value===""?null:parseFloat(re.target.value);R(pt=>pt?{...pt,price_out:Ae}:null)},placeholder:"默认: 0"})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"force_stream_mode",checked:E?.force_stream_mode||!1,onCheckedChange:re=>R(Ae=>Ae?{...Ae,force_stream_mode:re}:null)}),a.jsx(te,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>D(!1),children:"取消"}),a.jsx(ie,{onClick:nn,children:"保存"})]})]})}),a.jsx(mn,{open:L,onOpenChange:U,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除模型 "',V!==null?t[V]?.name:"",'" 吗? 此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:qn,children:"删除"})]})]})}),a.jsx(mn,{open:ne,onOpenChange:ce,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["确定要删除选中的 ",$.size," 个模型吗? 此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),T&&a.jsx(vw,{onRestartComplete:nt,onRestartFailed:ut})]})})}function Pi({title:t,description:e,taskConfig:n,modelNames:r,onChange:s,hideTemperature:i=!1,hideMaxTokens:l=!1}){const c=d=>{s("model_list",d)};return a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:t}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:e})]}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"模型列表"}),a.jsx(zte,{options:r.map(d=>({label:d,value:d})),selected:n.model_list||[],onChange:c,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!i&&a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"温度"}),a.jsx(Me,{type:"number",step:"0.1",min:"0",max:"1",value:n.temperature??.3,onChange:d=>{const h=parseFloat(d.target.value);!isNaN(h)&&h>=0&&h<=1&&s("temperature",h)},className:"w-20 h-8 text-sm"})]}),a.jsx(yx,{value:[n.temperature??.3],onValueChange:d=>s("temperature",d[0]),min:0,max:1,step:.1,className:"w-full"})]}),!l&&a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"最大 Token"}),a.jsx(Me,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:d=>s("max_tokens",parseInt(d.target.value))})]})]})]})]})}const Bx="/api/webui/config";async function Bte(){const e=await(await ot(`${Bx}/adapter-config/path`)).json();return!e.success||!e.path?null:{path:e.path,lastModified:e.lastModified}}async function Lte(t){const n=await(await ot(`${Bx}/adapter-config/path`,{method:"POST",headers:bt(),body:JSON.stringify({path:t})})).json();if(!n.success)throw new Error(n.message||"保存路径失败")}async function Ite(t){const n=await(await ot(`${Bx}/adapter-config?path=${encodeURIComponent(t)}`)).json();if(!n.success)throw new Error("读取配置文件失败");return n.content}async function c8(t,e){const r=await(await ot(`${Bx}/adapter-config`,{method:"POST",headers:bt(),body:JSON.stringify({path:t,content:e})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}const Zs={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}};function qte(){const[t,e]=S.useState("upload"),[n,r]=S.useState(null),[s,i]=S.useState(""),[l,c]=S.useState(""),[d,h]=S.useState(""),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,A]=S.useState(null),_=S.useRef(null),{toast:D}=Pr(),E=S.useRef(null),R=K=>{if(!K.trim())return{valid:!1,error:"路径不能为空"};const H=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,fe=/^(\/|~\/).+\.toml$/i,ve=H.test(K),Re=fe.test(K);return!ve&&!Re?{valid:!1,error:"路径格式错误。Windows: C:\\path\\file.toml,Linux: /path/file.toml"}:K.toLowerCase().endsWith(".toml")?/[<>"|?*\x00-\x1F]/.test(K)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}:{valid:!1,error:"文件必须是 .toml 格式"}},Q=K=>{if(c(K),K.trim()){const H=R(K);h(H.error)}else h("")};S.useEffect(()=>{(async()=>{try{const H=await Bte();H&&H.path&&(c(H.path),e("path"),await F(H.path))}catch(H){console.error("加载保存的路径失败:",H)}})()},[]);const F=async K=>{const H=R(K);if(!H.valid){h(H.error),D({title:"路径无效",description:H.error,variant:"destructive"});return}h(""),v(!0);try{const fe=await Ite(K),ve=ce(fe);r(ve),c(K),await Lte(K),D({title:"加载成功",description:"已从配置文件加载"})}catch(fe){console.error("加载配置失败:",fe),D({title:"加载失败",description:fe instanceof Error?fe.message:"无法读取配置文件",variant:"destructive"})}finally{v(!1)}},L=S.useCallback(K=>{t!=="path"||!l||(E.current&&clearTimeout(E.current),E.current=setTimeout(async()=>{p(!0);try{const H=z(K);await c8(l,H),D({title:"自动保存成功",description:"配置已保存到文件"})}catch(H){console.error("自动保存失败:",H),D({title:"自动保存失败",description:H instanceof Error?H.message:"保存配置失败",variant:"destructive"})}finally{p(!1)}},1e3))},[t,l,D]),U=async()=>{if(!n||!l)return;const K=R(l);if(!K.valid){D({title:"保存失败",description:K.error,variant:"destructive"});return}p(!0);try{const H=z(n);await c8(l,H),D({title:"保存成功",description:"配置已保存到文件"})}catch(H){console.error("保存失败:",H),D({title:"保存失败",description:H instanceof Error?H.message:"保存配置失败",variant:"destructive"})}finally{p(!1)}},V=async()=>{l&&await F(l)},de=K=>{if(K!==t){if(n){A(K),k(!0);return}W(K)}},W=K=>{r(null),i(""),h(""),e(K),D({title:"已切换模式",description:K==="upload"?"现在可以上传配置文件":"现在可以指定配置文件路径"})},J=()=>{T&&(W(T),A(null)),k(!1)},$=()=>{if(n){j(!0);return}ae()},ae=()=>{c(""),r(null),h(""),D({title:"已清空",description:"路径和配置已清空"})},ne=()=>{ae(),j(!1)},ce=K=>{const H=JSON.parse(JSON.stringify(Zs)),fe=K.split(` +`);let ve="";for(const Re of fe){const ue=Re.trim();if(!ue||ue.startsWith("#"))continue;const We=ue.match(/^\[(\w+)\]$/);if(We){ve=We[1];continue}const ct=ue.match(/^(\w+)\s*=\s*(.+)$/);if(ct&&ve){const[,Oe,nt]=ct,ut=nt.trim();let Ct;if(ut==="true")Ct=!0;else if(ut==="false")Ct=!1;else if(ut.startsWith("[")&&ut.endsWith("]")){const In=ut.slice(1,-1).trim();if(In){const Tn=In.split(",").map(nn=>{const _t=nn.trim();return isNaN(Number(_t))?_t.replace(/"/g,""):Number(_t)}),Jn=typeof Tn[0];Ct=Tn.every(nn=>typeof nn===Jn)?Tn:Tn.filter(nn=>typeof nn=="number")}else Ct=[]}else ut.startsWith('"')&&ut.endsWith('"')?Ct=ut.slice(1,-1):isNaN(Number(ut))?Ct=ut.replace(/"/g,""):Ct=Number(ut);if(ve in H){const In=H[ve];In[Oe]=Ct}}}return H},z=K=>{const H=[],fe=(ve,Re)=>ve===""||ve===null||ve===void 0?Re:ve;return H.push("[inner]"),H.push(`version = "${fe(K.inner.version,Zs.inner.version)}" # 版本号`),H.push("# 请勿修改版本号,除非你知道自己在做什么"),H.push(""),H.push("[nickname] # 现在没用"),H.push(`nickname = "${fe(K.nickname.nickname,Zs.nickname.nickname)}"`),H.push(""),H.push("[napcat_server] # Napcat连接的ws服务设置"),H.push(`host = "${fe(K.napcat_server.host,Zs.napcat_server.host)}" # Napcat设定的主机地址`),H.push(`port = ${fe(K.napcat_server.port||0,Zs.napcat_server.port)} # Napcat设定的端口`),H.push(`token = "${fe(K.napcat_server.token,Zs.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),H.push(`heartbeat_interval = ${fe(K.napcat_server.heartbeat_interval||0,Zs.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),H.push(""),H.push("[maibot_server] # 连接麦麦的ws服务设置"),H.push(`host = "${fe(K.maibot_server.host,Zs.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),H.push(`port = ${fe(K.maibot_server.port||0,Zs.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),H.push(""),H.push("[chat] # 黑白名单功能"),H.push(`group_list_type = "${fe(K.chat.group_list_type,Zs.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),H.push(`group_list = [${K.chat.group_list.join(", ")}] # 群组名单`),H.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),H.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),H.push(`private_list_type = "${fe(K.chat.private_list_type,Zs.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),H.push(`private_list = [${K.chat.private_list.join(", ")}] # 私聊名单`),H.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),H.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),H.push(`ban_user_id = [${K.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),H.push(`ban_qq_bot = ${K.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),H.push(`enable_poke = ${K.chat.enable_poke} # 是否启用戳一戳功能`),H.push(""),H.push("[voice] # 发送语音设置"),H.push(`use_tts = ${K.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),H.push(""),H.push("[debug]"),H.push(`level = "${fe(K.debug.level,Zs.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),H.join(` +`)},xe=K=>{const H=K.target.files?.[0];if(!H)return;const fe=new FileReader;fe.onload=ve=>{try{const Re=ve.target?.result,ue=ce(Re);r(ue),i(H.name),D({title:"上传成功",description:`已加载配置文件:${H.name}`})}catch(Re){console.error("解析配置文件失败:",Re),D({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},fe.readAsText(H)},Y=()=>{if(!n)return;const K=z(n),H=new Blob([K],{type:"text/plain;charset=utf-8"}),fe=URL.createObjectURL(H),ve=document.createElement("a");ve.href=fe,ve.download=s||"config.toml",document.body.appendChild(ve),ve.click(),document.body.removeChild(ve),URL.revokeObjectURL(fe),D({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},P=()=>{r(JSON.parse(JSON.stringify(Zs))),i("config.toml"),D({title:"已加载默认配置",description:"可以开始编辑配置"})};return a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"工作模式"}),a.jsx(Sr,{children:"选择配置文件的管理方式"})]}),a.jsxs(an,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 md:gap-4",children:[a.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>de("upload"),children:a.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[a.jsx(oO,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),a.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>de("path"),children:a.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[a.jsx(kq,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),t==="path"&&a.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs("div",{className:"flex-1 space-y-1",children:[a.jsx(Me,{id:"config-path",value:l,onChange:K=>Q(K.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${d?"border-destructive":""}`}),d&&a.jsx("p",{className:"text-xs text-destructive",children:d})]}),a.jsx(ie,{onClick:()=>F(l),disabled:x||!l||!!d,className:"w-full sm:w-auto",children:x?a.jsxs(a.Fragment,{children:[a.jsx(Fi,{className:"h-4 w-4 animate-spin mr-2"}),a.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"sm:hidden",children:"加载配置"}),a.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),a.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[a.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[a.jsx("span",{children:"路径格式说明"}),a.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),a.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[a.jsx("div",{children:"C:\\Adapter\\config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),a.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[a.jsx("div",{children:"/opt/adapter/config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),a.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsx(od,{children:t==="upload"?a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",m&&" (正在保存...)"]})})]}),t==="upload"&&!n&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[a.jsx("input",{ref:_,type:"file",accept:".toml",className:"hidden",onChange:xe}),a.jsxs(ie,{onClick:()=>_.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(oO,{className:"mr-2 h-4 w-4"}),"上传配置"]}),a.jsxs(ie,{onClick:P,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),t==="upload"&&n&&a.jsx("div",{className:"flex gap-2",children:a.jsxs(ie,{onClick:Y,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(fc,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),t==="path"&&n&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs(ie,{onClick:U,size:"sm",disabled:m||!!d,className:"w-full sm:w-auto",children:[a.jsx(lx,{className:"mr-2 h-4 w-4"}),m?"保存中...":"立即保存"]}),a.jsxs(ie,{onClick:V,size:"sm",variant:"outline",disabled:x,className:"w-full sm:w-auto",children:[a.jsx(Fi,{className:`mr-2 h-4 w-4 ${x?"animate-spin":""}`}),"刷新"]}),a.jsxs(ie,{onClick:$,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),n?a.jsxs(hl,{defaultValue:"napcat",className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:a.jsxs(ya,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[a.jsxs($t,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),a.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),a.jsxs($t,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),a.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),a.jsxs($t,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),a.jsx("span",{className:"sm:hidden",children:"聊天"})]}),a.jsxs($t,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),a.jsx("span",{className:"sm:hidden",children:"语音"})]}),a.jsx($t,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),a.jsx(kn,{value:"napcat",className:"space-y-4",children:a.jsx(Fte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"maibot",className:"space-y-4",children:a.jsx(Qte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"chat",className:"space-y-4",children:a.jsx($te,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"voice",className:"space-y-4",children:a.jsx(Hte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"debug",className:"space-y-4",children:a.jsx(Ute,{config:n,onChange:K=>{r(K),L(K)}})})]}):a.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:a.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[a.jsx(ao,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:t==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),a.jsx(mn,{open:b,onOpenChange:k,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认切换模式"}),a.jsxs(dn,{children:["切换模式将清空当前配置,确定要继续吗?",a.jsx("br",{}),a.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),a.jsxs(cn,{children:[a.jsx(fn,{onClick:()=>{k(!1),A(null)},children:"取消"}),a.jsx(hn,{onClick:J,children:"确认切换"})]})]})}),a.jsx(mn,{open:O,onOpenChange:j,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认清空路径"}),a.jsxs(dn,{children:["清空路径将清除当前配置,确定要继续吗?",a.jsx("br",{}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),a.jsxs(cn,{children:[a.jsx(fn,{onClick:()=>j(!1),children:"取消"}),a.jsx(hn,{onClick:ne,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function Fte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),a.jsxs("div",{className:"grid gap-3 md:gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),a.jsx(Me,{id:"napcat-host",value:t.napcat_server.host,onChange:n=>e({...t,napcat_server:{...t.napcat_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),a.jsx(Me,{id:"napcat-port",type:"number",value:t.napcat_server.port||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),a.jsx(Me,{id:"napcat-token",type:"password",value:t.napcat_server.token,onChange:n=>e({...t,napcat_server:{...t.napcat_server,token:n.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),a.jsx(Me,{id:"napcat-heartbeat",type:"number",value:t.napcat_server.heartbeat_interval||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,heartbeat_interval:n.target.value?parseInt(n.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function Qte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),a.jsxs("div",{className:"grid gap-3 md:gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),a.jsx(Me,{id:"maibot-host",value:t.maibot_server.host,onChange:n=>e({...t,maibot_server:{...t.maibot_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),a.jsx(Me,{id:"maibot-port",type:"number",value:t.maibot_server.port||"",onChange:n=>e({...t,maibot_server:{...t.maibot_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function $te({config:t,onChange:e}){const n=i=>{const l={...t};i==="group"?l.chat.group_list=[...l.chat.group_list,0]:i==="private"?l.chat.private_list=[...l.chat.private_list,0]:l.chat.ban_user_id=[...l.chat.ban_user_id,0],e(l)},r=(i,l)=>{const c={...t};i==="group"?c.chat.group_list=c.chat.group_list.filter((d,h)=>h!==l):i==="private"?c.chat.private_list=c.chat.private_list.filter((d,h)=>h!==l):c.chat.ban_user_id=c.chat.ban_user_id.filter((d,h)=>h!==l),e(c)},s=(i,l,c)=>{const d={...t};i==="group"?d.chat.group_list[l]=c:i==="private"?d.chat.private_list[l]=c:d.chat.ban_user_id[l]=c,e(d)};return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),a.jsxs("div",{className:"grid gap-4 md:gap-6",children:[a.jsxs("div",{className:"space-y-3 md:space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"群组名单类型"}),a.jsxs(Lt,{value:t.chat.group_list_type,onValueChange:i=>e({...t,chat:{...t.chat,group_list_type:i}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),a.jsx(Pe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsx(te,{className:"text-sm md:text-base",children:"群组列表"}),a.jsxs(ie,{onClick:()=>n("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),t.chat.group_list.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{type:"number",value:i,onChange:c=>s("group",l,parseInt(c.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除群号 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r("group",l),children:"删除"})]})]})]})]},l)),t.chat.group_list.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),a.jsxs("div",{className:"space-y-3 md:space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"私聊名单类型"}),a.jsxs(Lt,{value:t.chat.private_list_type,onValueChange:i=>e({...t,chat:{...t.chat,private_list_type:i}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),a.jsx(Pe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsx(te,{className:"text-sm md:text-base",children:"私聊列表"}),a.jsxs(ie,{onClick:()=>n("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.private_list.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{type:"number",value:i,onChange:c=>s("private",l,parseInt(c.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除用户 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r("private",l),children:"删除"})]})]})]})]},l)),t.chat.private_list.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"全局禁止名单"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),a.jsxs(ie,{onClick:()=>n("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.ban_user_id.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{type:"number",value:i,onChange:c=>s("ban",l,parseInt(c.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要从全局禁止名单中删除用户 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r("ban",l),children:"删除"})]})]})]})]},l)),t.chat.ban_user_id.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),a.jsx(jt,{checked:t.chat.ban_qq_bot,onCheckedChange:i=>e({...t,chat:{...t.chat,ban_qq_bot:i}})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),a.jsx(jt,{checked:t.chat.enable_poke,onCheckedChange:i=>e({...t,chat:{...t.chat,enable_poke:i}})})]})]})]})})}function Hte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),a.jsx(jt,{checked:t.voice.use_tts,onCheckedChange:n=>e({...t,voice:{use_tts:n}})})]})]})})}function Ute({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),a.jsx("div",{className:"grid gap-3 md:gap-4",children:a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"日志等级"}),a.jsxs(Lt,{value:t.debug.level,onValueChange:n=>e({...t,debug:{level:n}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"DEBUG",children:"DEBUG(调试)"}),a.jsx(Pe,{value:"INFO",children:"INFO(信息)"}),a.jsx(Pe,{value:"WARNING",children:"WARNING(警告)"}),a.jsx(Pe,{value:"ERROR",children:"ERROR(错误)"}),a.jsx(Pe,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function u8(t){const e=[],n=String(t||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const l=n.slice(s,r).trim();(l||!i)&&e.push(l),s=r+1,r=n.indexOf(",",s)}return e}function Vte(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Wte=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Gte=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xte={};function d8(t,e){return(Xte.jsx?Gte:Wte).test(t)}const Yte=/[ \t\n\f\r]/g;function Kte(t){return typeof t=="object"?t.type==="text"?h8(t.value):!1:h8(t)}function h8(t){return t.replace(Yte,"")===""}class x0{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}x0.prototype.normal={};x0.prototype.property={};x0.prototype.space=void 0;function Z_(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new x0(n,r,e)}function Pf(t){return t.toLowerCase()}class qs{constructor(e,n){this.attribute=n,this.property=e}}qs.prototype.attribute="";qs.prototype.booleanish=!1;qs.prototype.boolean=!1;qs.prototype.commaOrSpaceSeparated=!1;qs.prototype.commaSeparated=!1;qs.prototype.defined=!1;qs.prototype.mustUseProperty=!1;qs.prototype.number=!1;qs.prototype.overloadedBoolean=!1;qs.prototype.property="";qs.prototype.spaceSeparated=!1;qs.prototype.space=void 0;let Zte=0;const Ot=Dc(),mr=Dc(),h4=Dc(),ze=Dc(),Bn=Dc(),Ju=Dc(),Js=Dc();function Dc(){return 2**++Zte}const f4=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ot,booleanish:mr,commaOrSpaceSeparated:Js,commaSeparated:Ju,number:ze,overloadedBoolean:h4,spaceSeparated:Bn},Symbol.toStringTag,{value:"Module"})),hb=Object.keys(f4);class c5 extends qs{constructor(e,n,r,s){let i=-1;if(super(e,n),f8(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&rne.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(m8,ine);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!m8.test(i)){let l=i.replace(nne,sne);l.charAt(0)!=="-"&&(l="-"+l),e="data"+l}}s=c5}return new s(r,e)}function sne(t){return"-"+t.toLowerCase()}function ine(t){return t.charAt(1).toUpperCase()}const aD=Z_([J_,Jte,nD,rD,sD],"html"),Lx=Z_([J_,ene,nD,rD,sD],"svg");function p8(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function ane(t){return t.join(" ").trim()}var Nu={},fb,g8;function lne(){if(g8)return fb;g8=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,d=` +`,h="/",m="*",p="",x="comment",v="declaration";function b(O,j){if(typeof O!="string")throw new TypeError("First argument must be a string");if(!O)return[];j=j||{};var T=1,A=1;function _(W){var J=W.match(e);J&&(T+=J.length);var $=W.lastIndexOf(d);A=~$?W.length-$:A+W.length}function D(){var W={line:T,column:A};return function(J){return J.position=new E(W),F(),J}}function E(W){this.start=W,this.end={line:T,column:A},this.source=j.source}E.prototype.content=O;function R(W){var J=new Error(j.source+":"+T+":"+A+": "+W);if(J.reason=W,J.filename=j.source,J.line=T,J.column=A,J.source=O,!j.silent)throw J}function Q(W){var J=W.exec(O);if(J){var $=J[0];return _($),O=O.slice($.length),J}}function F(){Q(n)}function L(W){var J;for(W=W||[];J=U();)J!==!1&&W.push(J);return W}function U(){var W=D();if(!(h!=O.charAt(0)||m!=O.charAt(1))){for(var J=2;p!=O.charAt(J)&&(m!=O.charAt(J)||h!=O.charAt(J+1));)++J;if(J+=2,p===O.charAt(J-1))return R("End of comment missing");var $=O.slice(2,J-2);return A+=2,_($),O=O.slice(J),A+=2,W({type:x,comment:$})}}function V(){var W=D(),J=Q(r);if(J){if(U(),!Q(s))return R("property missing ':'");var $=Q(i),ae=W({type:v,property:k(J[0].replace(t,p)),value:$?k($[0].replace(t,p)):p});return Q(l),ae}}function de(){var W=[];L(W);for(var J;J=V();)J!==!1&&(W.push(J),L(W));return W}return F(),de()}function k(O){return O?O.replace(c,p):p}return fb=b,fb}var x8;function one(){if(x8)return Nu;x8=1;var t=Nu&&Nu.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Nu,"__esModule",{value:!0}),Nu.default=n;const e=t(lne());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const l=(0,e.default)(r),c=typeof s=="function";return l.forEach(d=>{if(d.type!=="declaration")return;const{property:h,value:m}=d;c?s(h,m,d):m&&(i=i||{},i[h]=m)}),i}return Nu}var Lh={},v8;function cne(){if(v8)return Lh;v8=1,Object.defineProperty(Lh,"__esModule",{value:!0}),Lh.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(h){return!h||n.test(h)||t.test(h)},l=function(h,m){return m.toUpperCase()},c=function(h,m){return"".concat(m,"-")},d=function(h,m){return m===void 0&&(m={}),i(h)?h:(h=h.toLowerCase(),m.reactCompat?h=h.replace(s,c):h=h.replace(r,c),h.replace(e,l))};return Lh.camelCase=d,Lh}var Ih,y8;function une(){if(y8)return Ih;y8=1;var t=Ih&&Ih.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(one()),n=cne();function r(s,i){var l={};return!s||typeof s!="string"||(0,e.default)(s,function(c,d){c&&d&&(l[(0,n.camelCase)(c,i)]=d)}),l}return r.default=r,Ih=r,Ih}var dne=une();const hne=u9(dne),lD=oD("end"),u5=oD("start");function oD(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function fne(t){const e=u5(t),n=lD(t);if(e&&n)return{start:e,end:n}}function af(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?b8(t.position):"start"in t||"end"in t?b8(t):"line"in t||"column"in t?m4(t):""}function m4(t){return w8(t&&t.line)+":"+w8(t&&t.column)}function b8(t){return m4(t&&t.start)+"-"+m4(t&&t.end)}function w8(t){return t&&typeof t=="number"?t:1}class as extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},l=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?s=e:!i.cause&&e&&(l=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?i.ruleId=r:(i.source=r.slice(0,d),i.ruleId=r.slice(d+1))}if(!i.place&&i.ancestors&&i.ancestors){const d=i.ancestors[i.ancestors.length-1];d&&(i.place=d.position)}const c=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=c?c.line:void 0,this.name=af(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=l&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}as.prototype.file="";as.prototype.name="";as.prototype.reason="";as.prototype.message="";as.prototype.stack="";as.prototype.column=void 0;as.prototype.line=void 0;as.prototype.ancestors=void 0;as.prototype.cause=void 0;as.prototype.fatal=void 0;as.prototype.place=void 0;as.prototype.ruleId=void 0;as.prototype.source=void 0;const d5={}.hasOwnProperty,mne=new Map,pne=/[A-Z]/g,gne=new Set(["table","tbody","thead","tfoot","tr"]),xne=new Set(["td","th"]),cD="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function vne(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Nne(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=jne(n,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?Lx:aD,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=uD(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function uD(t,e,n){if(e.type==="element")return yne(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return bne(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return Sne(t,e,n);if(e.type==="mdxjsEsm")return wne(t,e);if(e.type==="root")return kne(t,e,n);if(e.type==="text")return One(t,e)}function yne(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Lx,t.schema=s),t.ancestors.push(e);const i=hD(t,e.tagName,!1),l=Cne(t,e);let c=f5(t,e);return gne.has(e.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!Kte(d):!0})),dD(t,l,i,e),h5(l,c),t.ancestors.pop(),t.schema=r,t.create(e,i,l,n)}function bne(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}Bf(t,e.position)}function wne(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Bf(t,e.position)}function Sne(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=Lx,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:hD(t,e.name,!0),l=Tne(t,e),c=f5(t,e);return dD(t,l,i,e),h5(l,c),t.ancestors.pop(),t.schema=r,t.create(e,i,l,n)}function kne(t,e,n){const r={};return h5(r,f5(t,e)),t.create(e,t.Fragment,r,n)}function One(t,e){return e.value}function dD(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function h5(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function jne(t,e,n){return r;function r(s,i,l,c){const h=Array.isArray(l.children)?n:e;return c?h(i,l,c):h(i,l)}}function Nne(t,e){return n;function n(r,s,i,l){const c=Array.isArray(i.children),d=u5(r);return e(s,i,l,c,{columnNumber:d?d.column-1:void 0,fileName:t,lineNumber:d?d.line:void 0},void 0)}}function Cne(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&d5.call(e.properties,s)){const i=Ane(t,s,e.properties[s]);if(i){const[l,c]=i;t.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&xne.has(e.tagName)?r=c:n[l]=c}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Tne(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const l=i.expression;l.type;const c=l.properties[0];c.type,Object.assign(n,t.evaluater.evaluateExpression(c.argument))}else Bf(t,e.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const c=r.value.data.estree.body[0];c.type,i=t.evaluater.evaluateExpression(c.expression)}else Bf(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function f5(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:mne;for(;++rs?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(e,n),t.splice(...l);else for(n&&t.splice(e,n);i0?(si(t,t.length,0,e),t):e}const O8={}.hasOwnProperty;function mD(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Qi(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ds=Ao(/[A-Za-z]/),rs=Ao(/[\dA-Za-z]/),Lne=Ao(/[#-'*+\--9=?A-Z^-~]/);function Hg(t){return t!==null&&(t<32||t===127)}const p4=Ao(/\d/),Ine=Ao(/[\dA-Fa-f]/),qne=Ao(/[!-/:-@[-`{-~]/);function Ze(t){return t!==null&&t<-2}function Rn(t){return t!==null&&(t<0||t===32)}function qt(t){return t===-2||t===-1||t===32}const Ix=Ao(new RegExp("\\p{P}|\\p{S}","u")),Cc=Ao(/\s/);function Ao(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Dd(t){const e=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const c=t.charCodeAt(n+1);i<56320&&c>56319&&c<57344?(l=String.fromCharCode(i,c),s=1):l="�"}else l=String.fromCharCode(i);l&&(e.push(t.slice(r,n),encodeURIComponent(l)),r=n+s+1,l=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function zt(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return l;function l(d){return qt(d)?(t.enter(n),c(d)):e(d)}function c(d){return qt(d)&&i++l))return;const R=e.events.length;let Q=R,F,L;for(;Q--;)if(e.events[Q][0]==="exit"&&e.events[Q][1].type==="chunkFlow"){if(F){L=e.events[Q][1].end;break}F=!0}for(j(r),E=R;EA;){const D=n[_];e.containerState=D[1],D[0].exit.call(e,t)}n.length=A}function T(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function Une(t,e,n){return zt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function vd(t){if(t===null||Rn(t)||Cc(t))return 1;if(Ix(t))return 2}function qx(t,e,n){const r=[];let s=-1;for(;++s1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const p={...t[r][1].end},x={...t[n][1].start};N8(p,-d),N8(x,d),l={type:d>1?"strongSequence":"emphasisSequence",start:p,end:{...t[r][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:x},i={type:d>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:d>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},t[r][1].end={...l.start},t[n][1].start={...c.end},h=[],t[r][1].end.offset-t[r][1].start.offset&&(h=bi(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=bi(h,[["enter",s,e],["enter",l,e],["exit",l,e],["enter",i,e]]),h=bi(h,qx(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=bi(h,[["exit",i,e],["enter",c,e],["exit",c,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(m=2,h=bi(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):m=0,si(t,r-1,n-r+3,h),n=r+h.length-m-2;break}}for(n=-1;++n0&&qt(E)?zt(t,T,"linePrefix",i+1)(E):T(E)}function T(E){return E===null||Ze(E)?t.check(C8,k,_)(E):(t.enter("codeFlowValue"),A(E))}function A(E){return E===null||Ze(E)?(t.exit("codeFlowValue"),T(E)):(t.consume(E),A)}function _(E){return t.exit("codeFenced"),e(E)}function D(E,R,Q){let F=0;return L;function L(J){return E.enter("lineEnding"),E.consume(J),E.exit("lineEnding"),U}function U(J){return E.enter("codeFencedFence"),qt(J)?zt(E,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(J):V(J)}function V(J){return J===c?(E.enter("codeFencedFenceSequence"),de(J)):Q(J)}function de(J){return J===c?(F++,E.consume(J),de):F>=l?(E.exit("codeFencedFenceSequence"),qt(J)?zt(E,W,"whitespace")(J):W(J)):Q(J)}function W(J){return J===null||Ze(J)?(E.exit("codeFencedFence"),R(J)):Q(J)}}}function rre(t,e,n){const r=this;return s;function s(l){return l===null?n(l):(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i)}function i(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}const pb={name:"codeIndented",tokenize:ire},sre={partial:!0,tokenize:are};function ire(t,e,n){const r=this;return s;function s(h){return t.enter("codeIndented"),zt(t,i,"linePrefix",5)(h)}function i(h){const m=r.events[r.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(h):n(h)}function l(h){return h===null?d(h):Ze(h)?t.attempt(sre,l,d)(h):(t.enter("codeFlowValue"),c(h))}function c(h){return h===null||Ze(h)?(t.exit("codeFlowValue"),l(h)):(t.consume(h),c)}function d(h){return t.exit("codeIndented"),e(h)}}function are(t,e,n){const r=this;return s;function s(l){return r.parser.lazy[r.now().line]?n(l):Ze(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),s):zt(t,i,"linePrefix",5)(l)}function i(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(l):Ze(l)?s(l):n(l)}}const lre={name:"codeText",previous:cre,resolve:ore,tokenize:ure};function ore(t){let e=t.length-4,n=3,r,s;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&qh(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),qh(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),qh(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(l):t.interrupt(r.parser.constructs.flow,n,e)(l)}}function bD(t,e,n,r,s,i,l,c,d){const h=d||Number.POSITIVE_INFINITY;let m=0;return p;function p(j){return j===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(j),t.exit(i),x):j===null||j===32||j===41||Hg(j)?n(j):(t.enter(r),t.enter(l),t.enter(c),t.enter("chunkString",{contentType:"string"}),k(j))}function x(j){return j===62?(t.enter(i),t.consume(j),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(c),t.enter("chunkString",{contentType:"string"}),v(j))}function v(j){return j===62?(t.exit("chunkString"),t.exit(c),x(j)):j===null||j===60||Ze(j)?n(j):(t.consume(j),j===92?b:v)}function b(j){return j===60||j===62||j===92?(t.consume(j),v):v(j)}function k(j){return!m&&(j===null||j===41||Rn(j))?(t.exit("chunkString"),t.exit(c),t.exit(l),t.exit(r),e(j)):m999||v===null||v===91||v===93&&!d||v===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(v):v===93?(t.exit(i),t.enter(s),t.consume(v),t.exit(s),t.exit(r),e):Ze(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),m):(t.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===null||v===91||v===93||Ze(v)||c++>999?(t.exit("chunkString"),m(v)):(t.consume(v),d||(d=!qt(v)),v===92?x:p)}function x(v){return v===91||v===92||v===93?(t.consume(v),c++,p):p(v)}}function SD(t,e,n,r,s,i){let l;return c;function c(x){return x===34||x===39||x===40?(t.enter(r),t.enter(s),t.consume(x),t.exit(s),l=x===40?41:x,d):n(x)}function d(x){return x===l?(t.enter(s),t.consume(x),t.exit(s),t.exit(r),e):(t.enter(i),h(x))}function h(x){return x===l?(t.exit(i),d(l)):x===null?n(x):Ze(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),zt(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===l||x===null||Ze(x)?(t.exit("chunkString"),h(x)):(t.consume(x),x===92?p:m)}function p(x){return x===l||x===92?(t.consume(x),m):m(x)}}function lf(t,e){let n;return r;function r(s){return Ze(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):qt(s)?zt(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const vre={name:"definition",tokenize:bre},yre={partial:!0,tokenize:wre};function bre(t,e,n){const r=this;let s;return i;function i(v){return t.enter("definition"),l(v)}function l(v){return wD.call(r,t,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function c(v){return s=Qi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),d):n(v)}function d(v){return Rn(v)?lf(t,h)(v):h(v)}function h(v){return bD(t,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function m(v){return t.attempt(yre,p,p)(v)}function p(v){return qt(v)?zt(t,x,"whitespace")(v):x(v)}function x(v){return v===null||Ze(v)?(t.exit("definition"),r.parser.defined.push(s),e(v)):n(v)}}function wre(t,e,n){return r;function r(c){return Rn(c)?lf(t,s)(c):n(c)}function s(c){return SD(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function i(c){return qt(c)?zt(t,l,"whitespace")(c):l(c)}function l(c){return c===null||Ze(c)?e(c):n(c)}}const Sre={name:"hardBreakEscape",tokenize:kre};function kre(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return Ze(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const Ore={name:"headingAtx",resolve:jre,tokenize:Nre};function jre(t,e){let n=t.length-2,r=3,s,i;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},si(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function Nre(t,e,n){let r=0;return s;function s(m){return t.enter("atxHeading"),i(m)}function i(m){return t.enter("atxHeadingSequence"),l(m)}function l(m){return m===35&&r++<6?(t.consume(m),l):m===null||Rn(m)?(t.exit("atxHeadingSequence"),c(m)):n(m)}function c(m){return m===35?(t.enter("atxHeadingSequence"),d(m)):m===null||Ze(m)?(t.exit("atxHeading"),e(m)):qt(m)?zt(t,c,"whitespace")(m):(t.enter("atxHeadingText"),h(m))}function d(m){return m===35?(t.consume(m),d):(t.exit("atxHeadingSequence"),c(m))}function h(m){return m===null||m===35||Rn(m)?(t.exit("atxHeadingText"),c(m)):(t.consume(m),h)}}const Cre=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],A8=["pre","script","style","textarea"],Tre={concrete:!0,name:"htmlFlow",resolveTo:Ere,tokenize:_re},Are={partial:!0,tokenize:Rre},Mre={partial:!0,tokenize:Dre};function Ere(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function _re(t,e,n){const r=this;let s,i,l,c,d;return h;function h(P){return m(P)}function m(P){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(P),p}function p(P){return P===33?(t.consume(P),x):P===47?(t.consume(P),i=!0,k):P===63?(t.consume(P),s=3,r.interrupt?e:z):ds(P)?(t.consume(P),l=String.fromCharCode(P),O):n(P)}function x(P){return P===45?(t.consume(P),s=2,v):P===91?(t.consume(P),s=5,c=0,b):ds(P)?(t.consume(P),s=4,r.interrupt?e:z):n(P)}function v(P){return P===45?(t.consume(P),r.interrupt?e:z):n(P)}function b(P){const K="CDATA[";return P===K.charCodeAt(c++)?(t.consume(P),c===K.length?r.interrupt?e:V:b):n(P)}function k(P){return ds(P)?(t.consume(P),l=String.fromCharCode(P),O):n(P)}function O(P){if(P===null||P===47||P===62||Rn(P)){const K=P===47,H=l.toLowerCase();return!K&&!i&&A8.includes(H)?(s=1,r.interrupt?e(P):V(P)):Cre.includes(l.toLowerCase())?(s=6,K?(t.consume(P),j):r.interrupt?e(P):V(P)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):i?T(P):A(P))}return P===45||rs(P)?(t.consume(P),l+=String.fromCharCode(P),O):n(P)}function j(P){return P===62?(t.consume(P),r.interrupt?e:V):n(P)}function T(P){return qt(P)?(t.consume(P),T):L(P)}function A(P){return P===47?(t.consume(P),L):P===58||P===95||ds(P)?(t.consume(P),_):qt(P)?(t.consume(P),A):L(P)}function _(P){return P===45||P===46||P===58||P===95||rs(P)?(t.consume(P),_):D(P)}function D(P){return P===61?(t.consume(P),E):qt(P)?(t.consume(P),D):A(P)}function E(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(t.consume(P),d=P,R):qt(P)?(t.consume(P),E):Q(P)}function R(P){return P===d?(t.consume(P),d=null,F):P===null||Ze(P)?n(P):(t.consume(P),R)}function Q(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||Rn(P)?D(P):(t.consume(P),Q)}function F(P){return P===47||P===62||qt(P)?A(P):n(P)}function L(P){return P===62?(t.consume(P),U):n(P)}function U(P){return P===null||Ze(P)?V(P):qt(P)?(t.consume(P),U):n(P)}function V(P){return P===45&&s===2?(t.consume(P),$):P===60&&s===1?(t.consume(P),ae):P===62&&s===4?(t.consume(P),xe):P===63&&s===3?(t.consume(P),z):P===93&&s===5?(t.consume(P),ce):Ze(P)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(Are,Y,de)(P)):P===null||Ze(P)?(t.exit("htmlFlowData"),de(P)):(t.consume(P),V)}function de(P){return t.check(Mre,W,Y)(P)}function W(P){return t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),J}function J(P){return P===null||Ze(P)?de(P):(t.enter("htmlFlowData"),V(P))}function $(P){return P===45?(t.consume(P),z):V(P)}function ae(P){return P===47?(t.consume(P),l="",ne):V(P)}function ne(P){if(P===62){const K=l.toLowerCase();return A8.includes(K)?(t.consume(P),xe):V(P)}return ds(P)&&l.length<8?(t.consume(P),l+=String.fromCharCode(P),ne):V(P)}function ce(P){return P===93?(t.consume(P),z):V(P)}function z(P){return P===62?(t.consume(P),xe):P===45&&s===2?(t.consume(P),z):V(P)}function xe(P){return P===null||Ze(P)?(t.exit("htmlFlowData"),Y(P)):(t.consume(P),xe)}function Y(P){return t.exit("htmlFlow"),e(P)}}function Dre(t,e,n){const r=this;return s;function s(l){return Ze(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i):n(l)}function i(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}function Rre(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(v0,e,n)}}const zre={name:"htmlText",tokenize:Pre};function Pre(t,e,n){const r=this;let s,i,l;return c;function c(z){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(z),d}function d(z){return z===33?(t.consume(z),h):z===47?(t.consume(z),D):z===63?(t.consume(z),A):ds(z)?(t.consume(z),Q):n(z)}function h(z){return z===45?(t.consume(z),m):z===91?(t.consume(z),i=0,b):ds(z)?(t.consume(z),T):n(z)}function m(z){return z===45?(t.consume(z),v):n(z)}function p(z){return z===null?n(z):z===45?(t.consume(z),x):Ze(z)?(l=p,ae(z)):(t.consume(z),p)}function x(z){return z===45?(t.consume(z),v):p(z)}function v(z){return z===62?$(z):z===45?x(z):p(z)}function b(z){const xe="CDATA[";return z===xe.charCodeAt(i++)?(t.consume(z),i===xe.length?k:b):n(z)}function k(z){return z===null?n(z):z===93?(t.consume(z),O):Ze(z)?(l=k,ae(z)):(t.consume(z),k)}function O(z){return z===93?(t.consume(z),j):k(z)}function j(z){return z===62?$(z):z===93?(t.consume(z),j):k(z)}function T(z){return z===null||z===62?$(z):Ze(z)?(l=T,ae(z)):(t.consume(z),T)}function A(z){return z===null?n(z):z===63?(t.consume(z),_):Ze(z)?(l=A,ae(z)):(t.consume(z),A)}function _(z){return z===62?$(z):A(z)}function D(z){return ds(z)?(t.consume(z),E):n(z)}function E(z){return z===45||rs(z)?(t.consume(z),E):R(z)}function R(z){return Ze(z)?(l=R,ae(z)):qt(z)?(t.consume(z),R):$(z)}function Q(z){return z===45||rs(z)?(t.consume(z),Q):z===47||z===62||Rn(z)?F(z):n(z)}function F(z){return z===47?(t.consume(z),$):z===58||z===95||ds(z)?(t.consume(z),L):Ze(z)?(l=F,ae(z)):qt(z)?(t.consume(z),F):$(z)}function L(z){return z===45||z===46||z===58||z===95||rs(z)?(t.consume(z),L):U(z)}function U(z){return z===61?(t.consume(z),V):Ze(z)?(l=U,ae(z)):qt(z)?(t.consume(z),U):F(z)}function V(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(t.consume(z),s=z,de):Ze(z)?(l=V,ae(z)):qt(z)?(t.consume(z),V):(t.consume(z),W)}function de(z){return z===s?(t.consume(z),s=void 0,J):z===null?n(z):Ze(z)?(l=de,ae(z)):(t.consume(z),de)}function W(z){return z===null||z===34||z===39||z===60||z===61||z===96?n(z):z===47||z===62||Rn(z)?F(z):(t.consume(z),W)}function J(z){return z===47||z===62||Rn(z)?F(z):n(z)}function $(z){return z===62?(t.consume(z),t.exit("htmlTextData"),t.exit("htmlText"),e):n(z)}function ae(z){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),ne}function ne(z){return qt(z)?zt(t,ce,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):ce(z)}function ce(z){return t.enter("htmlTextData"),l(z)}}const g5={name:"labelEnd",resolveAll:qre,resolveTo:Fre,tokenize:Qre},Bre={tokenize:$re},Lre={tokenize:Hre},Ire={tokenize:Ure};function qre(t){let e=-1;const n=[];for(;++e=3&&(h===null||Ze(h))?(t.exit("thematicBreak"),e(h)):n(h)}function d(h){return h===s?(t.consume(h),r++,d):(t.exit("thematicBreakSequence"),qt(h)?zt(t,c,"whitespace")(h):c(h))}}const Ns={continuation:{tokenize:tse},exit:rse,name:"list",tokenize:ese},Zre={partial:!0,tokenize:sse},Jre={partial:!0,tokenize:nse};function ese(t,e,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,l=0;return c;function c(v){const b=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:p4(v)){if(r.containerState.type||(r.containerState.type=b,t.enter(b,{_container:!0})),b==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(og,n,h)(v):h(v);if(!r.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),d(v)}return n(v)}function d(v){return p4(v)&&++l<10?(t.consume(v),d):(!r.interrupt||l<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),h(v)):n(v)}function h(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,t.check(v0,r.interrupt?n:m,t.attempt(Zre,x,p))}function m(v){return r.containerState.initialBlankLine=!0,i++,x(v)}function p(v){return qt(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),x):n(v)}function x(v){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(v)}}function tse(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(v0,s,i);function s(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,zt(t,e,"listItemIndent",r.containerState.size+1)(c)}function i(c){return r.containerState.furtherBlankLines||!qt(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(Jre,e,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,zt(t,t.attempt(Ns,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function nse(t,e,n){const r=this;return zt(t,s,"listItemIndent",r.containerState.size+1);function s(i){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?e(i):n(i)}}function rse(t){t.exit(this.containerState.type)}function sse(t,e,n){const r=this;return zt(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const l=r.events[r.events.length-1];return!qt(i)&&l&&l[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const M8={name:"setextUnderline",resolveTo:ise,tokenize:ase};function ise(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const l={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",l,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=l,t.push(["exit",l,e]),t}function ase(t,e,n){const r=this;let s;return i;function i(h){let m=r.events.length,p;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){p=r.events[m][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(t.enter("setextHeadingLine"),s=h,l(h)):n(h)}function l(h){return t.enter("setextHeadingLineSequence"),c(h)}function c(h){return h===s?(t.consume(h),c):(t.exit("setextHeadingLineSequence"),qt(h)?zt(t,d,"lineSuffix")(h):d(h))}function d(h){return h===null||Ze(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const lse={tokenize:ose};function ose(t){const e=this,n=t.attempt(v0,r,t.attempt(this.parser.constructs.flowInitial,s,zt(t,t.attempt(this.parser.constructs.flow,s,t.attempt(fre,s)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const cse={resolveAll:OD()},use=kD("string"),dse=kD("text");function kD(t){return{resolveAll:OD(t==="text"?hse:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,l,c);return l;function l(m){return h(m)?i(m):c(m)}function c(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),d}function d(m){return h(m)?(n.exit("data"),i(m)):(n.consume(m),d)}function h(m){if(m===null)return!0;const p=s[m];let x=-1;if(p)for(;++x-1){const c=l[0];typeof c=="string"?l[0]=c.slice(r):l.shift()}i>0&&l.push(t[s].slice(0,i))}return l}function jse(t,e){let n=-1;const r=[];let s;for(;++n0){const cr=Be.tokenStack[Be.tokenStack.length-1];(cr[1]||_8).call(Be,void 0,cr[0])}for(Se.position={start:Xl(ee.length>0?ee[0][1].start:{line:1,column:1,offset:0}),end:Xl(ee.length>0?ee[ee.length-2][1].end:{line:1,column:1,offset:0})},Tt=-1;++Tt1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};t.patch(e,d);const h={type:"element",tagName:"sup",properties:{},children:[d]};return t.patch(e,h),t.applyData(e,h)}function Qse(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function $se(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function CD(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const l=s[s.length-1];return l&&l.type==="text"?l.value+=r:s.push({type:"text",value:r}),s}function Hse(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return CD(t,e);const s={src:Dd(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,i),t.applyData(e,i)}function Use(t,e){const n={src:Dd(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function Vse(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function Wse(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return CD(t,e);const s={href:Dd(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function Gse(t,e){const n={href:Dd(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Xse(t,e,n){const r=t.all(e),s=n?Yse(n):TD(e),i={},l=[];if(typeof e.checked=="boolean"){const m=r[0];let p;m&&m.type==="element"&&m.tagName==="p"?p=m:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let c=-1;for(;++c1}function Kse(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s0){const l={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},c=u5(e.children[1]),d=lD(e.children[e.children.length-1]);c&&d&&(l.position={start:c,end:d}),s.push(l)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function nie(t,e,n){const r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,c=l?l.length:e.children.length;let d=-1;const h=[];for(;++d0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return i.push(z8(e.slice(s),s>0,!1)),i.join("")}function z8(t,e,n){let r=0,s=t.length;if(e){let i=t.codePointAt(r);for(;i===D8||i===R8;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(s-1);for(;i===D8||i===R8;)s--,i=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function iie(t,e){const n={type:"text",value:sie(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function aie(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const lie={blockquote:Pse,break:Bse,code:Lse,delete:Ise,emphasis:qse,footnoteReference:Fse,heading:Qse,html:$se,imageReference:Hse,image:Use,inlineCode:Vse,linkReference:Wse,link:Gse,listItem:Xse,list:Kse,paragraph:Zse,root:Jse,strong:eie,table:tie,tableCell:rie,tableRow:nie,text:iie,thematicBreak:aie,toml:Op,yaml:Op,definition:Op,footnoteDefinition:Op};function Op(){}const AD=-1,Fx=0,of=1,Ug=2,x5=3,v5=4,y5=5,b5=6,MD=7,ED=8,P8=typeof self=="object"?self:globalThis,oie=(t,e)=>{const n=(s,i)=>(t.set(i,s),s),r=s=>{if(t.has(s))return t.get(s);const[i,l]=e[s];switch(i){case Fx:case AD:return n(l,s);case of:{const c=n([],s);for(const d of l)c.push(r(d));return c}case Ug:{const c=n({},s);for(const[d,h]of l)c[r(d)]=r(h);return c}case x5:return n(new Date(l),s);case v5:{const{source:c,flags:d}=l;return n(new RegExp(c,d),s)}case y5:{const c=n(new Map,s);for(const[d,h]of l)c.set(r(d),r(h));return c}case b5:{const c=n(new Set,s);for(const d of l)c.add(r(d));return c}case MD:{const{name:c,message:d}=l;return n(new P8[c](d),s)}case ED:return n(BigInt(l),s);case"BigInt":return n(Object(BigInt(l)),s);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:c}=new Uint8Array(l);return n(new DataView(c),l)}}return n(new P8[i](l),s)};return r},B8=t=>oie(new Map,t)(0),Cu="",{toString:cie}={},{keys:uie}=Object,Fh=t=>{const e=typeof t;if(e!=="object"||!t)return[Fx,e];const n=cie.call(t).slice(8,-1);switch(n){case"Array":return[of,Cu];case"Object":return[Ug,Cu];case"Date":return[x5,Cu];case"RegExp":return[v5,Cu];case"Map":return[y5,Cu];case"Set":return[b5,Cu];case"DataView":return[of,n]}return n.includes("Array")?[of,n]:n.includes("Error")?[MD,n]:[Ug,n]},jp=([t,e])=>t===Fx&&(e==="function"||e==="symbol"),die=(t,e,n,r)=>{const s=(l,c)=>{const d=r.push(l)-1;return n.set(c,d),d},i=l=>{if(n.has(l))return n.get(l);let[c,d]=Fh(l);switch(c){case Fx:{let m=l;switch(d){case"bigint":c=ED,m=l.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+d);m=null;break;case"undefined":return s([AD],l)}return s([c,m],l)}case of:{if(d){let x=l;return d==="DataView"?x=new Uint8Array(l.buffer):d==="ArrayBuffer"&&(x=new Uint8Array(l)),s([d,[...x]],l)}const m=[],p=s([c,m],l);for(const x of l)m.push(i(x));return p}case Ug:{if(d)switch(d){case"BigInt":return s([d,l.toString()],l);case"Boolean":case"Number":case"String":return s([d,l.valueOf()],l)}if(e&&"toJSON"in l)return i(l.toJSON());const m=[],p=s([c,m],l);for(const x of uie(l))(t||!jp(Fh(l[x])))&&m.push([i(x),i(l[x])]);return p}case x5:return s([c,l.toISOString()],l);case v5:{const{source:m,flags:p}=l;return s([c,{source:m,flags:p}],l)}case y5:{const m=[],p=s([c,m],l);for(const[x,v]of l)(t||!(jp(Fh(x))||jp(Fh(v))))&&m.push([i(x),i(v)]);return p}case b5:{const m=[],p=s([c,m],l);for(const x of l)(t||!jp(Fh(x)))&&m.push(i(x));return p}}const{message:h}=l;return s([c,{name:d,message:h}],l)};return i},L8=(t,{json:e,lossy:n}={})=>{const r=[];return die(!(e||n),!!e,new Map,r)(t),r},Vg=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?B8(L8(t,e)):structuredClone(t):(t,e)=>B8(L8(t,e));function hie(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function fie(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function mie(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||hie,r=t.options.footnoteBackLabel||fie,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",l=t.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let d=-1;for(;++d0&&b.push({type:"text",value:" "});let T=typeof n=="string"?n:n(d,v);typeof T=="string"&&(T={type:"text",value:T}),b.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+x+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(d,v),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}const O=m[m.length-1];if(O&&O.type==="element"&&O.tagName==="p"){const T=O.children[O.children.length-1];T&&T.type==="text"?T.value+=" ":O.children.push({type:"text",value:" "}),O.children.push(...b)}else m.push(...b);const j={type:"element",tagName:"li",properties:{id:e+"fn-"+x},children:t.wrap(m,!0)};t.patch(h,j),c.push(j)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Vg(l),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:t.wrap(c,!0)},{type:"text",value:` +`}]}}const y0=(function(t){if(t==null)return vie;if(typeof t=="function")return Qx(t);if(typeof t=="object")return Array.isArray(t)?pie(t):gie(t);if(typeof t=="string")return xie(t);throw new Error("Expected function, string, or object as test")});function pie(t){const e=[];let n=-1;for(;++n":""))+")"})}return x;function x(){let v=_D,b,k,O;if((!e||i(d,h,m[m.length-1]||void 0))&&(v=wie(n(d,m)),v[0]===x4))return v;if("children"in d&&d.children){const j=d;if(j.children&&v[0]!==DD)for(k=(r?j.children.length:-1)+l,O=m.concat(j);k>-1&&k0&&n.push({type:"text",value:` +`}),n}function I8(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function q8(t,e){const n=kie(t,e),r=n.one(t,void 0),s=mie(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:` +`},s),i}function Tie(t,e){return t&&"run"in t?async function(n,r){const s=q8(n,{file:r,...e});await t.run(s,r)}:function(n,r){return q8(n,{file:r,...t||e})}}function F8(t){if(t)throw t}var xb,Q8;function Aie(){if(Q8)return xb;Q8=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):e.call(h)==="[object Array]"},i=function(h){if(!h||e.call(h)!=="[object Object]")return!1;var m=t.call(h,"constructor"),p=h.constructor&&h.constructor.prototype&&t.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!m&&!p)return!1;var x;for(x in h);return typeof x>"u"||t.call(h,x)},l=function(h,m){n&&m.name==="__proto__"?n(h,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):h[m.name]=m.newValue},c=function(h,m){if(m==="__proto__")if(t.call(h,m)){if(r)return r(h,m).value}else return;return h[m]};return xb=function d(){var h,m,p,x,v,b,k=arguments[0],O=1,j=arguments.length,T=!1;for(typeof k=="boolean"&&(T=k,k=arguments[1]||{},O=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});Ol.length;let d;c&&l.push(s);try{d=t.apply(this,l)}catch(h){const m=h;if(c&&n)throw m;return s(m)}c||(d&&d.then&&typeof d.then=="function"?d.then(i,s):d instanceof Error?s(d):i(d))}function s(l,...c){n||(n=!0,e(l,...c))}function i(l){s(null,l)}}const ia={basename:Die,dirname:Rie,extname:zie,join:Pie,sep:"/"};function Die(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');b0(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let l=-1,c=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else l<0&&(i=!0,l=s+1),c>-1&&(t.codePointAt(s)===e.codePointAt(c--)?c<0&&(r=s):(c=-1,r=l));return n===r?r=l:r<0&&(r=t.length),t.slice(n,r)}function Rie(t){if(b0(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function zie(t){b0(t);let e=t.length,n=-1,r=0,s=-1,i=0,l;for(;e--;){const c=t.codePointAt(e);if(c===47){if(l){r=e+1;break}continue}n<0&&(l=!0,n=e+1),c===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function Pie(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function Lie(t,e){let n="",r=0,s=-1,i=0,l=-1,c,d;for(;++l<=t.length;){if(l2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",r=0):(n=n.slice(0,d),r=n.length-1-n.lastIndexOf("/")),s=l,i=0;continue}}else if(n.length>0){n="",r=0,s=l,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,l):n=t.slice(s+1,l),r=l-s-1;s=l,i=0}else c===46&&i>-1?i++:i=-1}return n}function b0(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Iie={cwd:qie};function qie(){return"/"}function b4(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function Fie(t){if(typeof t=="string")t=new URL(t);else if(!b4(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Qie(t)}function Qie(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[v,...b]=m;const k=r[x][1];y4(k)&&y4(v)&&(v=vb(!0,k,v)),r[x]=[h,v,...b]}}}}const Vie=new k5().freeze();function Sb(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function kb(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Ob(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function H8(t){if(!y4(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function U8(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Np(t){return Wie(t)?t:new RD(t)}function Wie(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Gie(t){return typeof t=="string"||Xie(t)}function Xie(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Yie="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",V8=[],W8={allowDangerousHtml:!0},Kie=/^(https?|ircs?|mailto|xmpp)$/i,Zie=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Jie(t){const e=eae(t),n=tae(t);return nae(e.runSync(e.parse(n),n),t)}function eae(t){const e=t.rehypePlugins||V8,n=t.remarkPlugins||V8,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...W8}:W8;return Vie().use(zse).use(n).use(Tie,r).use(e)}function tae(t){const e=t.children||"",n=new RD;return typeof e=="string"&&(n.value=e),n}function nae(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,l=e.skipHtml,c=e.unwrapDisallowed,d=e.urlTransform||rae;for(const m of Zie)Object.hasOwn(e,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+Yie+m.id,void 0);return S5(t,h),vne(t,{Fragment:a.Fragment,components:s,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function h(m,p,x){if(m.type==="raw"&&x&&typeof p=="number")return l?x.children.splice(p,1):x.children[p]={type:"text",value:m.value},p;if(m.type==="element"){let v;for(v in mb)if(Object.hasOwn(mb,v)&&Object.hasOwn(m.properties,v)){const b=m.properties[v],k=mb[v];(k===null||k.includes(m.tagName))&&(m.properties[v]=d(String(b||""),v,m))}}if(m.type==="element"){let v=n?!n.includes(m.tagName):i?i.includes(m.tagName):!1;if(!v&&r&&typeof p=="number"&&(v=!r(m,p,x)),v&&x&&typeof p=="number")return c&&m.children?x.children.splice(p,1,...m.children):x.children.splice(p,1),p}}}function rae(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||Kie.test(t.slice(0,e))?t:""}function G8(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function sae(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function iae(t,e,n){const s=y0((n||{}).ignore||[]),i=aae(e);let l=-1;for(;++l0?{type:"text",value:E}:void 0),E===!1?x.lastIndex=_+1:(b!==_&&T.push({type:"text",value:h.value.slice(b,_)}),Array.isArray(E)?T.push(...E):E&&T.push(E),b=_+A[0].length,j=!0),!x.global)break;A=x.exec(h.value)}return j?(b?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const s=G8(t,"(");let i=G8(t,")");for(;r!==-1&&s>i;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[t,n]}function zD(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Cc(n)||Ix(n))&&(!e||n!==47)}PD.peek=Aae;function wae(){this.buffer()}function Sae(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function kae(){this.buffer()}function Oae(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function jae(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qi(this.sliceSerialize(t)).toLowerCase(),n.label=e}function Nae(t){this.exit(t)}function Cae(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qi(this.sliceSerialize(t)).toLowerCase(),n.label=e}function Tae(t){this.exit(t)}function Aae(){return"["}function PD(t,e,n,r){const s=n.createTracker(r);let i=s.move("[^");const l=n.enter("footnoteReference"),c=n.enter("reference");return i+=s.move(n.safe(n.associationId(t),{after:"]",before:i})),c(),l(),i+=s.move("]"),i}function Mae(){return{enter:{gfmFootnoteCallString:wae,gfmFootnoteCall:Sae,gfmFootnoteDefinitionLabelString:kae,gfmFootnoteDefinition:Oae},exit:{gfmFootnoteCallString:jae,gfmFootnoteCall:Nae,gfmFootnoteDefinitionLabelString:Cae,gfmFootnoteDefinition:Tae}}}function Eae(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:PD},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,l){const c=i.createTracker(l);let d=c.move("[^");const h=i.enter("footnoteDefinition"),m=i.enter("label");return d+=c.move(i.safe(i.associationId(r),{before:d,after:"]"})),m(),d+=c.move("]:"),r.children&&r.children.length>0&&(c.shift(4),d+=c.move((e?` +`:" ")+i.indentLines(i.containerFlow(r,c.current()),e?BD:_ae))),h(),d}}function _ae(t,e,n){return e===0?t:BD(t,e,n)}function BD(t,e,n){return(n?"":" ")+t}const Dae=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];LD.peek=Lae;function Rae(){return{canContainEols:["delete"],enter:{strikethrough:Pae},exit:{strikethrough:Bae}}}function zae(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Dae}],handlers:{delete:LD}}}function Pae(t){this.enter({type:"delete",children:[]},t)}function Bae(t){this.exit(t)}function LD(t,e,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let l=s.move("~~");return l+=n.containerPhrasing(t,{...s.current(),before:l,after:"~"}),l+=s.move("~~"),i(),l}function Lae(){return"~"}function Iae(t){return t.length}function qae(t,e){const n=e||{},r=(n.align||[]).concat(),s=n.stringLength||Iae,i=[],l=[],c=[],d=[];let h=0,m=-1;for(;++mh&&(h=t[m].length);++jd[j])&&(d[j]=A)}k.push(T)}l[m]=k,c[m]=O}let p=-1;if(typeof r=="object"&&"length"in r)for(;++pd[p]&&(d[p]=T),v[p]=T),x[p]=A}l.splice(1,0,x),c.splice(1,0,v),m=-1;const b=[];for(;++m "),i.shift(2);const l=n.indentLines(n.containerFlow(t,i.current()),$ae);return s(),l}function $ae(t,e,n){return">"+(n?"":" ")+t}function Hae(t,e){return Y8(t,e.inConstruct,!0)&&!Y8(t,e.notInConstruct,!1)}function Y8(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++rl&&(l=i):i=1,s=r+e.length,r=n.indexOf(e,s);return l}function Uae(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function Vae(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function Wae(t,e,n,r){const s=Vae(n),i=t.value||"",l=s==="`"?"GraveAccent":"Tilde";if(Uae(t,n)){const p=n.enter("codeIndented"),x=n.indentLines(i,Gae);return p(),x}const c=n.createTracker(r),d=s.repeat(Math.max(ID(i,s)+1,3)),h=n.enter("codeFenced");let m=c.move(d);if(t.lang){const p=n.enter(`codeFencedLang${l}`);m+=c.move(n.safe(t.lang,{before:m,after:" ",encode:["`"],...c.current()})),p()}if(t.lang&&t.meta){const p=n.enter(`codeFencedMeta${l}`);m+=c.move(" "),m+=c.move(n.safe(t.meta,{before:m,after:` +`,encode:["`"],...c.current()})),p()}return m+=c.move(` +`),i&&(m+=c.move(i+` +`)),m+=c.move(d),h(),m}function Gae(t,e,n){return(n?"":" ")+t}function O5(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function Xae(t,e,n,r){const s=O5(n),i=s==='"'?"Quote":"Apostrophe",l=n.enter("definition");let c=n.enter("label");const d=n.createTracker(r);let h=d.move("[");return h+=d.move(n.safe(n.associationId(t),{before:h,after:"]",...d.current()})),h+=d.move("]: "),c(),!t.url||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(n.safe(t.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(c=n.enter("destinationRaw"),h+=d.move(n.safe(t.url,{before:h,after:t.title?" ":` +`,...d.current()}))),c(),t.title&&(c=n.enter(`title${i}`),h+=d.move(" "+s),h+=d.move(n.safe(t.title,{before:h,after:s,...d.current()})),h+=d.move(s),c()),l(),h}function Yae(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function Lf(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Wg(t,e,n){const r=vd(t),s=vd(e);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}qD.peek=Kae;function qD(t,e,n,r){const s=Yae(n),i=n.enter("emphasis"),l=n.createTracker(r),c=l.move(s);let d=l.move(n.containerPhrasing(t,{after:s,before:c,...l.current()}));const h=d.charCodeAt(0),m=Wg(r.before.charCodeAt(r.before.length-1),h,s);m.inside&&(d=Lf(h)+d.slice(1));const p=d.charCodeAt(d.length-1),x=Wg(r.after.charCodeAt(0),p,s);x.inside&&(d=d.slice(0,-1)+Lf(p));const v=l.move(s);return i(),n.attentionEncodeSurroundingInfo={after:x.outside,before:m.outside},c+d+v}function Kae(t,e,n){return n.options.emphasis||"*"}function Zae(t,e){let n=!1;return S5(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,x4}),!!((!t.depth||t.depth<3)&&m5(t)&&(e.options.setext||n))}function Jae(t,e,n,r){const s=Math.max(Math.min(6,t.depth||1),1),i=n.createTracker(r);if(Zae(t,n)){const m=n.enter("headingSetext"),p=n.enter("phrasing"),x=n.containerPhrasing(t,{...i.current(),before:` +`,after:` +`});return p(),m(),x+` +`+(s===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(` +`))+1))}const l="#".repeat(s),c=n.enter("headingAtx"),d=n.enter("phrasing");i.move(l+" ");let h=n.containerPhrasing(t,{before:"# ",after:` +`,...i.current()});return/^[\t ]/.test(h)&&(h=Lf(h.charCodeAt(0))+h.slice(1)),h=h?l+" "+h:l,n.options.closeAtx&&(h+=" "+l),d(),c(),h}FD.peek=ele;function FD(t){return t.value||""}function ele(){return"<"}QD.peek=tle;function QD(t,e,n,r){const s=O5(n),i=s==='"'?"Quote":"Apostrophe",l=n.enter("image");let c=n.enter("label");const d=n.createTracker(r);let h=d.move("![");return h+=d.move(n.safe(t.alt,{before:h,after:"]",...d.current()})),h+=d.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(n.safe(t.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(c=n.enter("destinationRaw"),h+=d.move(n.safe(t.url,{before:h,after:t.title?" ":")",...d.current()}))),c(),t.title&&(c=n.enter(`title${i}`),h+=d.move(" "+s),h+=d.move(n.safe(t.title,{before:h,after:s,...d.current()})),h+=d.move(s),c()),h+=d.move(")"),l(),h}function tle(){return"!"}$D.peek=nle;function $D(t,e,n,r){const s=t.referenceType,i=n.enter("imageReference");let l=n.enter("label");const c=n.createTracker(r);let d=c.move("![");const h=n.safe(t.alt,{before:d,after:"]",...c.current()});d+=c.move(h+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(t),{before:d,after:"]",...c.current()});return l(),n.stack=m,i(),s==="full"||!h||h!==p?d+=c.move(p+"]"):s==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function nle(){return"!"}HD.peek=rle;function HD(t,e,n){let r=t.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i\u007F]/.test(t.url))}VD.peek=sle;function VD(t,e,n,r){const s=O5(n),i=s==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let c,d;if(UD(t,n)){const m=n.stack;n.stack=[],c=n.enter("autolink");let p=l.move("<");return p+=l.move(n.containerPhrasing(t,{before:p,after:">",...l.current()})),p+=l.move(">"),c(),n.stack=m,p}c=n.enter("link"),d=n.enter("label");let h=l.move("[");return h+=l.move(n.containerPhrasing(t,{before:h,after:"](",...l.current()})),h+=l.move("]("),d(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(d=n.enter("destinationLiteral"),h+=l.move("<"),h+=l.move(n.safe(t.url,{before:h,after:">",...l.current()})),h+=l.move(">")):(d=n.enter("destinationRaw"),h+=l.move(n.safe(t.url,{before:h,after:t.title?" ":")",...l.current()}))),d(),t.title&&(d=n.enter(`title${i}`),h+=l.move(" "+s),h+=l.move(n.safe(t.title,{before:h,after:s,...l.current()})),h+=l.move(s),d()),h+=l.move(")"),c(),h}function sle(t,e,n){return UD(t,n)?"<":"["}WD.peek=ile;function WD(t,e,n,r){const s=t.referenceType,i=n.enter("linkReference");let l=n.enter("label");const c=n.createTracker(r);let d=c.move("[");const h=n.containerPhrasing(t,{before:d,after:"]",...c.current()});d+=c.move(h+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(t),{before:d,after:"]",...c.current()});return l(),n.stack=m,i(),s==="full"||!h||h!==p?d+=c.move(p+"]"):s==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function ile(){return"["}function j5(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function ale(t){const e=j5(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function lle(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function GD(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function ole(t,e,n,r){const s=n.enter("list"),i=n.bulletCurrent;let l=t.ordered?lle(n):j5(n);const c=t.ordered?l==="."?")":".":ale(n);let d=e&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!t.ordered){const m=t.children?t.children[0]:void 0;if((l==="*"||l==="-")&&m&&(!m.children||!m.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(d=!0),GD(n)===l&&m){let p=-1;for(;++p-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+i);let l=i.length+1;(s==="tab"||s==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(l=Math.ceil(l/4)*4);const c=n.createTracker(r);c.move(i+" ".repeat(l-i.length)),c.shift(l);const d=n.enter("listItem"),h=n.indentLines(n.containerFlow(t,c.current()),m);return d(),h;function m(p,x,v){return x?(v?"":" ".repeat(l))+p:(v?i:i+" ".repeat(l-i.length))+p}}function dle(t,e,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),l=n.containerPhrasing(t,r);return i(),s(),l}const hle=y0(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function fle(t,e,n,r){return(t.children.some(function(l){return hle(l)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function mle(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}XD.peek=ple;function XD(t,e,n,r){const s=mle(n),i=n.enter("strong"),l=n.createTracker(r),c=l.move(s+s);let d=l.move(n.containerPhrasing(t,{after:s,before:c,...l.current()}));const h=d.charCodeAt(0),m=Wg(r.before.charCodeAt(r.before.length-1),h,s);m.inside&&(d=Lf(h)+d.slice(1));const p=d.charCodeAt(d.length-1),x=Wg(r.after.charCodeAt(0),p,s);x.inside&&(d=d.slice(0,-1)+Lf(p));const v=l.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:x.outside,before:m.outside},c+d+v}function ple(t,e,n){return n.options.strong||"*"}function gle(t,e,n,r){return n.safe(t.value,r)}function xle(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function vle(t,e,n){const r=(GD(n)+(n.options.ruleSpaces?" ":"")).repeat(xle(n));return n.options.ruleSpaces?r.slice(0,-1):r}const YD={blockquote:Qae,break:K8,code:Wae,definition:Xae,emphasis:qD,hardBreak:K8,heading:Jae,html:FD,image:QD,imageReference:$D,inlineCode:HD,link:VD,linkReference:WD,list:ole,listItem:ule,paragraph:dle,root:fle,strong:XD,text:gle,thematicBreak:vle};function yle(){return{enter:{table:ble,tableData:Z8,tableHeader:Z8,tableRow:Sle},exit:{codeText:kle,table:wle,tableData:Tb,tableHeader:Tb,tableRow:Tb}}}function ble(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function wle(t){this.exit(t),this.data.inTable=void 0}function Sle(t){this.enter({type:"tableRow",children:[]},t)}function Tb(t){this.exit(t)}function Z8(t){this.enter({type:"tableCell",children:[]},t)}function kle(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,Ole));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function Ole(t,e){return e==="|"?e:t}function jle(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,s=e.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:l,tableCell:d,tableRow:c}};function l(v,b,k,O){return h(m(v,k,O),v.align)}function c(v,b,k,O){const j=p(v,k,O),T=h([j]);return T.slice(0,T.indexOf(` +`))}function d(v,b,k,O){const j=k.enter("tableCell"),T=k.enter("phrasing"),A=k.containerPhrasing(v,{...O,before:i,after:i});return T(),j(),A}function h(v,b){return qae(v,{align:b,alignDelimiters:r,padding:n,stringLength:s})}function m(v,b,k){const O=v.children;let j=-1;const T=[],A=b.enter("table");for(;++j0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const $le={tokenize:Kle,partial:!0};function Hle(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Gle,continuation:{tokenize:Xle},exit:Yle}},text:{91:{name:"gfmFootnoteCall",tokenize:Wle},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Ule,resolveTo:Vle}}}}function Ule(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;s--;){const d=r.events[s][1];if(d.type==="labelImage"){l=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return c;function c(d){if(!l||!l._balanced)return n(d);const h=Qi(r.sliceSerialize({start:l.end,end:r.now()}));return h.codePointAt(0)!==94||!i.includes(h.slice(1))?n(d):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),e(d))}}function Vle(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},c=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",l,e],["exit",l,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...c),t}function Wle(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,l;return c;function c(p){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),d}function d(p){return p!==94?n(p):(t.enter("gfmFootnoteCallMarker"),t.consume(p),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(p){if(i>999||p===93&&!l||p===null||p===91||Rn(p))return n(p);if(p===93){t.exit("chunkString");const x=t.exit("gfmFootnoteCallString");return s.includes(Qi(r.sliceSerialize(x)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(p)}return Rn(p)||(l=!0),i++,t.consume(p),p===92?m:h}function m(p){return p===91||p===92||p===93?(t.consume(p),i++,h):h(p)}}function Gle(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,l=0,c;return d;function d(b){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(b){return b===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",m):n(b)}function m(b){if(l>999||b===93&&!c||b===null||b===91||Rn(b))return n(b);if(b===93){t.exit("chunkString");const k=t.exit("gfmFootnoteDefinitionLabelString");return i=Qi(r.sliceSerialize(k)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),x}return Rn(b)||(c=!0),l++,t.consume(b),b===92?p:m}function p(b){return b===91||b===92||b===93?(t.consume(b),l++,m):m(b)}function x(b){return b===58?(t.enter("definitionMarker"),t.consume(b),t.exit("definitionMarker"),s.includes(i)||s.push(i),zt(t,v,"gfmFootnoteDefinitionWhitespace")):n(b)}function v(b){return e(b)}}function Xle(t,e,n){return t.check(v0,e,t.attempt($le,e,n))}function Yle(t){t.exit("gfmFootnoteDefinition")}function Kle(t,e,n){const r=this;return zt(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?e(i):n(i)}}function Zle(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(l,c){let d=-1;for(;++d1?d(b):(l.consume(b),p++,v);if(p<2&&!n)return d(b);const O=l.exit("strikethroughSequenceTemporary"),j=vd(b);return O._open=!j||j===2&&!!k,O._close=!k||k===2&&!!j,c(b)}}}class Jle{constructor(){this.map=[]}add(e,n,r){eoe(this,e,n,r)}consume(e){if(this.map.sort(function(i,l){return i[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let s=r.pop();for(;s;){for(const i of s)e.push(i);s=r.pop()}this.map.length=0}}function eoe(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const W=r.events[U][1].type;if(W==="lineEnding"||W==="linePrefix")U--;else break}const V=U>-1?r.events[U][1].type:null,de=V==="tableHead"||V==="tableRow"?E:d;return de===E&&r.parser.lazy[r.now().line]?n(L):de(L)}function d(L){return t.enter("tableHead"),t.enter("tableRow"),h(L)}function h(L){return L===124||(l=!0,i+=1),m(L)}function m(L){return L===null?n(L):Ze(L)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(L),t.exit("lineEnding"),v):n(L):qt(L)?zt(t,m,"whitespace")(L):(i+=1,l&&(l=!1,s+=1),L===124?(t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),l=!0,m):(t.enter("data"),p(L)))}function p(L){return L===null||L===124||Rn(L)?(t.exit("data"),m(L)):(t.consume(L),L===92?x:p)}function x(L){return L===92||L===124?(t.consume(L),p):p(L)}function v(L){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(L):(t.enter("tableDelimiterRow"),l=!1,qt(L)?zt(t,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):b(L))}function b(L){return L===45||L===58?O(L):L===124?(l=!0,t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),k):D(L)}function k(L){return qt(L)?zt(t,O,"whitespace")(L):O(L)}function O(L){return L===58?(i+=1,l=!0,t.enter("tableDelimiterMarker"),t.consume(L),t.exit("tableDelimiterMarker"),j):L===45?(i+=1,j(L)):L===null||Ze(L)?_(L):D(L)}function j(L){return L===45?(t.enter("tableDelimiterFiller"),T(L)):D(L)}function T(L){return L===45?(t.consume(L),T):L===58?(l=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(L),t.exit("tableDelimiterMarker"),A):(t.exit("tableDelimiterFiller"),A(L))}function A(L){return qt(L)?zt(t,_,"whitespace")(L):_(L)}function _(L){return L===124?b(L):L===null||Ze(L)?!l||s!==i?D(L):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(L)):D(L)}function D(L){return n(L)}function E(L){return t.enter("tableRow"),R(L)}function R(L){return L===124?(t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),R):L===null||Ze(L)?(t.exit("tableRow"),e(L)):qt(L)?zt(t,R,"whitespace")(L):(t.enter("data"),Q(L))}function Q(L){return L===null||L===124||Rn(L)?(t.exit("data"),R(L)):(t.consume(L),L===92?F:Q)}function F(L){return L===92||L===124?(t.consume(L),Q):Q(L)}}function soe(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],l=[0,0,0,0],c=!1,d=0,h,m,p;const x=new Jle;for(;++nn[2]+1){const b=n[2]+1,k=n[3]-n[2]-1;t.add(b,k,[])}}t.add(n[3]+1,0,[["exit",p,e]])}return s!==void 0&&(i.end=Object.assign({},Lu(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function eN(t,e,n,r,s){const i=[],l=Lu(e.events,n);s&&(s.end=Object.assign({},l),i.push(["exit",s,e])),r.end=Object.assign({},l),i.push(["exit",r,e]),t.add(n+1,0,i)}function Lu(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const ioe={name:"tasklistCheck",tokenize:loe};function aoe(){return{text:{91:ioe}}}function loe(t,e,n){const r=this;return s;function s(d){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(d):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),i)}function i(d){return Rn(d)?(t.enter("taskListCheckValueUnchecked"),t.consume(d),t.exit("taskListCheckValueUnchecked"),l):d===88||d===120?(t.enter("taskListCheckValueChecked"),t.consume(d),t.exit("taskListCheckValueChecked"),l):n(d)}function l(d){return d===93?(t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),c):n(d)}function c(d){return Ze(d)?e(d):qt(d)?t.check({tokenize:ooe},e,n)(d):n(d)}}function ooe(t,e,n){return zt(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function coe(t){return mD([Rle(),Hle(),Zle(t),noe(),aoe()])}const uoe={};function doe(t){const e=this,n=t||uoe,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(coe(n)),i.push(Mle()),l.push(Ele(n))}function hoe(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:c,mathText:l,mathTextData:c}};function t(d){const h={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[h]}},d)}function e(){this.buffer()}function n(){const d=this.resume(),h=this.stack[this.stack.length-1];h.type,h.meta=d}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(d){const h=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),m=this.stack[this.stack.length-1];m.type,this.exit(d),m.value=h;const p=m.data.hChildren[0];p.type,p.tagName,p.children.push({type:"text",value:h}),this.data.mathFlowInside=void 0}function i(d){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},d),this.buffer()}function l(d){const h=this.resume(),m=this.stack[this.stack.length-1];m.type,this.exit(d),m.value=h,m.data.hChildren.push({type:"text",value:h})}function c(d){this.config.enter.data.call(this,d),this.config.exit.data.call(this,d)}}function foe(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` +`,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(i,l,c,d){const h=i.value||"",m=c.createTracker(d),p="$".repeat(Math.max(ID(h,"$")+1,2)),x=c.enter("mathFlow");let v=m.move(p);if(i.meta){const b=c.enter("mathFlowMeta");v+=m.move(c.safe(i.meta,{after:` +`,before:v,encode:["$"],...m.current()})),b()}return v+=m.move(` +`),h&&(v+=m.move(h+` +`)),v+=m.move(p),x(),v}function r(i,l,c){let d=i.value||"",h=1;for(e||h++;new RegExp("(^|[^$])"+"\\$".repeat(h)+"([^$]|$)").test(d);)h++;const m="$".repeat(h);/[^ \r\n]/.test(d)&&(/^[ \r\n]/.test(d)&&/[ \r\n]$/.test(d)||/^\$|\$$/.test(d))&&(d=" "+d+" ");let p=-1;for(;++p15?h="…"+c.slice(s-15,s):h=c.slice(0,s);var m;i+15":">","<":"<",'"':""","'":"'"},joe=/[&><"']/g;function Noe(t){return String(t).replace(joe,e=>Ooe[e])}var iR=function t(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?t(e.body[0]):e:e.type==="font"?t(e.body):e},Coe=function(e){var n=iR(e);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},Toe=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},Aoe=function(e){var n=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},tn={deflt:woe,escape:Noe,hyphenate:koe,getBaseElem:iR,isCharacterBox:Coe,protocolFromUrl:Aoe},cg={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand ",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function Moe(t){if(t.default)return t.default;var e=t.type,n=Array.isArray(e)?e[0]:e;if(typeof n!="string")return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class C5{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var n in cg)if(cg.hasOwnProperty(n)){var r=cg[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:Moe(r)}}reportNonstrict(e,n,r){var s=this.strict;if(typeof s=="function"&&(s=s(e,n,r)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new De("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+e+"]"),r);s==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]"))}}useStrictBehavior(e,n,r){var s=this.strict;if(typeof s=="function")try{s=s(e,n,r)}catch{s="error"}return!s||s==="ignore"?!1:s===!0||s==="error"?!0:s==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var n=tn.protocolFromUrl(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class Yl{constructor(e,n,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=n,this.cramped=r}sup(){return la[Eoe[this.id]]}sub(){return la[_oe[this.id]]}fracNum(){return la[Doe[this.id]]}fracDen(){return la[Roe[this.id]]}cramp(){return la[zoe[this.id]]}text(){return la[Poe[this.id]]}isTight(){return this.size>=2}}var T5=0,Gg=1,ed=2,ul=3,If=4,Oi=5,yd=6,hs=7,la=[new Yl(T5,0,!1),new Yl(Gg,0,!0),new Yl(ed,1,!1),new Yl(ul,1,!0),new Yl(If,2,!1),new Yl(Oi,2,!0),new Yl(yd,3,!1),new Yl(hs,3,!0)],Eoe=[If,Oi,If,Oi,yd,hs,yd,hs],_oe=[Oi,Oi,Oi,Oi,hs,hs,hs,hs],Doe=[ed,ul,If,Oi,yd,hs,yd,hs],Roe=[ul,ul,Oi,Oi,hs,hs,hs,hs],zoe=[Gg,Gg,ul,ul,Oi,Oi,hs,hs],Poe=[T5,Gg,ed,ul,ed,ul,ed,ul],at={DISPLAY:la[T5],TEXT:la[ed],SCRIPT:la[If],SCRIPTSCRIPT:la[yd]},S4=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function Boe(t){for(var e=0;e=s[0]&&t<=s[1])return n.name}return null}var ug=[];S4.forEach(t=>t.blocks.forEach(e=>ug.push(...e)));function aR(t){for(var e=0;e=ug[e]&&t<=ug[e+1])return!0;return!1}var Tu=80,Loe=function(e,n){return"M95,"+(622+e+n)+` +c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 +c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 +c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 +s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429 +c69,-144,104.5,-217.7,106.5,-221 +l`+e/2.075+" -"+e+` +c5.3,-9.3,12,-14,20,-14 +H400000v`+(40+e)+`H845.2724 +s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 +c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z +M`+(834+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},Ioe=function(e,n){return"M263,"+(601+e+n)+`c0.7,0,18,39.7,52,119 +c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 +c340,-704.7,510.7,-1060.3,512,-1067 +l`+e/2.084+" -"+e+` +c4.7,-7.3,11,-11,19,-11 +H40000v`+(40+e)+`H1012.3 +s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232 +c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 +s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 +c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z +M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},qoe=function(e,n){return"M983 "+(10+e+n)+` +l`+e/3.13+" -"+e+` +c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+` +H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 +s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744 +c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 +c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 +c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 +c53.7,-170.3,84.5,-266.8,92.5,-289.5z +M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},Foe=function(e,n){return"M424,"+(2398+e+n)+` +c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 +c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 +s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 +s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081 +l`+e/4.223+" -"+e+`c4,-6.7,10,-10,18,-10 H400000 +v`+(40+e)+`H1014.6 +s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 +c-2,6,-10,9,-24,9 +c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+" "+n+` +h400000v`+(40+e)+"h-400000z"},Qoe=function(e,n){return"M473,"+(2713+e+n)+` +c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+" -"+e+` +c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7 +s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 +c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 +c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 +s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, +606zM`+(1001+e)+" "+n+"h400000v"+(40+e)+"H1017.7z"},$oe=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},Hoe=function(e,n,r){var s=r-54-n-e;return"M702 "+(e+n)+"H400000"+(40+e)+` +H742v`+s+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 +h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 +c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 +219 661 l218 661zM702 `+n+"H400000v"+(40+e)+"H742z"},Uoe=function(e,n,r){n=1e3*n;var s="";switch(e){case"sqrtMain":s=Loe(n,Tu);break;case"sqrtSize1":s=Ioe(n,Tu);break;case"sqrtSize2":s=qoe(n,Tu);break;case"sqrtSize3":s=Foe(n,Tu);break;case"sqrtSize4":s=Qoe(n,Tu);break;case"sqrtTall":s=Hoe(n,Tu,r)}return s},Voe=function(e,n){switch(e){case"⎜":return"M291 0 H417 V"+n+" H291z M291 0 H417 V"+n+" H291z";case"∣":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z";case"∥":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z"+("M367 0 H410 V"+n+" H367z M367 0 H410 V"+n+" H367z");case"⎟":return"M457 0 H583 V"+n+" H457z M457 0 H583 V"+n+" H457z";case"⎢":return"M319 0 H403 V"+n+" H319z M319 0 H403 V"+n+" H319z";case"⎥":return"M263 0 H347 V"+n+" H263z M263 0 H347 V"+n+" H263z";case"⎪":return"M384 0 H504 V"+n+" H384z M384 0 H504 V"+n+" H384z";case"⏐":return"M312 0 H355 V"+n+" H312z M312 0 H355 V"+n+" H312z";case"‖":return"M257 0 H300 V"+n+" H257z M257 0 H300 V"+n+" H257z"+("M478 0 H521 V"+n+" H478z M478 0 H521 V"+n+" H478z");default:return""}},nN={doubleleftarrow:`M262 157 +l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3 + 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28 + 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5 +c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5 + 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87 +-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7 +-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z +m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l +-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5 + 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88 +-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68 +-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18 +-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782 +c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3 +-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120 + 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8 +-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247 +c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208 + 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3 + 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202 + l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117 +-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7 + 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13 + 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688 + 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7 +-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80 +H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0 + 435 0h399565z`,leftgroupunder:`M400000 262 +H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219 + 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3 +-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5 +-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7 +-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5 + 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3 +-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7 +-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z +m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333 + 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5 + 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667 +-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12 + 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7 +-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0 +v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5 +-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3 +-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21 + 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z +M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z +M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23 +-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8 +c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3 + 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z +M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334 +c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14 +-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7 + 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11 + 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214 +c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14 + 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3 + 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0 +-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6 +-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z +m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8 +60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8 +-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z +m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2 +c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6 +-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z +m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0 +85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8 +-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z +m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1 +c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128 +-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 + 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 + 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85 +-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 +-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 + 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l +-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5 +s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1 +c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3 + 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237 +-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0 + 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18 + 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3 +-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2 +-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 + 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11 +-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7 + 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z +m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8 + 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5 +-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95 +-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8 + 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 + 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3 +-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z +m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3 + 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0 +-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21 + 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z +M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23 + 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32 +-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142 +-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40 + 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69 +-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3 +-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19 +-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101 + 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167 +c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3 + 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42 + 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333 +-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70 + 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7 +-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0 + 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0 + 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128 +-68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418 +-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9 + 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114 +c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751 + 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457 +-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0 + 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697 + 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696 + -338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345 +-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409 + 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9 + 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409 + -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5 +3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11 +10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63 +-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1 +-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59 +H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359 +c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22 +c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1, +-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202 +c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5 +c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130 +s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47 +121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6 +s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11 +c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z +M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32 +-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0 +13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39 +-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5 +-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 +-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 +151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 +c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17 +c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21 +c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40 +c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z +M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0 +c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, +-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 +c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z +M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 +c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9, +1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7, +-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z +M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0 +c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, +-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 +c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z +M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},Woe=function(e,n){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v1759 h347 v-84 +H403z M403 1759 V0 H319 V1759 v`+n+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v1759 H0 v84 H347z +M347 1759 V0 H263 V1759 v`+n+" v1759 h84z";case"vert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+" v585 h43z";case"doublevert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+` v585 h43z +M367 15 v585 v`+n+` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+n+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+n+` v1715 h263 v84 H319z +MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+n+` v1799 H0 v-84 H319z +MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v602 h84z +M403 1759 V0 H319 V1759 v`+n+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v602 h84z +M347 1759 V0 h-84 V1759 v`+n+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1 +c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349, +-36,557 l0,`+(n+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210, +949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9 +c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5, +-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189 +l0,-`+(n+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3, +-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3, +63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5 +c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(n+9)+` +c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664 +c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11 +c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 +c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 +l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, +-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class w0{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),n=0;nn.toText();return this.children.map(e).join("")}}var pa={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Tp={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},rN={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function Goe(t,e){pa[t]=e}function A5(t,e,n){if(!pa[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),s=pa[e][r];if(!s&&t[0]in rN&&(r=rN[t[0]].charCodeAt(0),s=pa[e][r]),!s&&n==="text"&&aR(r)&&(s=pa[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var Ab={};function Xoe(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!Ab[e]){var n=Ab[e]={cssEmPerMu:Tp.quad[e]/18};for(var r in Tp)Tp.hasOwnProperty(r)&&(n[r]=Tp[r][e])}return Ab[e]}var Yoe=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],sN=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],iN=function(e,n){return n.size<2?e:Yoe[e-1][n.size-1]};class sl{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||sl.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=sN[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return new sl(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:iN(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:sN[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=iN(sl.BASESIZE,e);return this.size===n&&this.textSize===sl.BASESIZE&&this.style===e?this:this.extend({style:e,size:n})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==sl.BASESIZE?["sizing","reset-size"+this.size,"size"+sl.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Xoe(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}sl.BASESIZE=6;var k4={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},Koe={ex:!0,em:!0,mu:!0},lR=function(e){return typeof e!="string"&&(e=e.unit),e in k4||e in Koe||e==="ex"},Kn=function(e,n){var r;if(e.unit in k4)r=k4[e.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(e.unit==="mu")r=n.fontMetrics().cssEmPerMu;else{var s;if(n.style.isTight()?s=n.havingStyle(n.style.text()):s=n,e.unit==="ex")r=s.fontMetrics().xHeight;else if(e.unit==="em")r=s.fontMetrics().quad;else throw new De("Invalid unit: '"+e.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},Le=function(e){return+e.toFixed(4)+"em"},yo=function(e){return e.filter(n=>n).join(" ")},oR=function(e,n,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},n){n.style.isTight()&&this.classes.push("mtight");var s=n.getColor();s&&(this.style.color=s)}},cR=function(e){var n=document.createElement(e);n.className=yo(this.classes);for(var r in this.style)this.style.hasOwnProperty(r)&&(n.style[r]=this.style[r]);for(var s in this.attributes)this.attributes.hasOwnProperty(s)&&n.setAttribute(s,this.attributes[s]);for(var i=0;i/=\x00-\x1f]/,uR=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+tn.escape(yo(this.classes))+'"');var r="";for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=tn.hyphenate(s)+":"+this.style[s]+";");r&&(n+=' style="'+tn.escape(r)+'"');for(var i in this.attributes)if(this.attributes.hasOwnProperty(i)){if(Zoe.test(i))throw new De("Invalid attribute name '"+i+"'");n+=" "+i+'="'+tn.escape(this.attributes[i])+'"'}n+=">";for(var l=0;l",n};class S0{constructor(e,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,oR.call(this,e,r,s),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return cR.call(this,"span")}toMarkup(){return uR.call(this,"span")}}class M5{constructor(e,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,oR.call(this,n,s),this.children=r||[],this.setAttribute("href",e)}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return cR.call(this,"a")}toMarkup(){return uR.call(this,"a")}}class Joe{constructor(e,n,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=e,this.classes=["mord"],this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var n in this.style)this.style.hasOwnProperty(n)&&(e.style[n]=this.style[n]);return e}toMarkup(){var e=''+tn.escape(this.alt)+'0&&(n=document.createElement("span"),n.style.marginRight=Le(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=yo(this.classes));for(var r in this.style)this.style.hasOwnProperty(r)&&(n=n||document.createElement("span"),n.style[r]=this.style[r]);return n?(n.appendChild(e),n):e}toMarkup(){var e=!1,n="0&&(r+="margin-right:"+this.italic+"em;");for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=tn.hyphenate(s)+":"+this.style[s]+";");r&&(e=!0,n+=' style="'+tn.escape(r)+'"');var i=tn.escape(this.text);return e?(n+=">",n+=i,n+="",n):i}}class xl{constructor(e,n){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=n||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);for(var s=0;s':''}}class O4{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"line");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var e=" but got "+String(t)+".")}var nce={bin:1,close:1,inner:1,open:1,punct:1,rel:1},rce={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Ln={math:{},text:{}};function N(t,e,n,r,s,i){Ln[t][s]={font:e,group:n,replace:r},i&&r&&(Ln[t][r]=Ln[t][s])}var C="math",Ee="text",B="main",G="ams",Wn="accent-token",Ve="bin",xs="close",Rd="inner",st="mathord",yr="op-token",li="open",$x="punct",X="rel",Sl="spacing",le="textord";N(C,B,X,"≡","\\equiv",!0);N(C,B,X,"≺","\\prec",!0);N(C,B,X,"≻","\\succ",!0);N(C,B,X,"∼","\\sim",!0);N(C,B,X,"⊥","\\perp");N(C,B,X,"⪯","\\preceq",!0);N(C,B,X,"⪰","\\succeq",!0);N(C,B,X,"≃","\\simeq",!0);N(C,B,X,"∣","\\mid",!0);N(C,B,X,"≪","\\ll",!0);N(C,B,X,"≫","\\gg",!0);N(C,B,X,"≍","\\asymp",!0);N(C,B,X,"∥","\\parallel");N(C,B,X,"⋈","\\bowtie",!0);N(C,B,X,"⌣","\\smile",!0);N(C,B,X,"⊑","\\sqsubseteq",!0);N(C,B,X,"⊒","\\sqsupseteq",!0);N(C,B,X,"≐","\\doteq",!0);N(C,B,X,"⌢","\\frown",!0);N(C,B,X,"∋","\\ni",!0);N(C,B,X,"∝","\\propto",!0);N(C,B,X,"⊢","\\vdash",!0);N(C,B,X,"⊣","\\dashv",!0);N(C,B,X,"∋","\\owns");N(C,B,$x,".","\\ldotp");N(C,B,$x,"⋅","\\cdotp");N(C,B,le,"#","\\#");N(Ee,B,le,"#","\\#");N(C,B,le,"&","\\&");N(Ee,B,le,"&","\\&");N(C,B,le,"ℵ","\\aleph",!0);N(C,B,le,"∀","\\forall",!0);N(C,B,le,"ℏ","\\hbar",!0);N(C,B,le,"∃","\\exists",!0);N(C,B,le,"∇","\\nabla",!0);N(C,B,le,"♭","\\flat",!0);N(C,B,le,"ℓ","\\ell",!0);N(C,B,le,"♮","\\natural",!0);N(C,B,le,"♣","\\clubsuit",!0);N(C,B,le,"℘","\\wp",!0);N(C,B,le,"♯","\\sharp",!0);N(C,B,le,"♢","\\diamondsuit",!0);N(C,B,le,"ℜ","\\Re",!0);N(C,B,le,"♡","\\heartsuit",!0);N(C,B,le,"ℑ","\\Im",!0);N(C,B,le,"♠","\\spadesuit",!0);N(C,B,le,"§","\\S",!0);N(Ee,B,le,"§","\\S");N(C,B,le,"¶","\\P",!0);N(Ee,B,le,"¶","\\P");N(C,B,le,"†","\\dag");N(Ee,B,le,"†","\\dag");N(Ee,B,le,"†","\\textdagger");N(C,B,le,"‡","\\ddag");N(Ee,B,le,"‡","\\ddag");N(Ee,B,le,"‡","\\textdaggerdbl");N(C,B,xs,"⎱","\\rmoustache",!0);N(C,B,li,"⎰","\\lmoustache",!0);N(C,B,xs,"⟯","\\rgroup",!0);N(C,B,li,"⟮","\\lgroup",!0);N(C,B,Ve,"∓","\\mp",!0);N(C,B,Ve,"⊖","\\ominus",!0);N(C,B,Ve,"⊎","\\uplus",!0);N(C,B,Ve,"⊓","\\sqcap",!0);N(C,B,Ve,"∗","\\ast");N(C,B,Ve,"⊔","\\sqcup",!0);N(C,B,Ve,"◯","\\bigcirc",!0);N(C,B,Ve,"∙","\\bullet",!0);N(C,B,Ve,"‡","\\ddagger");N(C,B,Ve,"≀","\\wr",!0);N(C,B,Ve,"⨿","\\amalg");N(C,B,Ve,"&","\\And");N(C,B,X,"⟵","\\longleftarrow",!0);N(C,B,X,"⇐","\\Leftarrow",!0);N(C,B,X,"⟸","\\Longleftarrow",!0);N(C,B,X,"⟶","\\longrightarrow",!0);N(C,B,X,"⇒","\\Rightarrow",!0);N(C,B,X,"⟹","\\Longrightarrow",!0);N(C,B,X,"↔","\\leftrightarrow",!0);N(C,B,X,"⟷","\\longleftrightarrow",!0);N(C,B,X,"⇔","\\Leftrightarrow",!0);N(C,B,X,"⟺","\\Longleftrightarrow",!0);N(C,B,X,"↦","\\mapsto",!0);N(C,B,X,"⟼","\\longmapsto",!0);N(C,B,X,"↗","\\nearrow",!0);N(C,B,X,"↩","\\hookleftarrow",!0);N(C,B,X,"↪","\\hookrightarrow",!0);N(C,B,X,"↘","\\searrow",!0);N(C,B,X,"↼","\\leftharpoonup",!0);N(C,B,X,"⇀","\\rightharpoonup",!0);N(C,B,X,"↙","\\swarrow",!0);N(C,B,X,"↽","\\leftharpoondown",!0);N(C,B,X,"⇁","\\rightharpoondown",!0);N(C,B,X,"↖","\\nwarrow",!0);N(C,B,X,"⇌","\\rightleftharpoons",!0);N(C,G,X,"≮","\\nless",!0);N(C,G,X,"","\\@nleqslant");N(C,G,X,"","\\@nleqq");N(C,G,X,"⪇","\\lneq",!0);N(C,G,X,"≨","\\lneqq",!0);N(C,G,X,"","\\@lvertneqq");N(C,G,X,"⋦","\\lnsim",!0);N(C,G,X,"⪉","\\lnapprox",!0);N(C,G,X,"⊀","\\nprec",!0);N(C,G,X,"⋠","\\npreceq",!0);N(C,G,X,"⋨","\\precnsim",!0);N(C,G,X,"⪹","\\precnapprox",!0);N(C,G,X,"≁","\\nsim",!0);N(C,G,X,"","\\@nshortmid");N(C,G,X,"∤","\\nmid",!0);N(C,G,X,"⊬","\\nvdash",!0);N(C,G,X,"⊭","\\nvDash",!0);N(C,G,X,"⋪","\\ntriangleleft");N(C,G,X,"⋬","\\ntrianglelefteq",!0);N(C,G,X,"⊊","\\subsetneq",!0);N(C,G,X,"","\\@varsubsetneq");N(C,G,X,"⫋","\\subsetneqq",!0);N(C,G,X,"","\\@varsubsetneqq");N(C,G,X,"≯","\\ngtr",!0);N(C,G,X,"","\\@ngeqslant");N(C,G,X,"","\\@ngeqq");N(C,G,X,"⪈","\\gneq",!0);N(C,G,X,"≩","\\gneqq",!0);N(C,G,X,"","\\@gvertneqq");N(C,G,X,"⋧","\\gnsim",!0);N(C,G,X,"⪊","\\gnapprox",!0);N(C,G,X,"⊁","\\nsucc",!0);N(C,G,X,"⋡","\\nsucceq",!0);N(C,G,X,"⋩","\\succnsim",!0);N(C,G,X,"⪺","\\succnapprox",!0);N(C,G,X,"≆","\\ncong",!0);N(C,G,X,"","\\@nshortparallel");N(C,G,X,"∦","\\nparallel",!0);N(C,G,X,"⊯","\\nVDash",!0);N(C,G,X,"⋫","\\ntriangleright");N(C,G,X,"⋭","\\ntrianglerighteq",!0);N(C,G,X,"","\\@nsupseteqq");N(C,G,X,"⊋","\\supsetneq",!0);N(C,G,X,"","\\@varsupsetneq");N(C,G,X,"⫌","\\supsetneqq",!0);N(C,G,X,"","\\@varsupsetneqq");N(C,G,X,"⊮","\\nVdash",!0);N(C,G,X,"⪵","\\precneqq",!0);N(C,G,X,"⪶","\\succneqq",!0);N(C,G,X,"","\\@nsubseteqq");N(C,G,Ve,"⊴","\\unlhd");N(C,G,Ve,"⊵","\\unrhd");N(C,G,X,"↚","\\nleftarrow",!0);N(C,G,X,"↛","\\nrightarrow",!0);N(C,G,X,"⇍","\\nLeftarrow",!0);N(C,G,X,"⇏","\\nRightarrow",!0);N(C,G,X,"↮","\\nleftrightarrow",!0);N(C,G,X,"⇎","\\nLeftrightarrow",!0);N(C,G,X,"△","\\vartriangle");N(C,G,le,"ℏ","\\hslash");N(C,G,le,"▽","\\triangledown");N(C,G,le,"◊","\\lozenge");N(C,G,le,"Ⓢ","\\circledS");N(C,G,le,"®","\\circledR");N(Ee,G,le,"®","\\circledR");N(C,G,le,"∡","\\measuredangle",!0);N(C,G,le,"∄","\\nexists");N(C,G,le,"℧","\\mho");N(C,G,le,"Ⅎ","\\Finv",!0);N(C,G,le,"⅁","\\Game",!0);N(C,G,le,"‵","\\backprime");N(C,G,le,"▲","\\blacktriangle");N(C,G,le,"▼","\\blacktriangledown");N(C,G,le,"■","\\blacksquare");N(C,G,le,"⧫","\\blacklozenge");N(C,G,le,"★","\\bigstar");N(C,G,le,"∢","\\sphericalangle",!0);N(C,G,le,"∁","\\complement",!0);N(C,G,le,"ð","\\eth",!0);N(Ee,B,le,"ð","ð");N(C,G,le,"╱","\\diagup");N(C,G,le,"╲","\\diagdown");N(C,G,le,"□","\\square");N(C,G,le,"□","\\Box");N(C,G,le,"◊","\\Diamond");N(C,G,le,"¥","\\yen",!0);N(Ee,G,le,"¥","\\yen",!0);N(C,G,le,"✓","\\checkmark",!0);N(Ee,G,le,"✓","\\checkmark");N(C,G,le,"ℶ","\\beth",!0);N(C,G,le,"ℸ","\\daleth",!0);N(C,G,le,"ℷ","\\gimel",!0);N(C,G,le,"ϝ","\\digamma",!0);N(C,G,le,"ϰ","\\varkappa");N(C,G,li,"┌","\\@ulcorner",!0);N(C,G,xs,"┐","\\@urcorner",!0);N(C,G,li,"└","\\@llcorner",!0);N(C,G,xs,"┘","\\@lrcorner",!0);N(C,G,X,"≦","\\leqq",!0);N(C,G,X,"⩽","\\leqslant",!0);N(C,G,X,"⪕","\\eqslantless",!0);N(C,G,X,"≲","\\lesssim",!0);N(C,G,X,"⪅","\\lessapprox",!0);N(C,G,X,"≊","\\approxeq",!0);N(C,G,Ve,"⋖","\\lessdot");N(C,G,X,"⋘","\\lll",!0);N(C,G,X,"≶","\\lessgtr",!0);N(C,G,X,"⋚","\\lesseqgtr",!0);N(C,G,X,"⪋","\\lesseqqgtr",!0);N(C,G,X,"≑","\\doteqdot");N(C,G,X,"≓","\\risingdotseq",!0);N(C,G,X,"≒","\\fallingdotseq",!0);N(C,G,X,"∽","\\backsim",!0);N(C,G,X,"⋍","\\backsimeq",!0);N(C,G,X,"⫅","\\subseteqq",!0);N(C,G,X,"⋐","\\Subset",!0);N(C,G,X,"⊏","\\sqsubset",!0);N(C,G,X,"≼","\\preccurlyeq",!0);N(C,G,X,"⋞","\\curlyeqprec",!0);N(C,G,X,"≾","\\precsim",!0);N(C,G,X,"⪷","\\precapprox",!0);N(C,G,X,"⊲","\\vartriangleleft");N(C,G,X,"⊴","\\trianglelefteq");N(C,G,X,"⊨","\\vDash",!0);N(C,G,X,"⊪","\\Vvdash",!0);N(C,G,X,"⌣","\\smallsmile");N(C,G,X,"⌢","\\smallfrown");N(C,G,X,"≏","\\bumpeq",!0);N(C,G,X,"≎","\\Bumpeq",!0);N(C,G,X,"≧","\\geqq",!0);N(C,G,X,"⩾","\\geqslant",!0);N(C,G,X,"⪖","\\eqslantgtr",!0);N(C,G,X,"≳","\\gtrsim",!0);N(C,G,X,"⪆","\\gtrapprox",!0);N(C,G,Ve,"⋗","\\gtrdot");N(C,G,X,"⋙","\\ggg",!0);N(C,G,X,"≷","\\gtrless",!0);N(C,G,X,"⋛","\\gtreqless",!0);N(C,G,X,"⪌","\\gtreqqless",!0);N(C,G,X,"≖","\\eqcirc",!0);N(C,G,X,"≗","\\circeq",!0);N(C,G,X,"≜","\\triangleq",!0);N(C,G,X,"∼","\\thicksim");N(C,G,X,"≈","\\thickapprox");N(C,G,X,"⫆","\\supseteqq",!0);N(C,G,X,"⋑","\\Supset",!0);N(C,G,X,"⊐","\\sqsupset",!0);N(C,G,X,"≽","\\succcurlyeq",!0);N(C,G,X,"⋟","\\curlyeqsucc",!0);N(C,G,X,"≿","\\succsim",!0);N(C,G,X,"⪸","\\succapprox",!0);N(C,G,X,"⊳","\\vartriangleright");N(C,G,X,"⊵","\\trianglerighteq");N(C,G,X,"⊩","\\Vdash",!0);N(C,G,X,"∣","\\shortmid");N(C,G,X,"∥","\\shortparallel");N(C,G,X,"≬","\\between",!0);N(C,G,X,"⋔","\\pitchfork",!0);N(C,G,X,"∝","\\varpropto");N(C,G,X,"◀","\\blacktriangleleft");N(C,G,X,"∴","\\therefore",!0);N(C,G,X,"∍","\\backepsilon");N(C,G,X,"▶","\\blacktriangleright");N(C,G,X,"∵","\\because",!0);N(C,G,X,"⋘","\\llless");N(C,G,X,"⋙","\\gggtr");N(C,G,Ve,"⊲","\\lhd");N(C,G,Ve,"⊳","\\rhd");N(C,G,X,"≂","\\eqsim",!0);N(C,B,X,"⋈","\\Join");N(C,G,X,"≑","\\Doteq",!0);N(C,G,Ve,"∔","\\dotplus",!0);N(C,G,Ve,"∖","\\smallsetminus");N(C,G,Ve,"⋒","\\Cap",!0);N(C,G,Ve,"⋓","\\Cup",!0);N(C,G,Ve,"⩞","\\doublebarwedge",!0);N(C,G,Ve,"⊟","\\boxminus",!0);N(C,G,Ve,"⊞","\\boxplus",!0);N(C,G,Ve,"⋇","\\divideontimes",!0);N(C,G,Ve,"⋉","\\ltimes",!0);N(C,G,Ve,"⋊","\\rtimes",!0);N(C,G,Ve,"⋋","\\leftthreetimes",!0);N(C,G,Ve,"⋌","\\rightthreetimes",!0);N(C,G,Ve,"⋏","\\curlywedge",!0);N(C,G,Ve,"⋎","\\curlyvee",!0);N(C,G,Ve,"⊝","\\circleddash",!0);N(C,G,Ve,"⊛","\\circledast",!0);N(C,G,Ve,"⋅","\\centerdot");N(C,G,Ve,"⊺","\\intercal",!0);N(C,G,Ve,"⋒","\\doublecap");N(C,G,Ve,"⋓","\\doublecup");N(C,G,Ve,"⊠","\\boxtimes",!0);N(C,G,X,"⇢","\\dashrightarrow",!0);N(C,G,X,"⇠","\\dashleftarrow",!0);N(C,G,X,"⇇","\\leftleftarrows",!0);N(C,G,X,"⇆","\\leftrightarrows",!0);N(C,G,X,"⇚","\\Lleftarrow",!0);N(C,G,X,"↞","\\twoheadleftarrow",!0);N(C,G,X,"↢","\\leftarrowtail",!0);N(C,G,X,"↫","\\looparrowleft",!0);N(C,G,X,"⇋","\\leftrightharpoons",!0);N(C,G,X,"↶","\\curvearrowleft",!0);N(C,G,X,"↺","\\circlearrowleft",!0);N(C,G,X,"↰","\\Lsh",!0);N(C,G,X,"⇈","\\upuparrows",!0);N(C,G,X,"↿","\\upharpoonleft",!0);N(C,G,X,"⇃","\\downharpoonleft",!0);N(C,B,X,"⊶","\\origof",!0);N(C,B,X,"⊷","\\imageof",!0);N(C,G,X,"⊸","\\multimap",!0);N(C,G,X,"↭","\\leftrightsquigarrow",!0);N(C,G,X,"⇉","\\rightrightarrows",!0);N(C,G,X,"⇄","\\rightleftarrows",!0);N(C,G,X,"↠","\\twoheadrightarrow",!0);N(C,G,X,"↣","\\rightarrowtail",!0);N(C,G,X,"↬","\\looparrowright",!0);N(C,G,X,"↷","\\curvearrowright",!0);N(C,G,X,"↻","\\circlearrowright",!0);N(C,G,X,"↱","\\Rsh",!0);N(C,G,X,"⇊","\\downdownarrows",!0);N(C,G,X,"↾","\\upharpoonright",!0);N(C,G,X,"⇂","\\downharpoonright",!0);N(C,G,X,"⇝","\\rightsquigarrow",!0);N(C,G,X,"⇝","\\leadsto");N(C,G,X,"⇛","\\Rrightarrow",!0);N(C,G,X,"↾","\\restriction");N(C,B,le,"‘","`");N(C,B,le,"$","\\$");N(Ee,B,le,"$","\\$");N(Ee,B,le,"$","\\textdollar");N(C,B,le,"%","\\%");N(Ee,B,le,"%","\\%");N(C,B,le,"_","\\_");N(Ee,B,le,"_","\\_");N(Ee,B,le,"_","\\textunderscore");N(C,B,le,"∠","\\angle",!0);N(C,B,le,"∞","\\infty",!0);N(C,B,le,"′","\\prime");N(C,B,le,"△","\\triangle");N(C,B,le,"Γ","\\Gamma",!0);N(C,B,le,"Δ","\\Delta",!0);N(C,B,le,"Θ","\\Theta",!0);N(C,B,le,"Λ","\\Lambda",!0);N(C,B,le,"Ξ","\\Xi",!0);N(C,B,le,"Π","\\Pi",!0);N(C,B,le,"Σ","\\Sigma",!0);N(C,B,le,"Υ","\\Upsilon",!0);N(C,B,le,"Φ","\\Phi",!0);N(C,B,le,"Ψ","\\Psi",!0);N(C,B,le,"Ω","\\Omega",!0);N(C,B,le,"A","Α");N(C,B,le,"B","Β");N(C,B,le,"E","Ε");N(C,B,le,"Z","Ζ");N(C,B,le,"H","Η");N(C,B,le,"I","Ι");N(C,B,le,"K","Κ");N(C,B,le,"M","Μ");N(C,B,le,"N","Ν");N(C,B,le,"O","Ο");N(C,B,le,"P","Ρ");N(C,B,le,"T","Τ");N(C,B,le,"X","Χ");N(C,B,le,"¬","\\neg",!0);N(C,B,le,"¬","\\lnot");N(C,B,le,"⊤","\\top");N(C,B,le,"⊥","\\bot");N(C,B,le,"∅","\\emptyset");N(C,G,le,"∅","\\varnothing");N(C,B,st,"α","\\alpha",!0);N(C,B,st,"β","\\beta",!0);N(C,B,st,"γ","\\gamma",!0);N(C,B,st,"δ","\\delta",!0);N(C,B,st,"ϵ","\\epsilon",!0);N(C,B,st,"ζ","\\zeta",!0);N(C,B,st,"η","\\eta",!0);N(C,B,st,"θ","\\theta",!0);N(C,B,st,"ι","\\iota",!0);N(C,B,st,"κ","\\kappa",!0);N(C,B,st,"λ","\\lambda",!0);N(C,B,st,"μ","\\mu",!0);N(C,B,st,"ν","\\nu",!0);N(C,B,st,"ξ","\\xi",!0);N(C,B,st,"ο","\\omicron",!0);N(C,B,st,"π","\\pi",!0);N(C,B,st,"ρ","\\rho",!0);N(C,B,st,"σ","\\sigma",!0);N(C,B,st,"τ","\\tau",!0);N(C,B,st,"υ","\\upsilon",!0);N(C,B,st,"ϕ","\\phi",!0);N(C,B,st,"χ","\\chi",!0);N(C,B,st,"ψ","\\psi",!0);N(C,B,st,"ω","\\omega",!0);N(C,B,st,"ε","\\varepsilon",!0);N(C,B,st,"ϑ","\\vartheta",!0);N(C,B,st,"ϖ","\\varpi",!0);N(C,B,st,"ϱ","\\varrho",!0);N(C,B,st,"ς","\\varsigma",!0);N(C,B,st,"φ","\\varphi",!0);N(C,B,Ve,"∗","*",!0);N(C,B,Ve,"+","+");N(C,B,Ve,"−","-",!0);N(C,B,Ve,"⋅","\\cdot",!0);N(C,B,Ve,"∘","\\circ",!0);N(C,B,Ve,"÷","\\div",!0);N(C,B,Ve,"±","\\pm",!0);N(C,B,Ve,"×","\\times",!0);N(C,B,Ve,"∩","\\cap",!0);N(C,B,Ve,"∪","\\cup",!0);N(C,B,Ve,"∖","\\setminus",!0);N(C,B,Ve,"∧","\\land");N(C,B,Ve,"∨","\\lor");N(C,B,Ve,"∧","\\wedge",!0);N(C,B,Ve,"∨","\\vee",!0);N(C,B,le,"√","\\surd");N(C,B,li,"⟨","\\langle",!0);N(C,B,li,"∣","\\lvert");N(C,B,li,"∥","\\lVert");N(C,B,xs,"?","?");N(C,B,xs,"!","!");N(C,B,xs,"⟩","\\rangle",!0);N(C,B,xs,"∣","\\rvert");N(C,B,xs,"∥","\\rVert");N(C,B,X,"=","=");N(C,B,X,":",":");N(C,B,X,"≈","\\approx",!0);N(C,B,X,"≅","\\cong",!0);N(C,B,X,"≥","\\ge");N(C,B,X,"≥","\\geq",!0);N(C,B,X,"←","\\gets");N(C,B,X,">","\\gt",!0);N(C,B,X,"∈","\\in",!0);N(C,B,X,"","\\@not");N(C,B,X,"⊂","\\subset",!0);N(C,B,X,"⊃","\\supset",!0);N(C,B,X,"⊆","\\subseteq",!0);N(C,B,X,"⊇","\\supseteq",!0);N(C,G,X,"⊈","\\nsubseteq",!0);N(C,G,X,"⊉","\\nsupseteq",!0);N(C,B,X,"⊨","\\models");N(C,B,X,"←","\\leftarrow",!0);N(C,B,X,"≤","\\le");N(C,B,X,"≤","\\leq",!0);N(C,B,X,"<","\\lt",!0);N(C,B,X,"→","\\rightarrow",!0);N(C,B,X,"→","\\to");N(C,G,X,"≱","\\ngeq",!0);N(C,G,X,"≰","\\nleq",!0);N(C,B,Sl," ","\\ ");N(C,B,Sl," ","\\space");N(C,B,Sl," ","\\nobreakspace");N(Ee,B,Sl," ","\\ ");N(Ee,B,Sl," "," ");N(Ee,B,Sl," ","\\space");N(Ee,B,Sl," ","\\nobreakspace");N(C,B,Sl,null,"\\nobreak");N(C,B,Sl,null,"\\allowbreak");N(C,B,$x,",",",");N(C,B,$x,";",";");N(C,G,Ve,"⊼","\\barwedge",!0);N(C,G,Ve,"⊻","\\veebar",!0);N(C,B,Ve,"⊙","\\odot",!0);N(C,B,Ve,"⊕","\\oplus",!0);N(C,B,Ve,"⊗","\\otimes",!0);N(C,B,le,"∂","\\partial",!0);N(C,B,Ve,"⊘","\\oslash",!0);N(C,G,Ve,"⊚","\\circledcirc",!0);N(C,G,Ve,"⊡","\\boxdot",!0);N(C,B,Ve,"△","\\bigtriangleup");N(C,B,Ve,"▽","\\bigtriangledown");N(C,B,Ve,"†","\\dagger");N(C,B,Ve,"⋄","\\diamond");N(C,B,Ve,"⋆","\\star");N(C,B,Ve,"◃","\\triangleleft");N(C,B,Ve,"▹","\\triangleright");N(C,B,li,"{","\\{");N(Ee,B,le,"{","\\{");N(Ee,B,le,"{","\\textbraceleft");N(C,B,xs,"}","\\}");N(Ee,B,le,"}","\\}");N(Ee,B,le,"}","\\textbraceright");N(C,B,li,"{","\\lbrace");N(C,B,xs,"}","\\rbrace");N(C,B,li,"[","\\lbrack",!0);N(Ee,B,le,"[","\\lbrack",!0);N(C,B,xs,"]","\\rbrack",!0);N(Ee,B,le,"]","\\rbrack",!0);N(C,B,li,"(","\\lparen",!0);N(C,B,xs,")","\\rparen",!0);N(Ee,B,le,"<","\\textless",!0);N(Ee,B,le,">","\\textgreater",!0);N(C,B,li,"⌊","\\lfloor",!0);N(C,B,xs,"⌋","\\rfloor",!0);N(C,B,li,"⌈","\\lceil",!0);N(C,B,xs,"⌉","\\rceil",!0);N(C,B,le,"\\","\\backslash");N(C,B,le,"∣","|");N(C,B,le,"∣","\\vert");N(Ee,B,le,"|","\\textbar",!0);N(C,B,le,"∥","\\|");N(C,B,le,"∥","\\Vert");N(Ee,B,le,"∥","\\textbardbl");N(Ee,B,le,"~","\\textasciitilde");N(Ee,B,le,"\\","\\textbackslash");N(Ee,B,le,"^","\\textasciicircum");N(C,B,X,"↑","\\uparrow",!0);N(C,B,X,"⇑","\\Uparrow",!0);N(C,B,X,"↓","\\downarrow",!0);N(C,B,X,"⇓","\\Downarrow",!0);N(C,B,X,"↕","\\updownarrow",!0);N(C,B,X,"⇕","\\Updownarrow",!0);N(C,B,yr,"∐","\\coprod");N(C,B,yr,"⋁","\\bigvee");N(C,B,yr,"⋀","\\bigwedge");N(C,B,yr,"⨄","\\biguplus");N(C,B,yr,"⋂","\\bigcap");N(C,B,yr,"⋃","\\bigcup");N(C,B,yr,"∫","\\int");N(C,B,yr,"∫","\\intop");N(C,B,yr,"∬","\\iint");N(C,B,yr,"∭","\\iiint");N(C,B,yr,"∏","\\prod");N(C,B,yr,"∑","\\sum");N(C,B,yr,"⨂","\\bigotimes");N(C,B,yr,"⨁","\\bigoplus");N(C,B,yr,"⨀","\\bigodot");N(C,B,yr,"∮","\\oint");N(C,B,yr,"∯","\\oiint");N(C,B,yr,"∰","\\oiiint");N(C,B,yr,"⨆","\\bigsqcup");N(C,B,yr,"∫","\\smallint");N(Ee,B,Rd,"…","\\textellipsis");N(C,B,Rd,"…","\\mathellipsis");N(Ee,B,Rd,"…","\\ldots",!0);N(C,B,Rd,"…","\\ldots",!0);N(C,B,Rd,"⋯","\\@cdots",!0);N(C,B,Rd,"⋱","\\ddots",!0);N(C,B,le,"⋮","\\varvdots");N(Ee,B,le,"⋮","\\varvdots");N(C,B,Wn,"ˊ","\\acute");N(C,B,Wn,"ˋ","\\grave");N(C,B,Wn,"¨","\\ddot");N(C,B,Wn,"~","\\tilde");N(C,B,Wn,"ˉ","\\bar");N(C,B,Wn,"˘","\\breve");N(C,B,Wn,"ˇ","\\check");N(C,B,Wn,"^","\\hat");N(C,B,Wn,"⃗","\\vec");N(C,B,Wn,"˙","\\dot");N(C,B,Wn,"˚","\\mathring");N(C,B,st,"","\\@imath");N(C,B,st,"","\\@jmath");N(C,B,le,"ı","ı");N(C,B,le,"ȷ","ȷ");N(Ee,B,le,"ı","\\i",!0);N(Ee,B,le,"ȷ","\\j",!0);N(Ee,B,le,"ß","\\ss",!0);N(Ee,B,le,"æ","\\ae",!0);N(Ee,B,le,"œ","\\oe",!0);N(Ee,B,le,"ø","\\o",!0);N(Ee,B,le,"Æ","\\AE",!0);N(Ee,B,le,"Œ","\\OE",!0);N(Ee,B,le,"Ø","\\O",!0);N(Ee,B,Wn,"ˊ","\\'");N(Ee,B,Wn,"ˋ","\\`");N(Ee,B,Wn,"ˆ","\\^");N(Ee,B,Wn,"˜","\\~");N(Ee,B,Wn,"ˉ","\\=");N(Ee,B,Wn,"˘","\\u");N(Ee,B,Wn,"˙","\\.");N(Ee,B,Wn,"¸","\\c");N(Ee,B,Wn,"˚","\\r");N(Ee,B,Wn,"ˇ","\\v");N(Ee,B,Wn,"¨",'\\"');N(Ee,B,Wn,"˝","\\H");N(Ee,B,Wn,"◯","\\textcircled");var dR={"--":!0,"---":!0,"``":!0,"''":!0};N(Ee,B,le,"–","--",!0);N(Ee,B,le,"–","\\textendash");N(Ee,B,le,"—","---",!0);N(Ee,B,le,"—","\\textemdash");N(Ee,B,le,"‘","`",!0);N(Ee,B,le,"‘","\\textquoteleft");N(Ee,B,le,"’","'",!0);N(Ee,B,le,"’","\\textquoteright");N(Ee,B,le,"“","``",!0);N(Ee,B,le,"“","\\textquotedblleft");N(Ee,B,le,"”","''",!0);N(Ee,B,le,"”","\\textquotedblright");N(C,B,le,"°","\\degree",!0);N(Ee,B,le,"°","\\degree");N(Ee,B,le,"°","\\textdegree",!0);N(C,B,le,"£","\\pounds");N(C,B,le,"£","\\mathsterling",!0);N(Ee,B,le,"£","\\pounds");N(Ee,B,le,"£","\\textsterling",!0);N(C,G,le,"✠","\\maltese");N(Ee,G,le,"✠","\\maltese");var lN='0123456789/@."';for(var Mb=0;Mb0)return Li(i,h,s,n,l.concat(m));if(d){var p,x;if(d==="boldsymbol"){var v=ace(i,s,n,l,r);p=v.fontName,x=[v.fontClass]}else c?(p=mR[d].fontName,x=[d]):(p=_p(d,n.fontWeight,n.fontShape),x=[d,n.fontWeight,n.fontShape]);if(Hx(i,p,s).metrics)return Li(i,p,s,n,l.concat(x));if(dR.hasOwnProperty(i)&&p.slice(0,10)==="Typewriter"){for(var b=[],k=0;k{if(yo(t.classes)!==yo(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize)return!1;if(t.classes.length===1){var n=t.classes[0];if(n==="mbin"||n==="mord")return!1}for(var r in t.style)if(t.style.hasOwnProperty(r)&&t.style[r]!==e.style[r])return!1;for(var s in e.style)if(e.style.hasOwnProperty(s)&&t.style[s]!==e.style[s])return!1;return!0},cce=t=>{for(var e=0;en&&(n=l.height),l.depth>r&&(r=l.depth),l.maxFontSize>s&&(s=l.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=s},Cs=function(e,n,r,s){var i=new S0(e,n,r,s);return E5(i),i},hR=(t,e,n,r)=>new S0(t,e,n,r),uce=function(e,n,r){var s=Cs([e],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Le(s.height),s.maxFontSize=1,s},dce=function(e,n,r,s){var i=new M5(e,n,r,s);return E5(i),i},fR=function(e){var n=new w0(e);return E5(n),n},hce=function(e,n){return e instanceof w0?Cs([],[e],n):e},fce=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,l=1;l{var n=Cs(["mspace"],[],e),r=Kn(t,e);return n.style.marginRight=Le(r),n},_p=function(e,n,r){var s="";switch(e){case"amsrm":s="AMS";break;case"textrm":s="Main";break;case"textsf":s="SansSerif";break;case"texttt":s="Typewriter";break;default:s=e}var i;return n==="textbf"&&r==="textit"?i="BoldItalic":n==="textbf"?i="Bold":n==="textit"?i="Italic":i="Regular",s+"-"+i},mR={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},pR={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},gce=function(e,n){var[r,s,i]=pR[e],l=new bo(r),c=new xl([l],{width:Le(s),height:Le(i),style:"width:"+Le(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),d=hR(["overlay"],[c],n);return d.height=i,d.style.height=Le(i),d.style.width=Le(s),d},pe={fontMap:mR,makeSymbol:Li,mathsym:ice,makeSpan:Cs,makeSvgSpan:hR,makeLineSpan:uce,makeAnchor:dce,makeFragment:fR,wrapFragment:hce,makeVList:mce,makeOrd:lce,makeGlue:pce,staticSvg:gce,svgData:pR,tryCombineChars:cce},Xn={number:3,unit:"mu"},tc={number:4,unit:"mu"},Ka={number:5,unit:"mu"},xce={mord:{mop:Xn,mbin:tc,mrel:Ka,minner:Xn},mop:{mord:Xn,mop:Xn,mrel:Ka,minner:Xn},mbin:{mord:tc,mop:tc,mopen:tc,minner:tc},mrel:{mord:Ka,mop:Ka,mopen:Ka,minner:Ka},mopen:{},mclose:{mop:Xn,mbin:tc,mrel:Ka,minner:Xn},mpunct:{mord:Xn,mop:Xn,mrel:Ka,mopen:Xn,mclose:Xn,mpunct:Xn,minner:Xn},minner:{mord:Xn,mop:Xn,mbin:tc,mrel:Ka,mopen:Xn,mpunct:Xn,minner:Xn}},vce={mord:{mop:Xn},mop:{mord:Xn,mop:Xn},mbin:{},mrel:{},mopen:{},mclose:{mop:Xn},mpunct:{},minner:{mop:Xn}},gR={},Yg={},Kg={};function Qe(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:l}=t,c={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:s},d=0;d{var O=k.classes[0],j=b.classes[0];O==="mbin"&&bce.includes(j)?k.classes[0]="mord":j==="mbin"&&yce.includes(O)&&(b.classes[0]="mord")},{node:p},x,v),hN(i,(b,k)=>{var O=N4(k),j=N4(b),T=O&&j?b.hasClass("mtight")?vce[O][j]:xce[O][j]:null;if(T)return pe.makeGlue(T,h)},{node:p},x,v),i},hN=function t(e,n,r,s,i){s&&e.push(s);for(var l=0;lx=>{e.splice(p+1,0,x),l++})(l)}s&&e.pop()},xR=function(e){return e instanceof w0||e instanceof M5||e instanceof S0&&e.hasClass("enclosing")?e:null},kce=function t(e,n){var r=xR(e);if(r){var s=r.children;if(s.length){if(n==="right")return t(s[s.length-1],"right");if(n==="left")return t(s[0],"left")}}return e},N4=function(e,n){return e?(n&&(e=kce(e,n)),Sce[e.classes[0]]||null):null},qf=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return vl(n.concat(r))},Kt=function(e,n,r){if(!e)return vl();if(Yg[e.type]){var s=Yg[e.type](e,n);if(r&&n.size!==r.size){s=vl(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new De("Got group of unknown type: '"+e.type+"'")};function Dp(t,e){var n=vl(["base"],t,e),r=vl(["strut"]);return r.style.height=Le(n.height+n.depth),n.depth&&(r.style.verticalAlign=Le(-n.depth)),n.children.unshift(r),n}function C4(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=Ar(t,e,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],l=[],c=0;c0&&(i.push(Dp(l,e)),l=[]),i.push(r[c]));l.length>0&&i.push(Dp(l,e));var h;n?(h=Dp(Ar(n,e,!0)),h.classes=["tag"],i.push(h)):s&&i.push(s);var m=vl(["katex-html"],i);if(m.setAttribute("aria-hidden","true"),h){var p=h.children[0];p.style.height=Le(m.height+m.depth),m.depth&&(p.style.verticalAlign=Le(-m.depth))}return m}function vR(t){return new w0(t)}class ni{constructor(e,n,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=n||[],this.classes=r||[]}setAttribute(e,n){this.attributes[e]=n}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&e.setAttribute(n,this.attributes[n]);this.classes.length>0&&(e.className=yo(this.classes));for(var r=0;r0&&(e+=' class ="'+tn.escape(yo(this.classes))+'"'),e+=">";for(var r=0;r",e}toText(){return this.children.map(e=>e.toText()).join("")}}class ga{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return tn.escape(this.toText())}toText(){return this.text}}class Oce{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",Le(this.width)),e}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var _e={MathNode:ni,TextNode:ga,SpaceNode:Oce,newDocumentFragment:vR},Mi=function(e,n,r){return Ln[n][e]&&Ln[n][e].replace&&e.charCodeAt(0)!==55349&&!(dR.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=Ln[n][e].replace),new _e.TextNode(e)},_5=function(e){return e.length===1?e[0]:new _e.MathNode("mrow",e)},D5=function(e,n){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold";var r=n.font;if(!r||r==="mathnormal")return null;var s=e.mode;if(r==="mathit")return"italic";if(r==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(r==="mathbf")return"bold";if(r==="mathbb")return"double-struck";if(r==="mathsfit")return"sans-serif-italic";if(r==="mathfrak")return"fraktur";if(r==="mathscr"||r==="mathcal")return"script";if(r==="mathsf")return"sans-serif";if(r==="mathtt")return"monospace";var i=e.text;if(["\\imath","\\jmath"].includes(i))return null;Ln[s][i]&&Ln[s][i].replace&&(i=Ln[s][i].replace);var l=pe.fontMap[r].fontName;return A5(i,l,s)?pe.fontMap[r].variant:null};function Rb(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof ga&&e.text==="."}else if(t.type==="mo"&&t.children.length===1&&t.getAttribute("separator")==="true"&&t.getAttribute("lspace")==="0em"&&t.getAttribute("rspace")==="0em"){var n=t.children[0];return n instanceof ga&&n.text===","}else return!1}var Fs=function(e,n,r){if(e.length===1){var s=zn(e[0],n);return r&&s instanceof ni&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],l,c=0;c=1&&(l.type==="mn"||Rb(l))){var h=d.children[0];h instanceof ni&&h.type==="mn"&&(h.children=[...l.children,...h.children],i.pop())}else if(l.type==="mi"&&l.children.length===1){var m=l.children[0];if(m instanceof ga&&m.text==="̸"&&(d.type==="mo"||d.type==="mi"||d.type==="mn")){var p=d.children[0];p instanceof ga&&p.text.length>0&&(p.text=p.text.slice(0,1)+"̸"+p.text.slice(1),i.pop())}}}i.push(d),l=d}return i},wo=function(e,n,r){return _5(Fs(e,n,r))},zn=function(e,n){if(!e)return new _e.MathNode("mrow");if(Kg[e.type]){var r=Kg[e.type](e,n);return r}else throw new De("Got group of unknown type: '"+e.type+"'")};function fN(t,e,n,r,s){var i=Fs(t,n),l;i.length===1&&i[0]instanceof ni&&["mrow","mtable"].includes(i[0].type)?l=i[0]:l=new _e.MathNode("mrow",i);var c=new _e.MathNode("annotation",[new _e.TextNode(e)]);c.setAttribute("encoding","application/x-tex");var d=new _e.MathNode("semantics",[l,c]),h=new _e.MathNode("math",[d]);h.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&h.setAttribute("display","block");var m=s?"katex":"katex-mathml";return pe.makeSpan([m],[h])}var yR=function(e){return new sl({style:e.displayMode?at.DISPLAY:at.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},bR=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=pe.makeSpan(r,[e])}return e},jce=function(e,n,r){var s=yR(r),i;if(r.output==="mathml")return fN(e,n,s,r.displayMode,!0);if(r.output==="html"){var l=C4(e,s);i=pe.makeSpan(["katex"],[l])}else{var c=fN(e,n,s,r.displayMode,!1),d=C4(e,s);i=pe.makeSpan(["katex"],[c,d])}return bR(i,r)},Nce=function(e,n,r){var s=yR(r),i=C4(e,s),l=pe.makeSpan(["katex"],[i]);return bR(l,r)},Cce={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Tce=function(e){var n=new _e.MathNode("mo",[new _e.TextNode(Cce[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},Ace={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Mce=function(e){return e.type==="ordgroup"?e.body.length:1},Ece=function(e,n){function r(){var c=4e5,d=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(d)){var h=e,m=Mce(h.base),p,x,v;if(m>5)d==="widehat"||d==="widecheck"?(p=420,c=2364,v=.42,x=d+"4"):(p=312,c=2340,v=.34,x="tilde4");else{var b=[1,1,2,2,3,3][m];d==="widehat"||d==="widecheck"?(c=[0,1062,2364,2364,2364][b],p=[0,239,300,360,420][b],v=[0,.24,.3,.3,.36,.42][b],x=d+b):(c=[0,600,1033,2339,2340][b],p=[0,260,286,306,312][b],v=[0,.26,.286,.3,.306,.34][b],x="tilde"+b)}var k=new bo(x),O=new xl([k],{width:"100%",height:Le(v),viewBox:"0 0 "+c+" "+p,preserveAspectRatio:"none"});return{span:pe.makeSvgSpan([],[O],n),minWidth:0,height:v}}else{var j=[],T=Ace[d],[A,_,D]=T,E=D/1e3,R=A.length,Q,F;if(R===1){var L=T[3];Q=["hide-tail"],F=[L]}else if(R===2)Q=["halfarrow-left","halfarrow-right"],F=["xMinYMin","xMaxYMin"];else if(R===3)Q=["brace-left","brace-center","brace-right"],F=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support + `+R+" children.");for(var U=0;U0&&(s.style.minWidth=Le(i)),s},_ce=function(e,n,r,s,i){var l,c=e.height+e.depth+r+s;if(/fbox|color|angl/.test(n)){if(l=pe.makeSpan(["stretchy",n],[],i),n==="fbox"){var d=i.color&&i.getColor();d&&(l.style.borderColor=d)}}else{var h=[];/^[bx]cancel$/.test(n)&&h.push(new O4({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&h.push(new O4({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var m=new xl(h,{width:"100%",height:Le(c)});l=pe.makeSvgSpan([],[m],i)}return l.height=c,l.style.height=Le(c),l},yl={encloseSpan:_ce,mathMLnode:Tce,svgSpan:Ece};function Nt(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function R5(t){var e=Ux(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function Ux(t){return t&&(t.type==="atom"||rce.hasOwnProperty(t.type))?t:null}var z5=(t,e)=>{var n,r,s;t&&t.type==="supsub"?(r=Nt(t.base,"accent"),n=r.base,t.base=n,s=tce(Kt(t,e)),t.base=r):(r=Nt(t,"accent"),n=r.base);var i=Kt(n,e.havingCrampedStyle()),l=r.isShifty&&tn.isCharacterBox(n),c=0;if(l){var d=tn.getBaseElem(n),h=Kt(d,e.havingCrampedStyle());c=aN(h).skew}var m=r.label==="\\c",p=m?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),x;if(r.isStretchy)x=yl.svgSpan(r,e),x=pe.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:x,wrapperClasses:["svg-align"],wrapperStyle:c>0?{width:"calc(100% - "+Le(2*c)+")",marginLeft:Le(2*c)}:void 0}]},e);else{var v,b;r.label==="\\vec"?(v=pe.staticSvg("vec",e),b=pe.svgData.vec[1]):(v=pe.makeOrd({mode:r.mode,text:r.label},e,"textord"),v=aN(v),v.italic=0,b=v.width,m&&(p+=v.depth)),x=pe.makeSpan(["accent-body"],[v]);var k=r.label==="\\textcircled";k&&(x.classes.push("accent-full"),p=i.height);var O=c;k||(O-=b/2),x.style.left=Le(O),r.label==="\\textcircled"&&(x.style.top=".2em"),x=pe.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-p},{type:"elem",elem:x}]},e)}var j=pe.makeSpan(["mord","accent"],[x],e);return s?(s.children[0]=j,s.height=Math.max(j.height,s.height),s.classes[0]="mord",s):j},wR=(t,e)=>{var n=t.isStretchy?yl.mathMLnode(t.label):new _e.MathNode("mo",[Mi(t.label,t.mode)]),r=new _e.MathNode("mover",[zn(t.base,e),n]);return r.setAttribute("accent","true"),r},Dce=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));Qe({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(t,e)=>{var n=Zg(e[0]),r=!Dce.test(t.funcName),s=!r||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:r,isShifty:s,base:n}},htmlBuilder:z5,mathmlBuilder:wR});Qe({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(t,e)=>{var n=e[0],r=t.parser.mode;return r==="math"&&(t.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+t.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:t.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:z5,mathmlBuilder:wR});Qe({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"accentUnder",mode:n.mode,label:r,base:s}},htmlBuilder:(t,e)=>{var n=Kt(t.base,e),r=yl.svgSpan(t,e),s=t.label==="\\utilde"?.12:0,i=pe.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]},e);return pe.makeSpan(["mord","accentunder"],[i],e)},mathmlBuilder:(t,e)=>{var n=yl.mathMLnode(t.label),r=new _e.MathNode("munder",[zn(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var Rp=t=>{var e=new _e.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Qe({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r,funcName:s}=t;return{type:"xArrow",mode:r.mode,label:s,body:e[0],below:n[0]}},htmlBuilder(t,e){var n=e.style,r=e.havingStyle(n.sup()),s=pe.wrapFragment(Kt(t.body,r,e),e),i=t.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var l;t.below&&(r=e.havingStyle(n.sub()),l=pe.wrapFragment(Kt(t.below,r,e),e),l.classes.push(i+"-arrow-pad"));var c=yl.svgSpan(t,e),d=-e.fontMetrics().axisHeight+.5*c.height,h=-e.fontMetrics().axisHeight-.5*c.height-.111;(s.depth>.25||t.label==="\\xleftequilibrium")&&(h-=s.depth);var m;if(l){var p=-e.fontMetrics().axisHeight+l.height+.5*c.height+.111;m=pe.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:c,shift:d},{type:"elem",elem:l,shift:p}]},e)}else m=pe.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:c,shift:d}]},e);return m.children[0].children[0].children[1].classes.push("svg-align"),pe.makeSpan(["mrel","x-arrow"],[m],e)},mathmlBuilder(t,e){var n=yl.mathMLnode(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var s=Rp(zn(t.body,e));if(t.below){var i=Rp(zn(t.below,e));r=new _e.MathNode("munderover",[n,i,s])}else r=new _e.MathNode("mover",[n,s])}else if(t.below){var l=Rp(zn(t.below,e));r=new _e.MathNode("munder",[n,l])}else r=Rp(),r=new _e.MathNode("mover",[n,r]);return r}});var Rce=pe.makeSpan;function SR(t,e){var n=Ar(t.body,e,!0);return Rce([t.mclass],n,e)}function kR(t,e){var n,r=Fs(t.body,e);return t.mclass==="minner"?n=new _e.MathNode("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new _e.MathNode("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new _e.MathNode("mo",r),t.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):t.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):t.mclass==="mopen"||t.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):t.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}Qe({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:ar(s),isCharacterBox:tn.isCharacterBox(s)}},htmlBuilder:SR,mathmlBuilder:kR});var Vx=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};Qe({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:Vx(e[0]),body:ar(e[1]),isCharacterBox:tn.isCharacterBox(e[1])}}});Qe({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,s=e[1],i=e[0],l;r!=="\\stackrel"?l=Vx(s):l="mrel";var c={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:ar(s)},d={type:"supsub",mode:i.mode,base:c,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:l,body:[d],isCharacterBox:tn.isCharacterBox(d)}},htmlBuilder:SR,mathmlBuilder:kR});Qe({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:Vx(e[0]),body:ar(e[0])}},htmlBuilder(t,e){var n=Ar(t.body,e,!0),r=pe.makeSpan([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=Fs(t.body,e),r=new _e.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var zce={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},mN=()=>({type:"styling",body:[],mode:"math",style:"display"}),pN=t=>t.type==="textord"&&t.text==="@",Pce=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function Bce(t,e,n){var r=zce[t];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var s=n.callFunction("\\\\cdleft",[e[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},l=n.callFunction("\\Big",[i],[]),c=n.callFunction("\\\\cdright",[e[1]],[]),d={type:"ordgroup",mode:"math",body:[s,l,c]};return n.callFunction("\\\\cdparent",[d],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var h={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[h],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Lce(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var n=t.fetch().text;if(n==="&"||n==="\\\\")t.consume();else if(n==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new De("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],s=[r],i=0;i-1))if("<>AV".indexOf(h)>-1)for(var p=0;p<2;p++){for(var x=!0,v=d+1;vAV=|." after @',l[d]);var b=Bce(h,m,t),k={type:"styling",body:[b],mode:"math",style:"display"};r.push(k),c=mN()}i%2===0?r.push(c):r.shift(),r=[],s.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var O=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:O,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}Qe({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:e[0]}},htmlBuilder(t,e){var n=e.havingStyle(e.style.sup()),r=pe.wrapFragment(Kt(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=Le(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new _e.MathNode("mrow",[zn(t.label,e)]);return n=new _e.MathNode("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new _e.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Qe({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(t,e){var{parser:n}=t;return{type:"cdlabelparent",mode:n.mode,fragment:e[0]}},htmlBuilder(t,e){var n=pe.wrapFragment(Kt(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new _e.MathNode("mrow",[zn(t.fragment,e)])}});Qe({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=Nt(e[0],"ordgroup"),s=r.body,i="",l=0;l=1114111)throw new De("\\@char with invalid code point "+i);return d<=65535?h=String.fromCharCode(d):(d-=65536,h=String.fromCharCode((d>>10)+55296,(d&1023)+56320)),{type:"textord",mode:n.mode,text:h}}});var OR=(t,e)=>{var n=Ar(t.body,e.withColor(t.color),!1);return pe.makeFragment(n)},jR=(t,e)=>{var n=Fs(t.body,e.withColor(t.color)),r=new _e.MathNode("mstyle",n);return r.setAttribute("mathcolor",t.color),r};Qe({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=Nt(e[0],"color-token").color,s=e[1];return{type:"color",mode:n.mode,color:r,body:ar(s)}},htmlBuilder:OR,mathmlBuilder:jR});Qe({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,s=Nt(e[0],"color-token").color;n.gullet.macros.set("\\current@color",s);var i=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:s,body:i}},htmlBuilder:OR,mathmlBuilder:jR});Qe({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(t,e,n){var{parser:r}=t,s=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,i=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:i,size:s&&Nt(s,"size").value}},htmlBuilder(t,e){var n=pe.makeSpan(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=Le(Kn(t.size,e)))),n},mathmlBuilder(t,e){var n=new _e.MathNode("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",Le(Kn(t.size,e)))),n}});var T4={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},NR=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new De("Expected a control sequence",t);return e},Ice=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},CR=(t,e,n,r)=>{var s=t.gullet.macros.get(n.text);s==null&&(n.noexpand=!0,s={tokens:[n],numArgs:0,unexpandable:!t.gullet.isExpandable(n.text)}),t.gullet.macros.set(e,s,r)};Qe({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(t){var{parser:e,funcName:n}=t;e.consumeSpaces();var r=e.fetch();if(T4[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=T4[r.text]),Nt(e.parseFunction(),"internal");throw new De("Invalid token after macro prefix",r)}});Qe({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=e.gullet.popToken(),s=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new De("Expected a control sequence",r);for(var i=0,l,c=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){l=e.gullet.future(),c[i].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new De('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new De('Argument number "'+r.text+'" out of order');i++,c.push([])}else{if(r.text==="EOF")throw new De("Expected a macro definition");c[i].push(r.text)}var{tokens:d}=e.gullet.consumeArg();return l&&d.unshift(l),(n==="\\edef"||n==="\\xdef")&&(d=e.gullet.expandTokens(d),d.reverse()),e.gullet.macros.set(s,{tokens:d,numArgs:i,delimiters:c},n===T4[n]),{type:"internal",mode:e.mode}}});Qe({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=NR(e.gullet.popToken());e.gullet.consumeSpaces();var s=Ice(e);return CR(e,r,s,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});Qe({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=NR(e.gullet.popToken()),s=e.gullet.popToken(),i=e.gullet.popToken();return CR(e,r,i,n==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});var Vh=function(e,n,r){var s=Ln.math[e]&&Ln.math[e].replace,i=A5(s||e,n,r);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return i},P5=function(e,n,r,s){var i=r.havingBaseStyle(n),l=pe.makeSpan(s.concat(i.sizingClasses(r)),[e],r),c=i.sizeMultiplier/r.sizeMultiplier;return l.height*=c,l.depth*=c,l.maxFontSize=i.sizeMultiplier,l},TR=function(e,n,r){var s=n.havingBaseStyle(r),i=(1-n.sizeMultiplier/s.sizeMultiplier)*n.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=Le(i),e.height-=i,e.depth+=i},qce=function(e,n,r,s,i,l){var c=pe.makeSymbol(e,"Main-Regular",i,s),d=P5(c,n,s,l);return r&&TR(d,s,n),d},Fce=function(e,n,r,s){return pe.makeSymbol(e,"Size"+n+"-Regular",r,s)},AR=function(e,n,r,s,i,l){var c=Fce(e,n,i,s),d=P5(pe.makeSpan(["delimsizing","size"+n],[c],s),at.TEXT,s,l);return r&&TR(d,s,at.TEXT),d},zb=function(e,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=pe.makeSpan(["delimsizinginner",s],[pe.makeSpan([],[pe.makeSymbol(e,n,r)])]);return{type:"elem",elem:i}},Pb=function(e,n,r){var s=pa["Size4-Regular"][e.charCodeAt(0)]?pa["Size4-Regular"][e.charCodeAt(0)][4]:pa["Size1-Regular"][e.charCodeAt(0)][4],i=new bo("inner",Voe(e,Math.round(1e3*n))),l=new xl([i],{width:Le(s),height:Le(n),style:"width:"+Le(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),c=pe.makeSvgSpan([],[l],r);return c.height=n,c.style.height=Le(n),c.style.width=Le(s),{type:"elem",elem:c}},A4=.008,zp={type:"kern",size:-1*A4},Qce=["|","\\lvert","\\rvert","\\vert"],$ce=["\\|","\\lVert","\\rVert","\\Vert"],MR=function(e,n,r,s,i,l){var c,d,h,m,p="",x=0;c=h=m=e,d=null;var v="Size1-Regular";e==="\\uparrow"?h=m="⏐":e==="\\Uparrow"?h=m="‖":e==="\\downarrow"?c=h="⏐":e==="\\Downarrow"?c=h="‖":e==="\\updownarrow"?(c="\\uparrow",h="⏐",m="\\downarrow"):e==="\\Updownarrow"?(c="\\Uparrow",h="‖",m="\\Downarrow"):Qce.includes(e)?(h="∣",p="vert",x=333):$ce.includes(e)?(h="∥",p="doublevert",x=556):e==="["||e==="\\lbrack"?(c="⎡",h="⎢",m="⎣",v="Size4-Regular",p="lbrack",x=667):e==="]"||e==="\\rbrack"?(c="⎤",h="⎥",m="⎦",v="Size4-Regular",p="rbrack",x=667):e==="\\lfloor"||e==="⌊"?(h=c="⎢",m="⎣",v="Size4-Regular",p="lfloor",x=667):e==="\\lceil"||e==="⌈"?(c="⎡",h=m="⎢",v="Size4-Regular",p="lceil",x=667):e==="\\rfloor"||e==="⌋"?(h=c="⎥",m="⎦",v="Size4-Regular",p="rfloor",x=667):e==="\\rceil"||e==="⌉"?(c="⎤",h=m="⎥",v="Size4-Regular",p="rceil",x=667):e==="("||e==="\\lparen"?(c="⎛",h="⎜",m="⎝",v="Size4-Regular",p="lparen",x=875):e===")"||e==="\\rparen"?(c="⎞",h="⎟",m="⎠",v="Size4-Regular",p="rparen",x=875):e==="\\{"||e==="\\lbrace"?(c="⎧",d="⎨",m="⎩",h="⎪",v="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(c="⎫",d="⎬",m="⎭",h="⎪",v="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(c="⎧",m="⎩",h="⎪",v="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(c="⎫",m="⎭",h="⎪",v="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(c="⎧",m="⎭",h="⎪",v="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(c="⎫",m="⎩",h="⎪",v="Size4-Regular");var b=Vh(c,v,i),k=b.height+b.depth,O=Vh(h,v,i),j=O.height+O.depth,T=Vh(m,v,i),A=T.height+T.depth,_=0,D=1;if(d!==null){var E=Vh(d,v,i);_=E.height+E.depth,D=2}var R=k+A+_,Q=Math.max(0,Math.ceil((n-R)/(D*j))),F=R+Q*D*j,L=s.fontMetrics().axisHeight;r&&(L*=s.sizeMultiplier);var U=F/2-L,V=[];if(p.length>0){var de=F-k-A,W=Math.round(F*1e3),J=Woe(p,Math.round(de*1e3)),$=new bo(p,J),ae=(x/1e3).toFixed(3)+"em",ne=(W/1e3).toFixed(3)+"em",ce=new xl([$],{width:ae,height:ne,viewBox:"0 0 "+x+" "+W}),z=pe.makeSvgSpan([],[ce],s);z.height=W/1e3,z.style.width=ae,z.style.height=ne,V.push({type:"elem",elem:z})}else{if(V.push(zb(m,v,i)),V.push(zp),d===null){var xe=F-k-A+2*A4;V.push(Pb(h,xe,s))}else{var Y=(F-k-A-_)/2+2*A4;V.push(Pb(h,Y,s)),V.push(zp),V.push(zb(d,v,i)),V.push(zp),V.push(Pb(h,Y,s))}V.push(zp),V.push(zb(c,v,i))}var P=s.havingBaseStyle(at.TEXT),K=pe.makeVList({positionType:"bottom",positionData:U,children:V},P);return P5(pe.makeSpan(["delimsizing","mult"],[K],P),at.TEXT,s,l)},Bb=80,Lb=.08,Ib=function(e,n,r,s,i){var l=Uoe(e,s,r),c=new bo(e,l),d=new xl([c],{width:"400em",height:Le(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return pe.makeSvgSpan(["hide-tail"],[d],i)},Hce=function(e,n){var r=n.havingBaseSizing(),s=RR("\\surd",e*r.sizeMultiplier,DR,r),i=r.sizeMultiplier,l=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),c,d=0,h=0,m=0,p;return s.type==="small"?(m=1e3+1e3*l+Bb,e<1?i=1:e<1.4&&(i=.7),d=(1+l+Lb)/i,h=(1+l)/i,c=Ib("sqrtMain",d,m,l,n),c.style.minWidth="0.853em",p=.833/i):s.type==="large"?(m=(1e3+Bb)*cf[s.size],h=(cf[s.size]+l)/i,d=(cf[s.size]+l+Lb)/i,c=Ib("sqrtSize"+s.size,d,m,l,n),c.style.minWidth="1.02em",p=1/i):(d=e+l+Lb,h=e+l,m=Math.floor(1e3*e+l)+Bb,c=Ib("sqrtTall",d,m,l,n),c.style.minWidth="0.742em",p=1.056),c.height=h,c.style.height=Le(d),{span:c,advanceWidth:p,ruleWidth:(n.fontMetrics().sqrtRuleThickness+l)*i}},ER=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Uce=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],_R=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],cf=[0,1.2,1.8,2.4,3],Vce=function(e,n,r,s,i){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),ER.includes(e)||_R.includes(e))return AR(e,n,!1,r,s,i);if(Uce.includes(e))return MR(e,cf[n],!1,r,s,i);throw new De("Illegal delimiter: '"+e+"'")},Wce=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Gce=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"stack"}],DR=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Xce=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},RR=function(e,n,r,s){for(var i=Math.min(2,3-s.style.size),l=i;ln)return r[l]}return r[r.length-1]},zR=function(e,n,r,s,i,l){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var c;_R.includes(e)?c=Wce:ER.includes(e)?c=DR:c=Gce;var d=RR(e,n,c,s);return d.type==="small"?qce(e,d.style,r,s,i,l):d.type==="large"?AR(e,d.size,r,s,i,l):MR(e,n,r,s,i,l)},Yce=function(e,n,r,s,i,l){var c=s.fontMetrics().axisHeight*s.sizeMultiplier,d=901,h=5/s.fontMetrics().ptPerEm,m=Math.max(n-c,r+c),p=Math.max(m/500*d,2*m-h);return zR(e,p,!0,s,i,l)},dl={sqrtImage:Hce,sizedDelim:Vce,sizeToMaxHeight:cf,customSizedDelim:zR,leftRightDelim:Yce},gN={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Kce=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function Wx(t,e){var n=Ux(t);if(n&&Kce.includes(n.text))return n;throw n?new De("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new De("Invalid delimiter type '"+t.type+"'",t)}Qe({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,e)=>{var n=Wx(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:gN[t.funcName].size,mclass:gN[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?pe.makeSpan([t.mclass]):dl.sizedDelim(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(Mi(t.delim,t.mode));var n=new _e.MathNode("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Le(dl.sizeToMaxHeight[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function xN(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Qe({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=t.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new De("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:Wx(e[0],t).text,color:n}}});Qe({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Wx(e[0],t),r=t.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=Nt(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(t,e)=>{xN(t);for(var n=Ar(t.body,e,!0,["mopen","mclose"]),r=0,s=0,i=!1,l=0;l{xN(t);var n=Fs(t.body,e);if(t.left!=="."){var r=new _e.MathNode("mo",[Mi(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var s=new _e.MathNode("mo",[Mi(t.right,t.mode)]);s.setAttribute("fence","true"),t.rightColor&&s.setAttribute("mathcolor",t.rightColor),n.push(s)}return _5(n)}});Qe({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Wx(e[0],t);if(!t.parser.leftrightDepth)throw new De("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=qf(e,[]);else{n=dl.sizedDelim(t.delim,1,e,t.mode,[]);var r={delim:t.delim,options:e};n.isMiddle=r}return n},mathmlBuilder:(t,e)=>{var n=t.delim==="\\vert"||t.delim==="|"?Mi("|","text"):Mi(t.delim,t.mode),r=new _e.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var B5=(t,e)=>{var n=pe.wrapFragment(Kt(t.body,e),e),r=t.label.slice(1),s=e.sizeMultiplier,i,l=0,c=tn.isCharacterBox(t.body);if(r==="sout")i=pe.makeSpan(["stretchy","sout"]),i.height=e.fontMetrics().defaultRuleThickness/s,l=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var d=Kn({number:.6,unit:"pt"},e),h=Kn({number:.35,unit:"ex"},e),m=e.havingBaseSizing();s=s/m.sizeMultiplier;var p=n.height+n.depth+d+h;n.style.paddingLeft=Le(p/2+d);var x=Math.floor(1e3*p*s),v=$oe(x),b=new xl([new bo("phase",v)],{width:"400em",height:Le(x/1e3),viewBox:"0 0 400000 "+x,preserveAspectRatio:"xMinYMin slice"});i=pe.makeSvgSpan(["hide-tail"],[b],e),i.style.height=Le(p),l=n.depth+d+h}else{/cancel/.test(r)?c||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var k=0,O=0,j=0;/box/.test(r)?(j=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),k=e.fontMetrics().fboxsep+(r==="colorbox"?0:j),O=k):r==="angl"?(j=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),k=4*j,O=Math.max(0,.25-n.depth)):(k=c?.2:0,O=k),i=yl.encloseSpan(n,r,k,O,e),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Le(j)):r==="angl"&&j!==.049&&(i.style.borderTopWidth=Le(j),i.style.borderRightWidth=Le(j)),l=n.depth+O,t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor,t.borderColor&&(i.style.borderColor=t.borderColor))}var T;if(t.backgroundColor)T=pe.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:l},{type:"elem",elem:n,shift:0}]},e);else{var A=/cancel|phase/.test(r)?["svg-align"]:[];T=pe.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:l,wrapperClasses:A}]},e)}return/cancel/.test(r)&&(T.height=n.height,T.depth=n.depth),/cancel/.test(r)&&!c?pe.makeSpan(["mord","cancel-lap"],[T],e):pe.makeSpan(["mord"],[T],e)},L5=(t,e)=>{var n=0,r=new _e.MathNode(t.label.indexOf("colorbox")>-1?"mpadded":"menclose",[zn(t.body,e)]);switch(t.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),t.label==="\\fcolorbox"){var s=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+s+"em solid "+String(t.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};Qe({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Nt(e[0],"color-token").color,l=e[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:l}},htmlBuilder:B5,mathmlBuilder:L5});Qe({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Nt(e[0],"color-token").color,l=Nt(e[1],"color-token").color,c=e[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:l,borderColor:i,body:c}},htmlBuilder:B5,mathmlBuilder:L5});Qe({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\fbox",body:e[0]}}});Qe({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"enclose",mode:n.mode,label:r,body:s}},htmlBuilder:B5,mathmlBuilder:L5});Qe({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\angl",body:e[0]}}});var PR={};function Ca(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:l}=t,c={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},d=0;d{var e=t.parser.settings;if(!e.displayMode)throw new De("{"+t.envName+"} can be used only in display mode.")};function I5(t){if(t.indexOf("ed")===-1)return t.indexOf("*")===-1}function Mo(t,e,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:l,colSeparationType:c,autoTag:d,singleRow:h,emptySingleRow:m,maxNumCols:p,leqno:x}=e;if(t.gullet.beginGroup(),h||t.gullet.macros.set("\\cr","\\\\\\relax"),!l){var v=t.gullet.expandMacroAsText("\\arraystretch");if(v==null)l=1;else if(l=parseFloat(v),!l||l<0)throw new De("Invalid \\arraystretch: "+v)}t.gullet.beginGroup();var b=[],k=[b],O=[],j=[],T=d!=null?[]:void 0;function A(){d&&t.gullet.macros.set("\\@eqnsw","1",!0)}function _(){T&&(t.gullet.macros.get("\\df@tag")?(T.push(t.subparse([new ii("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):T.push(!!d&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(A(),j.push(vN(t));;){var D=t.parseExpression(!1,h?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),D={type:"ordgroup",mode:t.mode,body:D},n&&(D={type:"styling",mode:t.mode,style:n,body:[D]}),b.push(D);var E=t.fetch().text;if(E==="&"){if(p&&b.length===p){if(h||c)throw new De("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(E==="\\end"){_(),b.length===1&&D.type==="styling"&&D.body[0].body.length===0&&(k.length>1||!m)&&k.pop(),j.length0&&(A+=.25),h.push({pos:A,isDashed:Jn[nn]})}for(_(l[0]),r=0;r0&&(U+=T,RJn))for(r=0;r=c)){var ve=void 0;(s>0||e.hskipBeforeAndAfter)&&(ve=tn.deflt(Y.pregap,x),ve!==0&&(J=pe.makeSpan(["arraycolsep"],[]),J.style.width=Le(ve),W.push(J)));var Re=[];for(r=0;r0){for(var Oe=pe.makeLineSpan("hline",n,m),nt=pe.makeLineSpan("hdashline",n,m),ut=[{type:"elem",elem:d,shift:0}];h.length>0;){var Ct=h.pop(),In=Ct.pos-V;Ct.isDashed?ut.push({type:"elem",elem:nt,shift:In}):ut.push({type:"elem",elem:Oe,shift:In})}d=pe.makeVList({positionType:"individualShift",children:ut},n)}if(ae.length===0)return pe.makeSpan(["mord"],[d],n);var Tn=pe.makeVList({positionType:"individualShift",children:ae},n);return Tn=pe.makeSpan(["tag"],[Tn],n),pe.makeFragment([d,Tn])},Zce={c:"center ",l:"left ",r:"right "},Aa=function(e,n){for(var r=[],s=new _e.MathNode("mtd",[],["mtr-glue"]),i=new _e.MathNode("mtd",[],["mml-eqn-num"]),l=0;l0){var b=e.cols,k="",O=!1,j=0,T=b.length;b[0].type==="separator"&&(x+="top ",j=1),b[b.length-1].type==="separator"&&(x+="bottom ",T-=1);for(var A=j;A0?"left ":"",x+=Q[Q.length-1].length>0?"right ":"";for(var F=1;F-1?"alignat":"align",i=e.envName==="split",l=Mo(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:I5(e.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),c,d=0,h={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var m="",p=0;p0&&v&&(O=1),r[b]={type:"align",align:k,pregap:O,postgap:0}}return l.colSeparationType=v?"align":"alignat",l};Ca({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=Ux(e[0]),r=n?[e[0]]:Nt(e[0],"ordgroup").body,s=r.map(function(l){var c=R5(l),d=c.text;if("lcr".indexOf(d)!==-1)return{type:"align",align:d};if(d==="|")return{type:"separator",separator:"|"};if(d===":")return{type:"separator",separator:":"};throw new De("Unknown column alignment: "+d,l)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return Mo(t.parser,i,q5(t.envName))},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(t.envName.charAt(t.envName.length-1)==="*"){var s=t.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),n=s.fetch().text,"lcr".indexOf(n)===-1)throw new De("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=Mo(t.parser,r,q5(t.envName)),l=Math.max(0,...i.body.map(c=>c.length));return i.cols=new Array(l).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[i],left:e[0],right:e[1],rightColor:void 0}:i},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=Mo(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=Ux(e[0]),r=n?[e[0]]:Nt(e[0],"ordgroup").body,s=r.map(function(l){var c=R5(l),d=c.text;if("lc".indexOf(d)!==-1)return{type:"align",align:d};throw new De("Unknown column alignment: "+d,l)});if(s.length>1)throw new De("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5};if(i=Mo(t.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new De("{subarray} can contain only one column");return i},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=Mo(t.parser,e,q5(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.indexOf("r")>-1?".":"\\{",right:t.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:LR,htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){["gather","gather*"].includes(t.envName)&&Gx(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:I5(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return Mo(t.parser,e,"display")},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:LR,htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){Gx(t);var e={autoTag:I5(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return Mo(t.parser,e,"display")},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["CD"],props:{numArgs:0},handler(t){return Gx(t),Lce(t.parser)},htmlBuilder:Ta,mathmlBuilder:Aa});q("\\nonumber","\\gdef\\@eqnsw{0}");q("\\notag","\\nonumber");Qe({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new De(t.funcName+" valid only within array environment")}});var yN=PR;Qe({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];if(s.type!=="ordgroup")throw new De("Invalid environment name",s);for(var i="",l=0;l{var n=t.font,r=e.withFont(n);return Kt(t.body,r)},qR=(t,e)=>{var n=t.font,r=e.withFont(n);return zn(t.body,r)},bN={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Qe({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=Zg(e[0]),i=r;return i in bN&&(i=bN[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:IR,mathmlBuilder:qR});Qe({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0],s=tn.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:Vx(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:s}}});Qe({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,breakOnTokenText:s}=t,{mode:i}=n,l=n.parseExpression(!0,s),c="math"+r.slice(1);return{type:"font",mode:i,font:c,body:{type:"ordgroup",mode:n.mode,body:l}}},htmlBuilder:IR,mathmlBuilder:qR});var FR=(t,e)=>{var n=e;return t==="display"?n=n.id>=at.SCRIPT.id?n.text():at.DISPLAY:t==="text"&&n.size===at.DISPLAY.size?n=at.TEXT:t==="script"?n=at.SCRIPT:t==="scriptscript"&&(n=at.SCRIPTSCRIPT),n},F5=(t,e)=>{var n=FR(t.size,e.style),r=n.fracNum(),s=n.fracDen(),i;i=e.havingStyle(r);var l=Kt(t.numer,i,e);if(t.continued){var c=8.5/e.fontMetrics().ptPerEm,d=3.5/e.fontMetrics().ptPerEm;l.height=l.height0?b=3*x:b=7*x,k=e.fontMetrics().denom1):(p>0?(v=e.fontMetrics().num2,b=x):(v=e.fontMetrics().num3,b=3*x),k=e.fontMetrics().denom2);var O;if(m){var T=e.fontMetrics().axisHeight;v-l.depth-(T+.5*p){var n=new _e.MathNode("mfrac",[zn(t.numer,e),zn(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=Kn(t.barSize,e);n.setAttribute("linethickness",Le(r))}var s=FR(t.size,e.style);if(s.size!==e.style.size){n=new _e.MathNode("mstyle",[n]);var i=s.size===at.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",i),n.setAttribute("scriptlevel","0")}if(t.leftDelim!=null||t.rightDelim!=null){var l=[];if(t.leftDelim!=null){var c=new _e.MathNode("mo",[new _e.TextNode(t.leftDelim.replace("\\",""))]);c.setAttribute("fence","true"),l.push(c)}if(l.push(n),t.rightDelim!=null){var d=new _e.MathNode("mo",[new _e.TextNode(t.rightDelim.replace("\\",""))]);d.setAttribute("fence","true"),l.push(d)}return _5(l)}return n};Qe({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1],l,c=null,d=null,h="auto";switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":l=!0;break;case"\\\\atopfrac":l=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":l=!1,c="(",d=")";break;case"\\\\bracefrac":l=!1,c="\\{",d="\\}";break;case"\\\\brackfrac":l=!1,c="[",d="]";break;default:throw new Error("Unrecognized genfrac command")}switch(r){case"\\dfrac":case"\\dbinom":h="display";break;case"\\tfrac":case"\\tbinom":h="text";break}return{type:"genfrac",mode:n.mode,continued:!1,numer:s,denom:i,hasBarLine:l,leftDelim:c,rightDelim:d,size:h,barSize:null}},htmlBuilder:F5,mathmlBuilder:Q5});Qe({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1];return{type:"genfrac",mode:n.mode,continued:!0,numer:s,denom:i,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});Qe({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(t){var{parser:e,funcName:n,token:r}=t,s;switch(n){case"\\over":s="\\frac";break;case"\\choose":s="\\binom";break;case"\\atop":s="\\\\atopfrac";break;case"\\brace":s="\\\\bracefrac";break;case"\\brack":s="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:s,token:r}}});var wN=["display","text","script","scriptscript"],SN=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};Qe({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(t,e){var{parser:n}=t,r=e[4],s=e[5],i=Zg(e[0]),l=i.type==="atom"&&i.family==="open"?SN(i.text):null,c=Zg(e[1]),d=c.type==="atom"&&c.family==="close"?SN(c.text):null,h=Nt(e[2],"size"),m,p=null;h.isBlank?m=!0:(p=h.value,m=p.number>0);var x="auto",v=e[3];if(v.type==="ordgroup"){if(v.body.length>0){var b=Nt(v.body[0],"textord");x=wN[Number(b.text)]}}else v=Nt(v,"textord"),x=wN[Number(v.text)];return{type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:m,barSize:p,leftDelim:l,rightDelim:d,size:x}},htmlBuilder:F5,mathmlBuilder:Q5});Qe({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(t,e){var{parser:n,funcName:r,token:s}=t;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:Nt(e[0],"size").value,token:s}}});Qe({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=Toe(Nt(e[1],"infix").size),l=e[2],c=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:l,continued:!1,hasBarLine:c,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:F5,mathmlBuilder:Q5});var QR=(t,e)=>{var n=e.style,r,s;t.type==="supsub"?(r=t.sup?Kt(t.sup,e.havingStyle(n.sup()),e):Kt(t.sub,e.havingStyle(n.sub()),e),s=Nt(t.base,"horizBrace")):s=Nt(t,"horizBrace");var i=Kt(s.base,e.havingBaseStyle(at.DISPLAY)),l=yl.svgSpan(s,e),c;if(s.isOver?(c=pe.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:l}]},e),c.children[0].children[0].children[1].classes.push("svg-align")):(c=pe.makeVList({positionType:"bottom",positionData:i.depth+.1+l.height,children:[{type:"elem",elem:l},{type:"kern",size:.1},{type:"elem",elem:i}]},e),c.children[0].children[0].children[0].classes.push("svg-align")),r){var d=pe.makeSpan(["mord",s.isOver?"mover":"munder"],[c],e);s.isOver?c=pe.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:d},{type:"kern",size:.2},{type:"elem",elem:r}]},e):c=pe.makeVList({positionType:"bottom",positionData:d.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:d}]},e)}return pe.makeSpan(["mord",s.isOver?"mover":"munder"],[c],e)},Jce=(t,e)=>{var n=yl.mathMLnode(t.label);return new _e.MathNode(t.isOver?"mover":"munder",[zn(t.base,e),n])};Qe({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"horizBrace",mode:n.mode,label:r,isOver:/^\\over/.test(r),base:e[0]}},htmlBuilder:QR,mathmlBuilder:Jce});Qe({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],s=Nt(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:ar(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=Ar(t.body,e,!1);return pe.makeAnchor(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=wo(t.body,e);return n instanceof ni||(n=new ni("mrow",[n])),n.setAttribute("href",t.href),n}});Qe({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=Nt(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var s=[],i=0;i{var{parser:n,funcName:r,token:s}=t,i=Nt(e[0],"raw").string,l=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var c,d={};switch(r){case"\\htmlClass":d.class=i,c={command:"\\htmlClass",class:i};break;case"\\htmlId":d.id=i,c={command:"\\htmlId",id:i};break;case"\\htmlStyle":d.style=i,c={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var h=i.split(","),m=0;m{var n=Ar(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var s=pe.makeSpan(r,n,e);for(var i in t.attributes)i!=="class"&&t.attributes.hasOwnProperty(i)&&s.setAttribute(i,t.attributes[i]);return s},mathmlBuilder:(t,e)=>wo(t.body,e)});Qe({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:ar(e[0]),mathml:ar(e[1])}},htmlBuilder:(t,e)=>{var n=Ar(t.html,e,!1);return pe.makeFragment(n)},mathmlBuilder:(t,e)=>wo(t.mathml,e)});var qb=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!n)throw new De("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!lR(r))throw new De("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Qe({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(t,e,n)=>{var{parser:r}=t,s={number:0,unit:"em"},i={number:.9,unit:"em"},l={number:0,unit:"em"},c="";if(n[0])for(var d=Nt(n[0],"raw").string,h=d.split(","),m=0;m{var n=Kn(t.height,e),r=0;t.totalheight.number>0&&(r=Kn(t.totalheight,e)-n);var s=0;t.width.number>0&&(s=Kn(t.width,e));var i={height:Le(n+r)};s>0&&(i.width=Le(s)),r>0&&(i.verticalAlign=Le(-r));var l=new Joe(t.src,t.alt,i);return l.height=n,l.depth=r,l},mathmlBuilder:(t,e)=>{var n=new _e.MathNode("mglyph",[]);n.setAttribute("alt",t.alt);var r=Kn(t.height,e),s=0;if(t.totalheight.number>0&&(s=Kn(t.totalheight,e)-r,n.setAttribute("valign",Le(-s))),n.setAttribute("height",Le(r+s)),t.width.number>0){var i=Kn(t.width,e);n.setAttribute("width",Le(i))}return n.setAttribute("src",t.src),n}});Qe({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=Nt(e[0],"size");if(n.settings.strict){var i=r[1]==="m",l=s.value.unit==="mu";i?(l||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):l&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:s.value}},htmlBuilder(t,e){return pe.makeGlue(t.dimension,e)},mathmlBuilder(t,e){var n=Kn(t.dimension,e);return new _e.SpaceNode(n)}});Qe({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:s}},htmlBuilder:(t,e)=>{var n;t.alignment==="clap"?(n=pe.makeSpan([],[Kt(t.body,e)]),n=pe.makeSpan(["inner"],[n],e)):n=pe.makeSpan(["inner"],[Kt(t.body,e)]);var r=pe.makeSpan(["fix"],[]),s=pe.makeSpan([t.alignment],[n,r],e),i=pe.makeSpan(["strut"]);return i.style.height=Le(s.height+s.depth),s.depth&&(i.style.verticalAlign=Le(-s.depth)),s.children.unshift(i),s=pe.makeSpan(["thinbox"],[s],e),pe.makeSpan(["mord","vbox"],[s],e)},mathmlBuilder:(t,e)=>{var n=new _e.MathNode("mpadded",[zn(t.body,e)]);if(t.alignment!=="rlap"){var r=t.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});Qe({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){var{funcName:n,parser:r}=t,s=r.mode;r.switchMode("math");var i=n==="\\("?"\\)":"$",l=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",body:l}}});Qe({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new De("Mismatched "+t.funcName)}});var kN=(t,e)=>{switch(e.style.size){case at.DISPLAY.size:return t.display;case at.TEXT.size:return t.text;case at.SCRIPT.size:return t.script;case at.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};Qe({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:ar(e[0]),text:ar(e[1]),script:ar(e[2]),scriptscript:ar(e[3])}},htmlBuilder:(t,e)=>{var n=kN(t,e),r=Ar(n,e,!1);return pe.makeFragment(r)},mathmlBuilder:(t,e)=>{var n=kN(t,e);return wo(n,e)}});var $R=(t,e,n,r,s,i,l)=>{t=pe.makeSpan([],[t]);var c=n&&tn.isCharacterBox(n),d,h;if(e){var m=Kt(e,r.havingStyle(s.sup()),r);h={elem:m,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-m.depth)}}if(n){var p=Kt(n,r.havingStyle(s.sub()),r);d={elem:p,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-p.height)}}var x;if(h&&d){var v=r.fontMetrics().bigOpSpacing5+d.elem.height+d.elem.depth+d.kern+t.depth+l;x=pe.makeVList({positionType:"bottom",positionData:v,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:d.elem,marginLeft:Le(-i)},{type:"kern",size:d.kern},{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Le(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(d){var b=t.height-l;x=pe.makeVList({positionType:"top",positionData:b,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:d.elem,marginLeft:Le(-i)},{type:"kern",size:d.kern},{type:"elem",elem:t}]},r)}else if(h){var k=t.depth+l;x=pe.makeVList({positionType:"bottom",positionData:k,children:[{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Le(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else return t;var O=[x];if(d&&i!==0&&!c){var j=pe.makeSpan(["mspace"],[],r);j.style.marginRight=Le(i),O.unshift(j)}return pe.makeSpan(["mop","op-limits"],O,r)},HR=["\\smallint"],zd=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Nt(t.base,"op"),s=!0):i=Nt(t,"op");var l=e.style,c=!1;l.size===at.DISPLAY.size&&i.symbol&&!HR.includes(i.name)&&(c=!0);var d;if(i.symbol){var h=c?"Size2-Regular":"Size1-Regular",m="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(m=i.name.slice(1),i.name=m==="oiint"?"\\iint":"\\iiint"),d=pe.makeSymbol(i.name,h,"math",e,["mop","op-symbol",c?"large-op":"small-op"]),m.length>0){var p=d.italic,x=pe.staticSvg(m+"Size"+(c?"2":"1"),e);d=pe.makeVList({positionType:"individualShift",children:[{type:"elem",elem:d,shift:0},{type:"elem",elem:x,shift:c?.08:0}]},e),i.name="\\"+m,d.classes.unshift("mop"),d.italic=p}}else if(i.body){var v=Ar(i.body,e,!0);v.length===1&&v[0]instanceof Ai?(d=v[0],d.classes[0]="mop"):d=pe.makeSpan(["mop"],v,e)}else{for(var b=[],k=1;k{var n;if(t.symbol)n=new ni("mo",[Mi(t.name,t.mode)]),HR.includes(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new ni("mo",Fs(t.body,e));else{n=new ni("mi",[new ga(t.name.slice(1))]);var r=new ni("mo",[Mi("⁡","text")]);t.parentIsSupSub?n=new ni("mrow",[n,r]):n=vR([n,r])}return n},eue={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Qe({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=r;return s.length===1&&(s=eue[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:zd,mathmlBuilder:k0});Qe({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:ar(r)}},htmlBuilder:zd,mathmlBuilder:k0});var tue={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Qe({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:zd,mathmlBuilder:k0});Qe({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:zd,mathmlBuilder:k0});Qe({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t,r=n;return r.length===1&&(r=tue[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:zd,mathmlBuilder:k0});var UR=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Nt(t.base,"operatorname"),s=!0):i=Nt(t,"operatorname");var l;if(i.body.length>0){for(var c=i.body.map(p=>{var x=p.text;return typeof x=="string"?{type:"textord",mode:p.mode,text:x}:p}),d=Ar(c,e.withFont("mathrm"),!0),h=0;h{for(var n=Fs(t.body,e.withFont("mathrm")),r=!0,s=0;sm.toText()).join("");n=[new _e.TextNode(c)]}var d=new _e.MathNode("mi",n);d.setAttribute("mathvariant","normal");var h=new _e.MathNode("mo",[Mi("⁡","text")]);return t.parentIsSupSub?new _e.MathNode("mrow",[d,h]):_e.newDocumentFragment([d,h])};Qe({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"operatorname",mode:n.mode,body:ar(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:UR,mathmlBuilder:nue});q("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Rc({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?pe.makeFragment(Ar(t.body,e,!1)):pe.makeSpan(["mord"],Ar(t.body,e,!0),e)},mathmlBuilder(t,e){return wo(t.body,e,!0)}});Qe({type:"overline",names:["\\overline"],props:{numArgs:1},handler(t,e){var{parser:n}=t,r=e[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(t,e){var n=Kt(t.body,e.havingCrampedStyle()),r=pe.makeLineSpan("overline-line",e),s=e.fontMetrics().defaultRuleThickness,i=pe.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]},e);return pe.makeSpan(["mord","overline"],[i],e)},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[new _e.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new _e.MathNode("mover",[zn(t.body,e),n]);return r.setAttribute("accent","true"),r}});Qe({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"phantom",mode:n.mode,body:ar(r)}},htmlBuilder:(t,e)=>{var n=Ar(t.body,e.withPhantom(),!1);return pe.makeFragment(n)},mathmlBuilder:(t,e)=>{var n=Fs(t.body,e);return new _e.MathNode("mphantom",n)}});Qe({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=pe.makeSpan([],[Kt(t.body,e.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r{var n=Fs(ar(t.body),e),r=new _e.MathNode("mphantom",n),s=new _e.MathNode("mpadded",[r]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});Qe({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=pe.makeSpan(["inner"],[Kt(t.body,e.withPhantom())]),r=pe.makeSpan(["fix"],[]);return pe.makeSpan(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=Fs(ar(t.body),e),r=new _e.MathNode("mphantom",n),s=new _e.MathNode("mpadded",[r]);return s.setAttribute("width","0px"),s}});Qe({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=Nt(e[0],"size").value,s=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(t,e){var n=Kt(t.body,e),r=Kn(t.dy,e);return pe.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){var n=new _e.MathNode("mpadded",[zn(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});Qe({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});Qe({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(t,e,n){var{parser:r}=t,s=n[0],i=Nt(e[0],"size"),l=Nt(e[1],"size");return{type:"rule",mode:r.mode,shift:s&&Nt(s,"size").value,width:i.value,height:l.value}},htmlBuilder(t,e){var n=pe.makeSpan(["mord","rule"],[],e),r=Kn(t.width,e),s=Kn(t.height,e),i=t.shift?Kn(t.shift,e):0;return n.style.borderRightWidth=Le(r),n.style.borderTopWidth=Le(s),n.style.bottom=Le(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=Kn(t.width,e),r=Kn(t.height,e),s=t.shift?Kn(t.shift,e):0,i=e.color&&e.getColor()||"black",l=new _e.MathNode("mspace");l.setAttribute("mathbackground",i),l.setAttribute("width",Le(n)),l.setAttribute("height",Le(r));var c=new _e.MathNode("mpadded",[l]);return s>=0?c.setAttribute("height",Le(s)):(c.setAttribute("height",Le(s)),c.setAttribute("depth",Le(-s))),c.setAttribute("voffset",Le(s)),c}});function VR(t,e,n){for(var r=Ar(t,e,!1),s=e.sizeMultiplier/n.sizeMultiplier,i=0;i{var n=e.havingSize(t.size);return VR(t.body,n,e)};Qe({type:"sizing",names:ON,props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!1,n);return{type:"sizing",mode:s.mode,size:ON.indexOf(r)+1,body:i}},htmlBuilder:rue,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=Fs(t.body,n),s=new _e.MathNode("mstyle",r);return s.setAttribute("mathsize",Le(n.sizeMultiplier)),s}});Qe({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,s=!1,i=!1,l=n[0]&&Nt(n[0],"ordgroup");if(l)for(var c="",d=0;d{var n=pe.makeSpan([],[Kt(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return n;if(t.smashHeight&&(n.height=0,n.children))for(var r=0;r{var n=new _e.MathNode("mpadded",[zn(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});Qe({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r}=t,s=n[0],i=e[0];return{type:"sqrt",mode:r.mode,body:i,index:s}},htmlBuilder(t,e){var n=Kt(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=pe.wrapFragment(n,e);var r=e.fontMetrics(),s=r.defaultRuleThickness,i=s;e.style.idn.height+n.depth+l&&(l=(l+p-n.height-n.depth)/2);var x=d.height-n.height-l-h;n.style.paddingLeft=Le(m);var v=pe.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+x)},{type:"elem",elem:d},{type:"kern",size:h}]},e);if(t.index){var b=e.havingStyle(at.SCRIPTSCRIPT),k=Kt(t.index,b,e),O=.6*(v.height-v.depth),j=pe.makeVList({positionType:"shift",positionData:-O,children:[{type:"elem",elem:k}]},e),T=pe.makeSpan(["root"],[j]);return pe.makeSpan(["mord","sqrt"],[T,v],e)}else return pe.makeSpan(["mord","sqrt"],[v],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new _e.MathNode("mroot",[zn(n,e),zn(r,e)]):new _e.MathNode("msqrt",[zn(n,e)])}});var jN={display:at.DISPLAY,text:at.TEXT,script:at.SCRIPT,scriptscript:at.SCRIPTSCRIPT};Qe({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t,e){var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!0,n),l=r.slice(1,r.length-5);return{type:"styling",mode:s.mode,style:l,body:i}},htmlBuilder(t,e){var n=jN[t.style],r=e.havingStyle(n).withFont("");return VR(t.body,r,e)},mathmlBuilder(t,e){var n=jN[t.style],r=e.havingStyle(n),s=Fs(t.body,r),i=new _e.MathNode("mstyle",s),l={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},c=l[t.style];return i.setAttribute("scriptlevel",c[0]),i.setAttribute("displaystyle",c[1]),i}});var sue=function(e,n){var r=e.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===at.DISPLAY.size||r.alwaysHandleSupSub);return s?zd:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===at.DISPLAY.size||r.limits);return i?UR:null}else{if(r.type==="accent")return tn.isCharacterBox(r.base)?z5:null;if(r.type==="horizBrace"){var l=!e.sub;return l===r.isOver?QR:null}else return null}else return null};Rc({type:"supsub",htmlBuilder(t,e){var n=sue(t,e);if(n)return n(t,e);var{base:r,sup:s,sub:i}=t,l=Kt(r,e),c,d,h=e.fontMetrics(),m=0,p=0,x=r&&tn.isCharacterBox(r);if(s){var v=e.havingStyle(e.style.sup());c=Kt(s,v,e),x||(m=l.height-v.fontMetrics().supDrop*v.sizeMultiplier/e.sizeMultiplier)}if(i){var b=e.havingStyle(e.style.sub());d=Kt(i,b,e),x||(p=l.depth+b.fontMetrics().subDrop*b.sizeMultiplier/e.sizeMultiplier)}var k;e.style===at.DISPLAY?k=h.sup1:e.style.cramped?k=h.sup3:k=h.sup2;var O=e.sizeMultiplier,j=Le(.5/h.ptPerEm/O),T=null;if(d){var A=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(l instanceof Ai||A)&&(T=Le(-l.italic))}var _;if(c&&d){m=Math.max(m,k,c.depth+.25*h.xHeight),p=Math.max(p,h.sub2);var D=h.defaultRuleThickness,E=4*D;if(m-c.depth-(d.height-p)0&&(m+=R,p-=R)}var Q=[{type:"elem",elem:d,shift:p,marginRight:j,marginLeft:T},{type:"elem",elem:c,shift:-m,marginRight:j}];_=pe.makeVList({positionType:"individualShift",children:Q},e)}else if(d){p=Math.max(p,h.sub1,d.height-.8*h.xHeight);var F=[{type:"elem",elem:d,marginLeft:T,marginRight:j}];_=pe.makeVList({positionType:"shift",positionData:p,children:F},e)}else if(c)m=Math.max(m,k,c.depth+.25*h.xHeight),_=pe.makeVList({positionType:"shift",positionData:-m,children:[{type:"elem",elem:c,marginRight:j}]},e);else throw new Error("supsub must have either sup or sub.");var L=N4(l,"right")||"mord";return pe.makeSpan([L],[l,pe.makeSpan(["msupsub"],[_])],e)},mathmlBuilder(t,e){var n=!1,r,s;t.base&&t.base.type==="horizBrace"&&(s=!!t.sup,s===t.base.isOver&&(n=!0,r=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var i=[zn(t.base,e)];t.sub&&i.push(zn(t.sub,e)),t.sup&&i.push(zn(t.sup,e));var l;if(n)l=r?"mover":"munder";else if(t.sub)if(t.sup){var h=t.base;h&&h.type==="op"&&h.limits&&e.style===at.DISPLAY||h&&h.type==="operatorname"&&h.alwaysHandleSupSub&&(e.style===at.DISPLAY||h.limits)?l="munderover":l="msubsup"}else{var d=t.base;d&&d.type==="op"&&d.limits&&(e.style===at.DISPLAY||d.alwaysHandleSupSub)||d&&d.type==="operatorname"&&d.alwaysHandleSupSub&&(d.limits||e.style===at.DISPLAY)?l="munder":l="msub"}else{var c=t.base;c&&c.type==="op"&&c.limits&&(e.style===at.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||e.style===at.DISPLAY)?l="mover":l="msup"}return new _e.MathNode(l,i)}});Rc({type:"atom",htmlBuilder(t,e){return pe.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[Mi(t.text,t.mode)]);if(t.family==="bin"){var r=D5(t,e);r==="bold-italic"&&n.setAttribute("mathvariant",r)}else t.family==="punct"?n.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&n.setAttribute("stretchy","false");return n}});var WR={mi:"italic",mn:"normal",mtext:"normal"};Rc({type:"mathord",htmlBuilder(t,e){return pe.makeOrd(t,e,"mathord")},mathmlBuilder(t,e){var n=new _e.MathNode("mi",[Mi(t.text,t.mode,e)]),r=D5(t,e)||"italic";return r!==WR[n.type]&&n.setAttribute("mathvariant",r),n}});Rc({type:"textord",htmlBuilder(t,e){return pe.makeOrd(t,e,"textord")},mathmlBuilder(t,e){var n=Mi(t.text,t.mode,e),r=D5(t,e)||"normal",s;return t.mode==="text"?s=new _e.MathNode("mtext",[n]):/[0-9]/.test(t.text)?s=new _e.MathNode("mn",[n]):t.text==="\\prime"?s=new _e.MathNode("mo",[n]):s=new _e.MathNode("mi",[n]),r!==WR[s.type]&&s.setAttribute("mathvariant",r),s}});var Fb={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Qb={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Rc({type:"spacing",htmlBuilder(t,e){if(Qb.hasOwnProperty(t.text)){var n=Qb[t.text].className||"";if(t.mode==="text"){var r=pe.makeOrd(t,e,"textord");return r.classes.push(n),r}else return pe.makeSpan(["mspace",n],[pe.mathsym(t.text,t.mode,e)],e)}else{if(Fb.hasOwnProperty(t.text))return pe.makeSpan(["mspace",Fb[t.text]],[],e);throw new De('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(Qb.hasOwnProperty(t.text))n=new _e.MathNode("mtext",[new _e.TextNode(" ")]);else{if(Fb.hasOwnProperty(t.text))return new _e.MathNode("mspace");throw new De('Unknown type of space "'+t.text+'"')}return n}});var NN=()=>{var t=new _e.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};Rc({type:"tag",mathmlBuilder(t,e){var n=new _e.MathNode("mtable",[new _e.MathNode("mtr",[NN(),new _e.MathNode("mtd",[wo(t.body,e)]),NN(),new _e.MathNode("mtd",[wo(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var CN={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},TN={"\\textbf":"textbf","\\textmd":"textmd"},iue={"\\textit":"textit","\\textup":"textup"},AN=(t,e)=>{var n=t.font;if(n){if(CN[n])return e.withTextFontFamily(CN[n]);if(TN[n])return e.withTextFontWeight(TN[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(iue[n])};Qe({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"text",mode:n.mode,body:ar(s),font:r}},htmlBuilder(t,e){var n=AN(t,e),r=Ar(t.body,n,!0);return pe.makeSpan(["mord","text"],r,n)},mathmlBuilder(t,e){var n=AN(t,e);return wo(t.body,n)}});Qe({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"underline",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Kt(t.body,e),r=pe.makeLineSpan("underline-line",e),s=e.fontMetrics().defaultRuleThickness,i=pe.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]},e);return pe.makeSpan(["mord","underline"],[i],e)},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[new _e.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new _e.MathNode("munder",[zn(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});Qe({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"vcenter",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Kt(t.body,e),r=e.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return pe.makeVList({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){return new _e.MathNode("mpadded",[zn(t.body,e)],["vcenter"])}});Qe({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new De("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=MN(t),r=[],s=e.havingStyle(e.style.text()),i=0;it.body.replace(/ /g,t.star?"␣":" "),io=gR,GR=`[ \r + ]`,aue="\\\\[a-zA-Z@]+",lue="\\\\[^\uD800-\uDFFF]",oue="("+aue+")"+GR+"*",cue=`\\\\( +|[ \r ]+ +?)[ \r ]*`,M4="[̀-ͯ]",uue=new RegExp(M4+"+$"),due="("+GR+"+)|"+(cue+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(M4+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(M4+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+oue)+("|"+lue+")");class EN{constructor(e,n){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=n,this.tokenRegex=new RegExp(due,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,n){this.catcodes[e]=n}lex(){var e=this.input,n=this.tokenRegex.lastIndex;if(n===e.length)return new ii("EOF",new Ts(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new De("Unexpected character: '"+e[n]+"'",new ii(e[n],new Ts(this,n,n+1)));var s=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[s]===14){var i=e.indexOf(` +`,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new ii(s,new Ts(this,n,this.tokenRegex.lastIndex))}}class hue{constructor(e,n){e===void 0&&(e={}),n===void 0&&(n={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=n,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new De("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var n in e)e.hasOwnProperty(n)&&(e[n]==null?delete this.current[n]:this.current[n]=e[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,n,r){if(r===void 0&&(r=!1),r){for(var s=0;s0&&(this.undefStack[this.undefStack.length-1][e]=n)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(e)&&(i[e]=this.current[e])}n==null?delete this.current[e]:this.current[e]=n}}var fue=BR;q("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});q("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});q("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});q("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});q("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var n=t.future();return e[0].length===1&&e[0][0].text===n.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});q("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");q("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var _N={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};q("\\char",function(t){var e=t.popToken(),n,r="";if(e.text==="'")n=8,e=t.popToken();else if(e.text==='"')n=16,e=t.popToken();else if(e.text==="`")if(e=t.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new De("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=_N[e.text],r==null||r>=n)throw new De("Invalid base-"+n+" digit "+e.text);for(var s;(s=_N[t.future().text])!=null&&s{var s=t.consumeArg().tokens;if(s.length!==1)throw new De("\\newcommand's first argument must be a macro name");var i=s[0].text,l=t.isDefined(i);if(l&&!e)throw new De("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!l&&!n)throw new De("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var c=0;if(s=t.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var d="",h=t.expandNextToken();h.text!=="]"&&h.text!=="EOF";)d+=h.text,h=t.expandNextToken();if(!d.match(/^\s*[0-9]+\s*$/))throw new De("Invalid number of arguments: "+d);c=parseInt(d),s=t.consumeArg().tokens}return l&&r||t.macros.set(i,{tokens:s,numArgs:c}),""};q("\\newcommand",t=>$5(t,!1,!0,!1));q("\\renewcommand",t=>$5(t,!0,!1,!1));q("\\providecommand",t=>$5(t,!0,!0,!0));q("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});q("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});q("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),io[n],Ln.math[n],Ln.text[n]),""});q("\\bgroup","{");q("\\egroup","}");q("~","\\nobreakspace");q("\\lq","`");q("\\rq","'");q("\\aa","\\r a");q("\\AA","\\r A");q("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");q("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");q("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");q("ℬ","\\mathscr{B}");q("ℰ","\\mathscr{E}");q("ℱ","\\mathscr{F}");q("ℋ","\\mathscr{H}");q("ℐ","\\mathscr{I}");q("ℒ","\\mathscr{L}");q("ℳ","\\mathscr{M}");q("ℛ","\\mathscr{R}");q("ℭ","\\mathfrak{C}");q("ℌ","\\mathfrak{H}");q("ℨ","\\mathfrak{Z}");q("\\Bbbk","\\Bbb{k}");q("·","\\cdotp");q("\\llap","\\mathllap{\\textrm{#1}}");q("\\rlap","\\mathrlap{\\textrm{#1}}");q("\\clap","\\mathclap{\\textrm{#1}}");q("\\mathstrut","\\vphantom{(}");q("\\underbar","\\underline{\\text{#1}}");q("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');q("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");q("\\ne","\\neq");q("≠","\\neq");q("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");q("∉","\\notin");q("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");q("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");q("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");q("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");q("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");q("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");q("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");q("⟂","\\perp");q("‼","\\mathclose{!\\mkern-0.8mu!}");q("∌","\\notni");q("⌜","\\ulcorner");q("⌝","\\urcorner");q("⌞","\\llcorner");q("⌟","\\lrcorner");q("©","\\copyright");q("®","\\textregistered");q("️","\\textregistered");q("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');q("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');q("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');q("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');q("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");q("⋮","\\vdots");q("\\varGamma","\\mathit{\\Gamma}");q("\\varDelta","\\mathit{\\Delta}");q("\\varTheta","\\mathit{\\Theta}");q("\\varLambda","\\mathit{\\Lambda}");q("\\varXi","\\mathit{\\Xi}");q("\\varPi","\\mathit{\\Pi}");q("\\varSigma","\\mathit{\\Sigma}");q("\\varUpsilon","\\mathit{\\Upsilon}");q("\\varPhi","\\mathit{\\Phi}");q("\\varPsi","\\mathit{\\Psi}");q("\\varOmega","\\mathit{\\Omega}");q("\\substack","\\begin{subarray}{c}#1\\end{subarray}");q("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");q("\\boxed","\\fbox{$\\displaystyle{#1}$}");q("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");q("\\implies","\\DOTSB\\;\\Longrightarrow\\;");q("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");q("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");q("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var DN={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};q("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in DN?e=DN[n]:(n.slice(0,4)==="\\not"||n in Ln.math&&["bin","rel"].includes(Ln.math[n].group))&&(e="\\dotsb"),e});var H5={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};q("\\dotso",function(t){var e=t.future().text;return e in H5?"\\ldots\\,":"\\ldots"});q("\\dotsc",function(t){var e=t.future().text;return e in H5&&e!==","?"\\ldots\\,":"\\ldots"});q("\\cdots",function(t){var e=t.future().text;return e in H5?"\\@cdots\\,":"\\@cdots"});q("\\dotsb","\\cdots");q("\\dotsm","\\cdots");q("\\dotsi","\\!\\cdots");q("\\dotsx","\\ldots\\,");q("\\DOTSI","\\relax");q("\\DOTSB","\\relax");q("\\DOTSX","\\relax");q("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");q("\\,","\\tmspace+{3mu}{.1667em}");q("\\thinspace","\\,");q("\\>","\\mskip{4mu}");q("\\:","\\tmspace+{4mu}{.2222em}");q("\\medspace","\\:");q("\\;","\\tmspace+{5mu}{.2777em}");q("\\thickspace","\\;");q("\\!","\\tmspace-{3mu}{.1667em}");q("\\negthinspace","\\!");q("\\negmedspace","\\tmspace-{4mu}{.2222em}");q("\\negthickspace","\\tmspace-{5mu}{.277em}");q("\\enspace","\\kern.5em ");q("\\enskip","\\hskip.5em\\relax");q("\\quad","\\hskip1em\\relax");q("\\qquad","\\hskip2em\\relax");q("\\tag","\\@ifstar\\tag@literal\\tag@paren");q("\\tag@paren","\\tag@literal{({#1})}");q("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new De("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});q("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");q("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");q("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");q("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");q("\\newline","\\\\\\relax");q("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var XR=Le(pa["Main-Regular"][84][1]-.7*pa["Main-Regular"][65][1]);q("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+XR+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");q("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+XR+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");q("\\hspace","\\@ifstar\\@hspacer\\@hspace");q("\\@hspace","\\hskip #1\\relax");q("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");q("\\ordinarycolon",":");q("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");q("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');q("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');q("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');q("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');q("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');q("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');q("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');q("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');q("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');q("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');q("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');q("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');q("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');q("∷","\\dblcolon");q("∹","\\eqcolon");q("≔","\\coloneqq");q("≕","\\eqqcolon");q("⩴","\\Coloneqq");q("\\ratio","\\vcentcolon");q("\\coloncolon","\\dblcolon");q("\\colonequals","\\coloneqq");q("\\coloncolonequals","\\Coloneqq");q("\\equalscolon","\\eqqcolon");q("\\equalscoloncolon","\\Eqqcolon");q("\\colonminus","\\coloneq");q("\\coloncolonminus","\\Coloneq");q("\\minuscolon","\\eqcolon");q("\\minuscoloncolon","\\Eqcolon");q("\\coloncolonapprox","\\Colonapprox");q("\\coloncolonsim","\\Colonsim");q("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");q("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");q("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");q("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");q("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");q("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");q("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");q("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");q("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");q("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");q("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");q("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");q("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");q("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");q("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");q("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");q("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");q("\\nleqq","\\html@mathml{\\@nleqq}{≰}");q("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");q("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");q("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");q("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");q("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");q("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");q("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");q("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");q("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");q("\\imath","\\html@mathml{\\@imath}{ı}");q("\\jmath","\\html@mathml{\\@jmath}{ȷ}");q("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");q("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");q("⟦","\\llbracket");q("⟧","\\rrbracket");q("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");q("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");q("⦃","\\lBrace");q("⦄","\\rBrace");q("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");q("⦵","\\minuso");q("\\darr","\\downarrow");q("\\dArr","\\Downarrow");q("\\Darr","\\Downarrow");q("\\lang","\\langle");q("\\rang","\\rangle");q("\\uarr","\\uparrow");q("\\uArr","\\Uparrow");q("\\Uarr","\\Uparrow");q("\\N","\\mathbb{N}");q("\\R","\\mathbb{R}");q("\\Z","\\mathbb{Z}");q("\\alef","\\aleph");q("\\alefsym","\\aleph");q("\\Alpha","\\mathrm{A}");q("\\Beta","\\mathrm{B}");q("\\bull","\\bullet");q("\\Chi","\\mathrm{X}");q("\\clubs","\\clubsuit");q("\\cnums","\\mathbb{C}");q("\\Complex","\\mathbb{C}");q("\\Dagger","\\ddagger");q("\\diamonds","\\diamondsuit");q("\\empty","\\emptyset");q("\\Epsilon","\\mathrm{E}");q("\\Eta","\\mathrm{H}");q("\\exist","\\exists");q("\\harr","\\leftrightarrow");q("\\hArr","\\Leftrightarrow");q("\\Harr","\\Leftrightarrow");q("\\hearts","\\heartsuit");q("\\image","\\Im");q("\\infin","\\infty");q("\\Iota","\\mathrm{I}");q("\\isin","\\in");q("\\Kappa","\\mathrm{K}");q("\\larr","\\leftarrow");q("\\lArr","\\Leftarrow");q("\\Larr","\\Leftarrow");q("\\lrarr","\\leftrightarrow");q("\\lrArr","\\Leftrightarrow");q("\\Lrarr","\\Leftrightarrow");q("\\Mu","\\mathrm{M}");q("\\natnums","\\mathbb{N}");q("\\Nu","\\mathrm{N}");q("\\Omicron","\\mathrm{O}");q("\\plusmn","\\pm");q("\\rarr","\\rightarrow");q("\\rArr","\\Rightarrow");q("\\Rarr","\\Rightarrow");q("\\real","\\Re");q("\\reals","\\mathbb{R}");q("\\Reals","\\mathbb{R}");q("\\Rho","\\mathrm{P}");q("\\sdot","\\cdot");q("\\sect","\\S");q("\\spades","\\spadesuit");q("\\sub","\\subset");q("\\sube","\\subseteq");q("\\supe","\\supseteq");q("\\Tau","\\mathrm{T}");q("\\thetasym","\\vartheta");q("\\weierp","\\wp");q("\\Zeta","\\mathrm{Z}");q("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");q("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");q("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");q("\\bra","\\mathinner{\\langle{#1}|}");q("\\ket","\\mathinner{|{#1}\\rangle}");q("\\braket","\\mathinner{\\langle{#1}\\rangle}");q("\\Bra","\\left\\langle#1\\right|");q("\\Ket","\\left|#1\\right\\rangle");var YR=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,s=e.consumeArg().tokens,i=e.consumeArg().tokens,l=e.macros.get("|"),c=e.macros.get("\\|");e.macros.beginGroup();var d=p=>x=>{t&&(x.macros.set("|",l),s.length&&x.macros.set("\\|",c));var v=p;if(!p&&s.length){var b=x.future();b.text==="|"&&(x.popToken(),v=!0)}return{tokens:v?s:r,numArgs:0}};e.macros.set("|",d(!1)),s.length&&e.macros.set("\\|",d(!0));var h=e.consumeArg().tokens,m=e.expandTokens([...i,...h,...n]);return e.macros.endGroup(),{tokens:m.reverse(),numArgs:0}};q("\\bra@ket",YR(!1));q("\\bra@set",YR(!0));q("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");q("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");q("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");q("\\angln","{\\angl n}");q("\\blue","\\textcolor{##6495ed}{#1}");q("\\orange","\\textcolor{##ffa500}{#1}");q("\\pink","\\textcolor{##ff00af}{#1}");q("\\red","\\textcolor{##df0030}{#1}");q("\\green","\\textcolor{##28ae7b}{#1}");q("\\gray","\\textcolor{gray}{#1}");q("\\purple","\\textcolor{##9d38bd}{#1}");q("\\blueA","\\textcolor{##ccfaff}{#1}");q("\\blueB","\\textcolor{##80f6ff}{#1}");q("\\blueC","\\textcolor{##63d9ea}{#1}");q("\\blueD","\\textcolor{##11accd}{#1}");q("\\blueE","\\textcolor{##0c7f99}{#1}");q("\\tealA","\\textcolor{##94fff5}{#1}");q("\\tealB","\\textcolor{##26edd5}{#1}");q("\\tealC","\\textcolor{##01d1c1}{#1}");q("\\tealD","\\textcolor{##01a995}{#1}");q("\\tealE","\\textcolor{##208170}{#1}");q("\\greenA","\\textcolor{##b6ffb0}{#1}");q("\\greenB","\\textcolor{##8af281}{#1}");q("\\greenC","\\textcolor{##74cf70}{#1}");q("\\greenD","\\textcolor{##1fab54}{#1}");q("\\greenE","\\textcolor{##0d923f}{#1}");q("\\goldA","\\textcolor{##ffd0a9}{#1}");q("\\goldB","\\textcolor{##ffbb71}{#1}");q("\\goldC","\\textcolor{##ff9c39}{#1}");q("\\goldD","\\textcolor{##e07d10}{#1}");q("\\goldE","\\textcolor{##a75a05}{#1}");q("\\redA","\\textcolor{##fca9a9}{#1}");q("\\redB","\\textcolor{##ff8482}{#1}");q("\\redC","\\textcolor{##f9685d}{#1}");q("\\redD","\\textcolor{##e84d39}{#1}");q("\\redE","\\textcolor{##bc2612}{#1}");q("\\maroonA","\\textcolor{##ffbde0}{#1}");q("\\maroonB","\\textcolor{##ff92c6}{#1}");q("\\maroonC","\\textcolor{##ed5fa6}{#1}");q("\\maroonD","\\textcolor{##ca337c}{#1}");q("\\maroonE","\\textcolor{##9e034e}{#1}");q("\\purpleA","\\textcolor{##ddd7ff}{#1}");q("\\purpleB","\\textcolor{##c6b9fc}{#1}");q("\\purpleC","\\textcolor{##aa87ff}{#1}");q("\\purpleD","\\textcolor{##7854ab}{#1}");q("\\purpleE","\\textcolor{##543b78}{#1}");q("\\mintA","\\textcolor{##f5f9e8}{#1}");q("\\mintB","\\textcolor{##edf2df}{#1}");q("\\mintC","\\textcolor{##e0e5cc}{#1}");q("\\grayA","\\textcolor{##f6f7f7}{#1}");q("\\grayB","\\textcolor{##f0f1f2}{#1}");q("\\grayC","\\textcolor{##e3e5e6}{#1}");q("\\grayD","\\textcolor{##d6d8da}{#1}");q("\\grayE","\\textcolor{##babec2}{#1}");q("\\grayF","\\textcolor{##888d93}{#1}");q("\\grayG","\\textcolor{##626569}{#1}");q("\\grayH","\\textcolor{##3b3e40}{#1}");q("\\grayI","\\textcolor{##21242c}{#1}");q("\\kaBlue","\\textcolor{##314453}{#1}");q("\\kaGreen","\\textcolor{##71B307}{#1}");var KR={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class mue{constructor(e,n,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(e),this.macros=new hue(fue,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new EN(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var n,r,s;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:s,end:r}=this.consumeArg(["]"])}else({tokens:s,start:n,end:r}=this.consumeArg());return this.pushToken(new ii("EOF",r.loc)),this.pushTokens(s),new ii("",Ts.range(n,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var n=[],r=e&&e.length>0;r||this.consumeSpaces();var s=this.future(),i,l=0,c=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++l;else if(i.text==="}"){if(--l,l===-1)throw new De("Extra }",i)}else if(i.text==="EOF")throw new De("Unexpected end of input in a macro argument, expected '"+(e&&r?e[c]:"}")+"'",i);if(e&&r)if((l===0||l===1&&e[c]==="{")&&i.text===e[c]){if(++c,c===e.length){n.splice(-c,c);break}}else c=0}while(l!==0||r);return s.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:s,end:i}}consumeArgs(e,n){if(n){if(n.length!==e+1)throw new De("The length of delimiters doesn't match the number of args!");for(var r=n[0],s=0;sthis.settings.maxExpand)throw new De("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var n=this.popToken(),r=n.text,s=n.noexpand?null:this._getExpansion(r);if(s==null||e&&s.unexpandable){if(e&&s==null&&r[0]==="\\"&&!this.isDefined(r))throw new De("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var i=s.tokens,l=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var c=i.length-1;c>=0;--c){var d=i[c];if(d.text==="#"){if(c===0)throw new De("Incomplete placeholder at end of macro body",d);if(d=i[--c],d.text==="#")i.splice(c+1,1);else if(/^[1-9]$/.test(d.text))i.splice(c,2,...l[+d.text-1]);else throw new De("Not a valid argument number",d)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new ii(e)]):void 0}expandTokens(e){var n=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),n.push(s)}return this.countExpansion(n.length),n}expandMacroAsText(e){var n=this.expandMacro(e);return n&&n.map(r=>r.text).join("")}_getExpansion(e){var n=this.macros.get(e);if(n==null)return n;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var s=typeof n=="function"?n(this):n;if(typeof s=="string"){var i=0;if(s.indexOf("#")!==-1)for(var l=s.replace(/##/g,"");l.indexOf("#"+(i+1))!==-1;)++i;for(var c=new EN(s,this.settings),d=[],h=c.lex();h.text!=="EOF";)d.push(h),h=c.lex();d.reverse();var m={tokens:d,numArgs:i};return m}return s}isDefined(e){return this.macros.has(e)||io.hasOwnProperty(e)||Ln.math.hasOwnProperty(e)||Ln.text.hasOwnProperty(e)||KR.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:io.hasOwnProperty(e)&&!io[e].primitive}}var RN=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Pp=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),$b={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},zN={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Xx{constructor(e,n){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new mue(e,n,this.mode),this.settings=n,this.leftrightDepth=0}expect(e,n){if(n===void 0&&(n=!0),this.fetch().text!==e)throw new De("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var n=this.nextToken;this.consume(),this.gullet.pushToken(new ii("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,r}parseExpression(e,n){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var s=this.fetch();if(Xx.endOfExpression.indexOf(s.text)!==-1||n&&s.text===n||e&&io[s.text]&&io[s.text].infix)break;var i=this.parseAtom(n);if(i){if(i.type==="internal")continue}else break;r.push(i)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var n=-1,r,s=0;s=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var c=Ln[this.mode][n].group,d=Ts.range(e),h;if(nce.hasOwnProperty(c)){var m=c;h={type:"atom",mode:this.mode,family:m,loc:d,text:n}}else h={type:c,mode:this.mode,loc:d,text:n};l=h}else if(n.charCodeAt(0)>=128)this.settings.strict&&(aR(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),e)),l={type:"textord",mode:"text",loc:Ts.range(e),text:n};else return null;if(this.consume(),i)for(var p=0;ph&&(h=m):m&&(h!==void 0&&h>-1&&d.push(` +`.repeat(h)||" "),h=-1,d.push(m))}return d.join("")}function sz(t,e,n){return t.type==="element"?Uue(t,e,n):t.type==="text"?n.whitespace==="normal"?iz(t,n):Vue(t):[]}function Uue(t,e,n){const r=az(t,n),s=t.children||[];let i=-1,l=[];if($ue(t))return l;let c,d;for(_4(t)||HN(t)&&qN(e,t,HN)?d=` +`:Que(t)?(c=2,d=2):rz(t)&&(c=1,d=1);++i{try{i(!0);const Oe=await nde({page:l,page_size:m,search:x||void 0,is_registered:b==="all"?void 0:b==="registered",is_banned:O==="all"?void 0:O==="banned",format:T==="all"?void 0:T,sort_by:"usage_count",sort_order:"desc"});e(Oe.data),h(Oe.total)}catch(Oe){const nt=Oe instanceof Error?Oe.message:"加载表情包列表失败";ne({title:"错误",description:nt,variant:"destructive"})}finally{i(!1)}},[l,m,x,b,O,T,ne]),z=async()=>{try{const Oe=await ade();r(Oe.data)}catch(Oe){console.error("加载统计数据失败:",Oe)}};S.useEffect(()=>{ce()},[ce]),S.useEffect(()=>{z()},[]);const xe=async Oe=>{try{const nt=await rde(Oe.id);D(nt.data),R(!0)}catch(nt){const ut=nt instanceof Error?nt.message:"加载详情失败";ne({title:"错误",description:ut,variant:"destructive"})}},Y=Oe=>{D(Oe),F(!0)},P=Oe=>{D(Oe),U(!0)},K=async()=>{if(_)try{await ide(_.id),ne({title:"成功",description:"表情包已删除"}),U(!1),D(null),ce(),z()}catch(Oe){const nt=Oe instanceof Error?Oe.message:"删除失败";ne({title:"错误",description:nt,variant:"destructive"})}},H=async Oe=>{try{await lde(Oe.id),ne({title:"成功",description:"表情包已注册"}),ce(),z()}catch(nt){const ut=nt instanceof Error?nt.message:"注册失败";ne({title:"错误",description:ut,variant:"destructive"})}},fe=async Oe=>{try{await ode(Oe.id),ne({title:"成功",description:"表情包已封禁"}),ce(),z()}catch(nt){const ut=nt instanceof Error?nt.message:"封禁失败";ne({title:"错误",description:ut,variant:"destructive"})}},ve=Oe=>{const nt=new Set(V);nt.has(Oe)?nt.delete(Oe):nt.add(Oe),de(nt)},Re=()=>{V.size===t.length&&t.length>0?de(new Set):de(new Set(t.map(Oe=>Oe.id)))},ue=async()=>{try{const Oe=await cde(Array.from(V));ne({title:"批量删除完成",description:Oe.message}),de(new Set),J(!1),ce(),z()}catch(Oe){ne({title:"批量删除失败",description:Oe instanceof Error?Oe.message:"批量删除失败",variant:"destructive"})}},We=()=>{const Oe=parseInt($),nt=Math.ceil(d/m);Oe>=1&&Oe<=nt?(c(Oe),ae("")):ne({title:"无效的页码",description:`请输入1-${nt}之间的页码`,variant:"destructive"})},ct=n?.formats?Object.keys(n.formats):[];return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsxs("div",{className:"mb-4 sm:mb-6",children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),a.jsx(vn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&a.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"总数"}),a.jsx(Gt,{className:"text-2xl",children:n.total})]})}),a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"已注册"}),a.jsx(Gt,{className:"text-2xl text-green-600",children:n.registered})]})}),a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"已封禁"}),a.jsx(Gt,{className:"text-2xl text-red-600",children:n.banned})]})}),a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"未注册"}),a.jsx(Gt,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),a.jsxs(gt,{children:[a.jsx(Wt,{children:a.jsxs(Gt,{className:"flex items-center gap-2",children:[a.jsx(t2,{className:"h-5 w-5"}),"搜索和筛选"]})}),a.jsxs(an,{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"搜索"}),a.jsxs("div",{className:"relative",children:[a.jsx(Bs,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"描述或哈希值...",value:x,onChange:Oe=>{v(Oe.target.value),c(1)},className:"pl-8"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"注册状态"}),a.jsxs(Lt,{value:b,onValueChange:Oe=>{k(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"registered",children:"已注册"}),a.jsx(Pe,{value:"unregistered",children:"未注册"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"封禁状态"}),a.jsxs(Lt,{value:O,onValueChange:Oe=>{j(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"banned",children:"已封禁"}),a.jsx(Pe,{value:"unbanned",children:"未封禁"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"格式"}),a.jsxs(Lt,{value:T,onValueChange:Oe=>{A(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),ct.map(Oe=>a.jsxs(Pe,{value:Oe,children:[Oe.toUpperCase()," (",n?.formats[Oe],")"]},Oe))]})]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:V.size>0&&a.jsxs("span",{children:["已选择 ",V.size," 个表情包"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:m.toString(),onValueChange:Oe=>{p(parseInt(Oe)),c(1),de(new Set)},children:[a.jsx(Dt,{id:"emoji-page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),V.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>de(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:()=>J(!0),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),a.jsx("div",{className:"flex justify-end pt-4 border-t",children:a.jsxs(ie,{variant:"outline",size:"sm",onClick:ce,disabled:s,children:[a.jsx(Fi,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"表情包列表"}),a.jsxs(Sr,{children:["共 ",d," 个表情包,当前第 ",l," 页"]})]}),a.jsxs(an,{children:[a.jsx("div",{className:"hidden md:block rounded-md border overflow-hidden",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:t.length>0&&V.size===t.length,onCheckedChange:Re,"aria-label":"全选"})}),a.jsx(xt,{className:"w-16",children:"预览"}),a.jsx(xt,{children:"描述"}),a.jsx(xt,{children:"格式"}),a.jsx(xt,{children:"情绪标签"}),a.jsx(xt,{className:"text-center",children:"状态"}),a.jsx(xt,{className:"text-right",children:"使用次数"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(Oe=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:V.has(Oe.id),onCheckedChange:()=>ve(Oe.id),"aria-label":`选择 ${Oe.description}`})}),a.jsx(it,{children:a.jsx("div",{className:"w-20 h-20 bg-muted rounded flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(Oe.id),alt:Oe.description||"表情包",className:"w-full h-full object-cover",onError:nt=>{const ut=nt.target;ut.style.display="none";const Ct=ut.parentElement;Ct&&(Ct.innerHTML='')}})})}),a.jsx(it,{children:a.jsxs("div",{className:"space-y-1 max-w-xs",children:[a.jsx("div",{className:"font-medium truncate",title:Oe.description||"无描述",children:Oe.description||"无描述"}),a.jsxs("div",{className:"text-xs text-muted-foreground font-mono",children:[Oe.emoji_hash.slice(0,16),"..."]})]})}),a.jsx(it,{children:a.jsx(On,{variant:"outline",children:Oe.format.toUpperCase()})}),a.jsx(it,{children:a.jsx(UN,{emotions:Oe.emotion})}),a.jsx(it,{className:"align-middle",children:a.jsxs("div",{className:"flex gap-2 justify-center",children:[Oe.is_registered&&a.jsxs(On,{variant:"default",className:"bg-green-600",children:[a.jsx(Es,{className:"h-3 w-3 mr-1"}),"已注册"]}),Oe.is_banned&&a.jsxs(On,{variant:"destructive",children:[a.jsx(Kb,{className:"h-3 w-3 mr-1"}),"已封禁"]})]})}),a.jsx(it,{className:"text-right font-mono",children:Oe.usage_count}),a.jsx(it,{children:a.jsxs("div",{className:"flex items-center justify-end gap-1 flex-wrap",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>xe(Oe),children:[a.jsx(co,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Y(Oe),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),!Oe.is_registered&&a.jsxs(ie,{size:"sm",onClick:()=>H(Oe),className:"bg-green-600 hover:bg-green-700 text-white",children:[a.jsx(Es,{className:"h-4 w-4 mr-1"}),"注册"]}),!Oe.is_banned&&a.jsxs(ie,{size:"sm",onClick:()=>fe(Oe),className:"bg-orange-600 hover:bg-orange-700 text-white",children:[a.jsx(cO,{className:"h-4 w-4 mr-1"}),"封禁"]}),a.jsxs(ie,{size:"sm",onClick:()=>P(Oe),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},Oe.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3",children:t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(Oe=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex gap-3",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("div",{className:"w-16 h-16 bg-muted rounded flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(Oe.id),alt:Oe.description||"表情包",className:"w-full h-full object-cover",onError:nt=>{const ut=nt.target;ut.style.display="none";const Ct=ut.parentElement;Ct&&(Ct.innerHTML='')}})})}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[a.jsxs("div",{className:"min-w-0 w-full overflow-hidden",children:[a.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",title:Oe.description||"无描述",children:Oe.description||"无描述"}),a.jsxs("p",{className:"text-xs text-muted-foreground font-mono line-clamp-1 w-full break-all",children:[Oe.emoji_hash.slice(0,16),"..."]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 items-center min-w-0",children:[a.jsx(On,{variant:"outline",className:"text-xs flex-shrink-0",children:Oe.format.toUpperCase()}),Oe.is_registered&&a.jsxs(On,{variant:"default",className:"bg-green-600 text-xs flex-shrink-0",children:[a.jsx(Es,{className:"h-3 w-3 mr-1"}),"已注册"]}),Oe.is_banned&&a.jsxs(On,{variant:"destructive",className:"text-xs flex-shrink-0",children:[a.jsx(Kb,{className:"h-3 w-3 mr-1"}),"已封禁"]}),a.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:["使用: ",Oe.usage_count]})]}),Oe.emotion&&Oe.emotion.length>0&&a.jsx("div",{className:"min-w-0 overflow-hidden",children:a.jsx(UN,{emotions:Oe.emotion})})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>xe(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(co,{className:"h-3 w-3 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Y(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),!Oe.is_registered&&a.jsxs(ie,{size:"sm",onClick:()=>H(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-green-600 hover:bg-green-700 text-white",children:[a.jsx(Es,{className:"h-3 w-3 mr-1"}),"注册"]}),!Oe.is_banned&&a.jsxs(ie,{size:"sm",onClick:()=>fe(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-orange-600 hover:bg-orange-700 text-white",children:[a.jsx(cO,{className:"h-3 w-3 mr-1"}),"封禁"]}),a.jsxs(ie,{size:"sm",onClick:()=>P(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},Oe.id))}),d>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(l-1)*m+1," 到"," ",Math.min(l*m,d)," 条,共 ",d," 条"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(Oe=>Math.max(1,Oe-1)),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:$,onChange:Oe=>ae(Oe.target.value),onKeyDown:Oe=>Oe.key==="Enter"&&We(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/m)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:We,disabled:!$,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(Oe=>Oe+1),disabled:l>=Math.ceil(d/m),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(d/m)),disabled:l>=Math.ceil(d/m),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]}),a.jsx(dde,{emoji:_,open:E,onOpenChange:R}),a.jsx(hde,{emoji:_,open:Q,onOpenChange:F,onSuccess:()=>{ce(),z()}})]})}),a.jsx(mn,{open:W,onOpenChange:J,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["你确定要删除选中的 ",V.size," 个表情包吗?此操作不可撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:ue,children:"确认删除"})]})]})}),a.jsx(Rr,{open:L,onOpenChange:U,children:a.jsxs(Nr,{children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"确认删除"}),a.jsx(Gr,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>U(!1),children:"取消"}),a.jsx(ie,{variant:"destructive",onClick:K,children:"删除"})]})]})})]})}function dde({emoji:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[90vh]",children:[a.jsx(Cr,{children:a.jsx(Tr,{children:"表情包详情"})}),a.jsx(vn,{className:"max-h-[calc(90vh-8rem)] pr-4",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex justify-center",children:a.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(t.id),alt:t.description||"表情包",className:"w-full h-full object-cover",onError:s=>{const i=s.target;i.style.display="none";const l=i.parentElement;l&&(l.innerHTML='')}})})}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"ID"}),a.jsx("div",{className:"mt-1 font-mono",children:t.id})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"格式"}),a.jsx("div",{className:"mt-1",children:a.jsx(On,{variant:"outline",children:t.format.toUpperCase()})})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"文件路径"}),a.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.full_path})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"哈希值"}),a.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.emoji_hash})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"描述"}),t.description?a.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:a.jsx(tde,{className:"prose-sm",children:t.description})}):a.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"情绪标签"}),a.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:(()=>{const s=t.emotion?t.emotion.split(/[,,]/).map(i=>i.trim()).filter(Boolean):[];return s.length>0?s.map((i,l)=>a.jsx(On,{variant:"secondary",children:i},l)):a.jsx("span",{className:"text-sm text-muted-foreground",children:"无"})})()})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"状态"}),a.jsxs("div",{className:"mt-2 flex gap-2",children:[t.is_registered&&a.jsx(On,{variant:"default",className:"bg-green-600",children:"已注册"}),t.is_banned&&a.jsx(On,{variant:"destructive",children:"已封禁"}),!t.is_registered&&!t.is_banned&&a.jsx(On,{variant:"outline",children:"未注册"})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"使用次数"}),a.jsx("div",{className:"mt-1 font-mono text-lg",children:t.usage_count})]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"记录时间"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.record_time)})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"注册时间"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.register_time)})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"最后使用"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.last_used_time)})]})]})})]})})}function hde({emoji:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState(""),[l,c]=S.useState(""),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState(!1),{toast:b}=Pr();S.useEffect(()=>{t&&(i(t.description||""),c(t.emotion||""),h(t.is_registered),p(t.is_banned))},[t]);const k=async()=>{if(t)try{v(!0);const O=l.split(/[,,]/).map(j=>j.trim()).filter(Boolean).join(",");await sde(t.id,{description:s||void 0,emotion:O||void 0,is_registered:d,is_banned:m}),b({title:"成功",description:"表情包信息已更新"}),n(!1),r()}catch(O){const j=O instanceof Error?O.message:"保存失败";b({title:"错误",description:j,variant:"destructive"})}finally{v(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑表情包"}),a.jsx(Gr,{children:"修改表情包的描述和标签信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(te,{children:"描述"}),a.jsx(_n,{value:s,onChange:O=>i(O.target.value),placeholder:"输入表情包描述...",rows:3,className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(te,{children:"情绪标签"}),a.jsx(Me,{value:l,onChange:O=>c(O.target.value),placeholder:"使用逗号分隔多个标签,如:开心, 微笑, 快乐",className:"mt-1"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入多个标签时使用逗号分隔(支持中英文逗号)"})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"is_registered",checked:d,onCheckedChange:O=>h(O===!0)}),a.jsx(te,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"is_banned",checked:m,onCheckedChange:O=>p(O===!0)}),a.jsx(te,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:k,disabled:x,children:x?"保存中...":"保存"})]})]})}):null}function UN({emotions:t}){const e=t?t.split(/[,,]/).map(i=>i.trim()).filter(Boolean):[];if(e.length===0)return a.jsx("span",{className:"text-xs text-muted-foreground",children:"-"});const n=(i,l=6)=>i.length<=l?i:i.slice(0,l)+"...",r=e.slice(0,3),s=e.length-3;return a.jsxs("div",{className:"flex flex-wrap gap-1 max-w-full overflow-hidden",children:[r.map((i,l)=>a.jsx(On,{variant:"secondary",className:"text-xs flex-shrink-0",title:i,children:n(i)},l)),s>0&&a.jsxs(On,{variant:"outline",className:"text-xs flex-shrink-0",title:`还有 ${s} 个标签: ${e.slice(3).join(", ")}`,children:["+",s]})]})}const Pc="/api/webui/expression";async function fde(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.chat_id&&e.append("chat_id",t.chat_id);const n=await ot(`${Pc}/list?${e}`,{headers:bt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取表达方式列表失败")}return n.json()}async function mde(t){const e=await ot(`${Pc}/${t}`,{headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取表达方式详情失败")}return e.json()}async function pde(t){const e=await ot(`${Pc}/`,{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"创建表达方式失败")}return e.json()}async function gde(t,e){const n=await ot(`${Pc}/${t}`,{method:"PATCH",headers:bt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新表达方式失败")}return n.json()}async function xde(t){const e=await ot(`${Pc}/${t}`,{method:"DELETE",headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除表达方式失败")}return e.json()}async function vde(t){const e=await ot(`${Pc}/batch/delete`,{method:"POST",headers:bt(),body:JSON.stringify({ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除表达方式失败")}return e.json()}async function yde(){const t=await ot(`${Pc}/stats/summary`,{headers:bt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}function bde(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(1),[d,h]=S.useState(20),[m,p]=S.useState(""),[x,v]=S.useState(null),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,A]=S.useState(!1),[_,D]=S.useState(null),[E,R]=S.useState(new Set),[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,de]=S.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),{toast:W}=Pr(),J=async()=>{try{r(!0);const H=await fde({page:l,page_size:d,search:m||void 0});e(H.data),i(H.total)}catch(H){W({title:"加载失败",description:H instanceof Error?H.message:"无法加载表达方式",variant:"destructive"})}finally{r(!1)}},$=async()=>{try{const H=await yde();de(H.data)}catch(H){console.error("加载统计数据失败:",H)}};S.useEffect(()=>{J(),$()},[l,d,m]);const ae=async H=>{try{const fe=await mde(H.id);v(fe.data),k(!0)}catch(fe){W({title:"加载详情失败",description:fe instanceof Error?fe.message:"无法加载表达方式详情",variant:"destructive"})}},ne=H=>{v(H),j(!0)},ce=async H=>{try{await xde(H.id),W({title:"删除成功",description:`已删除表达方式: ${H.situation}`}),D(null),J(),$()}catch(fe){W({title:"删除失败",description:fe instanceof Error?fe.message:"无法删除表达方式",variant:"destructive"})}},z=H=>{const fe=new Set(E);fe.has(H)?fe.delete(H):fe.add(H),R(fe)},xe=()=>{E.size===t.length&&t.length>0?R(new Set):R(new Set(t.map(H=>H.id)))},Y=async()=>{try{await vde(Array.from(E)),W({title:"批量删除成功",description:`已删除 ${E.size} 个表达方式`}),R(new Set),F(!1),J(),$()}catch(H){W({title:"批量删除失败",description:H instanceof Error?H.message:"无法批量删除表达方式",variant:"destructive"})}},P=()=>{const H=parseInt(L),fe=Math.ceil(s/d);H>=1&&H<=fe?(c(H),U("")):W({title:"无效的页码",description:`请输入1-${fe}之间的页码`,variant:"destructive"})},K=H=>H?new Date(H*1e3).toLocaleString("zh-CN"):"-";return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsx("div",{className:"mb-4 sm:mb-6",children:a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[a.jsx(Wf,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),a.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),a.jsxs(ie,{onClick:()=>A(!0),className:"gap-2",children:[a.jsx(Wr,{className:"h-4 w-4"}),"新增表达方式"]})]})}),a.jsx(vn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),a.jsx("div",{className:"text-2xl font-bold mt-1",children:V.total})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:V.recent_7days})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:V.chat_count})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx(te,{htmlFor:"search",children:"搜索"}),a.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Bs,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{id:"search",placeholder:"搜索情境、风格或上下文...",value:m,onChange:H=>p(H.target.value),className:"pl-9"})]})}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:E.size>0&&a.jsxs("span",{children:["已选择 ",E.size," 个表达方式"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:d.toString(),onValueChange:H=>{h(parseInt(H)),c(1),R(new Set)},children:[a.jsx(Dt,{id:"page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),E.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>R(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:()=>F(!0),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card",children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:E.size===t.length&&t.length>0,onCheckedChange:xe})}),a.jsx(xt,{children:"情境"}),a.jsx(xt,{children:"风格"}),a.jsx(xt,{children:"聊天ID"}),a.jsx(xt,{children:"最后活跃"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n?a.jsx(xr,{children:a.jsx(it,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(H=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:E.has(H.id),onCheckedChange:()=>z(H.id)})}),a.jsx(it,{className:"font-medium max-w-xs truncate",children:H.situation}),a.jsx(it,{className:"max-w-xs truncate",children:H.style}),a.jsx(it,{className:"font-mono text-sm",children:H.chat_id}),a.jsx(it,{className:"text-sm text-muted-foreground",children:K(H.last_active_time)}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ae(H),children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ne(H),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>D(H),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},H.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(H=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ss,{checked:E.has(H.id),onCheckedChange:()=>z(H.id),className:"mt-1"}),a.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),a.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:H.situation,children:H.situation})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),a.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:H.style,children:H.style})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天ID"}),a.jsx("p",{className:"font-mono text-xs truncate",children:H.chat_id})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后活跃"}),a.jsx("p",{className:"text-xs",children:K(H.last_active_time)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(H),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx($i,{className:"h-3 w-3 mr-1"}),"查看"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ne(H),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>D(H),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},H.id))}),s>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",l," / ",Math.ceil(s/d)," 页"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l-1),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:L,onChange:H=>U(H.target.value),onKeyDown:H=>H.key==="Enter"&&P(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/d)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:P,disabled:!L,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l+1),disabled:l>=Math.ceil(s/d),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(s/d)),disabled:l>=Math.ceil(s/d),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]})}),a.jsx(wde,{expression:x,open:b,onOpenChange:k}),a.jsx(Sde,{open:T,onOpenChange:A,onSuccess:()=>{J(),$(),A(!1)}}),a.jsx(kde,{expression:x,open:O,onOpenChange:j,onSuccess:()=>{J(),$(),j(!1)}}),a.jsx(mn,{open:!!_,onOpenChange:()=>D(null),children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除表达方式 "',_?.situation,'" 吗? 此操作不可撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>_&&ce(_),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),a.jsx(Ode,{open:Q,onOpenChange:F,onConfirm:Y,count:E.size})]})}function wde({expression:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"表达方式详情"}),a.jsx(Gr,{children:"查看表达方式的完整信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Au,{label:"情境",value:t.situation}),a.jsx(Au,{label:"风格",value:t.style}),a.jsx(Au,{icon:mg,label:"聊天ID",value:t.chat_id,mono:!0}),a.jsx(Au,{icon:mg,label:"记录ID",value:t.id.toString(),mono:!0})]}),t.context&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"上下文"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.context})]}),t.up_content&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"上文内容"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.up_content})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Au,{icon:dc,label:"最后活跃",value:r(t.last_active_time)}),a.jsx(Au,{icon:dc,label:"创建时间",value:r(t.create_date)})]})]}),a.jsx(ps,{children:a.jsx(ie,{onClick:()=>n(!1),children:"关闭"})})]})})}function Au({icon:t,label:e,value:n,mono:r=!1}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs(te,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&a.jsx(t,{className:"h-3 w-3"}),e]}),a.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Sde({open:t,onOpenChange:e,onSuccess:n}){const[r,s]=S.useState({situation:"",style:"",context:"",up_content:"",chat_id:""}),[i,l]=S.useState(!1),{toast:c}=Pr(),d=async()=>{if(!r.situation||!r.style||!r.chat_id){c({title:"验证失败",description:"请填写必填字段:情境、风格和聊天ID",variant:"destructive"});return}try{l(!0),await pde(r),c({title:"创建成功",description:"表达方式已创建"}),s({situation:"",style:"",context:"",up_content:"",chat_id:""}),n()}catch(h){c({title:"创建失败",description:h instanceof Error?h.message:"无法创建表达方式",variant:"destructive"})}finally{l(!1)}};return a.jsx(Rr,{open:t,onOpenChange:e,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"新增表达方式"}),a.jsx(Gr,{children:"创建新的表达方式记录"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"situation",children:["情境 ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Me,{id:"situation",value:r.situation,onChange:h=>s({...r,situation:h.target.value}),placeholder:"描述使用场景"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"style",children:["风格 ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Me,{id:"style",value:r.style,onChange:h=>s({...r,style:h.target.value}),placeholder:"描述表达风格"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"chat_id",children:["聊天ID ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Me,{id:"chat_id",value:r.chat_id,onChange:h=>s({...r,chat_id:h.target.value}),placeholder:"关联的聊天ID"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"context",children:"上下文"}),a.jsx(_n,{id:"context",value:r.context,onChange:h=>s({...r,context:h.target.value}),placeholder:"上下文信息(可选)",rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"up_content",children:"上文内容"}),a.jsx(_n,{id:"up_content",value:r.up_content,onChange:h=>s({...r,up_content:h.target.value}),placeholder:"上文内容(可选)",rows:3})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>e(!1),children:"取消"}),a.jsx(ie,{onClick:d,disabled:i,children:i?"创建中...":"创建"})]})]})})}function kde({expression:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState({}),[l,c]=S.useState(!1),{toast:d}=Pr();S.useEffect(()=>{t&&i({situation:t.situation,style:t.style,context:t.context||"",up_content:t.up_content||"",chat_id:t.chat_id})},[t]);const h=async()=>{if(t)try{c(!0),await gde(t.id,s),d({title:"保存成功",description:"表达方式已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新表达方式",variant:"destructive"})}finally{c(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑表达方式"}),a.jsx(Gr,{children:"修改表达方式的信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_situation",children:"情境"}),a.jsx(Me,{id:"edit_situation",value:s.situation||"",onChange:m=>i({...s,situation:m.target.value}),placeholder:"描述使用场景"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_style",children:"风格"}),a.jsx(Me,{id:"edit_style",value:s.style||"",onChange:m=>i({...s,style:m.target.value}),placeholder:"描述表达风格"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_chat_id",children:"聊天ID"}),a.jsx(Me,{id:"edit_chat_id",value:s.chat_id||"",onChange:m=>i({...s,chat_id:m.target.value}),placeholder:"关联的聊天ID"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_context",children:"上下文"}),a.jsx(_n,{id:"edit_context",value:s.context||"",onChange:m=>i({...s,context:m.target.value}),placeholder:"上下文信息",rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_up_content",children:"上文内容"}),a.jsx(_n,{id:"edit_up_content",value:s.up_content||"",onChange:m=>i({...s,up_content:m.target.value}),placeholder:"上文内容",rows:3})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:h,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function Ode({open:t,onOpenChange:e,onConfirm:n,count:r}){return a.jsx(mn,{open:t,onOpenChange:e,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["您即将删除 ",r," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const Pd="/api/webui/person";async function jde(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.is_known!==void 0&&e.append("is_known",t.is_known.toString()),t.platform&&e.append("platform",t.platform);const n=await ot(`${Pd}/list?${e}`,{headers:bt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取人物列表失败")}return n.json()}async function Nde(t){const e=await ot(`${Pd}/${t}`,{headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取人物详情失败")}return e.json()}async function Cde(t,e){const n=await ot(`${Pd}/${t}`,{method:"PATCH",headers:bt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新人物信息失败")}return n.json()}async function Tde(t){const e=await ot(`${Pd}/${t}`,{method:"DELETE",headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除人物信息失败")}return e.json()}async function Ade(){const t=await ot(`${Pd}/stats/summary`,{headers:bt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}async function Mde(t){const e=await ot(`${Pd}/batch/delete`,{method:"POST",headers:bt(),body:JSON.stringify({person_ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除失败")}return e.json()}function Ede(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(1),[d,h]=S.useState(20),[m,p]=S.useState(""),[x,v]=S.useState(void 0),[b,k]=S.useState(void 0),[O,j]=S.useState(null),[T,A]=S.useState(!1),[_,D]=S.useState(!1),[E,R]=S.useState(null),[Q,F]=S.useState({total:0,known:0,unknown:0,platforms:{}}),[L,U]=S.useState(new Set),[V,de]=S.useState(!1),[W,J]=S.useState(""),{toast:$}=Pr(),ae=async()=>{try{r(!0);const ue=await jde({page:l,page_size:d,search:m||void 0,is_known:x,platform:b});e(ue.data),i(ue.total)}catch(ue){$({title:"加载失败",description:ue instanceof Error?ue.message:"无法加载人物信息",variant:"destructive"})}finally{r(!1)}},ne=async()=>{try{const ue=await Ade();F(ue.data)}catch(ue){console.error("加载统计数据失败:",ue)}};S.useEffect(()=>{ae(),ne()},[l,d,m,x,b]);const ce=async ue=>{try{const We=await Nde(ue.person_id);j(We.data),A(!0)}catch(We){$({title:"加载详情失败",description:We instanceof Error?We.message:"无法加载人物详情",variant:"destructive"})}},z=ue=>{j(ue),D(!0)},xe=async ue=>{try{await Tde(ue.person_id),$({title:"删除成功",description:`已删除人物信息: ${ue.person_name||ue.nickname||ue.user_id}`}),R(null),ae(),ne()}catch(We){$({title:"删除失败",description:We instanceof Error?We.message:"无法删除人物信息",variant:"destructive"})}},Y=S.useMemo(()=>Object.keys(Q.platforms),[Q.platforms]),P=ue=>{const We=new Set(L);We.has(ue)?We.delete(ue):We.add(ue),U(We)},K=()=>{L.size===t.length&&t.length>0?U(new Set):U(new Set(t.map(ue=>ue.person_id)))},H=()=>{if(L.size===0){$({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}de(!0)},fe=async()=>{try{const ue=await Mde(Array.from(L));$({title:"批量删除完成",description:ue.message}),U(new Set),de(!1),ae(),ne()}catch(ue){$({title:"批量删除失败",description:ue instanceof Error?ue.message:"批量删除失败",variant:"destructive"})}},ve=()=>{const ue=parseInt(W),We=Math.ceil(s/d);ue>=1&&ue<=We?(c(ue),J("")):$({title:"无效的页码",description:`请输入1-${We}之间的页码`,variant:"destructive"})},Re=ue=>ue?new Date(ue*1e3).toLocaleString("zh-CN"):"-";return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsx("div",{className:"mb-4 sm:mb-6",children:a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[a.jsx(Oq,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),a.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),a.jsx(vn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),a.jsx("div",{className:"text-2xl font-bold mt-1",children:Q.total})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:Q.known})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:Q.unknown})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"sm:col-span-2",children:[a.jsx(te,{htmlFor:"search",children:"搜索"}),a.jsxs("div",{className:"relative mt-1.5",children:[a.jsx(Bs,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:m,onChange:ue=>p(ue.target.value),className:"pl-9"})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"filter-known",children:"认识状态"}),a.jsxs(Lt,{value:x===void 0?"all":x.toString(),onValueChange:ue=>{v(ue==="all"?void 0:ue==="true"),c(1)},children:[a.jsx(Dt,{id:"filter-known",className:"mt-1.5",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"true",children:"已认识"}),a.jsx(Pe,{value:"false",children:"未认识"})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"filter-platform",children:"平台"}),a.jsxs(Lt,{value:b||"all",onValueChange:ue=>{k(ue==="all"?void 0:ue),c(1)},children:[a.jsx(Dt,{id:"filter-platform",className:"mt-1.5",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部平台"}),Y.map(ue=>a.jsxs(Pe,{value:ue,children:[ue," (",Q.platforms[ue],")"]},ue))]})]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:L.size>0&&a.jsxs("span",{children:["已选择 ",L.size," 个人物"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:d.toString(),onValueChange:ue=>{h(parseInt(ue)),c(1),U(new Set)},children:[a.jsx(Dt,{id:"page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),L.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>U(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:H,children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card",children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:t.length>0&&L.size===t.length,onCheckedChange:K,"aria-label":"全选"})}),a.jsx(xt,{children:"状态"}),a.jsx(xt,{children:"名称"}),a.jsx(xt,{children:"昵称"}),a.jsx(xt,{children:"平台"}),a.jsx(xt,{children:"用户ID"}),a.jsx(xt,{children:"最后更新"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(ue=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:L.has(ue.person_id),onCheckedChange:()=>P(ue.person_id),"aria-label":`选择 ${ue.person_name||ue.nickname||ue.user_id}`})}),a.jsx(it,{children:a.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",ue.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:ue.is_known?"已认识":"未认识"})}),a.jsx(it,{className:"font-medium",children:ue.person_name||a.jsx("span",{className:"text-muted-foreground",children:"-"})}),a.jsx(it,{children:ue.nickname||"-"}),a.jsx(it,{children:ue.platform}),a.jsx(it,{className:"font-mono text-sm",children:ue.user_id}),a.jsx(it,{className:"text-sm text-muted-foreground",children:Re(ue.last_know)}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ce(ue),children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>z(ue),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>R(ue),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},ue.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(ue=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ss,{checked:L.has(ue.person_id),onCheckedChange:()=>P(ue.person_id),className:"mt-1"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",ue.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:ue.is_known?"已认识":"未认识"}),a.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:ue.person_name||a.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),ue.nickname&&a.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",ue.nickname]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),a.jsx("p",{className:"font-medium text-xs",children:ue.platform})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),a.jsx("p",{className:"font-mono text-xs truncate",title:ue.user_id,children:ue.user_id})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),a.jsx("p",{className:"text-xs",children:Re(ue.last_know)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ce(ue),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx($i,{className:"h-3 w-3 mr-1"}),"查看"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>z(ue),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>R(ue),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},ue.id))}),s>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",l," / ",Math.ceil(s/d)," 页"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l-1),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:W,onChange:ue=>J(ue.target.value),onKeyDown:ue=>ue.key==="Enter"&&ve(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/d)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:ve,disabled:!W,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l+1),disabled:l>=Math.ceil(s/d),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(s/d)),disabled:l>=Math.ceil(s/d),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]})}),a.jsx(_de,{person:O,open:T,onOpenChange:A}),a.jsx(Dde,{person:O,open:_,onOpenChange:D,onSuccess:()=>{ae(),ne(),D(!1)}}),a.jsx(mn,{open:!!E,onOpenChange:()=>R(null),children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除人物信息 "',E?.person_name||E?.nickname||E?.user_id,'" 吗? 此操作不可撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>E&&xe(E),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),a.jsx(mn,{open:V,onOpenChange:de,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["确定要删除选中的 ",L.size," 个人物信息吗? 此操作不可撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:fe,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function _de({person:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"人物详情"}),a.jsxs(Gr,{children:["查看 ",t.person_name||t.nickname||t.user_id," 的完整信息"]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Za,{icon:D9,label:"人物名称",value:t.person_name}),a.jsx(Za,{icon:Wf,label:"昵称",value:t.nickname}),a.jsx(Za,{icon:mg,label:"用户ID",value:t.user_id,mono:!0}),a.jsx(Za,{icon:mg,label:"人物ID",value:t.person_id,mono:!0}),a.jsx(Za,{label:"平台",value:t.platform}),a.jsx(Za,{label:"状态",value:t.is_known?"已认识":"未认识"})]}),t.name_reason&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),a.jsx("p",{className:"mt-1 text-sm",children:t.name_reason})]}),t.memory_points&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"个人印象"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.memory_points})]}),t.group_nick_name&&t.group_nick_name.length>0&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"群昵称"}),a.jsx("div",{className:"mt-2 space-y-1",children:t.group_nick_name.map((s,i)=>a.jsxs("div",{className:"text-sm flex items-center gap-2",children:[a.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:s.group_id}),a.jsx("span",{children:"→"}),a.jsx("span",{children:s.group_nick_name})]},i))})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsx(Za,{icon:dc,label:"认识时间",value:r(t.know_times)}),a.jsx(Za,{icon:dc,label:"首次记录",value:r(t.know_since)}),a.jsx(Za,{icon:dc,label:"最后更新",value:r(t.last_know)})]})]}),a.jsx(ps,{children:a.jsx(ie,{onClick:()=>n(!1),children:"关闭"})})]})})}function Za({icon:t,label:e,value:n,mono:r=!1}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs(te,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&a.jsx(t,{className:"h-3 w-3"}),e]}),a.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Dde({person:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState({}),[l,c]=S.useState(!1),{toast:d}=Pr();S.useEffect(()=>{t&&i({person_name:t.person_name||"",name_reason:t.name_reason||"",nickname:t.nickname||"",memory_points:t.memory_points||"",is_known:t.is_known})},[t]);const h=async()=>{if(t)try{c(!0),await Cde(t.person_id,s),d({title:"保存成功",description:"人物信息已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新人物信息",variant:"destructive"})}finally{c(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑人物信息"}),a.jsxs(Gr,{children:["修改 ",t.person_name||t.nickname||t.user_id," 的信息"]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"person_name",children:"人物名称"}),a.jsx(Me,{id:"person_name",value:s.person_name||"",onChange:m=>i({...s,person_name:m.target.value}),placeholder:"为这个人设置一个名称"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称"}),a.jsx(Me,{id:"nickname",value:s.nickname||"",onChange:m=>i({...s,nickname:m.target.value}),placeholder:"昵称"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"name_reason",children:"名称设定原因"}),a.jsx(_n,{id:"name_reason",value:s.name_reason||"",onChange:m=>i({...s,name_reason:m.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"memory_points",children:"个人印象"}),a.jsx(_n,{id:"memory_points",value:s.memory_points||"",onChange:m=>i({...s,memory_points:m.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),a.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[a.jsxs("div",{children:[a.jsx(te,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),a.jsx(jt,{id:"is_known",checked:s.is_known,onCheckedChange:m=>i({...s,is_known:m})})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:h,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function Rde(t,e,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:n}).format(e).split(/\s/g).slice(2).join(" ")}const zde={},Wh={};function uc(t,e){try{const r=(zde[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in Wh?Wh[r]:VN(r,r.split(":"))}catch{if(t in Wh)return Wh[t];const n=t?.match(Pde);return n?VN(t,n.slice(1)):NaN}}const Pde=/([+-]\d\d):?(\d\d)?/;function VN(t,e){const n=+(e[0]||0),r=+(e[1]||0),s=+(e[2]||0)/60;return Wh[t]=n*60+r>0?n*60+r+s:n*60-r-s}class xa extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(uc(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),lz(this),R4(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new xa(...n,e):new xa(Date.now(),e)}withTimeZone(e){return new xa(+this,e)}getTimezoneOffset(){const e=-uc(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),R4(this),+this}[Symbol.for("constructDateFrom")](e){return new xa(+new Date(e),this.timeZone)}}const WN=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!WN.test(t))return;const e=t.replace(WN,"$1UTC");xa.prototype[e]&&(t.startsWith("get")?xa.prototype[t]=function(){return this.internal[e]()}:(xa.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),Bde(this),+this},xa.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),R4(this),+this}))});function R4(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-uc(t.timeZone,t)*60))}function Bde(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),lz(t)}function lz(t){const e=uc(t.timeZone,t),n=e>0?Math.floor(e):Math.ceil(e),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const s=-new Date(+t).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),l=s-i,c=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();l&&c&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+l);const d=s-n;d&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+d);const h=new Date(+t);h.setUTCSeconds(0);const m=s>0?h.getSeconds():(h.getSeconds()-60)%60,p=Math.round(-(uc(t.timeZone,t)*60))%60;(p||m)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+p),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+p+m));const x=uc(t.timeZone,t),v=x>0?Math.floor(x):Math.ceil(x),k=-new Date(+t).getTimezoneOffset()-v,O=v!==n,j=k-d;if(O&&j){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+j);const T=uc(t.timeZone,t),A=T>0?Math.floor(T):Math.ceil(T),_=v-A;_&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+_),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+_))}}class Zr extends xa{static tz(e,...n){return n.length?new Zr(...n,e):new Zr(Date.now(),e)}toISOString(){const[e,n,r]=this.tzComponents(),s=`${e}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,n,r,s]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${r} ${n} ${s}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[n,r,s]=this.tzComponents();return`${e} GMT${n}${r}${s} (${Rde(this.timeZone,this)})`}toLocaleString(e,n){return Date.prototype.toLocaleString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(e,n){return Date.prototype.toLocaleDateString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(e,n){return Date.prototype.toLocaleTimeString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),n=e>0?"-":"+",r=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),s=String(Math.abs(e)%60).padStart(2,"0");return[n,r,s]}withTimeZone(e){return new Zr(+this,e)}[Symbol.for("constructDateFrom")](e){return new Zr(+new Date(e),this.timeZone)}}const oz=6048e5,Lde=864e5,GN=Symbol.for("constructDateFrom");function vr(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&GN in t?t[GN](e):t instanceof Date?new t.constructor(e):new Date(e)}function Nn(t,e){return vr(e||t,t)}function cz(t,e,n){const r=Nn(t,n?.in);return isNaN(e)?vr(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function uz(t,e,n){const r=Nn(t,n?.in);if(isNaN(e))return vr(t,NaN);if(!e)return r;const s=r.getDate(),i=vr(t,r.getTime());i.setMonth(r.getMonth()+e+1,0);const l=i.getDate();return s>=l?i:(r.setFullYear(i.getFullYear(),i.getMonth(),s),r)}let Ide={};function O0(){return Ide}function So(t,e){const n=O0(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Nn(t,e?.in),i=s.getDay(),l=(i=i.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function XN(t){const e=Nn(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Bc(t,...e){const n=vr.bind(null,t||e.find(r=>typeof r=="object"));return e.map(n)}function Qf(t,e){const n=Nn(t,e?.in);return n.setHours(0,0,0,0),n}function hz(t,e,n){const[r,s]=Bc(n?.in,t,e),i=Qf(r),l=Qf(s),c=+i-XN(i),d=+l-XN(l);return Math.round((c-d)/Lde)}function qde(t,e){const n=dz(t,e),r=vr(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Ff(r)}function Fde(t,e,n){return cz(t,e*7,n)}function Qde(t,e,n){return uz(t,e*12,n)}function $de(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=vr.bind(null,s));const i=Nn(s,r);(!n||n{!r&&typeof s=="object"&&(r=vr.bind(null,s));const i=Nn(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),vr(r,n||NaN)}function Ude(t,e,n){const[r,s]=Bc(n?.in,t,e);return+Qf(r)==+Qf(s)}function fz(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Vde(t){return!(!fz(t)&&typeof t!="number"||isNaN(+Nn(t)))}function Wde(t,e,n){const[r,s]=Bc(n?.in,t,e),i=r.getFullYear()-s.getFullYear(),l=r.getMonth()-s.getMonth();return i*12+l}function Gde(t,e){const n=Nn(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function mz(t,e){const[n,r]=Bc(t,e.start,e.end);return{start:n,end:r}}function Xde(t,e){const{start:n,end:r}=mz(e?.in,t);let s=+n>+r;const i=s?+n:+r,l=s?r:n;l.setHours(0,0,0,0),l.setDate(1);let c=1;const d=[];for(;+l<=i;)d.push(vr(n,l)),l.setMonth(l.getMonth()+c);return s?d.reverse():d}function Yde(t,e){const n=Nn(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Kde(t,e){const n=Nn(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function pz(t,e){const n=Nn(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Zde(t,e){const{start:n,end:r}=mz(e?.in,t);let s=+n>+r;const i=s?+n:+r,l=s?r:n;l.setHours(0,0,0,0),l.setMonth(0,1);let c=1;const d=[];for(;+l<=i;)d.push(vr(n,l)),l.setFullYear(l.getFullYear()+c);return s?d.reverse():d}function gz(t,e){const n=O0(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Nn(t,e?.in),i=s.getDay(),l=(i{let r;const s=ehe[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function td(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const nhe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},rhe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},she={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ihe={date:td({formats:nhe,defaultWidth:"full"}),time:td({formats:rhe,defaultWidth:"full"}),dateTime:td({formats:she,defaultWidth:"full"})},ahe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},lhe=(t,e,n,r)=>ahe[t];function ua(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const l=t.defaultFormattingWidth||t.defaultWidth,c=n?.width?String(n.width):l;s=t.formattingValues[c]||t.formattingValues[l]}else{const l=t.defaultWidth,c=n?.width?String(n.width):t.defaultWidth;s=t.values[c]||t.values[l]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const ohe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},che={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},uhe={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},dhe={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},hhe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},fhe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},mhe=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},phe={ordinalNumber:mhe,era:ua({values:ohe,defaultWidth:"wide"}),quarter:ua({values:che,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ua({values:uhe,defaultWidth:"wide"}),day:ua({values:dhe,defaultWidth:"wide"}),dayPeriod:ua({values:hhe,defaultWidth:"wide",formattingValues:fhe,defaultFormattingWidth:"wide"})};function da(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const l=i[0],c=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],d=Array.isArray(c)?xhe(c,p=>p.test(l)):ghe(c,p=>p.test(l));let h;h=t.valueCallback?t.valueCallback(d):d,h=n.valueCallback?n.valueCallback(h):h;const m=e.slice(l.length);return{value:h,rest:m}}}function ghe(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function xhe(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let l=t.valueCallback?t.valueCallback(i[0]):i[0];l=n.valueCallback?n.valueCallback(l):l;const c=e.slice(s.length);return{value:l,rest:c}}}const vhe=/^(\d+)(th|st|nd|rd)?/i,yhe=/\d+/i,bhe={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},whe={any:[/^b/i,/^(a|c)/i]},She={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},khe={any:[/1/i,/2/i,/3/i,/4/i]},Ohe={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},jhe={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Nhe={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Che={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},The={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Ahe={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Mhe={ordinalNumber:xz({matchPattern:vhe,parsePattern:yhe,valueCallback:t=>parseInt(t,10)}),era:da({matchPatterns:bhe,defaultMatchWidth:"wide",parsePatterns:whe,defaultParseWidth:"any"}),quarter:da({matchPatterns:She,defaultMatchWidth:"wide",parsePatterns:khe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:da({matchPatterns:Ohe,defaultMatchWidth:"wide",parsePatterns:jhe,defaultParseWidth:"any"}),day:da({matchPatterns:Nhe,defaultMatchWidth:"wide",parsePatterns:Che,defaultParseWidth:"any"}),dayPeriod:da({matchPatterns:The,defaultMatchWidth:"any",parsePatterns:Ahe,defaultParseWidth:"any"})},G5={code:"en-US",formatDistance:the,formatLong:ihe,formatRelative:lhe,localize:phe,match:Mhe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ehe(t,e){const n=Nn(t,e?.in);return hz(n,pz(n))+1}function vz(t,e){const n=Nn(t,e?.in),r=+Ff(n)-+qde(n);return Math.round(r/oz)+1}function yz(t,e){const n=Nn(t,e?.in),r=n.getFullYear(),s=O0(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,l=vr(e?.in||t,0);l.setFullYear(r+1,0,i),l.setHours(0,0,0,0);const c=So(l,e),d=vr(e?.in||t,0);d.setFullYear(r,0,i),d.setHours(0,0,0,0);const h=So(d,e);return+n>=+c?r+1:+n>=+h?r:r-1}function _he(t,e){const n=O0(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=yz(t,e),i=vr(e?.in||t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),So(i,e)}function bz(t,e){const n=Nn(t,e?.in),r=+So(n,e)-+_he(n,e);return Math.round(r/oz)+1}function xn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const Zl={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return xn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):xn(n+1,2)},d(t,e){return xn(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return xn(t.getHours()%12||12,e.length)},H(t,e){return xn(t.getHours(),e.length)},m(t,e){return xn(t.getMinutes(),e.length)},s(t,e){return xn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return xn(s,e.length)}},Mu={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},YN={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return Zl.y(t,e)},Y:function(t,e,n,r){const s=yz(t,r),i=s>0?s:1-s;if(e==="YY"){const l=i%100;return xn(l,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):xn(i,e.length)},R:function(t,e){const n=dz(t);return xn(n,e.length)},u:function(t,e){const n=t.getFullYear();return xn(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return xn(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return xn(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return Zl.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return xn(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const s=bz(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):xn(s,e.length)},I:function(t,e,n){const r=vz(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):xn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Zl.d(t,e)},D:function(t,e,n){const r=Ehe(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):xn(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return xn(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return xn(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return xn(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let s;switch(r===12?s=Mu.noon:r===0?s=Mu.midnight:s=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let s;switch(r>=17?s=Mu.evening:r>=12?s=Mu.afternoon:r>=4?s=Mu.morning:s=Mu.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Zl.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Zl.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):xn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):xn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Zl.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Zl.s(t,e)},S:function(t,e){return Zl.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return ZN(r);case"XXXX":case"XX":return rc(r);case"XXXXX":case"XXX":default:return rc(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return ZN(r);case"xxxx":case"xx":return rc(r);case"xxxxx":case"xxx":default:return rc(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+KN(r,":");case"OOOO":default:return"GMT"+rc(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+KN(r,":");case"zzzz":default:return"GMT"+rc(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return xn(r,e.length)},T:function(t,e,n){return xn(+t,e.length)}};function KN(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+e+xn(i,2)}function ZN(t,e){return t%60===0?(t>0?"-":"+")+xn(Math.abs(t)/60,2):rc(t,e)}function rc(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=xn(Math.trunc(r/60),2),i=xn(r%60,2);return n+s+e+i}const JN=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},wz=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Dhe=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return JN(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",JN(r,e)).replace("{{time}}",wz(s,e))},Rhe={p:wz,P:Dhe},zhe=/^D+$/,Phe=/^Y+$/,Bhe=["D","DD","YY","YYYY"];function Lhe(t){return zhe.test(t)}function Ihe(t){return Phe.test(t)}function qhe(t,e,n){const r=Fhe(t,e,n);if(console.warn(r),Bhe.includes(t))throw new RangeError(r)}function Fhe(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Qhe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,$he=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Hhe=/^'([^]*?)'?$/,Uhe=/''/g,Vhe=/[a-zA-Z]/;function dg(t,e,n){const r=O0(),s=n?.locale??r.locale??G5,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,l=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,c=Nn(t,n?.in);if(!Vde(c))throw new RangeError("Invalid time value");let d=e.match($he).map(m=>{const p=m[0];if(p==="p"||p==="P"){const x=Rhe[p];return x(m,s.formatLong)}return m}).join("").match(Qhe).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const p=m[0];if(p==="'")return{isToken:!1,value:Whe(m)};if(YN[p])return{isToken:!0,value:m};if(p.match(Vhe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+p+"`");return{isToken:!1,value:m}});s.localize.preprocessor&&(d=s.localize.preprocessor(c,d));const h={firstWeekContainsDate:i,weekStartsOn:l,locale:s};return d.map(m=>{if(!m.isToken)return m.value;const p=m.value;(!n?.useAdditionalWeekYearTokens&&Ihe(p)||!n?.useAdditionalDayOfYearTokens&&Lhe(p))&&qhe(p,e,String(t));const x=YN[p[0]];return x(c,p,s.localize,h)}).join("")}function Whe(t){const e=t.match(Hhe);return e?e[1].replace(Uhe,"'"):t}function Ghe(t,e){const n=Nn(t,e?.in),r=n.getFullYear(),s=n.getMonth(),i=vr(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function Xhe(t,e){return Nn(t,e?.in).getMonth()}function Yhe(t,e){return Nn(t,e?.in).getFullYear()}function Khe(t,e){return+Nn(t)>+Nn(e)}function Zhe(t,e){return+Nn(t)<+Nn(e)}function Jhe(t,e,n){const[r,s]=Bc(n?.in,t,e);return+So(r,n)==+So(s,n)}function efe(t,e,n){const[r,s]=Bc(n?.in,t,e);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function tfe(t,e,n){const[r,s]=Bc(n?.in,t,e);return r.getFullYear()===s.getFullYear()}function nfe(t,e,n){const r=Nn(t,n?.in),s=r.getFullYear(),i=r.getDate(),l=vr(t,0);l.setFullYear(s,e,15),l.setHours(0,0,0,0);const c=Ghe(l);return r.setMonth(e,Math.min(i,c)),r}function rfe(t,e,n){const r=Nn(t,n?.in);return isNaN(+r)?vr(t,NaN):(r.setFullYear(e),r)}const e9=5,sfe=4;function ife(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,s=e.addDays(t,-r+1),i=e.addDays(s,e9*7-1);return e.getMonth(t)===e.getMonth(i)?e9:sfe}function Sz(t,e){const n=e.startOfMonth(t),r=n.getDay();return r===1?n:r===0?e.addDays(n,-6):e.addDays(n,-1*(r-1))}function afe(t,e){const n=Sz(t,e),r=ife(t,e);return e.addDays(n,r*7-1)}class ai{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Zr.tz(this.options.timeZone):new this.Date,this.newDate=(r,s,i)=>this.overrides?.newDate?this.overrides.newDate(r,s,i):this.options.timeZone?new Zr(r,s,i,this.options.timeZone):new Date(r,s,i),this.addDays=(r,s)=>this.overrides?.addDays?this.overrides.addDays(r,s):cz(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):uz(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):Fde(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):Qde(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):hz(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):Wde(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Xde(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):Zde(r),i=new Set(s.map(c=>this.getYear(c)));if(i.size===s.length)return s;const l=[];return i.forEach(c=>{l.push(new Date(c,0,1))}),l},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):afe(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):Jde(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):Gde(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):gz(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):Kde(r),this.format=(r,s,i)=>{const l=this.overrides?.format?this.overrides.format(r,s,this.options):dg(r,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(l):l},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):vz(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):Xhe(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):Yhe(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):bz(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):Khe(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):Zhe(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):fz(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):Ude(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):efe(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):tfe(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):$de(r),this.min=r=>this.overrides?.min?this.overrides.min(r):Hde(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):nfe(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):rfe(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):Sz(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):Qf(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Ff(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):Yde(r),this.startOfWeek=(r,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):So(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):pz(r),this.options={locale:G5,...e},this.overrides=n}getDigitMap(){const{numerals:e="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:e}),r={};for(let s=0;s<10;s++)r[s.toString()]=n.format(s);return r}replaceDigits(e){const n=this.getDigitMap();return e.replace(/\d/g,r=>n[r]||r)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&ai.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:s}=this.options,i=n?.code;if(i&&ai.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:s}).format(e)}catch{}const l=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,l)}}ai.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Ma=new ai;class kz{constructor(e,n,r=Ma){this.date=e,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(e,n)),this.dateLib=r}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class lfe{constructor(e,n){this.date=e,this.weeks=n}}class ofe{constructor(e,n){this.days=n,this.weekNumber=e}}function cfe(t){return Ue.createElement("button",{...t})}function ufe(t){return Ue.createElement("span",{...t})}function dfe(t){const{size:e=24,orientation:n="left",className:r}=t;return Ue.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&Ue.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&Ue.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&Ue.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&Ue.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function hfe(t){const{day:e,modifiers:n,...r}=t;return Ue.createElement("td",{...r})}function ffe(t){const{day:e,modifiers:n,...r}=t,s=Ue.useRef(null);return Ue.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),Ue.createElement("button",{ref:s,...r})}var et;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})(et||(et={}));var Yn;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(Yn||(Yn={}));var qi;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(qi||(qi={}));var ti;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(ti||(ti={}));function mfe(t){const{options:e,className:n,components:r,classNames:s,...i}=t,l=[s[et.Dropdown],n].join(" "),c=e?.find(({value:d})=>d===i.value);return Ue.createElement("span",{"data-disabled":i.disabled,className:s[et.DropdownRoot]},Ue.createElement(r.Select,{className:l,...i},e?.map(({value:d,label:h,disabled:m})=>Ue.createElement(r.Option,{key:d,value:d,disabled:m},h))),Ue.createElement("span",{className:s[et.CaptionLabel],"aria-hidden":!0},c?.label,Ue.createElement(r.Chevron,{orientation:"down",size:18,className:s[et.Chevron]})))}function pfe(t){return Ue.createElement("div",{...t})}function gfe(t){return Ue.createElement("div",{...t})}function xfe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return Ue.createElement("div",{...r},t.children)}function vfe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return Ue.createElement("div",{...r})}function yfe(t){return Ue.createElement("table",{...t})}function bfe(t){return Ue.createElement("div",{...t})}const Oz=S.createContext(void 0);function j0(){const t=S.useContext(Oz);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function wfe(t){const{components:e}=j0();return Ue.createElement(e.Dropdown,{...t})}function Sfe(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:s,...i}=t,{components:l,classNames:c,labels:{labelPrevious:d,labelNext:h}}=j0(),m=S.useCallback(x=>{s&&n?.(x)},[s,n]),p=S.useCallback(x=>{r&&e?.(x)},[r,e]);return Ue.createElement("nav",{...i},Ue.createElement(l.PreviousMonthButton,{type:"button",className:c[et.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":d(r),onClick:p},Ue.createElement(l.Chevron,{disabled:r?void 0:!0,className:c[et.Chevron],orientation:"left"})),Ue.createElement(l.NextMonthButton,{type:"button",className:c[et.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":h(s),onClick:m},Ue.createElement(l.Chevron,{disabled:s?void 0:!0,orientation:"right",className:c[et.Chevron]})))}function kfe(t){const{components:e}=j0();return Ue.createElement(e.Button,{...t})}function Ofe(t){return Ue.createElement("option",{...t})}function jfe(t){const{components:e}=j0();return Ue.createElement(e.Button,{...t})}function Nfe(t){const{rootRef:e,...n}=t;return Ue.createElement("div",{...n,ref:e})}function Cfe(t){return Ue.createElement("select",{...t})}function Tfe(t){const{week:e,...n}=t;return Ue.createElement("tr",{...n})}function Afe(t){return Ue.createElement("th",{...t})}function Mfe(t){return Ue.createElement("thead",{"aria-hidden":!0},Ue.createElement("tr",{...t}))}function Efe(t){const{week:e,...n}=t;return Ue.createElement("th",{...n})}function _fe(t){return Ue.createElement("th",{...t})}function Dfe(t){return Ue.createElement("tbody",{...t})}function Rfe(t){const{components:e}=j0();return Ue.createElement(e.Dropdown,{...t})}const zfe=Object.freeze(Object.defineProperty({__proto__:null,Button:cfe,CaptionLabel:ufe,Chevron:dfe,Day:hfe,DayButton:ffe,Dropdown:mfe,DropdownNav:pfe,Footer:gfe,Month:xfe,MonthCaption:vfe,MonthGrid:yfe,Months:bfe,MonthsDropdown:wfe,Nav:Sfe,NextMonthButton:kfe,Option:Ofe,PreviousMonthButton:jfe,Root:Nfe,Select:Cfe,Week:Tfe,WeekNumber:Efe,WeekNumberHeader:_fe,Weekday:Afe,Weekdays:Mfe,Weeks:Dfe,YearsDropdown:Rfe},Symbol.toStringTag,{value:"Module"}));function ll(t,e,n=!1,r=Ma){let{from:s,to:i}=t;const{differenceInCalendarDays:l,isSameDay:c}=r;return s&&i?(l(i,s)<0&&([s,i]=[i,s]),l(e,s)>=(n?1:0)&&l(i,e)>=(n?1:0)):!n&&i?c(i,e):!n&&s?c(s,e):!1}function jz(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function X5(t){return!!(t&&typeof t=="object"&&"from"in t)}function Nz(t){return!!(t&&typeof t=="object"&&"after"in t)}function Cz(t){return!!(t&&typeof t=="object"&&"before"in t)}function Tz(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function Az(t,e){return Array.isArray(t)&&t.every(e.isDate)}function ol(t,e,n=Ma){const r=Array.isArray(e)?e:[e],{isSameDay:s,differenceInCalendarDays:i,isAfter:l}=n;return r.some(c=>{if(typeof c=="boolean")return c;if(n.isDate(c))return s(t,c);if(Az(c,n))return c.includes(t);if(X5(c))return ll(c,t,!1,n);if(Tz(c))return Array.isArray(c.dayOfWeek)?c.dayOfWeek.includes(t.getDay()):c.dayOfWeek===t.getDay();if(jz(c)){const d=i(c.before,t),h=i(c.after,t),m=d>0,p=h<0;return l(c.before,c.after)?p&&m:m||p}return Nz(c)?i(t,c.after)>0:Cz(c)?i(c.before,t)>0:typeof c=="function"?c(t):!1})}function Pfe(t,e,n,r,s){const{disabled:i,hidden:l,modifiers:c,showOutsideDays:d,broadcastCalendar:h,today:m}=e,{isSameDay:p,isSameMonth:x,startOfMonth:v,isBefore:b,endOfMonth:k,isAfter:O}=s,j=n&&v(n),T=r&&k(r),A={[Yn.focused]:[],[Yn.outside]:[],[Yn.disabled]:[],[Yn.hidden]:[],[Yn.today]:[]},_={};for(const D of t){const{date:E,displayMonth:R}=D,Q=!!(R&&!x(E,R)),F=!!(j&&b(E,j)),L=!!(T&&O(E,T)),U=!!(i&&ol(E,i,s)),V=!!(l&&ol(E,l,s))||F||L||!h&&!d&&Q||h&&d===!1&&Q,de=p(E,m??s.today());Q&&A.outside.push(D),U&&A.disabled.push(D),V&&A.hidden.push(D),de&&A.today.push(D),c&&Object.keys(c).forEach(W=>{const J=c?.[W];J&&ol(E,J,s)&&(_[W]?_[W].push(D):_[W]=[D])})}return D=>{const E={[Yn.focused]:!1,[Yn.disabled]:!1,[Yn.hidden]:!1,[Yn.outside]:!1,[Yn.today]:!1},R={};for(const Q in A){const F=A[Q];E[Q]=F.some(L=>L===D)}for(const Q in _)R[Q]=_[Q].some(F=>F===D);return{...E,...R}}}function Bfe(t,e,n={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):e[Yn[i]]?s.push(e[Yn[i]]):e[qi[i]]&&s.push(e[qi[i]]),s),[e[et.Day]])}function Lfe(t){return{...zfe,...t}}function Ife(t){const e={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([n,r])=>{n.startsWith("data-")&&(e[n]=r)}),e}function Y5(){const t={};for(const e in et)t[et[e]]=`rdp-${et[e]}`;for(const e in Yn)t[Yn[e]]=`rdp-${Yn[e]}`;for(const e in qi)t[qi[e]]=`rdp-${qi[e]}`;for(const e in ti)t[ti[e]]=`rdp-${ti[e]}`;return t}function Mz(t,e,n){return(n??new ai(e)).formatMonthYear(t)}const qfe=Mz;function Ffe(t,e,n){return(n??new ai(e)).format(t,"d")}function Qfe(t,e=Ma){return e.format(t,"LLLL")}function $fe(t,e,n){return(n??new ai(e)).format(t,"cccccc")}function Hfe(t,e=Ma){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function Ufe(){return""}function Ez(t,e=Ma){return e.format(t,"yyyy")}const Vfe=Ez,Wfe=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:Mz,formatDay:Ffe,formatMonthCaption:qfe,formatMonthDropdown:Qfe,formatWeekNumber:Hfe,formatWeekNumberHeader:Ufe,formatWeekdayName:$fe,formatYearCaption:Vfe,formatYearDropdown:Ez},Symbol.toStringTag,{value:"Module"}));function Gfe(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...Wfe,...t}}function Xfe(t,e,n,r,s){const{startOfMonth:i,startOfYear:l,endOfYear:c,eachMonthOfInterval:d,getMonth:h}=s;return d({start:l(t),end:c(t)}).map(x=>{const v=r.formatMonthDropdown(x,s),b=h(x),k=e&&xi(n)||!1;return{value:b,label:v,disabled:k}})}function Yfe(t,e={},n={}){let r={...e?.[et.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function Kfe(t,e,n){const r=t.today(),s=e?t.startOfISOWeek(r):t.startOfWeek(r),i=[];for(let l=0;l<7;l++){const c=t.addDays(s,l);i.push(c)}return i}function Zfe(t,e,n,r,s=!1){if(!t||!e)return;const{startOfYear:i,endOfYear:l,eachYearOfInterval:c,getYear:d}=r,h=i(t),m=l(e),p=c({start:h,end:m});return s&&p.reverse(),p.map(x=>{const v=n.formatYearDropdown(x,r);return{value:d(x),label:v,disabled:!1}})}function _z(t,e,n,r){let s=(r??new ai(n)).format(t,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s}const Jfe=_z;function Dz(t,e,n){return(n??new ai(e)).formatMonthYear(t)}const e0e=Dz;function t0e(t,e,n,r){let s=(r??new ai(n)).format(t,"PPPP");return e?.today&&(s=`Today, ${s}`),s}function n0e(t){return"Choose the Month"}function r0e(){return""}function s0e(t){return"Go to the Next Month"}function i0e(t){return"Go to the Previous Month"}function a0e(t,e,n){return(n??new ai(e)).format(t,"cccc")}function l0e(t,e){return`Week ${t}`}function o0e(t){return"Week Number"}function c0e(t){return"Choose the Year"}const u0e=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:e0e,labelDay:Jfe,labelDayButton:_z,labelGrid:Dz,labelGridcell:t0e,labelMonthDropdown:n0e,labelNav:r0e,labelNext:s0e,labelPrevious:i0e,labelWeekNumber:l0e,labelWeekNumberHeader:o0e,labelWeekday:a0e,labelYearDropdown:c0e},Symbol.toStringTag,{value:"Module"})),N0=t=>t instanceof HTMLElement?t:null,Ub=t=>[...t.querySelectorAll("[data-animated-month]")??[]],d0e=t=>N0(t.querySelector("[data-animated-month]")),Vb=t=>N0(t.querySelector("[data-animated-caption]")),Wb=t=>N0(t.querySelector("[data-animated-weeks]")),h0e=t=>N0(t.querySelector("[data-animated-nav]")),f0e=t=>N0(t.querySelector("[data-animated-weekdays]"));function m0e(t,e,{classNames:n,months:r,focused:s,dateLib:i}){const l=S.useRef(null),c=S.useRef(r),d=S.useRef(!1);S.useLayoutEffect(()=>{const h=c.current;if(c.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||h.length===0||r.length!==h.length)return;const m=i.isSameMonth(r[0].date,h[0].date),p=i.isAfter(r[0].date,h[0].date),x=p?n[ti.caption_after_enter]:n[ti.caption_before_enter],v=p?n[ti.weeks_after_enter]:n[ti.weeks_before_enter],b=l.current,k=t.current.cloneNode(!0);if(k instanceof HTMLElement?(Ub(k).forEach(A=>{if(!(A instanceof HTMLElement))return;const _=d0e(A);_&&A.contains(_)&&A.removeChild(_);const D=Vb(A);D&&D.classList.remove(x);const E=Wb(A);E&&E.classList.remove(v)}),l.current=k):l.current=null,d.current||m||s)return;const O=b instanceof HTMLElement?Ub(b):[],j=Ub(t.current);if(j?.every(T=>T instanceof HTMLElement)&&O&&O.every(T=>T instanceof HTMLElement)){d.current=!0,t.current.style.isolation="isolate";const T=h0e(t.current);T&&(T.style.zIndex="1"),j.forEach((A,_)=>{const D=O[_];if(!D)return;A.style.position="relative",A.style.overflow="hidden";const E=Vb(A);E&&E.classList.add(x);const R=Wb(A);R&&R.classList.add(v);const Q=()=>{d.current=!1,t.current&&(t.current.style.isolation=""),T&&(T.style.zIndex=""),E&&E.classList.remove(x),R&&R.classList.remove(v),A.style.position="",A.style.overflow="",A.contains(D)&&A.removeChild(D)};D.style.pointerEvents="none",D.style.position="absolute",D.style.overflow="hidden",D.setAttribute("aria-hidden","true");const F=f0e(D);F&&(F.style.opacity="0");const L=Vb(D);L&&(L.classList.add(p?n[ti.caption_before_exit]:n[ti.caption_after_exit]),L.addEventListener("animationend",Q));const U=Wb(D);U&&U.classList.add(p?n[ti.weeks_before_exit]:n[ti.weeks_after_exit]),A.insertBefore(D,A.firstChild)})}})}function p0e(t,e,n,r){const s=t[0],i=t[t.length-1],{ISOWeek:l,fixedWeeks:c,broadcastCalendar:d}=n??{},{addDays:h,differenceInCalendarDays:m,differenceInCalendarMonths:p,endOfBroadcastWeek:x,endOfISOWeek:v,endOfMonth:b,endOfWeek:k,isAfter:O,startOfBroadcastWeek:j,startOfISOWeek:T,startOfWeek:A}=r,_=d?j(s,r):l?T(s):A(s),D=d?x(i):l?v(b(i)):k(b(i)),E=m(D,_),R=p(i,s)+1,Q=[];for(let U=0;U<=E;U++){const V=h(_,U);if(e&&O(V,e))break;Q.push(V)}const L=(d?35:42)*R;if(c&&Q.length{const s=r.weeks.reduce((i,l)=>i.concat(l.days.slice()),e.slice());return n.concat(s.slice())},e.slice())}function x0e(t,e,n,r){const{numberOfMonths:s=1}=n,i=[];for(let l=0;le)break;i.push(c)}return i}function t9(t,e,n,r){const{month:s,defaultMonth:i,today:l=r.today(),numberOfMonths:c=1}=t;let d=s||i||l;const{differenceInCalendarMonths:h,addMonths:m,startOfMonth:p}=r;if(n&&h(n,d){const j=n.broadcastCalendar?p(O,r):n.ISOWeek?x(O):v(O),T=n.broadcastCalendar?i(O):n.ISOWeek?l(c(O)):d(c(O)),A=e.filter(R=>R>=j&&R<=T),_=n.broadcastCalendar?35:42;if(n.fixedWeeks&&A.length<_){const R=e.filter(Q=>{const F=_-A.length;return Q>T&&Q<=s(T,F)});A.push(...R)}const D=A.reduce((R,Q)=>{const F=n.ISOWeek?h(Q):m(Q),L=R.find(V=>V.weekNumber===F),U=new kz(Q,O,r);return L?L.days.push(U):R.push(new ofe(F,[U])),R},[]),E=new lfe(O,D);return k.push(E),k},[]);return n.reverseMonths?b.reverse():b}function y0e(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:s,startOfDay:i,startOfMonth:l,endOfMonth:c,addYears:d,endOfYear:h,newDate:m,today:p}=e,{fromYear:x,toYear:v,fromMonth:b,toMonth:k}=t;!n&&b&&(n=b),!n&&x&&(n=e.newDate(x,0,1)),!r&&k&&(r=k),!r&&v&&(r=m(v,11,31));const O=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=l(n):x?n=m(x,0,1):!n&&O&&(n=s(d(t.today??p(),-100))),r?r=c(r):v?r=m(v,11,31):!r&&O&&(r=h(t.today??p())),[n&&i(n),r&&i(r)]}function b0e(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:l,addMonths:c,differenceInCalendarMonths:d}=r,h=s?i:1,m=l(t);if(!e)return c(m,h);if(!(d(e,t)n.concat(r.weeks.slice()),e.slice())}function Yx(t,e){const[n,r]=S.useState(t);return[e===void 0?n:e,r]}function k0e(t,e){const[n,r]=y0e(t,e),{startOfMonth:s,endOfMonth:i}=e,l=t9(t,n,r,e),[c,d]=Yx(l,t.month?l:void 0);S.useEffect(()=>{const E=t9(t,n,r,e);d(E)},[t.timeZone]);const h=x0e(c,r,t,e),m=p0e(h,t.endMonth?i(t.endMonth):void 0,t,e),p=v0e(h,m,t,e),x=S0e(p),v=g0e(p),b=w0e(c,n,t,e),k=b0e(c,r,t,e),{disableNavigation:O,onMonthChange:j}=t,T=E=>x.some(R=>R.days.some(Q=>Q.isEqualTo(E))),A=E=>{if(O)return;let R=s(E);n&&Rs(r)&&(R=s(r)),d(R),j?.(R)};return{months:p,weeks:x,days:v,navStart:n,navEnd:r,previousMonth:b,nextMonth:k,goToMonth:A,goToDay:E=>{T(E)||A(E.date)}}}var aa;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(aa||(aa={}));function n9(t){return!t[Yn.disabled]&&!t[Yn.hidden]&&!t[Yn.outside]}function O0e(t,e,n,r){let s,i=-1;for(const l of t){const c=e(l);n9(c)&&(c[Yn.focused]&&in9(e(l)))),s}function j0e(t,e,n,r,s,i,l){const{ISOWeek:c,broadcastCalendar:d}=i,{addDays:h,addMonths:m,addWeeks:p,addYears:x,endOfBroadcastWeek:v,endOfISOWeek:b,endOfWeek:k,max:O,min:j,startOfBroadcastWeek:T,startOfISOWeek:A,startOfWeek:_}=l;let E={day:h,week:p,month:m,year:x,startOfWeek:R=>d?T(R,l):c?A(R):_(R),endOfWeek:R=>d?v(R):c?b(R):k(R)}[t](n,e==="after"?1:-1);return e==="before"&&r?E=O([r,E]):e==="after"&&s&&(E=j([s,E])),E}function Rz(t,e,n,r,s,i,l,c=0){if(c>365)return;const d=j0e(t,e,n.date,r,s,i,l),h=!!(i.disabled&&ol(d,i.disabled,l)),m=!!(i.hidden&&ol(d,i.hidden,l)),p=d,x=new kz(d,p,l);return!h&&!m?x:Rz(t,e,x,r,s,i,l,c+1)}function N0e(t,e,n,r,s){const{autoFocus:i}=t,[l,c]=S.useState(),d=O0e(e.days,n,r||(()=>!1),l),[h,m]=S.useState(i?d:void 0);return{isFocusTarget:k=>!!d?.isEqualTo(k),setFocused:m,focused:h,blur:()=>{c(h),m(void 0)},moveFocus:(k,O)=>{if(!h)return;const j=Rz(k,O,h,e.navStart,e.navEnd,t,s);j&&(t.disableNavigation&&!e.days.some(A=>A.isEqualTo(j))||(e.goToDay(j),m(j)))}}}function C0e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,l]=Yx(n,s?n:void 0),c=s?n:i,{isSameDay:d}=e,h=v=>c?.some(b=>d(b,v))??!1,{min:m,max:p}=t;return{selected:c,select:(v,b,k)=>{let O=[...c??[]];if(h(v)){if(c?.length===m||r&&c?.length===1)return;O=c?.filter(j=>!d(j,v))}else c?.length===p?O=[v]:O=[...O,v];return s||l(O),s?.(O,v,b,k),O},isSelected:h}}function T0e(t,e,n=0,r=0,s=!1,i=Ma){const{from:l,to:c}=e||{},{isSameDay:d,isAfter:h,isBefore:m}=i;let p;if(!l&&!c)p={from:t,to:n>0?void 0:t};else if(l&&!c)d(l,t)?n===0?p={from:l,to:t}:s?p={from:l,to:void 0}:p=void 0:m(t,l)?p={from:t,to:l}:p={from:l,to:t};else if(l&&c)if(d(l,t)&&d(c,t))s?p={from:l,to:c}:p=void 0;else if(d(l,t))p={from:l,to:n>0?void 0:t};else if(d(c,t))p={from:t,to:n>0?void 0:t};else if(m(t,l))p={from:t,to:c};else if(h(t,l))p={from:l,to:t};else if(h(t,c))p={from:l,to:t};else throw new Error("Invalid range");if(p?.from&&p?.to){const x=i.differenceInCalendarDays(p.to,p.from);r>0&&x>r?p={from:t,to:void 0}:n>1&&xtypeof c!="function").some(c=>typeof c=="boolean"?c:n.isDate(c)?ll(t,c,!1,n):Az(c,n)?c.some(d=>ll(t,d,!1,n)):X5(c)?c.from&&c.to?r9(t,{from:c.from,to:c.to},n):!1:Tz(c)?A0e(t,c.dayOfWeek,n):jz(c)?n.isAfter(c.before,c.after)?r9(t,{from:n.addDays(c.after,1),to:n.addDays(c.before,-1)},n):ol(t.from,c,n)||ol(t.to,c,n):Nz(c)||Cz(c)?ol(t.from,c,n)||ol(t.to,c,n):!1))return!0;const l=r.filter(c=>typeof c=="function");if(l.length){let c=t.from;const d=n.differenceInCalendarDays(t.to,t.from);for(let h=0;h<=d;h++){if(l.some(m=>m(c)))return!0;c=n.addDays(c,1)}}return!1}function E0e(t,e){const{disabled:n,excludeDisabled:r,selected:s,required:i,onSelect:l}=t,[c,d]=Yx(s,l?s:void 0),h=l?s:c;return{selected:h,select:(x,v,b)=>{const{min:k,max:O}=t,j=x?T0e(x,h,k,O,i,e):void 0;return r&&n&&j?.from&&j.to&&M0e({from:j.from,to:j.to},n,e)&&(j.from=x,j.to=void 0),l||d(j),l?.(j,x,v,b),j},isSelected:x=>h&&ll(h,x,!1,e)}}function _0e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,l]=Yx(n,s?n:void 0),c=s?n:i,{isSameDay:d}=e;return{selected:c,select:(p,x,v)=>{let b=p;return!r&&c&&c&&d(p,c)&&(b=void 0),s||l(b),s?.(b,p,x,v),b},isSelected:p=>c?d(c,p):!1}}function D0e(t,e){const n=_0e(t,e),r=C0e(t,e),s=E0e(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function R0e(t){let e=t;e.timeZone&&(e={...t},e.today&&(e.today=new Zr(e.today,e.timeZone)),e.month&&(e.month=new Zr(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new Zr(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new Zr(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new Zr(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new Zr(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(dt=>new Zr(dt,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new Zr(e.selected.from,e.timeZone):void 0,to:e.selected.to?new Zr(e.selected.to,e.timeZone):void 0}));const{components:n,formatters:r,labels:s,dateLib:i,locale:l,classNames:c}=S.useMemo(()=>{const dt={...G5,...e.locale};return{dateLib:new ai({locale:dt,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib),components:Lfe(e.components),formatters:Gfe(e.formatters),labels:{...u0e,...e.labels},locale:dt,classNames:{...Y5(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]),{captionLayout:d,mode:h,navLayout:m,numberOfMonths:p=1,onDayBlur:x,onDayClick:v,onDayFocus:b,onDayKeyDown:k,onDayMouseEnter:O,onDayMouseLeave:j,onNextClick:T,onPrevClick:A,showWeekNumber:_,styles:D}=e,{formatCaption:E,formatDay:R,formatMonthDropdown:Q,formatWeekNumber:F,formatWeekNumberHeader:L,formatWeekdayName:U,formatYearDropdown:V}=r,de=k0e(e,i),{days:W,months:J,navStart:$,navEnd:ae,previousMonth:ne,nextMonth:ce,goToMonth:z}=de,xe=Pfe(W,e,$,ae,i),{isSelected:Y,select:P,selected:K}=D0e(e,i)??{},{blur:H,focused:fe,isFocusTarget:ve,moveFocus:Re,setFocused:ue}=N0e(e,de,xe,Y??(()=>!1),i),{labelDayButton:We,labelGridcell:ct,labelGrid:Oe,labelMonthDropdown:nt,labelNav:ut,labelPrevious:Ct,labelNext:In,labelWeekday:Tn,labelWeekNumber:Jn,labelWeekNumberHeader:nn,labelYearDropdown:_t}=s,Yr=S.useMemo(()=>Kfe(i,e.ISOWeek),[i,e.ISOWeek]),qn=h!==void 0||v!==void 0,or=S.useCallback(()=>{ne&&(z(ne),A?.(ne))},[ne,z,A]),yn=S.useCallback(()=>{ce&&(z(ce),T?.(ce))},[z,ce,T]),ft=S.useCallback((dt,Pn)=>mt=>{mt.preventDefault(),mt.stopPropagation(),ue(dt),P?.(dt.date,Pn,mt),v?.(dt.date,Pn,mt)},[P,v,ue]),ee=S.useCallback((dt,Pn)=>mt=>{ue(dt),b?.(dt.date,Pn,mt)},[b,ue]),Se=S.useCallback((dt,Pn)=>mt=>{H(),x?.(dt.date,Pn,mt)},[H,x]),Be=S.useCallback((dt,Pn)=>mt=>{const rn={ArrowLeft:[mt.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[mt.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[mt.shiftKey?"year":"week","after"],ArrowUp:[mt.shiftKey?"year":"week","before"],PageUp:[mt.shiftKey?"year":"month","before"],PageDown:[mt.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(rn[mt.key]){mt.preventDefault(),mt.stopPropagation();const[Mr,At]=rn[mt.key];Re(Mr,At)}k?.(dt.date,Pn,mt)},[Re,k,e.dir]),rt=S.useCallback((dt,Pn)=>mt=>{O?.(dt.date,Pn,mt)},[O]),Tt=S.useCallback((dt,Pn)=>mt=>{j?.(dt.date,Pn,mt)},[j]),cr=S.useCallback(dt=>Pn=>{const mt=Number(Pn.target.value),rn=i.setMonth(i.startOfMonth(dt),mt);z(rn)},[i,z]),Kr=S.useCallback(dt=>Pn=>{const mt=Number(Pn.target.value),rn=i.setYear(i.startOfMonth(dt),mt);z(rn)},[i,z]),{className:re,style:Ae}=S.useMemo(()=>({className:[c[et.Root],e.className].filter(Boolean).join(" "),style:{...D?.[et.Root],...e.style}}),[c,e.className,e.style,D]),pt=Ife(e),yt=S.useRef(null);m0e(yt,!!e.animate,{classNames:c,months:J,focused:fe,dateLib:i});const vs={dayPickerProps:e,selected:K,select:P,isSelected:Y,months:J,nextMonth:ce,previousMonth:ne,goToMonth:z,getModifiers:xe,components:n,classNames:c,styles:D,labels:s,formatters:r};return Ue.createElement(Oz.Provider,{value:vs},Ue.createElement(n.Root,{rootRef:e.animate?yt:void 0,className:re,style:Ae,dir:e.dir,id:e.id,lang:e.lang,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...pt},Ue.createElement(n.Months,{className:c[et.Months],style:D?.[et.Months]},!e.hideNavigation&&!m&&Ue.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[et.Nav],style:D?.[et.Nav],"aria-label":ut(),onPreviousClick:or,onNextClick:yn,previousMonth:ne,nextMonth:ce}),J.map((dt,Pn)=>Ue.createElement(n.Month,{"data-animated-month":e.animate?"true":void 0,className:c[et.Month],style:D?.[et.Month],key:Pn,displayIndex:Pn,calendarMonth:dt},m==="around"&&!e.hideNavigation&&Pn===0&&Ue.createElement(n.PreviousMonthButton,{type:"button",className:c[et.PreviousMonthButton],tabIndex:ne?void 0:-1,"aria-disabled":ne?void 0:!0,"aria-label":Ct(ne),onClick:or,"data-animated-button":e.animate?"true":void 0},Ue.createElement(n.Chevron,{disabled:ne?void 0:!0,className:c[et.Chevron],orientation:e.dir==="rtl"?"right":"left"})),Ue.createElement(n.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:c[et.MonthCaption],style:D?.[et.MonthCaption],calendarMonth:dt,displayIndex:Pn},d?.startsWith("dropdown")?Ue.createElement(n.DropdownNav,{className:c[et.Dropdowns],style:D?.[et.Dropdowns]},(()=>{const mt=d==="dropdown"||d==="dropdown-months"?Ue.createElement(n.MonthsDropdown,{key:"month",className:c[et.MonthsDropdown],"aria-label":nt(),classNames:c,components:n,disabled:!!e.disableNavigation,onChange:cr(dt.date),options:Xfe(dt.date,$,ae,r,i),style:D?.[et.Dropdown],value:i.getMonth(dt.date)}):Ue.createElement("span",{key:"month"},Q(dt.date,i)),rn=d==="dropdown"||d==="dropdown-years"?Ue.createElement(n.YearsDropdown,{key:"year",className:c[et.YearsDropdown],"aria-label":_t(i.options),classNames:c,components:n,disabled:!!e.disableNavigation,onChange:Kr(dt.date),options:Zfe($,ae,r,i,!!e.reverseYears),style:D?.[et.Dropdown],value:i.getYear(dt.date)}):Ue.createElement("span",{key:"year"},V(dt.date,i));return i.getMonthYearOrder()==="year-first"?[rn,mt]:[mt,rn]})(),Ue.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},E(dt.date,i.options,i))):Ue.createElement(n.CaptionLabel,{className:c[et.CaptionLabel],role:"status","aria-live":"polite"},E(dt.date,i.options,i))),m==="around"&&!e.hideNavigation&&Pn===p-1&&Ue.createElement(n.NextMonthButton,{type:"button",className:c[et.NextMonthButton],tabIndex:ce?void 0:-1,"aria-disabled":ce?void 0:!0,"aria-label":In(ce),onClick:yn,"data-animated-button":e.animate?"true":void 0},Ue.createElement(n.Chevron,{disabled:ce?void 0:!0,className:c[et.Chevron],orientation:e.dir==="rtl"?"left":"right"})),Pn===p-1&&m==="after"&&!e.hideNavigation&&Ue.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[et.Nav],style:D?.[et.Nav],"aria-label":ut(),onPreviousClick:or,onNextClick:yn,previousMonth:ne,nextMonth:ce}),Ue.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":h==="multiple"||h==="range","aria-label":Oe(dt.date,i.options,i)||void 0,className:c[et.MonthGrid],style:D?.[et.MonthGrid]},!e.hideWeekdays&&Ue.createElement(n.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:c[et.Weekdays],style:D?.[et.Weekdays]},_&&Ue.createElement(n.WeekNumberHeader,{"aria-label":nn(i.options),className:c[et.WeekNumberHeader],style:D?.[et.WeekNumberHeader],scope:"col"},L()),Yr.map(mt=>Ue.createElement(n.Weekday,{"aria-label":Tn(mt,i.options,i),className:c[et.Weekday],key:String(mt),style:D?.[et.Weekday],scope:"col"},U(mt,i.options,i)))),Ue.createElement(n.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:c[et.Weeks],style:D?.[et.Weeks]},dt.weeks.map(mt=>Ue.createElement(n.Week,{className:c[et.Week],key:mt.weekNumber,style:D?.[et.Week],week:mt},_&&Ue.createElement(n.WeekNumber,{week:mt,style:D?.[et.WeekNumber],"aria-label":Jn(mt.weekNumber,{locale:l}),className:c[et.WeekNumber],scope:"row",role:"rowheader"},F(mt.weekNumber,i)),mt.days.map(rn=>{const{date:Mr}=rn,At=xe(rn);if(At[Yn.focused]=!At.hidden&&!!fe?.isEqualTo(rn),At[qi.selected]=Y?.(Mr)||At.selected,X5(K)){const{from:qc,to:Do}=K;At[qi.range_start]=!!(qc&&Do&&i.isSameDay(Mr,qc)),At[qi.range_end]=!!(qc&&Do&&i.isSameDay(Mr,Do)),At[qi.range_middle]=ll(K,Mr,!0,i)}const Ic=Yfe(At,D,e.modifiersStyles),_o=Bfe(At,c,e.modifiersClassNames),t1=!qn&&!At.hidden?ct(Mr,At,i.options,i):void 0;return Ue.createElement(n.Day,{key:`${i.format(Mr,"yyyy-MM-dd")}_${i.format(rn.displayMonth,"yyyy-MM")}`,day:rn,modifiers:At,className:_o.join(" "),style:Ic,role:"gridcell","aria-selected":At.selected||void 0,"aria-label":t1,"data-day":i.format(Mr,"yyyy-MM-dd"),"data-month":rn.outside?i.format(Mr,"yyyy-MM"):void 0,"data-selected":At.selected||void 0,"data-disabled":At.disabled||void 0,"data-hidden":At.hidden||void 0,"data-outside":rn.outside||void 0,"data-focused":At.focused||void 0,"data-today":At.today||void 0},!At.hidden&&qn?Ue.createElement(n.DayButton,{className:c[et.DayButton],style:D?.[et.DayButton],type:"button",day:rn,modifiers:At,disabled:At.disabled||void 0,tabIndex:ve(rn)?0:-1,"aria-label":We(Mr,At,i.options,i),onClick:ft(rn,At),onBlur:Se(rn,At),onFocus:ee(rn,At),onKeyDown:Be(rn,At),onMouseEnter:rt(rn,At),onMouseLeave:Tt(rn,At)},R(Mr,i.options,i)):!At.hidden&&R(rn.date,i.options,i))})))))))),e.footer&&Ue.createElement(n.Footer,{className:c[et.Footer],style:D?.[et.Footer],role:"status","aria-live":"polite"},e.footer)))}function s9({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:l,...c}){const d=Y5();return a.jsx(R0e,{showOutsideDays:n,className:ye("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,t),captionLayout:r,formatters:{formatMonthDropdown:h=>h.toLocaleString("default",{month:"short"}),...i},classNames:{root:ye("w-fit",d.root),months:ye("relative flex flex-col gap-4 md:flex-row",d.months),month:ye("flex w-full flex-col gap-4",d.month),nav:ye("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",d.nav),button_previous:ye(ff({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_previous),button_next:ye(ff({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_next),month_caption:ye("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",d.month_caption),dropdowns:ye("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",d.dropdowns),dropdown_root:ye("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",d.dropdown_root),dropdown:ye("bg-popover absolute inset-0 opacity-0",d.dropdown),caption_label:ye("select-none font-medium",r==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",d.caption_label),table:"w-full border-collapse",weekdays:ye("flex",d.weekdays),weekday:ye("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",d.weekday),week:ye("mt-2 flex w-full",d.week),week_number_header:ye("w-[--cell-size] select-none",d.week_number_header),week_number:ye("text-muted-foreground select-none text-[0.8rem]",d.week_number),day:ye("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",d.day),range_start:ye("bg-accent rounded-l-md",d.range_start),range_middle:ye("rounded-none",d.range_middle),range_end:ye("bg-accent rounded-r-md",d.range_end),today:ye("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",d.today),outside:ye("text-muted-foreground aria-selected:text-muted-foreground",d.outside),disabled:ye("text-muted-foreground opacity-50",d.disabled),hidden:ye("invisible",d.hidden),...e},components:{Root:({className:h,rootRef:m,...p})=>a.jsx("div",{"data-slot":"calendar",ref:m,className:ye(h),...p}),Chevron:({className:h,orientation:m,...p})=>m==="left"?a.jsx(Tc,{className:ye("size-4",h),...p}):m==="right"?a.jsx(Ac,{className:ye("size-4",h),...p}):a.jsx(df,{className:ye("size-4",h),...p}),DayButton:z0e,WeekNumber:({children:h,...m})=>a.jsx("td",{...m,children:a.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:h})}),...l},...c})}function z0e({className:t,day:e,modifiers:n,...r}){const s=Y5(),i=S.useRef(null);return S.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),a.jsx(ie,{ref:i,variant:"ghost",size:"icon","data-day":e.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:ye("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",s.day,t),...r})}class P0e{ws=null;reconnectTimeout=null;reconnectAttempts=0;maxReconnectAttempts=10;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];maxCacheSize=1e3;getWebSocketUrl(){{const e=window.location.protocol==="https:"?"wss:":"ws:",n=window.location.host;return`${e}//${n}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const e=this.getWebSocketUrl();try{this.ws=new WebSocket(e),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=n=>{try{if(n.data==="pong")return;const r=JSON.parse(n.data);this.notifyLog(r)}catch(r){console.error("解析日志消息失败:",r)}},this.ws.onerror=n=>{console.error("❌ WebSocket 错误:",n),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(n){console.error("创建 WebSocket 连接失败:",n),this.attemptReconnect()}}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return;this.reconnectAttempts+=1;const e=Math.min(1e3*this.reconnectAttempts,1e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},e)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(e){return this.logCallbacks.add(e),()=>this.logCallbacks.delete(e)}onConnectionChange(e){return this.connectionCallbacks.add(e),e(this.isConnected),()=>this.connectionCallbacks.delete(e)}notifyLog(e){this.logCache.some(r=>r.id===e.id)||(this.logCache.push(e),this.logCache.length>this.maxCacheSize&&(this.logCache=this.logCache.slice(-this.maxCacheSize)),this.logCallbacks.forEach(r=>{try{r(e)}catch(s){console.error("日志回调执行失败:",s)}}))}notifyConnection(e){this.connectionCallbacks.forEach(n=>{try{n(e)}catch(r){console.error("连接状态回调执行失败:",r)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const Iu=new P0e;typeof window<"u"&&Iu.connect();const B0e={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},L0e=(t,e,n)=>{let r;const s=B0e[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",String(e)),n?.addSuffix?n.comparison&&n.comparison>0?r+"内":r+"前":r},I0e={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},q0e={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},F0e={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Q0e={date:td({formats:I0e,defaultWidth:"full"}),time:td({formats:q0e,defaultWidth:"full"}),dateTime:td({formats:F0e,defaultWidth:"full"})};function i9(t,e,n){const r="eeee p";return Jhe(t,e,n)?r:t.getTime()>e.getTime()?"'下个'"+r:"'上个'"+r}const $0e={lastWeek:i9,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:i9,other:"PP p"},H0e=(t,e,n,r)=>{const s=$0e[t];return typeof s=="function"?s(e,n,r):s},U0e={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},V0e={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},W0e={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},G0e={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},X0e={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},Y0e={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},K0e=(t,e)=>{const n=Number(t);switch(e?.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},Z0e={ordinalNumber:K0e,era:ua({values:U0e,defaultWidth:"wide"}),quarter:ua({values:V0e,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ua({values:W0e,defaultWidth:"wide"}),day:ua({values:G0e,defaultWidth:"wide"}),dayPeriod:ua({values:X0e,defaultWidth:"wide",formattingValues:Y0e,defaultFormattingWidth:"wide"})},J0e=/^(第\s*)?\d+(日|时|分|秒)?/i,eme=/\d+/i,tme={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},nme={any:[/^(前)/i,/^(公元)/i]},rme={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},sme={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},ime={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},ame={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},lme={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},ome={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},cme={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},ume={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},dme={ordinalNumber:xz({matchPattern:J0e,parsePattern:eme,valueCallback:t=>parseInt(t,10)}),era:da({matchPatterns:tme,defaultMatchWidth:"wide",parsePatterns:nme,defaultParseWidth:"any"}),quarter:da({matchPatterns:rme,defaultMatchWidth:"wide",parsePatterns:sme,defaultParseWidth:"any",valueCallback:t=>t+1}),month:da({matchPatterns:ime,defaultMatchWidth:"wide",parsePatterns:ame,defaultParseWidth:"any"}),day:da({matchPatterns:lme,defaultMatchWidth:"wide",parsePatterns:ome,defaultParseWidth:"any"}),dayPeriod:da({matchPatterns:cme,defaultMatchWidth:"any",parsePatterns:ume,defaultParseWidth:"any"})},Bp={code:"zh-CN",formatDistance:L0e,formatLong:Q0e,formatRelative:H0e,localize:Z0e,match:dme,options:{weekStartsOn:1,firstWeekContainsDate:4}};function hme(){const[t,e]=S.useState([]),[n,r]=S.useState(""),[s,i]=S.useState("all"),[l,c]=S.useState("all"),[d,h]=S.useState(void 0),[m,p]=S.useState(void 0),[x,v]=S.useState(!0),[b,k]=S.useState(!1),O=S.useRef(null),j=S.useRef(null);S.useEffect(()=>{const U=Iu.getAllLogs();e(U);const V=Iu.onLog(()=>{e(Iu.getAllLogs())}),de=Iu.onConnectionChange(W=>{k(W)});return()=>{V(),de()}},[]),S.useEffect(()=>{x&&j.current&&j.current.scrollIntoView({behavior:"smooth",block:"end"})},[t,x]);const T=S.useMemo(()=>{const U=new Set(t.map(V=>V.module));return Array.from(U).sort()},[t]),A=U=>{switch(U){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},_=U=>{switch(U){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},D=()=>{window.location.reload()},E=()=>{Iu.clearLogs(),e([])},R=()=>{const U=L.map(J=>`${J.timestamp} [${J.level.padEnd(8)}] [${J.module}] ${J.message}`).join(` +`),V=new Blob([U],{type:"text/plain;charset=utf-8"}),de=URL.createObjectURL(V),W=document.createElement("a");W.href=de,W.download=`logs-${dg(new Date,"yyyy-MM-dd-HHmmss")}.txt`,W.click(),URL.revokeObjectURL(de)},Q=()=>{v(!x)},F=()=>{h(void 0),p(void 0)},L=S.useMemo(()=>t.filter(U=>{const V=n===""||U.message.toLowerCase().includes(n.toLowerCase())||U.module.toLowerCase().includes(n.toLowerCase()),de=s==="all"||U.level===s,W=l==="all"||U.module===l;let J=!0;if(d||m){const $=new Date(U.timestamp);if(d){const ae=new Date(d);ae.setHours(0,0,0,0),J=J&&$>=ae}if(m){const ae=new Date(m);ae.setHours(23,59,59,999),J=J&&$<=ae}}return V&&de&&W&&J}),[t,n,s,l,d,m]);return a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 p-3 sm:p-4 lg:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:ye("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",b?"bg-green-500 animate-pulse":"bg-red-500")}),a.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:b?"已连接":"未连接"})]})]}),a.jsx(gt,{className:"p-3 sm:p-4",children:a.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索日志...",value:n,onChange:U=>r(U.target.value),className:"pl-9 h-9 text-sm"})]}),a.jsxs(Lt,{value:s,onValueChange:i,children:[a.jsxs(Dt,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[a.jsx(t2,{className:"h-4 w-4 mr-2"}),a.jsx(It,{placeholder:"级别"})]}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部级别"}),a.jsx(Pe,{value:"DEBUG",children:"DEBUG"}),a.jsx(Pe,{value:"INFO",children:"INFO"}),a.jsx(Pe,{value:"WARNING",children:"WARNING"}),a.jsx(Pe,{value:"ERROR",children:"ERROR"}),a.jsx(Pe,{value:"CRITICAL",children:"CRITICAL"})]})]}),a.jsxs(Lt,{value:l,onValueChange:c,children:[a.jsxs(Dt,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[a.jsx(t2,{className:"h-4 w-4 mr-2"}),a.jsx(It,{placeholder:"模块"})]}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部模块"}),T.map(U=>a.jsx(Pe,{value:U,children:U},U))]})]})]}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!d&&"text-muted-foreground"),children:[a.jsx(uO,{className:"mr-2 h-4 w-4"}),a.jsx("span",{className:"text-xs sm:text-sm",children:d?dg(d,"PPP",{locale:Bp}):"开始日期"})]})}),a.jsx(fl,{className:"w-auto p-0",align:"start",children:a.jsx(s9,{mode:"single",selected:d,onSelect:h,initialFocus:!0,locale:Bp})})]}),a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!m&&"text-muted-foreground"),children:[a.jsx(uO,{className:"mr-2 h-4 w-4"}),a.jsx("span",{className:"text-xs sm:text-sm",children:m?dg(m,"PPP",{locale:Bp}):"结束日期"})]})}),a.jsx(fl,{className:"w-auto p-0",align:"start",children:a.jsx(s9,{mode:"single",selected:m,onSelect:p,initialFocus:!0,locale:Bp})})]}),(d||m)&&a.jsxs(ie,{variant:"outline",size:"sm",onClick:F,className:"w-full sm:w-auto h-9",children:[a.jsx(Gf,{className:"h-4 w-4 sm:mr-2"}),a.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),a.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[a.jsxs(ie,{variant:x?"default":"outline",size:"sm",onClick:Q,className:"flex-1 sm:flex-none h-9",children:[x?a.jsx(jq,{className:"h-4 w-4"}):a.jsx(Nq,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:x?"自动滚动":"已暂停"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:D,className:"flex-1 sm:flex-none h-9",children:[a.jsx(Fi,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:E,className:"flex-1 sm:flex-none h-9",children:[a.jsx(Ht,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:R,className:"flex-1 sm:flex-none h-9",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),a.jsx("div",{className:"flex-1 hidden sm:block"}),a.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[a.jsxs("span",{className:"font-mono",children:[L.length," / ",t.length]}),a.jsx("span",{className:"ml-1",children:"条日志"})]})]})]})}),a.jsx(gt,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900",children:a.jsx(vn,{className:"h-[calc(100vh-280px)] sm:h-[calc(100vh-320px)] lg:h-[calc(100vh-400px)]",children:a.jsxs("div",{ref:O,className:"p-2 sm:p-3 lg:p-4 font-mono text-xs sm:text-sm space-y-1",children:[L.length===0?a.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):L.map(U=>a.jsxs("div",{className:ye("py-2 px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",_(U.level)),children:[a.jsxs("div",{className:"flex flex-col gap-1 sm:hidden",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-600 text-xs",children:U.timestamp}),a.jsxs("span",{className:ye("text-xs font-semibold",A(U.level)),children:["[",U.level,"]"]})]}),a.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 text-xs truncate",children:U.module}),a.jsx("div",{className:"text-gray-300 dark:text-gray-400 text-xs break-all",children:U.message})]}),a.jsxs("div",{className:"hidden sm:flex gap-3 items-start",children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[140px] lg:w-[180px] text-xs lg:text-sm",children:U.timestamp}),a.jsxs("span",{className:ye("flex-shrink-0 w-[70px] lg:w-[80px] font-semibold text-xs lg:text-sm",A(U.level)),children:["[",U.level,"]"]}),a.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[120px] lg:w-[150px] truncate text-xs lg:text-sm",children:U.module}),a.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 break-all text-xs lg:text-sm",children:U.message})]})]},U.id)),a.jsx("div",{ref:j,className:"h-4"})]})})})]})})}const fme="Mai-with-u",mme="plugin-repo",pme="main",gme="plugin_details.json";async function xme(){try{const t=await ot("/api/webui/plugins/fetch-raw",{method:"POST",headers:bt(),body:JSON.stringify({owner:fme,repo:mme,branch:pme,file_path:gme})});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success||!e.data)throw new Error(e.error||"获取插件列表失败");return JSON.parse(e.data).filter(s=>!s?.id||!s?.manifest?(console.warn("跳过无效插件数据:",s),!1):!s.manifest.name||!s.manifest.version?(console.warn("跳过缺少必需字段的插件:",s.id),!1):!0).map(s=>({id:s.id,manifest:{manifest_version:s.manifest.manifest_version||1,name:s.manifest.name,version:s.manifest.version,description:s.manifest.description||"",author:s.manifest.author||{name:"Unknown"},license:s.manifest.license||"Unknown",host_application:s.manifest.host_application||{min_version:"0.0.0"},homepage_url:s.manifest.homepage_url,repository_url:s.manifest.repository_url,keywords:s.manifest.keywords||[],categories:s.manifest.categories||[],default_locale:s.manifest.default_locale||"zh-CN",locales_path:s.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(t){throw console.error("Failed to fetch plugin list:",t),t}}async function vme(){try{const t=await ot("/api/webui/plugins/git-status");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to check Git status:",t),{installed:!1,error:"无法检测 Git 安装状态"}}}async function yme(){try{const t=await ot("/api/webui/plugins/version");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to get Maimai version:",t),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function bme(t,e,n){const r=t.split(".").map(c=>parseInt(c)||0),s=r[0]||0,i=r[1]||0,l=r[2]||0;if(n.version_majorparseInt(p)||0),d=c[0]||0,h=c[1]||0,m=c[2]||0;if(n.version_major>d||n.version_major===d&&n.version_minor>h||n.version_major===d&&n.version_minor===h&&n.version_patch>m)return!1}return!0}function wme(t,e){const n=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host,s=new WebSocket(`${n}//${r}/api/webui/ws/plugin-progress`);return s.onopen=()=>{console.log("Plugin progress WebSocket connected");const i=setInterval(()=>{s.readyState===WebSocket.OPEN?s.send("ping"):clearInterval(i)},3e4)},s.onmessage=i=>{try{if(i.data==="pong")return;const l=JSON.parse(i.data);t(l)}catch(l){console.error("Failed to parse progress data:",l)}},s.onerror=i=>{console.error("Plugin progress WebSocket error:",i),e?.(i)},s.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},s}async function Lp(){try{const t=await ot("/api/webui/plugins/installed",{headers:bt()});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success)throw new Error(e.message||"获取已安装插件列表失败");return e.plugins||[]}catch(t){return console.error("Failed to get installed plugins:",t),[]}}function Ip(t,e){return e.some(n=>n.id===t)}function qp(t,e){const n=e.find(r=>r.id===t);if(n)return n.manifest?.version||n.version}async function Sme(t,e,n="main"){const r=await ot("/api/webui/plugins/install",{method:"POST",headers:bt(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"安装失败")}return await r.json()}async function kme(t){const e=await ot("/api/webui/plugins/uninstall",{method:"POST",headers:bt(),body:JSON.stringify({plugin_id:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"卸载失败")}return await e.json()}async function Ome(t,e,n="main"){const r=await ot("/api/webui/plugins/update",{method:"POST",headers:bt(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"更新失败")}return await r.json()}const C0="https://maibot-plugin-stats.maibot-webui.workers.dev";async function zz(t){try{const e=await fetch(`${C0}/stats/${t}`);return e.ok?await e.json():(console.error("Failed to fetch plugin stats:",e.statusText),null)}catch(e){return console.error("Error fetching plugin stats:",e),null}}async function jme(t,e){try{const n=e||K5(),r=await fetch(`${C0}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点赞失败"}}catch(n){return console.error("Error liking plugin:",n),{success:!1,error:"网络错误"}}}async function Nme(t,e){try{const n=e||K5(),r=await fetch(`${C0}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点踩失败"}}catch(n){return console.error("Error disliking plugin:",n),{success:!1,error:"网络错误"}}}async function Cme(t,e,n,r){if(e<1||e>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const s=r||K5(),i=await fetch(`${C0}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,rating:e,comment:n,user_id:s})}),l=await i.json();return i.status===429?{success:!1,error:"每天最多评分 3 次"}:i.ok?{success:!0,...l}:{success:!1,error:l.error||"评分失败"}}catch(s){return console.error("Error rating plugin:",s),{success:!1,error:"网络错误"}}}async function Tme(t){try{const e=await fetch(`${C0}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t})}),n=await e.json();return e.status===429?(console.warn("Download recording rate limited"),{success:!0}):e.ok?{success:!0,...n}:(console.error("Failed to record download:",n.error),{success:!1,error:n.error})}catch(e){return console.error("Error recording download:",e),{success:!1,error:"网络错误"}}}function Ame(){const t=navigator,e=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,t.deviceMemory||0].join("|");let n=0;for(let r=0;r{i(!0);const j=await zz(t);j&&r(j),i(!1)};S.useEffect(()=>{v()},[t]);const b=async()=>{const j=await jme(t);j.success?(x({title:"已点赞",description:"感谢你的支持!"}),v()):x({title:"点赞失败",description:j.error||"未知错误",variant:"destructive"})},k=async()=>{const j=await Nme(t);j.success?(x({title:"已反馈",description:"感谢你的反馈!"}),v()):x({title:"操作失败",description:j.error||"未知错误",variant:"destructive"})},O=async()=>{if(l===0){x({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const j=await Cme(t,l,d||void 0);j.success?(x({title:"评分成功",description:"感谢你的评价!"}),p(!1),c(0),h(""),v()):x({title:"评分失败",description:j.error||"未知错误",variant:"destructive"})};return s?a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:"-"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Jl,{className:"h-4 w-4"}),a.jsx("span",{children:"-"})]})]}):n?e?a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${n.downloads.toLocaleString()}`,children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:n.downloads.toLocaleString()})]}),a.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${n.rating.toFixed(1)} (${n.rating_count} 条评价)`,children:[a.jsx(Jl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsx("span",{children:n.rating.toFixed(1)})]}),a.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${n.likes}`,children:[a.jsx(my,{className:"h-4 w-4"}),a.jsx("span",{children:n.likes})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(fc,{className:"h-5 w-5 text-muted-foreground mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.downloads.toLocaleString()}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(Jl,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),a.jsx("span",{className:"text-2xl font-bold",children:n.rating.toFixed(1)}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.rating_count," 条评价"]})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(my,{className:"h-5 w-5 text-green-500 mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.likes}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(dO,{className:"h-5 w-5 text-red-500 mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.dislikes}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:b,children:[a.jsx(my,{className:"h-4 w-4 mr-1"}),"点赞"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:k,children:[a.jsx(dO,{className:"h-4 w-4 mr-1"}),"点踩"]}),a.jsxs(Rr,{open:m,onOpenChange:p,children:[a.jsx(mw,{asChild:!0,children:a.jsxs(ie,{variant:"default",size:"sm",children:[a.jsx(Jl,{className:"h-4 w-4 mr-1"}),"评分"]})}),a.jsxs(Nr,{children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"为插件评分"}),a.jsx(Gr,{children:"分享你的使用体验,帮助其他用户"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(j=>a.jsx("button",{onClick:()=>c(j),className:"focus:outline-none",children:a.jsx(Jl,{className:`h-8 w-8 transition-colors ${j<=l?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},j))}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[l===0&&"点击星星进行评分",l===1&&"很差",l===2&&"一般",l===3&&"还行",l===4&&"不错",l===5&&"非常好"]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),a.jsx(_n,{value:d,onChange:j=>h(j.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[d.length," / 500"]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>p(!1),children:"取消"}),a.jsx(ie,{onClick:O,disabled:l===0,children:"提交评分"})]})]})]})]}),n.recent_ratings&&n.recent_ratings.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),a.jsx("div",{className:"space-y-3",children:n.recent_ratings.map((j,T)=>a.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(A=>a.jsx(Jl,{className:`h-3 w-3 ${A<=j.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},A))}),a.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(j.created_at).toLocaleDateString()})]}),j.comment&&a.jsx("p",{className:"text-sm text-muted-foreground",children:j.comment})]},T))})]})]}):null}const a9={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function Eme(){const t=wa(),[e,n]=S.useState(null),[r,s]=S.useState(""),[i,l]=S.useState("all"),[c,d]=S.useState("all"),[h,m]=S.useState(!1),[p,x]=S.useState([]),[v,b]=S.useState(!0),[k,O]=S.useState(null),[j,T]=S.useState(null),[A,_]=S.useState(null),[D,E]=S.useState(null),[,R]=S.useState([]),[Q,F]=S.useState({}),{toast:L}=Pr(),U=async z=>{const xe=z.map(async K=>{try{const H=await zz(K.id);return{id:K.id,stats:H}}catch(H){return console.warn(`Failed to load stats for ${K.id}:`,H),{id:K.id,stats:null}}}),Y=await Promise.all(xe),P={};Y.forEach(({id:K,stats:H})=>{H&&(P[K]=H)}),F(P)};S.useEffect(()=>{let z=null,xe=!1;return(async()=>{if(z=wme(P=>{xe||(_(P),P.stage==="success"?setTimeout(()=>{xe||_(null)},2e3):P.stage==="error"&&(b(!1),O(P.error||"加载失败")))},P=>{console.error("WebSocket error:",P),xe||L({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(P=>{if(!z){P();return}const K=()=>{z&&z.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),P()):z&&z.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),P()):setTimeout(K,100)};K()}),!xe){const P=await vme();T(P),P.installed||L({title:"Git 未安装",description:P.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!xe){const P=await yme();E(P)}if(!xe)try{b(!0),O(null);const P=await xme();if(!xe){const K=await Lp();R(K);const H=P.map(fe=>{const ve=Ip(fe.id,K),Re=qp(fe.id,K);return{...fe,installed:ve,installed_version:Re}});for(const fe of K)!H.some(Re=>Re.id===fe.id)&&fe.manifest&&H.push({id:fe.id,manifest:{manifest_version:fe.manifest.manifest_version||1,name:fe.manifest.name,version:fe.manifest.version,description:fe.manifest.description||"",author:fe.manifest.author,license:fe.manifest.license||"Unknown",host_application:fe.manifest.host_application,homepage_url:fe.manifest.homepage_url,repository_url:fe.manifest.repository_url,keywords:fe.manifest.keywords||[],categories:fe.manifest.categories||[],default_locale:fe.manifest.default_locale||"zh-CN",locales_path:fe.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:fe.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});x(H),U(H)}}catch(P){if(!xe){const K=P instanceof Error?P.message:"加载插件列表失败";O(K),L({title:"加载失败",description:K,variant:"destructive"})}}finally{xe||b(!1)}})(),()=>{xe=!0,z&&z.close()}},[L]);const V=z=>{if(!z.installed&&D&&!de(z))return a.jsxs(On,{variant:"destructive",className:"gap-1",children:[a.jsx(xc,{className:"h-3 w-3"}),"不兼容"]});if(z.installed){const xe=z.installed_version?.trim(),Y=z.manifest.version?.trim();if(xe!==Y){const P=xe?.split(".").map(Number)||[0,0,0],K=Y?.split(".").map(Number)||[0,0,0];for(let H=0;H<3;H++){if((K[H]||0)>(P[H]||0))return a.jsxs(On,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[a.jsx(xc,{className:"h-3 w-3"}),"可更新"]});if((K[H]||0)<(P[H]||0))break}}return a.jsxs(On,{variant:"default",className:"gap-1",children:[a.jsx(Es,{className:"h-3 w-3"}),"已安装"]})}return null},de=z=>!D||!z.manifest?.host_application?!0:bme(z.manifest.host_application.min_version,z.manifest.host_application.max_version,D),W=z=>{if(!z.installed||!z.installed_version||!z.manifest?.version)return!1;const xe=z.installed_version.trim(),Y=z.manifest.version.trim();if(xe===Y)return!1;const P=xe.split(".").map(Number),K=Y.split(".").map(Number);for(let H=0;H<3;H++){if((K[H]||0)>(P[H]||0))return!0;if((K[H]||0)<(P[H]||0))return!1}return!1},J=p.filter(z=>{if(!z.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",z.id),!1;const xe=r===""||z.manifest.name?.toLowerCase().includes(r.toLowerCase())||z.manifest.description?.toLowerCase().includes(r.toLowerCase())||z.manifest.keywords&&z.manifest.keywords.some(H=>H.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||z.manifest.categories&&z.manifest.categories.includes(i);let P=!0;c==="installed"?P=z.installed===!0:c==="updates"&&(P=z.installed===!0&&W(z));const K=!h||!D||de(z);return xe&&Y&&P&&K}),$=()=>{n(null)},ae=async z=>{if(!j?.installed){L({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(D&&!de(z)){L({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await Sme(z.id,z.manifest.repository_url||"","main"),Tme(z.id).catch(Y=>{console.warn("Failed to record download:",Y)}),L({title:"安装成功",description:`${z.manifest.name} 已成功安装`});const xe=await Lp();R(xe),x(Y=>Y.map(P=>{if(P.id===z.id){const K=Ip(P.id,xe),H=qp(P.id,xe);return{...P,installed:K,installed_version:H}}return P}))}catch(xe){L({title:"安装失败",description:xe instanceof Error?xe.message:"未知错误",variant:"destructive"})}},ne=async z=>{try{await kme(z.id),L({title:"卸载成功",description:`${z.manifest.name} 已成功卸载`});const xe=await Lp();R(xe),x(Y=>Y.map(P=>{if(P.id===z.id){const K=Ip(P.id,xe),H=qp(P.id,xe);return{...P,installed:K,installed_version:H}}return P}))}catch(xe){L({title:"卸载失败",description:xe instanceof Error?xe.message:"未知错误",variant:"destructive"})}},ce=async z=>{if(!j?.installed){L({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const xe=await Ome(z.id,z.manifest.repository_url||"","main");L({title:"更新成功",description:`${z.manifest.name} 已从 ${xe.old_version} 更新到 ${xe.new_version}`});const Y=await Lp();R(Y),x(P=>P.map(K=>{if(K.id===z.id){const H=Ip(K.id,Y),fe=qp(K.id,Y);return{...K,installed:H,installed_version:fe}}return K}))}catch(xe){L({title:"更新失败",description:xe instanceof Error?xe.message:"未知错误",variant:"destructive"})}};return a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),a.jsxs(ie,{onClick:()=>t({to:"/plugin-mirrors"}),children:[a.jsx(Cq,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),j&&!j.installed&&a.jsxs(gt,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[a.jsx(Wt,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Hu,{className:"h-5 w-5 text-orange-600"}),a.jsxs("div",{children:[a.jsx(Gt,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),a.jsx(Sr,{className:"text-orange-800 dark:text-orange-200",children:j.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),a.jsx(an,{children:a.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",a.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索插件...",value:r,onChange:z=>s(z.target.value),className:"pl-9"})]}),a.jsxs(Lt,{value:i,onValueChange:l,children:[a.jsx(Dt,{className:"w-full sm:w-[200px]",children:a.jsx(It,{placeholder:"选择分类"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部分类"}),a.jsx(Pe,{value:"Group Management",children:"群组管理"}),a.jsx(Pe,{value:"Entertainment & Interaction",children:"娱乐互动"}),a.jsx(Pe,{value:"Utility Tools",children:"实用工具"}),a.jsx(Pe,{value:"Content Generation",children:"内容生成"}),a.jsx(Pe,{value:"Multimedia",children:"多媒体"}),a.jsx(Pe,{value:"External Integration",children:"外部集成"}),a.jsx(Pe,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),a.jsx(Pe,{value:"Other",children:"其他"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"compatible-only",checked:h,onCheckedChange:z=>m(z===!0)}),a.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),a.jsx(hl,{value:c,onValueChange:d,className:"w-full",children:a.jsxs(ya,{className:"grid w-full grid-cols-3",children:[a.jsxs($t,{value:"all",children:["全部插件 (",p.length,")"]}),a.jsxs($t,{value:"installed",children:["已安装 (",p.filter(z=>z.installed).length,")"]}),a.jsxs($t,{value:"updates",children:["可更新 (",p.filter(z=>z.installed&&W(z)).length,")"]})]})}),A&&A.stage==="loading"&&a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(hf,{className:"h-4 w-4 animate-spin"}),a.jsxs("span",{className:"text-sm font-medium",children:[A.operation==="fetch"&&"加载插件列表",A.operation==="install"&&`安装插件${A.plugin_id?`: ${A.plugin_id}`:""}`,A.operation==="uninstall"&&`卸载插件${A.plugin_id?`: ${A.plugin_id}`:""}`,A.operation==="update"&&`更新插件${A.plugin_id?`: ${A.plugin_id}`:""}`]})]}),a.jsxs("span",{className:"text-sm font-medium",children:[A.progress,"%"]})]}),a.jsx(n0,{value:A.progress,className:"h-2"}),a.jsx("div",{className:"text-xs text-muted-foreground",children:A.message}),A.operation==="fetch"&&A.total_plugins>0&&a.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",A.loaded_plugins," / ",A.total_plugins," 个插件"]})]})}),A&&A.stage==="error"&&A.error&&a.jsx(gt,{className:"border-destructive bg-destructive/10",children:a.jsx(Wt,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Hu,{className:"h-5 w-5 text-destructive"}),a.jsxs("div",{children:[a.jsx(Gt,{className:"text-lg text-destructive",children:"加载失败"}),a.jsx(Sr,{className:"text-destructive/80",children:A.error})]})]})})}),v?a.jsxs("div",{className:"flex items-center justify-center py-12",children:[a.jsx(hf,{className:"h-8 w-8 animate-spin text-muted-foreground"}),a.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):k?a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Hu,{className:"h-12 w-12 text-destructive mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:k}),a.jsx(ie,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):J.length===0?a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Bs,{className:"h-12 w-12 text-muted-foreground mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:r||i!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:J.map(z=>a.jsxs(gt,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[a.jsxs(Wt,{children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx(Gt,{className:"text-xl",children:z.manifest?.name||z.id}),a.jsxs("div",{className:"flex flex-col gap-1",children:[z.manifest?.categories&&z.manifest.categories[0]&&a.jsx(On,{variant:"secondary",className:"text-xs whitespace-nowrap",children:a9[z.manifest.categories[0]]||z.manifest.categories[0]}),V(z)]})]}),a.jsx(Sr,{className:"line-clamp-2",children:z.manifest?.description||"无描述"})]}),a.jsx(an,{className:"flex-1",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:(Q[z.id]?.downloads??z.downloads??0).toLocaleString()})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Jl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsx("span",{children:(Q[z.id]?.rating??z.rating??0).toFixed(1)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[z.manifest?.keywords&&z.manifest.keywords.slice(0,3).map(xe=>a.jsx(On,{variant:"outline",className:"text-xs",children:xe},xe)),z.manifest?.keywords&&z.manifest.keywords.length>3&&a.jsxs(On,{variant:"outline",className:"text-xs",children:["+",z.manifest.keywords.length-3]})]}),a.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[a.jsxs("div",{children:["v",z.manifest?.version||"unknown"," · ",z.manifest?.author?.name||"Unknown"]}),z.manifest?.host_application&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{children:"支持:"}),a.jsxs("span",{className:"font-medium",children:[z.manifest.host_application.min_version,z.manifest.host_application.max_version?` - ${z.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),a.jsx(bC,{className:"pt-4",children:a.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>n(z),children:"查看详情"}),z.installed?W(z)?a.jsxs(ie,{size:"sm",disabled:!j?.installed,title:j?.installed?void 0:"Git 未安装",onClick:()=>ce(z),children:[a.jsx(Fi,{className:"h-4 w-4 mr-1"}),"更新"]}):a.jsxs(ie,{variant:"destructive",size:"sm",disabled:!j?.installed,title:j?.installed?void 0:"Git 未安装",onClick:()=>ne(z),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"卸载"]}):a.jsxs(ie,{size:"sm",disabled:!j?.installed||A?.operation==="install"||D!==null&&!de(z),title:j?.installed?D!==null&&!de(z)?`不兼容当前版本 (需要 ${z.manifest?.host_application?.min_version||"未知"}${z.manifest?.host_application?.max_version?` - ${z.manifest.host_application.max_version}`:"+"},当前 ${D?.version})`:void 0:"Git 未安装",onClick:()=>ae(z),children:[a.jsx(fc,{className:"h-4 w-4 mr-1"}),A?.operation==="install"&&A?.plugin_id===z.id?"安装中...":"安装"]})]})})]},z.id))}),a.jsx(Rr,{open:e!==null,onOpenChange:$,children:e&&e.manifest&&a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsx(Cr,{children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"space-y-2 flex-1",children:[a.jsx(Tr,{className:"text-2xl",children:e.manifest.name}),a.jsxs(Gr,{children:["作者: ",e.manifest.author?.name||"Unknown",e.manifest.author?.url&&a.jsx("a",{href:e.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:a.jsx(Yh,{className:"h-3 w-3 inline"})})]})]}),a.jsxs("div",{className:"flex flex-col gap-2",children:[e.manifest.categories&&e.manifest.categories[0]&&a.jsx(On,{variant:"secondary",children:a9[e.manifest.categories[0]]||e.manifest.categories[0]}),V(e)]})]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(Mme,{pluginId:e.id}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"版本"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",e.manifest?.version||"unknown"]}),e.installed&&e.installed_version&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",e.installed_version]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"下载量"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:(Q[e.id]?.downloads??e.downloads??0).toLocaleString()})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"评分"}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Jl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[(Q[e.id]?.rating??e.rating??0).toFixed(1)," (",Q[e.id]?.rating_count??e.review_count??0,")"]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"许可证"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.license||"Unknown"})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.manifest.host_application?.min_version||"未知",e.manifest.host_application?.max_version?` - ${e.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:e.manifest.keywords&&e.manifest.keywords.map(z=>a.jsx(On,{variant:"outline",children:z},z))})]}),e.detailed_description&&a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),a.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:e.detailed_description})]}),!e.detailed_description&&a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.description||"无描述"})]}),a.jsxs("div",{className:"space-y-2",children:[e.manifest.homepage_url&&a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium",children:"主页: "}),a.jsx("a",{href:e.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.homepage_url})]}),e.manifest.repository_url&&a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium",children:"仓库: "}),a.jsx("a",{href:e.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.repository_url})]})]})]}),a.jsxs(ps,{children:[e.manifest.homepage_url&&a.jsxs(ie,{onClick:()=>window.open(e.manifest.homepage_url,"_blank"),children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"访问主页"]}),e.manifest.repository_url&&a.jsxs(ie,{variant:"outline",onClick:()=>window.open(e.manifest.repository_url,"_blank"),children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function _me(){return a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(Fi,{className:"h-4 w-4 mr-2"}),"刷新"]}),a.jsxs(ie,{size:"sm",children:[a.jsx(Ii,{className:"h-4 w-4 mr-2"}),"全局设置"]})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"已安装插件"}),a.jsx(pg,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"正在加载..."})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"已启用"}),a.jsx(Es,{className:"h-4 w-4 text-green-600"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"已禁用"}),a.jsx(xc,{className:"h-4 w-4 text-orange-600"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"可更新"}),a.jsx(Fi,{className:"h-4 w-4 text-blue-600"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"有新版本可用"})]})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"已安装的插件"}),a.jsx(Sr,{children:"查看和管理已安装插件的配置"})]}),a.jsx(an,{children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[a.jsx(pg,{className:"h-16 w-16 text-muted-foreground/50"}),a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"插件配置功能开发中"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"即将支持插件的启用/禁用、参数配置等功能"})]}),a.jsx("div",{className:"flex gap-2",children:a.jsx(ie,{variant:"outline",asChild:!0,children:a.jsxs("a",{href:"/plugins",children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"前往插件市场"]})})})]})})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(gt,{children:[a.jsx(Wt,{children:a.jsx(Gt,{className:"text-base",children:"即将推出的功能"})}),a.jsx(an,{children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"插件启用/禁用"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"快速切换插件运行状态"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"配置参数编辑"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"可视化编辑插件配置文件"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"依赖管理"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"查看和安装插件依赖包"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"插件日志"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"查看插件运行日志和错误信息"})]})]})]})})]}),a.jsxs(gt,{children:[a.jsx(Wt,{children:a.jsx(Gt,{className:"text-base",children:"开发者工具"})}),a.jsx(an,{children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"热重载"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"无需重启即可重新加载插件"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"配置验证"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查配置文件格式和完整性"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"性能监控"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"监控插件的资源占用情况"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"调试模式"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"详细的调试信息和错误追踪"})]})]})]})})]})]}),a.jsx(gt,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:a.jsx(an,{className:"pt-6",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(xc,{className:"h-5 w-5 text-blue-600 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"开发进行中"}),a.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["插件配置功能正在积极开发中。目前您可以通过",a.jsx("strong",{children:"插件市场"}),"安装和卸载插件,完整的配置管理功能即将推出。"]})]})]})})})]})})}function Dme(){const t=wa(),{toast:e}=Pr(),[n,r]=S.useState([]),[s,i]=S.useState(!0),[l,c]=S.useState(null),[d,h]=S.useState(null),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O=S.useCallback(async()=>{try{i(!0),c(null);const R=localStorage.getItem("access-token"),Q=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${R}`}});if(!Q.ok)throw new Error("获取镜像源列表失败");const F=await Q.json();r(F.mirrors||[])}catch(R){const Q=R instanceof Error?R.message:"加载镜像源失败";c(Q),e({title:"加载失败",description:Q,variant:"destructive"})}finally{i(!1)}},[e]);S.useEffect(()=>{O()},[O]);const j=async()=>{try{const R=localStorage.getItem("access-token"),Q=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${R}`,"Content-Type":"application/json"},body:JSON.stringify(b)});if(!Q.ok){const F=await Q.json();throw new Error(F.detail||"添加镜像源失败")}e({title:"添加成功",description:"镜像源已添加"}),p(!1),k({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O()}catch(R){e({title:"添加失败",description:R instanceof Error?R.message:"未知错误",variant:"destructive"})}},T=async()=>{if(d)try{const R=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${d.id}`,{method:"PUT",headers:{Authorization:`Bearer ${R}`,"Content-Type":"application/json"},body:JSON.stringify({name:b.name,raw_prefix:b.raw_prefix,clone_prefix:b.clone_prefix,enabled:b.enabled,priority:b.priority})})).ok)throw new Error("更新镜像源失败");e({title:"更新成功",description:"镜像源已更新"}),v(!1),h(null),O()}catch(R){e({title:"更新失败",description:R instanceof Error?R.message:"未知错误",variant:"destructive"})}},A=async R=>{if(confirm("确定要删除这个镜像源吗?"))try{const Q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${R}`,{method:"DELETE",headers:{Authorization:`Bearer ${Q}`}})).ok)throw new Error("删除镜像源失败");e({title:"删除成功",description:"镜像源已删除"}),O()}catch(Q){e({title:"删除失败",description:Q instanceof Error?Q.message:"未知错误",variant:"destructive"})}},_=async R=>{try{const Q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${R.id}`,{method:"PUT",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!R.enabled})})).ok)throw new Error("更新状态失败");O()}catch(Q){e({title:"更新失败",description:Q instanceof Error?Q.message:"未知错误",variant:"destructive"})}},D=R=>{h(R),k({id:R.id,name:R.name,raw_prefix:R.raw_prefix,clone_prefix:R.clone_prefix,enabled:R.enabled,priority:R.priority}),v(!0)},E=async(R,Q)=>{const F=Q==="up"?R.priority-1:R.priority+1;if(!(F<1))try{const L=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${R.id}`,{method:"PUT",headers:{Authorization:`Bearer ${L}`,"Content-Type":"application/json"},body:JSON.stringify({priority:F})})).ok)throw new Error("更新优先级失败");O()}catch(L){e({title:"更新失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}};return a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>t({to:"/plugins"}),children:a.jsx(R9,{className:"h-5 w-5"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),a.jsxs(ie,{onClick:()=>p(!0),children:[a.jsx(Wr,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),s?a.jsx(gt,{className:"p-6",children:a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(hf,{className:"h-8 w-8 animate-spin text-primary"})})}):l?a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Hu,{className:"h-12 w-12 text-destructive mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:l}),a.jsx(ie,{onClick:O,children:"重新加载"})]})}):a.jsxs(gt,{children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{children:"状态"}),a.jsx(xt,{children:"名称"}),a.jsx(xt,{children:"ID"}),a.jsx(xt,{children:"优先级"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n.map(R=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(jt,{checked:R.enabled,onCheckedChange:()=>_(R)})}),a.jsx(it,{children:a.jsxs("div",{children:[a.jsx("div",{className:"font-medium",children:R.name}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",R.raw_prefix]})]})}),a.jsx(it,{children:a.jsx(On,{variant:"outline",children:R.id})}),a.jsx(it,{children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-mono",children:R.priority}),a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx(ie,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(R,"up"),disabled:R.priority===1,children:a.jsx(e2,{className:"h-3 w-3"})}),a.jsx(ie,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(R,"down"),children:a.jsx(df,{className:"h-3 w-3"})})]})]})}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>D(R),children:a.jsx(nd,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>A(R.id),children:a.jsx(Ht,{className:"h-4 w-4 text-destructive"})})]})})]},R.id))})]})}),a.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(R=>a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:"font-semibold",children:R.name}),R.enabled&&a.jsx(On,{variant:"default",className:"text-xs",children:"启用"})]}),a.jsx(On,{variant:"outline",className:"mt-1 text-xs",children:R.id})]}),a.jsx(jt,{checked:R.enabled,onCheckedChange:()=>_(R)})]}),a.jsxs("div",{className:"text-sm space-y-1",children:[a.jsxs("div",{className:"text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"Raw: "}),a.jsx("span",{className:"break-all",children:R.raw_prefix})]}),a.jsxs("div",{className:"text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"优先级: "}),a.jsx("span",{className:"font-mono",children:R.priority})]})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[a.jsxs(ie,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>D(R),children:[a.jsx(nd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>E(R,"up"),disabled:R.priority===1,children:a.jsx(e2,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>E(R,"down"),children:a.jsx(df,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"destructive",size:"sm",onClick:()=>A(R.id),children:a.jsx(Ht,{className:"h-4 w-4"})})]})]})},R.id))})]}),a.jsx(Rr,{open:m,onOpenChange:p,children:a.jsxs(Nr,{className:"max-w-lg",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"添加镜像源"}),a.jsx(Gr,{children:"添加新的 Git 镜像源配置"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-id",children:"镜像源 ID *"}),a.jsx(Me,{id:"add-id",placeholder:"例如: my-mirror",value:b.id,onChange:R=>k({...b,id:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-name",children:"名称 *"}),a.jsx(Me,{id:"add-name",placeholder:"例如: 我的镜像源",value:b.name,onChange:R=>k({...b,name:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),a.jsx(Me,{id:"add-raw",placeholder:"https://example.com/raw",value:b.raw_prefix,onChange:R=>k({...b,raw_prefix:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-clone",children:"克隆前缀 *"}),a.jsx(Me,{id:"add-clone",placeholder:"https://example.com/clone",value:b.clone_prefix,onChange:R=>k({...b,clone_prefix:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-priority",children:"优先级"}),a.jsx(Me,{id:"add-priority",type:"number",min:"1",value:b.priority,onChange:R=>k({...b,priority:parseInt(R.target.value)||1})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"add-enabled",checked:b.enabled,onCheckedChange:R=>k({...b,enabled:R})}),a.jsx(te,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>p(!1),children:"取消"}),a.jsx(ie,{onClick:j,children:"添加"})]})]})}),a.jsx(Rr,{open:x,onOpenChange:v,children:a.jsxs(Nr,{className:"max-w-lg",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑镜像源"}),a.jsx(Gr,{children:"修改镜像源配置"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"镜像源 ID"}),a.jsx(Me,{value:b.id,disabled:!0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-name",children:"名称 *"}),a.jsx(Me,{id:"edit-name",value:b.name,onChange:R=>k({...b,name:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),a.jsx(Me,{id:"edit-raw",value:b.raw_prefix,onChange:R=>k({...b,raw_prefix:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-clone",children:"克隆前缀 *"}),a.jsx(Me,{id:"edit-clone",value:b.clone_prefix,onChange:R=>k({...b,clone_prefix:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-priority",children:"优先级"}),a.jsx(Me,{id:"edit-priority",type:"number",min:"1",value:b.priority,onChange:R=>k({...b,priority:parseInt(R.target.value)||1})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"edit-enabled",checked:b.enabled,onCheckedChange:R=>k({...b,enabled:R})}),a.jsx(te,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>v(!1),children:"取消"}),a.jsx(ie,{onClick:T,children:"保存"})]})]})})]})})}const Rme=Nd("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),Pz=S.forwardRef(({className:t,size:e,abbrTitle:n,children:r,...s},i)=>a.jsx("kbd",{className:ye(Rme({size:e,className:t})),ref:i,...s,children:n?a.jsx("abbr",{title:n,children:r}):r}));Pz.displayName="Kbd";const zme=[{icon:hg,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:ao,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:z9,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:P9,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:K4,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Wf,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:B9,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:Tq,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:pg,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:fg,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:Ii,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function Pme({open:t,onOpenChange:e}){const[n,r]=S.useState(""),[s,i]=S.useState(0),l=wa(),c=zme.filter(m=>m.title.toLowerCase().includes(n.toLowerCase())||m.description.toLowerCase().includes(n.toLowerCase())||m.category.toLowerCase().includes(n.toLowerCase()));S.useEffect(()=>{t&&(r(""),i(0))},[t]);const d=S.useCallback(m=>{l({to:m}),e(!1)},[l,e]),h=S.useCallback(m=>{m.key==="ArrowDown"?(m.preventDefault(),i(p=>(p+1)%c.length)):m.key==="ArrowUp"?(m.preventDefault(),i(p=>(p-1+c.length)%c.length)):m.key==="Enter"&&c[s]&&(m.preventDefault(),d(c[s].path))},[c,s,d]);return a.jsx(Rr,{open:t,onOpenChange:e,children:a.jsxs(Nr,{className:"max-w-2xl p-0 gap-0",children:[a.jsxs(Cr,{className:"px-4 pt-4 pb-0",children:[a.jsx(Tr,{className:"sr-only",children:"搜索"}),a.jsxs("div",{className:"relative",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),a.jsx(Me,{value:n,onChange:m=>{r(m.target.value),i(0)},onKeyDown:h,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),a.jsx("div",{className:"border-t",children:a.jsx(vn,{className:"h-[400px]",children:c.length>0?a.jsx("div",{className:"p-2",children:c.map((m,p)=>{const x=m.icon;return a.jsxs("button",{onClick:()=>d(m.path),onMouseEnter:()=>i(p),className:ye("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",p===s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[a.jsx(x,{className:"h-5 w-5 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium text-sm",children:m.title}),a.jsx("div",{className:"text-xs text-muted-foreground truncate",children:m.description})]}),a.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:m.category})]},m.path)})}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx(Bs,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),a.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function Bme(t){const e=Lme(t),n=S.forwardRef((r,s)=>{const{children:i,...l}=r,c=S.Children.toArray(i),d=c.find(qme);if(d){const h=d.props.children,m=c.map(p=>p===d?S.Children.count(h)>1?S.Children.only(null):S.isValidElement(h)?h.props.children:null:p);return a.jsx(e,{...l,ref:s,children:S.isValidElement(h)?S.cloneElement(h,void 0,m):null})}return a.jsx(e,{...l,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function Lme(t){const e=S.forwardRef((n,r)=>{const{children:s,...i}=n;if(S.isValidElement(s)){const l=Qme(s),c=Fme(i,s.props);return s.type!==S.Fragment&&(c.ref=r?oo(r,l):l),S.cloneElement(s,c)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Ime=Symbol("radix.slottable");function qme(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Ime}function Fme(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...c)=>{const d=i(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function Qme(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var z4=["Enter"," "],$me=["ArrowDown","PageUp","Home"],Bz=["ArrowUp","PageDown","End"],Hme=[...$me,...Bz],Ume={ltr:[...z4,"ArrowRight"],rtl:[...z4,"ArrowLeft"]},Vme={ltr:["ArrowLeft"],rtl:["ArrowRight"]},T0="Menu",[$f,Wme,Gme]=tx(T0),[Lc,Lz]=Vi(T0,[Gme,wd,fx]),A0=wd(),Iz=fx(),[qz,Eo]=Lc(T0),[Xme,M0]=Lc(T0),Fz=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:l=!0}=t,c=A0(e),[d,h]=S.useState(null),m=S.useRef(!1),p=es(i),x=Vf(s);return S.useEffect(()=>{const v=()=>{m.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>m.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),a.jsx(ix,{...c,children:a.jsx(qz,{scope:e,open:n,onOpenChange:p,content:d,onContentChange:h,children:a.jsx(Xme,{scope:e,onClose:S.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:m,dir:x,modal:l,children:r})})})};Fz.displayName=T0;var Yme="MenuAnchor",Z5=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=A0(n);return a.jsx(ax,{...s,...r,ref:e})});Z5.displayName=Yme;var J5="MenuPortal",[Kme,Qz]=Lc(J5,{forceMount:void 0}),$z=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=Eo(J5,e);return a.jsx(Kme,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};$z.displayName=J5;var Ci="MenuContent",[Zme,e3]=Lc(Ci),Hz=S.forwardRef((t,e)=>{const n=Qz(Ci,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Eo(Ci,t.__scopeMenu),l=M0(Ci,t.__scopeMenu);return a.jsx($f.Provider,{scope:t.__scopeMenu,children:a.jsx(Ls,{present:r||i.open,children:a.jsx($f.Slot,{scope:t.__scopeMenu,children:l.modal?a.jsx(Jme,{...s,ref:e}):a.jsx(epe,{...s,ref:e})})})})}),Jme=S.forwardRef((t,e)=>{const n=Eo(Ci,t.__scopeMenu),r=S.useRef(null),s=Cn(e,r);return S.useEffect(()=>{const i=r.current;if(i)return j9(i)},[]),a.jsx(t3,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:$e(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),epe=S.forwardRef((t,e)=>{const n=Eo(Ci,t.__scopeMenu);return a.jsx(t3,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),tpe=Bme("MenuContent.ScrollLock"),t3=S.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:d,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:x,onDismiss:v,disableOutsideScroll:b,...k}=t,O=Eo(Ci,n),j=M0(Ci,n),T=A0(n),A=Iz(n),_=Wme(n),[D,E]=S.useState(null),R=S.useRef(null),Q=Cn(e,R,O.onContentChange),F=S.useRef(0),L=S.useRef(""),U=S.useRef(0),V=S.useRef(null),de=S.useRef("right"),W=S.useRef(0),J=b?N9:S.Fragment,$=b?{as:tpe,allowPinchZoom:!0}:void 0,ae=ce=>{const z=L.current+ce,xe=_().filter(ve=>!ve.disabled),Y=document.activeElement,P=xe.find(ve=>ve.ref.current===Y)?.textValue,K=xe.map(ve=>ve.textValue),H=fpe(K,z,P),fe=xe.find(ve=>ve.textValue===H)?.ref.current;(function ve(Re){L.current=Re,window.clearTimeout(F.current),Re!==""&&(F.current=window.setTimeout(()=>ve(""),1e3))})(z),fe&&setTimeout(()=>fe.focus())};S.useEffect(()=>()=>window.clearTimeout(F.current),[]),C9();const ne=S.useCallback(ce=>de.current===V.current?.side&&ppe(ce,V.current?.area),[]);return a.jsx(Zme,{scope:n,searchRef:L,onItemEnter:S.useCallback(ce=>{ne(ce)&&ce.preventDefault()},[ne]),onItemLeave:S.useCallback(ce=>{ne(ce)||(R.current?.focus(),E(null))},[ne]),onTriggerLeave:S.useCallback(ce=>{ne(ce)&&ce.preventDefault()},[ne]),pointerGraceTimerRef:U,onPointerGraceIntentChange:S.useCallback(ce=>{V.current=ce},[]),children:a.jsx(J,{...$,children:a.jsx(T9,{asChild:!0,trapped:s,onMountAutoFocus:$e(i,ce=>{ce.preventDefault(),R.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:x,onDismiss:v,children:a.jsx(NC,{asChild:!0,...A,dir:j.dir,orientation:"vertical",loop:r,currentTabStopId:D,onCurrentTabStopIdChange:E,onEntryFocus:$e(d,ce=>{j.isUsingKeyboardRef.current||ce.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(X4,{role:"menu","aria-orientation":"vertical","data-state":lP(O.open),"data-radix-menu-content":"",dir:j.dir,...T,...k,ref:Q,style:{outline:"none",...k.style},onKeyDown:$e(k.onKeyDown,ce=>{const xe=ce.target.closest("[data-radix-menu-content]")===ce.currentTarget,Y=ce.ctrlKey||ce.altKey||ce.metaKey,P=ce.key.length===1;xe&&(ce.key==="Tab"&&ce.preventDefault(),!Y&&P&&ae(ce.key));const K=R.current;if(ce.target!==K||!Hme.includes(ce.key))return;ce.preventDefault();const fe=_().filter(ve=>!ve.disabled).map(ve=>ve.ref.current);Bz.includes(ce.key)&&fe.reverse(),dpe(fe)}),onBlur:$e(t.onBlur,ce=>{ce.currentTarget.contains(ce.target)||(window.clearTimeout(F.current),L.current="")}),onPointerMove:$e(t.onPointerMove,Hf(ce=>{const z=ce.target,xe=W.current!==ce.clientX;if(ce.currentTarget.contains(z)&&xe){const Y=ce.clientX>W.current?"right":"left";de.current=Y,W.current=ce.clientX}}))})})})})})})});Hz.displayName=Ci;var npe="MenuGroup",n3=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Zt.div,{role:"group",...r,ref:e})});n3.displayName=npe;var rpe="MenuLabel",Uz=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Zt.div,{...r,ref:e})});Uz.displayName=rpe;var Jg="MenuItem",l9="menu.itemSelect",Kx=S.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=S.useRef(null),l=M0(Jg,t.__scopeMenu),c=e3(Jg,t.__scopeMenu),d=Cn(e,i),h=S.useRef(!1),m=()=>{const p=i.current;if(!n&&p){const x=new CustomEvent(l9,{bubbles:!0,cancelable:!0});p.addEventListener(l9,v=>r?.(v),{once:!0}),M9(p,x),x.defaultPrevented?h.current=!1:l.onClose()}};return a.jsx(Vz,{...s,ref:d,disabled:n,onClick:$e(t.onClick,m),onPointerDown:p=>{t.onPointerDown?.(p),h.current=!0},onPointerUp:$e(t.onPointerUp,p=>{h.current||p.currentTarget?.click()}),onKeyDown:$e(t.onKeyDown,p=>{const x=c.searchRef.current!=="";n||x&&p.key===" "||z4.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Kx.displayName=Jg;var Vz=S.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,l=e3(Jg,n),c=Iz(n),d=S.useRef(null),h=Cn(e,d),[m,p]=S.useState(!1),[x,v]=S.useState("");return S.useEffect(()=>{const b=d.current;b&&v((b.textContent??"").trim())},[i.children]),a.jsx($f.ItemSlot,{scope:n,disabled:r,textValue:s??x,children:a.jsx(CC,{asChild:!0,...c,focusable:!r,children:a.jsx(Zt.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:h,onPointerMove:$e(t.onPointerMove,Hf(b=>{r?l.onItemLeave(b):(l.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:$e(t.onPointerLeave,Hf(b=>l.onItemLeave(b))),onFocus:$e(t.onFocus,()=>p(!0)),onBlur:$e(t.onBlur,()=>p(!1))})})})}),spe="MenuCheckboxItem",Wz=S.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return a.jsx(Zz,{scope:t.__scopeMenu,checked:n,children:a.jsx(Kx,{role:"menuitemcheckbox","aria-checked":ex(n)?"mixed":n,...s,ref:e,"data-state":i3(n),onSelect:$e(s.onSelect,()=>r?.(ex(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Wz.displayName=spe;var Gz="MenuRadioGroup",[ipe,ape]=Lc(Gz,{value:void 0,onValueChange:()=>{}}),Xz=S.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=es(r);return a.jsx(ipe,{scope:t.__scopeMenu,value:n,onValueChange:i,children:a.jsx(n3,{...s,ref:e})})});Xz.displayName=Gz;var Yz="MenuRadioItem",Kz=S.forwardRef((t,e)=>{const{value:n,...r}=t,s=ape(Yz,t.__scopeMenu),i=n===s.value;return a.jsx(Zz,{scope:t.__scopeMenu,checked:i,children:a.jsx(Kx,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":i3(i),onSelect:$e(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Kz.displayName=Yz;var r3="MenuItemIndicator",[Zz,lpe]=Lc(r3,{checked:!1}),Jz=S.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=lpe(r3,n);return a.jsx(Ls,{present:r||ex(i.checked)||i.checked===!0,children:a.jsx(Zt.span,{...s,ref:e,"data-state":i3(i.checked)})})});Jz.displayName=r3;var ope="MenuSeparator",eP=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Zt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});eP.displayName=ope;var cpe="MenuArrow",tP=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=A0(n);return a.jsx(Y4,{...s,...r,ref:e})});tP.displayName=cpe;var s3="MenuSub",[upe,nP]=Lc(s3),rP=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:s}=t,i=Eo(s3,e),l=A0(e),[c,d]=S.useState(null),[h,m]=S.useState(null),p=es(s);return S.useEffect(()=>(i.open===!1&&p(!1),()=>p(!1)),[i.open,p]),a.jsx(ix,{...l,children:a.jsx(qz,{scope:e,open:r,onOpenChange:p,content:h,onContentChange:m,children:a.jsx(upe,{scope:e,contentId:ji(),triggerId:ji(),trigger:c,onTriggerChange:d,children:n})})})};rP.displayName=s3;var Gh="MenuSubTrigger",sP=S.forwardRef((t,e)=>{const n=Eo(Gh,t.__scopeMenu),r=M0(Gh,t.__scopeMenu),s=nP(Gh,t.__scopeMenu),i=e3(Gh,t.__scopeMenu),l=S.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:d}=i,h={__scopeMenu:t.__scopeMenu},m=S.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return S.useEffect(()=>m,[m]),S.useEffect(()=>{const p=c.current;return()=>{window.clearTimeout(p),d(null)}},[c,d]),a.jsx(Z5,{asChild:!0,...h,children:a.jsx(Vz,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":lP(n.open),...t,ref:oo(e,s.onTriggerChange),onClick:p=>{t.onClick?.(p),!(t.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:$e(t.onPointerMove,Hf(p=>{i.onItemEnter(p),!p.defaultPrevented&&!t.disabled&&!n.open&&!l.current&&(i.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:$e(t.onPointerLeave,Hf(p=>{m();const x=n.content?.getBoundingClientRect();if(x){const v=n.content?.dataset.side,b=v==="right",k=b?-5:5,O=x[b?"left":"right"],j=x[b?"right":"left"];i.onPointerGraceIntentChange({area:[{x:p.clientX+k,y:p.clientY},{x:O,y:x.top},{x:j,y:x.top},{x:j,y:x.bottom},{x:O,y:x.bottom}],side:v}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(p),p.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:$e(t.onKeyDown,p=>{const x=i.searchRef.current!=="";t.disabled||x&&p.key===" "||Ume[r.dir].includes(p.key)&&(n.onOpenChange(!0),n.content?.focus(),p.preventDefault())})})})});sP.displayName=Gh;var iP="MenuSubContent",aP=S.forwardRef((t,e)=>{const n=Qz(Ci,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Eo(Ci,t.__scopeMenu),l=M0(Ci,t.__scopeMenu),c=nP(iP,t.__scopeMenu),d=S.useRef(null),h=Cn(e,d);return a.jsx($f.Provider,{scope:t.__scopeMenu,children:a.jsx(Ls,{present:r||i.open,children:a.jsx($f.Slot,{scope:t.__scopeMenu,children:a.jsx(t3,{id:c.contentId,"aria-labelledby":c.triggerId,...s,ref:h,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{l.isUsingKeyboardRef.current&&d.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:$e(t.onFocusOutside,m=>{m.target!==c.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:$e(t.onEscapeKeyDown,m=>{l.onClose(),m.preventDefault()}),onKeyDown:$e(t.onKeyDown,m=>{const p=m.currentTarget.contains(m.target),x=Vme[l.dir].includes(m.key);p&&x&&(i.onOpenChange(!1),c.trigger?.focus(),m.preventDefault())})})})})})});aP.displayName=iP;function lP(t){return t?"open":"closed"}function ex(t){return t==="indeterminate"}function i3(t){return ex(t)?"indeterminate":t?"checked":"unchecked"}function dpe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function hpe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function fpe(t,e,n){const s=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let l=hpe(t,Math.max(i,0));s.length===1&&(l=l.filter(h=>h!==n));const d=l.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return d!==n?d:void 0}function mpe(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,l=e.length-1;ir!=x>r&&n<(p-h)*(r-m)/(x-m)+h&&(s=!s)}return s}function ppe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return mpe(n,e)}function Hf(t){return e=>e.pointerType==="mouse"?t(e):void 0}var gpe=Fz,xpe=Z5,vpe=$z,ype=Hz,bpe=n3,wpe=Uz,Spe=Kx,kpe=Wz,Ope=Xz,jpe=Kz,Npe=Jz,Cpe=eP,Tpe=tP,Ape=rP,Mpe=sP,Epe=aP,a3="ContextMenu",[_pe]=Vi(a3,[Lz]),ls=Lz(),[Dpe,oP]=_pe(a3),cP=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:s,modal:i=!0}=t,[l,c]=S.useState(!1),d=ls(e),h=es(r),m=S.useCallback(p=>{c(p),h(p)},[h]);return a.jsx(Dpe,{scope:e,open:l,onOpenChange:m,modal:i,children:a.jsx(gpe,{...d,dir:s,open:l,onOpenChange:m,modal:i,children:n})})};cP.displayName=a3;var uP="ContextMenuTrigger",dP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=t,i=oP(uP,n),l=ls(n),c=S.useRef({x:0,y:0}),d=S.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...c.current})}),h=S.useRef(0),m=S.useCallback(()=>window.clearTimeout(h.current),[]),p=x=>{c.current={x:x.clientX,y:x.clientY},i.onOpenChange(!0)};return S.useEffect(()=>m,[m]),S.useEffect(()=>void(r&&m()),[r,m]),a.jsxs(a.Fragment,{children:[a.jsx(xpe,{...l,virtualRef:d}),a.jsx(Zt.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:$e(t.onContextMenu,x=>{m(),p(x),x.preventDefault()}),onPointerDown:r?t.onPointerDown:$e(t.onPointerDown,Fp(x=>{m(),h.current=window.setTimeout(()=>p(x),700)})),onPointerMove:r?t.onPointerMove:$e(t.onPointerMove,Fp(m)),onPointerCancel:r?t.onPointerCancel:$e(t.onPointerCancel,Fp(m)),onPointerUp:r?t.onPointerUp:$e(t.onPointerUp,Fp(m))})]})});dP.displayName=uP;var Rpe="ContextMenuPortal",hP=t=>{const{__scopeContextMenu:e,...n}=t,r=ls(e);return a.jsx(vpe,{...r,...n})};hP.displayName=Rpe;var fP="ContextMenuContent",mP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=oP(fP,n),i=ls(n),l=S.useRef(!1);return a.jsx(ype,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:c=>{t.onCloseAutoFocus?.(c),!c.defaultPrevented&&l.current&&c.preventDefault(),l.current=!1},onInteractOutside:c=>{t.onInteractOutside?.(c),!c.defaultPrevented&&!s.modal&&(l.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});mP.displayName=fP;var zpe="ContextMenuGroup",Ppe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(bpe,{...s,...r,ref:e})});Ppe.displayName=zpe;var Bpe="ContextMenuLabel",pP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(wpe,{...s,...r,ref:e})});pP.displayName=Bpe;var Lpe="ContextMenuItem",gP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Spe,{...s,...r,ref:e})});gP.displayName=Lpe;var Ipe="ContextMenuCheckboxItem",xP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(kpe,{...s,...r,ref:e})});xP.displayName=Ipe;var qpe="ContextMenuRadioGroup",Fpe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Ope,{...s,...r,ref:e})});Fpe.displayName=qpe;var Qpe="ContextMenuRadioItem",vP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(jpe,{...s,...r,ref:e})});vP.displayName=Qpe;var $pe="ContextMenuItemIndicator",yP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Npe,{...s,...r,ref:e})});yP.displayName=$pe;var Hpe="ContextMenuSeparator",bP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Cpe,{...s,...r,ref:e})});bP.displayName=Hpe;var Upe="ContextMenuArrow",Vpe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Tpe,{...s,...r,ref:e})});Vpe.displayName=Upe;var wP="ContextMenuSub",SP=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,open:s,defaultOpen:i}=t,l=ls(e),[c,d]=ko({prop:s,defaultProp:i??!1,onChange:r,caller:wP});return a.jsx(Ape,{...l,open:c,onOpenChange:d,children:n})};SP.displayName=wP;var Wpe="ContextMenuSubTrigger",kP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Mpe,{...s,...r,ref:e})});kP.displayName=Wpe;var Gpe="ContextMenuSubContent",OP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Epe,{...s,...r,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});OP.displayName=Gpe;function Fp(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var Xpe=cP,Ype=dP,Kpe=hP,jP=mP,NP=pP,CP=gP,TP=xP,AP=vP,MP=yP,EP=bP,Zpe=SP,_P=kP,DP=OP;const Jpe=Xpe,ege=Ype,tge=Zpe,RP=S.forwardRef(({className:t,inset:e,children:n,...r},s)=>a.jsxs(_P,{ref:s,className:ye("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...r,children:[n,a.jsx(Ac,{className:"ml-auto h-4 w-4"})]}));RP.displayName=_P.displayName;const zP=S.forwardRef(({className:t,...e},n)=>a.jsx(DP,{ref:n,className:ye("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 origin-[--radix-context-menu-content-transform-origin]",t),...e}));zP.displayName=DP.displayName;const PP=S.forwardRef(({className:t,...e},n)=>a.jsx(Kpe,{children:a.jsx(jP,{ref:n,className:ye("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-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 origin-[--radix-context-menu-content-transform-origin]",t),...e})}));PP.displayName=jP.displayName;const Bi=S.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(CP,{ref:r,className:ye("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));Bi.displayName=CP.displayName;const nge=S.forwardRef(({className:t,children:e,checked:n,...r},s)=>a.jsxs(TP,{ref:s,className:ye("relative flex 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),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(MP,{children:a.jsx(hc,{className:"h-4 w-4"})})}),e]}));nge.displayName=TP.displayName;const rge=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(AP,{ref:r,className:ye("relative flex 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(MP,{children:a.jsx(Aq,{className:"h-2 w-2 fill-current"})})}),e]}));rge.displayName=AP.displayName;const sge=S.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(NP,{ref:r,className:ye("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...n}));sge.displayName=NP.displayName;const Xh=S.forwardRef(({className:t,...e},n)=>a.jsx(EP,{ref:n,className:ye("-mx-1 my-1 h-px bg-border",t),...e}));Xh.displayName=EP.displayName;const qu=({className:t,...e})=>a.jsx("span",{className:ye("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});qu.displayName="ContextMenuShortcut";var ige=Symbol("radix.slottable");function age(t){const e=({children:n})=>a.jsx(a.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=ige,e}var[Zx]=Vi("Tooltip",[wd]),Jx=wd(),BP="TooltipProvider",lge=700,P4="tooltip.open",[oge,l3]=Zx(BP),LP=t=>{const{__scopeTooltip:e,delayDuration:n=lge,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,l=S.useRef(!0),c=S.useRef(!1),d=S.useRef(0);return S.useEffect(()=>{const h=d.current;return()=>window.clearTimeout(h)},[]),a.jsx(oge,{scope:e,isOpenDelayedRef:l,delayDuration:n,onOpen:S.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:S.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:S.useCallback(h=>{c.current=h},[]),disableHoverableContent:s,children:i})};LP.displayName=BP;var Uf="Tooltip",[cge,E0]=Zx(Uf),IP=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:l,delayDuration:c}=t,d=l3(Uf,t.__scopeTooltip),h=Jx(e),[m,p]=S.useState(null),x=ji(),v=S.useRef(0),b=l??d.disableHoverableContent,k=c??d.delayDuration,O=S.useRef(!1),[j,T]=ko({prop:r,defaultProp:s??!1,onChange:R=>{R?(d.onOpen(),document.dispatchEvent(new CustomEvent(P4))):d.onClose(),i?.(R)},caller:Uf}),A=S.useMemo(()=>j?O.current?"delayed-open":"instant-open":"closed",[j]),_=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,O.current=!1,T(!0)},[T]),D=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,T(!1)},[T]),E=S.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{O.current=!0,T(!0),v.current=0},k)},[k,T]);return S.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),a.jsx(ix,{...h,children:a.jsx(cge,{scope:e,contentId:x,open:j,stateAttribute:A,trigger:m,onTriggerChange:p,onTriggerEnter:S.useCallback(()=>{d.isOpenDelayedRef.current?E():_()},[d.isOpenDelayedRef,E,_]),onTriggerLeave:S.useCallback(()=>{b?D():(window.clearTimeout(v.current),v.current=0)},[D,b]),onOpen:_,onClose:D,disableHoverableContent:b,children:n})})};IP.displayName=Uf;var B4="TooltipTrigger",qP=S.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=E0(B4,n),i=l3(B4,n),l=Jx(n),c=S.useRef(null),d=Cn(e,c,s.onTriggerChange),h=S.useRef(!1),m=S.useRef(!1),p=S.useCallback(()=>h.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),a.jsx(ax,{asChild:!0,...l,children:a.jsx(Zt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:d,onPointerMove:$e(t.onPointerMove,x=>{x.pointerType!=="touch"&&!m.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),m.current=!0)}),onPointerLeave:$e(t.onPointerLeave,()=>{s.onTriggerLeave(),m.current=!1}),onPointerDown:$e(t.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:$e(t.onFocus,()=>{h.current||s.onOpen()}),onBlur:$e(t.onBlur,s.onClose),onClick:$e(t.onClick,s.onClose)})})});qP.displayName=B4;var o3="TooltipPortal",[uge,dge]=Zx(o3,{forceMount:void 0}),FP=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=E0(o3,e);return a.jsx(uge,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};FP.displayName=o3;var bd="TooltipContent",QP=S.forwardRef((t,e)=>{const n=dge(bd,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,l=E0(bd,t.__scopeTooltip);return a.jsx(Ls,{present:r||l.open,children:l.disableHoverableContent?a.jsx($P,{side:s,...i,ref:e}):a.jsx(hge,{side:s,...i,ref:e})})}),hge=S.forwardRef((t,e)=>{const n=E0(bd,t.__scopeTooltip),r=l3(bd,t.__scopeTooltip),s=S.useRef(null),i=Cn(e,s),[l,c]=S.useState(null),{trigger:d,onClose:h}=n,m=s.current,{onPointerInTransitChange:p}=r,x=S.useCallback(()=>{c(null),p(!1)},[p]),v=S.useCallback((b,k)=>{const O=b.currentTarget,j={x:b.clientX,y:b.clientY},T=xge(j,O.getBoundingClientRect()),A=vge(j,T),_=yge(k.getBoundingClientRect()),D=wge([...A,..._]);c(D),p(!0)},[p]);return S.useEffect(()=>()=>x(),[x]),S.useEffect(()=>{if(d&&m){const b=O=>v(O,m),k=O=>v(O,d);return d.addEventListener("pointerleave",b),m.addEventListener("pointerleave",k),()=>{d.removeEventListener("pointerleave",b),m.removeEventListener("pointerleave",k)}}},[d,m,v,x]),S.useEffect(()=>{if(l){const b=k=>{const O=k.target,j={x:k.clientX,y:k.clientY},T=d?.contains(O)||m?.contains(O),A=!bge(j,l);T?x():A&&(x(),h())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[d,m,l,h,x]),a.jsx($P,{...t,ref:i})}),[fge,mge]=Zx(Uf,{isInside:!1}),pge=age("TooltipContent"),$P=S.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:l,...c}=t,d=E0(bd,n),h=Jx(n),{onClose:m}=d;return S.useEffect(()=>(document.addEventListener(P4,m),()=>document.removeEventListener(P4,m)),[m]),S.useEffect(()=>{if(d.trigger){const p=x=>{x.target?.contains(d.trigger)&&m()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[d.trigger,m]),a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:p=>p.preventDefault(),onDismiss:m,children:a.jsxs(X4,{"data-state":d.stateAttribute,...h,...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(pge,{children:r}),a.jsx(fge,{scope:n,isInside:!0,children:a.jsx(sq,{id:d.contentId,role:"tooltip",children:s||r})})]})})});QP.displayName=bd;var HP="TooltipArrow",gge=S.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Jx(n);return mge(HP,n).isInside?null:a.jsx(Y4,{...s,...r,ref:e})});gge.displayName=HP;function xge(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function vge(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 yge(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function bge(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,l=e.length-1;ir!=x>r&&n<(p-h)*(r-m)/(x-m)+h&&(s=!s)}return s}function wge(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),Sge(e)}function Sge(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const i=e[e.length-1],l=e[e.length-2];if((i.x-l.x)*(s.y-l.y)>=(i.y-l.y)*(s.x-l.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],l=n[n.length-2];if((i.x-l.x)*(s.y-l.y)>=(i.y-l.y)*(s.x-l.x))n.pop();else break}n.push(s)}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 kge=LP,Oge=IP,jge=qP,Nge=FP,UP=QP;const Cge=kge,Tge=Oge,Age=jge,VP=S.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(Nge,{children:a.jsx(UP,{ref:r,sideOffset:e,className:ye("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",t),...n})}));VP.displayName=UP.displayName;function Mge({children:t}){CH();const[e,n]=S.useState(!0),[r,s]=S.useState(!1),[i,l]=S.useState(!1),{theme:c,setTheme:d}=dw(),h=AI(),m=wa();S.useEffect(()=>{const k=O=>{(O.metaKey||O.ctrlKey)&&O.key==="k"&&(O.preventDefault(),l(!0))};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[]);const p=[{title:"概览",items:[{icon:hg,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:ao,label:"麦麦主程序配置",path:"/config/bot"},{icon:z9,label:"麦麦模型提供商配置",path:"/config/modelProvider"},{icon:P9,label:"麦麦模型配置",path:"/config/model"},{icon:hO,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:K4,label:"表情包管理",path:"/resource/emoji"},{icon:Wf,label:"表达方式管理",path:"/resource/expression"},{icon:B9,label:"人物信息管理",path:"/resource/person"}]},{title:"扩展与监控",items:[{icon:pg,label:"插件市场",path:"/plugins"},{icon:hO,label:"插件配置",path:"/plugin-config"},{icon:fg,label:"日志查看器",path:"/logs"}]},{title:"系统",items:[{icon:Ii,label:"系统设置",path:"/settings"}]}],v=c==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":c,b=()=>{localStorage.removeItem("access-token"),m({to:"/auth"})};return a.jsx(Cge,{delayDuration:300,children:a.jsxs("div",{className:"flex h-screen overflow-hidden",children:[a.jsxs("aside",{className:ye("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",e?"lg:w-64":"lg:w-16",r?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[a.jsx("div",{className:"flex h-16 items-center border-b px-4",children:a.jsxs("div",{className:ye("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!e&&"lg:flex-none lg:w-8"),children:[a.jsxs("div",{className:ye("flex items-baseline gap-2",!e&&"lg:hidden"),children:[a.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),a.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:rH()})]}),!e&&a.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),a.jsx("nav",{className:"flex-1 overflow-y-auto p-4",children:a.jsx("ul",{className:ye("space-y-6",!e&&"lg:space-y-3"),children:p.map((k,O)=>a.jsxs("li",{children:[a.jsx("div",{className:ye("px-3 h-[1.25rem]","mb-2",!e&&"lg:mb-1 lg:invisible"),children:a.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:k.title})}),!e&&O>0&&a.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),a.jsx("ul",{className:"space-y-1",children:k.items.map(j=>{const T=h({to:j.path}),A=j.icon,_=a.jsxs(a.Fragment,{children:[T&&a.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),a.jsxs("div",{className:ye("flex items-center transition-all duration-300",e?"gap-3":"lg:gap-0"),children:[a.jsx(A,{className:ye("h-5 w-5 flex-shrink-0",T&&"text-primary"),strokeWidth:2,fill:"none"}),a.jsx("span",{className:ye("text-sm font-medium whitespace-nowrap transition-all duration-300",T&&"font-semibold",e?"opacity-100 max-w-[200px]":"lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:j.label})]})]});return a.jsx("li",{className:"relative",children:a.jsxs(Tge,{children:[a.jsx(Age,{asChild:!0,children:a.jsx(MI,{to:j.path,className:ye("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",T?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",e?"px-3":"lg:px-0 lg:justify-center"),onClick:()=>s(!1),children:_})}),!e&&a.jsx(VP,{side:"right",className:"hidden lg:block",children:a.jsx("p",{children:j.label})})]})},j.path)})})]},k.title))})})]}),r&&a.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>s(!1)}),a.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[a.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:()=>s(!r),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:a.jsx(Mq,{className:"h-5 w-5"})}),a.jsx("button",{onClick:()=>n(!e),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:e?"收起侧边栏":"展开侧边栏",children:a.jsx(Tc,{className:ye("h-5 w-5 transition-transform",!e&&"rotate-180")})})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>l(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),a.jsxs(Pz,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[a.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),a.jsx(Pme,{open:i,onOpenChange:l}),a.jsxs(ie,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[a.jsx(Eq,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),a.jsx("button",{onClick:k=>{Q$(v==="dark"?"light":"dark",d,k)},className:"rounded-lg p-2 hover:bg-accent",title:v==="dark"?"切换到浅色模式":"切换到深色模式",children:v==="dark"?a.jsx(Zb,{className:"h-5 w-5"}):a.jsx(Jb,{className:"h-5 w-5"})}),a.jsx("div",{className:"h-6 w-px bg-border"}),a.jsxs(ie,{variant:"ghost",size:"sm",onClick:b,className:"gap-2",title:"登出系统",children:[a.jsx(fO,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),a.jsxs(Jpe,{children:[a.jsx(ege,{asChild:!0,children:a.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:t})}),a.jsxs(PP,{className:"w-64",children:[a.jsxs(Bi,{onClick:()=>m({to:"/"}),children:[a.jsx(hg,{className:"mr-2 h-4 w-4"}),"首页"]}),a.jsxs(Bi,{onClick:()=>m({to:"/settings"}),children:[a.jsx(Ii,{className:"mr-2 h-4 w-4"}),"系统设置"]}),a.jsxs(Bi,{onClick:()=>m({to:"/logs"}),children:[a.jsx(fg,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),a.jsx(Xh,{}),a.jsxs(tge,{children:[a.jsxs(RP,{children:[a.jsx(_9,{className:"mr-2 h-4 w-4"}),"切换主题"]}),a.jsxs(zP,{className:"w-48",children:[a.jsxs(Bi,{onClick:()=>d("light"),disabled:c==="light",children:[a.jsx(Zb,{className:"mr-2 h-4 w-4"}),"浅色",c==="light"&&a.jsx(qu,{children:"✓"})]}),a.jsxs(Bi,{onClick:()=>d("dark"),disabled:c==="dark",children:[a.jsx(Jb,{className:"mr-2 h-4 w-4"}),"深色",c==="dark"&&a.jsx(qu,{children:"✓"})]}),a.jsxs(Bi,{onClick:()=>d("system"),disabled:c==="system",children:[a.jsx(Ii,{className:"mr-2 h-4 w-4"}),"跟随系统",c==="system"&&a.jsx(qu,{children:"✓"})]})]})]}),a.jsx(Xh,{}),a.jsxs(Bi,{onClick:()=>window.location.reload(),children:[a.jsx(_q,{className:"mr-2 h-4 w-4"}),"刷新页面",a.jsx(qu,{children:"⌘R"})]}),a.jsxs(Bi,{onClick:()=>l(!0),children:[a.jsx(Bs,{className:"mr-2 h-4 w-4"}),"搜索",a.jsx(qu,{children:"⌘K"})]}),a.jsx(Xh,{}),a.jsxs(Bi,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[a.jsx(Yh,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),a.jsx(Xh,{}),a.jsxs(Bi,{onClick:b,className:"text-destructive focus:text-destructive",children:[a.jsx(fO,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}const _0=EI({component:()=>a.jsxs(a.Fragment,{children:[a.jsx(c9,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!qT())throw DI({to:"/auth"})}}),Ege=Xr({getParentRoute:()=>_0,path:"/auth",component:TH}),_ge=Xr({getParentRoute:()=>_0,path:"/setup",component:WH}),Qs=Xr({getParentRoute:()=>_0,id:"protected",component:()=>a.jsx(Mge,{children:a.jsx(c9,{})})}),Dge=Xr({getParentRoute:()=>Qs,path:"/",component:q$}),Rge=Xr({getParentRoute:()=>Qs,path:"/config/bot",component:Vee}),zge=Xr({getParentRoute:()=>Qs,path:"/config/modelProvider",component:ote}),Pge=Xr({getParentRoute:()=>Qs,path:"/config/model",component:Pte}),Bge=Xr({getParentRoute:()=>Qs,path:"/config/adapter",component:qte}),Lge=Xr({getParentRoute:()=>Qs,path:"/resource/emoji",component:ude}),Ige=Xr({getParentRoute:()=>Qs,path:"/resource/expression",component:bde}),qge=Xr({getParentRoute:()=>Qs,path:"/resource/person",component:Ede}),Fge=Xr({getParentRoute:()=>Qs,path:"/logs",component:hme}),Qge=Xr({getParentRoute:()=>Qs,path:"/plugins",component:Eme}),$ge=Xr({getParentRoute:()=>Qs,path:"/plugin-config",component:_me}),Hge=Xr({getParentRoute:()=>Qs,path:"/plugin-mirrors",component:Dme}),Uge=Xr({getParentRoute:()=>Qs,path:"/settings",component:bH}),Vge=Xr({getParentRoute:()=>_0,path:"*",component:$T}),Wge=_0.addChildren([Ege,_ge,Qs.addChildren([Dge,Rge,zge,Pge,Bge,Lge,Ige,qge,Qge,$ge,Hge,Fge,Uge]),Vge]),Gge=_I({routeTree:Wge,defaultNotFoundComponent:$T});function Xge({children:t,defaultTheme:e="system",storageKey:n="ui-theme",...r}){const[s,i]=S.useState(()=>localStorage.getItem(n)||e);S.useEffect(()=>{const c=window.document.documentElement;if(c.classList.remove("light","dark"),s==="system"){const d=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";c.classList.add(d);return}c.classList.add(s)},[s]),S.useEffect(()=>{const c=localStorage.getItem("accent-color");if(c){const d=document.documentElement,m={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[c];m&&(d.style.setProperty("--primary",m.hsl),m.gradient?(d.style.setProperty("--primary-gradient",m.gradient),d.classList.add("has-gradient")):(d.style.removeProperty("--primary-gradient"),d.classList.remove("has-gradient")))}},[]);const l={theme:s,setTheme:c=>{localStorage.setItem(n,c),i(c)}};return a.jsx(uT.Provider,{...r,value:l,children:t})}function Yge({children:t,defaultEnabled:e=!0,defaultWavesEnabled:n=!0,storageKey:r="enable-animations",wavesStorageKey:s="enable-waves-background"}){const[i,l]=S.useState(()=>{const m=localStorage.getItem(r);return m!==null?m==="true":e}),[c,d]=S.useState(()=>{const m=localStorage.getItem(s);return m!==null?m==="true":n});S.useEffect(()=>{const m=document.documentElement;i?m.classList.remove("no-animations"):m.classList.add("no-animations"),localStorage.setItem(r,String(i))},[i,r]),S.useEffect(()=>{localStorage.setItem(s,String(c))},[c,s]);const h={enableAnimations:i,setEnableAnimations:l,enableWavesBackground:c,setEnableWavesBackground:d};return a.jsx(dT.Provider,{value:h,children:t})}var c3="ToastProvider",[u3,Kge,Zge]=tx("Toast"),[WP]=Vi("Toast",[Zge]),[Jge,e1]=WP(c3),GP=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:l}=t,[c,d]=S.useState(null),[h,m]=S.useState(0),p=S.useRef(!1),x=S.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${c3}\`. Expected non-empty \`string\`.`),a.jsx(u3.Provider,{scope:e,children:a.jsx(Jge,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:h,viewport:c,onViewportChange:d,onToastAdd:S.useCallback(()=>m(v=>v+1),[]),onToastRemove:S.useCallback(()=>m(v=>v-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:x,children:l})})};GP.displayName=c3;var XP="ToastViewport",exe=["F8"],L4="toast.viewportPause",I4="toast.viewportResume",YP=S.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=exe,label:s="Notifications ({hotkey})",...i}=t,l=e1(XP,n),c=Kge(n),d=S.useRef(null),h=S.useRef(null),m=S.useRef(null),p=S.useRef(null),x=Cn(e,p,l.onViewportChange),v=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=l.toastCount>0;S.useEffect(()=>{const O=j=>{r.length!==0&&r.every(A=>j[A]||j.code===A)&&p.current?.focus()};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[r]),S.useEffect(()=>{const O=d.current,j=p.current;if(b&&O&&j){const T=()=>{if(!l.isClosePausedRef.current){const E=new CustomEvent(L4);j.dispatchEvent(E),l.isClosePausedRef.current=!0}},A=()=>{if(l.isClosePausedRef.current){const E=new CustomEvent(I4);j.dispatchEvent(E),l.isClosePausedRef.current=!1}},_=E=>{!O.contains(E.relatedTarget)&&A()},D=()=>{O.contains(document.activeElement)||A()};return O.addEventListener("focusin",T),O.addEventListener("focusout",_),O.addEventListener("pointermove",T),O.addEventListener("pointerleave",D),window.addEventListener("blur",T),window.addEventListener("focus",A),()=>{O.removeEventListener("focusin",T),O.removeEventListener("focusout",_),O.removeEventListener("pointermove",T),O.removeEventListener("pointerleave",D),window.removeEventListener("blur",T),window.removeEventListener("focus",A)}}},[b,l.isClosePausedRef]);const k=S.useCallback(({tabbingDirection:O})=>{const T=c().map(A=>{const _=A.ref.current,D=[_,...fxe(_)];return O==="forwards"?D:D.reverse()});return(O==="forwards"?T.reverse():T).flat()},[c]);return S.useEffect(()=>{const O=p.current;if(O){const j=T=>{const A=T.altKey||T.ctrlKey||T.metaKey;if(T.key==="Tab"&&!A){const D=document.activeElement,E=T.shiftKey;if(T.target===O&&E){h.current?.focus();return}const F=k({tabbingDirection:E?"backwards":"forwards"}),L=F.findIndex(U=>U===D);Gb(F.slice(L+1))?T.preventDefault():E?h.current?.focus():m.current?.focus()}};return O.addEventListener("keydown",j),()=>O.removeEventListener("keydown",j)}},[c,k]),a.jsxs(iq,{ref:d,role:"region","aria-label":s.replace("{hotkey}",v),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&a.jsx(q4,{ref:h,onFocusFromOutsideViewport:()=>{const O=k({tabbingDirection:"forwards"});Gb(O)}}),a.jsx(u3.Slot,{scope:n,children:a.jsx(Zt.ol,{tabIndex:-1,...i,ref:x})}),b&&a.jsx(q4,{ref:m,onFocusFromOutsideViewport:()=>{const O=k({tabbingDirection:"backwards"});Gb(O)}})]})});YP.displayName=XP;var KP="ToastFocusProxy",q4=S.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=e1(KP,n);return a.jsx(E9,{tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:l=>{const c=l.relatedTarget;!i.viewport?.contains(c)&&r()}})});q4.displayName=KP;var D0="Toast",txe="toast.swipeStart",nxe="toast.swipeMove",rxe="toast.swipeCancel",sxe="toast.swipeEnd",ZP=S.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...l}=t,[c,d]=ko({prop:r,defaultProp:s??!0,onChange:i,caller:D0});return a.jsx(Ls,{present:n||c,children:a.jsx(lxe,{open:c,...l,ref:e,onClose:()=>d(!1),onPause:es(t.onPause),onResume:es(t.onResume),onSwipeStart:$e(t.onSwipeStart,h=>{h.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:$e(t.onSwipeMove,h=>{const{x:m,y:p}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","move"),h.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${m}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:$e(t.onSwipeCancel,h=>{h.currentTarget.setAttribute("data-swipe","cancel"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:$e(t.onSwipeEnd,h=>{const{x:m,y:p}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","end"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${m}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),d(!1)})})})});ZP.displayName=D0;var[ixe,axe]=WP(D0,{onClose(){}}),lxe=S.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:l,onEscapeKeyDown:c,onPause:d,onResume:h,onSwipeStart:m,onSwipeMove:p,onSwipeCancel:x,onSwipeEnd:v,...b}=t,k=e1(D0,n),[O,j]=S.useState(null),T=Cn(e,W=>j(W)),A=S.useRef(null),_=S.useRef(null),D=s||k.duration,E=S.useRef(0),R=S.useRef(D),Q=S.useRef(0),{onToastAdd:F,onToastRemove:L}=k,U=es(()=>{O?.contains(document.activeElement)&&k.viewport?.focus(),l()}),V=S.useCallback(W=>{!W||W===1/0||(window.clearTimeout(Q.current),E.current=new Date().getTime(),Q.current=window.setTimeout(U,W))},[U]);S.useEffect(()=>{const W=k.viewport;if(W){const J=()=>{V(R.current),h?.()},$=()=>{const ae=new Date().getTime()-E.current;R.current=R.current-ae,window.clearTimeout(Q.current),d?.()};return W.addEventListener(L4,$),W.addEventListener(I4,J),()=>{W.removeEventListener(L4,$),W.removeEventListener(I4,J)}}},[k.viewport,D,d,h,V]),S.useEffect(()=>{i&&!k.isClosePausedRef.current&&V(D)},[i,D,k.isClosePausedRef,V]),S.useEffect(()=>(F(),()=>L()),[F,L]);const de=S.useMemo(()=>O?iB(O):null,[O]);return k.viewport?a.jsxs(a.Fragment,{children:[de&&a.jsx(oxe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:de}),a.jsx(ixe,{scope:n,onClose:U,children:RI.createPortal(a.jsx(u3.ItemSlot,{scope:n,children:a.jsx(aq,{asChild:!0,onEscapeKeyDown:$e(c,()=>{k.isFocusedToastEscapeKeyDownRef.current||U(),k.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(Zt.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":k.swipeDirection,...b,ref:T,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:$e(t.onKeyDown,W=>{W.key==="Escape"&&(c?.(W.nativeEvent),W.nativeEvent.defaultPrevented||(k.isFocusedToastEscapeKeyDownRef.current=!0,U()))}),onPointerDown:$e(t.onPointerDown,W=>{W.button===0&&(A.current={x:W.clientX,y:W.clientY})}),onPointerMove:$e(t.onPointerMove,W=>{if(!A.current)return;const J=W.clientX-A.current.x,$=W.clientY-A.current.y,ae=!!_.current,ne=["left","right"].includes(k.swipeDirection),ce=["left","up"].includes(k.swipeDirection)?Math.min:Math.max,z=ne?ce(0,J):0,xe=ne?0:ce(0,$),Y=W.pointerType==="touch"?10:2,P={x:z,y:xe},K={originalEvent:W,delta:P};ae?(_.current=P,Qp(nxe,p,K,{discrete:!1})):o9(P,k.swipeDirection,Y)?(_.current=P,Qp(txe,m,K,{discrete:!1}),W.target.setPointerCapture(W.pointerId)):(Math.abs(J)>Y||Math.abs($)>Y)&&(A.current=null)}),onPointerUp:$e(t.onPointerUp,W=>{const J=_.current,$=W.target;if($.hasPointerCapture(W.pointerId)&&$.releasePointerCapture(W.pointerId),_.current=null,A.current=null,J){const ae=W.currentTarget,ne={originalEvent:W,delta:J};o9(J,k.swipeDirection,k.swipeThreshold)?Qp(sxe,v,ne,{discrete:!0}):Qp(rxe,x,ne,{discrete:!0}),ae.addEventListener("click",ce=>ce.preventDefault(),{once:!0})}})})})}),k.viewport)})]}):null}),oxe=t=>{const{__scopeToast:e,children:n,...r}=t,s=e1(D0,e),[i,l]=S.useState(!1),[c,d]=S.useState(!1);return dxe(()=>l(!0)),S.useEffect(()=>{const h=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(h)},[]),c?null:a.jsx(sx,{asChild:!0,children:a.jsx(E9,{...r,children:i&&a.jsxs(a.Fragment,{children:[s.label," ",n]})})})},cxe="ToastTitle",JP=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(Zt.div,{...r,ref:e})});JP.displayName=cxe;var uxe="ToastDescription",eB=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(Zt.div,{...r,ref:e})});eB.displayName=uxe;var tB="ToastAction",nB=S.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?a.jsx(sB,{altText:n,asChild:!0,children:a.jsx(d3,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${tB}\`. Expected non-empty \`string\`.`),null)});nB.displayName=tB;var rB="ToastClose",d3=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=axe(rB,n);return a.jsx(sB,{asChild:!0,children:a.jsx(Zt.button,{type:"button",...r,ref:e,onClick:$e(t.onClick,s.onClose)})})});d3.displayName=rB;var sB=S.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return a.jsx(Zt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function iB(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),hxe(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const l=r.dataset.radixToastAnnounceAlt;l&&e.push(l)}else e.push(...iB(r))}}),e}function Qp(t,e,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?M9(s,i):s.dispatchEvent(i)}var o9=(t,e,n=0)=>{const r=Math.abs(t.x),s=Math.abs(t.y),i=r>s;return e==="left"||e==="right"?i&&r>n:!i&&s>n};function dxe(t=()=>{}){const e=es(t);h9(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function hxe(t){return t.nodeType===t.ELEMENT_NODE}function fxe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Gb(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var mxe=GP,aB=YP,lB=ZP,oB=JP,cB=eB,uB=nB,dB=d3;const pxe=mxe,hB=S.forwardRef(({className:t,...e},n)=>a.jsx(aB,{ref:n,className:ye("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));hB.displayName=aB.displayName;const gxe=Nd("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),fB=S.forwardRef(({className:t,variant:e,...n},r)=>a.jsx(lB,{ref:r,className:ye(gxe({variant:e}),t),...n}));fB.displayName=lB.displayName;const xxe=S.forwardRef(({className:t,...e},n)=>a.jsx(uB,{ref:n,className:ye("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));xxe.displayName=uB.displayName;const mB=S.forwardRef(({className:t,...e},n)=>a.jsx(dB,{ref:n,className:ye("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:a.jsx(Gf,{className:"h-4 w-4"})}));mB.displayName=dB.displayName;const pB=S.forwardRef(({className:t,...e},n)=>a.jsx(oB,{ref:n,className:ye("text-sm font-semibold [&+div]:text-xs",t),...e}));pB.displayName=oB.displayName;const gB=S.forwardRef(({className:t,...e},n)=>a.jsx(cB,{ref:n,className:ye("text-sm opacity-90",t),...e}));gB.displayName=cB.displayName;function vxe(){const{toasts:t}=Pr();return a.jsxs(pxe,{children:[t.map(function({id:e,title:n,description:r,action:s,...i}){return a.jsxs(fB,{...i,children:[a.jsxs("div",{className:"grid gap-1",children:[n&&a.jsx(pB,{children:n}),r&&a.jsx(gB,{children:r})]}),s,a.jsx(mB,{})]},e)}),a.jsx(hB,{})]})}Bq.createRoot(document.getElementById("root")).render(a.jsx(S.StrictMode,{children:a.jsx(Xge,{defaultTheme:"system",children:a.jsxs(Yge,{children:[a.jsx(zI,{router:Gge}),a.jsx(vxe,{})]})})})); diff --git a/webui/dist/assets/index-BExEVKIA.js b/webui/dist/assets/index-BExEVKIA.js deleted file mode 100644 index a52c84f3..00000000 --- a/webui/dist/assets/index-BExEVKIA.js +++ /dev/null @@ -1,344 +0,0 @@ -import{r as w,j as r,u as as,R as Fe,d as LC,L as BC,e as PC,f as gr,g as FC,h as IC,O as L5,b as qC,k as HC}from"./router-BWgTyY51.js";import{a as UC,b as $C,g as B5}from"./react-vendor-Dtc2IqVY.js";import{c as P5,R as VC,T as GC,L as YC,a as WC,C as y0,X as b0,Y as Wc,b as XC,B as vp,d as w0,P as KC,e as QC,f as ZC}from"./charts-DU5SeejN.js";import{c as Ua,a as bm,u as Ta,P as It,b as Pe,d as mn,e as Eu,f as zl,g as yr,h as Wr,i as F5,j as h1,k as f1,S as JC,l as I5,m as q5,R as H5,O as wm,n as p1,C as jm,o as x1,T as g1,D as v1,p as y1,q as U5,r as $5,W as eT,s as V5,I as tT,t as G5,v as Y5,w as nT,x as W5,V as rT,L as X5,y as K5,z as aT,A as sT,B as Q5,E as lT,F as iT,G as Sl,H as Nm,J as Vo,K as Z5,M as J5,N as e6,Q as t6,U as b1,X as w1,Y as Sm,Z as km,_ as j1,$ as n6,a0 as oT,a1 as r6,a2 as cT,a3 as uT,a4 as a6,a5 as dT}from"./ui-vendor-nTGLnMlb.js";import{R as Ia,A as mT,D as hT,a as fT,Z as fu,C as di,M as Mu,T as pT,X as Au,P as s6,S as xT,b as Pa,I as pi,c as Ao,d as mi,e as vx,E as yx,f as Ha,g as $r,h as bx,i as gT,j as wx,k as jx,L as $y,K as vT,l as xi,m as yT,n as bT,F as Nl,o as wT,B as jT,U as l6,p as N1,q as NT,r as ST,s as Yr,H as J0,t as i6,u as pu,v as Nx,w as xu,x as Cm,y as S1,z as pr,G as zt,J as em,N as Bo,O as Du,Q as bi,V as wi,W as zu,Y as kT,_ as Vy,$ as CT,a0 as hi,a1 as Sx,a2 as Po,a3 as Gy,a4 as tm,a5 as TT,a6 as Yy,a7 as _T,a8 as ET,a9 as wl,aa as yp,ab as Wy,ac as MT,ad as ou,ae as nm,af as o6,ag as c6,ah as u6,ai as AT,aj as DT,ak as Xy,al as zT,am as OT,an as Ky,ao as RT}from"./icons-8vbl1orV.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))a(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();var bp={exports:{}},Xc={},wp={exports:{}},jp={};var Qy;function LT(){return Qy||(Qy=1,(function(e){function t(H,le){var re=H.length;H.push(le);e:for(;0>>1,E=H[ge];if(0>>1;gel(z,re))Xl(q,z)?(H[ge]=q,H[X]=re,ge=X):(H[ge]=z,H[Z]=re,ge=Z);else if(Xl(q,re))H[ge]=q,H[X]=re,ge=X;else break e}}return le}function l(H,le){var re=H.sortIndex-le.sortIndex;return re!==0?re:H.id-le.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var m=[],f=[],p=1,x=null,y=3,b=!1,N=!1,k=!1,S=!1,T=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function R(H){for(var le=n(f);le!==null;){if(le.callback===null)a(f);else if(le.startTime<=H)a(f),le.sortIndex=le.expirationTime,t(m,le);else break;le=n(f)}}function B(H){if(k=!1,R(H),!N)if(n(m)!==null)N=!0,O||(O=!0,ee());else{var le=n(f);le!==null&&se(B,le.startTime-H)}}var O=!1,L=-1,$=5,U=-1;function I(){return S?!0:!(e.unstable_now()-U<$)}function G(){if(S=!1,O){var H=e.unstable_now();U=H;var le=!0;try{e:{N=!1,k&&(k=!1,M(L),L=-1),b=!0;var re=y;try{t:{for(R(H),x=n(m);x!==null&&!(x.expirationTime>H&&I());){var ge=x.callback;if(typeof ge=="function"){x.callback=null,y=x.priorityLevel;var E=ge(x.expirationTime<=H);if(H=e.unstable_now(),typeof E=="function"){x.callback=E,R(H),le=!0;break t}x===n(m)&&a(m),R(H)}else a(m);x=n(m)}if(x!==null)le=!0;else{var we=n(f);we!==null&&se(B,we.startTime-H),le=!1}}break e}finally{x=null,y=re,b=!1}le=void 0}}finally{le?ee():O=!1}}}var ee;if(typeof A=="function")ee=function(){A(G)};else if(typeof MessageChannel<"u"){var Ne=new MessageChannel,J=Ne.port2;Ne.port1.onmessage=G,ee=function(){J.postMessage(null)}}else ee=function(){T(G,0)};function se(H,le){L=T(function(){H(e.unstable_now())},le)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(H){H.callback=null},e.unstable_forceFrameRate=function(H){0>H||125ge?(H.sortIndex=re,t(f,H),n(m)===null&&H===n(f)&&(k?(M(L),L=-1):k=!0,se(B,re-ge))):(H.sortIndex=E,t(m,H),N||b||(N=!0,O||(O=!0,ee()))),H},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(H){var le=y;return function(){var re=y;y=le;try{return H.apply(this,arguments)}finally{y=re}}}})(jp)),jp}var Zy;function BT(){return Zy||(Zy=1,wp.exports=LT()),wp.exports}var Jy;function PT(){if(Jy)return Xc;Jy=1;var e=BT(),t=UC(),n=$C();function a(s){var i="https://react.dev/errors/"+s;if(1E||(s.current=ge[E],ge[E]=null,E--)}function z(s,i){E++,ge[E]=s.current,s.current=i}var X=we(null),q=we(null),ce=we(null),fe=we(null);function De(s,i){switch(z(ce,i),z(q,s),z(X,null),i.nodeType){case 9:case 11:s=(s=i.documentElement)&&(s=s.namespaceURI)?hy(s):0;break;default:if(s=i.tagName,i=i.namespaceURI)i=hy(i),s=fy(i,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}Z(X),z(X,s)}function oe(){Z(X),Z(q),Z(ce)}function He(s){s.memoizedState!==null&&z(fe,s);var i=X.current,u=fy(i,s.type);i!==u&&(z(q,s),z(X,u))}function at(s){q.current===s&&(Z(X),Z(q)),fe.current===s&&(Z(fe),$c._currentValue=re)}var je,Ze;function qe(s){if(je===void 0)try{throw Error()}catch(u){var i=u.stack.trim().match(/\n( *(at )?)/);je=i&&i[1]||"",Ze=-1)":-1g||W[h]!==me[g]){var Se=` -`+W[h].replace(" at new "," at ");return s.displayName&&Se.includes("")&&(Se=Se.replace("",s.displayName)),Se}while(1<=h&&0<=g);break}}}finally{Ot=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?qe(u):""}function Dn(s,i){switch(s.tag){case 26:case 27:case 5:return qe(s.type);case 16:return qe("Lazy");case 13:return s.child!==i&&i!==null?qe("Suspense Fallback"):qe("Suspense");case 19:return qe("SuspenseList");case 0:case 15:return bn(s.type,!1);case 11:return bn(s.type.render,!1);case 1:return bn(s.type,!0);case 31:return qe("Activity");default:return""}}function Xe(s){try{var i="",u=null;do i+=Dn(s,u),u=s,s=s.return;while(s);return i}catch(h){return` -Error generating stack: `+h.message+` -`+h.stack}}var wn=Object.prototype.hasOwnProperty,Wn=e.unstable_scheduleCallback,Ar=e.unstable_cancelCallback,Cn=e.unstable_shouldYield,cr=e.unstable_requestPaint,$e=e.unstable_now,Fn=e.unstable_getCurrentPriorityLevel,K=e.unstable_ImmediatePriority,be=e.unstable_UserBlockingPriority,Re=e.unstable_NormalPriority,nt=e.unstable_LowPriority,kt=e.unstable_IdlePriority,rr=e.log,Dr=e.unstable_setDisableYieldValue,pe=null,Ee=null;function dt(s){if(typeof rr=="function"&&Dr(s),Ee&&typeof Ee.setStrictMode=="function")try{Ee.setStrictMode(pe,s)}catch{}}var mt=Math.clz32?Math.clz32:gn,zr=Math.log,st=Math.LN2;function gn(s){return s>>>=0,s===0?32:31-(zr(s)/st|0)|0}var ot=256,$t=262144,ar=4194304;function bt(s){var i=s&42;if(i!==0)return i;switch(s&-s){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Ai(s,i,u){var h=s.pendingLanes;if(h===0)return 0;var g=0,v=s.suspendedLanes,_=s.pingedLanes;s=s.warmLanes;var P=h&134217727;return P!==0?(h=P&~v,h!==0?g=bt(h):(_&=P,_!==0?g=bt(_):u||(u=P&~s,u!==0&&(g=bt(u))))):(P=h&~v,P!==0?g=bt(P):_!==0?g=bt(_):u||(u=h&~s,u!==0&&(g=bt(u)))),g===0?0:i!==0&&i!==g&&(i&v)===0&&(v=g&-g,u=i&-i,v>=u||v===32&&(u&4194048)!==0)?i:g}function Fl(s,i){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&i)===0}function sh(s,i){switch(s){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32: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 i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Di(){var s=ar;return ar<<=1,(ar&62914560)===0&&(ar=4194304),s}function Il(s){for(var i=[],u=0;31>u;u++)i.push(s);return i}function ac(s,i){s.pendingLanes|=i,i!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function SS(s,i,u,h,g,v){var _=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var P=s.entanglements,W=s.expirationTimes,me=s.hiddenUpdates;for(u=_&~u;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var MS=/[\n"\\]/g;function pa(s){return s.replace(MS,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function dh(s,i,u,h,g,v,_,P){s.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?s.type=_:s.removeAttribute("type"),i!=null?_==="number"?(i===0&&s.value===""||s.value!=i)&&(s.value=""+fa(i)):s.value!==""+fa(i)&&(s.value=""+fa(i)):_!=="submit"&&_!=="reset"||s.removeAttribute("value"),i!=null?mh(s,_,fa(i)):u!=null?mh(s,_,fa(u)):h!=null&&s.removeAttribute("value"),g==null&&v!=null&&(s.defaultChecked=!!v),g!=null&&(s.checked=g&&typeof g!="function"&&typeof g!="symbol"),P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?s.name=""+fa(P):s.removeAttribute("name")}function iv(s,i,u,h,g,v,_,P){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(s.type=v),i!=null||u!=null){if(!(v!=="submit"&&v!=="reset"||i!=null)){uh(s);return}u=u!=null?""+fa(u):"",i=i!=null?""+fa(i):u,P||i===s.value||(s.value=i),s.defaultValue=i}h=h??g,h=typeof h!="function"&&typeof h!="symbol"&&!!h,s.checked=P?s.checked:!!h,s.defaultChecked=!!h,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(s.name=_),uh(s)}function mh(s,i,u){i==="number"&&cd(s.ownerDocument)===s||s.defaultValue===""+u||(s.defaultValue=""+u)}function Pi(s,i,u,h){if(s=s.options,i){i={};for(var g=0;g"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gh=!1;if(hs)try{var oc={};Object.defineProperty(oc,"passive",{get:function(){gh=!0}}),window.addEventListener("test",oc,oc),window.removeEventListener("test",oc,oc)}catch{gh=!1}var Ys=null,vh=null,dd=null;function fv(){if(dd)return dd;var s,i=vh,u=i.length,h,g="value"in Ys?Ys.value:Ys.textContent,v=g.length;for(s=0;s=dc),bv=" ",wv=!1;function jv(s,i){switch(s){case"keyup":return ak.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nv(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Hi=!1;function lk(s,i){switch(s){case"compositionend":return Nv(i);case"keypress":return i.which!==32?null:(wv=!0,bv);case"textInput":return s=i.data,s===bv&&wv?null:s;default:return null}}function ik(s,i){if(Hi)return s==="compositionend"||!Nh&&jv(s,i)?(s=fv(),dd=vh=Ys=null,Hi=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1=i)return{node:u,offset:i-s};s=h}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=Av(u)}}function zv(s,i){return s&&i?s===i?!0:s&&s.nodeType===3?!1:i&&i.nodeType===3?zv(s,i.parentNode):"contains"in s?s.contains(i):s.compareDocumentPosition?!!(s.compareDocumentPosition(i)&16):!1:!1}function Ov(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var i=cd(s.document);i instanceof s.HTMLIFrameElement;){try{var u=typeof i.contentWindow.location.href=="string"}catch{u=!1}if(u)s=i.contentWindow;else break;i=cd(s.document)}return i}function Ch(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i&&(i==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||i==="textarea"||s.contentEditable==="true")}var pk=hs&&"documentMode"in document&&11>=document.documentMode,Ui=null,Th=null,pc=null,_h=!1;function Rv(s,i,u){var h=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;_h||Ui==null||Ui!==cd(h)||(h=Ui,"selectionStart"in h&&Ch(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),pc&&fc(pc,h)||(pc=h,h=a0(Th,"onSelect"),0>=_,g-=_,Va=1<<32-mt(i)+g|u<xt?(Dt=Ye,Ye=null):Dt=Ye.sibling;var Ht=xe(ie,Ye,ue[xt],ke);if(Ht===null){Ye===null&&(Ye=Dt);break}s&&Ye&&Ht.alternate===null&&i(ie,Ye),te=v(Ht,te,xt),qt===null?Qe=Ht:qt.sibling=Ht,qt=Ht,Ye=Dt}if(xt===ue.length)return u(ie,Ye),Rt&&ps(ie,xt),Qe;if(Ye===null){for(;xtxt?(Dt=Ye,Ye=null):Dt=Ye.sibling;var pl=xe(ie,Ye,Ht.value,ke);if(pl===null){Ye===null&&(Ye=Dt);break}s&&Ye&&pl.alternate===null&&i(ie,Ye),te=v(pl,te,xt),qt===null?Qe=pl:qt.sibling=pl,qt=pl,Ye=Dt}if(Ht.done)return u(ie,Ye),Rt&&ps(ie,xt),Qe;if(Ye===null){for(;!Ht.done;xt++,Ht=ue.next())Ht=Ce(ie,Ht.value,ke),Ht!==null&&(te=v(Ht,te,xt),qt===null?Qe=Ht:qt.sibling=Ht,qt=Ht);return Rt&&ps(ie,xt),Qe}for(Ye=h(Ye);!Ht.done;xt++,Ht=ue.next())Ht=ye(Ye,ie,xt,Ht.value,ke),Ht!==null&&(s&&Ht.alternate!==null&&Ye.delete(Ht.key===null?xt:Ht.key),te=v(Ht,te,xt),qt===null?Qe=Ht:qt.sibling=Ht,qt=Ht);return s&&Ye.forEach(function(RC){return i(ie,RC)}),Rt&&ps(ie,xt),Qe}function on(ie,te,ue,ke){if(typeof ue=="object"&&ue!==null&&ue.type===k&&ue.key===null&&(ue=ue.props.children),typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case b:e:{for(var Qe=ue.key;te!==null;){if(te.key===Qe){if(Qe=ue.type,Qe===k){if(te.tag===7){u(ie,te.sibling),ke=g(te,ue.props.children),ke.return=ie,ie=ke;break e}}else if(te.elementType===Qe||typeof Qe=="object"&&Qe!==null&&Qe.$$typeof===$&&Ql(Qe)===te.type){u(ie,te.sibling),ke=g(te,ue.props),wc(ke,ue),ke.return=ie,ie=ke;break e}u(ie,te);break}else i(ie,te);te=te.sibling}ue.type===k?(ke=Gl(ue.props.children,ie.mode,ke,ue.key),ke.return=ie,ie=ke):(ke=wd(ue.type,ue.key,ue.props,null,ie.mode,ke),wc(ke,ue),ke.return=ie,ie=ke)}return _(ie);case N:e:{for(Qe=ue.key;te!==null;){if(te.key===Qe)if(te.tag===4&&te.stateNode.containerInfo===ue.containerInfo&&te.stateNode.implementation===ue.implementation){u(ie,te.sibling),ke=g(te,ue.children||[]),ke.return=ie,ie=ke;break e}else{u(ie,te);break}else i(ie,te);te=te.sibling}ke=Rh(ue,ie.mode,ke),ke.return=ie,ie=ke}return _(ie);case $:return ue=Ql(ue),on(ie,te,ue,ke)}if(se(ue))return Ue(ie,te,ue,ke);if(ee(ue)){if(Qe=ee(ue),typeof Qe!="function")throw Error(a(150));return ue=Qe.call(ue),rt(ie,te,ue,ke)}if(typeof ue.then=="function")return on(ie,te,_d(ue),ke);if(ue.$$typeof===A)return on(ie,te,Sd(ie,ue),ke);Ed(ie,ue)}return typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint"?(ue=""+ue,te!==null&&te.tag===6?(u(ie,te.sibling),ke=g(te,ue),ke.return=ie,ie=ke):(u(ie,te),ke=Oh(ue,ie.mode,ke),ke.return=ie,ie=ke),_(ie)):u(ie,te)}return function(ie,te,ue,ke){try{bc=0;var Qe=on(ie,te,ue,ke);return eo=null,Qe}catch(Ye){if(Ye===Ji||Ye===Cd)throw Ye;var qt=ea(29,Ye,null,ie.mode);return qt.lanes=ke,qt.return=ie,qt}finally{}}}var Jl=a4(!0),s4=a4(!1),Zs=!1;function Yh(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Wh(s,i){s=s.updateQueue,i.updateQueue===s&&(i.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Js(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function el(s,i,u){var h=s.updateQueue;if(h===null)return null;if(h=h.shared,(Vt&2)!==0){var g=h.pending;return g===null?i.next=i:(i.next=g.next,g.next=i),h.pending=i,i=bd(s),Hv(s,null,u),i}return yd(s,h,i,u),bd(s)}function jc(s,i,u){if(i=i.updateQueue,i!==null&&(i=i.shared,(u&4194048)!==0)){var h=i.lanes;h&=s.pendingLanes,u|=h,i.lanes=u,Kg(s,u)}}function Xh(s,i){var u=s.updateQueue,h=s.alternate;if(h!==null&&(h=h.updateQueue,u===h)){var g=null,v=null;if(u=u.firstBaseUpdate,u!==null){do{var _={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};v===null?g=v=_:v=v.next=_,u=u.next}while(u!==null);v===null?g=v=i:v=v.next=i}else g=v=i;u={baseState:h.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:h.shared,callbacks:h.callbacks},s.updateQueue=u;return}s=u.lastBaseUpdate,s===null?u.firstBaseUpdate=i:s.next=i,u.lastBaseUpdate=i}var Kh=!1;function Nc(){if(Kh){var s=Zi;if(s!==null)throw s}}function Sc(s,i,u,h){Kh=!1;var g=s.updateQueue;Zs=!1;var v=g.firstBaseUpdate,_=g.lastBaseUpdate,P=g.shared.pending;if(P!==null){g.shared.pending=null;var W=P,me=W.next;W.next=null,_===null?v=me:_.next=me,_=W;var Se=s.alternate;Se!==null&&(Se=Se.updateQueue,P=Se.lastBaseUpdate,P!==_&&(P===null?Se.firstBaseUpdate=me:P.next=me,Se.lastBaseUpdate=W))}if(v!==null){var Ce=g.baseState;_=0,Se=me=W=null,P=v;do{var xe=P.lane&-536870913,ye=xe!==P.lane;if(ye?(At&xe)===xe:(h&xe)===xe){xe!==0&&xe===Qi&&(Kh=!0),Se!==null&&(Se=Se.next={lane:0,tag:P.tag,payload:P.payload,callback:null,next:null});e:{var Ue=s,rt=P;xe=i;var on=u;switch(rt.tag){case 1:if(Ue=rt.payload,typeof Ue=="function"){Ce=Ue.call(on,Ce,xe);break e}Ce=Ue;break e;case 3:Ue.flags=Ue.flags&-65537|128;case 0:if(Ue=rt.payload,xe=typeof Ue=="function"?Ue.call(on,Ce,xe):Ue,xe==null)break e;Ce=x({},Ce,xe);break e;case 2:Zs=!0}}xe=P.callback,xe!==null&&(s.flags|=64,ye&&(s.flags|=8192),ye=g.callbacks,ye===null?g.callbacks=[xe]:ye.push(xe))}else ye={lane:xe,tag:P.tag,payload:P.payload,callback:P.callback,next:null},Se===null?(me=Se=ye,W=Ce):Se=Se.next=ye,_|=xe;if(P=P.next,P===null){if(P=g.shared.pending,P===null)break;ye=P,P=ye.next,ye.next=null,g.lastBaseUpdate=ye,g.shared.pending=null}}while(!0);Se===null&&(W=Ce),g.baseState=W,g.firstBaseUpdate=me,g.lastBaseUpdate=Se,v===null&&(g.shared.lanes=0),sl|=_,s.lanes=_,s.memoizedState=Ce}}function l4(s,i){if(typeof s!="function")throw Error(a(191,s));s.call(i)}function i4(s,i){var u=s.callbacks;if(u!==null)for(s.callbacks=null,s=0;sv?v:8;var _=H.T,P={};H.T=P,xf(s,!1,i,u);try{var W=g(),me=H.S;if(me!==null&&me(P,W),W!==null&&typeof W=="object"&&typeof W.then=="function"){var Se=Sk(W,h);Tc(s,i,Se,sa(s))}else Tc(s,i,h,sa(s))}catch(Ce){Tc(s,i,{then:function(){},status:"rejected",reason:Ce},sa())}finally{le.p=v,_!==null&&P.types!==null&&(_.types=P.types),H.T=_}}function Mk(){}function ff(s,i,u,h){if(s.tag!==5)throw Error(a(476));var g=F4(s).queue;P4(s,g,i,re,u===null?Mk:function(){return I4(s),u(h)})}function F4(s){var i=s.memoizedState;if(i!==null)return i;i={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ys,lastRenderedState:re},next:null};var u={};return i.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ys,lastRenderedState:u},next:null},s.memoizedState=i,s=s.alternate,s!==null&&(s.memoizedState=i),i}function I4(s){var i=F4(s);i.next===null&&(i=s.alternate.memoizedState),Tc(s,i.next.queue,{},sa())}function pf(){return mr($c)}function q4(){return Bn().memoizedState}function H4(){return Bn().memoizedState}function Ak(s){for(var i=s.return;i!==null;){switch(i.tag){case 24:case 3:var u=sa();s=Js(u);var h=el(i,s,u);h!==null&&(Ir(h,i,u),jc(h,i,u)),i={cache:Uh()},s.payload=i;return}i=i.return}}function Dk(s,i,u){var h=sa();u={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Fd(s)?$4(i,u):(u=Dh(s,i,u,h),u!==null&&(Ir(u,s,h),V4(u,i,h)))}function U4(s,i,u){var h=sa();Tc(s,i,u,h)}function Tc(s,i,u,h){var g={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Fd(s))$4(i,g);else{var v=s.alternate;if(s.lanes===0&&(v===null||v.lanes===0)&&(v=i.lastRenderedReducer,v!==null))try{var _=i.lastRenderedState,P=v(_,u);if(g.hasEagerState=!0,g.eagerState=P,Jr(P,_))return yd(s,i,g,0),hn===null&&vd(),!1}catch{}finally{}if(u=Dh(s,i,g,h),u!==null)return Ir(u,s,h),V4(u,i,h),!0}return!1}function xf(s,i,u,h){if(h={lane:2,revertLane:Wf(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Fd(s)){if(i)throw Error(a(479))}else i=Dh(s,u,h,2),i!==null&&Ir(i,s,2)}function Fd(s){var i=s.alternate;return s===ht||i!==null&&i===ht}function $4(s,i){no=Dd=!0;var u=s.pending;u===null?i.next=i:(i.next=u.next,u.next=i),s.pending=i}function V4(s,i,u){if((u&4194048)!==0){var h=i.lanes;h&=s.pendingLanes,u|=h,i.lanes=u,Kg(s,u)}}var _c={readContext:mr,use:Rd,useCallback:zn,useContext:zn,useEffect:zn,useImperativeHandle:zn,useLayoutEffect:zn,useInsertionEffect:zn,useMemo:zn,useReducer:zn,useRef:zn,useState:zn,useDebugValue:zn,useDeferredValue:zn,useTransition:zn,useSyncExternalStore:zn,useId:zn,useHostTransitionStatus:zn,useFormState:zn,useActionState:zn,useOptimistic:zn,useMemoCache:zn,useCacheRefresh:zn};_c.useEffectEvent=zn;var G4={readContext:mr,use:Rd,useCallback:function(s,i){return kr().memoizedState=[s,i===void 0?null:i],s},useContext:mr,useEffect:E4,useImperativeHandle:function(s,i,u){u=u!=null?u.concat([s]):null,Bd(4194308,4,z4.bind(null,i,s),u)},useLayoutEffect:function(s,i){return Bd(4194308,4,s,i)},useInsertionEffect:function(s,i){Bd(4,2,s,i)},useMemo:function(s,i){var u=kr();i=i===void 0?null:i;var h=s();if(ei){dt(!0);try{s()}finally{dt(!1)}}return u.memoizedState=[h,i],h},useReducer:function(s,i,u){var h=kr();if(u!==void 0){var g=u(i);if(ei){dt(!0);try{u(i)}finally{dt(!1)}}}else g=i;return h.memoizedState=h.baseState=g,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:g},h.queue=s,s=s.dispatch=Dk.bind(null,ht,s),[h.memoizedState,s]},useRef:function(s){var i=kr();return s={current:s},i.memoizedState=s},useState:function(s){s=cf(s);var i=s.queue,u=U4.bind(null,ht,i);return i.dispatch=u,[s.memoizedState,u]},useDebugValue:mf,useDeferredValue:function(s,i){var u=kr();return hf(u,s,i)},useTransition:function(){var s=cf(!1);return s=P4.bind(null,ht,s.queue,!0,!1),kr().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,i,u){var h=ht,g=kr();if(Rt){if(u===void 0)throw Error(a(407));u=u()}else{if(u=i(),hn===null)throw Error(a(349));(At&127)!==0||h4(h,i,u)}g.memoizedState=u;var v={value:u,getSnapshot:i};return g.queue=v,E4(p4.bind(null,h,v,s),[s]),h.flags|=2048,ao(9,{destroy:void 0},f4.bind(null,h,v,u,i),null),u},useId:function(){var s=kr(),i=hn.identifierPrefix;if(Rt){var u=Ga,h=Va;u=(h&~(1<<32-mt(h)-1)).toString(32)+u,i="_"+i+"R_"+u,u=zd++,0<\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof h.is=="string"?_.createElement("select",{is:h.is}):_.createElement("select"),h.multiple?v.multiple=!0:h.size&&(v.size=h.size);break;default:v=typeof h.is=="string"?_.createElement(g,{is:h.is}):_.createElement(g)}}v[ur]=i,v[Or]=h;e:for(_=i.child;_!==null;){if(_.tag===5||_.tag===6)v.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===i)break e;for(;_.sibling===null;){if(_.return===null||_.return===i)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}i.stateNode=v;e:switch(fr(v,g,h),g){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&ws(i)}}return Nn(i),Mf(i,i.type,s===null?null:s.memoizedProps,i.pendingProps,u),null;case 6:if(s&&i.stateNode!=null)s.memoizedProps!==h&&ws(i);else{if(typeof h!="string"&&i.stateNode===null)throw Error(a(166));if(s=ce.current,Xi(i)){if(s=i.stateNode,u=i.memoizedProps,h=null,g=dr,g!==null)switch(g.tag){case 27:case 5:h=g.memoizedProps}s[ur]=i,s=!!(s.nodeValue===u||h!==null&&h.suppressHydrationWarning===!0||dy(s.nodeValue,u)),s||Ks(i,!0)}else s=s0(s).createTextNode(h),s[ur]=i,i.stateNode=s}return Nn(i),null;case 31:if(u=i.memoizedState,s===null||s.memoizedState!==null){if(h=Xi(i),u!==null){if(s===null){if(!h)throw Error(a(318));if(s=i.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(557));s[ur]=i}else Yl(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Nn(i),s=!1}else u=Fh(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return i.flags&256?(na(i),i):(na(i),null);if((i.flags&128)!==0)throw Error(a(558))}return Nn(i),null;case 13:if(h=i.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(g=Xi(i),h!==null&&h.dehydrated!==null){if(s===null){if(!g)throw Error(a(318));if(g=i.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(a(317));g[ur]=i}else Yl(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Nn(i),g=!1}else g=Fh(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=g),g=!0;if(!g)return i.flags&256?(na(i),i):(na(i),null)}return na(i),(i.flags&128)!==0?(i.lanes=u,i):(u=h!==null,s=s!==null&&s.memoizedState!==null,u&&(h=i.child,g=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(g=h.alternate.memoizedState.cachePool.pool),v=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(v=h.memoizedState.cachePool.pool),v!==g&&(h.flags|=2048)),u!==s&&u&&(i.child.flags|=8192),$d(i,i.updateQueue),Nn(i),null);case 4:return oe(),s===null&&Zf(i.stateNode.containerInfo),Nn(i),null;case 10:return gs(i.type),Nn(i),null;case 19:if(Z(Ln),h=i.memoizedState,h===null)return Nn(i),null;if(g=(i.flags&128)!==0,v=h.rendering,v===null)if(g)Mc(h,!1);else{if(On!==0||s!==null&&(s.flags&128)!==0)for(s=i.child;s!==null;){if(v=Ad(s),v!==null){for(i.flags|=128,Mc(h,!1),s=v.updateQueue,i.updateQueue=s,$d(i,s),i.subtreeFlags=0,s=u,u=i.child;u!==null;)Uv(u,s),u=u.sibling;return z(Ln,Ln.current&1|2),Rt&&ps(i,h.treeForkCount),i.child}s=s.sibling}h.tail!==null&&$e()>Xd&&(i.flags|=128,g=!0,Mc(h,!1),i.lanes=4194304)}else{if(!g)if(s=Ad(v),s!==null){if(i.flags|=128,g=!0,s=s.updateQueue,i.updateQueue=s,$d(i,s),Mc(h,!0),h.tail===null&&h.tailMode==="hidden"&&!v.alternate&&!Rt)return Nn(i),null}else 2*$e()-h.renderingStartTime>Xd&&u!==536870912&&(i.flags|=128,g=!0,Mc(h,!1),i.lanes=4194304);h.isBackwards?(v.sibling=i.child,i.child=v):(s=h.last,s!==null?s.sibling=v:i.child=v,h.last=v)}return h.tail!==null?(s=h.tail,h.rendering=s,h.tail=s.sibling,h.renderingStartTime=$e(),s.sibling=null,u=Ln.current,z(Ln,g?u&1|2:u&1),Rt&&ps(i,h.treeForkCount),s):(Nn(i),null);case 22:case 23:return na(i),Zh(),h=i.memoizedState!==null,s!==null?s.memoizedState!==null!==h&&(i.flags|=8192):h&&(i.flags|=8192),h?(u&536870912)!==0&&(i.flags&128)===0&&(Nn(i),i.subtreeFlags&6&&(i.flags|=8192)):Nn(i),u=i.updateQueue,u!==null&&$d(i,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),h=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(h=i.memoizedState.cachePool.pool),h!==u&&(i.flags|=2048),s!==null&&Z(Kl),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),i.memoizedState.cache!==u&&(i.flags|=2048),gs(In),Nn(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function Bk(s,i){switch(Bh(i),i.tag){case 1:return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 3:return gs(In),oe(),s=i.flags,(s&65536)!==0&&(s&128)===0?(i.flags=s&-65537|128,i):null;case 26:case 27:case 5:return at(i),null;case 31:if(i.memoizedState!==null){if(na(i),i.alternate===null)throw Error(a(340));Yl()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 13:if(na(i),s=i.memoizedState,s!==null&&s.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Yl()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 19:return Z(Ln),null;case 4:return oe(),null;case 10:return gs(i.type),null;case 22:case 23:return na(i),Zh(),s!==null&&Z(Kl),s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 24:return gs(In),null;case 25:return null;default:return null}}function x2(s,i){switch(Bh(i),i.tag){case 3:gs(In),oe();break;case 26:case 27:case 5:at(i);break;case 4:oe();break;case 31:i.memoizedState!==null&&na(i);break;case 13:na(i);break;case 19:Z(Ln);break;case 10:gs(i.type);break;case 22:case 23:na(i),Zh(),s!==null&&Z(Kl);break;case 24:gs(In)}}function Ac(s,i){try{var u=i.updateQueue,h=u!==null?u.lastEffect:null;if(h!==null){var g=h.next;u=g;do{if((u.tag&s)===s){h=void 0;var v=u.create,_=u.inst;h=v(),_.destroy=h}u=u.next}while(u!==g)}}catch(P){nn(i,i.return,P)}}function rl(s,i,u){try{var h=i.updateQueue,g=h!==null?h.lastEffect:null;if(g!==null){var v=g.next;h=v;do{if((h.tag&s)===s){var _=h.inst,P=_.destroy;if(P!==void 0){_.destroy=void 0,g=i;var W=u,me=P;try{me()}catch(Se){nn(g,W,Se)}}}h=h.next}while(h!==v)}}catch(Se){nn(i,i.return,Se)}}function g2(s){var i=s.updateQueue;if(i!==null){var u=s.stateNode;try{i4(i,u)}catch(h){nn(s,s.return,h)}}}function v2(s,i,u){u.props=ti(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(h){nn(s,i,h)}}function Dc(s,i){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var h=s.stateNode;break;case 30:h=s.stateNode;break;default:h=s.stateNode}typeof u=="function"?s.refCleanup=u(h):u.current=h}}catch(g){nn(s,i,g)}}function Ya(s,i){var u=s.ref,h=s.refCleanup;if(u!==null)if(typeof h=="function")try{h()}catch(g){nn(s,i,g)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(g){nn(s,i,g)}else u.current=null}function y2(s){var i=s.type,u=s.memoizedProps,h=s.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":u.autoFocus&&h.focus();break e;case"img":u.src?h.src=u.src:u.srcSet&&(h.srcset=u.srcSet)}}catch(g){nn(s,s.return,g)}}function Af(s,i,u){try{var h=s.stateNode;sC(h,s.type,u,i),h[Or]=i}catch(g){nn(s,s.return,g)}}function b2(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&ul(s.type)||s.tag===4}function Df(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||b2(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&ul(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function zf(s,i,u){var h=s.tag;if(h===5||h===6)s=s.stateNode,i?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(s,i):(i=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,i.appendChild(s),u=u._reactRootContainer,u!=null||i.onclick!==null||(i.onclick=ms));else if(h!==4&&(h===27&&ul(s.type)&&(u=s.stateNode,i=null),s=s.child,s!==null))for(zf(s,i,u),s=s.sibling;s!==null;)zf(s,i,u),s=s.sibling}function Vd(s,i,u){var h=s.tag;if(h===5||h===6)s=s.stateNode,i?u.insertBefore(s,i):u.appendChild(s);else if(h!==4&&(h===27&&ul(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(Vd(s,i,u),s=s.sibling;s!==null;)Vd(s,i,u),s=s.sibling}function w2(s){var i=s.stateNode,u=s.memoizedProps;try{for(var h=s.type,g=i.attributes;g.length;)i.removeAttributeNode(g[0]);fr(i,h,u),i[ur]=s,i[Or]=u}catch(v){nn(s,s.return,v)}}var js=!1,Un=!1,Of=!1,j2=typeof WeakSet=="function"?WeakSet:Set,lr=null;function Pk(s,i){if(s=s.containerInfo,tp=m0,s=Ov(s),Ch(s)){if("selectionStart"in s)var u={start:s.selectionStart,end:s.selectionEnd};else e:{u=(u=s.ownerDocument)&&u.defaultView||window;var h=u.getSelection&&u.getSelection();if(h&&h.rangeCount!==0){u=h.anchorNode;var g=h.anchorOffset,v=h.focusNode;h=h.focusOffset;try{u.nodeType,v.nodeType}catch{u=null;break e}var _=0,P=-1,W=-1,me=0,Se=0,Ce=s,xe=null;t:for(;;){for(var ye;Ce!==u||g!==0&&Ce.nodeType!==3||(P=_+g),Ce!==v||h!==0&&Ce.nodeType!==3||(W=_+h),Ce.nodeType===3&&(_+=Ce.nodeValue.length),(ye=Ce.firstChild)!==null;)xe=Ce,Ce=ye;for(;;){if(Ce===s)break t;if(xe===u&&++me===g&&(P=_),xe===v&&++Se===h&&(W=_),(ye=Ce.nextSibling)!==null)break;Ce=xe,xe=Ce.parentNode}Ce=ye}u=P===-1||W===-1?null:{start:P,end:W}}else u=null}u=u||{start:0,end:0}}else u=null;for(np={focusedElem:s,selectionRange:u},m0=!1,lr=i;lr!==null;)if(i=lr,s=i.child,(i.subtreeFlags&1028)!==0&&s!==null)s.return=i,lr=s;else for(;lr!==null;){switch(i=lr,v=i.alternate,s=i.flags,i.tag){case 0:if((s&4)!==0&&(s=i.updateQueue,s=s!==null?s.events:null,s!==null))for(u=0;u title"))),fr(v,h,u),v[ur]=s,sr(v),h=v;break e;case"link":var _=_y("link","href",g).get(h+(u.href||""));if(_){for(var P=0;P<_.length;P++)if(v=_[P],v.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&v.getAttribute("rel")===(u.rel==null?null:u.rel)&&v.getAttribute("title")===(u.title==null?null:u.title)&&v.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){_.splice(P,1);break t}}v=g.createElement(h),fr(v,h,u),g.head.appendChild(v);break;case"meta":if(_=_y("meta","content",g).get(h+(u.content||""))){for(P=0;P<_.length;P++)if(v=_[P],v.getAttribute("content")===(u.content==null?null:""+u.content)&&v.getAttribute("name")===(u.name==null?null:u.name)&&v.getAttribute("property")===(u.property==null?null:u.property)&&v.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&v.getAttribute("charset")===(u.charSet==null?null:u.charSet)){_.splice(P,1);break t}}v=g.createElement(h),fr(v,h,u),g.head.appendChild(v);break;default:throw Error(a(468,h))}v[ur]=s,sr(v),h=v}s.stateNode=h}else Ey(g,s.type,s.stateNode);else s.stateNode=Ty(g,h,s.memoizedProps);else v!==h?(v===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):v.count--,h===null?Ey(g,s.type,s.stateNode):Ty(g,h,s.memoizedProps)):h===null&&s.stateNode!==null&&Af(s,s.memoizedProps,u.memoizedProps)}break;case 27:Br(i,s),Pr(s),h&512&&(Un||u===null||Ya(u,u.return)),u!==null&&h&4&&Af(s,s.memoizedProps,u.memoizedProps);break;case 5:if(Br(i,s),Pr(s),h&512&&(Un||u===null||Ya(u,u.return)),s.flags&32){g=s.stateNode;try{Fi(g,"")}catch(Ue){nn(s,s.return,Ue)}}h&4&&s.stateNode!=null&&(g=s.memoizedProps,Af(s,g,u!==null?u.memoizedProps:g)),h&1024&&(Of=!0);break;case 6:if(Br(i,s),Pr(s),h&4){if(s.stateNode===null)throw Error(a(162));h=s.memoizedProps,u=s.stateNode;try{u.nodeValue=h}catch(Ue){nn(s,s.return,Ue)}}break;case 3:if(o0=null,g=za,za=l0(i.containerInfo),Br(i,s),za=g,Pr(s),h&4&&u!==null&&u.memoizedState.isDehydrated)try{go(i.containerInfo)}catch(Ue){nn(s,s.return,Ue)}Of&&(Of=!1,E2(s));break;case 4:h=za,za=l0(s.stateNode.containerInfo),Br(i,s),Pr(s),za=h;break;case 12:Br(i,s),Pr(s);break;case 31:Br(i,s),Pr(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Gd(s,h)));break;case 13:Br(i,s),Pr(s),s.child.flags&8192&&s.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(Wd=$e()),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Gd(s,h)));break;case 22:g=s.memoizedState!==null;var W=u!==null&&u.memoizedState!==null,me=js,Se=Un;if(js=me||g,Un=Se||W,Br(i,s),Un=Se,js=me,Pr(s),h&8192)e:for(i=s.stateNode,i._visibility=g?i._visibility&-2:i._visibility|1,g&&(u===null||W||js||Un||ni(s)),u=null,i=s;;){if(i.tag===5||i.tag===26){if(u===null){W=u=i;try{if(v=W.stateNode,g)_=v.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{P=W.stateNode;var Ce=W.memoizedProps.style,xe=Ce!=null&&Ce.hasOwnProperty("display")?Ce.display:null;P.style.display=xe==null||typeof xe=="boolean"?"":(""+xe).trim()}}catch(Ue){nn(W,W.return,Ue)}}}else if(i.tag===6){if(u===null){W=i;try{W.stateNode.nodeValue=g?"":W.memoizedProps}catch(Ue){nn(W,W.return,Ue)}}}else if(i.tag===18){if(u===null){W=i;try{var ye=W.stateNode;g?vy(ye,!0):vy(W.stateNode,!1)}catch(Ue){nn(W,W.return,Ue)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===s)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;u===i&&(u=null),i=i.return}u===i&&(u=null),i.sibling.return=i.return,i=i.sibling}h&4&&(h=s.updateQueue,h!==null&&(u=h.retryQueue,u!==null&&(h.retryQueue=null,Gd(s,u))));break;case 19:Br(i,s),Pr(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Gd(s,h)));break;case 30:break;case 21:break;default:Br(i,s),Pr(s)}}function Pr(s){var i=s.flags;if(i&2){try{for(var u,h=s.return;h!==null;){if(b2(h)){u=h;break}h=h.return}if(u==null)throw Error(a(160));switch(u.tag){case 27:var g=u.stateNode,v=Df(s);Vd(s,v,g);break;case 5:var _=u.stateNode;u.flags&32&&(Fi(_,""),u.flags&=-33);var P=Df(s);Vd(s,P,_);break;case 3:case 4:var W=u.stateNode.containerInfo,me=Df(s);zf(s,me,W);break;default:throw Error(a(161))}}catch(Se){nn(s,s.return,Se)}s.flags&=-3}i&4096&&(s.flags&=-4097)}function E2(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var i=s;E2(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),s=s.sibling}}function Ss(s,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)N2(s,i.alternate,i),i=i.sibling}function ni(s){for(s=s.child;s!==null;){var i=s;switch(i.tag){case 0:case 11:case 14:case 15:rl(4,i,i.return),ni(i);break;case 1:Ya(i,i.return);var u=i.stateNode;typeof u.componentWillUnmount=="function"&&v2(i,i.return,u),ni(i);break;case 27:qc(i.stateNode);case 26:case 5:Ya(i,i.return),ni(i);break;case 22:i.memoizedState===null&&ni(i);break;case 30:ni(i);break;default:ni(i)}s=s.sibling}}function ks(s,i,u){for(u=u&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var h=i.alternate,g=s,v=i,_=v.flags;switch(v.tag){case 0:case 11:case 15:ks(g,v,u),Ac(4,v);break;case 1:if(ks(g,v,u),h=v,g=h.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(me){nn(h,h.return,me)}if(h=v,g=h.updateQueue,g!==null){var P=h.stateNode;try{var W=g.shared.hiddenCallbacks;if(W!==null)for(g.shared.hiddenCallbacks=null,g=0;gon&&(_=on,on=rt,rt=_);var ie=Dv(P,rt),te=Dv(P,on);if(ie&&te&&(ye.rangeCount!==1||ye.anchorNode!==ie.node||ye.anchorOffset!==ie.offset||ye.focusNode!==te.node||ye.focusOffset!==te.offset)){var ue=Ce.createRange();ue.setStart(ie.node,ie.offset),ye.removeAllRanges(),rt>on?(ye.addRange(ue),ye.extend(te.node,te.offset)):(ue.setEnd(te.node,te.offset),ye.addRange(ue))}}}}for(Ce=[],ye=P;ye=ye.parentNode;)ye.nodeType===1&&Ce.push({element:ye,left:ye.scrollLeft,top:ye.scrollTop});for(typeof P.focus=="function"&&P.focus(),P=0;Pu?32:u,H.T=null,u=qf,qf=null;var v=il,_=Ts;if(Xn=0,co=il=null,Ts=0,(Vt&6)!==0)throw Error(a(331));var P=Vt;if(Vt|=4,z2(v.current),M2(v,v.current,_,u),Vt=P,Pc(0,!1),Ee&&typeof Ee.onPostCommitFiberRoot=="function")try{Ee.onPostCommitFiberRoot(pe,v)}catch{}return!0}finally{le.p=g,H.T=h,Q2(s,i)}}function J2(s,i,u){i=ga(u,i),i=bf(s.stateNode,i,2),s=el(s,i,2),s!==null&&(ac(s,2),Wa(s))}function nn(s,i,u){if(s.tag===3)J2(s,s,u);else for(;i!==null;){if(i.tag===3){J2(i,s,u);break}else if(i.tag===1){var h=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(ll===null||!ll.has(h))){s=ga(u,s),u=e2(2),h=el(i,u,2),h!==null&&(t2(u,h,i,s),ac(h,2),Wa(h));break}}i=i.return}}function Vf(s,i,u){var h=s.pingCache;if(h===null){h=s.pingCache=new qk;var g=new Set;h.set(i,g)}else g=h.get(i),g===void 0&&(g=new Set,h.set(i,g));g.has(u)||(Bf=!0,g.add(u),s=Gk.bind(null,s,i,u),i.then(s,s))}function Gk(s,i,u){var h=s.pingCache;h!==null&&h.delete(i),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,hn===s&&(At&u)===u&&(On===4||On===3&&(At&62914560)===At&&300>$e()-Wd?(Vt&2)===0&&uo(s,0):Pf|=u,oo===At&&(oo=0)),Wa(s)}function ey(s,i){i===0&&(i=Di()),s=Vl(s,i),s!==null&&(ac(s,i),Wa(s))}function Yk(s){var i=s.memoizedState,u=0;i!==null&&(u=i.retryLane),ey(s,u)}function Wk(s,i){var u=0;switch(s.tag){case 31:case 13:var h=s.stateNode,g=s.memoizedState;g!==null&&(u=g.retryLane);break;case 19:h=s.stateNode;break;case 22:h=s.stateNode._retryCache;break;default:throw Error(a(314))}h!==null&&h.delete(i),ey(s,u)}function Xk(s,i){return Wn(s,i)}var t0=null,ho=null,Gf=!1,n0=!1,Yf=!1,cl=0;function Wa(s){s!==ho&&s.next===null&&(ho===null?t0=ho=s:ho=ho.next=s),n0=!0,Gf||(Gf=!0,Qk())}function Pc(s,i){if(!Yf&&n0){Yf=!0;do for(var u=!1,h=t0;h!==null;){if(s!==0){var g=h.pendingLanes;if(g===0)var v=0;else{var _=h.suspendedLanes,P=h.pingedLanes;v=(1<<31-mt(42|s)+1)-1,v&=g&~(_&~P),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(u=!0,ay(h,v))}else v=At,v=Ai(h,h===hn?v:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(v&3)===0||Fl(h,v)||(u=!0,ay(h,v));h=h.next}while(u);Yf=!1}}function Kk(){ty()}function ty(){n0=Gf=!1;var s=0;cl!==0&&iC()&&(s=cl);for(var i=$e(),u=null,h=t0;h!==null;){var g=h.next,v=ny(h,i);v===0?(h.next=null,u===null?t0=g:u.next=g,g===null&&(ho=u)):(u=h,(s!==0||(v&3)!==0)&&(n0=!0)),h=g}Xn!==0&&Xn!==5||Pc(s),cl!==0&&(cl=0)}function ny(s,i){for(var u=s.suspendedLanes,h=s.pingedLanes,g=s.expirationTimes,v=s.pendingLanes&-62914561;0P)break;var Se=W.transferSize,Ce=W.initiatorType;Se&&my(Ce)&&(W=W.responseEnd,_+=Se*(W"u"?null:document;function Sy(s,i,u){var h=fo;if(h&&typeof i=="string"&&i){var g=pa(i);g='link[rel="'+s+'"][href="'+g+'"]',typeof u=="string"&&(g+='[crossorigin="'+u+'"]'),Ny.has(g)||(Ny.add(g),s={rel:s,crossOrigin:u,href:i},h.querySelector(g)===null&&(i=h.createElement("link"),fr(i,"link",s),sr(i),h.head.appendChild(i)))}}function xC(s){_s.D(s),Sy("dns-prefetch",s,null)}function gC(s,i){_s.C(s,i),Sy("preconnect",s,i)}function vC(s,i,u){_s.L(s,i,u);var h=fo;if(h&&s&&i){var g='link[rel="preload"][as="'+pa(i)+'"]';i==="image"&&u&&u.imageSrcSet?(g+='[imagesrcset="'+pa(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(g+='[imagesizes="'+pa(u.imageSizes)+'"]')):g+='[href="'+pa(s)+'"]';var v=g;switch(i){case"style":v=po(s);break;case"script":v=xo(s)}Na.has(v)||(s=x({rel:"preload",href:i==="image"&&u&&u.imageSrcSet?void 0:s,as:i},u),Na.set(v,s),h.querySelector(g)!==null||i==="style"&&h.querySelector(Hc(v))||i==="script"&&h.querySelector(Uc(v))||(i=h.createElement("link"),fr(i,"link",s),sr(i),h.head.appendChild(i)))}}function yC(s,i){_s.m(s,i);var u=fo;if(u&&s){var h=i&&typeof i.as=="string"?i.as:"script",g='link[rel="modulepreload"][as="'+pa(h)+'"][href="'+pa(s)+'"]',v=g;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=xo(s)}if(!Na.has(v)&&(s=x({rel:"modulepreload",href:s},i),Na.set(v,s),u.querySelector(g)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(Uc(v)))return}h=u.createElement("link"),fr(h,"link",s),sr(h),u.head.appendChild(h)}}}function bC(s,i,u){_s.S(s,i,u);var h=fo;if(h&&s){var g=Li(h).hoistableStyles,v=po(s);i=i||"default";var _=g.get(v);if(!_){var P={loading:0,preload:null};if(_=h.querySelector(Hc(v)))P.loading=5;else{s=x({rel:"stylesheet",href:s,"data-precedence":i},u),(u=Na.get(v))&&cp(s,u);var W=_=h.createElement("link");sr(W),fr(W,"link",s),W._p=new Promise(function(me,Se){W.onload=me,W.onerror=Se}),W.addEventListener("load",function(){P.loading|=1}),W.addEventListener("error",function(){P.loading|=2}),P.loading|=4,i0(_,i,h)}_={type:"stylesheet",instance:_,count:1,state:P},g.set(v,_)}}}function wC(s,i){_s.X(s,i);var u=fo;if(u&&s){var h=Li(u).hoistableScripts,g=xo(s),v=h.get(g);v||(v=u.querySelector(Uc(g)),v||(s=x({src:s,async:!0},i),(i=Na.get(g))&&up(s,i),v=u.createElement("script"),sr(v),fr(v,"link",s),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(g,v))}}function jC(s,i){_s.M(s,i);var u=fo;if(u&&s){var h=Li(u).hoistableScripts,g=xo(s),v=h.get(g);v||(v=u.querySelector(Uc(g)),v||(s=x({src:s,async:!0,type:"module"},i),(i=Na.get(g))&&up(s,i),v=u.createElement("script"),sr(v),fr(v,"link",s),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(g,v))}}function ky(s,i,u,h){var g=(g=ce.current)?l0(g):null;if(!g)throw Error(a(446));switch(s){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(i=po(u.href),u=Li(g).hoistableStyles,h=u.get(i),h||(h={type:"style",instance:null,count:0,state:null},u.set(i,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){s=po(u.href);var v=Li(g).hoistableStyles,_=v.get(s);if(_||(g=g.ownerDocument||g,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(s,_),(v=g.querySelector(Hc(s)))&&!v._p&&(_.instance=v,_.state.loading=5),Na.has(s)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Na.set(s,u),v||NC(g,s,u,_.state))),i&&h===null)throw Error(a(528,""));return _}if(i&&h!==null)throw Error(a(529,""));return null;case"script":return i=u.async,u=u.src,typeof u=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=xo(u),u=Li(g).hoistableScripts,h=u.get(i),h||(h={type:"script",instance:null,count:0,state:null},u.set(i,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,s))}}function po(s){return'href="'+pa(s)+'"'}function Hc(s){return'link[rel="stylesheet"]['+s+"]"}function Cy(s){return x({},s,{"data-precedence":s.precedence,precedence:null})}function NC(s,i,u,h){s.querySelector('link[rel="preload"][as="style"]['+i+"]")?h.loading=1:(i=s.createElement("link"),h.preload=i,i.addEventListener("load",function(){return h.loading|=1}),i.addEventListener("error",function(){return h.loading|=2}),fr(i,"link",u),sr(i),s.head.appendChild(i))}function xo(s){return'[src="'+pa(s)+'"]'}function Uc(s){return"script[async]"+s}function Ty(s,i,u){if(i.count++,i.instance===null)switch(i.type){case"style":var h=s.querySelector('style[data-href~="'+pa(u.href)+'"]');if(h)return i.instance=h,sr(h),h;var g=x({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return h=(s.ownerDocument||s).createElement("style"),sr(h),fr(h,"style",g),i0(h,u.precedence,s),i.instance=h;case"stylesheet":g=po(u.href);var v=s.querySelector(Hc(g));if(v)return i.state.loading|=4,i.instance=v,sr(v),v;h=Cy(u),(g=Na.get(g))&&cp(h,g),v=(s.ownerDocument||s).createElement("link"),sr(v);var _=v;return _._p=new Promise(function(P,W){_.onload=P,_.onerror=W}),fr(v,"link",h),i.state.loading|=4,i0(v,u.precedence,s),i.instance=v;case"script":return v=xo(u.src),(g=s.querySelector(Uc(v)))?(i.instance=g,sr(g),g):(h=u,(g=Na.get(v))&&(h=x({},u),up(h,g)),s=s.ownerDocument||s,g=s.createElement("script"),sr(g),fr(g,"link",h),s.head.appendChild(g),i.instance=g);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(h=i.instance,i.state.loading|=4,i0(h,u.precedence,s));return i.instance}function i0(s,i,u){for(var h=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=h.length?h[h.length-1]:null,v=g,_=0;_ title"):null)}function SC(s,i,u){if(u===1||i.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return s=i.disabled,typeof i.precedence=="string"&&s==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function My(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function kC(s,i,u,h){if(u.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var g=po(h.href),v=i.querySelector(Hc(g));if(v){i=v._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(s.count++,s=c0.bind(s),i.then(s,s)),u.state.loading|=4,u.instance=v,sr(v);return}v=i.ownerDocument||i,h=Cy(h),(g=Na.get(g))&&cp(h,g),v=v.createElement("link"),sr(v);var _=v;_._p=new Promise(function(P,W){_.onload=P,_.onerror=W}),fr(v,"link",h),u.instance=v}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(u,i),(i=u.state.preload)&&(u.state.loading&3)===0&&(s.count++,u=c0.bind(s),i.addEventListener("load",u),i.addEventListener("error",u))}}var dp=0;function CC(s,i){return s.stylesheets&&s.count===0&&d0(s,s.stylesheets),0dp?50:800)+i);return s.unsuspend=u,function(){s.unsuspend=null,clearTimeout(h),clearTimeout(g)}}:null}function c0(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)d0(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var u0=null;function d0(s,i){s.stylesheets=null,s.unsuspend!==null&&(s.count++,u0=new Map,i.forEach(TC,s),u0=null,c0.call(s))}function TC(s,i){if(!(i.state.loading&4)){var u=u0.get(s);if(u)var h=u.get(null);else{u=new Map,u0.set(s,u);for(var g=s.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),bp.exports=PT(),bp.exports}var IT=FT();function d6(e,t){return function(){return e.apply(t,arguments)}}const{toString:qT}=Object.prototype,{getPrototypeOf:k1}=Object,{iterator:Tm,toStringTag:m6}=Symbol,_m=(e=>t=>{const n=qT.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),$a=e=>(e=e.toLowerCase(),t=>_m(t)===e),Em=e=>t=>typeof t===e,{isArray:Go}=Array,Fo=Em("undefined");function Ou(e){return e!==null&&!Fo(e)&&e.constructor!==null&&!Fo(e.constructor)&&Vr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const h6=$a("ArrayBuffer");function HT(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&h6(e.buffer),t}const UT=Em("string"),Vr=Em("function"),f6=Em("number"),Ru=e=>e!==null&&typeof e=="object",$T=e=>e===!0||e===!1,$0=e=>{if(_m(e)!=="object")return!1;const t=k1(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(m6 in e)&&!(Tm in e)},VT=e=>{if(!Ru(e)||Ou(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},GT=$a("Date"),YT=$a("File"),WT=$a("Blob"),XT=$a("FileList"),KT=e=>Ru(e)&&Vr(e.pipe),QT=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Vr(e.append)&&((t=_m(e))==="formdata"||t==="object"&&Vr(e.toString)&&e.toString()==="[object FormData]"))},ZT=$a("URLSearchParams"),[JT,e_,t_,n_]=["ReadableStream","Request","Response","Headers"].map($a),r_=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Lu(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let a,l;if(typeof e!="object"&&(e=[e]),Go(e))for(a=0,l=e.length;a0;)if(l=n[a],t===l.toLowerCase())return l;return null}const ci=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,x6=e=>!Fo(e)&&e!==ci;function kx(){const{caseless:e,skipUndefined:t}=x6(this)&&this||{},n={},a=(l,o)=>{const c=e&&p6(n,o)||o;$0(n[c])&&$0(l)?n[c]=kx(n[c],l):$0(l)?n[c]=kx({},l):Go(l)?n[c]=l.slice():(!t||!Fo(l))&&(n[c]=l)};for(let l=0,o=arguments.length;l(Lu(t,(l,o)=>{n&&Vr(l)?e[o]=d6(l,n):e[o]=l},{allOwnKeys:a}),e),s_=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),l_=(e,t,n,a)=>{e.prototype=Object.create(t.prototype,a),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},i_=(e,t,n,a)=>{let l,o,c;const d={};if(t=t||{},e==null)return t;do{for(l=Object.getOwnPropertyNames(e),o=l.length;o-- >0;)c=l[o],(!a||a(c,e,t))&&!d[c]&&(t[c]=e[c],d[c]=!0);e=n!==!1&&k1(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},o_=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const a=e.indexOf(t,n);return a!==-1&&a===n},c_=e=>{if(!e)return null;if(Go(e))return e;let t=e.length;if(!f6(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},u_=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&k1(Uint8Array)),d_=(e,t)=>{const a=(e&&e[Tm]).call(e);let l;for(;(l=a.next())&&!l.done;){const o=l.value;t.call(e,o[0],o[1])}},m_=(e,t)=>{let n;const a=[];for(;(n=e.exec(t))!==null;)a.push(n);return a},h_=$a("HTMLFormElement"),f_=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,a,l){return a.toUpperCase()+l}),tb=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),p_=$a("RegExp"),g6=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),a={};Lu(n,(l,o)=>{let c;(c=t(l,o,e))!==!1&&(a[o]=c||l)}),Object.defineProperties(e,a)},x_=e=>{g6(e,(t,n)=>{if(Vr(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const a=e[n];if(Vr(a)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},g_=(e,t)=>{const n={},a=l=>{l.forEach(o=>{n[o]=!0})};return Go(e)?a(e):a(String(e).split(t)),n},v_=()=>{},y_=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function b_(e){return!!(e&&Vr(e.append)&&e[m6]==="FormData"&&e[Tm])}const w_=e=>{const t=new Array(10),n=(a,l)=>{if(Ru(a)){if(t.indexOf(a)>=0)return;if(Ou(a))return a;if(!("toJSON"in a)){t[l]=a;const o=Go(a)?[]:{};return Lu(a,(c,d)=>{const m=n(c,l+1);!Fo(m)&&(o[d]=m)}),t[l]=void 0,o}}return a};return n(e,0)},j_=$a("AsyncFunction"),N_=e=>e&&(Ru(e)||Vr(e))&&Vr(e.then)&&Vr(e.catch),v6=((e,t)=>e?setImmediate:t?((n,a)=>(ci.addEventListener("message",({source:l,data:o})=>{l===ci&&o===n&&a.length&&a.shift()()},!1),l=>{a.push(l),ci.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Vr(ci.postMessage)),S_=typeof queueMicrotask<"u"?queueMicrotask.bind(ci):typeof process<"u"&&process.nextTick||v6,k_=e=>e!=null&&Vr(e[Tm]),ve={isArray:Go,isArrayBuffer:h6,isBuffer:Ou,isFormData:QT,isArrayBufferView:HT,isString:UT,isNumber:f6,isBoolean:$T,isObject:Ru,isPlainObject:$0,isEmptyObject:VT,isReadableStream:JT,isRequest:e_,isResponse:t_,isHeaders:n_,isUndefined:Fo,isDate:GT,isFile:YT,isBlob:WT,isRegExp:p_,isFunction:Vr,isStream:KT,isURLSearchParams:ZT,isTypedArray:u_,isFileList:XT,forEach:Lu,merge:kx,extend:a_,trim:r_,stripBOM:s_,inherits:l_,toFlatObject:i_,kindOf:_m,kindOfTest:$a,endsWith:o_,toArray:c_,forEachEntry:d_,matchAll:m_,isHTMLForm:h_,hasOwnProperty:tb,hasOwnProp:tb,reduceDescriptors:g6,freezeMethods:x_,toObjectSet:g_,toCamelCase:f_,noop:v_,toFiniteNumber:y_,findKey:p6,global:ci,isContextDefined:x6,isSpecCompliantForm:b_,toJSONObject:w_,isAsyncFn:j_,isThenable:N_,setImmediate:v6,asap:S_,isIterable:k_};function ft(e,t,n,a,l){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),a&&(this.request=a),l&&(this.response=l,this.status=l.status?l.status:null)}ve.inherits(ft,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:ve.toJSONObject(this.config),code:this.code,status:this.status}}});const y6=ft.prototype,b6={};["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(e=>{b6[e]={value:e}});Object.defineProperties(ft,b6);Object.defineProperty(y6,"isAxiosError",{value:!0});ft.from=(e,t,n,a,l,o)=>{const c=Object.create(y6);ve.toFlatObject(e,c,function(p){return p!==Error.prototype},f=>f!=="isAxiosError");const d=e&&e.message?e.message:"Error",m=t==null&&e?e.code:t;return ft.call(c,d,m,n,a,l),e&&c.cause==null&&Object.defineProperty(c,"cause",{value:e,configurable:!0}),c.name=e&&e.name||"Error",o&&Object.assign(c,o),c};const C_=null;function Cx(e){return ve.isPlainObject(e)||ve.isArray(e)}function w6(e){return ve.endsWith(e,"[]")?e.slice(0,-2):e}function nb(e,t,n){return e?e.concat(t).map(function(l,o){return l=w6(l),!n&&o?"["+l+"]":l}).join(n?".":""):t}function T_(e){return ve.isArray(e)&&!e.some(Cx)}const __=ve.toFlatObject(ve,{},null,function(t){return/^is[A-Z]/.test(t)});function Mm(e,t,n){if(!ve.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=ve.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(k,S){return!ve.isUndefined(S[k])});const a=n.metaTokens,l=n.visitor||p,o=n.dots,c=n.indexes,m=(n.Blob||typeof Blob<"u"&&Blob)&&ve.isSpecCompliantForm(t);if(!ve.isFunction(l))throw new TypeError("visitor must be a function");function f(N){if(N===null)return"";if(ve.isDate(N))return N.toISOString();if(ve.isBoolean(N))return N.toString();if(!m&&ve.isBlob(N))throw new ft("Blob is not supported. Use a Buffer instead.");return ve.isArrayBuffer(N)||ve.isTypedArray(N)?m&&typeof Blob=="function"?new Blob([N]):Buffer.from(N):N}function p(N,k,S){let T=N;if(N&&!S&&typeof N=="object"){if(ve.endsWith(k,"{}"))k=a?k:k.slice(0,-2),N=JSON.stringify(N);else if(ve.isArray(N)&&T_(N)||(ve.isFileList(N)||ve.endsWith(k,"[]"))&&(T=ve.toArray(N)))return k=w6(k),T.forEach(function(A,R){!(ve.isUndefined(A)||A===null)&&t.append(c===!0?nb([k],R,o):c===null?k:k+"[]",f(A))}),!1}return Cx(N)?!0:(t.append(nb(S,k,o),f(N)),!1)}const x=[],y=Object.assign(__,{defaultVisitor:p,convertValue:f,isVisitable:Cx});function b(N,k){if(!ve.isUndefined(N)){if(x.indexOf(N)!==-1)throw Error("Circular reference detected in "+k.join("."));x.push(N),ve.forEach(N,function(T,M){(!(ve.isUndefined(T)||T===null)&&l.call(t,T,ve.isString(M)?M.trim():M,k,y))===!0&&b(T,k?k.concat(M):[M])}),x.pop()}}if(!ve.isObject(e))throw new TypeError("data must be an object");return b(e),t}function rb(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(a){return t[a]})}function C1(e,t){this._pairs=[],e&&Mm(e,this,t)}const j6=C1.prototype;j6.append=function(t,n){this._pairs.push([t,n])};j6.toString=function(t){const n=t?function(a){return t.call(this,a,rb)}:rb;return this._pairs.map(function(l){return n(l[0])+"="+n(l[1])},"").join("&")};function E_(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function N6(e,t,n){if(!t)return e;const a=n&&n.encode||E_;ve.isFunction(n)&&(n={serialize:n});const l=n&&n.serialize;let o;if(l?o=l(t,n):o=ve.isURLSearchParams(t)?t.toString():new C1(t,n).toString(a),o){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class ab{constructor(){this.handlers=[]}use(t,n,a){return this.handlers.push({fulfilled:t,rejected:n,synchronous:a?a.synchronous:!1,runWhen:a?a.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ve.forEach(this.handlers,function(a){a!==null&&t(a)})}}const S6={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},M_=typeof URLSearchParams<"u"?URLSearchParams:C1,A_=typeof FormData<"u"?FormData:null,D_=typeof Blob<"u"?Blob:null,z_={isBrowser:!0,classes:{URLSearchParams:M_,FormData:A_,Blob:D_},protocols:["http","https","file","blob","url","data"]},T1=typeof window<"u"&&typeof document<"u",Tx=typeof navigator=="object"&&navigator||void 0,O_=T1&&(!Tx||["ReactNative","NativeScript","NS"].indexOf(Tx.product)<0),R_=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",L_=T1&&window.location.href||"http://localhost",B_=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:T1,hasStandardBrowserEnv:O_,hasStandardBrowserWebWorkerEnv:R_,navigator:Tx,origin:L_},Symbol.toStringTag,{value:"Module"})),br={...B_,...z_};function P_(e,t){return Mm(e,new br.classes.URLSearchParams,{visitor:function(n,a,l,o){return br.isNode&&ve.isBuffer(n)?(this.append(a,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function F_(e){return ve.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function I_(e){const t={},n=Object.keys(e);let a;const l=n.length;let o;for(a=0;a=n.length;return c=!c&&ve.isArray(l)?l.length:c,m?(ve.hasOwnProp(l,c)?l[c]=[l[c],a]:l[c]=a,!d):((!l[c]||!ve.isObject(l[c]))&&(l[c]=[]),t(n,a,l[c],o)&&ve.isArray(l[c])&&(l[c]=I_(l[c])),!d)}if(ve.isFormData(e)&&ve.isFunction(e.entries)){const n={};return ve.forEachEntry(e,(a,l)=>{t(F_(a),l,n,0)}),n}return null}function q_(e,t,n){if(ve.isString(e))try{return(t||JSON.parse)(e),ve.trim(e)}catch(a){if(a.name!=="SyntaxError")throw a}return(n||JSON.stringify)(e)}const Bu={transitional:S6,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const a=n.getContentType()||"",l=a.indexOf("application/json")>-1,o=ve.isObject(t);if(o&&ve.isHTMLForm(t)&&(t=new FormData(t)),ve.isFormData(t))return l?JSON.stringify(k6(t)):t;if(ve.isArrayBuffer(t)||ve.isBuffer(t)||ve.isStream(t)||ve.isFile(t)||ve.isBlob(t)||ve.isReadableStream(t))return t;if(ve.isArrayBufferView(t))return t.buffer;if(ve.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let d;if(o){if(a.indexOf("application/x-www-form-urlencoded")>-1)return P_(t,this.formSerializer).toString();if((d=ve.isFileList(t))||a.indexOf("multipart/form-data")>-1){const m=this.env&&this.env.FormData;return Mm(d?{"files[]":t}:t,m&&new m,this.formSerializer)}}return o||l?(n.setContentType("application/json",!1),q_(t)):t}],transformResponse:[function(t){const n=this.transitional||Bu.transitional,a=n&&n.forcedJSONParsing,l=this.responseType==="json";if(ve.isResponse(t)||ve.isReadableStream(t))return t;if(t&&ve.isString(t)&&(a&&!this.responseType||l)){const c=!(n&&n.silentJSONParsing)&&l;try{return JSON.parse(t,this.parseReviver)}catch(d){if(c)throw d.name==="SyntaxError"?ft.from(d,ft.ERR_BAD_RESPONSE,this,null,this.response):d}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:br.classes.FormData,Blob:br.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ve.forEach(["delete","get","head","post","put","patch"],e=>{Bu.headers[e]={}});const H_=ve.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"]),U_=e=>{const t={};let n,a,l;return e&&e.split(` -`).forEach(function(c){l=c.indexOf(":"),n=c.substring(0,l).trim().toLowerCase(),a=c.substring(l+1).trim(),!(!n||t[n]&&H_[n])&&(n==="set-cookie"?t[n]?t[n].push(a):t[n]=[a]:t[n]=t[n]?t[n]+", "+a:a)}),t},sb=Symbol("internals");function Kc(e){return e&&String(e).trim().toLowerCase()}function V0(e){return e===!1||e==null?e:ve.isArray(e)?e.map(V0):String(e)}function $_(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let a;for(;a=n.exec(e);)t[a[1]]=a[2];return t}const V_=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Np(e,t,n,a,l){if(ve.isFunction(a))return a.call(this,t,n);if(l&&(t=n),!!ve.isString(t)){if(ve.isString(a))return t.indexOf(a)!==-1;if(ve.isRegExp(a))return a.test(t)}}function G_(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,a)=>n.toUpperCase()+a)}function Y_(e,t){const n=ve.toCamelCase(" "+t);["get","set","has"].forEach(a=>{Object.defineProperty(e,a+n,{value:function(l,o,c){return this[a].call(this,t,l,o,c)},configurable:!0})})}let Gr=class{constructor(t){t&&this.set(t)}set(t,n,a){const l=this;function o(d,m,f){const p=Kc(m);if(!p)throw new Error("header name must be a non-empty string");const x=ve.findKey(l,p);(!x||l[x]===void 0||f===!0||f===void 0&&l[x]!==!1)&&(l[x||m]=V0(d))}const c=(d,m)=>ve.forEach(d,(f,p)=>o(f,p,m));if(ve.isPlainObject(t)||t instanceof this.constructor)c(t,n);else if(ve.isString(t)&&(t=t.trim())&&!V_(t))c(U_(t),n);else if(ve.isObject(t)&&ve.isIterable(t)){let d={},m,f;for(const p of t){if(!ve.isArray(p))throw TypeError("Object iterator must return a key-value pair");d[f=p[0]]=(m=d[f])?ve.isArray(m)?[...m,p[1]]:[m,p[1]]:p[1]}c(d,n)}else t!=null&&o(n,t,a);return this}get(t,n){if(t=Kc(t),t){const a=ve.findKey(this,t);if(a){const l=this[a];if(!n)return l;if(n===!0)return $_(l);if(ve.isFunction(n))return n.call(this,l,a);if(ve.isRegExp(n))return n.exec(l);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Kc(t),t){const a=ve.findKey(this,t);return!!(a&&this[a]!==void 0&&(!n||Np(this,this[a],a,n)))}return!1}delete(t,n){const a=this;let l=!1;function o(c){if(c=Kc(c),c){const d=ve.findKey(a,c);d&&(!n||Np(a,a[d],d,n))&&(delete a[d],l=!0)}}return ve.isArray(t)?t.forEach(o):o(t),l}clear(t){const n=Object.keys(this);let a=n.length,l=!1;for(;a--;){const o=n[a];(!t||Np(this,this[o],o,t,!0))&&(delete this[o],l=!0)}return l}normalize(t){const n=this,a={};return ve.forEach(this,(l,o)=>{const c=ve.findKey(a,o);if(c){n[c]=V0(l),delete n[o];return}const d=t?G_(o):String(o).trim();d!==o&&delete n[o],n[d]=V0(l),a[d]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return ve.forEach(this,(a,l)=>{a!=null&&a!==!1&&(n[l]=t&&ve.isArray(a)?a.join(", "):a)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` -`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const a=new this(t);return n.forEach(l=>a.set(l)),a}static accessor(t){const a=(this[sb]=this[sb]={accessors:{}}).accessors,l=this.prototype;function o(c){const d=Kc(c);a[d]||(Y_(l,c),a[d]=!0)}return ve.isArray(t)?t.forEach(o):o(t),this}};Gr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ve.reduceDescriptors(Gr.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(a){this[n]=a}}});ve.freezeMethods(Gr);function Sp(e,t){const n=this||Bu,a=t||n,l=Gr.from(a.headers);let o=a.data;return ve.forEach(e,function(d){o=d.call(n,o,l.normalize(),t?t.status:void 0)}),l.normalize(),o}function C6(e){return!!(e&&e.__CANCEL__)}function Yo(e,t,n){ft.call(this,e??"canceled",ft.ERR_CANCELED,t,n),this.name="CanceledError"}ve.inherits(Yo,ft,{__CANCEL__:!0});function T6(e,t,n){const a=n.config.validateStatus;!n.status||!a||a(n.status)?e(n):t(new ft("Request failed with status code "+n.status,[ft.ERR_BAD_REQUEST,ft.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function W_(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function X_(e,t){e=e||10;const n=new Array(e),a=new Array(e);let l=0,o=0,c;return t=t!==void 0?t:1e3,function(m){const f=Date.now(),p=a[o];c||(c=f),n[l]=m,a[l]=f;let x=o,y=0;for(;x!==l;)y+=n[x++],x=x%e;if(l=(l+1)%e,l===o&&(o=(o+1)%e),f-c{n=p,l=null,o&&(clearTimeout(o),o=null),e(...f)};return[(...f)=>{const p=Date.now(),x=p-n;x>=a?c(f,p):(l=f,o||(o=setTimeout(()=>{o=null,c(l)},a-x)))},()=>l&&c(l)]}const rm=(e,t,n=3)=>{let a=0;const l=X_(50,250);return K_(o=>{const c=o.loaded,d=o.lengthComputable?o.total:void 0,m=c-a,f=l(m),p=c<=d;a=c;const x={loaded:c,total:d,progress:d?c/d:void 0,bytes:m,rate:f||void 0,estimated:f&&d&&p?(d-c)/f:void 0,event:o,lengthComputable:d!=null,[t?"download":"upload"]:!0};e(x)},n)},lb=(e,t)=>{const n=e!=null;return[a=>t[0]({lengthComputable:n,total:e,loaded:a}),t[1]]},ib=e=>(...t)=>ve.asap(()=>e(...t)),Q_=br.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,br.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(br.origin),br.navigator&&/(msie|trident)/i.test(br.navigator.userAgent)):()=>!0,Z_=br.hasStandardBrowserEnv?{write(e,t,n,a,l,o,c){if(typeof document>"u")return;const d=[`${e}=${encodeURIComponent(t)}`];ve.isNumber(n)&&d.push(`expires=${new Date(n).toUTCString()}`),ve.isString(a)&&d.push(`path=${a}`),ve.isString(l)&&d.push(`domain=${l}`),o===!0&&d.push("secure"),ve.isString(c)&&d.push(`SameSite=${c}`),document.cookie=d.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function J_(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function eE(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function _6(e,t,n){let a=!J_(t);return e&&(a||n==!1)?eE(e,t):t}const ob=e=>e instanceof Gr?{...e}:e;function gi(e,t){t=t||{};const n={};function a(f,p,x,y){return ve.isPlainObject(f)&&ve.isPlainObject(p)?ve.merge.call({caseless:y},f,p):ve.isPlainObject(p)?ve.merge({},p):ve.isArray(p)?p.slice():p}function l(f,p,x,y){if(ve.isUndefined(p)){if(!ve.isUndefined(f))return a(void 0,f,x,y)}else return a(f,p,x,y)}function o(f,p){if(!ve.isUndefined(p))return a(void 0,p)}function c(f,p){if(ve.isUndefined(p)){if(!ve.isUndefined(f))return a(void 0,f)}else return a(void 0,p)}function d(f,p,x){if(x in t)return a(f,p);if(x in e)return a(void 0,f)}const m={url:o,method:o,data:o,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:d,headers:(f,p,x)=>l(ob(f),ob(p),x,!0)};return ve.forEach(Object.keys({...e,...t}),function(p){const x=m[p]||l,y=x(e[p],t[p],p);ve.isUndefined(y)&&x!==d||(n[p]=y)}),n}const E6=e=>{const t=gi({},e);let{data:n,withXSRFToken:a,xsrfHeaderName:l,xsrfCookieName:o,headers:c,auth:d}=t;if(t.headers=c=Gr.from(c),t.url=N6(_6(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),d&&c.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):""))),ve.isFormData(n)){if(br.hasStandardBrowserEnv||br.hasStandardBrowserWebWorkerEnv)c.setContentType(void 0);else if(ve.isFunction(n.getHeaders)){const m=n.getHeaders(),f=["content-type","content-length"];Object.entries(m).forEach(([p,x])=>{f.includes(p.toLowerCase())&&c.set(p,x)})}}if(br.hasStandardBrowserEnv&&(a&&ve.isFunction(a)&&(a=a(t)),a||a!==!1&&Q_(t.url))){const m=l&&o&&Z_.read(o);m&&c.set(l,m)}return t},tE=typeof XMLHttpRequest<"u",nE=tE&&function(e){return new Promise(function(n,a){const l=E6(e);let o=l.data;const c=Gr.from(l.headers).normalize();let{responseType:d,onUploadProgress:m,onDownloadProgress:f}=l,p,x,y,b,N;function k(){b&&b(),N&&N(),l.cancelToken&&l.cancelToken.unsubscribe(p),l.signal&&l.signal.removeEventListener("abort",p)}let S=new XMLHttpRequest;S.open(l.method.toUpperCase(),l.url,!0),S.timeout=l.timeout;function T(){if(!S)return;const A=Gr.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),B={data:!d||d==="text"||d==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:A,config:e,request:S};T6(function(L){n(L),k()},function(L){a(L),k()},B),S=null}"onloadend"in S?S.onloadend=T:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(T)},S.onabort=function(){S&&(a(new ft("Request aborted",ft.ECONNABORTED,e,S)),S=null)},S.onerror=function(R){const B=R&&R.message?R.message:"Network Error",O=new ft(B,ft.ERR_NETWORK,e,S);O.event=R||null,a(O),S=null},S.ontimeout=function(){let R=l.timeout?"timeout of "+l.timeout+"ms exceeded":"timeout exceeded";const B=l.transitional||S6;l.timeoutErrorMessage&&(R=l.timeoutErrorMessage),a(new ft(R,B.clarifyTimeoutError?ft.ETIMEDOUT:ft.ECONNABORTED,e,S)),S=null},o===void 0&&c.setContentType(null),"setRequestHeader"in S&&ve.forEach(c.toJSON(),function(R,B){S.setRequestHeader(B,R)}),ve.isUndefined(l.withCredentials)||(S.withCredentials=!!l.withCredentials),d&&d!=="json"&&(S.responseType=l.responseType),f&&([y,N]=rm(f,!0),S.addEventListener("progress",y)),m&&S.upload&&([x,b]=rm(m),S.upload.addEventListener("progress",x),S.upload.addEventListener("loadend",b)),(l.cancelToken||l.signal)&&(p=A=>{S&&(a(!A||A.type?new Yo(null,e,S):A),S.abort(),S=null)},l.cancelToken&&l.cancelToken.subscribe(p),l.signal&&(l.signal.aborted?p():l.signal.addEventListener("abort",p)));const M=W_(l.url);if(M&&br.protocols.indexOf(M)===-1){a(new ft("Unsupported protocol "+M+":",ft.ERR_BAD_REQUEST,e));return}S.send(o||null)})},rE=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let a=new AbortController,l;const o=function(f){if(!l){l=!0,d();const p=f instanceof Error?f:this.reason;a.abort(p instanceof ft?p:new Yo(p instanceof Error?p.message:p))}};let c=t&&setTimeout(()=>{c=null,o(new ft(`timeout ${t} of ms exceeded`,ft.ETIMEDOUT))},t);const d=()=>{e&&(c&&clearTimeout(c),c=null,e.forEach(f=>{f.unsubscribe?f.unsubscribe(o):f.removeEventListener("abort",o)}),e=null)};e.forEach(f=>f.addEventListener("abort",o));const{signal:m}=a;return m.unsubscribe=()=>ve.asap(d),m}},aE=function*(e,t){let n=e.byteLength;if(n{const l=sE(e,t);let o=0,c,d=m=>{c||(c=!0,a&&a(m))};return new ReadableStream({async pull(m){try{const{done:f,value:p}=await l.next();if(f){d(),m.close();return}let x=p.byteLength;if(n){let y=o+=x;n(y)}m.enqueue(new Uint8Array(p))}catch(f){throw d(f),f}},cancel(m){return d(m),l.return()}},{highWaterMark:2})},ub=64*1024,{isFunction:j0}=ve,iE=(({Request:e,Response:t})=>({Request:e,Response:t}))(ve.global),{ReadableStream:db,TextEncoder:mb}=ve.global,hb=(e,...t)=>{try{return!!e(...t)}catch{return!1}},oE=e=>{e=ve.merge.call({skipUndefined:!0},iE,e);const{fetch:t,Request:n,Response:a}=e,l=t?j0(t):typeof fetch=="function",o=j0(n),c=j0(a);if(!l)return!1;const d=l&&j0(db),m=l&&(typeof mb=="function"?(N=>k=>N.encode(k))(new mb):async N=>new Uint8Array(await new n(N).arrayBuffer())),f=o&&d&&hb(()=>{let N=!1;const k=new n(br.origin,{body:new db,method:"POST",get duplex(){return N=!0,"half"}}).headers.has("Content-Type");return N&&!k}),p=c&&d&&hb(()=>ve.isReadableStream(new a("").body)),x={stream:p&&(N=>N.body)};l&&["text","arrayBuffer","blob","formData","stream"].forEach(N=>{!x[N]&&(x[N]=(k,S)=>{let T=k&&k[N];if(T)return T.call(k);throw new ft(`Response type '${N}' is not supported`,ft.ERR_NOT_SUPPORT,S)})});const y=async N=>{if(N==null)return 0;if(ve.isBlob(N))return N.size;if(ve.isSpecCompliantForm(N))return(await new n(br.origin,{method:"POST",body:N}).arrayBuffer()).byteLength;if(ve.isArrayBufferView(N)||ve.isArrayBuffer(N))return N.byteLength;if(ve.isURLSearchParams(N)&&(N=N+""),ve.isString(N))return(await m(N)).byteLength},b=async(N,k)=>{const S=ve.toFiniteNumber(N.getContentLength());return S??y(k)};return async N=>{let{url:k,method:S,data:T,signal:M,cancelToken:A,timeout:R,onDownloadProgress:B,onUploadProgress:O,responseType:L,headers:$,withCredentials:U="same-origin",fetchOptions:I}=E6(N),G=t||fetch;L=L?(L+"").toLowerCase():"text";let ee=rE([M,A&&A.toAbortSignal()],R),Ne=null;const J=ee&&ee.unsubscribe&&(()=>{ee.unsubscribe()});let se;try{if(O&&f&&S!=="get"&&S!=="head"&&(se=await b($,T))!==0){let we=new n(k,{method:"POST",body:T,duplex:"half"}),Z;if(ve.isFormData(T)&&(Z=we.headers.get("content-type"))&&$.setContentType(Z),we.body){const[z,X]=lb(se,rm(ib(O)));T=cb(we.body,ub,z,X)}}ve.isString(U)||(U=U?"include":"omit");const H=o&&"credentials"in n.prototype,le={...I,signal:ee,method:S.toUpperCase(),headers:$.normalize().toJSON(),body:T,duplex:"half",credentials:H?U:void 0};Ne=o&&new n(k,le);let re=await(o?G(Ne,I):G(k,le));const ge=p&&(L==="stream"||L==="response");if(p&&(B||ge&&J)){const we={};["status","statusText","headers"].forEach(q=>{we[q]=re[q]});const Z=ve.toFiniteNumber(re.headers.get("content-length")),[z,X]=B&&lb(Z,rm(ib(B),!0))||[];re=new a(cb(re.body,ub,z,()=>{X&&X(),J&&J()}),we)}L=L||"text";let E=await x[ve.findKey(x,L)||"text"](re,N);return!ge&&J&&J(),await new Promise((we,Z)=>{T6(we,Z,{data:E,headers:Gr.from(re.headers),status:re.status,statusText:re.statusText,config:N,request:Ne})})}catch(H){throw J&&J(),H&&H.name==="TypeError"&&/Load failed|fetch/i.test(H.message)?Object.assign(new ft("Network Error",ft.ERR_NETWORK,N,Ne),{cause:H.cause||H}):ft.from(H,H&&H.code,N,Ne)}}},cE=new Map,M6=e=>{let t=e&&e.env||{};const{fetch:n,Request:a,Response:l}=t,o=[a,l,n];let c=o.length,d=c,m,f,p=cE;for(;d--;)m=o[d],f=p.get(m),f===void 0&&p.set(m,f=d?new Map:oE(t)),p=f;return f};M6();const _1={http:C_,xhr:nE,fetch:{get:M6}};ve.forEach(_1,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const fb=e=>`- ${e}`,uE=e=>ve.isFunction(e)||e===null||e===!1;function dE(e,t){e=ve.isArray(e)?e:[e];const{length:n}=e;let a,l;const o={};for(let c=0;c`adapter ${m} `+(f===!1?"is not supported by the environment":"is not available in the build"));let d=n?c.length>1?`since : -`+c.map(fb).join(` -`):" "+fb(c[0]):"as no adapter specified";throw new ft("There is no suitable adapter to dispatch the request "+d,"ERR_NOT_SUPPORT")}return l}const A6={getAdapter:dE,adapters:_1};function kp(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Yo(null,e)}function pb(e){return kp(e),e.headers=Gr.from(e.headers),e.data=Sp.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),A6.getAdapter(e.adapter||Bu.adapter,e)(e).then(function(a){return kp(e),a.data=Sp.call(e,e.transformResponse,a),a.headers=Gr.from(a.headers),a},function(a){return C6(a)||(kp(e),a&&a.response&&(a.response.data=Sp.call(e,e.transformResponse,a.response),a.response.headers=Gr.from(a.response.headers))),Promise.reject(a)})}const D6="1.13.2",Am={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Am[e]=function(a){return typeof a===e||"a"+(t<1?"n ":" ")+e}});const xb={};Am.transitional=function(t,n,a){function l(o,c){return"[Axios v"+D6+"] Transitional option '"+o+"'"+c+(a?". "+a:"")}return(o,c,d)=>{if(t===!1)throw new ft(l(c," has been removed"+(n?" in "+n:"")),ft.ERR_DEPRECATED);return n&&!xb[c]&&(xb[c]=!0,console.warn(l(c," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,c,d):!0}};Am.spelling=function(t){return(n,a)=>(console.warn(`${a} is likely a misspelling of ${t}`),!0)};function mE(e,t,n){if(typeof e!="object")throw new ft("options must be an object",ft.ERR_BAD_OPTION_VALUE);const a=Object.keys(e);let l=a.length;for(;l-- >0;){const o=a[l],c=t[o];if(c){const d=e[o],m=d===void 0||c(d,o,e);if(m!==!0)throw new ft("option "+o+" must be "+m,ft.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ft("Unknown option "+o,ft.ERR_BAD_OPTION)}}const G0={assertOptions:mE,validators:Am},Xa=G0.validators;let fi=class{constructor(t){this.defaults=t||{},this.interceptors={request:new ab,response:new ab}}async request(t,n){try{return await this._request(t,n)}catch(a){if(a instanceof Error){let l={};Error.captureStackTrace?Error.captureStackTrace(l):l=new Error;const o=l.stack?l.stack.replace(/^.+\n/,""):"";try{a.stack?o&&!String(a.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(a.stack+=` -`+o):a.stack=o}catch{}}throw a}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=gi(this.defaults,n);const{transitional:a,paramsSerializer:l,headers:o}=n;a!==void 0&&G0.assertOptions(a,{silentJSONParsing:Xa.transitional(Xa.boolean),forcedJSONParsing:Xa.transitional(Xa.boolean),clarifyTimeoutError:Xa.transitional(Xa.boolean)},!1),l!=null&&(ve.isFunction(l)?n.paramsSerializer={serialize:l}:G0.assertOptions(l,{encode:Xa.function,serialize:Xa.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),G0.assertOptions(n,{baseUrl:Xa.spelling("baseURL"),withXsrfToken:Xa.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let c=o&&ve.merge(o.common,o[n.method]);o&&ve.forEach(["delete","get","head","post","put","patch","common"],N=>{delete o[N]}),n.headers=Gr.concat(c,o);const d=[];let m=!0;this.interceptors.request.forEach(function(k){typeof k.runWhen=="function"&&k.runWhen(n)===!1||(m=m&&k.synchronous,d.unshift(k.fulfilled,k.rejected))});const f=[];this.interceptors.response.forEach(function(k){f.push(k.fulfilled,k.rejected)});let p,x=0,y;if(!m){const N=[pb.bind(this),void 0];for(N.unshift(...d),N.push(...f),y=N.length,p=Promise.resolve(n);x{if(!a._listeners)return;let o=a._listeners.length;for(;o-- >0;)a._listeners[o](l);a._listeners=null}),this.promise.then=l=>{let o;const c=new Promise(d=>{a.subscribe(d),o=d}).then(l);return c.cancel=function(){a.unsubscribe(o)},c},t(function(o,c,d){a.reason||(a.reason=new Yo(o,c,d),n(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=a=>{t.abort(a)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new z6(function(l){t=l}),cancel:t}}};function fE(e){return function(n){return e.apply(null,n)}}function pE(e){return ve.isObject(e)&&e.isAxiosError===!0}const _x={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(_x).forEach(([e,t])=>{_x[t]=e});function O6(e){const t=new fi(e),n=d6(fi.prototype.request,t);return ve.extend(n,fi.prototype,t,{allOwnKeys:!0}),ve.extend(n,t,null,{allOwnKeys:!0}),n.create=function(l){return O6(gi(e,l))},n}const An=O6(Bu);An.Axios=fi;An.CanceledError=Yo;An.CancelToken=hE;An.isCancel=C6;An.VERSION=D6;An.toFormData=Mm;An.AxiosError=ft;An.Cancel=An.CanceledError;An.all=function(t){return Promise.all(t)};An.spread=fE;An.isAxiosError=pE;An.mergeConfig=gi;An.AxiosHeaders=Gr;An.formToJSON=e=>k6(ve.isHTMLForm(e)?new FormData(e):e);An.getAdapter=A6.getAdapter;An.HttpStatusCode=_x;An.default=An;const{Axios:wK,AxiosError:jK,CanceledError:NK,isCancel:SK,CancelToken:kK,VERSION:CK,all:TK,Cancel:_K,isAxiosError:EK,spread:MK,toFormData:AK,AxiosHeaders:DK,HttpStatusCode:zK,formToJSON:OK,getAdapter:RK,mergeConfig:LK}=An,xE=(e,t)=>{const n=new Array(e.length+t.length);for(let a=0;a({classGroupId:e,validator:t}),R6=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),am="-",gb=[],vE="arbitrary..",yE=e=>{const t=wE(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return bE(c);const d=c.split(am),m=d[0]===""&&d.length>1?1:0;return L6(d,m,t)},getConflictingClassGroupIds:(c,d)=>{if(d){const m=a[c],f=n[c];return m?f?xE(f,m):m:f||gb}return n[c]||gb}}},L6=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const l=e[t],o=n.nextPart.get(l);if(o){const f=L6(e,t+1,o);if(f)return f}const c=n.validators;if(c===null)return;const d=t===0?e.join(am):e.slice(t).join(am),m=c.length;for(let f=0;fe.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),a=t.slice(0,n);return a?vE+a:void 0})(),wE=e=>{const{theme:t,classGroups:n}=e;return jE(n,t)},jE=(e,t)=>{const n=R6();for(const a in e){const l=e[a];E1(l,n,a,t)}return n},E1=(e,t,n,a)=>{const l=e.length;for(let o=0;o{if(typeof e=="string"){SE(e,t,n);return}if(typeof e=="function"){kE(e,t,n,a);return}CE(e,t,n,a)},SE=(e,t,n)=>{const a=e===""?t:B6(t,e);a.classGroupId=n},kE=(e,t,n,a)=>{if(TE(e)){E1(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(gE(n,e))},CE=(e,t,n,a)=>{const l=Object.entries(e),o=l.length;for(let c=0;c{let n=e;const a=t.split(am),l=a.length;for(let o=0;o"isThemeGetter"in e&&e.isThemeGetter===!0,_E=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),a=Object.create(null);const l=(o,c)=>{n[o]=c,t++,t>e&&(t=0,a=n,n=Object.create(null))};return{get(o){let c=n[o];if(c!==void 0)return c;if((c=a[o])!==void 0)return l(o,c),c},set(o,c){o in n?n[o]=c:l(o,c)}}},Ex="!",vb=":",EE=[],yb=(e,t,n,a,l)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:l}),ME=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=l=>{const o=[];let c=0,d=0,m=0,f;const p=l.length;for(let k=0;km?f-m:void 0;return yb(o,b,y,N)};if(t){const l=t+vb,o=a;a=c=>c.startsWith(l)?o(c.slice(l.length)):yb(EE,!1,c,void 0,!0)}if(n){const l=a;a=o=>n({className:o,parseClassName:l})}return a},AE=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,a)=>{t.set(n,1e6+a)}),n=>{const a=[];let l=[];for(let o=0;o0&&(l.sort(),a.push(...l),l=[]),a.push(c)):l.push(c)}return l.length>0&&(l.sort(),a.push(...l)),a}},DE=e=>({cache:_E(e.cacheSize),parseClassName:ME(e),sortModifiers:AE(e),...yE(e)}),zE=/\s+/,OE=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:l,sortModifiers:o}=t,c=[],d=e.trim().split(zE);let m="";for(let f=d.length-1;f>=0;f-=1){const p=d[f],{isExternal:x,modifiers:y,hasImportantModifier:b,baseClassName:N,maybePostfixModifierPosition:k}=n(p);if(x){m=p+(m.length>0?" "+m:m);continue}let S=!!k,T=a(S?N.substring(0,k):N);if(!T){if(!S){m=p+(m.length>0?" "+m:m);continue}if(T=a(N),!T){m=p+(m.length>0?" "+m:m);continue}S=!1}const M=y.length===0?"":y.length===1?y[0]:o(y).join(":"),A=b?M+Ex:M,R=A+T;if(c.indexOf(R)>-1)continue;c.push(R);const B=l(T,S);for(let O=0;O0?" "+m:m)}return m},RE=(...e)=>{let t=0,n,a,l="";for(;t{if(typeof e=="string")return e;let t,n="";for(let a=0;a{let n,a,l,o;const c=m=>{const f=t.reduce((p,x)=>x(p),e());return n=DE(f),a=n.cache.get,l=n.cache.set,o=d,d(m)},d=m=>{const f=a(m);if(f)return f;const p=OE(m,n);return l(m,p),p};return o=c,(...m)=>o(RE(...m))},BE=[],Kn=e=>{const t=n=>n[e]||BE;return t.isThemeGetter=!0,t},F6=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,I6=/^\((?:(\w[\w-]*):)?(.+)\)$/i,PE=/^\d+\/\d+$/,FE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,IE=/\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$/,qE=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,HE=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,UE=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,vo=e=>PE.test(e),wt=e=>!!e&&!Number.isNaN(Number(e)),xl=e=>!!e&&Number.isInteger(Number(e)),Cp=e=>e.endsWith("%")&&wt(e.slice(0,-1)),Es=e=>FE.test(e),$E=()=>!0,VE=e=>IE.test(e)&&!qE.test(e),q6=()=>!1,GE=e=>HE.test(e),YE=e=>UE.test(e),WE=e=>!Ve(e)&&!Ge(e),XE=e=>Wo(e,$6,q6),Ve=e=>F6.test(e),ai=e=>Wo(e,V6,VE),Tp=e=>Wo(e,eM,wt),bb=e=>Wo(e,H6,q6),KE=e=>Wo(e,U6,YE),N0=e=>Wo(e,G6,GE),Ge=e=>I6.test(e),Qc=e=>Xo(e,V6),QE=e=>Xo(e,tM),wb=e=>Xo(e,H6),ZE=e=>Xo(e,$6),JE=e=>Xo(e,U6),S0=e=>Xo(e,G6,!0),Wo=(e,t,n)=>{const a=F6.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},Xo=(e,t,n=!1)=>{const a=I6.exec(e);return a?a[1]?t(a[1]):n:!1},H6=e=>e==="position"||e==="percentage",U6=e=>e==="image"||e==="url",$6=e=>e==="length"||e==="size"||e==="bg-size",V6=e=>e==="length",eM=e=>e==="number",tM=e=>e==="family-name",G6=e=>e==="shadow",nM=()=>{const e=Kn("color"),t=Kn("font"),n=Kn("text"),a=Kn("font-weight"),l=Kn("tracking"),o=Kn("leading"),c=Kn("breakpoint"),d=Kn("container"),m=Kn("spacing"),f=Kn("radius"),p=Kn("shadow"),x=Kn("inset-shadow"),y=Kn("text-shadow"),b=Kn("drop-shadow"),N=Kn("blur"),k=Kn("perspective"),S=Kn("aspect"),T=Kn("ease"),M=Kn("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],B=()=>[...R(),Ge,Ve],O=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],$=()=>[Ge,Ve,m],U=()=>[vo,"full","auto",...$()],I=()=>[xl,"none","subgrid",Ge,Ve],G=()=>["auto",{span:["full",xl,Ge,Ve]},xl,Ge,Ve],ee=()=>[xl,"auto",Ge,Ve],Ne=()=>["auto","min","max","fr",Ge,Ve],J=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],se=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...$()],le=()=>[vo,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...$()],re=()=>[e,Ge,Ve],ge=()=>[...R(),wb,bb,{position:[Ge,Ve]}],E=()=>["no-repeat",{repeat:["","x","y","space","round"]}],we=()=>["auto","cover","contain",ZE,XE,{size:[Ge,Ve]}],Z=()=>[Cp,Qc,ai],z=()=>["","none","full",f,Ge,Ve],X=()=>["",wt,Qc,ai],q=()=>["solid","dashed","dotted","double"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],fe=()=>[wt,Cp,wb,bb],De=()=>["","none",N,Ge,Ve],oe=()=>["none",wt,Ge,Ve],He=()=>["none",wt,Ge,Ve],at=()=>[wt,Ge,Ve],je=()=>[vo,"full",...$()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Es],breakpoint:[Es],color:[$E],container:[Es],"drop-shadow":[Es],ease:["in","out","in-out"],font:[WE],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Es],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Es],shadow:[Es],spacing:["px",wt],text:[Es],"text-shadow":[Es],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",vo,Ve,Ge,S]}],container:["container"],columns:[{columns:[wt,Ve,Ge,d]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"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"],sr:["sr-only","not-sr-only"],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:B()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:U()}],"inset-x":[{"inset-x":U()}],"inset-y":[{"inset-y":U()}],start:[{start:U()}],end:[{end:U()}],top:[{top:U()}],right:[{right:U()}],bottom:[{bottom:U()}],left:[{left:U()}],visibility:["visible","invisible","collapse"],z:[{z:[xl,"auto",Ge,Ve]}],basis:[{basis:[vo,"full","auto",d,...$()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[wt,vo,"auto","initial","none",Ve]}],grow:[{grow:["",wt,Ge,Ve]}],shrink:[{shrink:["",wt,Ge,Ve]}],order:[{order:[xl,"first","last","none",Ge,Ve]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:G()}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:G()}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ne()}],"auto-rows":[{"auto-rows":Ne()}],gap:[{gap:$()}],"gap-x":[{"gap-x":$()}],"gap-y":[{"gap-y":$()}],"justify-content":[{justify:[...J(),"normal"]}],"justify-items":[{"justify-items":[...se(),"normal"]}],"justify-self":[{"justify-self":["auto",...se()]}],"align-content":[{content:["normal",...J()]}],"align-items":[{items:[...se(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...se(),{baseline:["","last"]}]}],"place-content":[{"place-content":J()}],"place-items":[{"place-items":[...se(),"baseline"]}],"place-self":[{"place-self":["auto",...se()]}],p:[{p:$()}],px:[{px:$()}],py:[{py:$()}],ps:[{ps:$()}],pe:[{pe:$()}],pt:[{pt:$()}],pr:[{pr:$()}],pb:[{pb:$()}],pl:[{pl:$()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":$()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":$()}],"space-y-reverse":["space-y-reverse"],size:[{size:le()}],w:[{w:[d,"screen",...le()]}],"min-w":[{"min-w":[d,"screen","none",...le()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[c]},...le()]}],h:[{h:["screen","lh",...le()]}],"min-h":[{"min-h":["screen","lh","none",...le()]}],"max-h":[{"max-h":["screen","lh",...le()]}],"font-size":[{text:["base",n,Qc,ai]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,Ge,Tp]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Cp,Ve]}],"font-family":[{font:[QE,Ve,t]}],"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-fractions"],tracking:[{tracking:[l,Ge,Ve]}],"line-clamp":[{"line-clamp":[wt,"none",Ge,Tp]}],leading:[{leading:[o,...$()]}],"list-image":[{"list-image":["none",Ge,Ve]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ge,Ve]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:re()}],"text-color":[{text:re()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:[wt,"from-font","auto",Ge,ai]}],"text-decoration-color":[{decoration:re()}],"underline-offset":[{"underline-offset":[wt,"auto",Ge,Ve]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:$()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ge,Ve]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ge,Ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ge()}],"bg-repeat":[{bg:E()}],"bg-size":[{bg:we()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},xl,Ge,Ve],radial:["",Ge,Ve],conic:[xl,Ge,Ve]},JE,KE]}],"bg-color":[{bg:re()}],"gradient-from-pos":[{from:Z()}],"gradient-via-pos":[{via:Z()}],"gradient-to-pos":[{to:Z()}],"gradient-from":[{from:re()}],"gradient-via":[{via:re()}],"gradient-to":[{to:re()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:X()}],"border-w-x":[{"border-x":X()}],"border-w-y":[{"border-y":X()}],"border-w-s":[{"border-s":X()}],"border-w-e":[{"border-e":X()}],"border-w-t":[{"border-t":X()}],"border-w-r":[{"border-r":X()}],"border-w-b":[{"border-b":X()}],"border-w-l":[{"border-l":X()}],"divide-x":[{"divide-x":X()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":X()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...q(),"hidden","none"]}],"divide-style":[{divide:[...q(),"hidden","none"]}],"border-color":[{border:re()}],"border-color-x":[{"border-x":re()}],"border-color-y":[{"border-y":re()}],"border-color-s":[{"border-s":re()}],"border-color-e":[{"border-e":re()}],"border-color-t":[{"border-t":re()}],"border-color-r":[{"border-r":re()}],"border-color-b":[{"border-b":re()}],"border-color-l":[{"border-l":re()}],"divide-color":[{divide:re()}],"outline-style":[{outline:[...q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[wt,Ge,Ve]}],"outline-w":[{outline:["",wt,Qc,ai]}],"outline-color":[{outline:re()}],shadow:[{shadow:["","none",p,S0,N0]}],"shadow-color":[{shadow:re()}],"inset-shadow":[{"inset-shadow":["none",x,S0,N0]}],"inset-shadow-color":[{"inset-shadow":re()}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:re()}],"ring-offset-w":[{"ring-offset":[wt,ai]}],"ring-offset-color":[{"ring-offset":re()}],"inset-ring-w":[{"inset-ring":X()}],"inset-ring-color":[{"inset-ring":re()}],"text-shadow":[{"text-shadow":["none",y,S0,N0]}],"text-shadow-color":[{"text-shadow":re()}],opacity:[{opacity:[wt,Ge,Ve]}],"mix-blend":[{"mix-blend":[...ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[wt]}],"mask-image-linear-from-pos":[{"mask-linear-from":fe()}],"mask-image-linear-to-pos":[{"mask-linear-to":fe()}],"mask-image-linear-from-color":[{"mask-linear-from":re()}],"mask-image-linear-to-color":[{"mask-linear-to":re()}],"mask-image-t-from-pos":[{"mask-t-from":fe()}],"mask-image-t-to-pos":[{"mask-t-to":fe()}],"mask-image-t-from-color":[{"mask-t-from":re()}],"mask-image-t-to-color":[{"mask-t-to":re()}],"mask-image-r-from-pos":[{"mask-r-from":fe()}],"mask-image-r-to-pos":[{"mask-r-to":fe()}],"mask-image-r-from-color":[{"mask-r-from":re()}],"mask-image-r-to-color":[{"mask-r-to":re()}],"mask-image-b-from-pos":[{"mask-b-from":fe()}],"mask-image-b-to-pos":[{"mask-b-to":fe()}],"mask-image-b-from-color":[{"mask-b-from":re()}],"mask-image-b-to-color":[{"mask-b-to":re()}],"mask-image-l-from-pos":[{"mask-l-from":fe()}],"mask-image-l-to-pos":[{"mask-l-to":fe()}],"mask-image-l-from-color":[{"mask-l-from":re()}],"mask-image-l-to-color":[{"mask-l-to":re()}],"mask-image-x-from-pos":[{"mask-x-from":fe()}],"mask-image-x-to-pos":[{"mask-x-to":fe()}],"mask-image-x-from-color":[{"mask-x-from":re()}],"mask-image-x-to-color":[{"mask-x-to":re()}],"mask-image-y-from-pos":[{"mask-y-from":fe()}],"mask-image-y-to-pos":[{"mask-y-to":fe()}],"mask-image-y-from-color":[{"mask-y-from":re()}],"mask-image-y-to-color":[{"mask-y-to":re()}],"mask-image-radial":[{"mask-radial":[Ge,Ve]}],"mask-image-radial-from-pos":[{"mask-radial-from":fe()}],"mask-image-radial-to-pos":[{"mask-radial-to":fe()}],"mask-image-radial-from-color":[{"mask-radial-from":re()}],"mask-image-radial-to-color":[{"mask-radial-to":re()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":R()}],"mask-image-conic-pos":[{"mask-conic":[wt]}],"mask-image-conic-from-pos":[{"mask-conic-from":fe()}],"mask-image-conic-to-pos":[{"mask-conic-to":fe()}],"mask-image-conic-from-color":[{"mask-conic-from":re()}],"mask-image-conic-to-color":[{"mask-conic-to":re()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ge()}],"mask-repeat":[{mask:E()}],"mask-size":[{mask:we()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ge,Ve]}],filter:[{filter:["","none",Ge,Ve]}],blur:[{blur:De()}],brightness:[{brightness:[wt,Ge,Ve]}],contrast:[{contrast:[wt,Ge,Ve]}],"drop-shadow":[{"drop-shadow":["","none",b,S0,N0]}],"drop-shadow-color":[{"drop-shadow":re()}],grayscale:[{grayscale:["",wt,Ge,Ve]}],"hue-rotate":[{"hue-rotate":[wt,Ge,Ve]}],invert:[{invert:["",wt,Ge,Ve]}],saturate:[{saturate:[wt,Ge,Ve]}],sepia:[{sepia:["",wt,Ge,Ve]}],"backdrop-filter":[{"backdrop-filter":["","none",Ge,Ve]}],"backdrop-blur":[{"backdrop-blur":De()}],"backdrop-brightness":[{"backdrop-brightness":[wt,Ge,Ve]}],"backdrop-contrast":[{"backdrop-contrast":[wt,Ge,Ve]}],"backdrop-grayscale":[{"backdrop-grayscale":["",wt,Ge,Ve]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[wt,Ge,Ve]}],"backdrop-invert":[{"backdrop-invert":["",wt,Ge,Ve]}],"backdrop-opacity":[{"backdrop-opacity":[wt,Ge,Ve]}],"backdrop-saturate":[{"backdrop-saturate":[wt,Ge,Ve]}],"backdrop-sepia":[{"backdrop-sepia":["",wt,Ge,Ve]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":$()}],"border-spacing-x":[{"border-spacing-x":$()}],"border-spacing-y":[{"border-spacing-y":$()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ge,Ve]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[wt,"initial",Ge,Ve]}],ease:[{ease:["linear","initial",T,Ge,Ve]}],delay:[{delay:[wt,Ge,Ve]}],animate:[{animate:["none",M,Ge,Ve]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,Ge,Ve]}],"perspective-origin":[{"perspective-origin":B()}],rotate:[{rotate:oe()}],"rotate-x":[{"rotate-x":oe()}],"rotate-y":[{"rotate-y":oe()}],"rotate-z":[{"rotate-z":oe()}],scale:[{scale:He()}],"scale-x":[{"scale-x":He()}],"scale-y":[{"scale-y":He()}],"scale-z":[{"scale-z":He()}],"scale-3d":["scale-3d"],skew:[{skew:at()}],"skew-x":[{"skew-x":at()}],"skew-y":[{"skew-y":at()}],transform:[{transform:[Ge,Ve,"","none","gpu","cpu"]}],"transform-origin":[{origin:B()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:je()}],"translate-x":[{"translate-x":je()}],"translate-y":[{"translate-y":je()}],"translate-z":[{"translate-z":je()}],"translate-none":["translate-none"],accent:[{accent:re()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:re()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",Ge,Ve]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"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",Ge,Ve]}],fill:[{fill:["none",...re()]}],"stroke-w":[{stroke:[wt,Qc,ai,Tp]}],stroke:[{stroke:["none",...re()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},rM=LE(nM);function he(...e){return rM(P5(e))}const ct=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:he("rounded-xl border bg-card text-card-foreground shadow",e),...t}));ct.displayName="Card";const Lt=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:he("flex flex-col space-y-1.5 p-6",e),...t}));Lt.displayName="CardHeader";const Bt=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:he("font-semibold leading-none tracking-tight",e),...t}));Bt.displayName="CardTitle";const Qn=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:he("text-sm text-muted-foreground",e),...t}));Qn.displayName="CardDescription";const Gt=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:he("p-6 pt-0",e),...t}));Gt.displayName="CardContent";const Y6=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:he("flex items-center p-6 pt-0",e),...t}));Y6.displayName="CardFooter";var _p="rovingFocusGroup.onEntryFocus",aM={bubbles:!1,cancelable:!0},Pu="RovingFocusGroup",[Mx,W6,sM]=bm(Pu),[lM,Dm]=Ua(Pu,[sM]),[iM,oM]=lM(Pu),X6=w.forwardRef((e,t)=>r.jsx(Mx.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Mx.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(cM,{...e,ref:t})})}));X6.displayName=Pu;var cM=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:a,loop:l=!1,dir:o,currentTabStopId:c,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:m,onEntryFocus:f,preventScrollOnEntryFocus:p=!1,...x}=e,y=w.useRef(null),b=mn(t,y),N=Eu(o),[k,S]=zl({prop:c,defaultProp:d??null,onChange:m,caller:Pu}),[T,M]=w.useState(!1),A=yr(f),R=W6(n),B=w.useRef(!1),[O,L]=w.useState(0);return w.useEffect(()=>{const $=y.current;if($)return $.addEventListener(_p,A),()=>$.removeEventListener(_p,A)},[A]),r.jsx(iM,{scope:n,orientation:a,dir:N,loop:l,currentTabStopId:k,onItemFocus:w.useCallback($=>S($),[S]),onItemShiftTab:w.useCallback(()=>M(!0),[]),onFocusableItemAdd:w.useCallback(()=>L($=>$+1),[]),onFocusableItemRemove:w.useCallback(()=>L($=>$-1),[]),children:r.jsx(It.div,{tabIndex:T||O===0?-1:0,"data-orientation":a,...x,ref:b,style:{outline:"none",...e.style},onMouseDown:Pe(e.onMouseDown,()=>{B.current=!0}),onFocus:Pe(e.onFocus,$=>{const U=!B.current;if($.target===$.currentTarget&&U&&!T){const I=new CustomEvent(_p,aM);if($.currentTarget.dispatchEvent(I),!I.defaultPrevented){const G=R().filter(H=>H.focusable),ee=G.find(H=>H.active),Ne=G.find(H=>H.id===k),se=[ee,Ne,...G].filter(Boolean).map(H=>H.ref.current);Z6(se,p)}}B.current=!1}),onBlur:Pe(e.onBlur,()=>M(!1))})})}),K6="RovingFocusGroupItem",Q6=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:a=!0,active:l=!1,tabStopId:o,children:c,...d}=e,m=Ta(),f=o||m,p=oM(K6,n),x=p.currentTabStopId===f,y=W6(n),{onFocusableItemAdd:b,onFocusableItemRemove:N,currentTabStopId:k}=p;return w.useEffect(()=>{if(a)return b(),()=>N()},[a,b,N]),r.jsx(Mx.ItemSlot,{scope:n,id:f,focusable:a,active:l,children:r.jsx(It.span,{tabIndex:x?0:-1,"data-orientation":p.orientation,...d,ref:t,onMouseDown:Pe(e.onMouseDown,S=>{a?p.onItemFocus(f):S.preventDefault()}),onFocus:Pe(e.onFocus,()=>p.onItemFocus(f)),onKeyDown:Pe(e.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){p.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const T=mM(S,p.orientation,p.dir);if(T!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let A=y().filter(R=>R.focusable).map(R=>R.ref.current);if(T==="last")A.reverse();else if(T==="prev"||T==="next"){T==="prev"&&A.reverse();const R=A.indexOf(S.currentTarget);A=p.loop?hM(A,R+1):A.slice(R+1)}setTimeout(()=>Z6(A))}}),children:typeof c=="function"?c({isCurrentTabStop:x,hasTabStop:k!=null}):c})})});Q6.displayName=K6;var uM={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function dM(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function mM(e,t,n){const a=dM(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(a))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(a)))return uM[a]}function Z6(e,t=!1){const n=document.activeElement;for(const a of e)if(a===n||(a.focus({preventScroll:t}),document.activeElement!==n))return}function hM(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var J6=X6,ew=Q6,zm="Tabs",[fM]=Ua(zm,[Dm]),tw=Dm(),[pM,M1]=fM(zm),nw=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,onValueChange:l,defaultValue:o,orientation:c="horizontal",dir:d,activationMode:m="automatic",...f}=e,p=Eu(d),[x,y]=zl({prop:a,onChange:l,defaultProp:o??"",caller:zm});return r.jsx(pM,{scope:n,baseId:Ta(),value:x,onValueChange:y,orientation:c,dir:p,activationMode:m,children:r.jsx(It.div,{dir:p,"data-orientation":c,...f,ref:t})})});nw.displayName=zm;var rw="TabsList",aw=w.forwardRef((e,t)=>{const{__scopeTabs:n,loop:a=!0,...l}=e,o=M1(rw,n),c=tw(n);return r.jsx(J6,{asChild:!0,...c,orientation:o.orientation,dir:o.dir,loop:a,children:r.jsx(It.div,{role:"tablist","aria-orientation":o.orientation,...l,ref:t})})});aw.displayName=rw;var sw="TabsTrigger",lw=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,disabled:l=!1,...o}=e,c=M1(sw,n),d=tw(n),m=cw(c.baseId,a),f=uw(c.baseId,a),p=a===c.value;return r.jsx(ew,{asChild:!0,...d,focusable:!l,active:p,children:r.jsx(It.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":f,"data-state":p?"active":"inactive","data-disabled":l?"":void 0,disabled:l,id:m,...o,ref:t,onMouseDown:Pe(e.onMouseDown,x=>{!l&&x.button===0&&x.ctrlKey===!1?c.onValueChange(a):x.preventDefault()}),onKeyDown:Pe(e.onKeyDown,x=>{[" ","Enter"].includes(x.key)&&c.onValueChange(a)}),onFocus:Pe(e.onFocus,()=>{const x=c.activationMode!=="manual";!p&&!l&&x&&c.onValueChange(a)})})})});lw.displayName=sw;var iw="TabsContent",ow=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,forceMount:l,children:o,...c}=e,d=M1(iw,n),m=cw(d.baseId,a),f=uw(d.baseId,a),p=a===d.value,x=w.useRef(p);return w.useEffect(()=>{const y=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(y)},[]),r.jsx(Wr,{present:l||p,children:({present:y})=>r.jsx(It.div,{"data-state":p?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":m,hidden:!y,id:f,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:x.current?"0s":void 0},children:y&&o})})});ow.displayName=iw;function cw(e,t){return`${e}-trigger-${t}`}function uw(e,t){return`${e}-content-${t}`}var xM=nw,dw=aw,mw=lw,hw=ow;const kl=xM,Bs=w.forwardRef(({className:e,...t},n)=>r.jsx(dw,{ref:n,className:he("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));Bs.displayName=dw.displayName;const Pt=w.forwardRef(({className:e,...t},n)=>r.jsx(mw,{ref:n,className:he("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 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",e),...t}));Pt.displayName=mw.displayName;const cn=w.forwardRef(({className:e,...t},n)=>r.jsx(hw,{ref:n,className:he("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",e),...t}));cn.displayName=hw.displayName;function gM(e,t){return w.useReducer((n,a)=>t[n][a]??n,e)}var A1="ScrollArea",[fw]=Ua(A1),[vM,Aa]=fw(A1),pw=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:a="hover",dir:l,scrollHideDelay:o=600,...c}=e,[d,m]=w.useState(null),[f,p]=w.useState(null),[x,y]=w.useState(null),[b,N]=w.useState(null),[k,S]=w.useState(null),[T,M]=w.useState(0),[A,R]=w.useState(0),[B,O]=w.useState(!1),[L,$]=w.useState(!1),U=mn(t,G=>m(G)),I=Eu(l);return r.jsx(vM,{scope:n,type:a,dir:I,scrollHideDelay:o,scrollArea:d,viewport:f,onViewportChange:p,content:x,onContentChange:y,scrollbarX:b,onScrollbarXChange:N,scrollbarXEnabled:B,onScrollbarXEnabledChange:O,scrollbarY:k,onScrollbarYChange:S,scrollbarYEnabled:L,onScrollbarYEnabledChange:$,onCornerWidthChange:M,onCornerHeightChange:R,children:r.jsx(It.div,{dir:I,...c,ref:U,style:{position:"relative","--radix-scroll-area-corner-width":T+"px","--radix-scroll-area-corner-height":A+"px",...e.style}})})});pw.displayName=A1;var xw="ScrollAreaViewport",gw=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:a,nonce:l,...o}=e,c=Aa(xw,n),d=w.useRef(null),m=mn(t,d,c.onViewportChange);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:l}),r.jsx(It.div,{"data-radix-scroll-area-viewport":"",...o,ref:m,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...e.style},children:r.jsx("div",{ref:c.onContentChange,style:{minWidth:"100%",display:"table"},children:a})})]})});gw.displayName=xw;var ss="ScrollAreaScrollbar",D1=w.forwardRef((e,t)=>{const{forceMount:n,...a}=e,l=Aa(ss,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:c}=l,d=e.orientation==="horizontal";return w.useEffect(()=>(d?o(!0):c(!0),()=>{d?o(!1):c(!1)}),[d,o,c]),l.type==="hover"?r.jsx(yM,{...a,ref:t,forceMount:n}):l.type==="scroll"?r.jsx(bM,{...a,ref:t,forceMount:n}):l.type==="auto"?r.jsx(vw,{...a,ref:t,forceMount:n}):l.type==="always"?r.jsx(z1,{...a,ref:t}):null});D1.displayName=ss;var yM=w.forwardRef((e,t)=>{const{forceMount:n,...a}=e,l=Aa(ss,e.__scopeScrollArea),[o,c]=w.useState(!1);return w.useEffect(()=>{const d=l.scrollArea;let m=0;if(d){const f=()=>{window.clearTimeout(m),c(!0)},p=()=>{m=window.setTimeout(()=>c(!1),l.scrollHideDelay)};return d.addEventListener("pointerenter",f),d.addEventListener("pointerleave",p),()=>{window.clearTimeout(m),d.removeEventListener("pointerenter",f),d.removeEventListener("pointerleave",p)}}},[l.scrollArea,l.scrollHideDelay]),r.jsx(Wr,{present:n||o,children:r.jsx(vw,{"data-state":o?"visible":"hidden",...a,ref:t})})}),bM=w.forwardRef((e,t)=>{const{forceMount:n,...a}=e,l=Aa(ss,e.__scopeScrollArea),o=e.orientation==="horizontal",c=Rm(()=>m("SCROLL_END"),100),[d,m]=gM("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 w.useEffect(()=>{if(d==="idle"){const f=window.setTimeout(()=>m("HIDE"),l.scrollHideDelay);return()=>window.clearTimeout(f)}},[d,l.scrollHideDelay,m]),w.useEffect(()=>{const f=l.viewport,p=o?"scrollLeft":"scrollTop";if(f){let x=f[p];const y=()=>{const b=f[p];x!==b&&(m("SCROLL"),c()),x=b};return f.addEventListener("scroll",y),()=>f.removeEventListener("scroll",y)}},[l.viewport,o,m,c]),r.jsx(Wr,{present:n||d!=="hidden",children:r.jsx(z1,{"data-state":d==="hidden"?"hidden":"visible",...a,ref:t,onPointerEnter:Pe(e.onPointerEnter,()=>m("POINTER_ENTER")),onPointerLeave:Pe(e.onPointerLeave,()=>m("POINTER_LEAVE"))})})}),vw=w.forwardRef((e,t)=>{const n=Aa(ss,e.__scopeScrollArea),{forceMount:a,...l}=e,[o,c]=w.useState(!1),d=e.orientation==="horizontal",m=Rm(()=>{if(n.viewport){const f=n.viewport.offsetWidth{const{orientation:n="vertical",...a}=e,l=Aa(ss,e.__scopeScrollArea),o=w.useRef(null),c=w.useRef(0),[d,m]=w.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),f=Nw(d.viewport,d.content),p={...a,sizes:d,onSizesChange:m,hasThumb:f>0&&f<1,onThumbChange:y=>o.current=y,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:y=>c.current=y};function x(y,b){return CM(y,c.current,d,b)}return n==="horizontal"?r.jsx(wM,{...p,ref:t,onThumbPositionChange:()=>{if(l.viewport&&o.current){const y=l.viewport.scrollLeft,b=jb(y,d,l.dir);o.current.style.transform=`translate3d(${b}px, 0, 0)`}},onWheelScroll:y=>{l.viewport&&(l.viewport.scrollLeft=y)},onDragScroll:y=>{l.viewport&&(l.viewport.scrollLeft=x(y,l.dir))}}):n==="vertical"?r.jsx(jM,{...p,ref:t,onThumbPositionChange:()=>{if(l.viewport&&o.current){const y=l.viewport.scrollTop,b=jb(y,d);o.current.style.transform=`translate3d(0, ${b}px, 0)`}},onWheelScroll:y=>{l.viewport&&(l.viewport.scrollTop=y)},onDragScroll:y=>{l.viewport&&(l.viewport.scrollTop=x(y))}}):null}),wM=w.forwardRef((e,t)=>{const{sizes:n,onSizesChange:a,...l}=e,o=Aa(ss,e.__scopeScrollArea),[c,d]=w.useState(),m=w.useRef(null),f=mn(t,m,o.onScrollbarXChange);return w.useEffect(()=>{m.current&&d(getComputedStyle(m.current))},[m]),r.jsx(bw,{"data-orientation":"horizontal",...l,ref:f,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":Om(n)+"px",...e.style},onThumbPointerDown:p=>e.onThumbPointerDown(p.x),onDragScroll:p=>e.onDragScroll(p.x),onWheelScroll:(p,x)=>{if(o.viewport){const y=o.viewport.scrollLeft+p.deltaX;e.onWheelScroll(y),kw(y,x)&&p.preventDefault()}},onResize:()=>{m.current&&o.viewport&&c&&a({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:m.current.clientWidth,paddingStart:lm(c.paddingLeft),paddingEnd:lm(c.paddingRight)}})}})}),jM=w.forwardRef((e,t)=>{const{sizes:n,onSizesChange:a,...l}=e,o=Aa(ss,e.__scopeScrollArea),[c,d]=w.useState(),m=w.useRef(null),f=mn(t,m,o.onScrollbarYChange);return w.useEffect(()=>{m.current&&d(getComputedStyle(m.current))},[m]),r.jsx(bw,{"data-orientation":"vertical",...l,ref:f,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":Om(n)+"px",...e.style},onThumbPointerDown:p=>e.onThumbPointerDown(p.y),onDragScroll:p=>e.onDragScroll(p.y),onWheelScroll:(p,x)=>{if(o.viewport){const y=o.viewport.scrollTop+p.deltaY;e.onWheelScroll(y),kw(y,x)&&p.preventDefault()}},onResize:()=>{m.current&&o.viewport&&c&&a({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:m.current.clientHeight,paddingStart:lm(c.paddingTop),paddingEnd:lm(c.paddingBottom)}})}})}),[NM,yw]=fw(ss),bw=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:a,hasThumb:l,onThumbChange:o,onThumbPointerUp:c,onThumbPointerDown:d,onThumbPositionChange:m,onDragScroll:f,onWheelScroll:p,onResize:x,...y}=e,b=Aa(ss,n),[N,k]=w.useState(null),S=mn(t,U=>k(U)),T=w.useRef(null),M=w.useRef(""),A=b.viewport,R=a.content-a.viewport,B=yr(p),O=yr(m),L=Rm(x,10);function $(U){if(T.current){const I=U.clientX-T.current.left,G=U.clientY-T.current.top;f({x:I,y:G})}}return w.useEffect(()=>{const U=I=>{const G=I.target;N?.contains(G)&&B(I,R)};return document.addEventListener("wheel",U,{passive:!1}),()=>document.removeEventListener("wheel",U,{passive:!1})},[A,N,R,B]),w.useEffect(O,[a,O]),Io(N,L),Io(b.content,L),r.jsx(NM,{scope:n,scrollbar:N,hasThumb:l,onThumbChange:yr(o),onThumbPointerUp:yr(c),onThumbPositionChange:O,onThumbPointerDown:yr(d),children:r.jsx(It.div,{...y,ref:S,style:{position:"absolute",...y.style},onPointerDown:Pe(e.onPointerDown,U=>{U.button===0&&(U.target.setPointerCapture(U.pointerId),T.current=N.getBoundingClientRect(),M.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",b.viewport&&(b.viewport.style.scrollBehavior="auto"),$(U))}),onPointerMove:Pe(e.onPointerMove,$),onPointerUp:Pe(e.onPointerUp,U=>{const I=U.target;I.hasPointerCapture(U.pointerId)&&I.releasePointerCapture(U.pointerId),document.body.style.webkitUserSelect=M.current,b.viewport&&(b.viewport.style.scrollBehavior=""),T.current=null})})})}),sm="ScrollAreaThumb",ww=w.forwardRef((e,t)=>{const{forceMount:n,...a}=e,l=yw(sm,e.__scopeScrollArea);return r.jsx(Wr,{present:n||l.hasThumb,children:r.jsx(SM,{ref:t,...a})})}),SM=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:a,...l}=e,o=Aa(sm,n),c=yw(sm,n),{onThumbPositionChange:d}=c,m=mn(t,x=>c.onThumbChange(x)),f=w.useRef(void 0),p=Rm(()=>{f.current&&(f.current(),f.current=void 0)},100);return w.useEffect(()=>{const x=o.viewport;if(x){const y=()=>{if(p(),!f.current){const b=TM(x,d);f.current=b,d()}};return d(),x.addEventListener("scroll",y),()=>x.removeEventListener("scroll",y)}},[o.viewport,p,d]),r.jsx(It.div,{"data-state":c.hasThumb?"visible":"hidden",...l,ref:m,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...a},onPointerDownCapture:Pe(e.onPointerDownCapture,x=>{const b=x.target.getBoundingClientRect(),N=x.clientX-b.left,k=x.clientY-b.top;c.onThumbPointerDown({x:N,y:k})}),onPointerUp:Pe(e.onPointerUp,c.onThumbPointerUp)})});ww.displayName=sm;var O1="ScrollAreaCorner",jw=w.forwardRef((e,t)=>{const n=Aa(O1,e.__scopeScrollArea),a=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&a?r.jsx(kM,{...e,ref:t}):null});jw.displayName=O1;var kM=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,...a}=e,l=Aa(O1,n),[o,c]=w.useState(0),[d,m]=w.useState(0),f=!!(o&&d);return Io(l.scrollbarX,()=>{const p=l.scrollbarX?.offsetHeight||0;l.onCornerHeightChange(p),m(p)}),Io(l.scrollbarY,()=>{const p=l.scrollbarY?.offsetWidth||0;l.onCornerWidthChange(p),c(p)}),f?r.jsx(It.div,{...a,ref:t,style:{width:o,height:d,position:"absolute",right:l.dir==="ltr"?0:void 0,left:l.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function lm(e){return e?parseInt(e,10):0}function Nw(e,t){const n=e/t;return isNaN(n)?0:n}function Om(e){const t=Nw(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,a=(e.scrollbar.size-n)*t;return Math.max(a,18)}function CM(e,t,n,a="ltr"){const l=Om(n),o=l/2,c=t||o,d=l-c,m=n.scrollbar.paddingStart+c,f=n.scrollbar.size-n.scrollbar.paddingEnd-d,p=n.content-n.viewport,x=a==="ltr"?[0,p]:[p*-1,0];return Sw([m,f],x)(e)}function jb(e,t,n="ltr"){const a=Om(t),l=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-l,c=t.content-t.viewport,d=o-a,m=n==="ltr"?[0,c]:[c*-1,0],f=h1(e,m);return Sw([0,c],[0,d])(f)}function Sw(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const a=(t[1]-t[0])/(e[1]-e[0]);return t[0]+a*(n-e[0])}}function kw(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},a=0;return(function l(){const o={left:e.scrollLeft,top:e.scrollTop},c=n.left!==o.left,d=n.top!==o.top;(c||d)&&t(),n=o,a=window.requestAnimationFrame(l)})(),()=>window.cancelAnimationFrame(a)};function Rm(e,t){const n=yr(e),a=w.useRef(0);return w.useEffect(()=>()=>window.clearTimeout(a.current),[]),w.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(n,t)},[n,t])}function Io(e,t){const n=yr(t);F5(()=>{let a=0;if(e){const l=new ResizeObserver(()=>{cancelAnimationFrame(a),a=window.requestAnimationFrame(n)});return l.observe(e),()=>{window.cancelAnimationFrame(a),l.unobserve(e)}}},[e,n])}var Cw=pw,_M=gw,EM=jw;const an=w.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(Cw,{ref:a,className:he("relative overflow-hidden",e),...n,children:[r.jsx(_M,{className:"h-full w-full rounded-[inherit]",children:t}),r.jsx(Tw,{}),r.jsx(EM,{})]}));an.displayName=Cw.displayName;const Tw=w.forwardRef(({className:e,orientation:t="vertical",...n},a)=>r.jsx(D1,{ref:a,orientation:t,className:he("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:r.jsx(ww,{className:"relative flex-1 rounded-full bg-border"})}));Tw.displayName=D1.displayName;function Nb({className:e,...t}){return r.jsx("div",{className:he("animate-pulse rounded-md bg-primary/10",e),...t})}function MM(e,t=[]){let n=[];function a(o,c){const d=w.createContext(c);d.displayName=o+"Context";const m=n.length;n=[...n,c];const f=x=>{const{scope:y,children:b,...N}=x,k=y?.[e]?.[m]||d,S=w.useMemo(()=>N,Object.values(N));return r.jsx(k.Provider,{value:S,children:b})};f.displayName=o+"Provider";function p(x,y){const b=y?.[e]?.[m]||d,N=w.useContext(b);if(N)return N;if(c!==void 0)return c;throw new Error(`\`${x}\` must be used within \`${o}\``)}return[f,p]}const l=()=>{const o=n.map(c=>w.createContext(c));return function(d){const m=d?.[e]||o;return w.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])}};return l.scopeName=e,[a,AM(l,...t)]}function AM(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(o){const c=a.reduce((d,{useScope:m,scopeName:f})=>{const x=m(o)[`__scope${f}`];return{...d,...x}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var DM=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_w=DM.reduce((e,t)=>{const n=f1(`Primitive.${t}`),a=w.forwardRef((l,o)=>{const{asChild:c,...d}=l,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(m,{...d,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),R1="Progress",L1=100,[zM]=MM(R1),[OM,RM]=zM(R1),Ew=w.forwardRef((e,t)=>{const{__scopeProgress:n,value:a=null,max:l,getValueLabel:o=LM,...c}=e;(l||l===0)&&!Sb(l)&&console.error(BM(`${l}`,"Progress"));const d=Sb(l)?l:L1;a!==null&&!kb(a,d)&&console.error(PM(`${a}`,"Progress"));const m=kb(a,d)?a:null,f=im(m)?o(m,d):void 0;return r.jsx(OM,{scope:n,value:m,max:d,children:r.jsx(_w.div,{"aria-valuemax":d,"aria-valuemin":0,"aria-valuenow":im(m)?m:void 0,"aria-valuetext":f,role:"progressbar","data-state":Dw(m,d),"data-value":m??void 0,"data-max":d,...c,ref:t})})});Ew.displayName=R1;var Mw="ProgressIndicator",Aw=w.forwardRef((e,t)=>{const{__scopeProgress:n,...a}=e,l=RM(Mw,n);return r.jsx(_w.div,{"data-state":Dw(l.value,l.max),"data-value":l.value??void 0,"data-max":l.max,...a,ref:t})});Aw.displayName=Mw;function LM(e,t){return`${Math.round(e/t*100)}%`}function Dw(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function im(e){return typeof e=="number"}function Sb(e){return im(e)&&!isNaN(e)&&e>0}function kb(e,t){return im(e)&&!isNaN(e)&&e<=t&&e>=0}function BM(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${L1}\`.`}function PM(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: - - a positive number - - less than the value passed to \`max\` (or ${L1} if no \`max\` prop is set) - - \`null\` or \`undefined\` if the progress is indeterminate. - -Defaulting to \`null\`.`}var zw=Ew,FM=Aw;const Fu=w.forwardRef(({className:e,value:t,...n},a)=>r.jsx(zw,{ref:a,className:he("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...n,children:r.jsx(FM,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Fu.displayName=zw.displayName;const IM={light:"",dark:".dark"},Ow=w.createContext(null);function Rw(){const e=w.useContext(Ow);if(!e)throw new Error("useChart must be used within a ");return e}const So=w.forwardRef(({id:e,className:t,children:n,config:a,...l},o)=>{const c=w.useId(),d=`chart-${e||c.replace(/:/g,"")}`;return r.jsx(Ow.Provider,{value:{config:a},children:r.jsxs("div",{"data-chart":d,ref:o,className:he("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",t),...l,children:[r.jsx(qM,{id:d,config:a}),r.jsx(VC,{children:n})]})})});So.displayName="Chart";const qM=({id:e,config:t})=>{const n=Object.entries(t).filter(([,a])=>a.theme||a.color);return n.length?r.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(IM).map(([a,l])=>` -${l} [data-chart=${e}] { -${n.map(([o,c])=>{const d=c.theme?.[a]||c.color;return d?` --color-${o}: ${d};`:null}).join(` -`)} -} -`).join(` -`)}}):null},Zc=GC,ko=w.forwardRef(({active:e,payload:t,className:n,indicator:a="dot",hideLabel:l=!1,hideIndicator:o=!1,label:c,labelFormatter:d,labelClassName:m,formatter:f,color:p,nameKey:x,labelKey:y},b)=>{const{config:N}=Rw(),k=w.useMemo(()=>{if(l||!t?.length)return null;const[T]=t,M=`${y||T?.dataKey||T?.name||"value"}`,A=Ax(N,T,M),R=!y&&typeof c=="string"?N[c]?.label||c:A?.label;return d?r.jsx("div",{className:he("font-medium",m),children:d(R,t)}):R?r.jsx("div",{className:he("font-medium",m),children:R}):null},[c,d,t,l,m,N,y]);if(!e||!t?.length)return null;const S=t.length===1&&a!=="dot";return r.jsxs("div",{ref:b,className:he("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[S?null:k,r.jsx("div",{className:"grid gap-1.5",children:t.filter(T=>T.type!=="none").map((T,M)=>{const A=`${x||T.name||T.dataKey||"value"}`,R=Ax(N,T,A),B=p||T.payload.fill||T.color;return r.jsx("div",{className:he("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",a==="dot"&&"items-center"),children:f&&T?.value!==void 0&&T.name?f(T.value,T.name,T,M,T.payload):r.jsxs(r.Fragment,{children:[R?.icon?r.jsx(R.icon,{}):!o&&r.jsx("div",{className:he("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":a==="dot","w-1":a==="line","w-0 border-[1.5px] border-dashed bg-transparent":a==="dashed","my-0.5":S&&a==="dashed"}),style:{"--color-bg":B,"--color-border":B}}),r.jsxs("div",{className:he("flex flex-1 justify-between leading-none",S?"items-end":"items-center"),children:[r.jsxs("div",{className:"grid gap-1.5",children:[S?k:null,r.jsx("span",{className:"text-muted-foreground",children:R?.label||T.name})]}),T.value&&r.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:T.value.toLocaleString()})]})]})},T.dataKey)})})]})});ko.displayName="ChartTooltip";const HM=YC,Lw=w.forwardRef(({className:e,hideIcon:t=!1,payload:n,verticalAlign:a="bottom",nameKey:l},o)=>{const{config:c}=Rw();return n?.length?r.jsx("div",{ref:o,className:he("flex items-center justify-center gap-4",a==="top"?"pb-3":"pt-3",e),children:n.filter(d=>d.type!=="none").map(d=>{const m=`${l||d.dataKey||"value"}`,f=Ax(c,d,m);return r.jsxs("div",{className:he("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[f?.icon&&!t?r.jsx(f.icon,{}):r.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:d.color}}),f?.label]},d.value)})}):null});Lw.displayName="ChartLegend";function Ax(e,t,n){if(typeof t!="object"||t===null)return;const a="payload"in t&&typeof t.payload=="object"&&t.payload!==null?t.payload:void 0;let l=n;return n in t&&typeof t[n]=="string"?l=t[n]:a&&n in a&&typeof a[n]=="string"&&(l=a[n]),l in e?e[l]:e[n]}const Cb=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Tb=P5,Ko=(e,t)=>n=>{var a;if(t?.variants==null)return Tb(e,n?.class,n?.className);const{variants:l,defaultVariants:o}=t,c=Object.keys(l).map(f=>{const p=n?.[f],x=o?.[f];if(p===null)return null;const y=Cb(p)||Cb(x);return l[f][y]}),d=n&&Object.entries(n).reduce((f,p)=>{let[x,y]=p;return y===void 0||(f[x]=y),f},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((f,p)=>{let{class:x,className:y,...b}=p;return Object.entries(b).every(N=>{let[k,S]=N;return Array.isArray(S)?S.includes({...o,...d}[k]):{...o,...d}[k]===S})?[...f,x,y]:f},[]);return Tb(e,c,m,n?.class,n?.className)},gu=Ko("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring 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 shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ne=w.forwardRef(({className:e,variant:t,size:n,asChild:a=!1,...l},o)=>{const c=a?JC:"button";return r.jsx(c,{className:he(gu({variant:t,size:n,className:e})),ref:o,...l})});ne.displayName="Button";function UM(){const[e,t]=w.useState(null),[n,a]=w.useState(!0),[l,o]=w.useState(0),[c,d]=w.useState(24),[m,f]=w.useState(!0),[p,x]=w.useState(null),[y,b]=w.useState(!0),N=w.useCallback(async()=>{try{b(!0);const U=await An.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");x({hitokoto:U.data.hitokoto,from:U.data.from||U.data.from_who||"未知"})}catch(U){console.error("获取一言失败:",U),x({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{b(!1)}},[]),k=w.useCallback(async()=>{try{const U=localStorage.getItem("access-token"),I=await An.get(`/api/webui/statistics/dashboard?hours=${c}`,{headers:{Authorization:`Bearer ${U}`}});t(I.data),a(!1),o(100)}catch(U){console.error("Failed to fetch dashboard data:",U),a(!1),o(100)}},[c]);if(w.useEffect(()=>{if(!n)return;o(0);const U=setTimeout(()=>o(15),200),I=setTimeout(()=>o(30),800),G=setTimeout(()=>o(45),2e3),ee=setTimeout(()=>o(60),4e3),Ne=setTimeout(()=>o(75),6500),J=setTimeout(()=>o(85),9e3),se=setTimeout(()=>o(92),11e3);return()=>{clearTimeout(U),clearTimeout(I),clearTimeout(G),clearTimeout(ee),clearTimeout(Ne),clearTimeout(J),clearTimeout(se)}},[n]),w.useEffect(()=>{k(),N()},[k,N]),w.useEffect(()=>{if(!m)return;const U=setInterval(()=>{k()},3e4);return()=>clearInterval(U)},[m,k]),n||!e)return r.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:r.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[r.jsx(Ia,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Fu,{value:l,className:"h-2"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[l,"%"]})]})]})});const{summary:S,model_stats:T,hourly_data:M,daily_data:A,recent_activity:R}=e,B=U=>{const I=Math.floor(U/3600),G=Math.floor(U%3600/60);return`${I}小时${G}分钟`},O=U=>new Date(U).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),L=T.slice(0,6).map(U=>({name:U.model_name,value:U.request_count,fill:`hsl(var(--chart-${T.indexOf(U)%5+1}))`})),$={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return r.jsx(an,{className:"h-full",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(kl,{value:c.toString(),onValueChange:U=>d(Number(U)),children:r.jsxs(Bs,{className:"grid grid-cols-3 w-full sm:w-auto",children:[r.jsx(Pt,{value:"24",children:"24小时"}),r.jsx(Pt,{value:"168",children:"7天"}),r.jsx(Pt,{value:"720",children:"30天"})]})}),r.jsxs(ne,{variant:m?"default":"outline",size:"sm",onClick:()=>f(!m),className:"gap-2",children:[r.jsx(Ia,{className:`h-4 w-4 ${m?"animate-spin":""}`}),r.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),r.jsx(ne,{variant:"outline",size:"sm",onClick:k,children:r.jsx(Ia,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"总请求数"}),r.jsx(mT,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Gt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:S.total_requests.toLocaleString()}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",c<48?c+"小时":Math.floor(c/24)+"天"]})]})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"总花费"}),r.jsx(hT,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Gt,{children:[r.jsxs("div",{className:"text-2xl font-bold",children:["¥",S.total_cost.toFixed(2)]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.cost_per_hour>0?`¥${S.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"Token消耗"}),r.jsx(fT,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Gt,{children:[r.jsxs("div",{className:"text-2xl font-bold",children:[(S.total_tokens/1e3).toFixed(1),"K"]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.tokens_per_hour>0?`${(S.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"平均响应"}),r.jsx(fu,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Gt,{children:[r.jsxs("div",{className:"text-2xl font-bold",children:[S.avg_response_time.toFixed(2),"s"]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),r.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"在线时长"}),r.jsx(di,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Gt,{children:r.jsx("div",{className:"text-xl font-bold",children:B(S.online_time)})})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"消息处理"}),r.jsx(Mu,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Gt,{children:[r.jsx("div",{className:"text-xl font-bold",children:S.total_messages.toLocaleString()}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",S.total_replies.toLocaleString()," 条"]})]})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"成本效率"}),r.jsx(pT,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Gt,{children:[r.jsx("div",{className:"text-xl font-bold",children:S.total_messages>0?`¥${(S.total_cost/S.total_messages*100).toFixed(2)}`:"¥0.00"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),r.jsxs(kl,{defaultValue:"trends",className:"space-y-4",children:[r.jsxs(Bs,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[r.jsx(Pt,{value:"trends",children:"趋势"}),r.jsx(Pt,{value:"models",children:"模型"}),r.jsx(Pt,{value:"activity",children:"活动"}),r.jsx(Pt,{value:"daily",children:"日统计"})]}),r.jsxs(cn,{value:"trends",className:"space-y-4",children:[r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"请求趋势"}),r.jsxs(Qn,{children:["最近",c,"小时的请求量变化"]})]}),r.jsx(Gt,{children:r.jsx(So,{config:$,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:r.jsxs(WC,{data:M,children:[r.jsx(y0,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),r.jsx(b0,{dataKey:"timestamp",tickFormatter:U=>O(U),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Wc,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Zc,{content:r.jsx(ko,{labelFormatter:U=>O(U)})}),r.jsx(XC,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),r.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"花费趋势"}),r.jsx(Qn,{children:"API调用成本变化"})]}),r.jsx(Gt,{children:r.jsx(So,{config:$,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:r.jsxs(vp,{data:M,children:[r.jsx(y0,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),r.jsx(b0,{dataKey:"timestamp",tickFormatter:U=>O(U),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Wc,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Zc,{content:r.jsx(ko,{labelFormatter:U=>O(U)})}),r.jsx(w0,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"Token消耗"}),r.jsx(Qn,{children:"Token使用量变化"})]}),r.jsx(Gt,{children:r.jsx(So,{config:$,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:r.jsxs(vp,{data:M,children:[r.jsx(y0,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),r.jsx(b0,{dataKey:"timestamp",tickFormatter:U=>O(U),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Wc,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Zc,{content:r.jsx(ko,{labelFormatter:U=>O(U)})}),r.jsx(w0,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),r.jsx(cn,{value:"models",className:"space-y-4",children:r.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"模型请求分布"}),r.jsx(Qn,{children:"各模型使用占比"})]}),r.jsx(Gt,{children:r.jsx(So,{config:Object.fromEntries(T.slice(0,6).map((U,I)=>[U.model_name,{label:U.model_name,color:`hsl(var(--chart-${I%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:r.jsxs(KC,{children:[r.jsx(Zc,{content:r.jsx(ko,{})}),r.jsx(QC,{data:L,cx:"50%",cy:"50%",labelLine:!1,label:({name:U,percent:I})=>`${U} ${I?(I*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:L.map((U,I)=>r.jsx(ZC,{fill:U.fill},`cell-${I}`))})]})})})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"模型详细统计"}),r.jsx(Qn,{children:"请求数、花费和性能"})]}),r.jsx(Gt,{children:r.jsx(an,{className:"h-[300px] sm:h-[400px]",children:r.jsx("div",{className:"space-y-3",children:T.map((U,I)=>r.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:U.model_name}),r.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${I%5+1}))`}})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),r.jsx("span",{className:"ml-1 font-medium",children:U.request_count.toLocaleString()})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"花费:"}),r.jsxs("span",{className:"ml-1 font-medium",children:["¥",U.total_cost.toFixed(2)]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),r.jsxs("span",{className:"ml-1 font-medium",children:[(U.total_tokens/1e3).toFixed(1),"K"]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),r.jsxs("span",{className:"ml-1 font-medium",children:[U.avg_response_time.toFixed(2),"s"]})]})]})]},I))})})})]})]})}),r.jsx(cn,{value:"activity",children:r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"最近活动"}),r.jsx(Qn,{children:"最新的API调用记录"})]}),r.jsx(Gt,{children:r.jsx(an,{className:"h-[400px] sm:h-[500px]",children:r.jsx("div",{className:"space-y-2",children:R.map((U,I)=>r.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium text-sm truncate",children:U.model}),r.jsx("div",{className:"text-xs text-muted-foreground",children:U.request_type})]}),r.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:O(U.timestamp)})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),r.jsx("span",{className:"ml-1",children:U.tokens})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"花费:"}),r.jsxs("span",{className:"ml-1",children:["¥",U.cost.toFixed(4)]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),r.jsxs("span",{className:"ml-1",children:[U.time_cost.toFixed(2),"s"]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"状态:"}),r.jsx("span",{className:`ml-1 ${U.status==="success"?"text-green-600":"text-red-600"}`,children:U.status})]})]})]},I))})})})]})}),r.jsx(cn,{value:"daily",children:r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"每日统计"}),r.jsx(Qn,{children:"最近7天的数据汇总"})]}),r.jsx(Gt,{children:r.jsx(So,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:r.jsxs(vp,{data:A,children:[r.jsx(y0,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),r.jsx(b0,{dataKey:"timestamp",tickFormatter:U=>{const I=new Date(U);return`${I.getMonth()+1}/${I.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Wc,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Wc,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),r.jsx(Zc,{content:r.jsx(ko,{labelFormatter:U=>new Date(U).toLocaleDateString("zh-CN")})}),r.jsx(HM,{content:r.jsx(Lw,{})}),r.jsx(w0,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),r.jsx(w0,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),r.jsxs(ct,{className:"border-2 border-primary/20",children:[r.jsx(Lt,{className:"pb-3",children:r.jsx(Bt,{className:"text-lg",children:"每日一言"})}),r.jsx(Gt,{children:y?r.jsxs("div",{className:"space-y-2",children:[r.jsx(Nb,{className:"h-6 w-3/4"}),r.jsx(Nb,{className:"h-4 w-1/4"})]}):p?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-lg font-medium leading-relaxed italic",children:['"',p.hitokoto,'"']}),r.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["—— ",p.from]})]}):null})]})]})})}const $M={theme:"system",setTheme:()=>null},Bw=w.createContext($M),B1=()=>{const e=w.useContext(Bw);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},VM=(e,t,n)=>{const a=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||a){t(e);return}const l=n.clientX,o=n.clientY,c=Math.hypot(Math.max(l,innerWidth-l),Math.max(o,innerHeight-o));document.startViewTransition(()=>{t(e)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${l}px ${o}px)`,`circle(${c}px at ${l}px ${o}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},Pw=w.createContext(void 0),Fw=()=>{const e=w.useContext(Pw);if(e===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return e};var Lm="Switch",[GM]=Ua(Lm),[YM,WM]=GM(Lm),Iw=w.forwardRef((e,t)=>{const{__scopeSwitch:n,name:a,checked:l,defaultChecked:o,required:c,disabled:d,value:m="on",onCheckedChange:f,form:p,...x}=e,[y,b]=w.useState(null),N=mn(t,A=>b(A)),k=w.useRef(!1),S=y?p||!!y.closest("form"):!0,[T,M]=zl({prop:l,defaultProp:o??!1,onChange:f,caller:Lm});return r.jsxs(YM,{scope:n,checked:T,disabled:d,children:[r.jsx(It.button,{type:"button",role:"switch","aria-checked":T,"aria-required":c,"data-state":$w(T),"data-disabled":d?"":void 0,disabled:d,value:m,...x,ref:N,onClick:Pe(e.onClick,A=>{M(R=>!R),S&&(k.current=A.isPropagationStopped(),k.current||A.stopPropagation())})}),S&&r.jsx(Uw,{control:y,bubbles:!k.current,name:a,value:m,checked:T,required:c,disabled:d,form:p,style:{transform:"translateX(-100%)"}})]})});Iw.displayName=Lm;var qw="SwitchThumb",Hw=w.forwardRef((e,t)=>{const{__scopeSwitch:n,...a}=e,l=WM(qw,n);return r.jsx(It.span,{"data-state":$w(l.checked),"data-disabled":l.disabled?"":void 0,...a,ref:t})});Hw.displayName=qw;var XM="SwitchBubbleInput",Uw=w.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:a=!0,...l},o)=>{const c=w.useRef(null),d=mn(c,o),m=I5(n),f=q5(t);return w.useEffect(()=>{const p=c.current;if(!p)return;const x=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(x,"checked").set;if(m!==n&&b){const N=new Event("click",{bubbles:a});b.call(p,n),p.dispatchEvent(N)}},[m,n,a]),r.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...l,tabIndex:-1,ref:d,style:{...l.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Uw.displayName=XM;function $w(e){return e?"checked":"unchecked"}var Vw=Iw,KM=Hw;const vt=w.forwardRef(({className:e,...t},n)=>r.jsx(Vw,{className:he("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm 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",e),...t,ref:n,children:r.jsx(KM,{className:he("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));vt.displayName=Vw.displayName;const QM=Ko("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Q=w.forwardRef(({className:e,...t},n)=>r.jsx(H5,{ref:n,className:he(QM(),e),...t}));Q.displayName=H5.displayName;const Te=w.forwardRef(({className:e,type:t,...n},a)=>r.jsx("input",{type:t,className:he("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors 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-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:a,...n}));Te.displayName="Input";const ZM=1,JM=1e6;let Ep=0;function eA(){return Ep=(Ep+1)%Number.MAX_SAFE_INTEGER,Ep.toString()}const Mp=new Map,_b=e=>{if(Mp.has(e))return;const t=setTimeout(()=>{Mp.delete(e),cu({type:"REMOVE_TOAST",toastId:e})},JM);Mp.set(e,t)},tA=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,ZM)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?_b(n):e.toasts.forEach(a=>{_b(a.id)}),{...e,toasts:e.toasts.map(a=>a.id===n||n===void 0?{...a,open:!1}:a)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},Y0=[];let W0={toasts:[]};function cu(e){W0=tA(W0,e),Y0.forEach(t=>{t(W0)})}function nA({...e}){const t=eA(),n=l=>cu({type:"UPDATE_TOAST",toast:{...l,id:t}}),a=()=>cu({type:"DISMISS_TOAST",toastId:t});return cu({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:l=>{l||a()}}}),{id:t,dismiss:a,update:n}}function or(){const[e,t]=w.useState(W0);return w.useEffect(()=>(Y0.push(t),()=>{const n=Y0.indexOf(t);n>-1&&Y0.splice(n,1)}),[e]),{...e,toast:nA,dismiss:n=>cu({type:"DISMISS_TOAST",toastId:n})}}const rA=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:e=>e.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:e=>/[A-Z]/.test(e)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:e=>/[a-z]/.test(e)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:e=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(e)}];function aA(e){const t=rA.map(a=>({id:a.id,label:a.label,description:a.description,passed:a.validate(e)}));return{isValid:t.every(a=>a.passed),rules:t}}const P1="0.11.5 Beta",F1="MaiBot Dashboard",sA=`${F1} v${P1}`,lA=(e="v")=>`${e}${P1}`,ir=y1,I1=U5,iA=p1,Gw=w.forwardRef(({className:e,...t},n)=>r.jsx(wm,{ref:n,className:he("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",e),...t}));Gw.displayName=wm.displayName;const Jn=w.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(iA,{children:[r.jsx(Gw,{}),r.jsxs(jm,{ref:a,className:he("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",e),...n,children:[t,r.jsxs(x1,{className:"absolute right-4 top-4 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:[r.jsx(Au,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Jn.displayName=jm.displayName;const er=({className:e,...t})=>r.jsx("div",{className:he("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});er.displayName="DialogHeader";const Er=({className:e,...t})=>r.jsx("div",{className:he("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Er.displayName="DialogFooter";const tr=w.forwardRef(({className:e,...t},n)=>r.jsx(g1,{ref:n,className:he("text-lg font-semibold leading-none tracking-tight",e),...t}));tr.displayName=g1.displayName;const xr=w.forwardRef(({className:e,...t},n)=>r.jsx(v1,{ref:n,className:he("text-sm text-muted-foreground",e),...t}));xr.displayName=v1.displayName;var oA=Symbol("radix.slottable");function cA(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=oA,t}var Yw="AlertDialog",[uA]=Ua(Yw,[$5]),Hs=$5(),Ww=e=>{const{__scopeAlertDialog:t,...n}=e,a=Hs(t);return r.jsx(y1,{...a,...n,modal:!0})};Ww.displayName=Yw;var dA="AlertDialogTrigger",Xw=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...a}=e,l=Hs(n);return r.jsx(U5,{...l,...a,ref:t})});Xw.displayName=dA;var mA="AlertDialogPortal",Kw=e=>{const{__scopeAlertDialog:t,...n}=e,a=Hs(t);return r.jsx(p1,{...a,...n})};Kw.displayName=mA;var hA="AlertDialogOverlay",Qw=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...a}=e,l=Hs(n);return r.jsx(wm,{...l,...a,ref:t})});Qw.displayName=hA;var Do="AlertDialogContent",[fA,pA]=uA(Do),xA=cA("AlertDialogContent"),Zw=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:a,...l}=e,o=Hs(n),c=w.useRef(null),d=mn(t,c),m=w.useRef(null);return r.jsx(eT,{contentName:Do,titleName:Jw,docsSlug:"alert-dialog",children:r.jsx(fA,{scope:n,cancelRef:m,children:r.jsxs(jm,{role:"alertdialog",...o,...l,ref:d,onOpenAutoFocus:Pe(l.onOpenAutoFocus,f=>{f.preventDefault(),m.current?.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[r.jsx(xA,{children:a}),r.jsx(vA,{contentRef:c})]})})})});Zw.displayName=Do;var Jw="AlertDialogTitle",ej=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...a}=e,l=Hs(n);return r.jsx(g1,{...l,...a,ref:t})});ej.displayName=Jw;var tj="AlertDialogDescription",nj=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...a}=e,l=Hs(n);return r.jsx(v1,{...l,...a,ref:t})});nj.displayName=tj;var gA="AlertDialogAction",rj=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...a}=e,l=Hs(n);return r.jsx(x1,{...l,...a,ref:t})});rj.displayName=gA;var aj="AlertDialogCancel",sj=w.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...a}=e,{cancelRef:l}=pA(aj,n),o=Hs(n),c=mn(t,l);return r.jsx(x1,{...o,...a,ref:c})});sj.displayName=aj;var vA=({contentRef:e})=>{const t=`\`${Do}\` requires a description for the component to be accessible for screen reader users. - -You can add a description to the \`${Do}\` by passing a \`${tj}\` 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 \`${Do}\`. 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 w.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},yA=Ww,bA=Xw,wA=Kw,lj=Qw,ij=Zw,oj=rj,cj=sj,uj=ej,dj=nj;const en=yA,Zn=bA,jA=wA,mj=w.forwardRef(({className:e,...t},n)=>r.jsx(lj,{className:he("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",e),...t,ref:n}));mj.displayName=lj.displayName;const Yt=w.forwardRef(({className:e,...t},n)=>r.jsxs(jA,{children:[r.jsx(mj,{}),r.jsx(ij,{ref:n,className:he("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",e),...t})]}));Yt.displayName=ij.displayName;const Wt=({className:e,...t})=>r.jsx("div",{className:he("flex flex-col space-y-2 text-center sm:text-left",e),...t});Wt.displayName="AlertDialogHeader";const Xt=({className:e,...t})=>r.jsx("div",{className:he("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Xt.displayName="AlertDialogFooter";const Kt=w.forwardRef(({className:e,...t},n)=>r.jsx(uj,{ref:n,className:he("text-lg font-semibold",e),...t}));Kt.displayName=uj.displayName;const Qt=w.forwardRef(({className:e,...t},n)=>r.jsx(dj,{ref:n,className:he("text-sm text-muted-foreground",e),...t}));Qt.displayName=dj.displayName;const Zt=w.forwardRef(({className:e,...t},n)=>r.jsx(oj,{ref:n,className:he(gu(),e),...t}));Zt.displayName=oj.displayName;const Jt=w.forwardRef(({className:e,...t},n)=>r.jsx(cj,{ref:n,className:he(gu({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Jt.displayName=cj.displayName;function NA(){return r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),r.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),r.jsxs(kl,{defaultValue:"appearance",className:"w-full",children:[r.jsxs(Bs,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[r.jsxs(Pt,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[r.jsx(s6,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),r.jsx("span",{children:"外观"})]}),r.jsxs(Pt,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[r.jsx(xT,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),r.jsx("span",{children:"安全"})]}),r.jsxs(Pt,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[r.jsx(Pa,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),r.jsx("span",{children:"其他"})]}),r.jsxs(Pt,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[r.jsx(pi,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),r.jsx("span",{children:"关于"})]})]}),r.jsxs(an,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[r.jsx(cn,{value:"appearance",className:"mt-0",children:r.jsx(SA,{})}),r.jsx(cn,{value:"security",className:"mt-0",children:r.jsx(kA,{})}),r.jsx(cn,{value:"other",className:"mt-0",children:r.jsx(CA,{})}),r.jsx(cn,{value:"about",className:"mt-0",children:r.jsx(TA,{})})]})]})]})}function Eb(e){const t=document.documentElement,a={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[e];if(a)t.style.setProperty("--primary",a.hsl),a.gradient?(t.style.setProperty("--primary-gradient",a.gradient),t.classList.add("has-gradient")):(t.style.removeProperty("--primary-gradient"),t.classList.remove("has-gradient"));else if(e.startsWith("#")){const l=o=>{o=o.replace("#","");const c=parseInt(o.substring(0,2),16)/255,d=parseInt(o.substring(2,4),16)/255,m=parseInt(o.substring(4,6),16)/255,f=Math.max(c,d,m),p=Math.min(c,d,m);let x=0,y=0;const b=(f+p)/2;if(f!==p){const N=f-p;switch(y=b>.5?N/(2-f-p):N/(f+p),f){case c:x=((d-m)/N+(dlocalStorage.getItem("accent-color")||"blue");w.useEffect(()=>{const f=localStorage.getItem("accent-color")||"blue";Eb(f)},[]);const m=f=>{d(f),localStorage.setItem("accent-color",f),Eb(f)};return r.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[r.jsx(Ap,{value:"light",current:e,onChange:t,label:"浅色",description:"始终使用浅色主题"}),r.jsx(Ap,{value:"dark",current:e,onChange:t,label:"深色",description:"始终使用深色主题"}),r.jsx(Ap,{value:"system",current:e,onChange:t,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),r.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),r.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[r.jsx(Sa,{value:"blue",current:c,onChange:m,label:"蓝色",colorClass:"bg-blue-500"}),r.jsx(Sa,{value:"purple",current:c,onChange:m,label:"紫色",colorClass:"bg-purple-500"}),r.jsx(Sa,{value:"green",current:c,onChange:m,label:"绿色",colorClass:"bg-green-500"}),r.jsx(Sa,{value:"orange",current:c,onChange:m,label:"橙色",colorClass:"bg-orange-500"}),r.jsx(Sa,{value:"pink",current:c,onChange:m,label:"粉色",colorClass:"bg-pink-500"}),r.jsx(Sa,{value:"red",current:c,onChange:m,label:"红色",colorClass:"bg-red-500"})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),r.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[r.jsx(Sa,{value:"gradient-sunset",current:c,onChange:m,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),r.jsx(Sa,{value:"gradient-ocean",current:c,onChange:m,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),r.jsx(Sa,{value:"gradient-forest",current:c,onChange:m,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),r.jsx(Sa,{value:"gradient-aurora",current:c,onChange:m,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),r.jsx(Sa,{value:"gradient-fire",current:c,onChange:m,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),r.jsx(Sa,{value:"gradient-twilight",current:c,onChange:m,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[r.jsx("div",{className:"flex-1",children:r.jsx("input",{type:"color",value:c.startsWith("#")?c:"#3b82f6",onChange:f=>m(f.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),r.jsx("div",{className:"flex-1",children:r.jsx(Te,{type:"text",value:c,onChange:f=>m(f.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),r.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),r.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[r.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5 flex-1",children:[r.jsx(Q,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),r.jsx(vt,{id:"animations",checked:n,onCheckedChange:a})]})}),r.jsx("div",{className:"rounded-lg border bg-card p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5 flex-1",children:[r.jsx(Q,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),r.jsx(vt,{id:"waves-background",checked:l,onCheckedChange:o})]})})]})]})]})}function kA(){const e=as(),[t,n]=w.useState(""),[a,l]=w.useState(""),[o,c]=w.useState(!1),[d,m]=w.useState(!1),[f,p]=w.useState(!1),[x,y]=w.useState(!1),[b,N]=w.useState(!1),[k,S]=w.useState(!1),[T,M]=w.useState(""),[A,R]=w.useState(!1),{toast:B}=or(),O=w.useMemo(()=>aA(a),[a]),L=()=>localStorage.getItem("access-token")||"",$=async J=>{try{await navigator.clipboard.writeText(J),N(!0),B({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>N(!1),2e3)}catch{B({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},U=async()=>{if(!a.trim()){B({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!O.isValid){const J=O.rules.filter(se=>!se.passed).map(se=>se.label).join(", ");B({title:"格式错误",description:`Token 不符合要求: ${J}`,variant:"destructive"});return}p(!0);try{const J=L(),se=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${J}`},body:JSON.stringify({new_token:a.trim()})}),H=await se.json();se.ok&&H.success?(localStorage.setItem("access-token",a.trim()),l(""),t&&n(a.trim()),B({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),e({to:"/auth"})},1500)):B({title:"更新失败",description:H.message||"无法更新 Token",variant:"destructive"})}catch(J){console.error("更新 Token 错误:",J),B({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{p(!1)}},I=async()=>{y(!0);try{const J=L(),se=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${J}`}}),H=await se.json();se.ok&&H.success?(localStorage.setItem("access-token",H.token),n(H.token),M(H.token),S(!0),R(!1),B({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):B({title:"生成失败",description:H.message||"无法生成新 Token",variant:"destructive"})}catch(J){console.error("生成 Token 错误:",J),B({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{y(!1)}},G=async()=>{try{await navigator.clipboard.writeText(T),R(!0),B({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{B({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},ee=()=>{S(!1),setTimeout(()=>{M(""),R(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),e({to:"/auth"})},500)},Ne=J=>{J||ee()};return r.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[r.jsx(ir,{open:k,onOpenChange:Ne,children:r.jsxs(Jn,{className:"sm:max-w-md",children:[r.jsxs(er,{children:[r.jsxs(tr,{className:"flex items-center gap-2",children:[r.jsx(Ao,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),r.jsx(xr,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[r.jsx(Q,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),r.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:T})]}),r.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Ao,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[r.jsx("p",{className:"font-semibold",children:"重要提示"}),r.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[r.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),r.jsx("li",{children:"请立即复制并保存到安全的位置"}),r.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),r.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),r.jsxs(Er,{className:"gap-2 sm:gap-0",children:[r.jsx(ne,{variant:"outline",onClick:G,className:"gap-2",children:A?r.jsxs(r.Fragment,{children:[r.jsx(mi,{className:"h-4 w-4 text-green-500"}),"已复制"]}):r.jsxs(r.Fragment,{children:[r.jsx(vx,{className:"h-4 w-4"}),"复制 Token"]})}),r.jsx(ne,{onClick:ee,children:"我已保存,关闭"})]})]})}),r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),r.jsx("div",{className:"space-y-3 sm:space-y-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Te,{id:"current-token",type:o?"text":"password",value:t||L(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),r.jsx("button",{onClick:()=>{t||n(L()),c(!o)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:o?"隐藏":"显示",children:o?r.jsx(yx,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(Ha,{className:"h-4 w-4 text-muted-foreground"})})]}),r.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[r.jsx(ne,{variant:"outline",size:"icon",onClick:()=>$(L()),title:"复制到剪贴板",className:"flex-shrink-0",children:b?r.jsx(mi,{className:"h-4 w-4 text-green-500"}):r.jsx(vx,{className:"h-4 w-4"})}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsxs(ne,{variant:"outline",disabled:x,className:"gap-2 flex-1 sm:flex-none",children:[r.jsx(Ia,{className:he("h-4 w-4",x&&"animate-spin")}),r.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),r.jsx("span",{className:"sm:hidden",children:"生成"})]})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认重新生成 Token"}),r.jsx(Qt,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:I,children:"确认生成"})]})]})]})]})]}),r.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),r.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),r.jsxs("div",{className:"relative",children:[r.jsx(Te,{id:"new-token",type:d?"text":"password",value:a,onChange:J=>l(J.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),r.jsx("button",{onClick:()=>m(!d),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:d?"隐藏":"显示",children:d?r.jsx(yx,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(Ha,{className:"h-4 w-4 text-muted-foreground"})})]}),a&&r.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),r.jsx("div",{className:"space-y-1.5",children:O.rules.map(J=>r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[J.passed?r.jsx($r,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):r.jsx(bx,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx("span",{className:he(J.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:J.label})]},J.id))}),O.isValid&&r.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:r.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[r.jsx(mi,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),r.jsx(ne,{onClick:U,disabled:f||!O.isValid||!a,className:"w-full sm:w-auto",children:f?"更新中...":"更新自定义 Token"})]})]}),r.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[r.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),r.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[r.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),r.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),r.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),r.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),r.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),r.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function CA(){const e=as(),{toast:t}=or(),[n,a]=w.useState(!1),l=async()=>{a(!0);try{const o=localStorage.getItem("access-token"),c=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${o}`}}),d=await c.json();c.ok&&d.success?(t({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{e({to:"/setup"})},1e3)):t({title:"重置失败",description:d.message||"无法重置配置状态",variant:"destructive"})}catch(o){console.error("重置配置状态错误:",o),t({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{a(!1)}};return r.jsx("div",{className:"space-y-4 sm:space-y-6",children:r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),r.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[r.jsx("div",{className:"space-y-2",children:r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsxs(ne,{variant:"outline",disabled:n,className:"gap-2",children:[r.jsx(gT,{className:he("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认重新配置"}),r.jsx(Qt,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:l,children:"确认重置"})]})]})]})]})]})})}function TA(){return r.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",F1]}),r.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[r.jsxs("p",{children:["版本: ",P1]}),r.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),r.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",r.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),r.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[r.jsx("li",{children:"React 19.2.0"}),r.jsx("li",{children:"TypeScript 5.7.2"}),r.jsx("li",{children:"Vite 6.0.7"}),r.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),r.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[r.jsx("li",{children:"shadcn/ui"}),r.jsx("li",{children:"Radix UI"}),r.jsx("li",{children:"Tailwind CSS 3.4.17"}),r.jsx("li",{children:"Lucide Icons"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("p",{className:"font-medium text-foreground",children:"后端"}),r.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[r.jsx("li",{children:"Python 3.12+"}),r.jsx("li",{children:"FastAPI"}),r.jsx("li",{children:"Uvicorn"}),r.jsx("li",{children:"WebSocket"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),r.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[r.jsx("li",{children:"Bun / npm"}),r.jsx("li",{children:"ESLint 9.17.0"}),r.jsx("li",{children:"PostCSS"})]})]})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),r.jsx(an,{className:"h-[300px] sm:h-[400px]",children:r.jsxs("div",{className:"space-y-4 pr-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(Tn,{name:"React",description:"用户界面构建库",license:"MIT"}),r.jsx(Tn,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),r.jsx(Tn,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),r.jsx(Tn,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),r.jsx(Tn,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(Tn,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),r.jsx(Tn,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(Tn,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),r.jsx(Tn,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(Tn,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),r.jsx(Tn,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),r.jsx(Tn,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),r.jsx(Tn,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(Tn,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),r.jsx(Tn,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(Tn,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),r.jsx(Tn,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),r.jsx(Tn,{name:"Pydantic",description:"数据验证库",license:"MIT"}),r.jsx(Tn,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),r.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[r.jsx(Tn,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),r.jsx(Tn,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),r.jsx(Tn,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),r.jsx(Tn,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[r.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:r.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[r.jsx("div",{className:"flex-shrink-0 mt-0.5",children:r.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:r.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Tn({name:e,description:t,license:n}){return r.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-foreground truncate",children:e}),r.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:t})]}),r.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:n})]})}function Ap({value:e,current:t,onChange:n,label:a,description:l}){const o=t===e;return r.jsxs("button",{onClick:()=>n(e),className:he("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",o?"border-primary bg-accent":"border-border"),children:[o&&r.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-sm sm:text-base font-medium",children:a}),r.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:l})]}),r.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[e==="light"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),r.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),r.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),e==="dark"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),r.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),r.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),e==="system"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),r.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),r.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function Sa({value:e,current:t,onChange:n,label:a,colorClass:l}){const o=t===e;return r.jsxs("button",{onClick:()=>n(e),className:he("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",o?"border-primary bg-accent":"border-border"),children:[o&&r.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),r.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[r.jsx("div",{className:he("h-8 w-8 sm:h-10 sm:w-10 rounded-full",l)}),r.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:a})]})]})}class _A{grad3;p;perm;constructor(t=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let n=0;n<256;n++)this.p[n]=Math.floor(Math.random()*256);this.perm=[];for(let n=0;n<512;n++)this.perm[n]=this.p[n&255]}dot(t,n,a){return t[0]*n+t[1]*a}mix(t,n,a){return(1-a)*t+a*n}fade(t){return t*t*t*(t*(t*6-15)+10)}perlin2(t,n){const a=Math.floor(t)&255,l=Math.floor(n)&255;t-=Math.floor(t),n-=Math.floor(n);const o=this.fade(t),c=this.fade(n),d=this.perm[a]+l,m=this.perm[d],f=this.perm[d+1],p=this.perm[a+1]+l,x=this.perm[p],y=this.perm[p+1];return this.mix(this.mix(this.dot(this.grad3[m%12],t,n),this.dot(this.grad3[x%12],t-1,n),o),this.mix(this.dot(this.grad3[f%12],t,n-1),this.dot(this.grad3[y%12],t-1,n-1),o),c)}}function EA(){const e=w.useRef(null),t=w.useRef(null),n=w.useRef(void 0),a=w.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new _A(Math.random()),bounding:null});return w.useEffect(()=>{const l=t.current,o=e.current;if(!l||!o)return;const c=a.current,d=()=>{const k=l.getBoundingClientRect();c.bounding=k,o.style.width=`${k.width}px`,o.style.height=`${k.height}px`},m=()=>{if(!c.bounding)return;const{width:k,height:S}=c.bounding;c.lines=[],c.paths.forEach(U=>U.remove()),c.paths=[];const T=10,M=32,A=k+200,R=S+30,B=Math.ceil(A/T),O=Math.ceil(R/M),L=(k-T*B)/2,$=(S-M*O)/2;for(let U=0;U<=B;U++){const I=[];for(let ee=0;ee<=O;ee++){const Ne={x:L+T*U,y:$+M*ee,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};I.push(Ne)}const G=document.createElementNS("http://www.w3.org/2000/svg","path");o.appendChild(G),c.paths.push(G),c.lines.push(I)}},f=k=>{const{lines:S,mouse:T,noise:M}=c;S.forEach(A=>{A.forEach(R=>{const B=M.perlin2((R.x+k*.0125)*.002,(R.y+k*.005)*.0015)*12;R.wave.x=Math.cos(B)*32,R.wave.y=Math.sin(B)*16;const O=R.x-T.sx,L=R.y-T.sy,$=Math.hypot(O,L),U=Math.max(175,T.vs);if(${const T={x:k.x+k.wave.x+(S?k.cursor.x:0),y:k.y+k.wave.y+(S?k.cursor.y:0)};return T.x=Math.round(T.x*10)/10,T.y=Math.round(T.y*10)/10,T},x=()=>{const{lines:k,paths:S}=c;k.forEach((T,M)=>{let A=p(T[0],!1),R=`M ${A.x} ${A.y}`;T.forEach((B,O)=>{const L=O===T.length-1;A=p(B,!L),R+=`L ${A.x} ${A.y}`}),S[M].setAttribute("d",R)})},y=k=>{const{mouse:S}=c;S.sx+=(S.x-S.sx)*.1,S.sy+=(S.y-S.sy)*.1;const T=S.x-S.lx,M=S.y-S.ly,A=Math.hypot(T,M);S.v=A,S.vs+=(A-S.vs)*.1,S.vs=Math.min(100,S.vs),S.lx=S.x,S.ly=S.y,S.a=Math.atan2(M,T),l&&(l.style.setProperty("--x",`${S.sx}px`),l.style.setProperty("--y",`${S.sy}px`)),f(k),x(),n.current=requestAnimationFrame(y)},b=k=>{if(!c.bounding)return;const{mouse:S}=c;S.x=k.pageX-c.bounding.left,S.y=k.pageY-c.bounding.top+window.scrollY,S.set||(S.sx=S.x,S.sy=S.y,S.lx=S.x,S.ly=S.y,S.set=!0)},N=()=>{d(),m()};return d(),m(),window.addEventListener("resize",N),window.addEventListener("mousemove",b),n.current=requestAnimationFrame(y),()=>{window.removeEventListener("resize",N),window.removeEventListener("mousemove",b),n.current&&cancelAnimationFrame(n.current)}},[]),r.jsxs("div",{ref:t,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[r.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),r.jsx("svg",{ref:e,style:{display:"block",width:"100%",height:"100%"},children:r.jsx("style",{children:` - path { - fill: none; - stroke: hsl(var(--primary) / 0.20); - stroke-width: 1px; - } - `})})]})}function MA(){const e=as();w.useEffect(()=>{localStorage.getItem("access-token")||e({to:"/auth"})},[e])}function hj(){return!!localStorage.getItem("access-token")}function AA(){const[e,t]=w.useState(""),[n,a]=w.useState(!1),[l,o]=w.useState(""),c=as(),{enableWavesBackground:d,setEnableWavesBackground:m}=Fw(),{theme:f,setTheme:p}=B1();w.useEffect(()=>{hj()&&c({to:"/"})},[c]);const y=f==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":f,b=()=>{p(y==="dark"?"light":"dark")},N=async k=>{if(k.preventDefault(),o(""),!e.trim()){o("请输入 Access Token");return}a(!0);try{const S=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e.trim()})}),T=await S.json();if(S.ok&&T.valid){localStorage.setItem("access-token",e.trim());const M=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${e.trim()}`}}),A=await M.json();M.ok&&A.is_first_setup?c({to:"/setup"}):c({to:"/"})}else o(T.message||"Token 验证失败,请检查后重试")}catch(S){console.error("Token 验证错误:",S),o("连接服务器失败,请检查网络连接")}finally{a(!1)}};return r.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[d&&r.jsx(EA,{}),r.jsxs(ct,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[r.jsx("button",{onClick:b,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:y==="dark"?"切换到浅色模式":"切换到深色模式",children:y==="dark"?r.jsx(wx,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):r.jsx(jx,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),r.jsxs(Lt,{className:"space-y-4 text-center",children:[r.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:r.jsx($y,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Bt,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),r.jsx(Qn,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),r.jsx(Gt,{children:r.jsxs("form",{onSubmit:N,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),r.jsxs("div",{className:"relative",children:[r.jsx(vT,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),r.jsx(Te,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:e,onChange:k=>t(k.target.value),className:he("pl-10",l&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),l&&r.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[r.jsx(xi,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),r.jsx("span",{children:l})]}),r.jsx(ne,{type:"submit",className:"w-full",disabled:n,children:n?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),r.jsxs(ir,{children:[r.jsx(I1,{asChild:!0,children:r.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[r.jsx(yT,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),r.jsxs(Jn,{className:"sm:max-w-md",children:[r.jsxs(er,{children:[r.jsxs(tr,{className:"flex items-center gap-2",children:[r.jsx($y,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),r.jsx(xr,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(bT,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),r.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[r.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),r.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),r.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Nl,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),r.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:r.jsx("code",{className:"text-primary",children:"data/webui.json"})}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",r.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),r.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(xi,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),r.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[r.jsx("p",{className:"font-semibold",children:"安全提示"}),r.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[r.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),r.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[r.jsx(fu,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsxs(Kt,{className:"flex items-center gap-2",children:[r.jsx(fu,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),r.jsx(Qt,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),r.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>m(!1),children:"关闭动画"})]})]})]})]})})]}),r.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:r.jsx("p",{children:sA})})]})}const fn=w.forwardRef(({className:e,...t},n)=>r.jsx("textarea",{className:he("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));fn.displayName="Textarea";var DA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],zA=DA.reduce((e,t)=>{const n=f1(`Primitive.${t}`),a=w.forwardRef((l,o)=>{const{asChild:c,...d}=l,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(m,{...d,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),OA="Separator",Mb="horizontal",RA=["horizontal","vertical"],fj=w.forwardRef((e,t)=>{const{decorative:n,orientation:a=Mb,...l}=e,o=LA(a)?a:Mb,d=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return r.jsx(zA.div,{"data-orientation":o,...d,...l,ref:t})});fj.displayName=OA;function LA(e){return RA.includes(e)}var pj=fj;const vu=w.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...a},l)=>r.jsx(pj,{ref:l,decorative:n,orientation:t,className:he("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...a}));vu.displayName=pj.displayName;const BA=Ko("inline-flex items-center rounded-md 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 shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function un({className:e,variant:t,...n}){return r.jsx("div",{className:he(BA({variant:t}),e),...n})}function PA({config:e,onChange:t}){const n=l=>{l.trim()&&!e.alias_names.includes(l.trim())&&t({...e,alias_names:[...e.alias_names,l.trim()]})},a=l=>{t({...e,alias_names:e.alias_names.filter((o,c)=>c!==l)})};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"qq_account",children:"QQ账号 *"}),r.jsx(Te,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:e.qq_account||"",onChange:l=>t({...e,qq_account:Number(l.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"nickname",children:"昵称 *"}),r.jsx(Te,{id:"nickname",placeholder:"请输入机器人的昵称",value:e.nickname,onChange:l=>t({...e,nickname:l.target.value})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{children:"别名"}),r.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:e.alias_names.map((l,o)=>r.jsxs(un,{variant:"secondary",className:"gap-1",children:[l,r.jsx("button",{type:"button",onClick:()=>a(o),className:"ml-1 hover:text-destructive",children:r.jsx(Au,{className:"h-3 w-3"})})]},o))}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:l=>{l.key==="Enter"&&(n(l.target.value),l.target.value="")}}),r.jsx(ne,{type:"button",variant:"outline",onClick:()=>{const l=document.getElementById("alias_input");l&&(n(l.value),l.value="")},children:"添加"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function FA({config:e,onChange:t}){return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"personality",children:"人格特征 *"}),r.jsx(fn,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:e.personality,onChange:n=>t({...e,personality:n.target.value}),rows:3}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"reply_style",children:"表达风格 *"}),r.jsx(fn,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:e.reply_style,onChange:n=>t({...e,reply_style:n.target.value}),rows:3}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"interest",children:"兴趣 *"}),r.jsx(fn,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:e.interest,onChange:n=>t({...e,interest:n.target.value}),rows:2}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),r.jsx(vu,{}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"plan_style",children:"群聊说话规则 *"}),r.jsx(fn,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:e.plan_style,onChange:n=>t({...e,plan_style:n.target.value}),rows:4}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),r.jsx(fn,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:e.private_plan_style,onChange:n=>t({...e,private_plan_style:n.target.value}),rows:3}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function IA({config:e,onChange:t}){return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{htmlFor:"emoji_chance",children:"表情包激活概率"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[(e.emoji_chance*100).toFixed(0),"%"]})]}),r.jsx(Te,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:e.emoji_chance,onChange:n=>t({...e,emoji_chance:Number(n.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"max_reg_num",children:"最大表情包数量"}),r.jsx(Te,{id:"max_reg_num",type:"number",min:"1",max:"200",value:e.max_reg_num,onChange:n=>t({...e,max_reg_num:Number(n.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Q,{htmlFor:"do_replace",children:"达到最大数量时替换"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),r.jsx(vt,{id:"do_replace",checked:e.do_replace,onCheckedChange:n=>t({...e,do_replace:n})})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),r.jsx(Te,{id:"check_interval",type:"number",min:"1",max:"120",value:e.check_interval,onChange:n=>t({...e,check_interval:Number(n.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),r.jsx(vu,{}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Q,{htmlFor:"steal_emoji",children:"偷取表情包"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),r.jsx(vt,{id:"steal_emoji",checked:e.steal_emoji,onCheckedChange:n=>t({...e,steal_emoji:n})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Q,{htmlFor:"content_filtration",children:"启用表情包过滤"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),r.jsx(vt,{id:"content_filtration",checked:e.content_filtration,onCheckedChange:n=>t({...e,content_filtration:n})})]}),e.content_filtration&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"filtration_prompt",children:"过滤要求"}),r.jsx(Te,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:e.filtration_prompt,onChange:n=>t({...e,filtration_prompt:n.target.value})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function qA({config:e,onChange:t}){return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Q,{htmlFor:"enable_tool",children:"启用工具系统"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),r.jsx(vt,{id:"enable_tool",checked:e.enable_tool,onCheckedChange:n=>t({...e,enable_tool:n})})]}),r.jsx(vu,{}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Q,{htmlFor:"enable_mood",children:"启用情绪系统"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),r.jsx(vt,{id:"enable_mood",checked:e.enable_mood,onCheckedChange:n=>t({...e,enable_mood:n})})]}),e.enable_mood&&r.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),r.jsx(Te,{id:"mood_update_threshold",type:"number",min:"0.1",max:"10",step:"0.1",value:e.mood_update_threshold||1,onChange:n=>t({...e,mood_update_threshold:Number(n.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Q,{htmlFor:"emotion_style",children:"情感特征"}),r.jsx(fn,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:e.emotion_style||"",onChange:n=>t({...e,emotion_style:n.target.value}),rows:2}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),r.jsx(vu,{}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Q,{htmlFor:"all_global",children:"启用全局黑话模式"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),r.jsx(vt,{id:"all_global",checked:e.all_global,onCheckedChange:n=>t({...e,all_global:n})})]})]})}async function lt(e,t){const n=await fetch(e,t);if(n.status===401)throw localStorage.removeItem("access-token"),window.location.href="/auth",new Error("认证失败,请重新登录");return n}function pt(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function HA(){const e=await lt("/api/webui/config/bot",{method:"GET",headers:pt()});if(!e.ok)throw new Error("读取Bot配置失败");const n=(await e.json()).config.bot||{};return{qq_account:n.qq_account||0,nickname:n.nickname||"",alias_names:n.alias_names||[]}}async function UA(){const e=await lt("/api/webui/config/bot",{method:"GET",headers:pt()});if(!e.ok)throw new Error("读取人格配置失败");const n=(await e.json()).config.personality||{};return{personality:n.personality||"",reply_style:n.reply_style||"",interest:n.interest||"",plan_style:n.plan_style||"",private_plan_style:n.private_plan_style||""}}async function $A(){const e=await lt("/api/webui/config/bot",{method:"GET",headers:pt()});if(!e.ok)throw new Error("读取表情包配置失败");const n=(await e.json()).config.emoji||{};return{emoji_chance:n.emoji_chance??.4,max_reg_num:n.max_reg_num??40,do_replace:n.do_replace??!0,check_interval:n.check_interval??10,steal_emoji:n.steal_emoji??!0,content_filtration:n.content_filtration??!1,filtration_prompt:n.filtration_prompt||""}}async function VA(){const e=await lt("/api/webui/config/bot",{method:"GET",headers:pt()});if(!e.ok)throw new Error("读取其他配置失败");const n=(await e.json()).config,a=n.tool||{},l=n.mood||{},o=n.jargon||{};return{enable_tool:a.enable_tool??!0,enable_mood:l.enable_mood??!1,mood_update_threshold:l.mood_update_threshold,emotion_style:l.emotion_style,all_global:o.all_global??!0}}async function GA(e){const t=await lt("/api/webui/config/bot/section/bot",{method:"POST",headers:pt(),body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await t.json()}async function YA(e){const t=await lt("/api/webui/config/bot/section/personality",{method:"POST",headers:pt(),body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.detail||"保存人格配置失败")}return await t.json()}async function WA(e){const t=await lt("/api/webui/config/bot/section/emoji",{method:"POST",headers:pt(),body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.detail||"保存表情包配置失败")}return await t.json()}async function XA(e){const t=[];t.push(lt("/api/webui/config/bot/section/tool",{method:"POST",headers:pt(),body:JSON.stringify({enable_tool:e.enable_tool})})),t.push(lt("/api/webui/config/bot/section/jargon",{method:"POST",headers:pt(),body:JSON.stringify({all_global:e.all_global})}));const n={enable_mood:e.enable_mood};e.enable_mood&&(n.mood_update_threshold=e.mood_update_threshold||1,n.emotion_style=e.emotion_style||""),t.push(lt("/api/webui/config/bot/section/mood",{method:"POST",headers:pt(),body:JSON.stringify(n)}));const a=await Promise.all(t);for(const l of a)if(!l.ok){const o=await l.json();throw new Error(o.detail||"保存其他配置失败")}return{success:!0}}async function Ab(){const e=localStorage.getItem("access-token"),t=await lt("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${e}`}});if(!t.ok){const n=await t.json();throw new Error(n.message||"标记配置完成失败")}return await t.json()}function KA(){const e=as(),{toast:t}=or(),[n,a]=w.useState(0),[l,o]=w.useState(!1),[c,d]=w.useState(!1),[m,f]=w.useState(!0),[p,x]=w.useState({qq_account:0,nickname:"",alias_names:[]}),[y,b]=w.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 -2.如果相同的内容已经被执行,请不要重复执行 -3.请控制你的发言频率,不要太过频繁的发言 -4.如果有人对你感到厌烦,请减少回复 -5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 -2.如果相同的内容已经被执行,请不要重复执行 -3.某句话如果已经被回复过,不要重复回复`}),[N,k]=w.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[S,T]=w.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遭遇特定事件的时候起伏较大",all_global:!0}),M=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:jT},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:l6},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:N1},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:Pa},{id:"complete",title:"完成设置",description:"后续配置提示",icon:fu}],A=(n+1)/M.length*100;w.useEffect(()=>{(async()=>{try{f(!0);const[G,ee,Ne,J]=await Promise.all([HA(),UA(),$A(),VA()]);x(G),b(ee),k(Ne),T(J)}catch(G){t({title:"加载配置失败",description:G instanceof Error?G.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{f(!1)}})()},[t]);const R=async()=>{d(!0);try{switch(n){case 0:await GA(p);break;case 1:await YA(y);break;case 2:await WA(N);break;case 3:await XA(S);break}return t({title:"保存成功",description:`${M[n].title}配置已保存`}),!0}catch(I){return t({title:"保存失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"}),!1}finally{d(!1)}},B=async()=>{await R()&&n{n>0&&a(n-1)},L=async()=>{o(!0);try{if(!await R()){o(!1);return}await Ab(),t({title:"配置完成",description:"所有配置已保存,正在跳转..."}),setTimeout(()=>{e({to:"/"})},500)}catch(I){t({title:"完成失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"})}finally{o(!1)}},$=async()=>{try{await Ab(),e({to:"/"})}catch(I){t({title:"跳过失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"})}},U=()=>{switch(n){case 0:return r.jsx(PA,{config:p,onChange:x});case 1:return r.jsx(FA,{config:y,onChange:b});case 2:return r.jsx(IA,{config:N,onChange:k});case 3:return r.jsx(qA,{config:S,onChange:T});case 4:return r.jsxs("div",{className:"space-y-6 text-center py-8",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(fu,{className:"h-8 w-8 text-primary",strokeWidth:2})}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"text-xl font-semibold",children:"模型配置"}),r.jsx("p",{className:"text-muted-foreground max-w-md mx-auto",children:"为了让机器人正常工作,您需要配置 AI 模型提供商和模型。"})]}),r.jsxs("div",{className:"rounded-lg border bg-muted/50 p-6 max-w-md mx-auto text-left space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"mt-0.5",children:r.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"1"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"配置 API 提供商"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → API 提供商"中添加您的 API 提供商信息'})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"mt-0.5",children:r.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"2"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"添加模型"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型列表"中添加需要使用的模型'})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"mt-0.5",children:r.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"3"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"配置模型任务"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型任务配置"中为不同任务分配模型'})]})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"💡 提示:完成向导后,您可以在系统设置中进行详细的模型配置"})]});default:return null}};return r.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),r.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),m?r.jsxs("div",{className:"relative z-10 text-center",children:[r.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:r.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),r.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[r.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[r.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:r.jsx(wT,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),r.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),r.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",F1," 的初始配置"]})]}),r.jsxs("div",{className:"mb-6 md:mb-8",children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[r.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",M.length]}),r.jsxs("span",{className:"font-medium text-primary",children:[Math.round(A),"%"]})]}),r.jsx(Fu,{value:A,className:"h-2"})]}),r.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:M.map((I,G)=>{const ee=I.icon;return r.jsxs("div",{className:he("flex flex-1 flex-col items-center gap-1 md:gap-2",Ge({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[r.jsx(J0,{className:"h-4 w-4"}),"返回首页"]}),r.jsxs(ne,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[r.jsx(i6,{className:"h-4 w-4"}),"返回上一页"]})]}),r.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var gj=["PageUp","PageDown"],vj=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],yj={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Qo="Slider",[Dx,QA,ZA]=bm(Qo),[bj]=Ua(Qo,[ZA]),[JA,Bm]=bj(Qo),wj=w.forwardRef((e,t)=>{const{name:n,min:a=0,max:l=100,step:o=1,orientation:c="horizontal",disabled:d=!1,minStepsBetweenThumbs:m=0,defaultValue:f=[a],value:p,onValueChange:x=()=>{},onValueCommit:y=()=>{},inverted:b=!1,form:N,...k}=e,S=w.useRef(new Set),T=w.useRef(0),A=c==="horizontal"?eD:tD,[R=[],B]=zl({prop:p,defaultProp:f,onChange:G=>{[...S.current][T.current]?.focus(),x(G)}}),O=w.useRef(R);function L(G){const ee=lD(R,G);I(G,ee)}function $(G){I(G,T.current)}function U(){const G=O.current[T.current];R[T.current]!==G&&y(R)}function I(G,ee,{commit:Ne}={commit:!1}){const J=uD(o),se=dD(Math.round((G-a)/o)*o+a,J),H=h1(se,[a,l]);B((le=[])=>{const re=aD(le,H,ee);if(cD(re,m*o)){T.current=re.indexOf(H);const ge=String(re)!==String(le);return ge&&Ne&&y(re),ge?re:le}else return le})}return r.jsx(JA,{scope:e.__scopeSlider,name:n,disabled:d,min:a,max:l,valueIndexToChangeRef:T,thumbs:S.current,values:R,orientation:c,form:N,children:r.jsx(Dx.Provider,{scope:e.__scopeSlider,children:r.jsx(Dx.Slot,{scope:e.__scopeSlider,children:r.jsx(A,{"aria-disabled":d,"data-disabled":d?"":void 0,...k,ref:t,onPointerDown:Pe(k.onPointerDown,()=>{d||(O.current=R)}),min:a,max:l,inverted:b,onSlideStart:d?void 0:L,onSlideMove:d?void 0:$,onSlideEnd:d?void 0:U,onHomeKeyDown:()=>!d&&I(a,0,{commit:!0}),onEndKeyDown:()=>!d&&I(l,R.length-1,{commit:!0}),onStepKeyDown:({event:G,direction:ee})=>{if(!d){const se=gj.includes(G.key)||G.shiftKey&&vj.includes(G.key)?10:1,H=T.current,le=R[H],re=o*se*ee;I(le+re,H,{commit:!0})}}})})})})});wj.displayName=Qo;var[jj,Nj]=bj(Qo,{startEdge:"left",endEdge:"right",size:"width",direction:1}),eD=w.forwardRef((e,t)=>{const{min:n,max:a,dir:l,inverted:o,onSlideStart:c,onSlideMove:d,onSlideEnd:m,onStepKeyDown:f,...p}=e,[x,y]=w.useState(null),b=mn(t,A=>y(A)),N=w.useRef(void 0),k=Eu(l),S=k==="ltr",T=S&&!o||!S&&o;function M(A){const R=N.current||x.getBoundingClientRect(),B=[0,R.width],L=q1(B,T?[n,a]:[a,n]);return N.current=R,L(A-R.left)}return r.jsx(jj,{scope:e.__scopeSlider,startEdge:T?"left":"right",endEdge:T?"right":"left",direction:T?1:-1,size:"width",children:r.jsx(Sj,{dir:k,"data-orientation":"horizontal",...p,ref:b,style:{...p.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:A=>{const R=M(A.clientX);c?.(R)},onSlideMove:A=>{const R=M(A.clientX);d?.(R)},onSlideEnd:()=>{N.current=void 0,m?.()},onStepKeyDown:A=>{const B=yj[T?"from-left":"from-right"].includes(A.key);f?.({event:A,direction:B?-1:1})}})})}),tD=w.forwardRef((e,t)=>{const{min:n,max:a,inverted:l,onSlideStart:o,onSlideMove:c,onSlideEnd:d,onStepKeyDown:m,...f}=e,p=w.useRef(null),x=mn(t,p),y=w.useRef(void 0),b=!l;function N(k){const S=y.current||p.current.getBoundingClientRect(),T=[0,S.height],A=q1(T,b?[a,n]:[n,a]);return y.current=S,A(k-S.top)}return r.jsx(jj,{scope:e.__scopeSlider,startEdge:b?"bottom":"top",endEdge:b?"top":"bottom",size:"height",direction:b?1:-1,children:r.jsx(Sj,{"data-orientation":"vertical",...f,ref:x,style:{...f.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:k=>{const S=N(k.clientY);o?.(S)},onSlideMove:k=>{const S=N(k.clientY);c?.(S)},onSlideEnd:()=>{y.current=void 0,d?.()},onStepKeyDown:k=>{const T=yj[b?"from-bottom":"from-top"].includes(k.key);m?.({event:k,direction:T?-1:1})}})})}),Sj=w.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:a,onSlideMove:l,onSlideEnd:o,onHomeKeyDown:c,onEndKeyDown:d,onStepKeyDown:m,...f}=e,p=Bm(Qo,n);return r.jsx(It.span,{...f,ref:t,onKeyDown:Pe(e.onKeyDown,x=>{x.key==="Home"?(c(x),x.preventDefault()):x.key==="End"?(d(x),x.preventDefault()):gj.concat(vj).includes(x.key)&&(m(x),x.preventDefault())}),onPointerDown:Pe(e.onPointerDown,x=>{const y=x.target;y.setPointerCapture(x.pointerId),x.preventDefault(),p.thumbs.has(y)?y.focus():a(x)}),onPointerMove:Pe(e.onPointerMove,x=>{x.target.hasPointerCapture(x.pointerId)&&l(x)}),onPointerUp:Pe(e.onPointerUp,x=>{const y=x.target;y.hasPointerCapture(x.pointerId)&&(y.releasePointerCapture(x.pointerId),o(x))})})}),kj="SliderTrack",Cj=w.forwardRef((e,t)=>{const{__scopeSlider:n,...a}=e,l=Bm(kj,n);return r.jsx(It.span,{"data-disabled":l.disabled?"":void 0,"data-orientation":l.orientation,...a,ref:t})});Cj.displayName=kj;var zx="SliderRange",Tj=w.forwardRef((e,t)=>{const{__scopeSlider:n,...a}=e,l=Bm(zx,n),o=Nj(zx,n),c=w.useRef(null),d=mn(t,c),m=l.values.length,f=l.values.map(y=>Mj(y,l.min,l.max)),p=m>1?Math.min(...f):0,x=100-Math.max(...f);return r.jsx(It.span,{"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,...a,ref:d,style:{...e.style,[o.startEdge]:p+"%",[o.endEdge]:x+"%"}})});Tj.displayName=zx;var Ox="SliderThumb",_j=w.forwardRef((e,t)=>{const n=QA(e.__scopeSlider),[a,l]=w.useState(null),o=mn(t,d=>l(d)),c=w.useMemo(()=>a?n().findIndex(d=>d.ref.current===a):-1,[n,a]);return r.jsx(nD,{...e,ref:o,index:c})}),nD=w.forwardRef((e,t)=>{const{__scopeSlider:n,index:a,name:l,...o}=e,c=Bm(Ox,n),d=Nj(Ox,n),[m,f]=w.useState(null),p=mn(t,M=>f(M)),x=m?c.form||!!m.closest("form"):!0,y=q5(m),b=c.values[a],N=b===void 0?0:Mj(b,c.min,c.max),k=sD(a,c.values.length),S=y?.[d.size],T=S?iD(S,N,d.direction):0;return w.useEffect(()=>{if(m)return c.thumbs.add(m),()=>{c.thumbs.delete(m)}},[m,c.thumbs]),r.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[d.startEdge]:`calc(${N}% + ${T}px)`},children:[r.jsx(Dx.ItemSlot,{scope:e.__scopeSlider,children:r.jsx(It.span,{role:"slider","aria-label":e["aria-label"]||k,"aria-valuemin":c.min,"aria-valuenow":b,"aria-valuemax":c.max,"aria-orientation":c.orientation,"data-orientation":c.orientation,"data-disabled":c.disabled?"":void 0,tabIndex:c.disabled?void 0:0,...o,ref:p,style:b===void 0?{display:"none"}:e.style,onFocus:Pe(e.onFocus,()=>{c.valueIndexToChangeRef.current=a})})}),x&&r.jsx(Ej,{name:l??(c.name?c.name+(c.values.length>1?"[]":""):void 0),form:c.form,value:b},a)]})});_j.displayName=Ox;var rD="RadioBubbleInput",Ej=w.forwardRef(({__scopeSlider:e,value:t,...n},a)=>{const l=w.useRef(null),o=mn(l,a),c=I5(t);return w.useEffect(()=>{const d=l.current;if(!d)return;const m=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(m,"value").set;if(c!==t&&p){const x=new Event("input",{bubbles:!0});p.call(d,t),d.dispatchEvent(x)}},[c,t]),r.jsx(It.input,{style:{display:"none"},...n,ref:o,defaultValue:t})});Ej.displayName=rD;function aD(e=[],t,n){const a=[...e];return a[n]=t,a.sort((l,o)=>l-o)}function Mj(e,t,n){const o=100/(n-t)*(e-t);return h1(o,[0,100])}function sD(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function lD(e,t){if(e.length===1)return 0;const n=e.map(l=>Math.abs(l-t)),a=Math.min(...n);return n.indexOf(a)}function iD(e,t,n){const a=e/2,o=q1([0,50],[0,a]);return(a-o(t)*n)*n}function oD(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function cD(e,t){if(t>0){const n=oD(e);return Math.min(...n)>=t}return!0}function q1(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const a=(t[1]-t[0])/(e[1]-e[0]);return t[0]+a*(n-e[0])}}function uD(e){return(String(e).split(".")[1]||"").length}function dD(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var Aj=wj,mD=Cj,hD=Tj,fD=_j;const Pm=w.forwardRef(({className:e,...t},n)=>r.jsxs(Aj,{ref:n,className:he("relative flex w-full touch-none select-none items-center",e),...t,children:[r.jsx(mD,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:r.jsx(hD,{className:"absolute h-full bg-primary"})}),r.jsx(fD,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));Pm.displayName=Aj.displayName;const _t=lT,Et=iT,jt=w.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(V5,{ref:a,className:he("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,r.jsx(tT,{asChild:!0,children:r.jsx(pu,{className:"h-4 w-4 opacity-50"})})]}));jt.displayName=V5.displayName;const Dj=w.forwardRef(({className:e,...t},n)=>r.jsx(G5,{ref:n,className:he("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Nx,{className:"h-4 w-4"})}));Dj.displayName=G5.displayName;const zj=w.forwardRef(({className:e,...t},n)=>r.jsx(Y5,{ref:n,className:he("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(pu,{className:"h-4 w-4"})}));zj.displayName=Y5.displayName;const Nt=w.forwardRef(({className:e,children:t,position:n="popper",...a},l)=>r.jsx(nT,{children:r.jsxs(W5,{ref:l,className:he("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 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 origin-[--radix-select-content-transform-origin]",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",e),position:n,...a,children:[r.jsx(Dj,{}),r.jsx(rT,{className:he("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(zj,{})]})}));Nt.displayName=W5.displayName;const pD=w.forwardRef(({className:e,...t},n)=>r.jsx(X5,{ref:n,className:he("px-2 py-1.5 text-sm font-semibold",e),...t}));pD.displayName=X5.displayName;const Oe=w.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(K5,{ref:a,className:he("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(aT,{children:r.jsx(mi,{className:"h-4 w-4"})})}),r.jsx(sT,{children:t})]}));Oe.displayName=K5.displayName;const xD=w.forwardRef(({className:e,...t},n)=>r.jsx(Q5,{ref:n,className:he("-mx-1 my-1 h-px bg-muted",e),...t}));xD.displayName=Q5.displayName;function gD(e){const t=vD(e),n=w.forwardRef((a,l)=>{const{children:o,...c}=a,d=w.Children.toArray(o),m=d.find(bD);if(m){const f=m.props.children,p=d.map(x=>x===m?w.Children.count(f)>1?w.Children.only(null):w.isValidElement(f)?f.props.children:null:x);return r.jsx(t,{...c,ref:l,children:w.isValidElement(f)?w.cloneElement(f,void 0,p):null})}return r.jsx(t,{...c,ref:l,children:o})});return n.displayName=`${e}.Slot`,n}function vD(e){const t=w.forwardRef((n,a)=>{const{children:l,...o}=n;if(w.isValidElement(l)){const c=jD(l),d=wD(o,l.props);return l.type!==w.Fragment&&(d.ref=a?Sl(a,c):c),w.cloneElement(l,d)}return w.Children.count(l)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var yD=Symbol("radix.slottable");function bD(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===yD}function wD(e,t){const n={...t};for(const a in t){const l=e[a],o=t[a];/^on[A-Z]/.test(a)?l&&o?n[a]=(...d)=>{const m=o(...d);return l(...d),m}:l&&(n[a]=l):a==="style"?n[a]={...l,...o}:a==="className"&&(n[a]=[l,o].filter(Boolean).join(" "))}return{...e,...n}}function jD(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Fm="Popover",[Oj]=Ua(Fm,[Vo]),Iu=Vo(),[ND,Ol]=Oj(Fm),Rj=e=>{const{__scopePopover:t,children:n,open:a,defaultOpen:l,onOpenChange:o,modal:c=!1}=e,d=Iu(t),m=w.useRef(null),[f,p]=w.useState(!1),[x,y]=zl({prop:a,defaultProp:l??!1,onChange:o,caller:Fm});return r.jsx(Sm,{...d,children:r.jsx(ND,{scope:t,contentId:Ta(),triggerRef:m,open:x,onOpenChange:y,onOpenToggle:w.useCallback(()=>y(b=>!b),[y]),hasCustomAnchor:f,onCustomAnchorAdd:w.useCallback(()=>p(!0),[]),onCustomAnchorRemove:w.useCallback(()=>p(!1),[]),modal:c,children:n})})};Rj.displayName=Fm;var Lj="PopoverAnchor",SD=w.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,l=Ol(Lj,n),o=Iu(n),{onCustomAnchorAdd:c,onCustomAnchorRemove:d}=l;return w.useEffect(()=>(c(),()=>d()),[c,d]),r.jsx(km,{...o,...a,ref:t})});SD.displayName=Lj;var Bj="PopoverTrigger",Pj=w.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,l=Ol(Bj,n),o=Iu(n),c=mn(t,l.triggerRef),d=r.jsx(It.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":Uj(l.open),...a,ref:c,onClick:Pe(e.onClick,l.onOpenToggle)});return l.hasCustomAnchor?d:r.jsx(km,{asChild:!0,...o,children:d})});Pj.displayName=Bj;var H1="PopoverPortal",[kD,CD]=Oj(H1,{forceMount:void 0}),Fj=e=>{const{__scopePopover:t,forceMount:n,children:a,container:l}=e,o=Ol(H1,t);return r.jsx(kD,{scope:t,forceMount:n,children:r.jsx(Wr,{present:n||o.open,children:r.jsx(Nm,{asChild:!0,container:l,children:a})})})};Fj.displayName=H1;var qo="PopoverContent",Ij=w.forwardRef((e,t)=>{const n=CD(qo,e.__scopePopover),{forceMount:a=n.forceMount,...l}=e,o=Ol(qo,e.__scopePopover);return r.jsx(Wr,{present:a||o.open,children:o.modal?r.jsx(_D,{...l,ref:t}):r.jsx(ED,{...l,ref:t})})});Ij.displayName=qo;var TD=gD("PopoverContent.RemoveScroll"),_D=w.forwardRef((e,t)=>{const n=Ol(qo,e.__scopePopover),a=w.useRef(null),l=mn(t,a),o=w.useRef(!1);return w.useEffect(()=>{const c=a.current;if(c)return Z5(c)},[]),r.jsx(J5,{as:TD,allowPinchZoom:!0,children:r.jsx(qj,{...e,ref:l,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Pe(e.onCloseAutoFocus,c=>{c.preventDefault(),o.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Pe(e.onPointerDownOutside,c=>{const d=c.detail.originalEvent,m=d.button===0&&d.ctrlKey===!0,f=d.button===2||m;o.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:Pe(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1})})})}),ED=w.forwardRef((e,t)=>{const n=Ol(qo,e.__scopePopover),a=w.useRef(!1),l=w.useRef(!1);return r.jsx(qj,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(a.current||n.triggerRef.current?.focus(),o.preventDefault()),a.current=!1,l.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(a.current=!0,o.detail.originalEvent.type==="pointerdown"&&(l.current=!0));const c=o.target;n.triggerRef.current?.contains(c)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&l.current&&o.preventDefault()}})}),qj=w.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:o,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:f,onInteractOutside:p,...x}=e,y=Ol(qo,n),b=Iu(n);return e6(),r.jsx(t6,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:l,onUnmountAutoFocus:o,children:r.jsx(b1,{asChild:!0,disableOutsidePointerEvents:c,onInteractOutside:p,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:f,onDismiss:()=>y.onOpenChange(!1),children:r.jsx(w1,{"data-state":Uj(y.open),role:"dialog",id:y.contentId,...b,...x,ref:t,style:{...x.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Hj="PopoverClose",MD=w.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,l=Ol(Hj,n);return r.jsx(It.button,{type:"button",...a,ref:t,onClick:Pe(e.onClick,()=>l.onOpenChange(!1))})});MD.displayName=Hj;var AD="PopoverArrow",DD=w.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,l=Iu(n);return r.jsx(j1,{...l,...a,ref:t})});DD.displayName=AD;function Uj(e){return e?"open":"closed"}var zD=Rj,OD=Pj,RD=Fj,$j=Ij;const Cl=zD,Tl=OD,Ps=w.forwardRef(({className:e,align:t="center",sideOffset:n=4,...a},l)=>r.jsx(RD,{children:r.jsx($j,{ref:l,align:t,sideOffset:n,className:he("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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 origin-[--radix-popover-content-transform-origin]",e),...a})}));Ps.displayName=$j.displayName;const Zo="/api/webui/config";async function LD(){const t=await(await lt(`${Zo}/bot`)).json();if(!t.success)throw new Error("获取配置数据失败");return t.config}async function zo(){const t=await(await lt(`${Zo}/model`)).json();if(!t.success)throw new Error("获取模型配置数据失败");return t.config}async function Db(e){const n=await(await lt(`${Zo}/bot`,{method:"POST",headers:pt(),body:JSON.stringify(e)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function om(e){const n=await(await lt(`${Zo}/model`,{method:"POST",headers:pt(),body:JSON.stringify(e)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function BD(e,t){const a=await(await lt(`${Zo}/bot/section/${e}`,{method:"POST",headers:pt(),body:JSON.stringify(t)})).json();if(!a.success)throw new Error(a.message||`保存配置节 ${e} 失败`)}async function Rx(e,t){const a=await(await lt(`${Zo}/model/section/${e}`,{method:"POST",headers:pt(),body:JSON.stringify(t)})).json();if(!a.success)throw new Error(a.message||`保存配置节 ${e} 失败`)}const PD=An.create({baseURL:"",timeout:1e4});async function U1(){try{return(await PD.post("/api/webui/system/restart")).data}catch(e){throw console.error("重启麦麦失败:",e),e}}const FD=Ko("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),qu=w.forwardRef(({className:e,variant:t,...n},a)=>r.jsx("div",{ref:a,role:"alert",className:he(FD({variant:t}),e),...n}));qu.displayName="Alert";const ID=w.forwardRef(({className:e,...t},n)=>r.jsx("h5",{ref:n,className:he("mb-1 font-medium leading-none tracking-tight",e),...t}));ID.displayName="AlertTitle";const Hu=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:he("text-sm [&_p]:leading-relaxed",e),...t}));Hu.displayName="AlertDescription";function $1({onRestartComplete:e,onRestartFailed:t}){const[n,a]=w.useState(0),[l,o]=w.useState("restarting"),[c,d]=w.useState(0),[m,f]=w.useState(0);w.useEffect(()=>{const y=setInterval(()=>{a(k=>k>=90?k:k+1)},200),b=setInterval(()=>{d(k=>k+1)},1e3),N=setTimeout(()=>{o("checking"),p()},3e3);return()=>{clearInterval(y),clearInterval(b),clearTimeout(N)}},[]);const p=()=>{const b=async()=>{try{if(f(k=>k+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)a(100),o("success"),setTimeout(()=>{e?.()},1500);else throw new Error("Status check failed")}catch{m<60?setTimeout(b,2e3):(o("failed"),t?.())}};b()},x=y=>{const b=Math.floor(y/60),N=y%60;return`${b}:${N.toString().padStart(2,"0")}`};return r.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:r.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[r.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[l==="restarting"&&r.jsxs(r.Fragment,{children:[r.jsx(xu,{className:"h-16 w-16 text-primary animate-spin"}),r.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),r.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),l==="checking"&&r.jsxs(r.Fragment,{children:[r.jsx(xu,{className:"h-16 w-16 text-primary animate-spin"}),r.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),r.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",m,"/60)"]})]}),l==="success"&&r.jsxs(r.Fragment,{children:[r.jsx($r,{className:"h-16 w-16 text-green-500"}),r.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),r.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),l==="failed"&&r.jsxs(r.Fragment,{children:[r.jsx(xi,{className:"h-16 w-16 text-destructive"}),r.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),r.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),l!=="failed"&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Fu,{value:n,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[n,"%"]}),r.jsxs("span",{children:["已用时: ",x(c)]})]})]}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:r.jsxs("p",{className:"text-sm text-muted-foreground",children:[l==="restarting"&&"🔄 配置已保存,正在重启主程序...",l==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",l==="success"&&"✅ 配置已生效,服务运行正常",l==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),l==="failed"&&r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),r.jsx("button",{onClick:()=>{o("checking"),f(0),p()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}function qD(){const[e,t]=w.useState(!0),[n,a]=w.useState(!1),[l,o]=w.useState(!1),[c,d]=w.useState(!1),[m,f]=w.useState(!1),[p,x]=w.useState(!1),{toast:y}=or(),[b,N]=w.useState(null),[k,S]=w.useState(null),[T,M]=w.useState(null),[A,R]=w.useState(null),[B,O]=w.useState(null),[L,$]=w.useState(null),[U,I]=w.useState(null),[G,ee]=w.useState(null),[Ne,J]=w.useState(null),[se,H]=w.useState(null),[le,re]=w.useState(null),[ge,E]=w.useState(null),[we,Z]=w.useState(null),[z,X]=w.useState(null),[q,ce]=w.useState(null),[fe,De]=w.useState(null),[oe,He]=w.useState(null),[at,je]=w.useState(null),Ze=w.useRef(null),qe=w.useRef(!0),Ot=w.useRef({}),bn=w.useCallback(async()=>{try{t(!0);const $e=await LD();Ot.current=$e,N($e.bot),S($e.personality);const Fn=$e.chat;Fn.talk_value_rules||(Fn.talk_value_rules=[]),M(Fn),R($e.expression),O($e.emoji),$($e.memory),I($e.tool),ee($e.mood),J($e.voice),H($e.lpmm_knowledge),re($e.keyword_reaction),E($e.response_post_process),Z($e.chinese_typo),X($e.response_splitter),ce($e.log),De($e.debug),He($e.maim_message),je($e.telemetry),d(!1),qe.current=!1}catch($e){console.error("加载配置失败:",$e),y({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{t(!1)}},[y]);w.useEffect(()=>{bn()},[bn]);const Dn=w.useCallback(async($e,Fn)=>{if(!qe.current)try{o(!0),await BD($e,Fn),d(!1)}catch(K){console.error(`自动保存 ${$e} 失败:`,K),d(!0)}finally{o(!1)}},[]),Xe=w.useCallback(($e,Fn)=>{qe.current||(d(!0),Ze.current&&clearTimeout(Ze.current),Ze.current=setTimeout(()=>{Dn($e,Fn)},2e3))},[Dn]);w.useEffect(()=>{b&&!qe.current&&Xe("bot",b)},[b,Xe]),w.useEffect(()=>{k&&!qe.current&&Xe("personality",k)},[k,Xe]),w.useEffect(()=>{T&&!qe.current&&Xe("chat",T)},[T,Xe]),w.useEffect(()=>{A&&!qe.current&&Xe("expression",A)},[A,Xe]),w.useEffect(()=>{B&&!qe.current&&Xe("emoji",B)},[B,Xe]),w.useEffect(()=>{L&&!qe.current&&Xe("memory",L)},[L,Xe]),w.useEffect(()=>{U&&!qe.current&&Xe("tool",U)},[U,Xe]),w.useEffect(()=>{G&&!qe.current&&Xe("mood",G)},[G,Xe]),w.useEffect(()=>{Ne&&!qe.current&&Xe("voice",Ne)},[Ne,Xe]),w.useEffect(()=>{se&&!qe.current&&Xe("lpmm_knowledge",se)},[se,Xe]),w.useEffect(()=>{le&&!qe.current&&Xe("keyword_reaction",le)},[le,Xe]),w.useEffect(()=>{ge&&!qe.current&&Xe("response_post_process",ge)},[ge,Xe]),w.useEffect(()=>{we&&!qe.current&&Xe("chinese_typo",we)},[we,Xe]),w.useEffect(()=>{z&&!qe.current&&Xe("response_splitter",z)},[z,Xe]),w.useEffect(()=>{q&&!qe.current&&Xe("log",q)},[q,Xe]),w.useEffect(()=>{fe&&!qe.current&&Xe("debug",fe)},[fe,Xe]),w.useEffect(()=>{oe&&!qe.current&&Xe("maim_message",oe)},[oe,Xe]),w.useEffect(()=>{at&&!qe.current&&Xe("telemetry",at)},[at,Xe]);const wn=async()=>{try{a(!0),Ze.current&&clearTimeout(Ze.current);const $e={...Ot.current,bot:b,personality:k,chat:T,expression:A,emoji:B,memory:L,tool:U,mood:G,voice:Ne,lpmm_knowledge:se,keyword_reaction:le,response_post_process:ge,chinese_typo:we,response_splitter:z,log:q,debug:fe,maim_message:oe,telemetry:at};await Db($e),d(!1),y({title:"保存成功",description:"麦麦主程序配置已保存"})}catch($e){console.error("保存配置失败:",$e),y({title:"保存失败",description:$e.message,variant:"destructive"})}finally{a(!1)}},Wn=async()=>{try{f(!0),U1().catch(()=>{}),x(!0)}catch($e){console.error("重启失败:",$e),x(!1),y({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),f(!1)}},Ar=async()=>{try{a(!0),Ze.current&&clearTimeout(Ze.current);const $e={...Ot.current,bot:b,personality:k,chat:T,expression:A,emoji:B,memory:L,tool:U,mood:G,voice:Ne,lpmm_knowledge:se,keyword_reaction:le,response_post_process:ge,chinese_typo:we,response_splitter:z,log:q,debug:fe,maim_message:oe,telemetry:at};await Db($e),d(!1),y({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(Fn=>setTimeout(Fn,500)),await Wn()}catch($e){console.error("保存失败:",$e),y({title:"保存失败",description:$e.message,variant:"destructive"})}finally{a(!1)}},Cn=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},cr=()=>{x(!1),f(!1),y({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return e?r.jsx(an,{className:"h-full",children:r.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):r.jsx(an,{className:"h-full",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),r.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),r.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[r.jsxs(ne,{onClick:wn,disabled:n||l||!c||m,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[r.jsx(Cm,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":l?"自动保存中...":c?"保存配置":"已保存"]}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsxs(ne,{disabled:n||l||m,size:"sm",className:"flex-1 sm:flex-none",children:[r.jsx(S1,{className:"mr-2 h-4 w-4"}),m?"重启中...":c?"保存并重启":"重启麦麦"]})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认重启麦麦?"}),r.jsx(Qt,{children:c?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:c?Ar:Wn,children:c?"保存并重启":"确认重启"})]})]})]})]})]}),r.jsxs(qu,{children:[r.jsx(pi,{className:"h-4 w-4"}),r.jsxs(Hu,{children:["配置更新后需要",r.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),r.jsxs(kl,{defaultValue:"bot",className:"w-full",children:[r.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:r.jsxs(Bs,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[r.jsx(Pt,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),r.jsx(Pt,{value:"personality",className:"flex-shrink-0",children:"人格"}),r.jsx(Pt,{value:"chat",className:"flex-shrink-0",children:"聊天"}),r.jsx(Pt,{value:"expression",className:"flex-shrink-0",children:"表达"}),r.jsx(Pt,{value:"features",className:"flex-shrink-0",children:"功能"}),r.jsx(Pt,{value:"processing",className:"flex-shrink-0",children:"处理"}),r.jsx(Pt,{value:"mood",className:"flex-shrink-0",children:"情绪"}),r.jsx(Pt,{value:"voice",className:"flex-shrink-0",children:"语音"}),r.jsx(Pt,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),r.jsx(Pt,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),r.jsx(cn,{value:"bot",className:"space-y-4",children:b&&r.jsx(HD,{config:b,onChange:N})}),r.jsx(cn,{value:"personality",className:"space-y-4",children:k&&r.jsx(UD,{config:k,onChange:S})}),r.jsx(cn,{value:"chat",className:"space-y-4",children:T&&r.jsx($D,{config:T,onChange:M})}),r.jsx(cn,{value:"expression",className:"space-y-4",children:A&&r.jsx(VD,{config:A,onChange:R})}),r.jsx(cn,{value:"features",className:"space-y-4",children:B&&L&&U&&r.jsx(GD,{emojiConfig:B,memoryConfig:L,toolConfig:U,onEmojiChange:O,onMemoryChange:$,onToolChange:I})}),r.jsx(cn,{value:"processing",className:"space-y-4",children:le&&ge&&we&&z&&r.jsx(YD,{keywordReactionConfig:le,responsePostProcessConfig:ge,chineseTypoConfig:we,responseSplitterConfig:z,onKeywordReactionChange:re,onResponsePostProcessChange:E,onChineseTypoChange:Z,onResponseSplitterChange:X})}),r.jsx(cn,{value:"mood",className:"space-y-4",children:G&&r.jsx(WD,{config:G,onChange:ee})}),r.jsx(cn,{value:"voice",className:"space-y-4",children:Ne&&r.jsx(XD,{config:Ne,onChange:J})}),r.jsx(cn,{value:"lpmm",className:"space-y-4",children:se&&r.jsx(KD,{config:se,onChange:H})}),r.jsxs(cn,{value:"other",className:"space-y-4",children:[q&&r.jsx(QD,{config:q,onChange:ce}),fe&&r.jsx(ZD,{config:fe,onChange:De}),oe&&r.jsx(JD,{config:oe,onChange:He}),at&&r.jsx(ez,{config:at,onChange:je})]})]}),p&&r.jsx($1,{onRestartComplete:Cn,onRestartFailed:cr})]})})}function HD({config:e,onChange:t}){const n=()=>{t({...e,platforms:[...e.platforms,""]})},a=m=>{t({...e,platforms:e.platforms.filter((f,p)=>p!==m)})},l=(m,f)=>{const p=[...e.platforms];p[m]=f,t({...e,platforms:p})},o=()=>{t({...e,alias_names:[...e.alias_names,""]})},c=m=>{t({...e,alias_names:e.alias_names.filter((f,p)=>p!==m)})},d=(m,f)=>{const p=[...e.alias_names];p[m]=f,t({...e,alias_names:p})};return r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"platform",children:"平台"}),r.jsx(Te,{id:"platform",value:e.platform,onChange:m=>t({...e,platform:m.target.value}),placeholder:"qq"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"qq_account",children:"QQ账号"}),r.jsx(Te,{id:"qq_account",value:e.qq_account,onChange:m=>t({...e,qq_account:m.target.value}),placeholder:"123456789"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"nickname",children:"昵称"}),r.jsx(Te,{id:"nickname",value:e.nickname,onChange:m=>t({...e,nickname:m.target.value}),placeholder:"麦麦"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{children:"其他平台账号"}),r.jsxs(ne,{onClick:n,size:"sm",variant:"outline",children:[r.jsx(pr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),r.jsxs("div",{className:"space-y-2",children:[e.platforms.map((m,f)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{value:m,onChange:p=>l(f,p.target.value),placeholder:"wx:114514"}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"icon",variant:"outline",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:['确定要删除平台账号 "',m||"(空)",'" 吗?此操作无法撤销。']})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>a(f),children:"删除"})]})]})]})]},f)),e.platforms.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{children:"别名"}),r.jsxs(ne,{onClick:o,size:"sm",variant:"outline",children:[r.jsx(pr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),r.jsxs("div",{className:"space-y-2",children:[e.alias_names.map((m,f)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{value:m,onChange:p=>d(f,p.target.value),placeholder:"小麦"}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"icon",variant:"outline",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:['确定要删除别名 "',m||"(空)",'" 吗?此操作无法撤销。']})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>c(f),children:"删除"})]})]})]})]},f)),e.alias_names.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function UD({config:e,onChange:t}){const n=()=>{t({...e,states:[...e.states,""]})},a=o=>{t({...e,states:e.states.filter((c,d)=>d!==o)})},l=(o,c)=>{const d=[...e.states];d[o]=c,t({...e,states:d})};return r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"personality",children:"人格特质"}),r.jsx(fn,{id:"personality",value:e.personality,onChange:o=>t({...e,personality:o.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"reply_style",children:"表达风格"}),r.jsx(fn,{id:"reply_style",value:e.reply_style,onChange:o=>t({...e,reply_style:o.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"interest",children:"兴趣"}),r.jsx(fn,{id:"interest",value:e.interest,onChange:o=>t({...e,interest:o.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"plan_style",children:"说话规则与行为风格"}),r.jsx(fn,{id:"plan_style",value:e.plan_style,onChange:o=>t({...e,plan_style:o.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"visual_style",children:"识图规则"}),r.jsx(fn,{id:"visual_style",value:e.visual_style,onChange:o=>t({...e,visual_style:o.target.value}),placeholder:"识图时的处理规则",rows:3})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"private_plan_style",children:"私聊规则"}),r.jsx(fn,{id:"private_plan_style",value:e.private_plan_style,onChange:o=>t({...e,private_plan_style:o.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{children:"状态列表(人格多样性)"}),r.jsxs(ne,{onClick:n,size:"sm",variant:"outline",children:[r.jsx(pr,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),r.jsx("div",{className:"space-y-2",children:e.states.map((o,c)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(fn,{value:o,onChange:d=>l(c,d.target.value),placeholder:"描述一个人格状态",rows:2}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"icon",variant:"outline",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsx(Qt,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>a(c),children:"删除"})]})]})]})]},c))})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"state_probability",children:"状态替换概率"}),r.jsx(Te,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:e.state_probability,onChange:o=>t({...e,state_probability:parseFloat(o.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function $D({config:e,onChange:t}){const n=()=>{t({...e,talk_value_rules:[...e.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},a=d=>{t({...e,talk_value_rules:e.talk_value_rules.filter((m,f)=>f!==d)})},l=(d,m,f)=>{const p=[...e.talk_value_rules];p[d]={...p[d],[m]:f},t({...e,talk_value_rules:p})},o=({value:d,onChange:m})=>{const[f,p]=w.useState("00"),[x,y]=w.useState("00"),[b,N]=w.useState("23"),[k,S]=w.useState("59");w.useEffect(()=>{const M=d.split("-");if(M.length===2){const[A,R]=M,[B,O]=A.split(":"),[L,$]=R.split(":");B&&p(B.padStart(2,"0")),O&&y(O.padStart(2,"0")),L&&N(L.padStart(2,"0")),$&&S($.padStart(2,"0"))}},[d]);const T=(M,A,R,B)=>{const O=`${M}:${A}-${R}:${B}`;m(O)};return r.jsxs(Cl,{children:[r.jsx(Tl,{asChild:!0,children:r.jsxs(ne,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[r.jsx(di,{className:"h-4 w-4 mr-2"}),d||"选择时间段"]})}),r.jsx(Ps,{className:"w-80",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-xs",children:"小时"}),r.jsxs(_t,{value:f,onValueChange:M=>{p(M),T(M,x,b,k)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsx(Nt,{children:Array.from({length:24},(M,A)=>A).map(M=>r.jsx(Oe,{value:M.toString().padStart(2,"0"),children:M.toString().padStart(2,"0")},M))})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-xs",children:"分钟"}),r.jsxs(_t,{value:x,onValueChange:M=>{y(M),T(f,M,b,k)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsx(Nt,{children:Array.from({length:60},(M,A)=>A).map(M=>r.jsx(Oe,{value:M.toString().padStart(2,"0"),children:M.toString().padStart(2,"0")},M))})]})]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-xs",children:"小时"}),r.jsxs(_t,{value:b,onValueChange:M=>{N(M),T(f,x,M,k)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsx(Nt,{children:Array.from({length:24},(M,A)=>A).map(M=>r.jsx(Oe,{value:M.toString().padStart(2,"0"),children:M.toString().padStart(2,"0")},M))})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-xs",children:"分钟"}),r.jsxs(_t,{value:k,onValueChange:M=>{S(M),T(f,x,b,M)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsx(Nt,{children:Array.from({length:60},(M,A)=>A).map(M=>r.jsx(Oe,{value:M.toString().padStart(2,"0"),children:M.toString().padStart(2,"0")},M))})]})]})]})]})]})})]})},c=({rule:d})=>{const m=`{ target = "${d.target}", time = "${d.time}", value = ${d.value.toFixed(1)} }`;return r.jsxs(Cl,{children:[r.jsx(Tl,{asChild:!0,children:r.jsxs(ne,{variant:"outline",size:"sm",children:[r.jsx(Ha,{className:"h-4 w-4 mr-1"}),"预览"]})}),r.jsx(Ps,{className:"w-96",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),r.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:m}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),r.jsx(Te,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:e.talk_value,onChange:d=>t({...e,talk_value:parseFloat(d.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"mentioned_bot_reply",children:"提及回复增幅"}),r.jsx(Te,{id:"mentioned_bot_reply",type:"number",step:"0.1",min:"0",max:"1",value:e.mentioned_bot_reply,onChange:d=>t({...e,mentioned_bot_reply:parseFloat(d.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"提及时回复概率增幅,1 为 100% 回复"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"max_context_size",children:"上下文长度"}),r.jsx(Te,{id:"max_context_size",type:"number",min:"1",value:e.max_context_size,onChange:d=>t({...e,max_context_size:parseInt(d.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"planner_smooth",children:"规划器平滑"}),r.jsx(Te,{id:"planner_smooth",type:"number",step:"1",min:"0",value:e.planner_smooth,onChange:d=>t({...e,planner_smooth:parseFloat(d.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"enable_talk_value_rules",checked:e.enable_talk_value_rules,onCheckedChange:d=>t({...e,enable_talk_value_rules:d})}),r.jsx(Q,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"include_planner_reasoning",checked:e.include_planner_reasoning,onCheckedChange:d=>t({...e,include_planner_reasoning:d})}),r.jsx(Q,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),e.enable_talk_value_rules&&r.jsxs("div",{className:"border-t pt-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),r.jsxs(ne,{onClick:n,size:"sm",children:[r.jsx(pr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),e.talk_value_rules&&e.talk_value_rules.length>0?r.jsx("div",{className:"space-y-4",children:e.talk_value_rules.map((d,m)=>r.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",m+1]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(c,{rule:d}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{variant:"ghost",size:"sm",children:r.jsx(zt,{className:"h-4 w-4 text-destructive"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:["确定要删除规则 #",m+1," 吗?此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>a(m),children:"删除"})]})]})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"配置类型"}),r.jsxs(_t,{value:d.target===""?"global":"specific",onValueChange:f=>{f==="global"?l(m,"target",""):l(m,"target","qq::group")},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"global",children:"全局配置"}),r.jsx(Oe,{value:"specific",children:"详细配置"})]})]})]}),d.target!==""&&(()=>{const f=d.target.split(":"),p=f[0]||"qq",x=f[1]||"",y=f[2]||"group";return r.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"平台"}),r.jsxs(_t,{value:p,onValueChange:b=>{l(m,"target",`${b}:${x}:${y}`)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"qq",children:"QQ"}),r.jsx(Oe,{value:"wx",children:"微信"})]})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"群 ID"}),r.jsx(Te,{value:x,onChange:b=>{l(m,"target",`${p}:${b.target.value}:${y}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"类型"}),r.jsxs(_t,{value:y,onValueChange:b=>{l(m,"target",`${p}:${x}:${b}`)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"group",children:"群组(group)"}),r.jsx(Oe,{value:"private",children:"私聊(private)"})]})]})]})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",d.target||"(未设置)"]})]})})(),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"时间段 (Time)"}),r.jsx(o,{value:d.time,onChange:f=>l(m,"time",f)}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{htmlFor:`rule-value-${m}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),r.jsx(Te,{id:`rule-value-${m}`,type:"number",step:"0.01",min:"0",max:"1",value:d.value,onChange:f=>{const p=parseFloat(f.target.value);isNaN(p)||l(m,"value",Math.max(0,Math.min(1,p)))},className:"w-20 h-8 text-xs"})]}),r.jsx(Pm,{value:[d.value],onValueChange:f=>l(m,"value",f[0]),min:0,max:1,step:.01,className:"w-full"}),r.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[r.jsx("span",{children:"0 (完全沉默)"}),r.jsx("span",{children:"0.5"}),r.jsx("span",{children:"1.0 (正常)"})]})]})]})]},m))}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:r.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),r.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[r.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),r.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[r.jsxs("li",{children:["• ",r.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),r.jsxs("li",{children:["• ",r.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),r.jsxs("li",{children:["• ",r.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),r.jsxs("li",{children:["• ",r.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),r.jsxs("li",{children:["• ",r.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function VD({config:e,onChange:t}){const n=()=>{t({...e,learning_list:[...e.learning_list,["","enable","enable","1.0"]]})},a=y=>{t({...e,learning_list:e.learning_list.filter((b,N)=>N!==y)})},l=(y,b,N)=>{const k=[...e.learning_list];k[y][b]=N,t({...e,learning_list:k})},o=({rule:y})=>{const b=`["${y[0]}", "${y[1]}", "${y[2]}", "${y[3]}"]`;return r.jsxs(Cl,{children:[r.jsx(Tl,{asChild:!0,children:r.jsxs(ne,{variant:"outline",size:"sm",children:[r.jsx(Ha,{className:"h-4 w-4 mr-1"}),"预览"]})}),r.jsx(Ps,{className:"w-96",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),r.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:b}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},c=({member:y,groupIndex:b,memberIndex:N,availableChatIds:k})=>{const S=k.includes(y)||y==="*",[T,M]=w.useState(!S);return r.jsxs("div",{className:"flex gap-2",children:[r.jsx("div",{className:"flex-1 flex gap-2",children:T?r.jsxs(r.Fragment,{children:[r.jsx(Te,{value:y,onChange:A=>x(b,N,A.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),k.length>0&&r.jsx(ne,{size:"sm",variant:"outline",onClick:()=>M(!1),title:"切换到下拉选择",children:"下拉"})]}):r.jsxs(r.Fragment,{children:[r.jsxs(_t,{value:y,onValueChange:A=>x(b,N,A),children:[r.jsx(jt,{className:"flex-1",children:r.jsx(Et,{placeholder:"选择聊天流"})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"*",children:"* (全局共享)"}),k.map((A,R)=>r.jsx(Oe,{value:A,children:A},R))]})]}),r.jsx(ne,{size:"sm",variant:"outline",onClick:()=>M(!0),title:"切换到手动输入",children:"输入"})]})}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"icon",variant:"outline",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:['确定要删除组成员 "',y||"(空)",'" 吗?此操作无法撤销。']})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>p(b,N),children:"删除"})]})]})]})]})},d=()=>{t({...e,expression_groups:[...e.expression_groups,[]]})},m=y=>{t({...e,expression_groups:e.expression_groups.filter((b,N)=>N!==y)})},f=y=>{const b=[...e.expression_groups];b[y]=[...b[y],""],t({...e,expression_groups:b})},p=(y,b)=>{const N=[...e.expression_groups];N[y]=N[y].filter((k,S)=>S!==b),t({...e,expression_groups:N})},x=(y,b,N)=>{const k=[...e.expression_groups];k[y][b]=N,t({...e,expression_groups:k})};return r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),r.jsxs(ne,{onClick:n,size:"sm",variant:"outline",children:[r.jsx(pr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),r.jsxs("div",{className:"space-y-4",children:[e.learning_list.map((y,b)=>{const N=e.learning_list.some((R,B)=>B!==b&&R[0]===""),k=y[0]==="",S=y[0].split(":"),T=S[0]||"qq",M=S[1]||"",A=S[2]||"group";return r.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-sm font-medium",children:["规则 ",b+1," ",k&&"(全局配置)"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(o,{rule:y}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"sm",variant:"ghost",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:["确定要删除学习规则 ",b+1," 吗?此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>a(b),children:"删除"})]})]})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"配置类型"}),r.jsxs(_t,{value:k?"global":"specific",onValueChange:R=>{R==="global"?l(b,0,""):l(b,0,"qq::group")},disabled:N&&!k,children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"global",children:"全局配置"}),r.jsx(Oe,{value:"specific",disabled:N&&!k,children:"详细配置"})]})]}),N&&!k&&r.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!k&&r.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"平台"}),r.jsxs(_t,{value:T,onValueChange:R=>{l(b,0,`${R}:${M}:${A}`)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"qq",children:"QQ"}),r.jsx(Oe,{value:"wx",children:"微信"})]})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"群 ID"}),r.jsx(Te,{value:M,onChange:R=>{l(b,0,`${T}:${R.target.value}:${A}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"类型"}),r.jsxs(_t,{value:A,onValueChange:R=>{l(b,0,`${T}:${M}:${R}`)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"group",children:"群组(group)"}),r.jsx(Oe,{value:"private",children:"私聊(private)"})]})]})]})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",y[0]||"(未设置)"]})]}),r.jsx("div",{className:"grid gap-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-xs font-medium",children:"使用学到的表达"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),r.jsx(vt,{checked:y[1]==="enable",onCheckedChange:R=>l(b,1,R?"enable":"disable")})]})}),r.jsx("div",{className:"grid gap-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-xs font-medium",children:"学习表达"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),r.jsx(vt,{checked:y[2]==="enable",onCheckedChange:R=>l(b,2,R?"enable":"disable")})]})}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{className:"text-xs font-medium",children:"学习强度"}),r.jsx(Te,{type:"number",step:"0.1",min:"0",max:"5",value:y[3],onChange:R=>{const B=parseFloat(R.target.value);isNaN(B)||l(b,3,Math.max(0,Math.min(5,B)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),r.jsx(Pm,{value:[parseFloat(y[3])||1],onValueChange:R=>l(b,3,R[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),r.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[r.jsx("span",{children:"0 (不学习)"}),r.jsx("span",{children:"2.5"}),r.jsx("span",{children:"5.0 (快速学习)"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},b)}),e.learning_list.length===0&&r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),r.jsxs(ne,{onClick:d,size:"sm",variant:"outline",children:[r.jsx(pr,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),r.jsxs("div",{className:"space-y-4",children:[e.expression_groups.map((y,b)=>{const N=e.learning_list.map(k=>k[0]).filter(k=>k!=="");return r.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",b+1,y.length===1&&y[0]==="*"&&"(全局共享)"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ne,{onClick:()=>f(b),size:"sm",variant:"outline",children:r.jsx(pr,{className:"h-4 w-4"})}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"sm",variant:"ghost",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:["确定要删除共享组 ",b+1," 吗?此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>m(b),children:"删除"})]})]})]})]})]}),r.jsx("div",{className:"space-y-2",children:y.map((k,S)=>r.jsx(c,{member:k,groupIndex:b,memberIndex:S,availableChatIds:N},S))}),r.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},b)}),e.expression_groups.length===0&&r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function GD({emojiConfig:e,memoryConfig:t,toolConfig:n,onEmojiChange:a,onMemoryChange:l,onToolChange:o}){return r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:c=>o({...n,enable_tool:c})}),r.jsx(Q,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),r.jsx(Te,{id:"max_agent_iterations",type:"number",min:"1",value:t.max_agent_iterations,onChange:c=>l({...t,max_agent_iterations:parseInt(c.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),r.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"emoji_chance",children:"表情包激活概率"}),r.jsx(Te,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:e.emoji_chance,onChange:c=>a({...e,emoji_chance:parseFloat(c.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"max_reg_num",children:"最大注册数量"}),r.jsx(Te,{id:"max_reg_num",type:"number",min:"1",value:e.max_reg_num,onChange:c=>a({...e,max_reg_num:parseInt(c.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),r.jsx(Te,{id:"check_interval",type:"number",min:"1",value:e.check_interval,onChange:c=>a({...e,check_interval:parseInt(c.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"do_replace",checked:e.do_replace,onCheckedChange:c=>a({...e,do_replace:c})}),r.jsx(Q,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"steal_emoji",checked:e.steal_emoji,onCheckedChange:c=>a({...e,steal_emoji:c})}),r.jsx(Q,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),r.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"content_filtration",checked:e.content_filtration,onCheckedChange:c=>a({...e,content_filtration:c})}),r.jsx(Q,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),e.content_filtration&&r.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[r.jsx(Q,{htmlFor:"filtration_prompt",children:"过滤要求"}),r.jsx(Te,{id:"filtration_prompt",value:e.filtration_prompt,onChange:c=>a({...e,filtration_prompt:c.target.value}),placeholder:"符合公序良俗"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function YD({keywordReactionConfig:e,responsePostProcessConfig:t,chineseTypoConfig:n,responseSplitterConfig:a,onKeywordReactionChange:l,onResponsePostProcessChange:o,onChineseTypoChange:c,onResponseSplitterChange:d}){const m=()=>{l({...e,regex_rules:[...e.regex_rules,{regex:[""],reaction:""}]})},f=R=>{l({...e,regex_rules:e.regex_rules.filter((B,O)=>O!==R)})},p=(R,B,O)=>{const L=[...e.regex_rules];B==="regex"&&typeof O=="string"?L[R]={...L[R],regex:[O]}:B==="reaction"&&typeof O=="string"&&(L[R]={...L[R],reaction:O}),l({...e,regex_rules:L})},x=({regex:R,reaction:B,onRegexChange:O,onReactionChange:L})=>{const[$,U]=w.useState(!1),[I,G]=w.useState(""),[ee,Ne]=w.useState(null),[J,se]=w.useState(""),[H,le]=w.useState({}),[re,ge]=w.useState(""),E=w.useRef(null),[we,Z]=w.useState("build"),z=fe=>fe.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),X=(fe,De=0)=>{const oe=E.current;if(!oe)return;const He=oe.selectionStart||0,at=oe.selectionEnd||0,je=R.substring(0,He)+fe+R.substring(at);O(je),setTimeout(()=>{const Ze=He+fe.length+De;oe.setSelectionRange(Ze,Ze),oe.focus()},0)};w.useEffect(()=>{if(!R||!I){Ne(null),le({}),ge(B),se("");return}try{const fe=z(R),De=new RegExp(fe,"g"),oe=I.match(De);Ne(oe),se("");const at=new RegExp(fe).exec(I);if(at&&at.groups){le(at.groups);let je=B;Object.entries(at.groups).forEach(([Ze,qe])=>{je=je.replace(new RegExp(`\\[${Ze}\\]`,"g"),qe||"")}),ge(je)}else le({}),ge(B)}catch(fe){se(fe.message),Ne(null),le({}),ge(B)}},[R,I,B]);const q=()=>{if(!I||!ee||ee.length===0)return r.jsx("span",{className:"text-muted-foreground",children:I||"请输入测试文本"});try{const fe=z(R),De=new RegExp(fe,"g");let oe=0;const He=[];let at;for(;(at=De.exec(I))!==null;)at.index>oe&&He.push(r.jsx("span",{children:I.substring(oe,at.index)},`text-${oe}`)),He.push(r.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:at[0]},`match-${at.index}`)),oe=at.index+at[0].length;return oe)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return r.jsxs(ir,{open:$,onOpenChange:U,children:[r.jsx(I1,{asChild:!0,children:r.jsxs(ne,{variant:"outline",size:"sm",children:[r.jsx(em,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),r.jsxs(Jn,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[r.jsxs(er,{children:[r.jsx(tr,{children:"正则表达式编辑器"}),r.jsx(xr,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),r.jsx(an,{className:"max-h-[calc(90vh-120px)]",children:r.jsxs(kl,{value:we,onValueChange:fe=>Z(fe),className:"w-full",children:[r.jsxs(Bs,{className:"grid w-full grid-cols-2",children:[r.jsx(Pt,{value:"build",children:"🔧 构建器"}),r.jsx(Pt,{value:"test",children:"🧪 测试器"})]}),r.jsxs(cn,{value:"build",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{className:"text-sm font-medium",children:"正则表达式"}),r.jsx(Te,{ref:E,value:R,onChange:fe=>O(fe.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{className:"text-sm font-medium",children:"Reaction 内容"}),r.jsx(fn,{value:B,onChange:fe=>L(fe.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),r.jsxs("div",{className:"space-y-4 border-t pt-4",children:[ce.map(fe=>r.jsxs("div",{className:"space-y-2",children:[r.jsx("h5",{className:"text-xs font-semibold text-primary",children:fe.category}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:fe.items.map(De=>r.jsx(ne,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>X(De.pattern,De.moveCursor||0),children:r.jsxs("div",{className:"flex flex-col items-start w-full",children:[r.jsxs("div",{className:"flex items-center gap-2 w-full",children:[r.jsx("span",{className:"text-xs font-medium",children:De.label}),r.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:De.pattern})]}),r.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:De.desc})]})},De.label))})]},fe.category)),r.jsxs("div",{className:"space-y-2 border-t pt-4",children:[r.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ne,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>O("^(?P\\S{1,20})是这样的$"),children:r.jsxs("div",{className:"flex flex-col items-start w-full",children:[r.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),r.jsx(ne,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>O("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:r.jsxs("div",{className:"flex flex-col items-start w-full",children:[r.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),r.jsx(ne,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>O("(?P.+?)(?:是|为什么|怎么)"),children:r.jsxs("div",{className:"flex flex-col items-start w-full",children:[r.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),r.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[r.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),r.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[r.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),r.jsxs("li",{children:["命名捕获组格式:",r.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),r.jsxs("li",{children:["在 reaction 中使用 ",r.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),r.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),r.jsxs(cn,{value:"test",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{className:"text-sm font-medium",children:"当前正则表达式"}),r.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:R||"(未设置)"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),r.jsx(fn,{id:"test-text",value:I,onChange:fe=>G(fe.target.value),placeholder:`在此输入要测试的文本... -例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),J&&r.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[r.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),r.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:J})]}),!J&&I&&r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex items-center gap-2",children:ee&&ee.length>0?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),r.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",ee.length," 处)"]})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),r.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{className:"text-sm font-medium",children:"匹配高亮"}),r.jsx(an,{className:"h-40 rounded-md bg-muted p-3",children:r.jsx("div",{className:"text-sm break-words",children:q()})})]}),Object.keys(H).length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{className:"text-sm font-medium",children:"命名捕获组"}),r.jsx(an,{className:"h-32 rounded-md border p-3",children:r.jsx("div",{className:"space-y-2",children:Object.entries(H).map(([fe,De])=>r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[r.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",fe,"]"]}),r.jsx("span",{className:"text-muted-foreground",children:"="}),r.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:De})]},fe))})})]}),Object.keys(H).length>0&&B&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{className:"text-sm font-medium",children:"Reaction 替换预览"}),r.jsx(an,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:r.jsx("div",{className:"text-sm break-words",children:re})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),r.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[r.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),r.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[r.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),r.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),r.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),r.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},y=()=>{l({...e,keyword_rules:[...e.keyword_rules,{keywords:[],reaction:""}]})},b=R=>{l({...e,keyword_rules:e.keyword_rules.filter((B,O)=>O!==R)})},N=(R,B,O)=>{const L=[...e.keyword_rules];typeof O=="string"&&(L[R]={...L[R],reaction:O}),l({...e,keyword_rules:L})},k=R=>{const B=[...e.keyword_rules];B[R]={...B[R],keywords:[...B[R].keywords||[],""]},l({...e,keyword_rules:B})},S=(R,B)=>{const O=[...e.keyword_rules];O[R]={...O[R],keywords:(O[R].keywords||[]).filter((L,$)=>$!==B)},l({...e,keyword_rules:O})},T=(R,B,O)=>{const L=[...e.keyword_rules],$=[...L[R].keywords||[]];$[B]=O,L[R]={...L[R],keywords:$},l({...e,keyword_rules:L})},M=({rule:R})=>{const B=`{ regex = [${(R.regex||[]).map(O=>`"${O}"`).join(", ")}], reaction = "${R.reaction}" }`;return r.jsxs(Cl,{children:[r.jsx(Tl,{asChild:!0,children:r.jsxs(ne,{variant:"outline",size:"sm",children:[r.jsx(Ha,{className:"h-4 w-4 mr-1"}),"预览"]})}),r.jsx(Ps,{className:"w-[95vw] sm:w-[500px]",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),r.jsx(an,{className:"h-60 rounded-md bg-muted p-3",children:r.jsx("pre",{className:"font-mono text-xs break-all",children:B})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},A=({rule:R})=>{const B=`[[keyword_reaction.keyword_rules]] -keywords = [${(R.keywords||[]).map(O=>`"${O}"`).join(", ")}] -reaction = "${R.reaction}"`;return r.jsxs(Cl,{children:[r.jsx(Tl,{asChild:!0,children:r.jsxs(ne,{variant:"outline",size:"sm",children:[r.jsx(Ha,{className:"h-4 w-4 mr-1"}),"预览"]})}),r.jsx(Ps,{className:"w-[95vw] sm:w-[500px]",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),r.jsx(an,{className:"h-60 rounded-md bg-muted p-3",children:r.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:B})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),r.jsxs(ne,{onClick:m,size:"sm",variant:"outline",children:[r.jsx(pr,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),r.jsxs("div",{className:"space-y-3",children:[e.regex_rules.map((R,B)=>r.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",B+1]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(x,{regex:R.regex&&R.regex[0]||"",reaction:R.reaction,onRegexChange:O=>p(B,"regex",O),onReactionChange:O=>p(B,"reaction",O)}),r.jsx(M,{rule:R}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"sm",variant:"ghost",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:["确定要删除正则规则 ",B+1," 吗?此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>f(B),children:"删除"})]})]})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),r.jsx(Te,{value:R.regex&&R.regex[0]||"",onChange:O=>p(B,"regex",O.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"反应内容"}),r.jsx(fn,{value:R.reaction,onChange:O=>p(B,"reaction",O.target.value),placeholder:`触发后麦麦的反应... -可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},B)),e.regex_rules.length===0&&r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),r.jsxs("div",{className:"space-y-4 border-t pt-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),r.jsxs(ne,{onClick:y,size:"sm",variant:"outline",children:[r.jsx(pr,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),r.jsxs("div",{className:"space-y-3",children:[e.keyword_rules.map((R,B)=>r.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",B+1]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(A,{rule:R}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"sm",variant:"ghost",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:["确定要删除关键词规则 ",B+1," 吗?此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>b(B),children:"删除"})]})]})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{className:"text-xs font-medium",children:"关键词列表"}),r.jsxs(ne,{onClick:()=>k(B),size:"sm",variant:"ghost",children:[r.jsx(pr,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),r.jsxs("div",{className:"space-y-2",children:[(R.keywords||[]).map((O,L)=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te,{value:O,onChange:$=>T(B,L,$.target.value),placeholder:"关键词",className:"flex-1"}),r.jsx(ne,{onClick:()=>S(B,L),size:"sm",variant:"ghost",children:r.jsx(zt,{className:"h-4 w-4"})})]},L)),(!R.keywords||R.keywords.length===0)&&r.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-xs font-medium",children:"反应内容"}),r.jsx(fn,{value:R.reaction,onChange:O=>N(B,"reaction",O.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},B)),e.keyword_rules.length===0&&r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"enable_response_post_process",checked:t.enable_response_post_process,onCheckedChange:R=>o({...t,enable_response_post_process:R})}),r.jsx(Q,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),t.enable_response_post_process&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"border-t pt-6 space-y-4",children:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[r.jsx(vt,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:R=>c({...n,enable:R})}),r.jsx(Q,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),r.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&r.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),r.jsx(Te,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:R=>c({...n,error_rate:parseFloat(R.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),r.jsx(Te,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:R=>c({...n,min_freq:parseInt(R.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),r.jsx(Te,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:R=>c({...n,tone_error_rate:parseFloat(R.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),r.jsx(Te,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:R=>c({...n,word_replace_rate:parseFloat(R.target.value)})})]})]})]})}),r.jsx("div",{className:"border-t pt-6 space-y-4",children:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[r.jsx(vt,{id:"enable_response_splitter",checked:a.enable,onCheckedChange:R=>d({...a,enable:R})}),r.jsx(Q,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),r.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),a.enable&&r.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),r.jsx(Te,{id:"max_length",type:"number",min:"1",value:a.max_length,onChange:R=>d({...a,max_length:parseInt(R.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),r.jsx(Te,{id:"max_sentence_num",type:"number",min:"1",value:a.max_sentence_num,onChange:R=>d({...a,max_sentence_num:parseInt(R.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"enable_kaomoji_protection",checked:a.enable_kaomoji_protection,onCheckedChange:R=>d({...a,enable_kaomoji_protection:R})}),r.jsx(Q,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"enable_overflow_return_all",checked:a.enable_overflow_return_all,onCheckedChange:R=>d({...a,enable_overflow_return_all:R})}),r.jsx(Q,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),r.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function WD({config:e,onChange:t}){return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{checked:e.enable_mood,onCheckedChange:n=>t({...e,enable_mood:n})}),r.jsx(Q,{className:"cursor-pointer",children:"启用情绪系统"})]}),e.enable_mood&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"情绪更新阈值"}),r.jsx(Te,{type:"number",min:"1",value:e.mood_update_threshold,onChange:n=>t({...e,mood_update_threshold:parseInt(n.target.value)})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"情感特征"}),r.jsx(fn,{value:e.emotion_style,onChange:n=>t({...e,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function XD({config:e,onChange:t}){return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{checked:e.enable_asr,onCheckedChange:n=>t({...e,enable_asr:n})}),r.jsx(Q,{className:"cursor-pointer",children:"启用语音识别"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function KD({config:e,onChange:t}){return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{checked:e.enable,onCheckedChange:n=>t({...e,enable:n})}),r.jsx(Q,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),e.enable&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"LPMM 模式"}),r.jsxs(_t,{value:e.lpmm_mode,onValueChange:n=>t({...e,lpmm_mode:n}),children:[r.jsx(jt,{children:r.jsx(Et,{placeholder:"选择 LPMM 模式"})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"classic",children:"经典模式"}),r.jsx(Oe,{value:"agent",children:"Agent 模式"})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"同义词搜索 TopK"}),r.jsx(Te,{type:"number",min:"1",value:e.rag_synonym_search_top_k,onChange:n=>t({...e,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"同义词阈值"}),r.jsx(Te,{type:"number",step:"0.1",min:"0",max:"1",value:e.rag_synonym_threshold,onChange:n=>t({...e,rag_synonym_threshold:parseFloat(n.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"实体提取线程数"}),r.jsx(Te,{type:"number",min:"1",value:e.info_extraction_workers,onChange:n=>t({...e,info_extraction_workers:parseInt(n.target.value)})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"嵌入向量维度"}),r.jsx(Te,{type:"number",min:"1",value:e.embedding_dimension,onChange:n=>t({...e,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function QD({config:e,onChange:t}){const[n,a]=w.useState(""),[l,o]=w.useState("WARNING"),c=()=>{n&&!e.suppress_libraries.includes(n)&&(t({...e,suppress_libraries:[...e.suppress_libraries,n]}),a(""))},d=b=>{t({...e,suppress_libraries:e.suppress_libraries.filter(N=>N!==b)})},m=()=>{n&&!e.library_log_levels[n]&&(t({...e,library_log_levels:{...e.library_log_levels,[n]:l}}),a(""),o("WARNING"))},f=b=>{const N={...e.library_log_levels};delete N[b],t({...e,library_log_levels:N})},p=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],x=["FULL","compact","lite"],y=["none","title","full"];return r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"日期格式"}),r.jsx(Te,{value:e.date_style,onChange:b=>t({...e,date_style:b.target.value}),placeholder:"例如: m-d H:i:s"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"日志级别样式"}),r.jsxs(_t,{value:e.log_level_style,onValueChange:b=>t({...e,log_level_style:b}),children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsx(Nt,{children:x.map(b=>r.jsx(Oe,{value:b,children:b},b))})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"日志文本颜色"}),r.jsxs(_t,{value:e.color_text,onValueChange:b=>t({...e,color_text:b}),children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsx(Nt,{children:y.map(b=>r.jsx(Oe,{value:b,children:b},b))})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"全局日志级别"}),r.jsxs(_t,{value:e.log_level,onValueChange:b=>t({...e,log_level:b}),children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsx(Nt,{children:p.map(b=>r.jsx(Oe,{value:b,children:b},b))})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"控制台日志级别"}),r.jsxs(_t,{value:e.console_log_level,onValueChange:b=>t({...e,console_log_level:b}),children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsx(Nt,{children:p.map(b=>r.jsx(Oe,{value:b,children:b},b))})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"文件日志级别"}),r.jsxs(_t,{value:e.file_log_level,onValueChange:b=>t({...e,file_log_level:b}),children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsx(Nt,{children:p.map(b=>r.jsx(Oe,{value:b,children:b},b))})]})]})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"mb-2 block",children:"完全屏蔽的库"}),r.jsxs("div",{className:"flex gap-2 mb-2",children:[r.jsx(Te,{value:n,onChange:b=>a(b.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),c())}}),r.jsx(ne,{onClick:c,size:"sm",className:"flex-shrink-0",children:r.jsx(pr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:e.suppress_libraries.map(b=>r.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[r.jsx("span",{className:"text-sm",children:b}),r.jsx(ne,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>d(b),children:r.jsx(zt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},b))})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"mb-2 block",children:"特定库的日志级别"}),r.jsxs("div",{className:"flex gap-2 mb-2",children:[r.jsx(Te,{value:n,onChange:b=>a(b.target.value),placeholder:"输入库名",className:"flex-1"}),r.jsxs(_t,{value:l,onValueChange:o,children:[r.jsx(jt,{className:"w-32",children:r.jsx(Et,{})}),r.jsx(Nt,{children:p.map(b=>r.jsx(Oe,{value:b,children:b},b))})]}),r.jsx(ne,{onClick:m,size:"sm",children:r.jsx(pr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),r.jsx("div",{className:"space-y-2",children:Object.entries(e.library_log_levels).map(([b,N])=>r.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[r.jsx("span",{className:"text-sm font-medium",children:b}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:N}),r.jsx(ne,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>f(b),children:r.jsx(zt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},b))})]})]})}function ZD({config:e,onChange:t}){return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Q,{children:"显示 Prompt"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),r.jsx(vt,{checked:e.show_prompt,onCheckedChange:n=>t({...e,show_prompt:n})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Q,{children:"显示回复器 Prompt"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),r.jsx(vt,{checked:e.show_replyer_prompt,onCheckedChange:n=>t({...e,show_replyer_prompt:n})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Q,{children:"显示回复器推理"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),r.jsx(vt,{checked:e.show_replyer_reasoning,onCheckedChange:n=>t({...e,show_replyer_reasoning:n})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Q,{children:"显示 Jargon Prompt"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),r.jsx(vt,{checked:e.show_jargon_prompt,onCheckedChange:n=>t({...e,show_jargon_prompt:n})})]})]})]})}function JD({config:e,onChange:t}){const[n,a]=w.useState(""),l=()=>{n&&!e.auth_token.includes(n)&&(t({...e,auth_token:[...e.auth_token,n]}),a(""))},o=c=>{t({...e,auth_token:e.auth_token.filter((d,m)=>m!==c)})};return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Q,{children:"启用自定义服务器"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),r.jsx(vt,{checked:e.use_custom,onCheckedChange:c=>t({...e,use_custom:c})})]}),e.use_custom&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"主机地址"}),r.jsx(Te,{value:e.host,onChange:c=>t({...e,host:c.target.value}),placeholder:"127.0.0.1"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"端口号"}),r.jsx(Te,{type:"number",value:e.port,onChange:c=>t({...e,port:parseInt(c.target.value)}),placeholder:"8090"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"连接模式"}),r.jsxs(_t,{value:e.mode,onValueChange:c=>t({...e,mode:c}),children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"ws",children:"WebSocket (ws)"}),r.jsx(Oe,{value:"tcp",children:"TCP"})]})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{checked:e.use_wss,onCheckedChange:c=>t({...e,use_wss:c}),disabled:e.mode!=="ws"}),r.jsx(Q,{children:"使用 WSS 安全连接"})]})]}),e.use_wss&&e.mode==="ws"&&r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"SSL 证书文件路径"}),r.jsx(Te,{value:e.cert_file,onChange:c=>t({...e,cert_file:c.target.value}),placeholder:"cert.pem"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"SSL 密钥文件路径"}),r.jsx(Te,{value:e.key_file,onChange:c=>t({...e,key_file:c.target.value}),placeholder:"key.pem"})]})]})]})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"mb-2 block",children:"认证令牌"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),r.jsxs("div",{className:"flex gap-2 mb-2",children:[r.jsx(Te,{value:n,onChange:c=>a(c.target.value),placeholder:"输入认证令牌",onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),l())}}),r.jsx(ne,{onClick:l,size:"sm",children:r.jsx(pr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),r.jsx("div",{className:"space-y-2",children:e.auth_token.map((c,d)=>r.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[r.jsx("span",{className:"text-sm font-mono",children:c}),r.jsx(ne,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>o(d),children:r.jsx(zt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},d))})]})]})}function ez({config:e,onChange:t}){return r.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Q,{children:"启用统计信息发送"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),r.jsx(vt,{checked:e.enable,onCheckedChange:n=>t({...e,enable:n})})]})]})}const ji=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{className:"relative w-full overflow-auto",children:r.jsx("table",{ref:n,className:he("w-full caption-bottom text-sm",e),...t})}));ji.displayName="Table";const Ni=w.forwardRef(({className:e,...t},n)=>r.jsx("thead",{ref:n,className:he("[&_tr]:border-b",e),...t}));Ni.displayName="TableHeader";const Si=w.forwardRef(({className:e,...t},n)=>r.jsx("tbody",{ref:n,className:he("[&_tr:last-child]:border-0",e),...t}));Si.displayName="TableBody";const tz=w.forwardRef(({className:e,...t},n)=>r.jsx("tfoot",{ref:n,className:he("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));tz.displayName="TableFooter";const Vn=w.forwardRef(({className:e,...t},n)=>r.jsx("tr",{ref:n,className:he("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Vn.displayName="TableRow";const ut=w.forwardRef(({className:e,...t},n)=>r.jsx("th",{ref:n,className:he("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));ut.displayName="TableHead";const et=w.forwardRef(({className:e,...t},n)=>r.jsx("td",{ref:n,className:he("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));et.displayName="TableCell";const nz=w.forwardRef(({className:e,...t},n)=>r.jsx("caption",{ref:n,className:he("mt-4 text-sm text-muted-foreground",e),...t}));nz.displayName="TableCaption";const jr=w.forwardRef(({className:e,...t},n)=>r.jsx(n6,{ref:n,className:he("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:r.jsx(oT,{className:he("grid place-content-center text-current"),children:r.jsx(mi,{className:"h-4 w-4"})})}));jr.displayName=n6.displayName;function rz(){const[e,t]=w.useState([]),[n,a]=w.useState(!0),[l,o]=w.useState(!1),[c,d]=w.useState(!1),[m,f]=w.useState(!1),[p,x]=w.useState(!1),[y,b]=w.useState(!1),[N,k]=w.useState(!1),[S,T]=w.useState(null),[M,A]=w.useState(null),[R,B]=w.useState(!1),[O,L]=w.useState(null),[$,U]=w.useState(!1),[I,G]=w.useState(""),[ee,Ne]=w.useState(new Set),[J,se]=w.useState(!1),[H,le]=w.useState(1),[re,ge]=w.useState(20),[E,we]=w.useState(""),{toast:Z}=or(),z=w.useRef(null),X=w.useRef(!0);w.useEffect(()=>{q()},[]);const q=async()=>{try{a(!0);const K=await zo();t(K.api_providers||[]),f(!1),X.current=!1}catch(K){console.error("加载配置失败:",K)}finally{a(!1)}},ce=async()=>{try{x(!0),U1().catch(()=>{}),b(!0)}catch(K){console.error("重启失败:",K),b(!1),Z({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),x(!1)}},fe=async()=>{try{o(!0),z.current&&clearTimeout(z.current);const K=await zo();K.api_providers=e,await om(K),f(!1),Z({title:"保存成功",description:"正在重启麦麦..."}),await ce()}catch(K){console.error("保存配置失败:",K),Z({title:"保存失败",description:K.message,variant:"destructive"}),o(!1)}},De=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},oe=()=>{b(!1),x(!1),Z({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},He=w.useCallback(async K=>{if(!X.current)try{d(!0),await Rx("api_providers",K),f(!1)}catch(be){console.error("自动保存失败:",be),f(!0)}finally{d(!1)}},[]);w.useEffect(()=>{if(!X.current)return f(!0),z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{He(e)},2e3),()=>{z.current&&clearTimeout(z.current)}},[e,He]);const at=async()=>{try{o(!0),z.current&&clearTimeout(z.current);const K=await zo();K.api_providers=e,await om(K),f(!1),Z({title:"保存成功",description:"模型提供商配置已保存"})}catch(K){console.error("保存配置失败:",K),Z({title:"保存失败",description:K.message,variant:"destructive"})}finally{o(!1)}},je=(K,be)=>{T(K||{name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),A(be),U(!1),k(!0)},Ze=async()=>{if(S?.api_key)try{await navigator.clipboard.writeText(S.api_key),Z({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{Z({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},qe=()=>{if(!S)return;const K={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};if(M!==null){const be=[...e];be[M]=K,t(be)}else t([...e,K]);k(!1),T(null),A(null)},Ot=K=>{if(!K&&S){const be={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};T(be)}k(K)},bn=K=>{L(K),B(!0)},Dn=()=>{if(O!==null){const K=e.filter((be,Re)=>Re!==O);t(K),Z({title:"删除成功",description:"提供商已从列表中移除"})}B(!1),L(null)},Xe=K=>{const be=new Set(ee);be.has(K)?be.delete(K):be.add(K),Ne(be)},wn=()=>{if(ee.size===Cn.length)Ne(new Set);else{const K=Cn.map((be,Re)=>e.findIndex(nt=>nt===Cn[Re]));Ne(new Set(K))}},Wn=()=>{if(ee.size===0){Z({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}se(!0)},Ar=()=>{const K=e.filter((be,Re)=>!ee.has(Re));t(K),Ne(new Set),se(!1),Z({title:"批量删除成功",description:`已删除 ${ee.size} 个提供商`})},Cn=e.filter(K=>{if(!I)return!0;const be=I.toLowerCase();return K.name.toLowerCase().includes(be)||K.base_url.toLowerCase().includes(be)||K.client_type.toLowerCase().includes(be)}),cr=Math.ceil(Cn.length/re),$e=Cn.slice((H-1)*re,H*re),Fn=()=>{const K=parseInt(E);K>=1&&K<=cr&&(le(K),we(""))};return n?r.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型提供商配置"}),r.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 API 提供商配置"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[ee.size>0&&r.jsxs(ne,{onClick:Wn,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[r.jsx(zt,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",ee.size,")"]}),r.jsxs(ne,{onClick:()=>je(null,null),size:"sm",className:"w-full sm:w-auto",children:[r.jsx(pr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),r.jsxs(ne,{onClick:at,disabled:l||c||!m||p,size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[r.jsx(Cm,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),l?"保存中...":c?"自动保存中...":m?"保存配置":"已保存"]}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsxs(ne,{disabled:l||c||p,size:"sm",className:"w-full sm:w-auto",children:[r.jsx(S1,{className:"mr-2 h-4 w-4"}),p?"重启中...":m?"保存并重启":"重启麦麦"]})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认重启麦麦?"}),r.jsx(Qt,{children:m?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:m?fe:ce,children:m?"保存并重启":"确认重启"})]})]})]})]})]}),r.jsxs(qu,{children:[r.jsx(pi,{className:"h-4 w-4"}),r.jsxs(Hu,{children:["配置更新后需要",r.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),r.jsxs(an,{className:"h-[calc(100vh-260px)]",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[r.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[r.jsx(Yr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{placeholder:"搜索提供商名称、URL 或类型...",value:I,onChange:K=>G(K.target.value),className:"pl-9"})]}),I&&r.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Cn.length," 个结果"]})]}),r.jsx("div",{className:"md:hidden space-y-3",children:Cn.length===0?r.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:I?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):$e.map((K,be)=>{const Re=e.findIndex(nt=>nt===K);return r.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold text-base truncate",children:K.name}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:K.base_url})]}),r.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>je(K,Re),children:[r.jsx(Bo,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),r.jsxs(ne,{size:"sm",onClick:()=>bn(Re),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(zt,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),r.jsx("p",{className:"font-medium",children:K.client_type})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),r.jsx("p",{className:"font-medium",children:K.max_retry})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),r.jsx("p",{className:"font-medium",children:K.timeout})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),r.jsx("p",{className:"font-medium",children:K.retry_interval})]})]})]},be)})}),r.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:r.jsxs(ji,{children:[r.jsx(Ni,{children:r.jsxs(Vn,{children:[r.jsx(ut,{className:"w-12",children:r.jsx(jr,{checked:ee.size===Cn.length&&Cn.length>0,onCheckedChange:wn})}),r.jsx(ut,{children:"名称"}),r.jsx(ut,{children:"基础URL"}),r.jsx(ut,{children:"客户端类型"}),r.jsx(ut,{className:"text-right",children:"最大重试"}),r.jsx(ut,{className:"text-right",children:"超时(秒)"}),r.jsx(ut,{className:"text-right",children:"重试间隔(秒)"}),r.jsx(ut,{className:"text-right",children:"操作"})]})}),r.jsx(Si,{children:$e.length===0?r.jsx(Vn,{children:r.jsx(et,{colSpan:8,className:"text-center text-muted-foreground py-8",children:I?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):$e.map((K,be)=>{const Re=e.findIndex(nt=>nt===K);return r.jsxs(Vn,{children:[r.jsx(et,{children:r.jsx(jr,{checked:ee.has(Re),onCheckedChange:()=>Xe(Re)})}),r.jsx(et,{className:"font-medium",children:K.name}),r.jsx(et,{className:"max-w-xs truncate",title:K.base_url,children:K.base_url}),r.jsx(et,{children:K.client_type}),r.jsx(et,{className:"text-right",children:K.max_retry}),r.jsx(et,{className:"text-right",children:K.timeout}),r.jsx(et,{className:"text-right",children:K.retry_interval}),r.jsx(et,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>je(K,Re),children:[r.jsx(Bo,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),r.jsxs(ne,{size:"sm",onClick:()=>bn(Re),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(zt,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},be)})})]})}),Cn.length>0&&r.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),r.jsxs(_t,{value:re.toString(),onValueChange:K=>{ge(parseInt(K)),le(1),Ne(new Set)},children:[r.jsx(jt,{id:"page-size-provider",className:"w-20",children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"10",children:"10"}),r.jsx(Oe,{value:"20",children:"20"}),r.jsx(Oe,{value:"50",children:"50"}),r.jsx(Oe,{value:"100",children:"100"})]})]}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(H-1)*re+1," 到"," ",Math.min(H*re,Cn.length)," 条,共 ",Cn.length," 条"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>le(1),disabled:H===1,className:"hidden sm:flex",children:r.jsx(Du,{className:"h-4 w-4"})}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>le(K=>Math.max(1,K-1)),disabled:H===1,children:[r.jsx(bi,{className:"h-4 w-4 sm:mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te,{type:"number",value:E,onChange:K=>we(K.target.value),onKeyDown:K=>K.key==="Enter"&&Fn(),placeholder:H.toString(),className:"w-16 h-8 text-center",min:1,max:cr}),r.jsx(ne,{variant:"outline",size:"sm",onClick:Fn,disabled:!E,className:"h-8",children:"跳转"})]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>le(K=>K+1),disabled:H>=cr,children:[r.jsx("span",{className:"hidden sm:inline",children:"下一页"}),r.jsx(wi,{className:"h-4 w-4 sm:ml-1"})]}),r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>le(cr),disabled:H>=cr,className:"hidden sm:flex",children:r.jsx(zu,{className:"h-4 w-4"})})]})]})]}),r.jsx(ir,{open:N,onOpenChange:Ot,children:r.jsxs(Jn,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(er,{children:[r.jsx(tr,{children:M!==null?"编辑提供商":"添加提供商"}),r.jsx(xr,{children:"配置 API 提供商的连接信息和参数"})]}),r.jsxs("div",{className:"grid gap-4 py-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"name",children:"名称 *"}),r.jsx(Te,{id:"name",value:S?.name||"",onChange:K=>T(be=>be?{...be,name:K.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"base_url",children:"基础 URL *"}),r.jsx(Te,{id:"base_url",value:S?.base_url||"",onChange:K=>T(be=>be?{...be,base_url:K.target.value}:null),placeholder:"https://api.example.com/v1"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"api_key",children:"API Key *"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{id:"api_key",type:$?"text":"password",value:S?.api_key||"",onChange:K=>T(be=>be?{...be,api_key:K.target.value}:null),placeholder:"sk-...",className:"flex-1"}),r.jsx(ne,{type:"button",variant:"outline",size:"icon",onClick:()=>U(!$),title:$?"隐藏密钥":"显示密钥",children:$?r.jsx(yx,{className:"h-4 w-4"}):r.jsx(Ha,{className:"h-4 w-4"})}),r.jsx(ne,{type:"button",variant:"outline",size:"icon",onClick:Ze,title:"复制密钥",children:r.jsx(vx,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"client_type",children:"客户端类型"}),r.jsxs(_t,{value:S?.client_type||"openai",onValueChange:K=>T(be=>be?{...be,client_type:K}:null),children:[r.jsx(jt,{id:"client_type",children:r.jsx(Et,{placeholder:"选择客户端类型"})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"openai",children:"OpenAI"}),r.jsx(Oe,{value:"gemini",children:"Gemini"})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"max_retry",children:"最大重试"}),r.jsx(Te,{id:"max_retry",type:"number",min:"0",value:S?.max_retry??"",onChange:K=>{const be=K.target.value===""?null:parseInt(K.target.value);T(Re=>Re?{...Re,max_retry:be}:null)},placeholder:"默认: 2"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"timeout",children:"超时(秒)"}),r.jsx(Te,{id:"timeout",type:"number",min:"1",value:S?.timeout??"",onChange:K=>{const be=K.target.value===""?null:parseInt(K.target.value);T(Re=>Re?{...Re,timeout:be}:null)},placeholder:"默认: 30"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),r.jsx(Te,{id:"retry_interval",type:"number",min:"1",value:S?.retry_interval??"",onChange:K=>{const be=K.target.value===""?null:parseInt(K.target.value);T(Re=>Re?{...Re,retry_interval:be}:null)},placeholder:"默认: 10"})]})]})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>k(!1),children:"取消"}),r.jsx(ne,{onClick:qe,children:"保存"})]})]})}),r.jsx(en,{open:R,onOpenChange:B,children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:['确定要删除提供商 "',O!==null?e[O]?.name:"",'" 吗? 此操作无法撤销。']})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:Dn,children:"删除"})]})]})}),r.jsx(en,{open:J,onOpenChange:se,children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认批量删除"}),r.jsxs(Qt,{children:["确定要删除选中的 ",ee.size," 个提供商吗? 此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:Ar,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),y&&r.jsx($1,{onRestartComplete:De,onRestartFailed:oe})]})}var zb=1,az=.9,sz=.8,lz=.17,Dp=.1,zp=.999,iz=.9999,oz=.99,cz=/[\\\/_+.#"@\[\(\{&]/,uz=/[\\\/_+.#"@\[\(\{&]/g,dz=/[\s-]/,Vj=/[\s-]/g;function Lx(e,t,n,a,l,o,c){if(o===t.length)return l===e.length?zb:oz;var d=`${l},${o}`;if(c[d]!==void 0)return c[d];for(var m=a.charAt(o),f=n.indexOf(m,l),p=0,x,y,b,N;f>=0;)x=Lx(e,t,n,a,f+1,o+1,c),x>p&&(f===l?x*=zb:cz.test(e.charAt(f-1))?(x*=sz,b=e.slice(l,f-1).match(uz),b&&l>0&&(x*=Math.pow(zp,b.length))):dz.test(e.charAt(f-1))?(x*=az,N=e.slice(l,f-1).match(Vj),N&&l>0&&(x*=Math.pow(zp,N.length))):(x*=lz,l>0&&(x*=Math.pow(zp,f-l))),e.charAt(f)!==t.charAt(o)&&(x*=iz)),(xx&&(x=y*Dp)),x>p&&(p=x),f=n.indexOf(m,f+1);return c[d]=p,p}function Ob(e){return e.toLowerCase().replace(Vj," ")}function mz(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Lx(e,t,Ob(e),Ob(t),0,0,{})}var hz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Rl=hz.reduce((e,t)=>{const n=f1(`Primitive.${t}`),a=w.forwardRef((l,o)=>{const{asChild:c,...d}=l,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(m,{...d,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),Jc='[cmdk-group=""]',Op='[cmdk-group-items=""]',fz='[cmdk-group-heading=""]',Gj='[cmdk-item=""]',Rb=`${Gj}:not([aria-disabled="true"])`,Bx="cmdk-item-select",Co="data-value",pz=(e,t,n)=>mz(e,t,n),Yj=w.createContext(void 0),Uu=()=>w.useContext(Yj),Wj=w.createContext(void 0),V1=()=>w.useContext(Wj),Xj=w.createContext(void 0),Kj=w.forwardRef((e,t)=>{let n=To(()=>{var Z,z;return{search:"",value:(z=(Z=e.value)!=null?Z:e.defaultValue)!=null?z:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=To(()=>new Set),l=To(()=>new Map),o=To(()=>new Map),c=To(()=>new Set),d=Qj(e),{label:m,children:f,value:p,onValueChange:x,filter:y,shouldFilter:b,loop:N,disablePointerSelection:k=!1,vimBindings:S=!0,...T}=e,M=Ta(),A=Ta(),R=Ta(),B=w.useRef(null),O=Cz();vi(()=>{if(p!==void 0){let Z=p.trim();n.current.value=Z,L.emit()}},[p]),vi(()=>{O(6,Ne)},[]);let L=w.useMemo(()=>({subscribe:Z=>(c.current.add(Z),()=>c.current.delete(Z)),snapshot:()=>n.current,setState:(Z,z,X)=>{var q,ce,fe,De;if(!Object.is(n.current[Z],z)){if(n.current[Z]=z,Z==="search")ee(),I(),O(1,G);else if(Z==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let oe=document.getElementById(R);oe?oe.focus():(q=document.getElementById(M))==null||q.focus()}if(O(7,()=>{var oe;n.current.selectedItemId=(oe=J())==null?void 0:oe.id,L.emit()}),X||O(5,Ne),((ce=d.current)==null?void 0:ce.value)!==void 0){let oe=z??"";(De=(fe=d.current).onValueChange)==null||De.call(fe,oe);return}}L.emit()}},emit:()=>{c.current.forEach(Z=>Z())}}),[]),$=w.useMemo(()=>({value:(Z,z,X)=>{var q;z!==((q=o.current.get(Z))==null?void 0:q.value)&&(o.current.set(Z,{value:z,keywords:X}),n.current.filtered.items.set(Z,U(z,X)),O(2,()=>{I(),L.emit()}))},item:(Z,z)=>(a.current.add(Z),z&&(l.current.has(z)?l.current.get(z).add(Z):l.current.set(z,new Set([Z]))),O(3,()=>{ee(),I(),n.current.value||G(),L.emit()}),()=>{o.current.delete(Z),a.current.delete(Z),n.current.filtered.items.delete(Z);let X=J();O(4,()=>{ee(),X?.getAttribute("id")===Z&&G(),L.emit()})}),group:Z=>(l.current.has(Z)||l.current.set(Z,new Set),()=>{o.current.delete(Z),l.current.delete(Z)}),filter:()=>d.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:M,inputId:R,labelId:A,listInnerRef:B}),[]);function U(Z,z){var X,q;let ce=(q=(X=d.current)==null?void 0:X.filter)!=null?q:pz;return Z?ce(Z,n.current.search,z):0}function I(){if(!n.current.search||d.current.shouldFilter===!1)return;let Z=n.current.filtered.items,z=[];n.current.filtered.groups.forEach(q=>{let ce=l.current.get(q),fe=0;ce.forEach(De=>{let oe=Z.get(De);fe=Math.max(oe,fe)}),z.push([q,fe])});let X=B.current;se().sort((q,ce)=>{var fe,De;let oe=q.getAttribute("id"),He=ce.getAttribute("id");return((fe=Z.get(He))!=null?fe:0)-((De=Z.get(oe))!=null?De:0)}).forEach(q=>{let ce=q.closest(Op);ce?ce.appendChild(q.parentElement===ce?q:q.closest(`${Op} > *`)):X.appendChild(q.parentElement===X?q:q.closest(`${Op} > *`))}),z.sort((q,ce)=>ce[1]-q[1]).forEach(q=>{var ce;let fe=(ce=B.current)==null?void 0:ce.querySelector(`${Jc}[${Co}="${encodeURIComponent(q[0])}"]`);fe?.parentElement.appendChild(fe)})}function G(){let Z=se().find(X=>X.getAttribute("aria-disabled")!=="true"),z=Z?.getAttribute(Co);L.setState("value",z||void 0)}function ee(){var Z,z,X,q;if(!n.current.search||d.current.shouldFilter===!1){n.current.filtered.count=a.current.size;return}n.current.filtered.groups=new Set;let ce=0;for(let fe of a.current){let De=(z=(Z=o.current.get(fe))==null?void 0:Z.value)!=null?z:"",oe=(q=(X=o.current.get(fe))==null?void 0:X.keywords)!=null?q:[],He=U(De,oe);n.current.filtered.items.set(fe,He),He>0&&ce++}for(let[fe,De]of l.current)for(let oe of De)if(n.current.filtered.items.get(oe)>0){n.current.filtered.groups.add(fe);break}n.current.filtered.count=ce}function Ne(){var Z,z,X;let q=J();q&&(((Z=q.parentElement)==null?void 0:Z.firstChild)===q&&((X=(z=q.closest(Jc))==null?void 0:z.querySelector(fz))==null||X.scrollIntoView({block:"nearest"})),q.scrollIntoView({block:"nearest"}))}function J(){var Z;return(Z=B.current)==null?void 0:Z.querySelector(`${Gj}[aria-selected="true"]`)}function se(){var Z;return Array.from(((Z=B.current)==null?void 0:Z.querySelectorAll(Rb))||[])}function H(Z){let z=se()[Z];z&&L.setState("value",z.getAttribute(Co))}function le(Z){var z;let X=J(),q=se(),ce=q.findIndex(De=>De===X),fe=q[ce+Z];(z=d.current)!=null&&z.loop&&(fe=ce+Z<0?q[q.length-1]:ce+Z===q.length?q[0]:q[ce+Z]),fe&&L.setState("value",fe.getAttribute(Co))}function re(Z){let z=J(),X=z?.closest(Jc),q;for(;X&&!q;)X=Z>0?Sz(X,Jc):kz(X,Jc),q=X?.querySelector(Rb);q?L.setState("value",q.getAttribute(Co)):le(Z)}let ge=()=>H(se().length-1),E=Z=>{Z.preventDefault(),Z.metaKey?ge():Z.altKey?re(1):le(1)},we=Z=>{Z.preventDefault(),Z.metaKey?H(0):Z.altKey?re(-1):le(-1)};return w.createElement(Rl.div,{ref:t,tabIndex:-1,...T,"cmdk-root":"",onKeyDown:Z=>{var z;(z=T.onKeyDown)==null||z.call(T,Z);let X=Z.nativeEvent.isComposing||Z.keyCode===229;if(!(Z.defaultPrevented||X))switch(Z.key){case"n":case"j":{S&&Z.ctrlKey&&E(Z);break}case"ArrowDown":{E(Z);break}case"p":case"k":{S&&Z.ctrlKey&&we(Z);break}case"ArrowUp":{we(Z);break}case"Home":{Z.preventDefault(),H(0);break}case"End":{Z.preventDefault(),ge();break}case"Enter":{Z.preventDefault();let q=J();if(q){let ce=new Event(Bx);q.dispatchEvent(ce)}}}}},w.createElement("label",{"cmdk-label":"",htmlFor:$.inputId,id:$.labelId,style:_z},m),Im(e,Z=>w.createElement(Wj.Provider,{value:L},w.createElement(Yj.Provider,{value:$},Z))))}),xz=w.forwardRef((e,t)=>{var n,a;let l=Ta(),o=w.useRef(null),c=w.useContext(Xj),d=Uu(),m=Qj(e),f=(a=(n=m.current)==null?void 0:n.forceMount)!=null?a:c?.forceMount;vi(()=>{if(!f)return d.item(l,c?.id)},[f]);let p=Zj(l,o,[e.value,e.children,o],e.keywords),x=V1(),y=_l(O=>O.value&&O.value===p.current),b=_l(O=>f||d.filter()===!1?!0:O.search?O.filtered.items.get(l)>0:!0);w.useEffect(()=>{let O=o.current;if(!(!O||e.disabled))return O.addEventListener(Bx,N),()=>O.removeEventListener(Bx,N)},[b,e.onSelect,e.disabled]);function N(){var O,L;k(),(L=(O=m.current).onSelect)==null||L.call(O,p.current)}function k(){x.setState("value",p.current,!0)}if(!b)return null;let{disabled:S,value:T,onSelect:M,forceMount:A,keywords:R,...B}=e;return w.createElement(Rl.div,{ref:Sl(o,t),...B,id:l,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!y,"data-disabled":!!S,"data-selected":!!y,onPointerMove:S||d.getDisablePointerSelection()?void 0:k,onClick:S?void 0:N},e.children)}),gz=w.forwardRef((e,t)=>{let{heading:n,children:a,forceMount:l,...o}=e,c=Ta(),d=w.useRef(null),m=w.useRef(null),f=Ta(),p=Uu(),x=_l(b=>l||p.filter()===!1?!0:b.search?b.filtered.groups.has(c):!0);vi(()=>p.group(c),[]),Zj(c,d,[e.value,e.heading,m]);let y=w.useMemo(()=>({id:c,forceMount:l}),[l]);return w.createElement(Rl.div,{ref:Sl(d,t),...o,"cmdk-group":"",role:"presentation",hidden:x?void 0:!0},n&&w.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),Im(e,b=>w.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},w.createElement(Xj.Provider,{value:y},b))))}),vz=w.forwardRef((e,t)=>{let{alwaysRender:n,...a}=e,l=w.useRef(null),o=_l(c=>!c.search);return!n&&!o?null:w.createElement(Rl.div,{ref:Sl(l,t),...a,"cmdk-separator":"",role:"separator"})}),yz=w.forwardRef((e,t)=>{let{onValueChange:n,...a}=e,l=e.value!=null,o=V1(),c=_l(f=>f.search),d=_l(f=>f.selectedItemId),m=Uu();return w.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),w.createElement(Rl.input,{ref:t,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":d,id:m.inputId,type:"text",value:l?e.value:c,onChange:f=>{l||o.setState("search",f.target.value),n?.(f.target.value)}})}),bz=w.forwardRef((e,t)=>{let{children:n,label:a="Suggestions",...l}=e,o=w.useRef(null),c=w.useRef(null),d=_l(f=>f.selectedItemId),m=Uu();return w.useEffect(()=>{if(c.current&&o.current){let f=c.current,p=o.current,x,y=new ResizeObserver(()=>{x=requestAnimationFrame(()=>{let b=f.offsetHeight;p.style.setProperty("--cmdk-list-height",b.toFixed(1)+"px")})});return y.observe(f),()=>{cancelAnimationFrame(x),y.unobserve(f)}}},[]),w.createElement(Rl.div,{ref:Sl(o,t),...l,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":a,id:m.listId},Im(e,f=>w.createElement("div",{ref:Sl(c,m.listInnerRef),"cmdk-list-sizer":""},f)))}),wz=w.forwardRef((e,t)=>{let{open:n,onOpenChange:a,overlayClassName:l,contentClassName:o,container:c,...d}=e;return w.createElement(y1,{open:n,onOpenChange:a},w.createElement(p1,{container:c},w.createElement(wm,{"cmdk-overlay":"",className:l}),w.createElement(jm,{"aria-label":e.label,"cmdk-dialog":"",className:o},w.createElement(Kj,{ref:t,...d}))))}),jz=w.forwardRef((e,t)=>_l(n=>n.filtered.count===0)?w.createElement(Rl.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Nz=w.forwardRef((e,t)=>{let{progress:n,children:a,label:l="Loading...",...o}=e;return w.createElement(Rl.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":l},Im(e,c=>w.createElement("div",{"aria-hidden":!0},c)))}),Xr=Object.assign(Kj,{List:bz,Item:xz,Input:yz,Group:gz,Separator:vz,Dialog:wz,Empty:jz,Loading:Nz});function Sz(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function kz(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Qj(e){let t=w.useRef(e);return vi(()=>{t.current=e}),t}var vi=typeof window>"u"?w.useEffect:w.useLayoutEffect;function To(e){let t=w.useRef();return t.current===void 0&&(t.current=e()),t}function _l(e){let t=V1(),n=()=>e(t.snapshot());return w.useSyncExternalStore(t.subscribe,n,n)}function Zj(e,t,n,a=[]){let l=w.useRef(),o=Uu();return vi(()=>{var c;let d=(()=>{var f;for(let p of n){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(f=p.current.textContent)==null?void 0:f.trim():l.current}})(),m=a.map(f=>f.trim());o.value(e,d,m),(c=t.current)==null||c.setAttribute(Co,d),l.current=d}),l}var Cz=()=>{let[e,t]=w.useState(),n=To(()=>new Map);return vi(()=>{n.current.forEach(a=>a()),n.current=new Map},[e]),(a,l)=>{n.current.set(a,l),t({})}};function Tz(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Im({asChild:e,children:t},n){return e&&w.isValidElement(t)?w.cloneElement(Tz(t),{ref:t.ref},n(t.props.children)):n(t)}var _z={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Jj=w.forwardRef(({className:e,...t},n)=>r.jsx(Xr,{ref:n,className:he("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Jj.displayName=Xr.displayName;const e7=w.forwardRef(({className:e,...t},n)=>r.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[r.jsx(Yr,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),r.jsx(Xr.Input,{ref:n,className:he("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));e7.displayName=Xr.Input.displayName;const t7=w.forwardRef(({className:e,...t},n)=>r.jsx(Xr.List,{ref:n,className:he("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));t7.displayName=Xr.List.displayName;const n7=w.forwardRef((e,t)=>r.jsx(Xr.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));n7.displayName=Xr.Empty.displayName;const r7=w.forwardRef(({className:e,...t},n)=>r.jsx(Xr.Group,{ref:n,className:he("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));r7.displayName=Xr.Group.displayName;const Ez=w.forwardRef(({className:e,...t},n)=>r.jsx(Xr.Separator,{ref:n,className:he("-mx-1 h-px bg-border",e),...t}));Ez.displayName=Xr.Separator.displayName;const a7=w.forwardRef(({className:e,...t},n)=>r.jsx(Xr.Item,{ref:n,className:he("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));a7.displayName=Xr.Item.displayName;function Mz({options:e,selected:t,onChange:n,placeholder:a="选择选项...",emptyText:l="未找到选项",className:o}){const[c,d]=w.useState(!1),m=p=>{t.includes(p)?n(t.filter(x=>x!==p)):n([...t,p])},f=p=>{n(t.filter(x=>x!==p))};return r.jsxs(Cl,{open:c,onOpenChange:d,children:[r.jsx(Tl,{asChild:!0,children:r.jsxs(ne,{variant:"outline",role:"combobox","aria-expanded":c,className:he("w-full justify-between min-h-10 h-auto",o),children:[r.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:t.length===0?r.jsx("span",{className:"text-muted-foreground",children:a}):t.map(p=>{const x=e.find(y=>y.value===p);return r.jsxs(un,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80",onClick:y=>{y.stopPropagation(),f(p)},children:[x?.label||p,r.jsx(Au,{className:"ml-1 h-3 w-3",strokeWidth:2,fill:"none"})]},p)})}),r.jsx(kT,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),r.jsx(Ps,{className:"w-full p-0",align:"start",children:r.jsxs(Jj,{children:[r.jsx(e7,{placeholder:"搜索...",className:"h-9"}),r.jsxs(t7,{children:[r.jsx(n7,{children:l}),r.jsx(r7,{children:e.map(p=>{const x=t.includes(p.value);return r.jsxs(a7,{value:p.value,onSelect:()=>m(p.value),children:[r.jsx("div",{className:he("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",x?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:r.jsx(mi,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),r.jsx("span",{children:p.label})]},p.value)})})]})]})})]})}function Az(){const[e,t]=w.useState([]),[n,a]=w.useState([]),[l,o]=w.useState([]),[c,d]=w.useState(null),[m,f]=w.useState(!0),[p,x]=w.useState(!1),[y,b]=w.useState(!1),[N,k]=w.useState(!1),[S,T]=w.useState(!1),[M,A]=w.useState(!1),[R,B]=w.useState(!1),[O,L]=w.useState(null),[$,U]=w.useState(null),[I,G]=w.useState(!1),[ee,Ne]=w.useState(null),[J,se]=w.useState(""),[H,le]=w.useState(new Set),[re,ge]=w.useState(!1),[E,we]=w.useState(1),[Z,z]=w.useState(20),[X,q]=w.useState(""),{toast:ce}=or(),fe=w.useRef(null),De=w.useRef(null),oe=w.useRef(!0);w.useEffect(()=>{He()},[]);const He=async()=>{try{f(!0);const pe=await zo(),Ee=pe.models||[];t(Ee),o(Ee.map(mt=>mt.name));const dt=pe.api_providers||[];a(dt.map(mt=>mt.name)),d(pe.model_task_config||null),k(!1),oe.current=!1}catch(pe){console.error("加载配置失败:",pe)}finally{f(!1)}},at=async()=>{try{T(!0),U1().catch(()=>{}),A(!0)}catch(pe){console.error("重启失败:",pe),A(!1),ce({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),T(!1)}},je=async()=>{try{x(!0),fe.current&&clearTimeout(fe.current),De.current&&clearTimeout(De.current);const pe=await zo();pe.models=e,pe.model_task_config=c,await om(pe),k(!1),ce({title:"保存成功",description:"正在重启麦麦..."}),await at()}catch(pe){console.error("保存配置失败:",pe),ce({title:"保存失败",description:pe.message,variant:"destructive"}),x(!1)}},Ze=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},qe=()=>{A(!1),T(!1),ce({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Ot=w.useCallback(async pe=>{if(!oe.current)try{b(!0),await Rx("models",pe),k(!1)}catch(Ee){console.error("自动保存模型列表失败:",Ee),k(!0)}finally{b(!1)}},[]),bn=w.useCallback(async pe=>{if(!oe.current)try{b(!0),await Rx("model_task_config",pe),k(!1)}catch(Ee){console.error("自动保存任务配置失败:",Ee),k(!0)}finally{b(!1)}},[]);w.useEffect(()=>{if(!oe.current)return k(!0),fe.current&&clearTimeout(fe.current),fe.current=setTimeout(()=>{Ot(e)},2e3),()=>{fe.current&&clearTimeout(fe.current)}},[e,Ot]),w.useEffect(()=>{if(!(oe.current||!c))return k(!0),De.current&&clearTimeout(De.current),De.current=setTimeout(()=>{bn(c)},2e3),()=>{De.current&&clearTimeout(De.current)}},[c,bn]);const Dn=async()=>{try{x(!0),fe.current&&clearTimeout(fe.current),De.current&&clearTimeout(De.current);const pe=await zo();pe.models=e,pe.model_task_config=c,await om(pe),k(!1),ce({title:"保存成功",description:"模型配置已保存"}),await He()}catch(pe){console.error("保存配置失败:",pe),ce({title:"保存失败",description:pe.message,variant:"destructive"})}finally{x(!1)}},Xe=(pe,Ee)=>{L(pe||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),U(Ee),B(!0)},wn=()=>{if(!O)return;const pe={...O,price_in:O.price_in??0,price_out:O.price_out??0};let Ee;$!==null?(Ee=[...e],Ee[$]=pe):Ee=[...e,pe],t(Ee),o(Ee.map(dt=>dt.name)),B(!1),L(null),U(null)},Wn=pe=>{if(!pe&&O){const Ee={...O,price_in:O.price_in??0,price_out:O.price_out??0};L(Ee)}B(pe)},Ar=pe=>{Ne(pe),G(!0)},Cn=()=>{if(ee!==null){const pe=e.filter((Ee,dt)=>dt!==ee);t(pe),o(pe.map(Ee=>Ee.name)),ce({title:"删除成功",description:"模型已从列表中移除"})}G(!1),Ne(null)},cr=pe=>{const Ee=new Set(H);Ee.has(pe)?Ee.delete(pe):Ee.add(pe),le(Ee)},$e=()=>{if(H.size===Re.length)le(new Set);else{const pe=Re.map((Ee,dt)=>e.findIndex(mt=>mt===Re[dt]));le(new Set(pe))}},Fn=()=>{if(H.size===0){ce({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ge(!0)},K=()=>{const pe=e.filter((Ee,dt)=>!H.has(dt));t(pe),o(pe.map(Ee=>Ee.name)),le(new Set),ge(!1),ce({title:"批量删除成功",description:`已删除 ${H.size} 个模型`})},be=(pe,Ee,dt)=>{c&&d({...c,[pe]:{...c[pe],[Ee]:dt}})},Re=e.filter(pe=>{if(!J)return!0;const Ee=J.toLowerCase();return pe.name.toLowerCase().includes(Ee)||pe.model_identifier.toLowerCase().includes(Ee)||pe.api_provider.toLowerCase().includes(Ee)}),nt=Math.ceil(Re.length/Z),kt=Re.slice((E-1)*Z,E*Z),rr=()=>{const pe=parseInt(X);pe>=1&&pe<=nt&&(we(pe),q(""))},Dr=pe=>c?[c.utils?.model_list||[],c.utils_small?.model_list||[],c.tool_use?.model_list||[],c.replyer?.model_list||[],c.planner?.model_list||[],c.vlm?.model_list||[],c.voice?.model_list||[],c.embedding?.model_list||[],c.lpmm_entity_extract?.model_list||[],c.lpmm_rdf_build?.model_list||[],c.lpmm_qa?.model_list||[]].some(dt=>dt.includes(pe)):!1;return m?r.jsx(an,{className:"h-full",children:r.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):r.jsx(an,{className:"h-full",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型配置"}),r.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理模型和任务配置"})]}),r.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[r.jsxs(ne,{onClick:Dn,disabled:p||y||!N||S,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[r.jsx(Cm,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),p?"保存中...":y?"自动保存中...":N?"保存配置":"已保存"]}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsxs(ne,{disabled:p||y||S,size:"sm",className:"flex-1 sm:flex-none",children:[r.jsx(S1,{className:"mr-2 h-4 w-4"}),S?"重启中...":N?"保存并重启":"重启麦麦"]})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认重启麦麦?"}),r.jsx(Qt,{children:N?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:N?je:at,children:N?"保存并重启":"确认重启"})]})]})]})]})]}),r.jsxs(qu,{children:[r.jsx(pi,{className:"h-4 w-4"}),r.jsxs(Hu,{children:["配置更新后需要",r.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),r.jsxs(kl,{defaultValue:"models",className:"w-full",children:[r.jsxs(Bs,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[r.jsx(Pt,{value:"models",children:"模型配置"}),r.jsx(Pt,{value:"tasks",children:"模型任务配置"})]}),r.jsxs(cn,{value:"models",className:"space-y-4 mt-0",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),r.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[H.size>0&&r.jsxs(ne,{onClick:Fn,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[r.jsx(zt,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",H.size,")"]}),r.jsxs(ne,{onClick:()=>Xe(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[r.jsx(pr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[r.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[r.jsx(Yr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{placeholder:"搜索模型名称、标识符或提供商...",value:J,onChange:pe=>se(pe.target.value),className:"pl-9"})]}),J&&r.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Re.length," 个结果"]})]}),r.jsx("div",{className:"md:hidden space-y-3",children:kt.length===0?r.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:J?"未找到匹配的模型":"暂无模型配置"}):kt.map((pe,Ee)=>{const dt=e.findIndex(zr=>zr===pe),mt=Dr(pe.name);return r.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-base",children:pe.name}),r.jsx(un,{variant:mt?"default":"secondary",className:mt?"bg-green-600 hover:bg-green-700":"",children:mt?"已使用":"未使用"})]}),r.jsx("p",{className:"text-xs text-muted-foreground break-all",title:pe.model_identifier,children:pe.model_identifier})]}),r.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>Xe(pe,dt),children:[r.jsx(Bo,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),r.jsxs(ne,{size:"sm",onClick:()=>Ar(dt),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(zt,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),r.jsx("p",{className:"font-medium",children:pe.api_provider})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),r.jsx("p",{className:"font-medium",children:pe.force_stream_mode?"是":"否"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),r.jsxs("p",{className:"font-medium",children:["¥",pe.price_in,"/M"]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),r.jsxs("p",{className:"font-medium",children:["¥",pe.price_out,"/M"]})]})]})]},Ee)})}),r.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:r.jsxs(ji,{children:[r.jsx(Ni,{children:r.jsxs(Vn,{children:[r.jsx(ut,{className:"w-12",children:r.jsx(jr,{checked:H.size===Re.length&&Re.length>0,onCheckedChange:$e})}),r.jsx(ut,{className:"w-24",children:"使用状态"}),r.jsx(ut,{children:"模型名称"}),r.jsx(ut,{children:"模型标识符"}),r.jsx(ut,{children:"提供商"}),r.jsx(ut,{className:"text-right",children:"输入价格"}),r.jsx(ut,{className:"text-right",children:"输出价格"}),r.jsx(ut,{className:"text-center",children:"强制流式"}),r.jsx(ut,{className:"text-right",children:"操作"})]})}),r.jsx(Si,{children:kt.length===0?r.jsx(Vn,{children:r.jsx(et,{colSpan:9,className:"text-center text-muted-foreground py-8",children:J?"未找到匹配的模型":"暂无模型配置"})}):kt.map((pe,Ee)=>{const dt=e.findIndex(zr=>zr===pe),mt=Dr(pe.name);return r.jsxs(Vn,{children:[r.jsx(et,{children:r.jsx(jr,{checked:H.has(dt),onCheckedChange:()=>cr(dt)})}),r.jsx(et,{children:r.jsx(un,{variant:mt?"default":"secondary",className:mt?"bg-green-600 hover:bg-green-700":"",children:mt?"已使用":"未使用"})}),r.jsx(et,{className:"font-medium",children:pe.name}),r.jsx(et,{className:"max-w-xs truncate",title:pe.model_identifier,children:pe.model_identifier}),r.jsx(et,{children:pe.api_provider}),r.jsxs(et,{className:"text-right",children:["¥",pe.price_in,"/M"]}),r.jsxs(et,{className:"text-right",children:["¥",pe.price_out,"/M"]}),r.jsx(et,{className:"text-center",children:pe.force_stream_mode?"是":"否"}),r.jsx(et,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>Xe(pe,dt),children:[r.jsx(Bo,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),r.jsxs(ne,{size:"sm",onClick:()=>Ar(dt),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(zt,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Ee)})})]})}),Re.length>0&&r.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),r.jsxs(_t,{value:Z.toString(),onValueChange:pe=>{z(parseInt(pe)),we(1),le(new Set)},children:[r.jsx(jt,{id:"page-size-model",className:"w-20",children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"10",children:"10"}),r.jsx(Oe,{value:"20",children:"20"}),r.jsx(Oe,{value:"50",children:"50"}),r.jsx(Oe,{value:"100",children:"100"})]})]}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(E-1)*Z+1," 到"," ",Math.min(E*Z,Re.length)," 条,共 ",Re.length," 条"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>we(1),disabled:E===1,className:"hidden sm:flex",children:r.jsx(Du,{className:"h-4 w-4"})}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>we(pe=>Math.max(1,pe-1)),disabled:E===1,children:[r.jsx(bi,{className:"h-4 w-4 sm:mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te,{type:"number",value:X,onChange:pe=>q(pe.target.value),onKeyDown:pe=>pe.key==="Enter"&&rr(),placeholder:E.toString(),className:"w-16 h-8 text-center",min:1,max:nt}),r.jsx(ne,{variant:"outline",size:"sm",onClick:rr,disabled:!X,className:"h-8",children:"跳转"})]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>we(pe=>pe+1),disabled:E>=nt,children:[r.jsx("span",{className:"hidden sm:inline",children:"下一页"}),r.jsx(wi,{className:"h-4 w-4 sm:ml-1"})]}),r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>we(nt),disabled:E>=nt,className:"hidden sm:flex",children:r.jsx(zu,{className:"h-4 w-4"})})]})]})]}),r.jsxs(cn,{value:"tasks",className:"space-y-6 mt-0",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),c&&r.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[r.jsx(Ra,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:c.utils,modelNames:l,onChange:(pe,Ee)=>be("utils",pe,Ee)}),r.jsx(Ra,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:c.utils_small,modelNames:l,onChange:(pe,Ee)=>be("utils_small",pe,Ee)}),r.jsx(Ra,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:c.tool_use,modelNames:l,onChange:(pe,Ee)=>be("tool_use",pe,Ee)}),r.jsx(Ra,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:c.replyer,modelNames:l,onChange:(pe,Ee)=>be("replyer",pe,Ee)}),r.jsx(Ra,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:c.planner,modelNames:l,onChange:(pe,Ee)=>be("planner",pe,Ee)}),r.jsx(Ra,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:c.vlm,modelNames:l,onChange:(pe,Ee)=>be("vlm",pe,Ee),hideTemperature:!0}),r.jsx(Ra,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:c.voice,modelNames:l,onChange:(pe,Ee)=>be("voice",pe,Ee),hideTemperature:!0,hideMaxTokens:!0}),r.jsx(Ra,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:c.embedding,modelNames:l,onChange:(pe,Ee)=>be("embedding",pe,Ee),hideTemperature:!0,hideMaxTokens:!0}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),r.jsx(Ra,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:c.lpmm_entity_extract,modelNames:l,onChange:(pe,Ee)=>be("lpmm_entity_extract",pe,Ee)}),r.jsx(Ra,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:c.lpmm_rdf_build,modelNames:l,onChange:(pe,Ee)=>be("lpmm_rdf_build",pe,Ee)}),r.jsx(Ra,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:c.lpmm_qa,modelNames:l,onChange:(pe,Ee)=>be("lpmm_qa",pe,Ee)})]})]})]})]}),r.jsx(ir,{open:R,onOpenChange:Wn,children:r.jsxs(Jn,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(er,{children:[r.jsx(tr,{children:$!==null?"编辑模型":"添加模型"}),r.jsx(xr,{children:"配置模型的基本信息和参数"})]}),r.jsxs("div",{className:"grid gap-4 py-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"model_name",children:"模型名称 *"}),r.jsx(Te,{id:"model_name",value:O?.name||"",onChange:pe=>L(Ee=>Ee?{...Ee,name:pe.target.value}:null),placeholder:"例如: qwen3-30b"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"model_identifier",children:"模型标识符 *"}),r.jsx(Te,{id:"model_identifier",value:O?.model_identifier||"",onChange:pe=>L(Ee=>Ee?{...Ee,model_identifier:pe.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"API 提供商提供的模型 ID"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"api_provider",children:"API 提供商 *"}),r.jsxs(_t,{value:O?.api_provider||"",onValueChange:pe=>L(Ee=>Ee?{...Ee,api_provider:pe}:null),children:[r.jsx(jt,{id:"api_provider",children:r.jsx(Et,{placeholder:"选择提供商"})}),r.jsx(Nt,{children:n.map(pe=>r.jsx(Oe,{value:pe,children:pe},pe))})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),r.jsx(Te,{id:"price_in",type:"number",step:"0.1",min:"0",value:O?.price_in??"",onChange:pe=>{const Ee=pe.target.value===""?null:parseFloat(pe.target.value);L(dt=>dt?{...dt,price_in:Ee}:null)},placeholder:"默认: 0"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),r.jsx(Te,{id:"price_out",type:"number",step:"0.1",min:"0",value:O?.price_out??"",onChange:pe=>{const Ee=pe.target.value===""?null:parseFloat(pe.target.value);L(dt=>dt?{...dt,price_out:Ee}:null)},placeholder:"默认: 0"})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"force_stream_mode",checked:O?.force_stream_mode||!1,onCheckedChange:pe=>L(Ee=>Ee?{...Ee,force_stream_mode:pe}:null)}),r.jsx(Q,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>B(!1),children:"取消"}),r.jsx(ne,{onClick:wn,children:"保存"})]})]})}),r.jsx(en,{open:I,onOpenChange:G,children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:['确定要删除模型 "',ee!==null?e[ee]?.name:"",'" 吗? 此操作无法撤销。']})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:Cn,children:"删除"})]})]})}),r.jsx(en,{open:re,onOpenChange:ge,children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认批量删除"}),r.jsxs(Qt,{children:["确定要删除选中的 ",H.size," 个模型吗? 此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:K,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),M&&r.jsx($1,{onRestartComplete:Ze,onRestartFailed:qe})]})})}function Ra({title:e,description:t,taskConfig:n,modelNames:a,onChange:l,hideTemperature:o=!1,hideMaxTokens:c=!1}){const d=m=>{l("model_list",m)};return r.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:e}),r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:t})]}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"模型列表"}),r.jsx(Mz,{options:a.map(m=>({label:m,value:m})),selected:n.model_list||[],onChange:d,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!o&&r.jsxs("div",{className:"grid gap-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Q,{children:"温度"}),r.jsx(Te,{type:"number",step:"0.1",min:"0",max:"1",value:n.temperature??.3,onChange:m=>{const f=parseFloat(m.target.value);!isNaN(f)&&f>=0&&f<=1&&l("temperature",f)},className:"w-20 h-8 text-sm"})]}),r.jsx(Pm,{value:[n.temperature??.3],onValueChange:m=>l("temperature",m[0]),min:0,max:1,step:.1,className:"w-full"})]}),!c&&r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{children:"最大 Token"}),r.jsx(Te,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:m=>l("max_tokens",parseInt(m.target.value))})]})]})]})]})}const qm="/api/webui/config";async function Dz(){const t=await(await lt(`${qm}/adapter-config/path`)).json();return!t.success||!t.path?null:{path:t.path,lastModified:t.lastModified}}async function zz(e){const n=await(await lt(`${qm}/adapter-config/path`,{method:"POST",headers:pt(),body:JSON.stringify({path:e})})).json();if(!n.success)throw new Error(n.message||"保存路径失败")}async function Oz(e){const n=await(await lt(`${qm}/adapter-config?path=${encodeURIComponent(e)}`)).json();if(!n.success)throw new Error("读取配置文件失败");return n.content}async function Lb(e,t){const a=await(await lt(`${qm}/adapter-config`,{method:"POST",headers:pt(),body:JSON.stringify({path:e,content:t})})).json();if(!a.success)throw new Error(a.message||"保存配置失败")}const la={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}};function Rz(){const[e,t]=w.useState("upload"),[n,a]=w.useState(null),[l,o]=w.useState(""),[c,d]=w.useState(""),[m,f]=w.useState(""),[p,x]=w.useState(!1),[y,b]=w.useState(!1),[N,k]=w.useState(!1),[S,T]=w.useState(!1),[M,A]=w.useState(null),R=w.useRef(null),{toast:B}=or(),O=w.useRef(null),L=X=>{if(!X.trim())return{valid:!1,error:"路径不能为空"};const q=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,ce=/^(\/|~\/).+\.toml$/i,fe=q.test(X),De=ce.test(X);return!fe&&!De?{valid:!1,error:"路径格式错误。Windows: C:\\path\\file.toml,Linux: /path/file.toml"}:X.toLowerCase().endsWith(".toml")?/[<>"|?*\x00-\x1F]/.test(X)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}:{valid:!1,error:"文件必须是 .toml 格式"}},$=X=>{if(d(X),X.trim()){const q=L(X);f(q.error)}else f("")};w.useEffect(()=>{(async()=>{try{const q=await Dz();q&&q.path&&(d(q.path),t("path"),await U(q.path))}catch(q){console.error("加载保存的路径失败:",q)}})()},[]);const U=async X=>{const q=L(X);if(!q.valid){f(q.error),B({title:"路径无效",description:q.error,variant:"destructive"});return}f(""),b(!0);try{const ce=await Oz(X),fe=ge(ce);a(fe),d(X),await zz(X),B({title:"加载成功",description:"已从配置文件加载"})}catch(ce){console.error("加载配置失败:",ce),B({title:"加载失败",description:ce instanceof Error?ce.message:"无法读取配置文件",variant:"destructive"})}finally{b(!1)}},I=w.useCallback(X=>{e!=="path"||!c||(O.current&&clearTimeout(O.current),O.current=setTimeout(async()=>{x(!0);try{const q=E(X);await Lb(c,q),B({title:"自动保存成功",description:"配置已保存到文件"})}catch(q){console.error("自动保存失败:",q),B({title:"自动保存失败",description:q instanceof Error?q.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},1e3))},[e,c,B]),G=async()=>{if(!n||!c)return;const X=L(c);if(!X.valid){B({title:"保存失败",description:X.error,variant:"destructive"});return}x(!0);try{const q=E(n);await Lb(c,q),B({title:"保存成功",description:"配置已保存到文件"})}catch(q){console.error("保存失败:",q),B({title:"保存失败",description:q instanceof Error?q.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},ee=async()=>{c&&await U(c)},Ne=X=>{if(X!==e){if(n){A(X),k(!0);return}J(X)}},J=X=>{a(null),o(""),f(""),t(X),B({title:"已切换模式",description:X==="upload"?"现在可以上传配置文件":"现在可以指定配置文件路径"})},se=()=>{M&&(J(M),A(null)),k(!1)},H=()=>{if(n){T(!0);return}le()},le=()=>{d(""),a(null),f(""),B({title:"已清空",description:"路径和配置已清空"})},re=()=>{le(),T(!1)},ge=X=>{const q=JSON.parse(JSON.stringify(la)),ce=X.split(` -`);let fe="";for(const De of ce){const oe=De.trim();if(!oe||oe.startsWith("#"))continue;const He=oe.match(/^\[(\w+)\]$/);if(He){fe=He[1];continue}const at=oe.match(/^(\w+)\s*=\s*(.+)$/);if(at&&fe){const[,je,Ze]=at,qe=Ze.trim();let Ot;if(qe==="true")Ot=!0;else if(qe==="false")Ot=!1;else if(qe.startsWith("[")&&qe.endsWith("]")){const bn=qe.slice(1,-1).trim();if(bn){const Dn=bn.split(",").map(wn=>{const Wn=wn.trim();return isNaN(Number(Wn))?Wn.replace(/"/g,""):Number(Wn)}),Xe=typeof Dn[0];Ot=Dn.every(wn=>typeof wn===Xe)?Dn:Dn.filter(wn=>typeof wn=="number")}else Ot=[]}else qe.startsWith('"')&&qe.endsWith('"')?Ot=qe.slice(1,-1):isNaN(Number(qe))?Ot=qe.replace(/"/g,""):Ot=Number(qe);if(fe in q){const bn=q[fe];bn[je]=Ot}}}return q},E=X=>{const q=[],ce=(fe,De)=>fe===""||fe===null||fe===void 0?De:fe;return q.push("[inner]"),q.push(`version = "${ce(X.inner.version,la.inner.version)}" # 版本号`),q.push("# 请勿修改版本号,除非你知道自己在做什么"),q.push(""),q.push("[nickname] # 现在没用"),q.push(`nickname = "${ce(X.nickname.nickname,la.nickname.nickname)}"`),q.push(""),q.push("[napcat_server] # Napcat连接的ws服务设置"),q.push(`host = "${ce(X.napcat_server.host,la.napcat_server.host)}" # Napcat设定的主机地址`),q.push(`port = ${ce(X.napcat_server.port||0,la.napcat_server.port)} # Napcat设定的端口`),q.push(`token = "${ce(X.napcat_server.token,la.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),q.push(`heartbeat_interval = ${ce(X.napcat_server.heartbeat_interval||0,la.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),q.push(""),q.push("[maibot_server] # 连接麦麦的ws服务设置"),q.push(`host = "${ce(X.maibot_server.host,la.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),q.push(`port = ${ce(X.maibot_server.port||0,la.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),q.push(""),q.push("[chat] # 黑白名单功能"),q.push(`group_list_type = "${ce(X.chat.group_list_type,la.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),q.push(`group_list = [${X.chat.group_list.join(", ")}] # 群组名单`),q.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),q.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),q.push(`private_list_type = "${ce(X.chat.private_list_type,la.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),q.push(`private_list = [${X.chat.private_list.join(", ")}] # 私聊名单`),q.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),q.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),q.push(`ban_user_id = [${X.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),q.push(`ban_qq_bot = ${X.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),q.push(`enable_poke = ${X.chat.enable_poke} # 是否启用戳一戳功能`),q.push(""),q.push("[voice] # 发送语音设置"),q.push(`use_tts = ${X.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),q.push(""),q.push("[debug]"),q.push(`level = "${ce(X.debug.level,la.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),q.join(` -`)},we=X=>{const q=X.target.files?.[0];if(!q)return;const ce=new FileReader;ce.onload=fe=>{try{const De=fe.target?.result,oe=ge(De);a(oe),o(q.name),B({title:"上传成功",description:`已加载配置文件:${q.name}`})}catch(De){console.error("解析配置文件失败:",De),B({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},ce.readAsText(q)},Z=()=>{if(!n)return;const X=E(n),q=new Blob([X],{type:"text/plain;charset=utf-8"}),ce=URL.createObjectURL(q),fe=document.createElement("a");fe.href=ce,fe.download=l||"config.toml",document.body.appendChild(fe),fe.click(),document.body.removeChild(fe),URL.revokeObjectURL(ce),B({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},z=()=>{a(JSON.parse(JSON.stringify(la))),o("config.toml"),B({title:"已加载默认配置",description:"可以开始编辑配置"})};return r.jsx(an,{className:"h-full",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),r.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"工作模式"}),r.jsx(Qn,{children:"选择配置文件的管理方式"})]}),r.jsxs(Gt,{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 md:gap-4",children:[r.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${e==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Ne("upload"),children:r.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[r.jsx(Vy,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),r.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),r.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${e==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Ne("path"),children:r.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[r.jsx(CT,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),r.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),e==="path"&&r.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[r.jsxs("div",{className:"flex-1 space-y-1",children:[r.jsx(Te,{id:"config-path",value:c,onChange:X=>$(X.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${m?"border-destructive":""}`}),m&&r.jsx("p",{className:"text-xs text-destructive",children:m})]}),r.jsx(ne,{onClick:()=>U(c),disabled:y||!c||!!m,className:"w-full sm:w-auto",children:y?r.jsxs(r.Fragment,{children:[r.jsx(Ia,{className:"h-4 w-4 animate-spin mr-2"}),r.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"sm:hidden",children:"加载配置"}),r.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),r.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[r.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[r.jsx("span",{children:"路径格式说明"}),r.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),r.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[r.jsx("div",{children:"C:\\Adapter\\config.toml"}),r.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),r.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),r.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[r.jsx("div",{children:"/opt/adapter/config.toml"}),r.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),r.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),r.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),r.jsxs(qu,{children:[r.jsx(pi,{className:"h-4 w-4"}),r.jsx(Hu,{children:e==="upload"?r.jsxs(r.Fragment,{children:[r.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):r.jsxs(r.Fragment,{children:[r.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",p&&" (正在保存...)"]})})]}),e==="upload"&&!n&&r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[r.jsx("input",{ref:R,type:"file",accept:".toml",className:"hidden",onChange:we}),r.jsxs(ne,{onClick:()=>R.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[r.jsx(Vy,{className:"mr-2 h-4 w-4"}),"上传配置"]}),r.jsxs(ne,{onClick:z,size:"sm",className:"w-full sm:w-auto",children:[r.jsx(Nl,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),e==="upload"&&n&&r.jsx("div",{className:"flex gap-2",children:r.jsxs(ne,{onClick:Z,size:"sm",className:"w-full sm:w-auto",children:[r.jsx(hi,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),e==="path"&&n&&r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[r.jsxs(ne,{onClick:G,size:"sm",disabled:p||!!m,className:"w-full sm:w-auto",children:[r.jsx(Cm,{className:"mr-2 h-4 w-4"}),p?"保存中...":"立即保存"]}),r.jsxs(ne,{onClick:ee,size:"sm",variant:"outline",disabled:y,className:"w-full sm:w-auto",children:[r.jsx(Ia,{className:`mr-2 h-4 w-4 ${y?"animate-spin":""}`}),"刷新"]}),r.jsxs(ne,{onClick:H,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[r.jsx(zt,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),n?r.jsxs(kl,{defaultValue:"napcat",className:"w-full",children:[r.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:r.jsxs(Bs,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[r.jsxs(Pt,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[r.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),r.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),r.jsxs(Pt,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[r.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),r.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),r.jsxs(Pt,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[r.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),r.jsx("span",{className:"sm:hidden",children:"聊天"})]}),r.jsxs(Pt,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[r.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),r.jsx("span",{className:"sm:hidden",children:"语音"})]}),r.jsx(Pt,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),r.jsx(cn,{value:"napcat",className:"space-y-4",children:r.jsx(Lz,{config:n,onChange:X=>{a(X),I(X)}})}),r.jsx(cn,{value:"maibot",className:"space-y-4",children:r.jsx(Bz,{config:n,onChange:X=>{a(X),I(X)}})}),r.jsx(cn,{value:"chat",className:"space-y-4",children:r.jsx(Pz,{config:n,onChange:X=>{a(X),I(X)}})}),r.jsx(cn,{value:"voice",className:"space-y-4",children:r.jsx(Fz,{config:n,onChange:X=>{a(X),I(X)}})}),r.jsx(cn,{value:"debug",className:"space-y-4",children:r.jsx(Iz,{config:n,onChange:X=>{a(X),I(X)}})})]}):r.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:r.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[r.jsx(Nl,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),r.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:e==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),r.jsx(en,{open:N,onOpenChange:k,children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认切换模式"}),r.jsxs(Qt,{children:["切换模式将清空当前配置,确定要继续吗?",r.jsx("br",{}),r.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{onClick:()=>{k(!1),A(null)},children:"取消"}),r.jsx(Zt,{onClick:se,children:"确认切换"})]})]})}),r.jsx(en,{open:S,onOpenChange:T,children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认清空路径"}),r.jsxs(Qt,{children:["清空路径将清除当前配置,确定要继续吗?",r.jsx("br",{}),r.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{onClick:()=>T(!1),children:"取消"}),r.jsx(Zt,{onClick:re,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function Lz({config:e,onChange:t}){return r.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),r.jsxs("div",{className:"grid gap-3 md:gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),r.jsx(Te,{id:"napcat-host",value:e.napcat_server.host,onChange:n=>t({...e,napcat_server:{...e.napcat_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),r.jsx(Te,{id:"napcat-port",type:"number",value:e.napcat_server.port||"",onChange:n=>t({...e,napcat_server:{...e.napcat_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),r.jsx(Te,{id:"napcat-token",type:"password",value:e.napcat_server.token,onChange:n=>t({...e,napcat_server:{...e.napcat_server,token:n.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),r.jsx(Te,{id:"napcat-heartbeat",type:"number",value:e.napcat_server.heartbeat_interval||"",onChange:n=>t({...e,napcat_server:{...e.napcat_server,heartbeat_interval:n.target.value?parseInt(n.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function Bz({config:e,onChange:t}){return r.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),r.jsxs("div",{className:"grid gap-3 md:gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),r.jsx(Te,{id:"maibot-host",value:e.maibot_server.host,onChange:n=>t({...e,maibot_server:{...e.maibot_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),r.jsx(Te,{id:"maibot-port",type:"number",value:e.maibot_server.port||"",onChange:n=>t({...e,maibot_server:{...e.maibot_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function Pz({config:e,onChange:t}){const n=o=>{const c={...e};o==="group"?c.chat.group_list=[...c.chat.group_list,0]:o==="private"?c.chat.private_list=[...c.chat.private_list,0]:c.chat.ban_user_id=[...c.chat.ban_user_id,0],t(c)},a=(o,c)=>{const d={...e};o==="group"?d.chat.group_list=d.chat.group_list.filter((m,f)=>f!==c):o==="private"?d.chat.private_list=d.chat.private_list.filter((m,f)=>f!==c):d.chat.ban_user_id=d.chat.ban_user_id.filter((m,f)=>f!==c),t(d)},l=(o,c,d)=>{const m={...e};o==="group"?m.chat.group_list[c]=d:o==="private"?m.chat.private_list[c]=d:m.chat.ban_user_id[c]=d,t(m)};return r.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),r.jsxs("div",{className:"grid gap-4 md:gap-6",children:[r.jsxs("div",{className:"space-y-3 md:space-y-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-sm md:text-base",children:"群组名单类型"}),r.jsxs(_t,{value:e.chat.group_list_type,onValueChange:o=>t({...e,chat:{...e.chat,group_list_type:o}}),children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),r.jsx(Oe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[r.jsx(Q,{className:"text-sm md:text-base",children:"群组列表"}),r.jsxs(ne,{onClick:()=>n("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[r.jsx(Nl,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),e.chat.group_list.map((o,c)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{type:"number",value:o,onChange:d=>l("group",c,parseInt(d.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"icon",variant:"outline",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:["确定要删除群号 ",o," 吗?此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>a("group",c),children:"删除"})]})]})]})]},c)),e.chat.group_list.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),r.jsxs("div",{className:"space-y-3 md:space-y-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-sm md:text-base",children:"私聊名单类型"}),r.jsxs(_t,{value:e.chat.private_list_type,onValueChange:o=>t({...e,chat:{...e.chat,private_list_type:o}}),children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),r.jsx(Oe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[r.jsx(Q,{className:"text-sm md:text-base",children:"私聊列表"}),r.jsxs(ne,{onClick:()=>n("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[r.jsx(Nl,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),e.chat.private_list.map((o,c)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{type:"number",value:o,onChange:d=>l("private",c,parseInt(d.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"icon",variant:"outline",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:["确定要删除用户 ",o," 吗?此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>a("private",c),children:"删除"})]})]})]})]},c)),e.chat.private_list.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-sm md:text-base",children:"全局禁止名单"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),r.jsxs(ne,{onClick:()=>n("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[r.jsx(Nl,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),e.chat.ban_user_id.map((o,c)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Te,{type:"number",value:o,onChange:d=>l("ban",c,parseInt(d.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),r.jsxs(en,{children:[r.jsx(Zn,{asChild:!0,children:r.jsx(ne,{size:"icon",variant:"outline",children:r.jsx(zt,{className:"h-4 w-4"})})}),r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:["确定要从全局禁止名单中删除用户 ",o," 吗?此操作无法撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>a("ban",c),children:"删除"})]})]})]})]},c)),e.chat.ban_user_id.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),r.jsx(vt,{checked:e.chat.ban_qq_bot,onCheckedChange:o=>t({...e,chat:{...e.chat,ban_qq_bot:o}})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),r.jsx(vt,{checked:e.chat.enable_poke,onCheckedChange:o=>t({...e,chat:{...e.chat,enable_poke:o}})})]})]})]})})}function Fz({config:e,onChange:t}){return r.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),r.jsx(vt,{checked:e.voice.use_tts,onCheckedChange:n=>t({...e,voice:{use_tts:n}})})]})]})})}function Iz({config:e,onChange:t}){return r.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),r.jsx("div",{className:"grid gap-3 md:gap-4",children:r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Q,{className:"text-sm md:text-base",children:"日志等级"}),r.jsxs(_t,{value:e.debug.level,onValueChange:n=>t({...e,debug:{level:n}}),children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"DEBUG",children:"DEBUG(调试)"}),r.jsx(Oe,{value:"INFO",children:"INFO(信息)"}),r.jsx(Oe,{value:"WARNING",children:"WARNING(警告)"}),r.jsx(Oe,{value:"ERROR",children:"ERROR(错误)"}),r.jsx(Oe,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function Bb(e){const t=[],n=String(e||"");let a=n.indexOf(","),l=0,o=!1;for(;!o;){a===-1&&(a=n.length,o=!0);const c=n.slice(l,a).trim();(c||!o)&&t.push(c),l=a+1,a=n.indexOf(",",l)}return t}function qz(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Hz=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Uz=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$z={};function Pb(e,t){return($z.jsx?Uz:Hz).test(e)}const Vz=/[ \t\n\f\r]/g;function Gz(e){return typeof e=="object"?e.type==="text"?Fb(e.value):!1:Fb(e)}function Fb(e){return e.replace(Vz,"")===""}class $u{constructor(t,n,a){this.normal=n,this.property=t,a&&(this.space=a)}}$u.prototype.normal={};$u.prototype.property={};$u.prototype.space=void 0;function s7(e,t){const n={},a={};for(const l of e)Object.assign(n,l.property),Object.assign(a,l.normal);return new $u(n,a,t)}function yu(e){return e.toLowerCase()}class Kr{constructor(t,n){this.attribute=n,this.property=t}}Kr.prototype.attribute="";Kr.prototype.booleanish=!1;Kr.prototype.boolean=!1;Kr.prototype.commaOrSpaceSeparated=!1;Kr.prototype.commaSeparated=!1;Kr.prototype.defined=!1;Kr.prototype.mustUseProperty=!1;Kr.prototype.number=!1;Kr.prototype.overloadedBoolean=!1;Kr.prototype.property="";Kr.prototype.spaceSeparated=!1;Kr.prototype.space=void 0;let Yz=0;const gt=ki(),$n=ki(),Px=ki(),ze=ki(),vn=ki(),Oo=ki(),ia=ki();function ki(){return 2**++Yz}const Fx=Object.freeze(Object.defineProperty({__proto__:null,boolean:gt,booleanish:$n,commaOrSpaceSeparated:ia,commaSeparated:Oo,number:ze,overloadedBoolean:Px,spaceSeparated:vn},Symbol.toStringTag,{value:"Module"})),Rp=Object.keys(Fx);class G1 extends Kr{constructor(t,n,a,l){let o=-1;if(super(t,n),Ib(this,"space",l),typeof a=="number")for(;++o4&&n.slice(0,4)==="data"&&Zz.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(qb,eO);a="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!qb.test(o)){let c=o.replace(Qz,Jz);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}l=G1}return new l(a,t)}function Jz(e){return"-"+e.toLowerCase()}function eO(e){return e.charAt(1).toUpperCase()}const h7=s7([l7,Wz,c7,u7,d7],"html"),Hm=s7([l7,Xz,c7,u7,d7],"svg");function Hb(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function tO(e){return e.join(" ").trim()}var yo={},Lp,Ub;function nO(){if(Ub)return Lp;Ub=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,d=/^\s+|\s+$/g,m=` -`,f="/",p="*",x="",y="comment",b="declaration";function N(S,T){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];T=T||{};var M=1,A=1;function R(J){var se=J.match(t);se&&(M+=se.length);var H=J.lastIndexOf(m);A=~H?J.length-H:A+J.length}function B(){var J={line:M,column:A};return function(se){return se.position=new O(J),U(),se}}function O(J){this.start=J,this.end={line:M,column:A},this.source=T.source}O.prototype.content=S;function L(J){var se=new Error(T.source+":"+M+":"+A+": "+J);if(se.reason=J,se.filename=T.source,se.line=M,se.column=A,se.source=S,!T.silent)throw se}function $(J){var se=J.exec(S);if(se){var H=se[0];return R(H),S=S.slice(H.length),se}}function U(){$(n)}function I(J){var se;for(J=J||[];se=G();)se!==!1&&J.push(se);return J}function G(){var J=B();if(!(f!=S.charAt(0)||p!=S.charAt(1))){for(var se=2;x!=S.charAt(se)&&(p!=S.charAt(se)||f!=S.charAt(se+1));)++se;if(se+=2,x===S.charAt(se-1))return L("End of comment missing");var H=S.slice(2,se-2);return A+=2,R(H),S=S.slice(se),A+=2,J({type:y,comment:H})}}function ee(){var J=B(),se=$(a);if(se){if(G(),!$(l))return L("property missing ':'");var H=$(o),le=J({type:b,property:k(se[0].replace(e,x)),value:H?k(H[0].replace(e,x)):x});return $(c),le}}function Ne(){var J=[];I(J);for(var se;se=ee();)se!==!1&&(J.push(se),I(J));return J}return U(),Ne()}function k(S){return S?S.replace(d,x):x}return Lp=N,Lp}var $b;function rO(){if($b)return yo;$b=1;var e=yo&&yo.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(yo,"__esModule",{value:!0}),yo.default=n;const t=e(nO());function n(a,l){let o=null;if(!a||typeof a!="string")return o;const c=(0,t.default)(a),d=typeof l=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:f,value:p}=m;d?l(f,p,m):p&&(o=o||{},o[f]=p)}),o}return yo}var eu={},Vb;function aO(){if(Vb)return eu;Vb=1,Object.defineProperty(eu,"__esModule",{value:!0}),eu.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,o=function(f){return!f||n.test(f)||e.test(f)},c=function(f,p){return p.toUpperCase()},d=function(f,p){return"".concat(p,"-")},m=function(f,p){return p===void 0&&(p={}),o(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(l,d):f=f.replace(a,d),f.replace(t,c))};return eu.camelCase=m,eu}var tu,Gb;function sO(){if(Gb)return tu;Gb=1;var e=tu&&tu.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(rO()),n=aO();function a(l,o){var c={};return!l||typeof l!="string"||(0,t.default)(l,function(d,m){d&&m&&(c[(0,n.camelCase)(d,o)]=m)}),c}return a.default=a,tu=a,tu}var lO=sO();const iO=B5(lO),f7=p7("end"),Y1=p7("start");function p7(e){return t;function t(n){const a=n&&n.position&&n.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function oO(e){const t=Y1(e),n=f7(e);if(t&&n)return{start:t,end:n}}function uu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Yb(e.position):"start"in e||"end"in e?Yb(e):"line"in e||"column"in e?Ix(e):""}function Ix(e){return Wb(e&&e.line)+":"+Wb(e&&e.column)}function Yb(e){return Ix(e&&e.start)+"-"+Ix(e&&e.end)}function Wb(e){return e&&typeof e=="number"?e:1}class Nr extends Error{constructor(t,n,a){super(),typeof n=="string"&&(a=n,n=void 0);let l="",o={},c=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?l=t:!o.cause&&t&&(c=!0,l=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof a=="string"){const m=a.indexOf(":");m===-1?o.ruleId=a:(o.source=a.slice(0,m),o.ruleId=a.slice(m+1))}if(!o.place&&o.ancestors&&o.ancestors){const m=o.ancestors[o.ancestors.length-1];m&&(o.place=m.position)}const d=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=d?d.line:void 0,this.name=uu(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=c&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Nr.prototype.file="";Nr.prototype.name="";Nr.prototype.reason="";Nr.prototype.message="";Nr.prototype.stack="";Nr.prototype.column=void 0;Nr.prototype.line=void 0;Nr.prototype.ancestors=void 0;Nr.prototype.cause=void 0;Nr.prototype.fatal=void 0;Nr.prototype.place=void 0;Nr.prototype.ruleId=void 0;Nr.prototype.source=void 0;const W1={}.hasOwnProperty,cO=new Map,uO=/[A-Z]/g,dO=new Set(["table","tbody","thead","tfoot","tr"]),mO=new Set(["td","th"]),x7="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function hO(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let a;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=wO(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=bO(n,t.jsx,t.jsxs)}const l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:a,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Hm:h7,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=g7(l,e,void 0);return o&&typeof o!="string"?o:l.create(e,l.Fragment,{children:o||void 0},void 0)}function g7(e,t,n){if(t.type==="element")return fO(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return pO(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return gO(e,t,n);if(t.type==="mdxjsEsm")return xO(e,t);if(t.type==="root")return vO(e,t,n);if(t.type==="text")return yO(e,t)}function fO(e,t,n){const a=e.schema;let l=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(l=Hm,e.schema=l),e.ancestors.push(t);const o=y7(e,t.tagName,!1),c=jO(e,t);let d=K1(e,t);return dO.has(t.tagName)&&(d=d.filter(function(m){return typeof m=="string"?!Gz(m):!0})),v7(e,c,o,t),X1(c,d),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function pO(e,t){if(t.data&&t.data.estree&&e.evaluater){const a=t.data.estree.body[0];return a.type,e.evaluater.evaluateExpression(a.expression)}bu(e,t.position)}function xO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);bu(e,t.position)}function gO(e,t,n){const a=e.schema;let l=a;t.name==="svg"&&a.space==="html"&&(l=Hm,e.schema=l),e.ancestors.push(t);const o=t.name===null?e.Fragment:y7(e,t.name,!0),c=NO(e,t),d=K1(e,t);return v7(e,c,o,t),X1(c,d),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function vO(e,t,n){const a={};return X1(a,K1(e,t)),e.create(t,e.Fragment,a,n)}function yO(e,t){return t.value}function v7(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function X1(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function bO(e,t,n){return a;function a(l,o,c,d){const f=Array.isArray(c.children)?n:t;return d?f(o,c,d):f(o,c)}}function wO(e,t){return n;function n(a,l,o,c){const d=Array.isArray(o.children),m=Y1(a);return t(l,o,c,d,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function jO(e,t){const n={};let a,l;for(l in t.properties)if(l!=="children"&&W1.call(t.properties,l)){const o=SO(e,l,t.properties[l]);if(o){const[c,d]=o;e.tableCellAlignToStyle&&c==="align"&&typeof d=="string"&&mO.has(t.tagName)?a=d:n[c]=d}}if(a){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return n}function NO(e,t){const n={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const o=a.data.estree.body[0];o.type;const c=o.expression;c.type;const d=c.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else bu(e,t.position);else{const l=a.name;let o;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const d=a.value.data.estree.body[0];d.type,o=e.evaluater.evaluateExpression(d.expression)}else bu(e,t.position);else o=a.value===null?!0:a.value;n[l]=o}return n}function K1(e,t){const n=[];let a=-1;const l=e.passKeys?new Map:cO;for(;++al?0:l+t:t=t>l?l:t,n=n>0?n:0,a.length<1e4)c=Array.from(a),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);o0?(ua(e,e.length,0,t),e):t}const Qb={}.hasOwnProperty;function w7(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function qa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Tr=Ll(/[A-Za-z]/),wr=Ll(/[\dA-Za-z]/),zO=Ll(/[#-'*+\--9=?A-Z^-~]/);function cm(e){return e!==null&&(e<32||e===127)}const qx=Ll(/\d/),OO=Ll(/[\dA-Fa-f]/),RO=Ll(/[!-/:-@[-`{-~]/);function We(e){return e!==null&&e<-2}function pn(e){return e!==null&&(e<0||e===32)}function Mt(e){return e===-2||e===-1||e===32}const Um=Ll(new RegExp("\\p{P}|\\p{S}","u")),yi=Ll(/\s/);function Ll(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ec(e){const t=[];let n=-1,a=0,l=0;for(;++n55295&&o<57344){const d=e.charCodeAt(n+1);o<56320&&d>56319&&d<57344?(c=String.fromCharCode(o,d),l=1):c="�"}else c=String.fromCharCode(o);c&&(t.push(e.slice(a,n),encodeURIComponent(c)),a=n+l+1,c=""),l&&(n+=l,l=0)}return t.join("")+e.slice(a)}function St(e,t,n,a){const l=a?a-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(m){return Mt(m)?(e.enter(n),d(m)):t(m)}function d(m){return Mt(m)&&o++c))return;const L=t.events.length;let $=L,U,I;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(U){I=t.events[$][1].end;break}U=!0}for(T(a),O=L;OA;){const B=n[R];t.containerState=B[1],B[0].exit.call(t,e)}n.length=A}function M(){l.write([null]),o=void 0,l=void 0,t.containerState._closeFlow=void 0}}function IO(e,t,n){return St(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ho(e){if(e===null||pn(e)||yi(e))return 1;if(Um(e))return 2}function $m(e,t,n){const a=[];let l=-1;for(;++l1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const x={...e[a][1].end},y={...e[n][1].start};Jb(x,-m),Jb(y,m),c={type:m>1?"strongSequence":"emphasisSequence",start:x,end:{...e[a][1].end}},d={type:m>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},o={type:m>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},l={type:m>1?"strong":"emphasis",start:{...c.start},end:{...d.end}},e[a][1].end={...c.start},e[n][1].start={...d.end},f=[],e[a][1].end.offset-e[a][1].start.offset&&(f=ka(f,[["enter",e[a][1],t],["exit",e[a][1],t]])),f=ka(f,[["enter",l,t],["enter",c,t],["exit",c,t],["enter",o,t]]),f=ka(f,$m(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),f=ka(f,[["exit",o,t],["enter",d,t],["exit",d,t],["exit",l,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,f=ka(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,ua(e,a-1,n-a+3,f),n=a+f.length-p-2;break}}for(n=-1;++n0&&Mt(O)?St(e,M,"linePrefix",o+1)(O):M(O)}function M(O){return O===null||We(O)?e.check(e3,k,R)(O):(e.enter("codeFlowValue"),A(O))}function A(O){return O===null||We(O)?(e.exit("codeFlowValue"),M(O)):(e.consume(O),A)}function R(O){return e.exit("codeFenced"),t(O)}function B(O,L,$){let U=0;return I;function I(se){return O.enter("lineEnding"),O.consume(se),O.exit("lineEnding"),G}function G(se){return O.enter("codeFencedFence"),Mt(se)?St(O,ee,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(se):ee(se)}function ee(se){return se===d?(O.enter("codeFencedFenceSequence"),Ne(se)):$(se)}function Ne(se){return se===d?(U++,O.consume(se),Ne):U>=c?(O.exit("codeFencedFenceSequence"),Mt(se)?St(O,J,"whitespace")(se):J(se)):$(se)}function J(se){return se===null||We(se)?(O.exit("codeFencedFence"),L(se)):$(se)}}}function ZO(e,t,n){const a=this;return l;function l(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o)}function o(c){return a.parser.lazy[a.now().line]?n(c):t(c)}}const Pp={name:"codeIndented",tokenize:eR},JO={partial:!0,tokenize:tR};function eR(e,t,n){const a=this;return l;function l(f){return e.enter("codeIndented"),St(e,o,"linePrefix",5)(f)}function o(f){const p=a.events[a.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?c(f):n(f)}function c(f){return f===null?m(f):We(f)?e.attempt(JO,c,m)(f):(e.enter("codeFlowValue"),d(f))}function d(f){return f===null||We(f)?(e.exit("codeFlowValue"),c(f)):(e.consume(f),d)}function m(f){return e.exit("codeIndented"),t(f)}}function tR(e,t,n){const a=this;return l;function l(c){return a.parser.lazy[a.now().line]?n(c):We(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):St(e,o,"linePrefix",5)(c)}function o(c){const d=a.events[a.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(c):We(c)?l(c):n(c)}}const nR={name:"codeText",previous:aR,resolve:rR,tokenize:sR};function rR(e){let t=e.length-4,n=3,a,l;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(a=n;++a=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(t,n,a){const l=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return a&&nu(this.left,a),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),nu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),nu(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(c):e.interrupt(a.parser.constructs.flow,n,t)(c)}}function T7(e,t,n,a,l,o,c,d,m){const f=m||Number.POSITIVE_INFINITY;let p=0;return x;function x(T){return T===60?(e.enter(a),e.enter(l),e.enter(o),e.consume(T),e.exit(o),y):T===null||T===32||T===41||cm(T)?n(T):(e.enter(a),e.enter(c),e.enter(d),e.enter("chunkString",{contentType:"string"}),k(T))}function y(T){return T===62?(e.enter(o),e.consume(T),e.exit(o),e.exit(l),e.exit(a),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),b(T))}function b(T){return T===62?(e.exit("chunkString"),e.exit(d),y(T)):T===null||T===60||We(T)?n(T):(e.consume(T),T===92?N:b)}function N(T){return T===60||T===62||T===92?(e.consume(T),b):b(T)}function k(T){return!p&&(T===null||T===41||pn(T))?(e.exit("chunkString"),e.exit(d),e.exit(c),e.exit(a),t(T)):p999||b===null||b===91||b===93&&!m||b===94&&!d&&"_hiddenFootnoteSupport"in c.parser.constructs?n(b):b===93?(e.exit(o),e.enter(l),e.consume(b),e.exit(l),e.exit(a),t):We(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),x(b))}function x(b){return b===null||b===91||b===93||We(b)||d++>999?(e.exit("chunkString"),p(b)):(e.consume(b),m||(m=!Mt(b)),b===92?y:x)}function y(b){return b===91||b===92||b===93?(e.consume(b),d++,x):x(b)}}function E7(e,t,n,a,l,o){let c;return d;function d(y){return y===34||y===39||y===40?(e.enter(a),e.enter(l),e.consume(y),e.exit(l),c=y===40?41:y,m):n(y)}function m(y){return y===c?(e.enter(l),e.consume(y),e.exit(l),e.exit(a),t):(e.enter(o),f(y))}function f(y){return y===c?(e.exit(o),m(c)):y===null?n(y):We(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),St(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===c||y===null||We(y)?(e.exit("chunkString"),f(y)):(e.consume(y),y===92?x:p)}function x(y){return y===c||y===92?(e.consume(y),p):p(y)}}function du(e,t){let n;return a;function a(l){return We(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),n=!0,a):Mt(l)?St(e,a,n?"linePrefix":"lineSuffix")(l):t(l)}}const hR={name:"definition",tokenize:pR},fR={partial:!0,tokenize:xR};function pR(e,t,n){const a=this;let l;return o;function o(b){return e.enter("definition"),c(b)}function c(b){return _7.call(a,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function d(b){return l=qa(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),m):n(b)}function m(b){return pn(b)?du(e,f)(b):f(b)}function f(b){return T7(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function p(b){return e.attempt(fR,x,x)(b)}function x(b){return Mt(b)?St(e,y,"whitespace")(b):y(b)}function y(b){return b===null||We(b)?(e.exit("definition"),a.parser.defined.push(l),t(b)):n(b)}}function xR(e,t,n){return a;function a(d){return pn(d)?du(e,l)(d):n(d)}function l(d){return E7(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function o(d){return Mt(d)?St(e,c,"whitespace")(d):c(d)}function c(d){return d===null||We(d)?t(d):n(d)}}const gR={name:"hardBreakEscape",tokenize:vR};function vR(e,t,n){return a;function a(o){return e.enter("hardBreakEscape"),e.consume(o),l}function l(o){return We(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const yR={name:"headingAtx",resolve:bR,tokenize:wR};function bR(e,t){let n=e.length-2,a=3,l,o;return e[a][1].type==="whitespace"&&(a+=2),n-2>a&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(a===n-1||n-4>a&&e[n-2][1].type==="whitespace")&&(n-=a+1===n?2:4),n>a&&(l={type:"atxHeadingText",start:e[a][1].start,end:e[n][1].end},o={type:"chunkText",start:e[a][1].start,end:e[n][1].end,contentType:"text"},ua(e,a,n-a+1,[["enter",l,t],["enter",o,t],["exit",o,t],["exit",l,t]])),e}function wR(e,t,n){let a=0;return l;function l(p){return e.enter("atxHeading"),o(p)}function o(p){return e.enter("atxHeadingSequence"),c(p)}function c(p){return p===35&&a++<6?(e.consume(p),c):p===null||pn(p)?(e.exit("atxHeadingSequence"),d(p)):n(p)}function d(p){return p===35?(e.enter("atxHeadingSequence"),m(p)):p===null||We(p)?(e.exit("atxHeading"),t(p)):Mt(p)?St(e,d,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function m(p){return p===35?(e.consume(p),m):(e.exit("atxHeadingSequence"),d(p))}function f(p){return p===null||p===35||pn(p)?(e.exit("atxHeadingText"),d(p)):(e.consume(p),f)}}const jR=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],n3=["pre","script","style","textarea"],NR={concrete:!0,name:"htmlFlow",resolveTo:CR,tokenize:TR},SR={partial:!0,tokenize:ER},kR={partial:!0,tokenize:_R};function CR(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function TR(e,t,n){const a=this;let l,o,c,d,m;return f;function f(z){return p(z)}function p(z){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(z),x}function x(z){return z===33?(e.consume(z),y):z===47?(e.consume(z),o=!0,k):z===63?(e.consume(z),l=3,a.interrupt?t:E):Tr(z)?(e.consume(z),c=String.fromCharCode(z),S):n(z)}function y(z){return z===45?(e.consume(z),l=2,b):z===91?(e.consume(z),l=5,d=0,N):Tr(z)?(e.consume(z),l=4,a.interrupt?t:E):n(z)}function b(z){return z===45?(e.consume(z),a.interrupt?t:E):n(z)}function N(z){const X="CDATA[";return z===X.charCodeAt(d++)?(e.consume(z),d===X.length?a.interrupt?t:ee:N):n(z)}function k(z){return Tr(z)?(e.consume(z),c=String.fromCharCode(z),S):n(z)}function S(z){if(z===null||z===47||z===62||pn(z)){const X=z===47,q=c.toLowerCase();return!X&&!o&&n3.includes(q)?(l=1,a.interrupt?t(z):ee(z)):jR.includes(c.toLowerCase())?(l=6,X?(e.consume(z),T):a.interrupt?t(z):ee(z)):(l=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(z):o?M(z):A(z))}return z===45||wr(z)?(e.consume(z),c+=String.fromCharCode(z),S):n(z)}function T(z){return z===62?(e.consume(z),a.interrupt?t:ee):n(z)}function M(z){return Mt(z)?(e.consume(z),M):I(z)}function A(z){return z===47?(e.consume(z),I):z===58||z===95||Tr(z)?(e.consume(z),R):Mt(z)?(e.consume(z),A):I(z)}function R(z){return z===45||z===46||z===58||z===95||wr(z)?(e.consume(z),R):B(z)}function B(z){return z===61?(e.consume(z),O):Mt(z)?(e.consume(z),B):A(z)}function O(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(e.consume(z),m=z,L):Mt(z)?(e.consume(z),O):$(z)}function L(z){return z===m?(e.consume(z),m=null,U):z===null||We(z)?n(z):(e.consume(z),L)}function $(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||pn(z)?B(z):(e.consume(z),$)}function U(z){return z===47||z===62||Mt(z)?A(z):n(z)}function I(z){return z===62?(e.consume(z),G):n(z)}function G(z){return z===null||We(z)?ee(z):Mt(z)?(e.consume(z),G):n(z)}function ee(z){return z===45&&l===2?(e.consume(z),H):z===60&&l===1?(e.consume(z),le):z===62&&l===4?(e.consume(z),we):z===63&&l===3?(e.consume(z),E):z===93&&l===5?(e.consume(z),ge):We(z)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(SR,Z,Ne)(z)):z===null||We(z)?(e.exit("htmlFlowData"),Ne(z)):(e.consume(z),ee)}function Ne(z){return e.check(kR,J,Z)(z)}function J(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),se}function se(z){return z===null||We(z)?Ne(z):(e.enter("htmlFlowData"),ee(z))}function H(z){return z===45?(e.consume(z),E):ee(z)}function le(z){return z===47?(e.consume(z),c="",re):ee(z)}function re(z){if(z===62){const X=c.toLowerCase();return n3.includes(X)?(e.consume(z),we):ee(z)}return Tr(z)&&c.length<8?(e.consume(z),c+=String.fromCharCode(z),re):ee(z)}function ge(z){return z===93?(e.consume(z),E):ee(z)}function E(z){return z===62?(e.consume(z),we):z===45&&l===2?(e.consume(z),E):ee(z)}function we(z){return z===null||We(z)?(e.exit("htmlFlowData"),Z(z)):(e.consume(z),we)}function Z(z){return e.exit("htmlFlow"),t(z)}}function _R(e,t,n){const a=this;return l;function l(c){return We(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):n(c)}function o(c){return a.parser.lazy[a.now().line]?n(c):t(c)}}function ER(e,t,n){return a;function a(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Vu,t,n)}}const MR={name:"htmlText",tokenize:AR};function AR(e,t,n){const a=this;let l,o,c;return d;function d(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),m}function m(E){return E===33?(e.consume(E),f):E===47?(e.consume(E),B):E===63?(e.consume(E),A):Tr(E)?(e.consume(E),$):n(E)}function f(E){return E===45?(e.consume(E),p):E===91?(e.consume(E),o=0,N):Tr(E)?(e.consume(E),M):n(E)}function p(E){return E===45?(e.consume(E),b):n(E)}function x(E){return E===null?n(E):E===45?(e.consume(E),y):We(E)?(c=x,le(E)):(e.consume(E),x)}function y(E){return E===45?(e.consume(E),b):x(E)}function b(E){return E===62?H(E):E===45?y(E):x(E)}function N(E){const we="CDATA[";return E===we.charCodeAt(o++)?(e.consume(E),o===we.length?k:N):n(E)}function k(E){return E===null?n(E):E===93?(e.consume(E),S):We(E)?(c=k,le(E)):(e.consume(E),k)}function S(E){return E===93?(e.consume(E),T):k(E)}function T(E){return E===62?H(E):E===93?(e.consume(E),T):k(E)}function M(E){return E===null||E===62?H(E):We(E)?(c=M,le(E)):(e.consume(E),M)}function A(E){return E===null?n(E):E===63?(e.consume(E),R):We(E)?(c=A,le(E)):(e.consume(E),A)}function R(E){return E===62?H(E):A(E)}function B(E){return Tr(E)?(e.consume(E),O):n(E)}function O(E){return E===45||wr(E)?(e.consume(E),O):L(E)}function L(E){return We(E)?(c=L,le(E)):Mt(E)?(e.consume(E),L):H(E)}function $(E){return E===45||wr(E)?(e.consume(E),$):E===47||E===62||pn(E)?U(E):n(E)}function U(E){return E===47?(e.consume(E),H):E===58||E===95||Tr(E)?(e.consume(E),I):We(E)?(c=U,le(E)):Mt(E)?(e.consume(E),U):H(E)}function I(E){return E===45||E===46||E===58||E===95||wr(E)?(e.consume(E),I):G(E)}function G(E){return E===61?(e.consume(E),ee):We(E)?(c=G,le(E)):Mt(E)?(e.consume(E),G):U(E)}function ee(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),l=E,Ne):We(E)?(c=ee,le(E)):Mt(E)?(e.consume(E),ee):(e.consume(E),J)}function Ne(E){return E===l?(e.consume(E),l=void 0,se):E===null?n(E):We(E)?(c=Ne,le(E)):(e.consume(E),Ne)}function J(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||pn(E)?U(E):(e.consume(E),J)}function se(E){return E===47||E===62||pn(E)?U(E):n(E)}function H(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function le(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),re}function re(E){return Mt(E)?St(e,ge,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):ge(E)}function ge(E){return e.enter("htmlTextData"),c(E)}}const J1={name:"labelEnd",resolveAll:RR,resolveTo:LR,tokenize:BR},DR={tokenize:PR},zR={tokenize:FR},OR={tokenize:IR};function RR(e){let t=-1;const n=[];for(;++t=3&&(f===null||We(f))?(e.exit("thematicBreak"),t(f)):n(f)}function m(f){return f===l?(e.consume(f),a++,m):(e.exit("thematicBreakSequence"),Mt(f)?St(e,d,"whitespace")(f):d(f))}}const qr={continuation:{tokenize:KR},exit:ZR,name:"list",tokenize:XR},YR={partial:!0,tokenize:JR},WR={partial:!0,tokenize:QR};function XR(e,t,n){const a=this,l=a.events[a.events.length-1];let o=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,c=0;return d;function d(b){const N=a.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(N==="listUnordered"?!a.containerState.marker||b===a.containerState.marker:qx(b)){if(a.containerState.type||(a.containerState.type=N,e.enter(N,{_container:!0})),N==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(X0,n,f)(b):f(b);if(!a.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(b)}return n(b)}function m(b){return qx(b)&&++c<10?(e.consume(b),m):(!a.interrupt||c<2)&&(a.containerState.marker?b===a.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),f(b)):n(b)}function f(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||b,e.check(Vu,a.interrupt?n:p,e.attempt(YR,y,x))}function p(b){return a.containerState.initialBlankLine=!0,o++,y(b)}function x(b){return Mt(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return a.containerState.size=o+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function KR(e,t,n){const a=this;return a.containerState._closeFlow=void 0,e.check(Vu,l,o);function l(d){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,St(e,t,"listItemIndent",a.containerState.size+1)(d)}function o(d){return a.containerState.furtherBlankLines||!Mt(d)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,c(d)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(WR,t,c)(d))}function c(d){return a.containerState._closeFlow=!0,a.interrupt=void 0,St(e,e.attempt(qr,t,n),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function QR(e,t,n){const a=this;return St(e,l,"listItemIndent",a.containerState.size+1);function l(o){const c=a.events[a.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===a.containerState.size?t(o):n(o)}}function ZR(e){e.exit(this.containerState.type)}function JR(e,t,n){const a=this;return St(e,l,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(o){const c=a.events[a.events.length-1];return!Mt(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const r3={name:"setextUnderline",resolveTo:eL,tokenize:tL};function eL(e,t){let n=e.length,a,l,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){a=n;break}e[n][1].type==="paragraph"&&(l=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const c={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",o?(e.splice(l,0,["enter",c,t]),e.splice(o+1,0,["exit",e[a][1],t]),e[a][1].end={...e[o][1].end}):e[a][1]=c,e.push(["exit",c,t]),e}function tL(e,t,n){const a=this;let l;return o;function o(f){let p=a.events.length,x;for(;p--;)if(a.events[p][1].type!=="lineEnding"&&a.events[p][1].type!=="linePrefix"&&a.events[p][1].type!=="content"){x=a.events[p][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||x)?(e.enter("setextHeadingLine"),l=f,c(f)):n(f)}function c(f){return e.enter("setextHeadingLineSequence"),d(f)}function d(f){return f===l?(e.consume(f),d):(e.exit("setextHeadingLineSequence"),Mt(f)?St(e,m,"lineSuffix")(f):m(f))}function m(f){return f===null||We(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const nL={tokenize:rL};function rL(e){const t=this,n=e.attempt(Vu,a,e.attempt(this.parser.constructs.flowInitial,l,St(e,e.attempt(this.parser.constructs.flow,l,e.attempt(oR,l)),"linePrefix")));return n;function a(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function l(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const aL={resolveAll:A7()},sL=M7("string"),lL=M7("text");function M7(e){return{resolveAll:A7(e==="text"?iL:void 0),tokenize:t};function t(n){const a=this,l=this.parser.constructs[e],o=n.attempt(l,c,d);return c;function c(p){return f(p)?o(p):d(p)}function d(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),m}function m(p){return f(p)?(n.exit("data"),o(p)):(n.consume(p),m)}function f(p){if(p===null)return!0;const x=l[p];let y=-1;if(x)for(;++y-1){const d=c[0];typeof d=="string"?c[0]=d.slice(a):c.shift()}o>0&&c.push(e[l].slice(0,o))}return c}function bL(e,t){let n=-1;const a=[];let l;for(;++n0){const rr=Re.tokenStack[Re.tokenStack.length-1];(rr[1]||s3).call(Re,void 0,rr[0])}for(be.position={start:gl(K.length>0?K[0][1].start:{line:1,column:1,offset:0}),end:gl(K.length>0?K[K.length-2][1].end:{line:1,column:1,offset:0})},kt=-1;++kt1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,m);const f={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(t,f),e.applyData(t,f)}function BL(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PL(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function O7(e,t){const n=t.referenceType;let a="]";if(n==="collapsed"?a+="[]":n==="full"&&(a+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+a}];const l=e.all(t),o=l[0];o&&o.type==="text"?o.value="["+o.value:l.unshift({type:"text",value:"["});const c=l[l.length-1];return c&&c.type==="text"?c.value+=a:l.push({type:"text",value:a}),l}function FL(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return O7(e,t);const l={src:ec(a.url||""),alt:t.alt};a.title!==null&&a.title!==void 0&&(l.title=a.title);const o={type:"element",tagName:"img",properties:l,children:[]};return e.patch(t,o),e.applyData(t,o)}function IL(e,t){const n={src:ec(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,a),e.applyData(t,a)}function qL(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const a={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,a),e.applyData(t,a)}function HL(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return O7(e,t);const l={href:ec(a.url||"")};a.title!==null&&a.title!==void 0&&(l.title=a.title);const o={type:"element",tagName:"a",properties:l,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function UL(e,t){const n={href:ec(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function $L(e,t,n){const a=e.all(t),l=n?VL(n):R7(t),o={},c=[];if(typeof t.checked=="boolean"){const p=a[0];let x;p&&p.type==="element"&&p.tagName==="p"?x=p:(x={type:"element",tagName:"p",properties:{},children:[]},a.unshift(x)),x.children.length>0&&x.children.unshift({type:"text",value:" "}),x.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let d=-1;for(;++d1}function GL(e,t){const n={},a=e.all(t);let l=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++l0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},d=Y1(t.children[1]),m=f7(t.children[t.children.length-1]);d&&m&&(c.position={start:d,end:m}),l.push(c)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(t,o),e.applyData(t,o)}function QL(e,t,n){const a=n?n.children:void 0,o=(a?a.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,d=c?c.length:t.children.length;let m=-1;const f=[];for(;++m0,!0),a[0]),l=a.index+a[0].length,a=n.exec(t);return o.push(o3(t.slice(l),l>0,!1)),o.join("")}function o3(e,t,n){let a=0,l=e.length;if(t){let o=e.codePointAt(a);for(;o===l3||o===i3;)a++,o=e.codePointAt(a)}if(n){let o=e.codePointAt(l-1);for(;o===l3||o===i3;)l--,o=e.codePointAt(l-1)}return l>a?e.slice(a,l):""}function eB(e,t){const n={type:"text",value:JL(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function tB(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const nB={blockquote:AL,break:DL,code:zL,delete:OL,emphasis:RL,footnoteReference:LL,heading:BL,html:PL,imageReference:FL,image:IL,inlineCode:qL,linkReference:HL,link:UL,listItem:$L,list:GL,paragraph:YL,root:WL,strong:XL,table:KL,tableCell:ZL,tableRow:QL,text:eB,thematicBreak:tB,toml:k0,yaml:k0,definition:k0,footnoteDefinition:k0};function k0(){}const L7=-1,Vm=0,mu=1,um=2,eg=3,tg=4,ng=5,rg=6,B7=7,P7=8,c3=typeof self=="object"?self:globalThis,rB=(e,t)=>{const n=(l,o)=>(e.set(o,l),l),a=l=>{if(e.has(l))return e.get(l);const[o,c]=t[l];switch(o){case Vm:case L7:return n(c,l);case mu:{const d=n([],l);for(const m of c)d.push(a(m));return d}case um:{const d=n({},l);for(const[m,f]of c)d[a(m)]=a(f);return d}case eg:return n(new Date(c),l);case tg:{const{source:d,flags:m}=c;return n(new RegExp(d,m),l)}case ng:{const d=n(new Map,l);for(const[m,f]of c)d.set(a(m),a(f));return d}case rg:{const d=n(new Set,l);for(const m of c)d.add(a(m));return d}case B7:{const{name:d,message:m}=c;return n(new c3[d](m),l)}case P7:return n(BigInt(c),l);case"BigInt":return n(Object(BigInt(c)),l);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:d}=new Uint8Array(c);return n(new DataView(d),c)}}return n(new c3[o](c),l)};return a},u3=e=>rB(new Map,e)(0),bo="",{toString:aB}={},{keys:sB}=Object,ru=e=>{const t=typeof e;if(t!=="object"||!e)return[Vm,t];const n=aB.call(e).slice(8,-1);switch(n){case"Array":return[mu,bo];case"Object":return[um,bo];case"Date":return[eg,bo];case"RegExp":return[tg,bo];case"Map":return[ng,bo];case"Set":return[rg,bo];case"DataView":return[mu,n]}return n.includes("Array")?[mu,n]:n.includes("Error")?[B7,n]:[um,n]},C0=([e,t])=>e===Vm&&(t==="function"||t==="symbol"),lB=(e,t,n,a)=>{const l=(c,d)=>{const m=a.push(c)-1;return n.set(d,m),m},o=c=>{if(n.has(c))return n.get(c);let[d,m]=ru(c);switch(d){case Vm:{let p=c;switch(m){case"bigint":d=P7,p=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);p=null;break;case"undefined":return l([L7],c)}return l([d,p],c)}case mu:{if(m){let y=c;return m==="DataView"?y=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(y=new Uint8Array(c)),l([m,[...y]],c)}const p=[],x=l([d,p],c);for(const y of c)p.push(o(y));return x}case um:{if(m)switch(m){case"BigInt":return l([m,c.toString()],c);case"Boolean":case"Number":case"String":return l([m,c.valueOf()],c)}if(t&&"toJSON"in c)return o(c.toJSON());const p=[],x=l([d,p],c);for(const y of sB(c))(e||!C0(ru(c[y])))&&p.push([o(y),o(c[y])]);return x}case eg:return l([d,c.toISOString()],c);case tg:{const{source:p,flags:x}=c;return l([d,{source:p,flags:x}],c)}case ng:{const p=[],x=l([d,p],c);for(const[y,b]of c)(e||!(C0(ru(y))||C0(ru(b))))&&p.push([o(y),o(b)]);return x}case rg:{const p=[],x=l([d,p],c);for(const y of c)(e||!C0(ru(y)))&&p.push(o(y));return x}}const{message:f}=c;return l([d,{name:m,message:f}],c)};return o},d3=(e,{json:t,lossy:n}={})=>{const a=[];return lB(!(t||n),!!t,new Map,a)(e),a},dm=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?u3(d3(e,t)):structuredClone(e):(e,t)=>u3(d3(e,t));function iB(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function oB(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function cB(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||iB,a=e.options.footnoteBackLabel||oB,l=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let m=-1;for(;++m0&&N.push({type:"text",value:" "});let M=typeof n=="string"?n:n(m,b);typeof M=="string"&&(M={type:"text",value:M}),N.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,b),className:["data-footnote-backref"]},children:Array.isArray(M)?M:[M]})}const S=p[p.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const M=S.children[S.children.length-1];M&&M.type==="text"?M.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...N)}else p.push(...N);const T={type:"element",tagName:"li",properties:{id:t+"fn-"+y},children:e.wrap(p,!0)};e.patch(f,T),d.push(T)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...dm(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:` -`},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:` -`}]}}const Gu=(function(e){if(e==null)return hB;if(typeof e=="function")return Gm(e);if(typeof e=="object")return Array.isArray(e)?uB(e):dB(e);if(typeof e=="string")return mB(e);throw new Error("Expected function, string, or object as test")});function uB(e){const t=[];let n=-1;for(;++n":""))+")"})}return y;function y(){let b=F7,N,k,S;if((!t||o(m,f,p[p.length-1]||void 0))&&(b=xB(n(m,p)),b[0]===Ux))return b;if("children"in m&&m.children){const T=m;if(T.children&&b[0]!==I7)for(k=(a?T.children.length:-1)+c,S=p.concat(T);k>-1&&k0&&n.push({type:"text",value:` -`}),n}function m3(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function h3(e,t){const n=vB(e,t),a=n.one(e,void 0),l=cB(n),o=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return l&&o.children.push({type:"text",value:` -`},l),o}function NB(e,t){return e&&"run"in e?async function(n,a){const l=h3(n,{file:a,...t});await e.run(l,a)}:function(n,a){return h3(n,{file:a,...e||t})}}function f3(e){if(e)throw e}var Ip,p3;function SB(){if(p3)return Ip;p3=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},o=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var p=e.call(f,"constructor"),x=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!x)return!1;var y;for(y in f);return typeof y>"u"||e.call(f,y)},c=function(f,p){n&&p.name==="__proto__"?n(f,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):f[p.name]=p.newValue},d=function(f,p){if(p==="__proto__")if(e.call(f,p)){if(a)return a(f,p).value}else return;return f[p]};return Ip=function m(){var f,p,x,y,b,N,k=arguments[0],S=1,T=arguments.length,M=!1;for(typeof k=="boolean"&&(M=k,k=arguments[1]||{},S=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});Sc.length;let m;d&&c.push(l);try{m=e.apply(this,c)}catch(f){const p=f;if(d&&n)throw p;return l(p)}d||(m&&m.then&&typeof m.then=="function"?m.then(o,l):m instanceof Error?l(m):o(m))}function l(c,...d){n||(n=!0,t(c,...d))}function o(c){l(null,c)}}const Ka={basename:_B,dirname:EB,extname:MB,join:AB,sep:"/"};function _B(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Yu(e);let n=0,a=-1,l=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(o){n=l+1;break}}else a<0&&(o=!0,a=l+1);return a<0?"":e.slice(n,a)}if(t===e)return"";let c=-1,d=t.length-1;for(;l--;)if(e.codePointAt(l)===47){if(o){n=l+1;break}}else c<0&&(o=!0,c=l+1),d>-1&&(e.codePointAt(l)===t.codePointAt(d--)?d<0&&(a=l):(d=-1,a=c));return n===a?a=c:a<0&&(a=e.length),e.slice(n,a)}function EB(e){if(Yu(e),e.length===0)return".";let t=-1,n=e.length,a;for(;--n;)if(e.codePointAt(n)===47){if(a){t=n;break}}else a||(a=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function MB(e){Yu(e);let t=e.length,n=-1,a=0,l=-1,o=0,c;for(;t--;){const d=e.codePointAt(t);if(d===47){if(c){a=t+1;break}continue}n<0&&(c=!0,n=t+1),d===46?l<0?l=t:o!==1&&(o=1):l>-1&&(o=-1)}return l<0||n<0||o===0||o===1&&l===n-1&&l===a+1?"":e.slice(l,n)}function AB(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function zB(e,t){let n="",a=0,l=-1,o=0,c=-1,d,m;for(;++c<=e.length;){if(c2){if(m=n.lastIndexOf("/"),m!==n.length-1){m<0?(n="",a=0):(n=n.slice(0,m),a=n.length-1-n.lastIndexOf("/")),l=c,o=0;continue}}else if(n.length>0){n="",a=0,l=c,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",a=2)}else n.length>0?n+="/"+e.slice(l+1,c):n=e.slice(l+1,c),a=c-l-1;l=c,o=0}else d===46&&o>-1?o++:o=-1}return n}function Yu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const OB={cwd:RB};function RB(){return"/"}function Gx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function LB(e){if(typeof e=="string")e=new URL(e);else if(!Gx(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return BB(e)}function BB(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const t=e.pathname;let n=-1;for(;++n0){let[b,...N]=p;const k=a[y][1];Vx(k)&&Vx(b)&&(b=qp(!0,k,b)),a[y]=[f,b,...N]}}}}const qB=new lg().freeze();function Vp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Gp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Yp(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function g3(e){if(!Vx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function v3(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function T0(e){return HB(e)?e:new q7(e)}function HB(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function UB(e){return typeof e=="string"||$B(e)}function $B(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const VB="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",y3=[],b3={allowDangerousHtml:!0},GB=/^(https?|ircs?|mailto|xmpp)$/i,YB=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function WB(e){const t=XB(e),n=KB(e);return QB(t.runSync(t.parse(n),n),e)}function XB(e){const t=e.rehypePlugins||y3,n=e.remarkPlugins||y3,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...b3}:b3;return qB().use(ML).use(n).use(NB,a).use(t)}function KB(e){const t=e.children||"",n=new q7;return typeof t=="string"&&(n.value=t),n}function QB(e,t){const n=t.allowedElements,a=t.allowElement,l=t.components,o=t.disallowedElements,c=t.skipHtml,d=t.unwrapDisallowed,m=t.urlTransform||ZB;for(const p of YB)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+VB+p.id,void 0);return sg(e,f),hO(e,{Fragment:r.Fragment,components:l,ignoreInvalidStyle:!0,jsx:r.jsx,jsxs:r.jsxs,passKeys:!0,passNode:!0});function f(p,x,y){if(p.type==="raw"&&y&&typeof x=="number")return c?y.children.splice(x,1):y.children[x]={type:"text",value:p.value},x;if(p.type==="element"){let b;for(b in Bp)if(Object.hasOwn(Bp,b)&&Object.hasOwn(p.properties,b)){const N=p.properties[b],k=Bp[b];(k===null||k.includes(p.tagName))&&(p.properties[b]=m(String(N||""),b,p))}}if(p.type==="element"){let b=n?!n.includes(p.tagName):o?o.includes(p.tagName):!1;if(!b&&a&&typeof x=="number"&&(b=!a(p,x,y)),b&&y&&typeof x=="number")return d&&p.children?y.children.splice(x,1,...p.children):y.children.splice(x,1),x}}}function ZB(e){const t=e.indexOf(":"),n=e.indexOf("?"),a=e.indexOf("#"),l=e.indexOf("/");return t===-1||l!==-1&&t>l||n!==-1&&t>n||a!==-1&&t>a||GB.test(e.slice(0,t))?e:""}function w3(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let a=0,l=n.indexOf(t);for(;l!==-1;)a++,l=n.indexOf(t,l+t.length);return a}function JB(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function eP(e,t,n){const l=Gu((n||{}).ignore||[]),o=tP(t);let c=-1;for(;++c0?{type:"text",value:O}:void 0),O===!1?y.lastIndex=R+1:(N!==R&&M.push({type:"text",value:f.value.slice(N,R)}),Array.isArray(O)?M.push(...O):O&&M.push(O),N=R+A[0].length,T=!0),!y.global)break;A=y.exec(f.value)}return T?(N?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],a=n.indexOf(")");const l=w3(e,"(");let o=w3(e,")");for(;a!==-1&&l>o;)e+=n.slice(0,a+1),n=n.slice(a+1),a=n.indexOf(")"),o++;return[e,n]}function H7(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||yi(n)||Um(n))&&(!t||n!==47)}U7.peek=SP;function xP(){this.buffer()}function gP(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function vP(){this.buffer()}function yP(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function bP(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=qa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function wP(e){this.exit(e)}function jP(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=qa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function NP(e){this.exit(e)}function SP(){return"["}function U7(e,t,n,a){const l=n.createTracker(a);let o=l.move("[^");const c=n.enter("footnoteReference"),d=n.enter("reference");return o+=l.move(n.safe(n.associationId(e),{after:"]",before:o})),d(),c(),o+=l.move("]"),o}function kP(){return{enter:{gfmFootnoteCallString:xP,gfmFootnoteCall:gP,gfmFootnoteDefinitionLabelString:vP,gfmFootnoteDefinition:yP},exit:{gfmFootnoteCallString:bP,gfmFootnoteCall:wP,gfmFootnoteDefinitionLabelString:jP,gfmFootnoteDefinition:NP}}}function CP(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:U7},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(a,l,o,c){const d=o.createTracker(c);let m=d.move("[^");const f=o.enter("footnoteDefinition"),p=o.enter("label");return m+=d.move(o.safe(o.associationId(a),{before:m,after:"]"})),p(),m+=d.move("]:"),a.children&&a.children.length>0&&(d.shift(4),m+=d.move((t?` -`:" ")+o.indentLines(o.containerFlow(a,d.current()),t?$7:TP))),f(),m}}function TP(e,t,n){return t===0?e:$7(e,t,n)}function $7(e,t,n){return(n?"":" ")+e}const _P=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];V7.peek=zP;function EP(){return{canContainEols:["delete"],enter:{strikethrough:AP},exit:{strikethrough:DP}}}function MP(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:_P}],handlers:{delete:V7}}}function AP(e){this.enter({type:"delete",children:[]},e)}function DP(e){this.exit(e)}function V7(e,t,n,a){const l=n.createTracker(a),o=n.enter("strikethrough");let c=l.move("~~");return c+=n.containerPhrasing(e,{...l.current(),before:c,after:"~"}),c+=l.move("~~"),o(),c}function zP(){return"~"}function OP(e){return e.length}function RP(e,t){const n=t||{},a=(n.align||[]).concat(),l=n.stringLength||OP,o=[],c=[],d=[],m=[];let f=0,p=-1;for(;++pf&&(f=e[p].length);++Tm[T])&&(m[T]=A)}k.push(M)}c[p]=k,d[p]=S}let x=-1;if(typeof a=="object"&&"length"in a)for(;++xm[x]&&(m[x]=M),b[x]=M),y[x]=A}c.splice(1,0,y),d.splice(1,0,b),p=-1;const N=[];for(;++p "),o.shift(2);const c=n.indentLines(n.containerFlow(e,o.current()),PP);return l(),c}function PP(e,t,n){return">"+(n?"":" ")+e}function FP(e,t){return N3(e,t.inConstruct,!0)&&!N3(e,t.notInConstruct,!1)}function N3(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let a=-1;for(;++ac&&(c=o):o=1,l=a+t.length,a=n.indexOf(t,l);return c}function IP(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function qP(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function HP(e,t,n,a){const l=qP(n),o=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(IP(e,n)){const x=n.enter("codeIndented"),y=n.indentLines(o,UP);return x(),y}const d=n.createTracker(a),m=l.repeat(Math.max(G7(o,l)+1,3)),f=n.enter("codeFenced");let p=d.move(m);if(e.lang){const x=n.enter(`codeFencedLang${c}`);p+=d.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...d.current()})),x()}if(e.lang&&e.meta){const x=n.enter(`codeFencedMeta${c}`);p+=d.move(" "),p+=d.move(n.safe(e.meta,{before:p,after:` -`,encode:["`"],...d.current()})),x()}return p+=d.move(` -`),o&&(p+=d.move(o+` -`)),p+=d.move(m),f(),p}function UP(e,t,n){return(n?"":" ")+e}function ig(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function $P(e,t,n,a){const l=ig(n),o=l==='"'?"Quote":"Apostrophe",c=n.enter("definition");let d=n.enter("label");const m=n.createTracker(a);let f=m.move("[");return f+=m.move(n.safe(n.associationId(e),{before:f,after:"]",...m.current()})),f+=m.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),f+=m.move("<"),f+=m.move(n.safe(e.url,{before:f,after:">",...m.current()})),f+=m.move(">")):(d=n.enter("destinationRaw"),f+=m.move(n.safe(e.url,{before:f,after:e.title?" ":` -`,...m.current()}))),d(),e.title&&(d=n.enter(`title${o}`),f+=m.move(" "+l),f+=m.move(n.safe(e.title,{before:f,after:l,...m.current()})),f+=m.move(l),d()),c(),f}function VP(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function wu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function mm(e,t,n){const a=Ho(e),l=Ho(t);return a===void 0?l===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Y7.peek=GP;function Y7(e,t,n,a){const l=VP(n),o=n.enter("emphasis"),c=n.createTracker(a),d=c.move(l);let m=c.move(n.containerPhrasing(e,{after:l,before:d,...c.current()}));const f=m.charCodeAt(0),p=mm(a.before.charCodeAt(a.before.length-1),f,l);p.inside&&(m=wu(f)+m.slice(1));const x=m.charCodeAt(m.length-1),y=mm(a.after.charCodeAt(0),x,l);y.inside&&(m=m.slice(0,-1)+wu(x));const b=c.move(l);return o(),n.attentionEncodeSurroundingInfo={after:y.outside,before:p.outside},d+m+b}function GP(e,t,n){return n.options.emphasis||"*"}function YP(e,t){let n=!1;return sg(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return n=!0,Ux}),!!((!e.depth||e.depth<3)&&Q1(e)&&(t.options.setext||n))}function WP(e,t,n,a){const l=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(a);if(YP(e,n)){const p=n.enter("headingSetext"),x=n.enter("phrasing"),y=n.containerPhrasing(e,{...o.current(),before:` -`,after:` -`});return x(),p(),y+` -`+(l===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(` -`))+1))}const c="#".repeat(l),d=n.enter("headingAtx"),m=n.enter("phrasing");o.move(c+" ");let f=n.containerPhrasing(e,{before:"# ",after:` -`,...o.current()});return/^[\t ]/.test(f)&&(f=wu(f.charCodeAt(0))+f.slice(1)),f=f?c+" "+f:c,n.options.closeAtx&&(f+=" "+c),m(),d(),f}W7.peek=XP;function W7(e){return e.value||""}function XP(){return"<"}X7.peek=KP;function X7(e,t,n,a){const l=ig(n),o=l==='"'?"Quote":"Apostrophe",c=n.enter("image");let d=n.enter("label");const m=n.createTracker(a);let f=m.move("![");return f+=m.move(n.safe(e.alt,{before:f,after:"]",...m.current()})),f+=m.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),f+=m.move("<"),f+=m.move(n.safe(e.url,{before:f,after:">",...m.current()})),f+=m.move(">")):(d=n.enter("destinationRaw"),f+=m.move(n.safe(e.url,{before:f,after:e.title?" ":")",...m.current()}))),d(),e.title&&(d=n.enter(`title${o}`),f+=m.move(" "+l),f+=m.move(n.safe(e.title,{before:f,after:l,...m.current()})),f+=m.move(l),d()),f+=m.move(")"),c(),f}function KP(){return"!"}K7.peek=QP;function K7(e,t,n,a){const l=e.referenceType,o=n.enter("imageReference");let c=n.enter("label");const d=n.createTracker(a);let m=d.move("![");const f=n.safe(e.alt,{before:m,after:"]",...d.current()});m+=d.move(f+"]["),c();const p=n.stack;n.stack=[],c=n.enter("reference");const x=n.safe(n.associationId(e),{before:m,after:"]",...d.current()});return c(),n.stack=p,o(),l==="full"||!f||f!==x?m+=d.move(x+"]"):l==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function QP(){return"!"}Q7.peek=ZP;function Q7(e,t,n){let a=e.value||"",l="`",o=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(a);)l+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++o\u007F]/.test(e.url))}J7.peek=JP;function J7(e,t,n,a){const l=ig(n),o=l==='"'?"Quote":"Apostrophe",c=n.createTracker(a);let d,m;if(Z7(e,n)){const p=n.stack;n.stack=[],d=n.enter("autolink");let x=c.move("<");return x+=c.move(n.containerPhrasing(e,{before:x,after:">",...c.current()})),x+=c.move(">"),d(),n.stack=p,x}d=n.enter("link"),m=n.enter("label");let f=c.move("[");return f+=c.move(n.containerPhrasing(e,{before:f,after:"](",...c.current()})),f+=c.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=n.enter("destinationLiteral"),f+=c.move("<"),f+=c.move(n.safe(e.url,{before:f,after:">",...c.current()})),f+=c.move(">")):(m=n.enter("destinationRaw"),f+=c.move(n.safe(e.url,{before:f,after:e.title?" ":")",...c.current()}))),m(),e.title&&(m=n.enter(`title${o}`),f+=c.move(" "+l),f+=c.move(n.safe(e.title,{before:f,after:l,...c.current()})),f+=c.move(l),m()),f+=c.move(")"),d(),f}function JP(e,t,n){return Z7(e,n)?"<":"["}e8.peek=eF;function e8(e,t,n,a){const l=e.referenceType,o=n.enter("linkReference");let c=n.enter("label");const d=n.createTracker(a);let m=d.move("[");const f=n.containerPhrasing(e,{before:m,after:"]",...d.current()});m+=d.move(f+"]["),c();const p=n.stack;n.stack=[],c=n.enter("reference");const x=n.safe(n.associationId(e),{before:m,after:"]",...d.current()});return c(),n.stack=p,o(),l==="full"||!f||f!==x?m+=d.move(x+"]"):l==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function eF(){return"["}function og(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function tF(e){const t=og(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function nF(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function t8(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function rF(e,t,n,a){const l=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?nF(n):og(n);const d=e.ordered?c==="."?")":".":tF(n);let m=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(m=!0),t8(n)===c&&p){let x=-1;for(;++x-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let c=o.length+1;(l==="tab"||l==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const d=n.createTracker(a);d.move(o+" ".repeat(c-o.length)),d.shift(c);const m=n.enter("listItem"),f=n.indentLines(n.containerFlow(e,d.current()),p);return m(),f;function p(x,y,b){return y?(b?"":" ".repeat(c))+x:(b?o:o+" ".repeat(c-o.length))+x}}function lF(e,t,n,a){const l=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,a);return o(),l(),c}const iF=Gu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function oF(e,t,n,a){return(e.children.some(function(c){return iF(c)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function cF(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}n8.peek=uF;function n8(e,t,n,a){const l=cF(n),o=n.enter("strong"),c=n.createTracker(a),d=c.move(l+l);let m=c.move(n.containerPhrasing(e,{after:l,before:d,...c.current()}));const f=m.charCodeAt(0),p=mm(a.before.charCodeAt(a.before.length-1),f,l);p.inside&&(m=wu(f)+m.slice(1));const x=m.charCodeAt(m.length-1),y=mm(a.after.charCodeAt(0),x,l);y.inside&&(m=m.slice(0,-1)+wu(x));const b=c.move(l+l);return o(),n.attentionEncodeSurroundingInfo={after:y.outside,before:p.outside},d+m+b}function uF(e,t,n){return n.options.strong||"*"}function dF(e,t,n,a){return n.safe(e.value,a)}function mF(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function hF(e,t,n){const a=(t8(n)+(n.options.ruleSpaces?" ":"")).repeat(mF(n));return n.options.ruleSpaces?a.slice(0,-1):a}const r8={blockquote:BP,break:S3,code:HP,definition:$P,emphasis:Y7,hardBreak:S3,heading:WP,html:W7,image:X7,imageReference:K7,inlineCode:Q7,link:J7,linkReference:e8,list:rF,listItem:sF,paragraph:lF,root:oF,strong:n8,text:dF,thematicBreak:hF};function fF(){return{enter:{table:pF,tableData:k3,tableHeader:k3,tableRow:gF},exit:{codeText:vF,table:xF,tableData:Qp,tableHeader:Qp,tableRow:Qp}}}function pF(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function xF(e){this.exit(e),this.data.inTable=void 0}function gF(e){this.enter({type:"tableRow",children:[]},e)}function Qp(e){this.exit(e)}function k3(e){this.enter({type:"tableCell",children:[]},e)}function vF(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,yF));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function yF(e,t){return t==="|"?t:e}function bF(e){const t=e||{},n=t.tableCellPadding,a=t.tablePipeAlign,l=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` -`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:c,tableCell:m,tableRow:d}};function c(b,N,k,S){return f(p(b,k,S),b.align)}function d(b,N,k,S){const T=x(b,k,S),M=f([T]);return M.slice(0,M.indexOf(` -`))}function m(b,N,k,S){const T=k.enter("tableCell"),M=k.enter("phrasing"),A=k.containerPhrasing(b,{...S,before:o,after:o});return M(),T(),A}function f(b,N){return RP(b,{align:N,alignDelimiters:a,padding:n,stringLength:l})}function p(b,N,k){const S=b.children;let T=-1;const M=[],A=N.enter("table");for(;++T0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const PF={tokenize:GF,partial:!0};function FF(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:UF,continuation:{tokenize:$F},exit:VF}},text:{91:{name:"gfmFootnoteCall",tokenize:HF},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:IF,resolveTo:qF}}}}function IF(e,t,n){const a=this;let l=a.events.length;const o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let c;for(;l--;){const m=a.events[l][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return d;function d(m){if(!c||!c._balanced)return n(m);const f=qa(a.sliceSerialize({start:c.end,end:a.now()}));return f.codePointAt(0)!==94||!o.includes(f.slice(1))?n(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),t(m))}}function qF(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},d=[e[n+1],e[n+2],["enter",a,t],e[n+3],e[n+4],["enter",l,t],["exit",l,t],["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(n,e.length-n+1,...d),e}function HF(e,t,n){const a=this,l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o=0,c;return d;function d(x){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),m}function m(x){return x!==94?n(x):(e.enter("gfmFootnoteCallMarker"),e.consume(x),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(x){if(o>999||x===93&&!c||x===null||x===91||pn(x))return n(x);if(x===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return l.includes(qa(a.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(x)}return pn(x)||(c=!0),o++,e.consume(x),x===92?p:f}function p(x){return x===91||x===92||x===93?(e.consume(x),o++,f):f(x)}}function UF(e,t,n){const a=this,l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o,c=0,d;return m;function m(N){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(N),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(N){return N===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(N),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(N)}function p(N){if(c>999||N===93&&!d||N===null||N===91||pn(N))return n(N);if(N===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=qa(a.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(N),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return pn(N)||(d=!0),c++,e.consume(N),N===92?x:p}function x(N){return N===91||N===92||N===93?(e.consume(N),c++,p):p(N)}function y(N){return N===58?(e.enter("definitionMarker"),e.consume(N),e.exit("definitionMarker"),l.includes(o)||l.push(o),St(e,b,"gfmFootnoteDefinitionWhitespace")):n(N)}function b(N){return t(N)}}function $F(e,t,n){return e.check(Vu,t,e.attempt(PF,t,n))}function VF(e){e.exit("gfmFootnoteDefinition")}function GF(e,t,n){const a=this;return St(e,l,"gfmFootnoteDefinitionIndent",5);function l(o){const c=a.events[a.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(o):n(o)}}function YF(e){let n=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:o,resolveAll:l};return n==null&&(n=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function l(c,d){let m=-1;for(;++m1?m(N):(c.consume(N),x++,b);if(x<2&&!n)return m(N);const S=c.exit("strikethroughSequenceTemporary"),T=Ho(N);return S._open=!T||T===2&&!!k,S._close=!k||k===2&&!!T,d(N)}}}class WF{constructor(){this.map=[]}add(t,n,a){XF(this,t,n,a)}consume(t){if(this.map.sort(function(o,c){return o[0]-c[0]}),this.map.length===0)return;let n=this.map.length;const a=[];for(;n>0;)n-=1,a.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];a.push(t.slice()),t.length=0;let l=a.pop();for(;l;){for(const o of l)t.push(o);l=a.pop()}this.map.length=0}}function XF(e,t,n,a){let l=0;if(!(n===0&&a.length===0)){for(;l-1;){const J=a.events[G][1].type;if(J==="lineEnding"||J==="linePrefix")G--;else break}const ee=G>-1?a.events[G][1].type:null,Ne=ee==="tableHead"||ee==="tableRow"?O:m;return Ne===O&&a.parser.lazy[a.now().line]?n(I):Ne(I)}function m(I){return e.enter("tableHead"),e.enter("tableRow"),f(I)}function f(I){return I===124||(c=!0,o+=1),p(I)}function p(I){return I===null?n(I):We(I)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),b):n(I):Mt(I)?St(e,p,"whitespace")(I):(o+=1,c&&(c=!1,l+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),c=!0,p):(e.enter("data"),x(I)))}function x(I){return I===null||I===124||pn(I)?(e.exit("data"),p(I)):(e.consume(I),I===92?y:x)}function y(I){return I===92||I===124?(e.consume(I),x):x(I)}function b(I){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(I):(e.enter("tableDelimiterRow"),c=!1,Mt(I)?St(e,N,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):N(I))}function N(I){return I===45||I===58?S(I):I===124?(c=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),k):B(I)}function k(I){return Mt(I)?St(e,S,"whitespace")(I):S(I)}function S(I){return I===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),T):I===45?(o+=1,T(I)):I===null||We(I)?R(I):B(I)}function T(I){return I===45?(e.enter("tableDelimiterFiller"),M(I)):B(I)}function M(I){return I===45?(e.consume(I),M):I===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),A):(e.exit("tableDelimiterFiller"),A(I))}function A(I){return Mt(I)?St(e,R,"whitespace")(I):R(I)}function R(I){return I===124?N(I):I===null||We(I)?!c||l!==o?B(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):B(I)}function B(I){return n(I)}function O(I){return e.enter("tableRow"),L(I)}function L(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),L):I===null||We(I)?(e.exit("tableRow"),t(I)):Mt(I)?St(e,L,"whitespace")(I):(e.enter("data"),$(I))}function $(I){return I===null||I===124||pn(I)?(e.exit("data"),L(I)):(e.consume(I),I===92?U:$)}function U(I){return I===92||I===124?(e.consume(I),$):$(I)}}function JF(e,t){let n=-1,a=!0,l=0,o=[0,0,0,0],c=[0,0,0,0],d=!1,m=0,f,p,x;const y=new WF;for(;++nn[2]+1){const N=n[2]+1,k=n[3]-n[2]-1;e.add(N,k,[])}}e.add(n[3]+1,0,[["exit",x,t]])}return l!==void 0&&(o.end=Object.assign({},_o(t.events,l)),e.add(l,0,[["exit",o,t]]),o=void 0),o}function T3(e,t,n,a,l){const o=[],c=_o(t.events,n);l&&(l.end=Object.assign({},c),o.push(["exit",l,t])),a.end=Object.assign({},c),o.push(["exit",a,t]),e.add(n+1,0,o)}function _o(e,t){const n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}const eI={name:"tasklistCheck",tokenize:nI};function tI(){return{text:{91:eI}}}function nI(e,t,n){const a=this;return l;function l(m){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?n(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),o)}function o(m){return pn(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):n(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),d):n(m)}function d(m){return We(m)?t(m):Mt(m)?e.check({tokenize:rI},t,n)(m):n(m)}}function rI(e,t,n){return St(e,a,"whitespace");function a(l){return l===null?n(l):t(l)}}function aI(e){return w7([EF(),FF(),YF(e),QF(),tI()])}const sI={};function lI(e){const t=this,n=e||sI,a=t.data(),l=a.micromarkExtensions||(a.micromarkExtensions=[]),o=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);l.push(aI(n)),o.push(kF()),c.push(CF(n))}function iI(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:o},exit:{mathFlow:l,mathFlowFence:a,mathFlowFenceMeta:n,mathFlowValue:d,mathText:c,mathTextData:d}};function e(m){const f={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[f]}},m)}function t(){this.buffer()}function n(){const m=this.resume(),f=this.stack[this.stack.length-1];f.type,f.meta=m}function a(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function l(m){const f=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),p=this.stack[this.stack.length-1];p.type,this.exit(m),p.value=f;const x=p.data.hChildren[0];x.type,x.tagName,x.children.push({type:"text",value:f}),this.data.mathFlowInside=void 0}function o(m){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},m),this.buffer()}function c(m){const f=this.resume(),p=this.stack[this.stack.length-1];p.type,this.exit(m),p.value=f,p.data.hChildren.push({type:"text",value:f})}function d(m){this.config.enter.data.call(this,m),this.config.exit.data.call(this,m)}}function oI(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),a.peek=l,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` -`,inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:a}};function n(o,c,d,m){const f=o.value||"",p=d.createTracker(m),x="$".repeat(Math.max(G7(f,"$")+1,2)),y=d.enter("mathFlow");let b=p.move(x);if(o.meta){const N=d.enter("mathFlowMeta");b+=p.move(d.safe(o.meta,{after:` -`,before:b,encode:["$"],...p.current()})),N()}return b+=p.move(` -`),f&&(b+=p.move(f+` -`)),b+=p.move(x),y(),b}function a(o,c,d){let m=o.value||"",f=1;for(t||f++;new RegExp("(^|[^$])"+"\\$".repeat(f)+"([^$]|$)").test(m);)f++;const p="$".repeat(f);/[^ \r\n]/.test(m)&&(/^[ \r\n]/.test(m)&&/[ \r\n]$/.test(m)||/^\$|\$$/.test(m))&&(m=" "+m+" ");let x=-1;for(;++x15?f="…"+d.slice(l-15,l):f=d.slice(0,l);var p;o+15":">","<":"<",'"':""","'":"'"},bI=/[&><"']/g;function wI(e){return String(e).replace(bI,t=>yI[t])}var m8=function e(t){return t.type==="ordgroup"||t.type==="color"?t.body.length===1?e(t.body[0]):t:t.type==="font"?e(t.body):t},jI=function(t){var n=m8(t);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},NI=function(t){if(!t)throw new Error("Expected non-null, but got "+String(t));return t},SI=function(t){var n=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(t);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},Ut={deflt:xI,escape:wI,hyphenate:vI,getBaseElem:m8,isCharacterBox:jI,protocolFromUrl:SI},K0={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand ",cliProcessor:e=>e==="Infinity"?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function kI(e){if(e.default)return e.default;var t=e.type,n=Array.isArray(t)?t[0]:t;if(typeof n!="string")return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class ug{constructor(t){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,t=t||{};for(var n in K0)if(K0.hasOwnProperty(n)){var a=K0[n];this[n]=t[n]!==void 0?a.processor?a.processor(t[n]):t[n]:kI(a)}}reportNonstrict(t,n,a){var l=this.strict;if(typeof l=="function"&&(l=l(t,n,a)),!(!l||l==="ignore")){if(l===!0||l==="error")throw new Ae("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+t+"]"),a);l==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+l+"': "+n+" ["+t+"]"))}}useStrictBehavior(t,n,a){var l=this.strict;if(typeof l=="function")try{l=l(t,n,a)}catch{l="error"}return!l||l==="ignore"?!1:l===!0||l==="error"?!0:l==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+l+"': "+n+" ["+t+"]")),!1)}isTrusted(t){if(t.url&&!t.protocol){var n=Ut.protocolFromUrl(t.url);if(n==null)return!1;t.protocol=n}var a=typeof this.trust=="function"?this.trust(t):this.trust;return!!a}}class vl{constructor(t,n,a){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=n,this.cramped=a}sup(){return Za[CI[this.id]]}sub(){return Za[TI[this.id]]}fracNum(){return Za[_I[this.id]]}fracDen(){return Za[EI[this.id]]}cramp(){return Za[MI[this.id]]}text(){return Za[AI[this.id]]}isTight(){return this.size>=2}}var dg=0,hm=1,Ro=2,Rs=3,ju=4,Ca=5,Uo=6,_r=7,Za=[new vl(dg,0,!1),new vl(hm,0,!0),new vl(Ro,1,!1),new vl(Rs,1,!0),new vl(ju,2,!1),new vl(Ca,2,!0),new vl(Uo,3,!1),new vl(_r,3,!0)],CI=[ju,Ca,ju,Ca,Uo,_r,Uo,_r],TI=[Ca,Ca,Ca,Ca,_r,_r,_r,_r],_I=[Ro,Rs,ju,Ca,Uo,_r,Uo,_r],EI=[Rs,Rs,Ca,Ca,_r,_r,_r,_r],MI=[hm,hm,Rs,Rs,Ca,Ca,_r,_r],AI=[dg,hm,Ro,Rs,Ro,Rs,Ro,Rs],tt={DISPLAY:Za[dg],TEXT:Za[Ro],SCRIPT:Za[ju],SCRIPTSCRIPT:Za[Uo]},Wx=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function DI(e){for(var t=0;t=l[0]&&e<=l[1])return n.name}return null}var Q0=[];Wx.forEach(e=>e.blocks.forEach(t=>Q0.push(...t)));function h8(e){for(var t=0;t=Q0[t]&&e<=Q0[t+1])return!0;return!1}var wo=80,zI=function(t,n){return"M95,"+(622+t+n)+` -c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 -c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 -c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 -s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429 -c69,-144,104.5,-217.7,106.5,-221 -l`+t/2.075+" -"+t+` -c5.3,-9.3,12,-14,20,-14 -H400000v`+(40+t)+`H845.2724 -s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 -c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z -M`+(834+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},OI=function(t,n){return"M263,"+(601+t+n)+`c0.7,0,18,39.7,52,119 -c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 -c340,-704.7,510.7,-1060.3,512,-1067 -l`+t/2.084+" -"+t+` -c4.7,-7.3,11,-11,19,-11 -H40000v`+(40+t)+`H1012.3 -s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232 -c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 -s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 -c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z -M`+(1001+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},RI=function(t,n){return"M983 "+(10+t+n)+` -l`+t/3.13+" -"+t+` -c4,-6.7,10,-10,18,-10 H400000v`+(40+t)+` -H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 -s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744 -c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 -c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 -c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 -c53.7,-170.3,84.5,-266.8,92.5,-289.5z -M`+(1001+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},LI=function(t,n){return"M424,"+(2398+t+n)+` -c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 -c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 -s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 -s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081 -l`+t/4.223+" -"+t+`c4,-6.7,10,-10,18,-10 H400000 -v`+(40+t)+`H1014.6 -s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 -c-2,6,-10,9,-24,9 -c-8,0,-12,-0.7,-12,-2z M`+(1001+t)+" "+n+` -h400000v`+(40+t)+"h-400000z"},BI=function(t,n){return"M473,"+(2713+t+n)+` -c339.3,-1799.3,509.3,-2700,510,-2702 l`+t/5.298+" -"+t+` -c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+t)+`H1017.7 -s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 -c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 -c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 -s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, -606zM`+(1001+t)+" "+n+"h400000v"+(40+t)+"H1017.7z"},PI=function(t){var n=t/2;return"M400000 "+t+" H0 L"+n+" 0 l65 45 L145 "+(t-80)+" H400000z"},FI=function(t,n,a){var l=a-54-n-t;return"M702 "+(t+n)+"H400000"+(40+t)+` -H742v`+l+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 -h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 -c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 -219 661 l218 661zM702 `+n+"H400000v"+(40+t)+"H742z"},II=function(t,n,a){n=1e3*n;var l="";switch(t){case"sqrtMain":l=zI(n,wo);break;case"sqrtSize1":l=OI(n,wo);break;case"sqrtSize2":l=RI(n,wo);break;case"sqrtSize3":l=LI(n,wo);break;case"sqrtSize4":l=BI(n,wo);break;case"sqrtTall":l=FI(n,wo,a)}return l},qI=function(t,n){switch(t){case"⎜":return"M291 0 H417 V"+n+" H291z M291 0 H417 V"+n+" H291z";case"∣":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z";case"∥":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z"+("M367 0 H410 V"+n+" H367z M367 0 H410 V"+n+" H367z");case"⎟":return"M457 0 H583 V"+n+" H457z M457 0 H583 V"+n+" H457z";case"⎢":return"M319 0 H403 V"+n+" H319z M319 0 H403 V"+n+" H319z";case"⎥":return"M263 0 H347 V"+n+" H263z M263 0 H347 V"+n+" H263z";case"⎪":return"M384 0 H504 V"+n+" H384z M384 0 H504 V"+n+" H384z";case"⏐":return"M312 0 H355 V"+n+" H312z M312 0 H355 V"+n+" H312z";case"‖":return"M257 0 H300 V"+n+" H257z M257 0 H300 V"+n+" H257z"+("M478 0 H521 V"+n+" H478z M478 0 H521 V"+n+" H478z");default:return""}},E3={doubleleftarrow:`M262 157 -l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3 - 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28 - 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5 -c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5 - 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87 --86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7 --2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z -m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l --10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5 - 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88 --33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68 --17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18 --13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782 -c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3 --107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120 - 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8 --5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247 -c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208 - 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3 - 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202 - l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117 --45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7 - 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13 - 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688 - 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7 --331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80 -H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0 - 435 0h399565z`,leftgroupunder:`M400000 262 -H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219 - 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3 --3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5 --18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7 --196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5 - 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3 --4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7 --10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z -m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333 - 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5 - 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667 --152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12 - 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7 --2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0 -v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5 --83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3 --68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21 - 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z -M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z -M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23 --.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8 -c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3 - 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z -M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334 -c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14 --53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7 - 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11 - 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214 -c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14 - 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3 - 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0 --5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6 --320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z -m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8 -60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8 --451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z -m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2 -c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6 --480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z -m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0 -85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8 --707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z -m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1 -c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128 --16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 - 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 - 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85 --40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 --12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 - 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l --6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5 -s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1 -c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3 - 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237 --174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0 - 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18 - 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3 --3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2 --10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 - 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11 --18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7 - 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z -m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8 - 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5 --7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95 --27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8 - 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 - 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3 --64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z -m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3 - 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0 --13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21 - 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z -M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23 - 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32 --52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142 --167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40 - 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69 --70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3 --40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19 --37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101 - 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167 -c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3 - 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42 - 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333 --19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70 - 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7 --2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0 - 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0 - 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128 --68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418 --8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9 - 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114 -c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751 - 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457 --11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0 - 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697 - 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696 - -338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345 --11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409 - 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9 - 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409 - -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5 -3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11 -10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63 --1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1 --7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59 -H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359 -c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22 -c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10 --11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10 --11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10 --11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1, --5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, --11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, --11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, --11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202 -c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5 -c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130 -s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47 -121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6 -s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11 -c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z -M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32 --27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0 -13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39 --84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5 --119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 --12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 -151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 -c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17 -c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21 -c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40 -c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z -M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0 -c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, --231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 -c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z -M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 -c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9, -1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7, --152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z -M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0 -c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, --231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 -c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z -M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},HI=function(t,n){switch(t){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v1759 h347 v-84 -H403z M403 1759 V0 H319 V1759 v`+n+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v1759 H0 v84 H347z -M347 1759 V0 H263 V1759 v`+n+" v1759 h84z";case"vert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15 -c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 -c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+" v585 h43z";case"doublevert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15 -c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 -c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+` v585 h43z -M367 15 v585 v`+n+` v585 c2.667,10,9.667,15,21,15 -c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 -c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+n+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+n+` v1715 h263 v84 H319z -MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+n+` v1799 H0 v-84 H319z -MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v602 h84z -M403 1759 V0 H319 V1759 v`+n+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v602 h84z -M347 1759 V0 h-84 V1759 v`+n+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1 -c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349, --36,557 l0,`+(n+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210, -949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9 -c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5, --544.7,-112.5,-882c-2,-104,-3,-167,-3,-189 -l0,-`+(n+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3, --210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3, -63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5 -c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(n+9)+` -c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664 -c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11 -c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 -c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 -l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, --470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class Wu{constructor(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){for(var t=document.createDocumentFragment(),n=0;nn.toText();return this.children.map(t).join("")}}var ts={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},E0={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},M3={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function UI(e,t){ts[e]=t}function mg(e,t,n){if(!ts[t])throw new Error("Font metrics not found for font: "+t+".");var a=e.charCodeAt(0),l=ts[t][a];if(!l&&e[0]in M3&&(a=M3[e[0]].charCodeAt(0),l=ts[t][a]),!l&&n==="text"&&h8(a)&&(l=ts[t][77]),l)return{depth:l[0],height:l[1],italic:l[2],skew:l[3],width:l[4]}}var Zp={};function $I(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!Zp[t]){var n=Zp[t]={cssEmPerMu:E0.quad[t]/18};for(var a in E0)E0.hasOwnProperty(a)&&(n[a]=E0[a][t])}return Zp[t]}var VI=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],A3=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],D3=function(t,n){return n.size<2?t:VI[t-1][n.size-1]};class Ds{constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||Ds.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.sizeMultiplier=A3[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}extend(t){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var a in t)t.hasOwnProperty(a)&&(n[a]=t[a]);return new Ds(n)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:D3(this.textSize,t)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(t){return this.size===t&&this.textSize===t?this:this.extend({style:this.style.text(),size:t,textSize:t,sizeMultiplier:A3[t-1]})}havingBaseStyle(t){t=t||this.style.text();var n=D3(Ds.BASESIZE,t);return this.size===n&&this.textSize===Ds.BASESIZE&&this.style===t?this:this.extend({style:t,size:n})}havingBaseSizing(){var t;switch(this.style.id){case 4:case 5:t=3;break;case 6:case 7:t=1;break;default:t=6}return this.extend({style:this.style.text(),size:t})}withColor(t){return this.extend({color:t})}withPhantom(){return this.extend({phantom:!0})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}sizingClasses(t){return t.size!==this.size?["sizing","reset-size"+t.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==Ds.BASESIZE?["sizing","reset-size"+this.size,"size"+Ds.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=$I(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Ds.BASESIZE=6;var Xx={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},GI={ex:!0,em:!0,mu:!0},f8=function(t){return typeof t!="string"&&(t=t.unit),t in Xx||t in GI||t==="ex"},Mn=function(t,n){var a;if(t.unit in Xx)a=Xx[t.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(t.unit==="mu")a=n.fontMetrics().cssEmPerMu;else{var l;if(n.style.isTight()?l=n.havingStyle(n.style.text()):l=n,t.unit==="ex")a=l.fontMetrics().xHeight;else if(t.unit==="em")a=l.fontMetrics().quad;else throw new Ae("Invalid unit: '"+t.unit+"'");l!==n&&(a*=l.sizeMultiplier/n.sizeMultiplier)}return Math.min(t.number*a,n.maxSize)},Le=function(t){return+t.toFixed(4)+"em"},El=function(t){return t.filter(n=>n).join(" ")},p8=function(t,n,a){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=a||{},n){n.style.isTight()&&this.classes.push("mtight");var l=n.getColor();l&&(this.style.color=l)}},x8=function(t){var n=document.createElement(t);n.className=El(this.classes);for(var a in this.style)this.style.hasOwnProperty(a)&&(n.style[a]=this.style[a]);for(var l in this.attributes)this.attributes.hasOwnProperty(l)&&n.setAttribute(l,this.attributes[l]);for(var o=0;o/=\x00-\x1f]/,g8=function(t){var n="<"+t;this.classes.length&&(n+=' class="'+Ut.escape(El(this.classes))+'"');var a="";for(var l in this.style)this.style.hasOwnProperty(l)&&(a+=Ut.hyphenate(l)+":"+this.style[l]+";");a&&(n+=' style="'+Ut.escape(a)+'"');for(var o in this.attributes)if(this.attributes.hasOwnProperty(o)){if(YI.test(o))throw new Ae("Invalid attribute name '"+o+"'");n+=" "+o+'="'+Ut.escape(this.attributes[o])+'"'}n+=">";for(var c=0;c",n};class Xu{constructor(t,n,a,l){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,p8.call(this,t,a,l),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return x8.call(this,"span")}toMarkup(){return g8.call(this,"span")}}class hg{constructor(t,n,a,l){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,p8.call(this,n,l),this.children=a||[],this.setAttribute("href",t)}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return x8.call(this,"a")}toMarkup(){return g8.call(this,"a")}}class WI{constructor(t,n,a){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=t,this.classes=["mord"],this.style=a}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createElement("img");t.src=this.src,t.alt=this.alt,t.className="mord";for(var n in this.style)this.style.hasOwnProperty(n)&&(t.style[n]=this.style[n]);return t}toMarkup(){var t=''+Ut.escape(this.alt)+'0&&(n=document.createElement("span"),n.style.marginRight=Le(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=El(this.classes));for(var a in this.style)this.style.hasOwnProperty(a)&&(n=n||document.createElement("span"),n.style[a]=this.style[a]);return n?(n.appendChild(t),n):t}toMarkup(){var t=!1,n="0&&(a+="margin-right:"+this.italic+"em;");for(var l in this.style)this.style.hasOwnProperty(l)&&(a+=Ut.hyphenate(l)+":"+this.style[l]+";");a&&(t=!0,n+=' style="'+Ut.escape(a)+'"');var o=Ut.escape(this.text);return t?(n+=">",n+=o,n+="",n):o}}class Fs{constructor(t,n){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=n||{}}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");for(var a in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,a)&&n.setAttribute(a,this.attributes[a]);for(var l=0;l':''}}class Kx{constructor(t){this.attributes=void 0,this.attributes=t||{}}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"line");for(var a in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,a)&&n.setAttribute(a,this.attributes[a]);return n}toMarkup(){var t=" but got "+String(e)+".")}var QI={bin:1,close:1,inner:1,open:1,punct:1,rel:1},ZI={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},yn={math:{},text:{}};function j(e,t,n,a,l,o){yn[e][l]={font:t,group:n,replace:a},o&&a&&(yn[e][a]=yn[e][l])}var C="math",_e="text",D="main",V="ams",kn="accent-token",Ie="bin",Mr="close",tc="inner",Je="mathord",Yn="op-token",ha="open",Ym="punct",Y="rel",$s="spacing",ae="textord";j(C,D,Y,"≡","\\equiv",!0);j(C,D,Y,"≺","\\prec",!0);j(C,D,Y,"≻","\\succ",!0);j(C,D,Y,"∼","\\sim",!0);j(C,D,Y,"⊥","\\perp");j(C,D,Y,"⪯","\\preceq",!0);j(C,D,Y,"⪰","\\succeq",!0);j(C,D,Y,"≃","\\simeq",!0);j(C,D,Y,"∣","\\mid",!0);j(C,D,Y,"≪","\\ll",!0);j(C,D,Y,"≫","\\gg",!0);j(C,D,Y,"≍","\\asymp",!0);j(C,D,Y,"∥","\\parallel");j(C,D,Y,"⋈","\\bowtie",!0);j(C,D,Y,"⌣","\\smile",!0);j(C,D,Y,"⊑","\\sqsubseteq",!0);j(C,D,Y,"⊒","\\sqsupseteq",!0);j(C,D,Y,"≐","\\doteq",!0);j(C,D,Y,"⌢","\\frown",!0);j(C,D,Y,"∋","\\ni",!0);j(C,D,Y,"∝","\\propto",!0);j(C,D,Y,"⊢","\\vdash",!0);j(C,D,Y,"⊣","\\dashv",!0);j(C,D,Y,"∋","\\owns");j(C,D,Ym,".","\\ldotp");j(C,D,Ym,"⋅","\\cdotp");j(C,D,ae,"#","\\#");j(_e,D,ae,"#","\\#");j(C,D,ae,"&","\\&");j(_e,D,ae,"&","\\&");j(C,D,ae,"ℵ","\\aleph",!0);j(C,D,ae,"∀","\\forall",!0);j(C,D,ae,"ℏ","\\hbar",!0);j(C,D,ae,"∃","\\exists",!0);j(C,D,ae,"∇","\\nabla",!0);j(C,D,ae,"♭","\\flat",!0);j(C,D,ae,"ℓ","\\ell",!0);j(C,D,ae,"♮","\\natural",!0);j(C,D,ae,"♣","\\clubsuit",!0);j(C,D,ae,"℘","\\wp",!0);j(C,D,ae,"♯","\\sharp",!0);j(C,D,ae,"♢","\\diamondsuit",!0);j(C,D,ae,"ℜ","\\Re",!0);j(C,D,ae,"♡","\\heartsuit",!0);j(C,D,ae,"ℑ","\\Im",!0);j(C,D,ae,"♠","\\spadesuit",!0);j(C,D,ae,"§","\\S",!0);j(_e,D,ae,"§","\\S");j(C,D,ae,"¶","\\P",!0);j(_e,D,ae,"¶","\\P");j(C,D,ae,"†","\\dag");j(_e,D,ae,"†","\\dag");j(_e,D,ae,"†","\\textdagger");j(C,D,ae,"‡","\\ddag");j(_e,D,ae,"‡","\\ddag");j(_e,D,ae,"‡","\\textdaggerdbl");j(C,D,Mr,"⎱","\\rmoustache",!0);j(C,D,ha,"⎰","\\lmoustache",!0);j(C,D,Mr,"⟯","\\rgroup",!0);j(C,D,ha,"⟮","\\lgroup",!0);j(C,D,Ie,"∓","\\mp",!0);j(C,D,Ie,"⊖","\\ominus",!0);j(C,D,Ie,"⊎","\\uplus",!0);j(C,D,Ie,"⊓","\\sqcap",!0);j(C,D,Ie,"∗","\\ast");j(C,D,Ie,"⊔","\\sqcup",!0);j(C,D,Ie,"◯","\\bigcirc",!0);j(C,D,Ie,"∙","\\bullet",!0);j(C,D,Ie,"‡","\\ddagger");j(C,D,Ie,"≀","\\wr",!0);j(C,D,Ie,"⨿","\\amalg");j(C,D,Ie,"&","\\And");j(C,D,Y,"⟵","\\longleftarrow",!0);j(C,D,Y,"⇐","\\Leftarrow",!0);j(C,D,Y,"⟸","\\Longleftarrow",!0);j(C,D,Y,"⟶","\\longrightarrow",!0);j(C,D,Y,"⇒","\\Rightarrow",!0);j(C,D,Y,"⟹","\\Longrightarrow",!0);j(C,D,Y,"↔","\\leftrightarrow",!0);j(C,D,Y,"⟷","\\longleftrightarrow",!0);j(C,D,Y,"⇔","\\Leftrightarrow",!0);j(C,D,Y,"⟺","\\Longleftrightarrow",!0);j(C,D,Y,"↦","\\mapsto",!0);j(C,D,Y,"⟼","\\longmapsto",!0);j(C,D,Y,"↗","\\nearrow",!0);j(C,D,Y,"↩","\\hookleftarrow",!0);j(C,D,Y,"↪","\\hookrightarrow",!0);j(C,D,Y,"↘","\\searrow",!0);j(C,D,Y,"↼","\\leftharpoonup",!0);j(C,D,Y,"⇀","\\rightharpoonup",!0);j(C,D,Y,"↙","\\swarrow",!0);j(C,D,Y,"↽","\\leftharpoondown",!0);j(C,D,Y,"⇁","\\rightharpoondown",!0);j(C,D,Y,"↖","\\nwarrow",!0);j(C,D,Y,"⇌","\\rightleftharpoons",!0);j(C,V,Y,"≮","\\nless",!0);j(C,V,Y,"","\\@nleqslant");j(C,V,Y,"","\\@nleqq");j(C,V,Y,"⪇","\\lneq",!0);j(C,V,Y,"≨","\\lneqq",!0);j(C,V,Y,"","\\@lvertneqq");j(C,V,Y,"⋦","\\lnsim",!0);j(C,V,Y,"⪉","\\lnapprox",!0);j(C,V,Y,"⊀","\\nprec",!0);j(C,V,Y,"⋠","\\npreceq",!0);j(C,V,Y,"⋨","\\precnsim",!0);j(C,V,Y,"⪹","\\precnapprox",!0);j(C,V,Y,"≁","\\nsim",!0);j(C,V,Y,"","\\@nshortmid");j(C,V,Y,"∤","\\nmid",!0);j(C,V,Y,"⊬","\\nvdash",!0);j(C,V,Y,"⊭","\\nvDash",!0);j(C,V,Y,"⋪","\\ntriangleleft");j(C,V,Y,"⋬","\\ntrianglelefteq",!0);j(C,V,Y,"⊊","\\subsetneq",!0);j(C,V,Y,"","\\@varsubsetneq");j(C,V,Y,"⫋","\\subsetneqq",!0);j(C,V,Y,"","\\@varsubsetneqq");j(C,V,Y,"≯","\\ngtr",!0);j(C,V,Y,"","\\@ngeqslant");j(C,V,Y,"","\\@ngeqq");j(C,V,Y,"⪈","\\gneq",!0);j(C,V,Y,"≩","\\gneqq",!0);j(C,V,Y,"","\\@gvertneqq");j(C,V,Y,"⋧","\\gnsim",!0);j(C,V,Y,"⪊","\\gnapprox",!0);j(C,V,Y,"⊁","\\nsucc",!0);j(C,V,Y,"⋡","\\nsucceq",!0);j(C,V,Y,"⋩","\\succnsim",!0);j(C,V,Y,"⪺","\\succnapprox",!0);j(C,V,Y,"≆","\\ncong",!0);j(C,V,Y,"","\\@nshortparallel");j(C,V,Y,"∦","\\nparallel",!0);j(C,V,Y,"⊯","\\nVDash",!0);j(C,V,Y,"⋫","\\ntriangleright");j(C,V,Y,"⋭","\\ntrianglerighteq",!0);j(C,V,Y,"","\\@nsupseteqq");j(C,V,Y,"⊋","\\supsetneq",!0);j(C,V,Y,"","\\@varsupsetneq");j(C,V,Y,"⫌","\\supsetneqq",!0);j(C,V,Y,"","\\@varsupsetneqq");j(C,V,Y,"⊮","\\nVdash",!0);j(C,V,Y,"⪵","\\precneqq",!0);j(C,V,Y,"⪶","\\succneqq",!0);j(C,V,Y,"","\\@nsubseteqq");j(C,V,Ie,"⊴","\\unlhd");j(C,V,Ie,"⊵","\\unrhd");j(C,V,Y,"↚","\\nleftarrow",!0);j(C,V,Y,"↛","\\nrightarrow",!0);j(C,V,Y,"⇍","\\nLeftarrow",!0);j(C,V,Y,"⇏","\\nRightarrow",!0);j(C,V,Y,"↮","\\nleftrightarrow",!0);j(C,V,Y,"⇎","\\nLeftrightarrow",!0);j(C,V,Y,"△","\\vartriangle");j(C,V,ae,"ℏ","\\hslash");j(C,V,ae,"▽","\\triangledown");j(C,V,ae,"◊","\\lozenge");j(C,V,ae,"Ⓢ","\\circledS");j(C,V,ae,"®","\\circledR");j(_e,V,ae,"®","\\circledR");j(C,V,ae,"∡","\\measuredangle",!0);j(C,V,ae,"∄","\\nexists");j(C,V,ae,"℧","\\mho");j(C,V,ae,"Ⅎ","\\Finv",!0);j(C,V,ae,"⅁","\\Game",!0);j(C,V,ae,"‵","\\backprime");j(C,V,ae,"▲","\\blacktriangle");j(C,V,ae,"▼","\\blacktriangledown");j(C,V,ae,"■","\\blacksquare");j(C,V,ae,"⧫","\\blacklozenge");j(C,V,ae,"★","\\bigstar");j(C,V,ae,"∢","\\sphericalangle",!0);j(C,V,ae,"∁","\\complement",!0);j(C,V,ae,"ð","\\eth",!0);j(_e,D,ae,"ð","ð");j(C,V,ae,"╱","\\diagup");j(C,V,ae,"╲","\\diagdown");j(C,V,ae,"□","\\square");j(C,V,ae,"□","\\Box");j(C,V,ae,"◊","\\Diamond");j(C,V,ae,"¥","\\yen",!0);j(_e,V,ae,"¥","\\yen",!0);j(C,V,ae,"✓","\\checkmark",!0);j(_e,V,ae,"✓","\\checkmark");j(C,V,ae,"ℶ","\\beth",!0);j(C,V,ae,"ℸ","\\daleth",!0);j(C,V,ae,"ℷ","\\gimel",!0);j(C,V,ae,"ϝ","\\digamma",!0);j(C,V,ae,"ϰ","\\varkappa");j(C,V,ha,"┌","\\@ulcorner",!0);j(C,V,Mr,"┐","\\@urcorner",!0);j(C,V,ha,"└","\\@llcorner",!0);j(C,V,Mr,"┘","\\@lrcorner",!0);j(C,V,Y,"≦","\\leqq",!0);j(C,V,Y,"⩽","\\leqslant",!0);j(C,V,Y,"⪕","\\eqslantless",!0);j(C,V,Y,"≲","\\lesssim",!0);j(C,V,Y,"⪅","\\lessapprox",!0);j(C,V,Y,"≊","\\approxeq",!0);j(C,V,Ie,"⋖","\\lessdot");j(C,V,Y,"⋘","\\lll",!0);j(C,V,Y,"≶","\\lessgtr",!0);j(C,V,Y,"⋚","\\lesseqgtr",!0);j(C,V,Y,"⪋","\\lesseqqgtr",!0);j(C,V,Y,"≑","\\doteqdot");j(C,V,Y,"≓","\\risingdotseq",!0);j(C,V,Y,"≒","\\fallingdotseq",!0);j(C,V,Y,"∽","\\backsim",!0);j(C,V,Y,"⋍","\\backsimeq",!0);j(C,V,Y,"⫅","\\subseteqq",!0);j(C,V,Y,"⋐","\\Subset",!0);j(C,V,Y,"⊏","\\sqsubset",!0);j(C,V,Y,"≼","\\preccurlyeq",!0);j(C,V,Y,"⋞","\\curlyeqprec",!0);j(C,V,Y,"≾","\\precsim",!0);j(C,V,Y,"⪷","\\precapprox",!0);j(C,V,Y,"⊲","\\vartriangleleft");j(C,V,Y,"⊴","\\trianglelefteq");j(C,V,Y,"⊨","\\vDash",!0);j(C,V,Y,"⊪","\\Vvdash",!0);j(C,V,Y,"⌣","\\smallsmile");j(C,V,Y,"⌢","\\smallfrown");j(C,V,Y,"≏","\\bumpeq",!0);j(C,V,Y,"≎","\\Bumpeq",!0);j(C,V,Y,"≧","\\geqq",!0);j(C,V,Y,"⩾","\\geqslant",!0);j(C,V,Y,"⪖","\\eqslantgtr",!0);j(C,V,Y,"≳","\\gtrsim",!0);j(C,V,Y,"⪆","\\gtrapprox",!0);j(C,V,Ie,"⋗","\\gtrdot");j(C,V,Y,"⋙","\\ggg",!0);j(C,V,Y,"≷","\\gtrless",!0);j(C,V,Y,"⋛","\\gtreqless",!0);j(C,V,Y,"⪌","\\gtreqqless",!0);j(C,V,Y,"≖","\\eqcirc",!0);j(C,V,Y,"≗","\\circeq",!0);j(C,V,Y,"≜","\\triangleq",!0);j(C,V,Y,"∼","\\thicksim");j(C,V,Y,"≈","\\thickapprox");j(C,V,Y,"⫆","\\supseteqq",!0);j(C,V,Y,"⋑","\\Supset",!0);j(C,V,Y,"⊐","\\sqsupset",!0);j(C,V,Y,"≽","\\succcurlyeq",!0);j(C,V,Y,"⋟","\\curlyeqsucc",!0);j(C,V,Y,"≿","\\succsim",!0);j(C,V,Y,"⪸","\\succapprox",!0);j(C,V,Y,"⊳","\\vartriangleright");j(C,V,Y,"⊵","\\trianglerighteq");j(C,V,Y,"⊩","\\Vdash",!0);j(C,V,Y,"∣","\\shortmid");j(C,V,Y,"∥","\\shortparallel");j(C,V,Y,"≬","\\between",!0);j(C,V,Y,"⋔","\\pitchfork",!0);j(C,V,Y,"∝","\\varpropto");j(C,V,Y,"◀","\\blacktriangleleft");j(C,V,Y,"∴","\\therefore",!0);j(C,V,Y,"∍","\\backepsilon");j(C,V,Y,"▶","\\blacktriangleright");j(C,V,Y,"∵","\\because",!0);j(C,V,Y,"⋘","\\llless");j(C,V,Y,"⋙","\\gggtr");j(C,V,Ie,"⊲","\\lhd");j(C,V,Ie,"⊳","\\rhd");j(C,V,Y,"≂","\\eqsim",!0);j(C,D,Y,"⋈","\\Join");j(C,V,Y,"≑","\\Doteq",!0);j(C,V,Ie,"∔","\\dotplus",!0);j(C,V,Ie,"∖","\\smallsetminus");j(C,V,Ie,"⋒","\\Cap",!0);j(C,V,Ie,"⋓","\\Cup",!0);j(C,V,Ie,"⩞","\\doublebarwedge",!0);j(C,V,Ie,"⊟","\\boxminus",!0);j(C,V,Ie,"⊞","\\boxplus",!0);j(C,V,Ie,"⋇","\\divideontimes",!0);j(C,V,Ie,"⋉","\\ltimes",!0);j(C,V,Ie,"⋊","\\rtimes",!0);j(C,V,Ie,"⋋","\\leftthreetimes",!0);j(C,V,Ie,"⋌","\\rightthreetimes",!0);j(C,V,Ie,"⋏","\\curlywedge",!0);j(C,V,Ie,"⋎","\\curlyvee",!0);j(C,V,Ie,"⊝","\\circleddash",!0);j(C,V,Ie,"⊛","\\circledast",!0);j(C,V,Ie,"⋅","\\centerdot");j(C,V,Ie,"⊺","\\intercal",!0);j(C,V,Ie,"⋒","\\doublecap");j(C,V,Ie,"⋓","\\doublecup");j(C,V,Ie,"⊠","\\boxtimes",!0);j(C,V,Y,"⇢","\\dashrightarrow",!0);j(C,V,Y,"⇠","\\dashleftarrow",!0);j(C,V,Y,"⇇","\\leftleftarrows",!0);j(C,V,Y,"⇆","\\leftrightarrows",!0);j(C,V,Y,"⇚","\\Lleftarrow",!0);j(C,V,Y,"↞","\\twoheadleftarrow",!0);j(C,V,Y,"↢","\\leftarrowtail",!0);j(C,V,Y,"↫","\\looparrowleft",!0);j(C,V,Y,"⇋","\\leftrightharpoons",!0);j(C,V,Y,"↶","\\curvearrowleft",!0);j(C,V,Y,"↺","\\circlearrowleft",!0);j(C,V,Y,"↰","\\Lsh",!0);j(C,V,Y,"⇈","\\upuparrows",!0);j(C,V,Y,"↿","\\upharpoonleft",!0);j(C,V,Y,"⇃","\\downharpoonleft",!0);j(C,D,Y,"⊶","\\origof",!0);j(C,D,Y,"⊷","\\imageof",!0);j(C,V,Y,"⊸","\\multimap",!0);j(C,V,Y,"↭","\\leftrightsquigarrow",!0);j(C,V,Y,"⇉","\\rightrightarrows",!0);j(C,V,Y,"⇄","\\rightleftarrows",!0);j(C,V,Y,"↠","\\twoheadrightarrow",!0);j(C,V,Y,"↣","\\rightarrowtail",!0);j(C,V,Y,"↬","\\looparrowright",!0);j(C,V,Y,"↷","\\curvearrowright",!0);j(C,V,Y,"↻","\\circlearrowright",!0);j(C,V,Y,"↱","\\Rsh",!0);j(C,V,Y,"⇊","\\downdownarrows",!0);j(C,V,Y,"↾","\\upharpoonright",!0);j(C,V,Y,"⇂","\\downharpoonright",!0);j(C,V,Y,"⇝","\\rightsquigarrow",!0);j(C,V,Y,"⇝","\\leadsto");j(C,V,Y,"⇛","\\Rrightarrow",!0);j(C,V,Y,"↾","\\restriction");j(C,D,ae,"‘","`");j(C,D,ae,"$","\\$");j(_e,D,ae,"$","\\$");j(_e,D,ae,"$","\\textdollar");j(C,D,ae,"%","\\%");j(_e,D,ae,"%","\\%");j(C,D,ae,"_","\\_");j(_e,D,ae,"_","\\_");j(_e,D,ae,"_","\\textunderscore");j(C,D,ae,"∠","\\angle",!0);j(C,D,ae,"∞","\\infty",!0);j(C,D,ae,"′","\\prime");j(C,D,ae,"△","\\triangle");j(C,D,ae,"Γ","\\Gamma",!0);j(C,D,ae,"Δ","\\Delta",!0);j(C,D,ae,"Θ","\\Theta",!0);j(C,D,ae,"Λ","\\Lambda",!0);j(C,D,ae,"Ξ","\\Xi",!0);j(C,D,ae,"Π","\\Pi",!0);j(C,D,ae,"Σ","\\Sigma",!0);j(C,D,ae,"Υ","\\Upsilon",!0);j(C,D,ae,"Φ","\\Phi",!0);j(C,D,ae,"Ψ","\\Psi",!0);j(C,D,ae,"Ω","\\Omega",!0);j(C,D,ae,"A","Α");j(C,D,ae,"B","Β");j(C,D,ae,"E","Ε");j(C,D,ae,"Z","Ζ");j(C,D,ae,"H","Η");j(C,D,ae,"I","Ι");j(C,D,ae,"K","Κ");j(C,D,ae,"M","Μ");j(C,D,ae,"N","Ν");j(C,D,ae,"O","Ο");j(C,D,ae,"P","Ρ");j(C,D,ae,"T","Τ");j(C,D,ae,"X","Χ");j(C,D,ae,"¬","\\neg",!0);j(C,D,ae,"¬","\\lnot");j(C,D,ae,"⊤","\\top");j(C,D,ae,"⊥","\\bot");j(C,D,ae,"∅","\\emptyset");j(C,V,ae,"∅","\\varnothing");j(C,D,Je,"α","\\alpha",!0);j(C,D,Je,"β","\\beta",!0);j(C,D,Je,"γ","\\gamma",!0);j(C,D,Je,"δ","\\delta",!0);j(C,D,Je,"ϵ","\\epsilon",!0);j(C,D,Je,"ζ","\\zeta",!0);j(C,D,Je,"η","\\eta",!0);j(C,D,Je,"θ","\\theta",!0);j(C,D,Je,"ι","\\iota",!0);j(C,D,Je,"κ","\\kappa",!0);j(C,D,Je,"λ","\\lambda",!0);j(C,D,Je,"μ","\\mu",!0);j(C,D,Je,"ν","\\nu",!0);j(C,D,Je,"ξ","\\xi",!0);j(C,D,Je,"ο","\\omicron",!0);j(C,D,Je,"π","\\pi",!0);j(C,D,Je,"ρ","\\rho",!0);j(C,D,Je,"σ","\\sigma",!0);j(C,D,Je,"τ","\\tau",!0);j(C,D,Je,"υ","\\upsilon",!0);j(C,D,Je,"ϕ","\\phi",!0);j(C,D,Je,"χ","\\chi",!0);j(C,D,Je,"ψ","\\psi",!0);j(C,D,Je,"ω","\\omega",!0);j(C,D,Je,"ε","\\varepsilon",!0);j(C,D,Je,"ϑ","\\vartheta",!0);j(C,D,Je,"ϖ","\\varpi",!0);j(C,D,Je,"ϱ","\\varrho",!0);j(C,D,Je,"ς","\\varsigma",!0);j(C,D,Je,"φ","\\varphi",!0);j(C,D,Ie,"∗","*",!0);j(C,D,Ie,"+","+");j(C,D,Ie,"−","-",!0);j(C,D,Ie,"⋅","\\cdot",!0);j(C,D,Ie,"∘","\\circ",!0);j(C,D,Ie,"÷","\\div",!0);j(C,D,Ie,"±","\\pm",!0);j(C,D,Ie,"×","\\times",!0);j(C,D,Ie,"∩","\\cap",!0);j(C,D,Ie,"∪","\\cup",!0);j(C,D,Ie,"∖","\\setminus",!0);j(C,D,Ie,"∧","\\land");j(C,D,Ie,"∨","\\lor");j(C,D,Ie,"∧","\\wedge",!0);j(C,D,Ie,"∨","\\vee",!0);j(C,D,ae,"√","\\surd");j(C,D,ha,"⟨","\\langle",!0);j(C,D,ha,"∣","\\lvert");j(C,D,ha,"∥","\\lVert");j(C,D,Mr,"?","?");j(C,D,Mr,"!","!");j(C,D,Mr,"⟩","\\rangle",!0);j(C,D,Mr,"∣","\\rvert");j(C,D,Mr,"∥","\\rVert");j(C,D,Y,"=","=");j(C,D,Y,":",":");j(C,D,Y,"≈","\\approx",!0);j(C,D,Y,"≅","\\cong",!0);j(C,D,Y,"≥","\\ge");j(C,D,Y,"≥","\\geq",!0);j(C,D,Y,"←","\\gets");j(C,D,Y,">","\\gt",!0);j(C,D,Y,"∈","\\in",!0);j(C,D,Y,"","\\@not");j(C,D,Y,"⊂","\\subset",!0);j(C,D,Y,"⊃","\\supset",!0);j(C,D,Y,"⊆","\\subseteq",!0);j(C,D,Y,"⊇","\\supseteq",!0);j(C,V,Y,"⊈","\\nsubseteq",!0);j(C,V,Y,"⊉","\\nsupseteq",!0);j(C,D,Y,"⊨","\\models");j(C,D,Y,"←","\\leftarrow",!0);j(C,D,Y,"≤","\\le");j(C,D,Y,"≤","\\leq",!0);j(C,D,Y,"<","\\lt",!0);j(C,D,Y,"→","\\rightarrow",!0);j(C,D,Y,"→","\\to");j(C,V,Y,"≱","\\ngeq",!0);j(C,V,Y,"≰","\\nleq",!0);j(C,D,$s," ","\\ ");j(C,D,$s," ","\\space");j(C,D,$s," ","\\nobreakspace");j(_e,D,$s," ","\\ ");j(_e,D,$s," "," ");j(_e,D,$s," ","\\space");j(_e,D,$s," ","\\nobreakspace");j(C,D,$s,null,"\\nobreak");j(C,D,$s,null,"\\allowbreak");j(C,D,Ym,",",",");j(C,D,Ym,";",";");j(C,V,Ie,"⊼","\\barwedge",!0);j(C,V,Ie,"⊻","\\veebar",!0);j(C,D,Ie,"⊙","\\odot",!0);j(C,D,Ie,"⊕","\\oplus",!0);j(C,D,Ie,"⊗","\\otimes",!0);j(C,D,ae,"∂","\\partial",!0);j(C,D,Ie,"⊘","\\oslash",!0);j(C,V,Ie,"⊚","\\circledcirc",!0);j(C,V,Ie,"⊡","\\boxdot",!0);j(C,D,Ie,"△","\\bigtriangleup");j(C,D,Ie,"▽","\\bigtriangledown");j(C,D,Ie,"†","\\dagger");j(C,D,Ie,"⋄","\\diamond");j(C,D,Ie,"⋆","\\star");j(C,D,Ie,"◃","\\triangleleft");j(C,D,Ie,"▹","\\triangleright");j(C,D,ha,"{","\\{");j(_e,D,ae,"{","\\{");j(_e,D,ae,"{","\\textbraceleft");j(C,D,Mr,"}","\\}");j(_e,D,ae,"}","\\}");j(_e,D,ae,"}","\\textbraceright");j(C,D,ha,"{","\\lbrace");j(C,D,Mr,"}","\\rbrace");j(C,D,ha,"[","\\lbrack",!0);j(_e,D,ae,"[","\\lbrack",!0);j(C,D,Mr,"]","\\rbrack",!0);j(_e,D,ae,"]","\\rbrack",!0);j(C,D,ha,"(","\\lparen",!0);j(C,D,Mr,")","\\rparen",!0);j(_e,D,ae,"<","\\textless",!0);j(_e,D,ae,">","\\textgreater",!0);j(C,D,ha,"⌊","\\lfloor",!0);j(C,D,Mr,"⌋","\\rfloor",!0);j(C,D,ha,"⌈","\\lceil",!0);j(C,D,Mr,"⌉","\\rceil",!0);j(C,D,ae,"\\","\\backslash");j(C,D,ae,"∣","|");j(C,D,ae,"∣","\\vert");j(_e,D,ae,"|","\\textbar",!0);j(C,D,ae,"∥","\\|");j(C,D,ae,"∥","\\Vert");j(_e,D,ae,"∥","\\textbardbl");j(_e,D,ae,"~","\\textasciitilde");j(_e,D,ae,"\\","\\textbackslash");j(_e,D,ae,"^","\\textasciicircum");j(C,D,Y,"↑","\\uparrow",!0);j(C,D,Y,"⇑","\\Uparrow",!0);j(C,D,Y,"↓","\\downarrow",!0);j(C,D,Y,"⇓","\\Downarrow",!0);j(C,D,Y,"↕","\\updownarrow",!0);j(C,D,Y,"⇕","\\Updownarrow",!0);j(C,D,Yn,"∐","\\coprod");j(C,D,Yn,"⋁","\\bigvee");j(C,D,Yn,"⋀","\\bigwedge");j(C,D,Yn,"⨄","\\biguplus");j(C,D,Yn,"⋂","\\bigcap");j(C,D,Yn,"⋃","\\bigcup");j(C,D,Yn,"∫","\\int");j(C,D,Yn,"∫","\\intop");j(C,D,Yn,"∬","\\iint");j(C,D,Yn,"∭","\\iiint");j(C,D,Yn,"∏","\\prod");j(C,D,Yn,"∑","\\sum");j(C,D,Yn,"⨂","\\bigotimes");j(C,D,Yn,"⨁","\\bigoplus");j(C,D,Yn,"⨀","\\bigodot");j(C,D,Yn,"∮","\\oint");j(C,D,Yn,"∯","\\oiint");j(C,D,Yn,"∰","\\oiiint");j(C,D,Yn,"⨆","\\bigsqcup");j(C,D,Yn,"∫","\\smallint");j(_e,D,tc,"…","\\textellipsis");j(C,D,tc,"…","\\mathellipsis");j(_e,D,tc,"…","\\ldots",!0);j(C,D,tc,"…","\\ldots",!0);j(C,D,tc,"⋯","\\@cdots",!0);j(C,D,tc,"⋱","\\ddots",!0);j(C,D,ae,"⋮","\\varvdots");j(_e,D,ae,"⋮","\\varvdots");j(C,D,kn,"ˊ","\\acute");j(C,D,kn,"ˋ","\\grave");j(C,D,kn,"¨","\\ddot");j(C,D,kn,"~","\\tilde");j(C,D,kn,"ˉ","\\bar");j(C,D,kn,"˘","\\breve");j(C,D,kn,"ˇ","\\check");j(C,D,kn,"^","\\hat");j(C,D,kn,"⃗","\\vec");j(C,D,kn,"˙","\\dot");j(C,D,kn,"˚","\\mathring");j(C,D,Je,"","\\@imath");j(C,D,Je,"","\\@jmath");j(C,D,ae,"ı","ı");j(C,D,ae,"ȷ","ȷ");j(_e,D,ae,"ı","\\i",!0);j(_e,D,ae,"ȷ","\\j",!0);j(_e,D,ae,"ß","\\ss",!0);j(_e,D,ae,"æ","\\ae",!0);j(_e,D,ae,"œ","\\oe",!0);j(_e,D,ae,"ø","\\o",!0);j(_e,D,ae,"Æ","\\AE",!0);j(_e,D,ae,"Œ","\\OE",!0);j(_e,D,ae,"Ø","\\O",!0);j(_e,D,kn,"ˊ","\\'");j(_e,D,kn,"ˋ","\\`");j(_e,D,kn,"ˆ","\\^");j(_e,D,kn,"˜","\\~");j(_e,D,kn,"ˉ","\\=");j(_e,D,kn,"˘","\\u");j(_e,D,kn,"˙","\\.");j(_e,D,kn,"¸","\\c");j(_e,D,kn,"˚","\\r");j(_e,D,kn,"ˇ","\\v");j(_e,D,kn,"¨",'\\"');j(_e,D,kn,"˝","\\H");j(_e,D,kn,"◯","\\textcircled");var v8={"--":!0,"---":!0,"``":!0,"''":!0};j(_e,D,ae,"–","--",!0);j(_e,D,ae,"–","\\textendash");j(_e,D,ae,"—","---",!0);j(_e,D,ae,"—","\\textemdash");j(_e,D,ae,"‘","`",!0);j(_e,D,ae,"‘","\\textquoteleft");j(_e,D,ae,"’","'",!0);j(_e,D,ae,"’","\\textquoteright");j(_e,D,ae,"“","``",!0);j(_e,D,ae,"“","\\textquotedblleft");j(_e,D,ae,"”","''",!0);j(_e,D,ae,"”","\\textquotedblright");j(C,D,ae,"°","\\degree",!0);j(_e,D,ae,"°","\\degree");j(_e,D,ae,"°","\\textdegree",!0);j(C,D,ae,"£","\\pounds");j(C,D,ae,"£","\\mathsterling",!0);j(_e,D,ae,"£","\\pounds");j(_e,D,ae,"£","\\textsterling",!0);j(C,V,ae,"✠","\\maltese");j(_e,V,ae,"✠","\\maltese");var O3='0123456789/@."';for(var Jp=0;Jp0)return Ba(o,f,l,n,c.concat(p));if(m){var x,y;if(m==="boldsymbol"){var b=tq(o,l,n,c,a);x=b.fontName,y=[b.fontClass]}else d?(x=w8[m].fontName,y=[m]):(x=z0(m,n.fontWeight,n.fontShape),y=[m,n.fontWeight,n.fontShape]);if(Wm(o,x,l).metrics)return Ba(o,x,l,n,c.concat(y));if(v8.hasOwnProperty(o)&&x.slice(0,10)==="Typewriter"){for(var N=[],k=0;k{if(El(e.classes)!==El(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize)return!1;if(e.classes.length===1){var n=e.classes[0];if(n==="mbin"||n==="mord")return!1}for(var a in e.style)if(e.style.hasOwnProperty(a)&&e.style[a]!==t.style[a])return!1;for(var l in t.style)if(t.style.hasOwnProperty(l)&&e.style[l]!==t.style[l])return!1;return!0},aq=e=>{for(var t=0;tn&&(n=c.height),c.depth>a&&(a=c.depth),c.maxFontSize>l&&(l=c.maxFontSize)}t.height=n,t.depth=a,t.maxFontSize=l},Hr=function(t,n,a,l){var o=new Xu(t,n,a,l);return fg(o),o},y8=(e,t,n,a)=>new Xu(e,t,n,a),sq=function(t,n,a){var l=Hr([t],[],n);return l.height=Math.max(a||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),l.style.borderBottomWidth=Le(l.height),l.maxFontSize=1,l},lq=function(t,n,a,l){var o=new hg(t,n,a,l);return fg(o),o},b8=function(t){var n=new Wu(t);return fg(n),n},iq=function(t,n){return t instanceof Wu?Hr([],[t],n):t},oq=function(t){if(t.positionType==="individualShift"){for(var n=t.children,a=[n[0]],l=-n[0].shift-n[0].elem.depth,o=l,c=1;c{var n=Hr(["mspace"],[],t),a=Mn(e,t);return n.style.marginRight=Le(a),n},z0=function(t,n,a){var l="";switch(t){case"amsrm":l="AMS";break;case"textrm":l="Main";break;case"textsf":l="SansSerif";break;case"texttt":l="Typewriter";break;default:l=t}var o;return n==="textbf"&&a==="textit"?o="BoldItalic":n==="textbf"?o="Bold":n==="textit"?o="Italic":o="Regular",l+"-"+o},w8={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},j8={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},dq=function(t,n){var[a,l,o]=j8[t],c=new Ml(a),d=new Fs([c],{width:Le(l),height:Le(o),style:"width:"+Le(l),viewBox:"0 0 "+1e3*l+" "+1e3*o,preserveAspectRatio:"xMinYMin"}),m=y8(["overlay"],[d],n);return m.height=o,m.style.height=Le(o),m.style.width=Le(l),m},de={fontMap:w8,makeSymbol:Ba,mathsym:eq,makeSpan:Hr,makeSvgSpan:y8,makeLineSpan:sq,makeAnchor:lq,makeFragment:b8,wrapFragment:iq,makeVList:cq,makeOrd:nq,makeGlue:uq,staticSvg:dq,svgData:j8,tryCombineChars:aq},_n={number:3,unit:"mu"},ii={number:4,unit:"mu"},Ms={number:5,unit:"mu"},mq={mord:{mop:_n,mbin:ii,mrel:Ms,minner:_n},mop:{mord:_n,mop:_n,mrel:Ms,minner:_n},mbin:{mord:ii,mop:ii,mopen:ii,minner:ii},mrel:{mord:Ms,mop:Ms,mopen:Ms,minner:Ms},mopen:{},mclose:{mop:_n,mbin:ii,mrel:Ms,minner:_n},mpunct:{mord:_n,mop:_n,mrel:Ms,mopen:_n,mclose:_n,mpunct:_n,minner:_n},minner:{mord:_n,mop:_n,mbin:ii,mrel:Ms,mopen:_n,mpunct:_n,minner:_n}},hq={mord:{mop:_n},mop:{mord:_n,mop:_n},mbin:{},mrel:{},mopen:{},mclose:{mop:_n},mpunct:{},minner:{mop:_n}},N8={},pm={},xm={};function Be(e){for(var{type:t,names:n,props:a,handler:l,htmlBuilder:o,mathmlBuilder:c}=e,d={type:t,numArgs:a.numArgs,argTypes:a.argTypes,allowedInArgument:!!a.allowedInArgument,allowedInText:!!a.allowedInText,allowedInMath:a.allowedInMath===void 0?!0:a.allowedInMath,numOptionalArgs:a.numOptionalArgs||0,infix:!!a.infix,primitive:!!a.primitive,handler:l},m=0;m{var S=k.classes[0],T=N.classes[0];S==="mbin"&&pq.includes(T)?k.classes[0]="mord":T==="mbin"&&fq.includes(S)&&(N.classes[0]="mord")},{node:x},y,b),F3(o,(N,k)=>{var S=Zx(k),T=Zx(N),M=S&&T?N.hasClass("mtight")?hq[S][T]:mq[S][T]:null;if(M)return de.makeGlue(M,f)},{node:x},y,b),o},F3=function e(t,n,a,l,o){l&&t.push(l);for(var c=0;cy=>{t.splice(x+1,0,y),c++})(c)}l&&t.pop()},S8=function(t){return t instanceof Wu||t instanceof hg||t instanceof Xu&&t.hasClass("enclosing")?t:null},vq=function e(t,n){var a=S8(t);if(a){var l=a.children;if(l.length){if(n==="right")return e(l[l.length-1],"right");if(n==="left")return e(l[0],"left")}}return t},Zx=function(t,n){return t?(n&&(t=vq(t,n)),gq[t.classes[0]]||null):null},Nu=function(t,n){var a=["nulldelimiter"].concat(t.baseSizingClasses());return Is(n.concat(a))},Ft=function(t,n,a){if(!t)return Is();if(pm[t.type]){var l=pm[t.type](t,n);if(a&&n.size!==a.size){l=Is(n.sizingClasses(a),[l],n);var o=n.sizeMultiplier/a.sizeMultiplier;l.height*=o,l.depth*=o}return l}else throw new Ae("Got group of unknown type: '"+t.type+"'")};function O0(e,t){var n=Is(["base"],e,t),a=Is(["strut"]);return a.style.height=Le(n.height+n.depth),n.depth&&(a.style.verticalAlign=Le(-n.depth)),n.children.unshift(a),n}function Jx(e,t){var n=null;e.length===1&&e[0].type==="tag"&&(n=e[0].tag,e=e[0].body);var a=nr(e,t,"root"),l;a.length===2&&a[1].hasClass("tag")&&(l=a.pop());for(var o=[],c=[],d=0;d0&&(o.push(O0(c,t)),c=[]),o.push(a[d]));c.length>0&&o.push(O0(c,t));var f;n?(f=O0(nr(n,t,!0)),f.classes=["tag"],o.push(f)):l&&o.push(l);var p=Is(["katex-html"],o);if(p.setAttribute("aria-hidden","true"),f){var x=f.children[0];x.style.height=Le(p.height+p.depth),p.depth&&(x.style.verticalAlign=Le(-p.depth))}return p}function k8(e){return new Wu(e)}class ca{constructor(t,n,a){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=t,this.attributes={},this.children=n||[],this.classes=a||[]}setAttribute(t,n){this.attributes[t]=n}getAttribute(t){return this.attributes[t]}toNode(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);this.classes.length>0&&(t.className=El(this.classes));for(var a=0;a0&&(t+=' class ="'+Ut.escape(El(this.classes))+'"'),t+=">";for(var a=0;a",t}toText(){return this.children.map(t=>t.toText()).join("")}}class ns{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return Ut.escape(this.toText())}toText(){return this.text}}class yq{constructor(t){this.width=void 0,this.character=void 0,this.width=t,t>=.05555&&t<=.05556?this.character=" ":t>=.1666&&t<=.1667?this.character=" ":t>=.2222&&t<=.2223?this.character=" ":t>=.2777&&t<=.2778?this.character="  ":t>=-.05556&&t<=-.05555?this.character=" ⁣":t>=-.1667&&t<=-.1666?this.character=" ⁣":t>=-.2223&&t<=-.2222?this.character=" ⁣":t>=-.2778&&t<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",Le(this.width)),t}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var Me={MathNode:ca,TextNode:ns,SpaceNode:yq,newDocumentFragment:k8},Ma=function(t,n,a){return yn[n][t]&&yn[n][t].replace&&t.charCodeAt(0)!==55349&&!(v8.hasOwnProperty(t)&&a&&(a.fontFamily&&a.fontFamily.slice(4,6)==="tt"||a.font&&a.font.slice(4,6)==="tt"))&&(t=yn[n][t].replace),new Me.TextNode(t)},pg=function(t){return t.length===1?t[0]:new Me.MathNode("mrow",t)},xg=function(t,n){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold";var a=n.font;if(!a||a==="mathnormal")return null;var l=t.mode;if(a==="mathit")return"italic";if(a==="boldsymbol")return t.type==="textord"?"bold":"bold-italic";if(a==="mathbf")return"bold";if(a==="mathbb")return"double-struck";if(a==="mathsfit")return"sans-serif-italic";if(a==="mathfrak")return"fraktur";if(a==="mathscr"||a==="mathcal")return"script";if(a==="mathsf")return"sans-serif";if(a==="mathtt")return"monospace";var o=t.text;if(["\\imath","\\jmath"].includes(o))return null;yn[l][o]&&yn[l][o].replace&&(o=yn[l][o].replace);var c=de.fontMap[a].fontName;return mg(o,c,l)?de.fontMap[a].variant:null};function rx(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof ns&&t.text==="."}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){var n=e.children[0];return n instanceof ns&&n.text===","}else return!1}var Qr=function(t,n,a){if(t.length===1){var l=xn(t[0],n);return a&&l instanceof ca&&l.type==="mo"&&(l.setAttribute("lspace","0em"),l.setAttribute("rspace","0em")),[l]}for(var o=[],c,d=0;d=1&&(c.type==="mn"||rx(c))){var f=m.children[0];f instanceof ca&&f.type==="mn"&&(f.children=[...c.children,...f.children],o.pop())}else if(c.type==="mi"&&c.children.length===1){var p=c.children[0];if(p instanceof ns&&p.text==="̸"&&(m.type==="mo"||m.type==="mi"||m.type==="mn")){var x=m.children[0];x instanceof ns&&x.text.length>0&&(x.text=x.text.slice(0,1)+"̸"+x.text.slice(1),o.pop())}}}o.push(m),c=m}return o},Al=function(t,n,a){return pg(Qr(t,n,a))},xn=function(t,n){if(!t)return new Me.MathNode("mrow");if(xm[t.type]){var a=xm[t.type](t,n);return a}else throw new Ae("Got group of unknown type: '"+t.type+"'")};function I3(e,t,n,a,l){var o=Qr(e,n),c;o.length===1&&o[0]instanceof ca&&["mrow","mtable"].includes(o[0].type)?c=o[0]:c=new Me.MathNode("mrow",o);var d=new Me.MathNode("annotation",[new Me.TextNode(t)]);d.setAttribute("encoding","application/x-tex");var m=new Me.MathNode("semantics",[c,d]),f=new Me.MathNode("math",[m]);f.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),a&&f.setAttribute("display","block");var p=l?"katex":"katex-mathml";return de.makeSpan([p],[f])}var C8=function(t){return new Ds({style:t.displayMode?tt.DISPLAY:tt.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},T8=function(t,n){if(n.displayMode){var a=["katex-display"];n.leqno&&a.push("leqno"),n.fleqn&&a.push("fleqn"),t=de.makeSpan(a,[t])}return t},bq=function(t,n,a){var l=C8(a),o;if(a.output==="mathml")return I3(t,n,l,a.displayMode,!0);if(a.output==="html"){var c=Jx(t,l);o=de.makeSpan(["katex"],[c])}else{var d=I3(t,n,l,a.displayMode,!1),m=Jx(t,l);o=de.makeSpan(["katex"],[d,m])}return T8(o,a)},wq=function(t,n,a){var l=C8(a),o=Jx(t,l),c=de.makeSpan(["katex"],[o]);return T8(c,a)},jq={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Nq=function(t){var n=new Me.MathNode("mo",[new Me.TextNode(jq[t.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},Sq={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},kq=function(t){return t.type==="ordgroup"?t.body.length:1},Cq=function(t,n){function a(){var d=4e5,m=t.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(m)){var f=t,p=kq(f.base),x,y,b;if(p>5)m==="widehat"||m==="widecheck"?(x=420,d=2364,b=.42,y=m+"4"):(x=312,d=2340,b=.34,y="tilde4");else{var N=[1,1,2,2,3,3][p];m==="widehat"||m==="widecheck"?(d=[0,1062,2364,2364,2364][N],x=[0,239,300,360,420][N],b=[0,.24,.3,.3,.36,.42][N],y=m+N):(d=[0,600,1033,2339,2340][N],x=[0,260,286,306,312][N],b=[0,.26,.286,.3,.306,.34][N],y="tilde"+N)}var k=new Ml(y),S=new Fs([k],{width:"100%",height:Le(b),viewBox:"0 0 "+d+" "+x,preserveAspectRatio:"none"});return{span:de.makeSvgSpan([],[S],n),minWidth:0,height:b}}else{var T=[],M=Sq[m],[A,R,B]=M,O=B/1e3,L=A.length,$,U;if(L===1){var I=M[3];$=["hide-tail"],U=[I]}else if(L===2)$=["halfarrow-left","halfarrow-right"],U=["xMinYMin","xMaxYMin"];else if(L===3)$=["brace-left","brace-center","brace-right"],U=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support - `+L+" children.");for(var G=0;G0&&(l.style.minWidth=Le(o)),l},Tq=function(t,n,a,l,o){var c,d=t.height+t.depth+a+l;if(/fbox|color|angl/.test(n)){if(c=de.makeSpan(["stretchy",n],[],o),n==="fbox"){var m=o.color&&o.getColor();m&&(c.style.borderColor=m)}}else{var f=[];/^[bx]cancel$/.test(n)&&f.push(new Kx({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&f.push(new Kx({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var p=new Fs(f,{width:"100%",height:Le(d)});c=de.makeSvgSpan([],[p],o)}return c.height=d,c.style.height=Le(d),c},qs={encloseSpan:Tq,mathMLnode:Nq,svgSpan:Cq};function yt(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function gg(e){var t=Xm(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function Xm(e){return e&&(e.type==="atom"||ZI.hasOwnProperty(e.type))?e:null}var vg=(e,t)=>{var n,a,l;e&&e.type==="supsub"?(a=yt(e.base,"accent"),n=a.base,e.base=n,l=KI(Ft(e,t)),e.base=a):(a=yt(e,"accent"),n=a.base);var o=Ft(n,t.havingCrampedStyle()),c=a.isShifty&&Ut.isCharacterBox(n),d=0;if(c){var m=Ut.getBaseElem(n),f=Ft(m,t.havingCrampedStyle());d=z3(f).skew}var p=a.label==="\\c",x=p?o.height+o.depth:Math.min(o.height,t.fontMetrics().xHeight),y;if(a.isStretchy)y=qs.svgSpan(a,t),y=de.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"elem",elem:y,wrapperClasses:["svg-align"],wrapperStyle:d>0?{width:"calc(100% - "+Le(2*d)+")",marginLeft:Le(2*d)}:void 0}]},t);else{var b,N;a.label==="\\vec"?(b=de.staticSvg("vec",t),N=de.svgData.vec[1]):(b=de.makeOrd({mode:a.mode,text:a.label},t,"textord"),b=z3(b),b.italic=0,N=b.width,p&&(x+=b.depth)),y=de.makeSpan(["accent-body"],[b]);var k=a.label==="\\textcircled";k&&(y.classes.push("accent-full"),x=o.height);var S=d;k||(S-=N/2),y.style.left=Le(S),a.label==="\\textcircled"&&(y.style.top=".2em"),y=de.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"kern",size:-x},{type:"elem",elem:y}]},t)}var T=de.makeSpan(["mord","accent"],[y],t);return l?(l.children[0]=T,l.height=Math.max(T.height,l.height),l.classes[0]="mord",l):T},_8=(e,t)=>{var n=e.isStretchy?qs.mathMLnode(e.label):new Me.MathNode("mo",[Ma(e.label,e.mode)]),a=new Me.MathNode("mover",[xn(e.base,t),n]);return a.setAttribute("accent","true"),a},_q=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));Be({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{var n=gm(t[0]),a=!_q.test(e.funcName),l=!a||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:a,isShifty:l,base:n}},htmlBuilder:vg,mathmlBuilder:_8});Be({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var n=t[0],a=e.parser.mode;return a==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),a="text"),{type:"accent",mode:a,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:vg,mathmlBuilder:_8});Be({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=t[0];return{type:"accentUnder",mode:n.mode,label:a,base:l}},htmlBuilder:(e,t)=>{var n=Ft(e.base,t),a=qs.svgSpan(e,t),l=e.label==="\\utilde"?.12:0,o=de.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:a,wrapperClasses:["svg-align"]},{type:"kern",size:l},{type:"elem",elem:n}]},t);return de.makeSpan(["mord","accentunder"],[o],t)},mathmlBuilder:(e,t)=>{var n=qs.mathMLnode(e.label),a=new Me.MathNode("munder",[xn(e.base,t),n]);return a.setAttribute("accentunder","true"),a}});var R0=e=>{var t=new Me.MathNode("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};Be({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:a,funcName:l}=e;return{type:"xArrow",mode:a.mode,label:l,body:t[0],below:n[0]}},htmlBuilder(e,t){var n=t.style,a=t.havingStyle(n.sup()),l=de.wrapFragment(Ft(e.body,a,t),t),o=e.label.slice(0,2)==="\\x"?"x":"cd";l.classes.push(o+"-arrow-pad");var c;e.below&&(a=t.havingStyle(n.sub()),c=de.wrapFragment(Ft(e.below,a,t),t),c.classes.push(o+"-arrow-pad"));var d=qs.svgSpan(e,t),m=-t.fontMetrics().axisHeight+.5*d.height,f=-t.fontMetrics().axisHeight-.5*d.height-.111;(l.depth>.25||e.label==="\\xleftequilibrium")&&(f-=l.depth);var p;if(c){var x=-t.fontMetrics().axisHeight+c.height+.5*d.height+.111;p=de.makeVList({positionType:"individualShift",children:[{type:"elem",elem:l,shift:f},{type:"elem",elem:d,shift:m},{type:"elem",elem:c,shift:x}]},t)}else p=de.makeVList({positionType:"individualShift",children:[{type:"elem",elem:l,shift:f},{type:"elem",elem:d,shift:m}]},t);return p.children[0].children[0].children[1].classes.push("svg-align"),de.makeSpan(["mrel","x-arrow"],[p],t)},mathmlBuilder(e,t){var n=qs.mathMLnode(e.label);n.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var a;if(e.body){var l=R0(xn(e.body,t));if(e.below){var o=R0(xn(e.below,t));a=new Me.MathNode("munderover",[n,o,l])}else a=new Me.MathNode("mover",[n,l])}else if(e.below){var c=R0(xn(e.below,t));a=new Me.MathNode("munder",[n,c])}else a=R0(),a=new Me.MathNode("mover",[n,a]);return a}});var Eq=de.makeSpan;function E8(e,t){var n=nr(e.body,t,!0);return Eq([e.mclass],n,t)}function M8(e,t){var n,a=Qr(e.body,t);return e.mclass==="minner"?n=new Me.MathNode("mpadded",a):e.mclass==="mord"?e.isCharacterBox?(n=a[0],n.type="mi"):n=new Me.MathNode("mi",a):(e.isCharacterBox?(n=a[0],n.type="mo"):n=new Me.MathNode("mo",a),e.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):e.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):e.mclass==="mopen"||e.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):e.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}Be({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:n,funcName:a}=e,l=t[0];return{type:"mclass",mode:n.mode,mclass:"m"+a.slice(5),body:Pn(l),isCharacterBox:Ut.isCharacterBox(l)}},htmlBuilder:E8,mathmlBuilder:M8});var Km=e=>{var t=e.type==="ordgroup"&&e.body.length?e.body[0]:e;return t.type==="atom"&&(t.family==="bin"||t.family==="rel")?"m"+t.family:"mord"};Be({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:Km(t[0]),body:Pn(t[1]),isCharacterBox:Ut.isCharacterBox(t[1])}}});Be({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:n,funcName:a}=e,l=t[1],o=t[0],c;a!=="\\stackrel"?c=Km(l):c="mrel";var d={type:"op",mode:l.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:a!=="\\stackrel",body:Pn(l)},m={type:"supsub",mode:o.mode,base:d,sup:a==="\\underset"?null:o,sub:a==="\\underset"?o:null};return{type:"mclass",mode:n.mode,mclass:c,body:[m],isCharacterBox:Ut.isCharacterBox(m)}},htmlBuilder:E8,mathmlBuilder:M8});Be({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:Km(t[0]),body:Pn(t[0])}},htmlBuilder(e,t){var n=nr(e.body,t,!0),a=de.makeSpan([e.mclass],n,t);return a.style.textShadow="0.02em 0.01em 0.04px",a},mathmlBuilder(e,t){var n=Qr(e.body,t),a=new Me.MathNode("mstyle",n);return a.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),a}});var Mq={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},q3=()=>({type:"styling",body:[],mode:"math",style:"display"}),H3=e=>e.type==="textord"&&e.text==="@",Aq=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function Dq(e,t,n){var a=Mq[e];switch(a){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(a,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var l=n.callFunction("\\\\cdleft",[t[0]],[]),o={type:"atom",text:a,mode:"math",family:"rel"},c=n.callFunction("\\Big",[o],[]),d=n.callFunction("\\\\cdright",[t[1]],[]),m={type:"ordgroup",mode:"math",body:[l,c,d]};return n.callFunction("\\\\cdparent",[m],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var f={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[f],[])}default:return{type:"textord",text:" ",mode:"math"}}}function zq(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var n=e.fetch().text;if(n==="&"||n==="\\\\")e.consume();else if(n==="\\end"){t[t.length-1].length===0&&t.pop();break}else throw new Ae("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var a=[],l=[a],o=0;o-1))if("<>AV".indexOf(f)>-1)for(var x=0;x<2;x++){for(var y=!0,b=m+1;bAV=|." after @',c[m]);var N=Dq(f,p,e),k={type:"styling",body:[N],mode:"math",style:"display"};a.push(k),d=q3()}o%2===0?a.push(d):a.shift(),a=[],l.push(a)}e.gullet.endGroup(),e.gullet.endGroup();var S=new Array(l[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:l,arraystretch:1,addJot:!0,rowGaps:[null],cols:S,colSeparationType:"CD",hLinesBeforeRow:new Array(l.length+1).fill([])}}Be({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:a}=e;return{type:"cdlabel",mode:n.mode,side:a.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),a=de.wrapFragment(Ft(e.label,n,t),t);return a.classes.push("cd-label-"+e.side),a.style.bottom=Le(.8-a.depth),a.height=0,a.depth=0,a},mathmlBuilder(e,t){var n=new Me.MathNode("mrow",[xn(e.label,t)]);return n=new Me.MathNode("mpadded",[n]),n.setAttribute("width","0"),e.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Me.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Be({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:n}=e;return{type:"cdlabelparent",mode:n.mode,fragment:t[0]}},htmlBuilder(e,t){var n=de.wrapFragment(Ft(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(e,t){return new Me.MathNode("mrow",[xn(e.fragment,t)])}});Be({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,a=yt(t[0],"ordgroup"),l=a.body,o="",c=0;c=1114111)throw new Ae("\\@char with invalid code point "+o);return m<=65535?f=String.fromCharCode(m):(m-=65536,f=String.fromCharCode((m>>10)+55296,(m&1023)+56320)),{type:"textord",mode:n.mode,text:f}}});var A8=(e,t)=>{var n=nr(e.body,t.withColor(e.color),!1);return de.makeFragment(n)},D8=(e,t)=>{var n=Qr(e.body,t.withColor(e.color)),a=new Me.MathNode("mstyle",n);return a.setAttribute("mathcolor",e.color),a};Be({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,a=yt(t[0],"color-token").color,l=t[1];return{type:"color",mode:n.mode,color:a,body:Pn(l)}},htmlBuilder:A8,mathmlBuilder:D8});Be({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:a}=e,l=yt(t[0],"color-token").color;n.gullet.macros.set("\\current@color",l);var o=n.parseExpression(!0,a);return{type:"color",mode:n.mode,color:l,body:o}},htmlBuilder:A8,mathmlBuilder:D8});Be({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,n){var{parser:a}=e,l=a.gullet.future().text==="["?a.parseSizeGroup(!0):null,o=!a.settings.displayMode||!a.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:a.mode,newLine:o,size:l&&yt(l,"size").value}},htmlBuilder(e,t){var n=de.makeSpan(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=Le(Mn(e.size,t)))),n},mathmlBuilder(e,t){var n=new Me.MathNode("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",Le(Mn(e.size,t)))),n}});var e1={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},z8=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new Ae("Expected a control sequence",e);return t},Oq=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},O8=(e,t,n,a)=>{var l=e.gullet.macros.get(n.text);l==null&&(n.noexpand=!0,l={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,l,a)};Be({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:n}=e;t.consumeSpaces();var a=t.fetch();if(e1[a.text])return(n==="\\global"||n==="\\\\globallong")&&(a.text=e1[a.text]),yt(t.parseFunction(),"internal");throw new Ae("Invalid token after macro prefix",a)}});Be({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,a=t.gullet.popToken(),l=a.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(l))throw new Ae("Expected a control sequence",a);for(var o=0,c,d=[[]];t.gullet.future().text!=="{";)if(a=t.gullet.popToken(),a.text==="#"){if(t.gullet.future().text==="{"){c=t.gullet.future(),d[o].push("{");break}if(a=t.gullet.popToken(),!/^[1-9]$/.test(a.text))throw new Ae('Invalid argument number "'+a.text+'"');if(parseInt(a.text)!==o+1)throw new Ae('Argument number "'+a.text+'" out of order');o++,d.push([])}else{if(a.text==="EOF")throw new Ae("Expected a macro definition");d[o].push(a.text)}var{tokens:m}=t.gullet.consumeArg();return c&&m.unshift(c),(n==="\\edef"||n==="\\xdef")&&(m=t.gullet.expandTokens(m),m.reverse()),t.gullet.macros.set(l,{tokens:m,numArgs:o,delimiters:d},n===e1[n]),{type:"internal",mode:t.mode}}});Be({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,a=z8(t.gullet.popToken());t.gullet.consumeSpaces();var l=Oq(t);return O8(t,a,l,n==="\\\\globallet"),{type:"internal",mode:t.mode}}});Be({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,a=z8(t.gullet.popToken()),l=t.gullet.popToken(),o=t.gullet.popToken();return O8(t,a,o,n==="\\\\globalfuture"),t.gullet.pushToken(o),t.gullet.pushToken(l),{type:"internal",mode:t.mode}}});var au=function(t,n,a){var l=yn.math[t]&&yn.math[t].replace,o=mg(l||t,n,a);if(!o)throw new Error("Unsupported symbol "+t+" and font size "+n+".");return o},yg=function(t,n,a,l){var o=a.havingBaseStyle(n),c=de.makeSpan(l.concat(o.sizingClasses(a)),[t],a),d=o.sizeMultiplier/a.sizeMultiplier;return c.height*=d,c.depth*=d,c.maxFontSize=o.sizeMultiplier,c},R8=function(t,n,a){var l=n.havingBaseStyle(a),o=(1-n.sizeMultiplier/l.sizeMultiplier)*n.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=Le(o),t.height-=o,t.depth+=o},Rq=function(t,n,a,l,o,c){var d=de.makeSymbol(t,"Main-Regular",o,l),m=yg(d,n,l,c);return a&&R8(m,l,n),m},Lq=function(t,n,a,l){return de.makeSymbol(t,"Size"+n+"-Regular",a,l)},L8=function(t,n,a,l,o,c){var d=Lq(t,n,o,l),m=yg(de.makeSpan(["delimsizing","size"+n],[d],l),tt.TEXT,l,c);return a&&R8(m,l,tt.TEXT),m},ax=function(t,n,a){var l;n==="Size1-Regular"?l="delim-size1":l="delim-size4";var o=de.makeSpan(["delimsizinginner",l],[de.makeSpan([],[de.makeSymbol(t,n,a)])]);return{type:"elem",elem:o}},sx=function(t,n,a){var l=ts["Size4-Regular"][t.charCodeAt(0)]?ts["Size4-Regular"][t.charCodeAt(0)][4]:ts["Size1-Regular"][t.charCodeAt(0)][4],o=new Ml("inner",qI(t,Math.round(1e3*n))),c=new Fs([o],{width:Le(l),height:Le(n),style:"width:"+Le(l),viewBox:"0 0 "+1e3*l+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),d=de.makeSvgSpan([],[c],a);return d.height=n,d.style.height=Le(n),d.style.width=Le(l),{type:"elem",elem:d}},t1=.008,L0={type:"kern",size:-1*t1},Bq=["|","\\lvert","\\rvert","\\vert"],Pq=["\\|","\\lVert","\\rVert","\\Vert"],B8=function(t,n,a,l,o,c){var d,m,f,p,x="",y=0;d=f=p=t,m=null;var b="Size1-Regular";t==="\\uparrow"?f=p="⏐":t==="\\Uparrow"?f=p="‖":t==="\\downarrow"?d=f="⏐":t==="\\Downarrow"?d=f="‖":t==="\\updownarrow"?(d="\\uparrow",f="⏐",p="\\downarrow"):t==="\\Updownarrow"?(d="\\Uparrow",f="‖",p="\\Downarrow"):Bq.includes(t)?(f="∣",x="vert",y=333):Pq.includes(t)?(f="∥",x="doublevert",y=556):t==="["||t==="\\lbrack"?(d="⎡",f="⎢",p="⎣",b="Size4-Regular",x="lbrack",y=667):t==="]"||t==="\\rbrack"?(d="⎤",f="⎥",p="⎦",b="Size4-Regular",x="rbrack",y=667):t==="\\lfloor"||t==="⌊"?(f=d="⎢",p="⎣",b="Size4-Regular",x="lfloor",y=667):t==="\\lceil"||t==="⌈"?(d="⎡",f=p="⎢",b="Size4-Regular",x="lceil",y=667):t==="\\rfloor"||t==="⌋"?(f=d="⎥",p="⎦",b="Size4-Regular",x="rfloor",y=667):t==="\\rceil"||t==="⌉"?(d="⎤",f=p="⎥",b="Size4-Regular",x="rceil",y=667):t==="("||t==="\\lparen"?(d="⎛",f="⎜",p="⎝",b="Size4-Regular",x="lparen",y=875):t===")"||t==="\\rparen"?(d="⎞",f="⎟",p="⎠",b="Size4-Regular",x="rparen",y=875):t==="\\{"||t==="\\lbrace"?(d="⎧",m="⎨",p="⎩",f="⎪",b="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(d="⎫",m="⎬",p="⎭",f="⎪",b="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(d="⎧",p="⎩",f="⎪",b="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(d="⎫",p="⎭",f="⎪",b="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(d="⎧",p="⎭",f="⎪",b="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(d="⎫",p="⎩",f="⎪",b="Size4-Regular");var N=au(d,b,o),k=N.height+N.depth,S=au(f,b,o),T=S.height+S.depth,M=au(p,b,o),A=M.height+M.depth,R=0,B=1;if(m!==null){var O=au(m,b,o);R=O.height+O.depth,B=2}var L=k+A+R,$=Math.max(0,Math.ceil((n-L)/(B*T))),U=L+$*B*T,I=l.fontMetrics().axisHeight;a&&(I*=l.sizeMultiplier);var G=U/2-I,ee=[];if(x.length>0){var Ne=U-k-A,J=Math.round(U*1e3),se=HI(x,Math.round(Ne*1e3)),H=new Ml(x,se),le=(y/1e3).toFixed(3)+"em",re=(J/1e3).toFixed(3)+"em",ge=new Fs([H],{width:le,height:re,viewBox:"0 0 "+y+" "+J}),E=de.makeSvgSpan([],[ge],l);E.height=J/1e3,E.style.width=le,E.style.height=re,ee.push({type:"elem",elem:E})}else{if(ee.push(ax(p,b,o)),ee.push(L0),m===null){var we=U-k-A+2*t1;ee.push(sx(f,we,l))}else{var Z=(U-k-A-R)/2+2*t1;ee.push(sx(f,Z,l)),ee.push(L0),ee.push(ax(m,b,o)),ee.push(L0),ee.push(sx(f,Z,l))}ee.push(L0),ee.push(ax(d,b,o))}var z=l.havingBaseStyle(tt.TEXT),X=de.makeVList({positionType:"bottom",positionData:G,children:ee},z);return yg(de.makeSpan(["delimsizing","mult"],[X],z),tt.TEXT,l,c)},lx=80,ix=.08,ox=function(t,n,a,l,o){var c=II(t,l,a),d=new Ml(t,c),m=new Fs([d],{width:"400em",height:Le(n),viewBox:"0 0 400000 "+a,preserveAspectRatio:"xMinYMin slice"});return de.makeSvgSpan(["hide-tail"],[m],o)},Fq=function(t,n){var a=n.havingBaseSizing(),l=q8("\\surd",t*a.sizeMultiplier,I8,a),o=a.sizeMultiplier,c=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),d,m=0,f=0,p=0,x;return l.type==="small"?(p=1e3+1e3*c+lx,t<1?o=1:t<1.4&&(o=.7),m=(1+c+ix)/o,f=(1+c)/o,d=ox("sqrtMain",m,p,c,n),d.style.minWidth="0.853em",x=.833/o):l.type==="large"?(p=(1e3+lx)*hu[l.size],f=(hu[l.size]+c)/o,m=(hu[l.size]+c+ix)/o,d=ox("sqrtSize"+l.size,m,p,c,n),d.style.minWidth="1.02em",x=1/o):(m=t+c+ix,f=t+c,p=Math.floor(1e3*t+c)+lx,d=ox("sqrtTall",m,p,c,n),d.style.minWidth="0.742em",x=1.056),d.height=f,d.style.height=Le(m),{span:d,advanceWidth:x,ruleWidth:(n.fontMetrics().sqrtRuleThickness+c)*o}},P8=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Iq=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],F8=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],hu=[0,1.2,1.8,2.4,3],qq=function(t,n,a,l,o){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),P8.includes(t)||F8.includes(t))return L8(t,n,!1,a,l,o);if(Iq.includes(t))return B8(t,hu[n],!1,a,l,o);throw new Ae("Illegal delimiter: '"+t+"'")},Hq=[{type:"small",style:tt.SCRIPTSCRIPT},{type:"small",style:tt.SCRIPT},{type:"small",style:tt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Uq=[{type:"small",style:tt.SCRIPTSCRIPT},{type:"small",style:tt.SCRIPT},{type:"small",style:tt.TEXT},{type:"stack"}],I8=[{type:"small",style:tt.SCRIPTSCRIPT},{type:"small",style:tt.SCRIPT},{type:"small",style:tt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],$q=function(t){if(t.type==="small")return"Main-Regular";if(t.type==="large")return"Size"+t.size+"-Regular";if(t.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+t.type+"' here.")},q8=function(t,n,a,l){for(var o=Math.min(2,3-l.style.size),c=o;cn)return a[c]}return a[a.length-1]},H8=function(t,n,a,l,o,c){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var d;F8.includes(t)?d=Hq:P8.includes(t)?d=I8:d=Uq;var m=q8(t,n,d,l);return m.type==="small"?Rq(t,m.style,a,l,o,c):m.type==="large"?L8(t,m.size,a,l,o,c):B8(t,n,a,l,o,c)},Vq=function(t,n,a,l,o,c){var d=l.fontMetrics().axisHeight*l.sizeMultiplier,m=901,f=5/l.fontMetrics().ptPerEm,p=Math.max(n-d,a+d),x=Math.max(p/500*m,2*p-f);return H8(t,x,!0,l,o,c)},Ls={sqrtImage:Fq,sizedDelim:qq,sizeToMaxHeight:hu,customSizedDelim:H8,leftRightDelim:Vq},U3={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Gq=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function Qm(e,t){var n=Xm(e);if(n&&Gq.includes(n.text))return n;throw n?new Ae("Invalid delimiter '"+n.text+"' after '"+t.funcName+"'",e):new Ae("Invalid delimiter type '"+e.type+"'",e)}Be({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{var n=Qm(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:U3[e.funcName].size,mclass:U3[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim==="."?de.makeSpan([e.mclass]):Ls.sizedDelim(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(Ma(e.delim,e.mode));var n=new Me.MathNode("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var a=Le(Ls.sizeToMaxHeight[e.size]);return n.setAttribute("minsize",a),n.setAttribute("maxsize",a),n}});function $3(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Be({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=e.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new Ae("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:Qm(t[0],e).text,color:n}}});Be({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Qm(t[0],e),a=e.parser;++a.leftrightDepth;var l=a.parseExpression(!1);--a.leftrightDepth,a.expect("\\right",!1);var o=yt(a.parseFunction(),"leftright-right");return{type:"leftright",mode:a.mode,body:l,left:n.text,right:o.delim,rightColor:o.color}},htmlBuilder:(e,t)=>{$3(e);for(var n=nr(e.body,t,!0,["mopen","mclose"]),a=0,l=0,o=!1,c=0;c{$3(e);var n=Qr(e.body,t);if(e.left!=="."){var a=new Me.MathNode("mo",[Ma(e.left,e.mode)]);a.setAttribute("fence","true"),n.unshift(a)}if(e.right!=="."){var l=new Me.MathNode("mo",[Ma(e.right,e.mode)]);l.setAttribute("fence","true"),e.rightColor&&l.setAttribute("mathcolor",e.rightColor),n.push(l)}return pg(n)}});Be({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Qm(t[0],e);if(!e.parser.leftrightDepth)throw new Ae("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;if(e.delim===".")n=Nu(t,[]);else{n=Ls.sizedDelim(e.delim,1,t,e.mode,[]);var a={delim:e.delim,options:t};n.isMiddle=a}return n},mathmlBuilder:(e,t)=>{var n=e.delim==="\\vert"||e.delim==="|"?Ma("|","text"):Ma(e.delim,e.mode),a=new Me.MathNode("mo",[n]);return a.setAttribute("fence","true"),a.setAttribute("lspace","0.05em"),a.setAttribute("rspace","0.05em"),a}});var bg=(e,t)=>{var n=de.wrapFragment(Ft(e.body,t),t),a=e.label.slice(1),l=t.sizeMultiplier,o,c=0,d=Ut.isCharacterBox(e.body);if(a==="sout")o=de.makeSpan(["stretchy","sout"]),o.height=t.fontMetrics().defaultRuleThickness/l,c=-.5*t.fontMetrics().xHeight;else if(a==="phase"){var m=Mn({number:.6,unit:"pt"},t),f=Mn({number:.35,unit:"ex"},t),p=t.havingBaseSizing();l=l/p.sizeMultiplier;var x=n.height+n.depth+m+f;n.style.paddingLeft=Le(x/2+m);var y=Math.floor(1e3*x*l),b=PI(y),N=new Fs([new Ml("phase",b)],{width:"400em",height:Le(y/1e3),viewBox:"0 0 400000 "+y,preserveAspectRatio:"xMinYMin slice"});o=de.makeSvgSpan(["hide-tail"],[N],t),o.style.height=Le(x),c=n.depth+m+f}else{/cancel/.test(a)?d||n.classes.push("cancel-pad"):a==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var k=0,S=0,T=0;/box/.test(a)?(T=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),k=t.fontMetrics().fboxsep+(a==="colorbox"?0:T),S=k):a==="angl"?(T=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),k=4*T,S=Math.max(0,.25-n.depth)):(k=d?.2:0,S=k),o=qs.encloseSpan(n,a,k,S,t),/fbox|boxed|fcolorbox/.test(a)?(o.style.borderStyle="solid",o.style.borderWidth=Le(T)):a==="angl"&&T!==.049&&(o.style.borderTopWidth=Le(T),o.style.borderRightWidth=Le(T)),c=n.depth+S,e.backgroundColor&&(o.style.backgroundColor=e.backgroundColor,e.borderColor&&(o.style.borderColor=e.borderColor))}var M;if(e.backgroundColor)M=de.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:c},{type:"elem",elem:n,shift:0}]},t);else{var A=/cancel|phase/.test(a)?["svg-align"]:[];M=de.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:o,shift:c,wrapperClasses:A}]},t)}return/cancel/.test(a)&&(M.height=n.height,M.depth=n.depth),/cancel/.test(a)&&!d?de.makeSpan(["mord","cancel-lap"],[M],t):de.makeSpan(["mord"],[M],t)},wg=(e,t)=>{var n=0,a=new Me.MathNode(e.label.indexOf("colorbox")>-1?"mpadded":"menclose",[xn(e.body,t)]);switch(e.label){case"\\cancel":a.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":a.setAttribute("notation","downdiagonalstrike");break;case"\\phase":a.setAttribute("notation","phasorangle");break;case"\\sout":a.setAttribute("notation","horizontalstrike");break;case"\\fbox":a.setAttribute("notation","box");break;case"\\angl":a.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,a.setAttribute("width","+"+2*n+"pt"),a.setAttribute("height","+"+2*n+"pt"),a.setAttribute("lspace",n+"pt"),a.setAttribute("voffset",n+"pt"),e.label==="\\fcolorbox"){var l=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);a.setAttribute("style","border: "+l+"em solid "+String(e.borderColor))}break;case"\\xcancel":a.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&a.setAttribute("mathbackground",e.backgroundColor),a};Be({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(e,t,n){var{parser:a,funcName:l}=e,o=yt(t[0],"color-token").color,c=t[1];return{type:"enclose",mode:a.mode,label:l,backgroundColor:o,body:c}},htmlBuilder:bg,mathmlBuilder:wg});Be({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(e,t,n){var{parser:a,funcName:l}=e,o=yt(t[0],"color-token").color,c=yt(t[1],"color-token").color,d=t[2];return{type:"enclose",mode:a.mode,label:l,backgroundColor:c,borderColor:o,body:d}},htmlBuilder:bg,mathmlBuilder:wg});Be({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\fbox",body:t[0]}}});Be({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:a}=e,l=t[0];return{type:"enclose",mode:n.mode,label:a,body:l}},htmlBuilder:bg,mathmlBuilder:wg});Be({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\angl",body:t[0]}}});var U8={};function is(e){for(var{type:t,names:n,props:a,handler:l,htmlBuilder:o,mathmlBuilder:c}=e,d={type:t,numArgs:a.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:l},m=0;m{var t=e.parser.settings;if(!t.displayMode)throw new Ae("{"+e.envName+"} can be used only in display mode.")};function jg(e){if(e.indexOf("ed")===-1)return e.indexOf("*")===-1}function Bl(e,t,n){var{hskipBeforeAndAfter:a,addJot:l,cols:o,arraystretch:c,colSeparationType:d,autoTag:m,singleRow:f,emptySingleRow:p,maxNumCols:x,leqno:y}=t;if(e.gullet.beginGroup(),f||e.gullet.macros.set("\\cr","\\\\\\relax"),!c){var b=e.gullet.expandMacroAsText("\\arraystretch");if(b==null)c=1;else if(c=parseFloat(b),!c||c<0)throw new Ae("Invalid \\arraystretch: "+b)}e.gullet.beginGroup();var N=[],k=[N],S=[],T=[],M=m!=null?[]:void 0;function A(){m&&e.gullet.macros.set("\\@eqnsw","1",!0)}function R(){M&&(e.gullet.macros.get("\\df@tag")?(M.push(e.subparse([new da("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):M.push(!!m&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(A(),T.push(V3(e));;){var B=e.parseExpression(!1,f?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup(),B={type:"ordgroup",mode:e.mode,body:B},n&&(B={type:"styling",mode:e.mode,style:n,body:[B]}),N.push(B);var O=e.fetch().text;if(O==="&"){if(x&&N.length===x){if(f||d)throw new Ae("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(O==="\\end"){R(),N.length===1&&B.type==="styling"&&B.body[0].body.length===0&&(k.length>1||!p)&&k.pop(),T.length0&&(A+=.25),f.push({pos:A,isDashed:Xe[wn]})}for(R(c[0]),a=0;a0&&(G+=M,LXe))for(a=0;a=d)){var fe=void 0;(l>0||t.hskipBeforeAndAfter)&&(fe=Ut.deflt(Z.pregap,y),fe!==0&&(se=de.makeSpan(["arraycolsep"],[]),se.style.width=Le(fe),J.push(se)));var De=[];for(a=0;a0){for(var je=de.makeLineSpan("hline",n,p),Ze=de.makeLineSpan("hdashline",n,p),qe=[{type:"elem",elem:m,shift:0}];f.length>0;){var Ot=f.pop(),bn=Ot.pos-ee;Ot.isDashed?qe.push({type:"elem",elem:Ze,shift:bn}):qe.push({type:"elem",elem:je,shift:bn})}m=de.makeVList({positionType:"individualShift",children:qe},n)}if(le.length===0)return de.makeSpan(["mord"],[m],n);var Dn=de.makeVList({positionType:"individualShift",children:le},n);return Dn=de.makeSpan(["tag"],[Dn],n),de.makeFragment([m,Dn])},Yq={c:"center ",l:"left ",r:"right "},cs=function(t,n){for(var a=[],l=new Me.MathNode("mtd",[],["mtr-glue"]),o=new Me.MathNode("mtd",[],["mml-eqn-num"]),c=0;c0){var N=t.cols,k="",S=!1,T=0,M=N.length;N[0].type==="separator"&&(y+="top ",T=1),N[N.length-1].type==="separator"&&(y+="bottom ",M-=1);for(var A=T;A0?"left ":"",y+=$[$.length-1].length>0?"right ":"";for(var U=1;U<$.length-1;U++)L+=$[U].length===0?"none ":$[U][0]?"dashed ":"solid ";return/[sd]/.test(L)&&p.setAttribute("rowlines",L.trim()),y!==""&&(p=new Me.MathNode("menclose",[p]),p.setAttribute("notation",y.trim())),t.arraystretch&&t.arraystretch<1&&(p=new Me.MathNode("mstyle",[p]),p.setAttribute("scriptlevel","1")),p},V8=function(t,n){t.envName.indexOf("ed")===-1&&Zm(t);var a=[],l=t.envName.indexOf("at")>-1?"alignat":"align",o=t.envName==="split",c=Bl(t.parser,{cols:a,addJot:!0,autoTag:o?void 0:jg(t.envName),emptySingleRow:!0,colSeparationType:l,maxNumCols:o?2:void 0,leqno:t.parser.settings.leqno},"display"),d,m=0,f={type:"ordgroup",mode:t.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var p="",x=0;x0&&b&&(S=1),a[N]={type:"align",align:k,pregap:S,postgap:0}}return c.colSeparationType=b?"align":"alignat",c};is({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=Xm(t[0]),a=n?[t[0]]:yt(t[0],"ordgroup").body,l=a.map(function(c){var d=gg(c),m=d.text;if("lcr".indexOf(m)!==-1)return{type:"align",align:m};if(m==="|")return{type:"separator",separator:"|"};if(m===":")return{type:"separator",separator:":"};throw new Ae("Unknown column alignment: "+m,c)}),o={cols:l,hskipBeforeAndAfter:!0,maxNumCols:l.length};return Bl(e.parser,o,Ng(e.envName))},htmlBuilder:os,mathmlBuilder:cs});is({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],n="c",a={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(e.envName.charAt(e.envName.length-1)==="*"){var l=e.parser;if(l.consumeSpaces(),l.fetch().text==="["){if(l.consume(),l.consumeSpaces(),n=l.fetch().text,"lcr".indexOf(n)===-1)throw new Ae("Expected l or c or r",l.nextToken);l.consume(),l.consumeSpaces(),l.expect("]"),l.consume(),a.cols=[{type:"align",align:n}]}}var o=Bl(e.parser,a,Ng(e.envName)),c=Math.max(0,...o.body.map(d=>d.length));return o.cols=new Array(c).fill({type:"align",align:n}),t?{type:"leftright",mode:e.mode,body:[o],left:t[0],right:t[1],rightColor:void 0}:o},htmlBuilder:os,mathmlBuilder:cs});is({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},n=Bl(e.parser,t,"script");return n.colSeparationType="small",n},htmlBuilder:os,mathmlBuilder:cs});is({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=Xm(t[0]),a=n?[t[0]]:yt(t[0],"ordgroup").body,l=a.map(function(c){var d=gg(c),m=d.text;if("lc".indexOf(m)!==-1)return{type:"align",align:m};throw new Ae("Unknown column alignment: "+m,c)});if(l.length>1)throw new Ae("{subarray} can contain only one column");var o={cols:l,hskipBeforeAndAfter:!1,arraystretch:.5};if(o=Bl(e.parser,o,"script"),o.body.length>0&&o.body[0].length>1)throw new Ae("{subarray} can contain only one column");return o},htmlBuilder:os,mathmlBuilder:cs});is({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=Bl(e.parser,t,Ng(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:os,mathmlBuilder:cs});is({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:V8,htmlBuilder:os,mathmlBuilder:cs});is({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){["gather","gather*"].includes(e.envName)&&Zm(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:jg(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Bl(e.parser,t,"display")},htmlBuilder:os,mathmlBuilder:cs});is({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:V8,htmlBuilder:os,mathmlBuilder:cs});is({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){Zm(e);var t={autoTag:jg(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Bl(e.parser,t,"display")},htmlBuilder:os,mathmlBuilder:cs});is({type:"array",names:["CD"],props:{numArgs:0},handler(e){return Zm(e),zq(e.parser)},htmlBuilder:os,mathmlBuilder:cs});F("\\nonumber","\\gdef\\@eqnsw{0}");F("\\notag","\\nonumber");Be({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new Ae(e.funcName+" valid only within array environment")}});var G3=U8;Be({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:n,funcName:a}=e,l=t[0];if(l.type!=="ordgroup")throw new Ae("Invalid environment name",l);for(var o="",c=0;c{var n=e.font,a=t.withFont(n);return Ft(e.body,a)},Y8=(e,t)=>{var n=e.font,a=t.withFont(n);return xn(e.body,a)},Y3={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Be({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=gm(t[0]),o=a;return o in Y3&&(o=Y3[o]),{type:"font",mode:n.mode,font:o.slice(1),body:l}},htmlBuilder:G8,mathmlBuilder:Y8});Be({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:n}=e,a=t[0],l=Ut.isCharacterBox(a);return{type:"mclass",mode:n.mode,mclass:Km(a),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:a}],isCharacterBox:l}}});Be({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:a,breakOnTokenText:l}=e,{mode:o}=n,c=n.parseExpression(!0,l),d="math"+a.slice(1);return{type:"font",mode:o,font:d,body:{type:"ordgroup",mode:n.mode,body:c}}},htmlBuilder:G8,mathmlBuilder:Y8});var W8=(e,t)=>{var n=t;return e==="display"?n=n.id>=tt.SCRIPT.id?n.text():tt.DISPLAY:e==="text"&&n.size===tt.DISPLAY.size?n=tt.TEXT:e==="script"?n=tt.SCRIPT:e==="scriptscript"&&(n=tt.SCRIPTSCRIPT),n},Sg=(e,t)=>{var n=W8(e.size,t.style),a=n.fracNum(),l=n.fracDen(),o;o=t.havingStyle(a);var c=Ft(e.numer,o,t);if(e.continued){var d=8.5/t.fontMetrics().ptPerEm,m=3.5/t.fontMetrics().ptPerEm;c.height=c.height0?N=3*y:N=7*y,k=t.fontMetrics().denom1):(x>0?(b=t.fontMetrics().num2,N=y):(b=t.fontMetrics().num3,N=3*y),k=t.fontMetrics().denom2);var S;if(p){var M=t.fontMetrics().axisHeight;b-c.depth-(M+.5*x){var n=new Me.MathNode("mfrac",[xn(e.numer,t),xn(e.denom,t)]);if(!e.hasBarLine)n.setAttribute("linethickness","0px");else if(e.barSize){var a=Mn(e.barSize,t);n.setAttribute("linethickness",Le(a))}var l=W8(e.size,t.style);if(l.size!==t.style.size){n=new Me.MathNode("mstyle",[n]);var o=l.size===tt.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",o),n.setAttribute("scriptlevel","0")}if(e.leftDelim!=null||e.rightDelim!=null){var c=[];if(e.leftDelim!=null){var d=new Me.MathNode("mo",[new Me.TextNode(e.leftDelim.replace("\\",""))]);d.setAttribute("fence","true"),c.push(d)}if(c.push(n),e.rightDelim!=null){var m=new Me.MathNode("mo",[new Me.TextNode(e.rightDelim.replace("\\",""))]);m.setAttribute("fence","true"),c.push(m)}return pg(c)}return n};Be({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=t[0],o=t[1],c,d=null,m=null,f="auto";switch(a){case"\\dfrac":case"\\frac":case"\\tfrac":c=!0;break;case"\\\\atopfrac":c=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":c=!1,d="(",m=")";break;case"\\\\bracefrac":c=!1,d="\\{",m="\\}";break;case"\\\\brackfrac":c=!1,d="[",m="]";break;default:throw new Error("Unrecognized genfrac command")}switch(a){case"\\dfrac":case"\\dbinom":f="display";break;case"\\tfrac":case"\\tbinom":f="text";break}return{type:"genfrac",mode:n.mode,continued:!1,numer:l,denom:o,hasBarLine:c,leftDelim:d,rightDelim:m,size:f,barSize:null}},htmlBuilder:Sg,mathmlBuilder:kg});Be({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=t[0],o=t[1];return{type:"genfrac",mode:n.mode,continued:!0,numer:l,denom:o,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});Be({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:n,token:a}=e,l;switch(n){case"\\over":l="\\frac";break;case"\\choose":l="\\binom";break;case"\\atop":l="\\\\atopfrac";break;case"\\brace":l="\\\\bracefrac";break;case"\\brack":l="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:l,token:a}}});var W3=["display","text","script","scriptscript"],X3=function(t){var n=null;return t.length>0&&(n=t,n=n==="."?null:n),n};Be({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:n}=e,a=t[4],l=t[5],o=gm(t[0]),c=o.type==="atom"&&o.family==="open"?X3(o.text):null,d=gm(t[1]),m=d.type==="atom"&&d.family==="close"?X3(d.text):null,f=yt(t[2],"size"),p,x=null;f.isBlank?p=!0:(x=f.value,p=x.number>0);var y="auto",b=t[3];if(b.type==="ordgroup"){if(b.body.length>0){var N=yt(b.body[0],"textord");y=W3[Number(N.text)]}}else b=yt(b,"textord"),y=W3[Number(b.text)];return{type:"genfrac",mode:n.mode,numer:a,denom:l,continued:!1,hasBarLine:p,barSize:x,leftDelim:c,rightDelim:m,size:y}},htmlBuilder:Sg,mathmlBuilder:kg});Be({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:n,funcName:a,token:l}=e;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:yt(t[0],"size").value,token:l}}});Be({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=t[0],o=NI(yt(t[1],"infix").size),c=t[2],d=o.number>0;return{type:"genfrac",mode:n.mode,numer:l,denom:c,continued:!1,hasBarLine:d,barSize:o,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:Sg,mathmlBuilder:kg});var X8=(e,t)=>{var n=t.style,a,l;e.type==="supsub"?(a=e.sup?Ft(e.sup,t.havingStyle(n.sup()),t):Ft(e.sub,t.havingStyle(n.sub()),t),l=yt(e.base,"horizBrace")):l=yt(e,"horizBrace");var o=Ft(l.base,t.havingBaseStyle(tt.DISPLAY)),c=qs.svgSpan(l,t),d;if(l.isOver?(d=de.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"kern",size:.1},{type:"elem",elem:c}]},t),d.children[0].children[0].children[1].classes.push("svg-align")):(d=de.makeVList({positionType:"bottom",positionData:o.depth+.1+c.height,children:[{type:"elem",elem:c},{type:"kern",size:.1},{type:"elem",elem:o}]},t),d.children[0].children[0].children[0].classes.push("svg-align")),a){var m=de.makeSpan(["mord",l.isOver?"mover":"munder"],[d],t);l.isOver?d=de.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:m},{type:"kern",size:.2},{type:"elem",elem:a}]},t):d=de.makeVList({positionType:"bottom",positionData:m.depth+.2+a.height+a.depth,children:[{type:"elem",elem:a},{type:"kern",size:.2},{type:"elem",elem:m}]},t)}return de.makeSpan(["mord",l.isOver?"mover":"munder"],[d],t)},Wq=(e,t)=>{var n=qs.mathMLnode(e.label);return new Me.MathNode(e.isOver?"mover":"munder",[xn(e.base,t),n])};Be({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:a}=e;return{type:"horizBrace",mode:n.mode,label:a,isOver:/^\\over/.test(a),base:t[0]}},htmlBuilder:X8,mathmlBuilder:Wq});Be({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,a=t[1],l=yt(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:l})?{type:"href",mode:n.mode,href:l,body:Pn(a)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=nr(e.body,t,!1);return de.makeAnchor(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=Al(e.body,t);return n instanceof ca||(n=new ca("mrow",[n])),n.setAttribute("href",e.href),n}});Be({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,a=yt(t[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:a}))return n.formatUnsupportedCmd("\\url");for(var l=[],o=0;o{var{parser:n,funcName:a,token:l}=e,o=yt(t[0],"raw").string,c=t[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var d,m={};switch(a){case"\\htmlClass":m.class=o,d={command:"\\htmlClass",class:o};break;case"\\htmlId":m.id=o,d={command:"\\htmlId",id:o};break;case"\\htmlStyle":m.style=o,d={command:"\\htmlStyle",style:o};break;case"\\htmlData":{for(var f=o.split(","),p=0;p{var n=nr(e.body,t,!1),a=["enclosing"];e.attributes.class&&a.push(...e.attributes.class.trim().split(/\s+/));var l=de.makeSpan(a,n,t);for(var o in e.attributes)o!=="class"&&e.attributes.hasOwnProperty(o)&&l.setAttribute(o,e.attributes[o]);return l},mathmlBuilder:(e,t)=>Al(e.body,t)});Be({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"htmlmathml",mode:n.mode,html:Pn(t[0]),mathml:Pn(t[1])}},htmlBuilder:(e,t)=>{var n=nr(e.html,t,!1);return de.makeFragment(n)},mathmlBuilder:(e,t)=>Al(e.mathml,t)});var cx=function(t){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(t))return{number:+t,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t);if(!n)throw new Ae("Invalid size: '"+t+"' in \\includegraphics");var a={number:+(n[1]+n[2]),unit:n[3]};if(!f8(a))throw new Ae("Invalid unit: '"+a.unit+"' in \\includegraphics.");return a};Be({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,n)=>{var{parser:a}=e,l={number:0,unit:"em"},o={number:.9,unit:"em"},c={number:0,unit:"em"},d="";if(n[0])for(var m=yt(n[0],"raw").string,f=m.split(","),p=0;p{var n=Mn(e.height,t),a=0;e.totalheight.number>0&&(a=Mn(e.totalheight,t)-n);var l=0;e.width.number>0&&(l=Mn(e.width,t));var o={height:Le(n+a)};l>0&&(o.width=Le(l)),a>0&&(o.verticalAlign=Le(-a));var c=new WI(e.src,e.alt,o);return c.height=n,c.depth=a,c},mathmlBuilder:(e,t)=>{var n=new Me.MathNode("mglyph",[]);n.setAttribute("alt",e.alt);var a=Mn(e.height,t),l=0;if(e.totalheight.number>0&&(l=Mn(e.totalheight,t)-a,n.setAttribute("valign",Le(-l))),n.setAttribute("height",Le(a+l)),e.width.number>0){var o=Mn(e.width,t);n.setAttribute("width",Le(o))}return n.setAttribute("src",e.src),n}});Be({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:a}=e,l=yt(t[0],"size");if(n.settings.strict){var o=a[1]==="m",c=l.value.unit==="mu";o?(c||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" supports only mu units, "+("not "+l.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" works only in math mode")):c&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:l.value}},htmlBuilder(e,t){return de.makeGlue(e.dimension,t)},mathmlBuilder(e,t){var n=Mn(e.dimension,t);return new Me.SpaceNode(n)}});Be({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=t[0];return{type:"lap",mode:n.mode,alignment:a.slice(5),body:l}},htmlBuilder:(e,t)=>{var n;e.alignment==="clap"?(n=de.makeSpan([],[Ft(e.body,t)]),n=de.makeSpan(["inner"],[n],t)):n=de.makeSpan(["inner"],[Ft(e.body,t)]);var a=de.makeSpan(["fix"],[]),l=de.makeSpan([e.alignment],[n,a],t),o=de.makeSpan(["strut"]);return o.style.height=Le(l.height+l.depth),l.depth&&(o.style.verticalAlign=Le(-l.depth)),l.children.unshift(o),l=de.makeSpan(["thinbox"],[l],t),de.makeSpan(["mord","vbox"],[l],t)},mathmlBuilder:(e,t)=>{var n=new Me.MathNode("mpadded",[xn(e.body,t)]);if(e.alignment!=="rlap"){var a=e.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",a+"width")}return n.setAttribute("width","0px"),n}});Be({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:n,parser:a}=e,l=a.mode;a.switchMode("math");var o=n==="\\("?"\\)":"$",c=a.parseExpression(!1,o);return a.expect(o),a.switchMode(l),{type:"styling",mode:a.mode,style:"text",body:c}}});Be({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new Ae("Mismatched "+e.funcName)}});var K3=(e,t)=>{switch(t.style.size){case tt.DISPLAY.size:return e.display;case tt.TEXT.size:return e.text;case tt.SCRIPT.size:return e.script;case tt.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};Be({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:Pn(t[0]),text:Pn(t[1]),script:Pn(t[2]),scriptscript:Pn(t[3])}},htmlBuilder:(e,t)=>{var n=K3(e,t),a=nr(n,t,!1);return de.makeFragment(a)},mathmlBuilder:(e,t)=>{var n=K3(e,t);return Al(n,t)}});var K8=(e,t,n,a,l,o,c)=>{e=de.makeSpan([],[e]);var d=n&&Ut.isCharacterBox(n),m,f;if(t){var p=Ft(t,a.havingStyle(l.sup()),a);f={elem:p,kern:Math.max(a.fontMetrics().bigOpSpacing1,a.fontMetrics().bigOpSpacing3-p.depth)}}if(n){var x=Ft(n,a.havingStyle(l.sub()),a);m={elem:x,kern:Math.max(a.fontMetrics().bigOpSpacing2,a.fontMetrics().bigOpSpacing4-x.height)}}var y;if(f&&m){var b=a.fontMetrics().bigOpSpacing5+m.elem.height+m.elem.depth+m.kern+e.depth+c;y=de.makeVList({positionType:"bottom",positionData:b,children:[{type:"kern",size:a.fontMetrics().bigOpSpacing5},{type:"elem",elem:m.elem,marginLeft:Le(-o)},{type:"kern",size:m.kern},{type:"elem",elem:e},{type:"kern",size:f.kern},{type:"elem",elem:f.elem,marginLeft:Le(o)},{type:"kern",size:a.fontMetrics().bigOpSpacing5}]},a)}else if(m){var N=e.height-c;y=de.makeVList({positionType:"top",positionData:N,children:[{type:"kern",size:a.fontMetrics().bigOpSpacing5},{type:"elem",elem:m.elem,marginLeft:Le(-o)},{type:"kern",size:m.kern},{type:"elem",elem:e}]},a)}else if(f){var k=e.depth+c;y=de.makeVList({positionType:"bottom",positionData:k,children:[{type:"elem",elem:e},{type:"kern",size:f.kern},{type:"elem",elem:f.elem,marginLeft:Le(o)},{type:"kern",size:a.fontMetrics().bigOpSpacing5}]},a)}else return e;var S=[y];if(m&&o!==0&&!d){var T=de.makeSpan(["mspace"],[],a);T.style.marginRight=Le(o),S.unshift(T)}return de.makeSpan(["mop","op-limits"],S,a)},Q8=["\\smallint"],nc=(e,t)=>{var n,a,l=!1,o;e.type==="supsub"?(n=e.sup,a=e.sub,o=yt(e.base,"op"),l=!0):o=yt(e,"op");var c=t.style,d=!1;c.size===tt.DISPLAY.size&&o.symbol&&!Q8.includes(o.name)&&(d=!0);var m;if(o.symbol){var f=d?"Size2-Regular":"Size1-Regular",p="";if((o.name==="\\oiint"||o.name==="\\oiiint")&&(p=o.name.slice(1),o.name=p==="oiint"?"\\iint":"\\iiint"),m=de.makeSymbol(o.name,f,"math",t,["mop","op-symbol",d?"large-op":"small-op"]),p.length>0){var x=m.italic,y=de.staticSvg(p+"Size"+(d?"2":"1"),t);m=de.makeVList({positionType:"individualShift",children:[{type:"elem",elem:m,shift:0},{type:"elem",elem:y,shift:d?.08:0}]},t),o.name="\\"+p,m.classes.unshift("mop"),m.italic=x}}else if(o.body){var b=nr(o.body,t,!0);b.length===1&&b[0]instanceof Ea?(m=b[0],m.classes[0]="mop"):m=de.makeSpan(["mop"],b,t)}else{for(var N=[],k=1;k{var n;if(e.symbol)n=new ca("mo",[Ma(e.name,e.mode)]),Q8.includes(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new ca("mo",Qr(e.body,t));else{n=new ca("mi",[new ns(e.name.slice(1))]);var a=new ca("mo",[Ma("⁡","text")]);e.parentIsSupSub?n=new ca("mrow",[n,a]):n=k8([n,a])}return n},Xq={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Be({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=a;return l.length===1&&(l=Xq[l]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:l}},htmlBuilder:nc,mathmlBuilder:Ku});Be({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:n}=e,a=t[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Pn(a)}},htmlBuilder:nc,mathmlBuilder:Ku});var Kq={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Be({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:nc,mathmlBuilder:Ku});Be({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:nc,mathmlBuilder:Ku});Be({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e,a=n;return a.length===1&&(a=Kq[a]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:a}},htmlBuilder:nc,mathmlBuilder:Ku});var Z8=(e,t)=>{var n,a,l=!1,o;e.type==="supsub"?(n=e.sup,a=e.sub,o=yt(e.base,"operatorname"),l=!0):o=yt(e,"operatorname");var c;if(o.body.length>0){for(var d=o.body.map(x=>{var y=x.text;return typeof y=="string"?{type:"textord",mode:x.mode,text:y}:x}),m=nr(d,t.withFont("mathrm"),!0),f=0;f{for(var n=Qr(e.body,t.withFont("mathrm")),a=!0,l=0;lp.toText()).join("");n=[new Me.TextNode(d)]}var m=new Me.MathNode("mi",n);m.setAttribute("mathvariant","normal");var f=new Me.MathNode("mo",[Ma("⁡","text")]);return e.parentIsSupSub?new Me.MathNode("mrow",[m,f]):Me.newDocumentFragment([m,f])};Be({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:a}=e,l=t[0];return{type:"operatorname",mode:n.mode,body:Pn(l),alwaysHandleSupSub:a==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Z8,mathmlBuilder:Qq});F("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Ci({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?de.makeFragment(nr(e.body,t,!1)):de.makeSpan(["mord"],nr(e.body,t,!0),t)},mathmlBuilder(e,t){return Al(e.body,t,!0)}});Be({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:n}=e,a=t[0];return{type:"overline",mode:n.mode,body:a}},htmlBuilder(e,t){var n=Ft(e.body,t.havingCrampedStyle()),a=de.makeLineSpan("overline-line",t),l=t.fontMetrics().defaultRuleThickness,o=de.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*l},{type:"elem",elem:a},{type:"kern",size:l}]},t);return de.makeSpan(["mord","overline"],[o],t)},mathmlBuilder(e,t){var n=new Me.MathNode("mo",[new Me.TextNode("‾")]);n.setAttribute("stretchy","true");var a=new Me.MathNode("mover",[xn(e.body,t),n]);return a.setAttribute("accent","true"),a}});Be({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,a=t[0];return{type:"phantom",mode:n.mode,body:Pn(a)}},htmlBuilder:(e,t)=>{var n=nr(e.body,t.withPhantom(),!1);return de.makeFragment(n)},mathmlBuilder:(e,t)=>{var n=Qr(e.body,t);return new Me.MathNode("mphantom",n)}});Be({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,a=t[0];return{type:"hphantom",mode:n.mode,body:a}},htmlBuilder:(e,t)=>{var n=de.makeSpan([],[Ft(e.body,t.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var a=0;a{var n=Qr(Pn(e.body),t),a=new Me.MathNode("mphantom",n),l=new Me.MathNode("mpadded",[a]);return l.setAttribute("height","0px"),l.setAttribute("depth","0px"),l}});Be({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,a=t[0];return{type:"vphantom",mode:n.mode,body:a}},htmlBuilder:(e,t)=>{var n=de.makeSpan(["inner"],[Ft(e.body,t.withPhantom())]),a=de.makeSpan(["fix"],[]);return de.makeSpan(["mord","rlap"],[n,a],t)},mathmlBuilder:(e,t)=>{var n=Qr(Pn(e.body),t),a=new Me.MathNode("mphantom",n),l=new Me.MathNode("mpadded",[a]);return l.setAttribute("width","0px"),l}});Be({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,a=yt(t[0],"size").value,l=t[1];return{type:"raisebox",mode:n.mode,dy:a,body:l}},htmlBuilder(e,t){var n=Ft(e.body,t),a=Mn(e.dy,t);return de.makeVList({positionType:"shift",positionData:-a,children:[{type:"elem",elem:n}]},t)},mathmlBuilder(e,t){var n=new Me.MathNode("mpadded",[xn(e.body,t)]),a=e.dy.number+e.dy.unit;return n.setAttribute("voffset",a),n}});Be({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});Be({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,n){var{parser:a}=e,l=n[0],o=yt(t[0],"size"),c=yt(t[1],"size");return{type:"rule",mode:a.mode,shift:l&&yt(l,"size").value,width:o.value,height:c.value}},htmlBuilder(e,t){var n=de.makeSpan(["mord","rule"],[],t),a=Mn(e.width,t),l=Mn(e.height,t),o=e.shift?Mn(e.shift,t):0;return n.style.borderRightWidth=Le(a),n.style.borderTopWidth=Le(l),n.style.bottom=Le(o),n.width=a,n.height=l+o,n.depth=-o,n.maxFontSize=l*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=Mn(e.width,t),a=Mn(e.height,t),l=e.shift?Mn(e.shift,t):0,o=t.color&&t.getColor()||"black",c=new Me.MathNode("mspace");c.setAttribute("mathbackground",o),c.setAttribute("width",Le(n)),c.setAttribute("height",Le(a));var d=new Me.MathNode("mpadded",[c]);return l>=0?d.setAttribute("height",Le(l)):(d.setAttribute("height",Le(l)),d.setAttribute("depth",Le(-l))),d.setAttribute("voffset",Le(l)),d}});function J8(e,t,n){for(var a=nr(e,t,!1),l=t.sizeMultiplier/n.sizeMultiplier,o=0;o{var n=t.havingSize(e.size);return J8(e.body,n,t)};Be({type:"sizing",names:Q3,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:n,funcName:a,parser:l}=e,o=l.parseExpression(!1,n);return{type:"sizing",mode:l.mode,size:Q3.indexOf(a)+1,body:o}},htmlBuilder:Zq,mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),a=Qr(e.body,n),l=new Me.MathNode("mstyle",a);return l.setAttribute("mathsize",Le(n.sizeMultiplier)),l}});Be({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:a}=e,l=!1,o=!1,c=n[0]&&yt(n[0],"ordgroup");if(c)for(var d="",m=0;m{var n=de.makeSpan([],[Ft(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return n;if(e.smashHeight&&(n.height=0,n.children))for(var a=0;a{var n=new Me.MathNode("mpadded",[xn(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});Be({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:a}=e,l=n[0],o=t[0];return{type:"sqrt",mode:a.mode,body:o,index:l}},htmlBuilder(e,t){var n=Ft(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=de.wrapFragment(n,t);var a=t.fontMetrics(),l=a.defaultRuleThickness,o=l;t.style.idn.height+n.depth+c&&(c=(c+x-n.height-n.depth)/2);var y=m.height-n.height-c-f;n.style.paddingLeft=Le(p);var b=de.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+y)},{type:"elem",elem:m},{type:"kern",size:f}]},t);if(e.index){var N=t.havingStyle(tt.SCRIPTSCRIPT),k=Ft(e.index,N,t),S=.6*(b.height-b.depth),T=de.makeVList({positionType:"shift",positionData:-S,children:[{type:"elem",elem:k}]},t),M=de.makeSpan(["root"],[T]);return de.makeSpan(["mord","sqrt"],[M,b],t)}else return de.makeSpan(["mord","sqrt"],[b],t)},mathmlBuilder(e,t){var{body:n,index:a}=e;return a?new Me.MathNode("mroot",[xn(n,t),xn(a,t)]):new Me.MathNode("msqrt",[xn(n,t)])}});var Z3={display:tt.DISPLAY,text:tt.TEXT,script:tt.SCRIPT,scriptscript:tt.SCRIPTSCRIPT};Be({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:n,funcName:a,parser:l}=e,o=l.parseExpression(!0,n),c=a.slice(1,a.length-5);return{type:"styling",mode:l.mode,style:c,body:o}},htmlBuilder(e,t){var n=Z3[e.style],a=t.havingStyle(n).withFont("");return J8(e.body,a,t)},mathmlBuilder(e,t){var n=Z3[e.style],a=t.havingStyle(n),l=Qr(e.body,a),o=new Me.MathNode("mstyle",l),c={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},d=c[e.style];return o.setAttribute("scriptlevel",d[0]),o.setAttribute("displaystyle",d[1]),o}});var Jq=function(t,n){var a=t.base;if(a)if(a.type==="op"){var l=a.limits&&(n.style.size===tt.DISPLAY.size||a.alwaysHandleSupSub);return l?nc:null}else if(a.type==="operatorname"){var o=a.alwaysHandleSupSub&&(n.style.size===tt.DISPLAY.size||a.limits);return o?Z8:null}else{if(a.type==="accent")return Ut.isCharacterBox(a.base)?vg:null;if(a.type==="horizBrace"){var c=!t.sub;return c===a.isOver?X8:null}else return null}else return null};Ci({type:"supsub",htmlBuilder(e,t){var n=Jq(e,t);if(n)return n(e,t);var{base:a,sup:l,sub:o}=e,c=Ft(a,t),d,m,f=t.fontMetrics(),p=0,x=0,y=a&&Ut.isCharacterBox(a);if(l){var b=t.havingStyle(t.style.sup());d=Ft(l,b,t),y||(p=c.height-b.fontMetrics().supDrop*b.sizeMultiplier/t.sizeMultiplier)}if(o){var N=t.havingStyle(t.style.sub());m=Ft(o,N,t),y||(x=c.depth+N.fontMetrics().subDrop*N.sizeMultiplier/t.sizeMultiplier)}var k;t.style===tt.DISPLAY?k=f.sup1:t.style.cramped?k=f.sup3:k=f.sup2;var S=t.sizeMultiplier,T=Le(.5/f.ptPerEm/S),M=null;if(m){var A=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");(c instanceof Ea||A)&&(M=Le(-c.italic))}var R;if(d&&m){p=Math.max(p,k,d.depth+.25*f.xHeight),x=Math.max(x,f.sub2);var B=f.defaultRuleThickness,O=4*B;if(p-d.depth-(m.height-x)0&&(p+=L,x-=L)}var $=[{type:"elem",elem:m,shift:x,marginRight:T,marginLeft:M},{type:"elem",elem:d,shift:-p,marginRight:T}];R=de.makeVList({positionType:"individualShift",children:$},t)}else if(m){x=Math.max(x,f.sub1,m.height-.8*f.xHeight);var U=[{type:"elem",elem:m,marginLeft:M,marginRight:T}];R=de.makeVList({positionType:"shift",positionData:x,children:U},t)}else if(d)p=Math.max(p,k,d.depth+.25*f.xHeight),R=de.makeVList({positionType:"shift",positionData:-p,children:[{type:"elem",elem:d,marginRight:T}]},t);else throw new Error("supsub must have either sup or sub.");var I=Zx(c,"right")||"mord";return de.makeSpan([I],[c,de.makeSpan(["msupsub"],[R])],t)},mathmlBuilder(e,t){var n=!1,a,l;e.base&&e.base.type==="horizBrace"&&(l=!!e.sup,l===e.base.isOver&&(n=!0,a=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var o=[xn(e.base,t)];e.sub&&o.push(xn(e.sub,t)),e.sup&&o.push(xn(e.sup,t));var c;if(n)c=a?"mover":"munder";else if(e.sub)if(e.sup){var f=e.base;f&&f.type==="op"&&f.limits&&t.style===tt.DISPLAY||f&&f.type==="operatorname"&&f.alwaysHandleSupSub&&(t.style===tt.DISPLAY||f.limits)?c="munderover":c="msubsup"}else{var m=e.base;m&&m.type==="op"&&m.limits&&(t.style===tt.DISPLAY||m.alwaysHandleSupSub)||m&&m.type==="operatorname"&&m.alwaysHandleSupSub&&(m.limits||t.style===tt.DISPLAY)?c="munder":c="msub"}else{var d=e.base;d&&d.type==="op"&&d.limits&&(t.style===tt.DISPLAY||d.alwaysHandleSupSub)||d&&d.type==="operatorname"&&d.alwaysHandleSupSub&&(d.limits||t.style===tt.DISPLAY)?c="mover":c="msup"}return new Me.MathNode(c,o)}});Ci({type:"atom",htmlBuilder(e,t){return de.mathsym(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var n=new Me.MathNode("mo",[Ma(e.text,e.mode)]);if(e.family==="bin"){var a=xg(e,t);a==="bold-italic"&&n.setAttribute("mathvariant",a)}else e.family==="punct"?n.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&n.setAttribute("stretchy","false");return n}});var eN={mi:"italic",mn:"normal",mtext:"normal"};Ci({type:"mathord",htmlBuilder(e,t){return de.makeOrd(e,t,"mathord")},mathmlBuilder(e,t){var n=new Me.MathNode("mi",[Ma(e.text,e.mode,t)]),a=xg(e,t)||"italic";return a!==eN[n.type]&&n.setAttribute("mathvariant",a),n}});Ci({type:"textord",htmlBuilder(e,t){return de.makeOrd(e,t,"textord")},mathmlBuilder(e,t){var n=Ma(e.text,e.mode,t),a=xg(e,t)||"normal",l;return e.mode==="text"?l=new Me.MathNode("mtext",[n]):/[0-9]/.test(e.text)?l=new Me.MathNode("mn",[n]):e.text==="\\prime"?l=new Me.MathNode("mo",[n]):l=new Me.MathNode("mi",[n]),a!==eN[l.type]&&l.setAttribute("mathvariant",a),l}});var ux={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},dx={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Ci({type:"spacing",htmlBuilder(e,t){if(dx.hasOwnProperty(e.text)){var n=dx[e.text].className||"";if(e.mode==="text"){var a=de.makeOrd(e,t,"textord");return a.classes.push(n),a}else return de.makeSpan(["mspace",n],[de.mathsym(e.text,e.mode,t)],t)}else{if(ux.hasOwnProperty(e.text))return de.makeSpan(["mspace",ux[e.text]],[],t);throw new Ae('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var n;if(dx.hasOwnProperty(e.text))n=new Me.MathNode("mtext",[new Me.TextNode(" ")]);else{if(ux.hasOwnProperty(e.text))return new Me.MathNode("mspace");throw new Ae('Unknown type of space "'+e.text+'"')}return n}});var J3=()=>{var e=new Me.MathNode("mtd",[]);return e.setAttribute("width","50%"),e};Ci({type:"tag",mathmlBuilder(e,t){var n=new Me.MathNode("mtable",[new Me.MathNode("mtr",[J3(),new Me.MathNode("mtd",[Al(e.body,t)]),J3(),new Me.MathNode("mtd",[Al(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var e5={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},t5={"\\textbf":"textbf","\\textmd":"textmd"},eH={"\\textit":"textit","\\textup":"textup"},n5=(e,t)=>{var n=e.font;if(n){if(e5[n])return t.withTextFontFamily(e5[n]);if(t5[n])return t.withTextFontWeight(t5[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(eH[n])};Be({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:a}=e,l=t[0];return{type:"text",mode:n.mode,body:Pn(l),font:a}},htmlBuilder(e,t){var n=n5(e,t),a=nr(e.body,n,!0);return de.makeSpan(["mord","text"],a,n)},mathmlBuilder(e,t){var n=n5(e,t);return Al(e.body,n)}});Be({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"underline",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=Ft(e.body,t),a=de.makeLineSpan("underline-line",t),l=t.fontMetrics().defaultRuleThickness,o=de.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:l},{type:"elem",elem:a},{type:"kern",size:3*l},{type:"elem",elem:n}]},t);return de.makeSpan(["mord","underline"],[o],t)},mathmlBuilder(e,t){var n=new Me.MathNode("mo",[new Me.TextNode("‾")]);n.setAttribute("stretchy","true");var a=new Me.MathNode("munder",[xn(e.body,t),n]);return a.setAttribute("accentunder","true"),a}});Be({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"vcenter",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=Ft(e.body,t),a=t.fontMetrics().axisHeight,l=.5*(n.height-a-(n.depth+a));return de.makeVList({positionType:"shift",positionData:l,children:[{type:"elem",elem:n}]},t)},mathmlBuilder(e,t){return new Me.MathNode("mpadded",[xn(e.body,t)],["vcenter"])}});Be({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new Ae("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=r5(e),a=[],l=t.havingStyle(t.style.text()),o=0;oe.body.replace(/ /g,e.star?"␣":" "),jl=N8,tN=`[ \r - ]`,tH="\\\\[a-zA-Z@]+",nH="\\\\[^\uD800-\uDFFF]",rH="("+tH+")"+tN+"*",aH=`\\\\( -|[ \r ]+ -?)[ \r ]*`,n1="[̀-ͯ]",sH=new RegExp(n1+"+$"),lH="("+tN+"+)|"+(aH+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(n1+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(n1+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+rH)+("|"+nH+")");class a5{constructor(t,n){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=t,this.settings=n,this.tokenRegex=new RegExp(lH,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,n){this.catcodes[t]=n}lex(){var t=this.input,n=this.tokenRegex.lastIndex;if(n===t.length)return new da("EOF",new Ur(this,n,n));var a=this.tokenRegex.exec(t);if(a===null||a.index!==n)throw new Ae("Unexpected character: '"+t[n]+"'",new da(t[n],new Ur(this,n,n+1)));var l=a[6]||a[3]||(a[2]?"\\ ":" ");if(this.catcodes[l]===14){var o=t.indexOf(` -`,this.tokenRegex.lastIndex);return o===-1?(this.tokenRegex.lastIndex=t.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=o+1,this.lex()}return new da(l,new Ur(this,n,this.tokenRegex.lastIndex))}}class iH{constructor(t,n){t===void 0&&(t={}),n===void 0&&(n={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=n,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new Ae("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var t=this.undefStack.pop();for(var n in t)t.hasOwnProperty(n)&&(t[n]==null?delete this.current[n]:this.current[n]=t[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,n,a){if(a===void 0&&(a=!1),a){for(var l=0;l0&&(this.undefStack[this.undefStack.length-1][t]=n)}else{var o=this.undefStack[this.undefStack.length-1];o&&!o.hasOwnProperty(t)&&(o[t]=this.current[t])}n==null?delete this.current[t]:this.current[t]=n}}var oH=$8;F("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});F("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});F("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});F("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});F("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var n=e.future();return t[0].length===1&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});F("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");F("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var s5={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};F("\\char",function(e){var t=e.popToken(),n,a="";if(t.text==="'")n=8,t=e.popToken();else if(t.text==='"')n=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")a=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new Ae("\\char` missing argument");a=t.text.charCodeAt(0)}else n=10;if(n){if(a=s5[t.text],a==null||a>=n)throw new Ae("Invalid base-"+n+" digit "+t.text);for(var l;(l=s5[e.future().text])!=null&&l{var l=e.consumeArg().tokens;if(l.length!==1)throw new Ae("\\newcommand's first argument must be a macro name");var o=l[0].text,c=e.isDefined(o);if(c&&!t)throw new Ae("\\newcommand{"+o+"} attempting to redefine "+(o+"; use \\renewcommand"));if(!c&&!n)throw new Ae("\\renewcommand{"+o+"} when command "+o+" does not yet exist; use \\newcommand");var d=0;if(l=e.consumeArg().tokens,l.length===1&&l[0].text==="["){for(var m="",f=e.expandNextToken();f.text!=="]"&&f.text!=="EOF";)m+=f.text,f=e.expandNextToken();if(!m.match(/^\s*[0-9]+\s*$/))throw new Ae("Invalid number of arguments: "+m);d=parseInt(m),l=e.consumeArg().tokens}return c&&a||e.macros.set(o,{tokens:l,numArgs:d}),""};F("\\newcommand",e=>Cg(e,!1,!0,!1));F("\\renewcommand",e=>Cg(e,!0,!1,!1));F("\\providecommand",e=>Cg(e,!0,!0,!0));F("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(n=>n.text).join("")),""});F("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(n=>n.text).join("")),""});F("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),jl[n],yn.math[n],yn.text[n]),""});F("\\bgroup","{");F("\\egroup","}");F("~","\\nobreakspace");F("\\lq","`");F("\\rq","'");F("\\aa","\\r a");F("\\AA","\\r A");F("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");F("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");F("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");F("ℬ","\\mathscr{B}");F("ℰ","\\mathscr{E}");F("ℱ","\\mathscr{F}");F("ℋ","\\mathscr{H}");F("ℐ","\\mathscr{I}");F("ℒ","\\mathscr{L}");F("ℳ","\\mathscr{M}");F("ℛ","\\mathscr{R}");F("ℭ","\\mathfrak{C}");F("ℌ","\\mathfrak{H}");F("ℨ","\\mathfrak{Z}");F("\\Bbbk","\\Bbb{k}");F("·","\\cdotp");F("\\llap","\\mathllap{\\textrm{#1}}");F("\\rlap","\\mathrlap{\\textrm{#1}}");F("\\clap","\\mathclap{\\textrm{#1}}");F("\\mathstrut","\\vphantom{(}");F("\\underbar","\\underline{\\text{#1}}");F("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');F("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");F("\\ne","\\neq");F("≠","\\neq");F("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");F("∉","\\notin");F("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");F("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");F("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");F("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");F("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");F("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");F("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");F("⟂","\\perp");F("‼","\\mathclose{!\\mkern-0.8mu!}");F("∌","\\notni");F("⌜","\\ulcorner");F("⌝","\\urcorner");F("⌞","\\llcorner");F("⌟","\\lrcorner");F("©","\\copyright");F("®","\\textregistered");F("️","\\textregistered");F("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');F("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');F("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');F("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');F("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");F("⋮","\\vdots");F("\\varGamma","\\mathit{\\Gamma}");F("\\varDelta","\\mathit{\\Delta}");F("\\varTheta","\\mathit{\\Theta}");F("\\varLambda","\\mathit{\\Lambda}");F("\\varXi","\\mathit{\\Xi}");F("\\varPi","\\mathit{\\Pi}");F("\\varSigma","\\mathit{\\Sigma}");F("\\varUpsilon","\\mathit{\\Upsilon}");F("\\varPhi","\\mathit{\\Phi}");F("\\varPsi","\\mathit{\\Psi}");F("\\varOmega","\\mathit{\\Omega}");F("\\substack","\\begin{subarray}{c}#1\\end{subarray}");F("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");F("\\boxed","\\fbox{$\\displaystyle{#1}$}");F("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");F("\\implies","\\DOTSB\\;\\Longrightarrow\\;");F("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");F("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");F("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var l5={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};F("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in l5?t=l5[n]:(n.slice(0,4)==="\\not"||n in yn.math&&["bin","rel"].includes(yn.math[n].group))&&(t="\\dotsb"),t});var Tg={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};F("\\dotso",function(e){var t=e.future().text;return t in Tg?"\\ldots\\,":"\\ldots"});F("\\dotsc",function(e){var t=e.future().text;return t in Tg&&t!==","?"\\ldots\\,":"\\ldots"});F("\\cdots",function(e){var t=e.future().text;return t in Tg?"\\@cdots\\,":"\\@cdots"});F("\\dotsb","\\cdots");F("\\dotsm","\\cdots");F("\\dotsi","\\!\\cdots");F("\\dotsx","\\ldots\\,");F("\\DOTSI","\\relax");F("\\DOTSB","\\relax");F("\\DOTSX","\\relax");F("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");F("\\,","\\tmspace+{3mu}{.1667em}");F("\\thinspace","\\,");F("\\>","\\mskip{4mu}");F("\\:","\\tmspace+{4mu}{.2222em}");F("\\medspace","\\:");F("\\;","\\tmspace+{5mu}{.2777em}");F("\\thickspace","\\;");F("\\!","\\tmspace-{3mu}{.1667em}");F("\\negthinspace","\\!");F("\\negmedspace","\\tmspace-{4mu}{.2222em}");F("\\negthickspace","\\tmspace-{5mu}{.277em}");F("\\enspace","\\kern.5em ");F("\\enskip","\\hskip.5em\\relax");F("\\quad","\\hskip1em\\relax");F("\\qquad","\\hskip2em\\relax");F("\\tag","\\@ifstar\\tag@literal\\tag@paren");F("\\tag@paren","\\tag@literal{({#1})}");F("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new Ae("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});F("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");F("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");F("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");F("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");F("\\newline","\\\\\\relax");F("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var nN=Le(ts["Main-Regular"][84][1]-.7*ts["Main-Regular"][65][1]);F("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+nN+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");F("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+nN+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");F("\\hspace","\\@ifstar\\@hspacer\\@hspace");F("\\@hspace","\\hskip #1\\relax");F("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");F("\\ordinarycolon",":");F("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");F("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');F("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');F("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');F("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');F("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');F("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');F("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');F("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');F("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');F("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');F("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');F("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');F("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');F("∷","\\dblcolon");F("∹","\\eqcolon");F("≔","\\coloneqq");F("≕","\\eqqcolon");F("⩴","\\Coloneqq");F("\\ratio","\\vcentcolon");F("\\coloncolon","\\dblcolon");F("\\colonequals","\\coloneqq");F("\\coloncolonequals","\\Coloneqq");F("\\equalscolon","\\eqqcolon");F("\\equalscoloncolon","\\Eqqcolon");F("\\colonminus","\\coloneq");F("\\coloncolonminus","\\Coloneq");F("\\minuscolon","\\eqcolon");F("\\minuscoloncolon","\\Eqcolon");F("\\coloncolonapprox","\\Colonapprox");F("\\coloncolonsim","\\Colonsim");F("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");F("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");F("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");F("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");F("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");F("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");F("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");F("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");F("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");F("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");F("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");F("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");F("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");F("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");F("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");F("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");F("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");F("\\nleqq","\\html@mathml{\\@nleqq}{≰}");F("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");F("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");F("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");F("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");F("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");F("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");F("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");F("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");F("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");F("\\imath","\\html@mathml{\\@imath}{ı}");F("\\jmath","\\html@mathml{\\@jmath}{ȷ}");F("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");F("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");F("⟦","\\llbracket");F("⟧","\\rrbracket");F("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");F("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");F("⦃","\\lBrace");F("⦄","\\rBrace");F("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");F("⦵","\\minuso");F("\\darr","\\downarrow");F("\\dArr","\\Downarrow");F("\\Darr","\\Downarrow");F("\\lang","\\langle");F("\\rang","\\rangle");F("\\uarr","\\uparrow");F("\\uArr","\\Uparrow");F("\\Uarr","\\Uparrow");F("\\N","\\mathbb{N}");F("\\R","\\mathbb{R}");F("\\Z","\\mathbb{Z}");F("\\alef","\\aleph");F("\\alefsym","\\aleph");F("\\Alpha","\\mathrm{A}");F("\\Beta","\\mathrm{B}");F("\\bull","\\bullet");F("\\Chi","\\mathrm{X}");F("\\clubs","\\clubsuit");F("\\cnums","\\mathbb{C}");F("\\Complex","\\mathbb{C}");F("\\Dagger","\\ddagger");F("\\diamonds","\\diamondsuit");F("\\empty","\\emptyset");F("\\Epsilon","\\mathrm{E}");F("\\Eta","\\mathrm{H}");F("\\exist","\\exists");F("\\harr","\\leftrightarrow");F("\\hArr","\\Leftrightarrow");F("\\Harr","\\Leftrightarrow");F("\\hearts","\\heartsuit");F("\\image","\\Im");F("\\infin","\\infty");F("\\Iota","\\mathrm{I}");F("\\isin","\\in");F("\\Kappa","\\mathrm{K}");F("\\larr","\\leftarrow");F("\\lArr","\\Leftarrow");F("\\Larr","\\Leftarrow");F("\\lrarr","\\leftrightarrow");F("\\lrArr","\\Leftrightarrow");F("\\Lrarr","\\Leftrightarrow");F("\\Mu","\\mathrm{M}");F("\\natnums","\\mathbb{N}");F("\\Nu","\\mathrm{N}");F("\\Omicron","\\mathrm{O}");F("\\plusmn","\\pm");F("\\rarr","\\rightarrow");F("\\rArr","\\Rightarrow");F("\\Rarr","\\Rightarrow");F("\\real","\\Re");F("\\reals","\\mathbb{R}");F("\\Reals","\\mathbb{R}");F("\\Rho","\\mathrm{P}");F("\\sdot","\\cdot");F("\\sect","\\S");F("\\spades","\\spadesuit");F("\\sub","\\subset");F("\\sube","\\subseteq");F("\\supe","\\supseteq");F("\\Tau","\\mathrm{T}");F("\\thetasym","\\vartheta");F("\\weierp","\\wp");F("\\Zeta","\\mathrm{Z}");F("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");F("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");F("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");F("\\bra","\\mathinner{\\langle{#1}|}");F("\\ket","\\mathinner{|{#1}\\rangle}");F("\\braket","\\mathinner{\\langle{#1}\\rangle}");F("\\Bra","\\left\\langle#1\\right|");F("\\Ket","\\left|#1\\right\\rangle");var rN=e=>t=>{var n=t.consumeArg().tokens,a=t.consumeArg().tokens,l=t.consumeArg().tokens,o=t.consumeArg().tokens,c=t.macros.get("|"),d=t.macros.get("\\|");t.macros.beginGroup();var m=x=>y=>{e&&(y.macros.set("|",c),l.length&&y.macros.set("\\|",d));var b=x;if(!x&&l.length){var N=y.future();N.text==="|"&&(y.popToken(),b=!0)}return{tokens:b?l:a,numArgs:0}};t.macros.set("|",m(!1)),l.length&&t.macros.set("\\|",m(!0));var f=t.consumeArg().tokens,p=t.expandTokens([...o,...f,...n]);return t.macros.endGroup(),{tokens:p.reverse(),numArgs:0}};F("\\bra@ket",rN(!1));F("\\bra@set",rN(!0));F("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");F("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");F("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");F("\\angln","{\\angl n}");F("\\blue","\\textcolor{##6495ed}{#1}");F("\\orange","\\textcolor{##ffa500}{#1}");F("\\pink","\\textcolor{##ff00af}{#1}");F("\\red","\\textcolor{##df0030}{#1}");F("\\green","\\textcolor{##28ae7b}{#1}");F("\\gray","\\textcolor{gray}{#1}");F("\\purple","\\textcolor{##9d38bd}{#1}");F("\\blueA","\\textcolor{##ccfaff}{#1}");F("\\blueB","\\textcolor{##80f6ff}{#1}");F("\\blueC","\\textcolor{##63d9ea}{#1}");F("\\blueD","\\textcolor{##11accd}{#1}");F("\\blueE","\\textcolor{##0c7f99}{#1}");F("\\tealA","\\textcolor{##94fff5}{#1}");F("\\tealB","\\textcolor{##26edd5}{#1}");F("\\tealC","\\textcolor{##01d1c1}{#1}");F("\\tealD","\\textcolor{##01a995}{#1}");F("\\tealE","\\textcolor{##208170}{#1}");F("\\greenA","\\textcolor{##b6ffb0}{#1}");F("\\greenB","\\textcolor{##8af281}{#1}");F("\\greenC","\\textcolor{##74cf70}{#1}");F("\\greenD","\\textcolor{##1fab54}{#1}");F("\\greenE","\\textcolor{##0d923f}{#1}");F("\\goldA","\\textcolor{##ffd0a9}{#1}");F("\\goldB","\\textcolor{##ffbb71}{#1}");F("\\goldC","\\textcolor{##ff9c39}{#1}");F("\\goldD","\\textcolor{##e07d10}{#1}");F("\\goldE","\\textcolor{##a75a05}{#1}");F("\\redA","\\textcolor{##fca9a9}{#1}");F("\\redB","\\textcolor{##ff8482}{#1}");F("\\redC","\\textcolor{##f9685d}{#1}");F("\\redD","\\textcolor{##e84d39}{#1}");F("\\redE","\\textcolor{##bc2612}{#1}");F("\\maroonA","\\textcolor{##ffbde0}{#1}");F("\\maroonB","\\textcolor{##ff92c6}{#1}");F("\\maroonC","\\textcolor{##ed5fa6}{#1}");F("\\maroonD","\\textcolor{##ca337c}{#1}");F("\\maroonE","\\textcolor{##9e034e}{#1}");F("\\purpleA","\\textcolor{##ddd7ff}{#1}");F("\\purpleB","\\textcolor{##c6b9fc}{#1}");F("\\purpleC","\\textcolor{##aa87ff}{#1}");F("\\purpleD","\\textcolor{##7854ab}{#1}");F("\\purpleE","\\textcolor{##543b78}{#1}");F("\\mintA","\\textcolor{##f5f9e8}{#1}");F("\\mintB","\\textcolor{##edf2df}{#1}");F("\\mintC","\\textcolor{##e0e5cc}{#1}");F("\\grayA","\\textcolor{##f6f7f7}{#1}");F("\\grayB","\\textcolor{##f0f1f2}{#1}");F("\\grayC","\\textcolor{##e3e5e6}{#1}");F("\\grayD","\\textcolor{##d6d8da}{#1}");F("\\grayE","\\textcolor{##babec2}{#1}");F("\\grayF","\\textcolor{##888d93}{#1}");F("\\grayG","\\textcolor{##626569}{#1}");F("\\grayH","\\textcolor{##3b3e40}{#1}");F("\\grayI","\\textcolor{##21242c}{#1}");F("\\kaBlue","\\textcolor{##314453}{#1}");F("\\kaGreen","\\textcolor{##71B307}{#1}");var aN={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class cH{constructor(t,n,a){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(t),this.macros=new iH(oH,n.macros),this.mode=a,this.stack=[]}feed(t){this.lexer=new a5(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var n,a,l;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:l,end:a}=this.consumeArg(["]"])}else({tokens:l,start:n,end:a}=this.consumeArg());return this.pushToken(new da("EOF",a.loc)),this.pushTokens(l),new da("",Ur.range(n,a))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var n=[],a=t&&t.length>0;a||this.consumeSpaces();var l=this.future(),o,c=0,d=0;do{if(o=this.popToken(),n.push(o),o.text==="{")++c;else if(o.text==="}"){if(--c,c===-1)throw new Ae("Extra }",o)}else if(o.text==="EOF")throw new Ae("Unexpected end of input in a macro argument, expected '"+(t&&a?t[d]:"}")+"'",o);if(t&&a)if((c===0||c===1&&t[d]==="{")&&o.text===t[d]){if(++d,d===t.length){n.splice(-d,d);break}}else d=0}while(c!==0||a);return l.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:l,end:o}}consumeArgs(t,n){if(n){if(n.length!==t+1)throw new Ae("The length of delimiters doesn't match the number of args!");for(var a=n[0],l=0;lthis.settings.maxExpand)throw new Ae("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var n=this.popToken(),a=n.text,l=n.noexpand?null:this._getExpansion(a);if(l==null||t&&l.unexpandable){if(t&&l==null&&a[0]==="\\"&&!this.isDefined(a))throw new Ae("Undefined control sequence: "+a);return this.pushToken(n),!1}this.countExpansion(1);var o=l.tokens,c=this.consumeArgs(l.numArgs,l.delimiters);if(l.numArgs){o=o.slice();for(var d=o.length-1;d>=0;--d){var m=o[d];if(m.text==="#"){if(d===0)throw new Ae("Incomplete placeholder at end of macro body",m);if(m=o[--d],m.text==="#")o.splice(d+1,1);else if(/^[1-9]$/.test(m.text))o.splice(d,2,...c[+m.text-1]);else throw new Ae("Not a valid argument number",m)}}}return this.pushTokens(o),o.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}throw new Error}expandMacro(t){return this.macros.has(t)?this.expandTokens([new da(t)]):void 0}expandTokens(t){var n=[],a=this.stack.length;for(this.pushTokens(t);this.stack.length>a;)if(this.expandOnce(!0)===!1){var l=this.stack.pop();l.treatAsRelax&&(l.noexpand=!1,l.treatAsRelax=!1),n.push(l)}return this.countExpansion(n.length),n}expandMacroAsText(t){var n=this.expandMacro(t);return n&&n.map(a=>a.text).join("")}_getExpansion(t){var n=this.macros.get(t);if(n==null)return n;if(t.length===1){var a=this.lexer.catcodes[t];if(a!=null&&a!==13)return}var l=typeof n=="function"?n(this):n;if(typeof l=="string"){var o=0;if(l.indexOf("#")!==-1)for(var c=l.replace(/##/g,"");c.indexOf("#"+(o+1))!==-1;)++o;for(var d=new a5(l,this.settings),m=[],f=d.lex();f.text!=="EOF";)m.push(f),f=d.lex();m.reverse();var p={tokens:m,numArgs:o};return p}return l}isDefined(t){return this.macros.has(t)||jl.hasOwnProperty(t)||yn.math.hasOwnProperty(t)||yn.text.hasOwnProperty(t)||aN.hasOwnProperty(t)}isExpandable(t){var n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:jl.hasOwnProperty(t)&&!jl[t].primitive}}var i5=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,B0=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),mx={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},o5={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Jm{constructor(t,n){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new cH(t,n,this.mode),this.settings=n,this.leftrightDepth=0}expect(t,n){if(n===void 0&&(n=!0),this.fetch().text!==t)throw new Ae("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t}finally{this.gullet.endGroups()}}subparse(t){var n=this.nextToken;this.consume(),this.gullet.pushToken(new da("}")),this.gullet.pushTokens(t);var a=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,a}parseExpression(t,n){for(var a=[];;){this.mode==="math"&&this.consumeSpaces();var l=this.fetch();if(Jm.endOfExpression.indexOf(l.text)!==-1||n&&l.text===n||t&&jl[l.text]&&jl[l.text].infix)break;var o=this.parseAtom(n);if(o){if(o.type==="internal")continue}else break;a.push(o)}return this.mode==="text"&&this.formLigatures(a),this.handleInfixNodes(a)}handleInfixNodes(t){for(var n=-1,a,l=0;l=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',t);var d=yn[this.mode][n].group,m=Ur.range(t),f;if(QI.hasOwnProperty(d)){var p=d;f={type:"atom",mode:this.mode,family:p,loc:m,text:n}}else f={type:d,mode:this.mode,loc:m,text:n};c=f}else if(n.charCodeAt(0)>=128)this.settings.strict&&(h8(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),t)),c={type:"textord",mode:"text",loc:Ur.range(t),text:n};else return null;if(this.consume(),o)for(var x=0;xf&&(f=p):p&&(f!==void 0&&f>-1&&m.push(` -`.repeat(f)||" "),f=-1,m.push(p))}return m.join("")}function dN(e,t,n){return e.type==="element"?IH(e,t,n):e.type==="text"?n.whitespace==="normal"?mN(e,n):qH(e):[]}function IH(e,t,n){const a=hN(e,n),l=e.children||[];let o=-1,c=[];if(PH(e))return c;let d,m;for(a1(e)||g5(e)&&h5(t,e,g5)?m=` -`:BH(e)?(d=2,m=2):uN(e)&&(d=1,m=1);++o{try{o(!0);const je=await QH({page:c,page_size:p,search:y||void 0,is_registered:N==="all"?void 0:N==="registered",is_banned:S==="all"?void 0:S==="banned",format:M==="all"?void 0:M,sort_by:"usage_count",sort_order:"desc"});t(je.data),f(je.total)}catch(je){const Ze=je instanceof Error?je.message:"加载表情包列表失败";re({title:"错误",description:Ze,variant:"destructive"})}finally{o(!1)}},[c,p,y,N,S,M,re]),E=async()=>{try{const je=await tU();a(je.data)}catch(je){console.error("加载统计数据失败:",je)}};w.useEffect(()=>{ge()},[ge]),w.useEffect(()=>{E()},[]);const we=async je=>{try{const Ze=await ZH(je.id);B(Ze.data),L(!0)}catch(Ze){const qe=Ze instanceof Error?Ze.message:"加载详情失败";re({title:"错误",description:qe,variant:"destructive"})}},Z=je=>{B(je),U(!0)},z=je=>{B(je),G(!0)},X=async()=>{if(R)try{await eU(R.id),re({title:"成功",description:"表情包已删除"}),G(!1),B(null),ge(),E()}catch(je){const Ze=je instanceof Error?je.message:"删除失败";re({title:"错误",description:Ze,variant:"destructive"})}},q=async je=>{try{await nU(je.id),re({title:"成功",description:"表情包已注册"}),ge(),E()}catch(Ze){const qe=Ze instanceof Error?Ze.message:"注册失败";re({title:"错误",description:qe,variant:"destructive"})}},ce=async je=>{try{await rU(je.id),re({title:"成功",description:"表情包已封禁"}),ge(),E()}catch(Ze){const qe=Ze instanceof Error?Ze.message:"封禁失败";re({title:"错误",description:qe,variant:"destructive"})}},fe=je=>{const Ze=new Set(ee);Ze.has(je)?Ze.delete(je):Ze.add(je),Ne(Ze)},De=()=>{ee.size===e.length&&e.length>0?Ne(new Set):Ne(new Set(e.map(je=>je.id)))},oe=async()=>{try{const je=await aU(Array.from(ee));re({title:"批量删除完成",description:je.message}),Ne(new Set),se(!1),ge(),E()}catch(je){re({title:"批量删除失败",description:je instanceof Error?je.message:"批量删除失败",variant:"destructive"})}},He=()=>{const je=parseInt(H),Ze=Math.ceil(m/p);je>=1&&je<=Ze?(d(je),le("")):re({title:"无效的页码",description:`请输入1-${Ze}之间的页码`,variant:"destructive"})},at=n?.formats?Object.keys(n.formats):[];return r.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[r.jsxs("div",{className:"mb-4 sm:mb-6",children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),r.jsx(an,{className:"flex-1",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&r.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[r.jsx(ct,{children:r.jsxs(Lt,{className:"pb-2",children:[r.jsx(Qn,{children:"总数"}),r.jsx(Bt,{className:"text-2xl",children:n.total})]})}),r.jsx(ct,{children:r.jsxs(Lt,{className:"pb-2",children:[r.jsx(Qn,{children:"已注册"}),r.jsx(Bt,{className:"text-2xl text-green-600",children:n.registered})]})}),r.jsx(ct,{children:r.jsxs(Lt,{className:"pb-2",children:[r.jsx(Qn,{children:"已封禁"}),r.jsx(Bt,{className:"text-2xl text-red-600",children:n.banned})]})}),r.jsx(ct,{children:r.jsxs(Lt,{className:"pb-2",children:[r.jsx(Qn,{children:"未注册"}),r.jsx(Bt,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),r.jsxs(ct,{children:[r.jsx(Lt,{children:r.jsxs(Bt,{className:"flex items-center gap-2",children:[r.jsx(Sx,{className:"h-5 w-5"}),"搜索和筛选"]})}),r.jsxs(Gt,{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{children:"搜索"}),r.jsxs("div",{className:"relative",children:[r.jsx(Yr,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{placeholder:"描述或哈希值...",value:y,onChange:je=>{b(je.target.value),d(1)},className:"pl-8"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{children:"注册状态"}),r.jsxs(_t,{value:N,onValueChange:je=>{k(je),d(1)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"all",children:"全部"}),r.jsx(Oe,{value:"registered",children:"已注册"}),r.jsx(Oe,{value:"unregistered",children:"未注册"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{children:"封禁状态"}),r.jsxs(_t,{value:S,onValueChange:je=>{T(je),d(1)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"all",children:"全部"}),r.jsx(Oe,{value:"banned",children:"已封禁"}),r.jsx(Oe,{value:"unbanned",children:"未封禁"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{children:"格式"}),r.jsxs(_t,{value:M,onValueChange:je=>{A(je),d(1)},children:[r.jsx(jt,{children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"all",children:"全部"}),at.map(je=>r.jsxs(Oe,{value:je,children:[je.toUpperCase()," (",n?.formats[je],")"]},je))]})]})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[r.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:ee.size>0&&r.jsxs("span",{children:["已选择 ",ee.size," 个表情包"]})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),r.jsxs(_t,{value:p.toString(),onValueChange:je=>{x(parseInt(je)),d(1),Ne(new Set)},children:[r.jsx(jt,{id:"emoji-page-size",className:"w-20",children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"10",children:"10"}),r.jsx(Oe,{value:"20",children:"20"}),r.jsx(Oe,{value:"50",children:"50"}),r.jsx(Oe,{value:"100",children:"100"})]})]}),ee.size>0&&r.jsxs(r.Fragment,{children:[r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>Ne(new Set),children:"取消选择"}),r.jsxs(ne,{variant:"destructive",size:"sm",onClick:()=>se(!0),children:[r.jsx(zt,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),r.jsx("div",{className:"flex justify-end pt-4 border-t",children:r.jsxs(ne,{variant:"outline",size:"sm",onClick:ge,disabled:l,children:[r.jsx(Ia,{className:`h-4 w-4 mr-2 ${l?"animate-spin":""}`}),"刷新"]})})]})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"表情包列表"}),r.jsxs(Qn,{children:["共 ",m," 个表情包,当前第 ",c," 页"]})]}),r.jsxs(Gt,{children:[r.jsx("div",{className:"hidden md:block rounded-md border overflow-hidden",children:r.jsxs(ji,{children:[r.jsx(Ni,{children:r.jsxs(Vn,{children:[r.jsx(ut,{className:"w-12",children:r.jsx(jr,{checked:e.length>0&&ee.size===e.length,onCheckedChange:De,"aria-label":"全选"})}),r.jsx(ut,{className:"w-16",children:"预览"}),r.jsx(ut,{children:"描述"}),r.jsx(ut,{children:"格式"}),r.jsx(ut,{children:"情绪标签"}),r.jsx(ut,{className:"text-center",children:"状态"}),r.jsx(ut,{className:"text-right",children:"使用次数"}),r.jsx(ut,{className:"text-right",children:"操作"})]})}),r.jsx(Si,{children:e.length===0?r.jsx(Vn,{children:r.jsx(et,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):e.map(je=>r.jsxs(Vn,{children:[r.jsx(et,{children:r.jsx(jr,{checked:ee.has(je.id),onCheckedChange:()=>fe(je.id),"aria-label":`选择 ${je.description}`})}),r.jsx(et,{children:r.jsx("div",{className:"w-20 h-20 bg-muted rounded flex items-center justify-center overflow-hidden",children:r.jsx("img",{src:s1(je.id),alt:je.description||"表情包",className:"w-full h-full object-cover",onError:Ze=>{const qe=Ze.target;qe.style.display="none";const Ot=qe.parentElement;Ot&&(Ot.innerHTML='')}})})}),r.jsx(et,{children:r.jsxs("div",{className:"space-y-1 max-w-xs",children:[r.jsx("div",{className:"font-medium truncate",title:je.description||"无描述",children:je.description||"无描述"}),r.jsxs("div",{className:"text-xs text-muted-foreground font-mono",children:[je.emoji_hash.slice(0,16),"..."]})]})}),r.jsx(et,{children:r.jsx(un,{variant:"outline",children:je.format.toUpperCase()})}),r.jsx(et,{children:r.jsx(v5,{emotions:je.emotion})}),r.jsx(et,{className:"align-middle",children:r.jsxs("div",{className:"flex gap-2 justify-center",children:[je.is_registered&&r.jsxs(un,{variant:"default",className:"bg-green-600",children:[r.jsx($r,{className:"h-3 w-3 mr-1"}),"已注册"]}),je.is_banned&&r.jsxs(un,{variant:"destructive",children:[r.jsx(bx,{className:"h-3 w-3 mr-1"}),"已封禁"]})]})}),r.jsx(et,{className:"text-right font-mono",children:je.usage_count}),r.jsx(et,{children:r.jsxs("div",{className:"flex items-center justify-end gap-1 flex-wrap",children:[r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>we(je),children:[r.jsx(pi,{className:"h-4 w-4 mr-1"}),"详情"]}),r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>Z(je),children:[r.jsx(Po,{className:"h-4 w-4 mr-1"}),"编辑"]}),!je.is_registered&&r.jsxs(ne,{size:"sm",onClick:()=>q(je),className:"bg-green-600 hover:bg-green-700 text-white",children:[r.jsx($r,{className:"h-4 w-4 mr-1"}),"注册"]}),!je.is_banned&&r.jsxs(ne,{size:"sm",onClick:()=>ce(je),className:"bg-orange-600 hover:bg-orange-700 text-white",children:[r.jsx(Gy,{className:"h-4 w-4 mr-1"}),"封禁"]}),r.jsxs(ne,{size:"sm",onClick:()=>z(je),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(zt,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},je.id))})]})}),r.jsx("div",{className:"md:hidden space-y-3",children:e.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):e.map(je=>r.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("div",{className:"w-16 h-16 bg-muted rounded flex items-center justify-center overflow-hidden",children:r.jsx("img",{src:s1(je.id),alt:je.description||"表情包",className:"w-full h-full object-cover",onError:Ze=>{const qe=Ze.target;qe.style.display="none";const Ot=qe.parentElement;Ot&&(Ot.innerHTML='')}})})}),r.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[r.jsxs("div",{className:"min-w-0 w-full overflow-hidden",children:[r.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",title:je.description||"无描述",children:je.description||"无描述"}),r.jsxs("p",{className:"text-xs text-muted-foreground font-mono line-clamp-1 w-full break-all",children:[je.emoji_hash.slice(0,16),"..."]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 items-center min-w-0",children:[r.jsx(un,{variant:"outline",className:"text-xs flex-shrink-0",children:je.format.toUpperCase()}),je.is_registered&&r.jsxs(un,{variant:"default",className:"bg-green-600 text-xs flex-shrink-0",children:[r.jsx($r,{className:"h-3 w-3 mr-1"}),"已注册"]}),je.is_banned&&r.jsxs(un,{variant:"destructive",className:"text-xs flex-shrink-0",children:[r.jsx(bx,{className:"h-3 w-3 mr-1"}),"已封禁"]}),r.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:["使用: ",je.usage_count]})]}),je.emotion&&je.emotion.length>0&&r.jsx("div",{className:"min-w-0 overflow-hidden",children:r.jsx(v5,{emotions:je.emotion})})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>we(je),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[r.jsx(pi,{className:"h-3 w-3 mr-1"}),"详情"]}),r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>Z(je),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[r.jsx(Po,{className:"h-3 w-3 mr-1"}),"编辑"]}),!je.is_registered&&r.jsxs(ne,{size:"sm",onClick:()=>q(je),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-green-600 hover:bg-green-700 text-white",children:[r.jsx($r,{className:"h-3 w-3 mr-1"}),"注册"]}),!je.is_banned&&r.jsxs(ne,{size:"sm",onClick:()=>ce(je),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-orange-600 hover:bg-orange-700 text-white",children:[r.jsx(Gy,{className:"h-3 w-3 mr-1"}),"封禁"]}),r.jsxs(ne,{size:"sm",onClick:()=>z(je),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(zt,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},je.id))}),m>0&&r.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(c-1)*p+1," 到"," ",Math.min(c*p,m)," 条,共 ",m," 条"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>d(1),disabled:c===1,className:"hidden sm:flex",children:r.jsx(Du,{className:"h-4 w-4"})}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>d(je=>Math.max(1,je-1)),disabled:c===1,children:[r.jsx(bi,{className:"h-4 w-4 sm:mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te,{type:"number",value:H,onChange:je=>le(je.target.value),onKeyDown:je=>je.key==="Enter"&&He(),placeholder:c.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(m/p)}),r.jsx(ne,{variant:"outline",size:"sm",onClick:He,disabled:!H,className:"h-8",children:"跳转"})]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>d(je=>je+1),disabled:c>=Math.ceil(m/p),children:[r.jsx("span",{className:"hidden sm:inline",children:"下一页"}),r.jsx(wi,{className:"h-4 w-4 sm:ml-1"})]}),r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>d(Math.ceil(m/p)),disabled:c>=Math.ceil(m/p),className:"hidden sm:flex",children:r.jsx(zu,{className:"h-4 w-4"})})]})]})]})]}),r.jsx(lU,{emoji:R,open:O,onOpenChange:L}),r.jsx(iU,{emoji:R,open:$,onOpenChange:U,onSuccess:()=>{ge(),E()}})]})}),r.jsx(en,{open:J,onOpenChange:se,children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认批量删除"}),r.jsxs(Qt,{children:["你确定要删除选中的 ",ee.size," 个表情包吗?此操作不可撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:oe,children:"确认删除"})]})]})}),r.jsx(ir,{open:I,onOpenChange:G,children:r.jsxs(Jn,{children:[r.jsxs(er,{children:[r.jsx(tr,{children:"确认删除"}),r.jsx(xr,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>G(!1),children:"取消"}),r.jsx(ne,{variant:"destructive",onClick:X,children:"删除"})]})]})})]})}function lU({emoji:e,open:t,onOpenChange:n}){if(!e)return null;const a=l=>l?new Date(l*1e3).toLocaleString("zh-CN"):"-";return r.jsx(ir,{open:t,onOpenChange:n,children:r.jsxs(Jn,{className:"max-w-2xl max-h-[90vh]",children:[r.jsx(er,{children:r.jsx(tr,{children:"表情包详情"})}),r.jsx(an,{className:"max-h-[calc(90vh-8rem)] pr-4",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex justify-center",children:r.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:r.jsx("img",{src:s1(e.id),alt:e.description||"表情包",className:"w-full h-full object-cover",onError:l=>{const o=l.target;o.style.display="none";const c=o.parentElement;c&&(c.innerHTML='')}})})}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"ID"}),r.jsx("div",{className:"mt-1 font-mono",children:e.id})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"格式"}),r.jsx("div",{className:"mt-1",children:r.jsx(un,{variant:"outline",children:e.format.toUpperCase()})})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"文件路径"}),r.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:e.full_path})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"哈希值"}),r.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:e.emoji_hash})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"描述"}),e.description?r.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:r.jsx(KH,{className:"prose-sm",children:e.description})}):r.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"情绪标签"}),r.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:(()=>{const l=e.emotion?e.emotion.split(/[,,]/).map(o=>o.trim()).filter(Boolean):[];return l.length>0?l.map((o,c)=>r.jsx(un,{variant:"secondary",children:o},c)):r.jsx("span",{className:"text-sm text-muted-foreground",children:"无"})})()})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"状态"}),r.jsxs("div",{className:"mt-2 flex gap-2",children:[e.is_registered&&r.jsx(un,{variant:"default",className:"bg-green-600",children:"已注册"}),e.is_banned&&r.jsx(un,{variant:"destructive",children:"已封禁"}),!e.is_registered&&!e.is_banned&&r.jsx(un,{variant:"outline",children:"未注册"})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"使用次数"}),r.jsx("div",{className:"mt-1 font-mono text-lg",children:e.usage_count})]})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"记录时间"}),r.jsx("div",{className:"mt-1 text-sm",children:a(e.record_time)})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"注册时间"}),r.jsx("div",{className:"mt-1 text-sm",children:a(e.register_time)})]})]}),r.jsxs("div",{children:[r.jsx(Q,{className:"text-muted-foreground",children:"最后使用"}),r.jsx("div",{className:"mt-1 text-sm",children:a(e.last_used_time)})]})]})})]})})}function iU({emoji:e,open:t,onOpenChange:n,onSuccess:a}){const[l,o]=w.useState(""),[c,d]=w.useState(""),[m,f]=w.useState(!1),[p,x]=w.useState(!1),[y,b]=w.useState(!1),{toast:N}=or();w.useEffect(()=>{e&&(o(e.description||""),d(e.emotion||""),f(e.is_registered),x(e.is_banned))},[e]);const k=async()=>{if(e)try{b(!0);const S=c.split(/[,,]/).map(T=>T.trim()).filter(Boolean).join(",");await JH(e.id,{description:l||void 0,emotion:S||void 0,is_registered:m,is_banned:p}),N({title:"成功",description:"表情包信息已更新"}),n(!1),a()}catch(S){const T=S instanceof Error?S.message:"保存失败";N({title:"错误",description:T,variant:"destructive"})}finally{b(!1)}};return e?r.jsx(ir,{open:t,onOpenChange:n,children:r.jsxs(Jn,{className:"max-w-2xl",children:[r.jsxs(er,{children:[r.jsx(tr,{children:"编辑表情包"}),r.jsx(xr,{children:"修改表情包的描述和标签信息"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Q,{children:"描述"}),r.jsx(fn,{value:l,onChange:S=>o(S.target.value),placeholder:"输入表情包描述...",rows:3,className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx(Q,{children:"情绪标签"}),r.jsx(Te,{value:c,onChange:S=>d(S.target.value),placeholder:"使用逗号分隔多个标签,如:开心, 微笑, 快乐",className:"mt-1"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入多个标签时使用逗号分隔(支持中英文逗号)"})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(jr,{id:"is_registered",checked:m,onCheckedChange:S=>f(S===!0)}),r.jsx(Q,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(jr,{id:"is_banned",checked:p,onCheckedChange:S=>x(S===!0)}),r.jsx(Q,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>n(!1),children:"取消"}),r.jsx(ne,{onClick:k,disabled:y,children:y?"保存中...":"保存"})]})]})}):null}function v5({emotions:e}){const t=e?e.split(/[,,]/).map(o=>o.trim()).filter(Boolean):[];if(t.length===0)return r.jsx("span",{className:"text-xs text-muted-foreground",children:"-"});const n=(o,c=6)=>o.length<=c?o:o.slice(0,c)+"...",a=t.slice(0,3),l=t.length-3;return r.jsxs("div",{className:"flex flex-wrap gap-1 max-w-full overflow-hidden",children:[a.map((o,c)=>r.jsx(un,{variant:"secondary",className:"text-xs flex-shrink-0",title:o,children:n(o)},c)),l>0&&r.jsxs(un,{variant:"outline",className:"text-xs flex-shrink-0",title:`还有 ${l} 个标签: ${t.slice(3).join(", ")}`,children:["+",l]})]})}const _i="/api/webui/expression";async function oU(e){const t=new URLSearchParams;e.page&&t.append("page",e.page.toString()),e.page_size&&t.append("page_size",e.page_size.toString()),e.search&&t.append("search",e.search),e.chat_id&&t.append("chat_id",e.chat_id);const n=await lt(`${_i}/list?${t}`,{headers:pt()});if(!n.ok){const a=await n.json();throw new Error(a.detail||"获取表达方式列表失败")}return n.json()}async function cU(e){const t=await lt(`${_i}/${e}`,{headers:pt()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"获取表达方式详情失败")}return t.json()}async function uU(e){const t=await lt(`${_i}/`,{method:"POST",headers:pt(),body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.detail||"创建表达方式失败")}return t.json()}async function dU(e,t){const n=await lt(`${_i}/${e}`,{method:"PATCH",headers:pt(),body:JSON.stringify(t)});if(!n.ok){const a=await n.json();throw new Error(a.detail||"更新表达方式失败")}return n.json()}async function mU(e){const t=await lt(`${_i}/${e}`,{method:"DELETE",headers:pt()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"删除表达方式失败")}return t.json()}async function hU(e){const t=await lt(`${_i}/batch/delete`,{method:"POST",headers:pt(),body:JSON.stringify({ids:e})});if(!t.ok){const n=await t.json();throw new Error(n.detail||"批量删除表达方式失败")}return t.json()}async function fU(){const e=await lt(`${_i}/stats/summary`,{headers:pt()});if(!e.ok){const t=await e.json();throw new Error(t.detail||"获取统计数据失败")}return e.json()}function pU(){const[e,t]=w.useState([]),[n,a]=w.useState(!0),[l,o]=w.useState(0),[c,d]=w.useState(1),[m,f]=w.useState(20),[p,x]=w.useState(""),[y,b]=w.useState(null),[N,k]=w.useState(!1),[S,T]=w.useState(!1),[M,A]=w.useState(!1),[R,B]=w.useState(null),[O,L]=w.useState(new Set),[$,U]=w.useState(!1),[I,G]=w.useState(""),[ee,Ne]=w.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),{toast:J}=or(),se=async()=>{try{a(!0);const q=await oU({page:c,page_size:m,search:p||void 0});t(q.data),o(q.total)}catch(q){J({title:"加载失败",description:q instanceof Error?q.message:"无法加载表达方式",variant:"destructive"})}finally{a(!1)}},H=async()=>{try{const q=await fU();Ne(q.data)}catch(q){console.error("加载统计数据失败:",q)}};w.useEffect(()=>{se(),H()},[c,m,p]);const le=async q=>{try{const ce=await cU(q.id);b(ce.data),k(!0)}catch(ce){J({title:"加载详情失败",description:ce instanceof Error?ce.message:"无法加载表达方式详情",variant:"destructive"})}},re=q=>{b(q),T(!0)},ge=async q=>{try{await mU(q.id),J({title:"删除成功",description:`已删除表达方式: ${q.situation}`}),B(null),se(),H()}catch(ce){J({title:"删除失败",description:ce instanceof Error?ce.message:"无法删除表达方式",variant:"destructive"})}},E=q=>{const ce=new Set(O);ce.has(q)?ce.delete(q):ce.add(q),L(ce)},we=()=>{O.size===e.length&&e.length>0?L(new Set):L(new Set(e.map(q=>q.id)))},Z=async()=>{try{await hU(Array.from(O)),J({title:"批量删除成功",description:`已删除 ${O.size} 个表达方式`}),L(new Set),U(!1),se(),H()}catch(q){J({title:"批量删除失败",description:q instanceof Error?q.message:"无法批量删除表达方式",variant:"destructive"})}},z=()=>{const q=parseInt(I),ce=Math.ceil(l/m);q>=1&&q<=ce?(d(q),G("")):J({title:"无效的页码",description:`请输入1-${ce}之间的页码`,variant:"destructive"})},X=q=>q?new Date(q*1e3).toLocaleString("zh-CN"):"-";return r.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[r.jsx("div",{className:"mb-4 sm:mb-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[r.jsx(Mu,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),r.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),r.jsxs(ne,{onClick:()=>A(!0),className:"gap-2",children:[r.jsx(pr,{className:"h-4 w-4"}),"新增表达方式"]})]})}),r.jsx(an,{className:"flex-1",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),r.jsx("div",{className:"text-2xl font-bold mt-1",children:ee.total})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),r.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:ee.recent_7days})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),r.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:ee.chat_count})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx(Q,{htmlFor:"search",children:"搜索"}),r.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:r.jsxs("div",{className:"flex-1 relative",children:[r.jsx(Yr,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{id:"search",placeholder:"搜索情境、风格或上下文...",value:p,onChange:q=>x(q.target.value),className:"pl-9"})]})}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[r.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:O.size>0&&r.jsxs("span",{children:["已选择 ",O.size," 个表达方式"]})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),r.jsxs(_t,{value:m.toString(),onValueChange:q=>{f(parseInt(q)),d(1),L(new Set)},children:[r.jsx(jt,{id:"page-size",className:"w-20",children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"10",children:"10"}),r.jsx(Oe,{value:"20",children:"20"}),r.jsx(Oe,{value:"50",children:"50"}),r.jsx(Oe,{value:"100",children:"100"})]})]}),O.size>0&&r.jsxs(r.Fragment,{children:[r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>L(new Set),children:"取消选择"}),r.jsxs(ne,{variant:"destructive",size:"sm",onClick:()=>U(!0),children:[r.jsx(zt,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card",children:[r.jsx("div",{className:"hidden md:block",children:r.jsxs(ji,{children:[r.jsx(Ni,{children:r.jsxs(Vn,{children:[r.jsx(ut,{className:"w-12",children:r.jsx(jr,{checked:O.size===e.length&&e.length>0,onCheckedChange:we})}),r.jsx(ut,{children:"情境"}),r.jsx(ut,{children:"风格"}),r.jsx(ut,{children:"聊天ID"}),r.jsx(ut,{children:"最后活跃"}),r.jsx(ut,{className:"text-right",children:"操作"})]})}),r.jsx(Si,{children:n?r.jsx(Vn,{children:r.jsx(et,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):e.length===0?r.jsx(Vn,{children:r.jsx(et,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):e.map(q=>r.jsxs(Vn,{children:[r.jsx(et,{children:r.jsx(jr,{checked:O.has(q.id),onCheckedChange:()=>E(q.id)})}),r.jsx(et,{className:"font-medium max-w-xs truncate",children:q.situation}),r.jsx(et,{className:"max-w-xs truncate",children:q.style}),r.jsx(et,{className:"font-mono text-sm",children:q.chat_id}),r.jsx(et,{className:"text-sm text-muted-foreground",children:X(q.last_active_time)}),r.jsx(et,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>le(q),children:[r.jsx(Ha,{className:"h-4 w-4 mr-1"}),"详情"]}),r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>re(q),children:[r.jsx(Po,{className:"h-4 w-4 mr-1"}),"编辑"]}),r.jsxs(ne,{size:"sm",onClick:()=>B(q),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(zt,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},q.id))})]})}),r.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):e.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):e.map(q=>r.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(jr,{checked:O.has(q.id),onCheckedChange:()=>E(q.id),className:"mt-1"}),r.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),r.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:q.situation,children:q.situation})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),r.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:q.style,children:q.style})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天ID"}),r.jsx("p",{className:"font-mono text-xs truncate",children:q.chat_id})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后活跃"}),r.jsx("p",{className:"text-xs",children:X(q.last_active_time)})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>le(q),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[r.jsx(Ha,{className:"h-3 w-3 mr-1"}),"查看"]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>re(q),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[r.jsx(Po,{className:"h-3 w-3 mr-1"}),"编辑"]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>B(q),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[r.jsx(zt,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},q.id))}),l>0&&r.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",l," 条记录,第 ",c," / ",Math.ceil(l/m)," 页"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>d(1),disabled:c===1,className:"hidden sm:flex",children:r.jsx(Du,{className:"h-4 w-4"})}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>d(c-1),disabled:c===1,children:[r.jsx(bi,{className:"h-4 w-4 sm:mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te,{type:"number",value:I,onChange:q=>G(q.target.value),onKeyDown:q=>q.key==="Enter"&&z(),placeholder:c.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(l/m)}),r.jsx(ne,{variant:"outline",size:"sm",onClick:z,disabled:!I,className:"h-8",children:"跳转"})]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>d(c+1),disabled:c>=Math.ceil(l/m),children:[r.jsx("span",{className:"hidden sm:inline",children:"下一页"}),r.jsx(wi,{className:"h-4 w-4 sm:ml-1"})]}),r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>d(Math.ceil(l/m)),disabled:c>=Math.ceil(l/m),className:"hidden sm:flex",children:r.jsx(zu,{className:"h-4 w-4"})})]})]})]})]})}),r.jsx(xU,{expression:y,open:N,onOpenChange:k}),r.jsx(gU,{open:M,onOpenChange:A,onSuccess:()=>{se(),H(),A(!1)}}),r.jsx(vU,{expression:y,open:S,onOpenChange:T,onSuccess:()=>{se(),H(),T(!1)}}),r.jsx(en,{open:!!R,onOpenChange:()=>B(null),children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:['确定要删除表达方式 "',R?.situation,'" 吗? 此操作不可撤销。']})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>R&&ge(R),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),r.jsx(yU,{open:$,onOpenChange:U,onConfirm:Z,count:O.size})]})}function xU({expression:e,open:t,onOpenChange:n}){if(!e)return null;const a=l=>l?new Date(l*1e3).toLocaleString("zh-CN"):"-";return r.jsx(ir,{open:t,onOpenChange:n,children:r.jsxs(Jn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(er,{children:[r.jsx(tr,{children:"表达方式详情"}),r.jsx(xr,{children:"查看表达方式的完整信息"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(jo,{label:"情境",value:e.situation}),r.jsx(jo,{label:"风格",value:e.style}),r.jsx(jo,{icon:tm,label:"聊天ID",value:e.chat_id,mono:!0}),r.jsx(jo,{icon:tm,label:"记录ID",value:e.id.toString(),mono:!0})]}),e.context&&r.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[r.jsx(Q,{className:"text-xs text-muted-foreground",children:"上下文"}),r.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:e.context})]}),e.up_content&&r.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[r.jsx(Q,{className:"text-xs text-muted-foreground",children:"上文内容"}),r.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:e.up_content})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(jo,{icon:di,label:"最后活跃",value:a(e.last_active_time)}),r.jsx(jo,{icon:di,label:"创建时间",value:a(e.create_date)})]})]}),r.jsx(Er,{children:r.jsx(ne,{onClick:()=>n(!1),children:"关闭"})})]})})}function jo({icon:e,label:t,value:n,mono:a=!1}){return r.jsxs("div",{className:"space-y-1",children:[r.jsxs(Q,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e&&r.jsx(e,{className:"h-3 w-3"}),t]}),r.jsx("div",{className:he("text-sm",a&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function gU({open:e,onOpenChange:t,onSuccess:n}){const[a,l]=w.useState({situation:"",style:"",context:"",up_content:"",chat_id:""}),[o,c]=w.useState(!1),{toast:d}=or(),m=async()=>{if(!a.situation||!a.style||!a.chat_id){d({title:"验证失败",description:"请填写必填字段:情境、风格和聊天ID",variant:"destructive"});return}try{c(!0),await uU(a),d({title:"创建成功",description:"表达方式已创建"}),l({situation:"",style:"",context:"",up_content:"",chat_id:""}),n()}catch(f){d({title:"创建失败",description:f instanceof Error?f.message:"无法创建表达方式",variant:"destructive"})}finally{c(!1)}};return r.jsx(ir,{open:e,onOpenChange:t,children:r.jsxs(Jn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(er,{children:[r.jsx(tr,{children:"新增表达方式"}),r.jsx(xr,{children:"创建新的表达方式记录"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Q,{htmlFor:"situation",children:["情境 ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsx(Te,{id:"situation",value:a.situation,onChange:f=>l({...a,situation:f.target.value}),placeholder:"描述使用场景"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Q,{htmlFor:"style",children:["风格 ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsx(Te,{id:"style",value:a.style,onChange:f=>l({...a,style:f.target.value}),placeholder:"描述表达风格"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Q,{htmlFor:"chat_id",children:["聊天ID ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsx(Te,{id:"chat_id",value:a.chat_id,onChange:f=>l({...a,chat_id:f.target.value}),placeholder:"关联的聊天ID"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"context",children:"上下文"}),r.jsx(fn,{id:"context",value:a.context,onChange:f=>l({...a,context:f.target.value}),placeholder:"上下文信息(可选)",rows:3})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"up_content",children:"上文内容"}),r.jsx(fn,{id:"up_content",value:a.up_content,onChange:f=>l({...a,up_content:f.target.value}),placeholder:"上文内容(可选)",rows:3})]})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>t(!1),children:"取消"}),r.jsx(ne,{onClick:m,disabled:o,children:o?"创建中...":"创建"})]})]})})}function vU({expression:e,open:t,onOpenChange:n,onSuccess:a}){const[l,o]=w.useState({}),[c,d]=w.useState(!1),{toast:m}=or();w.useEffect(()=>{e&&o({situation:e.situation,style:e.style,context:e.context||"",up_content:e.up_content||"",chat_id:e.chat_id})},[e]);const f=async()=>{if(e)try{d(!0),await dU(e.id,l),m({title:"保存成功",description:"表达方式已更新"}),a()}catch(p){m({title:"保存失败",description:p instanceof Error?p.message:"无法更新表达方式",variant:"destructive"})}finally{d(!1)}};return e?r.jsx(ir,{open:t,onOpenChange:n,children:r.jsxs(Jn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(er,{children:[r.jsx(tr,{children:"编辑表达方式"}),r.jsx(xr,{children:"修改表达方式的信息"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit_situation",children:"情境"}),r.jsx(Te,{id:"edit_situation",value:l.situation||"",onChange:p=>o({...l,situation:p.target.value}),placeholder:"描述使用场景"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit_style",children:"风格"}),r.jsx(Te,{id:"edit_style",value:l.style||"",onChange:p=>o({...l,style:p.target.value}),placeholder:"描述表达风格"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit_chat_id",children:"聊天ID"}),r.jsx(Te,{id:"edit_chat_id",value:l.chat_id||"",onChange:p=>o({...l,chat_id:p.target.value}),placeholder:"关联的聊天ID"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit_context",children:"上下文"}),r.jsx(fn,{id:"edit_context",value:l.context||"",onChange:p=>o({...l,context:p.target.value}),placeholder:"上下文信息",rows:3})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit_up_content",children:"上文内容"}),r.jsx(fn,{id:"edit_up_content",value:l.up_content||"",onChange:p=>o({...l,up_content:p.target.value}),placeholder:"上文内容",rows:3})]})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>n(!1),children:"取消"}),r.jsx(ne,{onClick:f,disabled:c,children:c?"保存中...":"保存"})]})]})}):null}function yU({open:e,onOpenChange:t,onConfirm:n,count:a}){return r.jsx(en,{open:e,onOpenChange:t,children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认批量删除"}),r.jsxs(Qt,{children:["您即将删除 ",a," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const rc="/api/webui/person";async function bU(e){const t=new URLSearchParams;e.page&&t.append("page",e.page.toString()),e.page_size&&t.append("page_size",e.page_size.toString()),e.search&&t.append("search",e.search),e.is_known!==void 0&&t.append("is_known",e.is_known.toString()),e.platform&&t.append("platform",e.platform);const n=await lt(`${rc}/list?${t}`,{headers:pt()});if(!n.ok){const a=await n.json();throw new Error(a.detail||"获取人物列表失败")}return n.json()}async function wU(e){const t=await lt(`${rc}/${e}`,{headers:pt()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"获取人物详情失败")}return t.json()}async function jU(e,t){const n=await lt(`${rc}/${e}`,{method:"PATCH",headers:pt(),body:JSON.stringify(t)});if(!n.ok){const a=await n.json();throw new Error(a.detail||"更新人物信息失败")}return n.json()}async function NU(e){const t=await lt(`${rc}/${e}`,{method:"DELETE",headers:pt()});if(!t.ok){const n=await t.json();throw new Error(n.detail||"删除人物信息失败")}return t.json()}async function SU(){const e=await lt(`${rc}/stats/summary`,{headers:pt()});if(!e.ok){const t=await e.json();throw new Error(t.detail||"获取统计数据失败")}return e.json()}async function kU(e){const t=await lt(`${rc}/batch/delete`,{method:"POST",headers:pt(),body:JSON.stringify({person_ids:e})});if(!t.ok){const n=await t.json();throw new Error(n.detail||"批量删除失败")}return t.json()}function CU(){const[e,t]=w.useState([]),[n,a]=w.useState(!0),[l,o]=w.useState(0),[c,d]=w.useState(1),[m,f]=w.useState(20),[p,x]=w.useState(""),[y,b]=w.useState(void 0),[N,k]=w.useState(void 0),[S,T]=w.useState(null),[M,A]=w.useState(!1),[R,B]=w.useState(!1),[O,L]=w.useState(null),[$,U]=w.useState({total:0,known:0,unknown:0,platforms:{}}),[I,G]=w.useState(new Set),[ee,Ne]=w.useState(!1),[J,se]=w.useState(""),{toast:H}=or(),le=async()=>{try{a(!0);const oe=await bU({page:c,page_size:m,search:p||void 0,is_known:y,platform:N});t(oe.data),o(oe.total)}catch(oe){H({title:"加载失败",description:oe instanceof Error?oe.message:"无法加载人物信息",variant:"destructive"})}finally{a(!1)}},re=async()=>{try{const oe=await SU();U(oe.data)}catch(oe){console.error("加载统计数据失败:",oe)}};w.useEffect(()=>{le(),re()},[c,m,p,y,N]);const ge=async oe=>{try{const He=await wU(oe.person_id);T(He.data),A(!0)}catch(He){H({title:"加载详情失败",description:He instanceof Error?He.message:"无法加载人物详情",variant:"destructive"})}},E=oe=>{T(oe),B(!0)},we=async oe=>{try{await NU(oe.person_id),H({title:"删除成功",description:`已删除人物信息: ${oe.person_name||oe.nickname||oe.user_id}`}),L(null),le(),re()}catch(He){H({title:"删除失败",description:He instanceof Error?He.message:"无法删除人物信息",variant:"destructive"})}},Z=w.useMemo(()=>Object.keys($.platforms),[$.platforms]),z=oe=>{const He=new Set(I);He.has(oe)?He.delete(oe):He.add(oe),G(He)},X=()=>{I.size===e.length&&e.length>0?G(new Set):G(new Set(e.map(oe=>oe.person_id)))},q=()=>{if(I.size===0){H({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}Ne(!0)},ce=async()=>{try{const oe=await kU(Array.from(I));H({title:"批量删除完成",description:oe.message}),G(new Set),Ne(!1),le(),re()}catch(oe){H({title:"批量删除失败",description:oe instanceof Error?oe.message:"批量删除失败",variant:"destructive"})}},fe=()=>{const oe=parseInt(J),He=Math.ceil(l/m);oe>=1&&oe<=He?(d(oe),se("")):H({title:"无效的页码",description:`请输入1-${He}之间的页码`,variant:"destructive"})},De=oe=>oe?new Date(oe*1e3).toLocaleString("zh-CN"):"-";return r.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[r.jsx("div",{className:"mb-4 sm:mb-6",children:r.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:r.jsxs("div",{children:[r.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[r.jsx(TT,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),r.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),r.jsx(an,{className:"flex-1",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),r.jsx("div",{className:"text-2xl font-bold mt-1",children:$.total})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),r.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:$.known})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),r.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:$.unknown})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"sm:col-span-2",children:[r.jsx(Q,{htmlFor:"search",children:"搜索"}),r.jsxs("div",{className:"relative mt-1.5",children:[r.jsx(Yr,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:p,onChange:oe=>x(oe.target.value),className:"pl-9"})]})]}),r.jsxs("div",{children:[r.jsx(Q,{htmlFor:"filter-known",children:"认识状态"}),r.jsxs(_t,{value:y===void 0?"all":y.toString(),onValueChange:oe=>{b(oe==="all"?void 0:oe==="true"),d(1)},children:[r.jsx(jt,{id:"filter-known",className:"mt-1.5",children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"all",children:"全部"}),r.jsx(Oe,{value:"true",children:"已认识"}),r.jsx(Oe,{value:"false",children:"未认识"})]})]})]}),r.jsxs("div",{children:[r.jsx(Q,{htmlFor:"filter-platform",children:"平台"}),r.jsxs(_t,{value:N||"all",onValueChange:oe=>{k(oe==="all"?void 0:oe),d(1)},children:[r.jsx(jt,{id:"filter-platform",className:"mt-1.5",children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"all",children:"全部平台"}),Z.map(oe=>r.jsxs(Oe,{value:oe,children:[oe," (",$.platforms[oe],")"]},oe))]})]})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[r.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:I.size>0&&r.jsxs("span",{children:["已选择 ",I.size," 个人物"]})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),r.jsxs(_t,{value:m.toString(),onValueChange:oe=>{f(parseInt(oe)),d(1),G(new Set)},children:[r.jsx(jt,{id:"page-size",className:"w-20",children:r.jsx(Et,{})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"10",children:"10"}),r.jsx(Oe,{value:"20",children:"20"}),r.jsx(Oe,{value:"50",children:"50"}),r.jsx(Oe,{value:"100",children:"100"})]})]}),I.size>0&&r.jsxs(r.Fragment,{children:[r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>G(new Set),children:"取消选择"}),r.jsxs(ne,{variant:"destructive",size:"sm",onClick:q,children:[r.jsx(zt,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),r.jsxs("div",{className:"rounded-lg border bg-card",children:[r.jsx("div",{className:"hidden md:block",children:r.jsxs(ji,{children:[r.jsx(Ni,{children:r.jsxs(Vn,{children:[r.jsx(ut,{className:"w-12",children:r.jsx(jr,{checked:e.length>0&&I.size===e.length,onCheckedChange:X,"aria-label":"全选"})}),r.jsx(ut,{children:"状态"}),r.jsx(ut,{children:"名称"}),r.jsx(ut,{children:"昵称"}),r.jsx(ut,{children:"平台"}),r.jsx(ut,{children:"用户ID"}),r.jsx(ut,{children:"最后更新"}),r.jsx(ut,{className:"text-right",children:"操作"})]})}),r.jsx(Si,{children:n?r.jsx(Vn,{children:r.jsx(et,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):e.length===0?r.jsx(Vn,{children:r.jsx(et,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):e.map(oe=>r.jsxs(Vn,{children:[r.jsx(et,{children:r.jsx(jr,{checked:I.has(oe.person_id),onCheckedChange:()=>z(oe.person_id),"aria-label":`选择 ${oe.person_name||oe.nickname||oe.user_id}`})}),r.jsx(et,{children:r.jsx("div",{className:he("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",oe.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:oe.is_known?"已认识":"未认识"})}),r.jsx(et,{className:"font-medium",children:oe.person_name||r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(et,{children:oe.nickname||"-"}),r.jsx(et,{children:oe.platform}),r.jsx(et,{className:"font-mono text-sm",children:oe.user_id}),r.jsx(et,{className:"text-sm text-muted-foreground",children:De(oe.last_know)}),r.jsx(et,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>ge(oe),children:[r.jsx(Ha,{className:"h-4 w-4 mr-1"}),"详情"]}),r.jsxs(ne,{variant:"default",size:"sm",onClick:()=>E(oe),children:[r.jsx(Po,{className:"h-4 w-4 mr-1"}),"编辑"]}),r.jsxs(ne,{size:"sm",onClick:()=>L(oe),className:"bg-red-600 hover:bg-red-700 text-white",children:[r.jsx(zt,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},oe.id))})]})}),r.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):e.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):e.map(oe=>r.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(jr,{checked:I.has(oe.person_id),onCheckedChange:()=>z(oe.person_id),className:"mt-1"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:he("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",oe.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:oe.is_known?"已认识":"未认识"}),r.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:oe.person_name||r.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),oe.nickname&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",oe.nickname]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),r.jsx("p",{className:"font-medium text-xs",children:oe.platform})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),r.jsx("p",{className:"font-mono text-xs truncate",title:oe.user_id,children:oe.user_id})]}),r.jsxs("div",{className:"col-span-2",children:[r.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),r.jsx("p",{className:"text-xs",children:De(oe.last_know)})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>ge(oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[r.jsx(Ha,{className:"h-3 w-3 mr-1"}),"查看"]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>E(oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[r.jsx(Po,{className:"h-3 w-3 mr-1"}),"编辑"]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>L(oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[r.jsx(zt,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},oe.id))}),l>0&&r.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",l," 条记录,第 ",c," / ",Math.ceil(l/m)," 页"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>d(1),disabled:c===1,className:"hidden sm:flex",children:r.jsx(Du,{className:"h-4 w-4"})}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>d(c-1),disabled:c===1,children:[r.jsx(bi,{className:"h-4 w-4 sm:mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te,{type:"number",value:J,onChange:oe=>se(oe.target.value),onKeyDown:oe=>oe.key==="Enter"&&fe(),placeholder:c.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(l/m)}),r.jsx(ne,{variant:"outline",size:"sm",onClick:fe,disabled:!J,className:"h-8",children:"跳转"})]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>d(c+1),disabled:c>=Math.ceil(l/m),children:[r.jsx("span",{className:"hidden sm:inline",children:"下一页"}),r.jsx(wi,{className:"h-4 w-4 sm:ml-1"})]}),r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>d(Math.ceil(l/m)),disabled:c>=Math.ceil(l/m),className:"hidden sm:flex",children:r.jsx(zu,{className:"h-4 w-4"})})]})]})]})]})}),r.jsx(TU,{person:S,open:M,onOpenChange:A}),r.jsx(_U,{person:S,open:R,onOpenChange:B,onSuccess:()=>{le(),re(),B(!1)}}),r.jsx(en,{open:!!O,onOpenChange:()=>L(null),children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认删除"}),r.jsxs(Qt,{children:['确定要删除人物信息 "',O?.person_name||O?.nickname||O?.user_id,'" 吗? 此操作不可撤销。']})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:()=>O&&we(O),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),r.jsx(en,{open:ee,onOpenChange:Ne,children:r.jsxs(Yt,{children:[r.jsxs(Wt,{children:[r.jsx(Kt,{children:"确认批量删除"}),r.jsxs(Qt,{children:["确定要删除选中的 ",I.size," 个人物信息吗? 此操作不可撤销。"]})]}),r.jsxs(Xt,{children:[r.jsx(Jt,{children:"取消"}),r.jsx(Zt,{onClick:ce,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function TU({person:e,open:t,onOpenChange:n}){if(!e)return null;const a=l=>l?new Date(l*1e3).toLocaleString("zh-CN"):"-";return r.jsx(ir,{open:t,onOpenChange:n,children:r.jsxs(Jn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(er,{children:[r.jsx(tr,{children:"人物详情"}),r.jsxs(xr,{children:["查看 ",e.person_name||e.nickname||e.user_id," 的完整信息"]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(As,{icon:l6,label:"人物名称",value:e.person_name}),r.jsx(As,{icon:Mu,label:"昵称",value:e.nickname}),r.jsx(As,{icon:tm,label:"用户ID",value:e.user_id,mono:!0}),r.jsx(As,{icon:tm,label:"人物ID",value:e.person_id,mono:!0}),r.jsx(As,{label:"平台",value:e.platform}),r.jsx(As,{label:"状态",value:e.is_known?"已认识":"未认识"})]}),e.name_reason&&r.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[r.jsx(Q,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),r.jsx("p",{className:"mt-1 text-sm",children:e.name_reason})]}),e.memory_points&&r.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[r.jsx(Q,{className:"text-xs text-muted-foreground",children:"个人印象"}),r.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:e.memory_points})]}),e.group_nick_name&&e.group_nick_name.length>0&&r.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[r.jsx(Q,{className:"text-xs text-muted-foreground",children:"群昵称"}),r.jsx("div",{className:"mt-2 space-y-1",children:e.group_nick_name.map((l,o)=>r.jsxs("div",{className:"text-sm flex items-center gap-2",children:[r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:l.group_id}),r.jsx("span",{children:"→"}),r.jsx("span",{children:l.group_nick_name})]},o))})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsx(As,{icon:di,label:"认识时间",value:a(e.know_times)}),r.jsx(As,{icon:di,label:"首次记录",value:a(e.know_since)}),r.jsx(As,{icon:di,label:"最后更新",value:a(e.last_know)})]})]}),r.jsx(Er,{children:r.jsx(ne,{onClick:()=>n(!1),children:"关闭"})})]})})}function As({icon:e,label:t,value:n,mono:a=!1}){return r.jsxs("div",{className:"space-y-1",children:[r.jsxs(Q,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e&&r.jsx(e,{className:"h-3 w-3"}),t]}),r.jsx("div",{className:he("text-sm",a&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function _U({person:e,open:t,onOpenChange:n,onSuccess:a}){const[l,o]=w.useState({}),[c,d]=w.useState(!1),{toast:m}=or();w.useEffect(()=>{e&&o({person_name:e.person_name||"",name_reason:e.name_reason||"",nickname:e.nickname||"",memory_points:e.memory_points||"",is_known:e.is_known})},[e]);const f=async()=>{if(e)try{d(!0),await jU(e.person_id,l),m({title:"保存成功",description:"人物信息已更新"}),a()}catch(p){m({title:"保存失败",description:p instanceof Error?p.message:"无法更新人物信息",variant:"destructive"})}finally{d(!1)}};return e?r.jsx(ir,{open:t,onOpenChange:n,children:r.jsxs(Jn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(er,{children:[r.jsx(tr,{children:"编辑人物信息"}),r.jsxs(xr,{children:["修改 ",e.person_name||e.nickname||e.user_id," 的信息"]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"person_name",children:"人物名称"}),r.jsx(Te,{id:"person_name",value:l.person_name||"",onChange:p=>o({...l,person_name:p.target.value}),placeholder:"为这个人设置一个名称"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"nickname",children:"昵称"}),r.jsx(Te,{id:"nickname",value:l.nickname||"",onChange:p=>o({...l,nickname:p.target.value}),placeholder:"昵称"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"name_reason",children:"名称设定原因"}),r.jsx(fn,{id:"name_reason",value:l.name_reason||"",onChange:p=>o({...l,name_reason:p.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"memory_points",children:"个人印象"}),r.jsx(fn,{id:"memory_points",value:l.memory_points||"",onChange:p=>o({...l,memory_points:p.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{children:[r.jsx(Q,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),r.jsx(vt,{id:"is_known",checked:l.is_known,onCheckedChange:p=>o({...l,is_known:p})})]})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>n(!1),children:"取消"}),r.jsx(ne,{onClick:f,disabled:c,children:c?"保存中...":"保存"})]})]})}):null}function EU(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}const MU={},su={};function ui(e,t){try{const a=(MU[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];return a in su?su[a]:y5(a,a.split(":"))}catch{if(e in su)return su[e];const n=e?.match(AU);return n?y5(e,n.slice(1)):NaN}}const AU=/([+-]\d\d):?(\d\d)?/;function y5(e,t){const n=+(t[0]||0),a=+(t[1]||0),l=+(t[2]||0)/60;return su[e]=n*60+a>0?n*60+a+l:n*60-a-l}class rs extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(ui(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),fN(this),l1(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new rs(...n,t):new rs(Date.now(),t)}withTimeZone(t){return new rs(+this,t)}getTimezoneOffset(){const t=-ui(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),l1(this),+this}[Symbol.for("constructDateFrom")](t){return new rs(+new Date(t),this.timeZone)}}const b5=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!b5.test(e))return;const t=e.replace(b5,"$1UTC");rs.prototype[t]&&(e.startsWith("get")?rs.prototype[e]=function(){return this.internal[t]()}:(rs.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),DU(this),+this},rs.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),l1(this),+this}))});function l1(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-ui(e.timeZone,e)*60))}function DU(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),fN(e)}function fN(e){const t=ui(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),a=new Date(+e);a.setUTCHours(a.getUTCHours()-1);const l=-new Date(+e).getTimezoneOffset(),o=-new Date(+a).getTimezoneOffset(),c=l-o,d=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();c&&d&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+c);const m=l-n;m&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+m);const f=new Date(+e);f.setUTCSeconds(0);const p=l>0?f.getSeconds():(f.getSeconds()-60)%60,x=Math.round(-(ui(e.timeZone,e)*60))%60;(x||p)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+x),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+x+p));const y=ui(e.timeZone,e),b=y>0?Math.floor(y):Math.ceil(y),k=-new Date(+e).getTimezoneOffset()-b,S=b!==n,T=k-m;if(S&&T){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+T);const M=ui(e.timeZone,e),A=M>0?Math.floor(M):Math.ceil(M),R=b-A;R&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+R),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+R))}}class vr extends rs{static tz(t,...n){return n.length?new vr(...n,t):new vr(Date.now(),t)}toISOString(){const[t,n,a]=this.tzComponents(),l=`${t}${n}:${a}`;return this.internal.toISOString().slice(0,-1)+l}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,a,l]=this.internal.toUTCString().split(" ");return`${t?.slice(0,-1)} ${a} ${n} ${l}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,a,l]=this.tzComponents();return`${t} GMT${n}${a}${l} (${EU(this.timeZone,this)})`}toLocaleString(t,n){return Date.prototype.toLocaleString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(t,n){return Date.prototype.toLocaleDateString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(t,n){return Date.prototype.toLocaleTimeString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),n=t>0?"-":"+",a=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),l=String(Math.abs(t)%60).padStart(2,"0");return[n,a,l]}withTimeZone(t){return new vr(+this,t)}[Symbol.for("constructDateFrom")](t){return new vr(+new Date(t),this.timeZone)}}const pN=6048e5,zU=864e5,w5=Symbol.for("constructDateFrom");function Gn(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&w5 in e?e[w5](t):e instanceof Date?new e.constructor(t):new Date(t)}function dn(e,t){return Gn(t||e,e)}function xN(e,t,n){const a=dn(e,n?.in);return isNaN(t)?Gn(e,NaN):(t&&a.setDate(a.getDate()+t),a)}function gN(e,t,n){const a=dn(e,n?.in);if(isNaN(t))return Gn(e,NaN);if(!t)return a;const l=a.getDate(),o=Gn(e,a.getTime());o.setMonth(a.getMonth()+t+1,0);const c=o.getDate();return l>=c?o:(a.setFullYear(o.getFullYear(),o.getMonth(),l),a)}let OU={};function Qu(){return OU}function Dl(e,t){const n=Qu(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,l=dn(e,t?.in),o=l.getDay(),c=(o=o.getTime()?a+1:n.getTime()>=d.getTime()?a:a-1}function j5(e){const t=dn(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Ei(e,...t){const n=Gn.bind(null,e||t.find(a=>typeof a=="object"));return t.map(n)}function ku(e,t){const n=dn(e,t?.in);return n.setHours(0,0,0,0),n}function yN(e,t,n){const[a,l]=Ei(n?.in,e,t),o=ku(a),c=ku(l),d=+o-j5(o),m=+c-j5(c);return Math.round((d-m)/zU)}function RU(e,t){const n=vN(e,t),a=Gn(e,0);return a.setFullYear(n,0,4),a.setHours(0,0,0,0),Su(a)}function LU(e,t,n){return xN(e,t*7,n)}function BU(e,t,n){return gN(e,t*12,n)}function PU(e,t){let n,a=t?.in;return e.forEach(l=>{!a&&typeof l=="object"&&(a=Gn.bind(null,l));const o=dn(l,a);(!n||n{!a&&typeof l=="object"&&(a=Gn.bind(null,l));const o=dn(l,a);(!n||n>o||isNaN(+o))&&(n=o)}),Gn(a,n||NaN)}function IU(e,t,n){const[a,l]=Ei(n?.in,e,t);return+ku(a)==+ku(l)}function bN(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function qU(e){return!(!bN(e)&&typeof e!="number"||isNaN(+dn(e)))}function HU(e,t,n){const[a,l]=Ei(n?.in,e,t),o=a.getFullYear()-l.getFullYear(),c=a.getMonth()-l.getMonth();return o*12+c}function UU(e,t){const n=dn(e,t?.in),a=n.getMonth();return n.setFullYear(n.getFullYear(),a+1,0),n.setHours(23,59,59,999),n}function wN(e,t){const[n,a]=Ei(e,t.start,t.end);return{start:n,end:a}}function $U(e,t){const{start:n,end:a}=wN(t?.in,e);let l=+n>+a;const o=l?+n:+a,c=l?a:n;c.setHours(0,0,0,0),c.setDate(1);let d=1;const m=[];for(;+c<=o;)m.push(Gn(n,c)),c.setMonth(c.getMonth()+d);return l?m.reverse():m}function VU(e,t){const n=dn(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function GU(e,t){const n=dn(e,t?.in),a=n.getFullYear();return n.setFullYear(a+1,0,0),n.setHours(23,59,59,999),n}function jN(e,t){const n=dn(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function YU(e,t){const{start:n,end:a}=wN(t?.in,e);let l=+n>+a;const o=l?+n:+a,c=l?a:n;c.setHours(0,0,0,0),c.setMonth(0,1);let d=1;const m=[];for(;+c<=o;)m.push(Gn(n,c)),c.setFullYear(c.getFullYear()+d);return l?m.reverse():m}function NN(e,t){const n=Qu(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,l=dn(e,t?.in),o=l.getDay(),c=(o{let a;const l=XU[e];return typeof l=="string"?a=l:t===1?a=l.one:a=l.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a};function Lo(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const QU={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ZU={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},JU={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},e$={date:Lo({formats:QU,defaultWidth:"full"}),time:Lo({formats:ZU,defaultWidth:"full"}),dateTime:Lo({formats:JU,defaultWidth:"full"})},t$={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},n$=(e,t,n,a)=>t$[e];function Ja(e){return(t,n)=>{const a=n?.context?String(n.context):"standalone";let l;if(a==="formatting"&&e.formattingValues){const c=e.defaultFormattingWidth||e.defaultWidth,d=n?.width?String(n.width):c;l=e.formattingValues[d]||e.formattingValues[c]}else{const c=e.defaultWidth,d=n?.width?String(n.width):e.defaultWidth;l=e.values[d]||e.values[c]}const o=e.argumentCallback?e.argumentCallback(t):t;return l[o]}}const r$={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},a$={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},s$={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},l$={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},i$={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},o$={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},c$=(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},u$={ordinalNumber:c$,era:Ja({values:r$,defaultWidth:"wide"}),quarter:Ja({values:a$,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Ja({values:s$,defaultWidth:"wide"}),day:Ja({values:l$,defaultWidth:"wide"}),dayPeriod:Ja({values:i$,defaultWidth:"wide",formattingValues:o$,defaultFormattingWidth:"wide"})};function es(e){return(t,n={})=>{const a=n.width,l=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],o=t.match(l);if(!o)return null;const c=o[0],d=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],m=Array.isArray(d)?m$(d,x=>x.test(c)):d$(d,x=>x.test(c));let f;f=e.valueCallback?e.valueCallback(m):m,f=n.valueCallback?n.valueCallback(f):f;const p=t.slice(c.length);return{value:f,rest:p}}}function d$(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function m$(e,t){for(let n=0;n{const a=t.match(e.matchPattern);if(!a)return null;const l=a[0],o=t.match(e.parsePattern);if(!o)return null;let c=e.valueCallback?e.valueCallback(o[0]):o[0];c=n.valueCallback?n.valueCallback(c):c;const d=t.slice(l.length);return{value:c,rest:d}}}const h$=/^(\d+)(th|st|nd|rd)?/i,f$=/\d+/i,p$={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},x$={any:[/^b/i,/^(a|c)/i]},g$={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},v$={any:[/1/i,/2/i,/3/i,/4/i]},y$={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},b$={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},w$={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},j$={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},N$={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},S$={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},k$={ordinalNumber:SN({matchPattern:h$,parsePattern:f$,valueCallback:e=>parseInt(e,10)}),era:es({matchPatterns:p$,defaultMatchWidth:"wide",parsePatterns:x$,defaultParseWidth:"any"}),quarter:es({matchPatterns:g$,defaultMatchWidth:"wide",parsePatterns:v$,defaultParseWidth:"any",valueCallback:e=>e+1}),month:es({matchPatterns:y$,defaultMatchWidth:"wide",parsePatterns:b$,defaultParseWidth:"any"}),day:es({matchPatterns:w$,defaultMatchWidth:"wide",parsePatterns:j$,defaultParseWidth:"any"}),dayPeriod:es({matchPatterns:N$,defaultMatchWidth:"any",parsePatterns:S$,defaultParseWidth:"any"})},Ag={code:"en-US",formatDistance:KU,formatLong:e$,formatRelative:n$,localize:u$,match:k$,options:{weekStartsOn:0,firstWeekContainsDate:1}};function C$(e,t){const n=dn(e,t?.in);return yN(n,jN(n))+1}function kN(e,t){const n=dn(e,t?.in),a=+Su(n)-+RU(n);return Math.round(a/pN)+1}function CN(e,t){const n=dn(e,t?.in),a=n.getFullYear(),l=Qu(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??l.firstWeekContainsDate??l.locale?.options?.firstWeekContainsDate??1,c=Gn(t?.in||e,0);c.setFullYear(a+1,0,o),c.setHours(0,0,0,0);const d=Dl(c,t),m=Gn(t?.in||e,0);m.setFullYear(a,0,o),m.setHours(0,0,0,0);const f=Dl(m,t);return+n>=+d?a+1:+n>=+f?a:a-1}function T$(e,t){const n=Qu(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,l=CN(e,t),o=Gn(t?.in||e,0);return o.setFullYear(l,0,a),o.setHours(0,0,0,0),Dl(o,t)}function TN(e,t){const n=dn(e,t?.in),a=+Dl(n,t)-+T$(n,t);return Math.round(a/pN)+1}function rn(e,t){const n=e<0?"-":"",a=Math.abs(e).toString().padStart(t,"0");return n+a}const bl={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return rn(t==="yy"?a%100:a,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):rn(n+1,2)},d(e,t){return rn(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return rn(e.getHours()%12||12,t.length)},H(e,t){return rn(e.getHours(),t.length)},m(e,t){return rn(e.getMinutes(),t.length)},s(e,t){return rn(e.getSeconds(),t.length)},S(e,t){const n=t.length,a=e.getMilliseconds(),l=Math.trunc(a*Math.pow(10,n-3));return rn(l,t.length)}},No={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},N5={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});case"GGGG":default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const a=e.getFullYear(),l=a>0?a:1-a;return n.ordinalNumber(l,{unit:"year"})}return bl.y(e,t)},Y:function(e,t,n,a){const l=CN(e,a),o=l>0?l:1-l;if(t==="YY"){const c=o%100;return rn(c,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):rn(o,t.length)},R:function(e,t){const n=vN(e);return rn(n,t.length)},u:function(e,t){const n=e.getFullYear();return rn(n,t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return rn(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return rn(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return bl.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return rn(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const l=TN(e,a);return t==="wo"?n.ordinalNumber(l,{unit:"week"}):rn(l,t.length)},I:function(e,t,n){const a=kN(e);return t==="Io"?n.ordinalNumber(a,{unit:"week"}):rn(a,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):bl.d(e,t)},D:function(e,t,n){const a=C$(e);return t==="Do"?n.ordinalNumber(a,{unit:"dayOfYear"}):rn(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});case"EEEE":default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const l=e.getDay(),o=(l-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return rn(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(l,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(l,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(l,{width:"short",context:"formatting"});case"eeee":default:return n.day(l,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const l=e.getDay(),o=(l-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return rn(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(l,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(l,{width:"narrow",context:"standalone"});case"cccccc":return n.day(l,{width:"short",context:"standalone"});case"cccc":default:return n.day(l,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),l=a===0?7:a;switch(t){case"i":return String(l);case"ii":return rn(l,t.length);case"io":return n.ordinalNumber(l,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});case"iiii":default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const l=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let l;switch(a===12?l=No.noon:a===0?l=No.midnight:l=a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let l;switch(a>=17?l=No.evening:a>=12?l=No.afternoon:a>=4?l=No.morning:l=No.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let a=e.getHours()%12;return a===0&&(a=12),n.ordinalNumber(a,{unit:"hour"})}return bl.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):bl.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return t==="Ko"?n.ordinalNumber(a,{unit:"hour"}):rn(a,t.length)},k:function(e,t,n){let a=e.getHours();return a===0&&(a=24),t==="ko"?n.ordinalNumber(a,{unit:"hour"}):rn(a,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):bl.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):bl.s(e,t)},S:function(e,t){return bl.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(a===0)return"Z";switch(t){case"X":return k5(a);case"XXXX":case"XX":return oi(a);case"XXXXX":case"XXX":default:return oi(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return k5(a);case"xxxx":case"xx":return oi(a);case"xxxxx":case"xxx":default:return oi(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+S5(a,":");case"OOOO":default:return"GMT"+oi(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+S5(a,":");case"zzzz":default:return"GMT"+oi(a,":")}},t:function(e,t,n){const a=Math.trunc(+e/1e3);return rn(a,t.length)},T:function(e,t,n){return rn(+e,t.length)}};function S5(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),l=Math.trunc(a/60),o=a%60;return o===0?n+String(l):n+String(l)+t+rn(o,2)}function k5(e,t){return e%60===0?(e>0?"-":"+")+rn(Math.abs(e)/60,2):oi(e,t)}function oi(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),l=rn(Math.trunc(a/60),2),o=rn(a%60,2);return n+l+t+o}const C5=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},_N=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},_$=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],l=n[2];if(!l)return C5(e,t);let o;switch(a){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",C5(a,t)).replace("{{time}}",_N(l,t))},E$={p:_N,P:_$},M$=/^D+$/,A$=/^Y+$/,D$=["D","DD","YY","YYYY"];function z$(e){return M$.test(e)}function O$(e){return A$.test(e)}function R$(e,t,n){const a=L$(e,t,n);if(console.warn(a),D$.includes(e))throw new RangeError(a)}function L$(e,t,n){const a=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const B$=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,P$=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,F$=/^'([^]*?)'?$/,I$=/''/g,q$=/[a-zA-Z]/;function Z0(e,t,n){const a=Qu(),l=n?.locale??a.locale??Ag,o=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,c=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,d=dn(e,n?.in);if(!qU(d))throw new RangeError("Invalid time value");let m=t.match(P$).map(p=>{const x=p[0];if(x==="p"||x==="P"){const y=E$[x];return y(p,l.formatLong)}return p}).join("").match(B$).map(p=>{if(p==="''")return{isToken:!1,value:"'"};const x=p[0];if(x==="'")return{isToken:!1,value:H$(p)};if(N5[x])return{isToken:!0,value:p};if(x.match(q$))throw new RangeError("Format string contains an unescaped latin alphabet character `"+x+"`");return{isToken:!1,value:p}});l.localize.preprocessor&&(m=l.localize.preprocessor(d,m));const f={firstWeekContainsDate:o,weekStartsOn:c,locale:l};return m.map(p=>{if(!p.isToken)return p.value;const x=p.value;(!n?.useAdditionalWeekYearTokens&&O$(x)||!n?.useAdditionalDayOfYearTokens&&z$(x))&&R$(x,t,String(e));const y=N5[x[0]];return y(d,x,l.localize,f)}).join("")}function H$(e){const t=e.match(F$);return t?t[1].replace(I$,"'"):e}function U$(e,t){const n=dn(e,t?.in),a=n.getFullYear(),l=n.getMonth(),o=Gn(n,0);return o.setFullYear(a,l+1,0),o.setHours(0,0,0,0),o.getDate()}function $$(e,t){return dn(e,t?.in).getMonth()}function V$(e,t){return dn(e,t?.in).getFullYear()}function G$(e,t){return+dn(e)>+dn(t)}function Y$(e,t){return+dn(e)<+dn(t)}function W$(e,t,n){const[a,l]=Ei(n?.in,e,t);return+Dl(a,n)==+Dl(l,n)}function X$(e,t,n){const[a,l]=Ei(n?.in,e,t);return a.getFullYear()===l.getFullYear()&&a.getMonth()===l.getMonth()}function K$(e,t,n){const[a,l]=Ei(n?.in,e,t);return a.getFullYear()===l.getFullYear()}function Q$(e,t,n){const a=dn(e,n?.in),l=a.getFullYear(),o=a.getDate(),c=Gn(e,0);c.setFullYear(l,t,15),c.setHours(0,0,0,0);const d=U$(c);return a.setMonth(t,Math.min(o,d)),a}function Z$(e,t,n){const a=dn(e,n?.in);return isNaN(+a)?Gn(e,NaN):(a.setFullYear(t),a)}const T5=5,J$=4;function eV(e,t){const n=t.startOfMonth(e),a=n.getDay()>0?n.getDay():7,l=t.addDays(e,-a+1),o=t.addDays(l,T5*7-1);return t.getMonth(e)===t.getMonth(o)?T5:J$}function EN(e,t){const n=t.startOfMonth(e),a=n.getDay();return a===1?n:a===0?t.addDays(n,-6):t.addDays(n,-1*(a-1))}function tV(e,t){const n=EN(e,t),a=eV(e,t);return t.addDays(n,a*7-1)}class ma{constructor(t,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?vr.tz(this.options.timeZone):new this.Date,this.newDate=(a,l,o)=>this.overrides?.newDate?this.overrides.newDate(a,l,o):this.options.timeZone?new vr(a,l,o,this.options.timeZone):new Date(a,l,o),this.addDays=(a,l)=>this.overrides?.addDays?this.overrides.addDays(a,l):xN(a,l),this.addMonths=(a,l)=>this.overrides?.addMonths?this.overrides.addMonths(a,l):gN(a,l),this.addWeeks=(a,l)=>this.overrides?.addWeeks?this.overrides.addWeeks(a,l):LU(a,l),this.addYears=(a,l)=>this.overrides?.addYears?this.overrides.addYears(a,l):BU(a,l),this.differenceInCalendarDays=(a,l)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(a,l):yN(a,l),this.differenceInCalendarMonths=(a,l)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(a,l):HU(a,l),this.eachMonthOfInterval=a=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(a):$U(a),this.eachYearOfInterval=a=>{const l=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(a):YU(a),o=new Set(l.map(d=>this.getYear(d)));if(o.size===l.length)return l;const c=[];return o.forEach(d=>{c.push(new Date(d,0,1))}),c},this.endOfBroadcastWeek=a=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(a):tV(a,this),this.endOfISOWeek=a=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(a):WU(a),this.endOfMonth=a=>this.overrides?.endOfMonth?this.overrides.endOfMonth(a):UU(a),this.endOfWeek=(a,l)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(a,l):NN(a,this.options),this.endOfYear=a=>this.overrides?.endOfYear?this.overrides.endOfYear(a):GU(a),this.format=(a,l,o)=>{const c=this.overrides?.format?this.overrides.format(a,l,this.options):Z0(a,l,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(c):c},this.getISOWeek=a=>this.overrides?.getISOWeek?this.overrides.getISOWeek(a):kN(a),this.getMonth=(a,l)=>this.overrides?.getMonth?this.overrides.getMonth(a,this.options):$$(a,this.options),this.getYear=(a,l)=>this.overrides?.getYear?this.overrides.getYear(a,this.options):V$(a,this.options),this.getWeek=(a,l)=>this.overrides?.getWeek?this.overrides.getWeek(a,this.options):TN(a,this.options),this.isAfter=(a,l)=>this.overrides?.isAfter?this.overrides.isAfter(a,l):G$(a,l),this.isBefore=(a,l)=>this.overrides?.isBefore?this.overrides.isBefore(a,l):Y$(a,l),this.isDate=a=>this.overrides?.isDate?this.overrides.isDate(a):bN(a),this.isSameDay=(a,l)=>this.overrides?.isSameDay?this.overrides.isSameDay(a,l):IU(a,l),this.isSameMonth=(a,l)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(a,l):X$(a,l),this.isSameYear=(a,l)=>this.overrides?.isSameYear?this.overrides.isSameYear(a,l):K$(a,l),this.max=a=>this.overrides?.max?this.overrides.max(a):PU(a),this.min=a=>this.overrides?.min?this.overrides.min(a):FU(a),this.setMonth=(a,l)=>this.overrides?.setMonth?this.overrides.setMonth(a,l):Q$(a,l),this.setYear=(a,l)=>this.overrides?.setYear?this.overrides.setYear(a,l):Z$(a,l),this.startOfBroadcastWeek=(a,l)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(a,this):EN(a,this),this.startOfDay=a=>this.overrides?.startOfDay?this.overrides.startOfDay(a):ku(a),this.startOfISOWeek=a=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(a):Su(a),this.startOfMonth=a=>this.overrides?.startOfMonth?this.overrides.startOfMonth(a):VU(a),this.startOfWeek=(a,l)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(a,this.options):Dl(a,this.options),this.startOfYear=a=>this.overrides?.startOfYear?this.overrides.startOfYear(a):jN(a),this.options={locale:Ag,...t},this.overrides=n}getDigitMap(){const{numerals:t="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:t}),a={};for(let l=0;l<10;l++)a[l.toString()]=n.format(l);return a}replaceDigits(t){const n=this.getDigitMap();return t.replace(/\d/g,a=>n[a]||a)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){const t=this.options.locale?.code;return t&&ma.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:n,timeZone:a,numerals:l}=this.options,o=n?.code;if(o&&ma.yearFirstLocales.has(o))try{return new Intl.DateTimeFormat(o,{month:"long",year:"numeric",timeZone:a,numberingSystem:l}).format(t)}catch{}const c=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,c)}}ma.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const us=new ma;class MN{constructor(t,n,a=us){this.date=t,this.displayMonth=n,this.outside=!!(n&&!a.isSameMonth(t,n)),this.dateLib=a}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class nV{constructor(t,n){this.date=t,this.weeks=n}}class rV{constructor(t,n){this.days=n,this.weekNumber=t}}function aV(e){return Fe.createElement("button",{...e})}function sV(e){return Fe.createElement("span",{...e})}function lV(e){const{size:t=24,orientation:n="left",className:a}=e;return Fe.createElement("svg",{className:a,width:t,height:t,viewBox:"0 0 24 24"},n==="up"&&Fe.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&Fe.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&Fe.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&Fe.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function iV(e){const{day:t,modifiers:n,...a}=e;return Fe.createElement("td",{...a})}function oV(e){const{day:t,modifiers:n,...a}=e,l=Fe.useRef(null);return Fe.useEffect(()=>{n.focused&&l.current?.focus()},[n.focused]),Fe.createElement("button",{ref:l,...a})}var Ke;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(Ke||(Ke={}));var En;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(En||(En={}));var Fa;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(Fa||(Fa={}));var oa;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(oa||(oa={}));function cV(e){const{options:t,className:n,components:a,classNames:l,...o}=e,c=[l[Ke.Dropdown],n].join(" "),d=t?.find(({value:m})=>m===o.value);return Fe.createElement("span",{"data-disabled":o.disabled,className:l[Ke.DropdownRoot]},Fe.createElement(a.Select,{className:c,...o},t?.map(({value:m,label:f,disabled:p})=>Fe.createElement(a.Option,{key:m,value:m,disabled:p},f))),Fe.createElement("span",{className:l[Ke.CaptionLabel],"aria-hidden":!0},d?.label,Fe.createElement(a.Chevron,{orientation:"down",size:18,className:l[Ke.Chevron]})))}function uV(e){return Fe.createElement("div",{...e})}function dV(e){return Fe.createElement("div",{...e})}function mV(e){const{calendarMonth:t,displayIndex:n,...a}=e;return Fe.createElement("div",{...a},e.children)}function hV(e){const{calendarMonth:t,displayIndex:n,...a}=e;return Fe.createElement("div",{...a})}function fV(e){return Fe.createElement("table",{...e})}function pV(e){return Fe.createElement("div",{...e})}const AN=w.createContext(void 0);function Zu(){const e=w.useContext(AN);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function xV(e){const{components:t}=Zu();return Fe.createElement(t.Dropdown,{...e})}function gV(e){const{onPreviousClick:t,onNextClick:n,previousMonth:a,nextMonth:l,...o}=e,{components:c,classNames:d,labels:{labelPrevious:m,labelNext:f}}=Zu(),p=w.useCallback(y=>{l&&n?.(y)},[l,n]),x=w.useCallback(y=>{a&&t?.(y)},[a,t]);return Fe.createElement("nav",{...o},Fe.createElement(c.PreviousMonthButton,{type:"button",className:d[Ke.PreviousMonthButton],tabIndex:a?void 0:-1,"aria-disabled":a?void 0:!0,"aria-label":m(a),onClick:x},Fe.createElement(c.Chevron,{disabled:a?void 0:!0,className:d[Ke.Chevron],orientation:"left"})),Fe.createElement(c.NextMonthButton,{type:"button",className:d[Ke.NextMonthButton],tabIndex:l?void 0:-1,"aria-disabled":l?void 0:!0,"aria-label":f(l),onClick:p},Fe.createElement(c.Chevron,{disabled:l?void 0:!0,orientation:"right",className:d[Ke.Chevron]})))}function vV(e){const{components:t}=Zu();return Fe.createElement(t.Button,{...e})}function yV(e){return Fe.createElement("option",{...e})}function bV(e){const{components:t}=Zu();return Fe.createElement(t.Button,{...e})}function wV(e){const{rootRef:t,...n}=e;return Fe.createElement("div",{...n,ref:t})}function jV(e){return Fe.createElement("select",{...e})}function NV(e){const{week:t,...n}=e;return Fe.createElement("tr",{...n})}function SV(e){return Fe.createElement("th",{...e})}function kV(e){return Fe.createElement("thead",{"aria-hidden":!0},Fe.createElement("tr",{...e}))}function CV(e){const{week:t,...n}=e;return Fe.createElement("th",{...n})}function TV(e){return Fe.createElement("th",{...e})}function _V(e){return Fe.createElement("tbody",{...e})}function EV(e){const{components:t}=Zu();return Fe.createElement(t.Dropdown,{...e})}const MV=Object.freeze(Object.defineProperty({__proto__:null,Button:aV,CaptionLabel:sV,Chevron:lV,Day:iV,DayButton:oV,Dropdown:cV,DropdownNav:uV,Footer:dV,Month:mV,MonthCaption:hV,MonthGrid:fV,Months:pV,MonthsDropdown:xV,Nav:gV,NextMonthButton:vV,Option:yV,PreviousMonthButton:bV,Root:wV,Select:jV,Week:NV,WeekNumber:CV,WeekNumberHeader:TV,Weekday:SV,Weekdays:kV,Weeks:_V,YearsDropdown:EV},Symbol.toStringTag,{value:"Module"}));function zs(e,t,n=!1,a=us){let{from:l,to:o}=e;const{differenceInCalendarDays:c,isSameDay:d}=a;return l&&o?(c(o,l)<0&&([l,o]=[o,l]),c(t,l)>=(n?1:0)&&c(o,t)>=(n?1:0)):!n&&o?d(o,t):!n&&l?d(l,t):!1}function DN(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function Dg(e){return!!(e&&typeof e=="object"&&"from"in e)}function zN(e){return!!(e&&typeof e=="object"&&"after"in e)}function ON(e){return!!(e&&typeof e=="object"&&"before"in e)}function RN(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function LN(e,t){return Array.isArray(e)&&e.every(t.isDate)}function Os(e,t,n=us){const a=Array.isArray(t)?t:[t],{isSameDay:l,differenceInCalendarDays:o,isAfter:c}=n;return a.some(d=>{if(typeof d=="boolean")return d;if(n.isDate(d))return l(e,d);if(LN(d,n))return d.includes(e);if(Dg(d))return zs(d,e,!1,n);if(RN(d))return Array.isArray(d.dayOfWeek)?d.dayOfWeek.includes(e.getDay()):d.dayOfWeek===e.getDay();if(DN(d)){const m=o(d.before,e),f=o(d.after,e),p=m>0,x=f<0;return c(d.before,d.after)?x&&p:p||x}return zN(d)?o(e,d.after)>0:ON(d)?o(d.before,e)>0:typeof d=="function"?d(e):!1})}function AV(e,t,n,a,l){const{disabled:o,hidden:c,modifiers:d,showOutsideDays:m,broadcastCalendar:f,today:p}=t,{isSameDay:x,isSameMonth:y,startOfMonth:b,isBefore:N,endOfMonth:k,isAfter:S}=l,T=n&&b(n),M=a&&k(a),A={[En.focused]:[],[En.outside]:[],[En.disabled]:[],[En.hidden]:[],[En.today]:[]},R={};for(const B of e){const{date:O,displayMonth:L}=B,$=!!(L&&!y(O,L)),U=!!(T&&N(O,T)),I=!!(M&&S(O,M)),G=!!(o&&Os(O,o,l)),ee=!!(c&&Os(O,c,l))||U||I||!f&&!m&&$||f&&m===!1&&$,Ne=x(O,p??l.today());$&&A.outside.push(B),G&&A.disabled.push(B),ee&&A.hidden.push(B),Ne&&A.today.push(B),d&&Object.keys(d).forEach(J=>{const se=d?.[J];se&&Os(O,se,l)&&(R[J]?R[J].push(B):R[J]=[B])})}return B=>{const O={[En.focused]:!1,[En.disabled]:!1,[En.hidden]:!1,[En.outside]:!1,[En.today]:!1},L={};for(const $ in A){const U=A[$];O[$]=U.some(I=>I===B)}for(const $ in R)L[$]=R[$].some(U=>U===B);return{...O,...L}}}function DV(e,t,n={}){return Object.entries(e).filter(([,l])=>l===!0).reduce((l,[o])=>(n[o]?l.push(n[o]):t[En[o]]?l.push(t[En[o]]):t[Fa[o]]&&l.push(t[Fa[o]]),l),[t[Ke.Day]])}function zV(e){return{...MV,...e}}function OV(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([n,a])=>{n.startsWith("data-")&&(t[n]=a)}),t}function zg(){const e={};for(const t in Ke)e[Ke[t]]=`rdp-${Ke[t]}`;for(const t in En)e[En[t]]=`rdp-${En[t]}`;for(const t in Fa)e[Fa[t]]=`rdp-${Fa[t]}`;for(const t in oa)e[oa[t]]=`rdp-${oa[t]}`;return e}function BN(e,t,n){return(n??new ma(t)).formatMonthYear(e)}const RV=BN;function LV(e,t,n){return(n??new ma(t)).format(e,"d")}function BV(e,t=us){return t.format(e,"LLLL")}function PV(e,t,n){return(n??new ma(t)).format(e,"cccccc")}function FV(e,t=us){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function IV(){return""}function PN(e,t=us){return t.format(e,"yyyy")}const qV=PN,HV=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:BN,formatDay:LV,formatMonthCaption:RV,formatMonthDropdown:BV,formatWeekNumber:FV,formatWeekNumberHeader:IV,formatWeekdayName:PV,formatYearCaption:qV,formatYearDropdown:PN},Symbol.toStringTag,{value:"Module"}));function UV(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...HV,...e}}function $V(e,t,n,a,l){const{startOfMonth:o,startOfYear:c,endOfYear:d,eachMonthOfInterval:m,getMonth:f}=l;return m({start:c(e),end:d(e)}).map(y=>{const b=a.formatMonthDropdown(y,l),N=f(y),k=t&&yo(n)||!1;return{value:N,label:b,disabled:k}})}function VV(e,t={},n={}){let a={...t?.[Ke.Day]};return Object.entries(e).filter(([,l])=>l===!0).forEach(([l])=>{a={...a,...n?.[l]}}),a}function GV(e,t,n){const a=e.today(),l=t?e.startOfISOWeek(a):e.startOfWeek(a),o=[];for(let c=0;c<7;c++){const d=e.addDays(l,c);o.push(d)}return o}function YV(e,t,n,a,l=!1){if(!e||!t)return;const{startOfYear:o,endOfYear:c,eachYearOfInterval:d,getYear:m}=a,f=o(e),p=c(t),x=d({start:f,end:p});return l&&x.reverse(),x.map(y=>{const b=n.formatYearDropdown(y,a);return{value:m(y),label:b,disabled:!1}})}function FN(e,t,n,a){let l=(a??new ma(n)).format(e,"PPPP");return t.today&&(l=`Today, ${l}`),t.selected&&(l=`${l}, selected`),l}const WV=FN;function IN(e,t,n){return(n??new ma(t)).formatMonthYear(e)}const XV=IN;function KV(e,t,n,a){let l=(a??new ma(n)).format(e,"PPPP");return t?.today&&(l=`Today, ${l}`),l}function QV(e){return"Choose the Month"}function ZV(){return""}function JV(e){return"Go to the Next Month"}function eG(e){return"Go to the Previous Month"}function tG(e,t,n){return(n??new ma(t)).format(e,"cccc")}function nG(e,t){return`Week ${e}`}function rG(e){return"Week Number"}function aG(e){return"Choose the Year"}const sG=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:XV,labelDay:WV,labelDayButton:FN,labelGrid:IN,labelGridcell:KV,labelMonthDropdown:QV,labelNav:ZV,labelNext:JV,labelPrevious:eG,labelWeekNumber:nG,labelWeekNumberHeader:rG,labelWeekday:tG,labelYearDropdown:aG},Symbol.toStringTag,{value:"Module"})),Ju=e=>e instanceof HTMLElement?e:null,fx=e=>[...e.querySelectorAll("[data-animated-month]")??[]],lG=e=>Ju(e.querySelector("[data-animated-month]")),px=e=>Ju(e.querySelector("[data-animated-caption]")),xx=e=>Ju(e.querySelector("[data-animated-weeks]")),iG=e=>Ju(e.querySelector("[data-animated-nav]")),oG=e=>Ju(e.querySelector("[data-animated-weekdays]"));function cG(e,t,{classNames:n,months:a,focused:l,dateLib:o}){const c=w.useRef(null),d=w.useRef(a),m=w.useRef(!1);w.useLayoutEffect(()=>{const f=d.current;if(d.current=a,!t||!e.current||!(e.current instanceof HTMLElement)||a.length===0||f.length===0||a.length!==f.length)return;const p=o.isSameMonth(a[0].date,f[0].date),x=o.isAfter(a[0].date,f[0].date),y=x?n[oa.caption_after_enter]:n[oa.caption_before_enter],b=x?n[oa.weeks_after_enter]:n[oa.weeks_before_enter],N=c.current,k=e.current.cloneNode(!0);if(k instanceof HTMLElement?(fx(k).forEach(A=>{if(!(A instanceof HTMLElement))return;const R=lG(A);R&&A.contains(R)&&A.removeChild(R);const B=px(A);B&&B.classList.remove(y);const O=xx(A);O&&O.classList.remove(b)}),c.current=k):c.current=null,m.current||p||l)return;const S=N instanceof HTMLElement?fx(N):[],T=fx(e.current);if(T?.every(M=>M instanceof HTMLElement)&&S&&S.every(M=>M instanceof HTMLElement)){m.current=!0,e.current.style.isolation="isolate";const M=iG(e.current);M&&(M.style.zIndex="1"),T.forEach((A,R)=>{const B=S[R];if(!B)return;A.style.position="relative",A.style.overflow="hidden";const O=px(A);O&&O.classList.add(y);const L=xx(A);L&&L.classList.add(b);const $=()=>{m.current=!1,e.current&&(e.current.style.isolation=""),M&&(M.style.zIndex=""),O&&O.classList.remove(y),L&&L.classList.remove(b),A.style.position="",A.style.overflow="",A.contains(B)&&A.removeChild(B)};B.style.pointerEvents="none",B.style.position="absolute",B.style.overflow="hidden",B.setAttribute("aria-hidden","true");const U=oG(B);U&&(U.style.opacity="0");const I=px(B);I&&(I.classList.add(x?n[oa.caption_before_exit]:n[oa.caption_after_exit]),I.addEventListener("animationend",$));const G=xx(B);G&&G.classList.add(x?n[oa.weeks_before_exit]:n[oa.weeks_after_exit]),A.insertBefore(B,A.firstChild)})}})}function uG(e,t,n,a){const l=e[0],o=e[e.length-1],{ISOWeek:c,fixedWeeks:d,broadcastCalendar:m}=n??{},{addDays:f,differenceInCalendarDays:p,differenceInCalendarMonths:x,endOfBroadcastWeek:y,endOfISOWeek:b,endOfMonth:N,endOfWeek:k,isAfter:S,startOfBroadcastWeek:T,startOfISOWeek:M,startOfWeek:A}=a,R=m?T(l,a):c?M(l):A(l),B=m?y(o):c?b(N(o)):k(N(o)),O=p(B,R),L=x(o,l)+1,$=[];for(let G=0;G<=O;G++){const ee=f(R,G);if(t&&S(ee,t))break;$.push(ee)}const I=(m?35:42)*L;if(d&&$.length{const l=a.weeks.reduce((o,c)=>o.concat(c.days.slice()),t.slice());return n.concat(l.slice())},t.slice())}function mG(e,t,n,a){const{numberOfMonths:l=1}=n,o=[];for(let c=0;ct)break;o.push(d)}return o}function _5(e,t,n,a){const{month:l,defaultMonth:o,today:c=a.today(),numberOfMonths:d=1}=e;let m=l||o||c;const{differenceInCalendarMonths:f,addMonths:p,startOfMonth:x}=a;if(n&&f(n,m){const T=n.broadcastCalendar?x(S,a):n.ISOWeek?y(S):b(S),M=n.broadcastCalendar?o(S):n.ISOWeek?c(d(S)):m(d(S)),A=t.filter(L=>L>=T&&L<=M),R=n.broadcastCalendar?35:42;if(n.fixedWeeks&&A.length{const U=R-A.length;return $>M&&$<=l(M,U)});A.push(...L)}const B=A.reduce((L,$)=>{const U=n.ISOWeek?f($):p($),I=L.find(ee=>ee.weekNumber===U),G=new MN($,S,a);return I?I.days.push(G):L.push(new rV(U,[G])),L},[]),O=new nV(S,B);return k.push(O),k},[]);return n.reverseMonths?N.reverse():N}function fG(e,t){let{startMonth:n,endMonth:a}=e;const{startOfYear:l,startOfDay:o,startOfMonth:c,endOfMonth:d,addYears:m,endOfYear:f,newDate:p,today:x}=t,{fromYear:y,toYear:b,fromMonth:N,toMonth:k}=e;!n&&N&&(n=N),!n&&y&&(n=t.newDate(y,0,1)),!a&&k&&(a=k),!a&&b&&(a=p(b,11,31));const S=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return n?n=c(n):y?n=p(y,0,1):!n&&S&&(n=l(m(e.today??x(),-100))),a?a=d(a):b?a=p(b,11,31):!a&&S&&(a=f(e.today??x())),[n&&o(n),a&&o(a)]}function pG(e,t,n,a){if(n.disableNavigation)return;const{pagedNavigation:l,numberOfMonths:o=1}=n,{startOfMonth:c,addMonths:d,differenceInCalendarMonths:m}=a,f=l?o:1,p=c(e);if(!t)return d(p,f);if(!(m(t,e)n.concat(a.weeks.slice()),t.slice())}function eh(e,t){const[n,a]=w.useState(e);return[t===void 0?n:t,a]}function vG(e,t){const[n,a]=fG(e,t),{startOfMonth:l,endOfMonth:o}=t,c=_5(e,n,a,t),[d,m]=eh(c,e.month?c:void 0);w.useEffect(()=>{const O=_5(e,n,a,t);m(O)},[e.timeZone]);const f=mG(d,a,e,t),p=uG(f,e.endMonth?o(e.endMonth):void 0,e,t),x=hG(f,p,e,t),y=gG(x),b=dG(x),N=xG(d,n,e,t),k=pG(d,a,e,t),{disableNavigation:S,onMonthChange:T}=e,M=O=>y.some(L=>L.days.some($=>$.isEqualTo(O))),A=O=>{if(S)return;let L=l(O);n&&Ll(a)&&(L=l(a)),m(L),T?.(L)};return{months:x,weeks:y,days:b,navStart:n,navEnd:a,previousMonth:N,nextMonth:k,goToMonth:A,goToDay:O=>{M(O)||A(O.date)}}}var Qa;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(Qa||(Qa={}));function E5(e){return!e[En.disabled]&&!e[En.hidden]&&!e[En.outside]}function yG(e,t,n,a){let l,o=-1;for(const c of e){const d=t(c);E5(d)&&(d[En.focused]&&oE5(t(c)))),l}function bG(e,t,n,a,l,o,c){const{ISOWeek:d,broadcastCalendar:m}=o,{addDays:f,addMonths:p,addWeeks:x,addYears:y,endOfBroadcastWeek:b,endOfISOWeek:N,endOfWeek:k,max:S,min:T,startOfBroadcastWeek:M,startOfISOWeek:A,startOfWeek:R}=c;let O={day:f,week:x,month:p,year:y,startOfWeek:L=>m?M(L,c):d?A(L):R(L),endOfWeek:L=>m?b(L):d?N(L):k(L)}[e](n,t==="after"?1:-1);return t==="before"&&a?O=S([a,O]):t==="after"&&l&&(O=T([l,O])),O}function qN(e,t,n,a,l,o,c,d=0){if(d>365)return;const m=bG(e,t,n.date,a,l,o,c),f=!!(o.disabled&&Os(m,o.disabled,c)),p=!!(o.hidden&&Os(m,o.hidden,c)),x=m,y=new MN(m,x,c);return!f&&!p?y:qN(e,t,y,a,l,o,c,d+1)}function wG(e,t,n,a,l){const{autoFocus:o}=e,[c,d]=w.useState(),m=yG(t.days,n,a||(()=>!1),c),[f,p]=w.useState(o?m:void 0);return{isFocusTarget:k=>!!m?.isEqualTo(k),setFocused:p,focused:f,blur:()=>{d(f),p(void 0)},moveFocus:(k,S)=>{if(!f)return;const T=qN(k,S,f,t.navStart,t.navEnd,e,l);T&&(e.disableNavigation&&!t.days.some(A=>A.isEqualTo(T))||(t.goToDay(T),p(T)))}}}function jG(e,t){const{selected:n,required:a,onSelect:l}=e,[o,c]=eh(n,l?n:void 0),d=l?n:o,{isSameDay:m}=t,f=b=>d?.some(N=>m(N,b))??!1,{min:p,max:x}=e;return{selected:d,select:(b,N,k)=>{let S=[...d??[]];if(f(b)){if(d?.length===p||a&&d?.length===1)return;S=d?.filter(T=>!m(T,b))}else d?.length===x?S=[b]:S=[...S,b];return l||c(S),l?.(S,b,N,k),S},isSelected:f}}function NG(e,t,n=0,a=0,l=!1,o=us){const{from:c,to:d}=t||{},{isSameDay:m,isAfter:f,isBefore:p}=o;let x;if(!c&&!d)x={from:e,to:n>0?void 0:e};else if(c&&!d)m(c,e)?n===0?x={from:c,to:e}:l?x={from:c,to:void 0}:x=void 0:p(e,c)?x={from:e,to:c}:x={from:c,to:e};else if(c&&d)if(m(c,e)&&m(d,e))l?x={from:c,to:d}:x=void 0;else if(m(c,e))x={from:c,to:n>0?void 0:e};else if(m(d,e))x={from:e,to:n>0?void 0:e};else if(p(e,c))x={from:e,to:d};else if(f(e,c))x={from:c,to:e};else if(f(e,d))x={from:c,to:e};else throw new Error("Invalid range");if(x?.from&&x?.to){const y=o.differenceInCalendarDays(x.to,x.from);a>0&&y>a?x={from:e,to:void 0}:n>1&&ytypeof d!="function").some(d=>typeof d=="boolean"?d:n.isDate(d)?zs(e,d,!1,n):LN(d,n)?d.some(m=>zs(e,m,!1,n)):Dg(d)?d.from&&d.to?M5(e,{from:d.from,to:d.to},n):!1:RN(d)?SG(e,d.dayOfWeek,n):DN(d)?n.isAfter(d.before,d.after)?M5(e,{from:n.addDays(d.after,1),to:n.addDays(d.before,-1)},n):Os(e.from,d,n)||Os(e.to,d,n):zN(d)||ON(d)?Os(e.from,d,n)||Os(e.to,d,n):!1))return!0;const c=a.filter(d=>typeof d=="function");if(c.length){let d=e.from;const m=n.differenceInCalendarDays(e.to,e.from);for(let f=0;f<=m;f++){if(c.some(p=>p(d)))return!0;d=n.addDays(d,1)}}return!1}function CG(e,t){const{disabled:n,excludeDisabled:a,selected:l,required:o,onSelect:c}=e,[d,m]=eh(l,c?l:void 0),f=c?l:d;return{selected:f,select:(y,b,N)=>{const{min:k,max:S}=e,T=y?NG(y,f,k,S,o,t):void 0;return a&&n&&T?.from&&T.to&&kG({from:T.from,to:T.to},n,t)&&(T.from=y,T.to=void 0),c||m(T),c?.(T,y,b,N),T},isSelected:y=>f&&zs(f,y,!1,t)}}function TG(e,t){const{selected:n,required:a,onSelect:l}=e,[o,c]=eh(n,l?n:void 0),d=l?n:o,{isSameDay:m}=t;return{selected:d,select:(x,y,b)=>{let N=x;return!a&&d&&d&&m(x,d)&&(N=void 0),l||c(N),l?.(N,x,y,b),N},isSelected:x=>d?m(d,x):!1}}function _G(e,t){const n=TG(e,t),a=jG(e,t),l=CG(e,t);switch(e.mode){case"single":return n;case"multiple":return a;case"range":return l;default:return}}function EG(e){let t=e;t.timeZone&&(t={...e},t.today&&(t.today=new vr(t.today,t.timeZone)),t.month&&(t.month=new vr(t.month,t.timeZone)),t.defaultMonth&&(t.defaultMonth=new vr(t.defaultMonth,t.timeZone)),t.startMonth&&(t.startMonth=new vr(t.startMonth,t.timeZone)),t.endMonth&&(t.endMonth=new vr(t.endMonth,t.timeZone)),t.mode==="single"&&t.selected?t.selected=new vr(t.selected,t.timeZone):t.mode==="multiple"&&t.selected?t.selected=t.selected?.map(st=>new vr(st,t.timeZone)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?new vr(t.selected.from,t.timeZone):void 0,to:t.selected.to?new vr(t.selected.to,t.timeZone):void 0}));const{components:n,formatters:a,labels:l,dateLib:o,locale:c,classNames:d}=w.useMemo(()=>{const st={...Ag,...t.locale};return{dateLib:new ma({locale:st,weekStartsOn:t.broadcastCalendar?1:t.weekStartsOn,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},t.dateLib),components:zV(t.components),formatters:UV(t.formatters),labels:{...sG,...t.labels},locale:st,classNames:{...zg(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.components,t.formatters,t.labels,t.classNames]),{captionLayout:m,mode:f,navLayout:p,numberOfMonths:x=1,onDayBlur:y,onDayClick:b,onDayFocus:N,onDayKeyDown:k,onDayMouseEnter:S,onDayMouseLeave:T,onNextClick:M,onPrevClick:A,showWeekNumber:R,styles:B}=t,{formatCaption:O,formatDay:L,formatMonthDropdown:$,formatWeekNumber:U,formatWeekNumberHeader:I,formatWeekdayName:G,formatYearDropdown:ee}=a,Ne=vG(t,o),{days:J,months:se,navStart:H,navEnd:le,previousMonth:re,nextMonth:ge,goToMonth:E}=Ne,we=AV(J,t,H,le,o),{isSelected:Z,select:z,selected:X}=_G(t,o)??{},{blur:q,focused:ce,isFocusTarget:fe,moveFocus:De,setFocused:oe}=wG(t,Ne,we,Z??(()=>!1),o),{labelDayButton:He,labelGridcell:at,labelGrid:je,labelMonthDropdown:Ze,labelNav:qe,labelPrevious:Ot,labelNext:bn,labelWeekday:Dn,labelWeekNumber:Xe,labelWeekNumberHeader:wn,labelYearDropdown:Wn}=l,Ar=w.useMemo(()=>GV(o,t.ISOWeek),[o,t.ISOWeek]),Cn=f!==void 0||b!==void 0,cr=w.useCallback(()=>{re&&(E(re),A?.(re))},[re,E,A]),$e=w.useCallback(()=>{ge&&(E(ge),M?.(ge))},[E,ge,M]),Fn=w.useCallback((st,gn)=>ot=>{ot.preventDefault(),ot.stopPropagation(),oe(st),z?.(st.date,gn,ot),b?.(st.date,gn,ot)},[z,b,oe]),K=w.useCallback((st,gn)=>ot=>{oe(st),N?.(st.date,gn,ot)},[N,oe]),be=w.useCallback((st,gn)=>ot=>{q(),y?.(st.date,gn,ot)},[q,y]),Re=w.useCallback((st,gn)=>ot=>{const $t={ArrowLeft:[ot.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[ot.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[ot.shiftKey?"year":"week","after"],ArrowUp:[ot.shiftKey?"year":"week","before"],PageUp:[ot.shiftKey?"year":"month","before"],PageDown:[ot.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if($t[ot.key]){ot.preventDefault(),ot.stopPropagation();const[ar,bt]=$t[ot.key];De(ar,bt)}k?.(st.date,gn,ot)},[De,k,t.dir]),nt=w.useCallback((st,gn)=>ot=>{S?.(st.date,gn,ot)},[S]),kt=w.useCallback((st,gn)=>ot=>{T?.(st.date,gn,ot)},[T]),rr=w.useCallback(st=>gn=>{const ot=Number(gn.target.value),$t=o.setMonth(o.startOfMonth(st),ot);E($t)},[o,E]),Dr=w.useCallback(st=>gn=>{const ot=Number(gn.target.value),$t=o.setYear(o.startOfMonth(st),ot);E($t)},[o,E]),{className:pe,style:Ee}=w.useMemo(()=>({className:[d[Ke.Root],t.className].filter(Boolean).join(" "),style:{...B?.[Ke.Root],...t.style}}),[d,t.className,t.style,B]),dt=OV(t),mt=w.useRef(null);cG(mt,!!t.animate,{classNames:d,months:se,focused:ce,dateLib:o});const zr={dayPickerProps:t,selected:X,select:z,isSelected:Z,months:se,nextMonth:ge,previousMonth:re,goToMonth:E,getModifiers:we,components:n,classNames:d,styles:B,labels:l,formatters:a};return Fe.createElement(AN.Provider,{value:zr},Fe.createElement(n.Root,{rootRef:t.animate?mt:void 0,className:pe,style:Ee,dir:t.dir,id:t.id,lang:t.lang,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...dt},Fe.createElement(n.Months,{className:d[Ke.Months],style:B?.[Ke.Months]},!t.hideNavigation&&!p&&Fe.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:d[Ke.Nav],style:B?.[Ke.Nav],"aria-label":qe(),onPreviousClick:cr,onNextClick:$e,previousMonth:re,nextMonth:ge}),se.map((st,gn)=>Fe.createElement(n.Month,{"data-animated-month":t.animate?"true":void 0,className:d[Ke.Month],style:B?.[Ke.Month],key:gn,displayIndex:gn,calendarMonth:st},p==="around"&&!t.hideNavigation&&gn===0&&Fe.createElement(n.PreviousMonthButton,{type:"button",className:d[Ke.PreviousMonthButton],tabIndex:re?void 0:-1,"aria-disabled":re?void 0:!0,"aria-label":Ot(re),onClick:cr,"data-animated-button":t.animate?"true":void 0},Fe.createElement(n.Chevron,{disabled:re?void 0:!0,className:d[Ke.Chevron],orientation:t.dir==="rtl"?"right":"left"})),Fe.createElement(n.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:d[Ke.MonthCaption],style:B?.[Ke.MonthCaption],calendarMonth:st,displayIndex:gn},m?.startsWith("dropdown")?Fe.createElement(n.DropdownNav,{className:d[Ke.Dropdowns],style:B?.[Ke.Dropdowns]},(()=>{const ot=m==="dropdown"||m==="dropdown-months"?Fe.createElement(n.MonthsDropdown,{key:"month",className:d[Ke.MonthsDropdown],"aria-label":Ze(),classNames:d,components:n,disabled:!!t.disableNavigation,onChange:rr(st.date),options:$V(st.date,H,le,a,o),style:B?.[Ke.Dropdown],value:o.getMonth(st.date)}):Fe.createElement("span",{key:"month"},$(st.date,o)),$t=m==="dropdown"||m==="dropdown-years"?Fe.createElement(n.YearsDropdown,{key:"year",className:d[Ke.YearsDropdown],"aria-label":Wn(o.options),classNames:d,components:n,disabled:!!t.disableNavigation,onChange:Dr(st.date),options:YV(H,le,a,o,!!t.reverseYears),style:B?.[Ke.Dropdown],value:o.getYear(st.date)}):Fe.createElement("span",{key:"year"},ee(st.date,o));return o.getMonthYearOrder()==="year-first"?[$t,ot]:[ot,$t]})(),Fe.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},O(st.date,o.options,o))):Fe.createElement(n.CaptionLabel,{className:d[Ke.CaptionLabel],role:"status","aria-live":"polite"},O(st.date,o.options,o))),p==="around"&&!t.hideNavigation&&gn===x-1&&Fe.createElement(n.NextMonthButton,{type:"button",className:d[Ke.NextMonthButton],tabIndex:ge?void 0:-1,"aria-disabled":ge?void 0:!0,"aria-label":bn(ge),onClick:$e,"data-animated-button":t.animate?"true":void 0},Fe.createElement(n.Chevron,{disabled:ge?void 0:!0,className:d[Ke.Chevron],orientation:t.dir==="rtl"?"left":"right"})),gn===x-1&&p==="after"&&!t.hideNavigation&&Fe.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:d[Ke.Nav],style:B?.[Ke.Nav],"aria-label":qe(),onPreviousClick:cr,onNextClick:$e,previousMonth:re,nextMonth:ge}),Fe.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":f==="multiple"||f==="range","aria-label":je(st.date,o.options,o)||void 0,className:d[Ke.MonthGrid],style:B?.[Ke.MonthGrid]},!t.hideWeekdays&&Fe.createElement(n.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:d[Ke.Weekdays],style:B?.[Ke.Weekdays]},R&&Fe.createElement(n.WeekNumberHeader,{"aria-label":wn(o.options),className:d[Ke.WeekNumberHeader],style:B?.[Ke.WeekNumberHeader],scope:"col"},I()),Ar.map(ot=>Fe.createElement(n.Weekday,{"aria-label":Dn(ot,o.options,o),className:d[Ke.Weekday],key:String(ot),style:B?.[Ke.Weekday],scope:"col"},G(ot,o.options,o)))),Fe.createElement(n.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:d[Ke.Weeks],style:B?.[Ke.Weeks]},st.weeks.map(ot=>Fe.createElement(n.Week,{className:d[Ke.Week],key:ot.weekNumber,style:B?.[Ke.Week],week:ot},R&&Fe.createElement(n.WeekNumber,{week:ot,style:B?.[Ke.WeekNumber],"aria-label":Xe(ot.weekNumber,{locale:c}),className:d[Ke.WeekNumber],scope:"row",role:"rowheader"},U(ot.weekNumber,o)),ot.days.map($t=>{const{date:ar}=$t,bt=we($t);if(bt[En.focused]=!bt.hidden&&!!ce?.isEqualTo($t),bt[Fa.selected]=Z?.(ar)||bt.selected,Dg(X)){const{from:Di,to:Il}=X;bt[Fa.range_start]=!!(Di&&Il&&o.isSameDay(ar,Di)),bt[Fa.range_end]=!!(Di&&Il&&o.isSameDay(ar,Il)),bt[Fa.range_middle]=zs(X,ar,!0,o)}const Ai=VV(bt,B,t.modifiersStyles),Fl=DV(bt,d,t.modifiersClassNames),sh=!Cn&&!bt.hidden?at(ar,bt,o.options,o):void 0;return Fe.createElement(n.Day,{key:`${o.format(ar,"yyyy-MM-dd")}_${o.format($t.displayMonth,"yyyy-MM")}`,day:$t,modifiers:bt,className:Fl.join(" "),style:Ai,role:"gridcell","aria-selected":bt.selected||void 0,"aria-label":sh,"data-day":o.format(ar,"yyyy-MM-dd"),"data-month":$t.outside?o.format(ar,"yyyy-MM"):void 0,"data-selected":bt.selected||void 0,"data-disabled":bt.disabled||void 0,"data-hidden":bt.hidden||void 0,"data-outside":$t.outside||void 0,"data-focused":bt.focused||void 0,"data-today":bt.today||void 0},!bt.hidden&&Cn?Fe.createElement(n.DayButton,{className:d[Ke.DayButton],style:B?.[Ke.DayButton],type:"button",day:$t,modifiers:bt,disabled:bt.disabled||void 0,tabIndex:fe($t)?0:-1,"aria-label":He(ar,bt,o.options,o),onClick:Fn($t,bt),onBlur:be($t,bt),onFocus:K($t,bt),onKeyDown:Re($t,bt),onMouseEnter:nt($t,bt),onMouseLeave:kt($t,bt)},L(ar,o.options,o)):!bt.hidden&&L($t.date,o.options,o))})))))))),t.footer&&Fe.createElement(n.Footer,{className:d[Ke.Footer],style:B?.[Ke.Footer],role:"status","aria-live":"polite"},t.footer)))}function A5({className:e,classNames:t,showOutsideDays:n=!0,captionLayout:a="label",buttonVariant:l="ghost",formatters:o,components:c,...d}){const m=zg();return r.jsx(EG,{showOutsideDays:n,className:he("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:a,formatters:{formatMonthDropdown:f=>f.toLocaleString("default",{month:"short"}),...o},classNames:{root:he("w-fit",m.root),months:he("relative flex flex-col gap-4 md:flex-row",m.months),month:he("flex w-full flex-col gap-4",m.month),nav:he("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",m.nav),button_previous:he(gu({variant:l}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",m.button_previous),button_next:he(gu({variant:l}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",m.button_next),month_caption:he("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",m.month_caption),dropdowns:he("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",m.dropdowns),dropdown_root:he("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",m.dropdown_root),dropdown:he("bg-popover absolute inset-0 opacity-0",m.dropdown),caption_label:he("select-none font-medium",a==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",m.caption_label),table:"w-full border-collapse",weekdays:he("flex",m.weekdays),weekday:he("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",m.weekday),week:he("mt-2 flex w-full",m.week),week_number_header:he("w-[--cell-size] select-none",m.week_number_header),week_number:he("text-muted-foreground select-none text-[0.8rem]",m.week_number),day:he("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",m.day),range_start:he("bg-accent rounded-l-md",m.range_start),range_middle:he("rounded-none",m.range_middle),range_end:he("bg-accent rounded-r-md",m.range_end),today:he("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",m.today),outside:he("text-muted-foreground aria-selected:text-muted-foreground",m.outside),disabled:he("text-muted-foreground opacity-50",m.disabled),hidden:he("invisible",m.hidden),...t},components:{Root:({className:f,rootRef:p,...x})=>r.jsx("div",{"data-slot":"calendar",ref:p,className:he(f),...x}),Chevron:({className:f,orientation:p,...x})=>p==="left"?r.jsx(bi,{className:he("size-4",f),...x}):p==="right"?r.jsx(wi,{className:he("size-4",f),...x}):r.jsx(pu,{className:he("size-4",f),...x}),DayButton:MG,WeekNumber:({children:f,...p})=>r.jsx("td",{...p,children:r.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:f})}),...c},...d})}function MG({className:e,day:t,modifiers:n,...a}){const l=zg(),o=w.useRef(null);return w.useEffect(()=>{n.focused&&o.current?.focus()},[n.focused]),r.jsx(ne,{ref:o,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:he("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",l.day,e),...a})}class AG{ws=null;reconnectTimeout=null;reconnectAttempts=0;maxReconnectAttempts=10;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];maxCacheSize=1e3;getWebSocketUrl(){{const t=window.location.protocol==="https:"?"wss:":"ws:",n=window.location.host;return`${t}//${n}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const t=this.getWebSocketUrl();try{this.ws=new WebSocket(t),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=n=>{try{if(n.data==="pong")return;const a=JSON.parse(n.data);this.notifyLog(a)}catch(a){console.error("解析日志消息失败:",a)}},this.ws.onerror=n=>{console.error("❌ WebSocket 错误:",n),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(n){console.error("创建 WebSocket 连接失败:",n),this.attemptReconnect()}}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return;this.reconnectAttempts+=1;const t=Math.min(1e3*this.reconnectAttempts,1e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},t)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(t){return this.logCallbacks.add(t),()=>this.logCallbacks.delete(t)}onConnectionChange(t){return this.connectionCallbacks.add(t),t(this.isConnected),()=>this.connectionCallbacks.delete(t)}notifyLog(t){this.logCache.some(a=>a.id===t.id)||(this.logCache.push(t),this.logCache.length>this.maxCacheSize&&(this.logCache=this.logCache.slice(-this.maxCacheSize)),this.logCallbacks.forEach(a=>{try{a(t)}catch(l){console.error("日志回调执行失败:",l)}}))}notifyConnection(t){this.connectionCallbacks.forEach(n=>{try{n(t)}catch(a){console.error("连接状态回调执行失败:",a)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const Eo=new AG;typeof window<"u"&&Eo.connect();const DG={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},zG=(e,t,n)=>{let a;const l=DG[e];return typeof l=="string"?a=l:t===1?a=l.one:a=l.other.replace("{{count}}",String(t)),n?.addSuffix?n.comparison&&n.comparison>0?a+"内":a+"前":a},OG={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},RG={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},LG={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},BG={date:Lo({formats:OG,defaultWidth:"full"}),time:Lo({formats:RG,defaultWidth:"full"}),dateTime:Lo({formats:LG,defaultWidth:"full"})};function D5(e,t,n){const a="eeee p";return W$(e,t,n)?a:e.getTime()>t.getTime()?"'下个'"+a:"'上个'"+a}const PG={lastWeek:D5,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:D5,other:"PP p"},FG=(e,t,n,a)=>{const l=PG[e];return typeof l=="function"?l(t,n,a):l},IG={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},qG={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},HG={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},UG={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},$G={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},VG={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},GG=(e,t)=>{const n=Number(e);switch(t?.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},YG={ordinalNumber:GG,era:Ja({values:IG,defaultWidth:"wide"}),quarter:Ja({values:qG,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Ja({values:HG,defaultWidth:"wide"}),day:Ja({values:UG,defaultWidth:"wide"}),dayPeriod:Ja({values:$G,defaultWidth:"wide",formattingValues:VG,defaultFormattingWidth:"wide"})},WG=/^(第\s*)?\d+(日|时|分|秒)?/i,XG=/\d+/i,KG={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},QG={any:[/^(前)/i,/^(公元)/i]},ZG={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},JG={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},eY={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},tY={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},nY={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},rY={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},aY={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},sY={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},lY={ordinalNumber:SN({matchPattern:WG,parsePattern:XG,valueCallback:e=>parseInt(e,10)}),era:es({matchPatterns:KG,defaultMatchWidth:"wide",parsePatterns:QG,defaultParseWidth:"any"}),quarter:es({matchPatterns:ZG,defaultMatchWidth:"wide",parsePatterns:JG,defaultParseWidth:"any",valueCallback:e=>e+1}),month:es({matchPatterns:eY,defaultMatchWidth:"wide",parsePatterns:tY,defaultParseWidth:"any"}),day:es({matchPatterns:nY,defaultMatchWidth:"wide",parsePatterns:rY,defaultParseWidth:"any"}),dayPeriod:es({matchPatterns:aY,defaultMatchWidth:"any",parsePatterns:sY,defaultParseWidth:"any"})},P0={code:"zh-CN",formatDistance:zG,formatLong:BG,formatRelative:FG,localize:YG,match:lY,options:{weekStartsOn:1,firstWeekContainsDate:4}};function iY(){const[e,t]=w.useState([]),[n,a]=w.useState(""),[l,o]=w.useState("all"),[c,d]=w.useState("all"),[m,f]=w.useState(void 0),[p,x]=w.useState(void 0),[y,b]=w.useState(!0),[N,k]=w.useState(!1),S=w.useRef(null),T=w.useRef(null);w.useEffect(()=>{const G=Eo.getAllLogs();t(G);const ee=Eo.onLog(()=>{t(Eo.getAllLogs())}),Ne=Eo.onConnectionChange(J=>{k(J)});return()=>{ee(),Ne()}},[]),w.useEffect(()=>{y&&T.current&&T.current.scrollIntoView({behavior:"smooth",block:"end"})},[e,y]);const M=w.useMemo(()=>{const G=new Set(e.map(ee=>ee.module));return Array.from(G).sort()},[e]),A=G=>{switch(G){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},R=G=>{switch(G){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},B=()=>{window.location.reload()},O=()=>{Eo.clearLogs(),t([])},L=()=>{const G=I.map(se=>`${se.timestamp} [${se.level.padEnd(8)}] [${se.module}] ${se.message}`).join(` -`),ee=new Blob([G],{type:"text/plain;charset=utf-8"}),Ne=URL.createObjectURL(ee),J=document.createElement("a");J.href=Ne,J.download=`logs-${Z0(new Date,"yyyy-MM-dd-HHmmss")}.txt`,J.click(),URL.revokeObjectURL(Ne)},$=()=>{b(!y)},U=()=>{f(void 0),x(void 0)},I=w.useMemo(()=>e.filter(G=>{const ee=n===""||G.message.toLowerCase().includes(n.toLowerCase())||G.module.toLowerCase().includes(n.toLowerCase()),Ne=l==="all"||G.level===l,J=c==="all"||G.module===c;let se=!0;if(m||p){const H=new Date(G.timestamp);if(m){const le=new Date(m);le.setHours(0,0,0,0),se=se&&H>=le}if(p){const le=new Date(p);le.setHours(23,59,59,999),se=se&&H<=le}}return ee&&Ne&&J&&se}),[e,n,l,c,m,p]);return r.jsx(an,{className:"h-full",children:r.jsxs("div",{className:"space-y-4 p-3 sm:p-4 lg:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),r.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:he("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",N?"bg-green-500 animate-pulse":"bg-red-500")}),r.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:N?"已连接":"未连接"})]})]}),r.jsx(ct,{className:"p-3 sm:p-4",children:r.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[r.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[r.jsxs("div",{className:"flex-1 relative",children:[r.jsx(Yr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{placeholder:"搜索日志...",value:n,onChange:G=>a(G.target.value),className:"pl-9 h-9 text-sm"})]}),r.jsxs(_t,{value:l,onValueChange:o,children:[r.jsxs(jt,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[r.jsx(Sx,{className:"h-4 w-4 mr-2"}),r.jsx(Et,{placeholder:"级别"})]}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"all",children:"全部级别"}),r.jsx(Oe,{value:"DEBUG",children:"DEBUG"}),r.jsx(Oe,{value:"INFO",children:"INFO"}),r.jsx(Oe,{value:"WARNING",children:"WARNING"}),r.jsx(Oe,{value:"ERROR",children:"ERROR"}),r.jsx(Oe,{value:"CRITICAL",children:"CRITICAL"})]})]}),r.jsxs(_t,{value:c,onValueChange:d,children:[r.jsxs(jt,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[r.jsx(Sx,{className:"h-4 w-4 mr-2"}),r.jsx(Et,{placeholder:"模块"})]}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"all",children:"全部模块"}),M.map(G=>r.jsx(Oe,{value:G,children:G},G))]})]})]}),r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[r.jsxs(Cl,{children:[r.jsx(Tl,{asChild:!0,children:r.jsxs(ne,{variant:"outline",size:"sm",className:he("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!m&&"text-muted-foreground"),children:[r.jsx(Yy,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"text-xs sm:text-sm",children:m?Z0(m,"PPP",{locale:P0}):"开始日期"})]})}),r.jsx(Ps,{className:"w-auto p-0",align:"start",children:r.jsx(A5,{mode:"single",selected:m,onSelect:f,initialFocus:!0,locale:P0})})]}),r.jsxs(Cl,{children:[r.jsx(Tl,{asChild:!0,children:r.jsxs(ne,{variant:"outline",size:"sm",className:he("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!p&&"text-muted-foreground"),children:[r.jsx(Yy,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"text-xs sm:text-sm",children:p?Z0(p,"PPP",{locale:P0}):"结束日期"})]})}),r.jsx(Ps,{className:"w-auto p-0",align:"start",children:r.jsx(A5,{mode:"single",selected:p,onSelect:x,initialFocus:!0,locale:P0})})]}),(m||p)&&r.jsxs(ne,{variant:"outline",size:"sm",onClick:U,className:"w-full sm:w-auto h-9",children:[r.jsx(Au,{className:"h-4 w-4 sm:mr-2"}),r.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),r.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(ne,{variant:y?"default":"outline",size:"sm",onClick:$,className:"flex-1 sm:flex-none h-9",children:[y?r.jsx(_T,{className:"h-4 w-4"}):r.jsx(ET,{className:"h-4 w-4"}),r.jsx("span",{className:"ml-2 text-sm",children:y?"自动滚动":"已暂停"})]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:B,className:"flex-1 sm:flex-none h-9",children:[r.jsx(Ia,{className:"h-4 w-4"}),r.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:O,className:"flex-1 sm:flex-none h-9",children:[r.jsx(zt,{className:"h-4 w-4"}),r.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:L,className:"flex-1 sm:flex-none h-9",children:[r.jsx(hi,{className:"h-4 w-4"}),r.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),r.jsx("div",{className:"flex-1 hidden sm:block"}),r.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[r.jsxs("span",{className:"font-mono",children:[I.length," / ",e.length]}),r.jsx("span",{className:"ml-1",children:"条日志"})]})]})]})}),r.jsx(ct,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900",children:r.jsx(an,{className:"h-[calc(100vh-280px)] sm:h-[calc(100vh-320px)] lg:h-[calc(100vh-400px)]",children:r.jsxs("div",{ref:S,className:"p-2 sm:p-3 lg:p-4 font-mono text-xs sm:text-sm space-y-1",children:[I.length===0?r.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):I.map(G=>r.jsxs("div",{className:he("py-2 px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",R(G.level)),children:[r.jsxs("div",{className:"flex flex-col gap-1 sm:hidden",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-gray-500 dark:text-gray-600 text-xs",children:G.timestamp}),r.jsxs("span",{className:he("text-xs font-semibold",A(G.level)),children:["[",G.level,"]"]})]}),r.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 text-xs truncate",children:G.module}),r.jsx("div",{className:"text-gray-300 dark:text-gray-400 text-xs break-all",children:G.message})]}),r.jsxs("div",{className:"hidden sm:flex gap-3 items-start",children:[r.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[140px] lg:w-[180px] text-xs lg:text-sm",children:G.timestamp}),r.jsxs("span",{className:he("flex-shrink-0 w-[70px] lg:w-[80px] font-semibold text-xs lg:text-sm",A(G.level)),children:["[",G.level,"]"]}),r.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[120px] lg:w-[150px] truncate text-xs lg:text-sm",children:G.module}),r.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 break-all text-xs lg:text-sm",children:G.message})]})]},G.id)),r.jsx("div",{ref:T,className:"h-4"})]})})})]})})}const oY="Mai-with-u",cY="plugin-repo",uY="main",dY="plugin_details.json";async function mY(){try{const e=await lt("/api/webui/plugins/fetch-raw",{method:"POST",headers:pt(),body:JSON.stringify({owner:oY,repo:cY,branch:uY,file_path:dY})});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const t=await e.json();if(!t.success||!t.data)throw new Error(t.error||"获取插件列表失败");return JSON.parse(t.data).filter(l=>!l?.id||!l?.manifest?(console.warn("跳过无效插件数据:",l),!1):!l.manifest.name||!l.manifest.version?(console.warn("跳过缺少必需字段的插件:",l.id),!1):!0).map(l=>({id:l.id,manifest:{manifest_version:l.manifest.manifest_version||1,name:l.manifest.name,version:l.manifest.version,description:l.manifest.description||"",author:l.manifest.author||{name:"Unknown"},license:l.manifest.license||"Unknown",host_application:l.manifest.host_application||{min_version:"0.0.0"},homepage_url:l.manifest.homepage_url,repository_url:l.manifest.repository_url,keywords:l.manifest.keywords||[],categories:l.manifest.categories||[],default_locale:l.manifest.default_locale||"zh-CN",locales_path:l.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(e){throw console.error("Failed to fetch plugin list:",e),e}}async function hY(){try{const e=await lt("/api/webui/plugins/git-status");if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch(e){return console.error("Failed to check Git status:",e),{installed:!1,error:"无法检测 Git 安装状态"}}}async function fY(){try{const e=await lt("/api/webui/plugins/version");if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch(e){return console.error("Failed to get Maimai version:",e),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function pY(e,t,n){const a=e.split(".").map(d=>parseInt(d)||0),l=a[0]||0,o=a[1]||0,c=a[2]||0;if(n.version_majorparseInt(x)||0),m=d[0]||0,f=d[1]||0,p=d[2]||0;if(n.version_major>m||n.version_major===m&&n.version_minor>f||n.version_major===m&&n.version_minor===f&&n.version_patch>p)return!1}return!0}function xY(e,t){const n=window.location.protocol==="https:"?"wss:":"ws:",a=window.location.host,l=new WebSocket(`${n}//${a}/api/webui/ws/plugin-progress`);return l.onopen=()=>{console.log("Plugin progress WebSocket connected");const o=setInterval(()=>{l.readyState===WebSocket.OPEN?l.send("ping"):clearInterval(o)},3e4)},l.onmessage=o=>{try{if(o.data==="pong")return;const c=JSON.parse(o.data);e(c)}catch(c){console.error("Failed to parse progress data:",c)}},l.onerror=o=>{console.error("Plugin progress WebSocket error:",o),t?.(o)},l.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},l}async function F0(){try{const e=await lt("/api/webui/plugins/installed",{headers:pt()});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const t=await e.json();if(!t.success)throw new Error(t.message||"获取已安装插件列表失败");return t.plugins||[]}catch(e){return console.error("Failed to get installed plugins:",e),[]}}function I0(e,t){return t.some(n=>n.id===e)}function q0(e,t){const n=t.find(a=>a.id===e);if(n)return n.manifest?.version||n.version}async function gY(e,t,n="main"){const a=await lt("/api/webui/plugins/install",{method:"POST",headers:pt(),body:JSON.stringify({plugin_id:e,repository_url:t,branch:n})});if(!a.ok){const l=await a.json();throw new Error(l.detail||"安装失败")}return await a.json()}async function vY(e){const t=await lt("/api/webui/plugins/uninstall",{method:"POST",headers:pt(),body:JSON.stringify({plugin_id:e})});if(!t.ok){const n=await t.json();throw new Error(n.detail||"卸载失败")}return await t.json()}async function yY(e,t,n="main"){const a=await lt("/api/webui/plugins/update",{method:"POST",headers:pt(),body:JSON.stringify({plugin_id:e,repository_url:t,branch:n})});if(!a.ok){const l=await a.json();throw new Error(l.detail||"更新失败")}return await a.json()}const ed="https://maibot-plugin-stats.maibot-webui.workers.dev";async function HN(e){try{const t=await fetch(`${ed}/stats/${e}`);return t.ok?await t.json():(console.error("Failed to fetch plugin stats:",t.statusText),null)}catch(t){return console.error("Error fetching plugin stats:",t),null}}async function bY(e,t){try{const n=t||Og(),a=await fetch(`${ed}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:e,user_id:n})}),l=await a.json();return a.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:a.ok?{success:!0,...l}:{success:!1,error:l.error||"点赞失败"}}catch(n){return console.error("Error liking plugin:",n),{success:!1,error:"网络错误"}}}async function wY(e,t){try{const n=t||Og(),a=await fetch(`${ed}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:e,user_id:n})}),l=await a.json();return a.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:a.ok?{success:!0,...l}:{success:!1,error:l.error||"点踩失败"}}catch(n){return console.error("Error disliking plugin:",n),{success:!1,error:"网络错误"}}}async function jY(e,t,n,a){if(t<1||t>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const l=a||Og(),o=await fetch(`${ed}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:e,rating:t,comment:n,user_id:l})}),c=await o.json();return o.status===429?{success:!1,error:"每天最多评分 3 次"}:o.ok?{success:!0,...c}:{success:!1,error:c.error||"评分失败"}}catch(l){return console.error("Error rating plugin:",l),{success:!1,error:"网络错误"}}}async function NY(e){try{const t=await fetch(`${ed}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:e})}),n=await t.json();return t.status===429?(console.warn("Download recording rate limited"),{success:!0}):t.ok?{success:!0,...n}:(console.error("Failed to record download:",n.error),{success:!1,error:n.error})}catch(t){return console.error("Error recording download:",t),{success:!1,error:"网络错误"}}}function SY(){const e=navigator,t=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,e.deviceMemory||0].join("|");let n=0;for(let a=0;a{o(!0);const T=await HN(e);T&&a(T),o(!1)};w.useEffect(()=>{b()},[e]);const N=async()=>{const T=await bY(e);T.success?(y({title:"已点赞",description:"感谢你的支持!"}),b()):y({title:"点赞失败",description:T.error||"未知错误",variant:"destructive"})},k=async()=>{const T=await wY(e);T.success?(y({title:"已反馈",description:"感谢你的反馈!"}),b()):y({title:"操作失败",description:T.error||"未知错误",variant:"destructive"})},S=async()=>{if(c===0){y({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const T=await jY(e,c,m||void 0);T.success?(y({title:"评分成功",description:"感谢你的评价!"}),x(!1),d(0),f(""),b()):y({title:"评分失败",description:T.error||"未知错误",variant:"destructive"})};return l?r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(hi,{className:"h-4 w-4"}),r.jsx("span",{children:"-"})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(wl,{className:"h-4 w-4"}),r.jsx("span",{children:"-"})]})]}):n?t?r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${n.downloads.toLocaleString()}`,children:[r.jsx(hi,{className:"h-4 w-4"}),r.jsx("span",{children:n.downloads.toLocaleString()})]}),r.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${n.rating.toFixed(1)} (${n.rating_count} 条评价)`,children:[r.jsx(wl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),r.jsx("span",{children:n.rating.toFixed(1)})]}),r.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${n.likes}`,children:[r.jsx(yp,{className:"h-4 w-4"}),r.jsx("span",{children:n.likes})]})]}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[r.jsx(hi,{className:"h-5 w-5 text-muted-foreground mb-1"}),r.jsx("span",{className:"text-2xl font-bold",children:n.downloads.toLocaleString()}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),r.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[r.jsx(wl,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),r.jsx("span",{className:"text-2xl font-bold",children:n.rating.toFixed(1)}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.rating_count," 条评价"]})]}),r.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[r.jsx(yp,{className:"h-5 w-5 text-green-500 mb-1"}),r.jsx("span",{className:"text-2xl font-bold",children:n.likes}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),r.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[r.jsx(Wy,{className:"h-5 w-5 text-red-500 mb-1"}),r.jsx("span",{className:"text-2xl font-bold",children:n.dislikes}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ne,{variant:"outline",size:"sm",onClick:N,children:[r.jsx(yp,{className:"h-4 w-4 mr-1"}),"点赞"]}),r.jsxs(ne,{variant:"outline",size:"sm",onClick:k,children:[r.jsx(Wy,{className:"h-4 w-4 mr-1"}),"点踩"]}),r.jsxs(ir,{open:p,onOpenChange:x,children:[r.jsx(I1,{asChild:!0,children:r.jsxs(ne,{variant:"default",size:"sm",children:[r.jsx(wl,{className:"h-4 w-4 mr-1"}),"评分"]})}),r.jsxs(Jn,{children:[r.jsxs(er,{children:[r.jsx(tr,{children:"为插件评分"}),r.jsx(xr,{children:"分享你的使用体验,帮助其他用户"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(T=>r.jsx("button",{onClick:()=>d(T),className:"focus:outline-none",children:r.jsx(wl,{className:`h-8 w-8 transition-colors ${T<=c?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},T))}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[c===0&&"点击星星进行评分",c===1&&"很差",c===2&&"一般",c===3&&"还行",c===4&&"不错",c===5&&"非常好"]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),r.jsx(fn,{value:m,onChange:T=>f(T.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),r.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[m.length," / 500"]})]})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>x(!1),children:"取消"}),r.jsx(ne,{onClick:S,disabled:c===0,children:"提交评分"})]})]})]})]}),n.recent_ratings&&n.recent_ratings.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),r.jsx("div",{className:"space-y-3",children:n.recent_ratings.map((T,M)=>r.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(A=>r.jsx(wl,{className:`h-3 w-3 ${A<=T.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},A))}),r.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(T.created_at).toLocaleDateString()})]}),T.comment&&r.jsx("p",{className:"text-sm text-muted-foreground",children:T.comment})]},M))})]})]}):null}const z5={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function CY(){const e=as(),[t,n]=w.useState(null),[a,l]=w.useState(""),[o,c]=w.useState("all"),[d,m]=w.useState("all"),[f,p]=w.useState(!1),[x,y]=w.useState([]),[b,N]=w.useState(!0),[k,S]=w.useState(null),[T,M]=w.useState(null),[A,R]=w.useState(null),[B,O]=w.useState(null),[,L]=w.useState([]),[$,U]=w.useState({}),{toast:I}=or(),G=async E=>{const we=E.map(async X=>{try{const q=await HN(X.id);return{id:X.id,stats:q}}catch(q){return console.warn(`Failed to load stats for ${X.id}:`,q),{id:X.id,stats:null}}}),Z=await Promise.all(we),z={};Z.forEach(({id:X,stats:q})=>{q&&(z[X]=q)}),U(z)};w.useEffect(()=>{let E=null,we=!1;return(async()=>{if(E=xY(z=>{we||(R(z),z.stage==="success"?setTimeout(()=>{we||R(null)},2e3):z.stage==="error"&&(N(!1),S(z.error||"加载失败")))},z=>{console.error("WebSocket error:",z),we||I({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(z=>{if(!E){z();return}const X=()=>{E&&E.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),z()):E&&E.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),z()):setTimeout(X,100)};X()}),!we){const z=await hY();M(z),z.installed||I({title:"Git 未安装",description:z.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!we){const z=await fY();O(z)}if(!we)try{N(!0),S(null);const z=await mY();if(!we){const X=await F0();L(X);const q=z.map(ce=>{const fe=I0(ce.id,X),De=q0(ce.id,X);return{...ce,installed:fe,installed_version:De}});for(const ce of X)!q.some(De=>De.id===ce.id)&&ce.manifest&&q.push({id:ce.id,manifest:{manifest_version:ce.manifest.manifest_version||1,name:ce.manifest.name,version:ce.manifest.version,description:ce.manifest.description||"",author:ce.manifest.author,license:ce.manifest.license||"Unknown",host_application:ce.manifest.host_application,homepage_url:ce.manifest.homepage_url,repository_url:ce.manifest.repository_url,keywords:ce.manifest.keywords||[],categories:ce.manifest.categories||[],default_locale:ce.manifest.default_locale||"zh-CN",locales_path:ce.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:ce.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});y(q),G(q)}}catch(z){if(!we){const X=z instanceof Error?z.message:"加载插件列表失败";S(X),I({title:"加载失败",description:X,variant:"destructive"})}}finally{we||N(!1)}})(),()=>{we=!0,E&&E.close()}},[I]);const ee=E=>{if(!E.installed&&B&&!Ne(E))return r.jsxs(un,{variant:"destructive",className:"gap-1",children:[r.jsx(xi,{className:"h-3 w-3"}),"不兼容"]});if(E.installed){const we=E.installed_version?.trim(),Z=E.manifest.version?.trim();if(we!==Z){const z=we?.split(".").map(Number)||[0,0,0],X=Z?.split(".").map(Number)||[0,0,0];for(let q=0;q<3;q++){if((X[q]||0)>(z[q]||0))return r.jsxs(un,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[r.jsx(xi,{className:"h-3 w-3"}),"可更新"]});if((X[q]||0)<(z[q]||0))break}}return r.jsxs(un,{variant:"default",className:"gap-1",children:[r.jsx($r,{className:"h-3 w-3"}),"已安装"]})}return null},Ne=E=>!B||!E.manifest?.host_application?!0:pY(E.manifest.host_application.min_version,E.manifest.host_application.max_version,B),J=E=>{if(!E.installed||!E.installed_version||!E.manifest?.version)return!1;const we=E.installed_version.trim(),Z=E.manifest.version.trim();if(we===Z)return!1;const z=we.split(".").map(Number),X=Z.split(".").map(Number);for(let q=0;q<3;q++){if((X[q]||0)>(z[q]||0))return!0;if((X[q]||0)<(z[q]||0))return!1}return!1},se=x.filter(E=>{if(!E.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",E.id),!1;const we=a===""||E.manifest.name?.toLowerCase().includes(a.toLowerCase())||E.manifest.description?.toLowerCase().includes(a.toLowerCase())||E.manifest.keywords&&E.manifest.keywords.some(q=>q.toLowerCase().includes(a.toLowerCase())),Z=o==="all"||E.manifest.categories&&E.manifest.categories.includes(o);let z=!0;d==="installed"?z=E.installed===!0:d==="updates"&&(z=E.installed===!0&&J(E));const X=!f||!B||Ne(E);return we&&Z&&z&&X}),H=()=>{n(null)},le=async E=>{if(!T?.installed){I({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(B&&!Ne(E)){I({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await gY(E.id,E.manifest.repository_url||"","main"),NY(E.id).catch(Z=>{console.warn("Failed to record download:",Z)}),I({title:"安装成功",description:`${E.manifest.name} 已成功安装`});const we=await F0();L(we),y(Z=>Z.map(z=>{if(z.id===E.id){const X=I0(z.id,we),q=q0(z.id,we);return{...z,installed:X,installed_version:q}}return z}))}catch(we){I({title:"安装失败",description:we instanceof Error?we.message:"未知错误",variant:"destructive"})}},re=async E=>{try{await vY(E.id),I({title:"卸载成功",description:`${E.manifest.name} 已成功卸载`});const we=await F0();L(we),y(Z=>Z.map(z=>{if(z.id===E.id){const X=I0(z.id,we),q=q0(z.id,we);return{...z,installed:X,installed_version:q}}return z}))}catch(we){I({title:"卸载失败",description:we instanceof Error?we.message:"未知错误",variant:"destructive"})}},ge=async E=>{if(!T?.installed){I({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const we=await yY(E.id,E.manifest.repository_url||"","main");I({title:"更新成功",description:`${E.manifest.name} 已从 ${we.old_version} 更新到 ${we.new_version}`});const Z=await F0();L(Z),y(z=>z.map(X=>{if(X.id===E.id){const q=I0(X.id,Z),ce=q0(X.id,Z);return{...X,installed:q,installed_version:ce}}return X}))}catch(we){I({title:"更新失败",description:we instanceof Error?we.message:"未知错误",variant:"destructive"})}};return r.jsx(an,{className:"h-full",children:r.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),r.jsxs(ne,{onClick:()=>e({to:"/plugin-mirrors"}),children:[r.jsx(MT,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),T&&!T.installed&&r.jsxs(ct,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[r.jsx(Lt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ao,{className:"h-5 w-5 text-orange-600"}),r.jsxs("div",{children:[r.jsx(Bt,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),r.jsx(Qn,{className:"text-orange-800 dark:text-orange-200",children:T.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),r.jsx(Gt,{children:r.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",r.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),r.jsx(ct,{className:"p-4",children:r.jsxs("div",{className:"flex flex-col gap-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"flex-1 relative",children:[r.jsx(Yr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(Te,{placeholder:"搜索插件...",value:a,onChange:E=>l(E.target.value),className:"pl-9"})]}),r.jsxs(_t,{value:o,onValueChange:c,children:[r.jsx(jt,{className:"w-full sm:w-[200px]",children:r.jsx(Et,{placeholder:"选择分类"})}),r.jsxs(Nt,{children:[r.jsx(Oe,{value:"all",children:"全部分类"}),r.jsx(Oe,{value:"Group Management",children:"群组管理"}),r.jsx(Oe,{value:"Entertainment & Interaction",children:"娱乐互动"}),r.jsx(Oe,{value:"Utility Tools",children:"实用工具"}),r.jsx(Oe,{value:"Content Generation",children:"内容生成"}),r.jsx(Oe,{value:"Multimedia",children:"多媒体"}),r.jsx(Oe,{value:"External Integration",children:"外部集成"}),r.jsx(Oe,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),r.jsx(Oe,{value:"Other",children:"其他"})]})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(jr,{id:"compatible-only",checked:f,onCheckedChange:E=>p(E===!0)}),r.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),r.jsx(kl,{value:d,onValueChange:m,className:"w-full",children:r.jsxs(Bs,{className:"grid w-full grid-cols-3",children:[r.jsxs(Pt,{value:"all",children:["全部插件 (",x.length,")"]}),r.jsxs(Pt,{value:"installed",children:["已安装 (",x.filter(E=>E.installed).length,")"]}),r.jsxs(Pt,{value:"updates",children:["可更新 (",x.filter(E=>E.installed&&J(E)).length,")"]})]})}),A&&A.stage==="loading"&&r.jsx(ct,{className:"p-4",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(xu,{className:"h-4 w-4 animate-spin"}),r.jsxs("span",{className:"text-sm font-medium",children:[A.operation==="fetch"&&"加载插件列表",A.operation==="install"&&`安装插件${A.plugin_id?`: ${A.plugin_id}`:""}`,A.operation==="uninstall"&&`卸载插件${A.plugin_id?`: ${A.plugin_id}`:""}`,A.operation==="update"&&`更新插件${A.plugin_id?`: ${A.plugin_id}`:""}`]})]}),r.jsxs("span",{className:"text-sm font-medium",children:[A.progress,"%"]})]}),r.jsx(Fu,{value:A.progress,className:"h-2"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:A.message}),A.operation==="fetch"&&A.total_plugins>0&&r.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",A.loaded_plugins," / ",A.total_plugins," 个插件"]})]})}),A&&A.stage==="error"&&A.error&&r.jsx(ct,{className:"border-destructive bg-destructive/10",children:r.jsx(Lt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ao,{className:"h-5 w-5 text-destructive"}),r.jsxs("div",{children:[r.jsx(Bt,{className:"text-lg text-destructive",children:"加载失败"}),r.jsx(Qn,{className:"text-destructive/80",children:A.error})]})]})})}),b?r.jsxs("div",{className:"flex items-center justify-center py-12",children:[r.jsx(xu,{className:"h-8 w-8 animate-spin text-muted-foreground"}),r.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):k?r.jsx(ct,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[r.jsx(Ao,{className:"h-12 w-12 text-destructive mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:k}),r.jsx(ne,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):se.length===0?r.jsx(ct,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[r.jsx(Yr,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:a||o!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:se.map(E=>r.jsxs(ct,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[r.jsxs(Lt,{children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx(Bt,{className:"text-xl",children:E.manifest?.name||E.id}),r.jsxs("div",{className:"flex flex-col gap-1",children:[E.manifest?.categories&&E.manifest.categories[0]&&r.jsx(un,{variant:"secondary",className:"text-xs whitespace-nowrap",children:z5[E.manifest.categories[0]]||E.manifest.categories[0]}),ee(E)]})]}),r.jsx(Qn,{className:"line-clamp-2",children:E.manifest?.description||"无描述"})]}),r.jsx(Gt,{className:"flex-1",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(hi,{className:"h-4 w-4"}),r.jsx("span",{children:($[E.id]?.downloads??E.downloads??0).toLocaleString()})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(wl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),r.jsx("span",{children:($[E.id]?.rating??E.rating??0).toFixed(1)})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[E.manifest?.keywords&&E.manifest.keywords.slice(0,3).map(we=>r.jsx(un,{variant:"outline",className:"text-xs",children:we},we)),E.manifest?.keywords&&E.manifest.keywords.length>3&&r.jsxs(un,{variant:"outline",className:"text-xs",children:["+",E.manifest.keywords.length-3]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[r.jsxs("div",{children:["v",E.manifest?.version||"unknown"," · ",E.manifest?.author?.name||"Unknown"]}),E.manifest?.host_application&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("span",{children:"支持:"}),r.jsxs("span",{className:"font-medium",children:[E.manifest.host_application.min_version,E.manifest.host_application.max_version?` - ${E.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),r.jsx(Y6,{className:"pt-4",children:r.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>n(E),children:"查看详情"}),E.installed?J(E)?r.jsxs(ne,{size:"sm",disabled:!T?.installed,title:T?.installed?void 0:"Git 未安装",onClick:()=>ge(E),children:[r.jsx(Ia,{className:"h-4 w-4 mr-1"}),"更新"]}):r.jsxs(ne,{variant:"destructive",size:"sm",disabled:!T?.installed,title:T?.installed?void 0:"Git 未安装",onClick:()=>re(E),children:[r.jsx(zt,{className:"h-4 w-4 mr-1"}),"卸载"]}):r.jsxs(ne,{size:"sm",disabled:!T?.installed||A?.operation==="install"||B!==null&&!Ne(E),title:T?.installed?B!==null&&!Ne(E)?`不兼容当前版本 (需要 ${E.manifest?.host_application?.min_version||"未知"}${E.manifest?.host_application?.max_version?` - ${E.manifest.host_application.max_version}`:"+"},当前 ${B?.version})`:void 0:"Git 未安装",onClick:()=>le(E),children:[r.jsx(hi,{className:"h-4 w-4 mr-1"}),A?.operation==="install"&&A?.plugin_id===E.id?"安装中...":"安装"]})]})})]},E.id))}),r.jsx(ir,{open:t!==null,onOpenChange:H,children:t&&t.manifest&&r.jsxs(Jn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsx(er,{children:r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"space-y-2 flex-1",children:[r.jsx(tr,{className:"text-2xl",children:t.manifest.name}),r.jsxs(xr,{children:["作者: ",t.manifest.author?.name||"Unknown",t.manifest.author?.url&&r.jsx("a",{href:t.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:r.jsx(ou,{className:"h-3 w-3 inline"})})]})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[t.manifest.categories&&t.manifest.categories[0]&&r.jsx(un,{variant:"secondary",children:z5[t.manifest.categories[0]]||t.manifest.categories[0]}),ee(t)]})]})}),r.jsxs("div",{className:"space-y-6",children:[r.jsx(kY,{pluginId:t.id}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"版本"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",t.manifest?.version||"unknown"]}),t.installed&&t.installed_version&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",t.installed_version]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"下载量"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:($[t.id]?.downloads??t.downloads??0).toLocaleString()})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"评分"}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(wl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[($[t.id]?.rating??t.rating??0).toFixed(1)," (",$[t.id]?.rating_count??t.review_count??0,")"]})]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"许可证"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:t.manifest.license||"Unknown"})]}),r.jsxs("div",{className:"col-span-2",children:[r.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.manifest.host_application?.min_version||"未知",t.manifest.host_application?.max_version?` - ${t.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:t.manifest.keywords&&t.manifest.keywords.map(E=>r.jsx(un,{variant:"outline",children:E},E))})]}),t.detailed_description&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:t.detailed_description})]}),!t.detailed_description&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:t.manifest.description||"无描述"})]}),r.jsxs("div",{className:"space-y-2",children:[t.manifest.homepage_url&&r.jsxs("div",{className:"text-sm",children:[r.jsx("span",{className:"font-medium",children:"主页: "}),r.jsx("a",{href:t.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:t.manifest.homepage_url})]}),t.manifest.repository_url&&r.jsxs("div",{className:"text-sm",children:[r.jsx("span",{className:"font-medium",children:"仓库: "}),r.jsx("a",{href:t.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:t.manifest.repository_url})]})]})]}),r.jsxs(Er,{children:[t.manifest.homepage_url&&r.jsxs(ne,{onClick:()=>window.open(t.manifest.homepage_url,"_blank"),children:[r.jsx(ou,{className:"h-4 w-4 mr-2"}),"访问主页"]}),t.manifest.repository_url&&r.jsxs(ne,{variant:"outline",onClick:()=>window.open(t.manifest.repository_url,"_blank"),children:[r.jsx(ou,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function TY(){return r.jsx(an,{className:"h-full",children:r.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),r.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ne,{variant:"outline",size:"sm",children:[r.jsx(Ia,{className:"h-4 w-4 mr-2"}),"刷新"]}),r.jsxs(ne,{size:"sm",children:[r.jsx(Pa,{className:"h-4 w-4 mr-2"}),"全局设置"]})]})]}),r.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"已安装插件"}),r.jsx(nm,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Gt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:"0"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"正在加载..."})]})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"已启用"}),r.jsx($r,{className:"h-4 w-4 text-green-600"})]}),r.jsxs(Gt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:"0"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"已禁用"}),r.jsx(xi,{className:"h-4 w-4 text-orange-600"})]}),r.jsxs(Gt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:"0"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Bt,{className:"text-sm font-medium",children:"可更新"}),r.jsx(Ia,{className:"h-4 w-4 text-blue-600"})]}),r.jsxs(Gt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:"0"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"有新版本可用"})]})]})]}),r.jsxs(ct,{children:[r.jsxs(Lt,{children:[r.jsx(Bt,{children:"已安装的插件"}),r.jsx(Qn,{children:"查看和管理已安装插件的配置"})]}),r.jsx(Gt,{children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[r.jsx(nm,{className:"h-16 w-16 text-muted-foreground/50"}),r.jsxs("div",{className:"text-center space-y-2",children:[r.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"插件配置功能开发中"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"即将支持插件的启用/禁用、参数配置等功能"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsx(ne,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:"/plugins",children:[r.jsx(ou,{className:"h-4 w-4 mr-2"}),"前往插件市场"]})})})]})})]}),r.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[r.jsxs(ct,{children:[r.jsx(Lt,{children:r.jsx(Bt,{className:"text-base",children:"即将推出的功能"})}),r.jsx(Gt,{children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:r.jsx($r,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"插件启用/禁用"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"快速切换插件运行状态"})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:r.jsx($r,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"配置参数编辑"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"可视化编辑插件配置文件"})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:r.jsx($r,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"依赖管理"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"查看和安装插件依赖包"})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:r.jsx($r,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"插件日志"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"查看插件运行日志和错误信息"})]})]})]})})]}),r.jsxs(ct,{children:[r.jsx(Lt,{children:r.jsx(Bt,{className:"text-base",children:"开发者工具"})}),r.jsx(Gt,{children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:r.jsx(Pa,{className:"h-4 w-4 text-blue-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"热重载"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"无需重启即可重新加载插件"})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:r.jsx(Pa,{className:"h-4 w-4 text-blue-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"配置验证"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"检查配置文件格式和完整性"})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:r.jsx(Pa,{className:"h-4 w-4 text-blue-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"性能监控"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"监控插件的资源占用情况"})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:r.jsx(Pa,{className:"h-4 w-4 text-blue-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"调试模式"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"详细的调试信息和错误追踪"})]})]})]})})]})]}),r.jsx(ct,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:r.jsx(Gt,{className:"pt-6",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(xi,{className:"h-5 w-5 text-blue-600 mt-0.5 flex-shrink-0"}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"开发进行中"}),r.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["插件配置功能正在积极开发中。目前您可以通过",r.jsx("strong",{children:"插件市场"}),"安装和卸载插件,完整的配置管理功能即将推出。"]})]})]})})})]})})}function _Y(){const e=as(),{toast:t}=or(),[n,a]=w.useState([]),[l,o]=w.useState(!0),[c,d]=w.useState(null),[m,f]=w.useState(null),[p,x]=w.useState(!1),[y,b]=w.useState(!1),[N,k]=w.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S=w.useCallback(async()=>{try{o(!0),d(null);const L=localStorage.getItem("access-token"),$=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${L}`}});if(!$.ok)throw new Error("获取镜像源列表失败");const U=await $.json();a(U.mirrors||[])}catch(L){const $=L instanceof Error?L.message:"加载镜像源失败";d($),t({title:"加载失败",description:$,variant:"destructive"})}finally{o(!1)}},[t]);w.useEffect(()=>{S()},[S]);const T=async()=>{try{const L=localStorage.getItem("access-token"),$=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${L}`,"Content-Type":"application/json"},body:JSON.stringify(N)});if(!$.ok){const U=await $.json();throw new Error(U.detail||"添加镜像源失败")}t({title:"添加成功",description:"镜像源已添加"}),x(!1),k({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S()}catch(L){t({title:"添加失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},M=async()=>{if(m)try{const L=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${m.id}`,{method:"PUT",headers:{Authorization:`Bearer ${L}`,"Content-Type":"application/json"},body:JSON.stringify({name:N.name,raw_prefix:N.raw_prefix,clone_prefix:N.clone_prefix,enabled:N.enabled,priority:N.priority})})).ok)throw new Error("更新镜像源失败");t({title:"更新成功",description:"镜像源已更新"}),b(!1),f(null),S()}catch(L){t({title:"更新失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},A=async L=>{if(confirm("确定要删除这个镜像源吗?"))try{const $=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${L}`,{method:"DELETE",headers:{Authorization:`Bearer ${$}`}})).ok)throw new Error("删除镜像源失败");t({title:"删除成功",description:"镜像源已删除"}),S()}catch($){t({title:"删除失败",description:$ instanceof Error?$.message:"未知错误",variant:"destructive"})}},R=async L=>{try{const $=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${L.id}`,{method:"PUT",headers:{Authorization:`Bearer ${$}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!L.enabled})})).ok)throw new Error("更新状态失败");S()}catch($){t({title:"更新失败",description:$ instanceof Error?$.message:"未知错误",variant:"destructive"})}},B=L=>{f(L),k({id:L.id,name:L.name,raw_prefix:L.raw_prefix,clone_prefix:L.clone_prefix,enabled:L.enabled,priority:L.priority}),b(!0)},O=async(L,$)=>{const U=$==="up"?L.priority-1:L.priority+1;if(!(U<1))try{const I=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${L.id}`,{method:"PUT",headers:{Authorization:`Bearer ${I}`,"Content-Type":"application/json"},body:JSON.stringify({priority:U})})).ok)throw new Error("更新优先级失败");S()}catch(I){t({title:"更新失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"})}};return r.jsx(an,{className:"h-full",children:r.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(ne,{variant:"ghost",size:"icon",onClick:()=>e({to:"/plugins"}),children:r.jsx(i6,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),r.jsxs(ne,{onClick:()=>x(!0),children:[r.jsx(pr,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),l?r.jsx(ct,{className:"p-6",children:r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(xu,{className:"h-8 w-8 animate-spin text-primary"})})}):c?r.jsx(ct,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[r.jsx(Ao,{className:"h-12 w-12 text-destructive mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:c}),r.jsx(ne,{onClick:S,children:"重新加载"})]})}):r.jsxs(ct,{children:[r.jsx("div",{className:"hidden md:block",children:r.jsxs(ji,{children:[r.jsx(Ni,{children:r.jsxs(Vn,{children:[r.jsx(ut,{children:"状态"}),r.jsx(ut,{children:"名称"}),r.jsx(ut,{children:"ID"}),r.jsx(ut,{children:"优先级"}),r.jsx(ut,{className:"text-right",children:"操作"})]})}),r.jsx(Si,{children:n.map(L=>r.jsxs(Vn,{children:[r.jsx(et,{children:r.jsx(vt,{checked:L.enabled,onCheckedChange:()=>R(L)})}),r.jsx(et,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:L.name}),r.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",L.raw_prefix]})]})}),r.jsx(et,{children:r.jsx(un,{variant:"outline",children:L.id})}),r.jsx(et,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-mono",children:L.priority}),r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(ne,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>O(L,"up"),disabled:L.priority===1,children:r.jsx(Nx,{className:"h-3 w-3"})}),r.jsx(ne,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>O(L,"down"),children:r.jsx(pu,{className:"h-3 w-3"})})]})]})}),r.jsx(et,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(ne,{variant:"ghost",size:"icon",onClick:()=>B(L),children:r.jsx(Bo,{className:"h-4 w-4"})}),r.jsx(ne,{variant:"ghost",size:"icon",onClick:()=>A(L.id),children:r.jsx(zt,{className:"h-4 w-4 text-destructive"})})]})})]},L.id))})]})}),r.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(L=>r.jsx(ct,{className:"p-4",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"font-semibold",children:L.name}),L.enabled&&r.jsx(un,{variant:"default",className:"text-xs",children:"启用"})]}),r.jsx(un,{variant:"outline",className:"mt-1 text-xs",children:L.id})]}),r.jsx(vt,{checked:L.enabled,onCheckedChange:()=>R(L)})]}),r.jsxs("div",{className:"text-sm space-y-1",children:[r.jsxs("div",{className:"text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Raw: "}),r.jsx("span",{className:"break-all",children:L.raw_prefix})]}),r.jsxs("div",{className:"text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"优先级: "}),r.jsx("span",{className:"font-mono",children:L.priority})]})]}),r.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[r.jsxs(ne,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>B(L),children:[r.jsx(Bo,{className:"h-4 w-4 mr-1"}),"编辑"]}),r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>O(L,"up"),disabled:L.priority===1,children:r.jsx(Nx,{className:"h-4 w-4"})}),r.jsx(ne,{variant:"outline",size:"sm",onClick:()=>O(L,"down"),children:r.jsx(pu,{className:"h-4 w-4"})}),r.jsx(ne,{variant:"destructive",size:"sm",onClick:()=>A(L.id),children:r.jsx(zt,{className:"h-4 w-4"})})]})]})},L.id))})]}),r.jsx(ir,{open:p,onOpenChange:x,children:r.jsxs(Jn,{className:"max-w-lg",children:[r.jsxs(er,{children:[r.jsx(tr,{children:"添加镜像源"}),r.jsx(xr,{children:"添加新的 Git 镜像源配置"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"add-id",children:"镜像源 ID *"}),r.jsx(Te,{id:"add-id",placeholder:"例如: my-mirror",value:N.id,onChange:L=>k({...N,id:L.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"add-name",children:"名称 *"}),r.jsx(Te,{id:"add-name",placeholder:"例如: 我的镜像源",value:N.name,onChange:L=>k({...N,name:L.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),r.jsx(Te,{id:"add-raw",placeholder:"https://example.com/raw",value:N.raw_prefix,onChange:L=>k({...N,raw_prefix:L.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"add-clone",children:"克隆前缀 *"}),r.jsx(Te,{id:"add-clone",placeholder:"https://example.com/clone",value:N.clone_prefix,onChange:L=>k({...N,clone_prefix:L.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"add-priority",children:"优先级"}),r.jsx(Te,{id:"add-priority",type:"number",min:"1",value:N.priority,onChange:L=>k({...N,priority:parseInt(L.target.value)||1})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"add-enabled",checked:N.enabled,onCheckedChange:L=>k({...N,enabled:L})}),r.jsx(Q,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>x(!1),children:"取消"}),r.jsx(ne,{onClick:T,children:"添加"})]})]})}),r.jsx(ir,{open:y,onOpenChange:b,children:r.jsxs(Jn,{className:"max-w-lg",children:[r.jsxs(er,{children:[r.jsx(tr,{children:"编辑镜像源"}),r.jsx(xr,{children:"修改镜像源配置"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{children:"镜像源 ID"}),r.jsx(Te,{value:N.id,disabled:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit-name",children:"名称 *"}),r.jsx(Te,{id:"edit-name",value:N.name,onChange:L=>k({...N,name:L.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),r.jsx(Te,{id:"edit-raw",value:N.raw_prefix,onChange:L=>k({...N,raw_prefix:L.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit-clone",children:"克隆前缀 *"}),r.jsx(Te,{id:"edit-clone",value:N.clone_prefix,onChange:L=>k({...N,clone_prefix:L.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Q,{htmlFor:"edit-priority",children:"优先级"}),r.jsx(Te,{id:"edit-priority",type:"number",min:"1",value:N.priority,onChange:L=>k({...N,priority:parseInt(L.target.value)||1})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vt,{id:"edit-enabled",checked:N.enabled,onCheckedChange:L=>k({...N,enabled:L})}),r.jsx(Q,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),r.jsxs(Er,{children:[r.jsx(ne,{variant:"outline",onClick:()=>b(!1),children:"取消"}),r.jsx(ne,{onClick:M,children:"保存"})]})]})})]})})}const EY=Ko("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),UN=w.forwardRef(({className:e,size:t,abbrTitle:n,children:a,...l},o)=>r.jsx("kbd",{className:he(EY({size:t,className:e})),ref:o,...l,children:n?r.jsx("abbr",{title:n,children:a}):a}));UN.displayName="Kbd";const MY=[{icon:J0,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:Nl,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:o6,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:c6,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:N1,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Mu,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:u6,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:AT,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:nm,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:em,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:Pa,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function AY({open:e,onOpenChange:t}){const[n,a]=w.useState(""),[l,o]=w.useState(0),c=as(),d=MY.filter(p=>p.title.toLowerCase().includes(n.toLowerCase())||p.description.toLowerCase().includes(n.toLowerCase())||p.category.toLowerCase().includes(n.toLowerCase()));w.useEffect(()=>{e&&(a(""),o(0))},[e]);const m=w.useCallback(p=>{c({to:p}),t(!1)},[c,t]),f=w.useCallback(p=>{p.key==="ArrowDown"?(p.preventDefault(),o(x=>(x+1)%d.length)):p.key==="ArrowUp"?(p.preventDefault(),o(x=>(x-1+d.length)%d.length)):p.key==="Enter"&&d[l]&&(p.preventDefault(),m(d[l].path))},[d,l,m]);return r.jsx(ir,{open:e,onOpenChange:t,children:r.jsxs(Jn,{className:"max-w-2xl p-0 gap-0",children:[r.jsxs(er,{className:"px-4 pt-4 pb-0",children:[r.jsx(tr,{className:"sr-only",children:"搜索"}),r.jsxs("div",{className:"relative",children:[r.jsx(Yr,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),r.jsx(Te,{value:n,onChange:p=>{a(p.target.value),o(0)},onKeyDown:f,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),r.jsx("div",{className:"border-t",children:r.jsx(an,{className:"h-[400px]",children:d.length>0?r.jsx("div",{className:"p-2",children:d.map((p,x)=>{const y=p.icon;return r.jsxs("button",{onClick:()=>m(p.path),onMouseEnter:()=>o(x),className:he("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",x===l?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[r.jsx(y,{className:"h-5 w-5 flex-shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium text-sm",children:p.title}),r.jsx("div",{className:"text-xs text-muted-foreground truncate",children:p.description})]}),r.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:p.category})]},p.path)})}):r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Yr,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),r.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),r.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function DY(e){const t=zY(e),n=w.forwardRef((a,l)=>{const{children:o,...c}=a,d=w.Children.toArray(o),m=d.find(RY);if(m){const f=m.props.children,p=d.map(x=>x===m?w.Children.count(f)>1?w.Children.only(null):w.isValidElement(f)?f.props.children:null:x);return r.jsx(t,{...c,ref:l,children:w.isValidElement(f)?w.cloneElement(f,void 0,p):null})}return r.jsx(t,{...c,ref:l,children:o})});return n.displayName=`${e}.Slot`,n}function zY(e){const t=w.forwardRef((n,a)=>{const{children:l,...o}=n;if(w.isValidElement(l)){const c=BY(l),d=LY(o,l.props);return l.type!==w.Fragment&&(d.ref=a?Sl(a,c):c),w.cloneElement(l,d)}return w.Children.count(l)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var OY=Symbol("radix.slottable");function RY(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===OY}function LY(e,t){const n={...t};for(const a in t){const l=e[a],o=t[a];/^on[A-Z]/.test(a)?l&&o?n[a]=(...d)=>{const m=o(...d);return l(...d),m}:l&&(n[a]=l):a==="style"?n[a]={...l,...o}:a==="className"&&(n[a]=[l,o].filter(Boolean).join(" "))}return{...e,...n}}function BY(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var i1=["Enter"," "],PY=["ArrowDown","PageUp","Home"],$N=["ArrowUp","PageDown","End"],FY=[...PY,...$N],IY={ltr:[...i1,"ArrowRight"],rtl:[...i1,"ArrowLeft"]},qY={ltr:["ArrowLeft"],rtl:["ArrowRight"]},td="Menu",[Cu,HY,UY]=bm(td),[Mi,VN]=Ua(td,[UY,Vo,Dm]),nd=Vo(),GN=Dm(),[YN,Pl]=Mi(td),[$Y,rd]=Mi(td),WN=e=>{const{__scopeMenu:t,open:n=!1,children:a,dir:l,onOpenChange:o,modal:c=!0}=e,d=nd(t),[m,f]=w.useState(null),p=w.useRef(!1),x=yr(o),y=Eu(l);return w.useEffect(()=>{const b=()=>{p.current=!0,document.addEventListener("pointerdown",N,{capture:!0,once:!0}),document.addEventListener("pointermove",N,{capture:!0,once:!0})},N=()=>p.current=!1;return document.addEventListener("keydown",b,{capture:!0}),()=>{document.removeEventListener("keydown",b,{capture:!0}),document.removeEventListener("pointerdown",N,{capture:!0}),document.removeEventListener("pointermove",N,{capture:!0})}},[]),r.jsx(Sm,{...d,children:r.jsx(YN,{scope:t,open:n,onOpenChange:x,content:m,onContentChange:f,children:r.jsx($Y,{scope:t,onClose:w.useCallback(()=>x(!1),[x]),isUsingKeyboardRef:p,dir:y,modal:c,children:a})})})};WN.displayName=td;var VY="MenuAnchor",Rg=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,l=nd(n);return r.jsx(km,{...l,...a,ref:t})});Rg.displayName=VY;var Lg="MenuPortal",[GY,XN]=Mi(Lg,{forceMount:void 0}),KN=e=>{const{__scopeMenu:t,forceMount:n,children:a,container:l}=e,o=Pl(Lg,t);return r.jsx(GY,{scope:t,forceMount:n,children:r.jsx(Wr,{present:n||o.open,children:r.jsx(Nm,{asChild:!0,container:l,children:a})})})};KN.displayName=Lg;var _a="MenuContent",[YY,Bg]=Mi(_a),QN=w.forwardRef((e,t)=>{const n=XN(_a,e.__scopeMenu),{forceMount:a=n.forceMount,...l}=e,o=Pl(_a,e.__scopeMenu),c=rd(_a,e.__scopeMenu);return r.jsx(Cu.Provider,{scope:e.__scopeMenu,children:r.jsx(Wr,{present:a||o.open,children:r.jsx(Cu.Slot,{scope:e.__scopeMenu,children:c.modal?r.jsx(WY,{...l,ref:t}):r.jsx(XY,{...l,ref:t})})})})}),WY=w.forwardRef((e,t)=>{const n=Pl(_a,e.__scopeMenu),a=w.useRef(null),l=mn(t,a);return w.useEffect(()=>{const o=a.current;if(o)return Z5(o)},[]),r.jsx(Pg,{...e,ref:l,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Pe(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),XY=w.forwardRef((e,t)=>{const n=Pl(_a,e.__scopeMenu);return r.jsx(Pg,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),KY=DY("MenuContent.ScrollLock"),Pg=w.forwardRef((e,t)=>{const{__scopeMenu:n,loop:a=!1,trapFocus:l,onOpenAutoFocus:o,onCloseAutoFocus:c,disableOutsidePointerEvents:d,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:p,onFocusOutside:x,onInteractOutside:y,onDismiss:b,disableOutsideScroll:N,...k}=e,S=Pl(_a,n),T=rd(_a,n),M=nd(n),A=GN(n),R=HY(n),[B,O]=w.useState(null),L=w.useRef(null),$=mn(t,L,S.onContentChange),U=w.useRef(0),I=w.useRef(""),G=w.useRef(0),ee=w.useRef(null),Ne=w.useRef("right"),J=w.useRef(0),se=N?J5:w.Fragment,H=N?{as:KY,allowPinchZoom:!0}:void 0,le=ge=>{const E=I.current+ge,we=R().filter(fe=>!fe.disabled),Z=document.activeElement,z=we.find(fe=>fe.ref.current===Z)?.textValue,X=we.map(fe=>fe.textValue),q=oW(X,E,z),ce=we.find(fe=>fe.textValue===q)?.ref.current;(function fe(De){I.current=De,window.clearTimeout(U.current),De!==""&&(U.current=window.setTimeout(()=>fe(""),1e3))})(E),ce&&setTimeout(()=>ce.focus())};w.useEffect(()=>()=>window.clearTimeout(U.current),[]),e6();const re=w.useCallback(ge=>Ne.current===ee.current?.side&&uW(ge,ee.current?.area),[]);return r.jsx(YY,{scope:n,searchRef:I,onItemEnter:w.useCallback(ge=>{re(ge)&&ge.preventDefault()},[re]),onItemLeave:w.useCallback(ge=>{re(ge)||(L.current?.focus(),O(null))},[re]),onTriggerLeave:w.useCallback(ge=>{re(ge)&&ge.preventDefault()},[re]),pointerGraceTimerRef:G,onPointerGraceIntentChange:w.useCallback(ge=>{ee.current=ge},[]),children:r.jsx(se,{...H,children:r.jsx(t6,{asChild:!0,trapped:l,onMountAutoFocus:Pe(o,ge=>{ge.preventDefault(),L.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:c,children:r.jsx(b1,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:f,onPointerDownOutside:p,onFocusOutside:x,onInteractOutside:y,onDismiss:b,children:r.jsx(J6,{asChild:!0,...A,dir:T.dir,orientation:"vertical",loop:a,currentTabStopId:B,onCurrentTabStopIdChange:O,onEntryFocus:Pe(m,ge=>{T.isUsingKeyboardRef.current||ge.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(w1,{role:"menu","aria-orientation":"vertical","data-state":f9(S.open),"data-radix-menu-content":"",dir:T.dir,...M,...k,ref:$,style:{outline:"none",...k.style},onKeyDown:Pe(k.onKeyDown,ge=>{const we=ge.target.closest("[data-radix-menu-content]")===ge.currentTarget,Z=ge.ctrlKey||ge.altKey||ge.metaKey,z=ge.key.length===1;we&&(ge.key==="Tab"&&ge.preventDefault(),!Z&&z&&le(ge.key));const X=L.current;if(ge.target!==X||!FY.includes(ge.key))return;ge.preventDefault();const ce=R().filter(fe=>!fe.disabled).map(fe=>fe.ref.current);$N.includes(ge.key)&&ce.reverse(),lW(ce)}),onBlur:Pe(e.onBlur,ge=>{ge.currentTarget.contains(ge.target)||(window.clearTimeout(U.current),I.current="")}),onPointerMove:Pe(e.onPointerMove,Tu(ge=>{const E=ge.target,we=J.current!==ge.clientX;if(ge.currentTarget.contains(E)&&we){const Z=ge.clientX>J.current?"right":"left";Ne.current=Z,J.current=ge.clientX}}))})})})})})})});QN.displayName=_a;var QY="MenuGroup",Fg=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return r.jsx(It.div,{role:"group",...a,ref:t})});Fg.displayName=QY;var ZY="MenuLabel",ZN=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return r.jsx(It.div,{...a,ref:t})});ZN.displayName=ZY;var vm="MenuItem",O5="menu.itemSelect",th=w.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:a,...l}=e,o=w.useRef(null),c=rd(vm,e.__scopeMenu),d=Bg(vm,e.__scopeMenu),m=mn(t,o),f=w.useRef(!1),p=()=>{const x=o.current;if(!n&&x){const y=new CustomEvent(O5,{bubbles:!0,cancelable:!0});x.addEventListener(O5,b=>a?.(b),{once:!0}),r6(x,y),y.defaultPrevented?f.current=!1:c.onClose()}};return r.jsx(JN,{...l,ref:m,disabled:n,onClick:Pe(e.onClick,p),onPointerDown:x=>{e.onPointerDown?.(x),f.current=!0},onPointerUp:Pe(e.onPointerUp,x=>{f.current||x.currentTarget?.click()}),onKeyDown:Pe(e.onKeyDown,x=>{const y=d.searchRef.current!=="";n||y&&x.key===" "||i1.includes(x.key)&&(x.currentTarget.click(),x.preventDefault())})})});th.displayName=vm;var JN=w.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:a=!1,textValue:l,...o}=e,c=Bg(vm,n),d=GN(n),m=w.useRef(null),f=mn(t,m),[p,x]=w.useState(!1),[y,b]=w.useState("");return w.useEffect(()=>{const N=m.current;N&&b((N.textContent??"").trim())},[o.children]),r.jsx(Cu.ItemSlot,{scope:n,disabled:a,textValue:l??y,children:r.jsx(ew,{asChild:!0,...d,focusable:!a,children:r.jsx(It.div,{role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...o,ref:f,onPointerMove:Pe(e.onPointerMove,Tu(N=>{a?c.onItemLeave(N):(c.onItemEnter(N),N.defaultPrevented||N.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Pe(e.onPointerLeave,Tu(N=>c.onItemLeave(N))),onFocus:Pe(e.onFocus,()=>x(!0)),onBlur:Pe(e.onBlur,()=>x(!1))})})})}),JY="MenuCheckboxItem",e9=w.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:a,...l}=e;return r.jsx(s9,{scope:e.__scopeMenu,checked:n,children:r.jsx(th,{role:"menuitemcheckbox","aria-checked":ym(n)?"mixed":n,...l,ref:t,"data-state":Hg(n),onSelect:Pe(l.onSelect,()=>a?.(ym(n)?!0:!n),{checkForDefaultPrevented:!1})})})});e9.displayName=JY;var t9="MenuRadioGroup",[eW,tW]=Mi(t9,{value:void 0,onValueChange:()=>{}}),n9=w.forwardRef((e,t)=>{const{value:n,onValueChange:a,...l}=e,o=yr(a);return r.jsx(eW,{scope:e.__scopeMenu,value:n,onValueChange:o,children:r.jsx(Fg,{...l,ref:t})})});n9.displayName=t9;var r9="MenuRadioItem",a9=w.forwardRef((e,t)=>{const{value:n,...a}=e,l=tW(r9,e.__scopeMenu),o=n===l.value;return r.jsx(s9,{scope:e.__scopeMenu,checked:o,children:r.jsx(th,{role:"menuitemradio","aria-checked":o,...a,ref:t,"data-state":Hg(o),onSelect:Pe(a.onSelect,()=>l.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});a9.displayName=r9;var Ig="MenuItemIndicator",[s9,nW]=Mi(Ig,{checked:!1}),l9=w.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:a,...l}=e,o=nW(Ig,n);return r.jsx(Wr,{present:a||ym(o.checked)||o.checked===!0,children:r.jsx(It.span,{...l,ref:t,"data-state":Hg(o.checked)})})});l9.displayName=Ig;var rW="MenuSeparator",i9=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return r.jsx(It.div,{role:"separator","aria-orientation":"horizontal",...a,ref:t})});i9.displayName=rW;var aW="MenuArrow",o9=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,l=nd(n);return r.jsx(j1,{...l,...a,ref:t})});o9.displayName=aW;var qg="MenuSub",[sW,c9]=Mi(qg),u9=e=>{const{__scopeMenu:t,children:n,open:a=!1,onOpenChange:l}=e,o=Pl(qg,t),c=nd(t),[d,m]=w.useState(null),[f,p]=w.useState(null),x=yr(l);return w.useEffect(()=>(o.open===!1&&x(!1),()=>x(!1)),[o.open,x]),r.jsx(Sm,{...c,children:r.jsx(YN,{scope:t,open:a,onOpenChange:x,content:f,onContentChange:p,children:r.jsx(sW,{scope:t,contentId:Ta(),triggerId:Ta(),trigger:d,onTriggerChange:m,children:n})})})};u9.displayName=qg;var lu="MenuSubTrigger",d9=w.forwardRef((e,t)=>{const n=Pl(lu,e.__scopeMenu),a=rd(lu,e.__scopeMenu),l=c9(lu,e.__scopeMenu),o=Bg(lu,e.__scopeMenu),c=w.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:m}=o,f={__scopeMenu:e.__scopeMenu},p=w.useCallback(()=>{c.current&&window.clearTimeout(c.current),c.current=null},[]);return w.useEffect(()=>p,[p]),w.useEffect(()=>{const x=d.current;return()=>{window.clearTimeout(x),m(null)}},[d,m]),r.jsx(Rg,{asChild:!0,...f,children:r.jsx(JN,{id:l.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":l.contentId,"data-state":f9(n.open),...e,ref:Sl(t,l.onTriggerChange),onClick:x=>{e.onClick?.(x),!(e.disabled||x.defaultPrevented)&&(x.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Pe(e.onPointerMove,Tu(x=>{o.onItemEnter(x),!x.defaultPrevented&&!e.disabled&&!n.open&&!c.current&&(o.onPointerGraceIntentChange(null),c.current=window.setTimeout(()=>{n.onOpenChange(!0),p()},100))})),onPointerLeave:Pe(e.onPointerLeave,Tu(x=>{p();const y=n.content?.getBoundingClientRect();if(y){const b=n.content?.dataset.side,N=b==="right",k=N?-5:5,S=y[N?"left":"right"],T=y[N?"right":"left"];o.onPointerGraceIntentChange({area:[{x:x.clientX+k,y:x.clientY},{x:S,y:y.top},{x:T,y:y.top},{x:T,y:y.bottom},{x:S,y:y.bottom}],side:b}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(x),x.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Pe(e.onKeyDown,x=>{const y=o.searchRef.current!=="";e.disabled||y&&x.key===" "||IY[a.dir].includes(x.key)&&(n.onOpenChange(!0),n.content?.focus(),x.preventDefault())})})})});d9.displayName=lu;var m9="MenuSubContent",h9=w.forwardRef((e,t)=>{const n=XN(_a,e.__scopeMenu),{forceMount:a=n.forceMount,...l}=e,o=Pl(_a,e.__scopeMenu),c=rd(_a,e.__scopeMenu),d=c9(m9,e.__scopeMenu),m=w.useRef(null),f=mn(t,m);return r.jsx(Cu.Provider,{scope:e.__scopeMenu,children:r.jsx(Wr,{present:a||o.open,children:r.jsx(Cu.Slot,{scope:e.__scopeMenu,children:r.jsx(Pg,{id:d.contentId,"aria-labelledby":d.triggerId,...l,ref:f,align:"start",side:c.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{c.isUsingKeyboardRef.current&&m.current?.focus(),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:Pe(e.onFocusOutside,p=>{p.target!==d.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Pe(e.onEscapeKeyDown,p=>{c.onClose(),p.preventDefault()}),onKeyDown:Pe(e.onKeyDown,p=>{const x=p.currentTarget.contains(p.target),y=qY[c.dir].includes(p.key);x&&y&&(o.onOpenChange(!1),d.trigger?.focus(),p.preventDefault())})})})})})});h9.displayName=m9;function f9(e){return e?"open":"closed"}function ym(e){return e==="indeterminate"}function Hg(e){return ym(e)?"indeterminate":e?"checked":"unchecked"}function lW(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function iW(e,t){return e.map((n,a)=>e[(t+a)%e.length])}function oW(e,t,n){const l=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let c=iW(e,Math.max(o,0));l.length===1&&(c=c.filter(f=>f!==n));const m=c.find(f=>f.toLowerCase().startsWith(l.toLowerCase()));return m!==n?m:void 0}function cW(e,t){const{x:n,y:a}=e;let l=!1;for(let o=0,c=t.length-1;oa!=y>a&&n<(x-f)*(a-p)/(y-p)+f&&(l=!l)}return l}function uW(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return cW(n,t)}function Tu(e){return t=>t.pointerType==="mouse"?e(t):void 0}var dW=WN,mW=Rg,hW=KN,fW=QN,pW=Fg,xW=ZN,gW=th,vW=e9,yW=n9,bW=a9,wW=l9,jW=i9,NW=o9,SW=u9,kW=d9,CW=h9,Ug="ContextMenu",[TW]=Ua(Ug,[VN]),Sr=VN(),[_W,p9]=TW(Ug),x9=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:a,dir:l,modal:o=!0}=e,[c,d]=w.useState(!1),m=Sr(t),f=yr(a),p=w.useCallback(x=>{d(x),f(x)},[f]);return r.jsx(_W,{scope:t,open:c,onOpenChange:p,modal:o,children:r.jsx(dW,{...m,dir:l,open:c,onOpenChange:p,modal:o,children:n})})};x9.displayName=Ug;var g9="ContextMenuTrigger",v9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:a=!1,...l}=e,o=p9(g9,n),c=Sr(n),d=w.useRef({x:0,y:0}),m=w.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...d.current})}),f=w.useRef(0),p=w.useCallback(()=>window.clearTimeout(f.current),[]),x=y=>{d.current={x:y.clientX,y:y.clientY},o.onOpenChange(!0)};return w.useEffect(()=>p,[p]),w.useEffect(()=>void(a&&p()),[a,p]),r.jsxs(r.Fragment,{children:[r.jsx(mW,{...c,virtualRef:m}),r.jsx(It.span,{"data-state":o.open?"open":"closed","data-disabled":a?"":void 0,...l,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:a?e.onContextMenu:Pe(e.onContextMenu,y=>{p(),x(y),y.preventDefault()}),onPointerDown:a?e.onPointerDown:Pe(e.onPointerDown,H0(y=>{p(),f.current=window.setTimeout(()=>x(y),700)})),onPointerMove:a?e.onPointerMove:Pe(e.onPointerMove,H0(p)),onPointerCancel:a?e.onPointerCancel:Pe(e.onPointerCancel,H0(p)),onPointerUp:a?e.onPointerUp:Pe(e.onPointerUp,H0(p))})]})});v9.displayName=g9;var EW="ContextMenuPortal",y9=e=>{const{__scopeContextMenu:t,...n}=e,a=Sr(t);return r.jsx(hW,{...a,...n})};y9.displayName=EW;var b9="ContextMenuContent",w9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=p9(b9,n),o=Sr(n),c=w.useRef(!1);return r.jsx(fW,{...o,...a,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:d=>{e.onCloseAutoFocus?.(d),!d.defaultPrevented&&c.current&&d.preventDefault(),c.current=!1},onInteractOutside:d=>{e.onInteractOutside?.(d),!d.defaultPrevented&&!l.modal&&(c.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});w9.displayName=b9;var MW="ContextMenuGroup",AW=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(pW,{...l,...a,ref:t})});AW.displayName=MW;var DW="ContextMenuLabel",j9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(xW,{...l,...a,ref:t})});j9.displayName=DW;var zW="ContextMenuItem",N9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(gW,{...l,...a,ref:t})});N9.displayName=zW;var OW="ContextMenuCheckboxItem",S9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(vW,{...l,...a,ref:t})});S9.displayName=OW;var RW="ContextMenuRadioGroup",LW=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(yW,{...l,...a,ref:t})});LW.displayName=RW;var BW="ContextMenuRadioItem",k9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(bW,{...l,...a,ref:t})});k9.displayName=BW;var PW="ContextMenuItemIndicator",C9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(wW,{...l,...a,ref:t})});C9.displayName=PW;var FW="ContextMenuSeparator",T9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(jW,{...l,...a,ref:t})});T9.displayName=FW;var IW="ContextMenuArrow",qW=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(NW,{...l,...a,ref:t})});qW.displayName=IW;var _9="ContextMenuSub",E9=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:a,open:l,defaultOpen:o}=e,c=Sr(t),[d,m]=zl({prop:l,defaultProp:o??!1,onChange:a,caller:_9});return r.jsx(SW,{...c,open:d,onOpenChange:m,children:n})};E9.displayName=_9;var HW="ContextMenuSubTrigger",M9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(kW,{...l,...a,ref:t})});M9.displayName=HW;var UW="ContextMenuSubContent",A9=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...a}=e,l=Sr(n);return r.jsx(CW,{...l,...a,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});A9.displayName=UW;function H0(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var $W=x9,VW=v9,GW=y9,D9=w9,z9=j9,O9=N9,R9=S9,L9=k9,B9=C9,P9=T9,YW=E9,F9=M9,I9=A9;const WW=$W,XW=VW,KW=YW,q9=w.forwardRef(({className:e,inset:t,children:n,...a},l)=>r.jsxs(F9,{ref:l,className:he("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...a,children:[n,r.jsx(wi,{className:"ml-auto h-4 w-4"})]}));q9.displayName=F9.displayName;const H9=w.forwardRef(({className:e,...t},n)=>r.jsx(I9,{ref:n,className:he("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 origin-[--radix-context-menu-content-transform-origin]",e),...t}));H9.displayName=I9.displayName;const U9=w.forwardRef(({className:e,...t},n)=>r.jsx(GW,{children:r.jsx(D9,{ref:n,className:he("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-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 origin-[--radix-context-menu-content-transform-origin]",e),...t})}));U9.displayName=D9.displayName;const La=w.forwardRef(({className:e,inset:t,...n},a)=>r.jsx(O9,{ref:a,className:he("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));La.displayName=O9.displayName;const QW=w.forwardRef(({className:e,children:t,checked:n,...a},l)=>r.jsxs(R9,{ref:l,className:he("relative flex 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",e),checked:n,...a,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(B9,{children:r.jsx(mi,{className:"h-4 w-4"})})}),t]}));QW.displayName=R9.displayName;const ZW=w.forwardRef(({className:e,children:t,...n},a)=>r.jsxs(L9,{ref:a,className:he("relative flex 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",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(B9,{children:r.jsx(DT,{className:"h-2 w-2 fill-current"})})}),t]}));ZW.displayName=L9.displayName;const JW=w.forwardRef(({className:e,inset:t,...n},a)=>r.jsx(z9,{ref:a,className:he("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...n}));JW.displayName=z9.displayName;const iu=w.forwardRef(({className:e,...t},n)=>r.jsx(P9,{ref:n,className:he("-mx-1 my-1 h-px bg-border",e),...t}));iu.displayName=P9.displayName;const Mo=({className:e,...t})=>r.jsx("span",{className:he("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});Mo.displayName="ContextMenuShortcut";var eX=Symbol("radix.slottable");function tX(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=eX,t}var[nh]=Ua("Tooltip",[Vo]),rh=Vo(),$9="TooltipProvider",nX=700,o1="tooltip.open",[rX,$g]=nh($9),V9=e=>{const{__scopeTooltip:t,delayDuration:n=nX,skipDelayDuration:a=300,disableHoverableContent:l=!1,children:o}=e,c=w.useRef(!0),d=w.useRef(!1),m=w.useRef(0);return w.useEffect(()=>{const f=m.current;return()=>window.clearTimeout(f)},[]),r.jsx(rX,{scope:t,isOpenDelayedRef:c,delayDuration:n,onOpen:w.useCallback(()=>{window.clearTimeout(m.current),c.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>c.current=!0,a)},[a]),isPointerInTransitRef:d,onPointerInTransitChange:w.useCallback(f=>{d.current=f},[]),disableHoverableContent:l,children:o})};V9.displayName=$9;var _u="Tooltip",[aX,ad]=nh(_u),G9=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:l,onOpenChange:o,disableHoverableContent:c,delayDuration:d}=e,m=$g(_u,e.__scopeTooltip),f=rh(t),[p,x]=w.useState(null),y=Ta(),b=w.useRef(0),N=c??m.disableHoverableContent,k=d??m.delayDuration,S=w.useRef(!1),[T,M]=zl({prop:a,defaultProp:l??!1,onChange:L=>{L?(m.onOpen(),document.dispatchEvent(new CustomEvent(o1))):m.onClose(),o?.(L)},caller:_u}),A=w.useMemo(()=>T?S.current?"delayed-open":"instant-open":"closed",[T]),R=w.useCallback(()=>{window.clearTimeout(b.current),b.current=0,S.current=!1,M(!0)},[M]),B=w.useCallback(()=>{window.clearTimeout(b.current),b.current=0,M(!1)},[M]),O=w.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{S.current=!0,M(!0),b.current=0},k)},[k,M]);return w.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),r.jsx(Sm,{...f,children:r.jsx(aX,{scope:t,contentId:y,open:T,stateAttribute:A,trigger:p,onTriggerChange:x,onTriggerEnter:w.useCallback(()=>{m.isOpenDelayedRef.current?O():R()},[m.isOpenDelayedRef,O,R]),onTriggerLeave:w.useCallback(()=>{N?B():(window.clearTimeout(b.current),b.current=0)},[B,N]),onOpen:R,onClose:B,disableHoverableContent:N,children:n})})};G9.displayName=_u;var c1="TooltipTrigger",Y9=w.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,l=ad(c1,n),o=$g(c1,n),c=rh(n),d=w.useRef(null),m=mn(t,d,l.onTriggerChange),f=w.useRef(!1),p=w.useRef(!1),x=w.useCallback(()=>f.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",x),[x]),r.jsx(km,{asChild:!0,...c,children:r.jsx(It.button,{"aria-describedby":l.open?l.contentId:void 0,"data-state":l.stateAttribute,...a,ref:m,onPointerMove:Pe(e.onPointerMove,y=>{y.pointerType!=="touch"&&!p.current&&!o.isPointerInTransitRef.current&&(l.onTriggerEnter(),p.current=!0)}),onPointerLeave:Pe(e.onPointerLeave,()=>{l.onTriggerLeave(),p.current=!1}),onPointerDown:Pe(e.onPointerDown,()=>{l.open&&l.onClose(),f.current=!0,document.addEventListener("pointerup",x,{once:!0})}),onFocus:Pe(e.onFocus,()=>{f.current||l.onOpen()}),onBlur:Pe(e.onBlur,l.onClose),onClick:Pe(e.onClick,l.onClose)})})});Y9.displayName=c1;var Vg="TooltipPortal",[sX,lX]=nh(Vg,{forceMount:void 0}),W9=e=>{const{__scopeTooltip:t,forceMount:n,children:a,container:l}=e,o=ad(Vg,t);return r.jsx(sX,{scope:t,forceMount:n,children:r.jsx(Wr,{present:n||o.open,children:r.jsx(Nm,{asChild:!0,container:l,children:a})})})};W9.displayName=Vg;var $o="TooltipContent",X9=w.forwardRef((e,t)=>{const n=lX($o,e.__scopeTooltip),{forceMount:a=n.forceMount,side:l="top",...o}=e,c=ad($o,e.__scopeTooltip);return r.jsx(Wr,{present:a||c.open,children:c.disableHoverableContent?r.jsx(K9,{side:l,...o,ref:t}):r.jsx(iX,{side:l,...o,ref:t})})}),iX=w.forwardRef((e,t)=>{const n=ad($o,e.__scopeTooltip),a=$g($o,e.__scopeTooltip),l=w.useRef(null),o=mn(t,l),[c,d]=w.useState(null),{trigger:m,onClose:f}=n,p=l.current,{onPointerInTransitChange:x}=a,y=w.useCallback(()=>{d(null),x(!1)},[x]),b=w.useCallback((N,k)=>{const S=N.currentTarget,T={x:N.clientX,y:N.clientY},M=mX(T,S.getBoundingClientRect()),A=hX(T,M),R=fX(k.getBoundingClientRect()),B=xX([...A,...R]);d(B),x(!0)},[x]);return w.useEffect(()=>()=>y(),[y]),w.useEffect(()=>{if(m&&p){const N=S=>b(S,p),k=S=>b(S,m);return m.addEventListener("pointerleave",N),p.addEventListener("pointerleave",k),()=>{m.removeEventListener("pointerleave",N),p.removeEventListener("pointerleave",k)}}},[m,p,b,y]),w.useEffect(()=>{if(c){const N=k=>{const S=k.target,T={x:k.clientX,y:k.clientY},M=m?.contains(S)||p?.contains(S),A=!pX(T,c);M?y():A&&(y(),f())};return document.addEventListener("pointermove",N),()=>document.removeEventListener("pointermove",N)}},[m,p,c,f,y]),r.jsx(K9,{...e,ref:o})}),[oX,cX]=nh(_u,{isInside:!1}),uX=tX("TooltipContent"),K9=w.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":l,onEscapeKeyDown:o,onPointerDownOutside:c,...d}=e,m=ad($o,n),f=rh(n),{onClose:p}=m;return w.useEffect(()=>(document.addEventListener(o1,p),()=>document.removeEventListener(o1,p)),[p]),w.useEffect(()=>{if(m.trigger){const x=y=>{y.target?.contains(m.trigger)&&p()};return window.addEventListener("scroll",x,{capture:!0}),()=>window.removeEventListener("scroll",x,{capture:!0})}},[m.trigger,p]),r.jsx(b1,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:x=>x.preventDefault(),onDismiss:p,children:r.jsxs(w1,{"data-state":m.stateAttribute,...f,...d,ref:t,style:{...d.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:[r.jsx(uX,{children:a}),r.jsx(oX,{scope:n,isInside:!0,children:r.jsx(cT,{id:m.contentId,role:"tooltip",children:l||a})})]})})});X9.displayName=$o;var Q9="TooltipArrow",dX=w.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,l=rh(n);return cX(Q9,n).isInside?null:r.jsx(j1,{...l,...a,ref:t})});dX.displayName=Q9;function mX(e,t){const n=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),l=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,a,l,o)){case o:return"left";case l:return"right";case n:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function hX(e,t,n=5){const a=[];switch(t){case"top":a.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":a.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":a.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":a.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return a}function fX(e){const{top:t,right:n,bottom:a,left:l}=e;return[{x:l,y:t},{x:n,y:t},{x:n,y:a},{x:l,y:a}]}function pX(e,t){const{x:n,y:a}=e;let l=!1;for(let o=0,c=t.length-1;oa!=y>a&&n<(x-f)*(a-p)/(y-p)+f&&(l=!l)}return l}function xX(e){const t=e.slice();return t.sort((n,a)=>n.xa.x?1:n.ya.y?1:0),gX(t)}function gX(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a=2;){const o=t[t.length-1],c=t[t.length-2];if((o.x-c.x)*(l.y-c.y)>=(o.y-c.y)*(l.x-c.x))t.pop();else break}t.push(l)}t.pop();const n=[];for(let a=e.length-1;a>=0;a--){const l=e[a];for(;n.length>=2;){const o=n[n.length-1],c=n[n.length-2];if((o.x-c.x)*(l.y-c.y)>=(o.y-c.y)*(l.x-c.x))n.pop();else break}n.push(l)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var vX=V9,yX=G9,bX=Y9,wX=W9,Z9=X9;const jX=vX,NX=yX,SX=bX,J9=w.forwardRef(({className:e,sideOffset:t=4,...n},a)=>r.jsx(wX,{children:r.jsx(Z9,{ref:a,sideOffset:t,className:he("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...n})}));J9.displayName=Z9.displayName;function kX({children:e}){MA();const[t,n]=w.useState(!0),[a,l]=w.useState(!1),[o,c]=w.useState(!1),{theme:d,setTheme:m}=B1(),f=LC(),p=as();w.useEffect(()=>{const k=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),c(!0))};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[]);const x=[{title:"概览",items:[{icon:J0,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:Nl,label:"麦麦主程序配置",path:"/config/bot"},{icon:o6,label:"麦麦模型提供商配置",path:"/config/modelProvider"},{icon:c6,label:"麦麦模型配置",path:"/config/model"},{icon:Xy,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:N1,label:"表情包管理",path:"/resource/emoji"},{icon:Mu,label:"表达方式管理",path:"/resource/expression"},{icon:u6,label:"人物信息管理",path:"/resource/person"}]},{title:"扩展与监控",items:[{icon:nm,label:"插件市场",path:"/plugins"},{icon:Xy,label:"插件配置",path:"/plugin-config"},{icon:em,label:"日志查看器",path:"/logs"}]},{title:"系统",items:[{icon:Pa,label:"系统设置",path:"/settings"}]}],b=d==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":d,N=()=>{localStorage.removeItem("access-token"),p({to:"/auth"})};return r.jsx(jX,{delayDuration:300,children:r.jsxs("div",{className:"flex h-screen overflow-hidden",children:[r.jsxs("aside",{className:he("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",t?"lg:w-64":"lg:w-16",a?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[r.jsx("div",{className:"flex h-16 items-center border-b px-4",children:r.jsxs("div",{className:he("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!t&&"lg:flex-none lg:w-8"),children:[r.jsxs("div",{className:he("flex items-baseline gap-2",!t&&"lg:hidden"),children:[r.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),r.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:lA()})]}),!t&&r.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),r.jsx("nav",{className:"flex-1 overflow-y-auto p-4",children:r.jsx("ul",{className:he("space-y-6",!t&&"lg:space-y-3"),children:x.map((k,S)=>r.jsxs("li",{children:[r.jsx("div",{className:he("px-3 h-[1.25rem]","mb-2",!t&&"lg:mb-1 lg:invisible"),children:r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:k.title})}),!t&&S>0&&r.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),r.jsx("ul",{className:"space-y-1",children:k.items.map(T=>{const M=f({to:T.path}),A=T.icon,R=r.jsxs(r.Fragment,{children:[M&&r.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),r.jsxs("div",{className:he("flex items-center transition-all duration-300",t?"gap-3":"lg:gap-0"),children:[r.jsx(A,{className:he("h-5 w-5 flex-shrink-0",M&&"text-primary"),strokeWidth:2,fill:"none"}),r.jsx("span",{className:he("text-sm font-medium whitespace-nowrap transition-all duration-300",M&&"font-semibold",t?"opacity-100 max-w-[200px]":"lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:T.label})]})]});return r.jsx("li",{className:"relative",children:r.jsxs(NX,{children:[r.jsx(SX,{asChild:!0,children:r.jsx(BC,{to:T.path,className:he("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",M?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",t?"px-3":"lg:px-0 lg:justify-center"),onClick:()=>l(!1),children:R})}),!t&&r.jsx(J9,{side:"right",className:"hidden lg:block",children:r.jsx("p",{children:T.label})})]})},T.path)})})]},k.title))})})]}),a&&r.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>l(!1)}),r.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[r.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("button",{onClick:()=>l(!a),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:r.jsx(zT,{className:"h-5 w-5"})}),r.jsx("button",{onClick:()=>n(!t),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:t?"收起侧边栏":"展开侧边栏",children:r.jsx(bi,{className:he("h-5 w-5 transition-transform",!t&&"rotate-180")})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("button",{onClick:()=>c(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[r.jsx(Yr,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),r.jsxs(UN,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[r.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),r.jsx(AY,{open:o,onOpenChange:c}),r.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[r.jsx(OT,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),r.jsx("button",{onClick:k=>{VM(b==="dark"?"light":"dark",m,k)},className:"rounded-lg p-2 hover:bg-accent",title:b==="dark"?"切换到浅色模式":"切换到深色模式",children:b==="dark"?r.jsx(wx,{className:"h-5 w-5"}):r.jsx(jx,{className:"h-5 w-5"})}),r.jsx("div",{className:"h-6 w-px bg-border"}),r.jsxs(ne,{variant:"ghost",size:"sm",onClick:N,className:"gap-2",title:"登出系统",children:[r.jsx(Ky,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),r.jsxs(WW,{children:[r.jsx(XW,{asChild:!0,children:r.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:e})}),r.jsxs(U9,{className:"w-64",children:[r.jsxs(La,{onClick:()=>p({to:"/"}),children:[r.jsx(J0,{className:"mr-2 h-4 w-4"}),"首页"]}),r.jsxs(La,{onClick:()=>p({to:"/settings"}),children:[r.jsx(Pa,{className:"mr-2 h-4 w-4"}),"系统设置"]}),r.jsxs(La,{onClick:()=>p({to:"/logs"}),children:[r.jsx(em,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),r.jsx(iu,{}),r.jsxs(KW,{children:[r.jsxs(q9,{children:[r.jsx(s6,{className:"mr-2 h-4 w-4"}),"切换主题"]}),r.jsxs(H9,{className:"w-48",children:[r.jsxs(La,{onClick:()=>m("light"),disabled:d==="light",children:[r.jsx(wx,{className:"mr-2 h-4 w-4"}),"浅色",d==="light"&&r.jsx(Mo,{children:"✓"})]}),r.jsxs(La,{onClick:()=>m("dark"),disabled:d==="dark",children:[r.jsx(jx,{className:"mr-2 h-4 w-4"}),"深色",d==="dark"&&r.jsx(Mo,{children:"✓"})]}),r.jsxs(La,{onClick:()=>m("system"),disabled:d==="system",children:[r.jsx(Pa,{className:"mr-2 h-4 w-4"}),"跟随系统",d==="system"&&r.jsx(Mo,{children:"✓"})]})]})]}),r.jsx(iu,{}),r.jsxs(La,{onClick:()=>window.location.reload(),children:[r.jsx(RT,{className:"mr-2 h-4 w-4"}),"刷新页面",r.jsx(Mo,{children:"⌘R"})]}),r.jsxs(La,{onClick:()=>c(!0),children:[r.jsx(Yr,{className:"mr-2 h-4 w-4"}),"搜索",r.jsx(Mo,{children:"⌘K"})]}),r.jsx(iu,{}),r.jsxs(La,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[r.jsx(ou,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),r.jsx(iu,{}),r.jsxs(La,{onClick:N,className:"text-destructive focus:text-destructive",children:[r.jsx(Ky,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}const sd=PC({component:()=>r.jsxs(r.Fragment,{children:[r.jsx(L5,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!hj())throw IC({to:"/auth"})}}),CX=gr({getParentRoute:()=>sd,path:"/auth",component:AA}),TX=gr({getParentRoute:()=>sd,path:"/setup",component:KA}),Zr=gr({getParentRoute:()=>sd,id:"protected",component:()=>r.jsx(kX,{children:r.jsx(L5,{})})}),_X=gr({getParentRoute:()=>Zr,path:"/",component:UM}),EX=gr({getParentRoute:()=>Zr,path:"/config/bot",component:qD}),MX=gr({getParentRoute:()=>Zr,path:"/config/modelProvider",component:rz}),AX=gr({getParentRoute:()=>Zr,path:"/config/model",component:Az}),DX=gr({getParentRoute:()=>Zr,path:"/config/adapter",component:Rz}),zX=gr({getParentRoute:()=>Zr,path:"/resource/emoji",component:sU}),OX=gr({getParentRoute:()=>Zr,path:"/resource/expression",component:pU}),RX=gr({getParentRoute:()=>Zr,path:"/resource/person",component:CU}),LX=gr({getParentRoute:()=>Zr,path:"/logs",component:iY}),BX=gr({getParentRoute:()=>Zr,path:"/plugins",component:CY}),PX=gr({getParentRoute:()=>Zr,path:"/plugin-config",component:TY}),FX=gr({getParentRoute:()=>Zr,path:"/plugin-mirrors",component:_Y}),IX=gr({getParentRoute:()=>Zr,path:"/settings",component:NA}),qX=gr({getParentRoute:()=>sd,path:"*",component:xj}),HX=sd.addChildren([CX,TX,Zr.addChildren([_X,EX,MX,AX,DX,zX,OX,RX,BX,PX,FX,LX,IX]),qX]),UX=FC({routeTree:HX,defaultNotFoundComponent:xj});function $X({children:e,defaultTheme:t="system",storageKey:n="ui-theme",...a}){const[l,o]=w.useState(()=>localStorage.getItem(n)||t);w.useEffect(()=>{const d=window.document.documentElement;if(d.classList.remove("light","dark"),l==="system"){const m=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";d.classList.add(m);return}d.classList.add(l)},[l]),w.useEffect(()=>{const d=localStorage.getItem("accent-color");if(d){const m=document.documentElement,p={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[d];p&&(m.style.setProperty("--primary",p.hsl),p.gradient?(m.style.setProperty("--primary-gradient",p.gradient),m.classList.add("has-gradient")):(m.style.removeProperty("--primary-gradient"),m.classList.remove("has-gradient")))}},[]);const c={theme:l,setTheme:d=>{localStorage.setItem(n,d),o(d)}};return r.jsx(Bw.Provider,{...a,value:c,children:e})}function VX({children:e,defaultEnabled:t=!0,defaultWavesEnabled:n=!0,storageKey:a="enable-animations",wavesStorageKey:l="enable-waves-background"}){const[o,c]=w.useState(()=>{const p=localStorage.getItem(a);return p!==null?p==="true":t}),[d,m]=w.useState(()=>{const p=localStorage.getItem(l);return p!==null?p==="true":n});w.useEffect(()=>{const p=document.documentElement;o?p.classList.remove("no-animations"):p.classList.add("no-animations"),localStorage.setItem(a,String(o))},[o,a]),w.useEffect(()=>{localStorage.setItem(l,String(d))},[d,l]);const f={enableAnimations:o,setEnableAnimations:c,enableWavesBackground:d,setEnableWavesBackground:m};return r.jsx(Pw.Provider,{value:f,children:e})}var Gg="ToastProvider",[Yg,GX,YX]=bm("Toast"),[eS]=Ua("Toast",[YX]),[WX,ah]=eS(Gg),tS=e=>{const{__scopeToast:t,label:n="Notification",duration:a=5e3,swipeDirection:l="right",swipeThreshold:o=50,children:c}=e,[d,m]=w.useState(null),[f,p]=w.useState(0),x=w.useRef(!1),y=w.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Gg}\`. Expected non-empty \`string\`.`),r.jsx(Yg.Provider,{scope:t,children:r.jsx(WX,{scope:t,label:n,duration:a,swipeDirection:l,swipeThreshold:o,toastCount:f,viewport:d,onViewportChange:m,onToastAdd:w.useCallback(()=>p(b=>b+1),[]),onToastRemove:w.useCallback(()=>p(b=>b-1),[]),isFocusedToastEscapeKeyDownRef:x,isClosePausedRef:y,children:c})})};tS.displayName=Gg;var nS="ToastViewport",XX=["F8"],u1="toast.viewportPause",d1="toast.viewportResume",rS=w.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:a=XX,label:l="Notifications ({hotkey})",...o}=e,c=ah(nS,n),d=GX(n),m=w.useRef(null),f=w.useRef(null),p=w.useRef(null),x=w.useRef(null),y=mn(t,x,c.onViewportChange),b=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),N=c.toastCount>0;w.useEffect(()=>{const S=T=>{a.length!==0&&a.every(A=>T[A]||T.code===A)&&x.current?.focus()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[a]),w.useEffect(()=>{const S=m.current,T=x.current;if(N&&S&&T){const M=()=>{if(!c.isClosePausedRef.current){const O=new CustomEvent(u1);T.dispatchEvent(O),c.isClosePausedRef.current=!0}},A=()=>{if(c.isClosePausedRef.current){const O=new CustomEvent(d1);T.dispatchEvent(O),c.isClosePausedRef.current=!1}},R=O=>{!S.contains(O.relatedTarget)&&A()},B=()=>{S.contains(document.activeElement)||A()};return S.addEventListener("focusin",M),S.addEventListener("focusout",R),S.addEventListener("pointermove",M),S.addEventListener("pointerleave",B),window.addEventListener("blur",M),window.addEventListener("focus",A),()=>{S.removeEventListener("focusin",M),S.removeEventListener("focusout",R),S.removeEventListener("pointermove",M),S.removeEventListener("pointerleave",B),window.removeEventListener("blur",M),window.removeEventListener("focus",A)}}},[N,c.isClosePausedRef]);const k=w.useCallback(({tabbingDirection:S})=>{const M=d().map(A=>{const R=A.ref.current,B=[R,...oK(R)];return S==="forwards"?B:B.reverse()});return(S==="forwards"?M.reverse():M).flat()},[d]);return w.useEffect(()=>{const S=x.current;if(S){const T=M=>{const A=M.altKey||M.ctrlKey||M.metaKey;if(M.key==="Tab"&&!A){const B=document.activeElement,O=M.shiftKey;if(M.target===S&&O){f.current?.focus();return}const U=k({tabbingDirection:O?"backwards":"forwards"}),I=U.findIndex(G=>G===B);gx(U.slice(I+1))?M.preventDefault():O?f.current?.focus():p.current?.focus()}};return S.addEventListener("keydown",T),()=>S.removeEventListener("keydown",T)}},[d,k]),r.jsxs(uT,{ref:m,role:"region","aria-label":l.replace("{hotkey}",b),tabIndex:-1,style:{pointerEvents:N?void 0:"none"},children:[N&&r.jsx(m1,{ref:f,onFocusFromOutsideViewport:()=>{const S=k({tabbingDirection:"forwards"});gx(S)}}),r.jsx(Yg.Slot,{scope:n,children:r.jsx(It.ol,{tabIndex:-1,...o,ref:y})}),N&&r.jsx(m1,{ref:p,onFocusFromOutsideViewport:()=>{const S=k({tabbingDirection:"backwards"});gx(S)}})]})});rS.displayName=nS;var aS="ToastFocusProxy",m1=w.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:a,...l}=e,o=ah(aS,n);return r.jsx(a6,{tabIndex:0,...l,ref:t,style:{position:"fixed"},onFocus:c=>{const d=c.relatedTarget;!o.viewport?.contains(d)&&a()}})});m1.displayName=aS;var ld="Toast",KX="toast.swipeStart",QX="toast.swipeMove",ZX="toast.swipeCancel",JX="toast.swipeEnd",sS=w.forwardRef((e,t)=>{const{forceMount:n,open:a,defaultOpen:l,onOpenChange:o,...c}=e,[d,m]=zl({prop:a,defaultProp:l??!0,onChange:o,caller:ld});return r.jsx(Wr,{present:n||d,children:r.jsx(nK,{open:d,...c,ref:t,onClose:()=>m(!1),onPause:yr(e.onPause),onResume:yr(e.onResume),onSwipeStart:Pe(e.onSwipeStart,f=>{f.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Pe(e.onSwipeMove,f=>{const{x:p,y:x}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","move"),f.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${p}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${x}px`)}),onSwipeCancel:Pe(e.onSwipeCancel,f=>{f.currentTarget.setAttribute("data-swipe","cancel"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Pe(e.onSwipeEnd,f=>{const{x:p,y:x}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","end"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${p}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${x}px`),m(!1)})})})});sS.displayName=ld;var[eK,tK]=eS(ld,{onClose(){}}),nK=w.forwardRef((e,t)=>{const{__scopeToast:n,type:a="foreground",duration:l,open:o,onClose:c,onEscapeKeyDown:d,onPause:m,onResume:f,onSwipeStart:p,onSwipeMove:x,onSwipeCancel:y,onSwipeEnd:b,...N}=e,k=ah(ld,n),[S,T]=w.useState(null),M=mn(t,J=>T(J)),A=w.useRef(null),R=w.useRef(null),B=l||k.duration,O=w.useRef(0),L=w.useRef(B),$=w.useRef(0),{onToastAdd:U,onToastRemove:I}=k,G=yr(()=>{S?.contains(document.activeElement)&&k.viewport?.focus(),c()}),ee=w.useCallback(J=>{!J||J===1/0||(window.clearTimeout($.current),O.current=new Date().getTime(),$.current=window.setTimeout(G,J))},[G]);w.useEffect(()=>{const J=k.viewport;if(J){const se=()=>{ee(L.current),f?.()},H=()=>{const le=new Date().getTime()-O.current;L.current=L.current-le,window.clearTimeout($.current),m?.()};return J.addEventListener(u1,H),J.addEventListener(d1,se),()=>{J.removeEventListener(u1,H),J.removeEventListener(d1,se)}}},[k.viewport,B,m,f,ee]),w.useEffect(()=>{o&&!k.isClosePausedRef.current&&ee(B)},[o,B,k.isClosePausedRef,ee]),w.useEffect(()=>(U(),()=>I()),[U,I]);const Ne=w.useMemo(()=>S?mS(S):null,[S]);return k.viewport?r.jsxs(r.Fragment,{children:[Ne&&r.jsx(rK,{__scopeToast:n,role:"status","aria-live":a==="foreground"?"assertive":"polite",children:Ne}),r.jsx(eK,{scope:n,onClose:G,children:qC.createPortal(r.jsx(Yg.ItemSlot,{scope:n,children:r.jsx(dT,{asChild:!0,onEscapeKeyDown:Pe(d,()=>{k.isFocusedToastEscapeKeyDownRef.current||G(),k.isFocusedToastEscapeKeyDownRef.current=!1}),children:r.jsx(It.li,{tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":k.swipeDirection,...N,ref:M,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Pe(e.onKeyDown,J=>{J.key==="Escape"&&(d?.(J.nativeEvent),J.nativeEvent.defaultPrevented||(k.isFocusedToastEscapeKeyDownRef.current=!0,G()))}),onPointerDown:Pe(e.onPointerDown,J=>{J.button===0&&(A.current={x:J.clientX,y:J.clientY})}),onPointerMove:Pe(e.onPointerMove,J=>{if(!A.current)return;const se=J.clientX-A.current.x,H=J.clientY-A.current.y,le=!!R.current,re=["left","right"].includes(k.swipeDirection),ge=["left","up"].includes(k.swipeDirection)?Math.min:Math.max,E=re?ge(0,se):0,we=re?0:ge(0,H),Z=J.pointerType==="touch"?10:2,z={x:E,y:we},X={originalEvent:J,delta:z};le?(R.current=z,U0(QX,x,X,{discrete:!1})):R5(z,k.swipeDirection,Z)?(R.current=z,U0(KX,p,X,{discrete:!1}),J.target.setPointerCapture(J.pointerId)):(Math.abs(se)>Z||Math.abs(H)>Z)&&(A.current=null)}),onPointerUp:Pe(e.onPointerUp,J=>{const se=R.current,H=J.target;if(H.hasPointerCapture(J.pointerId)&&H.releasePointerCapture(J.pointerId),R.current=null,A.current=null,se){const le=J.currentTarget,re={originalEvent:J,delta:se};R5(se,k.swipeDirection,k.swipeThreshold)?U0(JX,b,re,{discrete:!0}):U0(ZX,y,re,{discrete:!0}),le.addEventListener("click",ge=>ge.preventDefault(),{once:!0})}})})})}),k.viewport)})]}):null}),rK=e=>{const{__scopeToast:t,children:n,...a}=e,l=ah(ld,t),[o,c]=w.useState(!1),[d,m]=w.useState(!1);return lK(()=>c(!0)),w.useEffect(()=>{const f=window.setTimeout(()=>m(!0),1e3);return()=>window.clearTimeout(f)},[]),d?null:r.jsx(Nm,{asChild:!0,children:r.jsx(a6,{...a,children:o&&r.jsxs(r.Fragment,{children:[l.label," ",n]})})})},aK="ToastTitle",lS=w.forwardRef((e,t)=>{const{__scopeToast:n,...a}=e;return r.jsx(It.div,{...a,ref:t})});lS.displayName=aK;var sK="ToastDescription",iS=w.forwardRef((e,t)=>{const{__scopeToast:n,...a}=e;return r.jsx(It.div,{...a,ref:t})});iS.displayName=sK;var oS="ToastAction",cS=w.forwardRef((e,t)=>{const{altText:n,...a}=e;return n.trim()?r.jsx(dS,{altText:n,asChild:!0,children:r.jsx(Wg,{...a,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${oS}\`. Expected non-empty \`string\`.`),null)});cS.displayName=oS;var uS="ToastClose",Wg=w.forwardRef((e,t)=>{const{__scopeToast:n,...a}=e,l=tK(uS,n);return r.jsx(dS,{asChild:!0,children:r.jsx(It.button,{type:"button",...a,ref:t,onClick:Pe(e.onClick,l.onClose)})})});Wg.displayName=uS;var dS=w.forwardRef((e,t)=>{const{__scopeToast:n,altText:a,...l}=e;return r.jsx(It.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":a||void 0,...l,ref:t})});function mS(e){const t=[];return Array.from(e.childNodes).forEach(a=>{if(a.nodeType===a.TEXT_NODE&&a.textContent&&t.push(a.textContent),iK(a)){const l=a.ariaHidden||a.hidden||a.style.display==="none",o=a.dataset.radixToastAnnounceExclude==="";if(!l)if(o){const c=a.dataset.radixToastAnnounceAlt;c&&t.push(c)}else t.push(...mS(a))}}),t}function U0(e,t,n,{discrete:a}){const l=n.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&l.addEventListener(e,t,{once:!0}),a?r6(l,o):l.dispatchEvent(o)}var R5=(e,t,n=0)=>{const a=Math.abs(e.x),l=Math.abs(e.y),o=a>l;return t==="left"||t==="right"?o&&a>n:!o&&l>n};function lK(e=()=>{}){const t=yr(e);F5(()=>{let n=0,a=0;return n=window.requestAnimationFrame(()=>a=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(a)}},[t])}function iK(e){return e.nodeType===e.ELEMENT_NODE}function oK(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const l=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||l?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function gx(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var cK=tS,hS=rS,fS=sS,pS=lS,xS=iS,gS=cS,vS=Wg;const uK=cK,yS=w.forwardRef(({className:e,...t},n)=>r.jsx(hS,{ref:n,className:he("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));yS.displayName=hS.displayName;const dK=Ko("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),bS=w.forwardRef(({className:e,variant:t,...n},a)=>r.jsx(fS,{ref:a,className:he(dK({variant:t}),e),...n}));bS.displayName=fS.displayName;const mK=w.forwardRef(({className:e,...t},n)=>r.jsx(gS,{ref:n,className:he("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));mK.displayName=gS.displayName;const wS=w.forwardRef(({className:e,...t},n)=>r.jsx(vS,{ref:n,className:he("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:r.jsx(Au,{className:"h-4 w-4"})}));wS.displayName=vS.displayName;const jS=w.forwardRef(({className:e,...t},n)=>r.jsx(pS,{ref:n,className:he("text-sm font-semibold [&+div]:text-xs",e),...t}));jS.displayName=pS.displayName;const NS=w.forwardRef(({className:e,...t},n)=>r.jsx(xS,{ref:n,className:he("text-sm opacity-90",e),...t}));NS.displayName=xS.displayName;function hK(){const{toasts:e}=or();return r.jsxs(uK,{children:[e.map(function({id:t,title:n,description:a,action:l,...o}){return r.jsxs(bS,{...o,children:[r.jsxs("div",{className:"grid gap-1",children:[n&&r.jsx(jS,{children:n}),a&&r.jsx(NS,{children:a})]}),l,r.jsx(wS,{})]},t)}),r.jsx(yS,{})]})}IT.createRoot(document.getElementById("root")).render(r.jsx(w.StrictMode,{children:r.jsx($X,{defaultTheme:"system",children:r.jsxs(VX,{children:[r.jsx(HC,{router:UX}),r.jsx(hK,{})]})})})); diff --git a/webui/dist/index.html b/webui/dist/index.html index 38883573..e0bd7ed3 100644 --- a/webui/dist/index.html +++ b/webui/dist/index.html @@ -5,12 +5,12 @@ MaiBot Dashboard - + - + - + From 5d9bf243d23ec68ce32ff770499349a379374a2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Thu, 20 Nov 2025 18:28:56 +0800 Subject: [PATCH 09/11] upload WebUI 0.11.5 Beta.989d879 DashBoard after Build Files commit hash : 989d87984feacb7e793a0dfb8a234dfccbfb2eed --- .../{index-B-xgVyqE.js => index-DjSFnv4K.js} | 60 +++++++++---------- webui/dist/index.html | 2 +- 2 files changed, 31 insertions(+), 31 deletions(-) rename webui/dist/assets/{index-B-xgVyqE.js => index-DjSFnv4K.js} (89%) diff --git a/webui/dist/assets/index-B-xgVyqE.js b/webui/dist/assets/index-DjSFnv4K.js similarity index 89% rename from webui/dist/assets/index-B-xgVyqE.js rename to webui/dist/assets/index-DjSFnv4K.js index 43d286e9..f3ad35f9 100644 --- a/webui/dist/assets/index-B-xgVyqE.js +++ b/webui/dist/assets/index-DjSFnv4K.js @@ -1,17 +1,17 @@ -import{r as S,j as a,u as wa,R as Ue,d as AI,L as MI,e as EI,f as Xr,g as _I,h as DI,O as c9,b as RI,k as zI}from"./router-BWgTyY51.js";import{a as PI,b as BI,g as u9}from"./react-vendor-Dtc2IqVY.js";import{c as d9,R as LI,T as II,L as qI,a as FI,C as Vm,X as Wm,Y as Ch,b as QI,B as fy,d as Gm,P as $I,e as HI,f as UI,_ as VI,g as WI}from"./charts-B1JvyJzO.js";import{c as Vi,a as tx,u as ji,P as Zt,b as $e,d as Cn,e as Vf,f as ko,g as es,h as Ls,i as h9,j as F4,k as Q4,S as GI,l as f9,m as m9,R as p9,O as nx,n as $4,C as rx,o as H4,T as U4,D as V4,p as W4,q as g9,r as x9,W as XI,s as v9,I as YI,t as y9,v as b9,w as KI,x as w9,V as ZI,L as S9,y as k9,z as JI,A as eq,B as O9,E as tq,F as nq,G as oo,H as sx,J as wd,K as j9,M as N9,N as C9,Q as T9,U as G4,X as X4,Y as ix,Z as ax,_ as Y4,$ as A9,a0 as rq,a1 as M9,a2 as sq,a3 as iq,a4 as E9,a5 as aq}from"./ui-vendor-nTGLnMlb.js";import{R as Fi,A as lq,D as oq,a as cq,Z as uf,C as dc,M as Wf,T as uq,X as Gf,P as _9,S as dq,b as Ii,I as co,c as Hu,d as hc,e as Xb,E as Yb,f as $i,g as Es,h as Kb,i as hq,j as Zb,k as Jb,L as lO,K as fq,l as xc,m as mq,n as pq,F as ao,o as gq,B as xq,U as D9,p as K4,q as vq,r as yq,s as Bs,H as hg,t as R9,u as df,v as e2,w as hf,x as bq,y as wq,z as lx,G as Z4,J as Wr,N as Ht,O as fg,Q as nd,V as Xf,W as Tc,Y as Ac,_ as Yf,$ as Sq,a0 as oO,a1 as kq,a2 as fc,a3 as t2,a4 as rd,a5 as cO,a6 as mg,a7 as Oq,a8 as uO,a9 as jq,aa as Nq,ab as Jl,ac as my,ad as dO,ae as Cq,af as Yh,ag as pg,ah as z9,ai as P9,aj as B9,ak as Tq,al as Aq,am as hO,an as Mq,ao as Eq,ap as fO,aq as _q}from"./icons-D6w7t-x9.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var py={exports:{}},Th={},gy={exports:{}},xy={};var mO;function Dq(){return mO||(mO=1,(function(t){function e($,ae){var ne=$.length;$.push(ae);e:for(;0>>1,z=$[ce];if(0>>1;ces(P,ne))Ks(H,P)?($[ce]=H,$[K]=ne,ce=K):($[ce]=P,$[Y]=ne,ce=Y);else if(Ks(H,ne))$[ce]=H,$[K]=ne,ce=K;else break e}}return ae}function s($,ae){var ne=$.sortIndex-ae.sortIndex;return ne!==0?ne:$.id-ae.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var l=Date,c=l.now();t.unstable_now=function(){return l.now()-c}}var d=[],h=[],m=1,p=null,x=3,v=!1,b=!1,k=!1,O=!1,j=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function _($){for(var ae=n(h);ae!==null;){if(ae.callback===null)r(h);else if(ae.startTime<=$)r(h),ae.sortIndex=ae.expirationTime,e(d,ae);else break;ae=n(h)}}function D($){if(k=!1,_($),!b)if(n(d)!==null)b=!0,E||(E=!0,V());else{var ae=n(h);ae!==null&&J(D,ae.startTime-$)}}var E=!1,R=-1,Q=5,F=-1;function L(){return O?!0:!(t.unstable_now()-F$&&L());){var ce=p.callback;if(typeof ce=="function"){p.callback=null,x=p.priorityLevel;var z=ce(p.expirationTime<=$);if($=t.unstable_now(),typeof z=="function"){p.callback=z,_($),ae=!0;break t}p===n(d)&&r(d),_($)}else r(d);p=n(d)}if(p!==null)ae=!0;else{var xe=n(h);xe!==null&&J(D,xe.startTime-$),ae=!1}}break e}finally{p=null,x=ne,v=!1}ae=void 0}}finally{ae?V():E=!1}}}var V;if(typeof A=="function")V=function(){A(U)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,W=de.port2;de.port1.onmessage=U,V=function(){W.postMessage(null)}}else V=function(){j(U,0)};function J($,ae){R=j(function(){$(t.unstable_now())},ae)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function($){$.callback=null},t.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<$?Math.floor(1e3/$):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_next=function($){switch(x){case 1:case 2:case 3:var ae=3;break;default:ae=x}var ne=x;x=ae;try{return $()}finally{x=ne}},t.unstable_requestPaint=function(){O=!0},t.unstable_runWithPriority=function($,ae){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var ne=x;x=$;try{return ae()}finally{x=ne}},t.unstable_scheduleCallback=function($,ae,ne){var ce=t.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0ce?($.sortIndex=ne,e(h,$),n(d)===null&&$===n(h)&&(k?(T(R),R=-1):k=!0,J(D,ne-ce))):($.sortIndex=z,e(d,$),b||v||(b=!0,E||(E=!0,V()))),$},t.unstable_shouldYield=L,t.unstable_wrapCallback=function($){var ae=x;return function(){var ne=x;x=ae;try{return $.apply(this,arguments)}finally{x=ne}}}})(xy)),xy}var pO;function Rq(){return pO||(pO=1,gy.exports=Dq()),gy.exports}var gO;function zq(){if(gO)return Th;gO=1;var t=Rq(),e=PI(),n=BI();function r(o){var u="https://react.dev/errors/"+o;if(1z||(o.current=ce[z],ce[z]=null,z--)}function P(o,u){z++,ce[z]=o.current,o.current=u}var K=xe(null),H=xe(null),fe=xe(null),ve=xe(null);function Re(o,u){switch(P(fe,u),P(H,o),P(K,null),u.nodeType){case 9:case 11:o=(o=u.documentElement)&&(o=o.namespaceURI)?Mk(o):0;break;default:if(o=u.tagName,u=u.namespaceURI)u=Mk(u),o=Ek(u,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}Y(K),P(K,o)}function ue(){Y(K),Y(H),Y(fe)}function We(o){o.memoizedState!==null&&P(ve,o);var u=K.current,f=Ek(u,o.type);u!==f&&(P(H,o),P(K,f))}function ct(o){H.current===o&&(Y(K),Y(H)),ve.current===o&&(Y(ve),kh._currentValue=ne)}var Oe,nt;function ut(o){if(Oe===void 0)try{throw Error()}catch(f){var u=f.stack.trim().match(/\n( *(at )?)/);Oe=u&&u[1]||"",nt=-1{for(const i of s)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var py={exports:{}},Th={},gy={exports:{}},xy={};var mO;function Dq(){return mO||(mO=1,(function(t){function e($,ae){var ne=$.length;$.push(ae);e:for(;0>>1,R=$[ue];if(0>>1;ues(P,ne))Ks(H,P)?($[ue]=H,$[K]=ne,ue=K):($[ue]=P,$[Y]=ne,ue=Y);else if(Ks(H,ne))$[ue]=H,$[K]=ne,ue=K;else break e}}return ae}function s($,ae){var ne=$.sortIndex-ae.sortIndex;return ne!==0?ne:$.id-ae.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var l=Date,c=l.now();t.unstable_now=function(){return l.now()-c}}var d=[],h=[],m=1,p=null,x=3,v=!1,b=!1,k=!1,O=!1,j=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function _($){for(var ae=n(h);ae!==null;){if(ae.callback===null)r(h);else if(ae.startTime<=$)r(h),ae.sortIndex=ae.expirationTime,e(d,ae);else break;ae=n(h)}}function D($){if(k=!1,_($),!b)if(n(d)!==null)b=!0,E||(E=!0,V());else{var ae=n(h);ae!==null&&J(D,ae.startTime-$)}}var E=!1,z=-1,Q=5,F=-1;function L(){return O?!0:!(t.unstable_now()-F$&&L());){var ue=p.callback;if(typeof ue=="function"){p.callback=null,x=p.priorityLevel;var R=ue(p.expirationTime<=$);if($=t.unstable_now(),typeof R=="function"){p.callback=R,_($),ae=!0;break t}p===n(d)&&r(d),_($)}else r(d);p=n(d)}if(p!==null)ae=!0;else{var me=n(h);me!==null&&J(D,me.startTime-$),ae=!1}}break e}finally{p=null,x=ne,v=!1}ae=void 0}}finally{ae?V():E=!1}}}var V;if(typeof A=="function")V=function(){A(U)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,W=ce.port2;ce.port1.onmessage=U,V=function(){W.postMessage(null)}}else V=function(){j(U,0)};function J($,ae){z=j(function(){$(t.unstable_now())},ae)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function($){$.callback=null},t.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<$?Math.floor(1e3/$):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_next=function($){switch(x){case 1:case 2:case 3:var ae=3;break;default:ae=x}var ne=x;x=ae;try{return $()}finally{x=ne}},t.unstable_requestPaint=function(){O=!0},t.unstable_runWithPriority=function($,ae){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var ne=x;x=$;try{return ae()}finally{x=ne}},t.unstable_scheduleCallback=function($,ae,ne){var ue=t.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0ue?($.sortIndex=ne,e(h,$),n(d)===null&&$===n(h)&&(k?(T(z),z=-1):k=!0,J(D,ne-ue))):($.sortIndex=R,e(d,$),b||v||(b=!0,E||(E=!0,V()))),$},t.unstable_shouldYield=L,t.unstable_wrapCallback=function($){var ae=x;return function(){var ne=x;x=ae;try{return $.apply(this,arguments)}finally{x=ne}}}})(xy)),xy}var pO;function Rq(){return pO||(pO=1,gy.exports=Dq()),gy.exports}var gO;function zq(){if(gO)return Th;gO=1;var t=Rq(),e=PI(),n=BI();function r(o){var u="https://react.dev/errors/"+o;if(1R||(o.current=ue[R],ue[R]=null,R--)}function P(o,u){R++,ue[R]=o.current,o.current=u}var K=me(null),H=me(null),fe=me(null),ve=me(null);function Re(o,u){switch(P(fe,u),P(H,o),P(K,null),u.nodeType){case 9:case 11:o=(o=u.documentElement)&&(o=o.namespaceURI)?Mk(o):0;break;default:if(o=u.tagName,u=u.namespaceURI)u=Mk(u),o=Ek(u,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}Y(K),P(K,o)}function de(){Y(K),Y(H),Y(fe)}function We(o){o.memoizedState!==null&&P(ve,o);var u=K.current,f=Ek(u,o.type);u!==f&&(P(H,o),P(K,f))}function ct(o){H.current===o&&(Y(K),Y(H)),ve.current===o&&(Y(ve),kh._currentValue=ne)}var Oe,nt;function ut(o){if(Oe===void 0)try{throw Error()}catch(f){var u=f.stack.trim().match(/\n( *(at )?)/);Oe=u&&u[1]||"",nt=-1)":-1y||Z[g]!==ge[y]){var je=` +`),xe=I.split(` +`);for(y=g=0;gy||Z[g]!==xe[y]){var je=` `+Z[g].replace(" at new "," at ");return o.displayName&&je.includes("")&&(je=je.replace("",o.displayName)),je}while(1<=g&&0<=y);break}}}finally{Ct=!1,Error.prepareStackTrace=f}return(f=o?o.displayName||o.name:"")?ut(f):""}function Tn(o,u){switch(o.tag){case 26:case 27:case 5:return ut(o.type);case 16:return ut("Lazy");case 13:return o.child!==u&&u!==null?ut("Suspense Fallback"):ut("Suspense");case 19:return ut("SuspenseList");case 0:case 15:return In(o.type,!1);case 11:return In(o.type.render,!1);case 1:return In(o.type,!0);case 31:return ut("Activity");default:return""}}function Jn(o){try{var u="",f=null;do u+=Tn(o,f),f=o,o=o.return;while(o);return u}catch(g){return` Error generating stack: `+g.message+` -`+g.stack}}var nn=Object.prototype.hasOwnProperty,_t=t.unstable_scheduleCallback,Yr=t.unstable_cancelCallback,qn=t.unstable_shouldYield,or=t.unstable_requestPaint,yn=t.unstable_now,ft=t.unstable_getCurrentPriorityLevel,ee=t.unstable_ImmediatePriority,Se=t.unstable_UserBlockingPriority,Be=t.unstable_NormalPriority,rt=t.unstable_LowPriority,Tt=t.unstable_IdlePriority,cr=t.log,Kr=t.unstable_setDisableYieldValue,re=null,Ae=null;function pt(o){if(typeof cr=="function"&&Kr(o),Ae&&typeof Ae.setStrictMode=="function")try{Ae.setStrictMode(re,o)}catch{}}var yt=Math.clz32?Math.clz32:Pn,vs=Math.log,dt=Math.LN2;function Pn(o){return o>>>=0,o===0?32:31-(vs(o)/dt|0)|0}var mt=256,rn=262144,Mr=4194304;function At(o){var u=o&42;if(u!==0)return u;switch(o&-o){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Ic(o,u,f){var g=o.pendingLanes;if(g===0)return 0;var y=0,w=o.suspendedLanes,M=o.pingedLanes;o=o.warmLanes;var I=g&134217727;return I!==0?(g=I&~w,g!==0?y=At(g):(M&=I,M!==0?y=At(M):f||(f=I&~o,f!==0&&(y=At(f))))):(I=g&~w,I!==0?y=At(I):M!==0?y=At(M):f||(f=g&~o,f!==0&&(y=At(f)))),y===0?0:u!==0&&u!==y&&(u&w)===0&&(w=y&-y,f=u&-u,w>=f||w===32&&(f&4194048)!==0)?u:y}function _o(o,u){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&u)===0}function t1(o,u){switch(o){case 1:case 2:case 4:case 8:case 64:return u+250;case 16:case 32: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 u+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function qc(){var o=Mr;return Mr<<=1,(Mr&62914560)===0&&(Mr=4194304),o}function Do(o){for(var u=[],f=0;31>f;f++)u.push(o);return u}function Bd(o,u){o.pendingLanes|=u,u!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function xB(o,u,f,g,y,w){var M=o.pendingLanes;o.pendingLanes=f,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=f,o.entangledLanes&=f,o.errorRecoveryDisabledLanes&=f,o.shellSuspendCounter=0;var I=o.entanglements,Z=o.expirationTimes,ge=o.hiddenUpdates;for(f=M&~f;0"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var kB=/[\n"\\]/g;function ci(o){return o.replace(kB,function(u){return"\\"+u.charCodeAt(0).toString(16)+" "})}function l1(o,u,f,g,y,w,M,I){o.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?o.type=M:o.removeAttribute("type"),u!=null?M==="number"?(u===0&&o.value===""||o.value!=u)&&(o.value=""+oi(u)):o.value!==""+oi(u)&&(o.value=""+oi(u)):M!=="submit"&&M!=="reset"||o.removeAttribute("value"),u!=null?o1(o,M,oi(u)):f!=null?o1(o,M,oi(f)):g!=null&&o.removeAttribute("value"),y==null&&w!=null&&(o.defaultChecked=!!w),y!=null&&(o.checked=y&&typeof y!="function"&&typeof y!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?o.name=""+oi(I):o.removeAttribute("name")}function O3(o,u,f,g,y,w,M,I){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(o.type=w),u!=null||f!=null){if(!(w!=="submit"&&w!=="reset"||u!=null)){a1(o);return}f=f!=null?""+oi(f):"",u=u!=null?""+oi(u):f,I||u===o.value||(o.value=u),o.defaultValue=u}g=g??y,g=typeof g!="function"&&typeof g!="symbol"&&!!g,o.checked=I?o.checked:!!g,o.defaultChecked=!!g,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(o.name=M),a1(o)}function o1(o,u,f){u==="number"&&P0(o.ownerDocument)===o||o.defaultValue===""+f||(o.defaultValue=""+f)}function Vc(o,u,f,g){if(o=o.options,u){u={};for(var y=0;y"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f1=!1;if(Da)try{var Fd={};Object.defineProperty(Fd,"passive",{get:function(){f1=!0}}),window.addEventListener("test",Fd,Fd),window.removeEventListener("test",Fd,Fd)}catch{f1=!1}var jl=null,m1=null,L0=null;function E3(){if(L0)return L0;var o,u=m1,f=u.length,g,y="value"in jl?jl.value:jl.textContent,w=y.length;for(o=0;o=Hd),B3=" ",L3=!1;function I3(o,u){switch(o){case"keyup":return KB.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function q3(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Yc=!1;function JB(o,u){switch(o){case"compositionend":return q3(u);case"keypress":return u.which!==32?null:(L3=!0,B3);case"textInput":return o=u.data,o===B3&&L3?null:o;default:return null}}function eL(o,u){if(Yc)return o==="compositionend"||!y1&&I3(o,u)?(o=E3(),L0=m1=jl=null,Yc=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1=u)return{node:f,offset:u-o};o=g}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=G3(f)}}function Y3(o,u){return o&&u?o===u?!0:o&&o.nodeType===3?!1:u&&u.nodeType===3?Y3(o,u.parentNode):"contains"in o?o.contains(u):o.compareDocumentPosition?!!(o.compareDocumentPosition(u)&16):!1:!1}function K3(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var u=P0(o.document);u instanceof o.HTMLIFrameElement;){try{var f=typeof u.contentWindow.location.href=="string"}catch{f=!1}if(f)o=u.contentWindow;else break;u=P0(o.document)}return u}function S1(o){var u=o&&o.nodeName&&o.nodeName.toLowerCase();return u&&(u==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||u==="textarea"||o.contentEditable==="true")}var oL=Da&&"documentMode"in document&&11>=document.documentMode,Kc=null,k1=null,Gd=null,O1=!1;function Z3(o,u,f){var g=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;O1||Kc==null||Kc!==P0(g)||(g=Kc,"selectionStart"in g&&S1(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Gd&&Wd(Gd,g)||(Gd=g,g=Em(k1,"onSelect"),0>=M,y-=M,Yi=1<<32-yt(u)+y|f<kt?(Qt=Ke,Ke=null):Qt=Ke.sibling;var en=be(oe,Ke,me[kt],Ne);if(en===null){Ke===null&&(Ke=Qt);break}o&&Ke&&en.alternate===null&&u(oe,Ke),se=w(en,se,kt),Jt===null?tt=en:Jt.sibling=en,Jt=en,Ke=Qt}if(kt===me.length)return f(oe,Ke),Ut&&za(oe,kt),tt;if(Ke===null){for(;ktkt?(Qt=Ke,Ke=null):Qt=Ke.sibling;var Wl=be(oe,Ke,en.value,Ne);if(Wl===null){Ke===null&&(Ke=Qt);break}o&&Ke&&Wl.alternate===null&&u(oe,Ke),se=w(Wl,se,kt),Jt===null?tt=Wl:Jt.sibling=Wl,Jt=Wl,Ke=Qt}if(en.done)return f(oe,Ke),Ut&&za(oe,kt),tt;if(Ke===null){for(;!en.done;kt++,en=me.next())en=Te(oe,en.value,Ne),en!==null&&(se=w(en,se,kt),Jt===null?tt=en:Jt.sibling=en,Jt=en);return Ut&&za(oe,kt),tt}for(Ke=g(Ke);!en.done;kt++,en=me.next())en=ke(Ke,oe,kt,en.value,Ne),en!==null&&(o&&en.alternate!==null&&Ke.delete(en.key===null?kt:en.key),se=w(en,se,kt),Jt===null?tt=en:Jt.sibling=en,Jt=en);return o&&Ke.forEach(function(TI){return u(oe,TI)}),Ut&&za(oe,kt),tt}function Sn(oe,se,me,Ne){if(typeof me=="object"&&me!==null&&me.type===k&&me.key===null&&(me=me.props.children),typeof me=="object"&&me!==null){switch(me.$$typeof){case v:e:{for(var tt=me.key;se!==null;){if(se.key===tt){if(tt=me.type,tt===k){if(se.tag===7){f(oe,se.sibling),Ne=y(se,me.props.children),Ne.return=oe,oe=Ne;break e}}else if(se.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===Q&&Ho(tt)===se.type){f(oe,se.sibling),Ne=y(se,me.props),eh(Ne,me),Ne.return=oe,oe=Ne;break e}f(oe,se);break}else u(oe,se);se=se.sibling}me.type===k?(Ne=Io(me.props.children,oe.mode,Ne,me.key),Ne.return=oe,oe=Ne):(Ne=G0(me.type,me.key,me.props,null,oe.mode,Ne),eh(Ne,me),Ne.return=oe,oe=Ne)}return M(oe);case b:e:{for(tt=me.key;se!==null;){if(se.key===tt)if(se.tag===4&&se.stateNode.containerInfo===me.containerInfo&&se.stateNode.implementation===me.implementation){f(oe,se.sibling),Ne=y(se,me.children||[]),Ne.return=oe,oe=Ne;break e}else{f(oe,se);break}else u(oe,se);se=se.sibling}Ne=E1(me,oe.mode,Ne),Ne.return=oe,oe=Ne}return M(oe);case Q:return me=Ho(me),Sn(oe,se,me,Ne)}if(J(me))return Ge(oe,se,me,Ne);if(V(me)){if(tt=V(me),typeof tt!="function")throw Error(r(150));return me=tt.call(me),lt(oe,se,me,Ne)}if(typeof me.then=="function")return Sn(oe,se,tm(me),Ne);if(me.$$typeof===A)return Sn(oe,se,K0(oe,me),Ne);nm(oe,me)}return typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint"?(me=""+me,se!==null&&se.tag===6?(f(oe,se.sibling),Ne=y(se,me),Ne.return=oe,oe=Ne):(f(oe,se),Ne=M1(me,oe.mode,Ne),Ne.return=oe,oe=Ne),M(oe)):f(oe,se)}return function(oe,se,me,Ne){try{Jd=0;var tt=Sn(oe,se,me,Ne);return ou=null,tt}catch(Ke){if(Ke===lu||Ke===J0)throw Ke;var Jt=Hs(29,Ke,null,oe.mode);return Jt.lanes=Ne,Jt.return=oe,Jt}finally{}}}var Vo=w6(!0),S6=w6(!1),Ml=!1;function $1(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function H1(o,u){o=o.updateQueue,u.updateQueue===o&&(u.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function El(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function _l(o,u,f){var g=o.updateQueue;if(g===null)return null;if(g=g.shared,(sn&2)!==0){var y=g.pending;return y===null?u.next=u:(u.next=y.next,y.next=u),g.pending=u,u=W0(o),i6(o,null,f),u}return V0(o,g,u,f),W0(o)}function th(o,u,f){if(u=u.updateQueue,u!==null&&(u=u.shared,(f&4194048)!==0)){var g=u.lanes;g&=o.pendingLanes,f|=g,u.lanes=f,f3(o,f)}}function U1(o,u){var f=o.updateQueue,g=o.alternate;if(g!==null&&(g=g.updateQueue,f===g)){var y=null,w=null;if(f=f.firstBaseUpdate,f!==null){do{var M={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};w===null?y=w=M:w=w.next=M,f=f.next}while(f!==null);w===null?y=w=u:w=w.next=u}else y=w=u;f={baseState:g.baseState,firstBaseUpdate:y,lastBaseUpdate:w,shared:g.shared,callbacks:g.callbacks},o.updateQueue=f;return}o=f.lastBaseUpdate,o===null?f.firstBaseUpdate=u:o.next=u,f.lastBaseUpdate=u}var V1=!1;function nh(){if(V1){var o=au;if(o!==null)throw o}}function rh(o,u,f,g){V1=!1;var y=o.updateQueue;Ml=!1;var w=y.firstBaseUpdate,M=y.lastBaseUpdate,I=y.shared.pending;if(I!==null){y.shared.pending=null;var Z=I,ge=Z.next;Z.next=null,M===null?w=ge:M.next=ge,M=Z;var je=o.alternate;je!==null&&(je=je.updateQueue,I=je.lastBaseUpdate,I!==M&&(I===null?je.firstBaseUpdate=ge:I.next=ge,je.lastBaseUpdate=Z))}if(w!==null){var Te=y.baseState;M=0,je=ge=Z=null,I=w;do{var be=I.lane&-536870913,ke=be!==I.lane;if(ke?(Ft&be)===be:(g&be)===be){be!==0&&be===iu&&(V1=!0),je!==null&&(je=je.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});e:{var Ge=o,lt=I;be=u;var Sn=f;switch(lt.tag){case 1:if(Ge=lt.payload,typeof Ge=="function"){Te=Ge.call(Sn,Te,be);break e}Te=Ge;break e;case 3:Ge.flags=Ge.flags&-65537|128;case 0:if(Ge=lt.payload,be=typeof Ge=="function"?Ge.call(Sn,Te,be):Ge,be==null)break e;Te=p({},Te,be);break e;case 2:Ml=!0}}be=I.callback,be!==null&&(o.flags|=64,ke&&(o.flags|=8192),ke=y.callbacks,ke===null?y.callbacks=[be]:ke.push(be))}else ke={lane:be,tag:I.tag,payload:I.payload,callback:I.callback,next:null},je===null?(ge=je=ke,Z=Te):je=je.next=ke,M|=be;if(I=I.next,I===null){if(I=y.shared.pending,I===null)break;ke=I,I=ke.next,ke.next=null,y.lastBaseUpdate=ke,y.shared.pending=null}}while(!0);je===null&&(Z=Te),y.baseState=Z,y.firstBaseUpdate=ge,y.lastBaseUpdate=je,w===null&&(y.shared.lanes=0),Bl|=M,o.lanes=M,o.memoizedState=Te}}function k6(o,u){if(typeof o!="function")throw Error(r(191,o));o.call(u)}function O6(o,u){var f=o.callbacks;if(f!==null)for(o.callbacks=null,o=0;ow?w:8;var M=$.T,I={};$.T=I,dv(o,!1,u,f);try{var Z=y(),ge=$.S;if(ge!==null&&ge(I,Z),Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var je=xL(Z,g);ah(o,u,je,Xs(o))}else ah(o,u,g,Xs(o))}catch(Te){ah(o,u,{then:function(){},status:"rejected",reason:Te},Xs())}finally{ae.p=w,M!==null&&I.types!==null&&(M.types=I.types),$.T=M}}function kL(){}function cv(o,u,f,g){if(o.tag!==5)throw Error(r(476));var y=nS(o).queue;tS(o,y,u,ne,f===null?kL:function(){return rS(o),f(g)})}function nS(o){var u=o.memoizedState;if(u!==null)return u;u={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ia,lastRenderedState:ne},next:null};var f={};return u.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ia,lastRenderedState:f},next:null},o.memoizedState=u,o=o.alternate,o!==null&&(o.memoizedState=u),u}function rS(o){var u=nS(o);u.next===null&&(u=o.alternate.memoizedState),ah(o,u.next.queue,{},Xs())}function uv(){return qr(kh)}function sS(){return sr().memoizedState}function iS(){return sr().memoizedState}function OL(o){for(var u=o.return;u!==null;){switch(u.tag){case 24:case 3:var f=Xs();o=El(f);var g=_l(u,o,f);g!==null&&(js(g,u,f),th(g,u,f)),u={cache:I1()},o.payload=u;return}u=u.return}}function jL(o,u,f){var g=Xs();f={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},hm(o)?lS(u,f):(f=T1(o,u,f,g),f!==null&&(js(f,o,g),oS(f,u,g)))}function aS(o,u,f){var g=Xs();ah(o,u,f,g)}function ah(o,u,f,g){var y={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(hm(o))lS(u,y);else{var w=o.alternate;if(o.lanes===0&&(w===null||w.lanes===0)&&(w=u.lastRenderedReducer,w!==null))try{var M=u.lastRenderedState,I=w(M,f);if(y.hasEagerState=!0,y.eagerState=I,$s(I,M))return V0(o,u,y,0),An===null&&U0(),!1}catch{}finally{}if(f=T1(o,u,y,g),f!==null)return js(f,o,g),oS(f,u,g),!0}return!1}function dv(o,u,f,g){if(g={lane:2,revertLane:$v(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},hm(o)){if(u)throw Error(r(479))}else u=T1(o,f,g,2),u!==null&&js(u,o,2)}function hm(o){var u=o.alternate;return o===wt||u!==null&&u===wt}function lS(o,u){uu=im=!0;var f=o.pending;f===null?u.next=u:(u.next=f.next,f.next=u),o.pending=u}function oS(o,u,f){if((f&4194048)!==0){var g=u.lanes;g&=o.pendingLanes,f|=g,u.lanes=f,f3(o,f)}}var lh={readContext:qr,use:om,useCallback:er,useContext:er,useEffect:er,useImperativeHandle:er,useLayoutEffect:er,useInsertionEffect:er,useMemo:er,useReducer:er,useRef:er,useState:er,useDebugValue:er,useDeferredValue:er,useTransition:er,useSyncExternalStore:er,useId:er,useHostTransitionStatus:er,useFormState:er,useActionState:er,useOptimistic:er,useMemoCache:er,useCacheRefresh:er};lh.useEffectEvent=er;var cS={readContext:qr,use:om,useCallback:function(o,u){return os().memoizedState=[o,u===void 0?null:u],o},useContext:qr,useEffect:V6,useImperativeHandle:function(o,u,f){f=f!=null?f.concat([o]):null,um(4194308,4,Y6.bind(null,u,o),f)},useLayoutEffect:function(o,u){return um(4194308,4,o,u)},useInsertionEffect:function(o,u){um(4,2,o,u)},useMemo:function(o,u){var f=os();u=u===void 0?null:u;var g=o();if(Wo){pt(!0);try{o()}finally{pt(!1)}}return f.memoizedState=[g,u],g},useReducer:function(o,u,f){var g=os();if(f!==void 0){var y=f(u);if(Wo){pt(!0);try{f(u)}finally{pt(!1)}}}else y=u;return g.memoizedState=g.baseState=y,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:y},g.queue=o,o=o.dispatch=jL.bind(null,wt,o),[g.memoizedState,o]},useRef:function(o){var u=os();return o={current:o},u.memoizedState=o},useState:function(o){o=sv(o);var u=o.queue,f=aS.bind(null,wt,u);return u.dispatch=f,[o.memoizedState,f]},useDebugValue:lv,useDeferredValue:function(o,u){var f=os();return ov(f,o,u)},useTransition:function(){var o=sv(!1);return o=tS.bind(null,wt,o.queue,!0,!1),os().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,u,f){var g=wt,y=os();if(Ut){if(f===void 0)throw Error(r(407));f=f()}else{if(f=u(),An===null)throw Error(r(349));(Ft&127)!==0||M6(g,u,f)}y.memoizedState=f;var w={value:f,getSnapshot:u};return y.queue=w,V6(_6.bind(null,g,w,o),[o]),g.flags|=2048,hu(9,{destroy:void 0},E6.bind(null,g,w,f,u),null),f},useId:function(){var o=os(),u=An.identifierPrefix;if(Ut){var f=Ki,g=Yi;f=(g&~(1<<32-yt(g)-1)).toString(32)+f,u="_"+u+"R_"+f,f=am++,0<\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof g.is=="string"?M.createElement("select",{is:g.is}):M.createElement("select"),g.multiple?w.multiple=!0:g.size&&(w.size=g.size);break;default:w=typeof g.is=="string"?M.createElement(y,{is:g.is}):M.createElement(y)}}w[Lr]=u,w[ys]=g;e:for(M=u.child;M!==null;){if(M.tag===5||M.tag===6)w.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===u)break e;for(;M.sibling===null;){if(M.return===null||M.return===u)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}u.stateNode=w;e:switch(Qr(w,y,g),y){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&Fa(u)}}return Qn(u),jv(u,u.type,o===null?null:o.memoizedProps,u.pendingProps,f),null;case 6:if(o&&u.stateNode!=null)o.memoizedProps!==g&&Fa(u);else{if(typeof g!="string"&&u.stateNode===null)throw Error(r(166));if(o=fe.current,ru(u)){if(o=u.stateNode,f=u.memoizedProps,g=null,y=Ir,y!==null)switch(y.tag){case 27:case 5:g=y.memoizedProps}o[Lr]=u,o=!!(o.nodeValue===f||g!==null&&g.suppressHydrationWarning===!0||Tk(o.nodeValue,f)),o||Tl(u,!0)}else o=_m(o).createTextNode(g),o[Lr]=u,u.stateNode=o}return Qn(u),null;case 31:if(f=u.memoizedState,o===null||o.memoizedState!==null){if(g=ru(u),f!==null){if(o===null){if(!g)throw Error(r(318));if(o=u.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[Lr]=u}else qo(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Qn(u),o=!1}else f=z1(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=f),o=!0;if(!o)return u.flags&256?(Vs(u),u):(Vs(u),null);if((u.flags&128)!==0)throw Error(r(558))}return Qn(u),null;case 13:if(g=u.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(y=ru(u),g!==null&&g.dehydrated!==null){if(o===null){if(!y)throw Error(r(318));if(y=u.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(r(317));y[Lr]=u}else qo(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Qn(u),y=!1}else y=z1(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=y),y=!0;if(!y)return u.flags&256?(Vs(u),u):(Vs(u),null)}return Vs(u),(u.flags&128)!==0?(u.lanes=f,u):(f=g!==null,o=o!==null&&o.memoizedState!==null,f&&(g=u.child,y=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(y=g.alternate.memoizedState.cachePool.pool),w=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(w=g.memoizedState.cachePool.pool),w!==y&&(g.flags|=2048)),f!==o&&f&&(u.child.flags|=8192),xm(u,u.updateQueue),Qn(u),null);case 4:return ue(),o===null&&Wv(u.stateNode.containerInfo),Qn(u),null;case 10:return Ba(u.type),Qn(u),null;case 19:if(Y(rr),g=u.memoizedState,g===null)return Qn(u),null;if(y=(u.flags&128)!==0,w=g.rendering,w===null)if(y)ch(g,!1);else{if(tr!==0||o!==null&&(o.flags&128)!==0)for(o=u.child;o!==null;){if(w=sm(o),w!==null){for(u.flags|=128,ch(g,!1),o=w.updateQueue,u.updateQueue=o,xm(u,o),u.subtreeFlags=0,o=f,f=u.child;f!==null;)a6(f,o),f=f.sibling;return P(rr,rr.current&1|2),Ut&&za(u,g.treeForkCount),u.child}o=o.sibling}g.tail!==null&&yn()>Sm&&(u.flags|=128,y=!0,ch(g,!1),u.lanes=4194304)}else{if(!y)if(o=sm(w),o!==null){if(u.flags|=128,y=!0,o=o.updateQueue,u.updateQueue=o,xm(u,o),ch(g,!0),g.tail===null&&g.tailMode==="hidden"&&!w.alternate&&!Ut)return Qn(u),null}else 2*yn()-g.renderingStartTime>Sm&&f!==536870912&&(u.flags|=128,y=!0,ch(g,!1),u.lanes=4194304);g.isBackwards?(w.sibling=u.child,u.child=w):(o=g.last,o!==null?o.sibling=w:u.child=w,g.last=w)}return g.tail!==null?(o=g.tail,g.rendering=o,g.tail=o.sibling,g.renderingStartTime=yn(),o.sibling=null,f=rr.current,P(rr,y?f&1|2:f&1),Ut&&za(u,g.treeForkCount),o):(Qn(u),null);case 22:case 23:return Vs(u),G1(),g=u.memoizedState!==null,o!==null?o.memoizedState!==null!==g&&(u.flags|=8192):g&&(u.flags|=8192),g?(f&536870912)!==0&&(u.flags&128)===0&&(Qn(u),u.subtreeFlags&6&&(u.flags|=8192)):Qn(u),f=u.updateQueue,f!==null&&xm(u,f.retryQueue),f=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==f&&(u.flags|=2048),o!==null&&Y($o),null;case 24:return f=null,o!==null&&(f=o.memoizedState.cache),u.memoizedState.cache!==f&&(u.flags|=2048),Ba(ur),Qn(u),null;case 25:return null;case 30:return null}throw Error(r(156,u.tag))}function ML(o,u){switch(D1(u),u.tag){case 1:return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 3:return Ba(ur),ue(),o=u.flags,(o&65536)!==0&&(o&128)===0?(u.flags=o&-65537|128,u):null;case 26:case 27:case 5:return ct(u),null;case 31:if(u.memoizedState!==null){if(Vs(u),u.alternate===null)throw Error(r(340));qo()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 13:if(Vs(u),o=u.memoizedState,o!==null&&o.dehydrated!==null){if(u.alternate===null)throw Error(r(340));qo()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 19:return Y(rr),null;case 4:return ue(),null;case 10:return Ba(u.type),null;case 22:case 23:return Vs(u),G1(),o!==null&&Y($o),o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 24:return Ba(ur),null;case 25:return null;default:return null}}function DS(o,u){switch(D1(u),u.tag){case 3:Ba(ur),ue();break;case 26:case 27:case 5:ct(u);break;case 4:ue();break;case 31:u.memoizedState!==null&&Vs(u);break;case 13:Vs(u);break;case 19:Y(rr);break;case 10:Ba(u.type);break;case 22:case 23:Vs(u),G1(),o!==null&&Y($o);break;case 24:Ba(ur)}}function uh(o,u){try{var f=u.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var y=g.next;f=y;do{if((f.tag&o)===o){g=void 0;var w=f.create,M=f.inst;g=w(),M.destroy=g}f=f.next}while(f!==y)}}catch(I){gn(u,u.return,I)}}function zl(o,u,f){try{var g=u.updateQueue,y=g!==null?g.lastEffect:null;if(y!==null){var w=y.next;g=w;do{if((g.tag&o)===o){var M=g.inst,I=M.destroy;if(I!==void 0){M.destroy=void 0,y=u;var Z=f,ge=I;try{ge()}catch(je){gn(y,Z,je)}}}g=g.next}while(g!==w)}}catch(je){gn(u,u.return,je)}}function RS(o){var u=o.updateQueue;if(u!==null){var f=o.stateNode;try{O6(u,f)}catch(g){gn(o,o.return,g)}}}function zS(o,u,f){f.props=Go(o.type,o.memoizedProps),f.state=o.memoizedState;try{f.componentWillUnmount()}catch(g){gn(o,u,g)}}function dh(o,u){try{var f=o.ref;if(f!==null){switch(o.tag){case 26:case 27:case 5:var g=o.stateNode;break;case 30:g=o.stateNode;break;default:g=o.stateNode}typeof f=="function"?o.refCleanup=f(g):f.current=g}}catch(y){gn(o,u,y)}}function Zi(o,u){var f=o.ref,g=o.refCleanup;if(f!==null)if(typeof g=="function")try{g()}catch(y){gn(o,u,y)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(y){gn(o,u,y)}else f.current=null}function PS(o){var u=o.type,f=o.memoizedProps,g=o.stateNode;try{e:switch(u){case"button":case"input":case"select":case"textarea":f.autoFocus&&g.focus();break e;case"img":f.src?g.src=f.src:f.srcSet&&(g.srcset=f.srcSet)}}catch(y){gn(o,o.return,y)}}function Nv(o,u,f){try{var g=o.stateNode;ZL(g,o.type,f,u),g[ys]=u}catch(y){gn(o,o.return,y)}}function BS(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Ql(o.type)||o.tag===4}function Cv(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||BS(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Ql(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Tv(o,u,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,u?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(o,u):(u=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,u.appendChild(o),f=f._reactRootContainer,f!=null||u.onclick!==null||(u.onclick=_a));else if(g!==4&&(g===27&&Ql(o.type)&&(f=o.stateNode,u=null),o=o.child,o!==null))for(Tv(o,u,f),o=o.sibling;o!==null;)Tv(o,u,f),o=o.sibling}function vm(o,u,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,u?f.insertBefore(o,u):f.appendChild(o);else if(g!==4&&(g===27&&Ql(o.type)&&(f=o.stateNode),o=o.child,o!==null))for(vm(o,u,f),o=o.sibling;o!==null;)vm(o,u,f),o=o.sibling}function LS(o){var u=o.stateNode,f=o.memoizedProps;try{for(var g=o.type,y=u.attributes;y.length;)u.removeAttributeNode(y[0]);Qr(u,g,f),u[Lr]=o,u[ys]=f}catch(w){gn(o,o.return,w)}}var Qa=!1,fr=!1,Av=!1,IS=typeof WeakSet=="function"?WeakSet:Set,_r=null;function EL(o,u){if(o=o.containerInfo,Yv=Im,o=K3(o),S1(o)){if("selectionStart"in o)var f={start:o.selectionStart,end:o.selectionEnd};else e:{f=(f=o.ownerDocument)&&f.defaultView||window;var g=f.getSelection&&f.getSelection();if(g&&g.rangeCount!==0){f=g.anchorNode;var y=g.anchorOffset,w=g.focusNode;g=g.focusOffset;try{f.nodeType,w.nodeType}catch{f=null;break e}var M=0,I=-1,Z=-1,ge=0,je=0,Te=o,be=null;t:for(;;){for(var ke;Te!==f||y!==0&&Te.nodeType!==3||(I=M+y),Te!==w||g!==0&&Te.nodeType!==3||(Z=M+g),Te.nodeType===3&&(M+=Te.nodeValue.length),(ke=Te.firstChild)!==null;)be=Te,Te=ke;for(;;){if(Te===o)break t;if(be===f&&++ge===y&&(I=M),be===w&&++je===g&&(Z=M),(ke=Te.nextSibling)!==null)break;Te=be,be=Te.parentNode}Te=ke}f=I===-1||Z===-1?null:{start:I,end:Z}}else f=null}f=f||{start:0,end:0}}else f=null;for(Kv={focusedElem:o,selectionRange:f},Im=!1,_r=u;_r!==null;)if(u=_r,o=u.child,(u.subtreeFlags&1028)!==0&&o!==null)o.return=u,_r=o;else for(;_r!==null;){switch(u=_r,w=u.alternate,o=u.flags,u.tag){case 0:if((o&4)!==0&&(o=u.updateQueue,o=o!==null?o.events:null,o!==null))for(f=0;f title"))),Qr(w,g,f),w[Lr]=o,Er(w),g=w;break e;case"link":var M=Uk("link","href",y).get(g+(f.href||""));if(M){for(var I=0;ISn&&(M=Sn,Sn=lt,lt=M);var oe=X3(I,lt),se=X3(I,Sn);if(oe&&se&&(ke.rangeCount!==1||ke.anchorNode!==oe.node||ke.anchorOffset!==oe.offset||ke.focusNode!==se.node||ke.focusOffset!==se.offset)){var me=Te.createRange();me.setStart(oe.node,oe.offset),ke.removeAllRanges(),lt>Sn?(ke.addRange(me),ke.extend(se.node,se.offset)):(me.setEnd(se.node,se.offset),ke.addRange(me))}}}}for(Te=[],ke=I;ke=ke.parentNode;)ke.nodeType===1&&Te.push({element:ke,left:ke.scrollLeft,top:ke.scrollTop});for(typeof I.focus=="function"&&I.focus(),I=0;If?32:f,$.T=null,f=Pv,Pv=null;var w=Il,M=Wa;if(br=0,xu=Il=null,Wa=0,(sn&6)!==0)throw Error(r(331));var I=sn;if(sn|=4,YS(w.current),WS(w,w.current,M,f),sn=I,xh(0,!1),Ae&&typeof Ae.onPostCommitFiberRoot=="function")try{Ae.onPostCommitFiberRoot(re,w)}catch{}return!0}finally{ae.p=y,$.T=g,mk(o,u)}}function gk(o,u,f){u=di(f,u),u=pv(o.stateNode,u,2),o=_l(o,u,2),o!==null&&(Bd(o,2),Ji(o))}function gn(o,u,f){if(o.tag===3)gk(o,o,f);else for(;u!==null;){if(u.tag===3){gk(u,o,f);break}else if(u.tag===1){var g=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Ll===null||!Ll.has(g))){o=di(f,o),f=xS(2),g=_l(u,f,2),g!==null&&(vS(f,g,u,o),Bd(g,2),Ji(g));break}}u=u.return}}function qv(o,u,f){var g=o.pingCache;if(g===null){g=o.pingCache=new RL;var y=new Set;g.set(u,y)}else y=g.get(u),y===void 0&&(y=new Set,g.set(u,y));y.has(f)||(_v=!0,y.add(f),o=IL.bind(null,o,u,f),u.then(o,o))}function IL(o,u,f){var g=o.pingCache;g!==null&&g.delete(u),o.pingedLanes|=o.suspendedLanes&f,o.warmLanes&=~f,An===o&&(Ft&f)===f&&(tr===4||tr===3&&(Ft&62914560)===Ft&&300>yn()-wm?(sn&2)===0&&vu(o,0):Dv|=f,gu===Ft&&(gu=0)),Ji(o)}function xk(o,u){u===0&&(u=qc()),o=Lo(o,u),o!==null&&(Bd(o,u),Ji(o))}function qL(o){var u=o.memoizedState,f=0;u!==null&&(f=u.retryLane),xk(o,f)}function FL(o,u){var f=0;switch(o.tag){case 31:case 13:var g=o.stateNode,y=o.memoizedState;y!==null&&(f=y.retryLane);break;case 19:g=o.stateNode;break;case 22:g=o.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(u),xk(o,f)}function QL(o,u){return _t(o,u)}var Tm=null,bu=null,Fv=!1,Am=!1,Qv=!1,Fl=0;function Ji(o){o!==bu&&o.next===null&&(bu===null?Tm=bu=o:bu=bu.next=o),Am=!0,Fv||(Fv=!0,HL())}function xh(o,u){if(!Qv&&Am){Qv=!0;do for(var f=!1,g=Tm;g!==null;){if(o!==0){var y=g.pendingLanes;if(y===0)var w=0;else{var M=g.suspendedLanes,I=g.pingedLanes;w=(1<<31-yt(42|o)+1)-1,w&=y&~(M&~I),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(f=!0,wk(g,w))}else w=Ft,w=Ic(g,g===An?w:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(w&3)===0||_o(g,w)||(f=!0,wk(g,w));g=g.next}while(f);Qv=!1}}function $L(){vk()}function vk(){Am=Fv=!1;var o=0;Fl!==0&&eI()&&(o=Fl);for(var u=yn(),f=null,g=Tm;g!==null;){var y=g.next,w=yk(g,u);w===0?(g.next=null,f===null?Tm=y:f.next=y,y===null&&(bu=f)):(f=g,(o!==0||(w&3)!==0)&&(Am=!0)),g=y}br!==0&&br!==5||xh(o),Fl!==0&&(Fl=0)}function yk(o,u){for(var f=o.suspendedLanes,g=o.pingedLanes,y=o.expirationTimes,w=o.pendingLanes&-62914561;0I)break;var je=Z.transferSize,Te=Z.initiatorType;je&&Ak(Te)&&(Z=Z.responseEnd,M+=je*(Z"u"?null:document;function Fk(o,u,f){var g=wu;if(g&&typeof u=="string"&&u){var y=ci(u);y='link[rel="'+o+'"][href="'+y+'"]',typeof f=="string"&&(y+='[crossorigin="'+f+'"]'),qk.has(y)||(qk.add(y),o={rel:o,crossOrigin:f,href:u},g.querySelector(y)===null&&(u=g.createElement("link"),Qr(u,"link",o),Er(u),g.head.appendChild(u)))}}function cI(o){Ga.D(o),Fk("dns-prefetch",o,null)}function uI(o,u){Ga.C(o,u),Fk("preconnect",o,u)}function dI(o,u,f){Ga.L(o,u,f);var g=wu;if(g&&o&&u){var y='link[rel="preload"][as="'+ci(u)+'"]';u==="image"&&f&&f.imageSrcSet?(y+='[imagesrcset="'+ci(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(y+='[imagesizes="'+ci(f.imageSizes)+'"]')):y+='[href="'+ci(o)+'"]';var w=y;switch(u){case"style":w=Su(o);break;case"script":w=ku(o)}xi.has(w)||(o=p({rel:"preload",href:u==="image"&&f&&f.imageSrcSet?void 0:o,as:u},f),xi.set(w,o),g.querySelector(y)!==null||u==="style"&&g.querySelector(wh(w))||u==="script"&&g.querySelector(Sh(w))||(u=g.createElement("link"),Qr(u,"link",o),Er(u),g.head.appendChild(u)))}}function hI(o,u){Ga.m(o,u);var f=wu;if(f&&o){var g=u&&typeof u.as=="string"?u.as:"script",y='link[rel="modulepreload"][as="'+ci(g)+'"][href="'+ci(o)+'"]',w=y;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=ku(o)}if(!xi.has(w)&&(o=p({rel:"modulepreload",href:o},u),xi.set(w,o),f.querySelector(y)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(Sh(w)))return}g=f.createElement("link"),Qr(g,"link",o),Er(g),f.head.appendChild(g)}}}function fI(o,u,f){Ga.S(o,u,f);var g=wu;if(g&&o){var y=Hc(g).hoistableStyles,w=Su(o);u=u||"default";var M=y.get(w);if(!M){var I={loading:0,preload:null};if(M=g.querySelector(wh(w)))I.loading=5;else{o=p({rel:"stylesheet",href:o,"data-precedence":u},f),(f=xi.get(w))&&sy(o,f);var Z=M=g.createElement("link");Er(Z),Qr(Z,"link",o),Z._p=new Promise(function(ge,je){Z.onload=ge,Z.onerror=je}),Z.addEventListener("load",function(){I.loading|=1}),Z.addEventListener("error",function(){I.loading|=2}),I.loading|=4,Rm(M,u,g)}M={type:"stylesheet",instance:M,count:1,state:I},y.set(w,M)}}}function mI(o,u){Ga.X(o,u);var f=wu;if(f&&o){var g=Hc(f).hoistableScripts,y=ku(o),w=g.get(y);w||(w=f.querySelector(Sh(y)),w||(o=p({src:o,async:!0},u),(u=xi.get(y))&&iy(o,u),w=f.createElement("script"),Er(w),Qr(w,"link",o),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(y,w))}}function pI(o,u){Ga.M(o,u);var f=wu;if(f&&o){var g=Hc(f).hoistableScripts,y=ku(o),w=g.get(y);w||(w=f.querySelector(Sh(y)),w||(o=p({src:o,async:!0,type:"module"},u),(u=xi.get(y))&&iy(o,u),w=f.createElement("script"),Er(w),Qr(w,"link",o),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(y,w))}}function Qk(o,u,f,g){var y=(y=fe.current)?Dm(y):null;if(!y)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(u=Su(f.href),f=Hc(y).hoistableStyles,g=f.get(u),g||(g={type:"style",instance:null,count:0,state:null},f.set(u,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){o=Su(f.href);var w=Hc(y).hoistableStyles,M=w.get(o);if(M||(y=y.ownerDocument||y,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(o,M),(w=y.querySelector(wh(o)))&&!w._p&&(M.instance=w,M.state.loading=5),xi.has(o)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},xi.set(o,f),w||gI(y,o,f,M.state))),u&&g===null)throw Error(r(528,""));return M}if(u&&g!==null)throw Error(r(529,""));return null;case"script":return u=f.async,f=f.src,typeof f=="string"&&u&&typeof u!="function"&&typeof u!="symbol"?(u=ku(f),f=Hc(y).hoistableScripts,g=f.get(u),g||(g={type:"script",instance:null,count:0,state:null},f.set(u,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function Su(o){return'href="'+ci(o)+'"'}function wh(o){return'link[rel="stylesheet"]['+o+"]"}function $k(o){return p({},o,{"data-precedence":o.precedence,precedence:null})}function gI(o,u,f,g){o.querySelector('link[rel="preload"][as="style"]['+u+"]")?g.loading=1:(u=o.createElement("link"),g.preload=u,u.addEventListener("load",function(){return g.loading|=1}),u.addEventListener("error",function(){return g.loading|=2}),Qr(u,"link",f),Er(u),o.head.appendChild(u))}function ku(o){return'[src="'+ci(o)+'"]'}function Sh(o){return"script[async]"+o}function Hk(o,u,f){if(u.count++,u.instance===null)switch(u.type){case"style":var g=o.querySelector('style[data-href~="'+ci(f.href)+'"]');if(g)return u.instance=g,Er(g),g;var y=p({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return g=(o.ownerDocument||o).createElement("style"),Er(g),Qr(g,"style",y),Rm(g,f.precedence,o),u.instance=g;case"stylesheet":y=Su(f.href);var w=o.querySelector(wh(y));if(w)return u.state.loading|=4,u.instance=w,Er(w),w;g=$k(f),(y=xi.get(y))&&sy(g,y),w=(o.ownerDocument||o).createElement("link"),Er(w);var M=w;return M._p=new Promise(function(I,Z){M.onload=I,M.onerror=Z}),Qr(w,"link",g),u.state.loading|=4,Rm(w,f.precedence,o),u.instance=w;case"script":return w=ku(f.src),(y=o.querySelector(Sh(w)))?(u.instance=y,Er(y),y):(g=f,(y=xi.get(w))&&(g=p({},f),iy(g,y)),o=o.ownerDocument||o,y=o.createElement("script"),Er(y),Qr(y,"link",g),o.head.appendChild(y),u.instance=y);case"void":return null;default:throw Error(r(443,u.type))}else u.type==="stylesheet"&&(u.state.loading&4)===0&&(g=u.instance,u.state.loading|=4,Rm(g,f.precedence,o));return u.instance}function Rm(o,u,f){for(var g=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=g.length?g[g.length-1]:null,w=y,M=0;M title"):null)}function xI(o,u,f){if(f===1||u.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof u.precedence!="string"||typeof u.href!="string"||u.href==="")break;return!0;case"link":if(typeof u.rel!="string"||typeof u.href!="string"||u.href===""||u.onLoad||u.onError)break;switch(u.rel){case"stylesheet":return o=u.disabled,typeof u.precedence=="string"&&o==null;default:return!0}case"script":if(u.async&&typeof u.async!="function"&&typeof u.async!="symbol"&&!u.onLoad&&!u.onError&&u.src&&typeof u.src=="string")return!0}return!1}function Wk(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function vI(o,u,f,g){if(f.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var y=Su(g.href),w=u.querySelector(wh(y));if(w){u=w._p,u!==null&&typeof u=="object"&&typeof u.then=="function"&&(o.count++,o=Pm.bind(o),u.then(o,o)),f.state.loading|=4,f.instance=w,Er(w);return}w=u.ownerDocument||u,g=$k(g),(y=xi.get(y))&&sy(g,y),w=w.createElement("link"),Er(w);var M=w;M._p=new Promise(function(I,Z){M.onload=I,M.onerror=Z}),Qr(w,"link",g),f.instance=w}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(f,u),(u=f.state.preload)&&(f.state.loading&3)===0&&(o.count++,f=Pm.bind(o),u.addEventListener("load",f),u.addEventListener("error",f))}}var ay=0;function yI(o,u){return o.stylesheets&&o.count===0&&Lm(o,o.stylesheets),0ay?50:800)+u);return o.unsuspend=f,function(){o.unsuspend=null,clearTimeout(g),clearTimeout(y)}}:null}function Pm(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Lm(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Bm=null;function Lm(o,u){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Bm=new Map,u.forEach(bI,o),Bm=null,Pm.call(o))}function bI(o,u){if(!(u.state.loading&4)){var f=Bm.get(o);if(f)var g=f.get(null);else{f=new Map,Bm.set(o,f);for(var y=o.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),py.exports=zq(),py.exports}var Bq=Pq();function L9(t,e){return function(){return t.apply(e,arguments)}}const{toString:Lq}=Object.prototype,{getPrototypeOf:J4}=Object,{iterator:ox,toStringTag:I9}=Symbol,cx=(t=>e=>{const n=Lq.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Wi=t=>(t=t.toLowerCase(),e=>cx(e)===t),ux=t=>e=>typeof e===t,{isArray:Sd}=Array,sd=ux("undefined");function Kf(t){return t!==null&&!sd(t)&&t.constructor!==null&&!sd(t.constructor)&&Rs(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const q9=Wi("ArrayBuffer");function Iq(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&q9(t.buffer),e}const qq=ux("string"),Rs=ux("function"),F9=ux("number"),Zf=t=>t!==null&&typeof t=="object",Fq=t=>t===!0||t===!1,$p=t=>{if(cx(t)!=="object")return!1;const e=J4(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(I9 in t)&&!(ox in t)},Qq=t=>{if(!Zf(t)||Kf(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},$q=Wi("Date"),Hq=Wi("File"),Uq=Wi("Blob"),Vq=Wi("FileList"),Wq=t=>Zf(t)&&Rs(t.pipe),Gq=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Rs(t.append)&&((e=cx(t))==="formdata"||e==="object"&&Rs(t.toString)&&t.toString()==="[object FormData]"))},Xq=Wi("URLSearchParams"),[Yq,Kq,Zq,Jq]=["ReadableStream","Request","Response","Headers"].map(Wi),eF=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Jf(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),Sd(t))for(r=0,s=t.length;r0;)if(s=n[r],e===s.toLowerCase())return s;return null}const ac=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,$9=t=>!sd(t)&&t!==ac;function n2(){const{caseless:t,skipUndefined:e}=$9(this)&&this||{},n={},r=(s,i)=>{const l=t&&Q9(n,i)||i;$p(n[l])&&$p(s)?n[l]=n2(n[l],s):$p(s)?n[l]=n2({},s):Sd(s)?n[l]=s.slice():(!e||!sd(s))&&(n[l]=s)};for(let s=0,i=arguments.length;s(Jf(e,(s,i)=>{n&&Rs(s)?t[i]=L9(s,n):t[i]=s},{allOwnKeys:r}),t),nF=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),rF=(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)},sF=(t,e,n,r)=>{let s,i,l;const c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)l=s[i],(!r||r(l,t,e))&&!c[l]&&(e[l]=t[l],c[l]=!0);t=n!==!1&&J4(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},iF=(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},aF=t=>{if(!t)return null;if(Sd(t))return t;let e=t.length;if(!F9(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},lF=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&J4(Uint8Array)),oF=(t,e)=>{const r=(t&&t[ox]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},cF=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},uF=Wi("HTMLFormElement"),dF=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),vO=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),hF=Wi("RegExp"),H9=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Jf(n,(s,i)=>{let l;(l=e(s,i,t))!==!1&&(r[i]=l||s)}),Object.defineProperties(t,r)},fF=t=>{H9(t,(e,n)=>{if(Rs(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Rs(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+"'")})}})},mF=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Sd(t)?r(t):r(String(t).split(e)),n},pF=()=>{},gF=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function xF(t){return!!(t&&Rs(t.append)&&t[I9]==="FormData"&&t[ox])}const vF=t=>{const e=new Array(10),n=(r,s)=>{if(Zf(r)){if(e.indexOf(r)>=0)return;if(Kf(r))return r;if(!("toJSON"in r)){e[s]=r;const i=Sd(r)?[]:{};return Jf(r,(l,c)=>{const d=n(l,s+1);!sd(d)&&(i[c]=d)}),e[s]=void 0,i}}return r};return n(t,0)},yF=Wi("AsyncFunction"),bF=t=>t&&(Zf(t)||Rs(t))&&Rs(t.then)&&Rs(t.catch),U9=((t,e)=>t?setImmediate:e?((n,r)=>(ac.addEventListener("message",({source:s,data:i})=>{s===ac&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),ac.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Rs(ac.postMessage)),wF=typeof queueMicrotask<"u"?queueMicrotask.bind(ac):typeof process<"u"&&process.nextTick||U9,SF=t=>t!=null&&Rs(t[ox]),we={isArray:Sd,isArrayBuffer:q9,isBuffer:Kf,isFormData:Gq,isArrayBufferView:Iq,isString:qq,isNumber:F9,isBoolean:Fq,isObject:Zf,isPlainObject:$p,isEmptyObject:Qq,isReadableStream:Yq,isRequest:Kq,isResponse:Zq,isHeaders:Jq,isUndefined:sd,isDate:$q,isFile:Hq,isBlob:Uq,isRegExp:hF,isFunction:Rs,isStream:Wq,isURLSearchParams:Xq,isTypedArray:lF,isFileList:Vq,forEach:Jf,merge:n2,extend:tF,trim:eF,stripBOM:nF,inherits:rF,toFlatObject:sF,kindOf:cx,kindOfTest:Wi,endsWith:iF,toArray:aF,forEachEntry:oF,matchAll:cF,isHTMLForm:uF,hasOwnProperty:vO,hasOwnProp:vO,reduceDescriptors:H9,freezeMethods:fF,toObjectSet:mF,toCamelCase:dF,noop:pF,toFiniteNumber:gF,findKey:Q9,global:ac,isContextDefined:$9,isSpecCompliantForm:xF,toJSONObject:vF,isAsyncFn:yF,isThenable:bF,setImmediate:U9,asap:wF,isIterable:SF};function St(t,e,n,r,s){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),s&&(this.response=s,this.status=s.status?s.status:null)}we.inherits(St,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:we.toJSONObject(this.config),code:this.code,status:this.status}}});const V9=St.prototype,W9={};["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=>{W9[t]={value:t}});Object.defineProperties(St,W9);Object.defineProperty(V9,"isAxiosError",{value:!0});St.from=(t,e,n,r,s,i)=>{const l=Object.create(V9);we.toFlatObject(t,l,function(m){return m!==Error.prototype},h=>h!=="isAxiosError");const c=t&&t.message?t.message:"Error",d=e==null&&t?t.code:e;return St.call(l,c,d,n,r,s),t&&l.cause==null&&Object.defineProperty(l,"cause",{value:t,configurable:!0}),l.name=t&&t.name||"Error",i&&Object.assign(l,i),l};const kF=null;function r2(t){return we.isPlainObject(t)||we.isArray(t)}function G9(t){return we.endsWith(t,"[]")?t.slice(0,-2):t}function yO(t,e,n){return t?t.concat(e).map(function(s,i){return s=G9(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function OF(t){return we.isArray(t)&&!t.some(r2)}const jF=we.toFlatObject(we,{},null,function(e){return/^is[A-Z]/.test(e)});function dx(t,e,n){if(!we.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=we.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(k,O){return!we.isUndefined(O[k])});const r=n.metaTokens,s=n.visitor||m,i=n.dots,l=n.indexes,d=(n.Blob||typeof Blob<"u"&&Blob)&&we.isSpecCompliantForm(e);if(!we.isFunction(s))throw new TypeError("visitor must be a function");function h(b){if(b===null)return"";if(we.isDate(b))return b.toISOString();if(we.isBoolean(b))return b.toString();if(!d&&we.isBlob(b))throw new St("Blob is not supported. Use a Buffer instead.");return we.isArrayBuffer(b)||we.isTypedArray(b)?d&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function m(b,k,O){let j=b;if(b&&!O&&typeof b=="object"){if(we.endsWith(k,"{}"))k=r?k:k.slice(0,-2),b=JSON.stringify(b);else if(we.isArray(b)&&OF(b)||(we.isFileList(b)||we.endsWith(k,"[]"))&&(j=we.toArray(b)))return k=G9(k),j.forEach(function(A,_){!(we.isUndefined(A)||A===null)&&e.append(l===!0?yO([k],_,i):l===null?k:k+"[]",h(A))}),!1}return r2(b)?!0:(e.append(yO(O,k,i),h(b)),!1)}const p=[],x=Object.assign(jF,{defaultVisitor:m,convertValue:h,isVisitable:r2});function v(b,k){if(!we.isUndefined(b)){if(p.indexOf(b)!==-1)throw Error("Circular reference detected in "+k.join("."));p.push(b),we.forEach(b,function(j,T){(!(we.isUndefined(j)||j===null)&&s.call(e,j,we.isString(T)?T.trim():T,k,x))===!0&&v(j,k?k.concat(T):[T])}),p.pop()}}if(!we.isObject(t))throw new TypeError("data must be an object");return v(t),e}function bO(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function ew(t,e){this._pairs=[],t&&dx(t,this,e)}const X9=ew.prototype;X9.append=function(e,n){this._pairs.push([e,n])};X9.toString=function(e){const n=e?function(r){return e.call(this,r,bO)}:bO;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function NF(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Y9(t,e,n){if(!e)return t;const r=n&&n.encode||NF;we.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=we.isURLSearchParams(e)?e.toString():new ew(e,n).toString(r),i){const l=t.indexOf("#");l!==-1&&(t=t.slice(0,l)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class wO{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){we.forEach(this.handlers,function(r){r!==null&&e(r)})}}const K9={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},CF=typeof URLSearchParams<"u"?URLSearchParams:ew,TF=typeof FormData<"u"?FormData:null,AF=typeof Blob<"u"?Blob:null,MF={isBrowser:!0,classes:{URLSearchParams:CF,FormData:TF,Blob:AF},protocols:["http","https","file","blob","url","data"]},tw=typeof window<"u"&&typeof document<"u",s2=typeof navigator=="object"&&navigator||void 0,EF=tw&&(!s2||["ReactNative","NativeScript","NS"].indexOf(s2.product)<0),_F=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",DF=tw&&window.location.href||"http://localhost",RF=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:tw,hasStandardBrowserEnv:EF,hasStandardBrowserWebWorkerEnv:_F,navigator:s2,origin:DF},Symbol.toStringTag,{value:"Module"})),ts={...RF,...MF};function zF(t,e){return dx(t,new ts.classes.URLSearchParams,{visitor:function(n,r,s,i){return ts.isNode&&we.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function PF(t){return we.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function BF(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r=n.length;return l=!l&&we.isArray(s)?s.length:l,d?(we.hasOwnProp(s,l)?s[l]=[s[l],r]:s[l]=r,!c):((!s[l]||!we.isObject(s[l]))&&(s[l]=[]),e(n,r,s[l],i)&&we.isArray(s[l])&&(s[l]=BF(s[l])),!c)}if(we.isFormData(t)&&we.isFunction(t.entries)){const n={};return we.forEachEntry(t,(r,s)=>{e(PF(r),s,n,0)}),n}return null}function LF(t,e,n){if(we.isString(t))try{return(e||JSON.parse)(t),we.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const e0={transitional:K9,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=we.isObject(e);if(i&&we.isHTMLForm(e)&&(e=new FormData(e)),we.isFormData(e))return s?JSON.stringify(Z9(e)):e;if(we.isArrayBuffer(e)||we.isBuffer(e)||we.isStream(e)||we.isFile(e)||we.isBlob(e)||we.isReadableStream(e))return e;if(we.isArrayBufferView(e))return e.buffer;if(we.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return zF(e,this.formSerializer).toString();if((c=we.isFileList(e))||r.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return dx(c?{"files[]":e}:e,d&&new d,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),LF(e)):e}],transformResponse:[function(e){const n=this.transitional||e0.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(we.isResponse(e)||we.isReadableStream(e))return e;if(e&&we.isString(e)&&(r&&!this.responseType||s)){const l=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(l)throw c.name==="SyntaxError"?St.from(c,St.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:ts.classes.FormData,Blob:ts.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};we.forEach(["delete","get","head","post","put","patch"],t=>{e0.headers[t]={}});const IF=we.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"]),qF=t=>{const e={};let n,r,s;return t&&t.split(` +`+g.stack}}var nn=Object.prototype.hasOwnProperty,_t=t.unstable_scheduleCallback,Yr=t.unstable_cancelCallback,qn=t.unstable_shouldYield,or=t.unstable_requestPaint,yn=t.unstable_now,ft=t.unstable_getCurrentPriorityLevel,ee=t.unstable_ImmediatePriority,Se=t.unstable_UserBlockingPriority,Be=t.unstable_NormalPriority,rt=t.unstable_LowPriority,Tt=t.unstable_IdlePriority,cr=t.log,Kr=t.unstable_setDisableYieldValue,re=null,Ae=null;function pt(o){if(typeof cr=="function"&&Kr(o),Ae&&typeof Ae.setStrictMode=="function")try{Ae.setStrictMode(re,o)}catch{}}var yt=Math.clz32?Math.clz32:Pn,vs=Math.log,dt=Math.LN2;function Pn(o){return o>>>=0,o===0?32:31-(vs(o)/dt|0)|0}var mt=256,rn=262144,Mr=4194304;function At(o){var u=o&42;if(u!==0)return u;switch(o&-o){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Ic(o,u,f){var g=o.pendingLanes;if(g===0)return 0;var y=0,w=o.suspendedLanes,M=o.pingedLanes;o=o.warmLanes;var I=g&134217727;return I!==0?(g=I&~w,g!==0?y=At(g):(M&=I,M!==0?y=At(M):f||(f=I&~o,f!==0&&(y=At(f))))):(I=g&~w,I!==0?y=At(I):M!==0?y=At(M):f||(f=g&~o,f!==0&&(y=At(f)))),y===0?0:u!==0&&u!==y&&(u&w)===0&&(w=y&-y,f=u&-u,w>=f||w===32&&(f&4194048)!==0)?u:y}function _o(o,u){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&u)===0}function t1(o,u){switch(o){case 1:case 2:case 4:case 8:case 64:return u+250;case 16:case 32: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 u+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function qc(){var o=Mr;return Mr<<=1,(Mr&62914560)===0&&(Mr=4194304),o}function Do(o){for(var u=[],f=0;31>f;f++)u.push(o);return u}function Bd(o,u){o.pendingLanes|=u,u!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function xB(o,u,f,g,y,w){var M=o.pendingLanes;o.pendingLanes=f,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=f,o.entangledLanes&=f,o.errorRecoveryDisabledLanes&=f,o.shellSuspendCounter=0;var I=o.entanglements,Z=o.expirationTimes,xe=o.hiddenUpdates;for(f=M&~f;0"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var kB=/[\n"\\]/g;function ci(o){return o.replace(kB,function(u){return"\\"+u.charCodeAt(0).toString(16)+" "})}function l1(o,u,f,g,y,w,M,I){o.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?o.type=M:o.removeAttribute("type"),u!=null?M==="number"?(u===0&&o.value===""||o.value!=u)&&(o.value=""+oi(u)):o.value!==""+oi(u)&&(o.value=""+oi(u)):M!=="submit"&&M!=="reset"||o.removeAttribute("value"),u!=null?o1(o,M,oi(u)):f!=null?o1(o,M,oi(f)):g!=null&&o.removeAttribute("value"),y==null&&w!=null&&(o.defaultChecked=!!w),y!=null&&(o.checked=y&&typeof y!="function"&&typeof y!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?o.name=""+oi(I):o.removeAttribute("name")}function O3(o,u,f,g,y,w,M,I){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(o.type=w),u!=null||f!=null){if(!(w!=="submit"&&w!=="reset"||u!=null)){a1(o);return}f=f!=null?""+oi(f):"",u=u!=null?""+oi(u):f,I||u===o.value||(o.value=u),o.defaultValue=u}g=g??y,g=typeof g!="function"&&typeof g!="symbol"&&!!g,o.checked=I?o.checked:!!g,o.defaultChecked=!!g,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(o.name=M),a1(o)}function o1(o,u,f){u==="number"&&P0(o.ownerDocument)===o||o.defaultValue===""+f||(o.defaultValue=""+f)}function Vc(o,u,f,g){if(o=o.options,u){u={};for(var y=0;y"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f1=!1;if(Da)try{var Fd={};Object.defineProperty(Fd,"passive",{get:function(){f1=!0}}),window.addEventListener("test",Fd,Fd),window.removeEventListener("test",Fd,Fd)}catch{f1=!1}var jl=null,m1=null,L0=null;function E3(){if(L0)return L0;var o,u=m1,f=u.length,g,y="value"in jl?jl.value:jl.textContent,w=y.length;for(o=0;o=Hd),B3=" ",L3=!1;function I3(o,u){switch(o){case"keyup":return KB.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function q3(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Yc=!1;function JB(o,u){switch(o){case"compositionend":return q3(u);case"keypress":return u.which!==32?null:(L3=!0,B3);case"textInput":return o=u.data,o===B3&&L3?null:o;default:return null}}function eL(o,u){if(Yc)return o==="compositionend"||!y1&&I3(o,u)?(o=E3(),L0=m1=jl=null,Yc=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1=u)return{node:f,offset:u-o};o=g}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=G3(f)}}function Y3(o,u){return o&&u?o===u?!0:o&&o.nodeType===3?!1:u&&u.nodeType===3?Y3(o,u.parentNode):"contains"in o?o.contains(u):o.compareDocumentPosition?!!(o.compareDocumentPosition(u)&16):!1:!1}function K3(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var u=P0(o.document);u instanceof o.HTMLIFrameElement;){try{var f=typeof u.contentWindow.location.href=="string"}catch{f=!1}if(f)o=u.contentWindow;else break;u=P0(o.document)}return u}function S1(o){var u=o&&o.nodeName&&o.nodeName.toLowerCase();return u&&(u==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||u==="textarea"||o.contentEditable==="true")}var oL=Da&&"documentMode"in document&&11>=document.documentMode,Kc=null,k1=null,Gd=null,O1=!1;function Z3(o,u,f){var g=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;O1||Kc==null||Kc!==P0(g)||(g=Kc,"selectionStart"in g&&S1(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Gd&&Wd(Gd,g)||(Gd=g,g=Em(k1,"onSelect"),0>=M,y-=M,Yi=1<<32-yt(u)+y|f<kt?(Qt=Ke,Ke=null):Qt=Ke.sibling;var en=be(oe,Ke,pe[kt],Ne);if(en===null){Ke===null&&(Ke=Qt);break}o&&Ke&&en.alternate===null&&u(oe,Ke),se=w(en,se,kt),Jt===null?tt=en:Jt.sibling=en,Jt=en,Ke=Qt}if(kt===pe.length)return f(oe,Ke),Ut&&za(oe,kt),tt;if(Ke===null){for(;ktkt?(Qt=Ke,Ke=null):Qt=Ke.sibling;var Wl=be(oe,Ke,en.value,Ne);if(Wl===null){Ke===null&&(Ke=Qt);break}o&&Ke&&Wl.alternate===null&&u(oe,Ke),se=w(Wl,se,kt),Jt===null?tt=Wl:Jt.sibling=Wl,Jt=Wl,Ke=Qt}if(en.done)return f(oe,Ke),Ut&&za(oe,kt),tt;if(Ke===null){for(;!en.done;kt++,en=pe.next())en=Te(oe,en.value,Ne),en!==null&&(se=w(en,se,kt),Jt===null?tt=en:Jt.sibling=en,Jt=en);return Ut&&za(oe,kt),tt}for(Ke=g(Ke);!en.done;kt++,en=pe.next())en=ke(Ke,oe,kt,en.value,Ne),en!==null&&(o&&en.alternate!==null&&Ke.delete(en.key===null?kt:en.key),se=w(en,se,kt),Jt===null?tt=en:Jt.sibling=en,Jt=en);return o&&Ke.forEach(function(TI){return u(oe,TI)}),Ut&&za(oe,kt),tt}function Sn(oe,se,pe,Ne){if(typeof pe=="object"&&pe!==null&&pe.type===k&&pe.key===null&&(pe=pe.props.children),typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case v:e:{for(var tt=pe.key;se!==null;){if(se.key===tt){if(tt=pe.type,tt===k){if(se.tag===7){f(oe,se.sibling),Ne=y(se,pe.props.children),Ne.return=oe,oe=Ne;break e}}else if(se.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===Q&&Ho(tt)===se.type){f(oe,se.sibling),Ne=y(se,pe.props),eh(Ne,pe),Ne.return=oe,oe=Ne;break e}f(oe,se);break}else u(oe,se);se=se.sibling}pe.type===k?(Ne=Io(pe.props.children,oe.mode,Ne,pe.key),Ne.return=oe,oe=Ne):(Ne=G0(pe.type,pe.key,pe.props,null,oe.mode,Ne),eh(Ne,pe),Ne.return=oe,oe=Ne)}return M(oe);case b:e:{for(tt=pe.key;se!==null;){if(se.key===tt)if(se.tag===4&&se.stateNode.containerInfo===pe.containerInfo&&se.stateNode.implementation===pe.implementation){f(oe,se.sibling),Ne=y(se,pe.children||[]),Ne.return=oe,oe=Ne;break e}else{f(oe,se);break}else u(oe,se);se=se.sibling}Ne=E1(pe,oe.mode,Ne),Ne.return=oe,oe=Ne}return M(oe);case Q:return pe=Ho(pe),Sn(oe,se,pe,Ne)}if(J(pe))return Ge(oe,se,pe,Ne);if(V(pe)){if(tt=V(pe),typeof tt!="function")throw Error(r(150));return pe=tt.call(pe),lt(oe,se,pe,Ne)}if(typeof pe.then=="function")return Sn(oe,se,tm(pe),Ne);if(pe.$$typeof===A)return Sn(oe,se,K0(oe,pe),Ne);nm(oe,pe)}return typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint"?(pe=""+pe,se!==null&&se.tag===6?(f(oe,se.sibling),Ne=y(se,pe),Ne.return=oe,oe=Ne):(f(oe,se),Ne=M1(pe,oe.mode,Ne),Ne.return=oe,oe=Ne),M(oe)):f(oe,se)}return function(oe,se,pe,Ne){try{Jd=0;var tt=Sn(oe,se,pe,Ne);return ou=null,tt}catch(Ke){if(Ke===lu||Ke===J0)throw Ke;var Jt=Hs(29,Ke,null,oe.mode);return Jt.lanes=Ne,Jt.return=oe,Jt}finally{}}}var Vo=w6(!0),S6=w6(!1),Ml=!1;function $1(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function H1(o,u){o=o.updateQueue,u.updateQueue===o&&(u.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function El(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function _l(o,u,f){var g=o.updateQueue;if(g===null)return null;if(g=g.shared,(sn&2)!==0){var y=g.pending;return y===null?u.next=u:(u.next=y.next,y.next=u),g.pending=u,u=W0(o),i6(o,null,f),u}return V0(o,g,u,f),W0(o)}function th(o,u,f){if(u=u.updateQueue,u!==null&&(u=u.shared,(f&4194048)!==0)){var g=u.lanes;g&=o.pendingLanes,f|=g,u.lanes=f,f3(o,f)}}function U1(o,u){var f=o.updateQueue,g=o.alternate;if(g!==null&&(g=g.updateQueue,f===g)){var y=null,w=null;if(f=f.firstBaseUpdate,f!==null){do{var M={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};w===null?y=w=M:w=w.next=M,f=f.next}while(f!==null);w===null?y=w=u:w=w.next=u}else y=w=u;f={baseState:g.baseState,firstBaseUpdate:y,lastBaseUpdate:w,shared:g.shared,callbacks:g.callbacks},o.updateQueue=f;return}o=f.lastBaseUpdate,o===null?f.firstBaseUpdate=u:o.next=u,f.lastBaseUpdate=u}var V1=!1;function nh(){if(V1){var o=au;if(o!==null)throw o}}function rh(o,u,f,g){V1=!1;var y=o.updateQueue;Ml=!1;var w=y.firstBaseUpdate,M=y.lastBaseUpdate,I=y.shared.pending;if(I!==null){y.shared.pending=null;var Z=I,xe=Z.next;Z.next=null,M===null?w=xe:M.next=xe,M=Z;var je=o.alternate;je!==null&&(je=je.updateQueue,I=je.lastBaseUpdate,I!==M&&(I===null?je.firstBaseUpdate=xe:I.next=xe,je.lastBaseUpdate=Z))}if(w!==null){var Te=y.baseState;M=0,je=xe=Z=null,I=w;do{var be=I.lane&-536870913,ke=be!==I.lane;if(ke?(Ft&be)===be:(g&be)===be){be!==0&&be===iu&&(V1=!0),je!==null&&(je=je.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});e:{var Ge=o,lt=I;be=u;var Sn=f;switch(lt.tag){case 1:if(Ge=lt.payload,typeof Ge=="function"){Te=Ge.call(Sn,Te,be);break e}Te=Ge;break e;case 3:Ge.flags=Ge.flags&-65537|128;case 0:if(Ge=lt.payload,be=typeof Ge=="function"?Ge.call(Sn,Te,be):Ge,be==null)break e;Te=p({},Te,be);break e;case 2:Ml=!0}}be=I.callback,be!==null&&(o.flags|=64,ke&&(o.flags|=8192),ke=y.callbacks,ke===null?y.callbacks=[be]:ke.push(be))}else ke={lane:be,tag:I.tag,payload:I.payload,callback:I.callback,next:null},je===null?(xe=je=ke,Z=Te):je=je.next=ke,M|=be;if(I=I.next,I===null){if(I=y.shared.pending,I===null)break;ke=I,I=ke.next,ke.next=null,y.lastBaseUpdate=ke,y.shared.pending=null}}while(!0);je===null&&(Z=Te),y.baseState=Z,y.firstBaseUpdate=xe,y.lastBaseUpdate=je,w===null&&(y.shared.lanes=0),Bl|=M,o.lanes=M,o.memoizedState=Te}}function k6(o,u){if(typeof o!="function")throw Error(r(191,o));o.call(u)}function O6(o,u){var f=o.callbacks;if(f!==null)for(o.callbacks=null,o=0;ow?w:8;var M=$.T,I={};$.T=I,dv(o,!1,u,f);try{var Z=y(),xe=$.S;if(xe!==null&&xe(I,Z),Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var je=xL(Z,g);ah(o,u,je,Xs(o))}else ah(o,u,g,Xs(o))}catch(Te){ah(o,u,{then:function(){},status:"rejected",reason:Te},Xs())}finally{ae.p=w,M!==null&&I.types!==null&&(M.types=I.types),$.T=M}}function kL(){}function cv(o,u,f,g){if(o.tag!==5)throw Error(r(476));var y=nS(o).queue;tS(o,y,u,ne,f===null?kL:function(){return rS(o),f(g)})}function nS(o){var u=o.memoizedState;if(u!==null)return u;u={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ia,lastRenderedState:ne},next:null};var f={};return u.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ia,lastRenderedState:f},next:null},o.memoizedState=u,o=o.alternate,o!==null&&(o.memoizedState=u),u}function rS(o){var u=nS(o);u.next===null&&(u=o.alternate.memoizedState),ah(o,u.next.queue,{},Xs())}function uv(){return qr(kh)}function sS(){return sr().memoizedState}function iS(){return sr().memoizedState}function OL(o){for(var u=o.return;u!==null;){switch(u.tag){case 24:case 3:var f=Xs();o=El(f);var g=_l(u,o,f);g!==null&&(js(g,u,f),th(g,u,f)),u={cache:I1()},o.payload=u;return}u=u.return}}function jL(o,u,f){var g=Xs();f={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},hm(o)?lS(u,f):(f=T1(o,u,f,g),f!==null&&(js(f,o,g),oS(f,u,g)))}function aS(o,u,f){var g=Xs();ah(o,u,f,g)}function ah(o,u,f,g){var y={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(hm(o))lS(u,y);else{var w=o.alternate;if(o.lanes===0&&(w===null||w.lanes===0)&&(w=u.lastRenderedReducer,w!==null))try{var M=u.lastRenderedState,I=w(M,f);if(y.hasEagerState=!0,y.eagerState=I,$s(I,M))return V0(o,u,y,0),An===null&&U0(),!1}catch{}finally{}if(f=T1(o,u,y,g),f!==null)return js(f,o,g),oS(f,u,g),!0}return!1}function dv(o,u,f,g){if(g={lane:2,revertLane:$v(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},hm(o)){if(u)throw Error(r(479))}else u=T1(o,f,g,2),u!==null&&js(u,o,2)}function hm(o){var u=o.alternate;return o===wt||u!==null&&u===wt}function lS(o,u){uu=im=!0;var f=o.pending;f===null?u.next=u:(u.next=f.next,f.next=u),o.pending=u}function oS(o,u,f){if((f&4194048)!==0){var g=u.lanes;g&=o.pendingLanes,f|=g,u.lanes=f,f3(o,f)}}var lh={readContext:qr,use:om,useCallback:er,useContext:er,useEffect:er,useImperativeHandle:er,useLayoutEffect:er,useInsertionEffect:er,useMemo:er,useReducer:er,useRef:er,useState:er,useDebugValue:er,useDeferredValue:er,useTransition:er,useSyncExternalStore:er,useId:er,useHostTransitionStatus:er,useFormState:er,useActionState:er,useOptimistic:er,useMemoCache:er,useCacheRefresh:er};lh.useEffectEvent=er;var cS={readContext:qr,use:om,useCallback:function(o,u){return os().memoizedState=[o,u===void 0?null:u],o},useContext:qr,useEffect:V6,useImperativeHandle:function(o,u,f){f=f!=null?f.concat([o]):null,um(4194308,4,Y6.bind(null,u,o),f)},useLayoutEffect:function(o,u){return um(4194308,4,o,u)},useInsertionEffect:function(o,u){um(4,2,o,u)},useMemo:function(o,u){var f=os();u=u===void 0?null:u;var g=o();if(Wo){pt(!0);try{o()}finally{pt(!1)}}return f.memoizedState=[g,u],g},useReducer:function(o,u,f){var g=os();if(f!==void 0){var y=f(u);if(Wo){pt(!0);try{f(u)}finally{pt(!1)}}}else y=u;return g.memoizedState=g.baseState=y,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:y},g.queue=o,o=o.dispatch=jL.bind(null,wt,o),[g.memoizedState,o]},useRef:function(o){var u=os();return o={current:o},u.memoizedState=o},useState:function(o){o=sv(o);var u=o.queue,f=aS.bind(null,wt,u);return u.dispatch=f,[o.memoizedState,f]},useDebugValue:lv,useDeferredValue:function(o,u){var f=os();return ov(f,o,u)},useTransition:function(){var o=sv(!1);return o=tS.bind(null,wt,o.queue,!0,!1),os().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,u,f){var g=wt,y=os();if(Ut){if(f===void 0)throw Error(r(407));f=f()}else{if(f=u(),An===null)throw Error(r(349));(Ft&127)!==0||M6(g,u,f)}y.memoizedState=f;var w={value:f,getSnapshot:u};return y.queue=w,V6(_6.bind(null,g,w,o),[o]),g.flags|=2048,hu(9,{destroy:void 0},E6.bind(null,g,w,f,u),null),f},useId:function(){var o=os(),u=An.identifierPrefix;if(Ut){var f=Ki,g=Yi;f=(g&~(1<<32-yt(g)-1)).toString(32)+f,u="_"+u+"R_"+f,f=am++,0<\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof g.is=="string"?M.createElement("select",{is:g.is}):M.createElement("select"),g.multiple?w.multiple=!0:g.size&&(w.size=g.size);break;default:w=typeof g.is=="string"?M.createElement(y,{is:g.is}):M.createElement(y)}}w[Lr]=u,w[ys]=g;e:for(M=u.child;M!==null;){if(M.tag===5||M.tag===6)w.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===u)break e;for(;M.sibling===null;){if(M.return===null||M.return===u)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}u.stateNode=w;e:switch(Qr(w,y,g),y){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&Fa(u)}}return Qn(u),jv(u,u.type,o===null?null:o.memoizedProps,u.pendingProps,f),null;case 6:if(o&&u.stateNode!=null)o.memoizedProps!==g&&Fa(u);else{if(typeof g!="string"&&u.stateNode===null)throw Error(r(166));if(o=fe.current,ru(u)){if(o=u.stateNode,f=u.memoizedProps,g=null,y=Ir,y!==null)switch(y.tag){case 27:case 5:g=y.memoizedProps}o[Lr]=u,o=!!(o.nodeValue===f||g!==null&&g.suppressHydrationWarning===!0||Tk(o.nodeValue,f)),o||Tl(u,!0)}else o=_m(o).createTextNode(g),o[Lr]=u,u.stateNode=o}return Qn(u),null;case 31:if(f=u.memoizedState,o===null||o.memoizedState!==null){if(g=ru(u),f!==null){if(o===null){if(!g)throw Error(r(318));if(o=u.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[Lr]=u}else qo(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Qn(u),o=!1}else f=z1(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=f),o=!0;if(!o)return u.flags&256?(Vs(u),u):(Vs(u),null);if((u.flags&128)!==0)throw Error(r(558))}return Qn(u),null;case 13:if(g=u.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(y=ru(u),g!==null&&g.dehydrated!==null){if(o===null){if(!y)throw Error(r(318));if(y=u.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(r(317));y[Lr]=u}else qo(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Qn(u),y=!1}else y=z1(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=y),y=!0;if(!y)return u.flags&256?(Vs(u),u):(Vs(u),null)}return Vs(u),(u.flags&128)!==0?(u.lanes=f,u):(f=g!==null,o=o!==null&&o.memoizedState!==null,f&&(g=u.child,y=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(y=g.alternate.memoizedState.cachePool.pool),w=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(w=g.memoizedState.cachePool.pool),w!==y&&(g.flags|=2048)),f!==o&&f&&(u.child.flags|=8192),xm(u,u.updateQueue),Qn(u),null);case 4:return de(),o===null&&Wv(u.stateNode.containerInfo),Qn(u),null;case 10:return Ba(u.type),Qn(u),null;case 19:if(Y(rr),g=u.memoizedState,g===null)return Qn(u),null;if(y=(u.flags&128)!==0,w=g.rendering,w===null)if(y)ch(g,!1);else{if(tr!==0||o!==null&&(o.flags&128)!==0)for(o=u.child;o!==null;){if(w=sm(o),w!==null){for(u.flags|=128,ch(g,!1),o=w.updateQueue,u.updateQueue=o,xm(u,o),u.subtreeFlags=0,o=f,f=u.child;f!==null;)a6(f,o),f=f.sibling;return P(rr,rr.current&1|2),Ut&&za(u,g.treeForkCount),u.child}o=o.sibling}g.tail!==null&&yn()>Sm&&(u.flags|=128,y=!0,ch(g,!1),u.lanes=4194304)}else{if(!y)if(o=sm(w),o!==null){if(u.flags|=128,y=!0,o=o.updateQueue,u.updateQueue=o,xm(u,o),ch(g,!0),g.tail===null&&g.tailMode==="hidden"&&!w.alternate&&!Ut)return Qn(u),null}else 2*yn()-g.renderingStartTime>Sm&&f!==536870912&&(u.flags|=128,y=!0,ch(g,!1),u.lanes=4194304);g.isBackwards?(w.sibling=u.child,u.child=w):(o=g.last,o!==null?o.sibling=w:u.child=w,g.last=w)}return g.tail!==null?(o=g.tail,g.rendering=o,g.tail=o.sibling,g.renderingStartTime=yn(),o.sibling=null,f=rr.current,P(rr,y?f&1|2:f&1),Ut&&za(u,g.treeForkCount),o):(Qn(u),null);case 22:case 23:return Vs(u),G1(),g=u.memoizedState!==null,o!==null?o.memoizedState!==null!==g&&(u.flags|=8192):g&&(u.flags|=8192),g?(f&536870912)!==0&&(u.flags&128)===0&&(Qn(u),u.subtreeFlags&6&&(u.flags|=8192)):Qn(u),f=u.updateQueue,f!==null&&xm(u,f.retryQueue),f=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==f&&(u.flags|=2048),o!==null&&Y($o),null;case 24:return f=null,o!==null&&(f=o.memoizedState.cache),u.memoizedState.cache!==f&&(u.flags|=2048),Ba(ur),Qn(u),null;case 25:return null;case 30:return null}throw Error(r(156,u.tag))}function ML(o,u){switch(D1(u),u.tag){case 1:return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 3:return Ba(ur),de(),o=u.flags,(o&65536)!==0&&(o&128)===0?(u.flags=o&-65537|128,u):null;case 26:case 27:case 5:return ct(u),null;case 31:if(u.memoizedState!==null){if(Vs(u),u.alternate===null)throw Error(r(340));qo()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 13:if(Vs(u),o=u.memoizedState,o!==null&&o.dehydrated!==null){if(u.alternate===null)throw Error(r(340));qo()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 19:return Y(rr),null;case 4:return de(),null;case 10:return Ba(u.type),null;case 22:case 23:return Vs(u),G1(),o!==null&&Y($o),o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 24:return Ba(ur),null;case 25:return null;default:return null}}function DS(o,u){switch(D1(u),u.tag){case 3:Ba(ur),de();break;case 26:case 27:case 5:ct(u);break;case 4:de();break;case 31:u.memoizedState!==null&&Vs(u);break;case 13:Vs(u);break;case 19:Y(rr);break;case 10:Ba(u.type);break;case 22:case 23:Vs(u),G1(),o!==null&&Y($o);break;case 24:Ba(ur)}}function uh(o,u){try{var f=u.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var y=g.next;f=y;do{if((f.tag&o)===o){g=void 0;var w=f.create,M=f.inst;g=w(),M.destroy=g}f=f.next}while(f!==y)}}catch(I){xn(u,u.return,I)}}function zl(o,u,f){try{var g=u.updateQueue,y=g!==null?g.lastEffect:null;if(y!==null){var w=y.next;g=w;do{if((g.tag&o)===o){var M=g.inst,I=M.destroy;if(I!==void 0){M.destroy=void 0,y=u;var Z=f,xe=I;try{xe()}catch(je){xn(y,Z,je)}}}g=g.next}while(g!==w)}}catch(je){xn(u,u.return,je)}}function RS(o){var u=o.updateQueue;if(u!==null){var f=o.stateNode;try{O6(u,f)}catch(g){xn(o,o.return,g)}}}function zS(o,u,f){f.props=Go(o.type,o.memoizedProps),f.state=o.memoizedState;try{f.componentWillUnmount()}catch(g){xn(o,u,g)}}function dh(o,u){try{var f=o.ref;if(f!==null){switch(o.tag){case 26:case 27:case 5:var g=o.stateNode;break;case 30:g=o.stateNode;break;default:g=o.stateNode}typeof f=="function"?o.refCleanup=f(g):f.current=g}}catch(y){xn(o,u,y)}}function Zi(o,u){var f=o.ref,g=o.refCleanup;if(f!==null)if(typeof g=="function")try{g()}catch(y){xn(o,u,y)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(y){xn(o,u,y)}else f.current=null}function PS(o){var u=o.type,f=o.memoizedProps,g=o.stateNode;try{e:switch(u){case"button":case"input":case"select":case"textarea":f.autoFocus&&g.focus();break e;case"img":f.src?g.src=f.src:f.srcSet&&(g.srcset=f.srcSet)}}catch(y){xn(o,o.return,y)}}function Nv(o,u,f){try{var g=o.stateNode;ZL(g,o.type,f,u),g[ys]=u}catch(y){xn(o,o.return,y)}}function BS(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Ql(o.type)||o.tag===4}function Cv(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||BS(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Ql(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Tv(o,u,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,u?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(o,u):(u=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,u.appendChild(o),f=f._reactRootContainer,f!=null||u.onclick!==null||(u.onclick=_a));else if(g!==4&&(g===27&&Ql(o.type)&&(f=o.stateNode,u=null),o=o.child,o!==null))for(Tv(o,u,f),o=o.sibling;o!==null;)Tv(o,u,f),o=o.sibling}function vm(o,u,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,u?f.insertBefore(o,u):f.appendChild(o);else if(g!==4&&(g===27&&Ql(o.type)&&(f=o.stateNode),o=o.child,o!==null))for(vm(o,u,f),o=o.sibling;o!==null;)vm(o,u,f),o=o.sibling}function LS(o){var u=o.stateNode,f=o.memoizedProps;try{for(var g=o.type,y=u.attributes;y.length;)u.removeAttributeNode(y[0]);Qr(u,g,f),u[Lr]=o,u[ys]=f}catch(w){xn(o,o.return,w)}}var Qa=!1,fr=!1,Av=!1,IS=typeof WeakSet=="function"?WeakSet:Set,_r=null;function EL(o,u){if(o=o.containerInfo,Yv=Im,o=K3(o),S1(o)){if("selectionStart"in o)var f={start:o.selectionStart,end:o.selectionEnd};else e:{f=(f=o.ownerDocument)&&f.defaultView||window;var g=f.getSelection&&f.getSelection();if(g&&g.rangeCount!==0){f=g.anchorNode;var y=g.anchorOffset,w=g.focusNode;g=g.focusOffset;try{f.nodeType,w.nodeType}catch{f=null;break e}var M=0,I=-1,Z=-1,xe=0,je=0,Te=o,be=null;t:for(;;){for(var ke;Te!==f||y!==0&&Te.nodeType!==3||(I=M+y),Te!==w||g!==0&&Te.nodeType!==3||(Z=M+g),Te.nodeType===3&&(M+=Te.nodeValue.length),(ke=Te.firstChild)!==null;)be=Te,Te=ke;for(;;){if(Te===o)break t;if(be===f&&++xe===y&&(I=M),be===w&&++je===g&&(Z=M),(ke=Te.nextSibling)!==null)break;Te=be,be=Te.parentNode}Te=ke}f=I===-1||Z===-1?null:{start:I,end:Z}}else f=null}f=f||{start:0,end:0}}else f=null;for(Kv={focusedElem:o,selectionRange:f},Im=!1,_r=u;_r!==null;)if(u=_r,o=u.child,(u.subtreeFlags&1028)!==0&&o!==null)o.return=u,_r=o;else for(;_r!==null;){switch(u=_r,w=u.alternate,o=u.flags,u.tag){case 0:if((o&4)!==0&&(o=u.updateQueue,o=o!==null?o.events:null,o!==null))for(f=0;f title"))),Qr(w,g,f),w[Lr]=o,Er(w),g=w;break e;case"link":var M=Uk("link","href",y).get(g+(f.href||""));if(M){for(var I=0;ISn&&(M=Sn,Sn=lt,lt=M);var oe=X3(I,lt),se=X3(I,Sn);if(oe&&se&&(ke.rangeCount!==1||ke.anchorNode!==oe.node||ke.anchorOffset!==oe.offset||ke.focusNode!==se.node||ke.focusOffset!==se.offset)){var pe=Te.createRange();pe.setStart(oe.node,oe.offset),ke.removeAllRanges(),lt>Sn?(ke.addRange(pe),ke.extend(se.node,se.offset)):(pe.setEnd(se.node,se.offset),ke.addRange(pe))}}}}for(Te=[],ke=I;ke=ke.parentNode;)ke.nodeType===1&&Te.push({element:ke,left:ke.scrollLeft,top:ke.scrollTop});for(typeof I.focus=="function"&&I.focus(),I=0;If?32:f,$.T=null,f=Pv,Pv=null;var w=Il,M=Wa;if(br=0,xu=Il=null,Wa=0,(sn&6)!==0)throw Error(r(331));var I=sn;if(sn|=4,YS(w.current),WS(w,w.current,M,f),sn=I,xh(0,!1),Ae&&typeof Ae.onPostCommitFiberRoot=="function")try{Ae.onPostCommitFiberRoot(re,w)}catch{}return!0}finally{ae.p=y,$.T=g,mk(o,u)}}function gk(o,u,f){u=di(f,u),u=pv(o.stateNode,u,2),o=_l(o,u,2),o!==null&&(Bd(o,2),Ji(o))}function xn(o,u,f){if(o.tag===3)gk(o,o,f);else for(;u!==null;){if(u.tag===3){gk(u,o,f);break}else if(u.tag===1){var g=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Ll===null||!Ll.has(g))){o=di(f,o),f=xS(2),g=_l(u,f,2),g!==null&&(vS(f,g,u,o),Bd(g,2),Ji(g));break}}u=u.return}}function qv(o,u,f){var g=o.pingCache;if(g===null){g=o.pingCache=new RL;var y=new Set;g.set(u,y)}else y=g.get(u),y===void 0&&(y=new Set,g.set(u,y));y.has(f)||(_v=!0,y.add(f),o=IL.bind(null,o,u,f),u.then(o,o))}function IL(o,u,f){var g=o.pingCache;g!==null&&g.delete(u),o.pingedLanes|=o.suspendedLanes&f,o.warmLanes&=~f,An===o&&(Ft&f)===f&&(tr===4||tr===3&&(Ft&62914560)===Ft&&300>yn()-wm?(sn&2)===0&&vu(o,0):Dv|=f,gu===Ft&&(gu=0)),Ji(o)}function xk(o,u){u===0&&(u=qc()),o=Lo(o,u),o!==null&&(Bd(o,u),Ji(o))}function qL(o){var u=o.memoizedState,f=0;u!==null&&(f=u.retryLane),xk(o,f)}function FL(o,u){var f=0;switch(o.tag){case 31:case 13:var g=o.stateNode,y=o.memoizedState;y!==null&&(f=y.retryLane);break;case 19:g=o.stateNode;break;case 22:g=o.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(u),xk(o,f)}function QL(o,u){return _t(o,u)}var Tm=null,bu=null,Fv=!1,Am=!1,Qv=!1,Fl=0;function Ji(o){o!==bu&&o.next===null&&(bu===null?Tm=bu=o:bu=bu.next=o),Am=!0,Fv||(Fv=!0,HL())}function xh(o,u){if(!Qv&&Am){Qv=!0;do for(var f=!1,g=Tm;g!==null;){if(o!==0){var y=g.pendingLanes;if(y===0)var w=0;else{var M=g.suspendedLanes,I=g.pingedLanes;w=(1<<31-yt(42|o)+1)-1,w&=y&~(M&~I),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(f=!0,wk(g,w))}else w=Ft,w=Ic(g,g===An?w:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(w&3)===0||_o(g,w)||(f=!0,wk(g,w));g=g.next}while(f);Qv=!1}}function $L(){vk()}function vk(){Am=Fv=!1;var o=0;Fl!==0&&eI()&&(o=Fl);for(var u=yn(),f=null,g=Tm;g!==null;){var y=g.next,w=yk(g,u);w===0?(g.next=null,f===null?Tm=y:f.next=y,y===null&&(bu=f)):(f=g,(o!==0||(w&3)!==0)&&(Am=!0)),g=y}br!==0&&br!==5||xh(o),Fl!==0&&(Fl=0)}function yk(o,u){for(var f=o.suspendedLanes,g=o.pingedLanes,y=o.expirationTimes,w=o.pendingLanes&-62914561;0I)break;var je=Z.transferSize,Te=Z.initiatorType;je&&Ak(Te)&&(Z=Z.responseEnd,M+=je*(Z"u"?null:document;function Fk(o,u,f){var g=wu;if(g&&typeof u=="string"&&u){var y=ci(u);y='link[rel="'+o+'"][href="'+y+'"]',typeof f=="string"&&(y+='[crossorigin="'+f+'"]'),qk.has(y)||(qk.add(y),o={rel:o,crossOrigin:f,href:u},g.querySelector(y)===null&&(u=g.createElement("link"),Qr(u,"link",o),Er(u),g.head.appendChild(u)))}}function cI(o){Ga.D(o),Fk("dns-prefetch",o,null)}function uI(o,u){Ga.C(o,u),Fk("preconnect",o,u)}function dI(o,u,f){Ga.L(o,u,f);var g=wu;if(g&&o&&u){var y='link[rel="preload"][as="'+ci(u)+'"]';u==="image"&&f&&f.imageSrcSet?(y+='[imagesrcset="'+ci(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(y+='[imagesizes="'+ci(f.imageSizes)+'"]')):y+='[href="'+ci(o)+'"]';var w=y;switch(u){case"style":w=Su(o);break;case"script":w=ku(o)}xi.has(w)||(o=p({rel:"preload",href:u==="image"&&f&&f.imageSrcSet?void 0:o,as:u},f),xi.set(w,o),g.querySelector(y)!==null||u==="style"&&g.querySelector(wh(w))||u==="script"&&g.querySelector(Sh(w))||(u=g.createElement("link"),Qr(u,"link",o),Er(u),g.head.appendChild(u)))}}function hI(o,u){Ga.m(o,u);var f=wu;if(f&&o){var g=u&&typeof u.as=="string"?u.as:"script",y='link[rel="modulepreload"][as="'+ci(g)+'"][href="'+ci(o)+'"]',w=y;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=ku(o)}if(!xi.has(w)&&(o=p({rel:"modulepreload",href:o},u),xi.set(w,o),f.querySelector(y)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(Sh(w)))return}g=f.createElement("link"),Qr(g,"link",o),Er(g),f.head.appendChild(g)}}}function fI(o,u,f){Ga.S(o,u,f);var g=wu;if(g&&o){var y=Hc(g).hoistableStyles,w=Su(o);u=u||"default";var M=y.get(w);if(!M){var I={loading:0,preload:null};if(M=g.querySelector(wh(w)))I.loading=5;else{o=p({rel:"stylesheet",href:o,"data-precedence":u},f),(f=xi.get(w))&&sy(o,f);var Z=M=g.createElement("link");Er(Z),Qr(Z,"link",o),Z._p=new Promise(function(xe,je){Z.onload=xe,Z.onerror=je}),Z.addEventListener("load",function(){I.loading|=1}),Z.addEventListener("error",function(){I.loading|=2}),I.loading|=4,Rm(M,u,g)}M={type:"stylesheet",instance:M,count:1,state:I},y.set(w,M)}}}function mI(o,u){Ga.X(o,u);var f=wu;if(f&&o){var g=Hc(f).hoistableScripts,y=ku(o),w=g.get(y);w||(w=f.querySelector(Sh(y)),w||(o=p({src:o,async:!0},u),(u=xi.get(y))&&iy(o,u),w=f.createElement("script"),Er(w),Qr(w,"link",o),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(y,w))}}function pI(o,u){Ga.M(o,u);var f=wu;if(f&&o){var g=Hc(f).hoistableScripts,y=ku(o),w=g.get(y);w||(w=f.querySelector(Sh(y)),w||(o=p({src:o,async:!0,type:"module"},u),(u=xi.get(y))&&iy(o,u),w=f.createElement("script"),Er(w),Qr(w,"link",o),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(y,w))}}function Qk(o,u,f,g){var y=(y=fe.current)?Dm(y):null;if(!y)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(u=Su(f.href),f=Hc(y).hoistableStyles,g=f.get(u),g||(g={type:"style",instance:null,count:0,state:null},f.set(u,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){o=Su(f.href);var w=Hc(y).hoistableStyles,M=w.get(o);if(M||(y=y.ownerDocument||y,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(o,M),(w=y.querySelector(wh(o)))&&!w._p&&(M.instance=w,M.state.loading=5),xi.has(o)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},xi.set(o,f),w||gI(y,o,f,M.state))),u&&g===null)throw Error(r(528,""));return M}if(u&&g!==null)throw Error(r(529,""));return null;case"script":return u=f.async,f=f.src,typeof f=="string"&&u&&typeof u!="function"&&typeof u!="symbol"?(u=ku(f),f=Hc(y).hoistableScripts,g=f.get(u),g||(g={type:"script",instance:null,count:0,state:null},f.set(u,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function Su(o){return'href="'+ci(o)+'"'}function wh(o){return'link[rel="stylesheet"]['+o+"]"}function $k(o){return p({},o,{"data-precedence":o.precedence,precedence:null})}function gI(o,u,f,g){o.querySelector('link[rel="preload"][as="style"]['+u+"]")?g.loading=1:(u=o.createElement("link"),g.preload=u,u.addEventListener("load",function(){return g.loading|=1}),u.addEventListener("error",function(){return g.loading|=2}),Qr(u,"link",f),Er(u),o.head.appendChild(u))}function ku(o){return'[src="'+ci(o)+'"]'}function Sh(o){return"script[async]"+o}function Hk(o,u,f){if(u.count++,u.instance===null)switch(u.type){case"style":var g=o.querySelector('style[data-href~="'+ci(f.href)+'"]');if(g)return u.instance=g,Er(g),g;var y=p({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return g=(o.ownerDocument||o).createElement("style"),Er(g),Qr(g,"style",y),Rm(g,f.precedence,o),u.instance=g;case"stylesheet":y=Su(f.href);var w=o.querySelector(wh(y));if(w)return u.state.loading|=4,u.instance=w,Er(w),w;g=$k(f),(y=xi.get(y))&&sy(g,y),w=(o.ownerDocument||o).createElement("link"),Er(w);var M=w;return M._p=new Promise(function(I,Z){M.onload=I,M.onerror=Z}),Qr(w,"link",g),u.state.loading|=4,Rm(w,f.precedence,o),u.instance=w;case"script":return w=ku(f.src),(y=o.querySelector(Sh(w)))?(u.instance=y,Er(y),y):(g=f,(y=xi.get(w))&&(g=p({},f),iy(g,y)),o=o.ownerDocument||o,y=o.createElement("script"),Er(y),Qr(y,"link",g),o.head.appendChild(y),u.instance=y);case"void":return null;default:throw Error(r(443,u.type))}else u.type==="stylesheet"&&(u.state.loading&4)===0&&(g=u.instance,u.state.loading|=4,Rm(g,f.precedence,o));return u.instance}function Rm(o,u,f){for(var g=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=g.length?g[g.length-1]:null,w=y,M=0;M title"):null)}function xI(o,u,f){if(f===1||u.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof u.precedence!="string"||typeof u.href!="string"||u.href==="")break;return!0;case"link":if(typeof u.rel!="string"||typeof u.href!="string"||u.href===""||u.onLoad||u.onError)break;switch(u.rel){case"stylesheet":return o=u.disabled,typeof u.precedence=="string"&&o==null;default:return!0}case"script":if(u.async&&typeof u.async!="function"&&typeof u.async!="symbol"&&!u.onLoad&&!u.onError&&u.src&&typeof u.src=="string")return!0}return!1}function Wk(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function vI(o,u,f,g){if(f.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var y=Su(g.href),w=u.querySelector(wh(y));if(w){u=w._p,u!==null&&typeof u=="object"&&typeof u.then=="function"&&(o.count++,o=Pm.bind(o),u.then(o,o)),f.state.loading|=4,f.instance=w,Er(w);return}w=u.ownerDocument||u,g=$k(g),(y=xi.get(y))&&sy(g,y),w=w.createElement("link"),Er(w);var M=w;M._p=new Promise(function(I,Z){M.onload=I,M.onerror=Z}),Qr(w,"link",g),f.instance=w}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(f,u),(u=f.state.preload)&&(f.state.loading&3)===0&&(o.count++,f=Pm.bind(o),u.addEventListener("load",f),u.addEventListener("error",f))}}var ay=0;function yI(o,u){return o.stylesheets&&o.count===0&&Lm(o,o.stylesheets),0ay?50:800)+u);return o.unsuspend=f,function(){o.unsuspend=null,clearTimeout(g),clearTimeout(y)}}:null}function Pm(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Lm(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Bm=null;function Lm(o,u){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Bm=new Map,u.forEach(bI,o),Bm=null,Pm.call(o))}function bI(o,u){if(!(u.state.loading&4)){var f=Bm.get(o);if(f)var g=f.get(null);else{f=new Map,Bm.set(o,f);for(var y=o.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),py.exports=zq(),py.exports}var Bq=Pq();function L9(t,e){return function(){return t.apply(e,arguments)}}const{toString:Lq}=Object.prototype,{getPrototypeOf:J4}=Object,{iterator:ox,toStringTag:I9}=Symbol,cx=(t=>e=>{const n=Lq.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Wi=t=>(t=t.toLowerCase(),e=>cx(e)===t),ux=t=>e=>typeof e===t,{isArray:Sd}=Array,sd=ux("undefined");function Kf(t){return t!==null&&!sd(t)&&t.constructor!==null&&!sd(t.constructor)&&Rs(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const q9=Wi("ArrayBuffer");function Iq(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&q9(t.buffer),e}const qq=ux("string"),Rs=ux("function"),F9=ux("number"),Zf=t=>t!==null&&typeof t=="object",Fq=t=>t===!0||t===!1,$p=t=>{if(cx(t)!=="object")return!1;const e=J4(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(I9 in t)&&!(ox in t)},Qq=t=>{if(!Zf(t)||Kf(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},$q=Wi("Date"),Hq=Wi("File"),Uq=Wi("Blob"),Vq=Wi("FileList"),Wq=t=>Zf(t)&&Rs(t.pipe),Gq=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Rs(t.append)&&((e=cx(t))==="formdata"||e==="object"&&Rs(t.toString)&&t.toString()==="[object FormData]"))},Xq=Wi("URLSearchParams"),[Yq,Kq,Zq,Jq]=["ReadableStream","Request","Response","Headers"].map(Wi),eF=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Jf(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),Sd(t))for(r=0,s=t.length;r0;)if(s=n[r],e===s.toLowerCase())return s;return null}const ac=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,$9=t=>!sd(t)&&t!==ac;function n2(){const{caseless:t,skipUndefined:e}=$9(this)&&this||{},n={},r=(s,i)=>{const l=t&&Q9(n,i)||i;$p(n[l])&&$p(s)?n[l]=n2(n[l],s):$p(s)?n[l]=n2({},s):Sd(s)?n[l]=s.slice():(!e||!sd(s))&&(n[l]=s)};for(let s=0,i=arguments.length;s(Jf(e,(s,i)=>{n&&Rs(s)?t[i]=L9(s,n):t[i]=s},{allOwnKeys:r}),t),nF=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),rF=(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)},sF=(t,e,n,r)=>{let s,i,l;const c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)l=s[i],(!r||r(l,t,e))&&!c[l]&&(e[l]=t[l],c[l]=!0);t=n!==!1&&J4(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},iF=(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},aF=t=>{if(!t)return null;if(Sd(t))return t;let e=t.length;if(!F9(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},lF=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&J4(Uint8Array)),oF=(t,e)=>{const r=(t&&t[ox]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},cF=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},uF=Wi("HTMLFormElement"),dF=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),vO=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),hF=Wi("RegExp"),H9=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Jf(n,(s,i)=>{let l;(l=e(s,i,t))!==!1&&(r[i]=l||s)}),Object.defineProperties(t,r)},fF=t=>{H9(t,(e,n)=>{if(Rs(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Rs(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+"'")})}})},mF=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Sd(t)?r(t):r(String(t).split(e)),n},pF=()=>{},gF=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function xF(t){return!!(t&&Rs(t.append)&&t[I9]==="FormData"&&t[ox])}const vF=t=>{const e=new Array(10),n=(r,s)=>{if(Zf(r)){if(e.indexOf(r)>=0)return;if(Kf(r))return r;if(!("toJSON"in r)){e[s]=r;const i=Sd(r)?[]:{};return Jf(r,(l,c)=>{const d=n(l,s+1);!sd(d)&&(i[c]=d)}),e[s]=void 0,i}}return r};return n(t,0)},yF=Wi("AsyncFunction"),bF=t=>t&&(Zf(t)||Rs(t))&&Rs(t.then)&&Rs(t.catch),U9=((t,e)=>t?setImmediate:e?((n,r)=>(ac.addEventListener("message",({source:s,data:i})=>{s===ac&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),ac.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Rs(ac.postMessage)),wF=typeof queueMicrotask<"u"?queueMicrotask.bind(ac):typeof process<"u"&&process.nextTick||U9,SF=t=>t!=null&&Rs(t[ox]),we={isArray:Sd,isArrayBuffer:q9,isBuffer:Kf,isFormData:Gq,isArrayBufferView:Iq,isString:qq,isNumber:F9,isBoolean:Fq,isObject:Zf,isPlainObject:$p,isEmptyObject:Qq,isReadableStream:Yq,isRequest:Kq,isResponse:Zq,isHeaders:Jq,isUndefined:sd,isDate:$q,isFile:Hq,isBlob:Uq,isRegExp:hF,isFunction:Rs,isStream:Wq,isURLSearchParams:Xq,isTypedArray:lF,isFileList:Vq,forEach:Jf,merge:n2,extend:tF,trim:eF,stripBOM:nF,inherits:rF,toFlatObject:sF,kindOf:cx,kindOfTest:Wi,endsWith:iF,toArray:aF,forEachEntry:oF,matchAll:cF,isHTMLForm:uF,hasOwnProperty:vO,hasOwnProp:vO,reduceDescriptors:H9,freezeMethods:fF,toObjectSet:mF,toCamelCase:dF,noop:pF,toFiniteNumber:gF,findKey:Q9,global:ac,isContextDefined:$9,isSpecCompliantForm:xF,toJSONObject:vF,isAsyncFn:yF,isThenable:bF,setImmediate:U9,asap:wF,isIterable:SF};function St(t,e,n,r,s){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),s&&(this.response=s,this.status=s.status?s.status:null)}we.inherits(St,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:we.toJSONObject(this.config),code:this.code,status:this.status}}});const V9=St.prototype,W9={};["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=>{W9[t]={value:t}});Object.defineProperties(St,W9);Object.defineProperty(V9,"isAxiosError",{value:!0});St.from=(t,e,n,r,s,i)=>{const l=Object.create(V9);we.toFlatObject(t,l,function(m){return m!==Error.prototype},h=>h!=="isAxiosError");const c=t&&t.message?t.message:"Error",d=e==null&&t?t.code:e;return St.call(l,c,d,n,r,s),t&&l.cause==null&&Object.defineProperty(l,"cause",{value:t,configurable:!0}),l.name=t&&t.name||"Error",i&&Object.assign(l,i),l};const kF=null;function r2(t){return we.isPlainObject(t)||we.isArray(t)}function G9(t){return we.endsWith(t,"[]")?t.slice(0,-2):t}function yO(t,e,n){return t?t.concat(e).map(function(s,i){return s=G9(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function OF(t){return we.isArray(t)&&!t.some(r2)}const jF=we.toFlatObject(we,{},null,function(e){return/^is[A-Z]/.test(e)});function dx(t,e,n){if(!we.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=we.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(k,O){return!we.isUndefined(O[k])});const r=n.metaTokens,s=n.visitor||m,i=n.dots,l=n.indexes,d=(n.Blob||typeof Blob<"u"&&Blob)&&we.isSpecCompliantForm(e);if(!we.isFunction(s))throw new TypeError("visitor must be a function");function h(b){if(b===null)return"";if(we.isDate(b))return b.toISOString();if(we.isBoolean(b))return b.toString();if(!d&&we.isBlob(b))throw new St("Blob is not supported. Use a Buffer instead.");return we.isArrayBuffer(b)||we.isTypedArray(b)?d&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function m(b,k,O){let j=b;if(b&&!O&&typeof b=="object"){if(we.endsWith(k,"{}"))k=r?k:k.slice(0,-2),b=JSON.stringify(b);else if(we.isArray(b)&&OF(b)||(we.isFileList(b)||we.endsWith(k,"[]"))&&(j=we.toArray(b)))return k=G9(k),j.forEach(function(A,_){!(we.isUndefined(A)||A===null)&&e.append(l===!0?yO([k],_,i):l===null?k:k+"[]",h(A))}),!1}return r2(b)?!0:(e.append(yO(O,k,i),h(b)),!1)}const p=[],x=Object.assign(jF,{defaultVisitor:m,convertValue:h,isVisitable:r2});function v(b,k){if(!we.isUndefined(b)){if(p.indexOf(b)!==-1)throw Error("Circular reference detected in "+k.join("."));p.push(b),we.forEach(b,function(j,T){(!(we.isUndefined(j)||j===null)&&s.call(e,j,we.isString(T)?T.trim():T,k,x))===!0&&v(j,k?k.concat(T):[T])}),p.pop()}}if(!we.isObject(t))throw new TypeError("data must be an object");return v(t),e}function bO(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function ew(t,e){this._pairs=[],t&&dx(t,this,e)}const X9=ew.prototype;X9.append=function(e,n){this._pairs.push([e,n])};X9.toString=function(e){const n=e?function(r){return e.call(this,r,bO)}:bO;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function NF(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Y9(t,e,n){if(!e)return t;const r=n&&n.encode||NF;we.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=we.isURLSearchParams(e)?e.toString():new ew(e,n).toString(r),i){const l=t.indexOf("#");l!==-1&&(t=t.slice(0,l)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class wO{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){we.forEach(this.handlers,function(r){r!==null&&e(r)})}}const K9={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},CF=typeof URLSearchParams<"u"?URLSearchParams:ew,TF=typeof FormData<"u"?FormData:null,AF=typeof Blob<"u"?Blob:null,MF={isBrowser:!0,classes:{URLSearchParams:CF,FormData:TF,Blob:AF},protocols:["http","https","file","blob","url","data"]},tw=typeof window<"u"&&typeof document<"u",s2=typeof navigator=="object"&&navigator||void 0,EF=tw&&(!s2||["ReactNative","NativeScript","NS"].indexOf(s2.product)<0),_F=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",DF=tw&&window.location.href||"http://localhost",RF=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:tw,hasStandardBrowserEnv:EF,hasStandardBrowserWebWorkerEnv:_F,navigator:s2,origin:DF},Symbol.toStringTag,{value:"Module"})),ts={...RF,...MF};function zF(t,e){return dx(t,new ts.classes.URLSearchParams,{visitor:function(n,r,s,i){return ts.isNode&&we.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function PF(t){return we.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function BF(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r=n.length;return l=!l&&we.isArray(s)?s.length:l,d?(we.hasOwnProp(s,l)?s[l]=[s[l],r]:s[l]=r,!c):((!s[l]||!we.isObject(s[l]))&&(s[l]=[]),e(n,r,s[l],i)&&we.isArray(s[l])&&(s[l]=BF(s[l])),!c)}if(we.isFormData(t)&&we.isFunction(t.entries)){const n={};return we.forEachEntry(t,(r,s)=>{e(PF(r),s,n,0)}),n}return null}function LF(t,e,n){if(we.isString(t))try{return(e||JSON.parse)(t),we.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const e0={transitional:K9,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=we.isObject(e);if(i&&we.isHTMLForm(e)&&(e=new FormData(e)),we.isFormData(e))return s?JSON.stringify(Z9(e)):e;if(we.isArrayBuffer(e)||we.isBuffer(e)||we.isStream(e)||we.isFile(e)||we.isBlob(e)||we.isReadableStream(e))return e;if(we.isArrayBufferView(e))return e.buffer;if(we.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return zF(e,this.formSerializer).toString();if((c=we.isFileList(e))||r.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return dx(c?{"files[]":e}:e,d&&new d,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),LF(e)):e}],transformResponse:[function(e){const n=this.transitional||e0.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(we.isResponse(e)||we.isReadableStream(e))return e;if(e&&we.isString(e)&&(r&&!this.responseType||s)){const l=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(l)throw c.name==="SyntaxError"?St.from(c,St.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:ts.classes.FormData,Blob:ts.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};we.forEach(["delete","get","head","post","put","patch"],t=>{e0.headers[t]={}});const IF=we.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"]),qF=t=>{const e={};let n,r,s;return t&&t.split(` `).forEach(function(l){s=l.indexOf(":"),n=l.substring(0,s).trim().toLowerCase(),r=l.substring(s+1).trim(),!(!n||e[n]&&IF[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},SO=Symbol("internals");function Ah(t){return t&&String(t).trim().toLowerCase()}function Hp(t){return t===!1||t==null?t:we.isArray(t)?t.map(Hp):String(t)}function FF(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 QF=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function vy(t,e,n,r,s){if(we.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!we.isString(e)){if(we.isString(r))return e.indexOf(r)!==-1;if(we.isRegExp(r))return r.test(e)}}function $F(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function HF(t,e){const n=we.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,l){return this[r].call(this,e,s,i,l)},configurable:!0})})}let zs=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(c,d,h){const m=Ah(d);if(!m)throw new Error("header name must be a non-empty string");const p=we.findKey(s,m);(!p||s[p]===void 0||h===!0||h===void 0&&s[p]!==!1)&&(s[p||d]=Hp(c))}const l=(c,d)=>we.forEach(c,(h,m)=>i(h,m,d));if(we.isPlainObject(e)||e instanceof this.constructor)l(e,n);else if(we.isString(e)&&(e=e.trim())&&!QF(e))l(qF(e),n);else if(we.isObject(e)&&we.isIterable(e)){let c={},d,h;for(const m of e){if(!we.isArray(m))throw TypeError("Object iterator must return a key-value pair");c[h=m[0]]=(d=c[h])?we.isArray(d)?[...d,m[1]]:[d,m[1]]:m[1]}l(c,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=Ah(e),e){const r=we.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return FF(s);if(we.isFunction(n))return n.call(this,s,r);if(we.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Ah(e),e){const r=we.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||vy(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(l){if(l=Ah(l),l){const c=we.findKey(r,l);c&&(!n||vy(r,r[c],c,n))&&(delete r[c],s=!0)}}return we.isArray(e)?e.forEach(i):i(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!e||vy(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const n=this,r={};return we.forEach(this,(s,i)=>{const l=we.findKey(r,i);if(l){n[l]=Hp(s),delete n[i];return}const c=e?$F(i):String(i).trim();c!==i&&delete n[i],n[c]=Hp(s),r[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return we.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&we.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(s=>r.set(s)),r}static accessor(e){const r=(this[SO]=this[SO]={accessors:{}}).accessors,s=this.prototype;function i(l){const c=Ah(l);r[c]||(HF(s,l),r[c]=!0)}return we.isArray(e)?e.forEach(i):i(e),this}};zs.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);we.reduceDescriptors(zs.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});we.freezeMethods(zs);function yy(t,e){const n=this||e0,r=e||n,s=zs.from(r.headers);let i=r.data;return we.forEach(t,function(c){i=c.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function J9(t){return!!(t&&t.__CANCEL__)}function kd(t,e,n){St.call(this,t??"canceled",St.ERR_CANCELED,e,n),this.name="CanceledError"}we.inherits(kd,St,{__CANCEL__:!0});function eC(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new St("Request failed with status code "+n.status,[St.ERR_BAD_REQUEST,St.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function UF(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function VF(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,l;return e=e!==void 0?e:1e3,function(d){const h=Date.now(),m=r[i];l||(l=h),n[s]=d,r[s]=h;let p=i,x=0;for(;p!==s;)x+=n[p++],p=p%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),h-l{n=m,s=null,i&&(clearTimeout(i),i=null),t(...h)};return[(...h)=>{const m=Date.now(),p=m-n;p>=r?l(h,m):(s=h,i||(i=setTimeout(()=>{i=null,l(s)},r-p)))},()=>s&&l(s)]}const gg=(t,e,n=3)=>{let r=0;const s=VF(50,250);return WF(i=>{const l=i.loaded,c=i.lengthComputable?i.total:void 0,d=l-r,h=s(d),m=l<=c;r=l;const p={loaded:l,total:c,progress:c?l/c:void 0,bytes:d,rate:h||void 0,estimated:h&&c&&m?(c-l)/h:void 0,event:i,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(p)},n)},kO=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},OO=t=>(...e)=>we.asap(()=>t(...e)),GF=ts.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,ts.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(ts.origin),ts.navigator&&/(msie|trident)/i.test(ts.navigator.userAgent)):()=>!0,XF=ts.hasStandardBrowserEnv?{write(t,e,n,r,s,i,l){if(typeof document>"u")return;const c=[`${t}=${encodeURIComponent(e)}`];we.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),we.isString(r)&&c.push(`path=${r}`),we.isString(s)&&c.push(`domain=${s}`),i===!0&&c.push("secure"),we.isString(l)&&c.push(`SameSite=${l}`),document.cookie=c.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function YF(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function KF(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function tC(t,e,n){let r=!YF(e);return t&&(r||n==!1)?KF(t,e):e}const jO=t=>t instanceof zs?{...t}:t;function vc(t,e){e=e||{};const n={};function r(h,m,p,x){return we.isPlainObject(h)&&we.isPlainObject(m)?we.merge.call({caseless:x},h,m):we.isPlainObject(m)?we.merge({},m):we.isArray(m)?m.slice():m}function s(h,m,p,x){if(we.isUndefined(m)){if(!we.isUndefined(h))return r(void 0,h,p,x)}else return r(h,m,p,x)}function i(h,m){if(!we.isUndefined(m))return r(void 0,m)}function l(h,m){if(we.isUndefined(m)){if(!we.isUndefined(h))return r(void 0,h)}else return r(void 0,m)}function c(h,m,p){if(p in e)return r(h,m);if(p in t)return r(void 0,h)}const d={url:i,method:i,data:i,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:c,headers:(h,m,p)=>s(jO(h),jO(m),p,!0)};return we.forEach(Object.keys({...t,...e}),function(m){const p=d[m]||s,x=p(t[m],e[m],m);we.isUndefined(x)&&p!==c||(n[m]=x)}),n}const nC=t=>{const e=vc({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:l,auth:c}=e;if(e.headers=l=zs.from(l),e.url=Y9(tC(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&l.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),we.isFormData(n)){if(ts.hasStandardBrowserEnv||ts.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if(we.isFunction(n.getHeaders)){const d=n.getHeaders(),h=["content-type","content-length"];Object.entries(d).forEach(([m,p])=>{h.includes(m.toLowerCase())&&l.set(m,p)})}}if(ts.hasStandardBrowserEnv&&(r&&we.isFunction(r)&&(r=r(e)),r||r!==!1&&GF(e.url))){const d=s&&i&&XF.read(i);d&&l.set(s,d)}return e},ZF=typeof XMLHttpRequest<"u",JF=ZF&&function(t){return new Promise(function(n,r){const s=nC(t);let i=s.data;const l=zs.from(s.headers).normalize();let{responseType:c,onUploadProgress:d,onDownloadProgress:h}=s,m,p,x,v,b;function k(){v&&v(),b&&b(),s.cancelToken&&s.cancelToken.unsubscribe(m),s.signal&&s.signal.removeEventListener("abort",m)}let O=new XMLHttpRequest;O.open(s.method.toUpperCase(),s.url,!0),O.timeout=s.timeout;function j(){if(!O)return;const A=zs.from("getAllResponseHeaders"in O&&O.getAllResponseHeaders()),D={data:!c||c==="text"||c==="json"?O.responseText:O.response,status:O.status,statusText:O.statusText,headers:A,config:t,request:O};eC(function(R){n(R),k()},function(R){r(R),k()},D),O=null}"onloadend"in O?O.onloadend=j:O.onreadystatechange=function(){!O||O.readyState!==4||O.status===0&&!(O.responseURL&&O.responseURL.indexOf("file:")===0)||setTimeout(j)},O.onabort=function(){O&&(r(new St("Request aborted",St.ECONNABORTED,t,O)),O=null)},O.onerror=function(_){const D=_&&_.message?_.message:"Network Error",E=new St(D,St.ERR_NETWORK,t,O);E.event=_||null,r(E),O=null},O.ontimeout=function(){let _=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const D=s.transitional||K9;s.timeoutErrorMessage&&(_=s.timeoutErrorMessage),r(new St(_,D.clarifyTimeoutError?St.ETIMEDOUT:St.ECONNABORTED,t,O)),O=null},i===void 0&&l.setContentType(null),"setRequestHeader"in O&&we.forEach(l.toJSON(),function(_,D){O.setRequestHeader(D,_)}),we.isUndefined(s.withCredentials)||(O.withCredentials=!!s.withCredentials),c&&c!=="json"&&(O.responseType=s.responseType),h&&([x,b]=gg(h,!0),O.addEventListener("progress",x)),d&&O.upload&&([p,v]=gg(d),O.upload.addEventListener("progress",p),O.upload.addEventListener("loadend",v)),(s.cancelToken||s.signal)&&(m=A=>{O&&(r(!A||A.type?new kd(null,t,O):A),O.abort(),O=null)},s.cancelToken&&s.cancelToken.subscribe(m),s.signal&&(s.signal.aborted?m():s.signal.addEventListener("abort",m)));const T=UF(s.url);if(T&&ts.protocols.indexOf(T)===-1){r(new St("Unsupported protocol "+T+":",St.ERR_BAD_REQUEST,t));return}O.send(i||null)})},eQ=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(h){if(!s){s=!0,c();const m=h instanceof Error?h:this.reason;r.abort(m instanceof St?m:new kd(m instanceof Error?m.message:m))}};let l=e&&setTimeout(()=>{l=null,i(new St(`timeout ${e} of ms exceeded`,St.ETIMEDOUT))},e);const c=()=>{t&&(l&&clearTimeout(l),l=null,t.forEach(h=>{h.unsubscribe?h.unsubscribe(i):h.removeEventListener("abort",i)}),t=null)};t.forEach(h=>h.addEventListener("abort",i));const{signal:d}=r;return d.unsubscribe=()=>we.asap(c),d}},tQ=function*(t,e){let n=t.byteLength;if(n{const s=nQ(t,e);let i=0,l,c=d=>{l||(l=!0,r&&r(d))};return new ReadableStream({async pull(d){try{const{done:h,value:m}=await s.next();if(h){c(),d.close();return}let p=m.byteLength;if(n){let x=i+=p;n(x)}d.enqueue(new Uint8Array(m))}catch(h){throw c(h),h}},cancel(d){return c(d),s.return()}},{highWaterMark:2})},CO=64*1024,{isFunction:Xm}=we,sQ=(({Request:t,Response:e})=>({Request:t,Response:e}))(we.global),{ReadableStream:TO,TextEncoder:AO}=we.global,MO=(t,...e)=>{try{return!!t(...e)}catch{return!1}},iQ=t=>{t=we.merge.call({skipUndefined:!0},sQ,t);const{fetch:e,Request:n,Response:r}=t,s=e?Xm(e):typeof fetch=="function",i=Xm(n),l=Xm(r);if(!s)return!1;const c=s&&Xm(TO),d=s&&(typeof AO=="function"?(b=>k=>b.encode(k))(new AO):async b=>new Uint8Array(await new n(b).arrayBuffer())),h=i&&c&&MO(()=>{let b=!1;const k=new n(ts.origin,{body:new TO,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!k}),m=l&&c&&MO(()=>we.isReadableStream(new r("").body)),p={stream:m&&(b=>b.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!p[b]&&(p[b]=(k,O)=>{let j=k&&k[b];if(j)return j.call(k);throw new St(`Response type '${b}' is not supported`,St.ERR_NOT_SUPPORT,O)})});const x=async b=>{if(b==null)return 0;if(we.isBlob(b))return b.size;if(we.isSpecCompliantForm(b))return(await new n(ts.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(we.isArrayBufferView(b)||we.isArrayBuffer(b))return b.byteLength;if(we.isURLSearchParams(b)&&(b=b+""),we.isString(b))return(await d(b)).byteLength},v=async(b,k)=>{const O=we.toFiniteNumber(b.getContentLength());return O??x(k)};return async b=>{let{url:k,method:O,data:j,signal:T,cancelToken:A,timeout:_,onDownloadProgress:D,onUploadProgress:E,responseType:R,headers:Q,withCredentials:F="same-origin",fetchOptions:L}=nC(b),U=e||fetch;R=R?(R+"").toLowerCase():"text";let V=eQ([T,A&&A.toAbortSignal()],_),de=null;const W=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let J;try{if(E&&h&&O!=="get"&&O!=="head"&&(J=await v(Q,j))!==0){let xe=new n(k,{method:"POST",body:j,duplex:"half"}),Y;if(we.isFormData(j)&&(Y=xe.headers.get("content-type"))&&Q.setContentType(Y),xe.body){const[P,K]=kO(J,gg(OO(E)));j=NO(xe.body,CO,P,K)}}we.isString(F)||(F=F?"include":"omit");const $=i&&"credentials"in n.prototype,ae={...L,signal:V,method:O.toUpperCase(),headers:Q.normalize().toJSON(),body:j,duplex:"half",credentials:$?F:void 0};de=i&&new n(k,ae);let ne=await(i?U(de,L):U(k,ae));const ce=m&&(R==="stream"||R==="response");if(m&&(D||ce&&W)){const xe={};["status","statusText","headers"].forEach(H=>{xe[H]=ne[H]});const Y=we.toFiniteNumber(ne.headers.get("content-length")),[P,K]=D&&kO(Y,gg(OO(D),!0))||[];ne=new r(NO(ne.body,CO,P,()=>{K&&K(),W&&W()}),xe)}R=R||"text";let z=await p[we.findKey(p,R)||"text"](ne,b);return!ce&&W&&W(),await new Promise((xe,Y)=>{eC(xe,Y,{data:z,headers:zs.from(ne.headers),status:ne.status,statusText:ne.statusText,config:b,request:de})})}catch($){throw W&&W(),$&&$.name==="TypeError"&&/Load failed|fetch/i.test($.message)?Object.assign(new St("Network Error",St.ERR_NETWORK,b,de),{cause:$.cause||$}):St.from($,$&&$.code,b,de)}}},aQ=new Map,rC=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,i=[r,s,n];let l=i.length,c=l,d,h,m=aQ;for(;c--;)d=i[c],h=m.get(d),h===void 0&&m.set(d,h=c?new Map:iQ(e)),m=h;return h};rC();const nw={http:kF,xhr:JF,fetch:{get:rC}};we.forEach(nw,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const EO=t=>`- ${t}`,lQ=t=>we.isFunction(t)||t===null||t===!1;function oQ(t,e){t=we.isArray(t)?t:[t];const{length:n}=t;let r,s;const i={};for(let l=0;l`adapter ${d} `+(h===!1?"is not supported by the environment":"is not available in the build"));let c=n?l.length>1?`since : +`)}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(s=>r.set(s)),r}static accessor(e){const r=(this[SO]=this[SO]={accessors:{}}).accessors,s=this.prototype;function i(l){const c=Ah(l);r[c]||(HF(s,l),r[c]=!0)}return we.isArray(e)?e.forEach(i):i(e),this}};zs.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);we.reduceDescriptors(zs.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});we.freezeMethods(zs);function yy(t,e){const n=this||e0,r=e||n,s=zs.from(r.headers);let i=r.data;return we.forEach(t,function(c){i=c.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function J9(t){return!!(t&&t.__CANCEL__)}function kd(t,e,n){St.call(this,t??"canceled",St.ERR_CANCELED,e,n),this.name="CanceledError"}we.inherits(kd,St,{__CANCEL__:!0});function eC(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new St("Request failed with status code "+n.status,[St.ERR_BAD_REQUEST,St.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function UF(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function VF(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,l;return e=e!==void 0?e:1e3,function(d){const h=Date.now(),m=r[i];l||(l=h),n[s]=d,r[s]=h;let p=i,x=0;for(;p!==s;)x+=n[p++],p=p%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),h-l{n=m,s=null,i&&(clearTimeout(i),i=null),t(...h)};return[(...h)=>{const m=Date.now(),p=m-n;p>=r?l(h,m):(s=h,i||(i=setTimeout(()=>{i=null,l(s)},r-p)))},()=>s&&l(s)]}const gg=(t,e,n=3)=>{let r=0;const s=VF(50,250);return WF(i=>{const l=i.loaded,c=i.lengthComputable?i.total:void 0,d=l-r,h=s(d),m=l<=c;r=l;const p={loaded:l,total:c,progress:c?l/c:void 0,bytes:d,rate:h||void 0,estimated:h&&c&&m?(c-l)/h:void 0,event:i,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(p)},n)},kO=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},OO=t=>(...e)=>we.asap(()=>t(...e)),GF=ts.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,ts.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(ts.origin),ts.navigator&&/(msie|trident)/i.test(ts.navigator.userAgent)):()=>!0,XF=ts.hasStandardBrowserEnv?{write(t,e,n,r,s,i,l){if(typeof document>"u")return;const c=[`${t}=${encodeURIComponent(e)}`];we.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),we.isString(r)&&c.push(`path=${r}`),we.isString(s)&&c.push(`domain=${s}`),i===!0&&c.push("secure"),we.isString(l)&&c.push(`SameSite=${l}`),document.cookie=c.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function YF(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function KF(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function tC(t,e,n){let r=!YF(e);return t&&(r||n==!1)?KF(t,e):e}const jO=t=>t instanceof zs?{...t}:t;function vc(t,e){e=e||{};const n={};function r(h,m,p,x){return we.isPlainObject(h)&&we.isPlainObject(m)?we.merge.call({caseless:x},h,m):we.isPlainObject(m)?we.merge({},m):we.isArray(m)?m.slice():m}function s(h,m,p,x){if(we.isUndefined(m)){if(!we.isUndefined(h))return r(void 0,h,p,x)}else return r(h,m,p,x)}function i(h,m){if(!we.isUndefined(m))return r(void 0,m)}function l(h,m){if(we.isUndefined(m)){if(!we.isUndefined(h))return r(void 0,h)}else return r(void 0,m)}function c(h,m,p){if(p in e)return r(h,m);if(p in t)return r(void 0,h)}const d={url:i,method:i,data:i,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:c,headers:(h,m,p)=>s(jO(h),jO(m),p,!0)};return we.forEach(Object.keys({...t,...e}),function(m){const p=d[m]||s,x=p(t[m],e[m],m);we.isUndefined(x)&&p!==c||(n[m]=x)}),n}const nC=t=>{const e=vc({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:l,auth:c}=e;if(e.headers=l=zs.from(l),e.url=Y9(tC(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&l.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),we.isFormData(n)){if(ts.hasStandardBrowserEnv||ts.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if(we.isFunction(n.getHeaders)){const d=n.getHeaders(),h=["content-type","content-length"];Object.entries(d).forEach(([m,p])=>{h.includes(m.toLowerCase())&&l.set(m,p)})}}if(ts.hasStandardBrowserEnv&&(r&&we.isFunction(r)&&(r=r(e)),r||r!==!1&&GF(e.url))){const d=s&&i&&XF.read(i);d&&l.set(s,d)}return e},ZF=typeof XMLHttpRequest<"u",JF=ZF&&function(t){return new Promise(function(n,r){const s=nC(t);let i=s.data;const l=zs.from(s.headers).normalize();let{responseType:c,onUploadProgress:d,onDownloadProgress:h}=s,m,p,x,v,b;function k(){v&&v(),b&&b(),s.cancelToken&&s.cancelToken.unsubscribe(m),s.signal&&s.signal.removeEventListener("abort",m)}let O=new XMLHttpRequest;O.open(s.method.toUpperCase(),s.url,!0),O.timeout=s.timeout;function j(){if(!O)return;const A=zs.from("getAllResponseHeaders"in O&&O.getAllResponseHeaders()),D={data:!c||c==="text"||c==="json"?O.responseText:O.response,status:O.status,statusText:O.statusText,headers:A,config:t,request:O};eC(function(z){n(z),k()},function(z){r(z),k()},D),O=null}"onloadend"in O?O.onloadend=j:O.onreadystatechange=function(){!O||O.readyState!==4||O.status===0&&!(O.responseURL&&O.responseURL.indexOf("file:")===0)||setTimeout(j)},O.onabort=function(){O&&(r(new St("Request aborted",St.ECONNABORTED,t,O)),O=null)},O.onerror=function(_){const D=_&&_.message?_.message:"Network Error",E=new St(D,St.ERR_NETWORK,t,O);E.event=_||null,r(E),O=null},O.ontimeout=function(){let _=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const D=s.transitional||K9;s.timeoutErrorMessage&&(_=s.timeoutErrorMessage),r(new St(_,D.clarifyTimeoutError?St.ETIMEDOUT:St.ECONNABORTED,t,O)),O=null},i===void 0&&l.setContentType(null),"setRequestHeader"in O&&we.forEach(l.toJSON(),function(_,D){O.setRequestHeader(D,_)}),we.isUndefined(s.withCredentials)||(O.withCredentials=!!s.withCredentials),c&&c!=="json"&&(O.responseType=s.responseType),h&&([x,b]=gg(h,!0),O.addEventListener("progress",x)),d&&O.upload&&([p,v]=gg(d),O.upload.addEventListener("progress",p),O.upload.addEventListener("loadend",v)),(s.cancelToken||s.signal)&&(m=A=>{O&&(r(!A||A.type?new kd(null,t,O):A),O.abort(),O=null)},s.cancelToken&&s.cancelToken.subscribe(m),s.signal&&(s.signal.aborted?m():s.signal.addEventListener("abort",m)));const T=UF(s.url);if(T&&ts.protocols.indexOf(T)===-1){r(new St("Unsupported protocol "+T+":",St.ERR_BAD_REQUEST,t));return}O.send(i||null)})},eQ=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(h){if(!s){s=!0,c();const m=h instanceof Error?h:this.reason;r.abort(m instanceof St?m:new kd(m instanceof Error?m.message:m))}};let l=e&&setTimeout(()=>{l=null,i(new St(`timeout ${e} of ms exceeded`,St.ETIMEDOUT))},e);const c=()=>{t&&(l&&clearTimeout(l),l=null,t.forEach(h=>{h.unsubscribe?h.unsubscribe(i):h.removeEventListener("abort",i)}),t=null)};t.forEach(h=>h.addEventListener("abort",i));const{signal:d}=r;return d.unsubscribe=()=>we.asap(c),d}},tQ=function*(t,e){let n=t.byteLength;if(n{const s=nQ(t,e);let i=0,l,c=d=>{l||(l=!0,r&&r(d))};return new ReadableStream({async pull(d){try{const{done:h,value:m}=await s.next();if(h){c(),d.close();return}let p=m.byteLength;if(n){let x=i+=p;n(x)}d.enqueue(new Uint8Array(m))}catch(h){throw c(h),h}},cancel(d){return c(d),s.return()}},{highWaterMark:2})},CO=64*1024,{isFunction:Xm}=we,sQ=(({Request:t,Response:e})=>({Request:t,Response:e}))(we.global),{ReadableStream:TO,TextEncoder:AO}=we.global,MO=(t,...e)=>{try{return!!t(...e)}catch{return!1}},iQ=t=>{t=we.merge.call({skipUndefined:!0},sQ,t);const{fetch:e,Request:n,Response:r}=t,s=e?Xm(e):typeof fetch=="function",i=Xm(n),l=Xm(r);if(!s)return!1;const c=s&&Xm(TO),d=s&&(typeof AO=="function"?(b=>k=>b.encode(k))(new AO):async b=>new Uint8Array(await new n(b).arrayBuffer())),h=i&&c&&MO(()=>{let b=!1;const k=new n(ts.origin,{body:new TO,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!k}),m=l&&c&&MO(()=>we.isReadableStream(new r("").body)),p={stream:m&&(b=>b.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!p[b]&&(p[b]=(k,O)=>{let j=k&&k[b];if(j)return j.call(k);throw new St(`Response type '${b}' is not supported`,St.ERR_NOT_SUPPORT,O)})});const x=async b=>{if(b==null)return 0;if(we.isBlob(b))return b.size;if(we.isSpecCompliantForm(b))return(await new n(ts.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(we.isArrayBufferView(b)||we.isArrayBuffer(b))return b.byteLength;if(we.isURLSearchParams(b)&&(b=b+""),we.isString(b))return(await d(b)).byteLength},v=async(b,k)=>{const O=we.toFiniteNumber(b.getContentLength());return O??x(k)};return async b=>{let{url:k,method:O,data:j,signal:T,cancelToken:A,timeout:_,onDownloadProgress:D,onUploadProgress:E,responseType:z,headers:Q,withCredentials:F="same-origin",fetchOptions:L}=nC(b),U=e||fetch;z=z?(z+"").toLowerCase():"text";let V=eQ([T,A&&A.toAbortSignal()],_),ce=null;const W=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let J;try{if(E&&h&&O!=="get"&&O!=="head"&&(J=await v(Q,j))!==0){let me=new n(k,{method:"POST",body:j,duplex:"half"}),Y;if(we.isFormData(j)&&(Y=me.headers.get("content-type"))&&Q.setContentType(Y),me.body){const[P,K]=kO(J,gg(OO(E)));j=NO(me.body,CO,P,K)}}we.isString(F)||(F=F?"include":"omit");const $=i&&"credentials"in n.prototype,ae={...L,signal:V,method:O.toUpperCase(),headers:Q.normalize().toJSON(),body:j,duplex:"half",credentials:$?F:void 0};ce=i&&new n(k,ae);let ne=await(i?U(ce,L):U(k,ae));const ue=m&&(z==="stream"||z==="response");if(m&&(D||ue&&W)){const me={};["status","statusText","headers"].forEach(H=>{me[H]=ne[H]});const Y=we.toFiniteNumber(ne.headers.get("content-length")),[P,K]=D&&kO(Y,gg(OO(D),!0))||[];ne=new r(NO(ne.body,CO,P,()=>{K&&K(),W&&W()}),me)}z=z||"text";let R=await p[we.findKey(p,z)||"text"](ne,b);return!ue&&W&&W(),await new Promise((me,Y)=>{eC(me,Y,{data:R,headers:zs.from(ne.headers),status:ne.status,statusText:ne.statusText,config:b,request:ce})})}catch($){throw W&&W(),$&&$.name==="TypeError"&&/Load failed|fetch/i.test($.message)?Object.assign(new St("Network Error",St.ERR_NETWORK,b,ce),{cause:$.cause||$}):St.from($,$&&$.code,b,ce)}}},aQ=new Map,rC=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,i=[r,s,n];let l=i.length,c=l,d,h,m=aQ;for(;c--;)d=i[c],h=m.get(d),h===void 0&&m.set(d,h=c?new Map:iQ(e)),m=h;return h};rC();const nw={http:kF,xhr:JF,fetch:{get:rC}};we.forEach(nw,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const EO=t=>`- ${t}`,lQ=t=>we.isFunction(t)||t===null||t===!1;function oQ(t,e){t=we.isArray(t)?t:[t];const{length:n}=t;let r,s;const i={};for(let l=0;l`adapter ${d} `+(h===!1?"is not supported by the environment":"is not available in the build"));let c=n?l.length>1?`since : `+l.map(EO).join(` `):" "+EO(l[0]):"as no adapter specified";throw new St("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const sC={getAdapter:oQ,adapters:nw};function by(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new kd(null,t)}function _O(t){return by(t),t.headers=zs.from(t.headers),t.data=yy.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),sC.getAdapter(t.adapter||e0.adapter,t)(t).then(function(r){return by(t),r.data=yy.call(t,t.transformResponse,r),r.headers=zs.from(r.headers),r},function(r){return J9(r)||(by(t),r&&r.response&&(r.response.data=yy.call(t,t.transformResponse,r.response),r.response.headers=zs.from(r.response.headers))),Promise.reject(r)})}const iC="1.13.2",hx={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{hx[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const DO={};hx.transitional=function(e,n,r){function s(i,l){return"[Axios v"+iC+"] Transitional option '"+i+"'"+l+(r?". "+r:"")}return(i,l,c)=>{if(e===!1)throw new St(s(l," has been removed"+(n?" in "+n:"")),St.ERR_DEPRECATED);return n&&!DO[l]&&(DO[l]=!0,console.warn(s(l," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,l,c):!0}};hx.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function cQ(t,e,n){if(typeof t!="object")throw new St("options must be an object",St.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const i=r[s],l=e[i];if(l){const c=t[i],d=c===void 0||l(c,i,t);if(d!==!0)throw new St("option "+i+" must be "+d,St.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new St("Unknown option "+i,St.ERR_BAD_OPTION)}}const Up={assertOptions:cQ,validators:hx},ea=Up.validators;let mc=class{constructor(e){this.defaults=e||{},this.interceptors={request:new wO,response:new wO}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=vc(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Up.assertOptions(r,{silentJSONParsing:ea.transitional(ea.boolean),forcedJSONParsing:ea.transitional(ea.boolean),clarifyTimeoutError:ea.transitional(ea.boolean)},!1),s!=null&&(we.isFunction(s)?n.paramsSerializer={serialize:s}:Up.assertOptions(s,{encode:ea.function,serialize:ea.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Up.assertOptions(n,{baseUrl:ea.spelling("baseURL"),withXsrfToken:ea.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=i&&we.merge(i.common,i[n.method]);i&&we.forEach(["delete","get","head","post","put","patch","common"],b=>{delete i[b]}),n.headers=zs.concat(l,i);const c=[];let d=!0;this.interceptors.request.forEach(function(k){typeof k.runWhen=="function"&&k.runWhen(n)===!1||(d=d&&k.synchronous,c.unshift(k.fulfilled,k.rejected))});const h=[];this.interceptors.response.forEach(function(k){h.push(k.fulfilled,k.rejected)});let m,p=0,x;if(!d){const b=[_O.bind(this),void 0];for(b.unshift(...c),b.push(...h),x=b.length,m=Promise.resolve(n);p{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const l=new Promise(c=>{r.subscribe(c),i=c}).then(s);return l.cancel=function(){r.unsubscribe(i)},l},e(function(i,l,c){r.reason||(r.reason=new kd(i,l,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 aC(function(s){e=s}),cancel:e}}};function dQ(t){return function(n){return t.apply(null,n)}}function hQ(t){return we.isObject(t)&&t.isAxiosError===!0}const i2={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(i2).forEach(([t,e])=>{i2[e]=t});function lC(t){const e=new mc(t),n=L9(mc.prototype.request,e);return we.extend(n,mc.prototype,e,{allOwnKeys:!0}),we.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return lC(vc(t,s))},n}const Zn=lC(e0);Zn.Axios=mc;Zn.CanceledError=kd;Zn.CancelToken=uQ;Zn.isCancel=J9;Zn.VERSION=iC;Zn.toFormData=dx;Zn.AxiosError=St;Zn.Cancel=Zn.CanceledError;Zn.all=function(e){return Promise.all(e)};Zn.spread=dQ;Zn.isAxiosError=hQ;Zn.mergeConfig=vc;Zn.AxiosHeaders=zs;Zn.formToJSON=t=>Z9(we.isHTMLForm(t)?new FormData(t):t);Zn.getAdapter=sC.getAdapter;Zn.HttpStatusCode=i2;Zn.default=Zn;const{Axios:Nxe,AxiosError:Cxe,CanceledError:Txe,isCancel:Axe,CancelToken:Mxe,VERSION:Exe,all:_xe,Cancel:Dxe,isAxiosError:Rxe,spread:zxe,toFormData:Pxe,AxiosHeaders:Bxe,HttpStatusCode:Lxe,formToJSON:Ixe,getAdapter:qxe,mergeConfig:Fxe}=Zn,fQ=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),oC=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),xg="-",RO=[],pQ="arbitrary..",gQ=t=>{const e=vQ(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return xQ(l);const c=l.split(xg),d=c[0]===""&&c.length>1?1:0;return cC(c,d,e)},getConflictingClassGroupIds:(l,c)=>{if(c){const d=r[l],h=n[l];return d?h?fQ(h,d):d:h||RO}return n[l]||RO}}},cC=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const h=cC(t,e+1,i);if(h)return h}const l=n.validators;if(l===null)return;const c=e===0?t.join(xg):t.slice(e).join(xg),d=l.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?pQ+r:void 0})(),vQ=t=>{const{theme:e,classGroups:n}=t;return yQ(n,e)},yQ=(t,e)=>{const n=oC();for(const r in t){const s=t[r];rw(s,n,r,e)}return n},rw=(t,e,n,r)=>{const s=t.length;for(let i=0;i{if(typeof t=="string"){wQ(t,e,n);return}if(typeof t=="function"){SQ(t,e,n,r);return}kQ(t,e,n,r)},wQ=(t,e,n)=>{const r=t===""?e:uC(e,t);r.classGroupId=n},SQ=(t,e,n,r)=>{if(OQ(t)){rw(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(mQ(n,t))},kQ=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let l=0;l{let n=t;const r=e.split(xg),s=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,jQ=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,l)=>{n[i]=l,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let l=n[i];if(l!==void 0)return l;if((l=r[i])!==void 0)return s(i,l),l},set(i,l){i in n?n[i]=l:s(i,l)}}},a2="!",zO=":",NQ=[],PO=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),CQ=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let l=0,c=0,d=0,h;const m=s.length;for(let k=0;kd?h-d:void 0;return PO(i,v,x,b)};if(e){const s=e+zO,i=r;r=l=>l.startsWith(s)?i(l.slice(s.length)):PO(NQ,!1,l,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},TQ=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i0&&(s.sort(),r.push(...s),s=[]),r.push(l)):s.push(l)}return s.length>0&&(s.sort(),r.push(...s)),r}},AQ=t=>({cache:jQ(t.cacheSize),parseClassName:CQ(t),sortModifiers:TQ(t),...gQ(t)}),MQ=/\s+/,EQ=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,l=[],c=t.trim().split(MQ);let d="";for(let h=c.length-1;h>=0;h-=1){const m=c[h],{isExternal:p,modifiers:x,hasImportantModifier:v,baseClassName:b,maybePostfixModifierPosition:k}=n(m);if(p){d=m+(d.length>0?" "+d:d);continue}let O=!!k,j=r(O?b.substring(0,k):b);if(!j){if(!O){d=m+(d.length>0?" "+d:d);continue}if(j=r(b),!j){d=m+(d.length>0?" "+d:d);continue}O=!1}const T=x.length===0?"":x.length===1?x[0]:i(x).join(":"),A=v?T+a2:T,_=A+j;if(l.indexOf(_)>-1)continue;l.push(_);const D=s(j,O);for(let E=0;E0?" "+d:d)}return d},_Q=(...t)=>{let e=0,n,r,s="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,s,i;const l=d=>{const h=e.reduce((m,p)=>p(m),t());return n=AQ(h),r=n.cache.get,s=n.cache.set,i=c,c(d)},c=d=>{const h=r(d);if(h)return h;const m=EQ(d,n);return s(d,m),m};return i=l,(...d)=>i(_Q(...d))},RQ=[],wr=t=>{const e=n=>n[t]||RQ;return e.isThemeGetter=!0,e},hC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zQ=/^\d+\/\d+$/,PQ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,BQ=/\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$/,LQ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,IQ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qQ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ju=t=>zQ.test(t),Mt=t=>!!t&&!Number.isNaN(Number(t)),Gl=t=>!!t&&Number.isInteger(Number(t)),wy=t=>t.endsWith("%")&&Mt(t.slice(0,-1)),Xa=t=>PQ.test(t),FQ=()=>!0,QQ=t=>BQ.test(t)&&!LQ.test(t),mC=()=>!1,$Q=t=>IQ.test(t),HQ=t=>qQ.test(t),UQ=t=>!Xe(t)&&!Ye(t),VQ=t=>Od(t,xC,mC),Xe=t=>hC.test(t),Ko=t=>Od(t,vC,QQ),Sy=t=>Od(t,KQ,Mt),BO=t=>Od(t,pC,mC),WQ=t=>Od(t,gC,HQ),Ym=t=>Od(t,yC,$Q),Ye=t=>fC.test(t),Mh=t=>jd(t,vC),GQ=t=>jd(t,ZQ),LO=t=>jd(t,pC),XQ=t=>jd(t,xC),YQ=t=>jd(t,gC),Km=t=>jd(t,yC,!0),Od=(t,e,n)=>{const r=hC.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},jd=(t,e,n=!1)=>{const r=fC.exec(t);return r?r[1]?e(r[1]):n:!1},pC=t=>t==="position"||t==="percentage",gC=t=>t==="image"||t==="url",xC=t=>t==="length"||t==="size"||t==="bg-size",vC=t=>t==="length",KQ=t=>t==="number",ZQ=t=>t==="family-name",yC=t=>t==="shadow",JQ=()=>{const t=wr("color"),e=wr("font"),n=wr("text"),r=wr("font-weight"),s=wr("tracking"),i=wr("leading"),l=wr("breakpoint"),c=wr("container"),d=wr("spacing"),h=wr("radius"),m=wr("shadow"),p=wr("inset-shadow"),x=wr("text-shadow"),v=wr("drop-shadow"),b=wr("blur"),k=wr("perspective"),O=wr("aspect"),j=wr("ease"),T=wr("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[..._(),Ye,Xe],E=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],Q=()=>[Ye,Xe,d],F=()=>[ju,"full","auto",...Q()],L=()=>[Gl,"none","subgrid",Ye,Xe],U=()=>["auto",{span:["full",Gl,Ye,Xe]},Gl,Ye,Xe],V=()=>[Gl,"auto",Ye,Xe],de=()=>["auto","min","max","fr",Ye,Xe],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...Q()],ae=()=>[ju,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...Q()],ne=()=>[t,Ye,Xe],ce=()=>[..._(),LO,BO,{position:[Ye,Xe]}],z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],xe=()=>["auto","cover","contain",XQ,VQ,{size:[Ye,Xe]}],Y=()=>[wy,Mh,Ko],P=()=>["","none","full",h,Ye,Xe],K=()=>["",Mt,Mh,Ko],H=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ve=()=>[Mt,wy,LO,BO],Re=()=>["","none",b,Ye,Xe],ue=()=>["none",Mt,Ye,Xe],We=()=>["none",Mt,Ye,Xe],ct=()=>[Mt,Ye,Xe],Oe=()=>[ju,"full",...Q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xa],breakpoint:[Xa],color:[FQ],container:[Xa],"drop-shadow":[Xa],ease:["in","out","in-out"],font:[UQ],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xa],shadow:[Xa],spacing:["px",Mt],text:[Xa],"text-shadow":[Xa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ju,Xe,Ye,O]}],container:["container"],columns:[{columns:[Mt,Xe,Ye,c]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"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"],sr:["sr-only","not-sr-only"],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:D()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:F()}],"inset-x":[{"inset-x":F()}],"inset-y":[{"inset-y":F()}],start:[{start:F()}],end:[{end:F()}],top:[{top:F()}],right:[{right:F()}],bottom:[{bottom:F()}],left:[{left:F()}],visibility:["visible","invisible","collapse"],z:[{z:[Gl,"auto",Ye,Xe]}],basis:[{basis:[ju,"full","auto",c,...Q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Mt,ju,"auto","initial","none",Xe]}],grow:[{grow:["",Mt,Ye,Xe]}],shrink:[{shrink:["",Mt,Ye,Xe]}],order:[{order:[Gl,"first","last","none",Ye,Xe]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:U()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":de()}],"auto-rows":[{"auto-rows":de()}],gap:[{gap:Q()}],"gap-x":[{"gap-x":Q()}],"gap-y":[{"gap-y":Q()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...J(),"baseline"]}],"place-self":[{"place-self":["auto",...J()]}],p:[{p:Q()}],px:[{px:Q()}],py:[{py:Q()}],ps:[{ps:Q()}],pe:[{pe:Q()}],pt:[{pt:Q()}],pr:[{pr:Q()}],pb:[{pb:Q()}],pl:[{pl:Q()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":Q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":Q()}],"space-y-reverse":["space-y-reverse"],size:[{size:ae()}],w:[{w:[c,"screen",...ae()]}],"min-w":[{"min-w":[c,"screen","none",...ae()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...ae()]}],h:[{h:["screen","lh",...ae()]}],"min-h":[{"min-h":["screen","lh","none",...ae()]}],"max-h":[{"max-h":["screen","lh",...ae()]}],"font-size":[{text:["base",n,Mh,Ko]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Ye,Sy]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",wy,Xe]}],"font-family":[{font:[GQ,Xe,e]}],"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-fractions"],tracking:[{tracking:[s,Ye,Xe]}],"line-clamp":[{"line-clamp":[Mt,"none",Ye,Sy]}],leading:[{leading:[i,...Q()]}],"list-image":[{"list-image":["none",Ye,Xe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ye,Xe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:ne()}],"text-color":[{text:ne()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:[Mt,"from-font","auto",Ye,Ko]}],"text-decoration-color":[{decoration:ne()}],"underline-offset":[{"underline-offset":[Mt,"auto",Ye,Xe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Q()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ye,Xe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ye,Xe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ce()}],"bg-repeat":[{bg:z()}],"bg-size":[{bg:xe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Gl,Ye,Xe],radial:["",Ye,Xe],conic:[Gl,Ye,Xe]},YQ,WQ]}],"bg-color":[{bg:ne()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:ne()}],"gradient-via":[{via:ne()}],"gradient-to":[{to:ne()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...H(),"hidden","none"]}],"divide-style":[{divide:[...H(),"hidden","none"]}],"border-color":[{border:ne()}],"border-color-x":[{"border-x":ne()}],"border-color-y":[{"border-y":ne()}],"border-color-s":[{"border-s":ne()}],"border-color-e":[{"border-e":ne()}],"border-color-t":[{"border-t":ne()}],"border-color-r":[{"border-r":ne()}],"border-color-b":[{"border-b":ne()}],"border-color-l":[{"border-l":ne()}],"divide-color":[{divide:ne()}],"outline-style":[{outline:[...H(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Mt,Ye,Xe]}],"outline-w":[{outline:["",Mt,Mh,Ko]}],"outline-color":[{outline:ne()}],shadow:[{shadow:["","none",m,Km,Ym]}],"shadow-color":[{shadow:ne()}],"inset-shadow":[{"inset-shadow":["none",p,Km,Ym]}],"inset-shadow-color":[{"inset-shadow":ne()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:ne()}],"ring-offset-w":[{"ring-offset":[Mt,Ko]}],"ring-offset-color":[{"ring-offset":ne()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":ne()}],"text-shadow":[{"text-shadow":["none",x,Km,Ym]}],"text-shadow-color":[{"text-shadow":ne()}],opacity:[{opacity:[Mt,Ye,Xe]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Mt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ve()}],"mask-image-linear-to-pos":[{"mask-linear-to":ve()}],"mask-image-linear-from-color":[{"mask-linear-from":ne()}],"mask-image-linear-to-color":[{"mask-linear-to":ne()}],"mask-image-t-from-pos":[{"mask-t-from":ve()}],"mask-image-t-to-pos":[{"mask-t-to":ve()}],"mask-image-t-from-color":[{"mask-t-from":ne()}],"mask-image-t-to-color":[{"mask-t-to":ne()}],"mask-image-r-from-pos":[{"mask-r-from":ve()}],"mask-image-r-to-pos":[{"mask-r-to":ve()}],"mask-image-r-from-color":[{"mask-r-from":ne()}],"mask-image-r-to-color":[{"mask-r-to":ne()}],"mask-image-b-from-pos":[{"mask-b-from":ve()}],"mask-image-b-to-pos":[{"mask-b-to":ve()}],"mask-image-b-from-color":[{"mask-b-from":ne()}],"mask-image-b-to-color":[{"mask-b-to":ne()}],"mask-image-l-from-pos":[{"mask-l-from":ve()}],"mask-image-l-to-pos":[{"mask-l-to":ve()}],"mask-image-l-from-color":[{"mask-l-from":ne()}],"mask-image-l-to-color":[{"mask-l-to":ne()}],"mask-image-x-from-pos":[{"mask-x-from":ve()}],"mask-image-x-to-pos":[{"mask-x-to":ve()}],"mask-image-x-from-color":[{"mask-x-from":ne()}],"mask-image-x-to-color":[{"mask-x-to":ne()}],"mask-image-y-from-pos":[{"mask-y-from":ve()}],"mask-image-y-to-pos":[{"mask-y-to":ve()}],"mask-image-y-from-color":[{"mask-y-from":ne()}],"mask-image-y-to-color":[{"mask-y-to":ne()}],"mask-image-radial":[{"mask-radial":[Ye,Xe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ve()}],"mask-image-radial-to-pos":[{"mask-radial-to":ve()}],"mask-image-radial-from-color":[{"mask-radial-from":ne()}],"mask-image-radial-to-color":[{"mask-radial-to":ne()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[Mt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ve()}],"mask-image-conic-to-pos":[{"mask-conic-to":ve()}],"mask-image-conic-from-color":[{"mask-conic-from":ne()}],"mask-image-conic-to-color":[{"mask-conic-to":ne()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ce()}],"mask-repeat":[{mask:z()}],"mask-size":[{mask:xe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ye,Xe]}],filter:[{filter:["","none",Ye,Xe]}],blur:[{blur:Re()}],brightness:[{brightness:[Mt,Ye,Xe]}],contrast:[{contrast:[Mt,Ye,Xe]}],"drop-shadow":[{"drop-shadow":["","none",v,Km,Ym]}],"drop-shadow-color":[{"drop-shadow":ne()}],grayscale:[{grayscale:["",Mt,Ye,Xe]}],"hue-rotate":[{"hue-rotate":[Mt,Ye,Xe]}],invert:[{invert:["",Mt,Ye,Xe]}],saturate:[{saturate:[Mt,Ye,Xe]}],sepia:[{sepia:["",Mt,Ye,Xe]}],"backdrop-filter":[{"backdrop-filter":["","none",Ye,Xe]}],"backdrop-blur":[{"backdrop-blur":Re()}],"backdrop-brightness":[{"backdrop-brightness":[Mt,Ye,Xe]}],"backdrop-contrast":[{"backdrop-contrast":[Mt,Ye,Xe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Mt,Ye,Xe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Mt,Ye,Xe]}],"backdrop-invert":[{"backdrop-invert":["",Mt,Ye,Xe]}],"backdrop-opacity":[{"backdrop-opacity":[Mt,Ye,Xe]}],"backdrop-saturate":[{"backdrop-saturate":[Mt,Ye,Xe]}],"backdrop-sepia":[{"backdrop-sepia":["",Mt,Ye,Xe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":Q()}],"border-spacing-x":[{"border-spacing-x":Q()}],"border-spacing-y":[{"border-spacing-y":Q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ye,Xe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Mt,"initial",Ye,Xe]}],ease:[{ease:["linear","initial",j,Ye,Xe]}],delay:[{delay:[Mt,Ye,Xe]}],animate:[{animate:["none",T,Ye,Xe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,Ye,Xe]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:ue()}],"rotate-x":[{"rotate-x":ue()}],"rotate-y":[{"rotate-y":ue()}],"rotate-z":[{"rotate-z":ue()}],scale:[{scale:We()}],"scale-x":[{"scale-x":We()}],"scale-y":[{"scale-y":We()}],"scale-z":[{"scale-z":We()}],"scale-3d":["scale-3d"],skew:[{skew:ct()}],"skew-x":[{"skew-x":ct()}],"skew-y":[{"skew-y":ct()}],transform:[{transform:[Ye,Xe,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Oe()}],"translate-x":[{"translate-x":Oe()}],"translate-y":[{"translate-y":Oe()}],"translate-z":[{"translate-z":Oe()}],"translate-none":["translate-none"],accent:[{accent:ne()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:ne()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",Ye,Xe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":Q()}],"scroll-mx":[{"scroll-mx":Q()}],"scroll-my":[{"scroll-my":Q()}],"scroll-ms":[{"scroll-ms":Q()}],"scroll-me":[{"scroll-me":Q()}],"scroll-mt":[{"scroll-mt":Q()}],"scroll-mr":[{"scroll-mr":Q()}],"scroll-mb":[{"scroll-mb":Q()}],"scroll-ml":[{"scroll-ml":Q()}],"scroll-p":[{"scroll-p":Q()}],"scroll-px":[{"scroll-px":Q()}],"scroll-py":[{"scroll-py":Q()}],"scroll-ps":[{"scroll-ps":Q()}],"scroll-pe":[{"scroll-pe":Q()}],"scroll-pt":[{"scroll-pt":Q()}],"scroll-pr":[{"scroll-pr":Q()}],"scroll-pb":[{"scroll-pb":Q()}],"scroll-pl":[{"scroll-pl":Q()}],"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",Ye,Xe]}],fill:[{fill:["none",...ne()]}],"stroke-w":[{stroke:[Mt,Mh,Ko,Sy]}],stroke:[{stroke:["none",...ne()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},e$=DQ(JQ);function ye(...t){return e$(d9(t))}const gt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("rounded-xl border bg-card text-card-foreground shadow",t),...e}));gt.displayName="Card";const Wt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("flex flex-col space-y-1.5 p-6",t),...e}));Wt.displayName="CardHeader";const Gt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("font-semibold leading-none tracking-tight",t),...e}));Gt.displayName="CardTitle";const Sr=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Sr.displayName="CardDescription";const an=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("p-6 pt-0",t),...e}));an.displayName="CardContent";const bC=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("flex items-center p-6 pt-0",t),...e}));bC.displayName="CardFooter";var ky="rovingFocusGroup.onEntryFocus",t$={bubbles:!1,cancelable:!0},t0="RovingFocusGroup",[l2,wC,n$]=tx(t0),[r$,fx]=Vi(t0,[n$]),[s$,i$]=r$(t0),SC=S.forwardRef((t,e)=>a.jsx(l2.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(l2.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(a$,{...t,ref:e})})}));SC.displayName=t0;var a$=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:h,preventScrollOnEntryFocus:m=!1,...p}=t,x=S.useRef(null),v=Cn(e,x),b=Vf(i),[k,O]=ko({prop:l,defaultProp:c??null,onChange:d,caller:t0}),[j,T]=S.useState(!1),A=es(h),_=wC(n),D=S.useRef(!1),[E,R]=S.useState(0);return S.useEffect(()=>{const Q=x.current;if(Q)return Q.addEventListener(ky,A),()=>Q.removeEventListener(ky,A)},[A]),a.jsx(s$,{scope:n,orientation:r,dir:b,loop:s,currentTabStopId:k,onItemFocus:S.useCallback(Q=>O(Q),[O]),onItemShiftTab:S.useCallback(()=>T(!0),[]),onFocusableItemAdd:S.useCallback(()=>R(Q=>Q+1),[]),onFocusableItemRemove:S.useCallback(()=>R(Q=>Q-1),[]),children:a.jsx(Zt.div,{tabIndex:j||E===0?-1:0,"data-orientation":r,...p,ref:v,style:{outline:"none",...t.style},onMouseDown:$e(t.onMouseDown,()=>{D.current=!0}),onFocus:$e(t.onFocus,Q=>{const F=!D.current;if(Q.target===Q.currentTarget&&F&&!j){const L=new CustomEvent(ky,t$);if(Q.currentTarget.dispatchEvent(L),!L.defaultPrevented){const U=_().filter($=>$.focusable),V=U.find($=>$.active),de=U.find($=>$.id===k),J=[V,de,...U].filter(Boolean).map($=>$.ref.current);jC(J,m)}}D.current=!1}),onBlur:$e(t.onBlur,()=>T(!1))})})}),kC="RovingFocusGroupItem",OC=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:l,...c}=t,d=ji(),h=i||d,m=i$(kC,n),p=m.currentTabStopId===h,x=wC(n),{onFocusableItemAdd:v,onFocusableItemRemove:b,currentTabStopId:k}=m;return S.useEffect(()=>{if(r)return v(),()=>b()},[r,v,b]),a.jsx(l2.ItemSlot,{scope:n,id:h,focusable:r,active:s,children:a.jsx(Zt.span,{tabIndex:p?0:-1,"data-orientation":m.orientation,...c,ref:e,onMouseDown:$e(t.onMouseDown,O=>{r?m.onItemFocus(h):O.preventDefault()}),onFocus:$e(t.onFocus,()=>m.onItemFocus(h)),onKeyDown:$e(t.onKeyDown,O=>{if(O.key==="Tab"&&O.shiftKey){m.onItemShiftTab();return}if(O.target!==O.currentTarget)return;const j=c$(O,m.orientation,m.dir);if(j!==void 0){if(O.metaKey||O.ctrlKey||O.altKey||O.shiftKey)return;O.preventDefault();let A=x().filter(_=>_.focusable).map(_=>_.ref.current);if(j==="last")A.reverse();else if(j==="prev"||j==="next"){j==="prev"&&A.reverse();const _=A.indexOf(O.currentTarget);A=m.loop?u$(A,_+1):A.slice(_+1)}setTimeout(()=>jC(A))}}),children:typeof l=="function"?l({isCurrentTabStop:p,hasTabStop:k!=null}):l})})});OC.displayName=kC;var l$={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function o$(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function c$(t,e,n){const r=o$(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return l$[r]}function jC(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function u$(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var NC=SC,CC=OC,mx="Tabs",[d$]=Vi(mx,[fx]),TC=fx(),[h$,sw]=d$(mx),AC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:l="horizontal",dir:c,activationMode:d="automatic",...h}=t,m=Vf(c),[p,x]=ko({prop:r,onChange:s,defaultProp:i??"",caller:mx});return a.jsx(h$,{scope:n,baseId:ji(),value:p,onValueChange:x,orientation:l,dir:m,activationMode:d,children:a.jsx(Zt.div,{dir:m,"data-orientation":l,...h,ref:e})})});AC.displayName=mx;var MC="TabsList",EC=S.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=sw(MC,n),l=TC(n);return a.jsx(NC,{asChild:!0,...l,orientation:i.orientation,dir:i.dir,loop:r,children:a.jsx(Zt.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});EC.displayName=MC;var _C="TabsTrigger",DC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,l=sw(_C,n),c=TC(n),d=PC(l.baseId,r),h=BC(l.baseId,r),m=r===l.value;return a.jsx(CC,{asChild:!0,...c,focusable:!s,active:m,children:a.jsx(Zt.button,{type:"button",role:"tab","aria-selected":m,"aria-controls":h,"data-state":m?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:d,...i,ref:e,onMouseDown:$e(t.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?l.onValueChange(r):p.preventDefault()}),onKeyDown:$e(t.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&l.onValueChange(r)}),onFocus:$e(t.onFocus,()=>{const p=l.activationMode!=="manual";!m&&!s&&p&&l.onValueChange(r)})})})});DC.displayName=_C;var RC="TabsContent",zC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...l}=t,c=sw(RC,n),d=PC(c.baseId,r),h=BC(c.baseId,r),m=r===c.value,p=S.useRef(m);return S.useEffect(()=>{const x=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(x)},[]),a.jsx(Ls,{present:s||m,children:({present:x})=>a.jsx(Zt.div,{"data-state":m?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":d,hidden:!x,id:h,tabIndex:0,...l,ref:e,style:{...t.style,animationDuration:p.current?"0s":void 0},children:x&&i})})});zC.displayName=RC;function PC(t,e){return`${t}-trigger-${e}`}function BC(t,e){return`${t}-content-${e}`}var f$=AC,LC=EC,IC=DC,qC=zC;const hl=f$,ya=S.forwardRef(({className:t,...e},n)=>a.jsx(LC,{ref:n,className:ye("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));ya.displayName=LC.displayName;const $t=S.forwardRef(({className:t,...e},n)=>a.jsx(IC,{ref:n,className:ye("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 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",t),...e}));$t.displayName=IC.displayName;const kn=S.forwardRef(({className:t,...e},n)=>a.jsx(qC,{ref:n,className:ye("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",t),...e}));kn.displayName=qC.displayName;function m$(t,e){return S.useReducer((n,r)=>e[n][r]??n,t)}var iw="ScrollArea",[FC]=Vi(iw),[p$,Ei]=FC(iw),QC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...l}=t,[c,d]=S.useState(null),[h,m]=S.useState(null),[p,x]=S.useState(null),[v,b]=S.useState(null),[k,O]=S.useState(null),[j,T]=S.useState(0),[A,_]=S.useState(0),[D,E]=S.useState(!1),[R,Q]=S.useState(!1),F=Cn(e,U=>d(U)),L=Vf(s);return a.jsx(p$,{scope:n,type:r,dir:L,scrollHideDelay:i,scrollArea:c,viewport:h,onViewportChange:m,content:p,onContentChange:x,scrollbarX:v,onScrollbarXChange:b,scrollbarXEnabled:D,onScrollbarXEnabledChange:E,scrollbarY:k,onScrollbarYChange:O,scrollbarYEnabled:R,onScrollbarYEnabledChange:Q,onCornerWidthChange:T,onCornerHeightChange:_,children:a.jsx(Zt.div,{dir:L,...l,ref:F,style:{position:"relative","--radix-scroll-area-corner-width":j+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})});QC.displayName=iw;var $C="ScrollAreaViewport",HC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,l=Ei($C,n),c=S.useRef(null),d=Cn(e,c,l.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}"},nonce:s}),a.jsx(Zt.div,{"data-radix-scroll-area-viewport":"",...i,ref:d,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:a.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});HC.displayName=$C;var Sa="ScrollAreaScrollbar",aw=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ei(Sa,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:l}=s,c=t.orientation==="horizontal";return S.useEffect(()=>(c?i(!0):l(!0),()=>{c?i(!1):l(!1)}),[c,i,l]),s.type==="hover"?a.jsx(g$,{...r,ref:e,forceMount:n}):s.type==="scroll"?a.jsx(x$,{...r,ref:e,forceMount:n}):s.type==="auto"?a.jsx(UC,{...r,ref:e,forceMount:n}):s.type==="always"?a.jsx(lw,{...r,ref:e}):null});aw.displayName=Sa;var g$=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ei(Sa,t.__scopeScrollArea),[i,l]=S.useState(!1);return S.useEffect(()=>{const c=s.scrollArea;let d=0;if(c){const h=()=>{window.clearTimeout(d),l(!0)},m=()=>{d=window.setTimeout(()=>l(!1),s.scrollHideDelay)};return c.addEventListener("pointerenter",h),c.addEventListener("pointerleave",m),()=>{window.clearTimeout(d),c.removeEventListener("pointerenter",h),c.removeEventListener("pointerleave",m)}}},[s.scrollArea,s.scrollHideDelay]),a.jsx(Ls,{present:n||i,children:a.jsx(UC,{"data-state":i?"visible":"hidden",...r,ref:e})})}),x$=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ei(Sa,t.__scopeScrollArea),i=t.orientation==="horizontal",l=gx(()=>d("SCROLL_END"),100),[c,d]=m$("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 S.useEffect(()=>{if(c==="idle"){const h=window.setTimeout(()=>d("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(h)}},[c,s.scrollHideDelay,d]),S.useEffect(()=>{const h=s.viewport,m=i?"scrollLeft":"scrollTop";if(h){let p=h[m];const x=()=>{const v=h[m];p!==v&&(d("SCROLL"),l()),p=v};return h.addEventListener("scroll",x),()=>h.removeEventListener("scroll",x)}},[s.viewport,i,d,l]),a.jsx(Ls,{present:n||c!=="hidden",children:a.jsx(lw,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:$e(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:$e(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),UC=S.forwardRef((t,e)=>{const n=Ei(Sa,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,l]=S.useState(!1),c=t.orientation==="horizontal",d=gx(()=>{if(n.viewport){const h=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,s=Ei(Sa,t.__scopeScrollArea),i=S.useRef(null),l=S.useRef(0),[c,d]=S.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=YC(c.viewport,c.content),m={...r,sizes:c,onSizesChange:d,hasThumb:h>0&&h<1,onThumbChange:x=>i.current=x,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:x=>l.current=x};function p(x,v){return k$(x,l.current,c,v)}return n==="horizontal"?a.jsx(v$,{...m,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const x=s.viewport.scrollLeft,v=IO(x,c,s.dir);i.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollLeft=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollLeft=p(x,s.dir))}}):n==="vertical"?a.jsx(y$,{...m,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const x=s.viewport.scrollTop,v=IO(x,c);i.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollTop=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollTop=p(x))}}):null}),v$=S.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Ei(Sa,t.__scopeScrollArea),[l,c]=S.useState(),d=S.useRef(null),h=Cn(e,d,i.onScrollbarXChange);return S.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(WC,{"data-orientation":"horizontal",...s,ref:h,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":px(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.x),onDragScroll:m=>t.onDragScroll(m.x),onWheelScroll:(m,p)=>{if(i.viewport){const x=i.viewport.scrollLeft+m.deltaX;t.onWheelScroll(x),ZC(x,p)&&m.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:yg(l.paddingLeft),paddingEnd:yg(l.paddingRight)}})}})}),y$=S.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Ei(Sa,t.__scopeScrollArea),[l,c]=S.useState(),d=S.useRef(null),h=Cn(e,d,i.onScrollbarYChange);return S.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(WC,{"data-orientation":"vertical",...s,ref:h,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":px(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.y),onDragScroll:m=>t.onDragScroll(m.y),onWheelScroll:(m,p)=>{if(i.viewport){const x=i.viewport.scrollTop+m.deltaY;t.onWheelScroll(x),ZC(x,p)&&m.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:yg(l.paddingTop),paddingEnd:yg(l.paddingBottom)}})}})}),[b$,VC]=FC(Sa),WC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:l,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:h,onWheelScroll:m,onResize:p,...x}=t,v=Ei(Sa,n),[b,k]=S.useState(null),O=Cn(e,F=>k(F)),j=S.useRef(null),T=S.useRef(""),A=v.viewport,_=r.content-r.viewport,D=es(m),E=es(d),R=gx(p,10);function Q(F){if(j.current){const L=F.clientX-j.current.left,U=F.clientY-j.current.top;h({x:L,y:U})}}return S.useEffect(()=>{const F=L=>{const U=L.target;b?.contains(U)&&D(L,_)};return document.addEventListener("wheel",F,{passive:!1}),()=>document.removeEventListener("wheel",F,{passive:!1})},[A,b,_,D]),S.useEffect(E,[r,E]),id(b,R),id(v.content,R),a.jsx(b$,{scope:n,scrollbar:b,hasThumb:s,onThumbChange:es(i),onThumbPointerUp:es(l),onThumbPositionChange:E,onThumbPointerDown:es(c),children:a.jsx(Zt.div,{...x,ref:O,style:{position:"absolute",...x.style},onPointerDown:$e(t.onPointerDown,F=>{F.button===0&&(F.target.setPointerCapture(F.pointerId),j.current=b.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),Q(F))}),onPointerMove:$e(t.onPointerMove,Q),onPointerUp:$e(t.onPointerUp,F=>{const L=F.target;L.hasPointerCapture(F.pointerId)&&L.releasePointerCapture(F.pointerId),document.body.style.webkitUserSelect=T.current,v.viewport&&(v.viewport.style.scrollBehavior=""),j.current=null})})})}),vg="ScrollAreaThumb",GC=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=VC(vg,t.__scopeScrollArea);return a.jsx(Ls,{present:n||s.hasThumb,children:a.jsx(w$,{ref:e,...r})})}),w$=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=Ei(vg,n),l=VC(vg,n),{onThumbPositionChange:c}=l,d=Cn(e,p=>l.onThumbChange(p)),h=S.useRef(void 0),m=gx(()=>{h.current&&(h.current(),h.current=void 0)},100);return S.useEffect(()=>{const p=i.viewport;if(p){const x=()=>{if(m(),!h.current){const v=O$(p,c);h.current=v,c()}};return c(),p.addEventListener("scroll",x),()=>p.removeEventListener("scroll",x)}},[i.viewport,m,c]),a.jsx(Zt.div,{"data-state":l.hasThumb?"visible":"hidden",...s,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:$e(t.onPointerDownCapture,p=>{const v=p.target.getBoundingClientRect(),b=p.clientX-v.left,k=p.clientY-v.top;l.onThumbPointerDown({x:b,y:k})}),onPointerUp:$e(t.onPointerUp,l.onThumbPointerUp)})});GC.displayName=vg;var ow="ScrollAreaCorner",XC=S.forwardRef((t,e)=>{const n=Ei(ow,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(S$,{...t,ref:e}):null});XC.displayName=ow;var S$=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=Ei(ow,n),[i,l]=S.useState(0),[c,d]=S.useState(0),h=!!(i&&c);return id(s.scrollbarX,()=>{const m=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(m),d(m)}),id(s.scrollbarY,()=>{const m=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(m),l(m)}),h?a.jsx(Zt.div,{...r,ref:e,style:{width:i,height:c,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function yg(t){return t?parseInt(t,10):0}function YC(t,e){const n=t/e;return isNaN(n)?0:n}function px(t){const e=YC(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function k$(t,e,n,r="ltr"){const s=px(n),i=s/2,l=e||i,c=s-l,d=n.scrollbar.paddingStart+l,h=n.scrollbar.size-n.scrollbar.paddingEnd-c,m=n.content-n.viewport,p=r==="ltr"?[0,m]:[m*-1,0];return KC([d,h],p)(t)}function IO(t,e,n="ltr"){const r=px(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,l=e.content-e.viewport,c=i-r,d=n==="ltr"?[0,l]:[l*-1,0],h=F4(t,d);return KC([0,l],[0,c])(h)}function KC(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 ZC(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function s(){const i={left:t.scrollLeft,top:t.scrollTop},l=n.left!==i.left,c=n.top!==i.top;(l||c)&&e(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function gx(t,e){const n=es(t),r=S.useRef(0);return S.useEffect(()=>()=>window.clearTimeout(r.current),[]),S.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function id(t,e){const n=es(e);h9(()=>{let r=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(t),()=>{window.cancelAnimationFrame(r),s.unobserve(t)}}},[t,n])}var JC=QC,j$=HC,N$=XC;const vn=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(JC,{ref:r,className:ye("relative overflow-hidden",t),...n,children:[a.jsx(j$,{className:"h-full w-full rounded-[inherit]",children:e}),a.jsx(eT,{}),a.jsx(N$,{})]}));vn.displayName=JC.displayName;const eT=S.forwardRef(({className:t,orientation:e="vertical",...n},r)=>a.jsx(aw,{ref:r,orientation:e,className:ye("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(GC,{className:"relative flex-1 rounded-full bg-border"})}));eT.displayName=aw.displayName;function qO({className:t,...e}){return a.jsx("div",{className:ye("animate-pulse rounded-md bg-primary/10",t),...e})}function C$(t,e=[]){let n=[];function r(i,l){const c=S.createContext(l);c.displayName=i+"Context";const d=n.length;n=[...n,l];const h=p=>{const{scope:x,children:v,...b}=p,k=x?.[t]?.[d]||c,O=S.useMemo(()=>b,Object.values(b));return a.jsx(k.Provider,{value:O,children:v})};h.displayName=i+"Provider";function m(p,x){const v=x?.[t]?.[d]||c,b=S.useContext(v);if(b)return b;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[h,m]}const s=()=>{const i=n.map(l=>S.createContext(l));return function(c){const d=c?.[t]||i;return S.useMemo(()=>({[`__scope${t}`]:{...c,[t]:d}}),[c,d])}};return s.scopeName=t,[r,T$(s,...e)]}function T$(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const l=r.reduce((c,{useScope:d,scopeName:h})=>{const p=d(i)[`__scope${h}`];return{...c,...p}},{});return S.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return n.scopeName=e.scopeName,n}var A$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],tT=A$.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),cw="Progress",uw=100,[M$]=C$(cw),[E$,_$]=M$(cw),nT=S.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=D$,...l}=t;(s||s===0)&&!FO(s)&&console.error(R$(`${s}`,"Progress"));const c=FO(s)?s:uw;r!==null&&!QO(r,c)&&console.error(z$(`${r}`,"Progress"));const d=QO(r,c)?r:null,h=bg(d)?i(d,c):void 0;return a.jsx(E$,{scope:n,value:d,max:c,children:a.jsx(tT.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":bg(d)?d:void 0,"aria-valuetext":h,role:"progressbar","data-state":iT(d,c),"data-value":d??void 0,"data-max":c,...l,ref:e})})});nT.displayName=cw;var rT="ProgressIndicator",sT=S.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=_$(rT,n);return a.jsx(tT.div,{"data-state":iT(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});sT.displayName=rT;function D$(t,e){return`${Math.round(t/e*100)}%`}function iT(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function bg(t){return typeof t=="number"}function FO(t){return bg(t)&&!isNaN(t)&&t>0}function QO(t,e){return bg(t)&&!isNaN(t)&&t<=e&&t>=0}function R$(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${uw}\`.`}function z$(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: +`+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=vc(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Up.assertOptions(r,{silentJSONParsing:ea.transitional(ea.boolean),forcedJSONParsing:ea.transitional(ea.boolean),clarifyTimeoutError:ea.transitional(ea.boolean)},!1),s!=null&&(we.isFunction(s)?n.paramsSerializer={serialize:s}:Up.assertOptions(s,{encode:ea.function,serialize:ea.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Up.assertOptions(n,{baseUrl:ea.spelling("baseURL"),withXsrfToken:ea.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=i&&we.merge(i.common,i[n.method]);i&&we.forEach(["delete","get","head","post","put","patch","common"],b=>{delete i[b]}),n.headers=zs.concat(l,i);const c=[];let d=!0;this.interceptors.request.forEach(function(k){typeof k.runWhen=="function"&&k.runWhen(n)===!1||(d=d&&k.synchronous,c.unshift(k.fulfilled,k.rejected))});const h=[];this.interceptors.response.forEach(function(k){h.push(k.fulfilled,k.rejected)});let m,p=0,x;if(!d){const b=[_O.bind(this),void 0];for(b.unshift(...c),b.push(...h),x=b.length,m=Promise.resolve(n);p{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const l=new Promise(c=>{r.subscribe(c),i=c}).then(s);return l.cancel=function(){r.unsubscribe(i)},l},e(function(i,l,c){r.reason||(r.reason=new kd(i,l,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 aC(function(s){e=s}),cancel:e}}};function dQ(t){return function(n){return t.apply(null,n)}}function hQ(t){return we.isObject(t)&&t.isAxiosError===!0}const i2={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(i2).forEach(([t,e])=>{i2[e]=t});function lC(t){const e=new mc(t),n=L9(mc.prototype.request,e);return we.extend(n,mc.prototype,e,{allOwnKeys:!0}),we.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return lC(vc(t,s))},n}const Zn=lC(e0);Zn.Axios=mc;Zn.CanceledError=kd;Zn.CancelToken=uQ;Zn.isCancel=J9;Zn.VERSION=iC;Zn.toFormData=dx;Zn.AxiosError=St;Zn.Cancel=Zn.CanceledError;Zn.all=function(e){return Promise.all(e)};Zn.spread=dQ;Zn.isAxiosError=hQ;Zn.mergeConfig=vc;Zn.AxiosHeaders=zs;Zn.formToJSON=t=>Z9(we.isHTMLForm(t)?new FormData(t):t);Zn.getAdapter=sC.getAdapter;Zn.HttpStatusCode=i2;Zn.default=Zn;const{Axios:Nxe,AxiosError:Cxe,CanceledError:Txe,isCancel:Axe,CancelToken:Mxe,VERSION:Exe,all:_xe,Cancel:Dxe,isAxiosError:Rxe,spread:zxe,toFormData:Pxe,AxiosHeaders:Bxe,HttpStatusCode:Lxe,formToJSON:Ixe,getAdapter:qxe,mergeConfig:Fxe}=Zn,fQ=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),oC=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),xg="-",RO=[],pQ="arbitrary..",gQ=t=>{const e=vQ(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return xQ(l);const c=l.split(xg),d=c[0]===""&&c.length>1?1:0;return cC(c,d,e)},getConflictingClassGroupIds:(l,c)=>{if(c){const d=r[l],h=n[l];return d?h?fQ(h,d):d:h||RO}return n[l]||RO}}},cC=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const h=cC(t,e+1,i);if(h)return h}const l=n.validators;if(l===null)return;const c=e===0?t.join(xg):t.slice(e).join(xg),d=l.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?pQ+r:void 0})(),vQ=t=>{const{theme:e,classGroups:n}=t;return yQ(n,e)},yQ=(t,e)=>{const n=oC();for(const r in t){const s=t[r];rw(s,n,r,e)}return n},rw=(t,e,n,r)=>{const s=t.length;for(let i=0;i{if(typeof t=="string"){wQ(t,e,n);return}if(typeof t=="function"){SQ(t,e,n,r);return}kQ(t,e,n,r)},wQ=(t,e,n)=>{const r=t===""?e:uC(e,t);r.classGroupId=n},SQ=(t,e,n,r)=>{if(OQ(t)){rw(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(mQ(n,t))},kQ=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let l=0;l{let n=t;const r=e.split(xg),s=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,jQ=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,l)=>{n[i]=l,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let l=n[i];if(l!==void 0)return l;if((l=r[i])!==void 0)return s(i,l),l},set(i,l){i in n?n[i]=l:s(i,l)}}},a2="!",zO=":",NQ=[],PO=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),CQ=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let l=0,c=0,d=0,h;const m=s.length;for(let k=0;kd?h-d:void 0;return PO(i,v,x,b)};if(e){const s=e+zO,i=r;r=l=>l.startsWith(s)?i(l.slice(s.length)):PO(NQ,!1,l,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},TQ=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i0&&(s.sort(),r.push(...s),s=[]),r.push(l)):s.push(l)}return s.length>0&&(s.sort(),r.push(...s)),r}},AQ=t=>({cache:jQ(t.cacheSize),parseClassName:CQ(t),sortModifiers:TQ(t),...gQ(t)}),MQ=/\s+/,EQ=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,l=[],c=t.trim().split(MQ);let d="";for(let h=c.length-1;h>=0;h-=1){const m=c[h],{isExternal:p,modifiers:x,hasImportantModifier:v,baseClassName:b,maybePostfixModifierPosition:k}=n(m);if(p){d=m+(d.length>0?" "+d:d);continue}let O=!!k,j=r(O?b.substring(0,k):b);if(!j){if(!O){d=m+(d.length>0?" "+d:d);continue}if(j=r(b),!j){d=m+(d.length>0?" "+d:d);continue}O=!1}const T=x.length===0?"":x.length===1?x[0]:i(x).join(":"),A=v?T+a2:T,_=A+j;if(l.indexOf(_)>-1)continue;l.push(_);const D=s(j,O);for(let E=0;E0?" "+d:d)}return d},_Q=(...t)=>{let e=0,n,r,s="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,s,i;const l=d=>{const h=e.reduce((m,p)=>p(m),t());return n=AQ(h),r=n.cache.get,s=n.cache.set,i=c,c(d)},c=d=>{const h=r(d);if(h)return h;const m=EQ(d,n);return s(d,m),m};return i=l,(...d)=>i(_Q(...d))},RQ=[],wr=t=>{const e=n=>n[t]||RQ;return e.isThemeGetter=!0,e},hC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zQ=/^\d+\/\d+$/,PQ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,BQ=/\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$/,LQ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,IQ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qQ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ju=t=>zQ.test(t),Mt=t=>!!t&&!Number.isNaN(Number(t)),Gl=t=>!!t&&Number.isInteger(Number(t)),wy=t=>t.endsWith("%")&&Mt(t.slice(0,-1)),Xa=t=>PQ.test(t),FQ=()=>!0,QQ=t=>BQ.test(t)&&!LQ.test(t),mC=()=>!1,$Q=t=>IQ.test(t),HQ=t=>qQ.test(t),UQ=t=>!Xe(t)&&!Ye(t),VQ=t=>Od(t,xC,mC),Xe=t=>hC.test(t),Ko=t=>Od(t,vC,QQ),Sy=t=>Od(t,KQ,Mt),BO=t=>Od(t,pC,mC),WQ=t=>Od(t,gC,HQ),Ym=t=>Od(t,yC,$Q),Ye=t=>fC.test(t),Mh=t=>jd(t,vC),GQ=t=>jd(t,ZQ),LO=t=>jd(t,pC),XQ=t=>jd(t,xC),YQ=t=>jd(t,gC),Km=t=>jd(t,yC,!0),Od=(t,e,n)=>{const r=hC.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},jd=(t,e,n=!1)=>{const r=fC.exec(t);return r?r[1]?e(r[1]):n:!1},pC=t=>t==="position"||t==="percentage",gC=t=>t==="image"||t==="url",xC=t=>t==="length"||t==="size"||t==="bg-size",vC=t=>t==="length",KQ=t=>t==="number",ZQ=t=>t==="family-name",yC=t=>t==="shadow",JQ=()=>{const t=wr("color"),e=wr("font"),n=wr("text"),r=wr("font-weight"),s=wr("tracking"),i=wr("leading"),l=wr("breakpoint"),c=wr("container"),d=wr("spacing"),h=wr("radius"),m=wr("shadow"),p=wr("inset-shadow"),x=wr("text-shadow"),v=wr("drop-shadow"),b=wr("blur"),k=wr("perspective"),O=wr("aspect"),j=wr("ease"),T=wr("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[..._(),Ye,Xe],E=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],Q=()=>[Ye,Xe,d],F=()=>[ju,"full","auto",...Q()],L=()=>[Gl,"none","subgrid",Ye,Xe],U=()=>["auto",{span:["full",Gl,Ye,Xe]},Gl,Ye,Xe],V=()=>[Gl,"auto",Ye,Xe],ce=()=>["auto","min","max","fr",Ye,Xe],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...Q()],ae=()=>[ju,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...Q()],ne=()=>[t,Ye,Xe],ue=()=>[..._(),LO,BO,{position:[Ye,Xe]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],me=()=>["auto","cover","contain",XQ,VQ,{size:[Ye,Xe]}],Y=()=>[wy,Mh,Ko],P=()=>["","none","full",h,Ye,Xe],K=()=>["",Mt,Mh,Ko],H=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ve=()=>[Mt,wy,LO,BO],Re=()=>["","none",b,Ye,Xe],de=()=>["none",Mt,Ye,Xe],We=()=>["none",Mt,Ye,Xe],ct=()=>[Mt,Ye,Xe],Oe=()=>[ju,"full",...Q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xa],breakpoint:[Xa],color:[FQ],container:[Xa],"drop-shadow":[Xa],ease:["in","out","in-out"],font:[UQ],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xa],shadow:[Xa],spacing:["px",Mt],text:[Xa],"text-shadow":[Xa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ju,Xe,Ye,O]}],container:["container"],columns:[{columns:[Mt,Xe,Ye,c]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"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"],sr:["sr-only","not-sr-only"],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:D()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:F()}],"inset-x":[{"inset-x":F()}],"inset-y":[{"inset-y":F()}],start:[{start:F()}],end:[{end:F()}],top:[{top:F()}],right:[{right:F()}],bottom:[{bottom:F()}],left:[{left:F()}],visibility:["visible","invisible","collapse"],z:[{z:[Gl,"auto",Ye,Xe]}],basis:[{basis:[ju,"full","auto",c,...Q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Mt,ju,"auto","initial","none",Xe]}],grow:[{grow:["",Mt,Ye,Xe]}],shrink:[{shrink:["",Mt,Ye,Xe]}],order:[{order:[Gl,"first","last","none",Ye,Xe]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:U()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ce()}],"auto-rows":[{"auto-rows":ce()}],gap:[{gap:Q()}],"gap-x":[{"gap-x":Q()}],"gap-y":[{"gap-y":Q()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...J(),"baseline"]}],"place-self":[{"place-self":["auto",...J()]}],p:[{p:Q()}],px:[{px:Q()}],py:[{py:Q()}],ps:[{ps:Q()}],pe:[{pe:Q()}],pt:[{pt:Q()}],pr:[{pr:Q()}],pb:[{pb:Q()}],pl:[{pl:Q()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":Q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":Q()}],"space-y-reverse":["space-y-reverse"],size:[{size:ae()}],w:[{w:[c,"screen",...ae()]}],"min-w":[{"min-w":[c,"screen","none",...ae()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...ae()]}],h:[{h:["screen","lh",...ae()]}],"min-h":[{"min-h":["screen","lh","none",...ae()]}],"max-h":[{"max-h":["screen","lh",...ae()]}],"font-size":[{text:["base",n,Mh,Ko]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Ye,Sy]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",wy,Xe]}],"font-family":[{font:[GQ,Xe,e]}],"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-fractions"],tracking:[{tracking:[s,Ye,Xe]}],"line-clamp":[{"line-clamp":[Mt,"none",Ye,Sy]}],leading:[{leading:[i,...Q()]}],"list-image":[{"list-image":["none",Ye,Xe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ye,Xe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:ne()}],"text-color":[{text:ne()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:[Mt,"from-font","auto",Ye,Ko]}],"text-decoration-color":[{decoration:ne()}],"underline-offset":[{"underline-offset":[Mt,"auto",Ye,Xe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Q()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ye,Xe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ye,Xe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ue()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:me()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Gl,Ye,Xe],radial:["",Ye,Xe],conic:[Gl,Ye,Xe]},YQ,WQ]}],"bg-color":[{bg:ne()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:ne()}],"gradient-via":[{via:ne()}],"gradient-to":[{to:ne()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...H(),"hidden","none"]}],"divide-style":[{divide:[...H(),"hidden","none"]}],"border-color":[{border:ne()}],"border-color-x":[{"border-x":ne()}],"border-color-y":[{"border-y":ne()}],"border-color-s":[{"border-s":ne()}],"border-color-e":[{"border-e":ne()}],"border-color-t":[{"border-t":ne()}],"border-color-r":[{"border-r":ne()}],"border-color-b":[{"border-b":ne()}],"border-color-l":[{"border-l":ne()}],"divide-color":[{divide:ne()}],"outline-style":[{outline:[...H(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Mt,Ye,Xe]}],"outline-w":[{outline:["",Mt,Mh,Ko]}],"outline-color":[{outline:ne()}],shadow:[{shadow:["","none",m,Km,Ym]}],"shadow-color":[{shadow:ne()}],"inset-shadow":[{"inset-shadow":["none",p,Km,Ym]}],"inset-shadow-color":[{"inset-shadow":ne()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:ne()}],"ring-offset-w":[{"ring-offset":[Mt,Ko]}],"ring-offset-color":[{"ring-offset":ne()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":ne()}],"text-shadow":[{"text-shadow":["none",x,Km,Ym]}],"text-shadow-color":[{"text-shadow":ne()}],opacity:[{opacity:[Mt,Ye,Xe]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Mt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ve()}],"mask-image-linear-to-pos":[{"mask-linear-to":ve()}],"mask-image-linear-from-color":[{"mask-linear-from":ne()}],"mask-image-linear-to-color":[{"mask-linear-to":ne()}],"mask-image-t-from-pos":[{"mask-t-from":ve()}],"mask-image-t-to-pos":[{"mask-t-to":ve()}],"mask-image-t-from-color":[{"mask-t-from":ne()}],"mask-image-t-to-color":[{"mask-t-to":ne()}],"mask-image-r-from-pos":[{"mask-r-from":ve()}],"mask-image-r-to-pos":[{"mask-r-to":ve()}],"mask-image-r-from-color":[{"mask-r-from":ne()}],"mask-image-r-to-color":[{"mask-r-to":ne()}],"mask-image-b-from-pos":[{"mask-b-from":ve()}],"mask-image-b-to-pos":[{"mask-b-to":ve()}],"mask-image-b-from-color":[{"mask-b-from":ne()}],"mask-image-b-to-color":[{"mask-b-to":ne()}],"mask-image-l-from-pos":[{"mask-l-from":ve()}],"mask-image-l-to-pos":[{"mask-l-to":ve()}],"mask-image-l-from-color":[{"mask-l-from":ne()}],"mask-image-l-to-color":[{"mask-l-to":ne()}],"mask-image-x-from-pos":[{"mask-x-from":ve()}],"mask-image-x-to-pos":[{"mask-x-to":ve()}],"mask-image-x-from-color":[{"mask-x-from":ne()}],"mask-image-x-to-color":[{"mask-x-to":ne()}],"mask-image-y-from-pos":[{"mask-y-from":ve()}],"mask-image-y-to-pos":[{"mask-y-to":ve()}],"mask-image-y-from-color":[{"mask-y-from":ne()}],"mask-image-y-to-color":[{"mask-y-to":ne()}],"mask-image-radial":[{"mask-radial":[Ye,Xe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ve()}],"mask-image-radial-to-pos":[{"mask-radial-to":ve()}],"mask-image-radial-from-color":[{"mask-radial-from":ne()}],"mask-image-radial-to-color":[{"mask-radial-to":ne()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[Mt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ve()}],"mask-image-conic-to-pos":[{"mask-conic-to":ve()}],"mask-image-conic-from-color":[{"mask-conic-from":ne()}],"mask-image-conic-to-color":[{"mask-conic-to":ne()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ue()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:me()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ye,Xe]}],filter:[{filter:["","none",Ye,Xe]}],blur:[{blur:Re()}],brightness:[{brightness:[Mt,Ye,Xe]}],contrast:[{contrast:[Mt,Ye,Xe]}],"drop-shadow":[{"drop-shadow":["","none",v,Km,Ym]}],"drop-shadow-color":[{"drop-shadow":ne()}],grayscale:[{grayscale:["",Mt,Ye,Xe]}],"hue-rotate":[{"hue-rotate":[Mt,Ye,Xe]}],invert:[{invert:["",Mt,Ye,Xe]}],saturate:[{saturate:[Mt,Ye,Xe]}],sepia:[{sepia:["",Mt,Ye,Xe]}],"backdrop-filter":[{"backdrop-filter":["","none",Ye,Xe]}],"backdrop-blur":[{"backdrop-blur":Re()}],"backdrop-brightness":[{"backdrop-brightness":[Mt,Ye,Xe]}],"backdrop-contrast":[{"backdrop-contrast":[Mt,Ye,Xe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Mt,Ye,Xe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Mt,Ye,Xe]}],"backdrop-invert":[{"backdrop-invert":["",Mt,Ye,Xe]}],"backdrop-opacity":[{"backdrop-opacity":[Mt,Ye,Xe]}],"backdrop-saturate":[{"backdrop-saturate":[Mt,Ye,Xe]}],"backdrop-sepia":[{"backdrop-sepia":["",Mt,Ye,Xe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":Q()}],"border-spacing-x":[{"border-spacing-x":Q()}],"border-spacing-y":[{"border-spacing-y":Q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ye,Xe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Mt,"initial",Ye,Xe]}],ease:[{ease:["linear","initial",j,Ye,Xe]}],delay:[{delay:[Mt,Ye,Xe]}],animate:[{animate:["none",T,Ye,Xe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,Ye,Xe]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:We()}],"scale-x":[{"scale-x":We()}],"scale-y":[{"scale-y":We()}],"scale-z":[{"scale-z":We()}],"scale-3d":["scale-3d"],skew:[{skew:ct()}],"skew-x":[{"skew-x":ct()}],"skew-y":[{"skew-y":ct()}],transform:[{transform:[Ye,Xe,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Oe()}],"translate-x":[{"translate-x":Oe()}],"translate-y":[{"translate-y":Oe()}],"translate-z":[{"translate-z":Oe()}],"translate-none":["translate-none"],accent:[{accent:ne()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:ne()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",Ye,Xe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":Q()}],"scroll-mx":[{"scroll-mx":Q()}],"scroll-my":[{"scroll-my":Q()}],"scroll-ms":[{"scroll-ms":Q()}],"scroll-me":[{"scroll-me":Q()}],"scroll-mt":[{"scroll-mt":Q()}],"scroll-mr":[{"scroll-mr":Q()}],"scroll-mb":[{"scroll-mb":Q()}],"scroll-ml":[{"scroll-ml":Q()}],"scroll-p":[{"scroll-p":Q()}],"scroll-px":[{"scroll-px":Q()}],"scroll-py":[{"scroll-py":Q()}],"scroll-ps":[{"scroll-ps":Q()}],"scroll-pe":[{"scroll-pe":Q()}],"scroll-pt":[{"scroll-pt":Q()}],"scroll-pr":[{"scroll-pr":Q()}],"scroll-pb":[{"scroll-pb":Q()}],"scroll-pl":[{"scroll-pl":Q()}],"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",Ye,Xe]}],fill:[{fill:["none",...ne()]}],"stroke-w":[{stroke:[Mt,Mh,Ko,Sy]}],stroke:[{stroke:["none",...ne()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},e$=DQ(JQ);function ye(...t){return e$(d9(t))}const gt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("rounded-xl border bg-card text-card-foreground shadow",t),...e}));gt.displayName="Card";const Wt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("flex flex-col space-y-1.5 p-6",t),...e}));Wt.displayName="CardHeader";const Gt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("font-semibold leading-none tracking-tight",t),...e}));Gt.displayName="CardTitle";const Sr=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Sr.displayName="CardDescription";const an=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("p-6 pt-0",t),...e}));an.displayName="CardContent";const bC=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("flex items-center p-6 pt-0",t),...e}));bC.displayName="CardFooter";var ky="rovingFocusGroup.onEntryFocus",t$={bubbles:!1,cancelable:!0},t0="RovingFocusGroup",[l2,wC,n$]=tx(t0),[r$,fx]=Vi(t0,[n$]),[s$,i$]=r$(t0),SC=S.forwardRef((t,e)=>a.jsx(l2.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(l2.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(a$,{...t,ref:e})})}));SC.displayName=t0;var a$=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:h,preventScrollOnEntryFocus:m=!1,...p}=t,x=S.useRef(null),v=Cn(e,x),b=Vf(i),[k,O]=ko({prop:l,defaultProp:c??null,onChange:d,caller:t0}),[j,T]=S.useState(!1),A=es(h),_=wC(n),D=S.useRef(!1),[E,z]=S.useState(0);return S.useEffect(()=>{const Q=x.current;if(Q)return Q.addEventListener(ky,A),()=>Q.removeEventListener(ky,A)},[A]),a.jsx(s$,{scope:n,orientation:r,dir:b,loop:s,currentTabStopId:k,onItemFocus:S.useCallback(Q=>O(Q),[O]),onItemShiftTab:S.useCallback(()=>T(!0),[]),onFocusableItemAdd:S.useCallback(()=>z(Q=>Q+1),[]),onFocusableItemRemove:S.useCallback(()=>z(Q=>Q-1),[]),children:a.jsx(Zt.div,{tabIndex:j||E===0?-1:0,"data-orientation":r,...p,ref:v,style:{outline:"none",...t.style},onMouseDown:$e(t.onMouseDown,()=>{D.current=!0}),onFocus:$e(t.onFocus,Q=>{const F=!D.current;if(Q.target===Q.currentTarget&&F&&!j){const L=new CustomEvent(ky,t$);if(Q.currentTarget.dispatchEvent(L),!L.defaultPrevented){const U=_().filter($=>$.focusable),V=U.find($=>$.active),ce=U.find($=>$.id===k),J=[V,ce,...U].filter(Boolean).map($=>$.ref.current);jC(J,m)}}D.current=!1}),onBlur:$e(t.onBlur,()=>T(!1))})})}),kC="RovingFocusGroupItem",OC=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:l,...c}=t,d=ji(),h=i||d,m=i$(kC,n),p=m.currentTabStopId===h,x=wC(n),{onFocusableItemAdd:v,onFocusableItemRemove:b,currentTabStopId:k}=m;return S.useEffect(()=>{if(r)return v(),()=>b()},[r,v,b]),a.jsx(l2.ItemSlot,{scope:n,id:h,focusable:r,active:s,children:a.jsx(Zt.span,{tabIndex:p?0:-1,"data-orientation":m.orientation,...c,ref:e,onMouseDown:$e(t.onMouseDown,O=>{r?m.onItemFocus(h):O.preventDefault()}),onFocus:$e(t.onFocus,()=>m.onItemFocus(h)),onKeyDown:$e(t.onKeyDown,O=>{if(O.key==="Tab"&&O.shiftKey){m.onItemShiftTab();return}if(O.target!==O.currentTarget)return;const j=c$(O,m.orientation,m.dir);if(j!==void 0){if(O.metaKey||O.ctrlKey||O.altKey||O.shiftKey)return;O.preventDefault();let A=x().filter(_=>_.focusable).map(_=>_.ref.current);if(j==="last")A.reverse();else if(j==="prev"||j==="next"){j==="prev"&&A.reverse();const _=A.indexOf(O.currentTarget);A=m.loop?u$(A,_+1):A.slice(_+1)}setTimeout(()=>jC(A))}}),children:typeof l=="function"?l({isCurrentTabStop:p,hasTabStop:k!=null}):l})})});OC.displayName=kC;var l$={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function o$(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function c$(t,e,n){const r=o$(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return l$[r]}function jC(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function u$(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var NC=SC,CC=OC,mx="Tabs",[d$]=Vi(mx,[fx]),TC=fx(),[h$,sw]=d$(mx),AC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:l="horizontal",dir:c,activationMode:d="automatic",...h}=t,m=Vf(c),[p,x]=ko({prop:r,onChange:s,defaultProp:i??"",caller:mx});return a.jsx(h$,{scope:n,baseId:ji(),value:p,onValueChange:x,orientation:l,dir:m,activationMode:d,children:a.jsx(Zt.div,{dir:m,"data-orientation":l,...h,ref:e})})});AC.displayName=mx;var MC="TabsList",EC=S.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=sw(MC,n),l=TC(n);return a.jsx(NC,{asChild:!0,...l,orientation:i.orientation,dir:i.dir,loop:r,children:a.jsx(Zt.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});EC.displayName=MC;var _C="TabsTrigger",DC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,l=sw(_C,n),c=TC(n),d=PC(l.baseId,r),h=BC(l.baseId,r),m=r===l.value;return a.jsx(CC,{asChild:!0,...c,focusable:!s,active:m,children:a.jsx(Zt.button,{type:"button",role:"tab","aria-selected":m,"aria-controls":h,"data-state":m?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:d,...i,ref:e,onMouseDown:$e(t.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?l.onValueChange(r):p.preventDefault()}),onKeyDown:$e(t.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&l.onValueChange(r)}),onFocus:$e(t.onFocus,()=>{const p=l.activationMode!=="manual";!m&&!s&&p&&l.onValueChange(r)})})})});DC.displayName=_C;var RC="TabsContent",zC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...l}=t,c=sw(RC,n),d=PC(c.baseId,r),h=BC(c.baseId,r),m=r===c.value,p=S.useRef(m);return S.useEffect(()=>{const x=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(x)},[]),a.jsx(Ls,{present:s||m,children:({present:x})=>a.jsx(Zt.div,{"data-state":m?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":d,hidden:!x,id:h,tabIndex:0,...l,ref:e,style:{...t.style,animationDuration:p.current?"0s":void 0},children:x&&i})})});zC.displayName=RC;function PC(t,e){return`${t}-trigger-${e}`}function BC(t,e){return`${t}-content-${e}`}var f$=AC,LC=EC,IC=DC,qC=zC;const hl=f$,ya=S.forwardRef(({className:t,...e},n)=>a.jsx(LC,{ref:n,className:ye("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));ya.displayName=LC.displayName;const $t=S.forwardRef(({className:t,...e},n)=>a.jsx(IC,{ref:n,className:ye("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 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",t),...e}));$t.displayName=IC.displayName;const kn=S.forwardRef(({className:t,...e},n)=>a.jsx(qC,{ref:n,className:ye("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",t),...e}));kn.displayName=qC.displayName;function m$(t,e){return S.useReducer((n,r)=>e[n][r]??n,t)}var iw="ScrollArea",[FC]=Vi(iw),[p$,Ei]=FC(iw),QC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...l}=t,[c,d]=S.useState(null),[h,m]=S.useState(null),[p,x]=S.useState(null),[v,b]=S.useState(null),[k,O]=S.useState(null),[j,T]=S.useState(0),[A,_]=S.useState(0),[D,E]=S.useState(!1),[z,Q]=S.useState(!1),F=Cn(e,U=>d(U)),L=Vf(s);return a.jsx(p$,{scope:n,type:r,dir:L,scrollHideDelay:i,scrollArea:c,viewport:h,onViewportChange:m,content:p,onContentChange:x,scrollbarX:v,onScrollbarXChange:b,scrollbarXEnabled:D,onScrollbarXEnabledChange:E,scrollbarY:k,onScrollbarYChange:O,scrollbarYEnabled:z,onScrollbarYEnabledChange:Q,onCornerWidthChange:T,onCornerHeightChange:_,children:a.jsx(Zt.div,{dir:L,...l,ref:F,style:{position:"relative","--radix-scroll-area-corner-width":j+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})});QC.displayName=iw;var $C="ScrollAreaViewport",HC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,l=Ei($C,n),c=S.useRef(null),d=Cn(e,c,l.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}"},nonce:s}),a.jsx(Zt.div,{"data-radix-scroll-area-viewport":"",...i,ref:d,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:a.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});HC.displayName=$C;var Sa="ScrollAreaScrollbar",aw=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ei(Sa,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:l}=s,c=t.orientation==="horizontal";return S.useEffect(()=>(c?i(!0):l(!0),()=>{c?i(!1):l(!1)}),[c,i,l]),s.type==="hover"?a.jsx(g$,{...r,ref:e,forceMount:n}):s.type==="scroll"?a.jsx(x$,{...r,ref:e,forceMount:n}):s.type==="auto"?a.jsx(UC,{...r,ref:e,forceMount:n}):s.type==="always"?a.jsx(lw,{...r,ref:e}):null});aw.displayName=Sa;var g$=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ei(Sa,t.__scopeScrollArea),[i,l]=S.useState(!1);return S.useEffect(()=>{const c=s.scrollArea;let d=0;if(c){const h=()=>{window.clearTimeout(d),l(!0)},m=()=>{d=window.setTimeout(()=>l(!1),s.scrollHideDelay)};return c.addEventListener("pointerenter",h),c.addEventListener("pointerleave",m),()=>{window.clearTimeout(d),c.removeEventListener("pointerenter",h),c.removeEventListener("pointerleave",m)}}},[s.scrollArea,s.scrollHideDelay]),a.jsx(Ls,{present:n||i,children:a.jsx(UC,{"data-state":i?"visible":"hidden",...r,ref:e})})}),x$=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ei(Sa,t.__scopeScrollArea),i=t.orientation==="horizontal",l=gx(()=>d("SCROLL_END"),100),[c,d]=m$("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 S.useEffect(()=>{if(c==="idle"){const h=window.setTimeout(()=>d("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(h)}},[c,s.scrollHideDelay,d]),S.useEffect(()=>{const h=s.viewport,m=i?"scrollLeft":"scrollTop";if(h){let p=h[m];const x=()=>{const v=h[m];p!==v&&(d("SCROLL"),l()),p=v};return h.addEventListener("scroll",x),()=>h.removeEventListener("scroll",x)}},[s.viewport,i,d,l]),a.jsx(Ls,{present:n||c!=="hidden",children:a.jsx(lw,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:$e(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:$e(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),UC=S.forwardRef((t,e)=>{const n=Ei(Sa,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,l]=S.useState(!1),c=t.orientation==="horizontal",d=gx(()=>{if(n.viewport){const h=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,s=Ei(Sa,t.__scopeScrollArea),i=S.useRef(null),l=S.useRef(0),[c,d]=S.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=YC(c.viewport,c.content),m={...r,sizes:c,onSizesChange:d,hasThumb:h>0&&h<1,onThumbChange:x=>i.current=x,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:x=>l.current=x};function p(x,v){return k$(x,l.current,c,v)}return n==="horizontal"?a.jsx(v$,{...m,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const x=s.viewport.scrollLeft,v=IO(x,c,s.dir);i.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollLeft=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollLeft=p(x,s.dir))}}):n==="vertical"?a.jsx(y$,{...m,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const x=s.viewport.scrollTop,v=IO(x,c);i.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollTop=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollTop=p(x))}}):null}),v$=S.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Ei(Sa,t.__scopeScrollArea),[l,c]=S.useState(),d=S.useRef(null),h=Cn(e,d,i.onScrollbarXChange);return S.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(WC,{"data-orientation":"horizontal",...s,ref:h,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":px(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.x),onDragScroll:m=>t.onDragScroll(m.x),onWheelScroll:(m,p)=>{if(i.viewport){const x=i.viewport.scrollLeft+m.deltaX;t.onWheelScroll(x),ZC(x,p)&&m.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:yg(l.paddingLeft),paddingEnd:yg(l.paddingRight)}})}})}),y$=S.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Ei(Sa,t.__scopeScrollArea),[l,c]=S.useState(),d=S.useRef(null),h=Cn(e,d,i.onScrollbarYChange);return S.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(WC,{"data-orientation":"vertical",...s,ref:h,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":px(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.y),onDragScroll:m=>t.onDragScroll(m.y),onWheelScroll:(m,p)=>{if(i.viewport){const x=i.viewport.scrollTop+m.deltaY;t.onWheelScroll(x),ZC(x,p)&&m.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:yg(l.paddingTop),paddingEnd:yg(l.paddingBottom)}})}})}),[b$,VC]=FC(Sa),WC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:l,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:h,onWheelScroll:m,onResize:p,...x}=t,v=Ei(Sa,n),[b,k]=S.useState(null),O=Cn(e,F=>k(F)),j=S.useRef(null),T=S.useRef(""),A=v.viewport,_=r.content-r.viewport,D=es(m),E=es(d),z=gx(p,10);function Q(F){if(j.current){const L=F.clientX-j.current.left,U=F.clientY-j.current.top;h({x:L,y:U})}}return S.useEffect(()=>{const F=L=>{const U=L.target;b?.contains(U)&&D(L,_)};return document.addEventListener("wheel",F,{passive:!1}),()=>document.removeEventListener("wheel",F,{passive:!1})},[A,b,_,D]),S.useEffect(E,[r,E]),id(b,z),id(v.content,z),a.jsx(b$,{scope:n,scrollbar:b,hasThumb:s,onThumbChange:es(i),onThumbPointerUp:es(l),onThumbPositionChange:E,onThumbPointerDown:es(c),children:a.jsx(Zt.div,{...x,ref:O,style:{position:"absolute",...x.style},onPointerDown:$e(t.onPointerDown,F=>{F.button===0&&(F.target.setPointerCapture(F.pointerId),j.current=b.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),Q(F))}),onPointerMove:$e(t.onPointerMove,Q),onPointerUp:$e(t.onPointerUp,F=>{const L=F.target;L.hasPointerCapture(F.pointerId)&&L.releasePointerCapture(F.pointerId),document.body.style.webkitUserSelect=T.current,v.viewport&&(v.viewport.style.scrollBehavior=""),j.current=null})})})}),vg="ScrollAreaThumb",GC=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=VC(vg,t.__scopeScrollArea);return a.jsx(Ls,{present:n||s.hasThumb,children:a.jsx(w$,{ref:e,...r})})}),w$=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=Ei(vg,n),l=VC(vg,n),{onThumbPositionChange:c}=l,d=Cn(e,p=>l.onThumbChange(p)),h=S.useRef(void 0),m=gx(()=>{h.current&&(h.current(),h.current=void 0)},100);return S.useEffect(()=>{const p=i.viewport;if(p){const x=()=>{if(m(),!h.current){const v=O$(p,c);h.current=v,c()}};return c(),p.addEventListener("scroll",x),()=>p.removeEventListener("scroll",x)}},[i.viewport,m,c]),a.jsx(Zt.div,{"data-state":l.hasThumb?"visible":"hidden",...s,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:$e(t.onPointerDownCapture,p=>{const v=p.target.getBoundingClientRect(),b=p.clientX-v.left,k=p.clientY-v.top;l.onThumbPointerDown({x:b,y:k})}),onPointerUp:$e(t.onPointerUp,l.onThumbPointerUp)})});GC.displayName=vg;var ow="ScrollAreaCorner",XC=S.forwardRef((t,e)=>{const n=Ei(ow,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(S$,{...t,ref:e}):null});XC.displayName=ow;var S$=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=Ei(ow,n),[i,l]=S.useState(0),[c,d]=S.useState(0),h=!!(i&&c);return id(s.scrollbarX,()=>{const m=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(m),d(m)}),id(s.scrollbarY,()=>{const m=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(m),l(m)}),h?a.jsx(Zt.div,{...r,ref:e,style:{width:i,height:c,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function yg(t){return t?parseInt(t,10):0}function YC(t,e){const n=t/e;return isNaN(n)?0:n}function px(t){const e=YC(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function k$(t,e,n,r="ltr"){const s=px(n),i=s/2,l=e||i,c=s-l,d=n.scrollbar.paddingStart+l,h=n.scrollbar.size-n.scrollbar.paddingEnd-c,m=n.content-n.viewport,p=r==="ltr"?[0,m]:[m*-1,0];return KC([d,h],p)(t)}function IO(t,e,n="ltr"){const r=px(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,l=e.content-e.viewport,c=i-r,d=n==="ltr"?[0,l]:[l*-1,0],h=F4(t,d);return KC([0,l],[0,c])(h)}function KC(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 ZC(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function s(){const i={left:t.scrollLeft,top:t.scrollTop},l=n.left!==i.left,c=n.top!==i.top;(l||c)&&e(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function gx(t,e){const n=es(t),r=S.useRef(0);return S.useEffect(()=>()=>window.clearTimeout(r.current),[]),S.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function id(t,e){const n=es(e);h9(()=>{let r=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(t),()=>{window.cancelAnimationFrame(r),s.unobserve(t)}}},[t,n])}var JC=QC,j$=HC,N$=XC;const mn=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(JC,{ref:r,className:ye("relative overflow-hidden",t),...n,children:[a.jsx(j$,{className:"h-full w-full rounded-[inherit]",children:e}),a.jsx(eT,{}),a.jsx(N$,{})]}));mn.displayName=JC.displayName;const eT=S.forwardRef(({className:t,orientation:e="vertical",...n},r)=>a.jsx(aw,{ref:r,orientation:e,className:ye("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(GC,{className:"relative flex-1 rounded-full bg-border"})}));eT.displayName=aw.displayName;function qO({className:t,...e}){return a.jsx("div",{className:ye("animate-pulse rounded-md bg-primary/10",t),...e})}function C$(t,e=[]){let n=[];function r(i,l){const c=S.createContext(l);c.displayName=i+"Context";const d=n.length;n=[...n,l];const h=p=>{const{scope:x,children:v,...b}=p,k=x?.[t]?.[d]||c,O=S.useMemo(()=>b,Object.values(b));return a.jsx(k.Provider,{value:O,children:v})};h.displayName=i+"Provider";function m(p,x){const v=x?.[t]?.[d]||c,b=S.useContext(v);if(b)return b;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[h,m]}const s=()=>{const i=n.map(l=>S.createContext(l));return function(c){const d=c?.[t]||i;return S.useMemo(()=>({[`__scope${t}`]:{...c,[t]:d}}),[c,d])}};return s.scopeName=t,[r,T$(s,...e)]}function T$(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const l=r.reduce((c,{useScope:d,scopeName:h})=>{const p=d(i)[`__scope${h}`];return{...c,...p}},{});return S.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return n.scopeName=e.scopeName,n}var A$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],tT=A$.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),cw="Progress",uw=100,[M$]=C$(cw),[E$,_$]=M$(cw),nT=S.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=D$,...l}=t;(s||s===0)&&!FO(s)&&console.error(R$(`${s}`,"Progress"));const c=FO(s)?s:uw;r!==null&&!QO(r,c)&&console.error(z$(`${r}`,"Progress"));const d=QO(r,c)?r:null,h=bg(d)?i(d,c):void 0;return a.jsx(E$,{scope:n,value:d,max:c,children:a.jsx(tT.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":bg(d)?d:void 0,"aria-valuetext":h,role:"progressbar","data-state":iT(d,c),"data-value":d??void 0,"data-max":c,...l,ref:e})})});nT.displayName=cw;var rT="ProgressIndicator",sT=S.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=_$(rT,n);return a.jsx(tT.div,{"data-state":iT(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});sT.displayName=rT;function D$(t,e){return`${Math.round(t/e*100)}%`}function iT(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function bg(t){return typeof t=="number"}function FO(t){return bg(t)&&!isNaN(t)&&t>0}function QO(t,e){return bg(t)&&!isNaN(t)&&t<=e&&t>=0}function R$(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${uw}\`.`}function z$(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 ${uw} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. @@ -22,25 +22,25 @@ ${n.map(([i,l])=>{const c=l.theme?.[r]||l.color;return c?` --color-${i}: ${c};` `)} } `).join(` -`)}}):null},Eh=II,_u=S.forwardRef(({active:t,payload:e,className:n,indicator:r="dot",hideLabel:s=!1,hideIndicator:i=!1,label:l,labelFormatter:c,labelClassName:d,formatter:h,color:m,nameKey:p,labelKey:x},v)=>{const{config:b}=oT(),k=S.useMemo(()=>{if(s||!e?.length)return null;const[j]=e,T=`${x||j?.dataKey||j?.name||"value"}`,A=o2(b,j,T),_=!x&&typeof l=="string"?b[l]?.label||l:A?.label;return c?a.jsx("div",{className:ye("font-medium",d),children:c(_,e)}):_?a.jsx("div",{className:ye("font-medium",d),children:_}):null},[l,c,e,s,d,b,x]);if(!t||!e?.length)return null;const O=e.length===1&&r!=="dot";return a.jsxs("div",{ref:v,className:ye("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[O?null:k,a.jsx("div",{className:"grid gap-1.5",children:e.filter(j=>j.type!=="none").map((j,T)=>{const A=`${p||j.name||j.dataKey||"value"}`,_=o2(b,j,A),D=m||j.payload.fill||j.color;return a.jsx("div",{className:ye("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",r==="dot"&&"items-center"),children:h&&j?.value!==void 0&&j.name?h(j.value,j.name,j,T,j.payload):a.jsxs(a.Fragment,{children:[_?.icon?a.jsx(_.icon,{}):!i&&a.jsx("div",{className:ye("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":O&&r==="dashed"}),style:{"--color-bg":D,"--color-border":D}}),a.jsxs("div",{className:ye("flex flex-1 justify-between leading-none",O?"items-end":"items-center"),children:[a.jsxs("div",{className:"grid gap-1.5",children:[O?k:null,a.jsx("span",{className:"text-muted-foreground",children:_?.label||j.name})]}),j.value&&a.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:j.value.toLocaleString()})]})]})},j.dataKey)})})]})});_u.displayName="ChartTooltip";const I$=qI,cT=S.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:s},i)=>{const{config:l}=oT();return n?.length?a.jsx("div",{ref:i,className:ye("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.filter(c=>c.type!=="none").map(c=>{const d=`${s||c.dataKey||"value"}`,h=o2(l,c,d);return a.jsxs("div",{className:ye("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[h?.icon&&!e?a.jsx(h.icon,{}):a.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:c.color}}),h?.label]},c.value)})}):null});cT.displayName="ChartLegend";function o2(t,e,n){if(typeof e!="object"||e===null)return;const r="payload"in e&&typeof e.payload=="object"&&e.payload!==null?e.payload:void 0;let s=n;return n in e&&typeof e[n]=="string"?s=e[n]:r&&n in r&&typeof r[n]=="string"&&(s=r[n]),s in t?t[s]:t[n]}const $O=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,HO=d9,Nd=(t,e)=>n=>{var r;if(e?.variants==null)return HO(t,n?.class,n?.className);const{variants:s,defaultVariants:i}=e,l=Object.keys(s).map(h=>{const m=n?.[h],p=i?.[h];if(m===null)return null;const x=$O(m)||$O(p);return s[h][x]}),c=n&&Object.entries(n).reduce((h,m)=>{let[p,x]=m;return x===void 0||(h[p]=x),h},{}),d=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,m)=>{let{class:p,className:x,...v}=m;return Object.entries(v).every(b=>{let[k,O]=b;return Array.isArray(O)?O.includes({...i,...c}[k]):{...i,...c}[k]===O})?[...h,p,x]:h},[]);return HO(t,l,d,n?.class,n?.className)},ff=Nd("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring 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 shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ie=S.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const l=r?GI:"button";return a.jsx(l,{className:ye(ff({variant:e,size:n,className:t})),ref:i,...s})});ie.displayName="Button";function q$(){const[t,e]=S.useState(null),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(24),[d,h]=S.useState(!0),[m,p]=S.useState(null),[x,v]=S.useState(!0),b=S.useCallback(async()=>{try{v(!0);const F=await Zn.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");p({hitokoto:F.data.hitokoto,from:F.data.from||F.data.from_who||"未知"})}catch(F){console.error("获取一言失败:",F),p({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{v(!1)}},[]),k=S.useCallback(async()=>{try{const F=localStorage.getItem("access-token"),L=await Zn.get(`/api/webui/statistics/dashboard?hours=${l}`,{headers:{Authorization:`Bearer ${F}`}});e(L.data),r(!1),i(100)}catch(F){console.error("Failed to fetch dashboard data:",F),r(!1),i(100)}},[l]);if(S.useEffect(()=>{if(!n)return;i(0);const F=setTimeout(()=>i(15),200),L=setTimeout(()=>i(30),800),U=setTimeout(()=>i(45),2e3),V=setTimeout(()=>i(60),4e3),de=setTimeout(()=>i(75),6500),W=setTimeout(()=>i(85),9e3),J=setTimeout(()=>i(92),11e3);return()=>{clearTimeout(F),clearTimeout(L),clearTimeout(U),clearTimeout(V),clearTimeout(de),clearTimeout(W),clearTimeout(J)}},[n]),S.useEffect(()=>{k(),b()},[k,b]),S.useEffect(()=>{if(!d)return;const F=setInterval(()=>{k()},3e4);return()=>clearInterval(F)},[d,k]),n||!t)return a.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:a.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[a.jsx(Fi,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(n0,{value:s,className:"h-2"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[s,"%"]})]})]})});const{summary:O,model_stats:j,hourly_data:T,daily_data:A,recent_activity:_}=t,D=F=>{const L=Math.floor(F/3600),U=Math.floor(F%3600/60);return`${L}小时${U}分钟`},E=F=>new Date(F).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),R=j.slice(0,6).map(F=>({name:F.model_name,value:F.request_count,fill:`hsl(var(--chart-${j.indexOf(F)%5+1}))`})),Q={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(hl,{value:l.toString(),onValueChange:F=>c(Number(F)),children:a.jsxs(ya,{className:"grid grid-cols-3 w-full sm:w-auto",children:[a.jsx($t,{value:"24",children:"24小时"}),a.jsx($t,{value:"168",children:"7天"}),a.jsx($t,{value:"720",children:"30天"})]})}),a.jsxs(ie,{variant:d?"default":"outline",size:"sm",onClick:()=>h(!d),className:"gap-2",children:[a.jsx(Fi,{className:`h-4 w-4 ${d?"animate-spin":""}`}),a.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:k,children:a.jsx(Fi,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"总请求数"}),a.jsx(lq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:O.total_requests.toLocaleString()}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",l<48?l+"小时":Math.floor(l/24)+"天"]})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"总花费"}),a.jsx(oq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:["¥",O.total_cost.toFixed(2)]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:O.cost_per_hour>0?`¥${O.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"Token消耗"}),a.jsx(cq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:[(O.total_tokens/1e3).toFixed(1),"K"]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:O.tokens_per_hour>0?`${(O.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"平均响应"}),a.jsx(uf,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:[O.avg_response_time.toFixed(2),"s"]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"在线时长"}),a.jsx(dc,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsx(an,{children:a.jsx("div",{className:"text-xl font-bold",children:D(O.online_time)})})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"消息处理"}),a.jsx(Wf,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-xl font-bold",children:O.total_messages.toLocaleString()}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",O.total_replies.toLocaleString()," 条"]})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"成本效率"}),a.jsx(uq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-xl font-bold",children:O.total_messages>0?`¥${(O.total_cost/O.total_messages*100).toFixed(2)}`:"¥0.00"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),a.jsxs(hl,{defaultValue:"trends",className:"space-y-4",children:[a.jsxs(ya,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[a.jsx($t,{value:"trends",children:"趋势"}),a.jsx($t,{value:"models",children:"模型"}),a.jsx($t,{value:"activity",children:"活动"}),a.jsx($t,{value:"daily",children:"日统计"})]}),a.jsxs(kn,{value:"trends",className:"space-y-4",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"请求趋势"}),a.jsxs(Sr,{children:["最近",l,"小时的请求量变化"]})]}),a.jsx(an,{children:a.jsx(Eu,{config:Q,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:a.jsxs(FI,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(QI,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"花费趋势"}),a.jsx(Sr,{children:"API调用成本变化"})]}),a.jsx(an,{children:a.jsx(Eu,{config:Q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:a.jsxs(fy,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(Gm,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"Token消耗"}),a.jsx(Sr,{children:"Token使用量变化"})]}),a.jsx(an,{children:a.jsx(Eu,{config:Q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:a.jsxs(fy,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(Gm,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),a.jsx(kn,{value:"models",className:"space-y-4",children:a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"模型请求分布"}),a.jsx(Sr,{children:"各模型使用占比"})]}),a.jsx(an,{children:a.jsx(Eu,{config:Object.fromEntries(j.slice(0,6).map((F,L)=>[F.model_name,{label:F.model_name,color:`hsl(var(--chart-${L%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:a.jsxs($I,{children:[a.jsx(Eh,{content:a.jsx(_u,{})}),a.jsx(HI,{data:R,cx:"50%",cy:"50%",labelLine:!1,label:({name:F,percent:L})=>`${F} ${L?(L*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:R.map((F,L)=>a.jsx(UI,{fill:F.fill},`cell-${L}`))})]})})})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"模型详细统计"}),a.jsx(Sr,{children:"请求数、花费和性能"})]}),a.jsx(an,{children:a.jsx(vn,{className:"h-[300px] sm:h-[400px]",children:a.jsx("div",{className:"space-y-3",children:j.map((F,L)=>a.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:F.model_name}),a.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${L%5+1}))`}})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),a.jsx("span",{className:"ml-1 font-medium",children:F.request_count.toLocaleString()})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"花费:"}),a.jsxs("span",{className:"ml-1 font-medium",children:["¥",F.total_cost.toFixed(2)]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),a.jsxs("span",{className:"ml-1 font-medium",children:[(F.total_tokens/1e3).toFixed(1),"K"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),a.jsxs("span",{className:"ml-1 font-medium",children:[F.avg_response_time.toFixed(2),"s"]})]})]})]},L))})})})]})]})}),a.jsx(kn,{value:"activity",children:a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"最近活动"}),a.jsx(Sr,{children:"最新的API调用记录"})]}),a.jsx(an,{children:a.jsx(vn,{className:"h-[400px] sm:h-[500px]",children:a.jsx("div",{className:"space-y-2",children:_.map((F,L)=>a.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium text-sm truncate",children:F.model}),a.jsx("div",{className:"text-xs text-muted-foreground",children:F.request_type})]}),a.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:E(F.timestamp)})]}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),a.jsx("span",{className:"ml-1",children:F.tokens})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"花费:"}),a.jsxs("span",{className:"ml-1",children:["¥",F.cost.toFixed(4)]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),a.jsxs("span",{className:"ml-1",children:[F.time_cost.toFixed(2),"s"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"状态:"}),a.jsx("span",{className:`ml-1 ${F.status==="success"?"text-green-600":"text-red-600"}`,children:F.status})]})]})]},L))})})})]})}),a.jsx(kn,{value:"daily",children:a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"每日统计"}),a.jsx(Sr,{children:"最近7天的数据汇总"})]}),a.jsx(an,{children:a.jsx(Eu,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:a.jsxs(fy,{data:A,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>{const L=new Date(F);return`${L.getMonth()+1}/${L.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>new Date(F).toLocaleDateString("zh-CN")})}),a.jsx(I$,{content:a.jsx(cT,{})}),a.jsx(Gm,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),a.jsx(Gm,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),a.jsxs(gt,{className:"border-2 border-primary/20",children:[a.jsx(Wt,{className:"pb-3",children:a.jsx(Gt,{className:"text-lg",children:"每日一言"})}),a.jsx(an,{children:x?a.jsxs("div",{className:"space-y-2",children:[a.jsx(qO,{className:"h-6 w-3/4"}),a.jsx(qO,{className:"h-4 w-1/4"})]}):m?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("p",{className:"text-lg font-medium leading-relaxed italic",children:['"',m.hitokoto,'"']}),a.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["—— ",m.from]})]}):null})]})]})})}const F$={theme:"system",setTheme:()=>null},uT=S.createContext(F$),dw=()=>{const t=S.useContext(uT);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},Q$=(t,e,n)=>{const r=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||r){e(t);return}const s=n.clientX,i=n.clientY,l=Math.hypot(Math.max(s,innerWidth-s),Math.max(i,innerHeight-i));document.startViewTransition(()=>{e(t)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${s}px ${i}px)`,`circle(${l}px at ${s}px ${i}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},dT=S.createContext(void 0),hT=()=>{const t=S.useContext(dT);if(t===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return t};var xx="Switch",[$$]=Vi(xx),[H$,U$]=$$(xx),fT=S.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:l,disabled:c,value:d="on",onCheckedChange:h,form:m,...p}=t,[x,v]=S.useState(null),b=Cn(e,A=>v(A)),k=S.useRef(!1),O=x?m||!!x.closest("form"):!0,[j,T]=ko({prop:s,defaultProp:i??!1,onChange:h,caller:xx});return a.jsxs(H$,{scope:n,checked:j,disabled:c,children:[a.jsx(Zt.button,{type:"button",role:"switch","aria-checked":j,"aria-required":l,"data-state":xT(j),"data-disabled":c?"":void 0,disabled:c,value:d,...p,ref:b,onClick:$e(t.onClick,A=>{T(_=>!_),O&&(k.current=A.isPropagationStopped(),k.current||A.stopPropagation())})}),O&&a.jsx(gT,{control:x,bubbles:!k.current,name:r,value:d,checked:j,required:l,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});fT.displayName=xx;var mT="SwitchThumb",pT=S.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=U$(mT,n);return a.jsx(Zt.span,{"data-state":xT(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});pT.displayName=mT;var V$="SwitchBubbleInput",gT=S.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const l=S.useRef(null),c=Cn(l,i),d=f9(n),h=m9(e);return S.useEffect(()=>{const m=l.current;if(!m)return;const p=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(p,"checked").set;if(d!==n&&v){const b=new Event("click",{bubbles:r});v.call(m,n),m.dispatchEvent(b)}},[d,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:c,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});gT.displayName=V$;function xT(t){return t?"checked":"unchecked"}var vT=fT,W$=pT;const jt=S.forwardRef(({className:t,...e},n)=>a.jsx(vT,{className:ye("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm 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(W$,{className:ye("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));jt.displayName=vT.displayName;const G$=Nd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),te=S.forwardRef(({className:t,...e},n)=>a.jsx(p9,{ref:n,className:ye(G$(),t),...e}));te.displayName=p9.displayName;const Me=S.forwardRef(({className:t,type:e,...n},r)=>a.jsx("input",{type:e,className:ye("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors 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-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Me.displayName="Input";const X$=1,Y$=1e6;let Oy=0;function K$(){return Oy=(Oy+1)%Number.MAX_SAFE_INTEGER,Oy.toString()}const jy=new Map,UO=t=>{if(jy.has(t))return;const e=setTimeout(()=>{jy.delete(t),Kh({type:"REMOVE_TOAST",toastId:t})},Y$);jy.set(t,e)},Z$=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,X$)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?UO(n):t.toasts.forEach(r=>{UO(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},Vp=[];let Wp={toasts:[]};function Kh(t){Wp=Z$(Wp,t),Vp.forEach(e=>{e(Wp)})}function J$({...t}){const e=K$(),n=s=>Kh({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>Kh({type:"DISMISS_TOAST",toastId:e});return Kh({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function Pr(){const[t,e]=S.useState(Wp);return S.useEffect(()=>(Vp.push(e),()=>{const n=Vp.indexOf(e);n>-1&&Vp.splice(n,1)}),[t]),{...t,toast:J$,dismiss:n=>Kh({type:"DISMISS_TOAST",toastId:n})}}const eH=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:t=>t.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:t=>/[A-Z]/.test(t)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:t=>/[a-z]/.test(t)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:t=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(t)}];function tH(t){const e=eH.map(r=>({id:r.id,label:r.label,description:r.description,passed:r.validate(t)}));return{isValid:e.every(r=>r.passed),rules:e}}const hw="0.11.5 Beta",fw="MaiBot Dashboard",nH=`${fw} v${hw}`,rH=(t="v")=>`${t}${hw}`,Rr=W4,mw=g9,sH=$4,yT=S.forwardRef(({className:t,...e},n)=>a.jsx(nx,{ref:n,className:ye("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}));yT.displayName=nx.displayName;const Nr=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(sH,{children:[a.jsx(yT,{}),a.jsxs(rx,{ref:r,className:ye("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(H4,{className:"absolute right-4 top-4 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(Gf,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Nr.displayName=rx.displayName;const Cr=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Cr.displayName="DialogHeader";const ps=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ps.displayName="DialogFooter";const Tr=S.forwardRef(({className:t,...e},n)=>a.jsx(U4,{ref:n,className:ye("text-lg font-semibold leading-none tracking-tight",t),...e}));Tr.displayName=U4.displayName;const Gr=S.forwardRef(({className:t,...e},n)=>a.jsx(V4,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Gr.displayName=V4.displayName;var iH=Symbol("radix.slottable");function aH(t){const e=({children:n})=>a.jsx(a.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=iH,e}var bT="AlertDialog",[lH]=Vi(bT,[x9]),bl=x9(),wT=t=>{const{__scopeAlertDialog:e,...n}=t,r=bl(e);return a.jsx(W4,{...r,...n,modal:!0})};wT.displayName=bT;var oH="AlertDialogTrigger",ST=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(g9,{...s,...r,ref:e})});ST.displayName=oH;var cH="AlertDialogPortal",kT=t=>{const{__scopeAlertDialog:e,...n}=t,r=bl(e);return a.jsx($4,{...r,...n})};kT.displayName=cH;var uH="AlertDialogOverlay",OT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(nx,{...s,...r,ref:e})});OT.displayName=uH;var Uu="AlertDialogContent",[dH,hH]=lH(Uu),fH=aH("AlertDialogContent"),jT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=bl(n),l=S.useRef(null),c=Cn(e,l),d=S.useRef(null);return a.jsx(XI,{contentName:Uu,titleName:NT,docsSlug:"alert-dialog",children:a.jsx(dH,{scope:n,cancelRef:d,children:a.jsxs(rx,{role:"alertdialog",...i,...s,ref:c,onOpenAutoFocus:$e(s.onOpenAutoFocus,h=>{h.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:[a.jsx(fH,{children:r}),a.jsx(pH,{contentRef:l})]})})})});jT.displayName=Uu;var NT="AlertDialogTitle",CT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(U4,{...s,...r,ref:e})});CT.displayName=NT;var TT="AlertDialogDescription",AT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(V4,{...s,...r,ref:e})});AT.displayName=TT;var mH="AlertDialogAction",MT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(H4,{...s,...r,ref:e})});MT.displayName=mH;var ET="AlertDialogCancel",_T=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=hH(ET,n),i=bl(n),l=Cn(e,s);return a.jsx(H4,{...i,...r,ref:l})});_T.displayName=ET;var pH=({contentRef:t})=>{const e=`\`${Uu}\` requires a description for the component to be accessible for screen reader users. +`)}}):null},Eh=II,_u=S.forwardRef(({active:t,payload:e,className:n,indicator:r="dot",hideLabel:s=!1,hideIndicator:i=!1,label:l,labelFormatter:c,labelClassName:d,formatter:h,color:m,nameKey:p,labelKey:x},v)=>{const{config:b}=oT(),k=S.useMemo(()=>{if(s||!e?.length)return null;const[j]=e,T=`${x||j?.dataKey||j?.name||"value"}`,A=o2(b,j,T),_=!x&&typeof l=="string"?b[l]?.label||l:A?.label;return c?a.jsx("div",{className:ye("font-medium",d),children:c(_,e)}):_?a.jsx("div",{className:ye("font-medium",d),children:_}):null},[l,c,e,s,d,b,x]);if(!t||!e?.length)return null;const O=e.length===1&&r!=="dot";return a.jsxs("div",{ref:v,className:ye("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[O?null:k,a.jsx("div",{className:"grid gap-1.5",children:e.filter(j=>j.type!=="none").map((j,T)=>{const A=`${p||j.name||j.dataKey||"value"}`,_=o2(b,j,A),D=m||j.payload.fill||j.color;return a.jsx("div",{className:ye("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",r==="dot"&&"items-center"),children:h&&j?.value!==void 0&&j.name?h(j.value,j.name,j,T,j.payload):a.jsxs(a.Fragment,{children:[_?.icon?a.jsx(_.icon,{}):!i&&a.jsx("div",{className:ye("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":O&&r==="dashed"}),style:{"--color-bg":D,"--color-border":D}}),a.jsxs("div",{className:ye("flex flex-1 justify-between leading-none",O?"items-end":"items-center"),children:[a.jsxs("div",{className:"grid gap-1.5",children:[O?k:null,a.jsx("span",{className:"text-muted-foreground",children:_?.label||j.name})]}),j.value&&a.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:j.value.toLocaleString()})]})]})},j.dataKey)})})]})});_u.displayName="ChartTooltip";const I$=qI,cT=S.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:s},i)=>{const{config:l}=oT();return n?.length?a.jsx("div",{ref:i,className:ye("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.filter(c=>c.type!=="none").map(c=>{const d=`${s||c.dataKey||"value"}`,h=o2(l,c,d);return a.jsxs("div",{className:ye("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[h?.icon&&!e?a.jsx(h.icon,{}):a.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:c.color}}),h?.label]},c.value)})}):null});cT.displayName="ChartLegend";function o2(t,e,n){if(typeof e!="object"||e===null)return;const r="payload"in e&&typeof e.payload=="object"&&e.payload!==null?e.payload:void 0;let s=n;return n in e&&typeof e[n]=="string"?s=e[n]:r&&n in r&&typeof r[n]=="string"&&(s=r[n]),s in t?t[s]:t[n]}const $O=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,HO=d9,Nd=(t,e)=>n=>{var r;if(e?.variants==null)return HO(t,n?.class,n?.className);const{variants:s,defaultVariants:i}=e,l=Object.keys(s).map(h=>{const m=n?.[h],p=i?.[h];if(m===null)return null;const x=$O(m)||$O(p);return s[h][x]}),c=n&&Object.entries(n).reduce((h,m)=>{let[p,x]=m;return x===void 0||(h[p]=x),h},{}),d=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,m)=>{let{class:p,className:x,...v}=m;return Object.entries(v).every(b=>{let[k,O]=b;return Array.isArray(O)?O.includes({...i,...c}[k]):{...i,...c}[k]===O})?[...h,p,x]:h},[]);return HO(t,l,d,n?.class,n?.className)},ff=Nd("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring 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 shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ie=S.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const l=r?GI:"button";return a.jsx(l,{className:ye(ff({variant:e,size:n,className:t})),ref:i,...s})});ie.displayName="Button";function q$(){const[t,e]=S.useState(null),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(24),[d,h]=S.useState(!0),[m,p]=S.useState(null),[x,v]=S.useState(!0),b=S.useCallback(async()=>{try{v(!0);const F=await Zn.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");p({hitokoto:F.data.hitokoto,from:F.data.from||F.data.from_who||"未知"})}catch(F){console.error("获取一言失败:",F),p({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{v(!1)}},[]),k=S.useCallback(async()=>{try{const F=localStorage.getItem("access-token"),L=await Zn.get(`/api/webui/statistics/dashboard?hours=${l}`,{headers:{Authorization:`Bearer ${F}`}});e(L.data),r(!1),i(100)}catch(F){console.error("Failed to fetch dashboard data:",F),r(!1),i(100)}},[l]);if(S.useEffect(()=>{if(!n)return;i(0);const F=setTimeout(()=>i(15),200),L=setTimeout(()=>i(30),800),U=setTimeout(()=>i(45),2e3),V=setTimeout(()=>i(60),4e3),ce=setTimeout(()=>i(75),6500),W=setTimeout(()=>i(85),9e3),J=setTimeout(()=>i(92),11e3);return()=>{clearTimeout(F),clearTimeout(L),clearTimeout(U),clearTimeout(V),clearTimeout(ce),clearTimeout(W),clearTimeout(J)}},[n]),S.useEffect(()=>{k(),b()},[k,b]),S.useEffect(()=>{if(!d)return;const F=setInterval(()=>{k()},3e4);return()=>clearInterval(F)},[d,k]),n||!t)return a.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:a.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[a.jsx(Fi,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(n0,{value:s,className:"h-2"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[s,"%"]})]})]})});const{summary:O,model_stats:j,hourly_data:T,daily_data:A,recent_activity:_}=t,D=F=>{const L=Math.floor(F/3600),U=Math.floor(F%3600/60);return`${L}小时${U}分钟`},E=F=>new Date(F).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),z=j.slice(0,6).map(F=>({name:F.model_name,value:F.request_count,fill:`hsl(var(--chart-${j.indexOf(F)%5+1}))`})),Q={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(hl,{value:l.toString(),onValueChange:F=>c(Number(F)),children:a.jsxs(ya,{className:"grid grid-cols-3 w-full sm:w-auto",children:[a.jsx($t,{value:"24",children:"24小时"}),a.jsx($t,{value:"168",children:"7天"}),a.jsx($t,{value:"720",children:"30天"})]})}),a.jsxs(ie,{variant:d?"default":"outline",size:"sm",onClick:()=>h(!d),className:"gap-2",children:[a.jsx(Fi,{className:`h-4 w-4 ${d?"animate-spin":""}`}),a.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:k,children:a.jsx(Fi,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"总请求数"}),a.jsx(lq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:O.total_requests.toLocaleString()}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",l<48?l+"小时":Math.floor(l/24)+"天"]})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"总花费"}),a.jsx(oq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:["¥",O.total_cost.toFixed(2)]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:O.cost_per_hour>0?`¥${O.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"Token消耗"}),a.jsx(cq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:[(O.total_tokens/1e3).toFixed(1),"K"]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:O.tokens_per_hour>0?`${(O.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"平均响应"}),a.jsx(uf,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:[O.avg_response_time.toFixed(2),"s"]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"在线时长"}),a.jsx(dc,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsx(an,{children:a.jsx("div",{className:"text-xl font-bold",children:D(O.online_time)})})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"消息处理"}),a.jsx(Wf,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-xl font-bold",children:O.total_messages.toLocaleString()}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",O.total_replies.toLocaleString()," 条"]})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"成本效率"}),a.jsx(uq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-xl font-bold",children:O.total_messages>0?`¥${(O.total_cost/O.total_messages*100).toFixed(2)}`:"¥0.00"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),a.jsxs(hl,{defaultValue:"trends",className:"space-y-4",children:[a.jsxs(ya,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[a.jsx($t,{value:"trends",children:"趋势"}),a.jsx($t,{value:"models",children:"模型"}),a.jsx($t,{value:"activity",children:"活动"}),a.jsx($t,{value:"daily",children:"日统计"})]}),a.jsxs(kn,{value:"trends",className:"space-y-4",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"请求趋势"}),a.jsxs(Sr,{children:["最近",l,"小时的请求量变化"]})]}),a.jsx(an,{children:a.jsx(Eu,{config:Q,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:a.jsxs(FI,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(QI,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"花费趋势"}),a.jsx(Sr,{children:"API调用成本变化"})]}),a.jsx(an,{children:a.jsx(Eu,{config:Q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:a.jsxs(fy,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(Gm,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"Token消耗"}),a.jsx(Sr,{children:"Token使用量变化"})]}),a.jsx(an,{children:a.jsx(Eu,{config:Q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:a.jsxs(fy,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(Gm,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),a.jsx(kn,{value:"models",className:"space-y-4",children:a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"模型请求分布"}),a.jsx(Sr,{children:"各模型使用占比"})]}),a.jsx(an,{children:a.jsx(Eu,{config:Object.fromEntries(j.slice(0,6).map((F,L)=>[F.model_name,{label:F.model_name,color:`hsl(var(--chart-${L%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:a.jsxs($I,{children:[a.jsx(Eh,{content:a.jsx(_u,{})}),a.jsx(HI,{data:z,cx:"50%",cy:"50%",labelLine:!1,label:({name:F,percent:L})=>`${F} ${L?(L*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:z.map((F,L)=>a.jsx(UI,{fill:F.fill},`cell-${L}`))})]})})})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"模型详细统计"}),a.jsx(Sr,{children:"请求数、花费和性能"})]}),a.jsx(an,{children:a.jsx(mn,{className:"h-[300px] sm:h-[400px]",children:a.jsx("div",{className:"space-y-3",children:j.map((F,L)=>a.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:F.model_name}),a.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${L%5+1}))`}})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),a.jsx("span",{className:"ml-1 font-medium",children:F.request_count.toLocaleString()})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"花费:"}),a.jsxs("span",{className:"ml-1 font-medium",children:["¥",F.total_cost.toFixed(2)]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),a.jsxs("span",{className:"ml-1 font-medium",children:[(F.total_tokens/1e3).toFixed(1),"K"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),a.jsxs("span",{className:"ml-1 font-medium",children:[F.avg_response_time.toFixed(2),"s"]})]})]})]},L))})})})]})]})}),a.jsx(kn,{value:"activity",children:a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"最近活动"}),a.jsx(Sr,{children:"最新的API调用记录"})]}),a.jsx(an,{children:a.jsx(mn,{className:"h-[400px] sm:h-[500px]",children:a.jsx("div",{className:"space-y-2",children:_.map((F,L)=>a.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium text-sm truncate",children:F.model}),a.jsx("div",{className:"text-xs text-muted-foreground",children:F.request_type})]}),a.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:E(F.timestamp)})]}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),a.jsx("span",{className:"ml-1",children:F.tokens})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"花费:"}),a.jsxs("span",{className:"ml-1",children:["¥",F.cost.toFixed(4)]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),a.jsxs("span",{className:"ml-1",children:[F.time_cost.toFixed(2),"s"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"状态:"}),a.jsx("span",{className:`ml-1 ${F.status==="success"?"text-green-600":"text-red-600"}`,children:F.status})]})]})]},L))})})})]})}),a.jsx(kn,{value:"daily",children:a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"每日统计"}),a.jsx(Sr,{children:"最近7天的数据汇总"})]}),a.jsx(an,{children:a.jsx(Eu,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:a.jsxs(fy,{data:A,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>{const L=new Date(F);return`${L.getMonth()+1}/${L.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>new Date(F).toLocaleDateString("zh-CN")})}),a.jsx(I$,{content:a.jsx(cT,{})}),a.jsx(Gm,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),a.jsx(Gm,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),a.jsxs(gt,{className:"border-2 border-primary/20",children:[a.jsx(Wt,{className:"pb-3",children:a.jsx(Gt,{className:"text-lg",children:"每日一言"})}),a.jsx(an,{children:x?a.jsxs("div",{className:"space-y-2",children:[a.jsx(qO,{className:"h-6 w-3/4"}),a.jsx(qO,{className:"h-4 w-1/4"})]}):m?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("p",{className:"text-lg font-medium leading-relaxed italic",children:['"',m.hitokoto,'"']}),a.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["—— ",m.from]})]}):null})]})]})})}const F$={theme:"system",setTheme:()=>null},uT=S.createContext(F$),dw=()=>{const t=S.useContext(uT);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},Q$=(t,e,n)=>{const r=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||r){e(t);return}const s=n.clientX,i=n.clientY,l=Math.hypot(Math.max(s,innerWidth-s),Math.max(i,innerHeight-i));document.startViewTransition(()=>{e(t)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${s}px ${i}px)`,`circle(${l}px at ${s}px ${i}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},dT=S.createContext(void 0),hT=()=>{const t=S.useContext(dT);if(t===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return t};var xx="Switch",[$$]=Vi(xx),[H$,U$]=$$(xx),fT=S.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:l,disabled:c,value:d="on",onCheckedChange:h,form:m,...p}=t,[x,v]=S.useState(null),b=Cn(e,A=>v(A)),k=S.useRef(!1),O=x?m||!!x.closest("form"):!0,[j,T]=ko({prop:s,defaultProp:i??!1,onChange:h,caller:xx});return a.jsxs(H$,{scope:n,checked:j,disabled:c,children:[a.jsx(Zt.button,{type:"button",role:"switch","aria-checked":j,"aria-required":l,"data-state":xT(j),"data-disabled":c?"":void 0,disabled:c,value:d,...p,ref:b,onClick:$e(t.onClick,A=>{T(_=>!_),O&&(k.current=A.isPropagationStopped(),k.current||A.stopPropagation())})}),O&&a.jsx(gT,{control:x,bubbles:!k.current,name:r,value:d,checked:j,required:l,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});fT.displayName=xx;var mT="SwitchThumb",pT=S.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=U$(mT,n);return a.jsx(Zt.span,{"data-state":xT(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});pT.displayName=mT;var V$="SwitchBubbleInput",gT=S.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const l=S.useRef(null),c=Cn(l,i),d=f9(n),h=m9(e);return S.useEffect(()=>{const m=l.current;if(!m)return;const p=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(p,"checked").set;if(d!==n&&v){const b=new Event("click",{bubbles:r});v.call(m,n),m.dispatchEvent(b)}},[d,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:c,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});gT.displayName=V$;function xT(t){return t?"checked":"unchecked"}var vT=fT,W$=pT;const jt=S.forwardRef(({className:t,...e},n)=>a.jsx(vT,{className:ye("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm 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(W$,{className:ye("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));jt.displayName=vT.displayName;const G$=Nd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),te=S.forwardRef(({className:t,...e},n)=>a.jsx(p9,{ref:n,className:ye(G$(),t),...e}));te.displayName=p9.displayName;const Me=S.forwardRef(({className:t,type:e,...n},r)=>a.jsx("input",{type:e,className:ye("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors 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-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Me.displayName="Input";const X$=1,Y$=1e6;let Oy=0;function K$(){return Oy=(Oy+1)%Number.MAX_SAFE_INTEGER,Oy.toString()}const jy=new Map,UO=t=>{if(jy.has(t))return;const e=setTimeout(()=>{jy.delete(t),Kh({type:"REMOVE_TOAST",toastId:t})},Y$);jy.set(t,e)},Z$=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,X$)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?UO(n):t.toasts.forEach(r=>{UO(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},Vp=[];let Wp={toasts:[]};function Kh(t){Wp=Z$(Wp,t),Vp.forEach(e=>{e(Wp)})}function J$({...t}){const e=K$(),n=s=>Kh({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>Kh({type:"DISMISS_TOAST",toastId:e});return Kh({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function Pr(){const[t,e]=S.useState(Wp);return S.useEffect(()=>(Vp.push(e),()=>{const n=Vp.indexOf(e);n>-1&&Vp.splice(n,1)}),[t]),{...t,toast:J$,dismiss:n=>Kh({type:"DISMISS_TOAST",toastId:n})}}const eH=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:t=>t.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:t=>/[A-Z]/.test(t)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:t=>/[a-z]/.test(t)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:t=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(t)}];function tH(t){const e=eH.map(r=>({id:r.id,label:r.label,description:r.description,passed:r.validate(t)}));return{isValid:e.every(r=>r.passed),rules:e}}const hw="0.11.5 Beta",fw="MaiBot Dashboard",nH=`${fw} v${hw}`,rH=(t="v")=>`${t}${hw}`,Rr=W4,mw=g9,sH=$4,yT=S.forwardRef(({className:t,...e},n)=>a.jsx(nx,{ref:n,className:ye("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}));yT.displayName=nx.displayName;const Nr=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(sH,{children:[a.jsx(yT,{}),a.jsxs(rx,{ref:r,className:ye("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(H4,{className:"absolute right-4 top-4 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(Gf,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Nr.displayName=rx.displayName;const Cr=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Cr.displayName="DialogHeader";const ps=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ps.displayName="DialogFooter";const Tr=S.forwardRef(({className:t,...e},n)=>a.jsx(U4,{ref:n,className:ye("text-lg font-semibold leading-none tracking-tight",t),...e}));Tr.displayName=U4.displayName;const Gr=S.forwardRef(({className:t,...e},n)=>a.jsx(V4,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Gr.displayName=V4.displayName;var iH=Symbol("radix.slottable");function aH(t){const e=({children:n})=>a.jsx(a.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=iH,e}var bT="AlertDialog",[lH]=Vi(bT,[x9]),bl=x9(),wT=t=>{const{__scopeAlertDialog:e,...n}=t,r=bl(e);return a.jsx(W4,{...r,...n,modal:!0})};wT.displayName=bT;var oH="AlertDialogTrigger",ST=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(g9,{...s,...r,ref:e})});ST.displayName=oH;var cH="AlertDialogPortal",kT=t=>{const{__scopeAlertDialog:e,...n}=t,r=bl(e);return a.jsx($4,{...r,...n})};kT.displayName=cH;var uH="AlertDialogOverlay",OT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(nx,{...s,...r,ref:e})});OT.displayName=uH;var Uu="AlertDialogContent",[dH,hH]=lH(Uu),fH=aH("AlertDialogContent"),jT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=bl(n),l=S.useRef(null),c=Cn(e,l),d=S.useRef(null);return a.jsx(XI,{contentName:Uu,titleName:NT,docsSlug:"alert-dialog",children:a.jsx(dH,{scope:n,cancelRef:d,children:a.jsxs(rx,{role:"alertdialog",...i,...s,ref:c,onOpenAutoFocus:$e(s.onOpenAutoFocus,h=>{h.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:[a.jsx(fH,{children:r}),a.jsx(pH,{contentRef:l})]})})})});jT.displayName=Uu;var NT="AlertDialogTitle",CT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(U4,{...s,...r,ref:e})});CT.displayName=NT;var TT="AlertDialogDescription",AT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(V4,{...s,...r,ref:e})});AT.displayName=TT;var mH="AlertDialogAction",MT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(H4,{...s,...r,ref:e})});MT.displayName=mH;var ET="AlertDialogCancel",_T=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=hH(ET,n),i=bl(n),l=Cn(e,s);return a.jsx(H4,{...i,...r,ref:l})});_T.displayName=ET;var pH=({contentRef:t})=>{const e=`\`${Uu}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${Uu}\` by passing a \`${TT}\` 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 \`${Uu}\`. 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 S.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},gH=wT,xH=ST,vH=kT,DT=OT,RT=jT,zT=MT,PT=_T,BT=CT,LT=AT;const mn=gH,jr=xH,yH=vH,IT=S.forwardRef(({className:t,...e},n)=>a.jsx(DT,{className:ye("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}));IT.displayName=DT.displayName;const ln=S.forwardRef(({className:t,...e},n)=>a.jsxs(yH,{children:[a.jsx(IT,{}),a.jsx(RT,{ref:n,className:ye("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})]}));ln.displayName=RT.displayName;const on=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col space-y-2 text-center sm:text-left",t),...e});on.displayName="AlertDialogHeader";const cn=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});cn.displayName="AlertDialogFooter";const un=S.forwardRef(({className:t,...e},n)=>a.jsx(BT,{ref:n,className:ye("text-lg font-semibold",t),...e}));un.displayName=BT.displayName;const dn=S.forwardRef(({className:t,...e},n)=>a.jsx(LT,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));dn.displayName=LT.displayName;const hn=S.forwardRef(({className:t,...e},n)=>a.jsx(zT,{ref:n,className:ye(ff(),t),...e}));hn.displayName=zT.displayName;const fn=S.forwardRef(({className:t,...e},n)=>a.jsx(PT,{ref:n,className:ye(ff({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));fn.displayName=PT.displayName;function bH(){return a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),a.jsxs(hl,{defaultValue:"appearance",className:"w-full",children:[a.jsxs(ya,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[a.jsxs($t,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(_9,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"外观"})]}),a.jsxs($t,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(dq,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"安全"})]}),a.jsxs($t,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(Ii,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"其他"})]}),a.jsxs($t,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(co,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"关于"})]})]}),a.jsxs(vn,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[a.jsx(kn,{value:"appearance",className:"mt-0",children:a.jsx(wH,{})}),a.jsx(kn,{value:"security",className:"mt-0",children:a.jsx(SH,{})}),a.jsx(kn,{value:"other",className:"mt-0",children:a.jsx(kH,{})}),a.jsx(kn,{value:"about",className:"mt-0",children:a.jsx(OH,{})})]})]})]})}function VO(t){const e=document.documentElement,r={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[t];if(r)e.style.setProperty("--primary",r.hsl),r.gradient?(e.style.setProperty("--primary-gradient",r.gradient),e.classList.add("has-gradient")):(e.style.removeProperty("--primary-gradient"),e.classList.remove("has-gradient"));else if(t.startsWith("#")){const s=i=>{i=i.replace("#","");const l=parseInt(i.substring(0,2),16)/255,c=parseInt(i.substring(2,4),16)/255,d=parseInt(i.substring(4,6),16)/255,h=Math.max(l,c,d),m=Math.min(l,c,d);let p=0,x=0;const v=(h+m)/2;if(h!==m){const b=h-m;switch(x=v>.5?b/(2-h-m):b/(h+m),h){case l:p=((c-d)/b+(clocalStorage.getItem("accent-color")||"blue");S.useEffect(()=>{const h=localStorage.getItem("accent-color")||"blue";VO(h)},[]);const d=h=>{c(h),localStorage.setItem("accent-color",h),VO(h)};return a.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[a.jsx(Ny,{value:"light",current:t,onChange:e,label:"浅色",description:"始终使用浅色主题"}),a.jsx(Ny,{value:"dark",current:t,onChange:e,label:"深色",description:"始终使用深色主题"}),a.jsx(Ny,{value:"system",current:t,onChange:e,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),a.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[a.jsx(vi,{value:"blue",current:l,onChange:d,label:"蓝色",colorClass:"bg-blue-500"}),a.jsx(vi,{value:"purple",current:l,onChange:d,label:"紫色",colorClass:"bg-purple-500"}),a.jsx(vi,{value:"green",current:l,onChange:d,label:"绿色",colorClass:"bg-green-500"}),a.jsx(vi,{value:"orange",current:l,onChange:d,label:"橙色",colorClass:"bg-orange-500"}),a.jsx(vi,{value:"pink",current:l,onChange:d,label:"粉色",colorClass:"bg-pink-500"}),a.jsx(vi,{value:"red",current:l,onChange:d,label:"红色",colorClass:"bg-red-500"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),a.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[a.jsx(vi,{value:"gradient-sunset",current:l,onChange:d,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),a.jsx(vi,{value:"gradient-ocean",current:l,onChange:d,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),a.jsx(vi,{value:"gradient-forest",current:l,onChange:d,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),a.jsx(vi,{value:"gradient-aurora",current:l,onChange:d,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),a.jsx(vi,{value:"gradient-fire",current:l,onChange:d,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),a.jsx(vi,{value:"gradient-twilight",current:l,onChange:d,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[a.jsx("div",{className:"flex-1",children:a.jsx("input",{type:"color",value:l.startsWith("#")?l:"#3b82f6",onChange:h=>d(h.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),a.jsx("div",{className:"flex-1",children:a.jsx(Me,{type:"text",value:l,onChange:h=>d(h.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),a.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),a.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[a.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5 flex-1",children:[a.jsx(te,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),a.jsx(jt,{id:"animations",checked:n,onCheckedChange:r})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5 flex-1",children:[a.jsx(te,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),a.jsx(jt,{id:"waves-background",checked:s,onCheckedChange:i})]})})]})]})]})}function SH(){const t=wa(),[e,n]=S.useState(""),[r,s]=S.useState(""),[i,l]=S.useState(!1),[c,d]=S.useState(!1),[h,m]=S.useState(!1),[p,x]=S.useState(!1),[v,b]=S.useState(!1),[k,O]=S.useState(!1),[j,T]=S.useState(""),[A,_]=S.useState(!1),{toast:D}=Pr(),E=S.useMemo(()=>tH(r),[r]),R=()=>localStorage.getItem("access-token")||"",Q=async W=>{try{await navigator.clipboard.writeText(W),b(!0),D({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>b(!1),2e3)}catch{D({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},F=async()=>{if(!r.trim()){D({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!E.isValid){const W=E.rules.filter(J=>!J.passed).map(J=>J.label).join(", ");D({title:"格式错误",description:`Token 不符合要求: ${W}`,variant:"destructive"});return}m(!0);try{const W=R(),J=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${W}`},body:JSON.stringify({new_token:r.trim()})}),$=await J.json();J.ok&&$.success?(localStorage.setItem("access-token",r.trim()),s(""),e&&n(r.trim()),D({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},1500)):D({title:"更新失败",description:$.message||"无法更新 Token",variant:"destructive"})}catch(W){console.error("更新 Token 错误:",W),D({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{m(!1)}},L=async()=>{x(!0);try{const W=R(),J=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${W}`}}),$=await J.json();J.ok&&$.success?(localStorage.setItem("access-token",$.token),n($.token),T($.token),O(!0),_(!1),D({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):D({title:"生成失败",description:$.message||"无法生成新 Token",variant:"destructive"})}catch(W){console.error("生成 Token 错误:",W),D({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{x(!1)}},U=async()=>{try{await navigator.clipboard.writeText(j),_(!0),D({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{D({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},V=()=>{O(!1),setTimeout(()=>{T(""),_(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},500)},de=W=>{W||V()};return a.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[a.jsx(Rr,{open:k,onOpenChange:de,children:a.jsxs(Nr,{className:"sm:max-w-md",children:[a.jsxs(Cr,{children:[a.jsxs(Tr,{className:"flex items-center gap-2",children:[a.jsx(Hu,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),a.jsx(Gr,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[a.jsx(te,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),a.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:j})]}),a.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Hu,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),a.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[a.jsx("p",{className:"font-semibold",children:"重要提示"}),a.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[a.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),a.jsx("li",{children:"请立即复制并保存到安全的位置"}),a.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),a.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),a.jsxs(ps,{className:"gap-2 sm:gap-0",children:[a.jsx(ie,{variant:"outline",onClick:U,className:"gap-2",children:A?a.jsxs(a.Fragment,{children:[a.jsx(hc,{className:"h-4 w-4 text-green-500"}),"已复制"]}):a.jsxs(a.Fragment,{children:[a.jsx(Xb,{className:"h-4 w-4"}),"复制 Token"]})}),a.jsx(ie,{onClick:V,children:"我已保存,关闭"})]})]})}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),a.jsx("div",{className:"space-y-3 sm:space-y-4",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(Me,{id:"current-token",type:i?"text":"password",value:e||R(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),a.jsx("button",{onClick:()=>{e||n(R()),l(!i)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:i?"隐藏":"显示",children:i?a.jsx(Yb,{className:"h-4 w-4 text-muted-foreground"}):a.jsx($i,{className:"h-4 w-4 text-muted-foreground"})})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[a.jsx(ie,{variant:"outline",size:"icon",onClick:()=>Q(R()),title:"复制到剪贴板",className:"flex-shrink-0",children:v?a.jsx(hc,{className:"h-4 w-4 text-green-500"}):a.jsx(Xb,{className:"h-4 w-4"})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{variant:"outline",disabled:p,className:"gap-2 flex-1 sm:flex-none",children:[a.jsx(Fi,{className:ye("h-4 w-4",p&&"animate-spin")}),a.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),a.jsx("span",{className:"sm:hidden",children:"生成"})]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重新生成 Token"}),a.jsx(dn,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:L,children:"确认生成"})]})]})]})]})]}),a.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),a.jsxs("div",{className:"relative",children:[a.jsx(Me,{id:"new-token",type:c?"text":"password",value:r,onChange:W=>s(W.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),a.jsx("button",{onClick:()=>d(!c),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:c?"隐藏":"显示",children:c?a.jsx(Yb,{className:"h-4 w-4 text-muted-foreground"}):a.jsx($i,{className:"h-4 w-4 text-muted-foreground"})})]}),r&&a.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),a.jsx("div",{className:"space-y-1.5",children:E.rules.map(W=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[W.passed?a.jsx(Es,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):a.jsx(Kb,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),a.jsx("span",{className:ye(W.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:W.label})]},W.id))}),E.isValid&&a.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:a.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[a.jsx(hc,{className:"h-4 w-4"}),a.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),a.jsx(ie,{onClick:F,disabled:h||!E.isValid||!r,className:"w-full sm:w-auto",children:h?"更新中...":"更新自定义 Token"})]})]}),a.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[a.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),a.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),a.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),a.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),a.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),a.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),a.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function kH(){const t=wa(),{toast:e}=Pr(),[n,r]=S.useState(!1),s=async()=>{r(!0);try{const i=localStorage.getItem("access-token"),l=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${i}`}}),c=await l.json();l.ok&&c.success?(e({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{t({to:"/setup"})},1e3)):e({title:"重置失败",description:c.message||"无法重置配置状态",variant:"destructive"})}catch(i){console.error("重置配置状态错误:",i),e({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{r(!1)}};return a.jsx("div",{className:"space-y-4 sm:space-y-6",children:a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsx("div",{className:"space-y-2",children:a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{variant:"outline",disabled:n,className:"gap-2",children:[a.jsx(hq,{className:ye("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重新配置"}),a.jsx(dn,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:s,children:"确认重置"})]})]})]})]})]})})}function OH(){return a.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",fw]}),a.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[a.jsxs("p",{children:["版本: ",hw]}),a.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),a.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",a.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"React 19.2.0"}),a.jsx("li",{children:"TypeScript 5.7.2"}),a.jsx("li",{children:"Vite 6.0.7"}),a.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"shadcn/ui"}),a.jsx("li",{children:"Radix UI"}),a.jsx("li",{children:"Tailwind CSS 3.4.17"}),a.jsx("li",{children:"Lucide Icons"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"后端"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"Python 3.12+"}),a.jsx("li",{children:"FastAPI"}),a.jsx("li",{children:"Uvicorn"}),a.jsx("li",{children:"WebSocket"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"Bun / npm"}),a.jsx("li",{children:"ESLint 9.17.0"}),a.jsx("li",{children:"PostCSS"})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),a.jsx(vn,{className:"h-[300px] sm:h-[400px]",children:a.jsxs("div",{className:"space-y-4 pr-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"React",description:"用户界面构建库",license:"MIT"}),a.jsx(Gn,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),a.jsx(Gn,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),a.jsx(Gn,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),a.jsx(Gn,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),a.jsx(Gn,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),a.jsx(Gn,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),a.jsx(Gn,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),a.jsx(Gn,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),a.jsx(Gn,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),a.jsx(Gn,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),a.jsx(Gn,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),a.jsx(Gn,{name:"Pydantic",description:"数据验证库",license:"MIT"}),a.jsx(Gn,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),a.jsx(Gn,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),a.jsx(Gn,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),a.jsx(Gn,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:a.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:a.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Gn({name:t,description:e,license:n}){return a.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium text-foreground truncate",children:t}),a.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:e})]}),a.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:n})]})}function Ny({value:t,current:e,onChange:n,label:r,description:s}){const i=e===t;return a.jsxs("button",{onClick:()=>n(t),className:ye("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&a.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-sm sm:text-base font-medium",children:r}),a.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:s})]}),a.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[t==="light"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),t==="dark"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),t==="system"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function vi({value:t,current:e,onChange:n,label:r,colorClass:s}){const i=e===t;return a.jsxs("button",{onClick:()=>n(t),className:ye("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&a.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),a.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[a.jsx("div",{className:ye("h-8 w-8 sm:h-10 sm:w-10 rounded-full",s)}),a.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:r})]})]})}class jH{grad3;p;perm;constructor(e=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let n=0;n<256;n++)this.p[n]=Math.floor(Math.random()*256);this.perm=[];for(let n=0;n<512;n++)this.perm[n]=this.p[n&255]}dot(e,n,r){return e[0]*n+e[1]*r}mix(e,n,r){return(1-r)*e+r*n}fade(e){return e*e*e*(e*(e*6-15)+10)}perlin2(e,n){const r=Math.floor(e)&255,s=Math.floor(n)&255;e-=Math.floor(e),n-=Math.floor(n);const i=this.fade(e),l=this.fade(n),c=this.perm[r]+s,d=this.perm[c],h=this.perm[c+1],m=this.perm[r+1]+s,p=this.perm[m],x=this.perm[m+1];return this.mix(this.mix(this.dot(this.grad3[d%12],e,n),this.dot(this.grad3[p%12],e-1,n),i),this.mix(this.dot(this.grad3[h%12],e,n-1),this.dot(this.grad3[x%12],e-1,n-1),i),l)}}function NH(){const t=S.useRef(null),e=S.useRef(null),n=S.useRef(void 0),r=S.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new jH(Math.random()),bounding:null});return S.useEffect(()=>{const s=e.current,i=t.current;if(!s||!i)return;const l=r.current,c=()=>{const k=s.getBoundingClientRect();l.bounding=k,i.style.width=`${k.width}px`,i.style.height=`${k.height}px`},d=()=>{if(!l.bounding)return;const{width:k,height:O}=l.bounding;l.lines=[],l.paths.forEach(F=>F.remove()),l.paths=[];const j=10,T=32,A=k+200,_=O+30,D=Math.ceil(A/j),E=Math.ceil(_/T),R=(k-j*D)/2,Q=(O-T*E)/2;for(let F=0;F<=D;F++){const L=[];for(let V=0;V<=E;V++){const de={x:R+j*F,y:Q+T*V,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};L.push(de)}const U=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild(U),l.paths.push(U),l.lines.push(L)}},h=k=>{const{lines:O,mouse:j,noise:T}=l;O.forEach(A=>{A.forEach(_=>{const D=T.perlin2((_.x+k*.0125)*.002,(_.y+k*.005)*.0015)*12;_.wave.x=Math.cos(D)*32,_.wave.y=Math.sin(D)*16;const E=_.x-j.sx,R=_.y-j.sy,Q=Math.hypot(E,R),F=Math.max(175,j.vs);if(Q{const j={x:k.x+k.wave.x+(O?k.cursor.x:0),y:k.y+k.wave.y+(O?k.cursor.y:0)};return j.x=Math.round(j.x*10)/10,j.y=Math.round(j.y*10)/10,j},p=()=>{const{lines:k,paths:O}=l;k.forEach((j,T)=>{let A=m(j[0],!1),_=`M ${A.x} ${A.y}`;j.forEach((D,E)=>{const R=E===j.length-1;A=m(D,!R),_+=`L ${A.x} ${A.y}`}),O[T].setAttribute("d",_)})},x=k=>{const{mouse:O}=l;O.sx+=(O.x-O.sx)*.1,O.sy+=(O.y-O.sy)*.1;const j=O.x-O.lx,T=O.y-O.ly,A=Math.hypot(j,T);O.v=A,O.vs+=(A-O.vs)*.1,O.vs=Math.min(100,O.vs),O.lx=O.x,O.ly=O.y,O.a=Math.atan2(T,j),s&&(s.style.setProperty("--x",`${O.sx}px`),s.style.setProperty("--y",`${O.sy}px`)),h(k),p(),n.current=requestAnimationFrame(x)},v=k=>{if(!l.bounding)return;const{mouse:O}=l;O.x=k.pageX-l.bounding.left,O.y=k.pageY-l.bounding.top+window.scrollY,O.set||(O.sx=O.x,O.sy=O.y,O.lx=O.x,O.ly=O.y,O.set=!0)},b=()=>{c(),d()};return c(),d(),window.addEventListener("resize",b),window.addEventListener("mousemove",v),n.current=requestAnimationFrame(x),()=>{window.removeEventListener("resize",b),window.removeEventListener("mousemove",v),n.current&&cancelAnimationFrame(n.current)}},[]),a.jsxs("div",{ref:e,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[a.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),a.jsx("svg",{ref:t,style:{display:"block",width:"100%",height:"100%"},children:a.jsx("style",{children:` +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return S.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},gH=wT,xH=ST,vH=kT,DT=OT,RT=jT,zT=MT,PT=_T,BT=CT,LT=AT;const pn=gH,jr=xH,yH=vH,IT=S.forwardRef(({className:t,...e},n)=>a.jsx(DT,{className:ye("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}));IT.displayName=DT.displayName;const ln=S.forwardRef(({className:t,...e},n)=>a.jsxs(yH,{children:[a.jsx(IT,{}),a.jsx(RT,{ref:n,className:ye("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})]}));ln.displayName=RT.displayName;const on=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col space-y-2 text-center sm:text-left",t),...e});on.displayName="AlertDialogHeader";const cn=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});cn.displayName="AlertDialogFooter";const un=S.forwardRef(({className:t,...e},n)=>a.jsx(BT,{ref:n,className:ye("text-lg font-semibold",t),...e}));un.displayName=BT.displayName;const dn=S.forwardRef(({className:t,...e},n)=>a.jsx(LT,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));dn.displayName=LT.displayName;const hn=S.forwardRef(({className:t,...e},n)=>a.jsx(zT,{ref:n,className:ye(ff(),t),...e}));hn.displayName=zT.displayName;const fn=S.forwardRef(({className:t,...e},n)=>a.jsx(PT,{ref:n,className:ye(ff({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));fn.displayName=PT.displayName;function bH(){return a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),a.jsxs(hl,{defaultValue:"appearance",className:"w-full",children:[a.jsxs(ya,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[a.jsxs($t,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(_9,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"外观"})]}),a.jsxs($t,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(dq,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"安全"})]}),a.jsxs($t,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(Ii,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"其他"})]}),a.jsxs($t,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(co,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"关于"})]})]}),a.jsxs(mn,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[a.jsx(kn,{value:"appearance",className:"mt-0",children:a.jsx(wH,{})}),a.jsx(kn,{value:"security",className:"mt-0",children:a.jsx(SH,{})}),a.jsx(kn,{value:"other",className:"mt-0",children:a.jsx(kH,{})}),a.jsx(kn,{value:"about",className:"mt-0",children:a.jsx(OH,{})})]})]})]})}function VO(t){const e=document.documentElement,r={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[t];if(r)e.style.setProperty("--primary",r.hsl),r.gradient?(e.style.setProperty("--primary-gradient",r.gradient),e.classList.add("has-gradient")):(e.style.removeProperty("--primary-gradient"),e.classList.remove("has-gradient"));else if(t.startsWith("#")){const s=i=>{i=i.replace("#","");const l=parseInt(i.substring(0,2),16)/255,c=parseInt(i.substring(2,4),16)/255,d=parseInt(i.substring(4,6),16)/255,h=Math.max(l,c,d),m=Math.min(l,c,d);let p=0,x=0;const v=(h+m)/2;if(h!==m){const b=h-m;switch(x=v>.5?b/(2-h-m):b/(h+m),h){case l:p=((c-d)/b+(clocalStorage.getItem("accent-color")||"blue");S.useEffect(()=>{const h=localStorage.getItem("accent-color")||"blue";VO(h)},[]);const d=h=>{c(h),localStorage.setItem("accent-color",h),VO(h)};return a.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[a.jsx(Ny,{value:"light",current:t,onChange:e,label:"浅色",description:"始终使用浅色主题"}),a.jsx(Ny,{value:"dark",current:t,onChange:e,label:"深色",description:"始终使用深色主题"}),a.jsx(Ny,{value:"system",current:t,onChange:e,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),a.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[a.jsx(vi,{value:"blue",current:l,onChange:d,label:"蓝色",colorClass:"bg-blue-500"}),a.jsx(vi,{value:"purple",current:l,onChange:d,label:"紫色",colorClass:"bg-purple-500"}),a.jsx(vi,{value:"green",current:l,onChange:d,label:"绿色",colorClass:"bg-green-500"}),a.jsx(vi,{value:"orange",current:l,onChange:d,label:"橙色",colorClass:"bg-orange-500"}),a.jsx(vi,{value:"pink",current:l,onChange:d,label:"粉色",colorClass:"bg-pink-500"}),a.jsx(vi,{value:"red",current:l,onChange:d,label:"红色",colorClass:"bg-red-500"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),a.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[a.jsx(vi,{value:"gradient-sunset",current:l,onChange:d,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),a.jsx(vi,{value:"gradient-ocean",current:l,onChange:d,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),a.jsx(vi,{value:"gradient-forest",current:l,onChange:d,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),a.jsx(vi,{value:"gradient-aurora",current:l,onChange:d,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),a.jsx(vi,{value:"gradient-fire",current:l,onChange:d,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),a.jsx(vi,{value:"gradient-twilight",current:l,onChange:d,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[a.jsx("div",{className:"flex-1",children:a.jsx("input",{type:"color",value:l.startsWith("#")?l:"#3b82f6",onChange:h=>d(h.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),a.jsx("div",{className:"flex-1",children:a.jsx(Me,{type:"text",value:l,onChange:h=>d(h.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),a.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),a.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[a.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5 flex-1",children:[a.jsx(te,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),a.jsx(jt,{id:"animations",checked:n,onCheckedChange:r})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5 flex-1",children:[a.jsx(te,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),a.jsx(jt,{id:"waves-background",checked:s,onCheckedChange:i})]})})]})]})]})}function SH(){const t=wa(),[e,n]=S.useState(""),[r,s]=S.useState(""),[i,l]=S.useState(!1),[c,d]=S.useState(!1),[h,m]=S.useState(!1),[p,x]=S.useState(!1),[v,b]=S.useState(!1),[k,O]=S.useState(!1),[j,T]=S.useState(""),[A,_]=S.useState(!1),{toast:D}=Pr(),E=S.useMemo(()=>tH(r),[r]),z=()=>localStorage.getItem("access-token")||"",Q=async W=>{try{await navigator.clipboard.writeText(W),b(!0),D({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>b(!1),2e3)}catch{D({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},F=async()=>{if(!r.trim()){D({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!E.isValid){const W=E.rules.filter(J=>!J.passed).map(J=>J.label).join(", ");D({title:"格式错误",description:`Token 不符合要求: ${W}`,variant:"destructive"});return}m(!0);try{const W=z(),J=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${W}`},body:JSON.stringify({new_token:r.trim()})}),$=await J.json();J.ok&&$.success?(localStorage.setItem("access-token",r.trim()),s(""),e&&n(r.trim()),D({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},1500)):D({title:"更新失败",description:$.message||"无法更新 Token",variant:"destructive"})}catch(W){console.error("更新 Token 错误:",W),D({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{m(!1)}},L=async()=>{x(!0);try{const W=z(),J=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${W}`}}),$=await J.json();J.ok&&$.success?(localStorage.setItem("access-token",$.token),n($.token),T($.token),O(!0),_(!1),D({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):D({title:"生成失败",description:$.message||"无法生成新 Token",variant:"destructive"})}catch(W){console.error("生成 Token 错误:",W),D({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{x(!1)}},U=async()=>{try{await navigator.clipboard.writeText(j),_(!0),D({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{D({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},V=()=>{O(!1),setTimeout(()=>{T(""),_(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},500)},ce=W=>{W||V()};return a.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[a.jsx(Rr,{open:k,onOpenChange:ce,children:a.jsxs(Nr,{className:"sm:max-w-md",children:[a.jsxs(Cr,{children:[a.jsxs(Tr,{className:"flex items-center gap-2",children:[a.jsx(Hu,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),a.jsx(Gr,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[a.jsx(te,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),a.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:j})]}),a.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Hu,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),a.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[a.jsx("p",{className:"font-semibold",children:"重要提示"}),a.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[a.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),a.jsx("li",{children:"请立即复制并保存到安全的位置"}),a.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),a.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),a.jsxs(ps,{className:"gap-2 sm:gap-0",children:[a.jsx(ie,{variant:"outline",onClick:U,className:"gap-2",children:A?a.jsxs(a.Fragment,{children:[a.jsx(hc,{className:"h-4 w-4 text-green-500"}),"已复制"]}):a.jsxs(a.Fragment,{children:[a.jsx(Xb,{className:"h-4 w-4"}),"复制 Token"]})}),a.jsx(ie,{onClick:V,children:"我已保存,关闭"})]})]})}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),a.jsx("div",{className:"space-y-3 sm:space-y-4",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(Me,{id:"current-token",type:i?"text":"password",value:e||z(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),a.jsx("button",{onClick:()=>{e||n(z()),l(!i)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:i?"隐藏":"显示",children:i?a.jsx(Yb,{className:"h-4 w-4 text-muted-foreground"}):a.jsx($i,{className:"h-4 w-4 text-muted-foreground"})})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[a.jsx(ie,{variant:"outline",size:"icon",onClick:()=>Q(z()),title:"复制到剪贴板",className:"flex-shrink-0",children:v?a.jsx(hc,{className:"h-4 w-4 text-green-500"}):a.jsx(Xb,{className:"h-4 w-4"})}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{variant:"outline",disabled:p,className:"gap-2 flex-1 sm:flex-none",children:[a.jsx(Fi,{className:ye("h-4 w-4",p&&"animate-spin")}),a.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),a.jsx("span",{className:"sm:hidden",children:"生成"})]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重新生成 Token"}),a.jsx(dn,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:L,children:"确认生成"})]})]})]})]})]}),a.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),a.jsxs("div",{className:"relative",children:[a.jsx(Me,{id:"new-token",type:c?"text":"password",value:r,onChange:W=>s(W.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),a.jsx("button",{onClick:()=>d(!c),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:c?"隐藏":"显示",children:c?a.jsx(Yb,{className:"h-4 w-4 text-muted-foreground"}):a.jsx($i,{className:"h-4 w-4 text-muted-foreground"})})]}),r&&a.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),a.jsx("div",{className:"space-y-1.5",children:E.rules.map(W=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[W.passed?a.jsx(Es,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):a.jsx(Kb,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),a.jsx("span",{className:ye(W.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:W.label})]},W.id))}),E.isValid&&a.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:a.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[a.jsx(hc,{className:"h-4 w-4"}),a.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),a.jsx(ie,{onClick:F,disabled:h||!E.isValid||!r,className:"w-full sm:w-auto",children:h?"更新中...":"更新自定义 Token"})]})]}),a.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[a.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),a.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),a.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),a.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),a.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),a.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),a.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function kH(){const t=wa(),{toast:e}=Pr(),[n,r]=S.useState(!1),s=async()=>{r(!0);try{const i=localStorage.getItem("access-token"),l=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${i}`}}),c=await l.json();l.ok&&c.success?(e({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{t({to:"/setup"})},1e3)):e({title:"重置失败",description:c.message||"无法重置配置状态",variant:"destructive"})}catch(i){console.error("重置配置状态错误:",i),e({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{r(!1)}};return a.jsx("div",{className:"space-y-4 sm:space-y-6",children:a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsx("div",{className:"space-y-2",children:a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{variant:"outline",disabled:n,className:"gap-2",children:[a.jsx(hq,{className:ye("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重新配置"}),a.jsx(dn,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:s,children:"确认重置"})]})]})]})]})]})})}function OH(){return a.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",fw]}),a.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[a.jsxs("p",{children:["版本: ",hw]}),a.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),a.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",a.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"React 19.2.0"}),a.jsx("li",{children:"TypeScript 5.7.2"}),a.jsx("li",{children:"Vite 6.0.7"}),a.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"shadcn/ui"}),a.jsx("li",{children:"Radix UI"}),a.jsx("li",{children:"Tailwind CSS 3.4.17"}),a.jsx("li",{children:"Lucide Icons"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"后端"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"Python 3.12+"}),a.jsx("li",{children:"FastAPI"}),a.jsx("li",{children:"Uvicorn"}),a.jsx("li",{children:"WebSocket"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"Bun / npm"}),a.jsx("li",{children:"ESLint 9.17.0"}),a.jsx("li",{children:"PostCSS"})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),a.jsx(mn,{className:"h-[300px] sm:h-[400px]",children:a.jsxs("div",{className:"space-y-4 pr-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"React",description:"用户界面构建库",license:"MIT"}),a.jsx(Gn,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),a.jsx(Gn,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),a.jsx(Gn,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),a.jsx(Gn,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),a.jsx(Gn,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),a.jsx(Gn,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),a.jsx(Gn,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),a.jsx(Gn,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),a.jsx(Gn,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),a.jsx(Gn,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),a.jsx(Gn,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),a.jsx(Gn,{name:"Pydantic",description:"数据验证库",license:"MIT"}),a.jsx(Gn,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),a.jsx(Gn,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),a.jsx(Gn,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),a.jsx(Gn,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:a.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:a.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Gn({name:t,description:e,license:n}){return a.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium text-foreground truncate",children:t}),a.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:e})]}),a.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:n})]})}function Ny({value:t,current:e,onChange:n,label:r,description:s}){const i=e===t;return a.jsxs("button",{onClick:()=>n(t),className:ye("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&a.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-sm sm:text-base font-medium",children:r}),a.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:s})]}),a.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[t==="light"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),t==="dark"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),t==="system"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function vi({value:t,current:e,onChange:n,label:r,colorClass:s}){const i=e===t;return a.jsxs("button",{onClick:()=>n(t),className:ye("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&a.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),a.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[a.jsx("div",{className:ye("h-8 w-8 sm:h-10 sm:w-10 rounded-full",s)}),a.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:r})]})]})}class jH{grad3;p;perm;constructor(e=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let n=0;n<256;n++)this.p[n]=Math.floor(Math.random()*256);this.perm=[];for(let n=0;n<512;n++)this.perm[n]=this.p[n&255]}dot(e,n,r){return e[0]*n+e[1]*r}mix(e,n,r){return(1-r)*e+r*n}fade(e){return e*e*e*(e*(e*6-15)+10)}perlin2(e,n){const r=Math.floor(e)&255,s=Math.floor(n)&255;e-=Math.floor(e),n-=Math.floor(n);const i=this.fade(e),l=this.fade(n),c=this.perm[r]+s,d=this.perm[c],h=this.perm[c+1],m=this.perm[r+1]+s,p=this.perm[m],x=this.perm[m+1];return this.mix(this.mix(this.dot(this.grad3[d%12],e,n),this.dot(this.grad3[p%12],e-1,n),i),this.mix(this.dot(this.grad3[h%12],e,n-1),this.dot(this.grad3[x%12],e-1,n-1),i),l)}}function NH(){const t=S.useRef(null),e=S.useRef(null),n=S.useRef(void 0),r=S.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new jH(Math.random()),bounding:null});return S.useEffect(()=>{const s=e.current,i=t.current;if(!s||!i)return;const l=r.current,c=()=>{const k=s.getBoundingClientRect();l.bounding=k,i.style.width=`${k.width}px`,i.style.height=`${k.height}px`},d=()=>{if(!l.bounding)return;const{width:k,height:O}=l.bounding;l.lines=[],l.paths.forEach(F=>F.remove()),l.paths=[];const j=10,T=32,A=k+200,_=O+30,D=Math.ceil(A/j),E=Math.ceil(_/T),z=(k-j*D)/2,Q=(O-T*E)/2;for(let F=0;F<=D;F++){const L=[];for(let V=0;V<=E;V++){const ce={x:z+j*F,y:Q+T*V,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};L.push(ce)}const U=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild(U),l.paths.push(U),l.lines.push(L)}},h=k=>{const{lines:O,mouse:j,noise:T}=l;O.forEach(A=>{A.forEach(_=>{const D=T.perlin2((_.x+k*.0125)*.002,(_.y+k*.005)*.0015)*12;_.wave.x=Math.cos(D)*32,_.wave.y=Math.sin(D)*16;const E=_.x-j.sx,z=_.y-j.sy,Q=Math.hypot(E,z),F=Math.max(175,j.vs);if(Q{const j={x:k.x+k.wave.x+(O?k.cursor.x:0),y:k.y+k.wave.y+(O?k.cursor.y:0)};return j.x=Math.round(j.x*10)/10,j.y=Math.round(j.y*10)/10,j},p=()=>{const{lines:k,paths:O}=l;k.forEach((j,T)=>{let A=m(j[0],!1),_=`M ${A.x} ${A.y}`;j.forEach((D,E)=>{const z=E===j.length-1;A=m(D,!z),_+=`L ${A.x} ${A.y}`}),O[T].setAttribute("d",_)})},x=k=>{const{mouse:O}=l;O.sx+=(O.x-O.sx)*.1,O.sy+=(O.y-O.sy)*.1;const j=O.x-O.lx,T=O.y-O.ly,A=Math.hypot(j,T);O.v=A,O.vs+=(A-O.vs)*.1,O.vs=Math.min(100,O.vs),O.lx=O.x,O.ly=O.y,O.a=Math.atan2(T,j),s&&(s.style.setProperty("--x",`${O.sx}px`),s.style.setProperty("--y",`${O.sy}px`)),h(k),p(),n.current=requestAnimationFrame(x)},v=k=>{if(!l.bounding)return;const{mouse:O}=l;O.x=k.pageX-l.bounding.left,O.y=k.pageY-l.bounding.top+window.scrollY,O.set||(O.sx=O.x,O.sy=O.y,O.lx=O.x,O.ly=O.y,O.set=!0)},b=()=>{c(),d()};return c(),d(),window.addEventListener("resize",b),window.addEventListener("mousemove",v),n.current=requestAnimationFrame(x),()=>{window.removeEventListener("resize",b),window.removeEventListener("mousemove",v),n.current&&cancelAnimationFrame(n.current)}},[]),a.jsxs("div",{ref:e,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[a.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),a.jsx("svg",{ref:t,style:{display:"block",width:"100%",height:"100%"},children:a.jsx("style",{children:` path { fill: none; stroke: hsl(var(--primary) / 0.20); stroke-width: 1px; } - `})})]})}function CH(){const t=wa();S.useEffect(()=>{localStorage.getItem("access-token")||t({to:"/auth"})},[t])}function qT(){return!!localStorage.getItem("access-token")}function TH(){const[t,e]=S.useState(""),[n,r]=S.useState(!1),[s,i]=S.useState(""),l=wa(),{enableWavesBackground:c,setEnableWavesBackground:d}=hT(),{theme:h,setTheme:m}=dw();S.useEffect(()=>{qT()&&l({to:"/"})},[l]);const x=h==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":h,v=()=>{m(x==="dark"?"light":"dark")},b=async k=>{if(k.preventDefault(),i(""),!t.trim()){i("请输入 Access Token");return}r(!0);try{const O=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t.trim()})}),j=await O.json();if(O.ok&&j.valid){localStorage.setItem("access-token",t.trim());const T=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${t.trim()}`}}),A=await T.json();T.ok&&A.is_first_setup?l({to:"/setup"}):l({to:"/"})}else i(j.message||"Token 验证失败,请检查后重试")}catch(O){console.error("Token 验证错误:",O),i("连接服务器失败,请检查网络连接")}finally{r(!1)}};return a.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[c&&a.jsx(NH,{}),a.jsxs(gt,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[a.jsx("button",{onClick:v,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:x==="dark"?"切换到浅色模式":"切换到深色模式",children:x==="dark"?a.jsx(Zb,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):a.jsx(Jb,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),a.jsxs(Wt,{className:"space-y-4 text-center",children:[a.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:a.jsx(lO,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Gt,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),a.jsx(Sr,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),a.jsx(an,{children:a.jsxs("form",{onSubmit:b,className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),a.jsxs("div",{className:"relative",children:[a.jsx(fq,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),a.jsx(Me,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:t,onChange:k=>e(k.target.value),className:ye("pl-10",s&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),s&&a.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[a.jsx(xc,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),a.jsx("span",{children:s})]}),a.jsx(ie,{type:"submit",className:"w-full",disabled:n,children:n?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),a.jsxs(Rr,{children:[a.jsx(mw,{asChild:!0,children:a.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[a.jsx(mq,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),a.jsxs(Nr,{className:"sm:max-w-md",children:[a.jsxs(Cr,{children:[a.jsxs(Tr,{className:"flex items-center gap-2",children:[a.jsx(lO,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),a.jsx(Gr,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(pq,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),a.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[a.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),a.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ao,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),a.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:a.jsx("code",{className:"text-primary",children:"data/webui.json"})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",a.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),a.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(xc,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[a.jsx("p",{className:"font-semibold",children:"安全提示"}),a.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[a.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),a.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[a.jsx(uf,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsxs(un,{className:"flex items-center gap-2",children:[a.jsx(uf,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),a.jsx(dn,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>d(!1),children:"关闭动画"})]})]})]})]})})]}),a.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:a.jsx("p",{children:nH})})]})}const _n=S.forwardRef(({className:t,...e},n)=>a.jsx("textarea",{className:ye("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...e}));_n.displayName="Textarea";var AH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],MH=AH.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),EH="Separator",WO="horizontal",_H=["horizontal","vertical"],FT=S.forwardRef((t,e)=>{const{decorative:n,orientation:r=WO,...s}=t,i=DH(r)?r:WO,c=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return a.jsx(MH.div,{"data-orientation":i,...c,...s,ref:e})});FT.displayName=EH;function DH(t){return _H.includes(t)}var QT=FT;const mf=S.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},s)=>a.jsx(QT,{ref:s,decorative:n,orientation:e,className:ye("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));mf.displayName=QT.displayName;const RH=Nd("inline-flex items-center rounded-md 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 shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function On({className:t,variant:e,...n}){return a.jsx("div",{className:ye(RH({variant:e}),t),...n})}function zH({config:t,onChange:e}){const n=s=>{s.trim()&&!t.alias_names.includes(s.trim())&&e({...t,alias_names:[...t.alias_names,s.trim()]})},r=s=>{e({...t,alias_names:t.alias_names.filter((i,l)=>l!==s)})};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"qq_account",children:"QQ账号 *"}),a.jsx(Me,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:t.qq_account||"",onChange:s=>e({...t,qq_account:Number(s.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称 *"}),a.jsx(Me,{id:"nickname",placeholder:"请输入机器人的昵称",value:t.nickname,onChange:s=>e({...t,nickname:s.target.value})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{children:"别名"}),a.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.alias_names.map((s,i)=>a.jsxs(On,{variant:"secondary",className:"gap-1",children:[s,a.jsx("button",{type:"button",onClick:()=>r(i),className:"ml-1 hover:text-destructive",children:a.jsx(Gf,{className:"h-3 w-3"})})]},i))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:s=>{s.key==="Enter"&&(n(s.target.value),s.target.value="")}}),a.jsx(ie,{type:"button",variant:"outline",onClick:()=>{const s=document.getElementById("alias_input");s&&(n(s.value),s.value="")},children:"添加"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function PH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"personality",children:"人格特征 *"}),a.jsx(_n,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:t.personality,onChange:n=>e({...t,personality:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"reply_style",children:"表达风格 *"}),a.jsx(_n,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:t.reply_style,onChange:n=>e({...t,reply_style:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"interest",children:"兴趣 *"}),a.jsx(_n,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:t.interest,onChange:n=>e({...t,interest:n.target.value}),rows:2}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),a.jsx(mf,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"plan_style",children:"群聊说话规则 *"}),a.jsx(_n,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:t.plan_style,onChange:n=>e({...t,plan_style:n.target.value}),rows:4}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),a.jsx(_n,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:t.private_plan_style,onChange:n=>e({...t,private_plan_style:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function BH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{htmlFor:"emoji_chance",children:"表情包激活概率"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[(t.emoji_chance*100).toFixed(0),"%"]})]}),a.jsx(Me,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:t.emoji_chance,onChange:n=>e({...t,emoji_chance:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"max_reg_num",children:"最大表情包数量"}),a.jsx(Me,{id:"max_reg_num",type:"number",min:"1",max:"200",value:t.max_reg_num,onChange:n=>e({...t,max_reg_num:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"do_replace",children:"达到最大数量时替换"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),a.jsx(jt,{id:"do_replace",checked:t.do_replace,onCheckedChange:n=>e({...t,do_replace:n})})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),a.jsx(Me,{id:"check_interval",type:"number",min:"1",max:"120",value:t.check_interval,onChange:n=>e({...t,check_interval:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"steal_emoji",children:"偷取表情包"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),a.jsx(jt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:n=>e({...t,steal_emoji:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"content_filtration",children:"启用表情包过滤"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),a.jsx(jt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:n=>e({...t,content_filtration:n})})]}),t.content_filtration&&a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"filtration_prompt",children:"过滤要求"}),a.jsx(Me,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:t.filtration_prompt,onChange:n=>e({...t,filtration_prompt:n.target.value})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function LH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"enable_tool",children:"启用工具系统"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),a.jsx(jt,{id:"enable_tool",checked:t.enable_tool,onCheckedChange:n=>e({...t,enable_tool:n})})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"enable_mood",children:"启用情绪系统"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),a.jsx(jt,{id:"enable_mood",checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})})]}),t.enable_mood&&a.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),a.jsx(Me,{id:"mood_update_threshold",type:"number",min:"0.1",max:"10",step:"0.1",value:t.mood_update_threshold||1,onChange:n=>e({...t,mood_update_threshold:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"emotion_style",children:"情感特征"}),a.jsx(_n,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:t.emotion_style||"",onChange:n=>e({...t,emotion_style:n.target.value}),rows:2}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"all_global",children:"启用全局黑话模式"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),a.jsx(jt,{id:"all_global",checked:t.all_global,onCheckedChange:n=>e({...t,all_global:n})})]})]})}async function ot(t,e){const n=await fetch(t,e);if(n.status===401)throw localStorage.removeItem("access-token"),window.location.href="/auth",new Error("认证失败,请重新登录");return n}function bt(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function IH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取Bot配置失败");const n=(await t.json()).config.bot||{};return{qq_account:n.qq_account||0,nickname:n.nickname||"",alias_names:n.alias_names||[]}}async function qH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取人格配置失败");const n=(await t.json()).config.personality||{};return{personality:n.personality||"",reply_style:n.reply_style||"",interest:n.interest||"",plan_style:n.plan_style||"",private_plan_style:n.private_plan_style||""}}async function FH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取表情包配置失败");const n=(await t.json()).config.emoji||{};return{emoji_chance:n.emoji_chance??.4,max_reg_num:n.max_reg_num??40,do_replace:n.do_replace??!0,check_interval:n.check_interval??10,steal_emoji:n.steal_emoji??!0,content_filtration:n.content_filtration??!1,filtration_prompt:n.filtration_prompt||""}}async function QH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取其他配置失败");const n=(await t.json()).config,r=n.tool||{},s=n.mood||{},i=n.jargon||{};return{enable_tool:r.enable_tool??!0,enable_mood:s.enable_mood??!1,mood_update_threshold:s.mood_update_threshold,emotion_style:s.emotion_style,all_global:i.all_global??!0}}async function $H(t){const e=await ot("/api/webui/config/bot/section/bot",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await e.json()}async function HH(t){const e=await ot("/api/webui/config/bot/section/personality",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存人格配置失败")}return await e.json()}async function UH(t){const e=await ot("/api/webui/config/bot/section/emoji",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存表情包配置失败")}return await e.json()}async function VH(t){const e=[];e.push(ot("/api/webui/config/bot/section/tool",{method:"POST",headers:bt(),body:JSON.stringify({enable_tool:t.enable_tool})})),e.push(ot("/api/webui/config/bot/section/jargon",{method:"POST",headers:bt(),body:JSON.stringify({all_global:t.all_global})}));const n={enable_mood:t.enable_mood};t.enable_mood&&(n.mood_update_threshold=t.mood_update_threshold||1,n.emotion_style=t.emotion_style||""),e.push(ot("/api/webui/config/bot/section/mood",{method:"POST",headers:bt(),body:JSON.stringify(n)}));const r=await Promise.all(e);for(const s of r)if(!s.ok){const i=await s.json();throw new Error(i.detail||"保存其他配置失败")}return{success:!0}}async function GO(){const t=localStorage.getItem("access-token"),e=await ot("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!e.ok){const n=await e.json();throw new Error(n.message||"标记配置完成失败")}return await e.json()}function WH(){const t=wa(),{toast:e}=Pr(),[n,r]=S.useState(0),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!0),[m,p]=S.useState({qq_account:0,nickname:"",alias_names:[]}),[x,v]=S.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 + `})})]})}function CH(){const t=wa();S.useEffect(()=>{localStorage.getItem("access-token")||t({to:"/auth"})},[t])}function qT(){return!!localStorage.getItem("access-token")}function TH(){const[t,e]=S.useState(""),[n,r]=S.useState(!1),[s,i]=S.useState(""),l=wa(),{enableWavesBackground:c,setEnableWavesBackground:d}=hT(),{theme:h,setTheme:m}=dw();S.useEffect(()=>{qT()&&l({to:"/"})},[l]);const x=h==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":h,v=()=>{m(x==="dark"?"light":"dark")},b=async k=>{if(k.preventDefault(),i(""),!t.trim()){i("请输入 Access Token");return}r(!0);try{const O=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t.trim()})}),j=await O.json();if(O.ok&&j.valid){localStorage.setItem("access-token",t.trim());const T=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${t.trim()}`}}),A=await T.json();T.ok&&A.is_first_setup?l({to:"/setup"}):l({to:"/"})}else i(j.message||"Token 验证失败,请检查后重试")}catch(O){console.error("Token 验证错误:",O),i("连接服务器失败,请检查网络连接")}finally{r(!1)}};return a.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[c&&a.jsx(NH,{}),a.jsxs(gt,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[a.jsx("button",{onClick:v,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:x==="dark"?"切换到浅色模式":"切换到深色模式",children:x==="dark"?a.jsx(Zb,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):a.jsx(Jb,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),a.jsxs(Wt,{className:"space-y-4 text-center",children:[a.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:a.jsx(lO,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Gt,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),a.jsx(Sr,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),a.jsx(an,{children:a.jsxs("form",{onSubmit:b,className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),a.jsxs("div",{className:"relative",children:[a.jsx(fq,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),a.jsx(Me,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:t,onChange:k=>e(k.target.value),className:ye("pl-10",s&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),s&&a.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[a.jsx(xc,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),a.jsx("span",{children:s})]}),a.jsx(ie,{type:"submit",className:"w-full",disabled:n,children:n?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),a.jsxs(Rr,{children:[a.jsx(mw,{asChild:!0,children:a.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[a.jsx(mq,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),a.jsxs(Nr,{className:"sm:max-w-md",children:[a.jsxs(Cr,{children:[a.jsxs(Tr,{className:"flex items-center gap-2",children:[a.jsx(lO,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),a.jsx(Gr,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(pq,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),a.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[a.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),a.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ao,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),a.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:a.jsx("code",{className:"text-primary",children:"data/webui.json"})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",a.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),a.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(xc,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[a.jsx("p",{className:"font-semibold",children:"安全提示"}),a.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[a.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),a.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[a.jsx(uf,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsxs(un,{className:"flex items-center gap-2",children:[a.jsx(uf,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),a.jsx(dn,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>d(!1),children:"关闭动画"})]})]})]})]})})]}),a.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:a.jsx("p",{children:nH})})]})}const _n=S.forwardRef(({className:t,...e},n)=>a.jsx("textarea",{className:ye("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...e}));_n.displayName="Textarea";var AH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],MH=AH.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),EH="Separator",WO="horizontal",_H=["horizontal","vertical"],FT=S.forwardRef((t,e)=>{const{decorative:n,orientation:r=WO,...s}=t,i=DH(r)?r:WO,c=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return a.jsx(MH.div,{"data-orientation":i,...c,...s,ref:e})});FT.displayName=EH;function DH(t){return _H.includes(t)}var QT=FT;const mf=S.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},s)=>a.jsx(QT,{ref:s,decorative:n,orientation:e,className:ye("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));mf.displayName=QT.displayName;const RH=Nd("inline-flex items-center rounded-md 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 shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function On({className:t,variant:e,...n}){return a.jsx("div",{className:ye(RH({variant:e}),t),...n})}function zH({config:t,onChange:e}){const n=s=>{s.trim()&&!t.alias_names.includes(s.trim())&&e({...t,alias_names:[...t.alias_names,s.trim()]})},r=s=>{e({...t,alias_names:t.alias_names.filter((i,l)=>l!==s)})};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"qq_account",children:"QQ账号 *"}),a.jsx(Me,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:t.qq_account||"",onChange:s=>e({...t,qq_account:Number(s.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称 *"}),a.jsx(Me,{id:"nickname",placeholder:"请输入机器人的昵称",value:t.nickname,onChange:s=>e({...t,nickname:s.target.value})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{children:"别名"}),a.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.alias_names.map((s,i)=>a.jsxs(On,{variant:"secondary",className:"gap-1",children:[s,a.jsx("button",{type:"button",onClick:()=>r(i),className:"ml-1 hover:text-destructive",children:a.jsx(Gf,{className:"h-3 w-3"})})]},i))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:s=>{s.key==="Enter"&&(n(s.target.value),s.target.value="")}}),a.jsx(ie,{type:"button",variant:"outline",onClick:()=>{const s=document.getElementById("alias_input");s&&(n(s.value),s.value="")},children:"添加"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function PH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"personality",children:"人格特征 *"}),a.jsx(_n,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:t.personality,onChange:n=>e({...t,personality:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"reply_style",children:"表达风格 *"}),a.jsx(_n,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:t.reply_style,onChange:n=>e({...t,reply_style:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"interest",children:"兴趣 *"}),a.jsx(_n,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:t.interest,onChange:n=>e({...t,interest:n.target.value}),rows:2}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),a.jsx(mf,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"plan_style",children:"群聊说话规则 *"}),a.jsx(_n,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:t.plan_style,onChange:n=>e({...t,plan_style:n.target.value}),rows:4}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),a.jsx(_n,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:t.private_plan_style,onChange:n=>e({...t,private_plan_style:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function BH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{htmlFor:"emoji_chance",children:"表情包激活概率"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[(t.emoji_chance*100).toFixed(0),"%"]})]}),a.jsx(Me,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:t.emoji_chance,onChange:n=>e({...t,emoji_chance:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"max_reg_num",children:"最大表情包数量"}),a.jsx(Me,{id:"max_reg_num",type:"number",min:"1",max:"200",value:t.max_reg_num,onChange:n=>e({...t,max_reg_num:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"do_replace",children:"达到最大数量时替换"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),a.jsx(jt,{id:"do_replace",checked:t.do_replace,onCheckedChange:n=>e({...t,do_replace:n})})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),a.jsx(Me,{id:"check_interval",type:"number",min:"1",max:"120",value:t.check_interval,onChange:n=>e({...t,check_interval:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"steal_emoji",children:"偷取表情包"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),a.jsx(jt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:n=>e({...t,steal_emoji:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"content_filtration",children:"启用表情包过滤"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),a.jsx(jt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:n=>e({...t,content_filtration:n})})]}),t.content_filtration&&a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"filtration_prompt",children:"过滤要求"}),a.jsx(Me,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:t.filtration_prompt,onChange:n=>e({...t,filtration_prompt:n.target.value})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function LH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"enable_tool",children:"启用工具系统"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),a.jsx(jt,{id:"enable_tool",checked:t.enable_tool,onCheckedChange:n=>e({...t,enable_tool:n})})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"enable_mood",children:"启用情绪系统"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),a.jsx(jt,{id:"enable_mood",checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})})]}),t.enable_mood&&a.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),a.jsx(Me,{id:"mood_update_threshold",type:"number",min:"0.1",max:"10",step:"0.1",value:t.mood_update_threshold||1,onChange:n=>e({...t,mood_update_threshold:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"emotion_style",children:"情感特征"}),a.jsx(_n,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:t.emotion_style||"",onChange:n=>e({...t,emotion_style:n.target.value}),rows:2}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"all_global",children:"启用全局黑话模式"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),a.jsx(jt,{id:"all_global",checked:t.all_global,onCheckedChange:n=>e({...t,all_global:n})})]})]})}async function ot(t,e){const n=await fetch(t,e);if(n.status===401)throw localStorage.removeItem("access-token"),window.location.href="/auth",new Error("认证失败,请重新登录");return n}function bt(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function IH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取Bot配置失败");const n=(await t.json()).config.bot||{};return{qq_account:n.qq_account||0,nickname:n.nickname||"",alias_names:n.alias_names||[]}}async function qH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取人格配置失败");const n=(await t.json()).config.personality||{};return{personality:n.personality||"",reply_style:n.reply_style||"",interest:n.interest||"",plan_style:n.plan_style||"",private_plan_style:n.private_plan_style||""}}async function FH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取表情包配置失败");const n=(await t.json()).config.emoji||{};return{emoji_chance:n.emoji_chance??.4,max_reg_num:n.max_reg_num??40,do_replace:n.do_replace??!0,check_interval:n.check_interval??10,steal_emoji:n.steal_emoji??!0,content_filtration:n.content_filtration??!1,filtration_prompt:n.filtration_prompt||""}}async function QH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取其他配置失败");const n=(await t.json()).config,r=n.tool||{},s=n.mood||{},i=n.jargon||{};return{enable_tool:r.enable_tool??!0,enable_mood:s.enable_mood??!1,mood_update_threshold:s.mood_update_threshold,emotion_style:s.emotion_style,all_global:i.all_global??!0}}async function $H(t){const e=await ot("/api/webui/config/bot/section/bot",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await e.json()}async function HH(t){const e=await ot("/api/webui/config/bot/section/personality",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存人格配置失败")}return await e.json()}async function UH(t){const e=await ot("/api/webui/config/bot/section/emoji",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存表情包配置失败")}return await e.json()}async function VH(t){const e=[];e.push(ot("/api/webui/config/bot/section/tool",{method:"POST",headers:bt(),body:JSON.stringify({enable_tool:t.enable_tool})})),e.push(ot("/api/webui/config/bot/section/jargon",{method:"POST",headers:bt(),body:JSON.stringify({all_global:t.all_global})}));const n={enable_mood:t.enable_mood};t.enable_mood&&(n.mood_update_threshold=t.mood_update_threshold||1,n.emotion_style=t.emotion_style||""),e.push(ot("/api/webui/config/bot/section/mood",{method:"POST",headers:bt(),body:JSON.stringify(n)}));const r=await Promise.all(e);for(const s of r)if(!s.ok){const i=await s.json();throw new Error(i.detail||"保存其他配置失败")}return{success:!0}}async function GO(){const t=localStorage.getItem("access-token"),e=await ot("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!e.ok){const n=await e.json();throw new Error(n.message||"标记配置完成失败")}return await e.json()}function WH(){const t=wa(),{toast:e}=Pr(),[n,r]=S.useState(0),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!0),[m,p]=S.useState({qq_account:0,nickname:"",alias_names:[]}),[x,v]=S.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 3.请控制你的发言频率,不要太过频繁的发言 4.如果有人对你感到厌烦,请减少回复 5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 -3.某句话如果已经被回复过,不要重复回复`}),[b,k]=S.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[O,j]=S.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遭遇特定事件的时候起伏较大",all_global:!0}),T=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:xq},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:D9},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:K4},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:Ii},{id:"complete",title:"完成设置",description:"后续配置提示",icon:uf}],A=(n+1)/T.length*100;S.useEffect(()=>{(async()=>{try{h(!0);const[U,V,de,W]=await Promise.all([IH(),qH(),FH(),QH()]);p(U),v(V),k(de),j(W)}catch(U){e({title:"加载配置失败",description:U instanceof Error?U.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{h(!1)}})()},[e]);const _=async()=>{c(!0);try{switch(n){case 0:await $H(m);break;case 1:await HH(x);break;case 2:await UH(b);break;case 3:await VH(O);break}return e({title:"保存成功",description:`${T[n].title}配置已保存`}),!0}catch(L){return e({title:"保存失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"}),!1}finally{c(!1)}},D=async()=>{await _()&&n{n>0&&r(n-1)},R=async()=>{i(!0);try{if(!await _()){i(!1);return}await GO(),e({title:"配置完成",description:"所有配置已保存,正在跳转..."}),setTimeout(()=>{t({to:"/"})},500)}catch(L){e({title:"完成失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}finally{i(!1)}},Q=async()=>{try{await GO(),t({to:"/"})}catch(L){e({title:"跳过失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},F=()=>{switch(n){case 0:return a.jsx(zH,{config:m,onChange:p});case 1:return a.jsx(PH,{config:x,onChange:v});case 2:return a.jsx(BH,{config:b,onChange:k});case 3:return a.jsx(LH,{config:O,onChange:j});case 4:return a.jsxs("div",{className:"space-y-6 text-center py-8",children:[a.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:a.jsx(uf,{className:"h-8 w-8 text-primary",strokeWidth:2})}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h3",{className:"text-xl font-semibold",children:"模型配置"}),a.jsx("p",{className:"text-muted-foreground max-w-md mx-auto",children:"为了让机器人正常工作,您需要配置 AI 模型提供商和模型。"})]}),a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-6 max-w-md mx-auto text-left space-y-4",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"1"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"配置 API 提供商"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → API 提供商"中添加您的 API 提供商信息'})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"2"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"添加模型"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型列表"中添加需要使用的模型'})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"3"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"配置模型任务"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型任务配置"中为不同任务分配模型'})]})]})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"💡 提示:完成向导后,您可以在系统设置中进行详细的模型配置"})]});default:return null}};return a.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[a.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[a.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),a.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),d?a.jsxs("div",{className:"relative z-10 text-center",children:[a.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:a.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),a.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),a.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[a.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[a.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:a.jsx(gq,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),a.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),a.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",fw," 的初始配置"]})]}),a.jsxs("div",{className:"mb-6 md:mb-8",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[a.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",T.length]}),a.jsxs("span",{className:"font-medium text-primary",children:[Math.round(A),"%"]})]}),a.jsx(n0,{value:A,className:"h-2"})]}),a.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:T.map((L,U)=>{const V=L.icon;return a.jsxs("div",{className:ye("flex flex-1 flex-col items-center gap-1 md:gap-2",Ut({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[a.jsx(hg,{className:"h-4 w-4"}),"返回首页"]}),a.jsxs(ie,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[a.jsx(R9,{className:"h-4 w-4"}),"返回上一页"]})]}),a.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var HT=["PageUp","PageDown"],UT=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],VT={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Cd="Slider",[c2,GH,XH]=tx(Cd),[WT]=Vi(Cd,[XH]),[YH,vx]=WT(Cd),GT=S.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:l="horizontal",disabled:c=!1,minStepsBetweenThumbs:d=0,defaultValue:h=[r],value:m,onValueChange:p=()=>{},onValueCommit:x=()=>{},inverted:v=!1,form:b,...k}=t,O=S.useRef(new Set),j=S.useRef(0),A=l==="horizontal"?KH:ZH,[_=[],D]=ko({prop:m,defaultProp:h,onChange:U=>{[...O.current][j.current]?.focus(),p(U)}}),E=S.useRef(_);function R(U){const V=rU(_,U);L(U,V)}function Q(U){L(U,j.current)}function F(){const U=E.current[j.current];_[j.current]!==U&&x(_)}function L(U,V,{commit:de}={commit:!1}){const W=lU(i),J=oU(Math.round((U-r)/i)*i+r,W),$=F4(J,[r,s]);D((ae=[])=>{const ne=tU(ae,$,V);if(aU(ne,d*i)){j.current=ne.indexOf($);const ce=String(ne)!==String(ae);return ce&&de&&x(ne),ce?ne:ae}else return ae})}return a.jsx(YH,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:s,valueIndexToChangeRef:j,thumbs:O.current,values:_,orientation:l,form:b,children:a.jsx(c2.Provider,{scope:t.__scopeSlider,children:a.jsx(c2.Slot,{scope:t.__scopeSlider,children:a.jsx(A,{"aria-disabled":c,"data-disabled":c?"":void 0,...k,ref:e,onPointerDown:$e(k.onPointerDown,()=>{c||(E.current=_)}),min:r,max:s,inverted:v,onSlideStart:c?void 0:R,onSlideMove:c?void 0:Q,onSlideEnd:c?void 0:F,onHomeKeyDown:()=>!c&&L(r,0,{commit:!0}),onEndKeyDown:()=>!c&&L(s,_.length-1,{commit:!0}),onStepKeyDown:({event:U,direction:V})=>{if(!c){const J=HT.includes(U.key)||U.shiftKey&&UT.includes(U.key)?10:1,$=j.current,ae=_[$],ne=i*J*V;L(ae+ne,$,{commit:!0})}}})})})})});GT.displayName=Cd;var[XT,YT]=WT(Cd,{startEdge:"left",endEdge:"right",size:"width",direction:1}),KH=S.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:l,onSlideMove:c,onSlideEnd:d,onStepKeyDown:h,...m}=t,[p,x]=S.useState(null),v=Cn(e,A=>x(A)),b=S.useRef(void 0),k=Vf(s),O=k==="ltr",j=O&&!i||!O&&i;function T(A){const _=b.current||p.getBoundingClientRect(),D=[0,_.width],R=pw(D,j?[n,r]:[r,n]);return b.current=_,R(A-_.left)}return a.jsx(XT,{scope:t.__scopeSlider,startEdge:j?"left":"right",endEdge:j?"right":"left",direction:j?1:-1,size:"width",children:a.jsx(KT,{dir:k,"data-orientation":"horizontal",...m,ref:v,style:{...m.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:A=>{const _=T(A.clientX);l?.(_)},onSlideMove:A=>{const _=T(A.clientX);c?.(_)},onSlideEnd:()=>{b.current=void 0,d?.()},onStepKeyDown:A=>{const D=VT[j?"from-left":"from-right"].includes(A.key);h?.({event:A,direction:D?-1:1})}})})}),ZH=S.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...h}=t,m=S.useRef(null),p=Cn(e,m),x=S.useRef(void 0),v=!s;function b(k){const O=x.current||m.current.getBoundingClientRect(),j=[0,O.height],A=pw(j,v?[r,n]:[n,r]);return x.current=O,A(k-O.top)}return a.jsx(XT,{scope:t.__scopeSlider,startEdge:v?"bottom":"top",endEdge:v?"top":"bottom",size:"height",direction:v?1:-1,children:a.jsx(KT,{"data-orientation":"vertical",...h,ref:p,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:k=>{const O=b(k.clientY);i?.(O)},onSlideMove:k=>{const O=b(k.clientY);l?.(O)},onSlideEnd:()=>{x.current=void 0,c?.()},onStepKeyDown:k=>{const j=VT[v?"from-bottom":"from-top"].includes(k.key);d?.({event:k,direction:j?-1:1})}})})}),KT=S.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:l,onEndKeyDown:c,onStepKeyDown:d,...h}=t,m=vx(Cd,n);return a.jsx(Zt.span,{...h,ref:e,onKeyDown:$e(t.onKeyDown,p=>{p.key==="Home"?(l(p),p.preventDefault()):p.key==="End"?(c(p),p.preventDefault()):HT.concat(UT).includes(p.key)&&(d(p),p.preventDefault())}),onPointerDown:$e(t.onPointerDown,p=>{const x=p.target;x.setPointerCapture(p.pointerId),p.preventDefault(),m.thumbs.has(x)?x.focus():r(p)}),onPointerMove:$e(t.onPointerMove,p=>{p.target.hasPointerCapture(p.pointerId)&&s(p)}),onPointerUp:$e(t.onPointerUp,p=>{const x=p.target;x.hasPointerCapture(p.pointerId)&&(x.releasePointerCapture(p.pointerId),i(p))})})}),ZT="SliderTrack",JT=S.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=vx(ZT,n);return a.jsx(Zt.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});JT.displayName=ZT;var u2="SliderRange",eA=S.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=vx(u2,n),i=YT(u2,n),l=S.useRef(null),c=Cn(e,l),d=s.values.length,h=s.values.map(x=>rA(x,s.min,s.max)),m=d>1?Math.min(...h):0,p=100-Math.max(...h);return a.jsx(Zt.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:m+"%",[i.endEdge]:p+"%"}})});eA.displayName=u2;var d2="SliderThumb",tA=S.forwardRef((t,e)=>{const n=GH(t.__scopeSlider),[r,s]=S.useState(null),i=Cn(e,c=>s(c)),l=S.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return a.jsx(JH,{...t,ref:i,index:l})}),JH=S.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...i}=t,l=vx(d2,n),c=YT(d2,n),[d,h]=S.useState(null),m=Cn(e,T=>h(T)),p=d?l.form||!!d.closest("form"):!0,x=m9(d),v=l.values[r],b=v===void 0?0:rA(v,l.min,l.max),k=nU(r,l.values.length),O=x?.[c.size],j=O?sU(O,b,c.direction):0;return S.useEffect(()=>{if(d)return l.thumbs.add(d),()=>{l.thumbs.delete(d)}},[d,l.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${b}% + ${j}px)`},children:[a.jsx(c2.ItemSlot,{scope:t.__scopeSlider,children:a.jsx(Zt.span,{role:"slider","aria-label":t["aria-label"]||k,"aria-valuemin":l.min,"aria-valuenow":v,"aria-valuemax":l.max,"aria-orientation":l.orientation,"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,tabIndex:l.disabled?void 0:0,...i,ref:m,style:v===void 0?{display:"none"}:t.style,onFocus:$e(t.onFocus,()=>{l.valueIndexToChangeRef.current=r})})}),p&&a.jsx(nA,{name:s??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:v},r)]})});tA.displayName=d2;var eU="RadioBubbleInput",nA=S.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=S.useRef(null),i=Cn(s,r),l=f9(e);return S.useEffect(()=>{const c=s.current;if(!c)return;const d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==e&&m){const p=new Event("input",{bubbles:!0});m.call(c,e),c.dispatchEvent(p)}},[l,e]),a.jsx(Zt.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});nA.displayName=eU;function tU(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,i)=>s-i)}function rA(t,e,n){const i=100/(n-e)*(t-e);return F4(i,[0,100])}function nU(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function rU(t,e){if(t.length===1)return 0;const n=t.map(s=>Math.abs(s-e)),r=Math.min(...n);return n.indexOf(r)}function sU(t,e,n){const r=t/2,i=pw([0,50],[0,r]);return(r-i(e)*n)*n}function iU(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function aU(t,e){if(e>0){const n=iU(t);return Math.min(...n)>=e}return!0}function pw(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 lU(t){return(String(t).split(".")[1]||"").length}function oU(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var sA=GT,cU=JT,uU=eA,dU=tA;const yx=S.forwardRef(({className:t,...e},n)=>a.jsxs(sA,{ref:n,className:ye("relative flex w-full touch-none select-none items-center",t),...e,children:[a.jsx(cU,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:a.jsx(uU,{className:"absolute h-full bg-primary"})}),a.jsx(dU,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));yx.displayName=sA.displayName;const Lt=tq,It=nq,Dt=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(v9,{ref:r,className:ye("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,a.jsx(YI,{asChild:!0,children:a.jsx(df,{className:"h-4 w-4 opacity-50"})})]}));Dt.displayName=v9.displayName;const iA=S.forwardRef(({className:t,...e},n)=>a.jsx(y9,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(e2,{className:"h-4 w-4"})}));iA.displayName=y9.displayName;const aA=S.forwardRef(({className:t,...e},n)=>a.jsx(b9,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(df,{className:"h-4 w-4"})}));aA.displayName=b9.displayName;const Rt=S.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>a.jsx(KI,{children:a.jsxs(w9,{ref:s,className:ye("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 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 origin-[--radix-select-content-transform-origin]",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(iA,{}),a.jsx(ZI,{className:ye("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(aA,{})]})}));Rt.displayName=w9.displayName;const hU=S.forwardRef(({className:t,...e},n)=>a.jsx(S9,{ref:n,className:ye("px-2 py-1.5 text-sm font-semibold",t),...e}));hU.displayName=S9.displayName;const Pe=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(k9,{ref:r,className:ye("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[a.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(JI,{children:a.jsx(hc,{className:"h-4 w-4"})})}),a.jsx(eq,{children:e})]}));Pe.displayName=k9.displayName;const fU=S.forwardRef(({className:t,...e},n)=>a.jsx(O9,{ref:n,className:ye("-mx-1 my-1 h-px bg-muted",t),...e}));fU.displayName=O9.displayName;function mU(t){const e=pU(t),n=S.forwardRef((r,s)=>{const{children:i,...l}=r,c=S.Children.toArray(i),d=c.find(xU);if(d){const h=d.props.children,m=c.map(p=>p===d?S.Children.count(h)>1?S.Children.only(null):S.isValidElement(h)?h.props.children:null:p);return a.jsx(e,{...l,ref:s,children:S.isValidElement(h)?S.cloneElement(h,void 0,m):null})}return a.jsx(e,{...l,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function pU(t){const e=S.forwardRef((n,r)=>{const{children:s,...i}=n;if(S.isValidElement(s)){const l=yU(s),c=vU(i,s.props);return s.type!==S.Fragment&&(c.ref=r?oo(r,l):l),S.cloneElement(s,c)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var gU=Symbol("radix.slottable");function xU(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===gU}function vU(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...c)=>{const d=i(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function yU(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var bx="Popover",[lA]=Vi(bx,[wd]),r0=wd(),[bU,Oo]=lA(bx),oA=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:l=!1}=t,c=r0(e),d=S.useRef(null),[h,m]=S.useState(!1),[p,x]=ko({prop:r,defaultProp:s??!1,onChange:i,caller:bx});return a.jsx(ix,{...c,children:a.jsx(bU,{scope:e,contentId:ji(),triggerRef:d,open:p,onOpenChange:x,onOpenToggle:S.useCallback(()=>x(v=>!v),[x]),hasCustomAnchor:h,onCustomAnchorAdd:S.useCallback(()=>m(!0),[]),onCustomAnchorRemove:S.useCallback(()=>m(!1),[]),modal:l,children:n})})};oA.displayName=bx;var cA="PopoverAnchor",wU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Oo(cA,n),i=r0(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=s;return S.useEffect(()=>(l(),()=>c()),[l,c]),a.jsx(ax,{...i,...r,ref:e})});wU.displayName=cA;var uA="PopoverTrigger",dA=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Oo(uA,n),i=r0(n),l=Cn(e,s.triggerRef),c=a.jsx(Zt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":gA(s.open),...r,ref:l,onClick:$e(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:a.jsx(ax,{asChild:!0,...i,children:c})});dA.displayName=uA;var gw="PopoverPortal",[SU,kU]=lA(gw,{forceMount:void 0}),hA=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=Oo(gw,e);return a.jsx(SU,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};hA.displayName=gw;var ad="PopoverContent",fA=S.forwardRef((t,e)=>{const n=kU(ad,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=Oo(ad,t.__scopePopover);return a.jsx(Ls,{present:r||i.open,children:i.modal?a.jsx(jU,{...s,ref:e}):a.jsx(NU,{...s,ref:e})})});fA.displayName=ad;var OU=mU("PopoverContent.RemoveScroll"),jU=S.forwardRef((t,e)=>{const n=Oo(ad,t.__scopePopover),r=S.useRef(null),s=Cn(e,r),i=S.useRef(!1);return S.useEffect(()=>{const l=r.current;if(l)return j9(l)},[]),a.jsx(N9,{as:OU,allowPinchZoom:!0,children:a.jsx(mA,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:$e(t.onCloseAutoFocus,l=>{l.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:$e(t.onPointerDownOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,h=c.button===2||d;i.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:$e(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),NU=S.forwardRef((t,e)=>{const n=Oo(ad,t.__scopePopover),r=S.useRef(!1),s=S.useRef(!1);return a.jsx(mA,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=i.target;n.triggerRef.current?.contains(l)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),mA=S.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:m,...p}=t,x=Oo(ad,n),v=r0(n);return C9(),a.jsx(T9,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:m,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onDismiss:()=>x.onOpenChange(!1),children:a.jsx(X4,{"data-state":gA(x.open),role:"dialog",id:x.contentId,...v,...p,ref:e,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),pA="PopoverClose",CU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Oo(pA,n);return a.jsx(Zt.button,{type:"button",...r,ref:e,onClick:$e(t.onClick,()=>s.onOpenChange(!1))})});CU.displayName=pA;var TU="PopoverArrow",AU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=r0(n);return a.jsx(Y4,{...s,...r,ref:e})});AU.displayName=TU;function gA(t){return t?"open":"closed"}var MU=oA,EU=dA,_U=hA,xA=fA;const uo=MU,ho=EU,fl=S.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>a.jsx(_U,{children:a.jsx(xA,{ref:s,align:e,sideOffset:n,className:ye("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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 origin-[--radix-popover-content-transform-origin]",t),...r})}));fl.displayName=xA.displayName;const jo="/api/webui/config";async function DU(){const e=await(await ot(`${jo}/bot`)).json();if(!e.success)throw new Error("获取配置数据失败");return e.config}async function Vu(){const e=await(await ot(`${jo}/model`)).json();if(!e.success)throw new Error("获取模型配置数据失败");return e.config}async function XO(t){const n=await(await ot(`${jo}/bot`,{method:"POST",headers:bt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function RU(){const e=await(await ot(`${jo}/bot/raw`)).json();if(!e.success)throw new Error("获取配置源代码失败");return e.content}async function zU(t){const n=await(await ot(`${jo}/bot/raw`,{method:"POST",headers:bt(),body:JSON.stringify({raw_content:t})})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function wg(t){const n=await(await ot(`${jo}/model`,{method:"POST",headers:bt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function PU(t,e){const r=await(await ot(`${jo}/bot/section/${t}`,{method:"POST",headers:bt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function h2(t,e){const r=await(await ot(`${jo}/model/section/${t}`,{method:"POST",headers:bt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}const BU=Zn.create({baseURL:"",timeout:1e4});async function xw(){try{return(await BU.post("/api/webui/system/restart")).data}catch(t){throw console.error("重启麦麦失败:",t),t}}const LU=Nd("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),ld=S.forwardRef(({className:t,variant:e,...n},r)=>a.jsx("div",{ref:r,role:"alert",className:ye(LU({variant:e}),t),...n}));ld.displayName="Alert";const IU=S.forwardRef(({className:t,...e},n)=>a.jsx("h5",{ref:n,className:ye("mb-1 font-medium leading-none tracking-tight",t),...e}));IU.displayName="AlertTitle";const od=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("text-sm [&_p]:leading-relaxed",t),...e}));od.displayName="AlertDescription";function vw({onRestartComplete:t,onRestartFailed:e}){const[n,r]=S.useState(0),[s,i]=S.useState("restarting"),[l,c]=S.useState(0),[d,h]=S.useState(0);S.useEffect(()=>{const x=setInterval(()=>{r(k=>k>=90?k:k+1)},200),v=setInterval(()=>{c(k=>k+1)},1e3),b=setTimeout(()=>{i("checking"),m()},3e3);return()=>{clearInterval(x),clearInterval(v),clearTimeout(b)}},[]);const m=()=>{const v=async()=>{try{if(h(k=>k+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)r(100),i("success"),setTimeout(()=>{t?.()},1500);else throw new Error("Status check failed")}catch{d<60?setTimeout(v,2e3):(i("failed"),e?.())}};v()},p=x=>{const v=Math.floor(x/60),b=x%60;return`${v}:${b.toString().padStart(2,"0")}`};return a.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:a.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[a.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s==="restarting"&&a.jsxs(a.Fragment,{children:[a.jsx(hf,{className:"h-16 w-16 text-primary animate-spin"}),a.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),s==="checking"&&a.jsxs(a.Fragment,{children:[a.jsx(hf,{className:"h-16 w-16 text-primary animate-spin"}),a.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),a.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",d,"/60)"]})]}),s==="success"&&a.jsxs(a.Fragment,{children:[a.jsx(Es,{className:"h-16 w-16 text-green-500"}),a.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),s==="failed"&&a.jsxs(a.Fragment,{children:[a.jsx(xc,{className:"h-16 w-16 text-destructive"}),a.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),s!=="failed"&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(n0,{value:n,className:"h-2"}),a.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[a.jsxs("span",{children:[n,"%"]}),a.jsxs("span",{children:["已用时: ",p(l)]})]})]}),a.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="restarting"&&"🔄 配置已保存,正在重启主程序...",s==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",s==="success"&&"✅ 配置已生效,服务运行正常",s==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),s==="failed"&&a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),a.jsx("button",{onClick:()=>{i("checking"),h(0),m()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}let f2=[],vA=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e>1;if(t=vA[r])e=r+1;else return!0;if(e==n)return!1}}function YO(t){return t>=127462&&t<=127487}const KO=8205;function FU(t,e,n=!0,r=!0){return(n?yA:QU)(t,e,r)}function yA(t,e,n){if(e==t.length)return e;e&&bA(t.charCodeAt(e))&&wA(t.charCodeAt(e-1))&&e--;let r=Cy(t,e);for(e+=ZO(r);e=0&&YO(Cy(t,l));)i++,l-=2;if(i%2==0)break;e+=2}else break}return e}function QU(t,e,n){for(;e>0;){let r=yA(t,e-2,n);if(r=56320&&t<57344}function wA(t){return t>=55296&&t<56320}function ZO(t){return t<65536?1:2}class Xt{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=cd(this,e,n);let s=[];return this.decompose(0,e,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(n,this.length,s,1),Gp.from(s,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=cd(this,e,n);let r=[];return this.decompose(e,n,r,0),Gp.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),s=new Zh(this),i=new Zh(e);for(let l=n,c=n;;){if(s.next(l),i.next(l),l=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(c+=s.value.length,s.done||c>=r)return!0}}iter(e=1){return new Zh(this,e)}iterRange(e,n=this.length){return new SA(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let s=this.line(e).from;r=this.iterRange(s,Math.max(s,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new kA(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Xt.empty:e.length<=32?new ir(e):Gp.from(ir.split(e,[]))}}class ir extends Xt{constructor(e,n=$U(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,s){for(let i=0;;i++){let l=this.text[i],c=s+l.length;if((n?r:c)>=e)return new HU(s,c,r,l);s=c+1,r++}}decompose(e,n,r,s){let i=e<=0&&n>=this.length?this:new ir(JO(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let l=r.pop(),c=Xp(i.text,l.text.slice(),0,i.length);if(c.length<=32)r.push(new ir(c,l.length+i.length));else{let d=c.length>>1;r.push(new ir(c.slice(0,d)),new ir(c.slice(d)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof ir))return super.replace(e,n,r);[e,n]=cd(this,e,n);let s=Xp(this.text,Xp(r.text,JO(this.text,0,e)),n),i=this.length+r.length-(n-e);return s.length<=32?new ir(s,i):Gp.from(ir.split(s,[]),i)}sliceString(e,n=this.length,r=` +3.某句话如果已经被回复过,不要重复回复`}),[b,k]=S.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[O,j]=S.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遭遇特定事件的时候起伏较大",all_global:!0}),T=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:xq},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:D9},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:K4},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:Ii},{id:"complete",title:"完成设置",description:"后续配置提示",icon:uf}],A=(n+1)/T.length*100;S.useEffect(()=>{(async()=>{try{h(!0);const[U,V,ce,W]=await Promise.all([IH(),qH(),FH(),QH()]);p(U),v(V),k(ce),j(W)}catch(U){e({title:"加载配置失败",description:U instanceof Error?U.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{h(!1)}})()},[e]);const _=async()=>{c(!0);try{switch(n){case 0:await $H(m);break;case 1:await HH(x);break;case 2:await UH(b);break;case 3:await VH(O);break}return e({title:"保存成功",description:`${T[n].title}配置已保存`}),!0}catch(L){return e({title:"保存失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"}),!1}finally{c(!1)}},D=async()=>{await _()&&n{n>0&&r(n-1)},z=async()=>{i(!0);try{if(!await _()){i(!1);return}await GO(),e({title:"配置完成",description:"所有配置已保存,正在跳转..."}),setTimeout(()=>{t({to:"/"})},500)}catch(L){e({title:"完成失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}finally{i(!1)}},Q=async()=>{try{await GO(),t({to:"/"})}catch(L){e({title:"跳过失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},F=()=>{switch(n){case 0:return a.jsx(zH,{config:m,onChange:p});case 1:return a.jsx(PH,{config:x,onChange:v});case 2:return a.jsx(BH,{config:b,onChange:k});case 3:return a.jsx(LH,{config:O,onChange:j});case 4:return a.jsxs("div",{className:"space-y-6 text-center py-8",children:[a.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:a.jsx(uf,{className:"h-8 w-8 text-primary",strokeWidth:2})}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h3",{className:"text-xl font-semibold",children:"模型配置"}),a.jsx("p",{className:"text-muted-foreground max-w-md mx-auto",children:"为了让机器人正常工作,您需要配置 AI 模型提供商和模型。"})]}),a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-6 max-w-md mx-auto text-left space-y-4",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"1"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"配置 API 提供商"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → API 提供商"中添加您的 API 提供商信息'})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"2"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"添加模型"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型列表"中添加需要使用的模型'})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"3"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"配置模型任务"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型任务配置"中为不同任务分配模型'})]})]})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"💡 提示:完成向导后,您可以在系统设置中进行详细的模型配置"})]});default:return null}};return a.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[a.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[a.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),a.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),d?a.jsxs("div",{className:"relative z-10 text-center",children:[a.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:a.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),a.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),a.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[a.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[a.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:a.jsx(gq,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),a.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),a.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",fw," 的初始配置"]})]}),a.jsxs("div",{className:"mb-6 md:mb-8",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[a.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",T.length]}),a.jsxs("span",{className:"font-medium text-primary",children:[Math.round(A),"%"]})]}),a.jsx(n0,{value:A,className:"h-2"})]}),a.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:T.map((L,U)=>{const V=L.icon;return a.jsxs("div",{className:ye("flex flex-1 flex-col items-center gap-1 md:gap-2",Ut({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[a.jsx(hg,{className:"h-4 w-4"}),"返回首页"]}),a.jsxs(ie,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[a.jsx(R9,{className:"h-4 w-4"}),"返回上一页"]})]}),a.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var HT=["PageUp","PageDown"],UT=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],VT={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Cd="Slider",[c2,GH,XH]=tx(Cd),[WT]=Vi(Cd,[XH]),[YH,vx]=WT(Cd),GT=S.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:l="horizontal",disabled:c=!1,minStepsBetweenThumbs:d=0,defaultValue:h=[r],value:m,onValueChange:p=()=>{},onValueCommit:x=()=>{},inverted:v=!1,form:b,...k}=t,O=S.useRef(new Set),j=S.useRef(0),A=l==="horizontal"?KH:ZH,[_=[],D]=ko({prop:m,defaultProp:h,onChange:U=>{[...O.current][j.current]?.focus(),p(U)}}),E=S.useRef(_);function z(U){const V=rU(_,U);L(U,V)}function Q(U){L(U,j.current)}function F(){const U=E.current[j.current];_[j.current]!==U&&x(_)}function L(U,V,{commit:ce}={commit:!1}){const W=lU(i),J=oU(Math.round((U-r)/i)*i+r,W),$=F4(J,[r,s]);D((ae=[])=>{const ne=tU(ae,$,V);if(aU(ne,d*i)){j.current=ne.indexOf($);const ue=String(ne)!==String(ae);return ue&&ce&&x(ne),ue?ne:ae}else return ae})}return a.jsx(YH,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:s,valueIndexToChangeRef:j,thumbs:O.current,values:_,orientation:l,form:b,children:a.jsx(c2.Provider,{scope:t.__scopeSlider,children:a.jsx(c2.Slot,{scope:t.__scopeSlider,children:a.jsx(A,{"aria-disabled":c,"data-disabled":c?"":void 0,...k,ref:e,onPointerDown:$e(k.onPointerDown,()=>{c||(E.current=_)}),min:r,max:s,inverted:v,onSlideStart:c?void 0:z,onSlideMove:c?void 0:Q,onSlideEnd:c?void 0:F,onHomeKeyDown:()=>!c&&L(r,0,{commit:!0}),onEndKeyDown:()=>!c&&L(s,_.length-1,{commit:!0}),onStepKeyDown:({event:U,direction:V})=>{if(!c){const J=HT.includes(U.key)||U.shiftKey&&UT.includes(U.key)?10:1,$=j.current,ae=_[$],ne=i*J*V;L(ae+ne,$,{commit:!0})}}})})})})});GT.displayName=Cd;var[XT,YT]=WT(Cd,{startEdge:"left",endEdge:"right",size:"width",direction:1}),KH=S.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:l,onSlideMove:c,onSlideEnd:d,onStepKeyDown:h,...m}=t,[p,x]=S.useState(null),v=Cn(e,A=>x(A)),b=S.useRef(void 0),k=Vf(s),O=k==="ltr",j=O&&!i||!O&&i;function T(A){const _=b.current||p.getBoundingClientRect(),D=[0,_.width],z=pw(D,j?[n,r]:[r,n]);return b.current=_,z(A-_.left)}return a.jsx(XT,{scope:t.__scopeSlider,startEdge:j?"left":"right",endEdge:j?"right":"left",direction:j?1:-1,size:"width",children:a.jsx(KT,{dir:k,"data-orientation":"horizontal",...m,ref:v,style:{...m.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:A=>{const _=T(A.clientX);l?.(_)},onSlideMove:A=>{const _=T(A.clientX);c?.(_)},onSlideEnd:()=>{b.current=void 0,d?.()},onStepKeyDown:A=>{const D=VT[j?"from-left":"from-right"].includes(A.key);h?.({event:A,direction:D?-1:1})}})})}),ZH=S.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...h}=t,m=S.useRef(null),p=Cn(e,m),x=S.useRef(void 0),v=!s;function b(k){const O=x.current||m.current.getBoundingClientRect(),j=[0,O.height],A=pw(j,v?[r,n]:[n,r]);return x.current=O,A(k-O.top)}return a.jsx(XT,{scope:t.__scopeSlider,startEdge:v?"bottom":"top",endEdge:v?"top":"bottom",size:"height",direction:v?1:-1,children:a.jsx(KT,{"data-orientation":"vertical",...h,ref:p,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:k=>{const O=b(k.clientY);i?.(O)},onSlideMove:k=>{const O=b(k.clientY);l?.(O)},onSlideEnd:()=>{x.current=void 0,c?.()},onStepKeyDown:k=>{const j=VT[v?"from-bottom":"from-top"].includes(k.key);d?.({event:k,direction:j?-1:1})}})})}),KT=S.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:l,onEndKeyDown:c,onStepKeyDown:d,...h}=t,m=vx(Cd,n);return a.jsx(Zt.span,{...h,ref:e,onKeyDown:$e(t.onKeyDown,p=>{p.key==="Home"?(l(p),p.preventDefault()):p.key==="End"?(c(p),p.preventDefault()):HT.concat(UT).includes(p.key)&&(d(p),p.preventDefault())}),onPointerDown:$e(t.onPointerDown,p=>{const x=p.target;x.setPointerCapture(p.pointerId),p.preventDefault(),m.thumbs.has(x)?x.focus():r(p)}),onPointerMove:$e(t.onPointerMove,p=>{p.target.hasPointerCapture(p.pointerId)&&s(p)}),onPointerUp:$e(t.onPointerUp,p=>{const x=p.target;x.hasPointerCapture(p.pointerId)&&(x.releasePointerCapture(p.pointerId),i(p))})})}),ZT="SliderTrack",JT=S.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=vx(ZT,n);return a.jsx(Zt.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});JT.displayName=ZT;var u2="SliderRange",eA=S.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=vx(u2,n),i=YT(u2,n),l=S.useRef(null),c=Cn(e,l),d=s.values.length,h=s.values.map(x=>rA(x,s.min,s.max)),m=d>1?Math.min(...h):0,p=100-Math.max(...h);return a.jsx(Zt.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:m+"%",[i.endEdge]:p+"%"}})});eA.displayName=u2;var d2="SliderThumb",tA=S.forwardRef((t,e)=>{const n=GH(t.__scopeSlider),[r,s]=S.useState(null),i=Cn(e,c=>s(c)),l=S.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return a.jsx(JH,{...t,ref:i,index:l})}),JH=S.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...i}=t,l=vx(d2,n),c=YT(d2,n),[d,h]=S.useState(null),m=Cn(e,T=>h(T)),p=d?l.form||!!d.closest("form"):!0,x=m9(d),v=l.values[r],b=v===void 0?0:rA(v,l.min,l.max),k=nU(r,l.values.length),O=x?.[c.size],j=O?sU(O,b,c.direction):0;return S.useEffect(()=>{if(d)return l.thumbs.add(d),()=>{l.thumbs.delete(d)}},[d,l.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${b}% + ${j}px)`},children:[a.jsx(c2.ItemSlot,{scope:t.__scopeSlider,children:a.jsx(Zt.span,{role:"slider","aria-label":t["aria-label"]||k,"aria-valuemin":l.min,"aria-valuenow":v,"aria-valuemax":l.max,"aria-orientation":l.orientation,"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,tabIndex:l.disabled?void 0:0,...i,ref:m,style:v===void 0?{display:"none"}:t.style,onFocus:$e(t.onFocus,()=>{l.valueIndexToChangeRef.current=r})})}),p&&a.jsx(nA,{name:s??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:v},r)]})});tA.displayName=d2;var eU="RadioBubbleInput",nA=S.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=S.useRef(null),i=Cn(s,r),l=f9(e);return S.useEffect(()=>{const c=s.current;if(!c)return;const d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==e&&m){const p=new Event("input",{bubbles:!0});m.call(c,e),c.dispatchEvent(p)}},[l,e]),a.jsx(Zt.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});nA.displayName=eU;function tU(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,i)=>s-i)}function rA(t,e,n){const i=100/(n-e)*(t-e);return F4(i,[0,100])}function nU(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function rU(t,e){if(t.length===1)return 0;const n=t.map(s=>Math.abs(s-e)),r=Math.min(...n);return n.indexOf(r)}function sU(t,e,n){const r=t/2,i=pw([0,50],[0,r]);return(r-i(e)*n)*n}function iU(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function aU(t,e){if(e>0){const n=iU(t);return Math.min(...n)>=e}return!0}function pw(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 lU(t){return(String(t).split(".")[1]||"").length}function oU(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var sA=GT,cU=JT,uU=eA,dU=tA;const yx=S.forwardRef(({className:t,...e},n)=>a.jsxs(sA,{ref:n,className:ye("relative flex w-full touch-none select-none items-center",t),...e,children:[a.jsx(cU,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:a.jsx(uU,{className:"absolute h-full bg-primary"})}),a.jsx(dU,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));yx.displayName=sA.displayName;const Lt=tq,It=nq,Dt=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(v9,{ref:r,className:ye("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,a.jsx(YI,{asChild:!0,children:a.jsx(df,{className:"h-4 w-4 opacity-50"})})]}));Dt.displayName=v9.displayName;const iA=S.forwardRef(({className:t,...e},n)=>a.jsx(y9,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(e2,{className:"h-4 w-4"})}));iA.displayName=y9.displayName;const aA=S.forwardRef(({className:t,...e},n)=>a.jsx(b9,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(df,{className:"h-4 w-4"})}));aA.displayName=b9.displayName;const Rt=S.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>a.jsx(KI,{children:a.jsxs(w9,{ref:s,className:ye("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 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 origin-[--radix-select-content-transform-origin]",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(iA,{}),a.jsx(ZI,{className:ye("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(aA,{})]})}));Rt.displayName=w9.displayName;const hU=S.forwardRef(({className:t,...e},n)=>a.jsx(S9,{ref:n,className:ye("px-2 py-1.5 text-sm font-semibold",t),...e}));hU.displayName=S9.displayName;const Pe=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(k9,{ref:r,className:ye("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[a.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(JI,{children:a.jsx(hc,{className:"h-4 w-4"})})}),a.jsx(eq,{children:e})]}));Pe.displayName=k9.displayName;const fU=S.forwardRef(({className:t,...e},n)=>a.jsx(O9,{ref:n,className:ye("-mx-1 my-1 h-px bg-muted",t),...e}));fU.displayName=O9.displayName;function mU(t){const e=pU(t),n=S.forwardRef((r,s)=>{const{children:i,...l}=r,c=S.Children.toArray(i),d=c.find(xU);if(d){const h=d.props.children,m=c.map(p=>p===d?S.Children.count(h)>1?S.Children.only(null):S.isValidElement(h)?h.props.children:null:p);return a.jsx(e,{...l,ref:s,children:S.isValidElement(h)?S.cloneElement(h,void 0,m):null})}return a.jsx(e,{...l,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function pU(t){const e=S.forwardRef((n,r)=>{const{children:s,...i}=n;if(S.isValidElement(s)){const l=yU(s),c=vU(i,s.props);return s.type!==S.Fragment&&(c.ref=r?oo(r,l):l),S.cloneElement(s,c)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var gU=Symbol("radix.slottable");function xU(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===gU}function vU(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...c)=>{const d=i(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function yU(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var bx="Popover",[lA]=Vi(bx,[wd]),r0=wd(),[bU,Oo]=lA(bx),oA=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:l=!1}=t,c=r0(e),d=S.useRef(null),[h,m]=S.useState(!1),[p,x]=ko({prop:r,defaultProp:s??!1,onChange:i,caller:bx});return a.jsx(ix,{...c,children:a.jsx(bU,{scope:e,contentId:ji(),triggerRef:d,open:p,onOpenChange:x,onOpenToggle:S.useCallback(()=>x(v=>!v),[x]),hasCustomAnchor:h,onCustomAnchorAdd:S.useCallback(()=>m(!0),[]),onCustomAnchorRemove:S.useCallback(()=>m(!1),[]),modal:l,children:n})})};oA.displayName=bx;var cA="PopoverAnchor",wU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Oo(cA,n),i=r0(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=s;return S.useEffect(()=>(l(),()=>c()),[l,c]),a.jsx(ax,{...i,...r,ref:e})});wU.displayName=cA;var uA="PopoverTrigger",dA=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Oo(uA,n),i=r0(n),l=Cn(e,s.triggerRef),c=a.jsx(Zt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":gA(s.open),...r,ref:l,onClick:$e(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:a.jsx(ax,{asChild:!0,...i,children:c})});dA.displayName=uA;var gw="PopoverPortal",[SU,kU]=lA(gw,{forceMount:void 0}),hA=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=Oo(gw,e);return a.jsx(SU,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};hA.displayName=gw;var ad="PopoverContent",fA=S.forwardRef((t,e)=>{const n=kU(ad,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=Oo(ad,t.__scopePopover);return a.jsx(Ls,{present:r||i.open,children:i.modal?a.jsx(jU,{...s,ref:e}):a.jsx(NU,{...s,ref:e})})});fA.displayName=ad;var OU=mU("PopoverContent.RemoveScroll"),jU=S.forwardRef((t,e)=>{const n=Oo(ad,t.__scopePopover),r=S.useRef(null),s=Cn(e,r),i=S.useRef(!1);return S.useEffect(()=>{const l=r.current;if(l)return j9(l)},[]),a.jsx(N9,{as:OU,allowPinchZoom:!0,children:a.jsx(mA,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:$e(t.onCloseAutoFocus,l=>{l.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:$e(t.onPointerDownOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,h=c.button===2||d;i.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:$e(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),NU=S.forwardRef((t,e)=>{const n=Oo(ad,t.__scopePopover),r=S.useRef(!1),s=S.useRef(!1);return a.jsx(mA,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=i.target;n.triggerRef.current?.contains(l)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),mA=S.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:m,...p}=t,x=Oo(ad,n),v=r0(n);return C9(),a.jsx(T9,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:m,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onDismiss:()=>x.onOpenChange(!1),children:a.jsx(X4,{"data-state":gA(x.open),role:"dialog",id:x.contentId,...v,...p,ref:e,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),pA="PopoverClose",CU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Oo(pA,n);return a.jsx(Zt.button,{type:"button",...r,ref:e,onClick:$e(t.onClick,()=>s.onOpenChange(!1))})});CU.displayName=pA;var TU="PopoverArrow",AU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=r0(n);return a.jsx(Y4,{...s,...r,ref:e})});AU.displayName=TU;function gA(t){return t?"open":"closed"}var MU=oA,EU=dA,_U=hA,xA=fA;const uo=MU,ho=EU,fl=S.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>a.jsx(_U,{children:a.jsx(xA,{ref:s,align:e,sideOffset:n,className:ye("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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 origin-[--radix-popover-content-transform-origin]",t),...r})}));fl.displayName=xA.displayName;const jo="/api/webui/config";async function DU(){const e=await(await ot(`${jo}/bot`)).json();if(!e.success)throw new Error("获取配置数据失败");return e.config}async function Vu(){const e=await(await ot(`${jo}/model`)).json();if(!e.success)throw new Error("获取模型配置数据失败");return e.config}async function XO(t){const n=await(await ot(`${jo}/bot`,{method:"POST",headers:bt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function RU(){const e=await(await ot(`${jo}/bot/raw`)).json();if(!e.success)throw new Error("获取配置源代码失败");return e.content}async function zU(t){const n=await(await ot(`${jo}/bot/raw`,{method:"POST",headers:bt(),body:JSON.stringify({raw_content:t})})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function wg(t){const n=await(await ot(`${jo}/model`,{method:"POST",headers:bt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function PU(t,e){const r=await(await ot(`${jo}/bot/section/${t}`,{method:"POST",headers:bt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function h2(t,e){const r=await(await ot(`${jo}/model/section/${t}`,{method:"POST",headers:bt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}const BU=Zn.create({baseURL:"",timeout:1e4});async function xw(){try{return(await BU.post("/api/webui/system/restart")).data}catch(t){throw console.error("重启麦麦失败:",t),t}}const LU=Nd("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),ld=S.forwardRef(({className:t,variant:e,...n},r)=>a.jsx("div",{ref:r,role:"alert",className:ye(LU({variant:e}),t),...n}));ld.displayName="Alert";const IU=S.forwardRef(({className:t,...e},n)=>a.jsx("h5",{ref:n,className:ye("mb-1 font-medium leading-none tracking-tight",t),...e}));IU.displayName="AlertTitle";const od=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("text-sm [&_p]:leading-relaxed",t),...e}));od.displayName="AlertDescription";function vw({onRestartComplete:t,onRestartFailed:e}){const[n,r]=S.useState(0),[s,i]=S.useState("restarting"),[l,c]=S.useState(0),[d,h]=S.useState(0);S.useEffect(()=>{const x=setInterval(()=>{r(k=>k>=90?k:k+1)},200),v=setInterval(()=>{c(k=>k+1)},1e3),b=setTimeout(()=>{i("checking"),m()},3e3);return()=>{clearInterval(x),clearInterval(v),clearTimeout(b)}},[]);const m=()=>{const v=async()=>{try{if(h(k=>k+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)r(100),i("success"),setTimeout(()=>{t?.()},1500);else throw new Error("Status check failed")}catch{d<60?setTimeout(v,2e3):(i("failed"),e?.())}};v()},p=x=>{const v=Math.floor(x/60),b=x%60;return`${v}:${b.toString().padStart(2,"0")}`};return a.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:a.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[a.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s==="restarting"&&a.jsxs(a.Fragment,{children:[a.jsx(hf,{className:"h-16 w-16 text-primary animate-spin"}),a.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),s==="checking"&&a.jsxs(a.Fragment,{children:[a.jsx(hf,{className:"h-16 w-16 text-primary animate-spin"}),a.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),a.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",d,"/60)"]})]}),s==="success"&&a.jsxs(a.Fragment,{children:[a.jsx(Es,{className:"h-16 w-16 text-green-500"}),a.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),s==="failed"&&a.jsxs(a.Fragment,{children:[a.jsx(xc,{className:"h-16 w-16 text-destructive"}),a.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),s!=="failed"&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(n0,{value:n,className:"h-2"}),a.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[a.jsxs("span",{children:[n,"%"]}),a.jsxs("span",{children:["已用时: ",p(l)]})]})]}),a.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="restarting"&&"🔄 配置已保存,正在重启主程序...",s==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",s==="success"&&"✅ 配置已生效,服务运行正常",s==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),s==="failed"&&a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),a.jsx("button",{onClick:()=>{i("checking"),h(0),m()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}let f2=[],vA=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e>1;if(t=vA[r])e=r+1;else return!0;if(e==n)return!1}}function YO(t){return t>=127462&&t<=127487}const KO=8205;function FU(t,e,n=!0,r=!0){return(n?yA:QU)(t,e,r)}function yA(t,e,n){if(e==t.length)return e;e&&bA(t.charCodeAt(e))&&wA(t.charCodeAt(e-1))&&e--;let r=Cy(t,e);for(e+=ZO(r);e=0&&YO(Cy(t,l));)i++,l-=2;if(i%2==0)break;e+=2}else break}return e}function QU(t,e,n){for(;e>0;){let r=yA(t,e-2,n);if(r=56320&&t<57344}function wA(t){return t>=55296&&t<56320}function ZO(t){return t<65536?1:2}class Xt{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=cd(this,e,n);let s=[];return this.decompose(0,e,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(n,this.length,s,1),Gp.from(s,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=cd(this,e,n);let r=[];return this.decompose(e,n,r,0),Gp.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),s=new Zh(this),i=new Zh(e);for(let l=n,c=n;;){if(s.next(l),i.next(l),l=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(c+=s.value.length,s.done||c>=r)return!0}}iter(e=1){return new Zh(this,e)}iterRange(e,n=this.length){return new SA(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let s=this.line(e).from;r=this.iterRange(s,Math.max(s,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new kA(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Xt.empty:e.length<=32?new ir(e):Gp.from(ir.split(e,[]))}}class ir extends Xt{constructor(e,n=$U(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,s){for(let i=0;;i++){let l=this.text[i],c=s+l.length;if((n?r:c)>=e)return new HU(s,c,r,l);s=c+1,r++}}decompose(e,n,r,s){let i=e<=0&&n>=this.length?this:new ir(JO(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let l=r.pop(),c=Xp(i.text,l.text.slice(),0,i.length);if(c.length<=32)r.push(new ir(c,l.length+i.length));else{let d=c.length>>1;r.push(new ir(c.slice(0,d)),new ir(c.slice(d)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof ir))return super.replace(e,n,r);[e,n]=cd(this,e,n);let s=Xp(this.text,Xp(r.text,JO(this.text,0,e)),n),i=this.length+r.length-(n-e);return s.length<=32?new ir(s,i):Gp.from(ir.split(s,[]),i)}sliceString(e,n=this.length,r=` `){[e,n]=cd(this,e,n);let s="";for(let i=0,l=0;i<=n&&le&&l&&(s+=r),ei&&(s+=c.slice(Math.max(0,e-i),n-i)),i=d+1}return s}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],s=-1;for(let i of e)r.push(i),s+=i.length+1,r.length==32&&(n.push(new ir(r,s)),r=[],s=-1);return s>-1&&n.push(new ir(r,s)),n}}let Gp=class Du extends Xt{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,s){for(let i=0;;i++){let l=this.children[i],c=s+l.length,d=r+l.lines-1;if((n?d:c)>=e)return l.lineInner(e,n,r,s);s=c+1,r=d+1}}decompose(e,n,r,s){for(let i=0,l=0;l<=n&&i=l){let h=s&((l<=e?1:0)|(d>=n?2:0));l>=e&&d<=n&&!h?r.push(c):c.decompose(e-l,n-l,r,h)}l=d+1}}replace(e,n,r){if([e,n]=cd(this,e,n),r.lines=i&&n<=c){let d=l.replace(e-i,n-i,r),h=this.lines-l.lines+d.lines;if(d.lines>4&&d.lines>h>>6){let m=this.children.slice();return m[s]=d,new Du(m,this.length-(n-e)+r.length)}return super.replace(i,c,d)}i=c+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` `){[e,n]=cd(this,e,n);let s="";for(let i=0,l=0;ie&&i&&(s+=r),el&&(s+=c.sliceString(e-l,n-l,r)),l=d+1}return s}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Du))return 0;let r=0,[s,i,l,c]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=n,i+=n){if(s==l||i==c)return r;let d=this.children[s],h=e.children[i];if(d!=h)return r+d.scanIdentical(h,n);r+=d.length+1}}static from(e,n=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let v of e)r+=v.lines;if(r<32){let v=[];for(let b of e)b.flatten(v);return new ir(v,n)}let s=Math.max(32,r>>5),i=s<<1,l=s>>1,c=[],d=0,h=-1,m=[];function p(v){let b;if(v.lines>i&&v instanceof Du)for(let k of v.children)p(k);else v.lines>l&&(d>l||!d)?(x(),c.push(v)):v instanceof ir&&d&&(b=m[m.length-1])instanceof ir&&v.lines+b.lines<=32?(d+=v.lines,h+=v.length+1,m[m.length-1]=new ir(b.text.concat(v.text),b.length+1+v.length)):(d+v.lines>s&&x(),d+=v.lines,h+=v.length+1,m.push(v))}function x(){d!=0&&(c.push(m.length==1?m[0]:Du.from(m,h)),h=-1,d=m.length=0)}for(let v of e)p(v);return x(),c.length==1?c[0]:new Du(c,n)}};Xt.empty=new ir([""],0);function $U(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Xp(t,e,n=0,r=1e9){for(let s=0,i=0,l=!0;i=n&&(d>r&&(c=c.slice(0,r-s)),s0?1:(e instanceof ir?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],i=this.offsets[r],l=i>>1,c=s instanceof ir?s.text.length:s.children.length;if(l==(n>0?c:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=` `,this;e--}else if(s instanceof ir){let d=s.text[l+(n<0?-1:0)];if(this.offsets[r]+=n,d.length>Math.max(0,e))return this.value=e==0?d:n>0?d.slice(e):d.slice(0,d.length-e),this;e-=d.length}else{let d=s.children[l+(n<0?-1:0)];e>d.length?(e-=d.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(d),this.offsets.push(n>0?1:(d instanceof ir?d.text.length:d.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class SA{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new Zh(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*n,this.value=s.length<=r?s:n<0?s.slice(s.length-r):s.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class kA{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:s}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Xt.prototype[Symbol.iterator]=function(){return this.iter()},Zh.prototype[Symbol.iterator]=SA.prototype[Symbol.iterator]=kA.prototype[Symbol.iterator]=function(){return this});class HU{constructor(e,n,r,s){this.from=e,this.to=n,this.number=r,this.text=s}get length(){return this.to-this.from}}function cd(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function Vr(t,e,n=!0,r=!0){return FU(t,e,n,r)}function UU(t){return t>=56320&&t<57344}function VU(t){return t>=55296&&t<56320}function As(t,e){let n=t.charCodeAt(e);if(!VU(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return UU(r)?(n-55296<<10)+(r-56320)+65536:n}function yw(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function oa(t){return t<65536?1:2}const m2=/\r\n?|\n/;var Ur=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(Ur||(Ur={}));class va{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return i+(e-s);i+=c}else{if(r!=Ur.Simple&&h>=e&&(r==Ur.TrackDel&&se||r==Ur.TrackBefore&&se))return null;if(h>e||h==e&&n<0&&!c)return e==s||n<0?i:i+d;i+=d}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return i}touchesRange(e,n=e){for(let r=0,s=0;r=0&&s<=n&&c>=e)return sn?"cover":!0;s=c}return!1}toString(){let e="";for(let n=0;n=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new va(e)}static create(e){return new va(e)}}class kr extends va{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return p2(this,(n,r,s,i,l)=>e=e.replace(s,s+(r-n),l),!1),e}mapDesc(e,n=!1){return g2(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let s=0,i=0;s=0){n[s]=c,n[s+1]=l;let d=s>>1;for(;r.length0&&ro(r,n,i.text),i.forward(m),c+=m}let h=e[l++];for(;c>1].toJSON()))}return e}static of(e,n,r){let s=[],i=[],l=0,c=null;function d(m=!1){if(!m&&!s.length)return;lx||p<0||x>n)throw new RangeError(`Invalid change range ${p} to ${x} (in doc of length ${n})`);let b=v?typeof v=="string"?Xt.of(v.split(r||m2)):v:Xt.empty,k=b.length;if(p==x&&k==0)return;pl&&Jr(s,p-l,-1),Jr(s,x-p,k),ro(i,s,b),l=x}}return h(e),d(!c),c}static empty(e){return new kr(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let s=0;sc&&typeof l!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length=0&&n<=0&&n==t[s+1]?t[s]+=e:s>=0&&e==0&&t[s]==0?t[s+1]+=n:r?(t[s]+=e,t[s+1]+=n):t.push(e,n)}function ro(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r>1])),!(n||l==t.sections.length||t.sections[l+1]<0);)c=t.sections[l++],d=t.sections[l++];e(s,h,i,m,p),s=h,i=m}}}function g2(t,e,n,r=!1){let s=[],i=r?[]:null,l=new pf(t),c=new pf(e);for(let d=-1;;){if(l.done&&c.len||c.done&&l.len)throw new Error("Mismatched change set lengths");if(l.ins==-1&&c.ins==-1){let h=Math.min(l.len,c.len);Jr(s,h,-1),l.forward(h),c.forward(h)}else if(c.ins>=0&&(l.ins<0||d==l.i||l.off==0&&(c.len=0&&d=0){let h=0,m=l.len;for(;m;)if(c.ins==-1){let p=Math.min(m,c.len);h+=p,m-=p,c.forward(p)}else if(c.ins==0&&c.lend||l.ins>=0&&l.len>d)&&(c||r.length>h),i.forward2(d),l.forward(d)}}}}class pf{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?Xt.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?Xt.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class lc{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,s;return this.empty?r=s=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new lc(r,s,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return Ce.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return Ce.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Ce.range(e.anchor,e.head)}static create(e,n,r){return new lc(e,n,r)}}class Ce{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:Ce.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Ce(e.ranges.map(n=>lc.fromJSON(n)),e.main)}static single(e,n=e){return new Ce([Ce.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;se?8:0)|i)}static normalized(e,n=0){let r=e[n];e.sort((s,i)=>s.from-i.from),n=e.indexOf(r);for(let s=1;si.head?Ce.range(d,c):Ce.range(c,d))}}return new Ce(e,n)}}function jA(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let bw=0;class He{constructor(e,n,r,s,i){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=bw++,this.default=e([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(e={}){return new He(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:ww),!!e.static,e.enables)}of(e){return new Yp([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yp(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yp(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function ww(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Yp{constructor(e,n,r,s){this.dependencies=e,this.facet=n,this.type=r,this.value=s,this.id=bw++}dynamicSlot(e){var n;let r=this.value,s=this.facet.compareInput,i=this.id,l=e[i]>>1,c=this.type==2,d=!1,h=!1,m=[];for(let p of this.dependencies)p=="doc"?d=!0:p=="selection"?h=!0:(((n=e[p.id])!==null&&n!==void 0?n:1)&1)==0&&m.push(e[p.id]);return{create(p){return p.values[l]=r(p),1},update(p,x){if(d&&x.docChanged||h&&(x.docChanged||x.selection)||x2(p,m)){let v=r(p);if(c?!ej(v,p.values[l],s):!s(v,p.values[l]))return p.values[l]=v,1}return 0},reconfigure:(p,x)=>{let v,b=x.config.address[i];if(b!=null){let k=kg(x,b);if(this.dependencies.every(O=>O instanceof He?x.facet(O)===p.facet(O):O instanceof Br?x.field(O,!1)==p.field(O,!1):!0)||(c?ej(v=r(p),k,s):s(v=r(p),k)))return p.values[l]=k,0}else v=r(p);return p.values[l]=v,1}}}}function ej(t,e,n){if(t.length!=e.length)return!1;for(let r=0;rt[d.id]),s=n.map(d=>d.type),i=r.filter(d=>!(d&1)),l=t[e.id]>>1;function c(d){let h=[];for(let m=0;mr===s),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Zm).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let i=r.values[n],l=this.updateF(i,s);return this.compareF(i,l)?0:(r.values[n]=l,1)},reconfigure:(r,s)=>{let i=r.facet(Zm),l=s.facet(Zm),c;return(c=i.find(d=>d.field==this))&&c!=l.find(d=>d.field==this)?(r.values[n]=c.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Zm.of({field:this,create:e})]}get extension(){return this}}const sc={lowest:4,low:3,default:2,high:1,highest:0};function _h(t){return e=>new NA(e,t)}const No={highest:_h(sc.highest),high:_h(sc.high),default:_h(sc.default),low:_h(sc.low),lowest:_h(sc.lowest)};class NA{constructor(e,n){this.inner=e,this.prec=n}}class wx{of(e){return new v2(this,e)}reconfigure(e){return wx.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class v2{constructor(e,n){this.compartment=e,this.inner=n}}class Sg{constructor(e,n,r,s,i,l){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=l,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,r){let s=[],i=Object.create(null),l=new Map;for(let x of GU(e,n,l))x instanceof Br?s.push(x):(i[x.facet.id]||(i[x.facet.id]=[])).push(x);let c=Object.create(null),d=[],h=[];for(let x of s)c[x.id]=h.length<<1,h.push(v=>x.slot(v));let m=r?.config.facets;for(let x in i){let v=i[x],b=v[0].facet,k=m&&m[x]||[];if(v.every(O=>O.type==0))if(c[b.id]=d.length<<1|1,ww(k,v))d.push(r.facet(b));else{let O=b.combine(v.map(j=>j.value));d.push(r&&b.compare(O,r.facet(b))?r.facet(b):O)}else{for(let O of v)O.type==0?(c[O.id]=d.length<<1|1,d.push(O.value)):(c[O.id]=h.length<<1,h.push(j=>O.dynamicSlot(j)));c[b.id]=h.length<<1,h.push(O=>WU(O,b,v))}}let p=h.map(x=>x(c));return new Sg(e,l,p,c,d,i)}}function GU(t,e,n){let r=[[],[],[],[],[]],s=new Map;function i(l,c){let d=s.get(l);if(d!=null){if(d<=c)return;let h=r[d].indexOf(l);h>-1&&r[d].splice(h,1),l instanceof v2&&n.delete(l.compartment)}if(s.set(l,c),Array.isArray(l))for(let h of l)i(h,c);else if(l instanceof v2){if(n.has(l.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(l.compartment)||l.inner;n.set(l.compartment,h),i(h,c)}else if(l instanceof NA)i(l.inner,l.prec);else if(l instanceof Br)r[c].push(l),l.provides&&i(l.provides,c);else if(l instanceof Yp)r[c].push(l),l.facet.extensions&&i(l.facet.extensions,sc.default);else{let h=l.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${l}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(h,c)}}return i(t,sc.default),r.reduce((l,c)=>l.concat(c))}function Jh(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let s=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|s}function kg(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const CA=He.define(),y2=He.define({combine:t=>t.some(e=>e),static:!0}),TA=He.define({combine:t=>t.length?t[0]:void 0,static:!0}),AA=He.define(),MA=He.define(),EA=He.define(),_A=He.define({combine:t=>t.length?t[0]:!1});class ka{constructor(e,n){this.type=e,this.value=n}static define(){return new XU}}class XU{of(e){return new ka(this,e)}}class YU{constructor(e){this.map=e}of(e){return new vt(this,e)}}class vt{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new vt(this.type,n)}is(e){return this.type==e}static define(e={}){return new YU(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let s of e){let i=s.map(n);i&&r.push(i)}return r}}vt.reconfigure=vt.define();vt.appendConfig=vt.define();class gr{constructor(e,n,r,s,i,l){this.startState=e,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=l,this._doc=null,this._state=null,r&&jA(r,n.newLength),i.some(c=>c.type==gr.time)||(this.annotations=i.concat(gr.time.of(Date.now())))}static create(e,n,r,s,i,l){return new gr(e,n,r,s,i,l)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(gr.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}gr.time=ka.define();gr.userEvent=ka.define();gr.addToHistory=ka.define();gr.remote=ka.define();function KU(t,e){let n=[];for(let r=0,s=0;;){let i,l;if(r=t[r]))i=t[r++],l=t[r++];else if(s=0;s--){let i=r[s](t);i instanceof gr?t=i:Array.isArray(i)&&i.length==1&&i[0]instanceof gr?t=i[0]:t=RA(e,Wu(i),!1)}return t}function JU(t){let e=t.startState,n=e.facet(EA),r=t;for(let s=n.length-1;s>=0;s--){let i=n[s](t);i&&Object.keys(i).length&&(r=DA(r,b2(e,i,t.changes.newLength),!0))}return r==t?t:gr.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const eV=[];function Wu(t){return t==null?eV:Array.isArray(t)?t:[t]}var Vn=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(Vn||(Vn={}));const tV=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let w2;try{w2=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function nV(t){if(w2)return w2.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||tV.test(n)))return!0}return!1}function rV(t){return e=>{if(!/\S/.test(e))return Vn.Space;if(nV(e))return Vn.Word;for(let n=0;n-1)return Vn.Word;return Vn.Other}}class Vt{constructor(e,n,r,s,i,l){this.config=e,this.doc=n,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=i,l&&(l._state=this);for(let c=0;cs.set(h,d)),n=null),s.set(c.value.compartment,c.value.extension)):c.is(vt.reconfigure)?(n=null,r=c.value):c.is(vt.appendConfig)&&(n=null,r=Wu(r).concat(c.value));let i;n?i=e.startState.values.slice():(n=Sg.resolve(r,s,this),i=new Vt(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(d,h)=>h.reconfigure(d,this),null).values);let l=e.startState.facet(y2)?e.newSelection:e.newSelection.asSingle();new Vt(n,e.newDoc,l,i,(c,d)=>d.update(c,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:Ce.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),s=this.changes(r.changes),i=[r.range],l=Wu(r.effects);for(let c=1;cl.spec.fromJSON(c,d)))}}return Vt.create({doc:e.doc,selection:Ce.fromJSON(e.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(e={}){let n=Sg.resolve(e.extensions||[],new Map),r=e.doc instanceof Xt?e.doc:Xt.of((e.doc||"").split(n.staticFacet(Vt.lineSeparator)||m2)),s=e.selection?e.selection instanceof Ce?e.selection:Ce.single(e.selection.anchor,e.selection.head):Ce.single(0);return jA(s,r.length),n.staticFacet(y2)||(s=s.asSingle()),new Vt(n,r,s,n.dynamicSlots.map(()=>null),(i,l)=>l.create(i),null)}get tabSize(){return this.facet(Vt.tabSize)}get lineBreak(){return this.facet(Vt.lineSeparator)||` @@ -48,23 +48,23 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert- `)}static newName(){let e=ij[sj]||1;return ij[sj]=e+1,N2+e.toString(36)}static mount(e,n,r){let s=e[C2],i=r&&r.nonce;s?i&&s.setNonce(i):s=new iV(e,i),s.mount(Array.isArray(n)?n:[n],e)}}let aj=new Map;class iV{constructor(e,n){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let i=aj.get(r);if(i)return e[C2]=i;this.sheet=new s.CSSStyleSheet,aj.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[C2]=this}mount(e,n){let r=this.sheet,s=0,i=0;for(let l=0;l-1&&(this.modules.splice(d,1),i--,d=-1),d==-1){if(this.modules.splice(i++,0,c),r)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},aV=typeof navigator<"u"&&/Mac/.test(navigator.platform),lV=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Hr=0;Hr<10;Hr++)mo[48+Hr]=mo[96+Hr]=String(Hr);for(var Hr=1;Hr<=24;Hr++)mo[Hr+111]="F"+Hr;for(var Hr=65;Hr<=90;Hr++)mo[Hr]=String.fromCharCode(Hr+32),xf[Hr]=String.fromCharCode(Hr);for(var Ay in mo)xf.hasOwnProperty(Ay)||(xf[Ay]=mo[Ay]);function oV(t){var e=aV&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||lV&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?xf:mo)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function Mn(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var s=n[r];typeof s=="string"?t.setAttribute(r,s):s!=null&&(t[r]=s)}e++}for(;e2);var Fe={mac:oj||/Mac/.test(us.platform),windows:/Win/.test(us.platform),linux:/Linux|X11/.test(us.platform),ie:Sx,ie_version:LA?T2.documentMode||6:M2?+M2[1]:A2?+A2[1]:0,gecko:lj,gecko_version:lj?+(/Firefox\/(\d+)/.exec(us.userAgent)||[0,0])[1]:0,chrome:!!My,chrome_version:My?+My[1]:0,ios:oj,android:/Android\b/.test(us.userAgent),webkit_version:cV?+(/\bAppleWebKit\/(\d+)/.exec(us.userAgent)||[0,0])[1]:0,safari:E2,safari_version:E2?+(/\bVersion\/(\d+(\.\d+)?)/.exec(us.userAgent)||[0,0])[1]:0,tabSize:T2.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function vf(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function _2(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Kp(t,e){if(!e.anchorNode)return!1;try{return _2(t,e.anchorNode)}catch{return!1}}function ud(t){return t.nodeType==3?wc(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function ef(t,e,n,r){return n?cj(t,e,n,r,-1)||cj(t,e,n,r,1):!1}function bc(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Og(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function cj(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:ba(t))){if(t.nodeName=="DIV")return!1;let i=t.parentNode;if(!i||i.nodeType!=1)return!1;e=bc(t)+(s<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=s<0?ba(t):0}else return!1}}function ba(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function s0(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function uV(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function IA(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function dV(t,e,n,r,s,i,l,c){let d=t.ownerDocument,h=d.defaultView||window;for(let m=t,p=!1;m&&!p;)if(m.nodeType==1){let x,v=m==d.body,b=1,k=1;if(v)x=uV(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(m).position)&&(p=!0),m.scrollHeight<=m.clientHeight&&m.scrollWidth<=m.clientWidth){m=m.assignedSlot||m.parentNode;continue}let T=m.getBoundingClientRect();({scaleX:b,scaleY:k}=IA(m,T)),x={left:T.left,right:T.left+m.clientWidth*b,top:T.top,bottom:T.top+m.clientHeight*k}}let O=0,j=0;if(s=="nearest")e.top0&&e.bottom>x.bottom+j&&(j=e.bottom-x.bottom+l)):e.bottom>x.bottom&&(j=e.bottom-x.bottom+l,n<0&&e.top-j0&&e.right>x.right+O&&(O=e.right-x.right+i)):e.right>x.right&&(O=e.right-x.right+i,n<0&&e.leftx.bottom||e.leftx.right)&&(e={left:Math.max(e.left,x.left),right:Math.min(e.right,x.right),top:Math.max(e.top,x.top),bottom:Math.min(e.bottom,x.bottom)}),m=m.assignedSlot||m.parentNode}else if(m.nodeType==11)m=m.host;else break}function hV(t){let e=t.ownerDocument,n,r;for(let s=t.parentNode;s&&!(s==e.body||n&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),!n&&s.scrollWidth>s.clientWidth&&(n=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:n,y:r}}class fV{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?ba(n):0),r,Math.min(e.focusOffset,r?ba(r):0))}set(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let nc=null;Fe.safari&&Fe.safari_version>=26&&(nc=!1);function qA(t){if(t.setActive)return t.setActive();if(nc)return t.focus(nc);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(nc==null?{get preventScroll(){return nc={preventScroll:!0},!0}}:void 0),!nc){nc=!1;for(let n=0;nMath.max(1,t.scrollHeight-t.clientHeight-4)}function $A(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=ba(n)}else if(n.parentNode&&!Og(n))r=bc(n),n=n.parentNode;else return null}}function HA(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&rn)return p.domBoundsAround(e,n,h);if(x>=e&&s==-1&&(s=d,i=h),h>n&&p.dom.parentNode==this.dom){l=d,c=m;break}m=x,h=x+p.breakAfter}return{from:i,to:c<0?r+this.length:c,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:l=0?this.children[l].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,r=kw){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}}function VA(t,e,n,r,s,i,l,c,d){let{children:h}=t,m=h.length?h[e]:null,p=i.length?i[i.length-1]:null,x=p?p.breakAfter:l;if(!(e==r&&m&&!l&&!x&&i.length<2&&m.merge(n,s,i.length?p:null,n==0,c,d))){if(r0&&(!l&&i.length&&m.merge(n,m.length,i[0],!1,c,0)?m.breakAfter=i.shift().breakAfter:(ngV||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new Hi(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new ns(this.dom,e)}domBoundsAround(e,n,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return xV(this.dom,e,n)}}class pl extends jn{constructor(e,n=[],r=0){super(),this.mark=e,this.children=n,this.length=r;for(let s of n)s.setParent(this)}setAttrs(e){if(FA(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,r,s,i,l){return r&&(!(r instanceof pl&&r.mark.eq(this.mark))||e&&i<=0||ne&&n.push(r=e&&(s=i),r=d,i++}let l=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new pl(this.mark,n,l)}domAtPos(e){return GA(this,e)}coordsAt(e,n){return YA(this,e,n)}}function xV(t,e,n){let r=t.nodeValue.length;e>r&&(e=r);let s=e,i=e,l=0;e==0&&n<0||e==r&&n>=0?Fe.chrome||Fe.gecko||(e?(s--,l=1):i=0)?0:c.length-1];return Fe.safari&&!l&&d.width==0&&(d=Array.prototype.find.call(c,h=>h.width)||d),l?s0(d,l<0):d||null}class al extends jn{static create(e,n,r){return new al(e,n,r)}constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}split(e){let n=al.create(this.widget,this.length-e,this.side);return this.length-=e,n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,n,r,s,i,l){return r&&(!(r instanceof al)||!this.widget.compare(r.widget)||e>0&&i<=0||n0)?ns.before(this.dom):ns.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);if(r)return r;let s=this.dom.getClientRects(),i=null;if(!s.length)return null;let l=this.side?this.side<0:e>0;for(let c=l?s.length-1:0;i=s[c],!(e>0?c==0:c==s.length-1||i.top0?ns.before(this.dom):ns.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Xt.empty}get isHidden(){return!0}}Hi.prototype.children=al.prototype.children=dd.prototype.children=kw;function GA(t,e){let n=t.dom,{children:r}=t,s=0;for(let i=0;si&&e0;i--){let l=r[i-1];if(l.dom.parentNode==n)return l.domAtPos(l.length)}for(let i=s;i0&&e instanceof pl&&s.length&&(r=s[s.length-1])instanceof pl&&r.mark.eq(e.mark)?XA(r,e.children[0],n-1):(s.push(e),e.setParent(t)),t.length+=e.length}function YA(t,e,n){let r=null,s=-1,i=null,l=-1;function c(h,m){for(let p=0,x=0;p=m&&(v.children.length?c(v,m-x):(!i||i.isHidden&&(n>0||yV(i,v)))&&(b>m||x==b&&v.getSide()>0)?(i=v,l=m-x):(x-1?1:0)!=s.length-(n&&s.indexOf(n)>-1?1:0))return!1;for(let i of r)if(i!=n&&(s.indexOf(i)==-1||t[i]!==e[i]))return!1;return!0}function R2(t,e,n){let r=!1;if(e)for(let s in e)n&&s in n||(r=!0,s=="style"?t.style.cssText="":t.removeAttribute(s));if(n)for(let s in n)e&&e[s]==n[s]||(r=!0,s=="style"?t.style.cssText=n[s]:t.setAttribute(s,n[s]));return r}function bV(t){let e=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new po(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,s;if(e.isBlockGap)r=-5e8,s=4e8;else{let{start:i,end:l}=KA(e,n);r=(i?n?-3e8:-1:5e8)-1,s=(l?n?2e8:1:-6e8)+1}return new po(e,r,s,n,e.widget||null,!0)}static line(e){return new a0(e)}static set(e,n=!1){return Yt.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Je.none=Yt.empty;class i0 extends Je{constructor(e){let{start:n,end:r}=KA(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var n,r;return this==e||e instanceof i0&&this.tagName==e.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&jg(this.attrs,e.attrs,"class")}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}i0.prototype.point=!1;class a0 extends Je{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof a0&&this.spec.class==e.spec.class&&jg(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}a0.prototype.mapMode=Ur.TrackBefore;a0.prototype.point=!0;class po extends Je{constructor(e,n,r,s,i,l){super(n,r,i,e),this.block=s,this.isReplace=l,this.mapMode=s?n<=0?Ur.TrackBefore:Ur.TrackAfter:Ur.TrackDel}get type(){return this.startSide!=this.endSide?fs.WidgetRange:this.startSide<=0?fs.WidgetBefore:fs.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof po&&wV(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}po.prototype.point=!0;function KA(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function wV(t,e){return t==e||!!(t&&e&&t.compare(e))}function Zp(t,e,n,r=0){let s=n.length-1;s>=0&&n[s]+r>=t?n[s]=Math.max(n[s],e):n.push(t,e)}class pr extends jn{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,r,s,i,l){if(r){if(!(r instanceof pr))return!1;this.dom||r.transferDOM(this)}return s&&this.setDeco(r?r.attrs:null),WA(this,e,n,r?r.children.slice():[],i,l),!0}split(e){let n=new pr;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i:r,off:s}=this.childPos(e);s&&(n.append(this.children[r].split(s),0),this.children[r].merge(s,this.children[r].length,null,!1,0,0),r++);for(let i=r;i0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,n}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){jg(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){XA(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=D2(n,this.attrs||{})),r&&(this.attrs=D2({class:r},this.attrs||{}))}domAtPos(e){return GA(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(FA(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(R2(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,n);let s=this.dom.lastChild;for(;s&&jn.get(s)instanceof pl;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((r=jn.get(s))===null||r===void 0?void 0:r.isEditable)==!1&&(!Fe.ios||!this.children.some(i=>i instanceof Hi))){let i=document.createElement("BR");i.cmIgnore=!0,this.dom.appendChild(i)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,n;for(let r of this.children){if(!(r instanceof Hi)||/[^ -~]/.test(r.text))return null;let s=ud(r.dom);if(s.length!=1)return null;e+=s[0].width,n=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:n}:null}coordsAt(e,n){let r=YA(this,e,n);if(!this.children.length&&r&&this.parent){let{heightOracle:s}=this.parent.view.viewState,i=r.bottom-r.top;if(Math.abs(i-s.lineHeight)<2&&s.textHeight=n){if(i instanceof pr)return i;if(l>n)break}s=l+i.breakAfter}return null}}class cl extends jn{constructor(e,n,r){super(),this.widget=e,this.length=n,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,n,r,s,i,l){return r&&(!(r instanceof cl)||!this.widget.compare(r.widget)||e>0&&i<=0||n0}}class z2 extends ja{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class tf{constructor(e,n,r,s){this.doc=e,this.pos=n,this.end=r,this.disallowBlockEffectsFor=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=n}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof cl&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new pr),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(tp(new dd(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof cl)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:l,lineBreak:c,done:d}=this.cursor.next(this.skip);if(this.skip=0,d)throw new Error("Ran out of text content when drawing inline views");if(c){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=l,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e),i=Math.min(s,512);this.flushBuffer(n.slice(n.length-r)),this.getLine().append(tp(new Hi(this.text.slice(this.textOff,this.textOff+i)),n),r),this.atCursorPos=!0,this.textOff+=i,e-=i,r=s<=i?0:n.length}}span(e,n,r,s){this.buildText(n-e,r,s),this.pos=n,this.openStart<0&&(this.openStart=s)}point(e,n,r,s,i,l){if(this.disallowBlockEffectsFor[l]&&r instanceof po){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let c=n-e;if(r instanceof po)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new cl(r.widget||hd.block,c,r));else{let d=al.create(r.widget||hd.inline,c,c?0:r.startSide),h=this.atCursorPos&&!d.isEditable&&i<=s.length&&(e0),m=!d.isEditable&&(es.length||r.startSide<=0),p=this.getLine();this.pendingBuffer==2&&!h&&!d.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),h&&(p.append(tp(new dd(1),s),i),i=s.length+Math.max(0,i-s.length)),p.append(tp(d,s),i),this.atCursorPos=m,this.pendingBuffer=m?es.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);c&&(this.textOff+c<=this.text.length?this.textOff+=c:(this.skip+=c-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=i)}static build(e,n,r,s,i){let l=new tf(e,n,r,i);return l.openEnd=Yt.spans(s,n,r,l),l.openStart<0&&(l.openStart=l.openEnd),l.finish(l.openEnd),l}}function tp(t,e){for(let n of e)t=new pl(n,[t],t.length);return t}class hd extends ja{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}hd.inline=new hd("span");hd.block=new hd("div");var Hn=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(Hn||(Hn={}));const Sc=Hn.LTR,Ow=Hn.RTL;function ZA(t){let e=[];for(let n=0;n=n){if(c.level==r)return l;(i<0||(s!=0?s<0?c.fromn:e[i].level>c.level))&&(i=l)}}if(i<0)throw new RangeError("Index out of range");return i}}function eM(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;k-=3)if(ta[k+1]==-v){let O=ta[k+2],j=O&2?s:O&4?O&1?i:s:0;j&&(En[p]=En[ta[k]]=j),c=k;break}}else{if(ta.length==189)break;ta[c++]=p,ta[c++]=x,ta[c++]=d}else if((b=En[p])==2||b==1){let k=b==s;d=k?0:1;for(let O=c-3;O>=0;O-=3){let j=ta[O+2];if(j&2)break;if(k)ta[O+2]|=2;else{if(j&4)break;ta[O+2]|=4}}}}}function CV(t,e,n,r){for(let s=0,i=r;s<=n.length;s++){let l=s?n[s-1].to:t,c=sd;)b==O&&(b=n[--k].from,O=k?n[k-1].to:t),En[--b]=v;d=m}else i=h,d++}}}function B2(t,e,n,r,s,i,l){let c=r%2?2:1;if(r%2==s%2)for(let d=e,h=0;dd&&l.push(new so(d,k.from,v));let O=k.direction==Sc!=!(v%2);L2(t,O?r+1:r,s,k.inner,k.from,k.to,l),d=k.to}b=k.to}else{if(b==n||(m?En[b]!=c:En[b]==c))break;b++}x?B2(t,d,b,r+1,s,x,l):de;){let m=!0,p=!1;if(!h||d>i[h-1].to){let k=En[d-1];k!=c&&(m=!1,p=k==16)}let x=!m&&c==1?[]:null,v=m?r:r+1,b=d;e:for(;;)if(h&&b==i[h-1].to){if(p)break e;let k=i[--h];if(!m)for(let O=k.from,j=h;;){if(O==e)break e;if(j&&i[j-1].to==O)O=i[--j].from;else{if(En[O-1]==c)break e;break}}if(x)x.push(k);else{k.toEn.length;)En[En.length]=256;let r=[],s=e==Sc?0:1;return L2(t,s,s,n,0,t.length,r),r}function tM(t){return[new so(0,t,0)]}let nM="";function AV(t,e,n,r,s){var i;let l=r.head-t.from,c=so.find(e,l,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),d=e[c],h=d.side(s,n);if(l==h){let x=c+=s?1:-1;if(x<0||x>=e.length)return null;d=e[c=x],l=d.side(!s,n),h=d.side(s,n)}let m=Vr(t.text,l,d.forward(s,n));(md.to)&&(m=h),nM=t.text.slice(Math.min(l,m),Math.max(l,m));let p=c==(s?e.length-1:0)?null:e[c+(s?1:-1)];return p&&m==h&&p.level+(s?0:1)t.some(e=>e)}),uM=He.define({combine:t=>t.some(e=>e)}),dM=He.define();class Xu{constructor(e,n="nearest",r="nearest",s=5,i=5,l=!1){this.range=e,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=l}map(e){return e.empty?this:new Xu(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Xu(Ce.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const np=vt.define({map:(t,e)=>t.map(e)}),hM=vt.define();function _s(t,e,n){let r=t.facet(aM);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const il=He.define({combine:t=>t.length?t[0]:!0});let EV=0;const Fu=He.define({combine(t){return t.filter((e,n)=>{for(let r=0;r{let d=[];return l&&d.push(yf.of(h=>{let m=h.plugin(c);return m?l(m):Je.none})),i&&d.push(i(c)),d})}static fromClass(e,n){return lr.define((r,s)=>new e(r,s),n)}}class Ey{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(_s(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(n){_s(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){_s(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const fM=He.define(),Cw=He.define(),yf=He.define(),mM=He.define(),l0=He.define(),pM=He.define();function fj(t,e){let n=t.state.facet(pM);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(t):i),s=[];return Yt.spans(r,e.from,e.to,{point(){},span(i,l,c,d){let h=i-e.from,m=l-e.from,p=s;for(let x=c.length-1;x>=0;x--,d--){let v=c[x].spec.bidiIsolate,b;if(v==null&&(v=MV(e.text,h,m)),d>0&&p.length&&(b=p[p.length-1]).to==h&&b.direction==v)b.to=m,p=b.inner;else{let k={from:h,to:m,direction:v,inner:[]};p.push(k),p=k.inner}}}}),s}const gM=He.define();function Tw(t){let e=0,n=0,r=0,s=0;for(let i of t.state.facet(gM)){let l=i(t);l&&(l.left!=null&&(e=Math.max(e,l.left)),l.right!=null&&(n=Math.max(n,l.right)),l.top!=null&&(r=Math.max(r,l.top)),l.bottom!=null&&(s=Math.max(s,l.bottom)))}return{left:e,right:n,top:r,bottom:s}}const Qh=He.define();class Ni{constructor(e,n,r,s){this.fromA=e,this.toA=n,this.fromB=r,this.toB=s}join(e){return new Ni(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let s=e[n-1];if(!(s.fromA>r.toA)){if(s.toAm)break;i+=2}if(!d)return r;new Ni(d.fromA,d.toA,d.fromB,d.toB).addToSet(r),l=d.toA,c=d.toB}}}class Ng{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=kr.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,l,c,d)=>s.push(new Ni(i,l,c,d))),this.changedRanges=s}static create(e,n,r){return new Ng(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class mj extends jn{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=Je.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new pr],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Ni(0,0,0,e.state.doc.length)],0,null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:h,toA:m})=>mthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?s=this.domChanged.newSel.head:!LV(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let i=s>-1?DV(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:m}=this.hasComposition;r=new Ni(h,m,e.changes.mapPos(h,-1),e.changes.mapPos(m,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(Fe.ie||Fe.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let l=this.decorations,c=this.updateDeco(),d=PV(l,c,e.changes);return r=Ni.extendWithRanges(r,d),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,r);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let l=Fe.chrome||Fe.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,l),this.flags&=-8,l&&(l.written||s.selectionRange.focusNode!=l.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(l=>l.flags&=-9);let i=[];if(this.view.viewport.from||this.view.viewport.to=0?s[l]:null;if(!c)break;let{fromA:d,toA:h,fromB:m,toB:p}=c,x,v,b,k;if(r&&r.range.fromBm){let _=tf.build(this.view.state.doc,m,r.range.fromB,this.decorations,this.dynamicDecorationMap),D=tf.build(this.view.state.doc,r.range.toB,p,this.decorations,this.dynamicDecorationMap);v=_.breakAtStart,b=_.openStart,k=D.openEnd;let E=this.compositionView(r);D.breakAtStart?E.breakAfter=1:D.content.length&&E.merge(E.length,E.length,D.content[0],!1,D.openStart,0)&&(E.breakAfter=D.content[0].breakAfter,D.content.shift()),_.content.length&&E.merge(0,0,_.content[_.content.length-1],!0,0,_.openEnd)&&_.content.pop(),x=_.content.concat(E).concat(D.content)}else({content:x,breakAtStart:v,openStart:b,openEnd:k}=tf.build(this.view.state.doc,m,p,this.decorations,this.dynamicDecorationMap));let{i:O,off:j}=i.findPos(h,1),{i:T,off:A}=i.findPos(d,-1);VA(this,T,A,O,j,x,v,b,k)}r&&this.fixCompositionDOM(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(hM)&&(this.editContextFormatting=r.value)}compositionView(e){let n=new Hi(e.text.nodeValue);n.flags|=8;for(let{deco:s}of e.marks)n=new pl(s,[n],n.length);let r=new pr;return r.append(n,0),r}fixCompositionDOM(e){let n=(i,l)=>{l.flags|=8|(l.children.some(d=>d.flags&7)?1:0),this.markedForComposition.add(l);let c=jn.get(i);c&&c!=l&&(c.dom=null),l.setDOM(i)},r=this.childPos(e.range.fromB,1),s=this.children[r.i];n(e.line,s);for(let i=e.marks.length-1;i>=-1;i--)r=s.childPos(r.off,1),s=s.children[r.i],n(i>=0?e.marks[i].node:e.text,s)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,s=r==this.dom,i=!s&&!(this.view.state.facet(il)||this.dom.tabIndex>-1)&&Kp(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(s||n||i))return;let l=this.forceSelection;this.forceSelection=!1;let c=this.view.state.selection.main,d=this.moveToLine(this.domAtPos(c.anchor)),h=c.empty?d:this.moveToLine(this.domAtPos(c.head));if(Fe.gecko&&c.empty&&!this.hasComposition&&_V(d)){let p=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(p,d.node.childNodes[d.offset]||null)),d=h=new ns(p,0),l=!0}let m=this.view.observer.selectionRange;(l||!m.focusNode||(!ef(d.node,d.offset,m.anchorNode,m.anchorOffset)||!ef(h.node,h.offset,m.focusNode,m.focusOffset))&&!this.suppressWidgetCursorChange(m,c))&&(this.view.observer.ignore(()=>{Fe.android&&Fe.chrome&&this.dom.contains(m.focusNode)&&BV(m.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let p=vf(this.view.root);if(p)if(c.empty){if(Fe.gecko){let x=RV(d.node,d.offset);if(x&&x!=3){let v=(x==1?$A:HA)(d.node,d.offset);v&&(d=new ns(v.node,v.offset))}}p.collapse(d.node,d.offset),c.bidiLevel!=null&&p.caretBidiLevel!==void 0&&(p.caretBidiLevel=c.bidiLevel)}else if(p.extend){p.collapse(d.node,d.offset);try{p.extend(h.node,h.offset)}catch{}}else{let x=document.createRange();c.anchor>c.head&&([d,h]=[h,d]),x.setEnd(h.node,h.offset),x.setStart(d.node,d.offset),p.removeAllRanges(),p.addRange(x)}i&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(d,h)),this.impreciseAnchor=d.precise?null:new ns(m.anchorNode,m.anchorOffset),this.impreciseHead=h.precise?null:new ns(m.focusNode,m.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&ef(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=vf(e.root),{anchorNode:s,anchorOffset:i}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let l=pr.find(this,n.head);if(!l)return;let c=l.posAtStart;if(n.head==c||n.head==c+l.length)return;let d=this.coordsAt(n.head,-1),h=this.coordsAt(n.head,1);if(!d||!h||d.bottom>h.top)return;let m=this.domAtPos(n.head+n.assoc);r.collapse(m.node,m.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let p=e.observer.selectionRange;e.docView.posFromDOM(p.anchorNode,p.anchorOffset)!=n.from&&r.collapse(s,i)}moveToLine(e){let n=this.dom,r;if(e.node!=n)return e;for(let s=e.offset;!r&&s=0;s--){let i=jn.get(n.childNodes[s]);i instanceof pr&&(r=i.domAtPos(i.length))}return r?new ns(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=jn.get(n);if(r&&r.rootView==this)return r;n=n.parentNode}return null}posFromDOM(e,n){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,n)+r.posAtStart}domAtPos(e){let{i:n,off:r}=this.childCursor().findPos(e,-1);for(;n=0;l--){let c=this.children[l],d=i-c.breakAfter,h=d-c.length;if(de||c.covers(1))&&(!r||c instanceof pr&&!(r instanceof pr&&n>=0)))r=c,s=h;else if(r&&h==e&&d==e&&c instanceof cl&&Math.abs(n)<2){if(c.deco.startSide<0)break;l&&(r=null)}i=h}return r?r.coordsAt(e-s,n):null}coordsForChar(e){let{i:n,off:r}=this.childPos(e,1),s=this.children[n];if(!(s instanceof pr))return null;for(;s.children.length;){let{i:c,off:d}=s.childPos(r,1);for(;;c++){if(c==s.children.length)return null;if((s=s.children[c]).length)break}r=d}if(!(s instanceof Hi))return null;let i=Vr(s.text,r);if(i==r)return null;let l=wc(s.dom,r,i).getClientRects();for(let c=0;cMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,c=-1,d=this.view.textDirection==Hn.LTR;for(let h=0,m=0;ms)break;if(h>=r){let v=p.dom.getBoundingClientRect();if(n.push(v.height),l){let b=p.dom.lastChild,k=b?ud(b):[];if(k.length){let O=k[k.length-1],j=d?O.right-v.left:v.right-O.left;j>c&&(c=j,this.minWidth=i,this.minWidthFrom=h,this.minWidthTo=x)}}}h=x+p.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?Hn.RTL:Hn.LTR}measureTextSize(){for(let i of this.children)if(i instanceof pr){let l=i.measureTextSize();if(l)return l}let e=document.createElement("div"),n,r,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let i=ud(e.firstChild)[0];n=e.getBoundingClientRect().height,r=i?i.width/27:7,s=i?i.height:n,e.remove()}),{lineHeight:n,charWidth:r,textHeight:s}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new UA(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,s=0;;s++){let i=s==n.viewports.length?null:n.viewports[s],l=i?i.from-1:this.length;if(l>r){let c=(n.lineBlockAt(l).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(Je.replace({widget:new z2(c),block:!0,inclusive:!0,isBlockGap:!0}).range(r,l))}if(!i)break;r=i.to+1}return Je.set(e)}updateDeco(){let e=1,n=this.view.state.facet(yf).map(i=>(this.dynamicDecorationMap[e++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(mM).map((i,l)=>{let c=typeof i=="function";return c&&(r=!0),c?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[e++]=r,n.push(Yt.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];en.anchor?-1:1),s;if(!r)return;!n.empty&&(s=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let i=Tw(this.view),l={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:c,offsetHeight:d}=this.view.scrollDOM;dV(this.view.scrollDOM,l,n.heads instanceof al||s.children.some(r);return r(this.children[n])}}function _V(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function xM(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=$A(n.focusNode,n.focusOffset),s=HA(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let c=jn.get(s.node);if(!c||c instanceof Hi&&c.text!=s.node.nodeValue)i=s;else if(t.docView.lastCompositionAfterCursor){let d=jn.get(r.node);!d||d instanceof Hi&&d.text!=r.node.nodeValue||(i=s)}}if(t.docView.lastCompositionAfterCursor=i!=r,!i)return null;let l=e-i.offset;return{from:l,to:l+i.node.nodeValue.length,node:i.node}}function DV(t,e,n){let r=xM(t,n);if(!r)return null;let{node:s,from:i,to:l}=r,c=s.nodeValue;if(/[\n\r]/.test(c)||t.state.doc.sliceString(r.from,r.to)!=c)return null;let d=e.invertedDesc,h=new Ni(d.mapPos(i),d.mapPos(l),i,l),m=[];for(let p=s.parentNode;;p=p.parentNode){let x=jn.get(p);if(x instanceof pl)m.push({node:p,deco:x.mark});else{if(x instanceof pr||p.nodeName=="DIV"&&p.parentNode==t.contentDOM)return{range:h,text:s,marks:m,line:p};if(p!=t.contentDOM)m.push({node:p,deco:new i0({inclusive:!0,attributes:bV(p),tagName:p.tagName.toLowerCase()})});else return null}}}function RV(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{re.from&&(n=!0)}),n}function IV(t,e,n=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),i=e-s.from;if(s.length==0)return Ce.cursor(e);i==0?n=1:i==s.length&&(n=-1);let l=i,c=i;n<0?l=Vr(s.text,i,!1):c=Vr(s.text,i);let d=r(s.text.slice(l,c));for(;l>0;){let h=Vr(s.text,l,!1);if(r(s.text.slice(h,l))!=d)break;l=h}for(;ct?e.left-t:Math.max(0,t-e.right)}function FV(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function _y(t,e){return t.tope.top+1}function pj(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function q2(t,e,n){let r,s,i,l,c=!1,d,h,m,p;for(let b=t.firstChild;b;b=b.nextSibling){let k=ud(b);for(let O=0;OA||l==A&&i>T)&&(r=b,s=j,i=T,l=A,c=T?e0:Oj.bottom&&(!m||m.bottomj.top)&&(h=b,p=j):m&&_y(m,j)?m=gj(m,j.bottom):p&&_y(p,j)&&(p=pj(p,j.top))}}if(m&&m.bottom>=n?(r=d,s=m):p&&p.top<=n&&(r=h,s=p),!r)return{node:t,offset:0};let x=Math.max(s.left,Math.min(s.right,e));if(r.nodeType==3)return xj(r,x,n);if(c&&r.contentEditable!="false")return q2(r,x,n);let v=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(s.left+s.right)/2?1:0);return{node:t,offset:v}}function xj(t,e,n){let r=t.nodeValue.length,s=-1,i=1e9,l=0;for(let c=0;cn?m.top-n:n-m.bottom)-1;if(m.left-1<=e&&m.right+1>=e&&p=(m.left+m.right)/2,v=x;if(Fe.chrome||Fe.gecko){let b=wc(t,c).getBoundingClientRect();Math.abs(b.left-m.right)<.1&&(v=!x)}if(p<=0)return{node:t,offset:c+(v?1:0)};s=c+(v?1:0),i=p}}}return{node:t,offset:s>-1?s:l>0?t.nodeValue.length:0}}function vM(t,e,n,r=-1){var s,i;let l=t.contentDOM.getBoundingClientRect(),c=l.top+t.viewState.paddingTop,d,{docHeight:h}=t.viewState,{x:m,y:p}=e,x=p-c;if(x<0)return 0;if(x>h)return t.state.doc.length;for(let _=t.viewState.heightOracle.textHeight/2,D=!1;d=t.elementAtHeight(x),d.type!=fs.Text;)for(;x=r>0?d.bottom+_:d.top-_,!(x>=0&&x<=h);){if(D)return n?null:0;D=!0,r=-r}p=c+x;let v=d.from;if(vt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:vj(t,l,d,m,p);let b=t.dom.ownerDocument,k=t.root.elementFromPoint?t.root:b,O=k.elementFromPoint(m,p);O&&!t.contentDOM.contains(O)&&(O=null),O||(m=Math.max(l.left+1,Math.min(l.right-1,m)),O=k.elementFromPoint(m,p),O&&!t.contentDOM.contains(O)&&(O=null));let j,T=-1;if(O&&((s=t.docView.nearest(O))===null||s===void 0?void 0:s.isEditable)!=!1){if(b.caretPositionFromPoint){let _=b.caretPositionFromPoint(m,p);_&&({offsetNode:j,offset:T}=_)}else if(b.caretRangeFromPoint){let _=b.caretRangeFromPoint(m,p);_&&({startContainer:j,startOffset:T}=_)}j&&(!t.contentDOM.contains(j)||Fe.safari&&QV(j,T,m)||Fe.chrome&&$V(j,T,m))&&(j=void 0),j&&(T=Math.min(ba(j),T))}if(!j||!t.docView.dom.contains(j)){let _=pr.find(t.docView,v);if(!_)return x>d.top+d.height/2?d.to:d.from;({node:j,offset:T}=q2(_.dom,m,p))}let A=t.docView.nearest(j);if(!A)return null;if(A.isWidget&&((i=A.dom)===null||i===void 0?void 0:i.nodeType)==1){let _=A.dom.getBoundingClientRect();return e.y<_.top||e.y<=_.bottom&&e.x<=(_.left+_.right)/2?A.posAtStart:A.posAtEnd}else return A.localPosFromDOM(j,T)+A.posAtStart}function vj(t,e,n,r,s){let i=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let c=t.viewState.heightOracle.textHeight,d=Math.floor((s-n.top-(t.defaultLineHeight-c)*.5)/c);i+=d*t.viewState.heightOracle.lineLength}let l=t.state.sliceDoc(n.from,n.to);return n.from+j2(l,i,t.state.tabSize)}function yM(t,e,n){let r,s=t;if(t.nodeType!=3||e!=(r=t.nodeValue.length))return!1;for(;;){let i=s.nextSibling;if(i){if(i.nodeName=="BR")break;return!1}else{let l=s.parentNode;if(!l||l.nodeName=="DIV")break;s=l}}return wc(t,r-1,r).getBoundingClientRect().right>n}function QV(t,e,n){return yM(t,e,n)}function $V(t,e,n){if(e!=0)return yM(t,e,n);for(let s=t;;){let i=s.parentNode;if(!i||i.nodeType!=1||i.firstChild!=s)return!1;if(i.classList.contains("cm-line"))break;s=i}let r=t.nodeType==1?t.getBoundingClientRect():wc(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function F2(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let s;for(let i of r.type){if(i.from>e)break;if(!(i.toe)return i;(!s||i.type==fs.Text&&(s.type!=i.type||(n<0?i.frome)))&&(s=i)}}return s||r}return r}function HV(t,e,n,r){let s=F2(t,e.head,e.assoc||-1),i=!r||s.type!=fs.Text||!(t.lineWrapping||s.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(i){let l=t.dom.getBoundingClientRect(),c=t.textDirectionAt(s.from),d=t.posAtCoords({x:n==(c==Hn.LTR)?l.right-1:l.left+1,y:(i.top+i.bottom)/2});if(d!=null)return Ce.cursor(d,n?-1:1)}return Ce.cursor(n?s.to:s.from,n?-1:1)}function yj(t,e,n,r){let s=t.state.doc.lineAt(e.head),i=t.bidiSpans(s),l=t.textDirectionAt(s.from);for(let c=e,d=null;;){let h=AV(s,i,l,c,n),m=nM;if(!h){if(s.number==(n?t.state.doc.lines:1))return c;m=` `,s=t.state.doc.line(s.number+(n?1:-1)),i=t.bidiSpans(s),h=t.visualLineSide(s,!n)}if(d){if(!d(m))return c}else{if(!r)return h;d=r(m)}c=h}}function UV(t,e,n){let r=t.state.charCategorizer(e),s=r(n);return i=>{let l=r(i);return s==Vn.Space&&(s=l),s==l}}function VV(t,e,n,r){let s=e.head,i=n?1:-1;if(s==(n?t.state.doc.length:0))return Ce.cursor(s,e.assoc);let l=e.goalColumn,c,d=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s,e.assoc||-1),m=t.documentTop;if(h)l==null&&(l=h.left-d.left),c=i<0?h.top:h.bottom;else{let v=t.viewState.lineBlockAt(s);l==null&&(l=Math.min(d.right-d.left,t.defaultCharacterWidth*(s-v.from))),c=(i<0?v.top:v.bottom)+m}let p=d.left+l,x=r??t.viewState.heightOracle.textHeight>>1;for(let v=0;;v+=10){let b=c+(x+v)*i,k=vM(t,{x:p,y:b},!1,i);if(bd.bottom||(i<0?ks)){let O=t.docView.coordsForChar(k),j=!O||b{if(e>i&&es(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:Ce.cursor(r,ri)&&!XV(l,n)&&this.lineBreak(),s=l}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,l=1,c;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),l=this.lineSeparator.length):(c=s.exec(n))&&(i=c.index,l=c[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),l>1)for(let d of this.points)d.node==e&&d.pos>this.text.length&&(d.pos-=l-1);r=i+l}}readNode(e){if(e.cmIgnore)return;let n=jn.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(GV(e,r.node,r.offset)?n:0))}}function GV(t,e,n){for(;;){if(!e||n-1;let{impreciseHead:i,impreciseAnchor:l}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let c=i||l?[]:ZV(e),d=new WV(c,e.state);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=JV(c,this.bounds.from)}else{let c=e.observer.selectionRange,d=i&&i.node==c.focusNode&&i.offset==c.focusOffset||!_2(e.contentDOM,c.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(c.focusNode,c.focusOffset),h=l&&l.node==c.anchorNode&&l.offset==c.anchorOffset||!_2(e.contentDOM,c.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(c.anchorNode,c.anchorOffset),m=e.viewport;if((Fe.ios||Fe.chrome)&&e.state.selection.main.empty&&d!=h&&(m.from>0||m.to-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Ce.range(h,d)):this.newSel=Ce.single(h,d)}}}function wM(t,e){let n,{newSel:r}=e,s=t.state.selection.main,i=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:l,to:c}=e.bounds,d=s.from,h=null;(i===8||Fe.android&&e.text.length=s.from&&n.to<=s.to&&(n.from!=s.from||n.to!=s.to)&&s.to-s.from-(n.to-n.from)<=4?n={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,s.to))}:t.state.doc.lineAt(s.from).toDate.now()-50?n={from:s.from,to:s.to,insert:t.state.toText(t.inputState.insertingText)}:Fe.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` - `&&t.lineWrapping&&(r&&(r=Ce.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:Xt.of([" "])}),n)return Aw(t,n,r,i);if(r&&!r.main.eq(s)){let l=!1,c="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(l=!0),c=t.inputState.lastSelectionOrigin,c=="select.pointer"&&(r=bM(t.state.facet(l0).map(d=>d(t)),r))),t.dispatch({selection:r,scrollIntoView:l,userEvent:c}),!0}else return!1}function Aw(t,e,n,r=-1){if(Fe.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(Fe.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&t.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Gu(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.lengths.head)&&Gu(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Gu(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let l,c=()=>l||(l=KV(t,e,n));return t.state.facet(lM).some(d=>d(t,e.from,e.to,i,c))||t.dispatch(c()),!0}function KV(t,e,n){let r,s=t.state,i=s.selection.main,l=-1;if(e.from==e.to&&e.fromi.to){let d=e.fromp(t)),h,d);e.from==m&&(l=m)}if(l>-1)r={changes:e,selection:Ce.cursor(e.from+e.insert.length,-1)};else if(e.from>=i.from&&e.to<=i.to&&e.to-e.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let d=i.frome.to?s.sliceDoc(e.to,i.to):"";r=s.replaceSelection(t.state.toText(d+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let d=s.changes(e),h=n&&n.main.to<=d.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=i.to+10&&e.to>=i.to-10){let m=t.state.sliceDoc(e.from,e.to),p,x=n&&xM(t,n.main.head);if(x){let b=e.insert.length-(e.to-e.from);p={from:x.from,to:x.to-b}}else p=t.state.doc.lineAt(i.head);let v=i.to-e.to;r=s.changeByRange(b=>{if(b.from==i.from&&b.to==i.to)return{changes:d,range:h||b.map(d)};let k=b.to-v,O=k-m.length;if(t.state.sliceDoc(O,k)!=m||k>=p.from&&O<=p.to)return{range:b};let j=s.changes({from:O,to:k,insert:e.insert}),T=b.to-i.to;return{changes:j,range:h?Ce.range(Math.max(0,h.anchor+T),Math.max(0,h.head+T)):b.map(j)}})}else r={changes:d,selection:h&&s.selection.replaceRange(h)}}let c="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,c+=".compose",t.inputState.compositionFirstChange&&(c+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:c,scrollIntoView:!0})}function SM(t,e,n,r){let s=Math.min(t.length,e.length),i=0;for(;i0&&c>0&&t.charCodeAt(l-1)==e.charCodeAt(c-1);)l--,c--;if(r=="end"){let d=Math.max(0,i-Math.min(l,c));n-=l+d-i}if(l=l?i-n:0;i-=d,c=i+(c-l),l=i}else if(c=c?i-n:0;i-=d,l=i+(l-c),c=i}return{from:i,toA:l,toB:c}}function ZV(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}=t.observer.selectionRange;return n&&(e.push(new bj(n,r)),(s!=n||i!=r)&&e.push(new bj(s,i))),e}function JV(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?Ce.single(n+e,r+e):null}class eW{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Fe.safari&&e.contentDOM.addEventListener("input",()=>null),Fe.gecko&&gW(e.contentDOM.ownerDocument)}handleEvent(e){!oW(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let s of r.observers)s(this.view,n);for(let s of r.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=tW(e),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let l=!n[i].handlers.length,c=r[i];c&&l!=!c.handlers.length&&(s.removeEventListener(i,this.handleEvent),c=null),c||s.addEventListener(i,this.handleEvent,{passive:l})}for(let i in r)i!="scroll"&&!n[i]&&s.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&OM.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Fe.android&&Fe.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return Fe.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=kM.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||nW.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from0?!0:Fe.safari&&!Fe.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function wj(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){_s(n.state,s)}}}function tW(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let s=r.spec,i=s&&s.plugin.domEventHandlers,l=s&&s.plugin.domEventObservers;if(i)for(let c in i){let d=i[c];d&&n(c).handlers.push(wj(r.value,d))}if(l)for(let c in l){let d=l[c];d&&n(c).observers.push(wj(r.value,d))}}for(let r in Ui)n(r).handlers.push(Ui[r]);for(let r in Ti)n(r).observers.push(Ti[r]);return e}const kM=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],nW="dthko",OM=[16,17,18,20,91,92,224,225],rp=6;function sp(t){return Math.max(0,t)*.7+8}function rW(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class sW{constructor(e,n,r,s){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=hV(e.contentDOM),this.atoms=e.state.facet(l0).map(l=>l(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Vt.allowMultipleSelections)&&iW(e,n),this.dragging=lW(e,n)&&CM(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&rW(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,i=0,l=this.view.win.innerWidth,c=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:l}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:c}=this.scrollParents.y.getBoundingClientRect());let d=Tw(this.view);e.clientX-d.left<=s+rp?n=-sp(s-e.clientX):e.clientX+d.right>=l-rp&&(n=sp(e.clientX-l)),e.clientY-d.top<=i+rp?r=-sp(i-e.clientY):e.clientY+d.bottom>=c-rp&&(r=sp(e.clientY-c)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=bM(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function iW(t,e){let n=t.state.facet(rM);return n.length?n[0](e):Fe.mac?e.metaKey:e.ctrlKey}function aW(t,e){let n=t.state.facet(sM);return n.length?n[0](e):Fe.mac?!e.altKey:!e.ctrlKey}function lW(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=vf(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i=e.clientX&&l.top<=e.clientY&&l.bottom>=e.clientY)return!0}return!1}function oW(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=jn.get(n))&&r.ignoreEvent(e))return!1;return!0}const Ui=Object.create(null),Ti=Object.create(null),jM=Fe.ie&&Fe.ie_version<15||Fe.ios&&Fe.webkit_version<604;function cW(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),NM(t,n.value)},50)}function kx(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function NM(t,e){e=kx(t.state,jw,e);let{state:n}=t,r,s=1,i=n.toText(e),l=i.lines==n.selection.ranges.length;if(Q2!=null&&n.selection.ranges.every(d=>d.empty)&&Q2==i.toString()){let d=-1;r=n.changeByRange(h=>{let m=n.doc.lineAt(h.from);if(m.from==d)return{range:h};d=m.from;let p=n.toText((l?i.line(s++).text:e)+n.lineBreak);return{changes:{from:m.from,insert:p},range:Ce.cursor(h.from+p.length)}})}else l?r=n.changeByRange(d=>{let h=i.line(s++);return{changes:{from:d.from,to:d.to,insert:h.text},range:Ce.cursor(d.from+h.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Ti.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};Ui.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Ti.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Ti.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Ui.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(iM))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=hW(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new sW(t,e,n,r)),r&&t.observer.ignore(()=>{qA(t.contentDOM);let i=t.root.activeElement;i&&!i.contains(t.contentDOM)&&i.blur()});let s=t.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function Sj(t,e,n,r){if(r==1)return Ce.cursor(e,n);if(r==2)return IV(t.state,e,n);{let s=pr.find(t.docView,e),i=t.state.doc.lineAt(s?s.posAtEnd:e),l=s?s.posAtStart:i.from,c=s?s.posAtEnd:i.to;return ce>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function uW(t,e,n,r){let s=pr.find(t.docView,e);if(!s)return 1;let i=e-s.posAtStart;if(i==0)return 1;if(i==s.length)return-1;let l=s.coordsAt(i,-1);if(l&&kj(n,r,l))return-1;let c=s.coordsAt(i,1);return c&&kj(n,r,c)?1:l&&l.bottom>=r?-1:1}function Oj(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:uW(t,n,e.clientX,e.clientY)}}const dW=Fe.ie&&Fe.ie_version<=11;let jj=null,Nj=0,Cj=0;function CM(t){if(!dW)return t.detail;let e=jj,n=Cj;return jj=t,Cj=Date.now(),Nj=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Nj+1)%3:1}function hW(t,e){let n=Oj(t,e),r=CM(e),s=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,l,c){let d=Oj(t,i),h,m=Sj(t,d.pos,d.bias,r);if(n.pos!=d.pos&&!l){let p=Sj(t,n.pos,n.bias,r),x=Math.min(p.from,m.from),v=Math.max(p.to,m.to);m=x1&&(h=fW(s,d.pos))?h:c?s.addRange(m):Ce.create([m])}}}function fW(t,e){for(let n=0;n=e)return Ce.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}Ui.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let s=t.docView.nearest(e.target);if(s&&s.isWidget){let i=s.posAtStart,l=i+s.length;(i>=n.to||l<=n.from)&&(n=Ce.range(i,l))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",kx(t.state,Nw,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ui.dragend=t=>(t.inputState.draggedContent=null,!1);function Tj(t,e,n,r){if(n=kx(t.state,jw,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,l=r&&i&&aW(t,e)?{from:i.from,to:i.to}:null,c={from:s,insert:n},d=t.state.changes(l?[l,c]:c);t.focus(),t.dispatch({changes:d,selection:{anchor:d.mapPos(s,-1),head:d.mapPos(s,1)},userEvent:l?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Ui.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,i=()=>{++s==n.length&&Tj(t,e,r.filter(l=>l!=null).join(t.state.lineBreak),!1)};for(let l=0;l{/[\x00-\x08\x0e-\x1f]{2}/.test(c.result)||(r[l]=c.result),i()},c.readAsText(n[l])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Tj(t,e,r,!0),!0}return!1};Ui.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=jM?null:e.clipboardData;return n?(NM(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(cW(t),!1)};function mW(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function pW(t){let e=[],n=[],r=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),n.push(s));if(!e.length){let s=-1;for(let{from:i}of t.selection.ranges){let l=t.doc.lineAt(i);l.number>s&&(e.push(l.text),n.push({from:l.from,to:Math.min(t.doc.length,l.to+1)})),s=l.number}r=!0}return{text:kx(t,Nw,e.join(t.lineBreak)),ranges:n,linewise:r}}let Q2=null;Ui.copy=Ui.cut=(t,e)=>{let{text:n,ranges:r,linewise:s}=pW(t.state);if(!n&&!s)return!1;Q2=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=jM?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(mW(t,n),!1)};const TM=ka.define();function AM(t,e){let n=[];for(let r of t.facet(oM)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:TM.of(!0)}):null}function MM(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=AM(t.state,e);n?t.dispatch(n):t.update([])}},10)}Ti.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),MM(t)};Ti.blur=t=>{t.observer.clearSelectionRange(),MM(t)};Ti.compositionstart=Ti.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Ti.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Fe.chrome&&Fe.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Ti.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Ui.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let i=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),l=e.getTargetRanges();if(i&&l.length){let c=l[0],d=t.posAtDOM(c.startContainer,c.startOffset),h=t.posAtDOM(c.endContainer,c.endOffset);return Aw(t,{from:d,to:h,insert:t.state.toText(i)},null),!0}}let s;if(Fe.chrome&&Fe.android&&(s=kM.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var l;(((l=window.visualViewport)===null||l===void 0?void 0:l.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Fe.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Fe.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Ti.compositionend(t,e),20),!1};const Aj=new Set;function gW(t){Aj.has(t)||(Aj.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const Mj=["pre-wrap","normal","pre-line","break-spaces"];let fd=!1;function Ej(){fd=!1}class xW{constructor(e){this.lineWrapping=e,this.doc=Xt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Mj.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,d=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=c;if(this.lineWrapping=c,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,d){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Jp&&(fd=!0),this.height=e)}replace(e,n,r){return ms.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,s){let i=this,l=r.doc;for(let c=s.length-1;c>=0;c--){let{fromA:d,toA:h,fromB:m,toB:p}=s[c],x=i.lineAt(d,$n.ByPosNoHeight,r.setDoc(n),0,0),v=x.to>=h?x:i.lineAt(h,$n.ByPosNoHeight,r,0,0);for(p+=v.to-h,h=v.to;c>0&&x.from<=s[c-1].toA;)d=s[c-1].fromA,m=s[c-1].fromB,c--,di*2){let c=e[n-1];c.break?e.splice(--n,1,c.left,null,c.right):e.splice(--n,1,c.left,c.right),r+=1+c.break,s-=c.size}else if(i>s*2){let c=e[r];c.break?e.splice(r,1,c.left,null,c.right):e.splice(r,1,c.left,c.right),r+=2+c.break,i-=c.size}else break;else if(s=i&&l(this.blockAt(0,r,s,i))}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class ei extends EM{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,s){return new ca(s,this.length,r,this.height,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof ei||s instanceof $r&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof $r?s=new ei(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):ms.of(r)}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setHeight(s.heights[s.index++]):(r||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class $r extends ms{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,s=e.doc.lineAt(n+this.length).number,i=s-r+1,l,c=0;if(e.lineWrapping){let d=Math.min(this.height,e.lineHeight*i);l=d/i,this.length>i+1&&(c=(this.height-d)/(this.length-i-1))}else l=this.height/i;return{firstLine:r,lastLine:s,perLine:l,perChar:c}}blockAt(e,n,r,s){let{firstLine:i,lastLine:l,perLine:c,perChar:d}=this.heightMetrics(n,s);if(n.lineWrapping){let h=s+(e0){let i=r[r.length-1];i instanceof $r?r[r.length-1]=new $r(i.length+s):r.push(null,new $r(s-1))}if(e>0){let i=r[0];i instanceof $r?r[0]=new $r(e+i.length):r.unshift(new $r(e-1),null)}return ms.of(r)}decomposeLeft(e,n){n.push(new $r(e-1),null)}decomposeRight(e,n){n.push(null,new $r(this.length-e-1))}updateHeight(e,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let l=[],c=Math.max(n,s.from),d=-1;for(s.from>n&&l.push(new $r(s.from-n-1).updateHeight(e,n));c<=i&&s.more;){let m=e.doc.lineAt(c).length;l.length&&l.push(null);let p=s.heights[s.index++];d==-1?d=p:Math.abs(p-d)>=Jp&&(d=-2);let x=new ei(m,p);x.outdated=!1,l.push(x),c+=m+1}c<=i&&l.push(null,new $r(i-c).updateHeight(e,c));let h=ms.of(l);return(d<0||Math.abs(h.height-this.height)>=Jp||Math.abs(d-this.heightMetrics(e,n).perLine)>=Jp)&&(fd=!0),Cg(this,h)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class yW extends ms{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,s){let i=r+this.left.height;return ec))return h;let m=n==$n.ByPosNoHeight?$n.ByPosNoHeight:$n.ByPos;return d?h.join(this.right.lineAt(c,m,r,l,c)):this.left.lineAt(c,m,r,s,i).join(h)}forEachLine(e,n,r,s,i,l){let c=s+this.left.height,d=i+this.left.length+this.break;if(this.break)e=d&&this.right.forEachLine(e,n,r,c,d,l);else{let h=this.lineAt(d,$n.ByPos,r,s,i);e=e&&h.from<=n&&l(h),n>h.to&&this.right.forEachLine(h.to+1,n,r,c,d,l)}}replace(e,n,r){let s=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-s,n-s,r));let i=[];e>0&&this.decomposeLeft(e,i);let l=i.length;for(let c of r)i.push(c);if(e>0&&_j(i,l-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,n);e2*n.size||n.size>2*e.size?ms.of(this.break?[e,null,n]:[e,n]):(this.left=Cg(this.left,e),this.right=Cg(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,s){let{left:i,right:l}=this,c=n+i.length+this.break,d=null;return s&&s.from<=n+i.length&&s.more?d=i=i.updateHeight(e,n,r,s):i.updateHeight(e,n,r),s&&s.from<=c+l.length&&s.more?d=l=l.updateHeight(e,c,r,s):l.updateHeight(e,c,r),d?this.balanced(i,l):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function _j(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof $r&&(r=t[e+1])instanceof $r&&t.splice(e-1,3,new $r(n.length+1+r.length))}const bW=5;class Mw{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof ei?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new ei(r-this.pos,-1)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e=bW)&&this.addLineDeco(s,i,l)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new ei(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new $r(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof ei)return e;let n=new ei(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof ei)&&!this.isCovered?this.nodes.push(new ei(0,-1)):(this.writtenTom.clientHeight||m.scrollWidth>m.clientWidth)&&p.overflow!="visible"){let x=m.getBoundingClientRect();i=Math.max(i,x.left),l=Math.min(l,x.right),c=Math.max(c,x.top),d=Math.min(h==t.parentNode?s.innerHeight:d,x.bottom)}h=p.position=="absolute"||p.position=="fixed"?m.offsetParent:m.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:i-n.left,right:Math.max(i,l)-n.left,top:c-(n.top+e),bottom:Math.max(c,d)-(n.top+e)}}function OW(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function jW(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class Ry{constructor(e,n,r,s){this.from=e,this.to=n,this.size=r,this.displaySize=s}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;rtypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new xW(n),this.stateDeco=e.facet(yf).filter(r=>typeof r!="function"),this.heightMap=ms.empty().applyChanges(this.stateDeco,Xt.empty,this.heightOracle.setDoc(e.doc),[new Ni(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Je.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!e.some(({from:i,to:l})=>s>=i&&s<=l)){let{from:i,to:l}=this.lineBlockAt(s);e.push(new ip(i,l))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Rj:new Ew(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Hh(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(yf).filter(m=>typeof m!="function");let s=e.changedRanges,i=Ni.extendWithRanges(s,wW(r,this.stateDeco,e?e.changes:kr.empty(this.state.doc.length))),l=this.heightMap.height,c=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Ej(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=l||fd)&&(e.flags|=2),c?(this.scrollAnchorPos=e.changes.mapPos(c.from,-1),this.scrollAnchorHeight=c.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=l);let d=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.headd.to)||!this.viewportIsAppropriate(d))&&(d=this.getViewport(0,n));let h=d.from!=this.viewport.from||d.to!=this.viewport.to;this.viewport=d,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(uM)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Hn.RTL:Hn.LTR;let l=this.heightOracle.mustRefreshForWrapping(i),c=n.getBoundingClientRect(),d=l||this.mustMeasureContent||this.contentDOMHeight!=c.height;this.contentDOMHeight=c.height,this.mustMeasureContent=!1;let h=0,m=0;if(c.width&&c.height){let{scaleX:_,scaleY:D}=IA(n,c);(_>.005&&Math.abs(this.scaleX-_)>.005||D>.005&&Math.abs(this.scaleY-D)>.005)&&(this.scaleX=_,this.scaleY=D,h|=16,l=d=!0)}let p=(parseInt(r.paddingTop)||0)*this.scaleY,x=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=p||this.paddingBottom!=x)&&(this.paddingTop=p,this.paddingBottom=x,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(d=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let v=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=v&&(this.scrollAnchorHeight=-1,this.scrollTop=v),this.scrolledToBottom=QA(e.scrollDOM);let b=(this.printing?jW:kW)(n,this.paddingTop),k=b.top-this.pixelViewport.top,O=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let j=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(j!=this.inView&&(this.inView=j,j&&(d=!0)),!this.inView&&!this.scrollTarget&&!OW(e.dom))return 0;let T=c.width;if((this.contentDOMWidth!=T||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=c.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),d){let _=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(_)&&(l=!0),l||s.lineWrapping&&Math.abs(T-this.contentDOMWidth)>s.charWidth){let{lineHeight:D,charWidth:E,textHeight:R}=e.docView.measureTextSize();l=D>0&&s.refresh(i,D,E,R,Math.max(5,T/E),_),l&&(e.docView.minWidth=0,h|=16)}k>0&&O>0?m=Math.max(k,O):k<0&&O<0&&(m=Math.min(k,O)),Ej();for(let D of this.viewports){let E=D.from==this.viewport.from?_:e.docView.measureVisibleLineHeights(D);this.heightMap=(l?ms.empty().applyChanges(this.stateDeco,Xt.empty,this.heightOracle,[new Ni(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,l,new vW(D.from,E))}fd&&(h|=2)}let A=!this.viewportIsAppropriate(this.viewport,m)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return A&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(m,this.scrollTarget),h|=this.updateForViewport()),(h&2||A)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(l?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:l,visibleBottom:c}=this,d=new ip(s.lineAt(l-r*1e3,$n.ByHeight,i,0,0).from,s.lineAt(c+(1-r)*1e3,$n.ByHeight,i,0,0).to);if(n){let{head:h}=n.range;if(hd.to){let m=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),p=s.lineAt(h,$n.ByPos,i,0,0),x;n.y=="center"?x=(p.top+p.bottom)/2-m/2:n.y=="start"||n.y=="nearest"&&h=c+Math.max(10,Math.min(r,250)))&&s>l-2*1e3&&i>1,l=s<<1;if(this.defaultTextDirection!=Hn.LTR&&!r)return[];let c=[],d=(m,p,x,v)=>{if(p-mm&&jj.from>=x.from&&j.to<=x.to&&Math.abs(j.from-m)j.fromT));if(!O){if(pA.from<=p&&A.to>=p)){let A=n.moveToLineBoundary(Ce.cursor(p),!1,!0).head;A>m&&(p=A)}let j=this.gapSize(x,m,p,v),T=r||j<2e6?j:2e6;O=new Ry(m,p,j,T)}c.push(O)},h=m=>{if(m.length2e6)for(let E of e)E.from>=m.from&&E.fromm.from&&d(m.from,v,m,p),bn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];Yt.spans(n,this.viewport.from,this.viewport.to,{span(i,l){r.push({from:i,to:l})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||Hh(this.heightMap.lineAt(e,$n.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||Hh(this.heightMap.lineAt(this.scaler.fromDOM(e),$n.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return Hh(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}let ip=class{constructor(e,n){this.from=e,this.to=n}};function CW(t,e,n){let r=[],s=t,i=0;return Yt.spans(n,t,e,{span(){},point(l,c){l>s&&(r.push({from:s,to:l}),i+=l-s),s=c}},20),s=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let s=0;;s++){let{from:i,to:l}=e[s],c=l-i;if(r<=c)return i+r;r-=c}}function lp(t,e){let n=0;for(let{from:r,to:s}of t.ranges){if(e<=s){n+=e-r;break}n+=s-r}return n/t.total}function TW(t,e){for(let n of t)if(e(n))return n}const Rj={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class Ew{constructor(e,n,r){let s=0,i=0,l=0;this.viewports=r.map(({from:c,to:d})=>{let h=n.lineAt(c,$n.ByPos,e,0,0).top,m=n.lineAt(d,$n.ByPos,e,0,0).bottom;return s+=m-h,{from:c,to:d,top:h,bottom:m,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let c of this.viewports)c.domTop=l+(c.top-i)*this.scale,l=c.domBottom=c.domTop+(c.bottom-c.top),i=c.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let i=nn.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function Hh(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new ca(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>Hh(s,e)):t._content)}const op=He.define({combine:t=>t.join(" ")}),$2=He.define({combine:t=>t.indexOf(!0)>-1}),H2=fo.newName(),_M=fo.newName(),DM=fo.newName(),RM={"&light":"."+_M,"&dark":"."+DM};function U2(t,e,n){return new fo(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return t;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):t+" "+r}})}const AW=U2("."+H2,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},RM),MW={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},zy=Fe.ie&&Fe.ie_version<=11;class EW{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new fV,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(Fe.ie&&Fe.ie_version<=11||Fe.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Fe.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Fe.chrome&&Fe.chrome_version<126)&&(this.editContext=new DW(e),e.state.facet(il)&&(e.contentDOM.editContext=this.editContext.editContext)),zy&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(il)?r.root.activeElement!=this.dom:!Kp(this.dom,s))return;let i=s.anchorNode&&r.docView.nearest(s.anchorNode);if(i&&i.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Fe.ie&&Fe.ie_version<=11||Fe.android&&Fe.chrome)&&!r.state.selection.main.empty&&s.focusNode&&ef(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=vf(e.root);if(!n)return!1;let r=Fe.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&_W(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=Kp(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&Gu(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of e){let l=this.readMutation(i);l&&(l.typeOver&&(s=!0),n==-1?{from:n,to:r}=l:(n=Math.min(l.from,n),r=Math.max(l.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&Kp(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new YV(this.view,e,n,r);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,s=wM(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let r=zj(n,e.previousSibling||e.target.previousSibling,-1),s=zj(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(il)!=e.state.facet(il)&&(e.view.contentDOM.editContext=e.state.facet(il)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function zj(t,e,n){for(;e;){let r=jn.get(e);if(r&&r.parent==t)return r;let s=e.parentNode;e=s!=t.dom?s:n>0?e.nextSibling:e.previousSibling}return null}function Pj(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,l=t.docView.domAtPos(t.state.selection.main.anchor);return ef(l.node,l.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function _W(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return Pj(t,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?Pj(t,n):null}class DW{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let s=e.state.selection.main,{anchor:i,head:l}=s,c=this.toEditorPos(r.updateRangeStart),d=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:c,drifted:!1});let h=d-c>r.text.length;c==this.from&&ithis.to&&(d=i);let m=SM(e.state.sliceDoc(c,d),r.text,(h?s.from:s.to)-c,h?"end":null);if(!m){let x=Ce.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));x.main.eq(s)||e.dispatch({selection:x,userEvent:"select"});return}let p={from:m.from+c,to:m.toA+c,insert:Xt.of(r.text.slice(m.from,m.toB).split(` -`))};if((Fe.mac||Fe.android)&&p.from==l-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(p={from:c,to:d,insert:Xt.of([r.text.replace("."," ")])}),this.pendingContextChange=p,!e.state.readOnly){let x=this.to-this.from+(p.to-p.from+p.insert.length);Aw(e,p,Ce.single(this.toEditorPos(r.selectionStart,x),this.toEditorPos(r.selectionEnd,x)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),p.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let l=this.toEditorPos(r.rangeStart),c=this.toEditorPos(r.rangeEnd);l{let s=[];for(let i of r.getTextFormats()){let l=i.underlineStyle,c=i.underlineThickness;if(!/none/i.test(l)&&!/none/i.test(c)){let d=this.toEditorPos(i.rangeStart),h=this.toEditorPos(i.rangeEnd);if(d{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=vf(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((i,l,c,d,h)=>{if(r)return;let m=h.length-(l-i);if(s&&l>=s.to)if(s.from==i&&s.to==l&&s.insert.eq(h)){s=this.pendingContextChange=null,n+=m,this.to+=m;return}else s=null,this.revertPending(e.state);if(i+=n,l+=n,l<=this.from)this.from+=m,this.to+=m;else if(ithis.to||this.to-this.from+h.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(l),h.toString()),this.to+=m}n+=m}),s&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class qe{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(s=>s.forEach(i=>r(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||mV(e.parent)||document,this.viewState=new Dj(e.state||Vt.create(e)),e.scrollTo&&e.scrollTo.is(np)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Fu).map(s=>new Ey(s));for(let s of this.plugins)s.update(this);this.observer=new EW(this),this.inputState=new eW(this),this.inputState.ensureHandlers(this.plugins),this.docView=new mj(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof gr?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let x of e){if(x.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=x.state}if(this.destroyed){this.viewState.state=i;return}let l=this.hasFocus,c=0,d=null;e.some(x=>x.annotation(TM))?(this.inputState.notifiedFocused=l,c=1):l!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=l,d=AM(i,l),d||(c=1));let h=this.observer.delayedAndroidKey,m=null;if(h?(this.observer.clearDelayedAndroidKey(),m=this.observer.readChange(),(m&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(m=null)):this.observer.clear(),i.facet(Vt.phrases)!=this.state.facet(Vt.phrases))return this.setState(i);s=Ng.create(this,i,e),s.flags|=c;let p=this.viewState.scrollTarget;try{this.updateState=2;for(let x of e){if(p&&(p=p.map(x.changes)),x.scrollIntoView){let{main:v}=x.state.selection;p=new Xu(v.empty?v:Ce.cursor(v.head,v.head>v.anchor?-1:1))}for(let v of x.effects)v.is(np)&&(p=v.value.clip(this.state))}this.viewState.update(s,p),this.bidiCache=Tg.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(Qh)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(x=>x.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(op)!=s.state.facet(op)&&(this.viewState.mustMeasureContent=!0),(n||r||p||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let x of this.state.facet(I2))try{x(s)}catch(v){_s(this.state,v,"update listener")}(d||m)&&Promise.resolve().then(()=>{d&&this.state==d.startState&&this.dispatch(d),m&&!wM(this,m)&&h.force&&Gu(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new Dj(e),this.plugins=e.facet(Fu).map(r=>new Ey(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new mj(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Fu),r=e.state.facet(Fu);if(n!=r){let s=[];for(let i of r){let l=n.indexOf(i);if(l<0)s.push(new Ey(i));else{let c=this.plugins[l];c.mustUpdate=e,s.push(c)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:l}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(l=-1),this.viewState.scrollAnchorHeight=-1;try{for(let c=0;;c++){if(l<0)if(QA(r))i=-1,l=this.viewState.heightMap.height;else{let v=this.viewState.scrollAnchorAt(s);i=v.from,l=v.top}this.updateState=1;let d=this.viewState.measure(this);if(!d&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(c>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];d&4||([this.measureRequests,h]=[h,this.measureRequests]);let m=h.map(v=>{try{return v.read(this)}catch(b){return _s(this.state,b),Bj}}),p=Ng.create(this,this.state,[]),x=!1;p.flags|=d,n?n.flags|=d:n=p,this.updateState=2,p.empty||(this.updatePlugins(p),this.inputState.update(p),this.updateAttrs(),x=this.docView.update(p),x&&this.docViewUpdate());for(let v=0;v1||b<-1){s=s+b,r.scrollTop=s/this.scaleY,l=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let c of this.state.facet(I2))c(n)}get themeClasses(){return H2+" "+(this.state.facet($2)?DM:_M)+" "+this.state.facet(op)}updateAttrs(){let e=Lj(this,fM,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(il)?"true":"false",class:"cm-content",style:`${Fe.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),Lj(this,Cw,n);let r=this.observer.ignore(()=>{let s=R2(this.contentDOM,this.contentAttrs,n),i=R2(this.dom,this.editorAttrs,e);return s||i});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let s of r.effects)if(s.is(qe.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Qh);let e=this.state.facet(qe.cspNonce);fo.mount(this.root,this.styleModules.concat(AW).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;nr.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return Dy(this,e,yj(this,e,n,r))}moveByGroup(e,n){return Dy(this,e,yj(this,e,n,r=>UV(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),i=r[n?r.length-1:0];return Ce.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return HV(this,e,n,r)}moveVertically(e,n,r){return Dy(this,e,VV(this,e,n,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),vM(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(e),i=this.bidiSpans(s),l=i[so.find(i,e-s.from,-1,n)];return s0(r,l.dir==Hn.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(cM)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>RW)return tM(e.length);let n=this.textDirectionAt(e.from),r;for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||eM(i.isolates,r=fj(this,e))))return i.order;r||(r=fj(this,e));let s=TV(e.text,n,r);return this.bidiCache.push(new Tg(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Fe.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{qA(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return np.of(new Xu(typeof e=="number"?Ce.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return np.of(new Xu(Ce.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return lr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return lr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=fo.newName(),s=[op.of(r),Qh.of(U2(`.${r}`,e))];return n&&n.dark&&s.push($2.of(!0)),s}static baseTheme(e){return No.lowest(Qh.of(U2("."+H2,e,RM)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&jn.get(r)||jn.get(e);return((n=s?.rootView)===null||n===void 0?void 0:n.view)||null}}qe.styleModule=Qh;qe.inputHandler=lM;qe.clipboardInputFilter=jw;qe.clipboardOutputFilter=Nw;qe.scrollHandler=dM;qe.focusChangeEffect=oM;qe.perLineTextDirection=cM;qe.exceptionSink=aM;qe.updateListener=I2;qe.editable=il;qe.mouseSelectionStyle=iM;qe.dragMovesSelection=sM;qe.clickAddsSelectionRange=rM;qe.decorations=yf;qe.outerDecorations=mM;qe.atomicRanges=l0;qe.bidiIsolatedRanges=pM;qe.scrollMargins=gM;qe.darkTheme=$2;qe.cspNonce=He.define({combine:t=>t.length?t[0]:""});qe.contentAttributes=Cw;qe.editorAttributes=fM;qe.lineWrapping=qe.contentAttributes.of({class:"cm-lineWrapping"});qe.announce=vt.define();const RW=4096,Bj={};class Tg{constructor(e,n,r,s,i,l){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=l}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:Hn.LTR;for(let i=Math.max(0,e.length-10);i=0;s--){let i=r[s],l=typeof i=="function"?i(t):i;l&&D2(l,n)}return n}const zW=Fe.mac?"mac":Fe.windows?"win":Fe.linux?"linux":"key";function PW(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,l,c;for(let d=0;dr.concat(s),[]))),n}function LW(t,e,n){return PM(zM(t.state),e,t,n)}let no=null;const IW=4e3;function qW(t,e=zW){let n=Object.create(null),r=Object.create(null),s=(l,c)=>{let d=r[l];if(d==null)r[l]=c;else if(d!=c)throw new Error("Key binding "+l+" is used both as a regular binding and as a multi-stroke prefix")},i=(l,c,d,h,m)=>{var p,x;let v=n[l]||(n[l]=Object.create(null)),b=c.split(/ (?!$)/).map(j=>PW(j,e));for(let j=1;j{let _=no={view:A,prefix:T,scope:l};return setTimeout(()=>{no==_&&(no=null)},IW),!0}]})}let k=b.join(" ");s(k,!1);let O=v[k]||(v[k]={preventDefault:!1,stopPropagation:!1,run:((x=(p=v._any)===null||p===void 0?void 0:p.run)===null||x===void 0?void 0:x.slice())||[]});d&&O.run.push(d),h&&(O.preventDefault=!0),m&&(O.stopPropagation=!0)};for(let l of t){let c=l.scope?l.scope.split(" "):["editor"];if(l.any)for(let h of c){let m=n[h]||(n[h]=Object.create(null));m._any||(m._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:p}=l;for(let x in m)m[x].run.push(v=>p(v,V2))}let d=l[e]||l.key;if(d)for(let h of c)i(h,d,l.run,l.preventDefault,l.stopPropagation),l.shift&&i(h,"Shift-"+d,l.shift,l.preventDefault,l.stopPropagation)}return n}let V2=null;function PM(t,e,n,r){V2=e;let s=oV(e),i=As(s,0),l=oa(i)==s.length&&s!=" ",c="",d=!1,h=!1,m=!1;no&&no.view==n&&no.scope==r&&(c=no.prefix+" ",OM.indexOf(e.keyCode)<0&&(h=!0,no=null));let p=new Set,x=O=>{if(O){for(let j of O.run)if(!p.has(j)&&(p.add(j),j(n)))return O.stopPropagation&&(m=!0),!0;O.preventDefault&&(O.stopPropagation&&(m=!0),h=!0)}return!1},v=t[r],b,k;return v&&(x(v[c+cp(s,e,!l)])?d=!0:l&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Fe.windows&&e.ctrlKey&&e.altKey)&&!(Fe.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(b=mo[e.keyCode])&&b!=s?(x(v[c+cp(b,e,!0)])||e.shiftKey&&(k=xf[e.keyCode])!=s&&k!=b&&x(v[c+cp(k,e,!1)]))&&(d=!0):l&&e.shiftKey&&x(v[c+cp(s,e,!0)])&&(d=!0),!d&&x(v._any)&&(d=!0)),h&&(d=!0),d&&m&&e.stopPropagation(),V2=null,d}class c0{constructor(e,n,r,s,i){this.className=e,this.left=n,this.top=r,this.width=s,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let s=e.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let i=BM(e);return[new c0(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return FW(e,n,r)}}function BM(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Hn.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function qj(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let i=t.dom.getBoundingClientRect(),l=(s.top+s.bottom)/2,c=t.posAtCoords({x:i.left+1,y:l}),d=t.posAtCoords({x:i.right-1,y:l});return c==null||d==null?r:{from:Math.max(r.from,Math.min(c,d)),to:Math.min(r.to,Math.max(c,d))}}function FW(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),s=Math.min(n.to,t.viewport.to),i=t.textDirection==Hn.LTR,l=t.contentDOM,c=l.getBoundingClientRect(),d=BM(t),h=l.querySelector(".cm-line"),m=h&&window.getComputedStyle(h),p=c.left+(m?parseInt(m.paddingLeft)+Math.min(0,parseInt(m.textIndent)):0),x=c.right-(m?parseInt(m.paddingRight):0),v=F2(t,r,1),b=F2(t,s,-1),k=v.type==fs.Text?v:null,O=b.type==fs.Text?b:null;if(k&&(t.lineWrapping||v.widgetLineBreaks)&&(k=qj(t,r,1,k)),O&&(t.lineWrapping||b.widgetLineBreaks)&&(O=qj(t,s,-1,O)),k&&O&&k.from==O.from&&k.to==O.to)return T(A(n.from,n.to,k));{let D=k?A(n.from,null,k):_(v,!1),E=O?A(null,n.to,O):_(b,!0),R=[];return(k||v).to<(O||b).from-(k&&O?1:0)||v.widgetLineBreaks>1&&D.bottom+t.defaultLineHeight/2V&&W.from=$)break;z>J&&U(Math.max(ce,J),D==null&&ce<=V,Math.min(z,$),E==null&&z>=de,ne.dir)}if(J=ae.to+1,J>=$)break}return L.length==0&&U(V,D==null,de,E==null,t.textDirection),{top:Q,bottom:F,horizontal:L}}function _(D,E){let R=c.top+(E?D.top:D.bottom);return{top:R,bottom:R,horizontal:[]}}}function QW(t,e){return t.constructor==e.constructor&&t.eq(e)}class $W{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(eg)!=e.state.facet(eg)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(eg);for(;n!QW(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of e)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=e,Fe.safari&&Fe.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const eg=He.define();function LM(t){return[lr.define(e=>new $W(e,t)),eg.of(t)]}const bf=He.define({combine(t){return Oa(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function HW(t={}){return[bf.of(t),UW,VW,WW,uM.of(!0)]}function IM(t){return t.startState.facet(bf)!=t.state.facet(bf)}const UW=LM({above:!0,markers(t){let{state:e}=t,n=e.facet(bf),r=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||n.drawRangeCursor){let l=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",c=s.empty?s:Ce.cursor(s.head,s.head>s.anchor?-1:1);for(let d of c0.forRange(t,l,c))r.push(d)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=IM(t);return n&&Fj(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){Fj(e.state,t)},class:"cm-cursorLayer"});function Fj(t,e){e.style.animationDuration=t.facet(bf).cursorBlinkRate+"ms"}const VW=LM({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:c0.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||IM(t)},class:"cm-selectionLayer"}),WW=No.highest(qe.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),qM=vt.define({map(t,e){return t==null?null:e.mapPos(t)}}),Uh=Br.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(qM)?r.value:n,t)}}),GW=lr.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(Uh);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Uh)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Uh),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Uh)!=t&&this.view.dispatch({effects:qM.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function XW(){return[Uh,GW]}function Qj(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),l=n,c;!i.next().done;l+=i.value.length)if(!i.lineBreak)for(;c=e.exec(i.value);)s(l+c.index,c)}function YW(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:s,to:i}of n)s=Math.max(t.state.doc.lineAt(s).from,s-e),i=Math.min(t.state.doc.lineAt(i).to,i+e),r.length&&r[r.length-1].to>=s?r[r.length-1].to=i:r.push({from:s,to:i});return r}class KW{constructor(e){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:l=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(c,d,h,m)=>s(m,h,h+c[0].length,c,d);else if(typeof r=="function")this.addMatch=(c,d,h,m)=>{let p=r(c,d,h);p&&m(h,h+c[0].length,p)};else if(r)this.addMatch=(c,d,h,m)=>m(h,h+c[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=l}createDeco(e){let n=new ml,r=n.add.bind(n);for(let{from:s,to:i}of YW(e,this.maxLength))Qj(e.state.doc,this.regexp,s,i,(l,c)=>this.addMatch(c,e,l,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,l,c,d)=>{d>=e.view.viewport.from&&c<=e.view.viewport.to&&(r=Math.min(c,r),s=Math.max(d,s))}),e.viewportMoved||s-r>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,n.map(e.changes),r,s):n}updateRange(e,n,r,s){for(let i of e.visibleRanges){let l=Math.max(i.from,r),c=Math.min(i.to,s);if(c>=l){let d=e.state.doc.lineAt(l),h=d.tod.from;l--)if(this.boundary.test(d.text[l-1-d.from])){m=l;break}for(;cx.push(j.range(k,O));if(d==h)for(this.regexp.lastIndex=m-d.from;(v=this.regexp.exec(d.text))&&v.indexthis.addMatch(O,e,k,b));n=n.update({filterFrom:m,filterTo:p,filter:(k,O)=>kp,add:x})}}return n}}const W2=/x/.unicode!=null?"gu":"g",ZW=new RegExp(`[\0-\b ---Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,W2),JW={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Py=null;function eG(){var t;if(Py==null&&typeof document<"u"&&document.body){let e=document.body.style;Py=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Py||!1}const tg=He.define({combine(t){let e=Oa(t,{render:null,specialChars:ZW,addSpecialChars:null});return(e.replaceTabs=!eG())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,W2)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,W2)),e}});function tG(t={}){return[tg.of(t),nG()]}let $j=null;function nG(){return $j||($j=lr.fromClass(class{constructor(t){this.view=t,this.decorations=Je.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(tg)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new KW({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=As(e[0],0);if(i==9){let l=s.lineAt(r),c=n.state.tabSize,d=Td(l.text,c,r-l.from);return Je.replace({widget:new aG((c-d%c)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=Je.replace({widget:new iG(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(tg);t.startState.facet(tg)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const rG="•";function sG(t){return t>=32?rG:t==10?"␤":String.fromCharCode(9216+t)}class iG extends ja{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=sG(this.code),r=e.state.phrase("Control character")+" "+(JW[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,n);if(s)return s;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class aG extends ja{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function lG(){return cG}const oG=Je.line({class:"cm-activeLine"}),cG=lr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let s=t.lineBlockAt(r.head);s.from>e&&(n.push(oG.range(s.from)),e=s.from)}return Je.set(n)}},{decorations:t=>t.decorations});class uG extends ja{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?ud(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),s=s0(n[0],r.direction!="rtl"),i=parseInt(r.lineHeight);return s.bottom-s.top>i*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+i}:s}ignoreEvent(){return!1}}function dG(t){let e=lr.fromClass(class{constructor(n){this.view=n,this.placeholder=t?Je.set([Je.widget({widget:new uG(t),side:1}).range(0)]):Je.none}get decorations(){return this.view.state.doc.length?Je.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,qe.contentAttributes.of({"aria-placeholder":t})]:e}const G2=2e3;function hG(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>G2||n.off>G2||e.col<0||n.col<0){let l=Math.min(e.off,n.off),c=Math.max(e.off,n.off);for(let d=r;d<=s;d++){let h=t.doc.line(d);h.length<=c&&i.push(Ce.range(h.from+l,h.to+c))}}else{let l=Math.min(e.col,n.col),c=Math.max(e.col,n.col);for(let d=r;d<=s;d++){let h=t.doc.line(d),m=j2(h.text,l,t.tabSize,!0);if(m<0)i.push(Ce.cursor(h.to));else{let p=j2(h.text,c,t.tabSize);i.push(Ce.range(h.from+m,h.from+p))}}}return i}function fG(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function Hj(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),s=n-r.from,i=s>G2?-1:s==r.length?fG(t,e.clientX):Td(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function mG(t,e){let n=Hj(t,e),r=t.state.selection;return n?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(n.line).from),l=s.state.doc.lineAt(i);n={line:l.number,col:n.col,off:Math.min(n.off,l.length)},r=r.map(s.changes)}},get(s,i,l){let c=Hj(t,s);if(!c)return r;let d=hG(t.state,n,c);return d.length?l?Ce.create(d.concat(r.ranges)):Ce.create(d):r}}:null}function pG(t){let e=(n=>n.altKey&&n.button==0);return qe.mouseSelectionStyle.of((n,r)=>e(r)?mG(n,r):null)}const gG={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},xG={style:"cursor: crosshair"};function vG(t={}){let[e,n]=gG[t.key||"Alt"],r=lr.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||n(s))},keyup(s){(s.keyCode==e||!n(s))&&this.set(!1)},mousemove(s){this.set(n(s))}}});return[r,qe.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?xG:null})]}const up="-10000px";class FM{constructor(e,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=e.state.facet(n),this.tooltips=this.input.filter(l=>l);let i=null;this.tooltipViews=this.tooltips.map(l=>i=r(l,i))}update(e,n){var r;let s=e.state.facet(this.facet),i=s.filter(d=>d);if(s===this.input){for(let d of this.tooltipViews)d.update&&d.update(e);return!1}let l=[],c=n?[]:null;for(let d=0;dn[h]=d),n.length=c.length),this.input=s,this.tooltips=i,this.tooltipViews=l,!0}}function yG(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const By=He.define({combine:t=>{var e,n,r;return{position:Fe.ios?"absolute":((e=t.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(s=>s.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||yG}}}),Uj=new WeakMap,_w=lr.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(By);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new FM(t,Dw,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(By);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",n.dom.appendChild(s)}return n.dom.style.position=this.position,n.dom.style.top=up,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(Fe.safari){let l=i.getBoundingClientRect();n=Math.abs(l.top+1e4)>1||Math.abs(l.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=Tw(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,l)=>{let c=this.manager.tooltipViews[l];return c.getCoords?c.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(By).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let c of this.manager.tooltipViews)c.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,l=[];for(let c=0;c=Math.min(n.bottom,r.bottom)||p.rightMath.min(n.right,r.right)+.1)){m.style.top=up;continue}let v=d.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,b=v?7:0,k=x.right-x.left,O=(e=Uj.get(h))!==null&&e!==void 0?e:x.bottom-x.top,j=h.offset||wG,T=this.view.textDirection==Hn.LTR,A=x.width>r.right-r.left?T?r.left:r.right-x.width:T?Math.max(r.left,Math.min(p.left-(v?14:0)+j.x,r.right-k)):Math.min(Math.max(r.left,p.left-k+(v?14:0)-j.x),r.right-k),_=this.above[c];!d.strictSide&&(_?p.top-O-b-j.yr.bottom)&&_==r.bottom-p.bottom>p.top-r.top&&(_=this.above[c]=!_);let D=(_?p.top-r.top:r.bottom-p.bottom)-b;if(DA&&Q.topE&&(E=_?Q.top-O-2-b:Q.bottom+b+2);if(this.position=="absolute"?(m.style.top=(E-t.parent.top)/i+"px",Vj(m,(A-t.parent.left)/s)):(m.style.top=E/i+"px",Vj(m,A/s)),v){let Q=p.left+(T?j.x:-j.x)-(A+14-7);v.style.left=Q/s+"px"}h.overlap!==!0&&l.push({left:A,top:E,right:R,bottom:E+O}),m.classList.toggle("cm-tooltip-above",_),m.classList.toggle("cm-tooltip-below",!_),h.positioned&&h.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=up}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Vj(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const bG=qe.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),wG={x:0,y:0},Dw=He.define({enables:[_w,bG]}),Ag=He.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Ox{static create(e){return new Ox(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new FM(e,Ag,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let s=r[e];if(s!==void 0){if(n===void 0)n=s;else if(n!==s)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const SG=Dw.compute([Ag],t=>{let e=t.facet(Ag);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:Ox.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class kG{constructor(e,n,r,s,i){this.view=e,this.source=n,this.field=r,this.setHover=s,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;ec.bottom||n.xc.right+e.defaultCharacterWidth)return;let d=e.bidiSpans(e.state.doc.lineAt(s)).find(m=>m.from<=s&&m.to>=s),h=d&&d.dir==Hn.RTL?-1:1;i=n.x{this.pending==c&&(this.pending=null,d&&!(Array.isArray(d)&&!d.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(d)?d:[d])}))},d=>_s(e.state,d,"hover tooltip"))}else l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])})}get tooltip(){let e=this.view.plugin(_w),n=e?e.manager.tooltips.findIndex(r=>r.create==Ox.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:i}=this;if(s.length&&i&&!OG(i.dom,e)||this.pending){let{pos:l}=s[0]||this.pending,c=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:l;(l==c?this.view.posAtCoords(this.lastMove)!=l:!jG(this.view,l,c,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const dp=4;function OG(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),l;if(l=t.querySelector(".cm-tooltip-arrow")){let c=l.getBoundingClientRect();s=Math.min(c.top,s),i=Math.max(c.bottom,i)}return e.clientX>=n-dp&&e.clientX<=r+dp&&e.clientY>=s-dp&&e.clientY<=i+dp}function jG(t,e,n,r,s,i){let l=t.scrollDOM.getBoundingClientRect(),c=t.documentTop+t.documentPadding.top+t.contentHeight;if(l.left>r||l.rights||Math.min(l.bottom,c)=e&&d<=n}function NG(t,e={}){let n=vt.define(),r=Br.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(l=>!e.hideOn(i,l))),i.docChanged)){let l=[];for(let c of s){let d=i.changes.mapPos(c.pos,-1,Ur.TrackDel);if(d!=null){let h=Object.assign(Object.create(null),c);h.pos=d,h.end!=null&&(h.end=i.changes.mapPos(h.end)),l.push(h)}}s=l}for(let l of i.effects)l.is(n)&&(s=l.value),l.is(CG)&&(s=[]);return s},provide:s=>Ag.from(s)});return{active:r,extension:[r,lr.define(s=>new kG(s,t,r,n,e.hoverTime||300)),SG]}}function QM(t,e){let n=t.plugin(_w);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const CG=vt.define(),Wj=He.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function wf(t,e){let n=t.plugin($M),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const $M=lr.fromClass(class{constructor(t){this.input=t.state.facet(Sf),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(Wj);this.top=new hp(t,!0,e.topContainer),this.bottom=new hp(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(Wj);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new hp(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new hp(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Sf);if(n!=this.input){let r=n.filter(d=>d),s=[],i=[],l=[],c=[];for(let d of r){let h=this.specs.indexOf(d),m;h<0?(m=d(t.view),c.push(m)):(m=this.panels[h],m.update&&m.update(t)),s.push(m),(m.top?i:l).push(m)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(l);for(let d of c)d.dom.classList.add("cm-panel"),d.mount&&d.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>qe.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class hp{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=Gj(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=Gj(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Gj(t){let e=t.nextSibling;return t.remove(),e}const Sf=He.define({enables:$M});class gl extends yc{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}gl.prototype.elementClass="";gl.prototype.toDOM=void 0;gl.prototype.mapMode=Ur.TrackBefore;gl.prototype.startSide=gl.prototype.endSide=-1;gl.prototype.point=!0;const ng=He.define(),TG=He.define(),AG={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Yt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},rf=He.define();function MG(t){return[HM(),rf.of({...AG,...t})]}const Xj=He.define({combine:t=>t.some(e=>e)});function HM(t){return[EG]}const EG=lr.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(rf).map(e=>new Kj(t,e)),this.fixed=!t.state.facet(Xj);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Xj)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=Yt.iter(this.view.state.facet(ng),this.view.viewport.from),r=[],s=this.gutters.map(i=>new _G(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let l=!0;for(let c of i.type)if(c.type==fs.Text&&l){X2(n,r,c.from);for(let d of s)d.line(this.view,c,r);l=!1}else if(c.widget)for(let d of s)d.widget(this.view,c)}else if(i.type==fs.Text){X2(n,r,i.from);for(let l of s)l.line(this.view,i,r)}else if(i.widget)for(let l of s)l.widget(this.view,i);for(let i of s)i.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(rf),n=t.state.facet(rf),r=t.docChanged||t.heightChanged||t.viewportChanged||!Yt.eq(t.startState.facet(ng),t.state.facet(ng),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let i of n){let l=e.indexOf(i);l<0?s.push(new Kj(this.view,i)):(this.gutters[l].update(t),s.push(this.gutters[l]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>qe.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,s=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Hn.LTR?{left:r,right:s}:{right:r,left:s}})});function Yj(t){return Array.isArray(t)?t:[t]}function X2(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class _G{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Yt.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,i=(n.top-this.height)/e.scaleY,l=n.height/e.scaleY;if(this.i==s.elements.length){let c=new UM(e,l,i,r);s.elements.push(c),s.dom.appendChild(c.dom)}else s.elements[this.i].update(e,l,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];X2(this.cursor,s,n.from),r.length&&(s=s.concat(r));let i=this.gutter.config.lineMarker(e,n,s);i&&s.unshift(i);let l=this.gutter;s.length==0&&!l.config.renderEmptyElements||this.addElement(e,n,s)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),s=r?[r]:null;for(let i of e.state.facet(TG)){let l=i(e,n.widget,n);l&&(s||(s=[])).push(l)}s&&this.addElement(e,n,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class Kj{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let i=s.target,l;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let d=i.getBoundingClientRect();l=(d.top+d.bottom)/2}else l=s.clientY;let c=e.lineBlockAtHeight(l-e.documentTop);n.domEventHandlers[r](e,c,s)&&s.preventDefault()});this.markers=Yj(n.markers(e)),n.initialSpacer&&(this.spacer=new UM(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=Yj(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let r=e.view.viewport;return!Yt.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class UM{constructor(e,n,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,s)}update(e,n,r,s){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),DG(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,l=0;;){let c=l,d=ii(c,d,h)||l(c,d,h):l}return r}})}});class Ly extends gl{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Iy(t,e){return t.state.facet(Qu).formatNumber(e,t.state)}const PG=rf.compute([Qu],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(RG)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new Ly(Iy(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(zG)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Qu)!=e.state.facet(Qu),initialSpacer(e){return new Ly(Iy(e,Zj(e.state.doc.lines)))},updateSpacer(e,n){let r=Iy(n.view,Zj(n.view.state.doc.lines));return r==e.number?e:new Ly(r)},domEventHandlers:t.facet(Qu).domEventHandlers,side:"before"}));function BG(t={}){return[Qu.of(t),HM(),PG]}function Zj(t){let e=9;for(;e{let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>n&&(n=s,e.push(LG.range(s)))}return Yt.of(e)});function qG(){return IG}const VM=1024;let FG=0;class qy{constructor(e,n){this.from=e,this.to=n}}class Et{constructor(e={}){this.id=FG++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=gs.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Et.closedBy=new Et({deserialize:t=>t.split(" ")});Et.openedBy=new Et({deserialize:t=>t.split(" ")});Et.group=new Et({deserialize:t=>t.split(" ")});Et.isolate=new Et({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Et.contextHash=new Et({perNode:!0});Et.lookAhead=new Et({perNode:!0});Et.mounted=new Et({perNode:!0});class Mg{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[Et.mounted.id]}}const QG=Object.create(null);class gs{constructor(e,n,r,s=0){this.name=e,this.props=n,this.id=r,this.flags=s}static define(e){let n=e.props&&e.props.length?Object.create(null):QG,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new gs(e.name||"",n,e.id,r);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(s)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Et.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let s of r.split(" "))n[s]=e[r];return r=>{for(let s=r.prop(Et.group),i=-1;i<(s?s.length:0);i++){let l=n[i<0?r.name:s[i]];if(l)return l}}}}gs.none=new gs("",Object.create(null),0,8);class jx{constructor(e){this.types=e;for(let n=0;n0;for(let d=this.cursor(l|Or.IncludeAnonymous);;){let h=!1;if(d.from<=i&&d.to>=s&&(!c&&d.type.isAnonymous||n(d)!==!1)){if(d.firstChild())continue;h=!0}for(;h&&r&&(c||!d.type.isAnonymous)&&r(d),!d.nextSibling();){if(!d.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Pw(gs.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new Dn(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new Dn(gs.none,n,r,s)))}static build(e){return VG(e)}}Dn.empty=new Dn(gs.none,[],[],0);class Rw{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Rw(this.buffer,this.index)}}class go{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return gs.none}toString(){let e=[];for(let n=0;n0));d=l[d+3]);return c}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),l=0;for(let c=e,d=0;c=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function kf(t,e,n,r){for(var s;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?c.length:-1;e!=h;e+=n){let m=c[e],p=d[e]+l.from;if(WM(s,r,p,p+m.length)){if(m instanceof go){if(i&Or.ExcludeBuffers)continue;let x=m.findChild(0,m.buffer.length,n,r-p,s);if(x>-1)return new ha(new $G(l,m,e,p),null,x)}else if(i&Or.IncludeAnonymous||!m.type.isAnonymous||zw(m)){let x;if(!(i&Or.IgnoreMounts)&&(x=Mg.get(m))&&!x.overlay)return new Ps(x.tree,p,e,l);let v=new Ps(m,p,e,l);return i&Or.IncludeAnonymous||!v.type.isAnonymous?v:v.nextChild(n<0?m.children.length-1:0,n,r,s)}}}if(i&Or.IncludeAnonymous||!l.type.isAnonymous||(l.index>=0?e=l.index+n:e=n<0?-1:l._parent._tree.children.length,l=l._parent,!l))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let s;if(!(r&Or.IgnoreOverlays)&&(s=Mg.get(this._tree))&&s.overlay){let i=e-this.from;for(let{from:l,to:c}of s.overlay)if((n>0?l<=i:l=i:c>i))return new Ps(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function e7(t,e,n,r){let s=t.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let l=!1;!l;)if(l=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(e)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function Y2(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class $G{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class ha extends GM{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.context.start,r);return i<0?null:new ha(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&Or.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return i<0?null:new ha(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new ha(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new ha(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let l=r.buffer[this.index+1];e.push(r.slice(s,i,l)),n.push(0)}return new Dn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function XM(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;in.from||l.to=e){let c=new Ps(l.tree,l.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(kf(c,e,n,!1))}}return s?XM(s):r}class K2{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ps)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof Ps?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Or.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Or.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Or.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let i=n+e,l=e<0?-1:r._tree.children.length;i!=l;i+=e){let c=r._tree.children[i];if(this.mode&Or.IncludeAnonymous||c instanceof go||!c.type.isAnonymous||zw(c))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let l=e;l;l=l._parent)if(l.index==s){if(s==this.index)return l;n=l,r=i+1;break e}s=this.stack[--i]}for(let s=r;s=0;i--){if(i<0)return Y2(this._tree,e,s);let l=r[n.buffer[this.stack[i]]];if(!l.isAnonymous){if(e[s]&&e[s]!=l.name)return!1;s--}}return!0}}function zw(t){return t.children.some(e=>e instanceof go||!e.type.isAnonymous||zw(e))}function VG(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=VM,reused:i=[],minRepeatType:l=r.types.length}=t,c=Array.isArray(n)?new Rw(n,n.length):n,d=r.types,h=0,m=0;function p(D,E,R,Q,F,L){let{id:U,start:V,end:de,size:W}=c,J=m,$=h;if(W<0)if(c.next(),W==-1){let xe=i[U];R.push(xe),Q.push(V-D);return}else if(W==-3){h=U;return}else if(W==-4){m=U;return}else throw new RangeError(`Unrecognized record size: ${W}`);let ae=d[U],ne,ce,z=V-D;if(de-V<=s&&(ce=O(c.pos-E,F))){let xe=new Uint16Array(ce.size-ce.skip),Y=c.pos-ce.size,P=xe.length;for(;c.pos>Y;)P=j(ce.start,xe,P);ne=new go(xe,de-ce.start,r),z=ce.start-D}else{let xe=c.pos-W;c.next();let Y=[],P=[],K=U>=l?U:-1,H=0,fe=de;for(;c.pos>xe;)K>=0&&c.id==K&&c.size>=0?(c.end<=fe-s&&(b(Y,P,V,H,c.end,fe,K,J,$),H=Y.length,fe=c.end),c.next()):L>2500?x(V,xe,Y,P):p(V,xe,Y,P,K,L+1);if(K>=0&&H>0&&H-1&&H>0){let ve=v(ae,$);ne=Pw(ae,Y,P,0,Y.length,0,de-V,ve,ve)}else ne=k(ae,Y,P,de-V,J-de,$)}R.push(ne),Q.push(z)}function x(D,E,R,Q){let F=[],L=0,U=-1;for(;c.pos>E;){let{id:V,start:de,end:W,size:J}=c;if(J>4)c.next();else{if(U>-1&&de=0;W-=3)V[J++]=F[W],V[J++]=F[W+1]-de,V[J++]=F[W+2]-de,V[J++]=J;R.push(new go(V,F[2]-de,r)),Q.push(de-D)}}function v(D,E){return(R,Q,F)=>{let L=0,U=R.length-1,V,de;if(U>=0&&(V=R[U])instanceof Dn){if(!U&&V.type==D&&V.length==F)return V;(de=V.prop(Et.lookAhead))&&(L=Q[U]+V.length+de)}return k(D,R,Q,F,L,E)}}function b(D,E,R,Q,F,L,U,V,de){let W=[],J=[];for(;D.length>Q;)W.push(D.pop()),J.push(E.pop()+R-F);D.push(k(r.types[U],W,J,L-F,V-L,de)),E.push(F-R)}function k(D,E,R,Q,F,L,U){if(L){let V=[Et.contextHash,L];U=U?[V].concat(U):[V]}if(F>25){let V=[Et.lookAhead,F];U=U?[V].concat(U):[V]}return new Dn(D,E,R,Q,U)}function O(D,E){let R=c.fork(),Q=0,F=0,L=0,U=R.end-s,V={size:0,start:0,skip:0};e:for(let de=R.pos-D;R.pos>de;){let W=R.size;if(R.id==E&&W>=0){V.size=Q,V.start=F,V.skip=L,L+=4,Q+=4,R.next();continue}let J=R.pos-W;if(W<0||J=l?4:0,ae=R.start;for(R.next();R.pos>J;){if(R.size<0)if(R.size==-3)$+=4;else break e;else R.id>=l&&($+=4);R.next()}F=ae,Q+=W,L+=$}return(E<0||Q==D)&&(V.size=Q,V.start=F,V.skip=L),V.size>4?V:void 0}function j(D,E,R){let{id:Q,start:F,end:L,size:U}=c;if(c.next(),U>=0&&Q4){let de=c.pos-(U-4);for(;c.pos>de;)R=j(D,E,R)}E[--R]=V,E[--R]=L-D,E[--R]=F-D,E[--R]=Q}else U==-3?h=Q:U==-4&&(m=Q);return R}let T=[],A=[];for(;c.pos>0;)p(t.start||0,t.bufferStart||0,T,A,-1,0);let _=(e=t.length)!==null&&e!==void 0?e:T.length?A[0]+T[0].length:0;return new Dn(d[t.topID],T.reverse(),A.reverse(),_)}const t7=new WeakMap;function rg(t,e){if(!t.isAnonymous||e instanceof go||e.type!=t)return 1;let n=t7.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Dn)){n=1;break}n+=rg(t,r)}t7.set(e,n)}return n}function Pw(t,e,n,r,s,i,l,c,d){let h=0;for(let b=r;b=m)break;E+=R}if(A==_+1){if(E>m){let R=b[_];v(R.children,R.positions,0,R.children.length,k[_]+T);continue}p.push(b[_])}else{let R=k[A-1]+b[A-1].length-D;p.push(Pw(t,b,k,_,A,D,R,null,d))}x.push(D+T-i)}}return v(e,n,r,s,0),(c||d)(p,x,l)}class WG{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof ha?this.setBuffer(e.context.buffer,e.index,n):e instanceof Ps&&this.map.set(e.tree,n)}get(e){return e instanceof ha?this.getBuffer(e.context.buffer,e.index):e instanceof Ps?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class pc{constructor(e,n,r,s,i=!1,l=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(l?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let s=[new pc(0,e.length,e,0,!1,r)];for(let i of n)i.to>e.length&&s.push(i);return s}static applyChanges(e,n,r=128){if(!n.length)return e;let s=[],i=1,l=e.length?e[0]:null;for(let c=0,d=0,h=0;;c++){let m=c=r)for(;l&&l.from=x.from||p<=x.to||h){let v=Math.max(x.from,d)-h,b=Math.min(x.to,p)-h;x=v>=b?null:new pc(v,b,x.tree,x.offset+h,c>0,!!m)}if(x&&s.push(x),l.to>p)break;l=inew qy(s.from,s.to)):[new qy(0,0)]:[new qy(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let s=this.startParse(e,n,r);for(;;){let i=s.advance();if(i)return i}}};class GG{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new Et({perNode:!0});let XG=0;class yi{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=XG++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof yi&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new yi(r,[],null,[]);if(s.set.push(s),n)for(let i of n.set)s.set.push(i);return s}static defineModifier(e){let n=new Eg(e);return r=>r.modified.indexOf(n)>-1?r:Eg.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let YG=0;class Eg{constructor(e){this.name=e,this.instances=[],this.id=YG++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(c=>c.base==e&&KG(n,c.modified));if(r)return r;let s=[],i=new yi(e.name,s,e,n);for(let c of n)c.instances.push(i);let l=ZG(n);for(let c of e.set)if(!c.modified.length)for(let d of l)s.push(Eg.get(c,d));return i}}function KG(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function ZG(t){let e=[[]];for(let n=0;nr.length-n.length)}function Lw(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],l=2,c=s;for(let p=0;;){if(c=="..."&&p>0&&p+3==s.length){l=1;break}let x=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(c);if(!x)throw new RangeError("Invalid path: "+s);if(i.push(x[0]=="*"?"":x[0][0]=='"'?JSON.parse(x[0]):x[0]),p+=x[0].length,p==s.length)break;let v=s[p++];if(p==s.length&&v=="!"){l=0;break}if(v!="/")throw new RangeError("Invalid path: "+s);c=s.slice(p)}let d=i.length-1,h=i[d];if(!h)throw new RangeError("Invalid path: "+s);let m=new Of(r,l,d>0?i.slice(0,d):null);e[h]=m.sort(e[h])}}return YM.add(e)}const YM=new Et({combine(t,e){let n,r,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let i=new Of(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class Of{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let l=s;for(let c of i)for(let d of c.set){let h=n[d.id];if(h){l=l?l+" "+h:h;break}}return l},scope:r}}function JG(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function eX(t,e,n,r=0,s=t.length){let i=new tX(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class tX{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,s,i){let{type:l,from:c,to:d}=e;if(c>=r||d<=n)return;l.isTop&&(i=this.highlighters.filter(v=>!v.scope||v.scope(l)));let h=s,m=nX(e)||Of.empty,p=JG(i,m.tags);if(p&&(h&&(h+=" "),h+=p,m.mode==1&&(s+=(s?" ":"")+p)),this.startSpan(Math.max(n,c),h),m.opaque)return;let x=e.tree&&e.tree.prop(Et.mounted);if(x&&x.overlay){let v=e.node.enter(x.overlay[0].from+c,1),b=this.highlighters.filter(O=>!O.scope||O.scope(x.tree.type)),k=e.firstChild();for(let O=0,j=c;;O++){let T=O=A||!e.nextSibling())););if(!T||A>r)break;j=T.to+c,j>n&&(this.highlightRange(v.cursor(),Math.max(n,T.from+c),Math.min(r,j),"",b),this.startSpan(Math.min(r,j),h))}k&&e.parent()}else if(e.firstChild()){x&&(s="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,s,i),this.startSpan(Math.min(r,e.to),h)}while(e.nextSibling());e.parent()}}}function nX(t){let e=t.type.prop(YM);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ie=yi.define,mp=Ie(),eo=Ie(),n7=Ie(eo),r7=Ie(eo),to=Ie(),pp=Ie(to),Fy=Ie(to),sa=Ie(),Zo=Ie(sa),na=Ie(),ra=Ie(),Z2=Ie(),Rh=Ie(Z2),gp=Ie(),he={comment:mp,lineComment:Ie(mp),blockComment:Ie(mp),docComment:Ie(mp),name:eo,variableName:Ie(eo),typeName:n7,tagName:Ie(n7),propertyName:r7,attributeName:Ie(r7),className:Ie(eo),labelName:Ie(eo),namespace:Ie(eo),macroName:Ie(eo),literal:to,string:pp,docString:Ie(pp),character:Ie(pp),attributeValue:Ie(pp),number:Fy,integer:Ie(Fy),float:Ie(Fy),bool:Ie(to),regexp:Ie(to),escape:Ie(to),color:Ie(to),url:Ie(to),keyword:na,self:Ie(na),null:Ie(na),atom:Ie(na),unit:Ie(na),modifier:Ie(na),operatorKeyword:Ie(na),controlKeyword:Ie(na),definitionKeyword:Ie(na),moduleKeyword:Ie(na),operator:ra,derefOperator:Ie(ra),arithmeticOperator:Ie(ra),logicOperator:Ie(ra),bitwiseOperator:Ie(ra),compareOperator:Ie(ra),updateOperator:Ie(ra),definitionOperator:Ie(ra),typeOperator:Ie(ra),controlOperator:Ie(ra),punctuation:Z2,separator:Ie(Z2),bracket:Rh,angleBracket:Ie(Rh),squareBracket:Ie(Rh),paren:Ie(Rh),brace:Ie(Rh),content:sa,heading:Zo,heading1:Ie(Zo),heading2:Ie(Zo),heading3:Ie(Zo),heading4:Ie(Zo),heading5:Ie(Zo),heading6:Ie(Zo),contentSeparator:Ie(sa),list:Ie(sa),quote:Ie(sa),emphasis:Ie(sa),strong:Ie(sa),link:Ie(sa),monospace:Ie(sa),strikethrough:Ie(sa),inserted:Ie(),deleted:Ie(),changed:Ie(),invalid:Ie(),meta:gp,documentMeta:Ie(gp),annotation:Ie(gp),processingInstruction:Ie(gp),definition:yi.defineModifier("definition"),constant:yi.defineModifier("constant"),function:yi.defineModifier("function"),standard:yi.defineModifier("standard"),local:yi.defineModifier("local"),special:yi.defineModifier("special")};for(let t in he){let e=he[t];e instanceof yi&&(e.name=t)}KM([{tag:he.link,class:"tok-link"},{tag:he.heading,class:"tok-heading"},{tag:he.emphasis,class:"tok-emphasis"},{tag:he.strong,class:"tok-strong"},{tag:he.keyword,class:"tok-keyword"},{tag:he.atom,class:"tok-atom"},{tag:he.bool,class:"tok-bool"},{tag:he.url,class:"tok-url"},{tag:he.labelName,class:"tok-labelName"},{tag:he.inserted,class:"tok-inserted"},{tag:he.deleted,class:"tok-deleted"},{tag:he.literal,class:"tok-literal"},{tag:he.string,class:"tok-string"},{tag:he.number,class:"tok-number"},{tag:[he.regexp,he.escape,he.special(he.string)],class:"tok-string2"},{tag:he.variableName,class:"tok-variableName"},{tag:he.local(he.variableName),class:"tok-variableName tok-local"},{tag:he.definition(he.variableName),class:"tok-variableName tok-definition"},{tag:he.special(he.variableName),class:"tok-variableName2"},{tag:he.definition(he.propertyName),class:"tok-propertyName tok-definition"},{tag:he.typeName,class:"tok-typeName"},{tag:he.namespace,class:"tok-namespace"},{tag:he.className,class:"tok-className"},{tag:he.macroName,class:"tok-macroName"},{tag:he.propertyName,class:"tok-propertyName"},{tag:he.operator,class:"tok-operator"},{tag:he.comment,class:"tok-comment"},{tag:he.meta,class:"tok-meta"},{tag:he.invalid,class:"tok-invalid"},{tag:he.punctuation,class:"tok-punctuation"}]);var Qy;const oc=new Et;function ZM(t){return He.define({combine:t?e=>e.concat(t):void 0})}const rX=new Et;class wi{constructor(e,n,r=[],s=""){this.data=e,this.name=s,Vt.prototype.hasOwnProperty("tree")||Object.defineProperty(Vt.prototype,"tree",{get(){return zr(this)}}),this.parser=n,this.extension=[xo.of(this),Vt.languageData.of((i,l,c)=>{let d=s7(i,l,c),h=d.type.prop(oc);if(!h)return[];let m=i.facet(h),p=d.type.prop(rX);if(p){let x=d.resolve(l-d.from,c);for(let v of p)if(v.test(x,i)){let b=i.facet(v.facet);return v.type=="replace"?b:b.concat(m)}}return m})].concat(r)}isActiveAt(e,n,r=-1){return s7(e,n,r).type.prop(oc)==this.data}findRegions(e){let n=e.facet(xo);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,l)=>{if(i.prop(oc)==this.data){r.push({from:l,to:l+i.length});return}let c=i.prop(Et.mounted);if(c){if(c.tree.prop(oc)==this.data){if(c.overlay)for(let d of c.overlay)r.push({from:d.from+l,to:d.to+l});else r.push({from:l,to:l+i.length});return}else if(c.overlay){let d=r.length;if(s(c.tree,c.overlay[0].from+l),r.length>d)return}}for(let d=0;dr.isTop?n:void 0)]}),e.name)}configure(e,n){return new jf(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function zr(t){let e=t.field(wi.state,!1);return e?e.tree:Dn.empty}class sX{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let zh=null;class md{constructor(e,n,r=[],s,i,l,c,d){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=l,this.skipped=c,this.scheduleOn=d,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new md(e,n,[],Dn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new sX(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Dn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(pc.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=zh;zh=this;try{return e()}finally{zh=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=i7(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:l,skipped:c}=this;if(this.takeTree(),!e.empty){let d=[];if(e.iterChangedRanges((h,m,p,x)=>d.push({fromA:h,toA:m,fromB:p,toB:x})),r=pc.applyChanges(r,d),s=Dn.empty,i=0,l={from:e.mapPos(l.from,-1),to:e.mapPos(l.to,1)},this.skipped.length){c=[];for(let h of this.skipped){let m=e.mapPos(h.from,1),p=e.mapPos(h.to,-1);me.from&&(this.fragments=i7(this.fragments,s,i),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends Bw{createParse(n,r,s){let i=s[0].from,l=s[s.length-1].to;return{parsedPos:i,advance(){let d=zh;if(d){for(let h of s)d.tempSkipped.push(h);e&&(d.scheduleOn=d.scheduleOn?Promise.all([d.scheduleOn,e]):e)}return this.parsedPos=l,new Dn(gs.none,[],[],l-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return zh}}function i7(t,e,n){return pc.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class pd{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new pd(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=md.create(e.facet(xo).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new pd(r)}}wi.state=Br.define({create:pd.init,update(t,e){for(let n of e.effects)if(n.is(wi.setState))return n.value;return e.startState.facet(xo)!=e.state.facet(xo)?pd.init(e.state):t.apply(e)}});let JM=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(JM=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const $y=typeof navigator<"u"&&(!((Qy=navigator.scheduling)===null||Qy===void 0)&&Qy.isInputPending)?()=>navigator.scheduling.isInputPending():null,iX=lr.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(wi.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(wi.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=JM(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnds+1e3,d=i.context.work(()=>$y&&$y()||Date.now()>l,s+(c?0:1e5));this.chunkBudget-=Date.now()-n,(d||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:wi.setState.of(new pd(i.context))})),this.chunkBudget>0&&!(d&&!c)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>_s(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),xo=He.define({combine(t){return t.length?t[0]:null},enables:t=>[wi.state,iX,qe.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class eE{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const aX=He.define(),u0=He.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function kc(t){let e=t.facet(u0);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Nf(t,e){let n="",r=t.tabSize,s=t.facet(u0)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i=e?lX(t,n,e):null}class Nx{constructor(e,n={}){this.state=e,this.options=n,this.unit=kc(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==e?{text:"",from:e}:(n<0?s-1&&(i+=l-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return Td(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let l=i(s);if(l>-1)return l}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Cx=new Et;function lX(t,e,n){let r=e.resolveStack(n),s=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let l=s;l&&!(l.fromr.node.to||l.from==r.node.from&&l.type==r.node.type);l=l.parent)i.push(l);for(let l=i.length-1;l>=0;l--)r={node:i[l],next:r}}return tE(r,t,n)}function tE(t,e,n){for(let r=t;r;r=r.next){let s=cX(r.node);if(s)return s(qw.create(e,n,r))}return 0}function oX(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function cX(t){let e=t.type.prop(Cx);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Et.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return l=>nE(l,!0,1,void 0,i&&!oX(l)?s.from:void 0)}return t.parent==null?uX:null}function uX(){return 0}class qw extends Nx{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new qw(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(dX(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return tE(this.context.next,this.base,this.pos)}}function dX(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function hX(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let s=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),l=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let c=n.to;;){let d=e.childAfter(c);if(!d||d==r)return null;if(!d.type.isSkipped){if(d.from>=l)return null;let h=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+h}}c=d.to}}function Hy({closing:t,align:e=!0,units:n=1}){return r=>nE(r,e,n,t)}function nE(t,e,n,r,s){let i=t.textAfter,l=i.match(/^\s*/)[0].length,c=r&&i.slice(l,l+r.length)==r||s==t.pos+l,d=e?hX(t):null;return d?c?t.column(d.from):t.column(d.to):t.baseIndent+(c?0:t.unit*n)}function a7({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const fX=200;function mX(){return Vt.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,s=n.lineAt(r);if(r>s.from+fX)return t;let i=n.sliceString(s.from,r);if(!e.some(h=>h.test(i)))return t;let{state:l}=t,c=-1,d=[];for(let{head:h}of l.selection.ranges){let m=l.doc.lineAt(h);if(m.from==c)continue;c=m.from;let p=Iw(l,m.from);if(p==null)continue;let x=/^\s*/.exec(m.text)[0],v=Nf(l,p);x!=v&&d.push({from:m.from,to:m.from+x.length,insert:v})}return d.length?[t,{changes:d,sequential:!0}]:t})}const pX=He.define(),Fw=new Et;function rE(t){let e=t.firstChild,n=t.lastChild;return e&&e.ton)continue;if(i&&c.from=e&&h.to>n&&(i=h)}}return i}function xX(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function _g(t,e,n){for(let r of t.facet(pX)){let s=r(t,e,n);if(s)return s}return gX(t,e,n)}function sE(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const Tx=vt.define({map:sE}),d0=vt.define({map:sE});function iE(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const Oc=Br.define({create(){return Je.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=l7(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(Tx)&&!vX(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(oE),s=r?Je.replace({widget:new jX(r(e.state,n.value))}):o7;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(d0)&&(t=t.update({filter:(r,s)=>n.value.from!=r||n.value.to!=s,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=l7(t,e.selection.main.head)),t},provide:t=>qe.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,s)=>{n.push(r,s)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n{se&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(s,i)=>s>=n||i<=e}):t}function Dg(t,e,n){var r;let s=null;return(r=t.field(Oc,!1))===null||r===void 0||r.between(e,n,(i,l)=>{(!s||s.from>i)&&(s={from:i,to:l})}),s}function vX(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function aE(t,e){return t.field(Oc,!1)?e:e.concat(vt.appendConfig.of(cE()))}const yX=t=>{for(let e of iE(t)){let n=_g(t.state,e.from,e.to);if(n)return t.dispatch({effects:aE(t.state,[Tx.of(n),lE(t,n)])}),!0}return!1},bX=t=>{if(!t.state.field(Oc,!1))return!1;let e=[];for(let n of iE(t)){let r=Dg(t.state,n.from,n.to);r&&e.push(d0.of(r),lE(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function lE(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return qe.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const wX=t=>{let{state:e}=t,n=[];for(let r=0;r{let e=t.state.field(Oc,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(d0.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},kX=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:yX},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:bX},{key:"Ctrl-Alt-[",run:wX},{key:"Ctrl-Alt-]",run:SX}],OX={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},oE=He.define({combine(t){return Oa(t,OX)}});function cE(t){return[Oc,TX]}function uE(t,e){let{state:n}=t,r=n.facet(oE),s=l=>{let c=t.lineBlockAt(t.posAtDOM(l.target)),d=Dg(t.state,c.from,c.to);d&&t.dispatch({effects:d0.of(d)}),l.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,s,e);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const o7=Je.replace({widget:new class extends ja{toDOM(t){return uE(t,null)}}});class jX extends ja{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return uE(e,this.value)}}const NX={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Uy extends gl{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function CX(t={}){let e={...NX,...t},n=new Uy(e,!0),r=new Uy(e,!1),s=lr.fromClass(class{constructor(l){this.from=l.viewport.from,this.markers=this.buildMarkers(l)}update(l){(l.docChanged||l.viewportChanged||l.startState.facet(xo)!=l.state.facet(xo)||l.startState.field(Oc,!1)!=l.state.field(Oc,!1)||zr(l.startState)!=zr(l.state)||e.foldingChanged(l))&&(this.markers=this.buildMarkers(l.view))}buildMarkers(l){let c=new ml;for(let d of l.viewportLineBlocks){let h=Dg(l.state,d.from,d.to)?r:_g(l.state,d.from,d.to)?n:null;h&&c.add(d.from,d.from,h)}return c.finish()}}),{domEventHandlers:i}=e;return[s,MG({class:"cm-foldGutter",markers(l){var c;return((c=l.plugin(s))===null||c===void 0?void 0:c.markers)||Yt.empty},initialSpacer(){return new Uy(e,!1)},domEventHandlers:{...i,click:(l,c,d)=>{if(i.click&&i.click(l,c,d))return!0;let h=Dg(l.state,c.from,c.to);if(h)return l.dispatch({effects:d0.of(h)}),!0;let m=_g(l.state,c.from,c.to);return m?(l.dispatch({effects:Tx.of(m)}),!0):!1}}}),cE()]}const TX=qe.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class h0{constructor(e,n){this.specs=e;let r;function s(c){let d=fo.newName();return(r||(r=Object.create(null)))["."+d]=c,d}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,l=n.scope;this.scope=l instanceof wi?c=>c.prop(oc)==l.data:l?c=>c==l:void 0,this.style=KM(e.map(c=>({tag:c.tag,class:c.class||s(Object.assign({},c,{tag:null}))})),{all:i}).style,this.module=r?new fo(r):null,this.themeType=n.themeType}static define(e,n){return new h0(e,n||{})}}const J2=He.define(),dE=He.define({combine(t){return t.length?[t[0]]:null}});function Vy(t){let e=t.facet(J2);return e.length?e:t.facet(dE)}function hE(t,e){let n=[MX],r;return t instanceof h0&&(t.module&&n.push(qe.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(dE.of(t)):r?n.push(J2.computeN([qe.darkTheme],s=>s.facet(qe.darkTheme)==(r=="dark")?[t]:[])):n.push(J2.of(t)),n}class AX{constructor(e){this.markCache=Object.create(null),this.tree=zr(e.state),this.decorations=this.buildDeco(e,Vy(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=zr(e.state),r=Vy(e.state),s=r!=Vy(e.startState),{viewport:i}=e.view,l=e.changes.mapPos(this.decoratedTo,1);n.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=l):(n!=this.tree||e.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return Je.none;let r=new ml;for(let{from:s,to:i}of e.visibleRanges)eX(this.tree,n,(l,c,d)=>{r.add(l,c,this.markCache[d]||(this.markCache[d]=Je.mark({class:d})))},s,i);return r.finish()}}const MX=No.high(lr.fromClass(AX,{decorations:t=>t.decorations})),EX=h0.define([{tag:he.meta,color:"#404740"},{tag:he.link,textDecoration:"underline"},{tag:he.heading,textDecoration:"underline",fontWeight:"bold"},{tag:he.emphasis,fontStyle:"italic"},{tag:he.strong,fontWeight:"bold"},{tag:he.strikethrough,textDecoration:"line-through"},{tag:he.keyword,color:"#708"},{tag:[he.atom,he.bool,he.url,he.contentSeparator,he.labelName],color:"#219"},{tag:[he.literal,he.inserted],color:"#164"},{tag:[he.string,he.deleted],color:"#a11"},{tag:[he.regexp,he.escape,he.special(he.string)],color:"#e40"},{tag:he.definition(he.variableName),color:"#00f"},{tag:he.local(he.variableName),color:"#30a"},{tag:[he.typeName,he.namespace],color:"#085"},{tag:he.className,color:"#167"},{tag:[he.special(he.variableName),he.macroName],color:"#256"},{tag:he.definition(he.propertyName),color:"#00c"},{tag:he.comment,color:"#940"},{tag:he.invalid,color:"#f00"}]),_X=qe.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),fE=1e4,mE="()[]{}",pE=He.define({combine(t){return Oa(t,{afterCursor:!0,brackets:mE,maxScanDistance:fE,renderMatch:zX})}}),DX=Je.mark({class:"cm-matchingBracket"}),RX=Je.mark({class:"cm-nonmatchingBracket"});function zX(t){let e=[],n=t.matched?DX:RX;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const PX=Br.define({create(){return Je.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(pE);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=fa(e.state,s.head,-1,r)||s.head>0&&fa(e.state,s.head-1,1,r)||r.afterCursor&&(fa(e.state,s.head,1,r)||s.headqe.decorations.from(t)}),BX=[PX,_X];function LX(t={}){return[pE.of(t),BX]}const IX=new Et;function e4(t,e,n){let r=t.prop(e<0?Et.openedBy:Et.closedBy);if(r)return r;if(t.name.length==1){let s=n.indexOf(t.name);if(s>-1&&s%2==(e<0?1:0))return[n[s+e]]}return null}function t4(t){let e=t.type.prop(IX);return e?e(t.node):t}function fa(t,e,n,r={}){let s=r.maxScanDistance||fE,i=r.brackets||mE,l=zr(t),c=l.resolveInner(e,n);for(let d=c;d;d=d.parent){let h=e4(d.type,n,i);if(h&&d.from0?e>=m.from&&em.from&&e<=m.to))return qX(t,e,n,d,m,h,i)}}return FX(t,e,n,l,c.type,s,i)}function qX(t,e,n,r,s,i,l){let c=r.parent,d={from:s.from,to:s.to},h=0,m=c?.cursor();if(m&&(n<0?m.childBefore(r.from):m.childAfter(r.to)))do if(n<0?m.to<=r.from:m.from>=r.to){if(h==0&&i.indexOf(m.type.name)>-1&&m.from0)return null;let h={from:n<0?e-1:e,to:n>0?e+1:e},m=t.doc.iterRange(e,n>0?t.doc.length:0),p=0;for(let x=0;!m.next().done&&x<=i;){let v=m.value;n<0&&(x+=v.length);let b=e+x*n;for(let k=n>0?0:v.length-1,O=n>0?v.length:-1;k!=O;k+=n){let j=l.indexOf(v[k]);if(!(j<0||r.resolveInner(b+k,1).type!=s))if(j%2==0==n>0)p++;else{if(p==1)return{start:h,end:{from:b+k,to:b+k+1},matched:j>>1==d>>1};p--}}n>0&&(x+=v.length)}return m.done?{start:h,matched:!1}:null}function c7(t,e,n,r=0,s=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let i=s;for(let l=r;l=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosr?l.toLowerCase():l,i=this.string.substr(this.pos,e.length);return s(i)==s(e)?(n!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&n!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function QX(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||$X,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||Hw,mergeTokens:t.mergeTokens!==!1}}function $X(t){if(typeof t!="object")return t;let e={};for(let n in t){let r=t[n];e[n]=r instanceof Array?r.slice():r}return e}const u7=new WeakMap;class Qw extends wi{constructor(e){let n=ZM(e.languageData),r=QX(e),s,i=new class extends Bw{createParse(l,c,d){return new UX(s,l,c,d)}};super(n,i,[],e.name),this.topNode=GX(n,this),s=this,this.streamParser=r,this.stateAfter=new Et({perNode:!0}),this.tokenTable=e.tokenTable?new bE(r.tokenTable):WX}static define(e){return new Qw(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=u7.get(e.state),n!=null&&n1e4)return null;for(;i=r&&n+e.length<=s&&e.prop(t.stateAfter);if(i)return{state:t.streamParser.copyState(i),pos:n+e.length};for(let l=e.children.length-1;l>=0;l--){let c=e.children[l],d=n+e.positions[l],h=c instanceof Dn&&d=e.length)return e;!s&&n==0&&e.type==t.topNode&&(s=!0);for(let i=e.children.length-1;i>=0;i--){let l=e.positions[i],c=e.children[i],d;if(ln&&$w(t,i.tree,0-i.offset,n,c),h;if(d&&d.pos<=r&&(h=xE(t,i.tree,n+i.offset,d.pos+i.offset,!1)))return{state:d.state,tree:h}}return{state:t.streamParser.startState(s?kc(s):4),tree:Dn.empty}}let UX=class{constructor(e,n,r,s){this.lang=e,this.input=n,this.fragments=r,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let i=md.get(),l=s[0].from,{state:c,tree:d}=HX(e,r,l,this.to,i?.state);this.state=c,this.parsedPos=this.chunkStart=l+d.length;for(let h=0;hh.from<=i.viewport.from&&h.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(kc(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=md.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos=n?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let n=this.input.chunk(e);if(this.input.lineChunks)n==` + `&&t.lineWrapping&&(r&&(r=Ce.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:Xt.of([" "])}),n)return Aw(t,n,r,i);if(r&&!r.main.eq(s)){let l=!1,c="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(l=!0),c=t.inputState.lastSelectionOrigin,c=="select.pointer"&&(r=bM(t.state.facet(l0).map(d=>d(t)),r))),t.dispatch({selection:r,scrollIntoView:l,userEvent:c}),!0}else return!1}function Aw(t,e,n,r=-1){if(Fe.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(Fe.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&t.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Gu(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.lengths.head)&&Gu(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Gu(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let l,c=()=>l||(l=KV(t,e,n));return t.state.facet(lM).some(d=>d(t,e.from,e.to,i,c))||t.dispatch(c()),!0}function KV(t,e,n){let r,s=t.state,i=s.selection.main,l=-1;if(e.from==e.to&&e.fromi.to){let d=e.fromp(t)),h,d);e.from==m&&(l=m)}if(l>-1)r={changes:e,selection:Ce.cursor(e.from+e.insert.length,-1)};else if(e.from>=i.from&&e.to<=i.to&&e.to-e.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let d=i.frome.to?s.sliceDoc(e.to,i.to):"";r=s.replaceSelection(t.state.toText(d+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let d=s.changes(e),h=n&&n.main.to<=d.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=i.to+10&&e.to>=i.to-10){let m=t.state.sliceDoc(e.from,e.to),p,x=n&&xM(t,n.main.head);if(x){let b=e.insert.length-(e.to-e.from);p={from:x.from,to:x.to-b}}else p=t.state.doc.lineAt(i.head);let v=i.to-e.to;r=s.changeByRange(b=>{if(b.from==i.from&&b.to==i.to)return{changes:d,range:h||b.map(d)};let k=b.to-v,O=k-m.length;if(t.state.sliceDoc(O,k)!=m||k>=p.from&&O<=p.to)return{range:b};let j=s.changes({from:O,to:k,insert:e.insert}),T=b.to-i.to;return{changes:j,range:h?Ce.range(Math.max(0,h.anchor+T),Math.max(0,h.head+T)):b.map(j)}})}else r={changes:d,selection:h&&s.selection.replaceRange(h)}}let c="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,c+=".compose",t.inputState.compositionFirstChange&&(c+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:c,scrollIntoView:!0})}function SM(t,e,n,r){let s=Math.min(t.length,e.length),i=0;for(;i0&&c>0&&t.charCodeAt(l-1)==e.charCodeAt(c-1);)l--,c--;if(r=="end"){let d=Math.max(0,i-Math.min(l,c));n-=l+d-i}if(l=l?i-n:0;i-=d,c=i+(c-l),l=i}else if(c=c?i-n:0;i-=d,l=i+(l-c),c=i}return{from:i,toA:l,toB:c}}function ZV(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}=t.observer.selectionRange;return n&&(e.push(new bj(n,r)),(s!=n||i!=r)&&e.push(new bj(s,i))),e}function JV(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?Ce.single(n+e,r+e):null}class eW{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Fe.safari&&e.contentDOM.addEventListener("input",()=>null),Fe.gecko&&gW(e.contentDOM.ownerDocument)}handleEvent(e){!oW(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let s of r.observers)s(this.view,n);for(let s of r.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=tW(e),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let l=!n[i].handlers.length,c=r[i];c&&l!=!c.handlers.length&&(s.removeEventListener(i,this.handleEvent),c=null),c||s.addEventListener(i,this.handleEvent,{passive:l})}for(let i in r)i!="scroll"&&!n[i]&&s.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&OM.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Fe.android&&Fe.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return Fe.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=kM.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||nW.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from0?!0:Fe.safari&&!Fe.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function wj(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){_s(n.state,s)}}}function tW(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let s=r.spec,i=s&&s.plugin.domEventHandlers,l=s&&s.plugin.domEventObservers;if(i)for(let c in i){let d=i[c];d&&n(c).handlers.push(wj(r.value,d))}if(l)for(let c in l){let d=l[c];d&&n(c).observers.push(wj(r.value,d))}}for(let r in Ui)n(r).handlers.push(Ui[r]);for(let r in Ti)n(r).observers.push(Ti[r]);return e}const kM=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],nW="dthko",OM=[16,17,18,20,91,92,224,225],rp=6;function sp(t){return Math.max(0,t)*.7+8}function rW(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class sW{constructor(e,n,r,s){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=hV(e.contentDOM),this.atoms=e.state.facet(l0).map(l=>l(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Vt.allowMultipleSelections)&&iW(e,n),this.dragging=lW(e,n)&&CM(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&rW(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,i=0,l=this.view.win.innerWidth,c=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:l}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:c}=this.scrollParents.y.getBoundingClientRect());let d=Tw(this.view);e.clientX-d.left<=s+rp?n=-sp(s-e.clientX):e.clientX+d.right>=l-rp&&(n=sp(e.clientX-l)),e.clientY-d.top<=i+rp?r=-sp(i-e.clientY):e.clientY+d.bottom>=c-rp&&(r=sp(e.clientY-c)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=bM(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function iW(t,e){let n=t.state.facet(rM);return n.length?n[0](e):Fe.mac?e.metaKey:e.ctrlKey}function aW(t,e){let n=t.state.facet(sM);return n.length?n[0](e):Fe.mac?!e.altKey:!e.ctrlKey}function lW(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=vf(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i=e.clientX&&l.top<=e.clientY&&l.bottom>=e.clientY)return!0}return!1}function oW(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=jn.get(n))&&r.ignoreEvent(e))return!1;return!0}const Ui=Object.create(null),Ti=Object.create(null),jM=Fe.ie&&Fe.ie_version<15||Fe.ios&&Fe.webkit_version<604;function cW(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),NM(t,n.value)},50)}function kx(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function NM(t,e){e=kx(t.state,jw,e);let{state:n}=t,r,s=1,i=n.toText(e),l=i.lines==n.selection.ranges.length;if(Q2!=null&&n.selection.ranges.every(d=>d.empty)&&Q2==i.toString()){let d=-1;r=n.changeByRange(h=>{let m=n.doc.lineAt(h.from);if(m.from==d)return{range:h};d=m.from;let p=n.toText((l?i.line(s++).text:e)+n.lineBreak);return{changes:{from:m.from,insert:p},range:Ce.cursor(h.from+p.length)}})}else l?r=n.changeByRange(d=>{let h=i.line(s++);return{changes:{from:d.from,to:d.to,insert:h.text},range:Ce.cursor(d.from+h.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Ti.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};Ui.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Ti.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Ti.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Ui.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(iM))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=hW(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new sW(t,e,n,r)),r&&t.observer.ignore(()=>{qA(t.contentDOM);let i=t.root.activeElement;i&&!i.contains(t.contentDOM)&&i.blur()});let s=t.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function Sj(t,e,n,r){if(r==1)return Ce.cursor(e,n);if(r==2)return IV(t.state,e,n);{let s=pr.find(t.docView,e),i=t.state.doc.lineAt(s?s.posAtEnd:e),l=s?s.posAtStart:i.from,c=s?s.posAtEnd:i.to;return ce>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function uW(t,e,n,r){let s=pr.find(t.docView,e);if(!s)return 1;let i=e-s.posAtStart;if(i==0)return 1;if(i==s.length)return-1;let l=s.coordsAt(i,-1);if(l&&kj(n,r,l))return-1;let c=s.coordsAt(i,1);return c&&kj(n,r,c)?1:l&&l.bottom>=r?-1:1}function Oj(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:uW(t,n,e.clientX,e.clientY)}}const dW=Fe.ie&&Fe.ie_version<=11;let jj=null,Nj=0,Cj=0;function CM(t){if(!dW)return t.detail;let e=jj,n=Cj;return jj=t,Cj=Date.now(),Nj=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Nj+1)%3:1}function hW(t,e){let n=Oj(t,e),r=CM(e),s=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,l,c){let d=Oj(t,i),h,m=Sj(t,d.pos,d.bias,r);if(n.pos!=d.pos&&!l){let p=Sj(t,n.pos,n.bias,r),x=Math.min(p.from,m.from),v=Math.max(p.to,m.to);m=x1&&(h=fW(s,d.pos))?h:c?s.addRange(m):Ce.create([m])}}}function fW(t,e){for(let n=0;n=e)return Ce.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}Ui.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let s=t.docView.nearest(e.target);if(s&&s.isWidget){let i=s.posAtStart,l=i+s.length;(i>=n.to||l<=n.from)&&(n=Ce.range(i,l))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",kx(t.state,Nw,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ui.dragend=t=>(t.inputState.draggedContent=null,!1);function Tj(t,e,n,r){if(n=kx(t.state,jw,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,l=r&&i&&aW(t,e)?{from:i.from,to:i.to}:null,c={from:s,insert:n},d=t.state.changes(l?[l,c]:c);t.focus(),t.dispatch({changes:d,selection:{anchor:d.mapPos(s,-1),head:d.mapPos(s,1)},userEvent:l?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Ui.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,i=()=>{++s==n.length&&Tj(t,e,r.filter(l=>l!=null).join(t.state.lineBreak),!1)};for(let l=0;l{/[\x00-\x08\x0e-\x1f]{2}/.test(c.result)||(r[l]=c.result),i()},c.readAsText(n[l])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Tj(t,e,r,!0),!0}return!1};Ui.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=jM?null:e.clipboardData;return n?(NM(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(cW(t),!1)};function mW(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function pW(t){let e=[],n=[],r=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),n.push(s));if(!e.length){let s=-1;for(let{from:i}of t.selection.ranges){let l=t.doc.lineAt(i);l.number>s&&(e.push(l.text),n.push({from:l.from,to:Math.min(t.doc.length,l.to+1)})),s=l.number}r=!0}return{text:kx(t,Nw,e.join(t.lineBreak)),ranges:n,linewise:r}}let Q2=null;Ui.copy=Ui.cut=(t,e)=>{let{text:n,ranges:r,linewise:s}=pW(t.state);if(!n&&!s)return!1;Q2=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=jM?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(mW(t,n),!1)};const TM=ka.define();function AM(t,e){let n=[];for(let r of t.facet(oM)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:TM.of(!0)}):null}function MM(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=AM(t.state,e);n?t.dispatch(n):t.update([])}},10)}Ti.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),MM(t)};Ti.blur=t=>{t.observer.clearSelectionRange(),MM(t)};Ti.compositionstart=Ti.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Ti.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Fe.chrome&&Fe.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Ti.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Ui.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let i=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),l=e.getTargetRanges();if(i&&l.length){let c=l[0],d=t.posAtDOM(c.startContainer,c.startOffset),h=t.posAtDOM(c.endContainer,c.endOffset);return Aw(t,{from:d,to:h,insert:t.state.toText(i)},null),!0}}let s;if(Fe.chrome&&Fe.android&&(s=kM.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var l;(((l=window.visualViewport)===null||l===void 0?void 0:l.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Fe.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Fe.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Ti.compositionend(t,e),20),!1};const Aj=new Set;function gW(t){Aj.has(t)||(Aj.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const Mj=["pre-wrap","normal","pre-line","break-spaces"];let fd=!1;function Ej(){fd=!1}class xW{constructor(e){this.lineWrapping=e,this.doc=Xt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Mj.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,d=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=c;if(this.lineWrapping=c,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,d){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Jp&&(fd=!0),this.height=e)}replace(e,n,r){return ms.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,s){let i=this,l=r.doc;for(let c=s.length-1;c>=0;c--){let{fromA:d,toA:h,fromB:m,toB:p}=s[c],x=i.lineAt(d,$n.ByPosNoHeight,r.setDoc(n),0,0),v=x.to>=h?x:i.lineAt(h,$n.ByPosNoHeight,r,0,0);for(p+=v.to-h,h=v.to;c>0&&x.from<=s[c-1].toA;)d=s[c-1].fromA,m=s[c-1].fromB,c--,di*2){let c=e[n-1];c.break?e.splice(--n,1,c.left,null,c.right):e.splice(--n,1,c.left,c.right),r+=1+c.break,s-=c.size}else if(i>s*2){let c=e[r];c.break?e.splice(r,1,c.left,null,c.right):e.splice(r,1,c.left,c.right),r+=2+c.break,i-=c.size}else break;else if(s=i&&l(this.blockAt(0,r,s,i))}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class ei extends EM{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,s){return new ca(s,this.length,r,this.height,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof ei||s instanceof $r&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof $r?s=new ei(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):ms.of(r)}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setHeight(s.heights[s.index++]):(r||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class $r extends ms{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,s=e.doc.lineAt(n+this.length).number,i=s-r+1,l,c=0;if(e.lineWrapping){let d=Math.min(this.height,e.lineHeight*i);l=d/i,this.length>i+1&&(c=(this.height-d)/(this.length-i-1))}else l=this.height/i;return{firstLine:r,lastLine:s,perLine:l,perChar:c}}blockAt(e,n,r,s){let{firstLine:i,lastLine:l,perLine:c,perChar:d}=this.heightMetrics(n,s);if(n.lineWrapping){let h=s+(e0){let i=r[r.length-1];i instanceof $r?r[r.length-1]=new $r(i.length+s):r.push(null,new $r(s-1))}if(e>0){let i=r[0];i instanceof $r?r[0]=new $r(e+i.length):r.unshift(new $r(e-1),null)}return ms.of(r)}decomposeLeft(e,n){n.push(new $r(e-1),null)}decomposeRight(e,n){n.push(null,new $r(this.length-e-1))}updateHeight(e,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let l=[],c=Math.max(n,s.from),d=-1;for(s.from>n&&l.push(new $r(s.from-n-1).updateHeight(e,n));c<=i&&s.more;){let m=e.doc.lineAt(c).length;l.length&&l.push(null);let p=s.heights[s.index++];d==-1?d=p:Math.abs(p-d)>=Jp&&(d=-2);let x=new ei(m,p);x.outdated=!1,l.push(x),c+=m+1}c<=i&&l.push(null,new $r(i-c).updateHeight(e,c));let h=ms.of(l);return(d<0||Math.abs(h.height-this.height)>=Jp||Math.abs(d-this.heightMetrics(e,n).perLine)>=Jp)&&(fd=!0),Cg(this,h)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class yW extends ms{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,s){let i=r+this.left.height;return ec))return h;let m=n==$n.ByPosNoHeight?$n.ByPosNoHeight:$n.ByPos;return d?h.join(this.right.lineAt(c,m,r,l,c)):this.left.lineAt(c,m,r,s,i).join(h)}forEachLine(e,n,r,s,i,l){let c=s+this.left.height,d=i+this.left.length+this.break;if(this.break)e=d&&this.right.forEachLine(e,n,r,c,d,l);else{let h=this.lineAt(d,$n.ByPos,r,s,i);e=e&&h.from<=n&&l(h),n>h.to&&this.right.forEachLine(h.to+1,n,r,c,d,l)}}replace(e,n,r){let s=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-s,n-s,r));let i=[];e>0&&this.decomposeLeft(e,i);let l=i.length;for(let c of r)i.push(c);if(e>0&&_j(i,l-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,n);e2*n.size||n.size>2*e.size?ms.of(this.break?[e,null,n]:[e,n]):(this.left=Cg(this.left,e),this.right=Cg(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,s){let{left:i,right:l}=this,c=n+i.length+this.break,d=null;return s&&s.from<=n+i.length&&s.more?d=i=i.updateHeight(e,n,r,s):i.updateHeight(e,n,r),s&&s.from<=c+l.length&&s.more?d=l=l.updateHeight(e,c,r,s):l.updateHeight(e,c,r),d?this.balanced(i,l):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function _j(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof $r&&(r=t[e+1])instanceof $r&&t.splice(e-1,3,new $r(n.length+1+r.length))}const bW=5;class Mw{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof ei?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new ei(r-this.pos,-1)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e=bW)&&this.addLineDeco(s,i,l)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new ei(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new $r(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof ei)return e;let n=new ei(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof ei)&&!this.isCovered?this.nodes.push(new ei(0,-1)):(this.writtenTom.clientHeight||m.scrollWidth>m.clientWidth)&&p.overflow!="visible"){let x=m.getBoundingClientRect();i=Math.max(i,x.left),l=Math.min(l,x.right),c=Math.max(c,x.top),d=Math.min(h==t.parentNode?s.innerHeight:d,x.bottom)}h=p.position=="absolute"||p.position=="fixed"?m.offsetParent:m.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:i-n.left,right:Math.max(i,l)-n.left,top:c-(n.top+e),bottom:Math.max(c,d)-(n.top+e)}}function OW(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function jW(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class Ry{constructor(e,n,r,s){this.from=e,this.to=n,this.size=r,this.displaySize=s}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;rtypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new xW(n),this.stateDeco=e.facet(yf).filter(r=>typeof r!="function"),this.heightMap=ms.empty().applyChanges(this.stateDeco,Xt.empty,this.heightOracle.setDoc(e.doc),[new Ni(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Je.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!e.some(({from:i,to:l})=>s>=i&&s<=l)){let{from:i,to:l}=this.lineBlockAt(s);e.push(new ip(i,l))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Rj:new Ew(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Hh(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(yf).filter(m=>typeof m!="function");let s=e.changedRanges,i=Ni.extendWithRanges(s,wW(r,this.stateDeco,e?e.changes:kr.empty(this.state.doc.length))),l=this.heightMap.height,c=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Ej(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=l||fd)&&(e.flags|=2),c?(this.scrollAnchorPos=e.changes.mapPos(c.from,-1),this.scrollAnchorHeight=c.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=l);let d=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.headd.to)||!this.viewportIsAppropriate(d))&&(d=this.getViewport(0,n));let h=d.from!=this.viewport.from||d.to!=this.viewport.to;this.viewport=d,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(uM)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Hn.RTL:Hn.LTR;let l=this.heightOracle.mustRefreshForWrapping(i),c=n.getBoundingClientRect(),d=l||this.mustMeasureContent||this.contentDOMHeight!=c.height;this.contentDOMHeight=c.height,this.mustMeasureContent=!1;let h=0,m=0;if(c.width&&c.height){let{scaleX:_,scaleY:D}=IA(n,c);(_>.005&&Math.abs(this.scaleX-_)>.005||D>.005&&Math.abs(this.scaleY-D)>.005)&&(this.scaleX=_,this.scaleY=D,h|=16,l=d=!0)}let p=(parseInt(r.paddingTop)||0)*this.scaleY,x=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=p||this.paddingBottom!=x)&&(this.paddingTop=p,this.paddingBottom=x,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(d=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let v=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=v&&(this.scrollAnchorHeight=-1,this.scrollTop=v),this.scrolledToBottom=QA(e.scrollDOM);let b=(this.printing?jW:kW)(n,this.paddingTop),k=b.top-this.pixelViewport.top,O=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let j=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(j!=this.inView&&(this.inView=j,j&&(d=!0)),!this.inView&&!this.scrollTarget&&!OW(e.dom))return 0;let T=c.width;if((this.contentDOMWidth!=T||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=c.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),d){let _=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(_)&&(l=!0),l||s.lineWrapping&&Math.abs(T-this.contentDOMWidth)>s.charWidth){let{lineHeight:D,charWidth:E,textHeight:z}=e.docView.measureTextSize();l=D>0&&s.refresh(i,D,E,z,Math.max(5,T/E),_),l&&(e.docView.minWidth=0,h|=16)}k>0&&O>0?m=Math.max(k,O):k<0&&O<0&&(m=Math.min(k,O)),Ej();for(let D of this.viewports){let E=D.from==this.viewport.from?_:e.docView.measureVisibleLineHeights(D);this.heightMap=(l?ms.empty().applyChanges(this.stateDeco,Xt.empty,this.heightOracle,[new Ni(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,l,new vW(D.from,E))}fd&&(h|=2)}let A=!this.viewportIsAppropriate(this.viewport,m)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return A&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(m,this.scrollTarget),h|=this.updateForViewport()),(h&2||A)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(l?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:l,visibleBottom:c}=this,d=new ip(s.lineAt(l-r*1e3,$n.ByHeight,i,0,0).from,s.lineAt(c+(1-r)*1e3,$n.ByHeight,i,0,0).to);if(n){let{head:h}=n.range;if(hd.to){let m=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),p=s.lineAt(h,$n.ByPos,i,0,0),x;n.y=="center"?x=(p.top+p.bottom)/2-m/2:n.y=="start"||n.y=="nearest"&&h=c+Math.max(10,Math.min(r,250)))&&s>l-2*1e3&&i>1,l=s<<1;if(this.defaultTextDirection!=Hn.LTR&&!r)return[];let c=[],d=(m,p,x,v)=>{if(p-mm&&jj.from>=x.from&&j.to<=x.to&&Math.abs(j.from-m)j.fromT));if(!O){if(pA.from<=p&&A.to>=p)){let A=n.moveToLineBoundary(Ce.cursor(p),!1,!0).head;A>m&&(p=A)}let j=this.gapSize(x,m,p,v),T=r||j<2e6?j:2e6;O=new Ry(m,p,j,T)}c.push(O)},h=m=>{if(m.length2e6)for(let E of e)E.from>=m.from&&E.fromm.from&&d(m.from,v,m,p),bn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];Yt.spans(n,this.viewport.from,this.viewport.to,{span(i,l){r.push({from:i,to:l})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||Hh(this.heightMap.lineAt(e,$n.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||Hh(this.heightMap.lineAt(this.scaler.fromDOM(e),$n.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return Hh(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}let ip=class{constructor(e,n){this.from=e,this.to=n}};function CW(t,e,n){let r=[],s=t,i=0;return Yt.spans(n,t,e,{span(){},point(l,c){l>s&&(r.push({from:s,to:l}),i+=l-s),s=c}},20),s=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let s=0;;s++){let{from:i,to:l}=e[s],c=l-i;if(r<=c)return i+r;r-=c}}function lp(t,e){let n=0;for(let{from:r,to:s}of t.ranges){if(e<=s){n+=e-r;break}n+=s-r}return n/t.total}function TW(t,e){for(let n of t)if(e(n))return n}const Rj={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class Ew{constructor(e,n,r){let s=0,i=0,l=0;this.viewports=r.map(({from:c,to:d})=>{let h=n.lineAt(c,$n.ByPos,e,0,0).top,m=n.lineAt(d,$n.ByPos,e,0,0).bottom;return s+=m-h,{from:c,to:d,top:h,bottom:m,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let c of this.viewports)c.domTop=l+(c.top-i)*this.scale,l=c.domBottom=c.domTop+(c.bottom-c.top),i=c.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let i=nn.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function Hh(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new ca(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>Hh(s,e)):t._content)}const op=He.define({combine:t=>t.join(" ")}),$2=He.define({combine:t=>t.indexOf(!0)>-1}),H2=fo.newName(),_M=fo.newName(),DM=fo.newName(),RM={"&light":"."+_M,"&dark":"."+DM};function U2(t,e,n){return new fo(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return t;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):t+" "+r}})}const AW=U2("."+H2,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},RM),MW={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},zy=Fe.ie&&Fe.ie_version<=11;class EW{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new fV,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(Fe.ie&&Fe.ie_version<=11||Fe.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Fe.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Fe.chrome&&Fe.chrome_version<126)&&(this.editContext=new DW(e),e.state.facet(il)&&(e.contentDOM.editContext=this.editContext.editContext)),zy&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(il)?r.root.activeElement!=this.dom:!Kp(this.dom,s))return;let i=s.anchorNode&&r.docView.nearest(s.anchorNode);if(i&&i.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Fe.ie&&Fe.ie_version<=11||Fe.android&&Fe.chrome)&&!r.state.selection.main.empty&&s.focusNode&&ef(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=vf(e.root);if(!n)return!1;let r=Fe.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&_W(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=Kp(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&Gu(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of e){let l=this.readMutation(i);l&&(l.typeOver&&(s=!0),n==-1?{from:n,to:r}=l:(n=Math.min(l.from,n),r=Math.max(l.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&Kp(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new YV(this.view,e,n,r);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,s=wM(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let r=zj(n,e.previousSibling||e.target.previousSibling,-1),s=zj(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(il)!=e.state.facet(il)&&(e.view.contentDOM.editContext=e.state.facet(il)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function zj(t,e,n){for(;e;){let r=jn.get(e);if(r&&r.parent==t)return r;let s=e.parentNode;e=s!=t.dom?s:n>0?e.nextSibling:e.previousSibling}return null}function Pj(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,l=t.docView.domAtPos(t.state.selection.main.anchor);return ef(l.node,l.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function _W(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return Pj(t,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?Pj(t,n):null}class DW{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let s=e.state.selection.main,{anchor:i,head:l}=s,c=this.toEditorPos(r.updateRangeStart),d=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:c,drifted:!1});let h=d-c>r.text.length;c==this.from&&ithis.to&&(d=i);let m=SM(e.state.sliceDoc(c,d),r.text,(h?s.from:s.to)-c,h?"end":null);if(!m){let x=Ce.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));x.main.eq(s)||e.dispatch({selection:x,userEvent:"select"});return}let p={from:m.from+c,to:m.toA+c,insert:Xt.of(r.text.slice(m.from,m.toB).split(` +`))};if((Fe.mac||Fe.android)&&p.from==l-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(p={from:c,to:d,insert:Xt.of([r.text.replace("."," ")])}),this.pendingContextChange=p,!e.state.readOnly){let x=this.to-this.from+(p.to-p.from+p.insert.length);Aw(e,p,Ce.single(this.toEditorPos(r.selectionStart,x),this.toEditorPos(r.selectionEnd,x)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),p.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let l=this.toEditorPos(r.rangeStart),c=this.toEditorPos(r.rangeEnd);l{let s=[];for(let i of r.getTextFormats()){let l=i.underlineStyle,c=i.underlineThickness;if(!/none/i.test(l)&&!/none/i.test(c)){let d=this.toEditorPos(i.rangeStart),h=this.toEditorPos(i.rangeEnd);if(d{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=vf(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((i,l,c,d,h)=>{if(r)return;let m=h.length-(l-i);if(s&&l>=s.to)if(s.from==i&&s.to==l&&s.insert.eq(h)){s=this.pendingContextChange=null,n+=m,this.to+=m;return}else s=null,this.revertPending(e.state);if(i+=n,l+=n,l<=this.from)this.from+=m,this.to+=m;else if(ithis.to||this.to-this.from+h.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(l),h.toString()),this.to+=m}n+=m}),s&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class qe{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(s=>s.forEach(i=>r(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||mV(e.parent)||document,this.viewState=new Dj(e.state||Vt.create(e)),e.scrollTo&&e.scrollTo.is(np)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Fu).map(s=>new Ey(s));for(let s of this.plugins)s.update(this);this.observer=new EW(this),this.inputState=new eW(this),this.inputState.ensureHandlers(this.plugins),this.docView=new mj(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof gr?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let x of e){if(x.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=x.state}if(this.destroyed){this.viewState.state=i;return}let l=this.hasFocus,c=0,d=null;e.some(x=>x.annotation(TM))?(this.inputState.notifiedFocused=l,c=1):l!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=l,d=AM(i,l),d||(c=1));let h=this.observer.delayedAndroidKey,m=null;if(h?(this.observer.clearDelayedAndroidKey(),m=this.observer.readChange(),(m&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(m=null)):this.observer.clear(),i.facet(Vt.phrases)!=this.state.facet(Vt.phrases))return this.setState(i);s=Ng.create(this,i,e),s.flags|=c;let p=this.viewState.scrollTarget;try{this.updateState=2;for(let x of e){if(p&&(p=p.map(x.changes)),x.scrollIntoView){let{main:v}=x.state.selection;p=new Xu(v.empty?v:Ce.cursor(v.head,v.head>v.anchor?-1:1))}for(let v of x.effects)v.is(np)&&(p=v.value.clip(this.state))}this.viewState.update(s,p),this.bidiCache=Tg.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(Qh)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(x=>x.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(op)!=s.state.facet(op)&&(this.viewState.mustMeasureContent=!0),(n||r||p||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let x of this.state.facet(I2))try{x(s)}catch(v){_s(this.state,v,"update listener")}(d||m)&&Promise.resolve().then(()=>{d&&this.state==d.startState&&this.dispatch(d),m&&!wM(this,m)&&h.force&&Gu(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new Dj(e),this.plugins=e.facet(Fu).map(r=>new Ey(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new mj(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Fu),r=e.state.facet(Fu);if(n!=r){let s=[];for(let i of r){let l=n.indexOf(i);if(l<0)s.push(new Ey(i));else{let c=this.plugins[l];c.mustUpdate=e,s.push(c)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:l}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(l=-1),this.viewState.scrollAnchorHeight=-1;try{for(let c=0;;c++){if(l<0)if(QA(r))i=-1,l=this.viewState.heightMap.height;else{let v=this.viewState.scrollAnchorAt(s);i=v.from,l=v.top}this.updateState=1;let d=this.viewState.measure(this);if(!d&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(c>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];d&4||([this.measureRequests,h]=[h,this.measureRequests]);let m=h.map(v=>{try{return v.read(this)}catch(b){return _s(this.state,b),Bj}}),p=Ng.create(this,this.state,[]),x=!1;p.flags|=d,n?n.flags|=d:n=p,this.updateState=2,p.empty||(this.updatePlugins(p),this.inputState.update(p),this.updateAttrs(),x=this.docView.update(p),x&&this.docViewUpdate());for(let v=0;v1||b<-1){s=s+b,r.scrollTop=s/this.scaleY,l=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let c of this.state.facet(I2))c(n)}get themeClasses(){return H2+" "+(this.state.facet($2)?DM:_M)+" "+this.state.facet(op)}updateAttrs(){let e=Lj(this,fM,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(il)?"true":"false",class:"cm-content",style:`${Fe.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),Lj(this,Cw,n);let r=this.observer.ignore(()=>{let s=R2(this.contentDOM,this.contentAttrs,n),i=R2(this.dom,this.editorAttrs,e);return s||i});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let s of r.effects)if(s.is(qe.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Qh);let e=this.state.facet(qe.cspNonce);fo.mount(this.root,this.styleModules.concat(AW).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;nr.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return Dy(this,e,yj(this,e,n,r))}moveByGroup(e,n){return Dy(this,e,yj(this,e,n,r=>UV(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),i=r[n?r.length-1:0];return Ce.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return HV(this,e,n,r)}moveVertically(e,n,r){return Dy(this,e,VV(this,e,n,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),vM(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(e),i=this.bidiSpans(s),l=i[so.find(i,e-s.from,-1,n)];return s0(r,l.dir==Hn.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(cM)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>RW)return tM(e.length);let n=this.textDirectionAt(e.from),r;for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||eM(i.isolates,r=fj(this,e))))return i.order;r||(r=fj(this,e));let s=TV(e.text,n,r);return this.bidiCache.push(new Tg(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Fe.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{qA(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return np.of(new Xu(typeof e=="number"?Ce.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return np.of(new Xu(Ce.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return lr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return lr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=fo.newName(),s=[op.of(r),Qh.of(U2(`.${r}`,e))];return n&&n.dark&&s.push($2.of(!0)),s}static baseTheme(e){return No.lowest(Qh.of(U2("."+H2,e,RM)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&jn.get(r)||jn.get(e);return((n=s?.rootView)===null||n===void 0?void 0:n.view)||null}}qe.styleModule=Qh;qe.inputHandler=lM;qe.clipboardInputFilter=jw;qe.clipboardOutputFilter=Nw;qe.scrollHandler=dM;qe.focusChangeEffect=oM;qe.perLineTextDirection=cM;qe.exceptionSink=aM;qe.updateListener=I2;qe.editable=il;qe.mouseSelectionStyle=iM;qe.dragMovesSelection=sM;qe.clickAddsSelectionRange=rM;qe.decorations=yf;qe.outerDecorations=mM;qe.atomicRanges=l0;qe.bidiIsolatedRanges=pM;qe.scrollMargins=gM;qe.darkTheme=$2;qe.cspNonce=He.define({combine:t=>t.length?t[0]:""});qe.contentAttributes=Cw;qe.editorAttributes=fM;qe.lineWrapping=qe.contentAttributes.of({class:"cm-lineWrapping"});qe.announce=vt.define();const RW=4096,Bj={};class Tg{constructor(e,n,r,s,i,l){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=l}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:Hn.LTR;for(let i=Math.max(0,e.length-10);i=0;s--){let i=r[s],l=typeof i=="function"?i(t):i;l&&D2(l,n)}return n}const zW=Fe.mac?"mac":Fe.windows?"win":Fe.linux?"linux":"key";function PW(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,l,c;for(let d=0;dr.concat(s),[]))),n}function LW(t,e,n){return PM(zM(t.state),e,t,n)}let no=null;const IW=4e3;function qW(t,e=zW){let n=Object.create(null),r=Object.create(null),s=(l,c)=>{let d=r[l];if(d==null)r[l]=c;else if(d!=c)throw new Error("Key binding "+l+" is used both as a regular binding and as a multi-stroke prefix")},i=(l,c,d,h,m)=>{var p,x;let v=n[l]||(n[l]=Object.create(null)),b=c.split(/ (?!$)/).map(j=>PW(j,e));for(let j=1;j{let _=no={view:A,prefix:T,scope:l};return setTimeout(()=>{no==_&&(no=null)},IW),!0}]})}let k=b.join(" ");s(k,!1);let O=v[k]||(v[k]={preventDefault:!1,stopPropagation:!1,run:((x=(p=v._any)===null||p===void 0?void 0:p.run)===null||x===void 0?void 0:x.slice())||[]});d&&O.run.push(d),h&&(O.preventDefault=!0),m&&(O.stopPropagation=!0)};for(let l of t){let c=l.scope?l.scope.split(" "):["editor"];if(l.any)for(let h of c){let m=n[h]||(n[h]=Object.create(null));m._any||(m._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:p}=l;for(let x in m)m[x].run.push(v=>p(v,V2))}let d=l[e]||l.key;if(d)for(let h of c)i(h,d,l.run,l.preventDefault,l.stopPropagation),l.shift&&i(h,"Shift-"+d,l.shift,l.preventDefault,l.stopPropagation)}return n}let V2=null;function PM(t,e,n,r){V2=e;let s=oV(e),i=As(s,0),l=oa(i)==s.length&&s!=" ",c="",d=!1,h=!1,m=!1;no&&no.view==n&&no.scope==r&&(c=no.prefix+" ",OM.indexOf(e.keyCode)<0&&(h=!0,no=null));let p=new Set,x=O=>{if(O){for(let j of O.run)if(!p.has(j)&&(p.add(j),j(n)))return O.stopPropagation&&(m=!0),!0;O.preventDefault&&(O.stopPropagation&&(m=!0),h=!0)}return!1},v=t[r],b,k;return v&&(x(v[c+cp(s,e,!l)])?d=!0:l&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Fe.windows&&e.ctrlKey&&e.altKey)&&!(Fe.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(b=mo[e.keyCode])&&b!=s?(x(v[c+cp(b,e,!0)])||e.shiftKey&&(k=xf[e.keyCode])!=s&&k!=b&&x(v[c+cp(k,e,!1)]))&&(d=!0):l&&e.shiftKey&&x(v[c+cp(s,e,!0)])&&(d=!0),!d&&x(v._any)&&(d=!0)),h&&(d=!0),d&&m&&e.stopPropagation(),V2=null,d}class c0{constructor(e,n,r,s,i){this.className=e,this.left=n,this.top=r,this.width=s,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let s=e.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let i=BM(e);return[new c0(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return FW(e,n,r)}}function BM(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Hn.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function qj(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let i=t.dom.getBoundingClientRect(),l=(s.top+s.bottom)/2,c=t.posAtCoords({x:i.left+1,y:l}),d=t.posAtCoords({x:i.right-1,y:l});return c==null||d==null?r:{from:Math.max(r.from,Math.min(c,d)),to:Math.min(r.to,Math.max(c,d))}}function FW(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),s=Math.min(n.to,t.viewport.to),i=t.textDirection==Hn.LTR,l=t.contentDOM,c=l.getBoundingClientRect(),d=BM(t),h=l.querySelector(".cm-line"),m=h&&window.getComputedStyle(h),p=c.left+(m?parseInt(m.paddingLeft)+Math.min(0,parseInt(m.textIndent)):0),x=c.right-(m?parseInt(m.paddingRight):0),v=F2(t,r,1),b=F2(t,s,-1),k=v.type==fs.Text?v:null,O=b.type==fs.Text?b:null;if(k&&(t.lineWrapping||v.widgetLineBreaks)&&(k=qj(t,r,1,k)),O&&(t.lineWrapping||b.widgetLineBreaks)&&(O=qj(t,s,-1,O)),k&&O&&k.from==O.from&&k.to==O.to)return T(A(n.from,n.to,k));{let D=k?A(n.from,null,k):_(v,!1),E=O?A(null,n.to,O):_(b,!0),z=[];return(k||v).to<(O||b).from-(k&&O?1:0)||v.widgetLineBreaks>1&&D.bottom+t.defaultLineHeight/2V&&W.from=$)break;R>J&&U(Math.max(ue,J),D==null&&ue<=V,Math.min(R,$),E==null&&R>=ce,ne.dir)}if(J=ae.to+1,J>=$)break}return L.length==0&&U(V,D==null,ce,E==null,t.textDirection),{top:Q,bottom:F,horizontal:L}}function _(D,E){let z=c.top+(E?D.top:D.bottom);return{top:z,bottom:z,horizontal:[]}}}function QW(t,e){return t.constructor==e.constructor&&t.eq(e)}class $W{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(eg)!=e.state.facet(eg)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(eg);for(;n!QW(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of e)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=e,Fe.safari&&Fe.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const eg=He.define();function LM(t){return[lr.define(e=>new $W(e,t)),eg.of(t)]}const bf=He.define({combine(t){return Oa(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function HW(t={}){return[bf.of(t),UW,VW,WW,uM.of(!0)]}function IM(t){return t.startState.facet(bf)!=t.state.facet(bf)}const UW=LM({above:!0,markers(t){let{state:e}=t,n=e.facet(bf),r=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||n.drawRangeCursor){let l=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",c=s.empty?s:Ce.cursor(s.head,s.head>s.anchor?-1:1);for(let d of c0.forRange(t,l,c))r.push(d)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=IM(t);return n&&Fj(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){Fj(e.state,t)},class:"cm-cursorLayer"});function Fj(t,e){e.style.animationDuration=t.facet(bf).cursorBlinkRate+"ms"}const VW=LM({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:c0.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||IM(t)},class:"cm-selectionLayer"}),WW=No.highest(qe.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),qM=vt.define({map(t,e){return t==null?null:e.mapPos(t)}}),Uh=Br.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(qM)?r.value:n,t)}}),GW=lr.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(Uh);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Uh)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Uh),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Uh)!=t&&this.view.dispatch({effects:qM.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function XW(){return[Uh,GW]}function Qj(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),l=n,c;!i.next().done;l+=i.value.length)if(!i.lineBreak)for(;c=e.exec(i.value);)s(l+c.index,c)}function YW(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:s,to:i}of n)s=Math.max(t.state.doc.lineAt(s).from,s-e),i=Math.min(t.state.doc.lineAt(i).to,i+e),r.length&&r[r.length-1].to>=s?r[r.length-1].to=i:r.push({from:s,to:i});return r}class KW{constructor(e){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:l=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(c,d,h,m)=>s(m,h,h+c[0].length,c,d);else if(typeof r=="function")this.addMatch=(c,d,h,m)=>{let p=r(c,d,h);p&&m(h,h+c[0].length,p)};else if(r)this.addMatch=(c,d,h,m)=>m(h,h+c[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=l}createDeco(e){let n=new ml,r=n.add.bind(n);for(let{from:s,to:i}of YW(e,this.maxLength))Qj(e.state.doc,this.regexp,s,i,(l,c)=>this.addMatch(c,e,l,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,l,c,d)=>{d>=e.view.viewport.from&&c<=e.view.viewport.to&&(r=Math.min(c,r),s=Math.max(d,s))}),e.viewportMoved||s-r>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,n.map(e.changes),r,s):n}updateRange(e,n,r,s){for(let i of e.visibleRanges){let l=Math.max(i.from,r),c=Math.min(i.to,s);if(c>=l){let d=e.state.doc.lineAt(l),h=d.tod.from;l--)if(this.boundary.test(d.text[l-1-d.from])){m=l;break}for(;cx.push(j.range(k,O));if(d==h)for(this.regexp.lastIndex=m-d.from;(v=this.regexp.exec(d.text))&&v.indexthis.addMatch(O,e,k,b));n=n.update({filterFrom:m,filterTo:p,filter:(k,O)=>kp,add:x})}}return n}}const W2=/x/.unicode!=null?"gu":"g",ZW=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,W2),JW={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Py=null;function eG(){var t;if(Py==null&&typeof document<"u"&&document.body){let e=document.body.style;Py=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Py||!1}const tg=He.define({combine(t){let e=Oa(t,{render:null,specialChars:ZW,addSpecialChars:null});return(e.replaceTabs=!eG())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,W2)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,W2)),e}});function tG(t={}){return[tg.of(t),nG()]}let $j=null;function nG(){return $j||($j=lr.fromClass(class{constructor(t){this.view=t,this.decorations=Je.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(tg)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new KW({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=As(e[0],0);if(i==9){let l=s.lineAt(r),c=n.state.tabSize,d=Td(l.text,c,r-l.from);return Je.replace({widget:new aG((c-d%c)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=Je.replace({widget:new iG(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(tg);t.startState.facet(tg)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const rG="•";function sG(t){return t>=32?rG:t==10?"␤":String.fromCharCode(9216+t)}class iG extends ja{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=sG(this.code),r=e.state.phrase("Control character")+" "+(JW[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,n);if(s)return s;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class aG extends ja{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function lG(){return cG}const oG=Je.line({class:"cm-activeLine"}),cG=lr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let s=t.lineBlockAt(r.head);s.from>e&&(n.push(oG.range(s.from)),e=s.from)}return Je.set(n)}},{decorations:t=>t.decorations});class uG extends ja{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?ud(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),s=s0(n[0],r.direction!="rtl"),i=parseInt(r.lineHeight);return s.bottom-s.top>i*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+i}:s}ignoreEvent(){return!1}}function dG(t){let e=lr.fromClass(class{constructor(n){this.view=n,this.placeholder=t?Je.set([Je.widget({widget:new uG(t),side:1}).range(0)]):Je.none}get decorations(){return this.view.state.doc.length?Je.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,qe.contentAttributes.of({"aria-placeholder":t})]:e}const G2=2e3;function hG(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>G2||n.off>G2||e.col<0||n.col<0){let l=Math.min(e.off,n.off),c=Math.max(e.off,n.off);for(let d=r;d<=s;d++){let h=t.doc.line(d);h.length<=c&&i.push(Ce.range(h.from+l,h.to+c))}}else{let l=Math.min(e.col,n.col),c=Math.max(e.col,n.col);for(let d=r;d<=s;d++){let h=t.doc.line(d),m=j2(h.text,l,t.tabSize,!0);if(m<0)i.push(Ce.cursor(h.to));else{let p=j2(h.text,c,t.tabSize);i.push(Ce.range(h.from+m,h.from+p))}}}return i}function fG(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function Hj(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),s=n-r.from,i=s>G2?-1:s==r.length?fG(t,e.clientX):Td(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function mG(t,e){let n=Hj(t,e),r=t.state.selection;return n?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(n.line).from),l=s.state.doc.lineAt(i);n={line:l.number,col:n.col,off:Math.min(n.off,l.length)},r=r.map(s.changes)}},get(s,i,l){let c=Hj(t,s);if(!c)return r;let d=hG(t.state,n,c);return d.length?l?Ce.create(d.concat(r.ranges)):Ce.create(d):r}}:null}function pG(t){let e=(n=>n.altKey&&n.button==0);return qe.mouseSelectionStyle.of((n,r)=>e(r)?mG(n,r):null)}const gG={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},xG={style:"cursor: crosshair"};function vG(t={}){let[e,n]=gG[t.key||"Alt"],r=lr.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||n(s))},keyup(s){(s.keyCode==e||!n(s))&&this.set(!1)},mousemove(s){this.set(n(s))}}});return[r,qe.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?xG:null})]}const up="-10000px";class FM{constructor(e,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=e.state.facet(n),this.tooltips=this.input.filter(l=>l);let i=null;this.tooltipViews=this.tooltips.map(l=>i=r(l,i))}update(e,n){var r;let s=e.state.facet(this.facet),i=s.filter(d=>d);if(s===this.input){for(let d of this.tooltipViews)d.update&&d.update(e);return!1}let l=[],c=n?[]:null;for(let d=0;dn[h]=d),n.length=c.length),this.input=s,this.tooltips=i,this.tooltipViews=l,!0}}function yG(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const By=He.define({combine:t=>{var e,n,r;return{position:Fe.ios?"absolute":((e=t.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(s=>s.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||yG}}}),Uj=new WeakMap,_w=lr.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(By);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new FM(t,Dw,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(By);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",n.dom.appendChild(s)}return n.dom.style.position=this.position,n.dom.style.top=up,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(Fe.safari){let l=i.getBoundingClientRect();n=Math.abs(l.top+1e4)>1||Math.abs(l.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=Tw(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,l)=>{let c=this.manager.tooltipViews[l];return c.getCoords?c.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(By).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let c of this.manager.tooltipViews)c.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,l=[];for(let c=0;c=Math.min(n.bottom,r.bottom)||p.rightMath.min(n.right,r.right)+.1)){m.style.top=up;continue}let v=d.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,b=v?7:0,k=x.right-x.left,O=(e=Uj.get(h))!==null&&e!==void 0?e:x.bottom-x.top,j=h.offset||wG,T=this.view.textDirection==Hn.LTR,A=x.width>r.right-r.left?T?r.left:r.right-x.width:T?Math.max(r.left,Math.min(p.left-(v?14:0)+j.x,r.right-k)):Math.min(Math.max(r.left,p.left-k+(v?14:0)-j.x),r.right-k),_=this.above[c];!d.strictSide&&(_?p.top-O-b-j.yr.bottom)&&_==r.bottom-p.bottom>p.top-r.top&&(_=this.above[c]=!_);let D=(_?p.top-r.top:r.bottom-p.bottom)-b;if(DA&&Q.topE&&(E=_?Q.top-O-2-b:Q.bottom+b+2);if(this.position=="absolute"?(m.style.top=(E-t.parent.top)/i+"px",Vj(m,(A-t.parent.left)/s)):(m.style.top=E/i+"px",Vj(m,A/s)),v){let Q=p.left+(T?j.x:-j.x)-(A+14-7);v.style.left=Q/s+"px"}h.overlap!==!0&&l.push({left:A,top:E,right:z,bottom:E+O}),m.classList.toggle("cm-tooltip-above",_),m.classList.toggle("cm-tooltip-below",!_),h.positioned&&h.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=up}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Vj(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const bG=qe.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),wG={x:0,y:0},Dw=He.define({enables:[_w,bG]}),Ag=He.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Ox{static create(e){return new Ox(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new FM(e,Ag,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let s=r[e];if(s!==void 0){if(n===void 0)n=s;else if(n!==s)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const SG=Dw.compute([Ag],t=>{let e=t.facet(Ag);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:Ox.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class kG{constructor(e,n,r,s,i){this.view=e,this.source=n,this.field=r,this.setHover=s,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;ec.bottom||n.xc.right+e.defaultCharacterWidth)return;let d=e.bidiSpans(e.state.doc.lineAt(s)).find(m=>m.from<=s&&m.to>=s),h=d&&d.dir==Hn.RTL?-1:1;i=n.x{this.pending==c&&(this.pending=null,d&&!(Array.isArray(d)&&!d.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(d)?d:[d])}))},d=>_s(e.state,d,"hover tooltip"))}else l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])})}get tooltip(){let e=this.view.plugin(_w),n=e?e.manager.tooltips.findIndex(r=>r.create==Ox.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:i}=this;if(s.length&&i&&!OG(i.dom,e)||this.pending){let{pos:l}=s[0]||this.pending,c=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:l;(l==c?this.view.posAtCoords(this.lastMove)!=l:!jG(this.view,l,c,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const dp=4;function OG(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),l;if(l=t.querySelector(".cm-tooltip-arrow")){let c=l.getBoundingClientRect();s=Math.min(c.top,s),i=Math.max(c.bottom,i)}return e.clientX>=n-dp&&e.clientX<=r+dp&&e.clientY>=s-dp&&e.clientY<=i+dp}function jG(t,e,n,r,s,i){let l=t.scrollDOM.getBoundingClientRect(),c=t.documentTop+t.documentPadding.top+t.contentHeight;if(l.left>r||l.rights||Math.min(l.bottom,c)=e&&d<=n}function NG(t,e={}){let n=vt.define(),r=Br.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(l=>!e.hideOn(i,l))),i.docChanged)){let l=[];for(let c of s){let d=i.changes.mapPos(c.pos,-1,Ur.TrackDel);if(d!=null){let h=Object.assign(Object.create(null),c);h.pos=d,h.end!=null&&(h.end=i.changes.mapPos(h.end)),l.push(h)}}s=l}for(let l of i.effects)l.is(n)&&(s=l.value),l.is(CG)&&(s=[]);return s},provide:s=>Ag.from(s)});return{active:r,extension:[r,lr.define(s=>new kG(s,t,r,n,e.hoverTime||300)),SG]}}function QM(t,e){let n=t.plugin(_w);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const CG=vt.define(),Wj=He.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function wf(t,e){let n=t.plugin($M),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const $M=lr.fromClass(class{constructor(t){this.input=t.state.facet(Sf),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(Wj);this.top=new hp(t,!0,e.topContainer),this.bottom=new hp(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(Wj);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new hp(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new hp(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Sf);if(n!=this.input){let r=n.filter(d=>d),s=[],i=[],l=[],c=[];for(let d of r){let h=this.specs.indexOf(d),m;h<0?(m=d(t.view),c.push(m)):(m=this.panels[h],m.update&&m.update(t)),s.push(m),(m.top?i:l).push(m)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(l);for(let d of c)d.dom.classList.add("cm-panel"),d.mount&&d.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>qe.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class hp{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=Gj(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=Gj(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Gj(t){let e=t.nextSibling;return t.remove(),e}const Sf=He.define({enables:$M});class gl extends yc{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}gl.prototype.elementClass="";gl.prototype.toDOM=void 0;gl.prototype.mapMode=Ur.TrackBefore;gl.prototype.startSide=gl.prototype.endSide=-1;gl.prototype.point=!0;const ng=He.define(),TG=He.define(),AG={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Yt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},rf=He.define();function MG(t){return[HM(),rf.of({...AG,...t})]}const Xj=He.define({combine:t=>t.some(e=>e)});function HM(t){return[EG]}const EG=lr.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(rf).map(e=>new Kj(t,e)),this.fixed=!t.state.facet(Xj);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Xj)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=Yt.iter(this.view.state.facet(ng),this.view.viewport.from),r=[],s=this.gutters.map(i=>new _G(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let l=!0;for(let c of i.type)if(c.type==fs.Text&&l){X2(n,r,c.from);for(let d of s)d.line(this.view,c,r);l=!1}else if(c.widget)for(let d of s)d.widget(this.view,c)}else if(i.type==fs.Text){X2(n,r,i.from);for(let l of s)l.line(this.view,i,r)}else if(i.widget)for(let l of s)l.widget(this.view,i);for(let i of s)i.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(rf),n=t.state.facet(rf),r=t.docChanged||t.heightChanged||t.viewportChanged||!Yt.eq(t.startState.facet(ng),t.state.facet(ng),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let i of n){let l=e.indexOf(i);l<0?s.push(new Kj(this.view,i)):(this.gutters[l].update(t),s.push(this.gutters[l]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>qe.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,s=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Hn.LTR?{left:r,right:s}:{right:r,left:s}})});function Yj(t){return Array.isArray(t)?t:[t]}function X2(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class _G{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Yt.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,i=(n.top-this.height)/e.scaleY,l=n.height/e.scaleY;if(this.i==s.elements.length){let c=new UM(e,l,i,r);s.elements.push(c),s.dom.appendChild(c.dom)}else s.elements[this.i].update(e,l,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];X2(this.cursor,s,n.from),r.length&&(s=s.concat(r));let i=this.gutter.config.lineMarker(e,n,s);i&&s.unshift(i);let l=this.gutter;s.length==0&&!l.config.renderEmptyElements||this.addElement(e,n,s)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),s=r?[r]:null;for(let i of e.state.facet(TG)){let l=i(e,n.widget,n);l&&(s||(s=[])).push(l)}s&&this.addElement(e,n,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class Kj{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let i=s.target,l;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let d=i.getBoundingClientRect();l=(d.top+d.bottom)/2}else l=s.clientY;let c=e.lineBlockAtHeight(l-e.documentTop);n.domEventHandlers[r](e,c,s)&&s.preventDefault()});this.markers=Yj(n.markers(e)),n.initialSpacer&&(this.spacer=new UM(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=Yj(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let r=e.view.viewport;return!Yt.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class UM{constructor(e,n,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,s)}update(e,n,r,s){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),DG(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,l=0;;){let c=l,d=ii(c,d,h)||l(c,d,h):l}return r}})}});class Ly extends gl{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Iy(t,e){return t.state.facet(Qu).formatNumber(e,t.state)}const PG=rf.compute([Qu],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(RG)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new Ly(Iy(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(zG)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Qu)!=e.state.facet(Qu),initialSpacer(e){return new Ly(Iy(e,Zj(e.state.doc.lines)))},updateSpacer(e,n){let r=Iy(n.view,Zj(n.view.state.doc.lines));return r==e.number?e:new Ly(r)},domEventHandlers:t.facet(Qu).domEventHandlers,side:"before"}));function BG(t={}){return[Qu.of(t),HM(),PG]}function Zj(t){let e=9;for(;e{let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>n&&(n=s,e.push(LG.range(s)))}return Yt.of(e)});function qG(){return IG}const VM=1024;let FG=0;class qy{constructor(e,n){this.from=e,this.to=n}}class Et{constructor(e={}){this.id=FG++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=gs.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Et.closedBy=new Et({deserialize:t=>t.split(" ")});Et.openedBy=new Et({deserialize:t=>t.split(" ")});Et.group=new Et({deserialize:t=>t.split(" ")});Et.isolate=new Et({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Et.contextHash=new Et({perNode:!0});Et.lookAhead=new Et({perNode:!0});Et.mounted=new Et({perNode:!0});class Mg{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[Et.mounted.id]}}const QG=Object.create(null);class gs{constructor(e,n,r,s=0){this.name=e,this.props=n,this.id=r,this.flags=s}static define(e){let n=e.props&&e.props.length?Object.create(null):QG,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new gs(e.name||"",n,e.id,r);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(s)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Et.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let s of r.split(" "))n[s]=e[r];return r=>{for(let s=r.prop(Et.group),i=-1;i<(s?s.length:0);i++){let l=n[i<0?r.name:s[i]];if(l)return l}}}}gs.none=new gs("",Object.create(null),0,8);class jx{constructor(e){this.types=e;for(let n=0;n0;for(let d=this.cursor(l|Or.IncludeAnonymous);;){let h=!1;if(d.from<=i&&d.to>=s&&(!c&&d.type.isAnonymous||n(d)!==!1)){if(d.firstChild())continue;h=!0}for(;h&&r&&(c||!d.type.isAnonymous)&&r(d),!d.nextSibling();){if(!d.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Pw(gs.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new Dn(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new Dn(gs.none,n,r,s)))}static build(e){return VG(e)}}Dn.empty=new Dn(gs.none,[],[],0);class Rw{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Rw(this.buffer,this.index)}}class go{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return gs.none}toString(){let e=[];for(let n=0;n0));d=l[d+3]);return c}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),l=0;for(let c=e,d=0;c=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function kf(t,e,n,r){for(var s;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?c.length:-1;e!=h;e+=n){let m=c[e],p=d[e]+l.from;if(WM(s,r,p,p+m.length)){if(m instanceof go){if(i&Or.ExcludeBuffers)continue;let x=m.findChild(0,m.buffer.length,n,r-p,s);if(x>-1)return new ha(new $G(l,m,e,p),null,x)}else if(i&Or.IncludeAnonymous||!m.type.isAnonymous||zw(m)){let x;if(!(i&Or.IgnoreMounts)&&(x=Mg.get(m))&&!x.overlay)return new Ps(x.tree,p,e,l);let v=new Ps(m,p,e,l);return i&Or.IncludeAnonymous||!v.type.isAnonymous?v:v.nextChild(n<0?m.children.length-1:0,n,r,s)}}}if(i&Or.IncludeAnonymous||!l.type.isAnonymous||(l.index>=0?e=l.index+n:e=n<0?-1:l._parent._tree.children.length,l=l._parent,!l))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let s;if(!(r&Or.IgnoreOverlays)&&(s=Mg.get(this._tree))&&s.overlay){let i=e-this.from;for(let{from:l,to:c}of s.overlay)if((n>0?l<=i:l=i:c>i))return new Ps(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function e7(t,e,n,r){let s=t.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let l=!1;!l;)if(l=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(e)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function Y2(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class $G{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class ha extends GM{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.context.start,r);return i<0?null:new ha(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&Or.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return i<0?null:new ha(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new ha(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new ha(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let l=r.buffer[this.index+1];e.push(r.slice(s,i,l)),n.push(0)}return new Dn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function XM(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;in.from||l.to=e){let c=new Ps(l.tree,l.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(kf(c,e,n,!1))}}return s?XM(s):r}class K2{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ps)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof Ps?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Or.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Or.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Or.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let i=n+e,l=e<0?-1:r._tree.children.length;i!=l;i+=e){let c=r._tree.children[i];if(this.mode&Or.IncludeAnonymous||c instanceof go||!c.type.isAnonymous||zw(c))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let l=e;l;l=l._parent)if(l.index==s){if(s==this.index)return l;n=l,r=i+1;break e}s=this.stack[--i]}for(let s=r;s=0;i--){if(i<0)return Y2(this._tree,e,s);let l=r[n.buffer[this.stack[i]]];if(!l.isAnonymous){if(e[s]&&e[s]!=l.name)return!1;s--}}return!0}}function zw(t){return t.children.some(e=>e instanceof go||!e.type.isAnonymous||zw(e))}function VG(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=VM,reused:i=[],minRepeatType:l=r.types.length}=t,c=Array.isArray(n)?new Rw(n,n.length):n,d=r.types,h=0,m=0;function p(D,E,z,Q,F,L){let{id:U,start:V,end:ce,size:W}=c,J=m,$=h;if(W<0)if(c.next(),W==-1){let me=i[U];z.push(me),Q.push(V-D);return}else if(W==-3){h=U;return}else if(W==-4){m=U;return}else throw new RangeError(`Unrecognized record size: ${W}`);let ae=d[U],ne,ue,R=V-D;if(ce-V<=s&&(ue=O(c.pos-E,F))){let me=new Uint16Array(ue.size-ue.skip),Y=c.pos-ue.size,P=me.length;for(;c.pos>Y;)P=j(ue.start,me,P);ne=new go(me,ce-ue.start,r),R=ue.start-D}else{let me=c.pos-W;c.next();let Y=[],P=[],K=U>=l?U:-1,H=0,fe=ce;for(;c.pos>me;)K>=0&&c.id==K&&c.size>=0?(c.end<=fe-s&&(b(Y,P,V,H,c.end,fe,K,J,$),H=Y.length,fe=c.end),c.next()):L>2500?x(V,me,Y,P):p(V,me,Y,P,K,L+1);if(K>=0&&H>0&&H-1&&H>0){let ve=v(ae,$);ne=Pw(ae,Y,P,0,Y.length,0,ce-V,ve,ve)}else ne=k(ae,Y,P,ce-V,J-ce,$)}z.push(ne),Q.push(R)}function x(D,E,z,Q){let F=[],L=0,U=-1;for(;c.pos>E;){let{id:V,start:ce,end:W,size:J}=c;if(J>4)c.next();else{if(U>-1&&ce=0;W-=3)V[J++]=F[W],V[J++]=F[W+1]-ce,V[J++]=F[W+2]-ce,V[J++]=J;z.push(new go(V,F[2]-ce,r)),Q.push(ce-D)}}function v(D,E){return(z,Q,F)=>{let L=0,U=z.length-1,V,ce;if(U>=0&&(V=z[U])instanceof Dn){if(!U&&V.type==D&&V.length==F)return V;(ce=V.prop(Et.lookAhead))&&(L=Q[U]+V.length+ce)}return k(D,z,Q,F,L,E)}}function b(D,E,z,Q,F,L,U,V,ce){let W=[],J=[];for(;D.length>Q;)W.push(D.pop()),J.push(E.pop()+z-F);D.push(k(r.types[U],W,J,L-F,V-L,ce)),E.push(F-z)}function k(D,E,z,Q,F,L,U){if(L){let V=[Et.contextHash,L];U=U?[V].concat(U):[V]}if(F>25){let V=[Et.lookAhead,F];U=U?[V].concat(U):[V]}return new Dn(D,E,z,Q,U)}function O(D,E){let z=c.fork(),Q=0,F=0,L=0,U=z.end-s,V={size:0,start:0,skip:0};e:for(let ce=z.pos-D;z.pos>ce;){let W=z.size;if(z.id==E&&W>=0){V.size=Q,V.start=F,V.skip=L,L+=4,Q+=4,z.next();continue}let J=z.pos-W;if(W<0||J=l?4:0,ae=z.start;for(z.next();z.pos>J;){if(z.size<0)if(z.size==-3)$+=4;else break e;else z.id>=l&&($+=4);z.next()}F=ae,Q+=W,L+=$}return(E<0||Q==D)&&(V.size=Q,V.start=F,V.skip=L),V.size>4?V:void 0}function j(D,E,z){let{id:Q,start:F,end:L,size:U}=c;if(c.next(),U>=0&&Q4){let ce=c.pos-(U-4);for(;c.pos>ce;)z=j(D,E,z)}E[--z]=V,E[--z]=L-D,E[--z]=F-D,E[--z]=Q}else U==-3?h=Q:U==-4&&(m=Q);return z}let T=[],A=[];for(;c.pos>0;)p(t.start||0,t.bufferStart||0,T,A,-1,0);let _=(e=t.length)!==null&&e!==void 0?e:T.length?A[0]+T[0].length:0;return new Dn(d[t.topID],T.reverse(),A.reverse(),_)}const t7=new WeakMap;function rg(t,e){if(!t.isAnonymous||e instanceof go||e.type!=t)return 1;let n=t7.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Dn)){n=1;break}n+=rg(t,r)}t7.set(e,n)}return n}function Pw(t,e,n,r,s,i,l,c,d){let h=0;for(let b=r;b=m)break;E+=z}if(A==_+1){if(E>m){let z=b[_];v(z.children,z.positions,0,z.children.length,k[_]+T);continue}p.push(b[_])}else{let z=k[A-1]+b[A-1].length-D;p.push(Pw(t,b,k,_,A,D,z,null,d))}x.push(D+T-i)}}return v(e,n,r,s,0),(c||d)(p,x,l)}class WG{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof ha?this.setBuffer(e.context.buffer,e.index,n):e instanceof Ps&&this.map.set(e.tree,n)}get(e){return e instanceof ha?this.getBuffer(e.context.buffer,e.index):e instanceof Ps?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class pc{constructor(e,n,r,s,i=!1,l=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(l?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let s=[new pc(0,e.length,e,0,!1,r)];for(let i of n)i.to>e.length&&s.push(i);return s}static applyChanges(e,n,r=128){if(!n.length)return e;let s=[],i=1,l=e.length?e[0]:null;for(let c=0,d=0,h=0;;c++){let m=c=r)for(;l&&l.from=x.from||p<=x.to||h){let v=Math.max(x.from,d)-h,b=Math.min(x.to,p)-h;x=v>=b?null:new pc(v,b,x.tree,x.offset+h,c>0,!!m)}if(x&&s.push(x),l.to>p)break;l=inew qy(s.from,s.to)):[new qy(0,0)]:[new qy(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let s=this.startParse(e,n,r);for(;;){let i=s.advance();if(i)return i}}};class GG{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new Et({perNode:!0});let XG=0;class yi{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=XG++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof yi&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new yi(r,[],null,[]);if(s.set.push(s),n)for(let i of n.set)s.set.push(i);return s}static defineModifier(e){let n=new Eg(e);return r=>r.modified.indexOf(n)>-1?r:Eg.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let YG=0;class Eg{constructor(e){this.name=e,this.instances=[],this.id=YG++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(c=>c.base==e&&KG(n,c.modified));if(r)return r;let s=[],i=new yi(e.name,s,e,n);for(let c of n)c.instances.push(i);let l=ZG(n);for(let c of e.set)if(!c.modified.length)for(let d of l)s.push(Eg.get(c,d));return i}}function KG(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function ZG(t){let e=[[]];for(let n=0;nr.length-n.length)}function Lw(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],l=2,c=s;for(let p=0;;){if(c=="..."&&p>0&&p+3==s.length){l=1;break}let x=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(c);if(!x)throw new RangeError("Invalid path: "+s);if(i.push(x[0]=="*"?"":x[0][0]=='"'?JSON.parse(x[0]):x[0]),p+=x[0].length,p==s.length)break;let v=s[p++];if(p==s.length&&v=="!"){l=0;break}if(v!="/")throw new RangeError("Invalid path: "+s);c=s.slice(p)}let d=i.length-1,h=i[d];if(!h)throw new RangeError("Invalid path: "+s);let m=new Of(r,l,d>0?i.slice(0,d):null);e[h]=m.sort(e[h])}}return YM.add(e)}const YM=new Et({combine(t,e){let n,r,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let i=new Of(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class Of{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let l=s;for(let c of i)for(let d of c.set){let h=n[d.id];if(h){l=l?l+" "+h:h;break}}return l},scope:r}}function JG(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function eX(t,e,n,r=0,s=t.length){let i=new tX(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class tX{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,s,i){let{type:l,from:c,to:d}=e;if(c>=r||d<=n)return;l.isTop&&(i=this.highlighters.filter(v=>!v.scope||v.scope(l)));let h=s,m=nX(e)||Of.empty,p=JG(i,m.tags);if(p&&(h&&(h+=" "),h+=p,m.mode==1&&(s+=(s?" ":"")+p)),this.startSpan(Math.max(n,c),h),m.opaque)return;let x=e.tree&&e.tree.prop(Et.mounted);if(x&&x.overlay){let v=e.node.enter(x.overlay[0].from+c,1),b=this.highlighters.filter(O=>!O.scope||O.scope(x.tree.type)),k=e.firstChild();for(let O=0,j=c;;O++){let T=O=A||!e.nextSibling())););if(!T||A>r)break;j=T.to+c,j>n&&(this.highlightRange(v.cursor(),Math.max(n,T.from+c),Math.min(r,j),"",b),this.startSpan(Math.min(r,j),h))}k&&e.parent()}else if(e.firstChild()){x&&(s="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,s,i),this.startSpan(Math.min(r,e.to),h)}while(e.nextSibling());e.parent()}}}function nX(t){let e=t.type.prop(YM);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ie=yi.define,mp=Ie(),eo=Ie(),n7=Ie(eo),r7=Ie(eo),to=Ie(),pp=Ie(to),Fy=Ie(to),sa=Ie(),Zo=Ie(sa),na=Ie(),ra=Ie(),Z2=Ie(),Rh=Ie(Z2),gp=Ie(),he={comment:mp,lineComment:Ie(mp),blockComment:Ie(mp),docComment:Ie(mp),name:eo,variableName:Ie(eo),typeName:n7,tagName:Ie(n7),propertyName:r7,attributeName:Ie(r7),className:Ie(eo),labelName:Ie(eo),namespace:Ie(eo),macroName:Ie(eo),literal:to,string:pp,docString:Ie(pp),character:Ie(pp),attributeValue:Ie(pp),number:Fy,integer:Ie(Fy),float:Ie(Fy),bool:Ie(to),regexp:Ie(to),escape:Ie(to),color:Ie(to),url:Ie(to),keyword:na,self:Ie(na),null:Ie(na),atom:Ie(na),unit:Ie(na),modifier:Ie(na),operatorKeyword:Ie(na),controlKeyword:Ie(na),definitionKeyword:Ie(na),moduleKeyword:Ie(na),operator:ra,derefOperator:Ie(ra),arithmeticOperator:Ie(ra),logicOperator:Ie(ra),bitwiseOperator:Ie(ra),compareOperator:Ie(ra),updateOperator:Ie(ra),definitionOperator:Ie(ra),typeOperator:Ie(ra),controlOperator:Ie(ra),punctuation:Z2,separator:Ie(Z2),bracket:Rh,angleBracket:Ie(Rh),squareBracket:Ie(Rh),paren:Ie(Rh),brace:Ie(Rh),content:sa,heading:Zo,heading1:Ie(Zo),heading2:Ie(Zo),heading3:Ie(Zo),heading4:Ie(Zo),heading5:Ie(Zo),heading6:Ie(Zo),contentSeparator:Ie(sa),list:Ie(sa),quote:Ie(sa),emphasis:Ie(sa),strong:Ie(sa),link:Ie(sa),monospace:Ie(sa),strikethrough:Ie(sa),inserted:Ie(),deleted:Ie(),changed:Ie(),invalid:Ie(),meta:gp,documentMeta:Ie(gp),annotation:Ie(gp),processingInstruction:Ie(gp),definition:yi.defineModifier("definition"),constant:yi.defineModifier("constant"),function:yi.defineModifier("function"),standard:yi.defineModifier("standard"),local:yi.defineModifier("local"),special:yi.defineModifier("special")};for(let t in he){let e=he[t];e instanceof yi&&(e.name=t)}KM([{tag:he.link,class:"tok-link"},{tag:he.heading,class:"tok-heading"},{tag:he.emphasis,class:"tok-emphasis"},{tag:he.strong,class:"tok-strong"},{tag:he.keyword,class:"tok-keyword"},{tag:he.atom,class:"tok-atom"},{tag:he.bool,class:"tok-bool"},{tag:he.url,class:"tok-url"},{tag:he.labelName,class:"tok-labelName"},{tag:he.inserted,class:"tok-inserted"},{tag:he.deleted,class:"tok-deleted"},{tag:he.literal,class:"tok-literal"},{tag:he.string,class:"tok-string"},{tag:he.number,class:"tok-number"},{tag:[he.regexp,he.escape,he.special(he.string)],class:"tok-string2"},{tag:he.variableName,class:"tok-variableName"},{tag:he.local(he.variableName),class:"tok-variableName tok-local"},{tag:he.definition(he.variableName),class:"tok-variableName tok-definition"},{tag:he.special(he.variableName),class:"tok-variableName2"},{tag:he.definition(he.propertyName),class:"tok-propertyName tok-definition"},{tag:he.typeName,class:"tok-typeName"},{tag:he.namespace,class:"tok-namespace"},{tag:he.className,class:"tok-className"},{tag:he.macroName,class:"tok-macroName"},{tag:he.propertyName,class:"tok-propertyName"},{tag:he.operator,class:"tok-operator"},{tag:he.comment,class:"tok-comment"},{tag:he.meta,class:"tok-meta"},{tag:he.invalid,class:"tok-invalid"},{tag:he.punctuation,class:"tok-punctuation"}]);var Qy;const oc=new Et;function ZM(t){return He.define({combine:t?e=>e.concat(t):void 0})}const rX=new Et;class wi{constructor(e,n,r=[],s=""){this.data=e,this.name=s,Vt.prototype.hasOwnProperty("tree")||Object.defineProperty(Vt.prototype,"tree",{get(){return zr(this)}}),this.parser=n,this.extension=[xo.of(this),Vt.languageData.of((i,l,c)=>{let d=s7(i,l,c),h=d.type.prop(oc);if(!h)return[];let m=i.facet(h),p=d.type.prop(rX);if(p){let x=d.resolve(l-d.from,c);for(let v of p)if(v.test(x,i)){let b=i.facet(v.facet);return v.type=="replace"?b:b.concat(m)}}return m})].concat(r)}isActiveAt(e,n,r=-1){return s7(e,n,r).type.prop(oc)==this.data}findRegions(e){let n=e.facet(xo);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,l)=>{if(i.prop(oc)==this.data){r.push({from:l,to:l+i.length});return}let c=i.prop(Et.mounted);if(c){if(c.tree.prop(oc)==this.data){if(c.overlay)for(let d of c.overlay)r.push({from:d.from+l,to:d.to+l});else r.push({from:l,to:l+i.length});return}else if(c.overlay){let d=r.length;if(s(c.tree,c.overlay[0].from+l),r.length>d)return}}for(let d=0;dr.isTop?n:void 0)]}),e.name)}configure(e,n){return new jf(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function zr(t){let e=t.field(wi.state,!1);return e?e.tree:Dn.empty}class sX{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let zh=null;class md{constructor(e,n,r=[],s,i,l,c,d){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=l,this.skipped=c,this.scheduleOn=d,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new md(e,n,[],Dn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new sX(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Dn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(pc.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=zh;zh=this;try{return e()}finally{zh=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=i7(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:l,skipped:c}=this;if(this.takeTree(),!e.empty){let d=[];if(e.iterChangedRanges((h,m,p,x)=>d.push({fromA:h,toA:m,fromB:p,toB:x})),r=pc.applyChanges(r,d),s=Dn.empty,i=0,l={from:e.mapPos(l.from,-1),to:e.mapPos(l.to,1)},this.skipped.length){c=[];for(let h of this.skipped){let m=e.mapPos(h.from,1),p=e.mapPos(h.to,-1);me.from&&(this.fragments=i7(this.fragments,s,i),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends Bw{createParse(n,r,s){let i=s[0].from,l=s[s.length-1].to;return{parsedPos:i,advance(){let d=zh;if(d){for(let h of s)d.tempSkipped.push(h);e&&(d.scheduleOn=d.scheduleOn?Promise.all([d.scheduleOn,e]):e)}return this.parsedPos=l,new Dn(gs.none,[],[],l-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return zh}}function i7(t,e,n){return pc.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class pd{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new pd(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=md.create(e.facet(xo).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new pd(r)}}wi.state=Br.define({create:pd.init,update(t,e){for(let n of e.effects)if(n.is(wi.setState))return n.value;return e.startState.facet(xo)!=e.state.facet(xo)?pd.init(e.state):t.apply(e)}});let JM=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(JM=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const $y=typeof navigator<"u"&&(!((Qy=navigator.scheduling)===null||Qy===void 0)&&Qy.isInputPending)?()=>navigator.scheduling.isInputPending():null,iX=lr.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(wi.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(wi.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=JM(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnds+1e3,d=i.context.work(()=>$y&&$y()||Date.now()>l,s+(c?0:1e5));this.chunkBudget-=Date.now()-n,(d||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:wi.setState.of(new pd(i.context))})),this.chunkBudget>0&&!(d&&!c)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>_s(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),xo=He.define({combine(t){return t.length?t[0]:null},enables:t=>[wi.state,iX,qe.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class eE{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const aX=He.define(),u0=He.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function kc(t){let e=t.facet(u0);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Nf(t,e){let n="",r=t.tabSize,s=t.facet(u0)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i=e?lX(t,n,e):null}class Nx{constructor(e,n={}){this.state=e,this.options=n,this.unit=kc(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==e?{text:"",from:e}:(n<0?s-1&&(i+=l-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return Td(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let l=i(s);if(l>-1)return l}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Cx=new Et;function lX(t,e,n){let r=e.resolveStack(n),s=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let l=s;l&&!(l.fromr.node.to||l.from==r.node.from&&l.type==r.node.type);l=l.parent)i.push(l);for(let l=i.length-1;l>=0;l--)r={node:i[l],next:r}}return tE(r,t,n)}function tE(t,e,n){for(let r=t;r;r=r.next){let s=cX(r.node);if(s)return s(qw.create(e,n,r))}return 0}function oX(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function cX(t){let e=t.type.prop(Cx);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Et.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return l=>nE(l,!0,1,void 0,i&&!oX(l)?s.from:void 0)}return t.parent==null?uX:null}function uX(){return 0}class qw extends Nx{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new qw(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(dX(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return tE(this.context.next,this.base,this.pos)}}function dX(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function hX(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let s=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),l=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let c=n.to;;){let d=e.childAfter(c);if(!d||d==r)return null;if(!d.type.isSkipped){if(d.from>=l)return null;let h=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+h}}c=d.to}}function Hy({closing:t,align:e=!0,units:n=1}){return r=>nE(r,e,n,t)}function nE(t,e,n,r,s){let i=t.textAfter,l=i.match(/^\s*/)[0].length,c=r&&i.slice(l,l+r.length)==r||s==t.pos+l,d=e?hX(t):null;return d?c?t.column(d.from):t.column(d.to):t.baseIndent+(c?0:t.unit*n)}function a7({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const fX=200;function mX(){return Vt.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,s=n.lineAt(r);if(r>s.from+fX)return t;let i=n.sliceString(s.from,r);if(!e.some(h=>h.test(i)))return t;let{state:l}=t,c=-1,d=[];for(let{head:h}of l.selection.ranges){let m=l.doc.lineAt(h);if(m.from==c)continue;c=m.from;let p=Iw(l,m.from);if(p==null)continue;let x=/^\s*/.exec(m.text)[0],v=Nf(l,p);x!=v&&d.push({from:m.from,to:m.from+x.length,insert:v})}return d.length?[t,{changes:d,sequential:!0}]:t})}const pX=He.define(),Fw=new Et;function rE(t){let e=t.firstChild,n=t.lastChild;return e&&e.ton)continue;if(i&&c.from=e&&h.to>n&&(i=h)}}return i}function xX(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function _g(t,e,n){for(let r of t.facet(pX)){let s=r(t,e,n);if(s)return s}return gX(t,e,n)}function sE(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const Tx=vt.define({map:sE}),d0=vt.define({map:sE});function iE(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const Oc=Br.define({create(){return Je.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=l7(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(Tx)&&!vX(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(oE),s=r?Je.replace({widget:new jX(r(e.state,n.value))}):o7;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(d0)&&(t=t.update({filter:(r,s)=>n.value.from!=r||n.value.to!=s,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=l7(t,e.selection.main.head)),t},provide:t=>qe.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,s)=>{n.push(r,s)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n{se&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(s,i)=>s>=n||i<=e}):t}function Dg(t,e,n){var r;let s=null;return(r=t.field(Oc,!1))===null||r===void 0||r.between(e,n,(i,l)=>{(!s||s.from>i)&&(s={from:i,to:l})}),s}function vX(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function aE(t,e){return t.field(Oc,!1)?e:e.concat(vt.appendConfig.of(cE()))}const yX=t=>{for(let e of iE(t)){let n=_g(t.state,e.from,e.to);if(n)return t.dispatch({effects:aE(t.state,[Tx.of(n),lE(t,n)])}),!0}return!1},bX=t=>{if(!t.state.field(Oc,!1))return!1;let e=[];for(let n of iE(t)){let r=Dg(t.state,n.from,n.to);r&&e.push(d0.of(r),lE(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function lE(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return qe.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const wX=t=>{let{state:e}=t,n=[];for(let r=0;r{let e=t.state.field(Oc,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(d0.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},kX=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:yX},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:bX},{key:"Ctrl-Alt-[",run:wX},{key:"Ctrl-Alt-]",run:SX}],OX={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},oE=He.define({combine(t){return Oa(t,OX)}});function cE(t){return[Oc,TX]}function uE(t,e){let{state:n}=t,r=n.facet(oE),s=l=>{let c=t.lineBlockAt(t.posAtDOM(l.target)),d=Dg(t.state,c.from,c.to);d&&t.dispatch({effects:d0.of(d)}),l.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,s,e);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const o7=Je.replace({widget:new class extends ja{toDOM(t){return uE(t,null)}}});class jX extends ja{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return uE(e,this.value)}}const NX={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Uy extends gl{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function CX(t={}){let e={...NX,...t},n=new Uy(e,!0),r=new Uy(e,!1),s=lr.fromClass(class{constructor(l){this.from=l.viewport.from,this.markers=this.buildMarkers(l)}update(l){(l.docChanged||l.viewportChanged||l.startState.facet(xo)!=l.state.facet(xo)||l.startState.field(Oc,!1)!=l.state.field(Oc,!1)||zr(l.startState)!=zr(l.state)||e.foldingChanged(l))&&(this.markers=this.buildMarkers(l.view))}buildMarkers(l){let c=new ml;for(let d of l.viewportLineBlocks){let h=Dg(l.state,d.from,d.to)?r:_g(l.state,d.from,d.to)?n:null;h&&c.add(d.from,d.from,h)}return c.finish()}}),{domEventHandlers:i}=e;return[s,MG({class:"cm-foldGutter",markers(l){var c;return((c=l.plugin(s))===null||c===void 0?void 0:c.markers)||Yt.empty},initialSpacer(){return new Uy(e,!1)},domEventHandlers:{...i,click:(l,c,d)=>{if(i.click&&i.click(l,c,d))return!0;let h=Dg(l.state,c.from,c.to);if(h)return l.dispatch({effects:d0.of(h)}),!0;let m=_g(l.state,c.from,c.to);return m?(l.dispatch({effects:Tx.of(m)}),!0):!1}}}),cE()]}const TX=qe.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class h0{constructor(e,n){this.specs=e;let r;function s(c){let d=fo.newName();return(r||(r=Object.create(null)))["."+d]=c,d}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,l=n.scope;this.scope=l instanceof wi?c=>c.prop(oc)==l.data:l?c=>c==l:void 0,this.style=KM(e.map(c=>({tag:c.tag,class:c.class||s(Object.assign({},c,{tag:null}))})),{all:i}).style,this.module=r?new fo(r):null,this.themeType=n.themeType}static define(e,n){return new h0(e,n||{})}}const J2=He.define(),dE=He.define({combine(t){return t.length?[t[0]]:null}});function Vy(t){let e=t.facet(J2);return e.length?e:t.facet(dE)}function hE(t,e){let n=[MX],r;return t instanceof h0&&(t.module&&n.push(qe.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(dE.of(t)):r?n.push(J2.computeN([qe.darkTheme],s=>s.facet(qe.darkTheme)==(r=="dark")?[t]:[])):n.push(J2.of(t)),n}class AX{constructor(e){this.markCache=Object.create(null),this.tree=zr(e.state),this.decorations=this.buildDeco(e,Vy(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=zr(e.state),r=Vy(e.state),s=r!=Vy(e.startState),{viewport:i}=e.view,l=e.changes.mapPos(this.decoratedTo,1);n.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=l):(n!=this.tree||e.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return Je.none;let r=new ml;for(let{from:s,to:i}of e.visibleRanges)eX(this.tree,n,(l,c,d)=>{r.add(l,c,this.markCache[d]||(this.markCache[d]=Je.mark({class:d})))},s,i);return r.finish()}}const MX=No.high(lr.fromClass(AX,{decorations:t=>t.decorations})),EX=h0.define([{tag:he.meta,color:"#404740"},{tag:he.link,textDecoration:"underline"},{tag:he.heading,textDecoration:"underline",fontWeight:"bold"},{tag:he.emphasis,fontStyle:"italic"},{tag:he.strong,fontWeight:"bold"},{tag:he.strikethrough,textDecoration:"line-through"},{tag:he.keyword,color:"#708"},{tag:[he.atom,he.bool,he.url,he.contentSeparator,he.labelName],color:"#219"},{tag:[he.literal,he.inserted],color:"#164"},{tag:[he.string,he.deleted],color:"#a11"},{tag:[he.regexp,he.escape,he.special(he.string)],color:"#e40"},{tag:he.definition(he.variableName),color:"#00f"},{tag:he.local(he.variableName),color:"#30a"},{tag:[he.typeName,he.namespace],color:"#085"},{tag:he.className,color:"#167"},{tag:[he.special(he.variableName),he.macroName],color:"#256"},{tag:he.definition(he.propertyName),color:"#00c"},{tag:he.comment,color:"#940"},{tag:he.invalid,color:"#f00"}]),_X=qe.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),fE=1e4,mE="()[]{}",pE=He.define({combine(t){return Oa(t,{afterCursor:!0,brackets:mE,maxScanDistance:fE,renderMatch:zX})}}),DX=Je.mark({class:"cm-matchingBracket"}),RX=Je.mark({class:"cm-nonmatchingBracket"});function zX(t){let e=[],n=t.matched?DX:RX;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const PX=Br.define({create(){return Je.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(pE);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=fa(e.state,s.head,-1,r)||s.head>0&&fa(e.state,s.head-1,1,r)||r.afterCursor&&(fa(e.state,s.head,1,r)||s.headqe.decorations.from(t)}),BX=[PX,_X];function LX(t={}){return[pE.of(t),BX]}const IX=new Et;function e4(t,e,n){let r=t.prop(e<0?Et.openedBy:Et.closedBy);if(r)return r;if(t.name.length==1){let s=n.indexOf(t.name);if(s>-1&&s%2==(e<0?1:0))return[n[s+e]]}return null}function t4(t){let e=t.type.prop(IX);return e?e(t.node):t}function fa(t,e,n,r={}){let s=r.maxScanDistance||fE,i=r.brackets||mE,l=zr(t),c=l.resolveInner(e,n);for(let d=c;d;d=d.parent){let h=e4(d.type,n,i);if(h&&d.from0?e>=m.from&&em.from&&e<=m.to))return qX(t,e,n,d,m,h,i)}}return FX(t,e,n,l,c.type,s,i)}function qX(t,e,n,r,s,i,l){let c=r.parent,d={from:s.from,to:s.to},h=0,m=c?.cursor();if(m&&(n<0?m.childBefore(r.from):m.childAfter(r.to)))do if(n<0?m.to<=r.from:m.from>=r.to){if(h==0&&i.indexOf(m.type.name)>-1&&m.from0)return null;let h={from:n<0?e-1:e,to:n>0?e+1:e},m=t.doc.iterRange(e,n>0?t.doc.length:0),p=0;for(let x=0;!m.next().done&&x<=i;){let v=m.value;n<0&&(x+=v.length);let b=e+x*n;for(let k=n>0?0:v.length-1,O=n>0?v.length:-1;k!=O;k+=n){let j=l.indexOf(v[k]);if(!(j<0||r.resolveInner(b+k,1).type!=s))if(j%2==0==n>0)p++;else{if(p==1)return{start:h,end:{from:b+k,to:b+k+1},matched:j>>1==d>>1};p--}}n>0&&(x+=v.length)}return m.done?{start:h,matched:!1}:null}function c7(t,e,n,r=0,s=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let i=s;for(let l=r;l=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosr?l.toLowerCase():l,i=this.string.substr(this.pos,e.length);return s(i)==s(e)?(n!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&n!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function QX(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||$X,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||Hw,mergeTokens:t.mergeTokens!==!1}}function $X(t){if(typeof t!="object")return t;let e={};for(let n in t){let r=t[n];e[n]=r instanceof Array?r.slice():r}return e}const u7=new WeakMap;class Qw extends wi{constructor(e){let n=ZM(e.languageData),r=QX(e),s,i=new class extends Bw{createParse(l,c,d){return new UX(s,l,c,d)}};super(n,i,[],e.name),this.topNode=GX(n,this),s=this,this.streamParser=r,this.stateAfter=new Et({perNode:!0}),this.tokenTable=e.tokenTable?new bE(r.tokenTable):WX}static define(e){return new Qw(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=u7.get(e.state),n!=null&&n1e4)return null;for(;i=r&&n+e.length<=s&&e.prop(t.stateAfter);if(i)return{state:t.streamParser.copyState(i),pos:n+e.length};for(let l=e.children.length-1;l>=0;l--){let c=e.children[l],d=n+e.positions[l],h=c instanceof Dn&&d=e.length)return e;!s&&n==0&&e.type==t.topNode&&(s=!0);for(let i=e.children.length-1;i>=0;i--){let l=e.positions[i],c=e.children[i],d;if(ln&&$w(t,i.tree,0-i.offset,n,c),h;if(d&&d.pos<=r&&(h=xE(t,i.tree,n+i.offset,d.pos+i.offset,!1)))return{state:d.state,tree:h}}return{state:t.streamParser.startState(s?kc(s):4),tree:Dn.empty}}let UX=class{constructor(e,n,r,s){this.lang=e,this.input=n,this.fragments=r,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let i=md.get(),l=s[0].from,{state:c,tree:d}=HX(e,r,l,this.to,i?.state);this.state=c,this.parsedPos=this.chunkStart=l+d.length;for(let h=0;hh.from<=i.viewport.from&&h.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(kc(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=md.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos=n?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let n=this.input.chunk(e);if(this.input.lineChunks)n==` `&&(n="");else{let r=n.indexOf(` `);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let s=this.rangeIndex;;){let i=this.ranges[s].to;if(i>=r||(n=n.slice(0,i-(r-n.length)),s++,s==this.ranges.length))break;let l=this.ranges[s].from,c=this.lineAfter(l);n+=c,r=l+c.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let s=this.ranges[this.rangeIndex].to,i=e+n;if(r>0?s>i:s>=i)break;let l=this.ranges[++this.rangeIndex].from;n+=l-s}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){s=this.skipGapsTo(n,s,1),n+=s;let c=this.chunk.length;s=this.skipGapsTo(r,s,-1),r+=s,i+=this.chunk.length-c}let l=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&l>=0&&this.chunk[l]==e&&this.chunk[l+2]==n?this.chunk[l+2]=r:this.chunk.push(e,n,r,i),s}parseLine(e){let{line:n,end:r}=this.nextLine(),s=0,{streamParser:i}=this.lang,l=new gE(n,e?e.state.tabSize:4,e?kc(e.state):2);if(l.eol())i.blankLine(this.state,l.indentUnit);else for(;!l.eol();){let c=vE(i.token,l,this.state);if(c&&(s=this.emitToken(this.lang.tokenTable.resolve(c),this.parsedPos+l.start,this.parsedPos+l.pos,s)),l.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const Hw=Object.create(null),Cf=[gs.none],VX=new jx(Cf),d7=[],h7=Object.create(null),yE=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])yE[t]=wE(Hw,e);class bE{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),yE)}resolve(e){return e?this.table[e]||(this.table[e]=wE(this.extra,e)):0}}const WX=new bE(Hw);function Wy(t,e){d7.indexOf(t)>-1||(d7.push(t),console.warn(e))}function wE(t,e){let n=[];for(let c of e.split(" ")){let d=[];for(let h of c.split(".")){let m=t[h]||he[h];m?typeof m=="function"?d.length?d=d.map(m):Wy(h,`Modifier ${h} used at start of tag`):d.length?Wy(h,`Tag ${h} used as modifier`):d=Array.isArray(m)?m:[m]:Wy(h,`Unknown highlighting tag ${h}`)}for(let h of d)n.push(h)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(c=>c.id),i=h7[s];if(i)return i.id;let l=h7[s]=gs.define({id:Cf.length,name:r,props:[Lw({[r]:n})]});return Cf.push(l),l.id}function GX(t,e){let n=gs.define({id:Cf.length,name:"Document",props:[oc.add(()=>t),Cx.add(()=>r=>e.getIndent(r))],top:!0});return Cf.push(n),n}Hn.RTL,Hn.LTR;const XX=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Vw(t.state,n.from);return r.line?YX(t):r.block?ZX(t):!1};function Uw(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=t(e,n);return s?(r(n.update(s)),!0):!1}}const YX=Uw(tY,0),KX=Uw(SE,0),ZX=Uw((t,e)=>SE(t,e,eY(e)),0);function Vw(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Ph=50;function JX(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-Ph,r),l=t.sliceDoc(s,s+Ph),c=/\s*$/.exec(i)[0].length,d=/^\s*/.exec(l)[0].length,h=i.length-c;if(i.slice(h-e.length,h)==e&&l.slice(d,d+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:s+d,margin:d&&1}};let m,p;s-r<=2*Ph?m=p=t.sliceDoc(r,s):(m=t.sliceDoc(r,r+Ph),p=t.sliceDoc(s-Ph,s));let x=/^\s*/.exec(m)[0].length,v=/\s*$/.exec(p)[0].length,b=p.length-v-n.length;return m.slice(x,x+e.length)==e&&p.slice(b,b+n.length)==n?{open:{pos:r+x+e.length,margin:/\s/.test(m.charAt(x+e.length))?1:0},close:{pos:s-v-n.length,margin:/\s/.test(p.charAt(b-1))?1:0}}:null}function eY(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),s=n.to<=r.to?r:t.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>r.from?e[i].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function SE(t,e,n=e.selection.ranges){let r=n.map(i=>Vw(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,l)=>JX(e,r[l],i.from,i.to));if(t!=2&&!s.every(i=>i))return{changes:e.changes(n.map((i,l)=>s[l]?[]:[{from:i.from,insert:r[l].open+" "},{from:i.to,insert:" "+r[l].close}]))};if(t!=1&&s.some(i=>i)){let i=[];for(let l=0,c;ls&&(i==l||l>p.from)){s=p.from;let x=/^\s*/.exec(p.text)[0].length,v=x==p.length,b=p.text.slice(x,x+h.length)==h?x:-1;xi.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:c,token:d,indent:h,empty:m,single:p}of r)(p||!m)&&i.push({from:c.from+h,insert:d+" "});let l=e.changes(i);return{changes:l,selection:e.selection.map(l,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:l,comment:c,token:d}of r)if(c>=0){let h=l.from+c,m=h+d.length;l.text[m-l.from]==" "&&m++,i.push({from:h,to:m})}return{changes:i}}return null}const n4=ka.define(),nY=ka.define(),rY=He.define(),kE=He.define({combine(t){return Oa(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,s)=>e(r,s)||n(r,s)})}}),OE=Br.define({create(){return ma.empty},update(t,e){let n=e.state.facet(kE),r=e.annotation(n4);if(r){let d=Ds.fromTransaction(e,r.selection),h=r.side,m=h==0?t.undone:t.done;return d?m=Rg(m,m.length,n.minDepth,d):m=CE(m,e.startState.selection),new ma(h==0?r.rest:m,h==0?m:r.rest)}let s=e.annotation(nY);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(gr.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=Ds.fromTransaction(e),l=e.annotation(gr.time),c=e.annotation(gr.userEvent);return i?t=t.addChanges(i,l,c,n,e):e.selection&&(t=t.addSelection(e.startState.selection,l,c,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new ma(t.done.map(Ds.fromJSON),t.undone.map(Ds.fromJSON))}});function sY(t={}){return[OE,kE.of(t),qe.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?jE:e.inputType=="historyRedo"?r4:null;return r?(e.preventDefault(),r(n)):!1}})]}function Ax(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(OE,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const jE=Ax(0,!1),r4=Ax(1,!1),iY=Ax(0,!0),aY=Ax(1,!0);class Ds{constructor(e,n,r,s,i){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(e){return new Ds(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new Ds(e.changes&&kr.fromJSON(e.changes),[],e.mapped&&va.fromJSON(e.mapped),e.startSelection&&Ce.fromJSON(e.startSelection),e.selectionsAfter.map(Ce.fromJSON))}static fromTransaction(e,n){let r=Si;for(let s of e.startState.facet(rY)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new Ds(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,Si)}static selection(e){return new Ds(void 0,Si,void 0,void 0,e)}}function Rg(t,e,n,r){let s=e+1>n+20?e-n-1:0,i=t.slice(s,e);return i.push(r),i}function lY(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,l,c)=>{for(let d=0;d=h&&l<=m&&(r=!0)}}),r}function oY(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function NE(t,e){return t.length?e.length?t.concat(e):t:e}const Si=[],cY=200;function CE(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-cY));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Rg(t,t.length-1,1e9,n.setSelAfter(r)))}else return[Ds.selection([e])]}function uY(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Gy(t,e){if(!t.length)return t;let n=t.length,r=Si;for(;n;){let s=dY(t[n-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=t.slice(0,n);return i[n-1]=s,i}else e=s.mapped,n--,r=s.selectionsAfter}return r.length?[Ds.selection(r)]:Si}function dY(t,e,n){let r=NE(t.selectionsAfter.length?t.selectionsAfter.map(c=>c.map(e)):Si,n);if(!t.changes)return Ds.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),l=t.mapped?t.mapped.composeDesc(i):i;return new Ds(s,vt.mapEffects(t.effects,e),l,t.startSelection.map(i),r)}const hY=/^(input\.type|delete)($|\.)/;class ma{constructor(e,n,r=0,s=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new ma(this.done,this.undone):this}addChanges(e,n,r,s,i){let l=this.done,c=l[l.length-1];return c&&c.changes&&!c.changes.empty&&e.changes&&(!r||hY.test(r))&&(!c.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):Mx(n,e))}function is(t){return t.textDirectionAt(t.state.selection.main.head)==Hn.LTR}const AE=t=>TE(t,!is(t)),ME=t=>TE(t,is(t));function EE(t,e){return Xi(t,n=>n.empty?t.moveByGroup(n,e):Mx(n,e))}const mY=t=>EE(t,!is(t)),pY=t=>EE(t,is(t));function gY(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Ex(t,e,n){let r=zr(t).resolveInner(e.head),s=n?Et.closedBy:Et.openedBy;for(let d=e.head;;){let h=n?r.childAfter(d):r.childBefore(d);if(!h)break;gY(t,h,s)?r=h:d=n?h.to:h.from}let i=r.type.prop(s),l,c;return i&&(l=n?fa(t,r.from,1):fa(t,r.to,-1))&&l.matched?c=n?l.end.to:l.end.from:c=n?r.to:r.from,Ce.cursor(c,n?-1:1)}const xY=t=>Xi(t,e=>Ex(t.state,e,!is(t))),vY=t=>Xi(t,e=>Ex(t.state,e,is(t)));function _E(t,e){return Xi(t,n=>{if(!n.empty)return Mx(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const DE=t=>_E(t,!1),RE=t=>_E(t,!0);function zE(t){let e=t.scrollDOM.clientHeightl.empty?t.moveVertically(l,e,n.height):Mx(l,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let l=t.coordsAtPos(r.selection.main.head),c=t.scrollDOM.getBoundingClientRect(),d=c.top+n.marginTop,h=c.bottom-n.marginBottom;l&&l.top>d&&l.bottomPE(t,!1),s4=t=>PE(t,!0);function Co(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(s=Ce.cursor(r.from+i))}return s}const yY=t=>Xi(t,e=>Co(t,e,!0)),bY=t=>Xi(t,e=>Co(t,e,!1)),wY=t=>Xi(t,e=>Co(t,e,!is(t))),SY=t=>Xi(t,e=>Co(t,e,is(t))),kY=t=>Xi(t,e=>Ce.cursor(t.lineBlockAt(e.head).from,1)),OY=t=>Xi(t,e=>Ce.cursor(t.lineBlockAt(e.head).to,-1));function jY(t,e,n){let r=!1,s=Ad(t.selection,i=>{let l=fa(t,i.head,-1)||fa(t,i.head,1)||i.head>0&&fa(t,i.head-1,1)||i.headjY(t,e);function _i(t,e){let n=Ad(t.state.selection,r=>{let s=e(r);return Ce.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(Gi(t.state,n)),!0)}function BE(t,e){return _i(t,n=>t.moveByChar(n,e))}const LE=t=>BE(t,!is(t)),IE=t=>BE(t,is(t));function qE(t,e){return _i(t,n=>t.moveByGroup(n,e))}const CY=t=>qE(t,!is(t)),TY=t=>qE(t,is(t)),AY=t=>_i(t,e=>Ex(t.state,e,!is(t))),MY=t=>_i(t,e=>Ex(t.state,e,is(t)));function FE(t,e){return _i(t,n=>t.moveVertically(n,e))}const QE=t=>FE(t,!1),$E=t=>FE(t,!0);function HE(t,e){return _i(t,n=>t.moveVertically(n,e,zE(t).height))}const m7=t=>HE(t,!1),p7=t=>HE(t,!0),EY=t=>_i(t,e=>Co(t,e,!0)),_Y=t=>_i(t,e=>Co(t,e,!1)),DY=t=>_i(t,e=>Co(t,e,!is(t))),RY=t=>_i(t,e=>Co(t,e,is(t))),zY=t=>_i(t,e=>Ce.cursor(t.lineBlockAt(e.head).from)),PY=t=>_i(t,e=>Ce.cursor(t.lineBlockAt(e.head).to)),g7=({state:t,dispatch:e})=>(e(Gi(t,{anchor:0})),!0),x7=({state:t,dispatch:e})=>(e(Gi(t,{anchor:t.doc.length})),!0),v7=({state:t,dispatch:e})=>(e(Gi(t,{anchor:t.selection.main.anchor,head:0})),!0),y7=({state:t,dispatch:e})=>(e(Gi(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),BY=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),LY=({state:t,dispatch:e})=>{let n=_x(t).map(({from:r,to:s})=>Ce.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Ce.create(n),userEvent:"select"})),!0},IY=({state:t,dispatch:e})=>{let n=Ad(t.selection,r=>{let s=zr(t),i=s.resolveStack(r.from,1);if(r.empty){let l=s.resolveStack(r.from,-1);l.node.from>=i.node.from&&l.node.to<=i.node.to&&(i=l)}for(let l=i;l;l=l.next){let{node:c}=l;if((c.from=r.to||c.to>r.to&&c.from<=r.from)&&l.next)return Ce.range(c.to,c.from)}return r});return n.eq(t.selection)?!1:(e(Gi(t,n)),!0)};function UE(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let l=n.doc.lineAt(i.head);if(e?l.to0)for(let c=i;;){let d=t.moveVertically(c,e);if(d.headl.to){s.some(h=>h.head==d.head)||s.push(d);break}else{if(d.head==c.head)break;c=d}}}return s.length==r.ranges.length?!1:(t.dispatch(Gi(n,Ce.create(s,s.length-1))),!0)}const qY=t=>UE(t,!1),FY=t=>UE(t,!0),QY=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Ce.create([n.main]):n.main.empty||(r=Ce.create([Ce.cursor(n.main.head)])),r?(e(Gi(t,r)),!0):!1};function f0(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:l,to:c}=i;if(l==c){let d=e(i);dl&&(n="delete.forward",d=xp(t,d,!0)),l=Math.min(l,d),c=Math.max(c,d)}else l=xp(t,l,!1),c=xp(t,c,!0);return l==c?{range:i}:{changes:{from:l,to:c},range:Ce.cursor(l,ls(t)))r.between(e,e,(s,i)=>{se&&(e=n?i:s)});return e}const VE=(t,e,n)=>f0(t,r=>{let s=r.from,{state:i}=t,l=i.doc.lineAt(s),c,d;if(n&&!e&&s>l.from&&sVE(t,!1,!0),WE=t=>VE(t,!0,!1),GE=(t,e)=>f0(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),l=s.charCategorizer(r);for(let c=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let d=Vr(i.text,r-i.from,e)+i.from,h=i.text.slice(Math.min(r,d)-i.from,Math.max(r,d)-i.from),m=l(h);if(c!=null&&m!=c)break;(h!=" "||r!=n.head)&&(c=m),r=d}return r}),XE=t=>GE(t,!1),$Y=t=>GE(t,!0),HY=t=>f0(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headf0(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),VY=t=>f0(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Xt.of(["",""])},range:Ce.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},GY=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,i=t.doc.lineAt(s),l=s==i.from?s-1:Vr(i.text,s-i.from,!1)+i.from,c=s==i.to?s+1:Vr(i.text,s-i.from,!0)+i.from;return{changes:{from:l,to:c,insert:t.doc.slice(s,c).append(t.doc.slice(l,s))},range:Ce.cursor(c)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function _x(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=s.number){let l=e[e.length-1];l.to=i.to,l.ranges.push(r)}else e.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return e}function YE(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of _x(t)){if(n?i.to==t.doc.length:i.from==0)continue;let l=t.doc.lineAt(n?i.to+1:i.from-1),c=l.length+1;if(n){r.push({from:i.to,to:l.to},{from:i.from,insert:l.text+t.lineBreak});for(let d of i.ranges)s.push(Ce.range(Math.min(t.doc.length,d.anchor+c),Math.min(t.doc.length,d.head+c)))}else{r.push({from:l.from,to:i.from},{from:i.to,insert:t.lineBreak+l.text});for(let d of i.ranges)s.push(Ce.range(d.anchor-c,d.head-c))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Ce.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const XY=({state:t,dispatch:e})=>YE(t,e,!1),YY=({state:t,dispatch:e})=>YE(t,e,!0);function KE(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of _x(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const KY=({state:t,dispatch:e})=>KE(t,e,!1),ZY=({state:t,dispatch:e})=>KE(t,e,!0),JY=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(_x(e).map(({from:s,to:i})=>(s>0?s--:i{let i;if(t.lineWrapping){let l=t.lineBlockAt(s.head),c=t.coordsAtPos(s.head,s.assoc||1);c&&(i=l.bottom+t.documentTop-c.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function eK(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=zr(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e),i;return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(Et.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const b7=ZE(!1),tK=ZE(!0);function ZE(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:l}=s,c=e.doc.lineAt(i),d=!t&&i==l&&eK(e,i);t&&(i=l=(l<=c.to?c:e.doc.lineAt(l)).to);let h=new Nx(e,{simulateBreak:i,simulateDoubleBreak:!!d}),m=Iw(h,i);for(m==null&&(m=Td(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));lc.from&&i{let s=[];for(let l=r.from;l<=r.to;){let c=t.doc.lineAt(l);c.number>n&&(r.empty||r.to>c.from)&&(e(c,s,r),n=c.number),l=c.to+1}let i=t.changes(s);return{changes:s,range:Ce.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const nK=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Nx(t,{overrideIndentation:i=>{let l=n[i];return l??-1}}),s=Ww(t,(i,l,c)=>{let d=Iw(r,i.from);if(d==null)return;/\S/.test(i.text)||(d=0);let h=/^\s*/.exec(i.text)[0],m=Nf(t,d);(h!=m||c.fromt.readOnly?!1:(e(t.update(Ww(t,(n,r)=>{r.push({from:n.from,insert:t.facet(u0)})}),{userEvent:"input.indent"})),!0),e_=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Ww(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Td(s,t.tabSize),l=0,c=Nf(t,Math.max(0,i-kc(t)));for(;l(t.setTabFocusMode(),!0),sK=[{key:"Ctrl-b",run:AE,shift:LE,preventDefault:!0},{key:"Ctrl-f",run:ME,shift:IE},{key:"Ctrl-p",run:DE,shift:QE},{key:"Ctrl-n",run:RE,shift:$E},{key:"Ctrl-a",run:kY,shift:zY},{key:"Ctrl-e",run:OY,shift:PY},{key:"Ctrl-d",run:WE},{key:"Ctrl-h",run:i4},{key:"Ctrl-k",run:HY},{key:"Ctrl-Alt-h",run:XE},{key:"Ctrl-o",run:WY},{key:"Ctrl-t",run:GY},{key:"Ctrl-v",run:s4}],iK=[{key:"ArrowLeft",run:AE,shift:LE,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:mY,shift:CY,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:wY,shift:DY,preventDefault:!0},{key:"ArrowRight",run:ME,shift:IE,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:pY,shift:TY,preventDefault:!0},{mac:"Cmd-ArrowRight",run:SY,shift:RY,preventDefault:!0},{key:"ArrowUp",run:DE,shift:QE,preventDefault:!0},{mac:"Cmd-ArrowUp",run:g7,shift:v7},{mac:"Ctrl-ArrowUp",run:f7,shift:m7},{key:"ArrowDown",run:RE,shift:$E,preventDefault:!0},{mac:"Cmd-ArrowDown",run:x7,shift:y7},{mac:"Ctrl-ArrowDown",run:s4,shift:p7},{key:"PageUp",run:f7,shift:m7},{key:"PageDown",run:s4,shift:p7},{key:"Home",run:bY,shift:_Y,preventDefault:!0},{key:"Mod-Home",run:g7,shift:v7},{key:"End",run:yY,shift:EY,preventDefault:!0},{key:"Mod-End",run:x7,shift:y7},{key:"Enter",run:b7,shift:b7},{key:"Mod-a",run:BY},{key:"Backspace",run:i4,shift:i4,preventDefault:!0},{key:"Delete",run:WE,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:XE,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:$Y,preventDefault:!0},{mac:"Mod-Backspace",run:UY,preventDefault:!0},{mac:"Mod-Delete",run:VY,preventDefault:!0}].concat(sK.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),aK=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:xY,shift:AY},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:vY,shift:MY},{key:"Alt-ArrowUp",run:XY},{key:"Shift-Alt-ArrowUp",run:KY},{key:"Alt-ArrowDown",run:YY},{key:"Shift-Alt-ArrowDown",run:ZY},{key:"Mod-Alt-ArrowUp",run:qY},{key:"Mod-Alt-ArrowDown",run:FY},{key:"Escape",run:QY},{key:"Mod-Enter",run:tK},{key:"Alt-l",mac:"Ctrl-l",run:LY},{key:"Mod-i",run:IY,preventDefault:!0},{key:"Mod-[",run:e_},{key:"Mod-]",run:JE},{key:"Mod-Alt-\\",run:nK},{key:"Shift-Mod-k",run:JY},{key:"Shift-Mod-\\",run:NY},{key:"Mod-/",run:XX},{key:"Alt-A",run:KX},{key:"Ctrl-m",mac:"Shift-Alt-m",run:rK}].concat(iK),lK={key:"Tab",run:JE,shift:e_},w7=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class gd{constructor(e,n,r=0,s=e.length,i,l){this.test=l,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=i?c=>i(w7(c)):w7,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return As(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=yw(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=oa(e);let s=this.normalize(n);if(s.length)for(let i=0,l=r;;i++){let c=s.charCodeAt(i),d=this.match(c,l,this.bufferPos+this.bufferStart);if(i==s.length-1){if(d)return this.value=d,this;break}l==r&&ithis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=zg(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||s.to<=n){let c=new Yu(n,e.sliceString(n,r));return Xy.set(e,c),c}if(s.from==n&&s.to==r)return s;let{text:i,from:l}=s;return l>n&&(i=e.sliceString(n,l)+i,l=n),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=zg(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Yu.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(n_.prototype[Symbol.iterator]=r_.prototype[Symbol.iterator]=function(){return this});function oK(t){try{return new RegExp(t,Gw),!0}catch{return!1}}function zg(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function a4(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=Mn("input",{class:"cm-textfield",name:"line",value:e}),r=Mn("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),t.dispatch({effects:sf.of(!1)}),t.focus()):i.keyCode==13&&(i.preventDefault(),s())},onsubmit:i=>{i.preventDefault(),s()}},Mn("label",t.state.phrase("Go to line"),": ",n)," ",Mn("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),Mn("button",{name:"close",onclick:()=>{t.dispatch({effects:sf.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function s(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!i)return;let{state:l}=t,c=l.doc.lineAt(l.selection.main.head),[,d,h,m,p]=i,x=m?+m.slice(1):0,v=h?+h:c.number;if(h&&p){let O=v/100;d&&(O=O*(d=="-"?-1:1)+c.number/l.doc.lines),v=Math.round(l.doc.lines*O)}else h&&d&&(v=v*(d=="-"?-1:1)+c.number);let b=l.doc.line(Math.max(1,Math.min(l.doc.lines,v))),k=Ce.cursor(b.from+Math.max(0,Math.min(x,b.length)));t.dispatch({effects:[sf.of(!1),qe.scrollIntoView(k.from,{y:"center"})],selection:k}),t.focus()}return{dom:r}}const sf=vt.define(),S7=Br.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(sf)&&(t=n.value);return t},provide:t=>Sf.from(t,e=>e?a4:null)}),cK=t=>{let e=wf(t,a4);if(!e){let n=[sf.of(!0)];t.state.field(S7,!1)==null&&n.push(vt.appendConfig.of([S7,uK])),t.dispatch({effects:n}),e=wf(t,a4)}return e&&e.dom.querySelector("input").select(),!0},uK=qe.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),dK={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},hK=He.define({combine(t){return Oa(t,dK,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function fK(t){return[vK,xK]}const mK=Je.mark({class:"cm-selectionMatch"}),pK=Je.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function k7(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Vn.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Vn.Word)}function gK(t,e,n,r){return t(e.sliceDoc(n,n+1))==Vn.Word&&t(e.sliceDoc(r-1,r))==Vn.Word}const xK=lr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(hK),{state:n}=t,r=n.selection;if(r.ranges.length>1)return Je.none;let s=r.main,i,l=null;if(s.empty){if(!e.highlightWordAroundCursor)return Je.none;let d=n.wordAt(s.head);if(!d)return Je.none;l=n.charCategorizer(s.head),i=n.sliceDoc(d.from,d.to)}else{let d=s.to-s.from;if(d200)return Je.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),l=n.charCategorizer(s.head),!(k7(l,n,s.from,s.to)&&gK(l,n,s.from,s.to)))return Je.none}else if(i=n.sliceDoc(s.from,s.to),!i)return Je.none}let c=[];for(let d of t.visibleRanges){let h=new gd(n.doc,i,d.from,d.to);for(;!h.next().done;){let{from:m,to:p}=h.value;if((!l||k7(l,n,m,p))&&(s.empty&&m<=s.from&&p>=s.to?c.push(pK.range(m,p)):(m>=s.to||p<=s.from)&&c.push(mK.range(m,p)),c.length>e.maxMatches))return Je.none}}return Je.set(c)}},{decorations:t=>t.decorations}),vK=qe.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),yK=({state:t,dispatch:e})=>{let{selection:n}=t,r=Ce.create(n.ranges.map(s=>t.wordAt(s.head)||Ce.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function bK(t,e){let{main:n,ranges:r}=t.selection,s=t.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let l=!1,c=new gd(t.doc,e,r[r.length-1].to);;)if(c.next(),c.done){if(l)return null;c=new gd(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),l=!0}else{if(l&&r.some(d=>d.from==c.value.from))continue;if(i){let d=t.wordAt(c.value.from);if(!d||d.from!=c.value.from||d.to!=c.value.to)continue}return c.value}}const wK=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return yK({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=r))return!1;let s=bK(t,r);return s?(e(t.update({selection:t.selection.addRange(Ce.range(s.from,s.to),!1),effects:qe.scrollIntoView(s.to)})),!0):!1},Md=He.define({combine(t){return Oa(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new DK(e),scrollToMatch:e=>qe.scrollIntoView(e)})}});class s_{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||oK(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?` -`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new jK(this):new kK(this)}getCursor(e,n=0,r){let s=e.doc?e:Vt.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?zu(this,s,n,r):Ru(this,s,n,r)}}class i_{constructor(e){this.spec=e}}function Ru(t,e,n,r){return new gd(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?SK(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function SK(t,e){return(n,r,s,i)=>((i>n||i+s.length=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=Ru(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}function zu(t,e,n,r){return new n_(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?OK(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function Pg(t,e){return t.slice(Vr(t,e,!1),e)}function Bg(t,e){return t.slice(e,Vr(t,e))}function OK(t){return(e,n,r)=>!r[0].length||(t(Pg(r.input,r.index))!=Vn.Word||t(Bg(r.input,r.index))!=Vn.Word)&&(t(Bg(r.input,r.index+r[0].length))!=Vn.Word||t(Pg(r.input,r.index+r[0].length))!=Vn.Word)}class jK extends i_{nextMatch(e,n,r){let s=zu(this.spec,e,r,e.doc.length).next();return s.done&&(s=zu(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),l=zu(this.spec,e,i,r),c=null;for(;!l.next().done;)c=l.value;if(c&&(i==n||c.from>i+10))return c;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=zu(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}const Tf=vt.define(),Xw=vt.define(),lo=Br.define({create(t){return new Yy(l4(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Tf)?t=new Yy(n.value.create(),t.panel):n.is(Xw)&&(t=new Yy(t.query,n.value?Yw:null));return t},provide:t=>Sf.from(t,e=>e.panel)});class Yy{constructor(e,n){this.query=e,this.panel=n}}const NK=Je.mark({class:"cm-searchMatch"}),CK=Je.mark({class:"cm-searchMatch cm-searchMatch-selected"}),TK=lr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(lo))}update(t){let e=t.state.field(lo);(e!=t.startState.field(lo)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return Je.none;let{view:n}=this,r=new ml;for(let s=0,i=n.visibleRanges,l=i.length;si[s+1].from-500;)d=i[++s].to;t.highlight(n.state,c,d,(h,m)=>{let p=n.state.selection.ranges.some(x=>x.from==h&&x.to==m);r.add(h,m,p?CK:NK)})}return r.finish()}},{decorations:t=>t.decorations});function m0(t){return e=>{let n=e.state.field(lo,!1);return n&&n.query.spec.valid?t(e,n):o_(e)}}const Lg=m0((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=Ce.single(r.from,r.to),i=t.state.facet(Md);return t.dispatch({selection:s,effects:[Kw(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),l_(t),!0}),Ig=m0((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=Ce.single(s.from,s.to),l=t.state.facet(Md);return t.dispatch({selection:i,effects:[Kw(t,s),l.scrollToMatch(i.main,t)],userEvent:"select.search"}),l_(t),!0}),AK=m0((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Ce.create(n.map(r=>Ce.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),MK=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],l=0;for(let c=new gd(t.doc,t.sliceDoc(r,s));!c.next().done;){if(i.length>1e3)return!1;c.value.from==r&&(l=i.length),i.push(Ce.range(c.value.from,c.value.to))}return e(t.update({selection:Ce.create(i,l),userEvent:"select.search.matches"})),!0},O7=m0((t,{query:e})=>{let{state:n}=t,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,r,r);if(!i)return!1;let l=i,c=[],d,h,m=[];l.from==r&&l.to==s&&(h=n.toText(e.getReplacement(l)),c.push({from:l.from,to:l.to,insert:h}),l=e.nextMatch(n,l.from,l.to),m.push(qe.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let p=t.state.changes(c);return l&&(d=Ce.single(l.from,l.to).map(p),m.push(Kw(t,l)),m.push(n.facet(Md).scrollToMatch(d.main,t))),t.dispatch({changes:p,selection:d,effects:m,userEvent:"input.replace"}),!0}),EK=m0((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(s=>{let{from:i,to:l}=s;return{from:i,to:l,insert:e.getReplacement(s)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:qe.announce.of(r),userEvent:"input.replace.all"}),!0});function Yw(t){return t.state.facet(Md).createPanel(t)}function l4(t,e){var n,r,s,i,l;let c=t.selection.main,d=c.empty||c.to>c.from+100?"":t.sliceDoc(c.from,c.to);if(e&&!d)return e;let h=t.facet(Md);return new s_({search:((n=e?.literal)!==null&&n!==void 0?n:h.literal)?d:d.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:h.regexp,wholeWord:(l=e?.wholeWord)!==null&&l!==void 0?l:h.wholeWord})}function a_(t){let e=wf(t,Yw);return e&&e.dom.querySelector("[main-field]")}function l_(t){let e=a_(t);e&&e==t.root.activeElement&&e.select()}const o_=t=>{let e=t.state.field(lo,!1);if(e&&e.panel){let n=a_(t);if(n&&n!=t.root.activeElement){let r=l4(t.state,e.query.spec);r.valid&&t.dispatch({effects:Tf.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[Xw.of(!0),e?Tf.of(l4(t.state,e.query.spec)):vt.appendConfig.of(zK)]});return!0},c_=t=>{let e=t.state.field(lo,!1);if(!e||!e.panel)return!1;let n=wf(t,Yw);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Xw.of(!1)}),!0},_K=[{key:"Mod-f",run:o_,scope:"editor search-panel"},{key:"F3",run:Lg,shift:Ig,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Lg,shift:Ig,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:c_,scope:"editor search-panel"},{key:"Mod-Shift-l",run:MK},{key:"Mod-Alt-g",run:cK},{key:"Mod-d",run:wK,preventDefault:!0}];class DK{constructor(e){this.view=e;let n=this.query=e.state.field(lo).query.spec;this.commit=this.commit.bind(this),this.searchField=Mn("input",{value:n.search,placeholder:Ys(e,"Find"),"aria-label":Ys(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mn("input",{value:n.replace,placeholder:Ys(e,"Replace"),"aria-label":Ys(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mn("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Mn("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Mn("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,l){return Mn("button",{class:"cm-button",name:s,onclick:i,type:"button"},l)}this.dom=Mn("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>Lg(e),[Ys(e,"next")]),r("prev",()=>Ig(e),[Ys(e,"previous")]),r("select",()=>AK(e),[Ys(e,"all")]),Mn("label",null,[this.caseField,Ys(e,"match case")]),Mn("label",null,[this.reField,Ys(e,"regexp")]),Mn("label",null,[this.wordField,Ys(e,"by word")]),...e.state.readOnly?[]:[Mn("br"),this.replaceField,r("replace",()=>O7(e),[Ys(e,"replace")]),r("replaceAll",()=>EK(e),[Ys(e,"replace all")])],Mn("button",{name:"close",onclick:()=>c_(e),"aria-label":Ys(e,"close"),type:"button"},["×"])])}commit(){let e=new s_({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Tf.of(e)}))}keydown(e){LW(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ig:Lg)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),O7(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Tf)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Md).top}}function Ys(t,e){return t.state.phrase(e)}const vp=30,yp=/[\s\.,:;?!]/;function Kw(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),s=t.state.doc.lineAt(n).to,i=Math.max(r.from,e-vp),l=Math.min(s,n+vp),c=t.state.sliceDoc(i,l);if(i!=r.from){for(let d=0;dc.length-vp;d--)if(!yp.test(c[d-1])&&yp.test(c[d])){c=c.slice(0,d);break}}return qe.announce.of(`${t.state.phrase("current match")}. ${c} ${t.state.phrase("on line")} ${r.number}.`)}const RK=qe.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),zK=[lo,No.low(TK),RK];class u_{constructor(e,n,r,s){this.state=e,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=zr(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(h_(e,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function j7(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function PK(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;itypeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:PK(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function BK(t,e){return n=>{for(let r=zr(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}let N7=class{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}};function gc(t){return t.selection.main.from}function h_(t,e){var n;let{source:r}=t,s=e&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const Zw=ka.define();function LK(t,e,n,r){let{main:s}=t.selection,i=n-s.from,l=r-s.from;return{...t.changeByRange(c=>{if(c!=s&&n!=r&&t.sliceDoc(c.from+i,c.from+l)!=t.sliceDoc(n,r))return{range:c};let d=t.toText(e);return{changes:{from:c.from+i,to:r==s.from?c.to:c.from+l,insert:d},range:Ce.cursor(c.from+i+d.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const C7=new WeakMap;function IK(t){if(!Array.isArray(t))return t;let e=C7.get(t);return e||C7.set(t,e=d_(t)),e}const qg=vt.define(),Af=vt.define();class qK{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&D<=57||D>=97&&D<=122?2:D>=65&&D<=90?1:0:(E=yw(D))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!T||R==1&&O||_==0&&R!=0)&&(n[p]==D||r[p]==D&&(x=!0)?l[p++]=T:l.length&&(j=!1)),_=R,T+=oa(D)}return p==d&&l[0]==0&&j?this.result(-100+(x?-200:0),l,e):v==d&&b==0?this.ret(-200-e.length+(k==e.length?0:-100),[0,k]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):v==d?this.ret(-900-e.length,[b,k]):p==d?this.result(-100+(x?-200:0)+-700+(j?0:-1100),l,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let l of n){let c=l+(this.astral?oa(As(r,l)):1);i&&s[i-1]==l?s[i-1]=c:(s[i++]=l,s[i++]=c)}return this.ret(e-r.length,s)}}class FK{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:QK,filterStrict:!1,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>T7(e(r),n(r)),optionClass:(e,n)=>r=>T7(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function T7(t,e){return t?e?t+" "+e:t:e}function QK(t,e,n,r,s,i){let l=t.textDirection==Hn.RTL,c=l,d=!1,h="top",m,p,x=e.left-s.left,v=s.right-e.right,b=r.right-r.left,k=r.bottom-r.top;if(c&&x=k||T>e.top?m=n.bottom-e.top:(h="bottom",m=e.bottom-n.top)}let O=(e.bottom-e.top)/i.offsetHeight,j=(e.right-e.left)/i.offsetWidth;return{style:`${h}: ${m/O}px; max-width: ${p/j}px`,class:"cm-completionInfo-"+(d?l?"left-narrow":"right-narrow":c?"left":"right")}}function $K(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let l=document.createElement("span");l.className="cm-completionLabel";let c=n.displayLabel||n.label,d=0;for(let h=0;hd&&l.appendChild(document.createTextNode(c.slice(d,m)));let x=l.appendChild(document.createElement("span"));x.appendChild(document.createTextNode(c.slice(m,p))),x.className="cm-completionMatchedText",d=p}return dn.position-r.position).map(n=>n.render)}function Ky(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/n);return{from:s*n,to:(s+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class HK{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:d=>this.placeInfo(d),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:l}=s.open,c=e.state.facet(Dr);this.optionContent=$K(c),this.optionClass=c.optionClass,this.tooltipClass=c.tooltipClass,this.range=Ky(i.length,l,c.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",d=>{let{options:h}=e.state.field(n).open;for(let m=d.target,p;m&&m!=this.dom;m=m.parentNode)if(m.nodeName=="LI"&&(p=/-(\d+)$/.exec(m.id))&&+p[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(Dr).closeOnBlur&&d.relatedTarget!=e.contentDOM&&e.dispatch({effects:Af.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:l,disabled:c}=r.open;(!s.open||s.open.options!=i)&&(this.range=Ky(i.length,l,e.state.facet(Dr).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),c!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!c)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=Ky(n.options.length,n.selected,this.view.state.facet(Dr).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let l=typeof i=="string"?document.createTextNode(i):i(s);if(!l)return;"then"in l?l.then(c=>{c&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(c,s)}).catch(c=>_s(this.view.state,c,"completion info")):(this.addInfoPane(l,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&VK(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let l=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:l.clientWidth,bottom:l.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom{l.target==s&&l.preventDefault()});let i=null;for(let l=r.from;lr.from||r.from==0))if(i=x,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let v=s.appendChild(document.createElement("completion-section"));v.textContent=x}}const m=s.appendChild(document.createElement("li"));m.id=n+"-"+l,m.setAttribute("role","option");let p=this.optionClass(c);p&&(m.className=p);for(let x of this.optionContent){let v=x(c,this.view.state,this.view,d);v&&m.appendChild(v)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.tonew HK(n,t,e)}function VK(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.topn.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function A7(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function WK(t,e){let n=[],r=null,s=null,i=m=>{n.push(m);let{section:p}=m.completion;if(p){r||(r=[]);let x=typeof p=="string"?p:p.name;r.some(v=>v.name==x)||r.push(typeof p=="string"?{name:x}:p)}},l=e.facet(Dr);for(let m of t)if(m.hasResult()){let p=m.result.getMatch;if(m.result.filter===!1)for(let x of m.result.options)i(new N7(x,m.source,p?p(x):[],1e9-n.length));else{let x=e.sliceDoc(m.from,m.to),v,b=l.filterStrict?new FK(x):new qK(x);for(let k of m.result.options)if(v=b.match(k.label)){let O=k.displayLabel?p?p(k,v.matched):[]:v.matched,j=v.score+(k.boost||0);if(i(new N7(k,m.source,O,j)),typeof k.section=="object"&&k.section.rank==="dynamic"){let{name:T}=k.section;s||(s=Object.create(null)),s[T]=Math.max(j,s[T]||-1e9)}}}}if(r){let m=Object.create(null),p=0,x=(v,b)=>(v.rank==="dynamic"&&b.rank==="dynamic"?s[b.name]-s[v.name]:0)||(typeof v.rank=="number"?v.rank:1e9)-(typeof b.rank=="number"?b.rank:1e9)||(v.namex.score-p.score||h(p.completion,x.completion))){let p=m.completion;!d||d.label!=p.label||d.detail!=p.detail||d.type!=null&&p.type!=null&&d.type!=p.type||d.apply!=p.apply||d.boost!=p.boost?c.push(m):A7(m.completion)>A7(d)&&(c[c.length-1]=m),d=m.completion}return c}class $u{constructor(e,n,r,s,i,l){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=l}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new $u(this.options,M7(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,l){if(s&&!l&&e.some(h=>h.isPending))return s.setDisabled();let c=WK(e,n);if(!c.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let d=n.facet(Dr).selectOnOpen?0:-1;if(s&&s.selected!=d&&s.selected!=-1){let h=s.options[s.selected].completion;for(let m=0;mm.hasResult()?Math.min(h,m.from):h,1e8),create:JK,above:i.aboveCursor},s?s.timestamp:Date.now(),d,!1)}map(e){return new $u(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new $u(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Fg{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new Fg(KK,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Dr),i=(r.override||n.languageDataAt("autocomplete",gc(n)).map(IK)).map(d=>(this.active.find(m=>m.source==d)||new ki(d,this.active.some(m=>m.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((d,h)=>d==this.active[h])&&(i=this.active);let l=this.open,c=e.effects.some(d=>d.is(Jw));l&&e.docChanged&&(l=l.map(e.changes)),e.selection||i.some(d=>d.hasResult()&&e.changes.touchesRange(d.from,d.to))||!GK(i,this.active)||c?l=$u.build(i,n,this.id,l,r,c):l&&l.disabled&&!i.some(d=>d.isPending)&&(l=null),!l&&i.every(d=>!d.isPending)&&i.some(d=>d.hasResult())&&(i=i.map(d=>d.hasResult()?new ki(d.source,0):d));for(let d of e.effects)d.is(m_)&&(l=l&&l.setSelected(d.value,this.id));return i==this.active&&l==this.open?this:new Fg(i,this.id,l)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?XK:YK}}function GK(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}const KK=[];function f_(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(Zw);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class ki{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=f_(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new ki(s.source,0)),r&4&&s.state==0&&(s=new ki(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(qg))s=new ki(s.source,1,i.value);else if(i.is(Af))s=new ki(s.source,0);else if(i.is(Jw))for(let l of i.value)l.source==s.source&&(s=l);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(gc(e.state))}}class Ku extends ki{constructor(e,n,r,s,i,l){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=l}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),l=e.changes.mapPos(this.to,1),c=gc(e.state);if(c>l||!s||n&2&&(gc(e.startState)==this.from||cn.map(e))}}),m_=vt.define(),Ms=Br.define({create(){return Fg.start()},update(t,e){return t.update(e)},provide:t=>[Dw.from(t,e=>e.tooltip),qe.contentAttributes.from(t,e=>e.attrs)]});function e5(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(Ms).active.find(s=>s.source==e.source);return r instanceof Ku?(typeof n=="string"?t.dispatch({...LK(t.state,n,r.from,r.to),annotations:Zw.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const JK=UK(Ms,e5);function bp(t,e="option"){return n=>{let r=n.state.field(Ms,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+s*(t?1:-1):t?0:l-1;return c<0?c=e=="page"?0:l-1:c>=l&&(c=e=="page"?l-1:0),n.dispatch({effects:m_.of(c)}),!0}}const eZ=t=>{let e=t.state.field(Ms,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(Ms,!1)?(t.dispatch({effects:qg.of(!0)}),!0):!1,tZ=t=>{let e=t.state.field(Ms,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Af.of(null)}),!0)};class nZ{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const rZ=50,sZ=1e3,iZ=lr.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(Ms).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Ms),n=t.state.facet(Dr);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Ms)==e)return;let r=t.transactions.some(i=>{let l=f_(i,n);return l&8||(i.selection||i.docChanged)&&!(l&3)});for(let i=0;irZ&&Date.now()-l.time>sZ){for(let c of l.context.abortListeners)try{c()}catch(d){_s(this.view.state,d)}l.context.abortListeners=null,this.running.splice(i--,1)}else l.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(l=>l.is(qg)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(l=>l.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(Ms);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Dr).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=gc(e),r=new u_(e,n,t.explicit,this.view),s=new nZ(t,r);this.running.push(s),Promise.resolve(t.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:Af.of(null)}),_s(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Dr).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Dr),r=this.view.state.field(Ms);for(let s=0;sc.source==i.active.source);if(l&&l.isPending)if(i.done==null){let c=new ki(i.active.source,0);for(let d of i.updates)c=c.update(d,n);c.isPending||e.push(c)}else this.startQuery(l)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:Jw.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Ms,!1);if(e&&e.tooltip&&this.view.state.facet(Dr).closeOnBlur){let n=e.open&&QM(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Af.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:qg.of(!1)}),20),this.composing=0}}}),aZ=typeof navigator=="object"&&/Win/.test(navigator.platform),lZ=No.highest(qe.domEventHandlers({keydown(t,e){let n=e.state.field(Ms,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(aZ&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(l=>l.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&e5(e,r),!1}})),p_=qe.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class oZ{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class t5{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Ur.TrackDel),r=e.mapPos(this.to,1,Ur.TrackDel);return n==null||r==null?null:new t5(this.field,n,r)}}class n5{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),l=/^\s*/.exec(i.text)[0];for(let d of this.lines){if(r.length){let h=l,m=/^\t*/.exec(d)[0].length;for(let p=0;pnew t5(d.field,s[d.line]+d.from,s[d.line]+d.to));return{text:r,ranges:c}}static parse(e){let n=[],r=[],s=[],i;for(let l of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(l);){let c=i[1]?+i[1]:null,d=i[2]||i[3]||"",h=-1,m=d.replace(/\\[{}]/g,p=>p[1]);for(let p=0;p=h&&x.field++}for(let p of s)if(p.line==r.length&&p.from>i.index){let x=i[2]?3+(i[1]||"").length:2;p.from-=x,p.to-=x}s.push(new oZ(h,r.length,i.index,i.index+m.length)),l=l.slice(0,i.index)+d+l.slice(i.index+i[0].length)}l=l.replace(/\\([{}])/g,(c,d,h)=>{for(let m of s)m.line==r.length&&m.from>h&&(m.from--,m.to--);return d}),r.push(l)}return new n5(r,s)}}let cZ=Je.widget({widget:new class extends ja{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),uZ=Je.mark({class:"cm-snippetField"});class Ed{constructor(e,n){this.ranges=e,this.active=n,this.deco=Je.set(e.map(r=>(r.from==r.to?cZ:uZ).range(r.from,r.to)),!0)}map(e){let n=[];for(let r of this.ranges){let s=r.map(e);if(!s)return null;n.push(s)}return new Ed(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const p0=vt.define({map(t,e){return t&&t.map(e)}}),dZ=vt.define(),Mf=Br.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(p0))return n.value;if(n.is(dZ)&&t)return new Ed(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>qe.decorations.from(t,e=>e?e.deco:Je.none)});function r5(t,e){return Ce.create(t.filter(n=>n.field==e).map(n=>Ce.range(n.from,n.to)))}function hZ(t){let e=n5.parse(t);return(n,r,s,i)=>{let{text:l,ranges:c}=e.instantiate(n.state,s),{main:d}=n.state.selection,h={changes:{from:s,to:i==d.from?d.to:i,insert:Xt.of(l)},scrollIntoView:!0,annotations:r?[Zw.of(r),gr.userEvent.of("input.complete")]:void 0};if(c.length&&(h.selection=r5(c,0)),c.some(m=>m.field>0)){let m=new Ed(c,0),p=h.effects=[p0.of(m)];n.state.field(Mf,!1)===void 0&&p.push(vt.appendConfig.of([Mf,xZ,vZ,p_]))}n.dispatch(n.state.update(h))}}function g_(t){return({state:e,dispatch:n})=>{let r=e.field(Mf,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(l=>l.field==s+t);return n(e.update({selection:r5(r.ranges,s),effects:p0.of(i?null:new Ed(r.ranges,s)),scrollIntoView:!0})),!0}}const fZ=({state:t,dispatch:e})=>t.field(Mf,!1)?(e(t.update({effects:p0.of(null)})),!0):!1,mZ=g_(1),pZ=g_(-1),gZ=[{key:"Tab",run:mZ,shift:pZ},{key:"Escape",run:fZ}],E7=He.define({combine(t){return t.length?t[0]:gZ}}),xZ=No.highest(o0.compute([E7],t=>t.facet(E7)));function Ya(t,e){return{...e,apply:hZ(t)}}const vZ=qe.domEventHandlers({mousedown(t,e){let n=e.state.field(Mf,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let s=n.ranges.find(i=>i.from<=r&&i.to>=r);return!s||s.field==n.active?!1:(e.dispatch({selection:r5(n.ranges,s.field),effects:p0.of(n.ranges.some(i=>i.field>s.field)?new Ed(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),Ef={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},cc=vt.define({map(t,e){let n=e.mapPos(t,-1,Ur.TrackAfter);return n??void 0}}),s5=new class extends yc{};s5.startSide=1;s5.endSide=-1;const x_=Br.define({create(){return Yt.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(cc)&&(t=t.update({add:[s5.range(n.value,n.value+1)]}));return t}});function yZ(){return[wZ,x_]}const Jy="()[]{}<>«»»«[]{}";function v_(t){for(let e=0;e{if((bZ?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&oa(As(r,0))==1||e!=s.from||n!=s.to)return!1;let i=OZ(t.state,r);return i?(t.dispatch(i),!0):!1}),SZ=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=y_(t,t.selection.main.head).brackets||Ef.brackets,s=null,i=t.changeByRange(l=>{if(l.empty){let c=jZ(t.doc,l.head);for(let d of r)if(d==c&&Dx(t.doc,l.head)==v_(As(d,0)))return{changes:{from:l.head-d.length,to:l.head+d.length},range:Ce.cursor(l.head-d.length)}}return{range:s=l}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},kZ=[{key:"Backspace",run:SZ}];function OZ(t,e){let n=y_(t,t.selection.main.head),r=n.brackets||Ef.brackets;for(let s of r){let i=v_(As(s,0));if(e==s)return i==s?TZ(t,s,r.indexOf(s+s+s)>-1,n):NZ(t,s,i,n.before||Ef.before);if(e==i&&b_(t,t.selection.main.from))return CZ(t,s,i)}return null}function b_(t,e){let n=!1;return t.field(x_).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function Dx(t,e){let n=t.sliceString(e,e+2);return n.slice(0,oa(As(n,0)))}function jZ(t,e){let n=t.sliceString(e-2,e);return oa(As(n,0))==n.length?n:n.slice(1)}function NZ(t,e,n,r){let s=null,i=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:n,from:l.to}],effects:cc.of(l.to+e.length),range:Ce.range(l.anchor+e.length,l.head+e.length)};let c=Dx(t.doc,l.head);return!c||/\s/.test(c)||r.indexOf(c)>-1?{changes:{insert:e+n,from:l.head},effects:cc.of(l.head+e.length),range:Ce.cursor(l.head+e.length)}:{range:s=l}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function CZ(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&Dx(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Ce.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function TZ(t,e,n,r){let s=r.stringPrefixes||Ef.stringPrefixes,i=null,l=t.changeByRange(c=>{if(!c.empty)return{changes:[{insert:e,from:c.from},{insert:e,from:c.to}],effects:cc.of(c.to+e.length),range:Ce.range(c.anchor+e.length,c.head+e.length)};let d=c.head,h=Dx(t.doc,d),m;if(h==e){if(_7(t,d))return{changes:{insert:e+e,from:d},effects:cc.of(d+e.length),range:Ce.cursor(d+e.length)};if(b_(t,d)){let x=n&&t.sliceDoc(d,d+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:d,to:d+x.length,insert:x},range:Ce.cursor(d+x.length)}}}else{if(n&&t.sliceDoc(d-2*e.length,d)==e+e&&(m=D7(t,d-2*e.length,s))>-1&&_7(t,m))return{changes:{insert:e+e+e+e,from:d},effects:cc.of(d+e.length),range:Ce.cursor(d+e.length)};if(t.charCategorizer(d)(h)!=Vn.Word&&D7(t,d,s)>-1&&!AZ(t,d,e,s))return{changes:{insert:e+e,from:d},effects:cc.of(d+e.length),range:Ce.cursor(d+e.length)}}return{range:i=c}});return i?null:t.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function _7(t,e){let n=zr(t).resolveInner(e+1);return n.parent&&n.from==e}function AZ(t,e,n,r){let s=zr(t).resolveInner(e,-1),i=r.reduce((l,c)=>Math.max(l,c.length),0);for(let l=0;l<5;l++){let c=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),d=c.indexOf(n);if(!d||d>-1&&r.indexOf(c.slice(0,d))>-1){let m=s.firstChild;for(;m&&m.from==s.from&&m.to-m.from>n.length+d;){if(t.sliceDoc(m.to-n.length,m.to)==n)return!1;m=m.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function D7(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Vn.Word)return e;for(let s of n){let i=e-s.length;if(t.sliceDoc(i,e)==s&&r(t.sliceDoc(i-1,i))!=Vn.Word)return i}return-1}function MZ(t={}){return[lZ,Ms,Dr.of(t),iZ,EZ,p_]}const w_=[{key:"Ctrl-Space",run:Zy},{mac:"Alt-`",run:Zy},{mac:"Alt-i",run:Zy},{key:"Escape",run:tZ},{key:"ArrowDown",run:bp(!0)},{key:"ArrowUp",run:bp(!1)},{key:"PageDown",run:bp(!0,"page")},{key:"PageUp",run:bp(!1,"page")},{key:"Enter",run:eZ}],EZ=No.highest(o0.computeN([Dr],t=>t.facet(Dr).defaultKeymap?[w_]:[]));class R7{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class ic{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(_f).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((v,b)=>v.from-b.from||v.to-b.to),l=new ml,c=[],d=0,h=r.doc.iter(),m=0,p=r.doc.length;for(let v=0;;){let b=v==i.length?null:i[v];if(!b&&!c.length)break;let k,O;if(c.length)k=d,O=c.reduce((A,_)=>Math.min(A,_.to),b&&b.from>k?b.from:1e8);else{if(k=b.from,k>p)break;O=b.to,c.push(b),v++}for(;vA.from||A.to==k))c.push(A),v++,O=Math.min(A.to,O);else{O=Math.min(A.from,O);break}}O=Math.min(O,p);let j=!1;if(c.some(A=>A.from==k&&(A.to==O||O==p))&&(j=k==O,!j&&O-k<10)){let A=k-(m+h.value.length);A>0&&(h.next(A),m=k);for(let _=k;;){if(_>=O){j=!0;break}if(!h.lineBreak&&m+h.value.length>_)break;_=m+h.value.length,m+=h.value.length,h.next()}}let T=HZ(c);if(j)l.add(k,k,Je.widget({widget:new qZ(T),diagnostics:c.slice()}));else{let A=c.reduce((_,D)=>D.markClass?_+" "+D.markClass:_,"");l.add(k,O,Je.mark({class:"cm-lintRange cm-lintRange-"+T+A,diagnostics:c.slice(),inclusiveEnd:c.some(_=>_.to>O)}))}if(d=O,d==p)break;for(let A=0;A{if(!(e&&l.diagnostics.indexOf(e)<0))if(!r)r=new R7(s,i,e||l.diagnostics[0]);else{if(l.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new R7(r.from,i,r.diagnostic)}}),r}function _Z(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(_f).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(l=>l.is(S_))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function DZ(t,e){return t.field(ri,!1)?e:e.concat(vt.appendConfig.of(UZ))}const S_=vt.define(),i5=vt.define(),k_=vt.define(),ri=Br.define({create(){return new ic(Je.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,s=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=xd(n,t.selected.diagnostic,i)||xd(n,null,i)}!n.size&&s&&e.state.facet(_f).autoPanel&&(s=null),t=new ic(n,s,r)}for(let n of e.effects)if(n.is(S_)){let r=e.state.facet(_f).autoPanel?n.value.length?Df.open:null:t.panel;t=ic.init(n.value,r,e.state)}else n.is(i5)?t=new ic(t.diagnostics,n.value?Df.open:null,t.selected):n.is(k_)&&(t=new ic(t.diagnostics,t.panel,n.value));return t},provide:t=>[Sf.from(t,e=>e.panel),qe.decorations.from(t,e=>e.diagnostics)]}),RZ=Je.mark({class:"cm-lintRange cm-lintRange-active"});function zZ(t,e,n){let{diagnostics:r}=t.state.field(ri),s,i=-1,l=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(d,h,{spec:m})=>{if(e>=d&&e<=h&&(d==h||(e>d||n>0)&&(ej_(t,n,!1)))}const BZ=t=>{let e=t.state.field(ri,!1);(!e||!e.panel)&&t.dispatch({effects:DZ(t.state,[i5.of(!0)])});let n=wf(t,Df.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},z7=t=>{let e=t.state.field(ri,!1);return!e||!e.panel?!1:(t.dispatch({effects:i5.of(!1)}),!0)},LZ=t=>{let e=t.state.field(ri,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},IZ=[{key:"Mod-Shift-m",run:BZ,preventDefault:!0},{key:"F8",run:LZ}],_f=He.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...Oa(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:P7,tooltipFilter:P7,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,s,i)=>e(r,s,i)||n(r,s,i):e:n,autoPanel:(e,n)=>e||n})}}});function P7(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function O_(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;ri.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function j_(t,e,n){var r;let s=n?O_(e.actions):[];return Mn("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Mn("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,l)=>{let c=!1,d=v=>{if(v.preventDefault(),c)return;c=!0;let b=xd(t.state.field(ri).diagnostics,e);b&&i.apply(t,b.from,b.to)},{name:h}=i,m=s[l]?h.indexOf(s[l]):-1,p=m<0?h:[h.slice(0,m),Mn("u",h.slice(m,m+1)),h.slice(m+1)],x=i.markClass?" "+i.markClass:"";return Mn("button",{type:"button",class:"cm-diagnosticAction"+x,onclick:d,onmousedown:d,"aria-label":` Action: ${h}${m<0?"":` (access key "${s[l]})"`}.`},p)}),e.source&&Mn("div",{class:"cm-diagnosticSource"},e.source))}class qZ extends ja{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Mn("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class B7{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=j_(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Df{constructor(e){this.view=e,this.items=[];let n=s=>{if(s.keyCode==27)z7(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],l=O_(i.actions);for(let c=0;c{for(let i=0;iz7(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(ri).selected;if(!e)return-1;for(let n=0;n{for(let m of h.diagnostics){if(l.has(m))continue;l.add(m);let p=-1,x;for(let v=r;vr&&(this.items.splice(r,p-r),s=!0)),n&&x.diagnostic==n.diagnostic?x.dom.hasAttribute("aria-selected")||(x.dom.setAttribute("aria-selected","true"),i=x):x.dom.hasAttribute("aria-selected")&&x.dom.removeAttribute("aria-selected"),r++}});r({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:c,panel:d})=>{let h=d.height/this.list.offsetHeight;c.topd.bottom&&(this.list.scrollTop+=(c.bottom-d.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(ri),r=xd(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:k_.of(r)})}static open(e){return new Df(e)}}function FZ(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function wp(t){return FZ(``,'width="6" height="3"')}const QZ=qe.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:wp("#d11")},".cm-lintRange-warning":{backgroundImage:wp("orange")},".cm-lintRange-info":{backgroundImage:wp("#999")},".cm-lintRange-hint":{backgroundImage:wp("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function $Z(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function HZ(t){let e="hint",n=1;for(let r of t){let s=$Z(r.severity);s>n&&(n=s,e=r.severity)}return e}const UZ=[ri,qe.decorations.compute([ri],t=>{let{selected:e,panel:n}=t.field(ri);return!e||!n||e.from==e.to?Je.none:Je.set([RZ.range(e.from,e.to)])}),NG(zZ,{hideOn:_Z}),QZ];var L7=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(kZ)),e.defaultKeymap!==!1&&(r=r.concat(aK)),e.searchKeymap!==!1&&(r=r.concat(_K)),e.historyKeymap!==!1&&(r=r.concat(fY)),e.foldKeymap!==!1&&(r=r.concat(kX)),e.completionKeymap!==!1&&(r=r.concat(w_)),e.lintKeymap!==!1&&(r=r.concat(IZ));var s=[];return e.lineNumbers!==!1&&s.push(BG()),e.highlightActiveLineGutter!==!1&&s.push(qG()),e.highlightSpecialChars!==!1&&s.push(tG()),e.history!==!1&&s.push(sY()),e.foldGutter!==!1&&s.push(CX()),e.drawSelection!==!1&&s.push(HW()),e.dropCursor!==!1&&s.push(XW()),e.allowMultipleSelections!==!1&&s.push(Vt.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(mX()),e.syntaxHighlighting!==!1&&s.push(hE(EX,{fallback:!0})),e.bracketMatching!==!1&&s.push(LX()),e.closeBrackets!==!1&&s.push(yZ()),e.autocompletion!==!1&&s.push(MZ()),e.rectangularSelection!==!1&&s.push(pG()),n!==!1&&s.push(vG()),e.highlightActiveLine!==!1&&s.push(lG()),e.highlightSelectionMatches!==!1&&s.push(fK()),e.tabSize&&typeof e.tabSize=="number"&&s.push(u0.of(" ".repeat(e.tabSize))),s.concat([o0.of(r.flat())]).filter(Boolean)};const VZ="#e5c07b",I7="#e06c75",WZ="#56b6c2",GZ="#ffffff",sg="#abb2bf",o4="#7d8799",XZ="#61afef",YZ="#98c379",q7="#d19a66",KZ="#c678dd",ZZ="#21252b",F7="#2c313a",Q7="#282c34",eb="#353a42",JZ="#3E4451",$7="#528bff",eJ=qe.theme({"&":{color:sg,backgroundColor:Q7},".cm-content":{caretColor:$7},".cm-cursor, .cm-dropCursor":{borderLeftColor:$7},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:JZ},".cm-panels":{backgroundColor:ZZ,color:sg},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Q7,color:o4,border:"none"},".cm-activeLineGutter":{backgroundColor:F7},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:eb},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:eb,borderBottomColor:eb},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:F7,color:sg}}},{dark:!0}),tJ=h0.define([{tag:he.keyword,color:KZ},{tag:[he.name,he.deleted,he.character,he.propertyName,he.macroName],color:I7},{tag:[he.function(he.variableName),he.labelName],color:XZ},{tag:[he.color,he.constant(he.name),he.standard(he.name)],color:q7},{tag:[he.definition(he.name),he.separator],color:sg},{tag:[he.typeName,he.className,he.number,he.changed,he.annotation,he.modifier,he.self,he.namespace],color:VZ},{tag:[he.operator,he.operatorKeyword,he.url,he.escape,he.regexp,he.link,he.special(he.string)],color:WZ},{tag:[he.meta,he.comment],color:o4},{tag:he.strong,fontWeight:"bold"},{tag:he.emphasis,fontStyle:"italic"},{tag:he.strikethrough,textDecoration:"line-through"},{tag:he.link,color:o4,textDecoration:"underline"},{tag:he.heading,fontWeight:"bold",color:I7},{tag:[he.atom,he.bool,he.special(he.variableName)],color:q7},{tag:[he.processingInstruction,he.string,he.inserted],color:YZ},{tag:he.invalid,color:GZ}]),N_=[eJ,hE(tJ)];var nJ=qe.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),rJ=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:i="light",placeholder:l="",basicSetup:c=!0}=e,d=[];switch(n&&d.unshift(o0.of([lK])),c&&(typeof c=="boolean"?d.unshift(L7()):d.unshift(L7(c))),l&&d.unshift(dG(l)),i){case"light":d.push(nJ);break;case"dark":d.push(N_);break;case"none":break;default:d.push(i);break}return r===!1&&d.push(qe.editable.of(!1)),s&&d.push(Vt.readOnly.of(!0)),[...d]},sJ=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class iJ{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class H7{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var tb=null,aJ=()=>typeof window>"u"?new H7:(tb||(tb=new H7),tb),U7=ka.define(),lJ=200,oJ=[];function cJ(t){var{value:e,selection:n,onChange:r,onStatistics:s,onCreateEditor:i,onUpdate:l,extensions:c=oJ,autoFocus:d,theme:h="light",height:m=null,minHeight:p=null,maxHeight:x=null,width:v=null,minWidth:b=null,maxWidth:k=null,placeholder:O="",editable:j=!0,readOnly:T=!1,indentWithTab:A=!0,basicSetup:_=!0,root:D,initialState:E}=t,[R,Q]=S.useState(),[F,L]=S.useState(),[U,V]=S.useState(),de=S.useState(()=>({current:null}))[0],W=S.useState(()=>({current:null}))[0],J=qe.theme({"&":{height:m,minHeight:p,maxHeight:x,width:v,minWidth:b,maxWidth:k},"& .cm-scroller":{height:"100% !important"}}),$=qe.updateListener.of(ce=>{if(ce.docChanged&&typeof r=="function"&&!ce.transactions.some(Y=>Y.annotation(U7))){de.current?de.current.reset():(de.current=new iJ(()=>{if(W.current){var Y=W.current;W.current=null,Y()}de.current=null},lJ),aJ().add(de.current));var z=ce.state.doc,xe=z.toString();r(xe,ce)}s&&s(sJ(ce))}),ae=rJ({theme:h,editable:j,readOnly:T,placeholder:O,indentWithTab:A,basicSetup:_}),ne=[$,J,...ae];return l&&typeof l=="function"&&ne.push(qe.updateListener.of(l)),ne=ne.concat(c),S.useLayoutEffect(()=>{if(R&&!U){var ce={doc:e,selection:n,extensions:ne},z=E?Vt.fromJSON(E.json,ce,E.fields):Vt.create(ce);if(V(z),!F){var xe=new qe({state:z,parent:R,root:D});L(xe),i&&i(xe,z)}}return()=>{F&&(V(void 0),L(void 0))}},[R,U]),S.useEffect(()=>{t.container&&Q(t.container)},[t.container]),S.useEffect(()=>()=>{F&&(F.destroy(),L(void 0)),de.current&&(de.current.cancel(),de.current=null)},[F]),S.useEffect(()=>{d&&F&&F.focus()},[d,F]),S.useEffect(()=>{F&&F.dispatch({effects:vt.reconfigure.of(ne)})},[h,c,m,p,x,v,b,k,O,j,T,A,_,r,l]),S.useEffect(()=>{if(e!==void 0){var ce=F?F.state.doc.toString():"";if(F&&e!==ce){var z=de.current&&!de.current.isDone,xe=()=>{F&&e!==F.state.doc.toString()&&F.dispatch({changes:{from:0,to:F.state.doc.toString().length,insert:e||""},annotations:[U7.of(!0)]})};z?W.current=xe:xe()}}},[e,F]),{state:U,setState:V,view:F,setView:L,container:R,setContainer:Q}}var uJ=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],C_=S.forwardRef((t,e)=>{var{className:n,value:r="",selection:s,extensions:i=[],onChange:l,onStatistics:c,onCreateEditor:d,onUpdate:h,autoFocus:m,theme:p="light",height:x,minHeight:v,maxHeight:b,width:k,minWidth:O,maxWidth:j,basicSetup:T,placeholder:A,indentWithTab:_,editable:D,readOnly:E,root:R,initialState:Q}=t,F=VI(t,uJ),L=S.useRef(null),{state:U,view:V,container:de,setContainer:W}=cJ({root:R,value:r,autoFocus:m,theme:p,height:x,minHeight:v,maxHeight:b,width:k,minWidth:O,maxWidth:j,basicSetup:T,placeholder:A,indentWithTab:_,editable:D,readOnly:E,selection:s,onChange:l,onStatistics:c,onCreateEditor:d,onUpdate:h,extensions:i,initialState:Q});S.useImperativeHandle(e,()=>({editor:L.current,state:U,view:V}),[L,de,U,V]);var J=S.useCallback(ae=>{L.current=ae,W(ae)},[W]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var $=typeof p=="string"?"cm-theme-"+p:"cm-theme";return a.jsx("div",WI({ref:J,className:""+$+(n?" "+n:"")},F))});C_.displayName="CodeMirror";var V7={};class Qg{constructor(e,n,r,s,i,l,c,d,h,m=0,p){this.p=e,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=l,this.buffer=c,this.bufferBase=d,this.curContext=h,this.lookAhead=m,this.parent=p}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let s=e.parser.context;return new Qg(e,[],n,r,r,0,[],0,s?new W7(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,s=e&65535,{parser:i}=this.p,l=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=m):this.p.lastBigReductionSized;)this.stack.pop();this.reduceContext(s,h)}storeNode(e,n,r,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&l.buffer[c-4]==0&&l.buffer[c-1]>-1){if(n==r)return;if(l.buffer[c-2]>=n){l.buffer[c-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,s);else{let l=this.buffer.length;if(l>0&&(this.buffer[l-4]!=0||this.buffer[l-1]<0)){let c=!1;for(let d=l;d>0&&this.buffer[d-2]>r;d-=4)if(this.buffer[d-1]>=0){c=!0;break}if(c)for(;l>0&&this.buffer[l-2]>r;)this.buffer[l]=this.buffer[l-4],this.buffer[l+1]=this.buffer[l-3],this.buffer[l+2]=this.buffer[l-2],this.buffer[l+3]=this.buffer[l-1],l-=4,s>4&&(s-=4)}this.buffer[l]=e,this.buffer[l+1]=n,this.buffer[l+2]=r,this.buffer[l+3]=s}}shift(e,n,r,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:l}=this.p;(s>this.pos||n<=l.maxNode)&&(this.pos=s,l.stateFlag(i,1)||(this.reducePos=s)),this.pushState(i,r),this.shiftContext(n,r),n<=l.maxNode&&this.buffer.push(n,r,s,4)}else this.pos=s,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,s,4)}apply(e,n,r,s){e&65536?this.reduce(e):this.shift(e,n,r,s)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(n,s),this.buffer.push(r,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),s=e.bufferBase+n;for(;e&&s==e.bufferBase;)e=e.parent;return new Qg(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new dJ(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let s=[];for(let i=0,l;id&1&&c==l)||s.push(n[i],l)}n=s}let r=[];for(let s=0;s>19,s=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let l=this.findForcedReduction();if(l==null)return!1;n=l}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(s,i)=>{if(!n.includes(s))return n.push(s),e.allActions(s,l=>{if(!(l&393216))if(l&65536){let c=(l>>19)-i;if(c>1){let d=l&65535,h=this.stack.length-c*3;if(h>=0&&e.getGoto(this.stack[h],d,!1)>=0)return c<<19|65536|d}}else{let c=r(l,i+1);if(c!=null)return c}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;nthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class W7{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class dJ{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=s}}class $g{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new $g(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new $g(this.stack,this.pos,this.index)}}function Sp(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r=92&&l--,l>=34&&l--;let d=l-32;if(d>=46&&(d-=46,c=!0),i+=d,c)break;i*=46}n?n[s++]=i:n=new e(i)}return n}class ig{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const G7=new ig;class hJ{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=G7,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,s=this.rangeIndex,i=this.pos+e;for(;ir.to:i>=r.to;){if(s==this.ranges.length-1)return null;let l=this.ranges[++s];i+=l.from-r.to,r=l}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n=this.chunk2Pos&&rc.to&&(this.chunk2=this.chunk2.slice(0,c.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=G7,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let s of this.ranges){if(s.from>=n)break;s.to>e&&(r+=this.input.read(Math.max(s.from,e),Math.min(s.to,n)))}return r}}class Zu{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;fJ(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Zu.prototype.contextual=Zu.prototype.fallback=Zu.prototype.extend=!1;Zu.prototype.fallback=Zu.prototype.extend=!1;class Rx{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function fJ(t,e,n,r,s,i){let l=0,c=1<0){let b=t[v];if(d.allows(b)&&(e.token.value==-1||e.token.value==b||mJ(b,e.token.value,s,i))){e.acceptToken(b);break}}let m=e.next,p=0,x=t[l+2];if(e.next<0&&x>p&&t[h+x*3-3]==65535){l=t[h+x*3-1];continue e}for(;p>1,b=h+v+(v<<1),k=t[b],O=t[b+1]||65536;if(m=O)p=v+1;else{l=t[b+2],e.advance();continue e}}break}}function X7(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function mJ(t,e,n,r){let s=X7(n,r,e);return s<0||X7(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class pJ{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Y7(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Y7(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=l,null;if(i instanceof Dn){if(l==e){if(l=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(l),this.index.push(0))}else this.index[n]++,this.nextStart=l+i.length}}}class gJ{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new ig)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,l=s.stateSlot(e.state,3),c=e.curContext?e.curContext.hash:0,d=0;for(let h=0;hp.end+25&&(d=Math.max(p.lookAhead,d)),p.value!=0)){let x=n;if(p.extended>-1&&(n=this.addActions(e,p.extended,p.end,n)),n=this.addActions(e,p.value,p.end,n),!m.extend&&(r=p,n>x))break}}for(;this.actions.length>n;)this.actions.pop();return d&&e.setLookAhead(d),!r&&e.pos==this.stream.end&&(r=new ig,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new ig,{pos:r,p:s}=e;return n.start=r,n.end=Math.min(r+1,s.stream.end),n.value=r==s.stream.end?s.parser.eofTerm:0,n}updateCachedToken(e,n,r){let s=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(s,e),r),e.value>-1){let{parser:i}=r.p;for(let l=0;l=0&&r.p.parser.dialect.allows(c>>1)){(c&1)==0?e.value=c>>1:e.extended=c>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;ie.bufferLength*4?new pJ(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],s,i;if(this.bigReductionCount>300&&e.length==1){let[l]=e;for(;l.forceReduce()&&l.stack.length&&l.stack[l.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let l=0;ln)r.push(c);else{if(this.advanceStack(c,r,e))continue;{s||(s=[],i=[]),s.push(c);let d=this.tokens.getMainToken(c);i.push(d.value,d.end)}}break}}if(!r.length){let l=s&&bJ(s);if(l)return Ks&&console.log("Finish with "+this.stackID(l)),this.stackToTree(l);if(this.parser.strict)throw Ks&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&s){let l=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,r);if(l)return Ks&&console.log("Force-finish "+this.stackID(l)),this.stackToTree(l.forceAll())}if(this.recovering){let l=this.recovering==1?1:this.recovering*3;if(r.length>l)for(r.sort((c,d)=>d.score-c.score);r.length>l;)r.pop();r.some(c=>c.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let l=0;l500&&h.buffer.length>500)if((c.score-h.score||c.buffer.length-h.buffer.length)>0)r.splice(d--,1);else{r.splice(l--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let l=1;l ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,m=h?e.curContext.hash:0;for(let p=this.fragments.nodeAt(s);p;){let x=this.parser.nodeSet.types[p.type.id]==p.type?i.getGoto(e.state,p.type.id):-1;if(x>-1&&p.length&&(!h||(p.prop(Et.contextHash)||0)==m))return e.useNode(p,x),Ks&&console.log(l+this.stackID(e)+` (via reuse of ${i.getName(p.type.id)})`),!0;if(!(p instanceof Dn)||p.children.length==0||p.positions[0]>0)break;let v=p.children[0];if(v instanceof Dn&&p.positions[0]==0)p=v;else break}}let c=i.stateSlot(e.state,4);if(c>0)return e.reduce(c),Ks&&console.log(l+this.stackID(e)+` (via always-reduce ${i.getName(c&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let d=this.tokens.getActions(e);for(let h=0;hs?n.push(b):r.push(b)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return K7(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let l=0;l ":"";if(c.deadEnd&&(i||(i=!0,c.restart(),Ks&&console.log(m+this.stackID(c)+" (restarted)"),this.advanceFully(c,r))))continue;let p=c.split(),x=m;for(let v=0;v<10&&p.forceReduce()&&(Ks&&console.log(x+this.stackID(p)+" (via force-reduce)"),!this.advanceFully(p,r));v++)Ks&&(x=this.stackID(p)+" -> ");for(let v of c.recoverByInsert(d))Ks&&console.log(m+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,r);this.stream.end>c.pos?(h==c.pos&&(h++,d=0),c.recoverByDelete(d,h),Ks&&console.log(m+this.stackID(c)+` (via recover-delete ${this.parser.getName(d)})`),K7(c,r)):(!s||s.scoret;class yJ{constructor(e){this.start=e.start,this.shift=e.shift||rb,this.reduce=e.reduce||rb,this.reuse=e.reuse||rb,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Rf extends Bw{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let c=0;ce.topRules[c][1]),s=[];for(let c=0;c=0)i(m,d,c[h++]);else{let p=c[h+-m];for(let x=-m;x>0;x--)i(c[h++],d,p);h++}}}this.nodeSet=new jx(n.map((c,d)=>gs.define({name:d>=this.minRepeatTerm?void 0:c,id:d,props:s[d],top:r.indexOf(d)>-1,error:d==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(d)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=VM;let l=Sp(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let c=0;ctypeof c=="number"?new Zu(l,c):c),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let s=new xJ(this,e,n,r);for(let i of this.wrappers)s=i(s,e,n,r);return s}getGoto(e,n,r=!1){let s=this.goto;if(n>=s[0])return-1;for(let i=s[n+1];;){let l=s[i++],c=l&1,d=s[i++];if(c&&r)return d;for(let h=i+(l>>1);i0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),s=r?n(r):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=rl(this.data,i+2);else break;s=n(rl(this.data,i+1))}return s}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=rl(this.data,r+2);else break;if((this.data[r+2]&1)==0){let s=this.data[r+1];n.some((i,l)=>l&1&&i==s)||n.push(this.data[r],s)}}return n}configure(e){let n=Object.assign(Object.create(Rf.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let s=e.tokenizers.find(i=>i.from==r);return s?s.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,s)=>{let i=e.specializers.find(c=>c.from==r.external);if(!i)return r;let l=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=Z7(l),l})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let l=n.indexOf(i);l>=0&&(r[l]=!0)}let s=null;for(let i=0;ir)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}const wJ=1,T_=194,A_=195,SJ=196,J7=197,kJ=198,OJ=199,jJ=200,NJ=2,M_=3,e8=201,CJ=24,TJ=25,AJ=49,MJ=50,EJ=55,_J=56,DJ=57,RJ=59,zJ=60,PJ=61,BJ=62,LJ=63,IJ=65,qJ=238,FJ=71,QJ=241,$J=242,HJ=243,UJ=244,VJ=245,WJ=246,GJ=247,XJ=248,E_=72,YJ=249,KJ=250,ZJ=251,JJ=252,eee=253,tee=254,nee=255,ree=256,see=73,iee=77,aee=263,lee=112,oee=130,cee=151,uee=152,dee=155,jc=10,zf=13,a5=32,zx=9,l5=35,hee=40,fee=46,c4=123,t8=125,__=39,D_=34,n8=92,mee=111,pee=120,gee=78,xee=117,vee=85,yee=new Set([TJ,AJ,MJ,aee,IJ,oee,_J,DJ,qJ,BJ,LJ,E_,see,iee,zJ,PJ,cee,uee,dee,lee]);function sb(t){return t==jc||t==zf}function ib(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}const bee=new Rx((t,e)=>{let n;if(t.next<0)t.acceptToken(OJ);else if(e.context.flags&ag)sb(t.next)&&t.acceptToken(kJ,1);else if(((n=t.peek(-1))<0||sb(n))&&e.canShift(J7)){let r=0;for(;t.next==a5||t.next==zx;)t.advance(),r++;(t.next==jc||t.next==zf||t.next==l5)&&t.acceptToken(J7,-r)}else sb(t.next)&&t.acceptToken(SJ,1)},{contextual:!0}),wee=new Rx((t,e)=>{let n=e.context;if(n.flags)return;let r=t.peek(-1);if(r==jc||r==zf){let s=0,i=0;for(;;){if(t.next==a5)s++;else if(t.next==zx)s+=8-s%8;else break;t.advance(),i++}s!=n.indent&&t.next!=jc&&t.next!=zf&&t.next!=l5&&(s[t,e|R_])),Oee=new yJ({start:See,reduce(t,e,n,r){return t.flags&ag&&yee.has(e)||(e==FJ||e==E_)&&t.flags&R_?t.parent:t},shift(t,e,n,r){return e==T_?new lg(t,kee(r.read(r.pos,n.pos)),0):e==A_?t.parent:e==CJ||e==EJ||e==RJ||e==M_?new lg(t,0,ag):r8.has(e)?new lg(t,0,r8.get(e)|t.flags&ag):t},hash(t){return t.hash}}),jee=new Rx(t=>{for(let e=0;e<5;e++){if(t.next!="print".charCodeAt(e))return;t.advance()}if(!/\w/.test(String.fromCharCode(t.next)))for(let e=0;;e++){let n=t.peek(e);if(!(n==a5||n==zx)){n!=hee&&n!=fee&&n!=jc&&n!=zf&&n!=l5&&t.acceptToken(wJ);return}}}),Nee=new Rx((t,e)=>{let{flags:n}=e.context,r=n&Ja?D_:__,s=(n&el)>0,i=!(n&tl),l=(n&nl)>0,c=t.pos;for(;!(t.next<0);)if(l&&t.next==c4)if(t.peek(1)==c4)t.advance(2);else{if(t.pos==c){t.acceptToken(M_,1);return}break}else if(i&&t.next==n8){if(t.pos==c){t.advance();let d=t.next;d>=0&&(t.advance(),Cee(t,d)),t.acceptToken(NJ);return}break}else if(t.next==n8&&!i&&t.peek(1)>-1)t.advance(2);else if(t.next==r&&(!s||t.peek(1)==r&&t.peek(2)==r)){if(t.pos==c){t.acceptToken(e8,s?3:1);return}break}else if(t.next==jc){if(s)t.advance();else if(t.pos==c){t.acceptToken(e8);return}break}else t.advance();t.pos>c&&t.acceptToken(jJ)});function Cee(t,e){if(e==mee)for(let n=0;n<2&&t.next>=48&&t.next<=55;n++)t.advance();else if(e==pee)for(let n=0;n<2&&ib(t.next);n++)t.advance();else if(e==xee)for(let n=0;n<4&&ib(t.next);n++)t.advance();else if(e==vee)for(let n=0;n<8&&ib(t.next);n++)t.advance();else if(e==gee&&t.next==c4){for(t.advance();t.next>=0&&t.next!=t8&&t.next!=__&&t.next!=D_&&t.next!=jc;)t.advance();t.next==t8&&t.advance()}}const Tee=Lw({'async "*" "**" FormatConversion FormatSpec':he.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":he.controlKeyword,"in not and or is del":he.operatorKeyword,"from def class global nonlocal lambda":he.definitionKeyword,import:he.moduleKeyword,"with as print":he.keyword,Boolean:he.bool,None:he.null,VariableName:he.variableName,"CallExpression/VariableName":he.function(he.variableName),"FunctionDefinition/VariableName":he.function(he.definition(he.variableName)),"ClassDefinition/VariableName":he.definition(he.className),PropertyName:he.propertyName,"CallExpression/MemberExpression/PropertyName":he.function(he.propertyName),Comment:he.lineComment,Number:he.number,String:he.string,FormatString:he.special(he.string),Escape:he.escape,UpdateOp:he.updateOperator,"ArithOp!":he.arithmeticOperator,BitOp:he.bitwiseOperator,CompareOp:he.compareOperator,AssignOp:he.definitionOperator,Ellipsis:he.punctuation,At:he.meta,"( )":he.paren,"[ ]":he.squareBracket,"{ }":he.brace,".":he.derefOperator,", ;":he.separator}),Aee={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},Mee=Rf.deserialize({version:14,states:"##jO`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[jee,wee,bee,Nee,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:t=>Aee[t]||-1}],tokenPrec:7668}),s8=new WG,z_=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function kp(t){return(e,n,r)=>{if(r)return!1;let s=e.node.getChild("VariableName");return s&&n(s,t),!0}}const Eee={FunctionDefinition:kp("function"),ClassDefinition:kp("class"),ForStatement(t,e,n){if(n){for(let r=t.node.firstChild;r;r=r.nextSibling)if(r.name=="VariableName")e(r,"variable");else if(r.name=="in")break}},ImportStatement(t,e){var n,r;let{node:s}=t,i=((n=s.firstChild)===null||n===void 0?void 0:n.name)=="from";for(let l=s.getChild("import");l;l=l.nextSibling)l.name=="VariableName"&&((r=l.nextSibling)===null||r===void 0?void 0:r.name)!="as"&&e(l,i?"variable":"namespace")},AssignStatement(t,e){for(let n=t.node.firstChild;n;n=n.nextSibling)if(n.name=="VariableName")e(n,"variable");else if(n.name==":"||n.name=="AssignOp")break},ParamList(t,e){for(let n=null,r=t.node.firstChild;r;r=r.nextSibling)r.name=="VariableName"&&(!n||!/\*|AssignOp/.test(n.name))&&e(r,"variable"),n=r},CapturePattern:kp("variable"),AsPattern:kp("variable"),__proto__:null};function P_(t,e){let n=s8.get(e);if(n)return n;let r=[],s=!0;function i(l,c){let d=t.sliceString(l.from,l.to);r.push({label:d,type:c})}return e.cursor(Or.IncludeAnonymous).iterate(l=>{if(l.name){let c=Eee[l.name];if(c&&c(l,i,s)||!s&&z_.has(l.name))return!1;s=!1}else if(l.to-l.from>8192){for(let c of P_(t,l.node))r.push(c);return!1}}),s8.set(e,r),r}const i8=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,B_=["String","FormatString","Comment","PropertyName"];function _ee(t){let e=zr(t.state).resolveInner(t.pos,-1);if(B_.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&i8.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let s=e;s;s=s.parent)z_.has(s.name)&&(r=r.concat(P_(t.state.doc,s)));return{options:r,from:n?e.from:t.pos,validFor:i8}}const Dee=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(t=>({label:t,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(t=>({label:t,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(t=>({label:t,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(t=>({label:t,type:"function"}))),Ree=[Ya("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),Ya("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),Ya("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),Ya("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),Ya(`if \${}: +`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new jK(this):new kK(this)}getCursor(e,n=0,r){let s=e.doc?e:Vt.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?zu(this,s,n,r):Ru(this,s,n,r)}}class i_{constructor(e){this.spec=e}}function Ru(t,e,n,r){return new gd(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?SK(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function SK(t,e){return(n,r,s,i)=>((i>n||i+s.length=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=Ru(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}function zu(t,e,n,r){return new n_(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?OK(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function Pg(t,e){return t.slice(Vr(t,e,!1),e)}function Bg(t,e){return t.slice(e,Vr(t,e))}function OK(t){return(e,n,r)=>!r[0].length||(t(Pg(r.input,r.index))!=Vn.Word||t(Bg(r.input,r.index))!=Vn.Word)&&(t(Bg(r.input,r.index+r[0].length))!=Vn.Word||t(Pg(r.input,r.index+r[0].length))!=Vn.Word)}class jK extends i_{nextMatch(e,n,r){let s=zu(this.spec,e,r,e.doc.length).next();return s.done&&(s=zu(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),l=zu(this.spec,e,i,r),c=null;for(;!l.next().done;)c=l.value;if(c&&(i==n||c.from>i+10))return c;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=zu(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}const Tf=vt.define(),Xw=vt.define(),lo=Br.define({create(t){return new Yy(l4(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Tf)?t=new Yy(n.value.create(),t.panel):n.is(Xw)&&(t=new Yy(t.query,n.value?Yw:null));return t},provide:t=>Sf.from(t,e=>e.panel)});class Yy{constructor(e,n){this.query=e,this.panel=n}}const NK=Je.mark({class:"cm-searchMatch"}),CK=Je.mark({class:"cm-searchMatch cm-searchMatch-selected"}),TK=lr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(lo))}update(t){let e=t.state.field(lo);(e!=t.startState.field(lo)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return Je.none;let{view:n}=this,r=new ml;for(let s=0,i=n.visibleRanges,l=i.length;si[s+1].from-500;)d=i[++s].to;t.highlight(n.state,c,d,(h,m)=>{let p=n.state.selection.ranges.some(x=>x.from==h&&x.to==m);r.add(h,m,p?CK:NK)})}return r.finish()}},{decorations:t=>t.decorations});function m0(t){return e=>{let n=e.state.field(lo,!1);return n&&n.query.spec.valid?t(e,n):o_(e)}}const Lg=m0((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=Ce.single(r.from,r.to),i=t.state.facet(Md);return t.dispatch({selection:s,effects:[Kw(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),l_(t),!0}),Ig=m0((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=Ce.single(s.from,s.to),l=t.state.facet(Md);return t.dispatch({selection:i,effects:[Kw(t,s),l.scrollToMatch(i.main,t)],userEvent:"select.search"}),l_(t),!0}),AK=m0((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Ce.create(n.map(r=>Ce.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),MK=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],l=0;for(let c=new gd(t.doc,t.sliceDoc(r,s));!c.next().done;){if(i.length>1e3)return!1;c.value.from==r&&(l=i.length),i.push(Ce.range(c.value.from,c.value.to))}return e(t.update({selection:Ce.create(i,l),userEvent:"select.search.matches"})),!0},O7=m0((t,{query:e})=>{let{state:n}=t,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,r,r);if(!i)return!1;let l=i,c=[],d,h,m=[];l.from==r&&l.to==s&&(h=n.toText(e.getReplacement(l)),c.push({from:l.from,to:l.to,insert:h}),l=e.nextMatch(n,l.from,l.to),m.push(qe.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let p=t.state.changes(c);return l&&(d=Ce.single(l.from,l.to).map(p),m.push(Kw(t,l)),m.push(n.facet(Md).scrollToMatch(d.main,t))),t.dispatch({changes:p,selection:d,effects:m,userEvent:"input.replace"}),!0}),EK=m0((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(s=>{let{from:i,to:l}=s;return{from:i,to:l,insert:e.getReplacement(s)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:qe.announce.of(r),userEvent:"input.replace.all"}),!0});function Yw(t){return t.state.facet(Md).createPanel(t)}function l4(t,e){var n,r,s,i,l;let c=t.selection.main,d=c.empty||c.to>c.from+100?"":t.sliceDoc(c.from,c.to);if(e&&!d)return e;let h=t.facet(Md);return new s_({search:((n=e?.literal)!==null&&n!==void 0?n:h.literal)?d:d.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:h.regexp,wholeWord:(l=e?.wholeWord)!==null&&l!==void 0?l:h.wholeWord})}function a_(t){let e=wf(t,Yw);return e&&e.dom.querySelector("[main-field]")}function l_(t){let e=a_(t);e&&e==t.root.activeElement&&e.select()}const o_=t=>{let e=t.state.field(lo,!1);if(e&&e.panel){let n=a_(t);if(n&&n!=t.root.activeElement){let r=l4(t.state,e.query.spec);r.valid&&t.dispatch({effects:Tf.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[Xw.of(!0),e?Tf.of(l4(t.state,e.query.spec)):vt.appendConfig.of(zK)]});return!0},c_=t=>{let e=t.state.field(lo,!1);if(!e||!e.panel)return!1;let n=wf(t,Yw);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Xw.of(!1)}),!0},_K=[{key:"Mod-f",run:o_,scope:"editor search-panel"},{key:"F3",run:Lg,shift:Ig,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Lg,shift:Ig,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:c_,scope:"editor search-panel"},{key:"Mod-Shift-l",run:MK},{key:"Mod-Alt-g",run:cK},{key:"Mod-d",run:wK,preventDefault:!0}];class DK{constructor(e){this.view=e;let n=this.query=e.state.field(lo).query.spec;this.commit=this.commit.bind(this),this.searchField=Mn("input",{value:n.search,placeholder:Ys(e,"Find"),"aria-label":Ys(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mn("input",{value:n.replace,placeholder:Ys(e,"Replace"),"aria-label":Ys(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mn("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Mn("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Mn("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,l){return Mn("button",{class:"cm-button",name:s,onclick:i,type:"button"},l)}this.dom=Mn("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>Lg(e),[Ys(e,"next")]),r("prev",()=>Ig(e),[Ys(e,"previous")]),r("select",()=>AK(e),[Ys(e,"all")]),Mn("label",null,[this.caseField,Ys(e,"match case")]),Mn("label",null,[this.reField,Ys(e,"regexp")]),Mn("label",null,[this.wordField,Ys(e,"by word")]),...e.state.readOnly?[]:[Mn("br"),this.replaceField,r("replace",()=>O7(e),[Ys(e,"replace")]),r("replaceAll",()=>EK(e),[Ys(e,"replace all")])],Mn("button",{name:"close",onclick:()=>c_(e),"aria-label":Ys(e,"close"),type:"button"},["×"])])}commit(){let e=new s_({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Tf.of(e)}))}keydown(e){LW(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ig:Lg)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),O7(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Tf)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Md).top}}function Ys(t,e){return t.state.phrase(e)}const vp=30,yp=/[\s\.,:;?!]/;function Kw(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),s=t.state.doc.lineAt(n).to,i=Math.max(r.from,e-vp),l=Math.min(s,n+vp),c=t.state.sliceDoc(i,l);if(i!=r.from){for(let d=0;dc.length-vp;d--)if(!yp.test(c[d-1])&&yp.test(c[d])){c=c.slice(0,d);break}}return qe.announce.of(`${t.state.phrase("current match")}. ${c} ${t.state.phrase("on line")} ${r.number}.`)}const RK=qe.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),zK=[lo,No.low(TK),RK];class u_{constructor(e,n,r,s){this.state=e,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=zr(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(h_(e,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function j7(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function PK(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;itypeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:PK(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function BK(t,e){return n=>{for(let r=zr(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}let N7=class{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}};function gc(t){return t.selection.main.from}function h_(t,e){var n;let{source:r}=t,s=e&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const Zw=ka.define();function LK(t,e,n,r){let{main:s}=t.selection,i=n-s.from,l=r-s.from;return{...t.changeByRange(c=>{if(c!=s&&n!=r&&t.sliceDoc(c.from+i,c.from+l)!=t.sliceDoc(n,r))return{range:c};let d=t.toText(e);return{changes:{from:c.from+i,to:r==s.from?c.to:c.from+l,insert:d},range:Ce.cursor(c.from+i+d.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const C7=new WeakMap;function IK(t){if(!Array.isArray(t))return t;let e=C7.get(t);return e||C7.set(t,e=d_(t)),e}const qg=vt.define(),Af=vt.define();class qK{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&D<=57||D>=97&&D<=122?2:D>=65&&D<=90?1:0:(E=yw(D))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!T||z==1&&O||_==0&&z!=0)&&(n[p]==D||r[p]==D&&(x=!0)?l[p++]=T:l.length&&(j=!1)),_=z,T+=oa(D)}return p==d&&l[0]==0&&j?this.result(-100+(x?-200:0),l,e):v==d&&b==0?this.ret(-200-e.length+(k==e.length?0:-100),[0,k]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):v==d?this.ret(-900-e.length,[b,k]):p==d?this.result(-100+(x?-200:0)+-700+(j?0:-1100),l,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let l of n){let c=l+(this.astral?oa(As(r,l)):1);i&&s[i-1]==l?s[i-1]=c:(s[i++]=l,s[i++]=c)}return this.ret(e-r.length,s)}}class FK{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:QK,filterStrict:!1,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>T7(e(r),n(r)),optionClass:(e,n)=>r=>T7(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function T7(t,e){return t?e?t+" "+e:t:e}function QK(t,e,n,r,s,i){let l=t.textDirection==Hn.RTL,c=l,d=!1,h="top",m,p,x=e.left-s.left,v=s.right-e.right,b=r.right-r.left,k=r.bottom-r.top;if(c&&x=k||T>e.top?m=n.bottom-e.top:(h="bottom",m=e.bottom-n.top)}let O=(e.bottom-e.top)/i.offsetHeight,j=(e.right-e.left)/i.offsetWidth;return{style:`${h}: ${m/O}px; max-width: ${p/j}px`,class:"cm-completionInfo-"+(d?l?"left-narrow":"right-narrow":c?"left":"right")}}function $K(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let l=document.createElement("span");l.className="cm-completionLabel";let c=n.displayLabel||n.label,d=0;for(let h=0;hd&&l.appendChild(document.createTextNode(c.slice(d,m)));let x=l.appendChild(document.createElement("span"));x.appendChild(document.createTextNode(c.slice(m,p))),x.className="cm-completionMatchedText",d=p}return dn.position-r.position).map(n=>n.render)}function Ky(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/n);return{from:s*n,to:(s+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class HK{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:d=>this.placeInfo(d),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:l}=s.open,c=e.state.facet(Dr);this.optionContent=$K(c),this.optionClass=c.optionClass,this.tooltipClass=c.tooltipClass,this.range=Ky(i.length,l,c.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",d=>{let{options:h}=e.state.field(n).open;for(let m=d.target,p;m&&m!=this.dom;m=m.parentNode)if(m.nodeName=="LI"&&(p=/-(\d+)$/.exec(m.id))&&+p[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(Dr).closeOnBlur&&d.relatedTarget!=e.contentDOM&&e.dispatch({effects:Af.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:l,disabled:c}=r.open;(!s.open||s.open.options!=i)&&(this.range=Ky(i.length,l,e.state.facet(Dr).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),c!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!c)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=Ky(n.options.length,n.selected,this.view.state.facet(Dr).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let l=typeof i=="string"?document.createTextNode(i):i(s);if(!l)return;"then"in l?l.then(c=>{c&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(c,s)}).catch(c=>_s(this.view.state,c,"completion info")):(this.addInfoPane(l,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&VK(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let l=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:l.clientWidth,bottom:l.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom{l.target==s&&l.preventDefault()});let i=null;for(let l=r.from;lr.from||r.from==0))if(i=x,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let v=s.appendChild(document.createElement("completion-section"));v.textContent=x}}const m=s.appendChild(document.createElement("li"));m.id=n+"-"+l,m.setAttribute("role","option");let p=this.optionClass(c);p&&(m.className=p);for(let x of this.optionContent){let v=x(c,this.view.state,this.view,d);v&&m.appendChild(v)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.tonew HK(n,t,e)}function VK(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.topn.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function A7(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function WK(t,e){let n=[],r=null,s=null,i=m=>{n.push(m);let{section:p}=m.completion;if(p){r||(r=[]);let x=typeof p=="string"?p:p.name;r.some(v=>v.name==x)||r.push(typeof p=="string"?{name:x}:p)}},l=e.facet(Dr);for(let m of t)if(m.hasResult()){let p=m.result.getMatch;if(m.result.filter===!1)for(let x of m.result.options)i(new N7(x,m.source,p?p(x):[],1e9-n.length));else{let x=e.sliceDoc(m.from,m.to),v,b=l.filterStrict?new FK(x):new qK(x);for(let k of m.result.options)if(v=b.match(k.label)){let O=k.displayLabel?p?p(k,v.matched):[]:v.matched,j=v.score+(k.boost||0);if(i(new N7(k,m.source,O,j)),typeof k.section=="object"&&k.section.rank==="dynamic"){let{name:T}=k.section;s||(s=Object.create(null)),s[T]=Math.max(j,s[T]||-1e9)}}}}if(r){let m=Object.create(null),p=0,x=(v,b)=>(v.rank==="dynamic"&&b.rank==="dynamic"?s[b.name]-s[v.name]:0)||(typeof v.rank=="number"?v.rank:1e9)-(typeof b.rank=="number"?b.rank:1e9)||(v.namex.score-p.score||h(p.completion,x.completion))){let p=m.completion;!d||d.label!=p.label||d.detail!=p.detail||d.type!=null&&p.type!=null&&d.type!=p.type||d.apply!=p.apply||d.boost!=p.boost?c.push(m):A7(m.completion)>A7(d)&&(c[c.length-1]=m),d=m.completion}return c}class $u{constructor(e,n,r,s,i,l){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=l}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new $u(this.options,M7(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,l){if(s&&!l&&e.some(h=>h.isPending))return s.setDisabled();let c=WK(e,n);if(!c.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let d=n.facet(Dr).selectOnOpen?0:-1;if(s&&s.selected!=d&&s.selected!=-1){let h=s.options[s.selected].completion;for(let m=0;mm.hasResult()?Math.min(h,m.from):h,1e8),create:JK,above:i.aboveCursor},s?s.timestamp:Date.now(),d,!1)}map(e){return new $u(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new $u(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Fg{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new Fg(KK,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Dr),i=(r.override||n.languageDataAt("autocomplete",gc(n)).map(IK)).map(d=>(this.active.find(m=>m.source==d)||new ki(d,this.active.some(m=>m.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((d,h)=>d==this.active[h])&&(i=this.active);let l=this.open,c=e.effects.some(d=>d.is(Jw));l&&e.docChanged&&(l=l.map(e.changes)),e.selection||i.some(d=>d.hasResult()&&e.changes.touchesRange(d.from,d.to))||!GK(i,this.active)||c?l=$u.build(i,n,this.id,l,r,c):l&&l.disabled&&!i.some(d=>d.isPending)&&(l=null),!l&&i.every(d=>!d.isPending)&&i.some(d=>d.hasResult())&&(i=i.map(d=>d.hasResult()?new ki(d.source,0):d));for(let d of e.effects)d.is(m_)&&(l=l&&l.setSelected(d.value,this.id));return i==this.active&&l==this.open?this:new Fg(i,this.id,l)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?XK:YK}}function GK(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}const KK=[];function f_(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(Zw);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class ki{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=f_(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new ki(s.source,0)),r&4&&s.state==0&&(s=new ki(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(qg))s=new ki(s.source,1,i.value);else if(i.is(Af))s=new ki(s.source,0);else if(i.is(Jw))for(let l of i.value)l.source==s.source&&(s=l);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(gc(e.state))}}class Ku extends ki{constructor(e,n,r,s,i,l){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=l}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),l=e.changes.mapPos(this.to,1),c=gc(e.state);if(c>l||!s||n&2&&(gc(e.startState)==this.from||cn.map(e))}}),m_=vt.define(),Ms=Br.define({create(){return Fg.start()},update(t,e){return t.update(e)},provide:t=>[Dw.from(t,e=>e.tooltip),qe.contentAttributes.from(t,e=>e.attrs)]});function e5(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(Ms).active.find(s=>s.source==e.source);return r instanceof Ku?(typeof n=="string"?t.dispatch({...LK(t.state,n,r.from,r.to),annotations:Zw.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const JK=UK(Ms,e5);function bp(t,e="option"){return n=>{let r=n.state.field(Ms,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+s*(t?1:-1):t?0:l-1;return c<0?c=e=="page"?0:l-1:c>=l&&(c=e=="page"?l-1:0),n.dispatch({effects:m_.of(c)}),!0}}const eZ=t=>{let e=t.state.field(Ms,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(Ms,!1)?(t.dispatch({effects:qg.of(!0)}),!0):!1,tZ=t=>{let e=t.state.field(Ms,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Af.of(null)}),!0)};class nZ{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const rZ=50,sZ=1e3,iZ=lr.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(Ms).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Ms),n=t.state.facet(Dr);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Ms)==e)return;let r=t.transactions.some(i=>{let l=f_(i,n);return l&8||(i.selection||i.docChanged)&&!(l&3)});for(let i=0;irZ&&Date.now()-l.time>sZ){for(let c of l.context.abortListeners)try{c()}catch(d){_s(this.view.state,d)}l.context.abortListeners=null,this.running.splice(i--,1)}else l.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(l=>l.is(qg)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(l=>l.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(Ms);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Dr).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=gc(e),r=new u_(e,n,t.explicit,this.view),s=new nZ(t,r);this.running.push(s),Promise.resolve(t.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:Af.of(null)}),_s(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Dr).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Dr),r=this.view.state.field(Ms);for(let s=0;sc.source==i.active.source);if(l&&l.isPending)if(i.done==null){let c=new ki(i.active.source,0);for(let d of i.updates)c=c.update(d,n);c.isPending||e.push(c)}else this.startQuery(l)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:Jw.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Ms,!1);if(e&&e.tooltip&&this.view.state.facet(Dr).closeOnBlur){let n=e.open&&QM(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Af.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:qg.of(!1)}),20),this.composing=0}}}),aZ=typeof navigator=="object"&&/Win/.test(navigator.platform),lZ=No.highest(qe.domEventHandlers({keydown(t,e){let n=e.state.field(Ms,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(aZ&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(l=>l.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&e5(e,r),!1}})),p_=qe.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class oZ{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class t5{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Ur.TrackDel),r=e.mapPos(this.to,1,Ur.TrackDel);return n==null||r==null?null:new t5(this.field,n,r)}}class n5{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),l=/^\s*/.exec(i.text)[0];for(let d of this.lines){if(r.length){let h=l,m=/^\t*/.exec(d)[0].length;for(let p=0;pnew t5(d.field,s[d.line]+d.from,s[d.line]+d.to));return{text:r,ranges:c}}static parse(e){let n=[],r=[],s=[],i;for(let l of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(l);){let c=i[1]?+i[1]:null,d=i[2]||i[3]||"",h=-1,m=d.replace(/\\[{}]/g,p=>p[1]);for(let p=0;p=h&&x.field++}for(let p of s)if(p.line==r.length&&p.from>i.index){let x=i[2]?3+(i[1]||"").length:2;p.from-=x,p.to-=x}s.push(new oZ(h,r.length,i.index,i.index+m.length)),l=l.slice(0,i.index)+d+l.slice(i.index+i[0].length)}l=l.replace(/\\([{}])/g,(c,d,h)=>{for(let m of s)m.line==r.length&&m.from>h&&(m.from--,m.to--);return d}),r.push(l)}return new n5(r,s)}}let cZ=Je.widget({widget:new class extends ja{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),uZ=Je.mark({class:"cm-snippetField"});class Ed{constructor(e,n){this.ranges=e,this.active=n,this.deco=Je.set(e.map(r=>(r.from==r.to?cZ:uZ).range(r.from,r.to)),!0)}map(e){let n=[];for(let r of this.ranges){let s=r.map(e);if(!s)return null;n.push(s)}return new Ed(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const p0=vt.define({map(t,e){return t&&t.map(e)}}),dZ=vt.define(),Mf=Br.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(p0))return n.value;if(n.is(dZ)&&t)return new Ed(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>qe.decorations.from(t,e=>e?e.deco:Je.none)});function r5(t,e){return Ce.create(t.filter(n=>n.field==e).map(n=>Ce.range(n.from,n.to)))}function hZ(t){let e=n5.parse(t);return(n,r,s,i)=>{let{text:l,ranges:c}=e.instantiate(n.state,s),{main:d}=n.state.selection,h={changes:{from:s,to:i==d.from?d.to:i,insert:Xt.of(l)},scrollIntoView:!0,annotations:r?[Zw.of(r),gr.userEvent.of("input.complete")]:void 0};if(c.length&&(h.selection=r5(c,0)),c.some(m=>m.field>0)){let m=new Ed(c,0),p=h.effects=[p0.of(m)];n.state.field(Mf,!1)===void 0&&p.push(vt.appendConfig.of([Mf,xZ,vZ,p_]))}n.dispatch(n.state.update(h))}}function g_(t){return({state:e,dispatch:n})=>{let r=e.field(Mf,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(l=>l.field==s+t);return n(e.update({selection:r5(r.ranges,s),effects:p0.of(i?null:new Ed(r.ranges,s)),scrollIntoView:!0})),!0}}const fZ=({state:t,dispatch:e})=>t.field(Mf,!1)?(e(t.update({effects:p0.of(null)})),!0):!1,mZ=g_(1),pZ=g_(-1),gZ=[{key:"Tab",run:mZ,shift:pZ},{key:"Escape",run:fZ}],E7=He.define({combine(t){return t.length?t[0]:gZ}}),xZ=No.highest(o0.compute([E7],t=>t.facet(E7)));function Ya(t,e){return{...e,apply:hZ(t)}}const vZ=qe.domEventHandlers({mousedown(t,e){let n=e.state.field(Mf,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let s=n.ranges.find(i=>i.from<=r&&i.to>=r);return!s||s.field==n.active?!1:(e.dispatch({selection:r5(n.ranges,s.field),effects:p0.of(n.ranges.some(i=>i.field>s.field)?new Ed(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),Ef={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},cc=vt.define({map(t,e){let n=e.mapPos(t,-1,Ur.TrackAfter);return n??void 0}}),s5=new class extends yc{};s5.startSide=1;s5.endSide=-1;const x_=Br.define({create(){return Yt.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(cc)&&(t=t.update({add:[s5.range(n.value,n.value+1)]}));return t}});function yZ(){return[wZ,x_]}const Jy="()[]{}<>«»»«[]{}";function v_(t){for(let e=0;e{if((bZ?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&oa(As(r,0))==1||e!=s.from||n!=s.to)return!1;let i=OZ(t.state,r);return i?(t.dispatch(i),!0):!1}),SZ=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=y_(t,t.selection.main.head).brackets||Ef.brackets,s=null,i=t.changeByRange(l=>{if(l.empty){let c=jZ(t.doc,l.head);for(let d of r)if(d==c&&Dx(t.doc,l.head)==v_(As(d,0)))return{changes:{from:l.head-d.length,to:l.head+d.length},range:Ce.cursor(l.head-d.length)}}return{range:s=l}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},kZ=[{key:"Backspace",run:SZ}];function OZ(t,e){let n=y_(t,t.selection.main.head),r=n.brackets||Ef.brackets;for(let s of r){let i=v_(As(s,0));if(e==s)return i==s?TZ(t,s,r.indexOf(s+s+s)>-1,n):NZ(t,s,i,n.before||Ef.before);if(e==i&&b_(t,t.selection.main.from))return CZ(t,s,i)}return null}function b_(t,e){let n=!1;return t.field(x_).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function Dx(t,e){let n=t.sliceString(e,e+2);return n.slice(0,oa(As(n,0)))}function jZ(t,e){let n=t.sliceString(e-2,e);return oa(As(n,0))==n.length?n:n.slice(1)}function NZ(t,e,n,r){let s=null,i=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:n,from:l.to}],effects:cc.of(l.to+e.length),range:Ce.range(l.anchor+e.length,l.head+e.length)};let c=Dx(t.doc,l.head);return!c||/\s/.test(c)||r.indexOf(c)>-1?{changes:{insert:e+n,from:l.head},effects:cc.of(l.head+e.length),range:Ce.cursor(l.head+e.length)}:{range:s=l}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function CZ(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&Dx(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Ce.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function TZ(t,e,n,r){let s=r.stringPrefixes||Ef.stringPrefixes,i=null,l=t.changeByRange(c=>{if(!c.empty)return{changes:[{insert:e,from:c.from},{insert:e,from:c.to}],effects:cc.of(c.to+e.length),range:Ce.range(c.anchor+e.length,c.head+e.length)};let d=c.head,h=Dx(t.doc,d),m;if(h==e){if(_7(t,d))return{changes:{insert:e+e,from:d},effects:cc.of(d+e.length),range:Ce.cursor(d+e.length)};if(b_(t,d)){let x=n&&t.sliceDoc(d,d+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:d,to:d+x.length,insert:x},range:Ce.cursor(d+x.length)}}}else{if(n&&t.sliceDoc(d-2*e.length,d)==e+e&&(m=D7(t,d-2*e.length,s))>-1&&_7(t,m))return{changes:{insert:e+e+e+e,from:d},effects:cc.of(d+e.length),range:Ce.cursor(d+e.length)};if(t.charCategorizer(d)(h)!=Vn.Word&&D7(t,d,s)>-1&&!AZ(t,d,e,s))return{changes:{insert:e+e,from:d},effects:cc.of(d+e.length),range:Ce.cursor(d+e.length)}}return{range:i=c}});return i?null:t.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function _7(t,e){let n=zr(t).resolveInner(e+1);return n.parent&&n.from==e}function AZ(t,e,n,r){let s=zr(t).resolveInner(e,-1),i=r.reduce((l,c)=>Math.max(l,c.length),0);for(let l=0;l<5;l++){let c=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),d=c.indexOf(n);if(!d||d>-1&&r.indexOf(c.slice(0,d))>-1){let m=s.firstChild;for(;m&&m.from==s.from&&m.to-m.from>n.length+d;){if(t.sliceDoc(m.to-n.length,m.to)==n)return!1;m=m.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function D7(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Vn.Word)return e;for(let s of n){let i=e-s.length;if(t.sliceDoc(i,e)==s&&r(t.sliceDoc(i-1,i))!=Vn.Word)return i}return-1}function MZ(t={}){return[lZ,Ms,Dr.of(t),iZ,EZ,p_]}const w_=[{key:"Ctrl-Space",run:Zy},{mac:"Alt-`",run:Zy},{mac:"Alt-i",run:Zy},{key:"Escape",run:tZ},{key:"ArrowDown",run:bp(!0)},{key:"ArrowUp",run:bp(!1)},{key:"PageDown",run:bp(!0,"page")},{key:"PageUp",run:bp(!1,"page")},{key:"Enter",run:eZ}],EZ=No.highest(o0.computeN([Dr],t=>t.facet(Dr).defaultKeymap?[w_]:[]));class R7{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class ic{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(_f).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((v,b)=>v.from-b.from||v.to-b.to),l=new ml,c=[],d=0,h=r.doc.iter(),m=0,p=r.doc.length;for(let v=0;;){let b=v==i.length?null:i[v];if(!b&&!c.length)break;let k,O;if(c.length)k=d,O=c.reduce((A,_)=>Math.min(A,_.to),b&&b.from>k?b.from:1e8);else{if(k=b.from,k>p)break;O=b.to,c.push(b),v++}for(;vA.from||A.to==k))c.push(A),v++,O=Math.min(A.to,O);else{O=Math.min(A.from,O);break}}O=Math.min(O,p);let j=!1;if(c.some(A=>A.from==k&&(A.to==O||O==p))&&(j=k==O,!j&&O-k<10)){let A=k-(m+h.value.length);A>0&&(h.next(A),m=k);for(let _=k;;){if(_>=O){j=!0;break}if(!h.lineBreak&&m+h.value.length>_)break;_=m+h.value.length,m+=h.value.length,h.next()}}let T=HZ(c);if(j)l.add(k,k,Je.widget({widget:new qZ(T),diagnostics:c.slice()}));else{let A=c.reduce((_,D)=>D.markClass?_+" "+D.markClass:_,"");l.add(k,O,Je.mark({class:"cm-lintRange cm-lintRange-"+T+A,diagnostics:c.slice(),inclusiveEnd:c.some(_=>_.to>O)}))}if(d=O,d==p)break;for(let A=0;A{if(!(e&&l.diagnostics.indexOf(e)<0))if(!r)r=new R7(s,i,e||l.diagnostics[0]);else{if(l.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new R7(r.from,i,r.diagnostic)}}),r}function _Z(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(_f).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(l=>l.is(S_))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function DZ(t,e){return t.field(ri,!1)?e:e.concat(vt.appendConfig.of(UZ))}const S_=vt.define(),i5=vt.define(),k_=vt.define(),ri=Br.define({create(){return new ic(Je.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,s=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=xd(n,t.selected.diagnostic,i)||xd(n,null,i)}!n.size&&s&&e.state.facet(_f).autoPanel&&(s=null),t=new ic(n,s,r)}for(let n of e.effects)if(n.is(S_)){let r=e.state.facet(_f).autoPanel?n.value.length?Df.open:null:t.panel;t=ic.init(n.value,r,e.state)}else n.is(i5)?t=new ic(t.diagnostics,n.value?Df.open:null,t.selected):n.is(k_)&&(t=new ic(t.diagnostics,t.panel,n.value));return t},provide:t=>[Sf.from(t,e=>e.panel),qe.decorations.from(t,e=>e.diagnostics)]}),RZ=Je.mark({class:"cm-lintRange cm-lintRange-active"});function zZ(t,e,n){let{diagnostics:r}=t.state.field(ri),s,i=-1,l=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(d,h,{spec:m})=>{if(e>=d&&e<=h&&(d==h||(e>d||n>0)&&(ej_(t,n,!1)))}const BZ=t=>{let e=t.state.field(ri,!1);(!e||!e.panel)&&t.dispatch({effects:DZ(t.state,[i5.of(!0)])});let n=wf(t,Df.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},z7=t=>{let e=t.state.field(ri,!1);return!e||!e.panel?!1:(t.dispatch({effects:i5.of(!1)}),!0)},LZ=t=>{let e=t.state.field(ri,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},IZ=[{key:"Mod-Shift-m",run:BZ,preventDefault:!0},{key:"F8",run:LZ}],_f=He.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...Oa(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:P7,tooltipFilter:P7,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,s,i)=>e(r,s,i)||n(r,s,i):e:n,autoPanel:(e,n)=>e||n})}}});function P7(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function O_(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;ri.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function j_(t,e,n){var r;let s=n?O_(e.actions):[];return Mn("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Mn("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,l)=>{let c=!1,d=v=>{if(v.preventDefault(),c)return;c=!0;let b=xd(t.state.field(ri).diagnostics,e);b&&i.apply(t,b.from,b.to)},{name:h}=i,m=s[l]?h.indexOf(s[l]):-1,p=m<0?h:[h.slice(0,m),Mn("u",h.slice(m,m+1)),h.slice(m+1)],x=i.markClass?" "+i.markClass:"";return Mn("button",{type:"button",class:"cm-diagnosticAction"+x,onclick:d,onmousedown:d,"aria-label":` Action: ${h}${m<0?"":` (access key "${s[l]})"`}.`},p)}),e.source&&Mn("div",{class:"cm-diagnosticSource"},e.source))}class qZ extends ja{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Mn("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class B7{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=j_(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Df{constructor(e){this.view=e,this.items=[];let n=s=>{if(s.keyCode==27)z7(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],l=O_(i.actions);for(let c=0;c{for(let i=0;iz7(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(ri).selected;if(!e)return-1;for(let n=0;n{for(let m of h.diagnostics){if(l.has(m))continue;l.add(m);let p=-1,x;for(let v=r;vr&&(this.items.splice(r,p-r),s=!0)),n&&x.diagnostic==n.diagnostic?x.dom.hasAttribute("aria-selected")||(x.dom.setAttribute("aria-selected","true"),i=x):x.dom.hasAttribute("aria-selected")&&x.dom.removeAttribute("aria-selected"),r++}});r({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:c,panel:d})=>{let h=d.height/this.list.offsetHeight;c.topd.bottom&&(this.list.scrollTop+=(c.bottom-d.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(ri),r=xd(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:k_.of(r)})}static open(e){return new Df(e)}}function FZ(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function wp(t){return FZ(``,'width="6" height="3"')}const QZ=qe.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:wp("#d11")},".cm-lintRange-warning":{backgroundImage:wp("orange")},".cm-lintRange-info":{backgroundImage:wp("#999")},".cm-lintRange-hint":{backgroundImage:wp("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function $Z(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function HZ(t){let e="hint",n=1;for(let r of t){let s=$Z(r.severity);s>n&&(n=s,e=r.severity)}return e}const UZ=[ri,qe.decorations.compute([ri],t=>{let{selected:e,panel:n}=t.field(ri);return!e||!n||e.from==e.to?Je.none:Je.set([RZ.range(e.from,e.to)])}),NG(zZ,{hideOn:_Z}),QZ];var L7=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(kZ)),e.defaultKeymap!==!1&&(r=r.concat(aK)),e.searchKeymap!==!1&&(r=r.concat(_K)),e.historyKeymap!==!1&&(r=r.concat(fY)),e.foldKeymap!==!1&&(r=r.concat(kX)),e.completionKeymap!==!1&&(r=r.concat(w_)),e.lintKeymap!==!1&&(r=r.concat(IZ));var s=[];return e.lineNumbers!==!1&&s.push(BG()),e.highlightActiveLineGutter!==!1&&s.push(qG()),e.highlightSpecialChars!==!1&&s.push(tG()),e.history!==!1&&s.push(sY()),e.foldGutter!==!1&&s.push(CX()),e.drawSelection!==!1&&s.push(HW()),e.dropCursor!==!1&&s.push(XW()),e.allowMultipleSelections!==!1&&s.push(Vt.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(mX()),e.syntaxHighlighting!==!1&&s.push(hE(EX,{fallback:!0})),e.bracketMatching!==!1&&s.push(LX()),e.closeBrackets!==!1&&s.push(yZ()),e.autocompletion!==!1&&s.push(MZ()),e.rectangularSelection!==!1&&s.push(pG()),n!==!1&&s.push(vG()),e.highlightActiveLine!==!1&&s.push(lG()),e.highlightSelectionMatches!==!1&&s.push(fK()),e.tabSize&&typeof e.tabSize=="number"&&s.push(u0.of(" ".repeat(e.tabSize))),s.concat([o0.of(r.flat())]).filter(Boolean)};const VZ="#e5c07b",I7="#e06c75",WZ="#56b6c2",GZ="#ffffff",sg="#abb2bf",o4="#7d8799",XZ="#61afef",YZ="#98c379",q7="#d19a66",KZ="#c678dd",ZZ="#21252b",F7="#2c313a",Q7="#282c34",eb="#353a42",JZ="#3E4451",$7="#528bff",eJ=qe.theme({"&":{color:sg,backgroundColor:Q7},".cm-content":{caretColor:$7},".cm-cursor, .cm-dropCursor":{borderLeftColor:$7},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:JZ},".cm-panels":{backgroundColor:ZZ,color:sg},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Q7,color:o4,border:"none"},".cm-activeLineGutter":{backgroundColor:F7},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:eb},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:eb,borderBottomColor:eb},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:F7,color:sg}}},{dark:!0}),tJ=h0.define([{tag:he.keyword,color:KZ},{tag:[he.name,he.deleted,he.character,he.propertyName,he.macroName],color:I7},{tag:[he.function(he.variableName),he.labelName],color:XZ},{tag:[he.color,he.constant(he.name),he.standard(he.name)],color:q7},{tag:[he.definition(he.name),he.separator],color:sg},{tag:[he.typeName,he.className,he.number,he.changed,he.annotation,he.modifier,he.self,he.namespace],color:VZ},{tag:[he.operator,he.operatorKeyword,he.url,he.escape,he.regexp,he.link,he.special(he.string)],color:WZ},{tag:[he.meta,he.comment],color:o4},{tag:he.strong,fontWeight:"bold"},{tag:he.emphasis,fontStyle:"italic"},{tag:he.strikethrough,textDecoration:"line-through"},{tag:he.link,color:o4,textDecoration:"underline"},{tag:he.heading,fontWeight:"bold",color:I7},{tag:[he.atom,he.bool,he.special(he.variableName)],color:q7},{tag:[he.processingInstruction,he.string,he.inserted],color:YZ},{tag:he.invalid,color:GZ}]),N_=[eJ,hE(tJ)];var nJ=qe.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),rJ=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:i="light",placeholder:l="",basicSetup:c=!0}=e,d=[];switch(n&&d.unshift(o0.of([lK])),c&&(typeof c=="boolean"?d.unshift(L7()):d.unshift(L7(c))),l&&d.unshift(dG(l)),i){case"light":d.push(nJ);break;case"dark":d.push(N_);break;case"none":break;default:d.push(i);break}return r===!1&&d.push(qe.editable.of(!1)),s&&d.push(Vt.readOnly.of(!0)),[...d]},sJ=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class iJ{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class H7{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var tb=null,aJ=()=>typeof window>"u"?new H7:(tb||(tb=new H7),tb),U7=ka.define(),lJ=200,oJ=[];function cJ(t){var{value:e,selection:n,onChange:r,onStatistics:s,onCreateEditor:i,onUpdate:l,extensions:c=oJ,autoFocus:d,theme:h="light",height:m=null,minHeight:p=null,maxHeight:x=null,width:v=null,minWidth:b=null,maxWidth:k=null,placeholder:O="",editable:j=!0,readOnly:T=!1,indentWithTab:A=!0,basicSetup:_=!0,root:D,initialState:E}=t,[z,Q]=S.useState(),[F,L]=S.useState(),[U,V]=S.useState(),ce=S.useState(()=>({current:null}))[0],W=S.useState(()=>({current:null}))[0],J=qe.theme({"&":{height:m,minHeight:p,maxHeight:x,width:v,minWidth:b,maxWidth:k},"& .cm-scroller":{height:"100% !important"}}),$=qe.updateListener.of(ue=>{if(ue.docChanged&&typeof r=="function"&&!ue.transactions.some(Y=>Y.annotation(U7))){ce.current?ce.current.reset():(ce.current=new iJ(()=>{if(W.current){var Y=W.current;W.current=null,Y()}ce.current=null},lJ),aJ().add(ce.current));var R=ue.state.doc,me=R.toString();r(me,ue)}s&&s(sJ(ue))}),ae=rJ({theme:h,editable:j,readOnly:T,placeholder:O,indentWithTab:A,basicSetup:_}),ne=[$,J,...ae];return l&&typeof l=="function"&&ne.push(qe.updateListener.of(l)),ne=ne.concat(c),S.useLayoutEffect(()=>{if(z&&!U){var ue={doc:e,selection:n,extensions:ne},R=E?Vt.fromJSON(E.json,ue,E.fields):Vt.create(ue);if(V(R),!F){var me=new qe({state:R,parent:z,root:D});L(me),i&&i(me,R)}}return()=>{F&&(V(void 0),L(void 0))}},[z,U]),S.useEffect(()=>{t.container&&Q(t.container)},[t.container]),S.useEffect(()=>()=>{F&&(F.destroy(),L(void 0)),ce.current&&(ce.current.cancel(),ce.current=null)},[F]),S.useEffect(()=>{d&&F&&F.focus()},[d,F]),S.useEffect(()=>{F&&F.dispatch({effects:vt.reconfigure.of(ne)})},[h,c,m,p,x,v,b,k,O,j,T,A,_,r,l]),S.useEffect(()=>{if(e!==void 0){var ue=F?F.state.doc.toString():"";if(F&&e!==ue){var R=ce.current&&!ce.current.isDone,me=()=>{F&&e!==F.state.doc.toString()&&F.dispatch({changes:{from:0,to:F.state.doc.toString().length,insert:e||""},annotations:[U7.of(!0)]})};R?W.current=me:me()}}},[e,F]),{state:U,setState:V,view:F,setView:L,container:z,setContainer:Q}}var uJ=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],C_=S.forwardRef((t,e)=>{var{className:n,value:r="",selection:s,extensions:i=[],onChange:l,onStatistics:c,onCreateEditor:d,onUpdate:h,autoFocus:m,theme:p="light",height:x,minHeight:v,maxHeight:b,width:k,minWidth:O,maxWidth:j,basicSetup:T,placeholder:A,indentWithTab:_,editable:D,readOnly:E,root:z,initialState:Q}=t,F=VI(t,uJ),L=S.useRef(null),{state:U,view:V,container:ce,setContainer:W}=cJ({root:z,value:r,autoFocus:m,theme:p,height:x,minHeight:v,maxHeight:b,width:k,minWidth:O,maxWidth:j,basicSetup:T,placeholder:A,indentWithTab:_,editable:D,readOnly:E,selection:s,onChange:l,onStatistics:c,onCreateEditor:d,onUpdate:h,extensions:i,initialState:Q});S.useImperativeHandle(e,()=>({editor:L.current,state:U,view:V}),[L,ce,U,V]);var J=S.useCallback(ae=>{L.current=ae,W(ae)},[W]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var $=typeof p=="string"?"cm-theme-"+p:"cm-theme";return a.jsx("div",WI({ref:J,className:""+$+(n?" "+n:"")},F))});C_.displayName="CodeMirror";var V7={};class Qg{constructor(e,n,r,s,i,l,c,d,h,m=0,p){this.p=e,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=l,this.buffer=c,this.bufferBase=d,this.curContext=h,this.lookAhead=m,this.parent=p}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let s=e.parser.context;return new Qg(e,[],n,r,r,0,[],0,s?new W7(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,s=e&65535,{parser:i}=this.p,l=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=m):this.p.lastBigReductionSized;)this.stack.pop();this.reduceContext(s,h)}storeNode(e,n,r,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&l.buffer[c-4]==0&&l.buffer[c-1]>-1){if(n==r)return;if(l.buffer[c-2]>=n){l.buffer[c-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,s);else{let l=this.buffer.length;if(l>0&&(this.buffer[l-4]!=0||this.buffer[l-1]<0)){let c=!1;for(let d=l;d>0&&this.buffer[d-2]>r;d-=4)if(this.buffer[d-1]>=0){c=!0;break}if(c)for(;l>0&&this.buffer[l-2]>r;)this.buffer[l]=this.buffer[l-4],this.buffer[l+1]=this.buffer[l-3],this.buffer[l+2]=this.buffer[l-2],this.buffer[l+3]=this.buffer[l-1],l-=4,s>4&&(s-=4)}this.buffer[l]=e,this.buffer[l+1]=n,this.buffer[l+2]=r,this.buffer[l+3]=s}}shift(e,n,r,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:l}=this.p;(s>this.pos||n<=l.maxNode)&&(this.pos=s,l.stateFlag(i,1)||(this.reducePos=s)),this.pushState(i,r),this.shiftContext(n,r),n<=l.maxNode&&this.buffer.push(n,r,s,4)}else this.pos=s,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,s,4)}apply(e,n,r,s){e&65536?this.reduce(e):this.shift(e,n,r,s)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(n,s),this.buffer.push(r,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),s=e.bufferBase+n;for(;e&&s==e.bufferBase;)e=e.parent;return new Qg(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new dJ(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let s=[];for(let i=0,l;id&1&&c==l)||s.push(n[i],l)}n=s}let r=[];for(let s=0;s>19,s=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let l=this.findForcedReduction();if(l==null)return!1;n=l}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(s,i)=>{if(!n.includes(s))return n.push(s),e.allActions(s,l=>{if(!(l&393216))if(l&65536){let c=(l>>19)-i;if(c>1){let d=l&65535,h=this.stack.length-c*3;if(h>=0&&e.getGoto(this.stack[h],d,!1)>=0)return c<<19|65536|d}}else{let c=r(l,i+1);if(c!=null)return c}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;nthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class W7{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class dJ{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=s}}class $g{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new $g(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new $g(this.stack,this.pos,this.index)}}function Sp(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r=92&&l--,l>=34&&l--;let d=l-32;if(d>=46&&(d-=46,c=!0),i+=d,c)break;i*=46}n?n[s++]=i:n=new e(i)}return n}class ig{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const G7=new ig;class hJ{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=G7,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,s=this.rangeIndex,i=this.pos+e;for(;ir.to:i>=r.to;){if(s==this.ranges.length-1)return null;let l=this.ranges[++s];i+=l.from-r.to,r=l}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n=this.chunk2Pos&&rc.to&&(this.chunk2=this.chunk2.slice(0,c.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=G7,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let s of this.ranges){if(s.from>=n)break;s.to>e&&(r+=this.input.read(Math.max(s.from,e),Math.min(s.to,n)))}return r}}class Zu{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;fJ(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Zu.prototype.contextual=Zu.prototype.fallback=Zu.prototype.extend=!1;Zu.prototype.fallback=Zu.prototype.extend=!1;class Rx{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function fJ(t,e,n,r,s,i){let l=0,c=1<0){let b=t[v];if(d.allows(b)&&(e.token.value==-1||e.token.value==b||mJ(b,e.token.value,s,i))){e.acceptToken(b);break}}let m=e.next,p=0,x=t[l+2];if(e.next<0&&x>p&&t[h+x*3-3]==65535){l=t[h+x*3-1];continue e}for(;p>1,b=h+v+(v<<1),k=t[b],O=t[b+1]||65536;if(m=O)p=v+1;else{l=t[b+2],e.advance();continue e}}break}}function X7(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function mJ(t,e,n,r){let s=X7(n,r,e);return s<0||X7(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class pJ{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Y7(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Y7(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=l,null;if(i instanceof Dn){if(l==e){if(l=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(l),this.index.push(0))}else this.index[n]++,this.nextStart=l+i.length}}}class gJ{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new ig)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,l=s.stateSlot(e.state,3),c=e.curContext?e.curContext.hash:0,d=0;for(let h=0;hp.end+25&&(d=Math.max(p.lookAhead,d)),p.value!=0)){let x=n;if(p.extended>-1&&(n=this.addActions(e,p.extended,p.end,n)),n=this.addActions(e,p.value,p.end,n),!m.extend&&(r=p,n>x))break}}for(;this.actions.length>n;)this.actions.pop();return d&&e.setLookAhead(d),!r&&e.pos==this.stream.end&&(r=new ig,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new ig,{pos:r,p:s}=e;return n.start=r,n.end=Math.min(r+1,s.stream.end),n.value=r==s.stream.end?s.parser.eofTerm:0,n}updateCachedToken(e,n,r){let s=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(s,e),r),e.value>-1){let{parser:i}=r.p;for(let l=0;l=0&&r.p.parser.dialect.allows(c>>1)){(c&1)==0?e.value=c>>1:e.extended=c>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;ie.bufferLength*4?new pJ(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],s,i;if(this.bigReductionCount>300&&e.length==1){let[l]=e;for(;l.forceReduce()&&l.stack.length&&l.stack[l.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let l=0;ln)r.push(c);else{if(this.advanceStack(c,r,e))continue;{s||(s=[],i=[]),s.push(c);let d=this.tokens.getMainToken(c);i.push(d.value,d.end)}}break}}if(!r.length){let l=s&&bJ(s);if(l)return Ks&&console.log("Finish with "+this.stackID(l)),this.stackToTree(l);if(this.parser.strict)throw Ks&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&s){let l=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,r);if(l)return Ks&&console.log("Force-finish "+this.stackID(l)),this.stackToTree(l.forceAll())}if(this.recovering){let l=this.recovering==1?1:this.recovering*3;if(r.length>l)for(r.sort((c,d)=>d.score-c.score);r.length>l;)r.pop();r.some(c=>c.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let l=0;l500&&h.buffer.length>500)if((c.score-h.score||c.buffer.length-h.buffer.length)>0)r.splice(d--,1);else{r.splice(l--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let l=1;l ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,m=h?e.curContext.hash:0;for(let p=this.fragments.nodeAt(s);p;){let x=this.parser.nodeSet.types[p.type.id]==p.type?i.getGoto(e.state,p.type.id):-1;if(x>-1&&p.length&&(!h||(p.prop(Et.contextHash)||0)==m))return e.useNode(p,x),Ks&&console.log(l+this.stackID(e)+` (via reuse of ${i.getName(p.type.id)})`),!0;if(!(p instanceof Dn)||p.children.length==0||p.positions[0]>0)break;let v=p.children[0];if(v instanceof Dn&&p.positions[0]==0)p=v;else break}}let c=i.stateSlot(e.state,4);if(c>0)return e.reduce(c),Ks&&console.log(l+this.stackID(e)+` (via always-reduce ${i.getName(c&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let d=this.tokens.getActions(e);for(let h=0;hs?n.push(b):r.push(b)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return K7(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let l=0;l ":"";if(c.deadEnd&&(i||(i=!0,c.restart(),Ks&&console.log(m+this.stackID(c)+" (restarted)"),this.advanceFully(c,r))))continue;let p=c.split(),x=m;for(let v=0;v<10&&p.forceReduce()&&(Ks&&console.log(x+this.stackID(p)+" (via force-reduce)"),!this.advanceFully(p,r));v++)Ks&&(x=this.stackID(p)+" -> ");for(let v of c.recoverByInsert(d))Ks&&console.log(m+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,r);this.stream.end>c.pos?(h==c.pos&&(h++,d=0),c.recoverByDelete(d,h),Ks&&console.log(m+this.stackID(c)+` (via recover-delete ${this.parser.getName(d)})`),K7(c,r)):(!s||s.scoret;class yJ{constructor(e){this.start=e.start,this.shift=e.shift||rb,this.reduce=e.reduce||rb,this.reuse=e.reuse||rb,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Rf extends Bw{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let c=0;ce.topRules[c][1]),s=[];for(let c=0;c=0)i(m,d,c[h++]);else{let p=c[h+-m];for(let x=-m;x>0;x--)i(c[h++],d,p);h++}}}this.nodeSet=new jx(n.map((c,d)=>gs.define({name:d>=this.minRepeatTerm?void 0:c,id:d,props:s[d],top:r.indexOf(d)>-1,error:d==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(d)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=VM;let l=Sp(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let c=0;ctypeof c=="number"?new Zu(l,c):c),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let s=new xJ(this,e,n,r);for(let i of this.wrappers)s=i(s,e,n,r);return s}getGoto(e,n,r=!1){let s=this.goto;if(n>=s[0])return-1;for(let i=s[n+1];;){let l=s[i++],c=l&1,d=s[i++];if(c&&r)return d;for(let h=i+(l>>1);i0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),s=r?n(r):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=rl(this.data,i+2);else break;s=n(rl(this.data,i+1))}return s}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=rl(this.data,r+2);else break;if((this.data[r+2]&1)==0){let s=this.data[r+1];n.some((i,l)=>l&1&&i==s)||n.push(this.data[r],s)}}return n}configure(e){let n=Object.assign(Object.create(Rf.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let s=e.tokenizers.find(i=>i.from==r);return s?s.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,s)=>{let i=e.specializers.find(c=>c.from==r.external);if(!i)return r;let l=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=Z7(l),l})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let l=n.indexOf(i);l>=0&&(r[l]=!0)}let s=null;for(let i=0;ir)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}const wJ=1,T_=194,A_=195,SJ=196,J7=197,kJ=198,OJ=199,jJ=200,NJ=2,M_=3,e8=201,CJ=24,TJ=25,AJ=49,MJ=50,EJ=55,_J=56,DJ=57,RJ=59,zJ=60,PJ=61,BJ=62,LJ=63,IJ=65,qJ=238,FJ=71,QJ=241,$J=242,HJ=243,UJ=244,VJ=245,WJ=246,GJ=247,XJ=248,E_=72,YJ=249,KJ=250,ZJ=251,JJ=252,eee=253,tee=254,nee=255,ree=256,see=73,iee=77,aee=263,lee=112,oee=130,cee=151,uee=152,dee=155,jc=10,zf=13,a5=32,zx=9,l5=35,hee=40,fee=46,c4=123,t8=125,__=39,D_=34,n8=92,mee=111,pee=120,gee=78,xee=117,vee=85,yee=new Set([TJ,AJ,MJ,aee,IJ,oee,_J,DJ,qJ,BJ,LJ,E_,see,iee,zJ,PJ,cee,uee,dee,lee]);function sb(t){return t==jc||t==zf}function ib(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}const bee=new Rx((t,e)=>{let n;if(t.next<0)t.acceptToken(OJ);else if(e.context.flags&ag)sb(t.next)&&t.acceptToken(kJ,1);else if(((n=t.peek(-1))<0||sb(n))&&e.canShift(J7)){let r=0;for(;t.next==a5||t.next==zx;)t.advance(),r++;(t.next==jc||t.next==zf||t.next==l5)&&t.acceptToken(J7,-r)}else sb(t.next)&&t.acceptToken(SJ,1)},{contextual:!0}),wee=new Rx((t,e)=>{let n=e.context;if(n.flags)return;let r=t.peek(-1);if(r==jc||r==zf){let s=0,i=0;for(;;){if(t.next==a5)s++;else if(t.next==zx)s+=8-s%8;else break;t.advance(),i++}s!=n.indent&&t.next!=jc&&t.next!=zf&&t.next!=l5&&(s[t,e|R_])),Oee=new yJ({start:See,reduce(t,e,n,r){return t.flags&ag&&yee.has(e)||(e==FJ||e==E_)&&t.flags&R_?t.parent:t},shift(t,e,n,r){return e==T_?new lg(t,kee(r.read(r.pos,n.pos)),0):e==A_?t.parent:e==CJ||e==EJ||e==RJ||e==M_?new lg(t,0,ag):r8.has(e)?new lg(t,0,r8.get(e)|t.flags&ag):t},hash(t){return t.hash}}),jee=new Rx(t=>{for(let e=0;e<5;e++){if(t.next!="print".charCodeAt(e))return;t.advance()}if(!/\w/.test(String.fromCharCode(t.next)))for(let e=0;;e++){let n=t.peek(e);if(!(n==a5||n==zx)){n!=hee&&n!=fee&&n!=jc&&n!=zf&&n!=l5&&t.acceptToken(wJ);return}}}),Nee=new Rx((t,e)=>{let{flags:n}=e.context,r=n&Ja?D_:__,s=(n&el)>0,i=!(n&tl),l=(n&nl)>0,c=t.pos;for(;!(t.next<0);)if(l&&t.next==c4)if(t.peek(1)==c4)t.advance(2);else{if(t.pos==c){t.acceptToken(M_,1);return}break}else if(i&&t.next==n8){if(t.pos==c){t.advance();let d=t.next;d>=0&&(t.advance(),Cee(t,d)),t.acceptToken(NJ);return}break}else if(t.next==n8&&!i&&t.peek(1)>-1)t.advance(2);else if(t.next==r&&(!s||t.peek(1)==r&&t.peek(2)==r)){if(t.pos==c){t.acceptToken(e8,s?3:1);return}break}else if(t.next==jc){if(s)t.advance();else if(t.pos==c){t.acceptToken(e8);return}break}else t.advance();t.pos>c&&t.acceptToken(jJ)});function Cee(t,e){if(e==mee)for(let n=0;n<2&&t.next>=48&&t.next<=55;n++)t.advance();else if(e==pee)for(let n=0;n<2&&ib(t.next);n++)t.advance();else if(e==xee)for(let n=0;n<4&&ib(t.next);n++)t.advance();else if(e==vee)for(let n=0;n<8&&ib(t.next);n++)t.advance();else if(e==gee&&t.next==c4){for(t.advance();t.next>=0&&t.next!=t8&&t.next!=__&&t.next!=D_&&t.next!=jc;)t.advance();t.next==t8&&t.advance()}}const Tee=Lw({'async "*" "**" FormatConversion FormatSpec':he.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":he.controlKeyword,"in not and or is del":he.operatorKeyword,"from def class global nonlocal lambda":he.definitionKeyword,import:he.moduleKeyword,"with as print":he.keyword,Boolean:he.bool,None:he.null,VariableName:he.variableName,"CallExpression/VariableName":he.function(he.variableName),"FunctionDefinition/VariableName":he.function(he.definition(he.variableName)),"ClassDefinition/VariableName":he.definition(he.className),PropertyName:he.propertyName,"CallExpression/MemberExpression/PropertyName":he.function(he.propertyName),Comment:he.lineComment,Number:he.number,String:he.string,FormatString:he.special(he.string),Escape:he.escape,UpdateOp:he.updateOperator,"ArithOp!":he.arithmeticOperator,BitOp:he.bitwiseOperator,CompareOp:he.compareOperator,AssignOp:he.definitionOperator,Ellipsis:he.punctuation,At:he.meta,"( )":he.paren,"[ ]":he.squareBracket,"{ }":he.brace,".":he.derefOperator,", ;":he.separator}),Aee={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},Mee=Rf.deserialize({version:14,states:"##jO`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[jee,wee,bee,Nee,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:t=>Aee[t]||-1}],tokenPrec:7668}),s8=new WG,z_=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function kp(t){return(e,n,r)=>{if(r)return!1;let s=e.node.getChild("VariableName");return s&&n(s,t),!0}}const Eee={FunctionDefinition:kp("function"),ClassDefinition:kp("class"),ForStatement(t,e,n){if(n){for(let r=t.node.firstChild;r;r=r.nextSibling)if(r.name=="VariableName")e(r,"variable");else if(r.name=="in")break}},ImportStatement(t,e){var n,r;let{node:s}=t,i=((n=s.firstChild)===null||n===void 0?void 0:n.name)=="from";for(let l=s.getChild("import");l;l=l.nextSibling)l.name=="VariableName"&&((r=l.nextSibling)===null||r===void 0?void 0:r.name)!="as"&&e(l,i?"variable":"namespace")},AssignStatement(t,e){for(let n=t.node.firstChild;n;n=n.nextSibling)if(n.name=="VariableName")e(n,"variable");else if(n.name==":"||n.name=="AssignOp")break},ParamList(t,e){for(let n=null,r=t.node.firstChild;r;r=r.nextSibling)r.name=="VariableName"&&(!n||!/\*|AssignOp/.test(n.name))&&e(r,"variable"),n=r},CapturePattern:kp("variable"),AsPattern:kp("variable"),__proto__:null};function P_(t,e){let n=s8.get(e);if(n)return n;let r=[],s=!0;function i(l,c){let d=t.sliceString(l.from,l.to);r.push({label:d,type:c})}return e.cursor(Or.IncludeAnonymous).iterate(l=>{if(l.name){let c=Eee[l.name];if(c&&c(l,i,s)||!s&&z_.has(l.name))return!1;s=!1}else if(l.to-l.from>8192){for(let c of P_(t,l.node))r.push(c);return!1}}),s8.set(e,r),r}const i8=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,B_=["String","FormatString","Comment","PropertyName"];function _ee(t){let e=zr(t.state).resolveInner(t.pos,-1);if(B_.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&i8.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let s=e;s;s=s.parent)z_.has(s.name)&&(r=r.concat(P_(t.state.doc,s)));return{options:r,from:n?e.from:t.pos,validFor:i8}}const Dee=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(t=>({label:t,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(t=>({label:t,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(t=>({label:t,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(t=>({label:t,type:"function"}))),Ree=[Ya("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),Ya("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),Ya("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),Ya("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),Ya(`if \${}: -`,{label:"if",detail:"block",type:"keyword"}),Ya("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),Ya("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),Ya("import ${module}",{label:"import",detail:"statement",type:"keyword"}),Ya("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],zee=BK(B_,d_(Dee.concat(Ree)));function ab(t){let{node:e,pos:n}=t,r=t.lineIndent(n,-1),s=null;for(;;){let i=e.childBefore(n);if(i)if(i.name=="Comment")n=i.from;else if(i.name=="Body"||i.name=="MatchBody")t.baseIndentFor(i)+t.unit<=r&&(s=i),e=i;else if(i.name=="MatchClause")e=i;else if(i.type.is("Statement"))e=i;else break;else break}return s}function lb(t,e){let n=t.baseIndentFor(e),r=t.lineAt(t.pos,-1),s=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&t.node.ton?null:n+t.unit}const ob=jf.define({name:"python",parser:Mee.configure({props:[Cx.add({Body:t=>{var e;let n=/^\s*(#|$)/.test(t.textAfter)&&ab(t)||t.node;return(e=lb(t,n))!==null&&e!==void 0?e:t.continue()},MatchBody:t=>{var e;let n=ab(t);return(e=lb(t,n||t.node))!==null&&e!==void 0?e:t.continue()},IfStatement:t=>/^\s*(else:|elif )/.test(t.textAfter)?t.baseIndent:t.continue(),"ForStatement WhileStatement":t=>/^\s*else:/.test(t.textAfter)?t.baseIndent:t.continue(),TryStatement:t=>/^\s*(except[ :]|finally:|else:)/.test(t.textAfter)?t.baseIndent:t.continue(),MatchStatement:t=>/^\s*case /.test(t.textAfter)?t.baseIndent+t.unit:t.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":Hy({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Hy({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Hy({closing:"]"}),MemberExpression:t=>t.baseIndent+t.unit,"String FormatString":()=>null,Script:t=>{var e;let n=ab(t);return(e=n&&lb(t,n))!==null&&e!==void 0?e:t.continue()}}),Fw.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":rE,Body:(t,e)=>({from:t.from+1,to:t.to-(t.to==e.doc.length?0:1)}),"String FormatString":(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function Pee(){return new eE(ob,[ob.data.of({autocomplete:_ee}),ob.data.of({autocomplete:zee})])}const Bee=Lw({String:he.string,Number:he.number,"True False":he.bool,PropertyName:he.propertyName,Null:he.null,", :":he.separator,"[ ]":he.squareBracket,"{ }":he.brace}),Lee=Rf.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[Bee],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Iee=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=qee(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function qee(t,e){let n;return(n=t.message.match(/at position (\d+)/))?Math.min(+n[1],e.length):(n=t.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+n[1]).from+ +n[2]-1,e.length):0}const Fee=jf.define({name:"json",parser:Lee.configure({props:[Cx.add({Object:a7({except:/^\s*\}/}),Array:a7({except:/^\s*\]/})}),Fw.add({"Object Array":rE})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Qee(){return new eE(Fee)}const $ee={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(t,e){let n;if(!e.inString&&(n=t.match(/^('''|"""|'|")/))&&(e.stringType=n[0],e.inString=!0),t.sol()&&!e.inString&&e.inArray===0&&(e.lhs=!0),e.inString){for(;e.inString;)if(t.match(e.stringType))e.inString=!1;else if(t.peek()==="\\")t.next(),t.next();else{if(t.eol())break;t.match(/^.[^\\\"\']*/)}return e.lhs?"property":"string"}else{if(e.inArray&&t.peek()==="]")return t.next(),e.inArray--,"bracket";if(e.lhs&&t.peek()==="["&&t.skipTo("]"))return t.next(),t.peek()==="]"&&t.next(),"atom";if(t.peek()==="#")return t.skipToEnd(),"comment";if(t.eatSpace())return null;if(e.lhs&&t.eatWhile(function(r){return r!="="&&r!=" "}))return"property";if(e.lhs&&t.peek()==="=")return t.next(),e.lhs=!1,null;if(!e.lhs&&t.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!e.lhs&&(t.match("true")||t.match("false")))return"atom";if(!e.lhs&&t.peek()==="[")return e.inArray++,t.next(),"bracket";if(!e.lhs&&t.match(/^\-?\d+(?:\.\d+)?/))return"number";t.eatSpace()||t.next()}return null},languageData:{commentTokens:{line:"#"}}},Hee={python:[Pee()],json:[Qee(),Iee()],toml:[Qw.define($ee)],text:[]};function Uee({value:t,onChange:e,language:n="text",readOnly:r=!1,height:s="400px",minHeight:i,maxHeight:l,placeholder:c,theme:d="dark",className:h=""}){const[m,p]=S.useState(!1);if(S.useEffect(()=>{p(!0)},[]),!m)return a.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${h}`,style:{height:s,minHeight:i,maxHeight:l}});const x=[...Hee[n]||[],qe.lineWrapping];return r&&x.push(qe.editable.of(!1)),a.jsx("div",{className:`rounded-md overflow-hidden border ${h}`,children:a.jsx(C_,{value:t,height:s,minHeight:i,maxHeight:l,theme:d==="dark"?N_:void 0,extensions:x,onChange:e,placeholder:c,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function Vee(){const[t,e]=S.useState(!0),[n,r]=S.useState(!1),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState("visual"),[b,k]=S.useState(""),[O,j]=S.useState(!1),{toast:T}=Pr(),[A,_]=S.useState(null),[D,E]=S.useState(null),[R,Q]=S.useState(null),[F,L]=S.useState(null),[U,V]=S.useState(null),[de,W]=S.useState(null),[J,$]=S.useState(null),[ae,ne]=S.useState(null),[ce,z]=S.useState(null),[xe,Y]=S.useState(null),[P,K]=S.useState(null),[H,fe]=S.useState(null),[ve,Re]=S.useState(null),[ue,We]=S.useState(null),[ct,Oe]=S.useState(null),[nt,ut]=S.useState(null),[Ct,In]=S.useState(null),[Tn,Jn]=S.useState(null),nn=S.useRef(null),_t=S.useRef(!0),Yr=S.useRef({}),qn=S.useCallback(async()=>{try{const re=await RU();k(re),j(!1)}catch(re){T({variant:"destructive",title:"加载失败",description:re instanceof Error?re.message:"加载源代码失败"})}},[T]),or=S.useCallback(async()=>{try{e(!0);const re=await DU();Yr.current=re,_(re.bot),E(re.personality);const Ae=re.chat;Ae.talk_value_rules||(Ae.talk_value_rules=[]),Q(Ae),L(re.expression),V(re.emoji),W(re.memory),$(re.tool),ne(re.mood),z(re.voice),Y(re.lpmm_knowledge),K(re.keyword_reaction),fe(re.response_post_process),Re(re.chinese_typo),We(re.response_splitter),Oe(re.log),ut(re.debug),In(re.maim_message),Jn(re.telemetry),c(!1),_t.current=!1,await qn()}catch(re){console.error("加载配置失败:",re),T({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{e(!1)}},[T,qn]);S.useEffect(()=>{or()},[or]);const yn=S.useCallback(async(re,Ae)=>{if(!_t.current)try{i(!0),await PU(re,Ae),c(!1)}catch(pt){console.error(`自动保存 ${re} 失败:`,pt),c(!0)}finally{i(!1)}},[]),ft=S.useCallback((re,Ae)=>{_t.current||(c(!0),nn.current&&clearTimeout(nn.current),nn.current=setTimeout(()=>{yn(re,Ae)},2e3))},[yn]);S.useEffect(()=>{A&&!_t.current&&ft("bot",A)},[A,ft]),S.useEffect(()=>{D&&!_t.current&&ft("personality",D)},[D,ft]),S.useEffect(()=>{R&&!_t.current&&ft("chat",R)},[R,ft]),S.useEffect(()=>{F&&!_t.current&&ft("expression",F)},[F,ft]),S.useEffect(()=>{U&&!_t.current&&ft("emoji",U)},[U,ft]),S.useEffect(()=>{de&&!_t.current&&ft("memory",de)},[de,ft]),S.useEffect(()=>{J&&!_t.current&&ft("tool",J)},[J,ft]),S.useEffect(()=>{ae&&!_t.current&&ft("mood",ae)},[ae,ft]),S.useEffect(()=>{ce&&!_t.current&&ft("voice",ce)},[ce,ft]),S.useEffect(()=>{xe&&!_t.current&&ft("lpmm_knowledge",xe)},[xe,ft]),S.useEffect(()=>{P&&!_t.current&&ft("keyword_reaction",P)},[P,ft]),S.useEffect(()=>{H&&!_t.current&&ft("response_post_process",H)},[H,ft]),S.useEffect(()=>{ve&&!_t.current&&ft("chinese_typo",ve)},[ve,ft]),S.useEffect(()=>{ue&&!_t.current&&ft("response_splitter",ue)},[ue,ft]),S.useEffect(()=>{ct&&!_t.current&&ft("log",ct)},[ct,ft]),S.useEffect(()=>{nt&&!_t.current&&ft("debug",nt)},[nt,ft]),S.useEffect(()=>{Ct&&!_t.current&&ft("maim_message",Ct)},[Ct,ft]),S.useEffect(()=>{Tn&&!_t.current&&ft("telemetry",Tn)},[Tn,ft]);const ee=async()=>{try{r(!0),await zU(b),c(!1),j(!1),T({title:"保存成功",description:"配置已保存"}),await or()}catch(re){j(!0),T({variant:"destructive",title:"保存失败",description:re instanceof Error?re.message:"保存配置失败"})}finally{r(!1)}},Se=async re=>{if(l){T({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}v(re),re==="source"?await qn():await or()},Be=async()=>{try{r(!0),nn.current&&clearTimeout(nn.current);const re={...Yr.current,bot:A,personality:D,chat:R,expression:F,emoji:U,memory:de,tool:J,mood:ae,voice:ce,lpmm_knowledge:xe,keyword_reaction:P,response_post_process:H,chinese_typo:ve,response_splitter:ue,log:ct,debug:nt,maim_message:Ct,telemetry:Tn};await XO(re),c(!1),T({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(re){console.error("保存配置失败:",re),T({title:"保存失败",description:re.message,variant:"destructive"})}finally{r(!1)}},rt=async()=>{try{h(!0),xw().catch(()=>{}),p(!0)}catch(re){console.error("重启失败:",re),p(!1),T({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),h(!1)}},Tt=async()=>{try{r(!0),nn.current&&clearTimeout(nn.current);const re={...Yr.current,bot:A,personality:D,chat:R,expression:F,emoji:U,memory:de,tool:J,mood:ae,voice:ce,lpmm_knowledge:xe,keyword_reaction:P,response_post_process:H,chinese_typo:ve,response_splitter:ue,log:ct,debug:nt,maim_message:Ct,telemetry:Tn};await XO(re),c(!1),T({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(Ae=>setTimeout(Ae,500)),await rt()}catch(re){console.error("保存失败:",re),T({title:"保存失败",description:re.message,variant:"destructive"})}finally{r(!1)}},cr=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Kr=()=>{p(!1),h(!1),T({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return t?a.jsx(vn,{className:"h-full",children:a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto items-center",children:[a.jsx(hl,{value:x,onValueChange:re=>Se(re),className:"w-auto",children:a.jsxs(ya,{className:"h-9",children:[a.jsxs($t,{value:"visual",className:"text-xs sm:text-sm px-2 sm:px-3",children:[a.jsx(bq,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化"]}),a.jsxs($t,{value:"source",className:"text-xs sm:text-sm px-2 sm:px-3",children:[a.jsx(wq,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码"]})]})}),a.jsxs(ie,{onClick:x==="visual"?Be:ee,disabled:n||s||!l||d,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":s?"自动保存中...":l?"保存配置":"已保存"]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:n||s||d,size:"sm",className:"flex-1 sm:flex-none",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),d?"重启中...":l?"保存并重启":"重启麦麦"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重启麦麦?"}),a.jsx(dn,{children:l?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:l?Tt:rt,children:l?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),x==="source"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:[a.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",O&&a.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),a.jsx(Uee,{value:b,onChange:re=>{k(re),c(!0),O&&j(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),x==="visual"&&a.jsx(a.Fragment,{children:a.jsxs(hl,{defaultValue:"bot",className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:a.jsxs(ya,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[a.jsx($t,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),a.jsx($t,{value:"personality",className:"flex-shrink-0",children:"人格"}),a.jsx($t,{value:"chat",className:"flex-shrink-0",children:"聊天"}),a.jsx($t,{value:"expression",className:"flex-shrink-0",children:"表达"}),a.jsx($t,{value:"features",className:"flex-shrink-0",children:"功能"}),a.jsx($t,{value:"processing",className:"flex-shrink-0",children:"处理"}),a.jsx($t,{value:"mood",className:"flex-shrink-0",children:"情绪"}),a.jsx($t,{value:"voice",className:"flex-shrink-0",children:"语音"}),a.jsx($t,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),a.jsx($t,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),a.jsx(kn,{value:"bot",className:"space-y-4",children:A&&a.jsx(Wee,{config:A,onChange:_})}),a.jsx(kn,{value:"personality",className:"space-y-4",children:D&&a.jsx(Gee,{config:D,onChange:E})}),a.jsx(kn,{value:"chat",className:"space-y-4",children:R&&a.jsx(Xee,{config:R,onChange:Q})}),a.jsx(kn,{value:"expression",className:"space-y-4",children:F&&a.jsx(Yee,{config:F,onChange:L})}),a.jsx(kn,{value:"features",className:"space-y-4",children:U&&de&&J&&a.jsx(Kee,{emojiConfig:U,memoryConfig:de,toolConfig:J,onEmojiChange:V,onMemoryChange:W,onToolChange:$})}),a.jsx(kn,{value:"processing",className:"space-y-4",children:P&&H&&ve&&ue&&a.jsx(Zee,{keywordReactionConfig:P,responsePostProcessConfig:H,chineseTypoConfig:ve,responseSplitterConfig:ue,onKeywordReactionChange:K,onResponsePostProcessChange:fe,onChineseTypoChange:Re,onResponseSplitterChange:We})}),a.jsx(kn,{value:"mood",className:"space-y-4",children:ae&&a.jsx(Jee,{config:ae,onChange:ne})}),a.jsx(kn,{value:"voice",className:"space-y-4",children:ce&&a.jsx(ete,{config:ce,onChange:z})}),a.jsx(kn,{value:"lpmm",className:"space-y-4",children:xe&&a.jsx(tte,{config:xe,onChange:Y})}),a.jsxs(kn,{value:"other",className:"space-y-4",children:[ct&&a.jsx(nte,{config:ct,onChange:Oe}),nt&&a.jsx(rte,{config:nt,onChange:ut}),Ct&&a.jsx(ste,{config:Ct,onChange:In}),Tn&&a.jsx(ite,{config:Tn,onChange:Jn})]})]})}),m&&a.jsx(vw,{onRestartComplete:cr,onRestartFailed:Kr})]})})}function Wee({config:t,onChange:e}){const n=()=>{e({...t,platforms:[...t.platforms,""]})},r=d=>{e({...t,platforms:t.platforms.filter((h,m)=>m!==d)})},s=(d,h)=>{const m=[...t.platforms];m[d]=h,e({...t,platforms:m})},i=()=>{e({...t,alias_names:[...t.alias_names,""]})},l=d=>{e({...t,alias_names:t.alias_names.filter((h,m)=>m!==d)})},c=(d,h)=>{const m=[...t.alias_names];m[d]=h,e({...t,alias_names:m})};return a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"platform",children:"平台"}),a.jsx(Me,{id:"platform",value:t.platform,onChange:d=>e({...t,platform:d.target.value}),placeholder:"qq"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"qq_account",children:"QQ账号"}),a.jsx(Me,{id:"qq_account",value:t.qq_account,onChange:d=>e({...t,qq_account:d.target.value}),placeholder:"123456789"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称"}),a.jsx(Me,{id:"nickname",value:t.nickname,onChange:d=>e({...t,nickname:d.target.value}),placeholder:"麦麦"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"其他平台账号"}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),a.jsxs("div",{className:"space-y-2",children:[t.platforms.map((d,h)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{value:d,onChange:m=>s(h,m.target.value),placeholder:"wx:114514"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除平台账号 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(h),children:"删除"})]})]})]})]},h)),t.platforms.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"别名"}),a.jsxs(ie,{onClick:i,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),a.jsxs("div",{className:"space-y-2",children:[t.alias_names.map((d,h)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{value:d,onChange:m=>c(h,m.target.value),placeholder:"小麦"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除别名 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>l(h),children:"删除"})]})]})]})]},h)),t.alias_names.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function Gee({config:t,onChange:e}){const n=()=>{e({...t,states:[...t.states,""]})},r=i=>{e({...t,states:t.states.filter((l,c)=>c!==i)})},s=(i,l)=>{const c=[...t.states];c[i]=l,e({...t,states:c})};return a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"personality",children:"人格特质"}),a.jsx(_n,{id:"personality",value:t.personality,onChange:i=>e({...t,personality:i.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"reply_style",children:"表达风格"}),a.jsx(_n,{id:"reply_style",value:t.reply_style,onChange:i=>e({...t,reply_style:i.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"interest",children:"兴趣"}),a.jsx(_n,{id:"interest",value:t.interest,onChange:i=>e({...t,interest:i.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"plan_style",children:"说话规则与行为风格"}),a.jsx(_n,{id:"plan_style",value:t.plan_style,onChange:i=>e({...t,plan_style:i.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"visual_style",children:"识图规则"}),a.jsx(_n,{id:"visual_style",value:t.visual_style,onChange:i=>e({...t,visual_style:i.target.value}),placeholder:"识图时的处理规则",rows:3})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"private_plan_style",children:"私聊规则"}),a.jsx(_n,{id:"private_plan_style",value:t.private_plan_style,onChange:i=>e({...t,private_plan_style:i.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"状态列表(人格多样性)"}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),a.jsx("div",{className:"space-y-2",children:t.states.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(_n,{value:i,onChange:c=>s(l,c.target.value),placeholder:"描述一个人格状态",rows:2}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsx(dn,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(l),children:"删除"})]})]})]})]},l))})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"state_probability",children:"状态替换概率"}),a.jsx(Me,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:t.state_probability,onChange:i=>e({...t,state_probability:parseFloat(i.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function Xee({config:t,onChange:e}){const n=()=>{e({...t,talk_value_rules:[...t.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},r=c=>{e({...t,talk_value_rules:t.talk_value_rules.filter((d,h)=>h!==c)})},s=(c,d,h)=>{const m=[...t.talk_value_rules];m[c]={...m[c],[d]:h},e({...t,talk_value_rules:m})},i=({value:c,onChange:d})=>{const[h,m]=S.useState("00"),[p,x]=S.useState("00"),[v,b]=S.useState("23"),[k,O]=S.useState("59");S.useEffect(()=>{const T=c.split("-");if(T.length===2){const[A,_]=T,[D,E]=A.split(":"),[R,Q]=_.split(":");D&&m(D.padStart(2,"0")),E&&x(E.padStart(2,"0")),R&&b(R.padStart(2,"0")),Q&&O(Q.padStart(2,"0"))}},[c]);const j=(T,A,_,D)=>{const E=`${T}:${A}-${_}:${D}`;d(E)};return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[a.jsx(dc,{className:"h-4 w-4 mr-2"}),c||"选择时间段"]})}),a.jsx(fl,{className:"w-80",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"小时"}),a.jsxs(Lt,{value:h,onValueChange:T=>{m(T),j(T,p,v,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:24},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"分钟"}),a.jsxs(Lt,{value:p,onValueChange:T=>{x(T),j(h,T,v,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:60},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"小时"}),a.jsxs(Lt,{value:v,onValueChange:T=>{b(T),j(h,p,T,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:24},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"分钟"}),a.jsxs(Lt,{value:k,onValueChange:T=>{O(T),j(h,p,v,T)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:60},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]})]})]})]})})]})},l=({rule:c})=>{const d=`{ target = "${c.target}", time = "${c.time}", value = ${c.value.toFixed(1)} }`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-96",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:d}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),a.jsx(Me,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:t.talk_value,onChange:c=>e({...t,talk_value:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"mentioned_bot_reply",children:"提及回复增幅"}),a.jsx(Me,{id:"mentioned_bot_reply",type:"number",step:"0.1",min:"0",max:"1",value:t.mentioned_bot_reply,onChange:c=>e({...t,mentioned_bot_reply:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"提及时回复概率增幅,1 为 100% 回复"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_context_size",children:"上下文长度"}),a.jsx(Me,{id:"max_context_size",type:"number",min:"1",value:t.max_context_size,onChange:c=>e({...t,max_context_size:parseInt(c.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"planner_smooth",children:"规划器平滑"}),a.jsx(Me,{id:"planner_smooth",type:"number",step:"1",min:"0",value:t.planner_smooth,onChange:c=>e({...t,planner_smooth:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_talk_value_rules",checked:t.enable_talk_value_rules,onCheckedChange:c=>e({...t,enable_talk_value_rules:c})}),a.jsx(te,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"include_planner_reasoning",checked:t.include_planner_reasoning,onCheckedChange:c=>e({...t,include_planner_reasoning:c})}),a.jsx(te,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),t.enable_talk_value_rules&&a.jsxs("div",{className:"border-t pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),a.jsxs(ie,{onClick:n,size:"sm",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),t.talk_value_rules&&t.talk_value_rules.length>0?a.jsx("div",{className:"space-y-4",children:t.talk_value_rules.map((c,d)=>a.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",d+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(l,{rule:c}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{variant:"ghost",size:"sm",children:a.jsx(Ht,{className:"h-4 w-4 text-destructive"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除规则 #",d+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(d),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"配置类型"}),a.jsxs(Lt,{value:c.target===""?"global":"specific",onValueChange:h=>{h==="global"?s(d,"target",""):s(d,"target","qq::group")},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"global",children:"全局配置"}),a.jsx(Pe,{value:"specific",children:"详细配置"})]})]})]}),c.target!==""&&(()=>{const h=c.target.split(":"),m=h[0]||"qq",p=h[1]||"",x=h[2]||"group";return a.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"平台"}),a.jsxs(Lt,{value:m,onValueChange:v=>{s(d,"target",`${v}:${p}:${x}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"qq",children:"QQ"}),a.jsx(Pe,{value:"wx",children:"微信"})]})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"群 ID"}),a.jsx(Me,{value:p,onChange:v=>{s(d,"target",`${m}:${v.target.value}:${x}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"类型"}),a.jsxs(Lt,{value:x,onValueChange:v=>{s(d,"target",`${m}:${p}:${v}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"group",children:"群组(group)"}),a.jsx(Pe,{value:"private",children:"私聊(private)"})]})]})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",c.target||"(未设置)"]})]})})(),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"时间段 (Time)"}),a.jsx(i,{value:c.time,onChange:h=>s(d,"time",h)}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{htmlFor:`rule-value-${d}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),a.jsx(Me,{id:`rule-value-${d}`,type:"number",step:"0.01",min:"0",max:"1",value:c.value,onChange:h=>{const m=parseFloat(h.target.value);isNaN(m)||s(d,"value",Math.max(0,Math.min(1,m)))},className:"w-20 h-8 text-xs"})]}),a.jsx(yx,{value:[c.value],onValueChange:h=>s(d,"value",h[0]),min:0,max:1,step:.01,className:"w-full"}),a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:"0 (完全沉默)"}),a.jsx("span",{children:"0.5"}),a.jsx("span",{children:"1.0 (正常)"})]})]})]})]},d))}):a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:a.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),a.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[a.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),a.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function Yee({config:t,onChange:e}){const n=()=>{e({...t,learning_list:[...t.learning_list,["","enable","enable","1.0"]]})},r=x=>{e({...t,learning_list:t.learning_list.filter((v,b)=>b!==x)})},s=(x,v,b)=>{const k=[...t.learning_list];k[x][v]=b,e({...t,learning_list:k})},i=({rule:x})=>{const v=`["${x[0]}", "${x[1]}", "${x[2]}", "${x[3]}"]`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-96",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:v}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},l=({member:x,groupIndex:v,memberIndex:b,availableChatIds:k})=>{const O=k.includes(x)||x==="*",[j,T]=S.useState(!O);return a.jsxs("div",{className:"flex gap-2",children:[a.jsx("div",{className:"flex-1 flex gap-2",children:j?a.jsxs(a.Fragment,{children:[a.jsx(Me,{value:x,onChange:A=>p(v,b,A.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),k.length>0&&a.jsx(ie,{size:"sm",variant:"outline",onClick:()=>T(!1),title:"切换到下拉选择",children:"下拉"})]}):a.jsxs(a.Fragment,{children:[a.jsxs(Lt,{value:x,onValueChange:A=>p(v,b,A),children:[a.jsx(Dt,{className:"flex-1",children:a.jsx(It,{placeholder:"选择聊天流"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"*",children:"* (全局共享)"}),k.map((A,_)=>a.jsx(Pe,{value:A,children:A},_))]})]}),a.jsx(ie,{size:"sm",variant:"outline",onClick:()=>T(!0),title:"切换到手动输入",children:"输入"})]})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除组成员 "',x||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>m(v,b),children:"删除"})]})]})]})]})},c=()=>{e({...t,expression_groups:[...t.expression_groups,[]]})},d=x=>{e({...t,expression_groups:t.expression_groups.filter((v,b)=>b!==x)})},h=x=>{const v=[...t.expression_groups];v[x]=[...v[x],""],e({...t,expression_groups:v})},m=(x,v)=>{const b=[...t.expression_groups];b[x]=b[x].filter((k,O)=>O!==v),e({...t,expression_groups:b})},p=(x,v,b)=>{const k=[...t.expression_groups];k[x][v]=b,e({...t,expression_groups:k})};return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),a.jsxs("div",{className:"space-y-4",children:[t.learning_list.map((x,v)=>{const b=t.learning_list.some((_,D)=>D!==v&&_[0]===""),k=x[0]==="",O=x[0].split(":"),j=O[0]||"qq",T=O[1]||"",A=O[2]||"group";return a.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["规则 ",v+1," ",k&&"(全局配置)"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(i,{rule:x}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除学习规则 ",v+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(v),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"配置类型"}),a.jsxs(Lt,{value:k?"global":"specific",onValueChange:_=>{_==="global"?s(v,0,""):s(v,0,"qq::group")},disabled:b&&!k,children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"global",children:"全局配置"}),a.jsx(Pe,{value:"specific",disabled:b&&!k,children:"详细配置"})]})]}),b&&!k&&a.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!k&&a.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"平台"}),a.jsxs(Lt,{value:j,onValueChange:_=>{s(v,0,`${_}:${T}:${A}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"qq",children:"QQ"}),a.jsx(Pe,{value:"wx",children:"微信"})]})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"群 ID"}),a.jsx(Me,{value:T,onChange:_=>{s(v,0,`${j}:${_.target.value}:${A}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"类型"}),a.jsxs(Lt,{value:A,onValueChange:_=>{s(v,0,`${j}:${T}:${_}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"group",children:"群组(group)"}),a.jsx(Pe,{value:"private",children:"私聊(private)"})]})]})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",x[0]||"(未设置)"]})]}),a.jsx("div",{className:"grid gap-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs font-medium",children:"使用学到的表达"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),a.jsx(jt,{checked:x[1]==="enable",onCheckedChange:_=>s(v,1,_?"enable":"disable")})]})}),a.jsx("div",{className:"grid gap-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs font-medium",children:"学习表达"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),a.jsx(jt,{checked:x[2]==="enable",onCheckedChange:_=>s(v,2,_?"enable":"disable")})]})}),a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-xs font-medium",children:"学习强度"}),a.jsx(Me,{type:"number",step:"0.1",min:"0",max:"5",value:x[3],onChange:_=>{const D=parseFloat(_.target.value);isNaN(D)||s(v,3,Math.max(0,Math.min(5,D)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),a.jsx(yx,{value:[parseFloat(x[3])||1],onValueChange:_=>s(v,3,_[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:"0 (不学习)"}),a.jsx("span",{children:"2.5"}),a.jsx("span",{children:"5.0 (快速学习)"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},v)}),t.learning_list.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),a.jsxs(ie,{onClick:c,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),a.jsxs("div",{className:"space-y-4",children:[t.expression_groups.map((x,v)=>{const b=t.learning_list.map(k=>k[0]).filter(k=>k!=="");return a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",v+1,x.length===1&&x[0]==="*"&&"(全局共享)"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ie,{onClick:()=>h(v),size:"sm",variant:"outline",children:a.jsx(Wr,{className:"h-4 w-4"})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除共享组 ",v+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>d(v),children:"删除"})]})]})]})]})]}),a.jsx("div",{className:"space-y-2",children:x.map((k,O)=>a.jsx(l,{member:k,groupIndex:v,memberIndex:O,availableChatIds:b},O))}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},v)}),t.expression_groups.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function Kee({emojiConfig:t,memoryConfig:e,toolConfig:n,onEmojiChange:r,onMemoryChange:s,onToolChange:i}){return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:l=>i({...n,enable_tool:l})}),a.jsx(te,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),a.jsx(Me,{id:"max_agent_iterations",type:"number",min:"1",value:e.max_agent_iterations,onChange:l=>s({...e,max_agent_iterations:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"emoji_chance",children:"表情包激活概率"}),a.jsx(Me,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:t.emoji_chance,onChange:l=>r({...t,emoji_chance:parseFloat(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_reg_num",children:"最大注册数量"}),a.jsx(Me,{id:"max_reg_num",type:"number",min:"1",value:t.max_reg_num,onChange:l=>r({...t,max_reg_num:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),a.jsx(Me,{id:"check_interval",type:"number",min:"1",value:t.check_interval,onChange:l=>r({...t,check_interval:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"do_replace",checked:t.do_replace,onCheckedChange:l=>r({...t,do_replace:l})}),a.jsx(te,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:l=>r({...t,steal_emoji:l})}),a.jsx(te,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),a.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:l=>r({...t,content_filtration:l})}),a.jsx(te,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),t.content_filtration&&a.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[a.jsx(te,{htmlFor:"filtration_prompt",children:"过滤要求"}),a.jsx(Me,{id:"filtration_prompt",value:t.filtration_prompt,onChange:l=>r({...t,filtration_prompt:l.target.value}),placeholder:"符合公序良俗"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function Zee({keywordReactionConfig:t,responsePostProcessConfig:e,chineseTypoConfig:n,responseSplitterConfig:r,onKeywordReactionChange:s,onResponsePostProcessChange:i,onChineseTypoChange:l,onResponseSplitterChange:c}){const d=()=>{s({...t,regex_rules:[...t.regex_rules,{regex:[""],reaction:""}]})},h=_=>{s({...t,regex_rules:t.regex_rules.filter((D,E)=>E!==_)})},m=(_,D,E)=>{const R=[...t.regex_rules];D==="regex"&&typeof E=="string"?R[_]={...R[_],regex:[E]}:D==="reaction"&&typeof E=="string"&&(R[_]={...R[_],reaction:E}),s({...t,regex_rules:R})},p=({regex:_,reaction:D,onRegexChange:E,onReactionChange:R})=>{const[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,de]=S.useState(null),[W,J]=S.useState(""),[$,ae]=S.useState({}),[ne,ce]=S.useState(""),z=S.useRef(null),[xe,Y]=S.useState("build"),P=ve=>ve.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),K=(ve,Re=0)=>{const ue=z.current;if(!ue)return;const We=ue.selectionStart||0,ct=ue.selectionEnd||0,Oe=_.substring(0,We)+ve+_.substring(ct);E(Oe),setTimeout(()=>{const nt=We+ve.length+Re;ue.setSelectionRange(nt,nt),ue.focus()},0)};S.useEffect(()=>{if(!_||!L){de(null),ae({}),ce(D),J("");return}try{const ve=P(_),Re=new RegExp(ve,"g"),ue=L.match(Re);de(ue),J("");const ct=new RegExp(ve).exec(L);if(ct&&ct.groups){ae(ct.groups);let Oe=D;Object.entries(ct.groups).forEach(([nt,ut])=>{Oe=Oe.replace(new RegExp(`\\[${nt}\\]`,"g"),ut||"")}),ce(Oe)}else ae({}),ce(D)}catch(ve){J(ve.message),de(null),ae({}),ce(D)}},[_,L,D]);const H=()=>{if(!L||!V||V.length===0)return a.jsx("span",{className:"text-muted-foreground",children:L||"请输入测试文本"});try{const ve=P(_),Re=new RegExp(ve,"g");let ue=0;const We=[];let ct;for(;(ct=Re.exec(L))!==null;)ct.index>ue&&We.push(a.jsx("span",{children:L.substring(ue,ct.index)},`text-${ue}`)),We.push(a.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:ct[0]},`match-${ct.index}`)),ue=ct.index+ct[0].length;return ue)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return a.jsxs(Rr,{open:Q,onOpenChange:F,children:[a.jsx(mw,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(fg,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"正则表达式编辑器"}),a.jsx(Gr,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),a.jsx(vn,{className:"max-h-[calc(90vh-120px)]",children:a.jsxs(hl,{value:xe,onValueChange:ve=>Y(ve),className:"w-full",children:[a.jsxs(ya,{className:"grid w-full grid-cols-2",children:[a.jsx($t,{value:"build",children:"🔧 构建器"}),a.jsx($t,{value:"test",children:"🧪 测试器"})]}),a.jsxs(kn,{value:"build",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"正则表达式"}),a.jsx(Me,{ref:z,value:_,onChange:ve=>E(ve.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"Reaction 内容"}),a.jsx(_n,{value:D,onChange:ve=>R(ve.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),a.jsxs("div",{className:"space-y-4 border-t pt-4",children:[fe.map(ve=>a.jsxs("div",{className:"space-y-2",children:[a.jsx("h5",{className:"text-xs font-semibold text-primary",children:ve.category}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:ve.items.map(Re=>a.jsx(ie,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>K(Re.pattern,Re.moveCursor||0),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsxs("div",{className:"flex items-center gap-2 w-full",children:[a.jsx("span",{className:"text-xs font-medium",children:Re.label}),a.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:Re.pattern})]}),a.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:Re.desc})]})},Re.label))})]},ve.category)),a.jsxs("div",{className:"space-y-2 border-t pt-4",children:[a.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("^(?P\\S{1,20})是这样的$"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?P.+?)(?:是|为什么|怎么)"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),a.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),a.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),a.jsxs("li",{children:["命名捕获组格式:",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),a.jsxs("li",{children:["在 reaction 中使用 ",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),a.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),a.jsxs(kn,{value:"test",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"当前正则表达式"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:_||"(未设置)"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),a.jsx(_n,{id:"test-text",value:L,onChange:ve=>U(ve.target.value),placeholder:`在此输入要测试的文本... -例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),W&&a.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[a.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),a.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:W})]}),!W&&L&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"flex items-center gap-2",children:V&&V.length>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),a.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",V.length," 处)"]})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),a.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"匹配高亮"}),a.jsx(vn,{className:"h-40 rounded-md bg-muted p-3",children:a.jsx("div",{className:"text-sm break-words",children:H()})})]}),Object.keys($).length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"命名捕获组"}),a.jsx(vn,{className:"h-32 rounded-md border p-3",children:a.jsx("div",{className:"space-y-2",children:Object.entries($).map(([ve,Re])=>a.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[a.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",ve,"]"]}),a.jsx("span",{className:"text-muted-foreground",children:"="}),a.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:Re})]},ve))})})]}),Object.keys($).length>0&&D&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"Reaction 替换预览"}),a.jsx(vn,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:a.jsx("div",{className:"text-sm break-words",children:ne})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),a.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),a.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),a.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),a.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),a.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},x=()=>{s({...t,keyword_rules:[...t.keyword_rules,{keywords:[],reaction:""}]})},v=_=>{s({...t,keyword_rules:t.keyword_rules.filter((D,E)=>E!==_)})},b=(_,D,E)=>{const R=[...t.keyword_rules];typeof E=="string"&&(R[_]={...R[_],reaction:E}),s({...t,keyword_rules:R})},k=_=>{const D=[...t.keyword_rules];D[_]={...D[_],keywords:[...D[_].keywords||[],""]},s({...t,keyword_rules:D})},O=(_,D)=>{const E=[...t.keyword_rules];E[_]={...E[_],keywords:(E[_].keywords||[]).filter((R,Q)=>Q!==D)},s({...t,keyword_rules:E})},j=(_,D,E)=>{const R=[...t.keyword_rules],Q=[...R[_].keywords||[]];Q[D]=E,R[_]={...R[_],keywords:Q},s({...t,keyword_rules:R})},T=({rule:_})=>{const D=`{ regex = [${(_.regex||[]).map(E=>`"${E}"`).join(", ")}], reaction = "${_.reaction}" }`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-[95vw] sm:w-[500px]",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx(vn,{className:"h-60 rounded-md bg-muted p-3",children:a.jsx("pre",{className:"font-mono text-xs break-all",children:D})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},A=({rule:_})=>{const D=`[[keyword_reaction.keyword_rules]] +`,{label:"if",detail:"block",type:"keyword"}),Ya("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),Ya("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),Ya("import ${module}",{label:"import",detail:"statement",type:"keyword"}),Ya("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],zee=BK(B_,d_(Dee.concat(Ree)));function ab(t){let{node:e,pos:n}=t,r=t.lineIndent(n,-1),s=null;for(;;){let i=e.childBefore(n);if(i)if(i.name=="Comment")n=i.from;else if(i.name=="Body"||i.name=="MatchBody")t.baseIndentFor(i)+t.unit<=r&&(s=i),e=i;else if(i.name=="MatchClause")e=i;else if(i.type.is("Statement"))e=i;else break;else break}return s}function lb(t,e){let n=t.baseIndentFor(e),r=t.lineAt(t.pos,-1),s=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&t.node.ton?null:n+t.unit}const ob=jf.define({name:"python",parser:Mee.configure({props:[Cx.add({Body:t=>{var e;let n=/^\s*(#|$)/.test(t.textAfter)&&ab(t)||t.node;return(e=lb(t,n))!==null&&e!==void 0?e:t.continue()},MatchBody:t=>{var e;let n=ab(t);return(e=lb(t,n||t.node))!==null&&e!==void 0?e:t.continue()},IfStatement:t=>/^\s*(else:|elif )/.test(t.textAfter)?t.baseIndent:t.continue(),"ForStatement WhileStatement":t=>/^\s*else:/.test(t.textAfter)?t.baseIndent:t.continue(),TryStatement:t=>/^\s*(except[ :]|finally:|else:)/.test(t.textAfter)?t.baseIndent:t.continue(),MatchStatement:t=>/^\s*case /.test(t.textAfter)?t.baseIndent+t.unit:t.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":Hy({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Hy({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Hy({closing:"]"}),MemberExpression:t=>t.baseIndent+t.unit,"String FormatString":()=>null,Script:t=>{var e;let n=ab(t);return(e=n&&lb(t,n))!==null&&e!==void 0?e:t.continue()}}),Fw.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":rE,Body:(t,e)=>({from:t.from+1,to:t.to-(t.to==e.doc.length?0:1)}),"String FormatString":(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function Pee(){return new eE(ob,[ob.data.of({autocomplete:_ee}),ob.data.of({autocomplete:zee})])}const Bee=Lw({String:he.string,Number:he.number,"True False":he.bool,PropertyName:he.propertyName,Null:he.null,", :":he.separator,"[ ]":he.squareBracket,"{ }":he.brace}),Lee=Rf.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[Bee],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Iee=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=qee(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function qee(t,e){let n;return(n=t.message.match(/at position (\d+)/))?Math.min(+n[1],e.length):(n=t.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+n[1]).from+ +n[2]-1,e.length):0}const Fee=jf.define({name:"json",parser:Lee.configure({props:[Cx.add({Object:a7({except:/^\s*\}/}),Array:a7({except:/^\s*\]/})}),Fw.add({"Object Array":rE})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Qee(){return new eE(Fee)}const $ee={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(t,e){let n;if(!e.inString&&(n=t.match(/^('''|"""|'|")/))&&(e.stringType=n[0],e.inString=!0),t.sol()&&!e.inString&&e.inArray===0&&(e.lhs=!0),e.inString){for(;e.inString;)if(t.match(e.stringType))e.inString=!1;else if(t.peek()==="\\")t.next(),t.next();else{if(t.eol())break;t.match(/^.[^\\\"\']*/)}return e.lhs?"property":"string"}else{if(e.inArray&&t.peek()==="]")return t.next(),e.inArray--,"bracket";if(e.lhs&&t.peek()==="["&&t.skipTo("]"))return t.next(),t.peek()==="]"&&t.next(),"atom";if(t.peek()==="#")return t.skipToEnd(),"comment";if(t.eatSpace())return null;if(e.lhs&&t.eatWhile(function(r){return r!="="&&r!=" "}))return"property";if(e.lhs&&t.peek()==="=")return t.next(),e.lhs=!1,null;if(!e.lhs&&t.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!e.lhs&&(t.match("true")||t.match("false")))return"atom";if(!e.lhs&&t.peek()==="[")return e.inArray++,t.next(),"bracket";if(!e.lhs&&t.match(/^\-?\d+(?:\.\d+)?/))return"number";t.eatSpace()||t.next()}return null},languageData:{commentTokens:{line:"#"}}},Hee={python:[Pee()],json:[Qee(),Iee()],toml:[Qw.define($ee)],text:[]};function Uee({value:t,onChange:e,language:n="text",readOnly:r=!1,height:s="400px",minHeight:i,maxHeight:l,placeholder:c,theme:d="dark",className:h=""}){const[m,p]=S.useState(!1);if(S.useEffect(()=>{p(!0)},[]),!m)return a.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${h}`,style:{height:s,minHeight:i,maxHeight:l}});const x=[...Hee[n]||[],qe.lineWrapping];return r&&x.push(qe.editable.of(!1)),a.jsx("div",{className:`rounded-md overflow-hidden border ${h}`,children:a.jsx(C_,{value:t,height:s,minHeight:i,maxHeight:l,theme:d==="dark"?N_:void 0,extensions:x,onChange:e,placeholder:c,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function Vee(){const[t,e]=S.useState(!0),[n,r]=S.useState(!1),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState("visual"),[b,k]=S.useState(""),[O,j]=S.useState(!1),{toast:T}=Pr(),[A,_]=S.useState(null),[D,E]=S.useState(null),[z,Q]=S.useState(null),[F,L]=S.useState(null),[U,V]=S.useState(null),[ce,W]=S.useState(null),[J,$]=S.useState(null),[ae,ne]=S.useState(null),[ue,R]=S.useState(null),[me,Y]=S.useState(null),[P,K]=S.useState(null),[H,fe]=S.useState(null),[ve,Re]=S.useState(null),[de,We]=S.useState(null),[ct,Oe]=S.useState(null),[nt,ut]=S.useState(null),[Ct,In]=S.useState(null),[Tn,Jn]=S.useState(null),nn=S.useRef(null),_t=S.useRef(!0),Yr=S.useRef({}),qn=S.useCallback(async()=>{try{const re=await RU();k(re),j(!1)}catch(re){T({variant:"destructive",title:"加载失败",description:re instanceof Error?re.message:"加载源代码失败"})}},[T]),or=S.useCallback(async()=>{try{e(!0);const re=await DU();Yr.current=re,_(re.bot),E(re.personality);const Ae=re.chat;Ae.talk_value_rules||(Ae.talk_value_rules=[]),Q(Ae),L(re.expression),V(re.emoji),W(re.memory),$(re.tool),ne(re.mood),R(re.voice),Y(re.lpmm_knowledge),K(re.keyword_reaction),fe(re.response_post_process),Re(re.chinese_typo),We(re.response_splitter),Oe(re.log),ut(re.debug),In(re.maim_message),Jn(re.telemetry),c(!1),_t.current=!1,await qn()}catch(re){console.error("加载配置失败:",re),T({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{e(!1)}},[T,qn]);S.useEffect(()=>{or()},[or]);const yn=S.useCallback(async(re,Ae)=>{if(!_t.current)try{i(!0),await PU(re,Ae),c(!1)}catch(pt){console.error(`自动保存 ${re} 失败:`,pt),c(!0)}finally{i(!1)}},[]),ft=S.useCallback((re,Ae)=>{_t.current||(c(!0),nn.current&&clearTimeout(nn.current),nn.current=setTimeout(()=>{yn(re,Ae)},2e3))},[yn]);S.useEffect(()=>{A&&!_t.current&&ft("bot",A)},[A,ft]),S.useEffect(()=>{D&&!_t.current&&ft("personality",D)},[D,ft]),S.useEffect(()=>{z&&!_t.current&&ft("chat",z)},[z,ft]),S.useEffect(()=>{F&&!_t.current&&ft("expression",F)},[F,ft]),S.useEffect(()=>{U&&!_t.current&&ft("emoji",U)},[U,ft]),S.useEffect(()=>{ce&&!_t.current&&ft("memory",ce)},[ce,ft]),S.useEffect(()=>{J&&!_t.current&&ft("tool",J)},[J,ft]),S.useEffect(()=>{ae&&!_t.current&&ft("mood",ae)},[ae,ft]),S.useEffect(()=>{ue&&!_t.current&&ft("voice",ue)},[ue,ft]),S.useEffect(()=>{me&&!_t.current&&ft("lpmm_knowledge",me)},[me,ft]),S.useEffect(()=>{P&&!_t.current&&ft("keyword_reaction",P)},[P,ft]),S.useEffect(()=>{H&&!_t.current&&ft("response_post_process",H)},[H,ft]),S.useEffect(()=>{ve&&!_t.current&&ft("chinese_typo",ve)},[ve,ft]),S.useEffect(()=>{de&&!_t.current&&ft("response_splitter",de)},[de,ft]),S.useEffect(()=>{ct&&!_t.current&&ft("log",ct)},[ct,ft]),S.useEffect(()=>{nt&&!_t.current&&ft("debug",nt)},[nt,ft]),S.useEffect(()=>{Ct&&!_t.current&&ft("maim_message",Ct)},[Ct,ft]),S.useEffect(()=>{Tn&&!_t.current&&ft("telemetry",Tn)},[Tn,ft]);const ee=async()=>{try{r(!0),await zU(b),c(!1),j(!1),T({title:"保存成功",description:"配置已保存"}),await or()}catch(re){j(!0),T({variant:"destructive",title:"保存失败",description:re instanceof Error?re.message:"保存配置失败"})}finally{r(!1)}},Se=async re=>{if(l){T({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}v(re),re==="source"?await qn():await or()},Be=async()=>{try{r(!0),nn.current&&clearTimeout(nn.current);const re={...Yr.current,bot:A,personality:D,chat:z,expression:F,emoji:U,memory:ce,tool:J,mood:ae,voice:ue,lpmm_knowledge:me,keyword_reaction:P,response_post_process:H,chinese_typo:ve,response_splitter:de,log:ct,debug:nt,maim_message:Ct,telemetry:Tn};await XO(re),c(!1),T({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(re){console.error("保存配置失败:",re),T({title:"保存失败",description:re.message,variant:"destructive"})}finally{r(!1)}},rt=async()=>{try{h(!0),xw().catch(()=>{}),p(!0)}catch(re){console.error("重启失败:",re),p(!1),T({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),h(!1)}},Tt=async()=>{try{r(!0),nn.current&&clearTimeout(nn.current);const re={...Yr.current,bot:A,personality:D,chat:z,expression:F,emoji:U,memory:ce,tool:J,mood:ae,voice:ue,lpmm_knowledge:me,keyword_reaction:P,response_post_process:H,chinese_typo:ve,response_splitter:de,log:ct,debug:nt,maim_message:Ct,telemetry:Tn};await XO(re),c(!1),T({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(Ae=>setTimeout(Ae,500)),await rt()}catch(re){console.error("保存失败:",re),T({title:"保存失败",description:re.message,variant:"destructive"})}finally{r(!1)}},cr=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Kr=()=>{p(!1),h(!1),T({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return t?a.jsx(mn,{className:"h-full",children:a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto items-center",children:[a.jsx(hl,{value:x,onValueChange:re=>Se(re),className:"w-auto",children:a.jsxs(ya,{className:"h-9",children:[a.jsxs($t,{value:"visual",className:"text-xs sm:text-sm px-2 sm:px-3",children:[a.jsx(bq,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化"]}),a.jsxs($t,{value:"source",className:"text-xs sm:text-sm px-2 sm:px-3",children:[a.jsx(wq,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码"]})]})}),a.jsxs(ie,{onClick:x==="visual"?Be:ee,disabled:n||s||!l||d,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":s?"自动保存中...":l?"保存配置":"已保存"]}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:n||s||d,size:"sm",className:"flex-1 sm:flex-none",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),d?"重启中...":l?"保存并重启":"重启麦麦"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重启麦麦?"}),a.jsx(dn,{children:l?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:l?Tt:rt,children:l?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),x==="source"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:[a.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",O&&a.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),a.jsx(Uee,{value:b,onChange:re=>{k(re),c(!0),O&&j(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),x==="visual"&&a.jsx(a.Fragment,{children:a.jsxs(hl,{defaultValue:"bot",className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:a.jsxs(ya,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[a.jsx($t,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),a.jsx($t,{value:"personality",className:"flex-shrink-0",children:"人格"}),a.jsx($t,{value:"chat",className:"flex-shrink-0",children:"聊天"}),a.jsx($t,{value:"expression",className:"flex-shrink-0",children:"表达"}),a.jsx($t,{value:"features",className:"flex-shrink-0",children:"功能"}),a.jsx($t,{value:"processing",className:"flex-shrink-0",children:"处理"}),a.jsx($t,{value:"mood",className:"flex-shrink-0",children:"情绪"}),a.jsx($t,{value:"voice",className:"flex-shrink-0",children:"语音"}),a.jsx($t,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),a.jsx($t,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),a.jsx(kn,{value:"bot",className:"space-y-4",children:A&&a.jsx(Wee,{config:A,onChange:_})}),a.jsx(kn,{value:"personality",className:"space-y-4",children:D&&a.jsx(Gee,{config:D,onChange:E})}),a.jsx(kn,{value:"chat",className:"space-y-4",children:z&&a.jsx(Xee,{config:z,onChange:Q})}),a.jsx(kn,{value:"expression",className:"space-y-4",children:F&&a.jsx(Yee,{config:F,onChange:L})}),a.jsx(kn,{value:"features",className:"space-y-4",children:U&&ce&&J&&a.jsx(Kee,{emojiConfig:U,memoryConfig:ce,toolConfig:J,onEmojiChange:V,onMemoryChange:W,onToolChange:$})}),a.jsx(kn,{value:"processing",className:"space-y-4",children:P&&H&&ve&&de&&a.jsx(Zee,{keywordReactionConfig:P,responsePostProcessConfig:H,chineseTypoConfig:ve,responseSplitterConfig:de,onKeywordReactionChange:K,onResponsePostProcessChange:fe,onChineseTypoChange:Re,onResponseSplitterChange:We})}),a.jsx(kn,{value:"mood",className:"space-y-4",children:ae&&a.jsx(Jee,{config:ae,onChange:ne})}),a.jsx(kn,{value:"voice",className:"space-y-4",children:ue&&a.jsx(ete,{config:ue,onChange:R})}),a.jsx(kn,{value:"lpmm",className:"space-y-4",children:me&&a.jsx(tte,{config:me,onChange:Y})}),a.jsxs(kn,{value:"other",className:"space-y-4",children:[ct&&a.jsx(nte,{config:ct,onChange:Oe}),nt&&a.jsx(rte,{config:nt,onChange:ut}),Ct&&a.jsx(ste,{config:Ct,onChange:In}),Tn&&a.jsx(ite,{config:Tn,onChange:Jn})]})]})}),m&&a.jsx(vw,{onRestartComplete:cr,onRestartFailed:Kr})]})})}function Wee({config:t,onChange:e}){const n=()=>{e({...t,platforms:[...t.platforms,""]})},r=d=>{e({...t,platforms:t.platforms.filter((h,m)=>m!==d)})},s=(d,h)=>{const m=[...t.platforms];m[d]=h,e({...t,platforms:m})},i=()=>{e({...t,alias_names:[...t.alias_names,""]})},l=d=>{e({...t,alias_names:t.alias_names.filter((h,m)=>m!==d)})},c=(d,h)=>{const m=[...t.alias_names];m[d]=h,e({...t,alias_names:m})};return a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"platform",children:"平台"}),a.jsx(Me,{id:"platform",value:t.platform,onChange:d=>e({...t,platform:d.target.value}),placeholder:"qq"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"qq_account",children:"QQ账号"}),a.jsx(Me,{id:"qq_account",value:t.qq_account,onChange:d=>e({...t,qq_account:d.target.value}),placeholder:"123456789"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称"}),a.jsx(Me,{id:"nickname",value:t.nickname,onChange:d=>e({...t,nickname:d.target.value}),placeholder:"麦麦"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"其他平台账号"}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),a.jsxs("div",{className:"space-y-2",children:[t.platforms.map((d,h)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{value:d,onChange:m=>s(h,m.target.value),placeholder:"wx:114514"}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除平台账号 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(h),children:"删除"})]})]})]})]},h)),t.platforms.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"别名"}),a.jsxs(ie,{onClick:i,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),a.jsxs("div",{className:"space-y-2",children:[t.alias_names.map((d,h)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{value:d,onChange:m=>c(h,m.target.value),placeholder:"小麦"}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除别名 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>l(h),children:"删除"})]})]})]})]},h)),t.alias_names.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function Gee({config:t,onChange:e}){const n=()=>{e({...t,states:[...t.states,""]})},r=i=>{e({...t,states:t.states.filter((l,c)=>c!==i)})},s=(i,l)=>{const c=[...t.states];c[i]=l,e({...t,states:c})};return a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"personality",children:"人格特质"}),a.jsx(_n,{id:"personality",value:t.personality,onChange:i=>e({...t,personality:i.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"reply_style",children:"表达风格"}),a.jsx(_n,{id:"reply_style",value:t.reply_style,onChange:i=>e({...t,reply_style:i.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"interest",children:"兴趣"}),a.jsx(_n,{id:"interest",value:t.interest,onChange:i=>e({...t,interest:i.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"plan_style",children:"说话规则与行为风格"}),a.jsx(_n,{id:"plan_style",value:t.plan_style,onChange:i=>e({...t,plan_style:i.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"visual_style",children:"识图规则"}),a.jsx(_n,{id:"visual_style",value:t.visual_style,onChange:i=>e({...t,visual_style:i.target.value}),placeholder:"识图时的处理规则",rows:3})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"private_plan_style",children:"私聊规则"}),a.jsx(_n,{id:"private_plan_style",value:t.private_plan_style,onChange:i=>e({...t,private_plan_style:i.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"状态列表(人格多样性)"}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),a.jsx("div",{className:"space-y-2",children:t.states.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(_n,{value:i,onChange:c=>s(l,c.target.value),placeholder:"描述一个人格状态",rows:2}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsx(dn,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(l),children:"删除"})]})]})]})]},l))})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"state_probability",children:"状态替换概率"}),a.jsx(Me,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:t.state_probability,onChange:i=>e({...t,state_probability:parseFloat(i.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function Xee({config:t,onChange:e}){const n=()=>{e({...t,talk_value_rules:[...t.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},r=c=>{e({...t,talk_value_rules:t.talk_value_rules.filter((d,h)=>h!==c)})},s=(c,d,h)=>{const m=[...t.talk_value_rules];m[c]={...m[c],[d]:h},e({...t,talk_value_rules:m})},i=({value:c,onChange:d})=>{const[h,m]=S.useState("00"),[p,x]=S.useState("00"),[v,b]=S.useState("23"),[k,O]=S.useState("59");S.useEffect(()=>{const T=c.split("-");if(T.length===2){const[A,_]=T,[D,E]=A.split(":"),[z,Q]=_.split(":");D&&m(D.padStart(2,"0")),E&&x(E.padStart(2,"0")),z&&b(z.padStart(2,"0")),Q&&O(Q.padStart(2,"0"))}},[c]);const j=(T,A,_,D)=>{const E=`${T}:${A}-${_}:${D}`;d(E)};return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[a.jsx(dc,{className:"h-4 w-4 mr-2"}),c||"选择时间段"]})}),a.jsx(fl,{className:"w-80",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"小时"}),a.jsxs(Lt,{value:h,onValueChange:T=>{m(T),j(T,p,v,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:24},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"分钟"}),a.jsxs(Lt,{value:p,onValueChange:T=>{x(T),j(h,T,v,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:60},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"小时"}),a.jsxs(Lt,{value:v,onValueChange:T=>{b(T),j(h,p,T,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:24},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"分钟"}),a.jsxs(Lt,{value:k,onValueChange:T=>{O(T),j(h,p,v,T)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:60},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]})]})]})]})})]})},l=({rule:c})=>{const d=`{ target = "${c.target}", time = "${c.time}", value = ${c.value.toFixed(1)} }`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-96",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:d}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),a.jsx(Me,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:t.talk_value,onChange:c=>e({...t,talk_value:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"mentioned_bot_reply",children:"提及回复增幅"}),a.jsx(Me,{id:"mentioned_bot_reply",type:"number",step:"0.1",min:"0",max:"1",value:t.mentioned_bot_reply,onChange:c=>e({...t,mentioned_bot_reply:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"提及时回复概率增幅,1 为 100% 回复"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_context_size",children:"上下文长度"}),a.jsx(Me,{id:"max_context_size",type:"number",min:"1",value:t.max_context_size,onChange:c=>e({...t,max_context_size:parseInt(c.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"planner_smooth",children:"规划器平滑"}),a.jsx(Me,{id:"planner_smooth",type:"number",step:"1",min:"0",value:t.planner_smooth,onChange:c=>e({...t,planner_smooth:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_talk_value_rules",checked:t.enable_talk_value_rules,onCheckedChange:c=>e({...t,enable_talk_value_rules:c})}),a.jsx(te,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"include_planner_reasoning",checked:t.include_planner_reasoning,onCheckedChange:c=>e({...t,include_planner_reasoning:c})}),a.jsx(te,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),t.enable_talk_value_rules&&a.jsxs("div",{className:"border-t pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),a.jsxs(ie,{onClick:n,size:"sm",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),t.talk_value_rules&&t.talk_value_rules.length>0?a.jsx("div",{className:"space-y-4",children:t.talk_value_rules.map((c,d)=>a.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",d+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(l,{rule:c}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{variant:"ghost",size:"sm",children:a.jsx(Ht,{className:"h-4 w-4 text-destructive"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除规则 #",d+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(d),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"配置类型"}),a.jsxs(Lt,{value:c.target===""?"global":"specific",onValueChange:h=>{h==="global"?s(d,"target",""):s(d,"target","qq::group")},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"global",children:"全局配置"}),a.jsx(Pe,{value:"specific",children:"详细配置"})]})]})]}),c.target!==""&&(()=>{const h=c.target.split(":"),m=h[0]||"qq",p=h[1]||"",x=h[2]||"group";return a.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"平台"}),a.jsxs(Lt,{value:m,onValueChange:v=>{s(d,"target",`${v}:${p}:${x}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"qq",children:"QQ"}),a.jsx(Pe,{value:"wx",children:"微信"})]})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"群 ID"}),a.jsx(Me,{value:p,onChange:v=>{s(d,"target",`${m}:${v.target.value}:${x}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"类型"}),a.jsxs(Lt,{value:x,onValueChange:v=>{s(d,"target",`${m}:${p}:${v}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"group",children:"群组(group)"}),a.jsx(Pe,{value:"private",children:"私聊(private)"})]})]})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",c.target||"(未设置)"]})]})})(),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"时间段 (Time)"}),a.jsx(i,{value:c.time,onChange:h=>s(d,"time",h)}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{htmlFor:`rule-value-${d}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),a.jsx(Me,{id:`rule-value-${d}`,type:"number",step:"0.01",min:"0",max:"1",value:c.value,onChange:h=>{const m=parseFloat(h.target.value);isNaN(m)||s(d,"value",Math.max(0,Math.min(1,m)))},className:"w-20 h-8 text-xs"})]}),a.jsx(yx,{value:[c.value],onValueChange:h=>s(d,"value",h[0]),min:0,max:1,step:.01,className:"w-full"}),a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:"0 (完全沉默)"}),a.jsx("span",{children:"0.5"}),a.jsx("span",{children:"1.0 (正常)"})]})]})]})]},d))}):a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:a.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),a.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[a.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),a.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function Yee({config:t,onChange:e}){const n=()=>{e({...t,learning_list:[...t.learning_list,["","enable","enable","1.0"]]})},r=x=>{e({...t,learning_list:t.learning_list.filter((v,b)=>b!==x)})},s=(x,v,b)=>{const k=[...t.learning_list];k[x][v]=b,e({...t,learning_list:k})},i=({rule:x})=>{const v=`["${x[0]}", "${x[1]}", "${x[2]}", "${x[3]}"]`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-96",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:v}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},l=({member:x,groupIndex:v,memberIndex:b,availableChatIds:k})=>{const O=k.includes(x)||x==="*",[j,T]=S.useState(!O);return a.jsxs("div",{className:"flex gap-2",children:[a.jsx("div",{className:"flex-1 flex gap-2",children:j?a.jsxs(a.Fragment,{children:[a.jsx(Me,{value:x,onChange:A=>p(v,b,A.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),k.length>0&&a.jsx(ie,{size:"sm",variant:"outline",onClick:()=>T(!1),title:"切换到下拉选择",children:"下拉"})]}):a.jsxs(a.Fragment,{children:[a.jsxs(Lt,{value:x,onValueChange:A=>p(v,b,A),children:[a.jsx(Dt,{className:"flex-1",children:a.jsx(It,{placeholder:"选择聊天流"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"*",children:"* (全局共享)"}),k.map((A,_)=>a.jsx(Pe,{value:A,children:A},_))]})]}),a.jsx(ie,{size:"sm",variant:"outline",onClick:()=>T(!0),title:"切换到手动输入",children:"输入"})]})}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除组成员 "',x||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>m(v,b),children:"删除"})]})]})]})]})},c=()=>{e({...t,expression_groups:[...t.expression_groups,[]]})},d=x=>{e({...t,expression_groups:t.expression_groups.filter((v,b)=>b!==x)})},h=x=>{const v=[...t.expression_groups];v[x]=[...v[x],""],e({...t,expression_groups:v})},m=(x,v)=>{const b=[...t.expression_groups];b[x]=b[x].filter((k,O)=>O!==v),e({...t,expression_groups:b})},p=(x,v,b)=>{const k=[...t.expression_groups];k[x][v]=b,e({...t,expression_groups:k})};return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),a.jsxs("div",{className:"space-y-4",children:[t.learning_list.map((x,v)=>{const b=t.learning_list.some((_,D)=>D!==v&&_[0]===""),k=x[0]==="",O=x[0].split(":"),j=O[0]||"qq",T=O[1]||"",A=O[2]||"group";return a.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["规则 ",v+1," ",k&&"(全局配置)"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(i,{rule:x}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除学习规则 ",v+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(v),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"配置类型"}),a.jsxs(Lt,{value:k?"global":"specific",onValueChange:_=>{_==="global"?s(v,0,""):s(v,0,"qq::group")},disabled:b&&!k,children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"global",children:"全局配置"}),a.jsx(Pe,{value:"specific",disabled:b&&!k,children:"详细配置"})]})]}),b&&!k&&a.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!k&&a.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"平台"}),a.jsxs(Lt,{value:j,onValueChange:_=>{s(v,0,`${_}:${T}:${A}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"qq",children:"QQ"}),a.jsx(Pe,{value:"wx",children:"微信"})]})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"群 ID"}),a.jsx(Me,{value:T,onChange:_=>{s(v,0,`${j}:${_.target.value}:${A}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"类型"}),a.jsxs(Lt,{value:A,onValueChange:_=>{s(v,0,`${j}:${T}:${_}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"group",children:"群组(group)"}),a.jsx(Pe,{value:"private",children:"私聊(private)"})]})]})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",x[0]||"(未设置)"]})]}),a.jsx("div",{className:"grid gap-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs font-medium",children:"使用学到的表达"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),a.jsx(jt,{checked:x[1]==="enable",onCheckedChange:_=>s(v,1,_?"enable":"disable")})]})}),a.jsx("div",{className:"grid gap-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs font-medium",children:"学习表达"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),a.jsx(jt,{checked:x[2]==="enable",onCheckedChange:_=>s(v,2,_?"enable":"disable")})]})}),a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-xs font-medium",children:"学习强度"}),a.jsx(Me,{type:"number",step:"0.1",min:"0",max:"5",value:x[3],onChange:_=>{const D=parseFloat(_.target.value);isNaN(D)||s(v,3,Math.max(0,Math.min(5,D)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),a.jsx(yx,{value:[parseFloat(x[3])||1],onValueChange:_=>s(v,3,_[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:"0 (不学习)"}),a.jsx("span",{children:"2.5"}),a.jsx("span",{children:"5.0 (快速学习)"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},v)}),t.learning_list.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),a.jsxs(ie,{onClick:c,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),a.jsxs("div",{className:"space-y-4",children:[t.expression_groups.map((x,v)=>{const b=t.learning_list.map(k=>k[0]).filter(k=>k!=="");return a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",v+1,x.length===1&&x[0]==="*"&&"(全局共享)"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ie,{onClick:()=>h(v),size:"sm",variant:"outline",children:a.jsx(Wr,{className:"h-4 w-4"})}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除共享组 ",v+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>d(v),children:"删除"})]})]})]})]})]}),a.jsx("div",{className:"space-y-2",children:x.map((k,O)=>a.jsx(l,{member:k,groupIndex:v,memberIndex:O,availableChatIds:b},O))}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},v)}),t.expression_groups.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function Kee({emojiConfig:t,memoryConfig:e,toolConfig:n,onEmojiChange:r,onMemoryChange:s,onToolChange:i}){return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:l=>i({...n,enable_tool:l})}),a.jsx(te,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),a.jsx(Me,{id:"max_agent_iterations",type:"number",min:"1",value:e.max_agent_iterations,onChange:l=>s({...e,max_agent_iterations:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"emoji_chance",children:"表情包激活概率"}),a.jsx(Me,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:t.emoji_chance,onChange:l=>r({...t,emoji_chance:parseFloat(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_reg_num",children:"最大注册数量"}),a.jsx(Me,{id:"max_reg_num",type:"number",min:"1",value:t.max_reg_num,onChange:l=>r({...t,max_reg_num:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),a.jsx(Me,{id:"check_interval",type:"number",min:"1",value:t.check_interval,onChange:l=>r({...t,check_interval:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"do_replace",checked:t.do_replace,onCheckedChange:l=>r({...t,do_replace:l})}),a.jsx(te,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:l=>r({...t,steal_emoji:l})}),a.jsx(te,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),a.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:l=>r({...t,content_filtration:l})}),a.jsx(te,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),t.content_filtration&&a.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[a.jsx(te,{htmlFor:"filtration_prompt",children:"过滤要求"}),a.jsx(Me,{id:"filtration_prompt",value:t.filtration_prompt,onChange:l=>r({...t,filtration_prompt:l.target.value}),placeholder:"符合公序良俗"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function Zee({keywordReactionConfig:t,responsePostProcessConfig:e,chineseTypoConfig:n,responseSplitterConfig:r,onKeywordReactionChange:s,onResponsePostProcessChange:i,onChineseTypoChange:l,onResponseSplitterChange:c}){const d=()=>{s({...t,regex_rules:[...t.regex_rules,{regex:[""],reaction:""}]})},h=_=>{s({...t,regex_rules:t.regex_rules.filter((D,E)=>E!==_)})},m=(_,D,E)=>{const z=[...t.regex_rules];D==="regex"&&typeof E=="string"?z[_]={...z[_],regex:[E]}:D==="reaction"&&typeof E=="string"&&(z[_]={...z[_],reaction:E}),s({...t,regex_rules:z})},p=({regex:_,reaction:D,onRegexChange:E,onReactionChange:z})=>{const[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,ce]=S.useState(null),[W,J]=S.useState(""),[$,ae]=S.useState({}),[ne,ue]=S.useState(""),R=S.useRef(null),[me,Y]=S.useState("build"),P=ve=>ve.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),K=(ve,Re=0)=>{const de=R.current;if(!de)return;const We=de.selectionStart||0,ct=de.selectionEnd||0,Oe=_.substring(0,We)+ve+_.substring(ct);E(Oe),setTimeout(()=>{const nt=We+ve.length+Re;de.setSelectionRange(nt,nt),de.focus()},0)};S.useEffect(()=>{if(!_||!L){ce(null),ae({}),ue(D),J("");return}try{const ve=P(_),Re=new RegExp(ve,"g"),de=L.match(Re);ce(de),J("");const ct=new RegExp(ve).exec(L);if(ct&&ct.groups){ae(ct.groups);let Oe=D;Object.entries(ct.groups).forEach(([nt,ut])=>{Oe=Oe.replace(new RegExp(`\\[${nt}\\]`,"g"),ut||"")}),ue(Oe)}else ae({}),ue(D)}catch(ve){J(ve.message),ce(null),ae({}),ue(D)}},[_,L,D]);const H=()=>{if(!L||!V||V.length===0)return a.jsx("span",{className:"text-muted-foreground",children:L||"请输入测试文本"});try{const ve=P(_),Re=new RegExp(ve,"g");let de=0;const We=[];let ct;for(;(ct=Re.exec(L))!==null;)ct.index>de&&We.push(a.jsx("span",{children:L.substring(de,ct.index)},`text-${de}`)),We.push(a.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:ct[0]},`match-${ct.index}`)),de=ct.index+ct[0].length;return de)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return a.jsxs(Rr,{open:Q,onOpenChange:F,children:[a.jsx(mw,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(fg,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"正则表达式编辑器"}),a.jsx(Gr,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),a.jsx(mn,{className:"max-h-[calc(90vh-120px)]",children:a.jsxs(hl,{value:me,onValueChange:ve=>Y(ve),className:"w-full",children:[a.jsxs(ya,{className:"grid w-full grid-cols-2",children:[a.jsx($t,{value:"build",children:"🔧 构建器"}),a.jsx($t,{value:"test",children:"🧪 测试器"})]}),a.jsxs(kn,{value:"build",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"正则表达式"}),a.jsx(Me,{ref:R,value:_,onChange:ve=>E(ve.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"Reaction 内容"}),a.jsx(_n,{value:D,onChange:ve=>z(ve.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),a.jsxs("div",{className:"space-y-4 border-t pt-4",children:[fe.map(ve=>a.jsxs("div",{className:"space-y-2",children:[a.jsx("h5",{className:"text-xs font-semibold text-primary",children:ve.category}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:ve.items.map(Re=>a.jsx(ie,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>K(Re.pattern,Re.moveCursor||0),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsxs("div",{className:"flex items-center gap-2 w-full",children:[a.jsx("span",{className:"text-xs font-medium",children:Re.label}),a.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:Re.pattern})]}),a.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:Re.desc})]})},Re.label))})]},ve.category)),a.jsxs("div",{className:"space-y-2 border-t pt-4",children:[a.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("^(?P\\S{1,20})是这样的$"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?P.+?)(?:是|为什么|怎么)"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),a.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),a.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),a.jsxs("li",{children:["命名捕获组格式:",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),a.jsxs("li",{children:["在 reaction 中使用 ",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),a.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),a.jsxs(kn,{value:"test",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"当前正则表达式"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:_||"(未设置)"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),a.jsx(_n,{id:"test-text",value:L,onChange:ve=>U(ve.target.value),placeholder:`在此输入要测试的文本... +例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),W&&a.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[a.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),a.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:W})]}),!W&&L&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"flex items-center gap-2",children:V&&V.length>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),a.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",V.length," 处)"]})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),a.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"匹配高亮"}),a.jsx(mn,{className:"h-40 rounded-md bg-muted p-3",children:a.jsx("div",{className:"text-sm break-words",children:H()})})]}),Object.keys($).length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"命名捕获组"}),a.jsx(mn,{className:"h-32 rounded-md border p-3",children:a.jsx("div",{className:"space-y-2",children:Object.entries($).map(([ve,Re])=>a.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[a.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",ve,"]"]}),a.jsx("span",{className:"text-muted-foreground",children:"="}),a.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:Re})]},ve))})})]}),Object.keys($).length>0&&D&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"Reaction 替换预览"}),a.jsx(mn,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:a.jsx("div",{className:"text-sm break-words",children:ne})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),a.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),a.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),a.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),a.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),a.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},x=()=>{s({...t,keyword_rules:[...t.keyword_rules,{keywords:[],reaction:""}]})},v=_=>{s({...t,keyword_rules:t.keyword_rules.filter((D,E)=>E!==_)})},b=(_,D,E)=>{const z=[...t.keyword_rules];typeof E=="string"&&(z[_]={...z[_],reaction:E}),s({...t,keyword_rules:z})},k=_=>{const D=[...t.keyword_rules];D[_]={...D[_],keywords:[...D[_].keywords||[],""]},s({...t,keyword_rules:D})},O=(_,D)=>{const E=[...t.keyword_rules];E[_]={...E[_],keywords:(E[_].keywords||[]).filter((z,Q)=>Q!==D)},s({...t,keyword_rules:E})},j=(_,D,E)=>{const z=[...t.keyword_rules],Q=[...z[_].keywords||[]];Q[D]=E,z[_]={...z[_],keywords:Q},s({...t,keyword_rules:z})},T=({rule:_})=>{const D=`{ regex = [${(_.regex||[]).map(E=>`"${E}"`).join(", ")}], reaction = "${_.reaction}" }`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-[95vw] sm:w-[500px]",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx(mn,{className:"h-60 rounded-md bg-muted p-3",children:a.jsx("pre",{className:"font-mono text-xs break-all",children:D})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},A=({rule:_})=>{const D=`[[keyword_reaction.keyword_rules]] keywords = [${(_.keywords||[]).map(E=>`"${E}"`).join(", ")}] -reaction = "${_.reaction}"`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-[95vw] sm:w-[500px]",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx(vn,{className:"h-60 rounded-md bg-muted p-3",children:a.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:D})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),a.jsxs(ie,{onClick:d,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),a.jsxs("div",{className:"space-y-3",children:[t.regex_rules.map((_,D)=>a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",D+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(p,{regex:_.regex&&_.regex[0]||"",reaction:_.reaction,onRegexChange:E=>m(D,"regex",E),onReactionChange:E=>m(D,"reaction",E)}),a.jsx(T,{rule:_}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除正则规则 ",D+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>h(D),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),a.jsx(Me,{value:_.regex&&_.regex[0]||"",onChange:E=>m(D,"regex",E.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"反应内容"}),a.jsx(_n,{value:_.reaction,onChange:E=>m(D,"reaction",E.target.value),placeholder:`触发后麦麦的反应... -可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},D)),t.regex_rules.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),a.jsxs("div",{className:"space-y-4 border-t pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),a.jsxs(ie,{onClick:x,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),a.jsxs("div",{className:"space-y-3",children:[t.keyword_rules.map((_,D)=>a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",D+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(A,{rule:_}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除关键词规则 ",D+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>v(D),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-xs font-medium",children:"关键词列表"}),a.jsxs(ie,{onClick:()=>k(D),size:"sm",variant:"ghost",children:[a.jsx(Wr,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),a.jsxs("div",{className:"space-y-2",children:[(_.keywords||[]).map((E,R)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{value:E,onChange:Q=>j(D,R,Q.target.value),placeholder:"关键词",className:"flex-1"}),a.jsx(ie,{onClick:()=>O(D,R),size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})]},R)),(!_.keywords||_.keywords.length===0)&&a.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"反应内容"}),a.jsx(_n,{value:_.reaction,onChange:E=>b(D,"reaction",E.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},D)),t.keyword_rules.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_response_post_process",checked:e.enable_response_post_process,onCheckedChange:_=>i({...e,enable_response_post_process:_})}),a.jsx(te,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),e.enable_response_post_process&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"border-t pt-6 space-y-4",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[a.jsx(jt,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:_=>l({...n,enable:_})}),a.jsx(te,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&a.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),a.jsx(Me,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:_=>l({...n,error_rate:parseFloat(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),a.jsx(Me,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:_=>l({...n,min_freq:parseInt(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),a.jsx(Me,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:_=>l({...n,tone_error_rate:parseFloat(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),a.jsx(Me,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:_=>l({...n,word_replace_rate:parseFloat(_.target.value)})})]})]})]})}),a.jsx("div",{className:"border-t pt-6 space-y-4",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[a.jsx(jt,{id:"enable_response_splitter",checked:r.enable,onCheckedChange:_=>c({...r,enable:_})}),a.jsx(te,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),r.enable&&a.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),a.jsx(Me,{id:"max_length",type:"number",min:"1",value:r.max_length,onChange:_=>c({...r,max_length:parseInt(_.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),a.jsx(Me,{id:"max_sentence_num",type:"number",min:"1",value:r.max_sentence_num,onChange:_=>c({...r,max_sentence_num:parseInt(_.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_kaomoji_protection",checked:r.enable_kaomoji_protection,onCheckedChange:_=>c({...r,enable_kaomoji_protection:_})}),a.jsx(te,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_overflow_return_all",checked:r.enable_overflow_return_all,onCheckedChange:_=>c({...r,enable_overflow_return_all:_})}),a.jsx(te,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),a.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function Jee({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用情绪系统"})]}),t.enable_mood&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"情绪更新阈值"}),a.jsx(Me,{type:"number",min:"1",value:t.mood_update_threshold,onChange:n=>e({...t,mood_update_threshold:parseInt(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"情感特征"}),a.jsx(_n,{value:t.emotion_style,onChange:n=>e({...t,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function ete({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable_asr,onCheckedChange:n=>e({...t,enable_asr:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用语音识别"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function tte({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),t.enable&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"LPMM 模式"}),a.jsxs(Lt,{value:t.lpmm_mode,onValueChange:n=>e({...t,lpmm_mode:n}),children:[a.jsx(Dt,{children:a.jsx(It,{placeholder:"选择 LPMM 模式"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"classic",children:"经典模式"}),a.jsx(Pe,{value:"agent",children:"Agent 模式"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"同义词搜索 TopK"}),a.jsx(Me,{type:"number",min:"1",value:t.rag_synonym_search_top_k,onChange:n=>e({...t,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"同义词阈值"}),a.jsx(Me,{type:"number",step:"0.1",min:"0",max:"1",value:t.rag_synonym_threshold,onChange:n=>e({...t,rag_synonym_threshold:parseFloat(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"实体提取线程数"}),a.jsx(Me,{type:"number",min:"1",value:t.info_extraction_workers,onChange:n=>e({...t,info_extraction_workers:parseInt(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"嵌入向量维度"}),a.jsx(Me,{type:"number",min:"1",value:t.embedding_dimension,onChange:n=>e({...t,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function nte({config:t,onChange:e}){const[n,r]=S.useState(""),[s,i]=S.useState("WARNING"),l=()=>{n&&!t.suppress_libraries.includes(n)&&(e({...t,suppress_libraries:[...t.suppress_libraries,n]}),r(""))},c=v=>{e({...t,suppress_libraries:t.suppress_libraries.filter(b=>b!==v)})},d=()=>{n&&!t.library_log_levels[n]&&(e({...t,library_log_levels:{...t.library_log_levels,[n]:s}}),r(""),i("WARNING"))},h=v=>{const b={...t.library_log_levels};delete b[v],e({...t,library_log_levels:b})},m=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],p=["FULL","compact","lite"],x=["none","title","full"];return a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日期格式"}),a.jsx(Me,{value:t.date_style,onChange:v=>e({...t,date_style:v.target.value}),placeholder:"例如: m-d H:i:s"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日志级别样式"}),a.jsxs(Lt,{value:t.log_level_style,onValueChange:v=>e({...t,log_level_style:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:p.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日志文本颜色"}),a.jsxs(Lt,{value:t.color_text,onValueChange:v=>e({...t,color_text:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:x.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"全局日志级别"}),a.jsxs(Lt,{value:t.log_level,onValueChange:v=>e({...t,log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"控制台日志级别"}),a.jsxs(Lt,{value:t.console_log_level,onValueChange:v=>e({...t,console_log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"文件日志级别"}),a.jsxs(Lt,{value:t.file_log_level,onValueChange:v=>e({...t,file_log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"完全屏蔽的库"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Me,{value:n,onChange:v=>r(v.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),l())}}),a.jsx(ie,{onClick:l,size:"sm",className:"flex-shrink-0",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:t.suppress_libraries.map(v=>a.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[a.jsx("span",{className:"text-sm",children:v}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>c(v),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},v))})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"特定库的日志级别"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Me,{value:n,onChange:v=>r(v.target.value),placeholder:"输入库名",className:"flex-1"}),a.jsxs(Lt,{value:s,onValueChange:i,children:[a.jsx(Dt,{className:"w-32",children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]}),a.jsx(ie,{onClick:d,size:"sm",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"space-y-2",children:Object.entries(t.library_log_levels).map(([v,b])=>a.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[a.jsx("span",{className:"text-sm font-medium",children:v}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:b}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>h(v),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},v))})]})]})}function rte({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示 Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),a.jsx(jt,{checked:t.show_prompt,onCheckedChange:n=>e({...t,show_prompt:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示回复器 Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),a.jsx(jt,{checked:t.show_replyer_prompt,onCheckedChange:n=>e({...t,show_replyer_prompt:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示回复器推理"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),a.jsx(jt,{checked:t.show_replyer_reasoning,onCheckedChange:n=>e({...t,show_replyer_reasoning:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示 Jargon Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),a.jsx(jt,{checked:t.show_jargon_prompt,onCheckedChange:n=>e({...t,show_jargon_prompt:n})})]})]})]})}function ste({config:t,onChange:e}){const[n,r]=S.useState(""),s=()=>{n&&!t.auth_token.includes(n)&&(e({...t,auth_token:[...t.auth_token,n]}),r(""))},i=l=>{e({...t,auth_token:t.auth_token.filter((c,d)=>d!==l)})};return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"启用自定义服务器"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),a.jsx(jt,{checked:t.use_custom,onCheckedChange:l=>e({...t,use_custom:l})})]}),t.use_custom&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"主机地址"}),a.jsx(Me,{value:t.host,onChange:l=>e({...t,host:l.target.value}),placeholder:"127.0.0.1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"端口号"}),a.jsx(Me,{type:"number",value:t.port,onChange:l=>e({...t,port:parseInt(l.target.value)}),placeholder:"8090"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"连接模式"}),a.jsxs(Lt,{value:t.mode,onValueChange:l=>e({...t,mode:l}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"ws",children:"WebSocket (ws)"}),a.jsx(Pe,{value:"tcp",children:"TCP"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.use_wss,onCheckedChange:l=>e({...t,use_wss:l}),disabled:t.mode!=="ws"}),a.jsx(te,{children:"使用 WSS 安全连接"})]})]}),t.use_wss&&t.mode==="ws"&&a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"SSL 证书文件路径"}),a.jsx(Me,{value:t.cert_file,onChange:l=>e({...t,cert_file:l.target.value}),placeholder:"cert.pem"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"SSL 密钥文件路径"}),a.jsx(Me,{value:t.key_file,onChange:l=>e({...t,key_file:l.target.value}),placeholder:"key.pem"})]})]})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"认证令牌"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Me,{value:n,onChange:l=>r(l.target.value),placeholder:"输入认证令牌",onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),s())}}),a.jsx(ie,{onClick:s,size:"sm",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"space-y-2",children:t.auth_token.map((l,c)=>a.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[a.jsx("span",{className:"text-sm font-mono",children:l}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>i(c),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},c))})]})]})}function ite({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"启用统计信息发送"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),a.jsx(jt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})})]})]})}const Mc=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{className:"relative w-full overflow-auto",children:a.jsx("table",{ref:n,className:ye("w-full caption-bottom text-sm",t),...e})}));Mc.displayName="Table";const Ec=S.forwardRef(({className:t,...e},n)=>a.jsx("thead",{ref:n,className:ye("[&_tr]:border-b",t),...e}));Ec.displayName="TableHeader";const _c=S.forwardRef(({className:t,...e},n)=>a.jsx("tbody",{ref:n,className:ye("[&_tr:last-child]:border-0",t),...e}));_c.displayName="TableBody";const ate=S.forwardRef(({className:t,...e},n)=>a.jsx("tfoot",{ref:n,className:ye("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));ate.displayName="TableFooter";const xr=S.forwardRef(({className:t,...e},n)=>a.jsx("tr",{ref:n,className:ye("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));xr.displayName="TableRow";const xt=S.forwardRef(({className:t,...e},n)=>a.jsx("th",{ref:n,className:ye("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));xt.displayName="TableHead";const it=S.forwardRef(({className:t,...e},n)=>a.jsx("td",{ref:n,className:ye("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));it.displayName="TableCell";const lte=S.forwardRef(({className:t,...e},n)=>a.jsx("caption",{ref:n,className:ye("mt-4 text-sm text-muted-foreground",t),...e}));lte.displayName="TableCaption";const ss=S.forwardRef(({className:t,...e},n)=>a.jsx(A9,{ref:n,className:ye("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:a.jsx(rq,{className:ye("grid place-content-center text-current"),children:a.jsx(hc,{className:"h-4 w-4"})})}));ss.displayName=A9.displayName;function ote(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(null),[T,A]=S.useState(null),[_,D]=S.useState(!1),[E,R]=S.useState(null),[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,de]=S.useState(new Set),[W,J]=S.useState(!1),[$,ae]=S.useState(1),[ne,ce]=S.useState(20),[z,xe]=S.useState(""),{toast:Y}=Pr(),P=S.useRef(null),K=S.useRef(!0);S.useEffect(()=>{H()},[]);const H=async()=>{try{r(!0);const ee=await Vu();e(ee.api_providers||[]),h(!1),K.current=!1}catch(ee){console.error("加载配置失败:",ee)}finally{r(!1)}},fe=async()=>{try{p(!0),xw().catch(()=>{}),v(!0)}catch(ee){console.error("重启失败:",ee),v(!1),Y({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),p(!1)}},ve=async()=>{try{i(!0),P.current&&clearTimeout(P.current);const ee=await Vu();ee.api_providers=t,await wg(ee),h(!1),Y({title:"保存成功",description:"正在重启麦麦..."}),await fe()}catch(ee){console.error("保存配置失败:",ee),Y({title:"保存失败",description:ee.message,variant:"destructive"}),i(!1)}},Re=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},ue=()=>{v(!1),p(!1),Y({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},We=S.useCallback(async ee=>{if(!K.current)try{c(!0),await h2("api_providers",ee),h(!1)}catch(Se){console.error("自动保存失败:",Se),h(!0)}finally{c(!1)}},[]);S.useEffect(()=>{if(!K.current)return h(!0),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{We(t)},2e3),()=>{P.current&&clearTimeout(P.current)}},[t,We]);const ct=async()=>{try{i(!0),P.current&&clearTimeout(P.current);const ee=await Vu();ee.api_providers=t,await wg(ee),h(!1),Y({title:"保存成功",description:"模型提供商配置已保存"})}catch(ee){console.error("保存配置失败:",ee),Y({title:"保存失败",description:ee.message,variant:"destructive"})}finally{i(!1)}},Oe=(ee,Se)=>{j(ee||{name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),A(Se),F(!1),k(!0)},nt=async()=>{if(O?.api_key)try{await navigator.clipboard.writeText(O.api_key),Y({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{Y({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},ut=()=>{if(!O)return;const ee={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};if(T!==null){const Se=[...t];Se[T]=ee,e(Se)}else e([...t,ee]);k(!1),j(null),A(null)},Ct=ee=>{if(!ee&&O){const Se={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};j(Se)}k(ee)},In=ee=>{R(ee),D(!0)},Tn=()=>{if(E!==null){const ee=t.filter((Se,Be)=>Be!==E);e(ee),Y({title:"删除成功",description:"提供商已从列表中移除"})}D(!1),R(null)},Jn=ee=>{const Se=new Set(V);Se.has(ee)?Se.delete(ee):Se.add(ee),de(Se)},nn=()=>{if(V.size===qn.length)de(new Set);else{const ee=qn.map((Se,Be)=>t.findIndex(rt=>rt===qn[Be]));de(new Set(ee))}},_t=()=>{if(V.size===0){Y({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}J(!0)},Yr=()=>{const ee=t.filter((Se,Be)=>!V.has(Be));e(ee),de(new Set),J(!1),Y({title:"批量删除成功",description:`已删除 ${V.size} 个提供商`})},qn=t.filter(ee=>{if(!L)return!0;const Se=L.toLowerCase();return ee.name.toLowerCase().includes(Se)||ee.base_url.toLowerCase().includes(Se)||ee.client_type.toLowerCase().includes(Se)}),or=Math.ceil(qn.length/ne),yn=qn.slice(($-1)*ne,$*ne),ft=()=>{const ee=parseInt(z);ee>=1&&ee<=or&&(ae(ee),xe(""))};return n?a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型提供商配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 API 提供商配置"})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[V.size>0&&a.jsxs(ie,{onClick:_t,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",V.size,")"]}),a.jsxs(ie,{onClick:()=>Oe(null,null),size:"sm",className:"w-full sm:w-auto",children:[a.jsx(Wr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),a.jsxs(ie,{onClick:ct,disabled:s||l||!d||m,size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),s?"保存中...":l?"自动保存中...":d?"保存配置":"已保存"]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:s||l||m,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),m?"重启中...":d?"保存并重启":"重启麦麦"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重启麦麦?"}),a.jsx(dn,{children:d?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:d?ve:fe,children:d?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),a.jsxs(vn,{className:"h-[calc(100vh-260px)]",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[a.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索提供商名称、URL 或类型...",value:L,onChange:ee=>U(ee.target.value),className:"pl-9"})]}),L&&a.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",qn.length," 个结果"]})]}),a.jsx("div",{className:"md:hidden space-y-3",children:qn.length===0?a.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:L?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):yn.map((ee,Se)=>{const Be=t.findIndex(rt=>rt===ee);return a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h3",{className:"font-semibold text-base truncate",children:ee.name}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:ee.base_url})]}),a.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Oe(ee,Be),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>In(Be),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),a.jsx("p",{className:"font-medium",children:ee.client_type})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),a.jsx("p",{className:"font-medium",children:ee.max_retry})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),a.jsx("p",{className:"font-medium",children:ee.timeout})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),a.jsx("p",{className:"font-medium",children:ee.retry_interval})]})]})]},Se)})}),a.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:V.size===qn.length&&qn.length>0,onCheckedChange:nn})}),a.jsx(xt,{children:"名称"}),a.jsx(xt,{children:"基础URL"}),a.jsx(xt,{children:"客户端类型"}),a.jsx(xt,{className:"text-right",children:"最大重试"}),a.jsx(xt,{className:"text-right",children:"超时(秒)"}),a.jsx(xt,{className:"text-right",children:"重试间隔(秒)"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:yn.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center text-muted-foreground py-8",children:L?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):yn.map((ee,Se)=>{const Be=t.findIndex(rt=>rt===ee);return a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:V.has(Be),onCheckedChange:()=>Jn(Be)})}),a.jsx(it,{className:"font-medium",children:ee.name}),a.jsx(it,{className:"max-w-xs truncate",title:ee.base_url,children:ee.base_url}),a.jsx(it,{children:ee.client_type}),a.jsx(it,{className:"text-right",children:ee.max_retry}),a.jsx(it,{className:"text-right",children:ee.timeout}),a.jsx(it,{className:"text-right",children:ee.retry_interval}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Oe(ee,Be),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>In(Be),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Se)})})]})}),qn.length>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:ne.toString(),onValueChange:ee=>{ce(parseInt(ee)),ae(1),de(new Set)},children:[a.jsx(Dt,{id:"page-size-provider",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",($-1)*ne+1," 到"," ",Math.min($*ne,qn.length)," 条,共 ",qn.length," 条"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ae(1),disabled:$===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(ee=>Math.max(1,ee-1)),disabled:$===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:z,onChange:ee=>xe(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&ft(),placeholder:$.toString(),className:"w-16 h-8 text-center",min:1,max:or}),a.jsx(ie,{variant:"outline",size:"sm",onClick:ft,disabled:!z,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(ee=>ee+1),disabled:$>=or,children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ae(or),disabled:$>=or,className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]}),a.jsx(Rr,{open:b,onOpenChange:Ct,children:a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:T!==null?"编辑提供商":"添加提供商"}),a.jsx(Gr,{children:"配置 API 提供商的连接信息和参数"})]}),a.jsxs("div",{className:"grid gap-4 py-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"name",children:"名称 *"}),a.jsx(Me,{id:"name",value:O?.name||"",onChange:ee=>j(Se=>Se?{...Se,name:ee.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"base_url",children:"基础 URL *"}),a.jsx(Me,{id:"base_url",value:O?.base_url||"",onChange:ee=>j(Se=>Se?{...Se,base_url:ee.target.value}:null),placeholder:"https://api.example.com/v1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"api_key",children:"API Key *"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{id:"api_key",type:Q?"text":"password",value:O?.api_key||"",onChange:ee=>j(Se=>Se?{...Se,api_key:ee.target.value}:null),placeholder:"sk-...",className:"flex-1"}),a.jsx(ie,{type:"button",variant:"outline",size:"icon",onClick:()=>F(!Q),title:Q?"隐藏密钥":"显示密钥",children:Q?a.jsx(Yb,{className:"h-4 w-4"}):a.jsx($i,{className:"h-4 w-4"})}),a.jsx(ie,{type:"button",variant:"outline",size:"icon",onClick:nt,title:"复制密钥",children:a.jsx(Xb,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"client_type",children:"客户端类型"}),a.jsxs(Lt,{value:O?.client_type||"openai",onValueChange:ee=>j(Se=>Se?{...Se,client_type:ee}:null),children:[a.jsx(Dt,{id:"client_type",children:a.jsx(It,{placeholder:"选择客户端类型"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"openai",children:"OpenAI"}),a.jsx(Pe,{value:"gemini",children:"Gemini"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_retry",children:"最大重试"}),a.jsx(Me,{id:"max_retry",type:"number",min:"0",value:O?.max_retry??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,max_retry:Se}:null)},placeholder:"默认: 2"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"timeout",children:"超时(秒)"}),a.jsx(Me,{id:"timeout",type:"number",min:"1",value:O?.timeout??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,timeout:Se}:null)},placeholder:"默认: 30"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),a.jsx(Me,{id:"retry_interval",type:"number",min:"1",value:O?.retry_interval??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,retry_interval:Se}:null)},placeholder:"默认: 10"})]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>k(!1),children:"取消"}),a.jsx(ie,{onClick:ut,children:"保存"})]})]})}),a.jsx(mn,{open:_,onOpenChange:D,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除提供商 "',E!==null?t[E]?.name:"",'" 吗? 此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:Tn,children:"删除"})]})]})}),a.jsx(mn,{open:W,onOpenChange:J,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["确定要删除选中的 ",V.size," 个提供商吗? 此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:Yr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),x&&a.jsx(vw,{onRestartComplete:Re,onRestartFailed:ue})]})}var a8=1,cte=.9,ute=.8,dte=.17,cb=.1,ub=.999,hte=.9999,fte=.99,mte=/[\\\/_+.#"@\[\(\{&]/,pte=/[\\\/_+.#"@\[\(\{&]/g,gte=/[\s-]/,L_=/[\s-]/g;function u4(t,e,n,r,s,i,l){if(i===e.length)return s===t.length?a8:fte;var c=`${s},${i}`;if(l[c]!==void 0)return l[c];for(var d=r.charAt(i),h=n.indexOf(d,s),m=0,p,x,v,b;h>=0;)p=u4(t,e,n,r,h+1,i+1,l),p>m&&(h===s?p*=a8:mte.test(t.charAt(h-1))?(p*=ute,v=t.slice(s,h-1).match(pte),v&&s>0&&(p*=Math.pow(ub,v.length))):gte.test(t.charAt(h-1))?(p*=cte,b=t.slice(s,h-1).match(L_),b&&s>0&&(p*=Math.pow(ub,b.length))):(p*=dte,s>0&&(p*=Math.pow(ub,h-s))),t.charAt(h)!==e.charAt(i)&&(p*=hte)),(pp&&(p=x*cb)),p>m&&(m=p),h=n.indexOf(d,h+1);return l[c]=m,m}function l8(t){return t.toLowerCase().replace(L_," ")}function xte(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,u4(t,e,l8(t),l8(e),0,0,{})}var vte=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],To=vte.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Bh='[cmdk-group=""]',db='[cmdk-group-items=""]',yte='[cmdk-group-heading=""]',I_='[cmdk-item=""]',o8=`${I_}:not([aria-disabled="true"])`,d4="cmdk-item-select",Pu="data-value",bte=(t,e,n)=>xte(t,e,n),q_=S.createContext(void 0),g0=()=>S.useContext(q_),F_=S.createContext(void 0),o5=()=>S.useContext(F_),Q_=S.createContext(void 0),$_=S.forwardRef((t,e)=>{let n=Bu(()=>{var Y,P;return{search:"",value:(P=(Y=t.value)!=null?Y:t.defaultValue)!=null?P:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Bu(()=>new Set),s=Bu(()=>new Map),i=Bu(()=>new Map),l=Bu(()=>new Set),c=H_(t),{label:d,children:h,value:m,onValueChange:p,filter:x,shouldFilter:v,loop:b,disablePointerSelection:k=!1,vimBindings:O=!0,...j}=t,T=ji(),A=ji(),_=ji(),D=S.useRef(null),E=Ete();Nc(()=>{if(m!==void 0){let Y=m.trim();n.current.value=Y,R.emit()}},[m]),Nc(()=>{E(6,de)},[]);let R=S.useMemo(()=>({subscribe:Y=>(l.current.add(Y),()=>l.current.delete(Y)),snapshot:()=>n.current,setState:(Y,P,K)=>{var H,fe,ve,Re;if(!Object.is(n.current[Y],P)){if(n.current[Y]=P,Y==="search")V(),L(),E(1,U);else if(Y==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ue=document.getElementById(_);ue?ue.focus():(H=document.getElementById(T))==null||H.focus()}if(E(7,()=>{var ue;n.current.selectedItemId=(ue=W())==null?void 0:ue.id,R.emit()}),K||E(5,de),((fe=c.current)==null?void 0:fe.value)!==void 0){let ue=P??"";(Re=(ve=c.current).onValueChange)==null||Re.call(ve,ue);return}}R.emit()}},emit:()=>{l.current.forEach(Y=>Y())}}),[]),Q=S.useMemo(()=>({value:(Y,P,K)=>{var H;P!==((H=i.current.get(Y))==null?void 0:H.value)&&(i.current.set(Y,{value:P,keywords:K}),n.current.filtered.items.set(Y,F(P,K)),E(2,()=>{L(),R.emit()}))},item:(Y,P)=>(r.current.add(Y),P&&(s.current.has(P)?s.current.get(P).add(Y):s.current.set(P,new Set([Y]))),E(3,()=>{V(),L(),n.current.value||U(),R.emit()}),()=>{i.current.delete(Y),r.current.delete(Y),n.current.filtered.items.delete(Y);let K=W();E(4,()=>{V(),K?.getAttribute("id")===Y&&U(),R.emit()})}),group:Y=>(s.current.has(Y)||s.current.set(Y,new Set),()=>{i.current.delete(Y),s.current.delete(Y)}),filter:()=>c.current.shouldFilter,label:d||t["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:T,inputId:_,labelId:A,listInnerRef:D}),[]);function F(Y,P){var K,H;let fe=(H=(K=c.current)==null?void 0:K.filter)!=null?H:bte;return Y?fe(Y,n.current.search,P):0}function L(){if(!n.current.search||c.current.shouldFilter===!1)return;let Y=n.current.filtered.items,P=[];n.current.filtered.groups.forEach(H=>{let fe=s.current.get(H),ve=0;fe.forEach(Re=>{let ue=Y.get(Re);ve=Math.max(ue,ve)}),P.push([H,ve])});let K=D.current;J().sort((H,fe)=>{var ve,Re;let ue=H.getAttribute("id"),We=fe.getAttribute("id");return((ve=Y.get(We))!=null?ve:0)-((Re=Y.get(ue))!=null?Re:0)}).forEach(H=>{let fe=H.closest(db);fe?fe.appendChild(H.parentElement===fe?H:H.closest(`${db} > *`)):K.appendChild(H.parentElement===K?H:H.closest(`${db} > *`))}),P.sort((H,fe)=>fe[1]-H[1]).forEach(H=>{var fe;let ve=(fe=D.current)==null?void 0:fe.querySelector(`${Bh}[${Pu}="${encodeURIComponent(H[0])}"]`);ve?.parentElement.appendChild(ve)})}function U(){let Y=J().find(K=>K.getAttribute("aria-disabled")!=="true"),P=Y?.getAttribute(Pu);R.setState("value",P||void 0)}function V(){var Y,P,K,H;if(!n.current.search||c.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let fe=0;for(let ve of r.current){let Re=(P=(Y=i.current.get(ve))==null?void 0:Y.value)!=null?P:"",ue=(H=(K=i.current.get(ve))==null?void 0:K.keywords)!=null?H:[],We=F(Re,ue);n.current.filtered.items.set(ve,We),We>0&&fe++}for(let[ve,Re]of s.current)for(let ue of Re)if(n.current.filtered.items.get(ue)>0){n.current.filtered.groups.add(ve);break}n.current.filtered.count=fe}function de(){var Y,P,K;let H=W();H&&(((Y=H.parentElement)==null?void 0:Y.firstChild)===H&&((K=(P=H.closest(Bh))==null?void 0:P.querySelector(yte))==null||K.scrollIntoView({block:"nearest"})),H.scrollIntoView({block:"nearest"}))}function W(){var Y;return(Y=D.current)==null?void 0:Y.querySelector(`${I_}[aria-selected="true"]`)}function J(){var Y;return Array.from(((Y=D.current)==null?void 0:Y.querySelectorAll(o8))||[])}function $(Y){let P=J()[Y];P&&R.setState("value",P.getAttribute(Pu))}function ae(Y){var P;let K=W(),H=J(),fe=H.findIndex(Re=>Re===K),ve=H[fe+Y];(P=c.current)!=null&&P.loop&&(ve=fe+Y<0?H[H.length-1]:fe+Y===H.length?H[0]:H[fe+Y]),ve&&R.setState("value",ve.getAttribute(Pu))}function ne(Y){let P=W(),K=P?.closest(Bh),H;for(;K&&!H;)K=Y>0?Ate(K,Bh):Mte(K,Bh),H=K?.querySelector(o8);H?R.setState("value",H.getAttribute(Pu)):ae(Y)}let ce=()=>$(J().length-1),z=Y=>{Y.preventDefault(),Y.metaKey?ce():Y.altKey?ne(1):ae(1)},xe=Y=>{Y.preventDefault(),Y.metaKey?$(0):Y.altKey?ne(-1):ae(-1)};return S.createElement(To.div,{ref:e,tabIndex:-1,...j,"cmdk-root":"",onKeyDown:Y=>{var P;(P=j.onKeyDown)==null||P.call(j,Y);let K=Y.nativeEvent.isComposing||Y.keyCode===229;if(!(Y.defaultPrevented||K))switch(Y.key){case"n":case"j":{O&&Y.ctrlKey&&z(Y);break}case"ArrowDown":{z(Y);break}case"p":case"k":{O&&Y.ctrlKey&&xe(Y);break}case"ArrowUp":{xe(Y);break}case"Home":{Y.preventDefault(),$(0);break}case"End":{Y.preventDefault(),ce();break}case"Enter":{Y.preventDefault();let H=W();if(H){let fe=new Event(d4);H.dispatchEvent(fe)}}}}},S.createElement("label",{"cmdk-label":"",htmlFor:Q.inputId,id:Q.labelId,style:Dte},d),Px(t,Y=>S.createElement(F_.Provider,{value:R},S.createElement(q_.Provider,{value:Q},Y))))}),wte=S.forwardRef((t,e)=>{var n,r;let s=ji(),i=S.useRef(null),l=S.useContext(Q_),c=g0(),d=H_(t),h=(r=(n=d.current)==null?void 0:n.forceMount)!=null?r:l?.forceMount;Nc(()=>{if(!h)return c.item(s,l?.id)},[h]);let m=U_(s,i,[t.value,t.children,i],t.keywords),p=o5(),x=vo(E=>E.value&&E.value===m.current),v=vo(E=>h||c.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);S.useEffect(()=>{let E=i.current;if(!(!E||t.disabled))return E.addEventListener(d4,b),()=>E.removeEventListener(d4,b)},[v,t.onSelect,t.disabled]);function b(){var E,R;k(),(R=(E=d.current).onSelect)==null||R.call(E,m.current)}function k(){p.setState("value",m.current,!0)}if(!v)return null;let{disabled:O,value:j,onSelect:T,forceMount:A,keywords:_,...D}=t;return S.createElement(To.div,{ref:oo(i,e),...D,id:s,"cmdk-item":"",role:"option","aria-disabled":!!O,"aria-selected":!!x,"data-disabled":!!O,"data-selected":!!x,onPointerMove:O||c.getDisablePointerSelection()?void 0:k,onClick:O?void 0:b},t.children)}),Ste=S.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,l=ji(),c=S.useRef(null),d=S.useRef(null),h=ji(),m=g0(),p=vo(v=>s||m.filter()===!1?!0:v.search?v.filtered.groups.has(l):!0);Nc(()=>m.group(l),[]),U_(l,c,[t.value,t.heading,d]);let x=S.useMemo(()=>({id:l,forceMount:s}),[s]);return S.createElement(To.div,{ref:oo(c,e),...i,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},n&&S.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),Px(t,v=>S.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},S.createElement(Q_.Provider,{value:x},v))))}),kte=S.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=S.useRef(null),i=vo(l=>!l.search);return!n&&!i?null:S.createElement(To.div,{ref:oo(s,e),...r,"cmdk-separator":"",role:"separator"})}),Ote=S.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=o5(),l=vo(h=>h.search),c=vo(h=>h.selectedItemId),d=g0();return S.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),S.createElement(To.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":c,id:d.inputId,type:"text",value:s?t.value:l,onChange:h=>{s||i.setState("search",h.target.value),n?.(h.target.value)}})}),jte=S.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=S.useRef(null),l=S.useRef(null),c=vo(h=>h.selectedItemId),d=g0();return S.useEffect(()=>{if(l.current&&i.current){let h=l.current,m=i.current,p,x=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let v=h.offsetHeight;m.style.setProperty("--cmdk-list-height",v.toFixed(1)+"px")})});return x.observe(h),()=>{cancelAnimationFrame(p),x.unobserve(h)}}},[]),S.createElement(To.div,{ref:oo(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":r,id:d.listId},Px(t,h=>S.createElement("div",{ref:oo(l,d.listInnerRef),"cmdk-list-sizer":""},h)))}),Nte=S.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:l,...c}=t;return S.createElement(W4,{open:n,onOpenChange:r},S.createElement($4,{container:l},S.createElement(nx,{"cmdk-overlay":"",className:s}),S.createElement(rx,{"aria-label":t.label,"cmdk-dialog":"",className:i},S.createElement($_,{ref:e,...c}))))}),Cte=S.forwardRef((t,e)=>vo(n=>n.filtered.count===0)?S.createElement(To.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),Tte=S.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return S.createElement(To.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Px(t,l=>S.createElement("div",{"aria-hidden":!0},l)))}),Is=Object.assign($_,{List:jte,Item:wte,Input:Ote,Group:Ste,Separator:kte,Dialog:Nte,Empty:Cte,Loading:Tte});function Ate(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function Mte(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function H_(t){let e=S.useRef(t);return Nc(()=>{e.current=t}),e}var Nc=typeof window>"u"?S.useEffect:S.useLayoutEffect;function Bu(t){let e=S.useRef();return e.current===void 0&&(e.current=t()),e}function vo(t){let e=o5(),n=()=>t(e.snapshot());return S.useSyncExternalStore(e.subscribe,n,n)}function U_(t,e,n,r=[]){let s=S.useRef(),i=g0();return Nc(()=>{var l;let c=(()=>{var h;for(let m of n){if(typeof m=="string")return m.trim();if(typeof m=="object"&&"current"in m)return m.current?(h=m.current.textContent)==null?void 0:h.trim():s.current}})(),d=r.map(h=>h.trim());i.value(t,c,d),(l=e.current)==null||l.setAttribute(Pu,c),s.current=c}),s}var Ete=()=>{let[t,e]=S.useState(),n=Bu(()=>new Map);return Nc(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function _te(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function Px({asChild:t,children:e},n){return t&&S.isValidElement(e)?S.cloneElement(_te(e),{ref:e.ref},n(e.props.children)):n(e)}var Dte={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const V_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is,{ref:n,className:ye("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));V_.displayName=Is.displayName;const W_=S.forwardRef(({className:t,...e},n)=>a.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[a.jsx(Bs,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),a.jsx(Is.Input,{ref:n,className:ye("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));W_.displayName=Is.Input.displayName;const G_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.List,{ref:n,className:ye("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));G_.displayName=Is.List.displayName;const X_=S.forwardRef((t,e)=>a.jsx(Is.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));X_.displayName=Is.Empty.displayName;const Y_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.Group,{ref:n,className:ye("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...e}));Y_.displayName=Is.Group.displayName;const Rte=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.Separator,{ref:n,className:ye("-mx-1 h-px bg-border",t),...e}));Rte.displayName=Is.Separator.displayName;const K_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.Item,{ref:n,className:ye("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...e}));K_.displayName=Is.Item.displayName;function zte({options:t,selected:e,onChange:n,placeholder:r="选择选项...",emptyText:s="未找到选项",className:i}){const[l,c]=S.useState(!1),d=m=>{e.includes(m)?n(e.filter(p=>p!==m)):n([...e,m])},h=m=>{n(e.filter(p=>p!==m))};return a.jsxs(uo,{open:l,onOpenChange:c,children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",role:"combobox","aria-expanded":l,className:ye("w-full justify-between min-h-10 h-auto",i),children:[a.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:e.length===0?a.jsx("span",{className:"text-muted-foreground",children:r}):e.map(m=>{const p=t.find(x=>x.value===m);return a.jsxs(On,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80",onClick:x=>{x.stopPropagation(),h(m)},children:[p?.label||m,a.jsx(Gf,{className:"ml-1 h-3 w-3",strokeWidth:2,fill:"none"})]},m)})}),a.jsx(Sq,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),a.jsx(fl,{className:"w-full p-0",align:"start",children:a.jsxs(V_,{children:[a.jsx(W_,{placeholder:"搜索...",className:"h-9"}),a.jsxs(G_,{children:[a.jsx(X_,{children:s}),a.jsx(Y_,{children:t.map(m=>{const p=e.includes(m.value);return a.jsxs(K_,{value:m.value,onSelect:()=>d(m.value),children:[a.jsx("div",{className:ye("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",p?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:a.jsx(hc,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),a.jsx("span",{children:m.label})]},m.value)})})]})]})})]})}function Pte(){const[t,e]=S.useState([]),[n,r]=S.useState([]),[s,i]=S.useState([]),[l,c]=S.useState(null),[d,h]=S.useState(!0),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,A]=S.useState(!1),[_,D]=S.useState(!1),[E,R]=S.useState(null),[Q,F]=S.useState(null),[L,U]=S.useState(!1),[V,de]=S.useState(null),[W,J]=S.useState(""),[$,ae]=S.useState(new Set),[ne,ce]=S.useState(!1),[z,xe]=S.useState(1),[Y,P]=S.useState(20),[K,H]=S.useState(""),{toast:fe}=Pr(),ve=S.useRef(null),Re=S.useRef(null),ue=S.useRef(!0);S.useEffect(()=>{We()},[]);const We=async()=>{try{h(!0);const re=await Vu(),Ae=re.models||[];e(Ae),i(Ae.map(yt=>yt.name));const pt=re.api_providers||[];r(pt.map(yt=>yt.name)),c(re.model_task_config||null),k(!1),ue.current=!1}catch(re){console.error("加载配置失败:",re)}finally{h(!1)}},ct=async()=>{try{j(!0),xw().catch(()=>{}),A(!0)}catch(re){console.error("重启失败:",re),A(!1),fe({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),j(!1)}},Oe=async()=>{try{p(!0),ve.current&&clearTimeout(ve.current),Re.current&&clearTimeout(Re.current);const re=await Vu();re.models=t,re.model_task_config=l,await wg(re),k(!1),fe({title:"保存成功",description:"正在重启麦麦..."}),await ct()}catch(re){console.error("保存配置失败:",re),fe({title:"保存失败",description:re.message,variant:"destructive"}),p(!1)}},nt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},ut=()=>{A(!1),j(!1),fe({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Ct=S.useCallback(async re=>{if(!ue.current)try{v(!0),await h2("models",re),k(!1)}catch(Ae){console.error("自动保存模型列表失败:",Ae),k(!0)}finally{v(!1)}},[]),In=S.useCallback(async re=>{if(!ue.current)try{v(!0),await h2("model_task_config",re),k(!1)}catch(Ae){console.error("自动保存任务配置失败:",Ae),k(!0)}finally{v(!1)}},[]);S.useEffect(()=>{if(!ue.current)return k(!0),ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{Ct(t)},2e3),()=>{ve.current&&clearTimeout(ve.current)}},[t,Ct]),S.useEffect(()=>{if(!(ue.current||!l))return k(!0),Re.current&&clearTimeout(Re.current),Re.current=setTimeout(()=>{In(l)},2e3),()=>{Re.current&&clearTimeout(Re.current)}},[l,In]);const Tn=async()=>{try{p(!0),ve.current&&clearTimeout(ve.current),Re.current&&clearTimeout(Re.current);const re=await Vu();re.models=t,re.model_task_config=l,await wg(re),k(!1),fe({title:"保存成功",description:"模型配置已保存"}),await We()}catch(re){console.error("保存配置失败:",re),fe({title:"保存失败",description:re.message,variant:"destructive"})}finally{p(!1)}},Jn=(re,Ae)=>{R(re||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),F(Ae),D(!0)},nn=()=>{if(!E)return;const re={...E,price_in:E.price_in??0,price_out:E.price_out??0};let Ae;Q!==null?(Ae=[...t],Ae[Q]=re):Ae=[...t,re],e(Ae),i(Ae.map(pt=>pt.name)),D(!1),R(null),F(null)},_t=re=>{if(!re&&E){const Ae={...E,price_in:E.price_in??0,price_out:E.price_out??0};R(Ae)}D(re)},Yr=re=>{de(re),U(!0)},qn=()=>{if(V!==null){const re=t.filter((Ae,pt)=>pt!==V);e(re),i(re.map(Ae=>Ae.name)),fe({title:"删除成功",description:"模型已从列表中移除"})}U(!1),de(null)},or=re=>{const Ae=new Set($);Ae.has(re)?Ae.delete(re):Ae.add(re),ae(Ae)},yn=()=>{if($.size===Be.length)ae(new Set);else{const re=Be.map((Ae,pt)=>t.findIndex(yt=>yt===Be[pt]));ae(new Set(re))}},ft=()=>{if($.size===0){fe({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ce(!0)},ee=()=>{const re=t.filter((Ae,pt)=>!$.has(pt));e(re),i(re.map(Ae=>Ae.name)),ae(new Set),ce(!1),fe({title:"批量删除成功",description:`已删除 ${$.size} 个模型`})},Se=(re,Ae,pt)=>{l&&c({...l,[re]:{...l[re],[Ae]:pt}})},Be=t.filter(re=>{if(!W)return!0;const Ae=W.toLowerCase();return re.name.toLowerCase().includes(Ae)||re.model_identifier.toLowerCase().includes(Ae)||re.api_provider.toLowerCase().includes(Ae)}),rt=Math.ceil(Be.length/Y),Tt=Be.slice((z-1)*Y,z*Y),cr=()=>{const re=parseInt(K);re>=1&&re<=rt&&(xe(re),H(""))},Kr=re=>l?[l.utils?.model_list||[],l.utils_small?.model_list||[],l.tool_use?.model_list||[],l.replyer?.model_list||[],l.planner?.model_list||[],l.vlm?.model_list||[],l.voice?.model_list||[],l.embedding?.model_list||[],l.lpmm_entity_extract?.model_list||[],l.lpmm_rdf_build?.model_list||[],l.lpmm_qa?.model_list||[]].some(pt=>pt.includes(re)):!1;return d?a.jsx(vn,{className:"h-full",children:a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理模型和任务配置"})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[a.jsxs(ie,{onClick:Tn,disabled:m||x||!b||O,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),m?"保存中...":x?"自动保存中...":b?"保存配置":"已保存"]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:m||x||O,size:"sm",className:"flex-1 sm:flex-none",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),O?"重启中...":b?"保存并重启":"重启麦麦"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重启麦麦?"}),a.jsx(dn,{children:b?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:b?Oe:ct,children:b?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),a.jsxs(hl,{defaultValue:"models",className:"w-full",children:[a.jsxs(ya,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[a.jsx($t,{value:"models",children:"模型配置"}),a.jsx($t,{value:"tasks",children:"模型任务配置"})]}),a.jsxs(kn,{value:"models",className:"space-y-4 mt-0",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[$.size>0&&a.jsxs(ie,{onClick:ft,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",$.size,")"]}),a.jsxs(ie,{onClick:()=>Jn(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(Wr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[a.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索模型名称、标识符或提供商...",value:W,onChange:re=>J(re.target.value),className:"pl-9"})]}),W&&a.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Be.length," 个结果"]})]}),a.jsx("div",{className:"md:hidden space-y-3",children:Tt.length===0?a.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:W?"未找到匹配的模型":"暂无模型配置"}):Tt.map((re,Ae)=>{const pt=t.findIndex(vs=>vs===re),yt=Kr(re.name);return a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("h3",{className:"font-semibold text-base",children:re.name}),a.jsx(On,{variant:yt?"default":"secondary",className:yt?"bg-green-600 hover:bg-green-700":"",children:yt?"已使用":"未使用"})]}),a.jsx("p",{className:"text-xs text-muted-foreground break-all",title:re.model_identifier,children:re.model_identifier})]}),a.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Jn(re,pt),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>Yr(pt),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),a.jsx("p",{className:"font-medium",children:re.api_provider})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),a.jsx("p",{className:"font-medium",children:re.force_stream_mode?"是":"否"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),a.jsxs("p",{className:"font-medium",children:["¥",re.price_in,"/M"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),a.jsxs("p",{className:"font-medium",children:["¥",re.price_out,"/M"]})]})]})]},Ae)})}),a.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:$.size===Be.length&&Be.length>0,onCheckedChange:yn})}),a.jsx(xt,{className:"w-24",children:"使用状态"}),a.jsx(xt,{children:"模型名称"}),a.jsx(xt,{children:"模型标识符"}),a.jsx(xt,{children:"提供商"}),a.jsx(xt,{className:"text-right",children:"输入价格"}),a.jsx(xt,{className:"text-right",children:"输出价格"}),a.jsx(xt,{className:"text-center",children:"强制流式"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:Tt.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:9,className:"text-center text-muted-foreground py-8",children:W?"未找到匹配的模型":"暂无模型配置"})}):Tt.map((re,Ae)=>{const pt=t.findIndex(vs=>vs===re),yt=Kr(re.name);return a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:$.has(pt),onCheckedChange:()=>or(pt)})}),a.jsx(it,{children:a.jsx(On,{variant:yt?"default":"secondary",className:yt?"bg-green-600 hover:bg-green-700":"",children:yt?"已使用":"未使用"})}),a.jsx(it,{className:"font-medium",children:re.name}),a.jsx(it,{className:"max-w-xs truncate",title:re.model_identifier,children:re.model_identifier}),a.jsx(it,{children:re.api_provider}),a.jsxs(it,{className:"text-right",children:["¥",re.price_in,"/M"]}),a.jsxs(it,{className:"text-right",children:["¥",re.price_out,"/M"]}),a.jsx(it,{className:"text-center",children:re.force_stream_mode?"是":"否"}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Jn(re,pt),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>Yr(pt),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Ae)})})]})}),Be.length>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:Y.toString(),onValueChange:re=>{P(parseInt(re)),xe(1),ae(new Set)},children:[a.jsx(Dt,{id:"page-size-model",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(z-1)*Y+1," 到"," ",Math.min(z*Y,Be.length)," 条,共 ",Be.length," 条"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>xe(1),disabled:z===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>xe(re=>Math.max(1,re-1)),disabled:z===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:K,onChange:re=>H(re.target.value),onKeyDown:re=>re.key==="Enter"&&cr(),placeholder:z.toString(),className:"w-16 h-8 text-center",min:1,max:rt}),a.jsx(ie,{variant:"outline",size:"sm",onClick:cr,disabled:!K,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>xe(re=>re+1),disabled:z>=rt,children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>xe(rt),disabled:z>=rt,className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]}),a.jsxs(kn,{value:"tasks",className:"space-y-6 mt-0",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),l&&a.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[a.jsx(Pi,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:l.utils,modelNames:s,onChange:(re,Ae)=>Se("utils",re,Ae)}),a.jsx(Pi,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:l.utils_small,modelNames:s,onChange:(re,Ae)=>Se("utils_small",re,Ae)}),a.jsx(Pi,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:l.tool_use,modelNames:s,onChange:(re,Ae)=>Se("tool_use",re,Ae)}),a.jsx(Pi,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:l.replyer,modelNames:s,onChange:(re,Ae)=>Se("replyer",re,Ae)}),a.jsx(Pi,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:l.planner,modelNames:s,onChange:(re,Ae)=>Se("planner",re,Ae)}),a.jsx(Pi,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:l.vlm,modelNames:s,onChange:(re,Ae)=>Se("vlm",re,Ae),hideTemperature:!0}),a.jsx(Pi,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:l.voice,modelNames:s,onChange:(re,Ae)=>Se("voice",re,Ae),hideTemperature:!0,hideMaxTokens:!0}),a.jsx(Pi,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:l.embedding,modelNames:s,onChange:(re,Ae)=>Se("embedding",re,Ae),hideTemperature:!0,hideMaxTokens:!0}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),a.jsx(Pi,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:l.lpmm_entity_extract,modelNames:s,onChange:(re,Ae)=>Se("lpmm_entity_extract",re,Ae)}),a.jsx(Pi,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:l.lpmm_rdf_build,modelNames:s,onChange:(re,Ae)=>Se("lpmm_rdf_build",re,Ae)}),a.jsx(Pi,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:l.lpmm_qa,modelNames:s,onChange:(re,Ae)=>Se("lpmm_qa",re,Ae)})]})]})]})]}),a.jsx(Rr,{open:_,onOpenChange:_t,children:a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:Q!==null?"编辑模型":"添加模型"}),a.jsx(Gr,{children:"配置模型的基本信息和参数"})]}),a.jsxs("div",{className:"grid gap-4 py-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"model_name",children:"模型名称 *"}),a.jsx(Me,{id:"model_name",value:E?.name||"",onChange:re=>R(Ae=>Ae?{...Ae,name:re.target.value}:null),placeholder:"例如: qwen3-30b"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"model_identifier",children:"模型标识符 *"}),a.jsx(Me,{id:"model_identifier",value:E?.model_identifier||"",onChange:re=>R(Ae=>Ae?{...Ae,model_identifier:re.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"API 提供商提供的模型 ID"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"api_provider",children:"API 提供商 *"}),a.jsxs(Lt,{value:E?.api_provider||"",onValueChange:re=>R(Ae=>Ae?{...Ae,api_provider:re}:null),children:[a.jsx(Dt,{id:"api_provider",children:a.jsx(It,{placeholder:"选择提供商"})}),a.jsx(Rt,{children:n.map(re=>a.jsx(Pe,{value:re,children:re},re))})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),a.jsx(Me,{id:"price_in",type:"number",step:"0.1",min:"0",value:E?.price_in??"",onChange:re=>{const Ae=re.target.value===""?null:parseFloat(re.target.value);R(pt=>pt?{...pt,price_in:Ae}:null)},placeholder:"默认: 0"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),a.jsx(Me,{id:"price_out",type:"number",step:"0.1",min:"0",value:E?.price_out??"",onChange:re=>{const Ae=re.target.value===""?null:parseFloat(re.target.value);R(pt=>pt?{...pt,price_out:Ae}:null)},placeholder:"默认: 0"})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"force_stream_mode",checked:E?.force_stream_mode||!1,onCheckedChange:re=>R(Ae=>Ae?{...Ae,force_stream_mode:re}:null)}),a.jsx(te,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>D(!1),children:"取消"}),a.jsx(ie,{onClick:nn,children:"保存"})]})]})}),a.jsx(mn,{open:L,onOpenChange:U,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除模型 "',V!==null?t[V]?.name:"",'" 吗? 此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:qn,children:"删除"})]})]})}),a.jsx(mn,{open:ne,onOpenChange:ce,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["确定要删除选中的 ",$.size," 个模型吗? 此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),T&&a.jsx(vw,{onRestartComplete:nt,onRestartFailed:ut})]})})}function Pi({title:t,description:e,taskConfig:n,modelNames:r,onChange:s,hideTemperature:i=!1,hideMaxTokens:l=!1}){const c=d=>{s("model_list",d)};return a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:t}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:e})]}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"模型列表"}),a.jsx(zte,{options:r.map(d=>({label:d,value:d})),selected:n.model_list||[],onChange:c,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!i&&a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"温度"}),a.jsx(Me,{type:"number",step:"0.1",min:"0",max:"1",value:n.temperature??.3,onChange:d=>{const h=parseFloat(d.target.value);!isNaN(h)&&h>=0&&h<=1&&s("temperature",h)},className:"w-20 h-8 text-sm"})]}),a.jsx(yx,{value:[n.temperature??.3],onValueChange:d=>s("temperature",d[0]),min:0,max:1,step:.1,className:"w-full"})]}),!l&&a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"最大 Token"}),a.jsx(Me,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:d=>s("max_tokens",parseInt(d.target.value))})]})]})]})]})}const Bx="/api/webui/config";async function Bte(){const e=await(await ot(`${Bx}/adapter-config/path`)).json();return!e.success||!e.path?null:{path:e.path,lastModified:e.lastModified}}async function Lte(t){const n=await(await ot(`${Bx}/adapter-config/path`,{method:"POST",headers:bt(),body:JSON.stringify({path:t})})).json();if(!n.success)throw new Error(n.message||"保存路径失败")}async function Ite(t){const n=await(await ot(`${Bx}/adapter-config?path=${encodeURIComponent(t)}`)).json();if(!n.success)throw new Error("读取配置文件失败");return n.content}async function c8(t,e){const r=await(await ot(`${Bx}/adapter-config`,{method:"POST",headers:bt(),body:JSON.stringify({path:t,content:e})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}const Zs={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}};function qte(){const[t,e]=S.useState("upload"),[n,r]=S.useState(null),[s,i]=S.useState(""),[l,c]=S.useState(""),[d,h]=S.useState(""),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,A]=S.useState(null),_=S.useRef(null),{toast:D}=Pr(),E=S.useRef(null),R=K=>{if(!K.trim())return{valid:!1,error:"路径不能为空"};const H=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,fe=/^(\/|~\/).+\.toml$/i,ve=H.test(K),Re=fe.test(K);return!ve&&!Re?{valid:!1,error:"路径格式错误。Windows: C:\\path\\file.toml,Linux: /path/file.toml"}:K.toLowerCase().endsWith(".toml")?/[<>"|?*\x00-\x1F]/.test(K)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}:{valid:!1,error:"文件必须是 .toml 格式"}},Q=K=>{if(c(K),K.trim()){const H=R(K);h(H.error)}else h("")};S.useEffect(()=>{(async()=>{try{const H=await Bte();H&&H.path&&(c(H.path),e("path"),await F(H.path))}catch(H){console.error("加载保存的路径失败:",H)}})()},[]);const F=async K=>{const H=R(K);if(!H.valid){h(H.error),D({title:"路径无效",description:H.error,variant:"destructive"});return}h(""),v(!0);try{const fe=await Ite(K),ve=ce(fe);r(ve),c(K),await Lte(K),D({title:"加载成功",description:"已从配置文件加载"})}catch(fe){console.error("加载配置失败:",fe),D({title:"加载失败",description:fe instanceof Error?fe.message:"无法读取配置文件",variant:"destructive"})}finally{v(!1)}},L=S.useCallback(K=>{t!=="path"||!l||(E.current&&clearTimeout(E.current),E.current=setTimeout(async()=>{p(!0);try{const H=z(K);await c8(l,H),D({title:"自动保存成功",description:"配置已保存到文件"})}catch(H){console.error("自动保存失败:",H),D({title:"自动保存失败",description:H instanceof Error?H.message:"保存配置失败",variant:"destructive"})}finally{p(!1)}},1e3))},[t,l,D]),U=async()=>{if(!n||!l)return;const K=R(l);if(!K.valid){D({title:"保存失败",description:K.error,variant:"destructive"});return}p(!0);try{const H=z(n);await c8(l,H),D({title:"保存成功",description:"配置已保存到文件"})}catch(H){console.error("保存失败:",H),D({title:"保存失败",description:H instanceof Error?H.message:"保存配置失败",variant:"destructive"})}finally{p(!1)}},V=async()=>{l&&await F(l)},de=K=>{if(K!==t){if(n){A(K),k(!0);return}W(K)}},W=K=>{r(null),i(""),h(""),e(K),D({title:"已切换模式",description:K==="upload"?"现在可以上传配置文件":"现在可以指定配置文件路径"})},J=()=>{T&&(W(T),A(null)),k(!1)},$=()=>{if(n){j(!0);return}ae()},ae=()=>{c(""),r(null),h(""),D({title:"已清空",description:"路径和配置已清空"})},ne=()=>{ae(),j(!1)},ce=K=>{const H=JSON.parse(JSON.stringify(Zs)),fe=K.split(` -`);let ve="";for(const Re of fe){const ue=Re.trim();if(!ue||ue.startsWith("#"))continue;const We=ue.match(/^\[(\w+)\]$/);if(We){ve=We[1];continue}const ct=ue.match(/^(\w+)\s*=\s*(.+)$/);if(ct&&ve){const[,Oe,nt]=ct,ut=nt.trim();let Ct;if(ut==="true")Ct=!0;else if(ut==="false")Ct=!1;else if(ut.startsWith("[")&&ut.endsWith("]")){const In=ut.slice(1,-1).trim();if(In){const Tn=In.split(",").map(nn=>{const _t=nn.trim();return isNaN(Number(_t))?_t.replace(/"/g,""):Number(_t)}),Jn=typeof Tn[0];Ct=Tn.every(nn=>typeof nn===Jn)?Tn:Tn.filter(nn=>typeof nn=="number")}else Ct=[]}else ut.startsWith('"')&&ut.endsWith('"')?Ct=ut.slice(1,-1):isNaN(Number(ut))?Ct=ut.replace(/"/g,""):Ct=Number(ut);if(ve in H){const In=H[ve];In[Oe]=Ct}}}return H},z=K=>{const H=[],fe=(ve,Re)=>ve===""||ve===null||ve===void 0?Re:ve;return H.push("[inner]"),H.push(`version = "${fe(K.inner.version,Zs.inner.version)}" # 版本号`),H.push("# 请勿修改版本号,除非你知道自己在做什么"),H.push(""),H.push("[nickname] # 现在没用"),H.push(`nickname = "${fe(K.nickname.nickname,Zs.nickname.nickname)}"`),H.push(""),H.push("[napcat_server] # Napcat连接的ws服务设置"),H.push(`host = "${fe(K.napcat_server.host,Zs.napcat_server.host)}" # Napcat设定的主机地址`),H.push(`port = ${fe(K.napcat_server.port||0,Zs.napcat_server.port)} # Napcat设定的端口`),H.push(`token = "${fe(K.napcat_server.token,Zs.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),H.push(`heartbeat_interval = ${fe(K.napcat_server.heartbeat_interval||0,Zs.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),H.push(""),H.push("[maibot_server] # 连接麦麦的ws服务设置"),H.push(`host = "${fe(K.maibot_server.host,Zs.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),H.push(`port = ${fe(K.maibot_server.port||0,Zs.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),H.push(""),H.push("[chat] # 黑白名单功能"),H.push(`group_list_type = "${fe(K.chat.group_list_type,Zs.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),H.push(`group_list = [${K.chat.group_list.join(", ")}] # 群组名单`),H.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),H.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),H.push(`private_list_type = "${fe(K.chat.private_list_type,Zs.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),H.push(`private_list = [${K.chat.private_list.join(", ")}] # 私聊名单`),H.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),H.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),H.push(`ban_user_id = [${K.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),H.push(`ban_qq_bot = ${K.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),H.push(`enable_poke = ${K.chat.enable_poke} # 是否启用戳一戳功能`),H.push(""),H.push("[voice] # 发送语音设置"),H.push(`use_tts = ${K.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),H.push(""),H.push("[debug]"),H.push(`level = "${fe(K.debug.level,Zs.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),H.join(` -`)},xe=K=>{const H=K.target.files?.[0];if(!H)return;const fe=new FileReader;fe.onload=ve=>{try{const Re=ve.target?.result,ue=ce(Re);r(ue),i(H.name),D({title:"上传成功",description:`已加载配置文件:${H.name}`})}catch(Re){console.error("解析配置文件失败:",Re),D({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},fe.readAsText(H)},Y=()=>{if(!n)return;const K=z(n),H=new Blob([K],{type:"text/plain;charset=utf-8"}),fe=URL.createObjectURL(H),ve=document.createElement("a");ve.href=fe,ve.download=s||"config.toml",document.body.appendChild(ve),ve.click(),document.body.removeChild(ve),URL.revokeObjectURL(fe),D({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},P=()=>{r(JSON.parse(JSON.stringify(Zs))),i("config.toml"),D({title:"已加载默认配置",description:"可以开始编辑配置"})};return a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"工作模式"}),a.jsx(Sr,{children:"选择配置文件的管理方式"})]}),a.jsxs(an,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 md:gap-4",children:[a.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>de("upload"),children:a.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[a.jsx(oO,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),a.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>de("path"),children:a.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[a.jsx(kq,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),t==="path"&&a.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs("div",{className:"flex-1 space-y-1",children:[a.jsx(Me,{id:"config-path",value:l,onChange:K=>Q(K.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${d?"border-destructive":""}`}),d&&a.jsx("p",{className:"text-xs text-destructive",children:d})]}),a.jsx(ie,{onClick:()=>F(l),disabled:x||!l||!!d,className:"w-full sm:w-auto",children:x?a.jsxs(a.Fragment,{children:[a.jsx(Fi,{className:"h-4 w-4 animate-spin mr-2"}),a.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"sm:hidden",children:"加载配置"}),a.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),a.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[a.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[a.jsx("span",{children:"路径格式说明"}),a.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),a.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[a.jsx("div",{children:"C:\\Adapter\\config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),a.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[a.jsx("div",{children:"/opt/adapter/config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),a.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsx(od,{children:t==="upload"?a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",m&&" (正在保存...)"]})})]}),t==="upload"&&!n&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[a.jsx("input",{ref:_,type:"file",accept:".toml",className:"hidden",onChange:xe}),a.jsxs(ie,{onClick:()=>_.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(oO,{className:"mr-2 h-4 w-4"}),"上传配置"]}),a.jsxs(ie,{onClick:P,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),t==="upload"&&n&&a.jsx("div",{className:"flex gap-2",children:a.jsxs(ie,{onClick:Y,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(fc,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),t==="path"&&n&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs(ie,{onClick:U,size:"sm",disabled:m||!!d,className:"w-full sm:w-auto",children:[a.jsx(lx,{className:"mr-2 h-4 w-4"}),m?"保存中...":"立即保存"]}),a.jsxs(ie,{onClick:V,size:"sm",variant:"outline",disabled:x,className:"w-full sm:w-auto",children:[a.jsx(Fi,{className:`mr-2 h-4 w-4 ${x?"animate-spin":""}`}),"刷新"]}),a.jsxs(ie,{onClick:$,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),n?a.jsxs(hl,{defaultValue:"napcat",className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:a.jsxs(ya,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[a.jsxs($t,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),a.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),a.jsxs($t,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),a.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),a.jsxs($t,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),a.jsx("span",{className:"sm:hidden",children:"聊天"})]}),a.jsxs($t,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),a.jsx("span",{className:"sm:hidden",children:"语音"})]}),a.jsx($t,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),a.jsx(kn,{value:"napcat",className:"space-y-4",children:a.jsx(Fte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"maibot",className:"space-y-4",children:a.jsx(Qte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"chat",className:"space-y-4",children:a.jsx($te,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"voice",className:"space-y-4",children:a.jsx(Hte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"debug",className:"space-y-4",children:a.jsx(Ute,{config:n,onChange:K=>{r(K),L(K)}})})]}):a.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:a.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[a.jsx(ao,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:t==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),a.jsx(mn,{open:b,onOpenChange:k,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认切换模式"}),a.jsxs(dn,{children:["切换模式将清空当前配置,确定要继续吗?",a.jsx("br",{}),a.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),a.jsxs(cn,{children:[a.jsx(fn,{onClick:()=>{k(!1),A(null)},children:"取消"}),a.jsx(hn,{onClick:J,children:"确认切换"})]})]})}),a.jsx(mn,{open:O,onOpenChange:j,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认清空路径"}),a.jsxs(dn,{children:["清空路径将清除当前配置,确定要继续吗?",a.jsx("br",{}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),a.jsxs(cn,{children:[a.jsx(fn,{onClick:()=>j(!1),children:"取消"}),a.jsx(hn,{onClick:ne,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function Fte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),a.jsxs("div",{className:"grid gap-3 md:gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),a.jsx(Me,{id:"napcat-host",value:t.napcat_server.host,onChange:n=>e({...t,napcat_server:{...t.napcat_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),a.jsx(Me,{id:"napcat-port",type:"number",value:t.napcat_server.port||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),a.jsx(Me,{id:"napcat-token",type:"password",value:t.napcat_server.token,onChange:n=>e({...t,napcat_server:{...t.napcat_server,token:n.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),a.jsx(Me,{id:"napcat-heartbeat",type:"number",value:t.napcat_server.heartbeat_interval||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,heartbeat_interval:n.target.value?parseInt(n.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function Qte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),a.jsxs("div",{className:"grid gap-3 md:gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),a.jsx(Me,{id:"maibot-host",value:t.maibot_server.host,onChange:n=>e({...t,maibot_server:{...t.maibot_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),a.jsx(Me,{id:"maibot-port",type:"number",value:t.maibot_server.port||"",onChange:n=>e({...t,maibot_server:{...t.maibot_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function $te({config:t,onChange:e}){const n=i=>{const l={...t};i==="group"?l.chat.group_list=[...l.chat.group_list,0]:i==="private"?l.chat.private_list=[...l.chat.private_list,0]:l.chat.ban_user_id=[...l.chat.ban_user_id,0],e(l)},r=(i,l)=>{const c={...t};i==="group"?c.chat.group_list=c.chat.group_list.filter((d,h)=>h!==l):i==="private"?c.chat.private_list=c.chat.private_list.filter((d,h)=>h!==l):c.chat.ban_user_id=c.chat.ban_user_id.filter((d,h)=>h!==l),e(c)},s=(i,l,c)=>{const d={...t};i==="group"?d.chat.group_list[l]=c:i==="private"?d.chat.private_list[l]=c:d.chat.ban_user_id[l]=c,e(d)};return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),a.jsxs("div",{className:"grid gap-4 md:gap-6",children:[a.jsxs("div",{className:"space-y-3 md:space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"群组名单类型"}),a.jsxs(Lt,{value:t.chat.group_list_type,onValueChange:i=>e({...t,chat:{...t.chat,group_list_type:i}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),a.jsx(Pe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsx(te,{className:"text-sm md:text-base",children:"群组列表"}),a.jsxs(ie,{onClick:()=>n("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),t.chat.group_list.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{type:"number",value:i,onChange:c=>s("group",l,parseInt(c.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除群号 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r("group",l),children:"删除"})]})]})]})]},l)),t.chat.group_list.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),a.jsxs("div",{className:"space-y-3 md:space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"私聊名单类型"}),a.jsxs(Lt,{value:t.chat.private_list_type,onValueChange:i=>e({...t,chat:{...t.chat,private_list_type:i}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),a.jsx(Pe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsx(te,{className:"text-sm md:text-base",children:"私聊列表"}),a.jsxs(ie,{onClick:()=>n("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.private_list.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{type:"number",value:i,onChange:c=>s("private",l,parseInt(c.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除用户 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r("private",l),children:"删除"})]})]})]})]},l)),t.chat.private_list.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"全局禁止名单"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),a.jsxs(ie,{onClick:()=>n("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.ban_user_id.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{type:"number",value:i,onChange:c=>s("ban",l,parseInt(c.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要从全局禁止名单中删除用户 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r("ban",l),children:"删除"})]})]})]})]},l)),t.chat.ban_user_id.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),a.jsx(jt,{checked:t.chat.ban_qq_bot,onCheckedChange:i=>e({...t,chat:{...t.chat,ban_qq_bot:i}})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),a.jsx(jt,{checked:t.chat.enable_poke,onCheckedChange:i=>e({...t,chat:{...t.chat,enable_poke:i}})})]})]})]})})}function Hte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),a.jsx(jt,{checked:t.voice.use_tts,onCheckedChange:n=>e({...t,voice:{use_tts:n}})})]})]})})}function Ute({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),a.jsx("div",{className:"grid gap-3 md:gap-4",children:a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"日志等级"}),a.jsxs(Lt,{value:t.debug.level,onValueChange:n=>e({...t,debug:{level:n}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"DEBUG",children:"DEBUG(调试)"}),a.jsx(Pe,{value:"INFO",children:"INFO(信息)"}),a.jsx(Pe,{value:"WARNING",children:"WARNING(警告)"}),a.jsx(Pe,{value:"ERROR",children:"ERROR(错误)"}),a.jsx(Pe,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function u8(t){const e=[],n=String(t||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const l=n.slice(s,r).trim();(l||!i)&&e.push(l),s=r+1,r=n.indexOf(",",s)}return e}function Vte(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Wte=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Gte=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xte={};function d8(t,e){return(Xte.jsx?Gte:Wte).test(t)}const Yte=/[ \t\n\f\r]/g;function Kte(t){return typeof t=="object"?t.type==="text"?h8(t.value):!1:h8(t)}function h8(t){return t.replace(Yte,"")===""}class x0{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}x0.prototype.normal={};x0.prototype.property={};x0.prototype.space=void 0;function Z_(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new x0(n,r,e)}function Pf(t){return t.toLowerCase()}class qs{constructor(e,n){this.attribute=n,this.property=e}}qs.prototype.attribute="";qs.prototype.booleanish=!1;qs.prototype.boolean=!1;qs.prototype.commaOrSpaceSeparated=!1;qs.prototype.commaSeparated=!1;qs.prototype.defined=!1;qs.prototype.mustUseProperty=!1;qs.prototype.number=!1;qs.prototype.overloadedBoolean=!1;qs.prototype.property="";qs.prototype.spaceSeparated=!1;qs.prototype.space=void 0;let Zte=0;const Ot=Dc(),mr=Dc(),h4=Dc(),ze=Dc(),Bn=Dc(),Ju=Dc(),Js=Dc();function Dc(){return 2**++Zte}const f4=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ot,booleanish:mr,commaOrSpaceSeparated:Js,commaSeparated:Ju,number:ze,overloadedBoolean:h4,spaceSeparated:Bn},Symbol.toStringTag,{value:"Module"})),hb=Object.keys(f4);class c5 extends qs{constructor(e,n,r,s){let i=-1;if(super(e,n),f8(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&rne.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(m8,ine);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!m8.test(i)){let l=i.replace(nne,sne);l.charAt(0)!=="-"&&(l="-"+l),e="data"+l}}s=c5}return new s(r,e)}function sne(t){return"-"+t.toLowerCase()}function ine(t){return t.charAt(1).toUpperCase()}const aD=Z_([J_,Jte,nD,rD,sD],"html"),Lx=Z_([J_,ene,nD,rD,sD],"svg");function p8(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function ane(t){return t.join(" ").trim()}var Nu={},fb,g8;function lne(){if(g8)return fb;g8=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,d=` -`,h="/",m="*",p="",x="comment",v="declaration";function b(O,j){if(typeof O!="string")throw new TypeError("First argument must be a string");if(!O)return[];j=j||{};var T=1,A=1;function _(W){var J=W.match(e);J&&(T+=J.length);var $=W.lastIndexOf(d);A=~$?W.length-$:A+W.length}function D(){var W={line:T,column:A};return function(J){return J.position=new E(W),F(),J}}function E(W){this.start=W,this.end={line:T,column:A},this.source=j.source}E.prototype.content=O;function R(W){var J=new Error(j.source+":"+T+":"+A+": "+W);if(J.reason=W,J.filename=j.source,J.line=T,J.column=A,J.source=O,!j.silent)throw J}function Q(W){var J=W.exec(O);if(J){var $=J[0];return _($),O=O.slice($.length),J}}function F(){Q(n)}function L(W){var J;for(W=W||[];J=U();)J!==!1&&W.push(J);return W}function U(){var W=D();if(!(h!=O.charAt(0)||m!=O.charAt(1))){for(var J=2;p!=O.charAt(J)&&(m!=O.charAt(J)||h!=O.charAt(J+1));)++J;if(J+=2,p===O.charAt(J-1))return R("End of comment missing");var $=O.slice(2,J-2);return A+=2,_($),O=O.slice(J),A+=2,W({type:x,comment:$})}}function V(){var W=D(),J=Q(r);if(J){if(U(),!Q(s))return R("property missing ':'");var $=Q(i),ae=W({type:v,property:k(J[0].replace(t,p)),value:$?k($[0].replace(t,p)):p});return Q(l),ae}}function de(){var W=[];L(W);for(var J;J=V();)J!==!1&&(W.push(J),L(W));return W}return F(),de()}function k(O){return O?O.replace(c,p):p}return fb=b,fb}var x8;function one(){if(x8)return Nu;x8=1;var t=Nu&&Nu.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Nu,"__esModule",{value:!0}),Nu.default=n;const e=t(lne());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const l=(0,e.default)(r),c=typeof s=="function";return l.forEach(d=>{if(d.type!=="declaration")return;const{property:h,value:m}=d;c?s(h,m,d):m&&(i=i||{},i[h]=m)}),i}return Nu}var Lh={},v8;function cne(){if(v8)return Lh;v8=1,Object.defineProperty(Lh,"__esModule",{value:!0}),Lh.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(h){return!h||n.test(h)||t.test(h)},l=function(h,m){return m.toUpperCase()},c=function(h,m){return"".concat(m,"-")},d=function(h,m){return m===void 0&&(m={}),i(h)?h:(h=h.toLowerCase(),m.reactCompat?h=h.replace(s,c):h=h.replace(r,c),h.replace(e,l))};return Lh.camelCase=d,Lh}var Ih,y8;function une(){if(y8)return Ih;y8=1;var t=Ih&&Ih.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(one()),n=cne();function r(s,i){var l={};return!s||typeof s!="string"||(0,e.default)(s,function(c,d){c&&d&&(l[(0,n.camelCase)(c,i)]=d)}),l}return r.default=r,Ih=r,Ih}var dne=une();const hne=u9(dne),lD=oD("end"),u5=oD("start");function oD(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function fne(t){const e=u5(t),n=lD(t);if(e&&n)return{start:e,end:n}}function af(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?b8(t.position):"start"in t||"end"in t?b8(t):"line"in t||"column"in t?m4(t):""}function m4(t){return w8(t&&t.line)+":"+w8(t&&t.column)}function b8(t){return m4(t&&t.start)+"-"+m4(t&&t.end)}function w8(t){return t&&typeof t=="number"?t:1}class as extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},l=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?s=e:!i.cause&&e&&(l=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?i.ruleId=r:(i.source=r.slice(0,d),i.ruleId=r.slice(d+1))}if(!i.place&&i.ancestors&&i.ancestors){const d=i.ancestors[i.ancestors.length-1];d&&(i.place=d.position)}const c=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=c?c.line:void 0,this.name=af(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=l&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}as.prototype.file="";as.prototype.name="";as.prototype.reason="";as.prototype.message="";as.prototype.stack="";as.prototype.column=void 0;as.prototype.line=void 0;as.prototype.ancestors=void 0;as.prototype.cause=void 0;as.prototype.fatal=void 0;as.prototype.place=void 0;as.prototype.ruleId=void 0;as.prototype.source=void 0;const d5={}.hasOwnProperty,mne=new Map,pne=/[A-Z]/g,gne=new Set(["table","tbody","thead","tfoot","tr"]),xne=new Set(["td","th"]),cD="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function vne(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Nne(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=jne(n,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?Lx:aD,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=uD(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function uD(t,e,n){if(e.type==="element")return yne(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return bne(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return Sne(t,e,n);if(e.type==="mdxjsEsm")return wne(t,e);if(e.type==="root")return kne(t,e,n);if(e.type==="text")return One(t,e)}function yne(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Lx,t.schema=s),t.ancestors.push(e);const i=hD(t,e.tagName,!1),l=Cne(t,e);let c=f5(t,e);return gne.has(e.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!Kte(d):!0})),dD(t,l,i,e),h5(l,c),t.ancestors.pop(),t.schema=r,t.create(e,i,l,n)}function bne(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}Bf(t,e.position)}function wne(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Bf(t,e.position)}function Sne(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=Lx,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:hD(t,e.name,!0),l=Tne(t,e),c=f5(t,e);return dD(t,l,i,e),h5(l,c),t.ancestors.pop(),t.schema=r,t.create(e,i,l,n)}function kne(t,e,n){const r={};return h5(r,f5(t,e)),t.create(e,t.Fragment,r,n)}function One(t,e){return e.value}function dD(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function h5(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function jne(t,e,n){return r;function r(s,i,l,c){const h=Array.isArray(l.children)?n:e;return c?h(i,l,c):h(i,l)}}function Nne(t,e){return n;function n(r,s,i,l){const c=Array.isArray(i.children),d=u5(r);return e(s,i,l,c,{columnNumber:d?d.column-1:void 0,fileName:t,lineNumber:d?d.line:void 0},void 0)}}function Cne(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&d5.call(e.properties,s)){const i=Ane(t,s,e.properties[s]);if(i){const[l,c]=i;t.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&xne.has(e.tagName)?r=c:n[l]=c}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Tne(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const l=i.expression;l.type;const c=l.properties[0];c.type,Object.assign(n,t.evaluater.evaluateExpression(c.argument))}else Bf(t,e.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const c=r.value.data.estree.body[0];c.type,i=t.evaluater.evaluateExpression(c.expression)}else Bf(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function f5(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:mne;for(;++rs?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(e,n),t.splice(...l);else for(n&&t.splice(e,n);i0?(si(t,t.length,0,e),t):e}const O8={}.hasOwnProperty;function mD(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Qi(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ds=Ao(/[A-Za-z]/),rs=Ao(/[\dA-Za-z]/),Lne=Ao(/[#-'*+\--9=?A-Z^-~]/);function Hg(t){return t!==null&&(t<32||t===127)}const p4=Ao(/\d/),Ine=Ao(/[\dA-Fa-f]/),qne=Ao(/[!-/:-@[-`{-~]/);function Ze(t){return t!==null&&t<-2}function Rn(t){return t!==null&&(t<0||t===32)}function qt(t){return t===-2||t===-1||t===32}const Ix=Ao(new RegExp("\\p{P}|\\p{S}","u")),Cc=Ao(/\s/);function Ao(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Dd(t){const e=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const c=t.charCodeAt(n+1);i<56320&&c>56319&&c<57344?(l=String.fromCharCode(i,c),s=1):l="�"}else l=String.fromCharCode(i);l&&(e.push(t.slice(r,n),encodeURIComponent(l)),r=n+s+1,l=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function zt(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return l;function l(d){return qt(d)?(t.enter(n),c(d)):e(d)}function c(d){return qt(d)&&i++l))return;const R=e.events.length;let Q=R,F,L;for(;Q--;)if(e.events[Q][0]==="exit"&&e.events[Q][1].type==="chunkFlow"){if(F){L=e.events[Q][1].end;break}F=!0}for(j(r),E=R;EA;){const D=n[_];e.containerState=D[1],D[0].exit.call(e,t)}n.length=A}function T(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function Une(t,e,n){return zt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function vd(t){if(t===null||Rn(t)||Cc(t))return 1;if(Ix(t))return 2}function qx(t,e,n){const r=[];let s=-1;for(;++s1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const p={...t[r][1].end},x={...t[n][1].start};N8(p,-d),N8(x,d),l={type:d>1?"strongSequence":"emphasisSequence",start:p,end:{...t[r][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:x},i={type:d>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:d>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},t[r][1].end={...l.start},t[n][1].start={...c.end},h=[],t[r][1].end.offset-t[r][1].start.offset&&(h=bi(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=bi(h,[["enter",s,e],["enter",l,e],["exit",l,e],["enter",i,e]]),h=bi(h,qx(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=bi(h,[["exit",i,e],["enter",c,e],["exit",c,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(m=2,h=bi(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):m=0,si(t,r-1,n-r+3,h),n=r+h.length-m-2;break}}for(n=-1;++n0&&qt(E)?zt(t,T,"linePrefix",i+1)(E):T(E)}function T(E){return E===null||Ze(E)?t.check(C8,k,_)(E):(t.enter("codeFlowValue"),A(E))}function A(E){return E===null||Ze(E)?(t.exit("codeFlowValue"),T(E)):(t.consume(E),A)}function _(E){return t.exit("codeFenced"),e(E)}function D(E,R,Q){let F=0;return L;function L(J){return E.enter("lineEnding"),E.consume(J),E.exit("lineEnding"),U}function U(J){return E.enter("codeFencedFence"),qt(J)?zt(E,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(J):V(J)}function V(J){return J===c?(E.enter("codeFencedFenceSequence"),de(J)):Q(J)}function de(J){return J===c?(F++,E.consume(J),de):F>=l?(E.exit("codeFencedFenceSequence"),qt(J)?zt(E,W,"whitespace")(J):W(J)):Q(J)}function W(J){return J===null||Ze(J)?(E.exit("codeFencedFence"),R(J)):Q(J)}}}function rre(t,e,n){const r=this;return s;function s(l){return l===null?n(l):(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i)}function i(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}const pb={name:"codeIndented",tokenize:ire},sre={partial:!0,tokenize:are};function ire(t,e,n){const r=this;return s;function s(h){return t.enter("codeIndented"),zt(t,i,"linePrefix",5)(h)}function i(h){const m=r.events[r.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(h):n(h)}function l(h){return h===null?d(h):Ze(h)?t.attempt(sre,l,d)(h):(t.enter("codeFlowValue"),c(h))}function c(h){return h===null||Ze(h)?(t.exit("codeFlowValue"),l(h)):(t.consume(h),c)}function d(h){return t.exit("codeIndented"),e(h)}}function are(t,e,n){const r=this;return s;function s(l){return r.parser.lazy[r.now().line]?n(l):Ze(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),s):zt(t,i,"linePrefix",5)(l)}function i(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(l):Ze(l)?s(l):n(l)}}const lre={name:"codeText",previous:cre,resolve:ore,tokenize:ure};function ore(t){let e=t.length-4,n=3,r,s;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&qh(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),qh(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),qh(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(l):t.interrupt(r.parser.constructs.flow,n,e)(l)}}function bD(t,e,n,r,s,i,l,c,d){const h=d||Number.POSITIVE_INFINITY;let m=0;return p;function p(j){return j===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(j),t.exit(i),x):j===null||j===32||j===41||Hg(j)?n(j):(t.enter(r),t.enter(l),t.enter(c),t.enter("chunkString",{contentType:"string"}),k(j))}function x(j){return j===62?(t.enter(i),t.consume(j),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(c),t.enter("chunkString",{contentType:"string"}),v(j))}function v(j){return j===62?(t.exit("chunkString"),t.exit(c),x(j)):j===null||j===60||Ze(j)?n(j):(t.consume(j),j===92?b:v)}function b(j){return j===60||j===62||j===92?(t.consume(j),v):v(j)}function k(j){return!m&&(j===null||j===41||Rn(j))?(t.exit("chunkString"),t.exit(c),t.exit(l),t.exit(r),e(j)):m999||v===null||v===91||v===93&&!d||v===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(v):v===93?(t.exit(i),t.enter(s),t.consume(v),t.exit(s),t.exit(r),e):Ze(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),m):(t.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===null||v===91||v===93||Ze(v)||c++>999?(t.exit("chunkString"),m(v)):(t.consume(v),d||(d=!qt(v)),v===92?x:p)}function x(v){return v===91||v===92||v===93?(t.consume(v),c++,p):p(v)}}function SD(t,e,n,r,s,i){let l;return c;function c(x){return x===34||x===39||x===40?(t.enter(r),t.enter(s),t.consume(x),t.exit(s),l=x===40?41:x,d):n(x)}function d(x){return x===l?(t.enter(s),t.consume(x),t.exit(s),t.exit(r),e):(t.enter(i),h(x))}function h(x){return x===l?(t.exit(i),d(l)):x===null?n(x):Ze(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),zt(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===l||x===null||Ze(x)?(t.exit("chunkString"),h(x)):(t.consume(x),x===92?p:m)}function p(x){return x===l||x===92?(t.consume(x),m):m(x)}}function lf(t,e){let n;return r;function r(s){return Ze(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):qt(s)?zt(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const vre={name:"definition",tokenize:bre},yre={partial:!0,tokenize:wre};function bre(t,e,n){const r=this;let s;return i;function i(v){return t.enter("definition"),l(v)}function l(v){return wD.call(r,t,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function c(v){return s=Qi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),d):n(v)}function d(v){return Rn(v)?lf(t,h)(v):h(v)}function h(v){return bD(t,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function m(v){return t.attempt(yre,p,p)(v)}function p(v){return qt(v)?zt(t,x,"whitespace")(v):x(v)}function x(v){return v===null||Ze(v)?(t.exit("definition"),r.parser.defined.push(s),e(v)):n(v)}}function wre(t,e,n){return r;function r(c){return Rn(c)?lf(t,s)(c):n(c)}function s(c){return SD(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function i(c){return qt(c)?zt(t,l,"whitespace")(c):l(c)}function l(c){return c===null||Ze(c)?e(c):n(c)}}const Sre={name:"hardBreakEscape",tokenize:kre};function kre(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return Ze(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const Ore={name:"headingAtx",resolve:jre,tokenize:Nre};function jre(t,e){let n=t.length-2,r=3,s,i;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},si(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function Nre(t,e,n){let r=0;return s;function s(m){return t.enter("atxHeading"),i(m)}function i(m){return t.enter("atxHeadingSequence"),l(m)}function l(m){return m===35&&r++<6?(t.consume(m),l):m===null||Rn(m)?(t.exit("atxHeadingSequence"),c(m)):n(m)}function c(m){return m===35?(t.enter("atxHeadingSequence"),d(m)):m===null||Ze(m)?(t.exit("atxHeading"),e(m)):qt(m)?zt(t,c,"whitespace")(m):(t.enter("atxHeadingText"),h(m))}function d(m){return m===35?(t.consume(m),d):(t.exit("atxHeadingSequence"),c(m))}function h(m){return m===null||m===35||Rn(m)?(t.exit("atxHeadingText"),c(m)):(t.consume(m),h)}}const Cre=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],A8=["pre","script","style","textarea"],Tre={concrete:!0,name:"htmlFlow",resolveTo:Ere,tokenize:_re},Are={partial:!0,tokenize:Rre},Mre={partial:!0,tokenize:Dre};function Ere(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function _re(t,e,n){const r=this;let s,i,l,c,d;return h;function h(P){return m(P)}function m(P){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(P),p}function p(P){return P===33?(t.consume(P),x):P===47?(t.consume(P),i=!0,k):P===63?(t.consume(P),s=3,r.interrupt?e:z):ds(P)?(t.consume(P),l=String.fromCharCode(P),O):n(P)}function x(P){return P===45?(t.consume(P),s=2,v):P===91?(t.consume(P),s=5,c=0,b):ds(P)?(t.consume(P),s=4,r.interrupt?e:z):n(P)}function v(P){return P===45?(t.consume(P),r.interrupt?e:z):n(P)}function b(P){const K="CDATA[";return P===K.charCodeAt(c++)?(t.consume(P),c===K.length?r.interrupt?e:V:b):n(P)}function k(P){return ds(P)?(t.consume(P),l=String.fromCharCode(P),O):n(P)}function O(P){if(P===null||P===47||P===62||Rn(P)){const K=P===47,H=l.toLowerCase();return!K&&!i&&A8.includes(H)?(s=1,r.interrupt?e(P):V(P)):Cre.includes(l.toLowerCase())?(s=6,K?(t.consume(P),j):r.interrupt?e(P):V(P)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):i?T(P):A(P))}return P===45||rs(P)?(t.consume(P),l+=String.fromCharCode(P),O):n(P)}function j(P){return P===62?(t.consume(P),r.interrupt?e:V):n(P)}function T(P){return qt(P)?(t.consume(P),T):L(P)}function A(P){return P===47?(t.consume(P),L):P===58||P===95||ds(P)?(t.consume(P),_):qt(P)?(t.consume(P),A):L(P)}function _(P){return P===45||P===46||P===58||P===95||rs(P)?(t.consume(P),_):D(P)}function D(P){return P===61?(t.consume(P),E):qt(P)?(t.consume(P),D):A(P)}function E(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(t.consume(P),d=P,R):qt(P)?(t.consume(P),E):Q(P)}function R(P){return P===d?(t.consume(P),d=null,F):P===null||Ze(P)?n(P):(t.consume(P),R)}function Q(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||Rn(P)?D(P):(t.consume(P),Q)}function F(P){return P===47||P===62||qt(P)?A(P):n(P)}function L(P){return P===62?(t.consume(P),U):n(P)}function U(P){return P===null||Ze(P)?V(P):qt(P)?(t.consume(P),U):n(P)}function V(P){return P===45&&s===2?(t.consume(P),$):P===60&&s===1?(t.consume(P),ae):P===62&&s===4?(t.consume(P),xe):P===63&&s===3?(t.consume(P),z):P===93&&s===5?(t.consume(P),ce):Ze(P)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(Are,Y,de)(P)):P===null||Ze(P)?(t.exit("htmlFlowData"),de(P)):(t.consume(P),V)}function de(P){return t.check(Mre,W,Y)(P)}function W(P){return t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),J}function J(P){return P===null||Ze(P)?de(P):(t.enter("htmlFlowData"),V(P))}function $(P){return P===45?(t.consume(P),z):V(P)}function ae(P){return P===47?(t.consume(P),l="",ne):V(P)}function ne(P){if(P===62){const K=l.toLowerCase();return A8.includes(K)?(t.consume(P),xe):V(P)}return ds(P)&&l.length<8?(t.consume(P),l+=String.fromCharCode(P),ne):V(P)}function ce(P){return P===93?(t.consume(P),z):V(P)}function z(P){return P===62?(t.consume(P),xe):P===45&&s===2?(t.consume(P),z):V(P)}function xe(P){return P===null||Ze(P)?(t.exit("htmlFlowData"),Y(P)):(t.consume(P),xe)}function Y(P){return t.exit("htmlFlow"),e(P)}}function Dre(t,e,n){const r=this;return s;function s(l){return Ze(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i):n(l)}function i(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}function Rre(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(v0,e,n)}}const zre={name:"htmlText",tokenize:Pre};function Pre(t,e,n){const r=this;let s,i,l;return c;function c(z){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(z),d}function d(z){return z===33?(t.consume(z),h):z===47?(t.consume(z),D):z===63?(t.consume(z),A):ds(z)?(t.consume(z),Q):n(z)}function h(z){return z===45?(t.consume(z),m):z===91?(t.consume(z),i=0,b):ds(z)?(t.consume(z),T):n(z)}function m(z){return z===45?(t.consume(z),v):n(z)}function p(z){return z===null?n(z):z===45?(t.consume(z),x):Ze(z)?(l=p,ae(z)):(t.consume(z),p)}function x(z){return z===45?(t.consume(z),v):p(z)}function v(z){return z===62?$(z):z===45?x(z):p(z)}function b(z){const xe="CDATA[";return z===xe.charCodeAt(i++)?(t.consume(z),i===xe.length?k:b):n(z)}function k(z){return z===null?n(z):z===93?(t.consume(z),O):Ze(z)?(l=k,ae(z)):(t.consume(z),k)}function O(z){return z===93?(t.consume(z),j):k(z)}function j(z){return z===62?$(z):z===93?(t.consume(z),j):k(z)}function T(z){return z===null||z===62?$(z):Ze(z)?(l=T,ae(z)):(t.consume(z),T)}function A(z){return z===null?n(z):z===63?(t.consume(z),_):Ze(z)?(l=A,ae(z)):(t.consume(z),A)}function _(z){return z===62?$(z):A(z)}function D(z){return ds(z)?(t.consume(z),E):n(z)}function E(z){return z===45||rs(z)?(t.consume(z),E):R(z)}function R(z){return Ze(z)?(l=R,ae(z)):qt(z)?(t.consume(z),R):$(z)}function Q(z){return z===45||rs(z)?(t.consume(z),Q):z===47||z===62||Rn(z)?F(z):n(z)}function F(z){return z===47?(t.consume(z),$):z===58||z===95||ds(z)?(t.consume(z),L):Ze(z)?(l=F,ae(z)):qt(z)?(t.consume(z),F):$(z)}function L(z){return z===45||z===46||z===58||z===95||rs(z)?(t.consume(z),L):U(z)}function U(z){return z===61?(t.consume(z),V):Ze(z)?(l=U,ae(z)):qt(z)?(t.consume(z),U):F(z)}function V(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(t.consume(z),s=z,de):Ze(z)?(l=V,ae(z)):qt(z)?(t.consume(z),V):(t.consume(z),W)}function de(z){return z===s?(t.consume(z),s=void 0,J):z===null?n(z):Ze(z)?(l=de,ae(z)):(t.consume(z),de)}function W(z){return z===null||z===34||z===39||z===60||z===61||z===96?n(z):z===47||z===62||Rn(z)?F(z):(t.consume(z),W)}function J(z){return z===47||z===62||Rn(z)?F(z):n(z)}function $(z){return z===62?(t.consume(z),t.exit("htmlTextData"),t.exit("htmlText"),e):n(z)}function ae(z){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),ne}function ne(z){return qt(z)?zt(t,ce,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):ce(z)}function ce(z){return t.enter("htmlTextData"),l(z)}}const g5={name:"labelEnd",resolveAll:qre,resolveTo:Fre,tokenize:Qre},Bre={tokenize:$re},Lre={tokenize:Hre},Ire={tokenize:Ure};function qre(t){let e=-1;const n=[];for(;++e=3&&(h===null||Ze(h))?(t.exit("thematicBreak"),e(h)):n(h)}function d(h){return h===s?(t.consume(h),r++,d):(t.exit("thematicBreakSequence"),qt(h)?zt(t,c,"whitespace")(h):c(h))}}const Ns={continuation:{tokenize:tse},exit:rse,name:"list",tokenize:ese},Zre={partial:!0,tokenize:sse},Jre={partial:!0,tokenize:nse};function ese(t,e,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,l=0;return c;function c(v){const b=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:p4(v)){if(r.containerState.type||(r.containerState.type=b,t.enter(b,{_container:!0})),b==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(og,n,h)(v):h(v);if(!r.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),d(v)}return n(v)}function d(v){return p4(v)&&++l<10?(t.consume(v),d):(!r.interrupt||l<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),h(v)):n(v)}function h(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,t.check(v0,r.interrupt?n:m,t.attempt(Zre,x,p))}function m(v){return r.containerState.initialBlankLine=!0,i++,x(v)}function p(v){return qt(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),x):n(v)}function x(v){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(v)}}function tse(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(v0,s,i);function s(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,zt(t,e,"listItemIndent",r.containerState.size+1)(c)}function i(c){return r.containerState.furtherBlankLines||!qt(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(Jre,e,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,zt(t,t.attempt(Ns,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function nse(t,e,n){const r=this;return zt(t,s,"listItemIndent",r.containerState.size+1);function s(i){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?e(i):n(i)}}function rse(t){t.exit(this.containerState.type)}function sse(t,e,n){const r=this;return zt(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const l=r.events[r.events.length-1];return!qt(i)&&l&&l[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const M8={name:"setextUnderline",resolveTo:ise,tokenize:ase};function ise(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const l={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",l,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=l,t.push(["exit",l,e]),t}function ase(t,e,n){const r=this;let s;return i;function i(h){let m=r.events.length,p;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){p=r.events[m][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(t.enter("setextHeadingLine"),s=h,l(h)):n(h)}function l(h){return t.enter("setextHeadingLineSequence"),c(h)}function c(h){return h===s?(t.consume(h),c):(t.exit("setextHeadingLineSequence"),qt(h)?zt(t,d,"lineSuffix")(h):d(h))}function d(h){return h===null||Ze(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const lse={tokenize:ose};function ose(t){const e=this,n=t.attempt(v0,r,t.attempt(this.parser.constructs.flowInitial,s,zt(t,t.attempt(this.parser.constructs.flow,s,t.attempt(fre,s)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const cse={resolveAll:OD()},use=kD("string"),dse=kD("text");function kD(t){return{resolveAll:OD(t==="text"?hse:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,l,c);return l;function l(m){return h(m)?i(m):c(m)}function c(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),d}function d(m){return h(m)?(n.exit("data"),i(m)):(n.consume(m),d)}function h(m){if(m===null)return!0;const p=s[m];let x=-1;if(p)for(;++x-1){const c=l[0];typeof c=="string"?l[0]=c.slice(r):l.shift()}i>0&&l.push(t[s].slice(0,i))}return l}function jse(t,e){let n=-1;const r=[];let s;for(;++na.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",D+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(p,{regex:_.regex&&_.regex[0]||"",reaction:_.reaction,onRegexChange:E=>m(D,"regex",E),onReactionChange:E=>m(D,"reaction",E)}),a.jsx(T,{rule:_}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除正则规则 ",D+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>h(D),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),a.jsx(Me,{value:_.regex&&_.regex[0]||"",onChange:E=>m(D,"regex",E.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"反应内容"}),a.jsx(_n,{value:_.reaction,onChange:E=>m(D,"reaction",E.target.value),placeholder:`触发后麦麦的反应... +可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},D)),t.regex_rules.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),a.jsxs("div",{className:"space-y-4 border-t pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),a.jsxs(ie,{onClick:x,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),a.jsxs("div",{className:"space-y-3",children:[t.keyword_rules.map((_,D)=>a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",D+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(A,{rule:_}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除关键词规则 ",D+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>v(D),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-xs font-medium",children:"关键词列表"}),a.jsxs(ie,{onClick:()=>k(D),size:"sm",variant:"ghost",children:[a.jsx(Wr,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),a.jsxs("div",{className:"space-y-2",children:[(_.keywords||[]).map((E,z)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{value:E,onChange:Q=>j(D,z,Q.target.value),placeholder:"关键词",className:"flex-1"}),a.jsx(ie,{onClick:()=>O(D,z),size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})]},z)),(!_.keywords||_.keywords.length===0)&&a.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"反应内容"}),a.jsx(_n,{value:_.reaction,onChange:E=>b(D,"reaction",E.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},D)),t.keyword_rules.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_response_post_process",checked:e.enable_response_post_process,onCheckedChange:_=>i({...e,enable_response_post_process:_})}),a.jsx(te,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),e.enable_response_post_process&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"border-t pt-6 space-y-4",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[a.jsx(jt,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:_=>l({...n,enable:_})}),a.jsx(te,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&a.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),a.jsx(Me,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:_=>l({...n,error_rate:parseFloat(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),a.jsx(Me,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:_=>l({...n,min_freq:parseInt(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),a.jsx(Me,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:_=>l({...n,tone_error_rate:parseFloat(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),a.jsx(Me,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:_=>l({...n,word_replace_rate:parseFloat(_.target.value)})})]})]})]})}),a.jsx("div",{className:"border-t pt-6 space-y-4",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[a.jsx(jt,{id:"enable_response_splitter",checked:r.enable,onCheckedChange:_=>c({...r,enable:_})}),a.jsx(te,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),r.enable&&a.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),a.jsx(Me,{id:"max_length",type:"number",min:"1",value:r.max_length,onChange:_=>c({...r,max_length:parseInt(_.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),a.jsx(Me,{id:"max_sentence_num",type:"number",min:"1",value:r.max_sentence_num,onChange:_=>c({...r,max_sentence_num:parseInt(_.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_kaomoji_protection",checked:r.enable_kaomoji_protection,onCheckedChange:_=>c({...r,enable_kaomoji_protection:_})}),a.jsx(te,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_overflow_return_all",checked:r.enable_overflow_return_all,onCheckedChange:_=>c({...r,enable_overflow_return_all:_})}),a.jsx(te,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),a.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function Jee({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用情绪系统"})]}),t.enable_mood&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"情绪更新阈值"}),a.jsx(Me,{type:"number",min:"1",value:t.mood_update_threshold,onChange:n=>e({...t,mood_update_threshold:parseInt(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"情感特征"}),a.jsx(_n,{value:t.emotion_style,onChange:n=>e({...t,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function ete({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable_asr,onCheckedChange:n=>e({...t,enable_asr:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用语音识别"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function tte({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),t.enable&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"LPMM 模式"}),a.jsxs(Lt,{value:t.lpmm_mode,onValueChange:n=>e({...t,lpmm_mode:n}),children:[a.jsx(Dt,{children:a.jsx(It,{placeholder:"选择 LPMM 模式"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"classic",children:"经典模式"}),a.jsx(Pe,{value:"agent",children:"Agent 模式"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"同义词搜索 TopK"}),a.jsx(Me,{type:"number",min:"1",value:t.rag_synonym_search_top_k,onChange:n=>e({...t,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"同义词阈值"}),a.jsx(Me,{type:"number",step:"0.1",min:"0",max:"1",value:t.rag_synonym_threshold,onChange:n=>e({...t,rag_synonym_threshold:parseFloat(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"实体提取线程数"}),a.jsx(Me,{type:"number",min:"1",value:t.info_extraction_workers,onChange:n=>e({...t,info_extraction_workers:parseInt(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"嵌入向量维度"}),a.jsx(Me,{type:"number",min:"1",value:t.embedding_dimension,onChange:n=>e({...t,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function nte({config:t,onChange:e}){const[n,r]=S.useState(""),[s,i]=S.useState("WARNING"),l=()=>{n&&!t.suppress_libraries.includes(n)&&(e({...t,suppress_libraries:[...t.suppress_libraries,n]}),r(""))},c=v=>{e({...t,suppress_libraries:t.suppress_libraries.filter(b=>b!==v)})},d=()=>{n&&!t.library_log_levels[n]&&(e({...t,library_log_levels:{...t.library_log_levels,[n]:s}}),r(""),i("WARNING"))},h=v=>{const b={...t.library_log_levels};delete b[v],e({...t,library_log_levels:b})},m=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],p=["FULL","compact","lite"],x=["none","title","full"];return a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日期格式"}),a.jsx(Me,{value:t.date_style,onChange:v=>e({...t,date_style:v.target.value}),placeholder:"例如: m-d H:i:s"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日志级别样式"}),a.jsxs(Lt,{value:t.log_level_style,onValueChange:v=>e({...t,log_level_style:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:p.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日志文本颜色"}),a.jsxs(Lt,{value:t.color_text,onValueChange:v=>e({...t,color_text:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:x.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"全局日志级别"}),a.jsxs(Lt,{value:t.log_level,onValueChange:v=>e({...t,log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"控制台日志级别"}),a.jsxs(Lt,{value:t.console_log_level,onValueChange:v=>e({...t,console_log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"文件日志级别"}),a.jsxs(Lt,{value:t.file_log_level,onValueChange:v=>e({...t,file_log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"完全屏蔽的库"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Me,{value:n,onChange:v=>r(v.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),l())}}),a.jsx(ie,{onClick:l,size:"sm",className:"flex-shrink-0",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:t.suppress_libraries.map(v=>a.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[a.jsx("span",{className:"text-sm",children:v}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>c(v),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},v))})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"特定库的日志级别"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Me,{value:n,onChange:v=>r(v.target.value),placeholder:"输入库名",className:"flex-1"}),a.jsxs(Lt,{value:s,onValueChange:i,children:[a.jsx(Dt,{className:"w-32",children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]}),a.jsx(ie,{onClick:d,size:"sm",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"space-y-2",children:Object.entries(t.library_log_levels).map(([v,b])=>a.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[a.jsx("span",{className:"text-sm font-medium",children:v}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:b}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>h(v),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},v))})]})]})}function rte({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示 Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),a.jsx(jt,{checked:t.show_prompt,onCheckedChange:n=>e({...t,show_prompt:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示回复器 Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),a.jsx(jt,{checked:t.show_replyer_prompt,onCheckedChange:n=>e({...t,show_replyer_prompt:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示回复器推理"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),a.jsx(jt,{checked:t.show_replyer_reasoning,onCheckedChange:n=>e({...t,show_replyer_reasoning:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示 Jargon Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),a.jsx(jt,{checked:t.show_jargon_prompt,onCheckedChange:n=>e({...t,show_jargon_prompt:n})})]})]})]})}function ste({config:t,onChange:e}){const[n,r]=S.useState(""),s=()=>{n&&!t.auth_token.includes(n)&&(e({...t,auth_token:[...t.auth_token,n]}),r(""))},i=l=>{e({...t,auth_token:t.auth_token.filter((c,d)=>d!==l)})};return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"启用自定义服务器"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),a.jsx(jt,{checked:t.use_custom,onCheckedChange:l=>e({...t,use_custom:l})})]}),t.use_custom&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"主机地址"}),a.jsx(Me,{value:t.host,onChange:l=>e({...t,host:l.target.value}),placeholder:"127.0.0.1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"端口号"}),a.jsx(Me,{type:"number",value:t.port,onChange:l=>e({...t,port:parseInt(l.target.value)}),placeholder:"8090"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"连接模式"}),a.jsxs(Lt,{value:t.mode,onValueChange:l=>e({...t,mode:l}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"ws",children:"WebSocket (ws)"}),a.jsx(Pe,{value:"tcp",children:"TCP"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.use_wss,onCheckedChange:l=>e({...t,use_wss:l}),disabled:t.mode!=="ws"}),a.jsx(te,{children:"使用 WSS 安全连接"})]})]}),t.use_wss&&t.mode==="ws"&&a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"SSL 证书文件路径"}),a.jsx(Me,{value:t.cert_file,onChange:l=>e({...t,cert_file:l.target.value}),placeholder:"cert.pem"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"SSL 密钥文件路径"}),a.jsx(Me,{value:t.key_file,onChange:l=>e({...t,key_file:l.target.value}),placeholder:"key.pem"})]})]})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"认证令牌"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Me,{value:n,onChange:l=>r(l.target.value),placeholder:"输入认证令牌",onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),s())}}),a.jsx(ie,{onClick:s,size:"sm",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"space-y-2",children:t.auth_token.map((l,c)=>a.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[a.jsx("span",{className:"text-sm font-mono",children:l}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>i(c),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},c))})]})]})}function ite({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"启用统计信息发送"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),a.jsx(jt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})})]})]})}const Mc=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{className:"relative w-full overflow-auto",children:a.jsx("table",{ref:n,className:ye("w-full caption-bottom text-sm",t),...e})}));Mc.displayName="Table";const Ec=S.forwardRef(({className:t,...e},n)=>a.jsx("thead",{ref:n,className:ye("[&_tr]:border-b",t),...e}));Ec.displayName="TableHeader";const _c=S.forwardRef(({className:t,...e},n)=>a.jsx("tbody",{ref:n,className:ye("[&_tr:last-child]:border-0",t),...e}));_c.displayName="TableBody";const ate=S.forwardRef(({className:t,...e},n)=>a.jsx("tfoot",{ref:n,className:ye("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));ate.displayName="TableFooter";const xr=S.forwardRef(({className:t,...e},n)=>a.jsx("tr",{ref:n,className:ye("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));xr.displayName="TableRow";const xt=S.forwardRef(({className:t,...e},n)=>a.jsx("th",{ref:n,className:ye("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));xt.displayName="TableHead";const it=S.forwardRef(({className:t,...e},n)=>a.jsx("td",{ref:n,className:ye("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));it.displayName="TableCell";const lte=S.forwardRef(({className:t,...e},n)=>a.jsx("caption",{ref:n,className:ye("mt-4 text-sm text-muted-foreground",t),...e}));lte.displayName="TableCaption";const ss=S.forwardRef(({className:t,...e},n)=>a.jsx(A9,{ref:n,className:ye("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:a.jsx(rq,{className:ye("grid place-content-center text-current"),children:a.jsx(hc,{className:"h-4 w-4"})})}));ss.displayName=A9.displayName;function ote(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(null),[T,A]=S.useState(null),[_,D]=S.useState(!1),[E,z]=S.useState(null),[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,ce]=S.useState(new Set),[W,J]=S.useState(!1),[$,ae]=S.useState(1),[ne,ue]=S.useState(20),[R,me]=S.useState(""),{toast:Y}=Pr(),P=S.useRef(null),K=S.useRef(!0);S.useEffect(()=>{H()},[]);const H=async()=>{try{r(!0);const ee=await Vu();e(ee.api_providers||[]),h(!1),K.current=!1}catch(ee){console.error("加载配置失败:",ee)}finally{r(!1)}},fe=async()=>{try{p(!0),xw().catch(()=>{}),v(!0)}catch(ee){console.error("重启失败:",ee),v(!1),Y({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),p(!1)}},ve=async()=>{try{i(!0),P.current&&clearTimeout(P.current);const ee=await Vu();ee.api_providers=t,await wg(ee),h(!1),Y({title:"保存成功",description:"正在重启麦麦..."}),await fe()}catch(ee){console.error("保存配置失败:",ee),Y({title:"保存失败",description:ee.message,variant:"destructive"}),i(!1)}},Re=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},de=()=>{v(!1),p(!1),Y({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},We=S.useCallback(async ee=>{if(!K.current)try{c(!0),await h2("api_providers",ee),h(!1)}catch(Se){console.error("自动保存失败:",Se),h(!0)}finally{c(!1)}},[]);S.useEffect(()=>{if(!K.current)return h(!0),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{We(t)},2e3),()=>{P.current&&clearTimeout(P.current)}},[t,We]);const ct=async()=>{try{i(!0),P.current&&clearTimeout(P.current);const ee=await Vu();ee.api_providers=t,await wg(ee),h(!1),Y({title:"保存成功",description:"模型提供商配置已保存"})}catch(ee){console.error("保存配置失败:",ee),Y({title:"保存失败",description:ee.message,variant:"destructive"})}finally{i(!1)}},Oe=(ee,Se)=>{j(ee||{name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),A(Se),F(!1),k(!0)},nt=async()=>{if(O?.api_key)try{await navigator.clipboard.writeText(O.api_key),Y({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{Y({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},ut=()=>{if(!O)return;const ee={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};if(T!==null){const Se=[...t];Se[T]=ee,e(Se)}else e([...t,ee]);k(!1),j(null),A(null)},Ct=ee=>{if(!ee&&O){const Se={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};j(Se)}k(ee)},In=ee=>{z(ee),D(!0)},Tn=()=>{if(E!==null){const ee=t.filter((Se,Be)=>Be!==E);e(ee),Y({title:"删除成功",description:"提供商已从列表中移除"})}D(!1),z(null)},Jn=ee=>{const Se=new Set(V);Se.has(ee)?Se.delete(ee):Se.add(ee),ce(Se)},nn=()=>{if(V.size===qn.length)ce(new Set);else{const ee=qn.map((Se,Be)=>t.findIndex(rt=>rt===qn[Be]));ce(new Set(ee))}},_t=()=>{if(V.size===0){Y({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}J(!0)},Yr=()=>{const ee=t.filter((Se,Be)=>!V.has(Be));e(ee),ce(new Set),J(!1),Y({title:"批量删除成功",description:`已删除 ${V.size} 个提供商`})},qn=t.filter(ee=>{if(!L)return!0;const Se=L.toLowerCase();return ee.name.toLowerCase().includes(Se)||ee.base_url.toLowerCase().includes(Se)||ee.client_type.toLowerCase().includes(Se)}),or=Math.ceil(qn.length/ne),yn=qn.slice(($-1)*ne,$*ne),ft=()=>{const ee=parseInt(R);ee>=1&&ee<=or&&(ae(ee),me(""))};return n?a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型提供商配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 API 提供商配置"})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[V.size>0&&a.jsxs(ie,{onClick:_t,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",V.size,")"]}),a.jsxs(ie,{onClick:()=>Oe(null,null),size:"sm",className:"w-full sm:w-auto",children:[a.jsx(Wr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),a.jsxs(ie,{onClick:ct,disabled:s||l||!d||m,size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),s?"保存中...":l?"自动保存中...":d?"保存配置":"已保存"]}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:s||l||m,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),m?"重启中...":d?"保存并重启":"重启麦麦"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重启麦麦?"}),a.jsx(dn,{children:d?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:d?ve:fe,children:d?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),a.jsxs(mn,{className:"h-[calc(100vh-260px)]",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[a.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索提供商名称、URL 或类型...",value:L,onChange:ee=>U(ee.target.value),className:"pl-9"})]}),L&&a.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",qn.length," 个结果"]})]}),a.jsx("div",{className:"md:hidden space-y-3",children:qn.length===0?a.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:L?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):yn.map((ee,Se)=>{const Be=t.findIndex(rt=>rt===ee);return a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h3",{className:"font-semibold text-base truncate",children:ee.name}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:ee.base_url})]}),a.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Oe(ee,Be),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>In(Be),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),a.jsx("p",{className:"font-medium",children:ee.client_type})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),a.jsx("p",{className:"font-medium",children:ee.max_retry})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),a.jsx("p",{className:"font-medium",children:ee.timeout})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),a.jsx("p",{className:"font-medium",children:ee.retry_interval})]})]})]},Se)})}),a.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:V.size===qn.length&&qn.length>0,onCheckedChange:nn})}),a.jsx(xt,{children:"名称"}),a.jsx(xt,{children:"基础URL"}),a.jsx(xt,{children:"客户端类型"}),a.jsx(xt,{className:"text-right",children:"最大重试"}),a.jsx(xt,{className:"text-right",children:"超时(秒)"}),a.jsx(xt,{className:"text-right",children:"重试间隔(秒)"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:yn.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center text-muted-foreground py-8",children:L?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):yn.map((ee,Se)=>{const Be=t.findIndex(rt=>rt===ee);return a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:V.has(Be),onCheckedChange:()=>Jn(Be)})}),a.jsx(it,{className:"font-medium",children:ee.name}),a.jsx(it,{className:"max-w-xs truncate",title:ee.base_url,children:ee.base_url}),a.jsx(it,{children:ee.client_type}),a.jsx(it,{className:"text-right",children:ee.max_retry}),a.jsx(it,{className:"text-right",children:ee.timeout}),a.jsx(it,{className:"text-right",children:ee.retry_interval}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Oe(ee,Be),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>In(Be),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Se)})})]})}),qn.length>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:ne.toString(),onValueChange:ee=>{ue(parseInt(ee)),ae(1),ce(new Set)},children:[a.jsx(Dt,{id:"page-size-provider",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",($-1)*ne+1," 到"," ",Math.min($*ne,qn.length)," 条,共 ",qn.length," 条"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ae(1),disabled:$===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(ee=>Math.max(1,ee-1)),disabled:$===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:R,onChange:ee=>me(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&ft(),placeholder:$.toString(),className:"w-16 h-8 text-center",min:1,max:or}),a.jsx(ie,{variant:"outline",size:"sm",onClick:ft,disabled:!R,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(ee=>ee+1),disabled:$>=or,children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ae(or),disabled:$>=or,className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]}),a.jsx(Rr,{open:b,onOpenChange:Ct,children:a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:T!==null?"编辑提供商":"添加提供商"}),a.jsx(Gr,{children:"配置 API 提供商的连接信息和参数"})]}),a.jsxs("div",{className:"grid gap-4 py-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"name",children:"名称 *"}),a.jsx(Me,{id:"name",value:O?.name||"",onChange:ee=>j(Se=>Se?{...Se,name:ee.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"base_url",children:"基础 URL *"}),a.jsx(Me,{id:"base_url",value:O?.base_url||"",onChange:ee=>j(Se=>Se?{...Se,base_url:ee.target.value}:null),placeholder:"https://api.example.com/v1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"api_key",children:"API Key *"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{id:"api_key",type:Q?"text":"password",value:O?.api_key||"",onChange:ee=>j(Se=>Se?{...Se,api_key:ee.target.value}:null),placeholder:"sk-...",className:"flex-1"}),a.jsx(ie,{type:"button",variant:"outline",size:"icon",onClick:()=>F(!Q),title:Q?"隐藏密钥":"显示密钥",children:Q?a.jsx(Yb,{className:"h-4 w-4"}):a.jsx($i,{className:"h-4 w-4"})}),a.jsx(ie,{type:"button",variant:"outline",size:"icon",onClick:nt,title:"复制密钥",children:a.jsx(Xb,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"client_type",children:"客户端类型"}),a.jsxs(Lt,{value:O?.client_type||"openai",onValueChange:ee=>j(Se=>Se?{...Se,client_type:ee}:null),children:[a.jsx(Dt,{id:"client_type",children:a.jsx(It,{placeholder:"选择客户端类型"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"openai",children:"OpenAI"}),a.jsx(Pe,{value:"gemini",children:"Gemini"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_retry",children:"最大重试"}),a.jsx(Me,{id:"max_retry",type:"number",min:"0",value:O?.max_retry??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,max_retry:Se}:null)},placeholder:"默认: 2"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"timeout",children:"超时(秒)"}),a.jsx(Me,{id:"timeout",type:"number",min:"1",value:O?.timeout??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,timeout:Se}:null)},placeholder:"默认: 30"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),a.jsx(Me,{id:"retry_interval",type:"number",min:"1",value:O?.retry_interval??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,retry_interval:Se}:null)},placeholder:"默认: 10"})]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>k(!1),children:"取消"}),a.jsx(ie,{onClick:ut,children:"保存"})]})]})}),a.jsx(pn,{open:_,onOpenChange:D,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除提供商 "',E!==null?t[E]?.name:"",'" 吗? 此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:Tn,children:"删除"})]})]})}),a.jsx(pn,{open:W,onOpenChange:J,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["确定要删除选中的 ",V.size," 个提供商吗? 此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:Yr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),x&&a.jsx(vw,{onRestartComplete:Re,onRestartFailed:de})]})}var a8=1,cte=.9,ute=.8,dte=.17,cb=.1,ub=.999,hte=.9999,fte=.99,mte=/[\\\/_+.#"@\[\(\{&]/,pte=/[\\\/_+.#"@\[\(\{&]/g,gte=/[\s-]/,L_=/[\s-]/g;function u4(t,e,n,r,s,i,l){if(i===e.length)return s===t.length?a8:fte;var c=`${s},${i}`;if(l[c]!==void 0)return l[c];for(var d=r.charAt(i),h=n.indexOf(d,s),m=0,p,x,v,b;h>=0;)p=u4(t,e,n,r,h+1,i+1,l),p>m&&(h===s?p*=a8:mte.test(t.charAt(h-1))?(p*=ute,v=t.slice(s,h-1).match(pte),v&&s>0&&(p*=Math.pow(ub,v.length))):gte.test(t.charAt(h-1))?(p*=cte,b=t.slice(s,h-1).match(L_),b&&s>0&&(p*=Math.pow(ub,b.length))):(p*=dte,s>0&&(p*=Math.pow(ub,h-s))),t.charAt(h)!==e.charAt(i)&&(p*=hte)),(pp&&(p=x*cb)),p>m&&(m=p),h=n.indexOf(d,h+1);return l[c]=m,m}function l8(t){return t.toLowerCase().replace(L_," ")}function xte(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,u4(t,e,l8(t),l8(e),0,0,{})}var vte=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],To=vte.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Bh='[cmdk-group=""]',db='[cmdk-group-items=""]',yte='[cmdk-group-heading=""]',I_='[cmdk-item=""]',o8=`${I_}:not([aria-disabled="true"])`,d4="cmdk-item-select",Pu="data-value",bte=(t,e,n)=>xte(t,e,n),q_=S.createContext(void 0),g0=()=>S.useContext(q_),F_=S.createContext(void 0),o5=()=>S.useContext(F_),Q_=S.createContext(void 0),$_=S.forwardRef((t,e)=>{let n=Bu(()=>{var Y,P;return{search:"",value:(P=(Y=t.value)!=null?Y:t.defaultValue)!=null?P:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Bu(()=>new Set),s=Bu(()=>new Map),i=Bu(()=>new Map),l=Bu(()=>new Set),c=H_(t),{label:d,children:h,value:m,onValueChange:p,filter:x,shouldFilter:v,loop:b,disablePointerSelection:k=!1,vimBindings:O=!0,...j}=t,T=ji(),A=ji(),_=ji(),D=S.useRef(null),E=Ete();Nc(()=>{if(m!==void 0){let Y=m.trim();n.current.value=Y,z.emit()}},[m]),Nc(()=>{E(6,ce)},[]);let z=S.useMemo(()=>({subscribe:Y=>(l.current.add(Y),()=>l.current.delete(Y)),snapshot:()=>n.current,setState:(Y,P,K)=>{var H,fe,ve,Re;if(!Object.is(n.current[Y],P)){if(n.current[Y]=P,Y==="search")V(),L(),E(1,U);else if(Y==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let de=document.getElementById(_);de?de.focus():(H=document.getElementById(T))==null||H.focus()}if(E(7,()=>{var de;n.current.selectedItemId=(de=W())==null?void 0:de.id,z.emit()}),K||E(5,ce),((fe=c.current)==null?void 0:fe.value)!==void 0){let de=P??"";(Re=(ve=c.current).onValueChange)==null||Re.call(ve,de);return}}z.emit()}},emit:()=>{l.current.forEach(Y=>Y())}}),[]),Q=S.useMemo(()=>({value:(Y,P,K)=>{var H;P!==((H=i.current.get(Y))==null?void 0:H.value)&&(i.current.set(Y,{value:P,keywords:K}),n.current.filtered.items.set(Y,F(P,K)),E(2,()=>{L(),z.emit()}))},item:(Y,P)=>(r.current.add(Y),P&&(s.current.has(P)?s.current.get(P).add(Y):s.current.set(P,new Set([Y]))),E(3,()=>{V(),L(),n.current.value||U(),z.emit()}),()=>{i.current.delete(Y),r.current.delete(Y),n.current.filtered.items.delete(Y);let K=W();E(4,()=>{V(),K?.getAttribute("id")===Y&&U(),z.emit()})}),group:Y=>(s.current.has(Y)||s.current.set(Y,new Set),()=>{i.current.delete(Y),s.current.delete(Y)}),filter:()=>c.current.shouldFilter,label:d||t["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:T,inputId:_,labelId:A,listInnerRef:D}),[]);function F(Y,P){var K,H;let fe=(H=(K=c.current)==null?void 0:K.filter)!=null?H:bte;return Y?fe(Y,n.current.search,P):0}function L(){if(!n.current.search||c.current.shouldFilter===!1)return;let Y=n.current.filtered.items,P=[];n.current.filtered.groups.forEach(H=>{let fe=s.current.get(H),ve=0;fe.forEach(Re=>{let de=Y.get(Re);ve=Math.max(de,ve)}),P.push([H,ve])});let K=D.current;J().sort((H,fe)=>{var ve,Re;let de=H.getAttribute("id"),We=fe.getAttribute("id");return((ve=Y.get(We))!=null?ve:0)-((Re=Y.get(de))!=null?Re:0)}).forEach(H=>{let fe=H.closest(db);fe?fe.appendChild(H.parentElement===fe?H:H.closest(`${db} > *`)):K.appendChild(H.parentElement===K?H:H.closest(`${db} > *`))}),P.sort((H,fe)=>fe[1]-H[1]).forEach(H=>{var fe;let ve=(fe=D.current)==null?void 0:fe.querySelector(`${Bh}[${Pu}="${encodeURIComponent(H[0])}"]`);ve?.parentElement.appendChild(ve)})}function U(){let Y=J().find(K=>K.getAttribute("aria-disabled")!=="true"),P=Y?.getAttribute(Pu);z.setState("value",P||void 0)}function V(){var Y,P,K,H;if(!n.current.search||c.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let fe=0;for(let ve of r.current){let Re=(P=(Y=i.current.get(ve))==null?void 0:Y.value)!=null?P:"",de=(H=(K=i.current.get(ve))==null?void 0:K.keywords)!=null?H:[],We=F(Re,de);n.current.filtered.items.set(ve,We),We>0&&fe++}for(let[ve,Re]of s.current)for(let de of Re)if(n.current.filtered.items.get(de)>0){n.current.filtered.groups.add(ve);break}n.current.filtered.count=fe}function ce(){var Y,P,K;let H=W();H&&(((Y=H.parentElement)==null?void 0:Y.firstChild)===H&&((K=(P=H.closest(Bh))==null?void 0:P.querySelector(yte))==null||K.scrollIntoView({block:"nearest"})),H.scrollIntoView({block:"nearest"}))}function W(){var Y;return(Y=D.current)==null?void 0:Y.querySelector(`${I_}[aria-selected="true"]`)}function J(){var Y;return Array.from(((Y=D.current)==null?void 0:Y.querySelectorAll(o8))||[])}function $(Y){let P=J()[Y];P&&z.setState("value",P.getAttribute(Pu))}function ae(Y){var P;let K=W(),H=J(),fe=H.findIndex(Re=>Re===K),ve=H[fe+Y];(P=c.current)!=null&&P.loop&&(ve=fe+Y<0?H[H.length-1]:fe+Y===H.length?H[0]:H[fe+Y]),ve&&z.setState("value",ve.getAttribute(Pu))}function ne(Y){let P=W(),K=P?.closest(Bh),H;for(;K&&!H;)K=Y>0?Ate(K,Bh):Mte(K,Bh),H=K?.querySelector(o8);H?z.setState("value",H.getAttribute(Pu)):ae(Y)}let ue=()=>$(J().length-1),R=Y=>{Y.preventDefault(),Y.metaKey?ue():Y.altKey?ne(1):ae(1)},me=Y=>{Y.preventDefault(),Y.metaKey?$(0):Y.altKey?ne(-1):ae(-1)};return S.createElement(To.div,{ref:e,tabIndex:-1,...j,"cmdk-root":"",onKeyDown:Y=>{var P;(P=j.onKeyDown)==null||P.call(j,Y);let K=Y.nativeEvent.isComposing||Y.keyCode===229;if(!(Y.defaultPrevented||K))switch(Y.key){case"n":case"j":{O&&Y.ctrlKey&&R(Y);break}case"ArrowDown":{R(Y);break}case"p":case"k":{O&&Y.ctrlKey&&me(Y);break}case"ArrowUp":{me(Y);break}case"Home":{Y.preventDefault(),$(0);break}case"End":{Y.preventDefault(),ue();break}case"Enter":{Y.preventDefault();let H=W();if(H){let fe=new Event(d4);H.dispatchEvent(fe)}}}}},S.createElement("label",{"cmdk-label":"",htmlFor:Q.inputId,id:Q.labelId,style:Dte},d),Px(t,Y=>S.createElement(F_.Provider,{value:z},S.createElement(q_.Provider,{value:Q},Y))))}),wte=S.forwardRef((t,e)=>{var n,r;let s=ji(),i=S.useRef(null),l=S.useContext(Q_),c=g0(),d=H_(t),h=(r=(n=d.current)==null?void 0:n.forceMount)!=null?r:l?.forceMount;Nc(()=>{if(!h)return c.item(s,l?.id)},[h]);let m=U_(s,i,[t.value,t.children,i],t.keywords),p=o5(),x=vo(E=>E.value&&E.value===m.current),v=vo(E=>h||c.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);S.useEffect(()=>{let E=i.current;if(!(!E||t.disabled))return E.addEventListener(d4,b),()=>E.removeEventListener(d4,b)},[v,t.onSelect,t.disabled]);function b(){var E,z;k(),(z=(E=d.current).onSelect)==null||z.call(E,m.current)}function k(){p.setState("value",m.current,!0)}if(!v)return null;let{disabled:O,value:j,onSelect:T,forceMount:A,keywords:_,...D}=t;return S.createElement(To.div,{ref:oo(i,e),...D,id:s,"cmdk-item":"",role:"option","aria-disabled":!!O,"aria-selected":!!x,"data-disabled":!!O,"data-selected":!!x,onPointerMove:O||c.getDisablePointerSelection()?void 0:k,onClick:O?void 0:b},t.children)}),Ste=S.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,l=ji(),c=S.useRef(null),d=S.useRef(null),h=ji(),m=g0(),p=vo(v=>s||m.filter()===!1?!0:v.search?v.filtered.groups.has(l):!0);Nc(()=>m.group(l),[]),U_(l,c,[t.value,t.heading,d]);let x=S.useMemo(()=>({id:l,forceMount:s}),[s]);return S.createElement(To.div,{ref:oo(c,e),...i,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},n&&S.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),Px(t,v=>S.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},S.createElement(Q_.Provider,{value:x},v))))}),kte=S.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=S.useRef(null),i=vo(l=>!l.search);return!n&&!i?null:S.createElement(To.div,{ref:oo(s,e),...r,"cmdk-separator":"",role:"separator"})}),Ote=S.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=o5(),l=vo(h=>h.search),c=vo(h=>h.selectedItemId),d=g0();return S.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),S.createElement(To.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":c,id:d.inputId,type:"text",value:s?t.value:l,onChange:h=>{s||i.setState("search",h.target.value),n?.(h.target.value)}})}),jte=S.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=S.useRef(null),l=S.useRef(null),c=vo(h=>h.selectedItemId),d=g0();return S.useEffect(()=>{if(l.current&&i.current){let h=l.current,m=i.current,p,x=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let v=h.offsetHeight;m.style.setProperty("--cmdk-list-height",v.toFixed(1)+"px")})});return x.observe(h),()=>{cancelAnimationFrame(p),x.unobserve(h)}}},[]),S.createElement(To.div,{ref:oo(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":r,id:d.listId},Px(t,h=>S.createElement("div",{ref:oo(l,d.listInnerRef),"cmdk-list-sizer":""},h)))}),Nte=S.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:l,...c}=t;return S.createElement(W4,{open:n,onOpenChange:r},S.createElement($4,{container:l},S.createElement(nx,{"cmdk-overlay":"",className:s}),S.createElement(rx,{"aria-label":t.label,"cmdk-dialog":"",className:i},S.createElement($_,{ref:e,...c}))))}),Cte=S.forwardRef((t,e)=>vo(n=>n.filtered.count===0)?S.createElement(To.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),Tte=S.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return S.createElement(To.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Px(t,l=>S.createElement("div",{"aria-hidden":!0},l)))}),Is=Object.assign($_,{List:jte,Item:wte,Input:Ote,Group:Ste,Separator:kte,Dialog:Nte,Empty:Cte,Loading:Tte});function Ate(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function Mte(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function H_(t){let e=S.useRef(t);return Nc(()=>{e.current=t}),e}var Nc=typeof window>"u"?S.useEffect:S.useLayoutEffect;function Bu(t){let e=S.useRef();return e.current===void 0&&(e.current=t()),e}function vo(t){let e=o5(),n=()=>t(e.snapshot());return S.useSyncExternalStore(e.subscribe,n,n)}function U_(t,e,n,r=[]){let s=S.useRef(),i=g0();return Nc(()=>{var l;let c=(()=>{var h;for(let m of n){if(typeof m=="string")return m.trim();if(typeof m=="object"&&"current"in m)return m.current?(h=m.current.textContent)==null?void 0:h.trim():s.current}})(),d=r.map(h=>h.trim());i.value(t,c,d),(l=e.current)==null||l.setAttribute(Pu,c),s.current=c}),s}var Ete=()=>{let[t,e]=S.useState(),n=Bu(()=>new Map);return Nc(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function _te(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function Px({asChild:t,children:e},n){return t&&S.isValidElement(e)?S.cloneElement(_te(e),{ref:e.ref},n(e.props.children)):n(e)}var Dte={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const V_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is,{ref:n,className:ye("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));V_.displayName=Is.displayName;const W_=S.forwardRef(({className:t,...e},n)=>a.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[a.jsx(Bs,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),a.jsx(Is.Input,{ref:n,className:ye("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));W_.displayName=Is.Input.displayName;const G_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.List,{ref:n,className:ye("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));G_.displayName=Is.List.displayName;const X_=S.forwardRef((t,e)=>a.jsx(Is.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));X_.displayName=Is.Empty.displayName;const Y_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.Group,{ref:n,className:ye("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...e}));Y_.displayName=Is.Group.displayName;const Rte=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.Separator,{ref:n,className:ye("-mx-1 h-px bg-border",t),...e}));Rte.displayName=Is.Separator.displayName;const K_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.Item,{ref:n,className:ye("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...e}));K_.displayName=Is.Item.displayName;function zte({options:t,selected:e,onChange:n,placeholder:r="选择选项...",emptyText:s="未找到选项",className:i}){const[l,c]=S.useState(!1),d=m=>{e.includes(m)?n(e.filter(p=>p!==m)):n([...e,m])},h=m=>{n(e.filter(p=>p!==m))};return a.jsxs(uo,{open:l,onOpenChange:c,children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",role:"combobox","aria-expanded":l,className:ye("w-full justify-between min-h-10 h-auto",i),children:[a.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:e.length===0?a.jsx("span",{className:"text-muted-foreground",children:r}):e.map(m=>{const p=t.find(x=>x.value===m);return a.jsxs(On,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80",onClick:x=>{x.stopPropagation(),h(m)},children:[p?.label||m,a.jsx(Gf,{className:"ml-1 h-3 w-3",strokeWidth:2,fill:"none"})]},m)})}),a.jsx(Sq,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),a.jsx(fl,{className:"w-full p-0",align:"start",children:a.jsxs(V_,{children:[a.jsx(W_,{placeholder:"搜索...",className:"h-9"}),a.jsxs(G_,{children:[a.jsx(X_,{children:s}),a.jsx(Y_,{children:t.map(m=>{const p=e.includes(m.value);return a.jsxs(K_,{value:m.value,onSelect:()=>d(m.value),children:[a.jsx("div",{className:ye("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",p?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:a.jsx(hc,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),a.jsx("span",{children:m.label})]},m.value)})})]})]})})]})}function Pte(){const[t,e]=S.useState([]),[n,r]=S.useState([]),[s,i]=S.useState([]),[l,c]=S.useState(null),[d,h]=S.useState(!0),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,A]=S.useState(!1),[_,D]=S.useState(!1),[E,z]=S.useState(null),[Q,F]=S.useState(null),[L,U]=S.useState(!1),[V,ce]=S.useState(null),[W,J]=S.useState(""),[$,ae]=S.useState(new Set),[ne,ue]=S.useState(!1),[R,me]=S.useState(1),[Y,P]=S.useState(20),[K,H]=S.useState(""),{toast:fe}=Pr(),ve=S.useRef(null),Re=S.useRef(null),de=S.useRef(!0);S.useEffect(()=>{We()},[]);const We=async()=>{try{h(!0);const re=await Vu(),Ae=re.models||[];e(Ae),i(Ae.map(yt=>yt.name));const pt=re.api_providers||[];r(pt.map(yt=>yt.name)),c(re.model_task_config||null),k(!1),de.current=!1}catch(re){console.error("加载配置失败:",re)}finally{h(!1)}},ct=async()=>{try{j(!0),xw().catch(()=>{}),A(!0)}catch(re){console.error("重启失败:",re),A(!1),fe({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),j(!1)}},Oe=async()=>{try{p(!0),ve.current&&clearTimeout(ve.current),Re.current&&clearTimeout(Re.current);const re=await Vu();re.models=t,re.model_task_config=l,await wg(re),k(!1),fe({title:"保存成功",description:"正在重启麦麦..."}),await ct()}catch(re){console.error("保存配置失败:",re),fe({title:"保存失败",description:re.message,variant:"destructive"}),p(!1)}},nt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},ut=()=>{A(!1),j(!1),fe({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Ct=S.useCallback(async re=>{if(!de.current)try{v(!0),await h2("models",re),k(!1)}catch(Ae){console.error("自动保存模型列表失败:",Ae),k(!0)}finally{v(!1)}},[]),In=S.useCallback(async re=>{if(!de.current)try{v(!0),await h2("model_task_config",re),k(!1)}catch(Ae){console.error("自动保存任务配置失败:",Ae),k(!0)}finally{v(!1)}},[]);S.useEffect(()=>{if(!de.current)return k(!0),ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{Ct(t)},2e3),()=>{ve.current&&clearTimeout(ve.current)}},[t,Ct]),S.useEffect(()=>{if(!(de.current||!l))return k(!0),Re.current&&clearTimeout(Re.current),Re.current=setTimeout(()=>{In(l)},2e3),()=>{Re.current&&clearTimeout(Re.current)}},[l,In]);const Tn=async()=>{try{p(!0),ve.current&&clearTimeout(ve.current),Re.current&&clearTimeout(Re.current);const re=await Vu();re.models=t,re.model_task_config=l,await wg(re),k(!1),fe({title:"保存成功",description:"模型配置已保存"}),await We()}catch(re){console.error("保存配置失败:",re),fe({title:"保存失败",description:re.message,variant:"destructive"})}finally{p(!1)}},Jn=(re,Ae)=>{z(re||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),F(Ae),D(!0)},nn=()=>{if(!E)return;const re={...E,price_in:E.price_in??0,price_out:E.price_out??0};let Ae;Q!==null?(Ae=[...t],Ae[Q]=re):Ae=[...t,re],e(Ae),i(Ae.map(pt=>pt.name)),D(!1),z(null),F(null)},_t=re=>{if(!re&&E){const Ae={...E,price_in:E.price_in??0,price_out:E.price_out??0};z(Ae)}D(re)},Yr=re=>{ce(re),U(!0)},qn=()=>{if(V!==null){const re=t.filter((Ae,pt)=>pt!==V);e(re),i(re.map(Ae=>Ae.name)),fe({title:"删除成功",description:"模型已从列表中移除"})}U(!1),ce(null)},or=re=>{const Ae=new Set($);Ae.has(re)?Ae.delete(re):Ae.add(re),ae(Ae)},yn=()=>{if($.size===Be.length)ae(new Set);else{const re=Be.map((Ae,pt)=>t.findIndex(yt=>yt===Be[pt]));ae(new Set(re))}},ft=()=>{if($.size===0){fe({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ue(!0)},ee=()=>{const re=t.filter((Ae,pt)=>!$.has(pt));e(re),i(re.map(Ae=>Ae.name)),ae(new Set),ue(!1),fe({title:"批量删除成功",description:`已删除 ${$.size} 个模型`})},Se=(re,Ae,pt)=>{l&&c({...l,[re]:{...l[re],[Ae]:pt}})},Be=t.filter(re=>{if(!W)return!0;const Ae=W.toLowerCase();return re.name.toLowerCase().includes(Ae)||re.model_identifier.toLowerCase().includes(Ae)||re.api_provider.toLowerCase().includes(Ae)}),rt=Math.ceil(Be.length/Y),Tt=Be.slice((R-1)*Y,R*Y),cr=()=>{const re=parseInt(K);re>=1&&re<=rt&&(me(re),H(""))},Kr=re=>l?[l.utils?.model_list||[],l.utils_small?.model_list||[],l.tool_use?.model_list||[],l.replyer?.model_list||[],l.planner?.model_list||[],l.vlm?.model_list||[],l.voice?.model_list||[],l.embedding?.model_list||[],l.lpmm_entity_extract?.model_list||[],l.lpmm_rdf_build?.model_list||[],l.lpmm_qa?.model_list||[]].some(pt=>pt.includes(re)):!1;return d?a.jsx(mn,{className:"h-full",children:a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理模型和任务配置"})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[a.jsxs(ie,{onClick:Tn,disabled:m||x||!b||O,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),m?"保存中...":x?"自动保存中...":b?"保存配置":"已保存"]}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:m||x||O,size:"sm",className:"flex-1 sm:flex-none",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),O?"重启中...":b?"保存并重启":"重启麦麦"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重启麦麦?"}),a.jsx(dn,{children:b?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:b?Oe:ct,children:b?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),a.jsxs(hl,{defaultValue:"models",className:"w-full",children:[a.jsxs(ya,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[a.jsx($t,{value:"models",children:"模型配置"}),a.jsx($t,{value:"tasks",children:"模型任务配置"})]}),a.jsxs(kn,{value:"models",className:"space-y-4 mt-0",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[$.size>0&&a.jsxs(ie,{onClick:ft,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",$.size,")"]}),a.jsxs(ie,{onClick:()=>Jn(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(Wr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[a.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索模型名称、标识符或提供商...",value:W,onChange:re=>J(re.target.value),className:"pl-9"})]}),W&&a.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Be.length," 个结果"]})]}),a.jsx("div",{className:"md:hidden space-y-3",children:Tt.length===0?a.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:W?"未找到匹配的模型":"暂无模型配置"}):Tt.map((re,Ae)=>{const pt=t.findIndex(vs=>vs===re),yt=Kr(re.name);return a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("h3",{className:"font-semibold text-base",children:re.name}),a.jsx(On,{variant:yt?"default":"secondary",className:yt?"bg-green-600 hover:bg-green-700":"",children:yt?"已使用":"未使用"})]}),a.jsx("p",{className:"text-xs text-muted-foreground break-all",title:re.model_identifier,children:re.model_identifier})]}),a.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Jn(re,pt),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>Yr(pt),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),a.jsx("p",{className:"font-medium",children:re.api_provider})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),a.jsx("p",{className:"font-medium",children:re.force_stream_mode?"是":"否"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),a.jsxs("p",{className:"font-medium",children:["¥",re.price_in,"/M"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),a.jsxs("p",{className:"font-medium",children:["¥",re.price_out,"/M"]})]})]})]},Ae)})}),a.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:$.size===Be.length&&Be.length>0,onCheckedChange:yn})}),a.jsx(xt,{className:"w-24",children:"使用状态"}),a.jsx(xt,{children:"模型名称"}),a.jsx(xt,{children:"模型标识符"}),a.jsx(xt,{children:"提供商"}),a.jsx(xt,{className:"text-right",children:"输入价格"}),a.jsx(xt,{className:"text-right",children:"输出价格"}),a.jsx(xt,{className:"text-center",children:"强制流式"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:Tt.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:9,className:"text-center text-muted-foreground py-8",children:W?"未找到匹配的模型":"暂无模型配置"})}):Tt.map((re,Ae)=>{const pt=t.findIndex(vs=>vs===re),yt=Kr(re.name);return a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:$.has(pt),onCheckedChange:()=>or(pt)})}),a.jsx(it,{children:a.jsx(On,{variant:yt?"default":"secondary",className:yt?"bg-green-600 hover:bg-green-700":"",children:yt?"已使用":"未使用"})}),a.jsx(it,{className:"font-medium",children:re.name}),a.jsx(it,{className:"max-w-xs truncate",title:re.model_identifier,children:re.model_identifier}),a.jsx(it,{children:re.api_provider}),a.jsxs(it,{className:"text-right",children:["¥",re.price_in,"/M"]}),a.jsxs(it,{className:"text-right",children:["¥",re.price_out,"/M"]}),a.jsx(it,{className:"text-center",children:re.force_stream_mode?"是":"否"}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Jn(re,pt),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>Yr(pt),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Ae)})})]})}),Be.length>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:Y.toString(),onValueChange:re=>{P(parseInt(re)),me(1),ae(new Set)},children:[a.jsx(Dt,{id:"page-size-model",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*Y+1," 到"," ",Math.min(R*Y,Be.length)," 条,共 ",Be.length," 条"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>me(1),disabled:R===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>me(re=>Math.max(1,re-1)),disabled:R===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:K,onChange:re=>H(re.target.value),onKeyDown:re=>re.key==="Enter"&&cr(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:rt}),a.jsx(ie,{variant:"outline",size:"sm",onClick:cr,disabled:!K,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>me(re=>re+1),disabled:R>=rt,children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>me(rt),disabled:R>=rt,className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]}),a.jsxs(kn,{value:"tasks",className:"space-y-6 mt-0",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),l&&a.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[a.jsx(Pi,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:l.utils,modelNames:s,onChange:(re,Ae)=>Se("utils",re,Ae)}),a.jsx(Pi,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:l.utils_small,modelNames:s,onChange:(re,Ae)=>Se("utils_small",re,Ae)}),a.jsx(Pi,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:l.tool_use,modelNames:s,onChange:(re,Ae)=>Se("tool_use",re,Ae)}),a.jsx(Pi,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:l.replyer,modelNames:s,onChange:(re,Ae)=>Se("replyer",re,Ae)}),a.jsx(Pi,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:l.planner,modelNames:s,onChange:(re,Ae)=>Se("planner",re,Ae)}),a.jsx(Pi,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:l.vlm,modelNames:s,onChange:(re,Ae)=>Se("vlm",re,Ae),hideTemperature:!0}),a.jsx(Pi,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:l.voice,modelNames:s,onChange:(re,Ae)=>Se("voice",re,Ae),hideTemperature:!0,hideMaxTokens:!0}),a.jsx(Pi,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:l.embedding,modelNames:s,onChange:(re,Ae)=>Se("embedding",re,Ae),hideTemperature:!0,hideMaxTokens:!0}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),a.jsx(Pi,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:l.lpmm_entity_extract,modelNames:s,onChange:(re,Ae)=>Se("lpmm_entity_extract",re,Ae)}),a.jsx(Pi,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:l.lpmm_rdf_build,modelNames:s,onChange:(re,Ae)=>Se("lpmm_rdf_build",re,Ae)}),a.jsx(Pi,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:l.lpmm_qa,modelNames:s,onChange:(re,Ae)=>Se("lpmm_qa",re,Ae)})]})]})]})]}),a.jsx(Rr,{open:_,onOpenChange:_t,children:a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:Q!==null?"编辑模型":"添加模型"}),a.jsx(Gr,{children:"配置模型的基本信息和参数"})]}),a.jsxs("div",{className:"grid gap-4 py-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"model_name",children:"模型名称 *"}),a.jsx(Me,{id:"model_name",value:E?.name||"",onChange:re=>z(Ae=>Ae?{...Ae,name:re.target.value}:null),placeholder:"例如: qwen3-30b"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"model_identifier",children:"模型标识符 *"}),a.jsx(Me,{id:"model_identifier",value:E?.model_identifier||"",onChange:re=>z(Ae=>Ae?{...Ae,model_identifier:re.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"API 提供商提供的模型 ID"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"api_provider",children:"API 提供商 *"}),a.jsxs(Lt,{value:E?.api_provider||"",onValueChange:re=>z(Ae=>Ae?{...Ae,api_provider:re}:null),children:[a.jsx(Dt,{id:"api_provider",children:a.jsx(It,{placeholder:"选择提供商"})}),a.jsx(Rt,{children:n.map(re=>a.jsx(Pe,{value:re,children:re},re))})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),a.jsx(Me,{id:"price_in",type:"number",step:"0.1",min:"0",value:E?.price_in??"",onChange:re=>{const Ae=re.target.value===""?null:parseFloat(re.target.value);z(pt=>pt?{...pt,price_in:Ae}:null)},placeholder:"默认: 0"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),a.jsx(Me,{id:"price_out",type:"number",step:"0.1",min:"0",value:E?.price_out??"",onChange:re=>{const Ae=re.target.value===""?null:parseFloat(re.target.value);z(pt=>pt?{...pt,price_out:Ae}:null)},placeholder:"默认: 0"})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"force_stream_mode",checked:E?.force_stream_mode||!1,onCheckedChange:re=>z(Ae=>Ae?{...Ae,force_stream_mode:re}:null)}),a.jsx(te,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>D(!1),children:"取消"}),a.jsx(ie,{onClick:nn,children:"保存"})]})]})}),a.jsx(pn,{open:L,onOpenChange:U,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除模型 "',V!==null?t[V]?.name:"",'" 吗? 此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:qn,children:"删除"})]})]})}),a.jsx(pn,{open:ne,onOpenChange:ue,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["确定要删除选中的 ",$.size," 个模型吗? 此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),T&&a.jsx(vw,{onRestartComplete:nt,onRestartFailed:ut})]})})}function Pi({title:t,description:e,taskConfig:n,modelNames:r,onChange:s,hideTemperature:i=!1,hideMaxTokens:l=!1}){const c=d=>{s("model_list",d)};return a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:t}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:e})]}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"模型列表"}),a.jsx(zte,{options:r.map(d=>({label:d,value:d})),selected:n.model_list||[],onChange:c,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!i&&a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"温度"}),a.jsx(Me,{type:"number",step:"0.1",min:"0",max:"1",value:n.temperature??.3,onChange:d=>{const h=parseFloat(d.target.value);!isNaN(h)&&h>=0&&h<=1&&s("temperature",h)},className:"w-20 h-8 text-sm"})]}),a.jsx(yx,{value:[n.temperature??.3],onValueChange:d=>s("temperature",d[0]),min:0,max:1,step:.1,className:"w-full"})]}),!l&&a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"最大 Token"}),a.jsx(Me,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:d=>s("max_tokens",parseInt(d.target.value))})]})]})]})]})}const Bx="/api/webui/config";async function Bte(){const e=await(await ot(`${Bx}/adapter-config/path`)).json();return!e.success||!e.path?null:{path:e.path,lastModified:e.lastModified}}async function Lte(t){const n=await(await ot(`${Bx}/adapter-config/path`,{method:"POST",headers:bt(),body:JSON.stringify({path:t})})).json();if(!n.success)throw new Error(n.message||"保存路径失败")}async function Ite(t){const n=await(await ot(`${Bx}/adapter-config?path=${encodeURIComponent(t)}`)).json();if(!n.success)throw new Error("读取配置文件失败");return n.content}async function c8(t,e){const r=await(await ot(`${Bx}/adapter-config`,{method:"POST",headers:bt(),body:JSON.stringify({path:t,content:e})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}const Zs={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}};function qte(){const[t,e]=S.useState("upload"),[n,r]=S.useState(null),[s,i]=S.useState(""),[l,c]=S.useState(""),[d,h]=S.useState(""),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,A]=S.useState(null),_=S.useRef(null),{toast:D}=Pr(),E=S.useRef(null),z=K=>{if(!K.trim())return{valid:!1,error:"路径不能为空"};const H=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,fe=/^(\/|~\/).+\.toml$/i,ve=H.test(K),Re=fe.test(K);return!ve&&!Re?{valid:!1,error:"路径格式错误。Windows: C:\\path\\file.toml,Linux: /path/file.toml"}:K.toLowerCase().endsWith(".toml")?/[<>"|?*\x00-\x1F]/.test(K)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}:{valid:!1,error:"文件必须是 .toml 格式"}},Q=K=>{if(c(K),K.trim()){const H=z(K);h(H.error)}else h("")};S.useEffect(()=>{(async()=>{try{const H=await Bte();H&&H.path&&(c(H.path),e("path"),await F(H.path))}catch(H){console.error("加载保存的路径失败:",H)}})()},[]);const F=async K=>{const H=z(K);if(!H.valid){h(H.error),D({title:"路径无效",description:H.error,variant:"destructive"});return}h(""),v(!0);try{const fe=await Ite(K),ve=ue(fe);r(ve),c(K),await Lte(K),D({title:"加载成功",description:"已从配置文件加载"})}catch(fe){console.error("加载配置失败:",fe),D({title:"加载失败",description:fe instanceof Error?fe.message:"无法读取配置文件",variant:"destructive"})}finally{v(!1)}},L=S.useCallback(K=>{t!=="path"||!l||(E.current&&clearTimeout(E.current),E.current=setTimeout(async()=>{p(!0);try{const H=R(K);await c8(l,H),D({title:"自动保存成功",description:"配置已保存到文件"})}catch(H){console.error("自动保存失败:",H),D({title:"自动保存失败",description:H instanceof Error?H.message:"保存配置失败",variant:"destructive"})}finally{p(!1)}},1e3))},[t,l,D]),U=async()=>{if(!n||!l)return;const K=z(l);if(!K.valid){D({title:"保存失败",description:K.error,variant:"destructive"});return}p(!0);try{const H=R(n);await c8(l,H),D({title:"保存成功",description:"配置已保存到文件"})}catch(H){console.error("保存失败:",H),D({title:"保存失败",description:H instanceof Error?H.message:"保存配置失败",variant:"destructive"})}finally{p(!1)}},V=async()=>{l&&await F(l)},ce=K=>{if(K!==t){if(n){A(K),k(!0);return}W(K)}},W=K=>{r(null),i(""),h(""),e(K),D({title:"已切换模式",description:K==="upload"?"现在可以上传配置文件":"现在可以指定配置文件路径"})},J=()=>{T&&(W(T),A(null)),k(!1)},$=()=>{if(n){j(!0);return}ae()},ae=()=>{c(""),r(null),h(""),D({title:"已清空",description:"路径和配置已清空"})},ne=()=>{ae(),j(!1)},ue=K=>{const H=JSON.parse(JSON.stringify(Zs)),fe=K.split(` +`);let ve="";for(const Re of fe){const de=Re.trim();if(!de||de.startsWith("#"))continue;const We=de.match(/^\[(\w+)\]$/);if(We){ve=We[1];continue}const ct=de.match(/^(\w+)\s*=\s*(.+)$/);if(ct&&ve){const[,Oe,nt]=ct,ut=nt.trim();let Ct;if(ut==="true")Ct=!0;else if(ut==="false")Ct=!1;else if(ut.startsWith("[")&&ut.endsWith("]")){const In=ut.slice(1,-1).trim();if(In){const Tn=In.split(",").map(nn=>{const _t=nn.trim();return isNaN(Number(_t))?_t.replace(/"/g,""):Number(_t)}),Jn=typeof Tn[0];Ct=Tn.every(nn=>typeof nn===Jn)?Tn:Tn.filter(nn=>typeof nn=="number")}else Ct=[]}else ut.startsWith('"')&&ut.endsWith('"')?Ct=ut.slice(1,-1):isNaN(Number(ut))?Ct=ut.replace(/"/g,""):Ct=Number(ut);if(ve in H){const In=H[ve];In[Oe]=Ct}}}return H},R=K=>{const H=[],fe=(ve,Re)=>ve===""||ve===null||ve===void 0?Re:ve;return H.push("[inner]"),H.push(`version = "${fe(K.inner.version,Zs.inner.version)}" # 版本号`),H.push("# 请勿修改版本号,除非你知道自己在做什么"),H.push(""),H.push("[nickname] # 现在没用"),H.push(`nickname = "${fe(K.nickname.nickname,Zs.nickname.nickname)}"`),H.push(""),H.push("[napcat_server] # Napcat连接的ws服务设置"),H.push(`host = "${fe(K.napcat_server.host,Zs.napcat_server.host)}" # Napcat设定的主机地址`),H.push(`port = ${fe(K.napcat_server.port||0,Zs.napcat_server.port)} # Napcat设定的端口`),H.push(`token = "${fe(K.napcat_server.token,Zs.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),H.push(`heartbeat_interval = ${fe(K.napcat_server.heartbeat_interval||0,Zs.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),H.push(""),H.push("[maibot_server] # 连接麦麦的ws服务设置"),H.push(`host = "${fe(K.maibot_server.host,Zs.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),H.push(`port = ${fe(K.maibot_server.port||0,Zs.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),H.push(""),H.push("[chat] # 黑白名单功能"),H.push(`group_list_type = "${fe(K.chat.group_list_type,Zs.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),H.push(`group_list = [${K.chat.group_list.join(", ")}] # 群组名单`),H.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),H.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),H.push(`private_list_type = "${fe(K.chat.private_list_type,Zs.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),H.push(`private_list = [${K.chat.private_list.join(", ")}] # 私聊名单`),H.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),H.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),H.push(`ban_user_id = [${K.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),H.push(`ban_qq_bot = ${K.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),H.push(`enable_poke = ${K.chat.enable_poke} # 是否启用戳一戳功能`),H.push(""),H.push("[voice] # 发送语音设置"),H.push(`use_tts = ${K.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),H.push(""),H.push("[debug]"),H.push(`level = "${fe(K.debug.level,Zs.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),H.join(` +`)},me=K=>{const H=K.target.files?.[0];if(!H)return;const fe=new FileReader;fe.onload=ve=>{try{const Re=ve.target?.result,de=ue(Re);r(de),i(H.name),D({title:"上传成功",description:`已加载配置文件:${H.name}`})}catch(Re){console.error("解析配置文件失败:",Re),D({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},fe.readAsText(H)},Y=()=>{if(!n)return;const K=R(n),H=new Blob([K],{type:"text/plain;charset=utf-8"}),fe=URL.createObjectURL(H),ve=document.createElement("a");ve.href=fe,ve.download=s||"config.toml",document.body.appendChild(ve),ve.click(),document.body.removeChild(ve),URL.revokeObjectURL(fe),D({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},P=()=>{r(JSON.parse(JSON.stringify(Zs))),i("config.toml"),D({title:"已加载默认配置",description:"可以开始编辑配置"})};return a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"工作模式"}),a.jsx(Sr,{children:"选择配置文件的管理方式"})]}),a.jsxs(an,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 md:gap-4",children:[a.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>ce("upload"),children:a.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[a.jsx(oO,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),a.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>ce("path"),children:a.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[a.jsx(kq,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),t==="path"&&a.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs("div",{className:"flex-1 space-y-1",children:[a.jsx(Me,{id:"config-path",value:l,onChange:K=>Q(K.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${d?"border-destructive":""}`}),d&&a.jsx("p",{className:"text-xs text-destructive",children:d})]}),a.jsx(ie,{onClick:()=>F(l),disabled:x||!l||!!d,className:"w-full sm:w-auto",children:x?a.jsxs(a.Fragment,{children:[a.jsx(Fi,{className:"h-4 w-4 animate-spin mr-2"}),a.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"sm:hidden",children:"加载配置"}),a.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),a.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[a.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[a.jsx("span",{children:"路径格式说明"}),a.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),a.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[a.jsx("div",{children:"C:\\Adapter\\config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),a.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[a.jsx("div",{children:"/opt/adapter/config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),a.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsx(od,{children:t==="upload"?a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",m&&" (正在保存...)"]})})]}),t==="upload"&&!n&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[a.jsx("input",{ref:_,type:"file",accept:".toml",className:"hidden",onChange:me}),a.jsxs(ie,{onClick:()=>_.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(oO,{className:"mr-2 h-4 w-4"}),"上传配置"]}),a.jsxs(ie,{onClick:P,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),t==="upload"&&n&&a.jsx("div",{className:"flex gap-2",children:a.jsxs(ie,{onClick:Y,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(fc,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),t==="path"&&n&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs(ie,{onClick:U,size:"sm",disabled:m||!!d,className:"w-full sm:w-auto",children:[a.jsx(lx,{className:"mr-2 h-4 w-4"}),m?"保存中...":"立即保存"]}),a.jsxs(ie,{onClick:V,size:"sm",variant:"outline",disabled:x,className:"w-full sm:w-auto",children:[a.jsx(Fi,{className:`mr-2 h-4 w-4 ${x?"animate-spin":""}`}),"刷新"]}),a.jsxs(ie,{onClick:$,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),n?a.jsxs(hl,{defaultValue:"napcat",className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:a.jsxs(ya,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[a.jsxs($t,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),a.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),a.jsxs($t,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),a.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),a.jsxs($t,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),a.jsx("span",{className:"sm:hidden",children:"聊天"})]}),a.jsxs($t,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),a.jsx("span",{className:"sm:hidden",children:"语音"})]}),a.jsx($t,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),a.jsx(kn,{value:"napcat",className:"space-y-4",children:a.jsx(Fte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"maibot",className:"space-y-4",children:a.jsx(Qte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"chat",className:"space-y-4",children:a.jsx($te,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"voice",className:"space-y-4",children:a.jsx(Hte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"debug",className:"space-y-4",children:a.jsx(Ute,{config:n,onChange:K=>{r(K),L(K)}})})]}):a.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:a.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[a.jsx(ao,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:t==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),a.jsx(pn,{open:b,onOpenChange:k,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认切换模式"}),a.jsxs(dn,{children:["切换模式将清空当前配置,确定要继续吗?",a.jsx("br",{}),a.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),a.jsxs(cn,{children:[a.jsx(fn,{onClick:()=>{k(!1),A(null)},children:"取消"}),a.jsx(hn,{onClick:J,children:"确认切换"})]})]})}),a.jsx(pn,{open:O,onOpenChange:j,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认清空路径"}),a.jsxs(dn,{children:["清空路径将清除当前配置,确定要继续吗?",a.jsx("br",{}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),a.jsxs(cn,{children:[a.jsx(fn,{onClick:()=>j(!1),children:"取消"}),a.jsx(hn,{onClick:ne,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function Fte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),a.jsxs("div",{className:"grid gap-3 md:gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),a.jsx(Me,{id:"napcat-host",value:t.napcat_server.host,onChange:n=>e({...t,napcat_server:{...t.napcat_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),a.jsx(Me,{id:"napcat-port",type:"number",value:t.napcat_server.port||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),a.jsx(Me,{id:"napcat-token",type:"password",value:t.napcat_server.token,onChange:n=>e({...t,napcat_server:{...t.napcat_server,token:n.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),a.jsx(Me,{id:"napcat-heartbeat",type:"number",value:t.napcat_server.heartbeat_interval||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,heartbeat_interval:n.target.value?parseInt(n.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function Qte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),a.jsxs("div",{className:"grid gap-3 md:gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),a.jsx(Me,{id:"maibot-host",value:t.maibot_server.host,onChange:n=>e({...t,maibot_server:{...t.maibot_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),a.jsx(Me,{id:"maibot-port",type:"number",value:t.maibot_server.port||"",onChange:n=>e({...t,maibot_server:{...t.maibot_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function $te({config:t,onChange:e}){const n=i=>{const l={...t};i==="group"?l.chat.group_list=[...l.chat.group_list,0]:i==="private"?l.chat.private_list=[...l.chat.private_list,0]:l.chat.ban_user_id=[...l.chat.ban_user_id,0],e(l)},r=(i,l)=>{const c={...t};i==="group"?c.chat.group_list=c.chat.group_list.filter((d,h)=>h!==l):i==="private"?c.chat.private_list=c.chat.private_list.filter((d,h)=>h!==l):c.chat.ban_user_id=c.chat.ban_user_id.filter((d,h)=>h!==l),e(c)},s=(i,l,c)=>{const d={...t};i==="group"?d.chat.group_list[l]=c:i==="private"?d.chat.private_list[l]=c:d.chat.ban_user_id[l]=c,e(d)};return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),a.jsxs("div",{className:"grid gap-4 md:gap-6",children:[a.jsxs("div",{className:"space-y-3 md:space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"群组名单类型"}),a.jsxs(Lt,{value:t.chat.group_list_type,onValueChange:i=>e({...t,chat:{...t.chat,group_list_type:i}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),a.jsx(Pe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsx(te,{className:"text-sm md:text-base",children:"群组列表"}),a.jsxs(ie,{onClick:()=>n("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),t.chat.group_list.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{type:"number",value:i,onChange:c=>s("group",l,parseInt(c.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除群号 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r("group",l),children:"删除"})]})]})]})]},l)),t.chat.group_list.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),a.jsxs("div",{className:"space-y-3 md:space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"私聊名单类型"}),a.jsxs(Lt,{value:t.chat.private_list_type,onValueChange:i=>e({...t,chat:{...t.chat,private_list_type:i}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),a.jsx(Pe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsx(te,{className:"text-sm md:text-base",children:"私聊列表"}),a.jsxs(ie,{onClick:()=>n("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.private_list.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{type:"number",value:i,onChange:c=>s("private",l,parseInt(c.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除用户 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r("private",l),children:"删除"})]})]})]})]},l)),t.chat.private_list.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"全局禁止名单"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),a.jsxs(ie,{onClick:()=>n("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.ban_user_id.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{type:"number",value:i,onChange:c=>s("ban",l,parseInt(c.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要从全局禁止名单中删除用户 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r("ban",l),children:"删除"})]})]})]})]},l)),t.chat.ban_user_id.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),a.jsx(jt,{checked:t.chat.ban_qq_bot,onCheckedChange:i=>e({...t,chat:{...t.chat,ban_qq_bot:i}})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),a.jsx(jt,{checked:t.chat.enable_poke,onCheckedChange:i=>e({...t,chat:{...t.chat,enable_poke:i}})})]})]})]})})}function Hte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),a.jsx(jt,{checked:t.voice.use_tts,onCheckedChange:n=>e({...t,voice:{use_tts:n}})})]})]})})}function Ute({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),a.jsx("div",{className:"grid gap-3 md:gap-4",children:a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"日志等级"}),a.jsxs(Lt,{value:t.debug.level,onValueChange:n=>e({...t,debug:{level:n}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"DEBUG",children:"DEBUG(调试)"}),a.jsx(Pe,{value:"INFO",children:"INFO(信息)"}),a.jsx(Pe,{value:"WARNING",children:"WARNING(警告)"}),a.jsx(Pe,{value:"ERROR",children:"ERROR(错误)"}),a.jsx(Pe,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function u8(t){const e=[],n=String(t||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const l=n.slice(s,r).trim();(l||!i)&&e.push(l),s=r+1,r=n.indexOf(",",s)}return e}function Vte(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Wte=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Gte=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xte={};function d8(t,e){return(Xte.jsx?Gte:Wte).test(t)}const Yte=/[ \t\n\f\r]/g;function Kte(t){return typeof t=="object"?t.type==="text"?h8(t.value):!1:h8(t)}function h8(t){return t.replace(Yte,"")===""}class x0{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}x0.prototype.normal={};x0.prototype.property={};x0.prototype.space=void 0;function Z_(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new x0(n,r,e)}function Pf(t){return t.toLowerCase()}class qs{constructor(e,n){this.attribute=n,this.property=e}}qs.prototype.attribute="";qs.prototype.booleanish=!1;qs.prototype.boolean=!1;qs.prototype.commaOrSpaceSeparated=!1;qs.prototype.commaSeparated=!1;qs.prototype.defined=!1;qs.prototype.mustUseProperty=!1;qs.prototype.number=!1;qs.prototype.overloadedBoolean=!1;qs.prototype.property="";qs.prototype.spaceSeparated=!1;qs.prototype.space=void 0;let Zte=0;const Ot=Dc(),mr=Dc(),h4=Dc(),ze=Dc(),Bn=Dc(),Ju=Dc(),Js=Dc();function Dc(){return 2**++Zte}const f4=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ot,booleanish:mr,commaOrSpaceSeparated:Js,commaSeparated:Ju,number:ze,overloadedBoolean:h4,spaceSeparated:Bn},Symbol.toStringTag,{value:"Module"})),hb=Object.keys(f4);class c5 extends qs{constructor(e,n,r,s){let i=-1;if(super(e,n),f8(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&rne.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(m8,ine);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!m8.test(i)){let l=i.replace(nne,sne);l.charAt(0)!=="-"&&(l="-"+l),e="data"+l}}s=c5}return new s(r,e)}function sne(t){return"-"+t.toLowerCase()}function ine(t){return t.charAt(1).toUpperCase()}const aD=Z_([J_,Jte,nD,rD,sD],"html"),Lx=Z_([J_,ene,nD,rD,sD],"svg");function p8(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function ane(t){return t.join(" ").trim()}var Nu={},fb,g8;function lne(){if(g8)return fb;g8=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,d=` +`,h="/",m="*",p="",x="comment",v="declaration";function b(O,j){if(typeof O!="string")throw new TypeError("First argument must be a string");if(!O)return[];j=j||{};var T=1,A=1;function _(W){var J=W.match(e);J&&(T+=J.length);var $=W.lastIndexOf(d);A=~$?W.length-$:A+W.length}function D(){var W={line:T,column:A};return function(J){return J.position=new E(W),F(),J}}function E(W){this.start=W,this.end={line:T,column:A},this.source=j.source}E.prototype.content=O;function z(W){var J=new Error(j.source+":"+T+":"+A+": "+W);if(J.reason=W,J.filename=j.source,J.line=T,J.column=A,J.source=O,!j.silent)throw J}function Q(W){var J=W.exec(O);if(J){var $=J[0];return _($),O=O.slice($.length),J}}function F(){Q(n)}function L(W){var J;for(W=W||[];J=U();)J!==!1&&W.push(J);return W}function U(){var W=D();if(!(h!=O.charAt(0)||m!=O.charAt(1))){for(var J=2;p!=O.charAt(J)&&(m!=O.charAt(J)||h!=O.charAt(J+1));)++J;if(J+=2,p===O.charAt(J-1))return z("End of comment missing");var $=O.slice(2,J-2);return A+=2,_($),O=O.slice(J),A+=2,W({type:x,comment:$})}}function V(){var W=D(),J=Q(r);if(J){if(U(),!Q(s))return z("property missing ':'");var $=Q(i),ae=W({type:v,property:k(J[0].replace(t,p)),value:$?k($[0].replace(t,p)):p});return Q(l),ae}}function ce(){var W=[];L(W);for(var J;J=V();)J!==!1&&(W.push(J),L(W));return W}return F(),ce()}function k(O){return O?O.replace(c,p):p}return fb=b,fb}var x8;function one(){if(x8)return Nu;x8=1;var t=Nu&&Nu.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Nu,"__esModule",{value:!0}),Nu.default=n;const e=t(lne());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const l=(0,e.default)(r),c=typeof s=="function";return l.forEach(d=>{if(d.type!=="declaration")return;const{property:h,value:m}=d;c?s(h,m,d):m&&(i=i||{},i[h]=m)}),i}return Nu}var Lh={},v8;function cne(){if(v8)return Lh;v8=1,Object.defineProperty(Lh,"__esModule",{value:!0}),Lh.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(h){return!h||n.test(h)||t.test(h)},l=function(h,m){return m.toUpperCase()},c=function(h,m){return"".concat(m,"-")},d=function(h,m){return m===void 0&&(m={}),i(h)?h:(h=h.toLowerCase(),m.reactCompat?h=h.replace(s,c):h=h.replace(r,c),h.replace(e,l))};return Lh.camelCase=d,Lh}var Ih,y8;function une(){if(y8)return Ih;y8=1;var t=Ih&&Ih.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(one()),n=cne();function r(s,i){var l={};return!s||typeof s!="string"||(0,e.default)(s,function(c,d){c&&d&&(l[(0,n.camelCase)(c,i)]=d)}),l}return r.default=r,Ih=r,Ih}var dne=une();const hne=u9(dne),lD=oD("end"),u5=oD("start");function oD(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function fne(t){const e=u5(t),n=lD(t);if(e&&n)return{start:e,end:n}}function af(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?b8(t.position):"start"in t||"end"in t?b8(t):"line"in t||"column"in t?m4(t):""}function m4(t){return w8(t&&t.line)+":"+w8(t&&t.column)}function b8(t){return m4(t&&t.start)+"-"+m4(t&&t.end)}function w8(t){return t&&typeof t=="number"?t:1}class as extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},l=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?s=e:!i.cause&&e&&(l=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?i.ruleId=r:(i.source=r.slice(0,d),i.ruleId=r.slice(d+1))}if(!i.place&&i.ancestors&&i.ancestors){const d=i.ancestors[i.ancestors.length-1];d&&(i.place=d.position)}const c=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=c?c.line:void 0,this.name=af(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=l&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}as.prototype.file="";as.prototype.name="";as.prototype.reason="";as.prototype.message="";as.prototype.stack="";as.prototype.column=void 0;as.prototype.line=void 0;as.prototype.ancestors=void 0;as.prototype.cause=void 0;as.prototype.fatal=void 0;as.prototype.place=void 0;as.prototype.ruleId=void 0;as.prototype.source=void 0;const d5={}.hasOwnProperty,mne=new Map,pne=/[A-Z]/g,gne=new Set(["table","tbody","thead","tfoot","tr"]),xne=new Set(["td","th"]),cD="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function vne(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Nne(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=jne(n,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?Lx:aD,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=uD(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function uD(t,e,n){if(e.type==="element")return yne(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return bne(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return Sne(t,e,n);if(e.type==="mdxjsEsm")return wne(t,e);if(e.type==="root")return kne(t,e,n);if(e.type==="text")return One(t,e)}function yne(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Lx,t.schema=s),t.ancestors.push(e);const i=hD(t,e.tagName,!1),l=Cne(t,e);let c=f5(t,e);return gne.has(e.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!Kte(d):!0})),dD(t,l,i,e),h5(l,c),t.ancestors.pop(),t.schema=r,t.create(e,i,l,n)}function bne(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}Bf(t,e.position)}function wne(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Bf(t,e.position)}function Sne(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=Lx,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:hD(t,e.name,!0),l=Tne(t,e),c=f5(t,e);return dD(t,l,i,e),h5(l,c),t.ancestors.pop(),t.schema=r,t.create(e,i,l,n)}function kne(t,e,n){const r={};return h5(r,f5(t,e)),t.create(e,t.Fragment,r,n)}function One(t,e){return e.value}function dD(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function h5(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function jne(t,e,n){return r;function r(s,i,l,c){const h=Array.isArray(l.children)?n:e;return c?h(i,l,c):h(i,l)}}function Nne(t,e){return n;function n(r,s,i,l){const c=Array.isArray(i.children),d=u5(r);return e(s,i,l,c,{columnNumber:d?d.column-1:void 0,fileName:t,lineNumber:d?d.line:void 0},void 0)}}function Cne(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&d5.call(e.properties,s)){const i=Ane(t,s,e.properties[s]);if(i){const[l,c]=i;t.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&xne.has(e.tagName)?r=c:n[l]=c}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Tne(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const l=i.expression;l.type;const c=l.properties[0];c.type,Object.assign(n,t.evaluater.evaluateExpression(c.argument))}else Bf(t,e.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const c=r.value.data.estree.body[0];c.type,i=t.evaluater.evaluateExpression(c.expression)}else Bf(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function f5(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:mne;for(;++rs?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(e,n),t.splice(...l);else for(n&&t.splice(e,n);i0?(si(t,t.length,0,e),t):e}const O8={}.hasOwnProperty;function mD(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Qi(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ds=Ao(/[A-Za-z]/),rs=Ao(/[\dA-Za-z]/),Lne=Ao(/[#-'*+\--9=?A-Z^-~]/);function Hg(t){return t!==null&&(t<32||t===127)}const p4=Ao(/\d/),Ine=Ao(/[\dA-Fa-f]/),qne=Ao(/[!-/:-@[-`{-~]/);function Ze(t){return t!==null&&t<-2}function Rn(t){return t!==null&&(t<0||t===32)}function qt(t){return t===-2||t===-1||t===32}const Ix=Ao(new RegExp("\\p{P}|\\p{S}","u")),Cc=Ao(/\s/);function Ao(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Dd(t){const e=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const c=t.charCodeAt(n+1);i<56320&&c>56319&&c<57344?(l=String.fromCharCode(i,c),s=1):l="�"}else l=String.fromCharCode(i);l&&(e.push(t.slice(r,n),encodeURIComponent(l)),r=n+s+1,l=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function zt(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return l;function l(d){return qt(d)?(t.enter(n),c(d)):e(d)}function c(d){return qt(d)&&i++l))return;const z=e.events.length;let Q=z,F,L;for(;Q--;)if(e.events[Q][0]==="exit"&&e.events[Q][1].type==="chunkFlow"){if(F){L=e.events[Q][1].end;break}F=!0}for(j(r),E=z;EA;){const D=n[_];e.containerState=D[1],D[0].exit.call(e,t)}n.length=A}function T(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function Une(t,e,n){return zt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function vd(t){if(t===null||Rn(t)||Cc(t))return 1;if(Ix(t))return 2}function qx(t,e,n){const r=[];let s=-1;for(;++s1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const p={...t[r][1].end},x={...t[n][1].start};N8(p,-d),N8(x,d),l={type:d>1?"strongSequence":"emphasisSequence",start:p,end:{...t[r][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:x},i={type:d>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:d>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},t[r][1].end={...l.start},t[n][1].start={...c.end},h=[],t[r][1].end.offset-t[r][1].start.offset&&(h=bi(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=bi(h,[["enter",s,e],["enter",l,e],["exit",l,e],["enter",i,e]]),h=bi(h,qx(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=bi(h,[["exit",i,e],["enter",c,e],["exit",c,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(m=2,h=bi(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):m=0,si(t,r-1,n-r+3,h),n=r+h.length-m-2;break}}for(n=-1;++n0&&qt(E)?zt(t,T,"linePrefix",i+1)(E):T(E)}function T(E){return E===null||Ze(E)?t.check(C8,k,_)(E):(t.enter("codeFlowValue"),A(E))}function A(E){return E===null||Ze(E)?(t.exit("codeFlowValue"),T(E)):(t.consume(E),A)}function _(E){return t.exit("codeFenced"),e(E)}function D(E,z,Q){let F=0;return L;function L(J){return E.enter("lineEnding"),E.consume(J),E.exit("lineEnding"),U}function U(J){return E.enter("codeFencedFence"),qt(J)?zt(E,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(J):V(J)}function V(J){return J===c?(E.enter("codeFencedFenceSequence"),ce(J)):Q(J)}function ce(J){return J===c?(F++,E.consume(J),ce):F>=l?(E.exit("codeFencedFenceSequence"),qt(J)?zt(E,W,"whitespace")(J):W(J)):Q(J)}function W(J){return J===null||Ze(J)?(E.exit("codeFencedFence"),z(J)):Q(J)}}}function rre(t,e,n){const r=this;return s;function s(l){return l===null?n(l):(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i)}function i(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}const pb={name:"codeIndented",tokenize:ire},sre={partial:!0,tokenize:are};function ire(t,e,n){const r=this;return s;function s(h){return t.enter("codeIndented"),zt(t,i,"linePrefix",5)(h)}function i(h){const m=r.events[r.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(h):n(h)}function l(h){return h===null?d(h):Ze(h)?t.attempt(sre,l,d)(h):(t.enter("codeFlowValue"),c(h))}function c(h){return h===null||Ze(h)?(t.exit("codeFlowValue"),l(h)):(t.consume(h),c)}function d(h){return t.exit("codeIndented"),e(h)}}function are(t,e,n){const r=this;return s;function s(l){return r.parser.lazy[r.now().line]?n(l):Ze(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),s):zt(t,i,"linePrefix",5)(l)}function i(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(l):Ze(l)?s(l):n(l)}}const lre={name:"codeText",previous:cre,resolve:ore,tokenize:ure};function ore(t){let e=t.length-4,n=3,r,s;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&qh(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),qh(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),qh(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(l):t.interrupt(r.parser.constructs.flow,n,e)(l)}}function bD(t,e,n,r,s,i,l,c,d){const h=d||Number.POSITIVE_INFINITY;let m=0;return p;function p(j){return j===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(j),t.exit(i),x):j===null||j===32||j===41||Hg(j)?n(j):(t.enter(r),t.enter(l),t.enter(c),t.enter("chunkString",{contentType:"string"}),k(j))}function x(j){return j===62?(t.enter(i),t.consume(j),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(c),t.enter("chunkString",{contentType:"string"}),v(j))}function v(j){return j===62?(t.exit("chunkString"),t.exit(c),x(j)):j===null||j===60||Ze(j)?n(j):(t.consume(j),j===92?b:v)}function b(j){return j===60||j===62||j===92?(t.consume(j),v):v(j)}function k(j){return!m&&(j===null||j===41||Rn(j))?(t.exit("chunkString"),t.exit(c),t.exit(l),t.exit(r),e(j)):m999||v===null||v===91||v===93&&!d||v===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(v):v===93?(t.exit(i),t.enter(s),t.consume(v),t.exit(s),t.exit(r),e):Ze(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),m):(t.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===null||v===91||v===93||Ze(v)||c++>999?(t.exit("chunkString"),m(v)):(t.consume(v),d||(d=!qt(v)),v===92?x:p)}function x(v){return v===91||v===92||v===93?(t.consume(v),c++,p):p(v)}}function SD(t,e,n,r,s,i){let l;return c;function c(x){return x===34||x===39||x===40?(t.enter(r),t.enter(s),t.consume(x),t.exit(s),l=x===40?41:x,d):n(x)}function d(x){return x===l?(t.enter(s),t.consume(x),t.exit(s),t.exit(r),e):(t.enter(i),h(x))}function h(x){return x===l?(t.exit(i),d(l)):x===null?n(x):Ze(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),zt(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===l||x===null||Ze(x)?(t.exit("chunkString"),h(x)):(t.consume(x),x===92?p:m)}function p(x){return x===l||x===92?(t.consume(x),m):m(x)}}function lf(t,e){let n;return r;function r(s){return Ze(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):qt(s)?zt(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const vre={name:"definition",tokenize:bre},yre={partial:!0,tokenize:wre};function bre(t,e,n){const r=this;let s;return i;function i(v){return t.enter("definition"),l(v)}function l(v){return wD.call(r,t,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function c(v){return s=Qi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),d):n(v)}function d(v){return Rn(v)?lf(t,h)(v):h(v)}function h(v){return bD(t,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function m(v){return t.attempt(yre,p,p)(v)}function p(v){return qt(v)?zt(t,x,"whitespace")(v):x(v)}function x(v){return v===null||Ze(v)?(t.exit("definition"),r.parser.defined.push(s),e(v)):n(v)}}function wre(t,e,n){return r;function r(c){return Rn(c)?lf(t,s)(c):n(c)}function s(c){return SD(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function i(c){return qt(c)?zt(t,l,"whitespace")(c):l(c)}function l(c){return c===null||Ze(c)?e(c):n(c)}}const Sre={name:"hardBreakEscape",tokenize:kre};function kre(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return Ze(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const Ore={name:"headingAtx",resolve:jre,tokenize:Nre};function jre(t,e){let n=t.length-2,r=3,s,i;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},si(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function Nre(t,e,n){let r=0;return s;function s(m){return t.enter("atxHeading"),i(m)}function i(m){return t.enter("atxHeadingSequence"),l(m)}function l(m){return m===35&&r++<6?(t.consume(m),l):m===null||Rn(m)?(t.exit("atxHeadingSequence"),c(m)):n(m)}function c(m){return m===35?(t.enter("atxHeadingSequence"),d(m)):m===null||Ze(m)?(t.exit("atxHeading"),e(m)):qt(m)?zt(t,c,"whitespace")(m):(t.enter("atxHeadingText"),h(m))}function d(m){return m===35?(t.consume(m),d):(t.exit("atxHeadingSequence"),c(m))}function h(m){return m===null||m===35||Rn(m)?(t.exit("atxHeadingText"),c(m)):(t.consume(m),h)}}const Cre=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],A8=["pre","script","style","textarea"],Tre={concrete:!0,name:"htmlFlow",resolveTo:Ere,tokenize:_re},Are={partial:!0,tokenize:Rre},Mre={partial:!0,tokenize:Dre};function Ere(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function _re(t,e,n){const r=this;let s,i,l,c,d;return h;function h(P){return m(P)}function m(P){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(P),p}function p(P){return P===33?(t.consume(P),x):P===47?(t.consume(P),i=!0,k):P===63?(t.consume(P),s=3,r.interrupt?e:R):ds(P)?(t.consume(P),l=String.fromCharCode(P),O):n(P)}function x(P){return P===45?(t.consume(P),s=2,v):P===91?(t.consume(P),s=5,c=0,b):ds(P)?(t.consume(P),s=4,r.interrupt?e:R):n(P)}function v(P){return P===45?(t.consume(P),r.interrupt?e:R):n(P)}function b(P){const K="CDATA[";return P===K.charCodeAt(c++)?(t.consume(P),c===K.length?r.interrupt?e:V:b):n(P)}function k(P){return ds(P)?(t.consume(P),l=String.fromCharCode(P),O):n(P)}function O(P){if(P===null||P===47||P===62||Rn(P)){const K=P===47,H=l.toLowerCase();return!K&&!i&&A8.includes(H)?(s=1,r.interrupt?e(P):V(P)):Cre.includes(l.toLowerCase())?(s=6,K?(t.consume(P),j):r.interrupt?e(P):V(P)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):i?T(P):A(P))}return P===45||rs(P)?(t.consume(P),l+=String.fromCharCode(P),O):n(P)}function j(P){return P===62?(t.consume(P),r.interrupt?e:V):n(P)}function T(P){return qt(P)?(t.consume(P),T):L(P)}function A(P){return P===47?(t.consume(P),L):P===58||P===95||ds(P)?(t.consume(P),_):qt(P)?(t.consume(P),A):L(P)}function _(P){return P===45||P===46||P===58||P===95||rs(P)?(t.consume(P),_):D(P)}function D(P){return P===61?(t.consume(P),E):qt(P)?(t.consume(P),D):A(P)}function E(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(t.consume(P),d=P,z):qt(P)?(t.consume(P),E):Q(P)}function z(P){return P===d?(t.consume(P),d=null,F):P===null||Ze(P)?n(P):(t.consume(P),z)}function Q(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||Rn(P)?D(P):(t.consume(P),Q)}function F(P){return P===47||P===62||qt(P)?A(P):n(P)}function L(P){return P===62?(t.consume(P),U):n(P)}function U(P){return P===null||Ze(P)?V(P):qt(P)?(t.consume(P),U):n(P)}function V(P){return P===45&&s===2?(t.consume(P),$):P===60&&s===1?(t.consume(P),ae):P===62&&s===4?(t.consume(P),me):P===63&&s===3?(t.consume(P),R):P===93&&s===5?(t.consume(P),ue):Ze(P)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(Are,Y,ce)(P)):P===null||Ze(P)?(t.exit("htmlFlowData"),ce(P)):(t.consume(P),V)}function ce(P){return t.check(Mre,W,Y)(P)}function W(P){return t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),J}function J(P){return P===null||Ze(P)?ce(P):(t.enter("htmlFlowData"),V(P))}function $(P){return P===45?(t.consume(P),R):V(P)}function ae(P){return P===47?(t.consume(P),l="",ne):V(P)}function ne(P){if(P===62){const K=l.toLowerCase();return A8.includes(K)?(t.consume(P),me):V(P)}return ds(P)&&l.length<8?(t.consume(P),l+=String.fromCharCode(P),ne):V(P)}function ue(P){return P===93?(t.consume(P),R):V(P)}function R(P){return P===62?(t.consume(P),me):P===45&&s===2?(t.consume(P),R):V(P)}function me(P){return P===null||Ze(P)?(t.exit("htmlFlowData"),Y(P)):(t.consume(P),me)}function Y(P){return t.exit("htmlFlow"),e(P)}}function Dre(t,e,n){const r=this;return s;function s(l){return Ze(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i):n(l)}function i(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}function Rre(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(v0,e,n)}}const zre={name:"htmlText",tokenize:Pre};function Pre(t,e,n){const r=this;let s,i,l;return c;function c(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),d}function d(R){return R===33?(t.consume(R),h):R===47?(t.consume(R),D):R===63?(t.consume(R),A):ds(R)?(t.consume(R),Q):n(R)}function h(R){return R===45?(t.consume(R),m):R===91?(t.consume(R),i=0,b):ds(R)?(t.consume(R),T):n(R)}function m(R){return R===45?(t.consume(R),v):n(R)}function p(R){return R===null?n(R):R===45?(t.consume(R),x):Ze(R)?(l=p,ae(R)):(t.consume(R),p)}function x(R){return R===45?(t.consume(R),v):p(R)}function v(R){return R===62?$(R):R===45?x(R):p(R)}function b(R){const me="CDATA[";return R===me.charCodeAt(i++)?(t.consume(R),i===me.length?k:b):n(R)}function k(R){return R===null?n(R):R===93?(t.consume(R),O):Ze(R)?(l=k,ae(R)):(t.consume(R),k)}function O(R){return R===93?(t.consume(R),j):k(R)}function j(R){return R===62?$(R):R===93?(t.consume(R),j):k(R)}function T(R){return R===null||R===62?$(R):Ze(R)?(l=T,ae(R)):(t.consume(R),T)}function A(R){return R===null?n(R):R===63?(t.consume(R),_):Ze(R)?(l=A,ae(R)):(t.consume(R),A)}function _(R){return R===62?$(R):A(R)}function D(R){return ds(R)?(t.consume(R),E):n(R)}function E(R){return R===45||rs(R)?(t.consume(R),E):z(R)}function z(R){return Ze(R)?(l=z,ae(R)):qt(R)?(t.consume(R),z):$(R)}function Q(R){return R===45||rs(R)?(t.consume(R),Q):R===47||R===62||Rn(R)?F(R):n(R)}function F(R){return R===47?(t.consume(R),$):R===58||R===95||ds(R)?(t.consume(R),L):Ze(R)?(l=F,ae(R)):qt(R)?(t.consume(R),F):$(R)}function L(R){return R===45||R===46||R===58||R===95||rs(R)?(t.consume(R),L):U(R)}function U(R){return R===61?(t.consume(R),V):Ze(R)?(l=U,ae(R)):qt(R)?(t.consume(R),U):F(R)}function V(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),s=R,ce):Ze(R)?(l=V,ae(R)):qt(R)?(t.consume(R),V):(t.consume(R),W)}function ce(R){return R===s?(t.consume(R),s=void 0,J):R===null?n(R):Ze(R)?(l=ce,ae(R)):(t.consume(R),ce)}function W(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Rn(R)?F(R):(t.consume(R),W)}function J(R){return R===47||R===62||Rn(R)?F(R):n(R)}function $(R){return R===62?(t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),e):n(R)}function ae(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),ne}function ne(R){return qt(R)?zt(t,ue,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):ue(R)}function ue(R){return t.enter("htmlTextData"),l(R)}}const g5={name:"labelEnd",resolveAll:qre,resolveTo:Fre,tokenize:Qre},Bre={tokenize:$re},Lre={tokenize:Hre},Ire={tokenize:Ure};function qre(t){let e=-1;const n=[];for(;++e=3&&(h===null||Ze(h))?(t.exit("thematicBreak"),e(h)):n(h)}function d(h){return h===s?(t.consume(h),r++,d):(t.exit("thematicBreakSequence"),qt(h)?zt(t,c,"whitespace")(h):c(h))}}const Ns={continuation:{tokenize:tse},exit:rse,name:"list",tokenize:ese},Zre={partial:!0,tokenize:sse},Jre={partial:!0,tokenize:nse};function ese(t,e,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,l=0;return c;function c(v){const b=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:p4(v)){if(r.containerState.type||(r.containerState.type=b,t.enter(b,{_container:!0})),b==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(og,n,h)(v):h(v);if(!r.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),d(v)}return n(v)}function d(v){return p4(v)&&++l<10?(t.consume(v),d):(!r.interrupt||l<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),h(v)):n(v)}function h(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,t.check(v0,r.interrupt?n:m,t.attempt(Zre,x,p))}function m(v){return r.containerState.initialBlankLine=!0,i++,x(v)}function p(v){return qt(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),x):n(v)}function x(v){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(v)}}function tse(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(v0,s,i);function s(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,zt(t,e,"listItemIndent",r.containerState.size+1)(c)}function i(c){return r.containerState.furtherBlankLines||!qt(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(Jre,e,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,zt(t,t.attempt(Ns,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function nse(t,e,n){const r=this;return zt(t,s,"listItemIndent",r.containerState.size+1);function s(i){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?e(i):n(i)}}function rse(t){t.exit(this.containerState.type)}function sse(t,e,n){const r=this;return zt(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const l=r.events[r.events.length-1];return!qt(i)&&l&&l[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const M8={name:"setextUnderline",resolveTo:ise,tokenize:ase};function ise(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const l={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",l,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=l,t.push(["exit",l,e]),t}function ase(t,e,n){const r=this;let s;return i;function i(h){let m=r.events.length,p;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){p=r.events[m][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(t.enter("setextHeadingLine"),s=h,l(h)):n(h)}function l(h){return t.enter("setextHeadingLineSequence"),c(h)}function c(h){return h===s?(t.consume(h),c):(t.exit("setextHeadingLineSequence"),qt(h)?zt(t,d,"lineSuffix")(h):d(h))}function d(h){return h===null||Ze(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const lse={tokenize:ose};function ose(t){const e=this,n=t.attempt(v0,r,t.attempt(this.parser.constructs.flowInitial,s,zt(t,t.attempt(this.parser.constructs.flow,s,t.attempt(fre,s)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const cse={resolveAll:OD()},use=kD("string"),dse=kD("text");function kD(t){return{resolveAll:OD(t==="text"?hse:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,l,c);return l;function l(m){return h(m)?i(m):c(m)}function c(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),d}function d(m){return h(m)?(n.exit("data"),i(m)):(n.consume(m),d)}function h(m){if(m===null)return!0;const p=s[m];let x=-1;if(p)for(;++x-1){const c=l[0];typeof c=="string"?l[0]=c.slice(r):l.shift()}i>0&&l.push(t[s].slice(0,i))}return l}function jse(t,e){let n=-1;const r=[];let s;for(;++n0){const cr=Be.tokenStack[Be.tokenStack.length-1];(cr[1]||_8).call(Be,void 0,cr[0])}for(Se.position={start:Xl(ee.length>0?ee[0][1].start:{line:1,column:1,offset:0}),end:Xl(ee.length>0?ee[ee.length-2][1].end:{line:1,column:1,offset:0})},Tt=-1;++Tt0){const cr=Be.tokenStack[Be.tokenStack.length-1];(cr[1]||_8).call(Be,void 0,cr[0])}for(Se.position={start:Xl(ee.length>0?ee[0][1].start:{line:1,column:1,offset:0}),end:Xl(ee.length>0?ee[ee.length-2][1].end:{line:1,column:1,offset:0})},Tt=-1;++Tt1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};t.patch(e,d);const h={type:"element",tagName:"sup",properties:{},children:[d]};return t.patch(e,h),t.applyData(e,h)}function Qse(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function $se(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function CD(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const l=s[s.length-1];return l&&l.type==="text"?l.value+=r:s.push({type:"text",value:r}),s}function Hse(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return CD(t,e);const s={src:Dd(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,i),t.applyData(e,i)}function Use(t,e){const n={src:Dd(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function Vse(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function Wse(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return CD(t,e);const s={href:Dd(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function Gse(t,e){const n={href:Dd(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Xse(t,e,n){const r=t.all(e),s=n?Yse(n):TD(e),i={},l=[];if(typeof e.checked=="boolean"){const m=r[0];let p;m&&m.type==="element"&&m.tagName==="p"?p=m:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let c=-1;for(;++c",...d.current()})),h+=d.move(">")):(c=n.enter("destinationRaw"),h+=d.move(n.safe(t.url,{before:h,after:t.title?" ":")",...d.current()}))),c(),t.title&&(c=n.enter(`title${i}`),h+=d.move(" "+s),h+=d.move(n.safe(t.title,{before:h,after:s,...d.current()})),h+=d.move(s),c()),h+=d.move(")"),l(),h}function tle(){return"!"}$D.peek=nle;function $D(t,e,n,r){const s=t.referenceType,i=n.enter("imageReference");let l=n.enter("label");const c=n.createTracker(r);let d=c.move("![");const h=n.safe(t.alt,{before:d,after:"]",...c.current()});d+=c.move(h+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(t),{before:d,after:"]",...c.current()});return l(),n.stack=m,i(),s==="full"||!h||h!==p?d+=c.move(p+"]"):s==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function nle(){return"!"}HD.peek=rle;function HD(t,e,n){let r=t.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i\u007F]/.test(t.url))}VD.peek=sle;function VD(t,e,n,r){const s=O5(n),i=s==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let c,d;if(UD(t,n)){const m=n.stack;n.stack=[],c=n.enter("autolink");let p=l.move("<");return p+=l.move(n.containerPhrasing(t,{before:p,after:">",...l.current()})),p+=l.move(">"),c(),n.stack=m,p}c=n.enter("link"),d=n.enter("label");let h=l.move("[");return h+=l.move(n.containerPhrasing(t,{before:h,after:"](",...l.current()})),h+=l.move("]("),d(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(d=n.enter("destinationLiteral"),h+=l.move("<"),h+=l.move(n.safe(t.url,{before:h,after:">",...l.current()})),h+=l.move(">")):(d=n.enter("destinationRaw"),h+=l.move(n.safe(t.url,{before:h,after:t.title?" ":")",...l.current()}))),d(),t.title&&(d=n.enter(`title${i}`),h+=l.move(" "+s),h+=l.move(n.safe(t.title,{before:h,after:s,...l.current()})),h+=l.move(s),d()),h+=l.move(")"),c(),h}function sle(t,e,n){return UD(t,n)?"<":"["}WD.peek=ile;function WD(t,e,n,r){const s=t.referenceType,i=n.enter("linkReference");let l=n.enter("label");const c=n.createTracker(r);let d=c.move("[");const h=n.containerPhrasing(t,{before:d,after:"]",...c.current()});d+=c.move(h+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(t),{before:d,after:"]",...c.current()});return l(),n.stack=m,i(),s==="full"||!h||h!==p?d+=c.move(p+"]"):s==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function ile(){return"["}function j5(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function ale(t){const e=j5(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function lle(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function GD(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function ole(t,e,n,r){const s=n.enter("list"),i=n.bulletCurrent;let l=t.ordered?lle(n):j5(n);const c=t.ordered?l==="."?")":".":ale(n);let d=e&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!t.ordered){const m=t.children?t.children[0]:void 0;if((l==="*"||l==="-")&&m&&(!m.children||!m.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(d=!0),GD(n)===l&&m){let p=-1;for(;++p-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+i);let l=i.length+1;(s==="tab"||s==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(l=Math.ceil(l/4)*4);const c=n.createTracker(r);c.move(i+" ".repeat(l-i.length)),c.shift(l);const d=n.enter("listItem"),h=n.indentLines(n.containerFlow(t,c.current()),m);return d(),h;function m(p,x,v){return x?(v?"":" ".repeat(l))+p:(v?i:i+" ".repeat(l-i.length))+p}}function dle(t,e,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),l=n.containerPhrasing(t,r);return i(),s(),l}const hle=y0(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function fle(t,e,n,r){return(t.children.some(function(l){return hle(l)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function mle(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}XD.peek=ple;function XD(t,e,n,r){const s=mle(n),i=n.enter("strong"),l=n.createTracker(r),c=l.move(s+s);let d=l.move(n.containerPhrasing(t,{after:s,before:c,...l.current()}));const h=d.charCodeAt(0),m=Wg(r.before.charCodeAt(r.before.length-1),h,s);m.inside&&(d=Lf(h)+d.slice(1));const p=d.charCodeAt(d.length-1),x=Wg(r.after.charCodeAt(0),p,s);x.inside&&(d=d.slice(0,-1)+Lf(p));const v=l.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:x.outside,before:m.outside},c+d+v}function ple(t,e,n){return n.options.strong||"*"}function gle(t,e,n,r){return n.safe(t.value,r)}function xle(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function vle(t,e,n){const r=(GD(n)+(n.options.ruleSpaces?" ":"")).repeat(xle(n));return n.options.ruleSpaces?r.slice(0,-1):r}const YD={blockquote:Qae,break:K8,code:Wae,definition:Xae,emphasis:qD,hardBreak:K8,heading:Jae,html:FD,image:QD,imageReference:$D,inlineCode:HD,link:VD,linkReference:WD,list:ole,listItem:ule,paragraph:dle,root:fle,strong:XD,text:gle,thematicBreak:vle};function yle(){return{enter:{table:ble,tableData:Z8,tableHeader:Z8,tableRow:Sle},exit:{codeText:kle,table:wle,tableData:Tb,tableHeader:Tb,tableRow:Tb}}}function ble(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function wle(t){this.exit(t),this.data.inTable=void 0}function Sle(t){this.enter({type:"tableRow",children:[]},t)}function Tb(t){this.exit(t)}function Z8(t){this.enter({type:"tableCell",children:[]},t)}function kle(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,Ole));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function Ole(t,e){return e==="|"?e:t}function jle(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,s=e.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:l,tableCell:d,tableRow:c}};function l(v,b,k,O){return h(m(v,k,O),v.align)}function c(v,b,k,O){const j=p(v,k,O),T=h([j]);return T.slice(0,T.indexOf(` -`))}function d(v,b,k,O){const j=k.enter("tableCell"),T=k.enter("phrasing"),A=k.containerPhrasing(v,{...O,before:i,after:i});return T(),j(),A}function h(v,b){return qae(v,{align:b,alignDelimiters:r,padding:n,stringLength:s})}function m(v,b,k){const O=v.children;let j=-1;const T=[],A=b.enter("table");for(;++j0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const $le={tokenize:Kle,partial:!0};function Hle(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Gle,continuation:{tokenize:Xle},exit:Yle}},text:{91:{name:"gfmFootnoteCall",tokenize:Wle},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Ule,resolveTo:Vle}}}}function Ule(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;s--;){const d=r.events[s][1];if(d.type==="labelImage"){l=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return c;function c(d){if(!l||!l._balanced)return n(d);const h=Qi(r.sliceSerialize({start:l.end,end:r.now()}));return h.codePointAt(0)!==94||!i.includes(h.slice(1))?n(d):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),e(d))}}function Vle(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},c=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",l,e],["exit",l,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...c),t}function Wle(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,l;return c;function c(p){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),d}function d(p){return p!==94?n(p):(t.enter("gfmFootnoteCallMarker"),t.consume(p),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(p){if(i>999||p===93&&!l||p===null||p===91||Rn(p))return n(p);if(p===93){t.exit("chunkString");const x=t.exit("gfmFootnoteCallString");return s.includes(Qi(r.sliceSerialize(x)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(p)}return Rn(p)||(l=!0),i++,t.consume(p),p===92?m:h}function m(p){return p===91||p===92||p===93?(t.consume(p),i++,h):h(p)}}function Gle(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,l=0,c;return d;function d(b){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(b){return b===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",m):n(b)}function m(b){if(l>999||b===93&&!c||b===null||b===91||Rn(b))return n(b);if(b===93){t.exit("chunkString");const k=t.exit("gfmFootnoteDefinitionLabelString");return i=Qi(r.sliceSerialize(k)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),x}return Rn(b)||(c=!0),l++,t.consume(b),b===92?p:m}function p(b){return b===91||b===92||b===93?(t.consume(b),l++,m):m(b)}function x(b){return b===58?(t.enter("definitionMarker"),t.consume(b),t.exit("definitionMarker"),s.includes(i)||s.push(i),zt(t,v,"gfmFootnoteDefinitionWhitespace")):n(b)}function v(b){return e(b)}}function Xle(t,e,n){return t.check(v0,e,t.attempt($le,e,n))}function Yle(t){t.exit("gfmFootnoteDefinition")}function Kle(t,e,n){const r=this;return zt(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?e(i):n(i)}}function Zle(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(l,c){let d=-1;for(;++d1?d(b):(l.consume(b),p++,v);if(p<2&&!n)return d(b);const O=l.exit("strikethroughSequenceTemporary"),j=vd(b);return O._open=!j||j===2&&!!k,O._close=!k||k===2&&!!j,c(b)}}}class Jle{constructor(){this.map=[]}add(e,n,r){eoe(this,e,n,r)}consume(e){if(this.map.sort(function(i,l){return i[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let s=r.pop();for(;s;){for(const i of s)e.push(i);s=r.pop()}this.map.length=0}}function eoe(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const W=r.events[U][1].type;if(W==="lineEnding"||W==="linePrefix")U--;else break}const V=U>-1?r.events[U][1].type:null,de=V==="tableHead"||V==="tableRow"?E:d;return de===E&&r.parser.lazy[r.now().line]?n(L):de(L)}function d(L){return t.enter("tableHead"),t.enter("tableRow"),h(L)}function h(L){return L===124||(l=!0,i+=1),m(L)}function m(L){return L===null?n(L):Ze(L)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(L),t.exit("lineEnding"),v):n(L):qt(L)?zt(t,m,"whitespace")(L):(i+=1,l&&(l=!1,s+=1),L===124?(t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),l=!0,m):(t.enter("data"),p(L)))}function p(L){return L===null||L===124||Rn(L)?(t.exit("data"),m(L)):(t.consume(L),L===92?x:p)}function x(L){return L===92||L===124?(t.consume(L),p):p(L)}function v(L){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(L):(t.enter("tableDelimiterRow"),l=!1,qt(L)?zt(t,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):b(L))}function b(L){return L===45||L===58?O(L):L===124?(l=!0,t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),k):D(L)}function k(L){return qt(L)?zt(t,O,"whitespace")(L):O(L)}function O(L){return L===58?(i+=1,l=!0,t.enter("tableDelimiterMarker"),t.consume(L),t.exit("tableDelimiterMarker"),j):L===45?(i+=1,j(L)):L===null||Ze(L)?_(L):D(L)}function j(L){return L===45?(t.enter("tableDelimiterFiller"),T(L)):D(L)}function T(L){return L===45?(t.consume(L),T):L===58?(l=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(L),t.exit("tableDelimiterMarker"),A):(t.exit("tableDelimiterFiller"),A(L))}function A(L){return qt(L)?zt(t,_,"whitespace")(L):_(L)}function _(L){return L===124?b(L):L===null||Ze(L)?!l||s!==i?D(L):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(L)):D(L)}function D(L){return n(L)}function E(L){return t.enter("tableRow"),R(L)}function R(L){return L===124?(t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),R):L===null||Ze(L)?(t.exit("tableRow"),e(L)):qt(L)?zt(t,R,"whitespace")(L):(t.enter("data"),Q(L))}function Q(L){return L===null||L===124||Rn(L)?(t.exit("data"),R(L)):(t.consume(L),L===92?F:Q)}function F(L){return L===92||L===124?(t.consume(L),Q):Q(L)}}function soe(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],l=[0,0,0,0],c=!1,d=0,h,m,p;const x=new Jle;for(;++nn[2]+1){const b=n[2]+1,k=n[3]-n[2]-1;t.add(b,k,[])}}t.add(n[3]+1,0,[["exit",p,e]])}return s!==void 0&&(i.end=Object.assign({},Lu(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function eN(t,e,n,r,s){const i=[],l=Lu(e.events,n);s&&(s.end=Object.assign({},l),i.push(["exit",s,e])),r.end=Object.assign({},l),i.push(["exit",r,e]),t.add(n+1,0,i)}function Lu(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const ioe={name:"tasklistCheck",tokenize:loe};function aoe(){return{text:{91:ioe}}}function loe(t,e,n){const r=this;return s;function s(d){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(d):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),i)}function i(d){return Rn(d)?(t.enter("taskListCheckValueUnchecked"),t.consume(d),t.exit("taskListCheckValueUnchecked"),l):d===88||d===120?(t.enter("taskListCheckValueChecked"),t.consume(d),t.exit("taskListCheckValueChecked"),l):n(d)}function l(d){return d===93?(t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),c):n(d)}function c(d){return Ze(d)?e(d):qt(d)?t.check({tokenize:ooe},e,n)(d):n(d)}}function ooe(t,e,n){return zt(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function coe(t){return mD([Rle(),Hle(),Zle(t),noe(),aoe()])}const uoe={};function doe(t){const e=this,n=t||uoe,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(coe(n)),i.push(Mle()),l.push(Ele(n))}function hoe(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:c,mathText:l,mathTextData:c}};function t(d){const h={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[h]}},d)}function e(){this.buffer()}function n(){const d=this.resume(),h=this.stack[this.stack.length-1];h.type,h.meta=d}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(d){const h=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),m=this.stack[this.stack.length-1];m.type,this.exit(d),m.value=h;const p=m.data.hChildren[0];p.type,p.tagName,p.children.push({type:"text",value:h}),this.data.mathFlowInside=void 0}function i(d){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},d),this.buffer()}function l(d){const h=this.resume(),m=this.stack[this.stack.length-1];m.type,this.exit(d),m.value=h,m.data.hChildren.push({type:"text",value:h})}function c(d){this.config.enter.data.call(this,d),this.config.exit.data.call(this,d)}}function foe(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` +`))}function d(v,b,k,O){const j=k.enter("tableCell"),T=k.enter("phrasing"),A=k.containerPhrasing(v,{...O,before:i,after:i});return T(),j(),A}function h(v,b){return qae(v,{align:b,alignDelimiters:r,padding:n,stringLength:s})}function m(v,b,k){const O=v.children;let j=-1;const T=[],A=b.enter("table");for(;++j0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const $le={tokenize:Kle,partial:!0};function Hle(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Gle,continuation:{tokenize:Xle},exit:Yle}},text:{91:{name:"gfmFootnoteCall",tokenize:Wle},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Ule,resolveTo:Vle}}}}function Ule(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;s--;){const d=r.events[s][1];if(d.type==="labelImage"){l=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return c;function c(d){if(!l||!l._balanced)return n(d);const h=Qi(r.sliceSerialize({start:l.end,end:r.now()}));return h.codePointAt(0)!==94||!i.includes(h.slice(1))?n(d):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),e(d))}}function Vle(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},c=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",l,e],["exit",l,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...c),t}function Wle(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,l;return c;function c(p){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),d}function d(p){return p!==94?n(p):(t.enter("gfmFootnoteCallMarker"),t.consume(p),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(p){if(i>999||p===93&&!l||p===null||p===91||Rn(p))return n(p);if(p===93){t.exit("chunkString");const x=t.exit("gfmFootnoteCallString");return s.includes(Qi(r.sliceSerialize(x)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(p)}return Rn(p)||(l=!0),i++,t.consume(p),p===92?m:h}function m(p){return p===91||p===92||p===93?(t.consume(p),i++,h):h(p)}}function Gle(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,l=0,c;return d;function d(b){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(b){return b===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",m):n(b)}function m(b){if(l>999||b===93&&!c||b===null||b===91||Rn(b))return n(b);if(b===93){t.exit("chunkString");const k=t.exit("gfmFootnoteDefinitionLabelString");return i=Qi(r.sliceSerialize(k)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),x}return Rn(b)||(c=!0),l++,t.consume(b),b===92?p:m}function p(b){return b===91||b===92||b===93?(t.consume(b),l++,m):m(b)}function x(b){return b===58?(t.enter("definitionMarker"),t.consume(b),t.exit("definitionMarker"),s.includes(i)||s.push(i),zt(t,v,"gfmFootnoteDefinitionWhitespace")):n(b)}function v(b){return e(b)}}function Xle(t,e,n){return t.check(v0,e,t.attempt($le,e,n))}function Yle(t){t.exit("gfmFootnoteDefinition")}function Kle(t,e,n){const r=this;return zt(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?e(i):n(i)}}function Zle(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(l,c){let d=-1;for(;++d1?d(b):(l.consume(b),p++,v);if(p<2&&!n)return d(b);const O=l.exit("strikethroughSequenceTemporary"),j=vd(b);return O._open=!j||j===2&&!!k,O._close=!k||k===2&&!!j,c(b)}}}class Jle{constructor(){this.map=[]}add(e,n,r){eoe(this,e,n,r)}consume(e){if(this.map.sort(function(i,l){return i[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let s=r.pop();for(;s;){for(const i of s)e.push(i);s=r.pop()}this.map.length=0}}function eoe(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const W=r.events[U][1].type;if(W==="lineEnding"||W==="linePrefix")U--;else break}const V=U>-1?r.events[U][1].type:null,ce=V==="tableHead"||V==="tableRow"?E:d;return ce===E&&r.parser.lazy[r.now().line]?n(L):ce(L)}function d(L){return t.enter("tableHead"),t.enter("tableRow"),h(L)}function h(L){return L===124||(l=!0,i+=1),m(L)}function m(L){return L===null?n(L):Ze(L)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(L),t.exit("lineEnding"),v):n(L):qt(L)?zt(t,m,"whitespace")(L):(i+=1,l&&(l=!1,s+=1),L===124?(t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),l=!0,m):(t.enter("data"),p(L)))}function p(L){return L===null||L===124||Rn(L)?(t.exit("data"),m(L)):(t.consume(L),L===92?x:p)}function x(L){return L===92||L===124?(t.consume(L),p):p(L)}function v(L){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(L):(t.enter("tableDelimiterRow"),l=!1,qt(L)?zt(t,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):b(L))}function b(L){return L===45||L===58?O(L):L===124?(l=!0,t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),k):D(L)}function k(L){return qt(L)?zt(t,O,"whitespace")(L):O(L)}function O(L){return L===58?(i+=1,l=!0,t.enter("tableDelimiterMarker"),t.consume(L),t.exit("tableDelimiterMarker"),j):L===45?(i+=1,j(L)):L===null||Ze(L)?_(L):D(L)}function j(L){return L===45?(t.enter("tableDelimiterFiller"),T(L)):D(L)}function T(L){return L===45?(t.consume(L),T):L===58?(l=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(L),t.exit("tableDelimiterMarker"),A):(t.exit("tableDelimiterFiller"),A(L))}function A(L){return qt(L)?zt(t,_,"whitespace")(L):_(L)}function _(L){return L===124?b(L):L===null||Ze(L)?!l||s!==i?D(L):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(L)):D(L)}function D(L){return n(L)}function E(L){return t.enter("tableRow"),z(L)}function z(L){return L===124?(t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),z):L===null||Ze(L)?(t.exit("tableRow"),e(L)):qt(L)?zt(t,z,"whitespace")(L):(t.enter("data"),Q(L))}function Q(L){return L===null||L===124||Rn(L)?(t.exit("data"),z(L)):(t.consume(L),L===92?F:Q)}function F(L){return L===92||L===124?(t.consume(L),Q):Q(L)}}function soe(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],l=[0,0,0,0],c=!1,d=0,h,m,p;const x=new Jle;for(;++nn[2]+1){const b=n[2]+1,k=n[3]-n[2]-1;t.add(b,k,[])}}t.add(n[3]+1,0,[["exit",p,e]])}return s!==void 0&&(i.end=Object.assign({},Lu(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function eN(t,e,n,r,s){const i=[],l=Lu(e.events,n);s&&(s.end=Object.assign({},l),i.push(["exit",s,e])),r.end=Object.assign({},l),i.push(["exit",r,e]),t.add(n+1,0,i)}function Lu(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const ioe={name:"tasklistCheck",tokenize:loe};function aoe(){return{text:{91:ioe}}}function loe(t,e,n){const r=this;return s;function s(d){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(d):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),i)}function i(d){return Rn(d)?(t.enter("taskListCheckValueUnchecked"),t.consume(d),t.exit("taskListCheckValueUnchecked"),l):d===88||d===120?(t.enter("taskListCheckValueChecked"),t.consume(d),t.exit("taskListCheckValueChecked"),l):n(d)}function l(d){return d===93?(t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),c):n(d)}function c(d){return Ze(d)?e(d):qt(d)?t.check({tokenize:ooe},e,n)(d):n(d)}}function ooe(t,e,n){return zt(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function coe(t){return mD([Rle(),Hle(),Zle(t),noe(),aoe()])}const uoe={};function doe(t){const e=this,n=t||uoe,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(coe(n)),i.push(Mle()),l.push(Ele(n))}function hoe(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:c,mathText:l,mathTextData:c}};function t(d){const h={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[h]}},d)}function e(){this.buffer()}function n(){const d=this.resume(),h=this.stack[this.stack.length-1];h.type,h.meta=d}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(d){const h=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),m=this.stack[this.stack.length-1];m.type,this.exit(d),m.value=h;const p=m.data.hChildren[0];p.type,p.tagName,p.children.push({type:"text",value:h}),this.data.mathFlowInside=void 0}function i(d){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},d),this.buffer()}function l(d){const h=this.resume(),m=this.stack[this.stack.length-1];m.type,this.exit(d),m.value=h,m.data.hChildren.push({type:"text",value:h})}function c(d){this.config.enter.data.call(this,d),this.config.exit.data.call(this,d)}}function foe(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` `,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(i,l,c,d){const h=i.value||"",m=c.createTracker(d),p="$".repeat(Math.max(ID(h,"$")+1,2)),x=c.enter("mathFlow");let v=m.move(p);if(i.meta){const b=c.enter("mathFlowMeta");v+=m.move(c.safe(i.meta,{after:` `,before:v,encode:["$"],...m.current()})),b()}return v+=m.move(` `),h&&(v+=m.move(h+` -`)),v+=m.move(p),x(),v}function r(i,l,c){let d=i.value||"",h=1;for(e||h++;new RegExp("(^|[^$])"+"\\$".repeat(h)+"([^$]|$)").test(d);)h++;const m="$".repeat(h);/[^ \r\n]/.test(d)&&(/^[ \r\n]/.test(d)&&/[ \r\n]$/.test(d)||/^\$|\$$/.test(d))&&(d=" "+d+" ");let p=-1;for(;++p15?h="…"+c.slice(s-15,s):h=c.slice(0,s);var m;i+15":">","<":"<",'"':""","'":"'"},joe=/[&><"']/g;function Noe(t){return String(t).replace(joe,e=>Ooe[e])}var iR=function t(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?t(e.body[0]):e:e.type==="font"?t(e.body):e},Coe=function(e){var n=iR(e);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},Toe=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},Aoe=function(e){var n=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},tn={deflt:woe,escape:Noe,hyphenate:koe,getBaseElem:iR,isCharacterBox:Coe,protocolFromUrl:Aoe},cg={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand ",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function Moe(t){if(t.default)return t.default;var e=t.type,n=Array.isArray(e)?e[0]:e;if(typeof n!="string")return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class C5{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var n in cg)if(cg.hasOwnProperty(n)){var r=cg[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:Moe(r)}}reportNonstrict(e,n,r){var s=this.strict;if(typeof s=="function"&&(s=s(e,n,r)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new De("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+e+"]"),r);s==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]"))}}useStrictBehavior(e,n,r){var s=this.strict;if(typeof s=="function")try{s=s(e,n,r)}catch{s="error"}return!s||s==="ignore"?!1:s===!0||s==="error"?!0:s==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var n=tn.protocolFromUrl(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class Yl{constructor(e,n,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=n,this.cramped=r}sup(){return la[Eoe[this.id]]}sub(){return la[_oe[this.id]]}fracNum(){return la[Doe[this.id]]}fracDen(){return la[Roe[this.id]]}cramp(){return la[zoe[this.id]]}text(){return la[Poe[this.id]]}isTight(){return this.size>=2}}var T5=0,Gg=1,ed=2,ul=3,If=4,Oi=5,yd=6,hs=7,la=[new Yl(T5,0,!1),new Yl(Gg,0,!0),new Yl(ed,1,!1),new Yl(ul,1,!0),new Yl(If,2,!1),new Yl(Oi,2,!0),new Yl(yd,3,!1),new Yl(hs,3,!0)],Eoe=[If,Oi,If,Oi,yd,hs,yd,hs],_oe=[Oi,Oi,Oi,Oi,hs,hs,hs,hs],Doe=[ed,ul,If,Oi,yd,hs,yd,hs],Roe=[ul,ul,Oi,Oi,hs,hs,hs,hs],zoe=[Gg,Gg,ul,ul,Oi,Oi,hs,hs],Poe=[T5,Gg,ed,ul,ed,ul,ed,ul],at={DISPLAY:la[T5],TEXT:la[ed],SCRIPT:la[If],SCRIPTSCRIPT:la[yd]},S4=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function Boe(t){for(var e=0;e=s[0]&&t<=s[1])return n.name}return null}var ug=[];S4.forEach(t=>t.blocks.forEach(e=>ug.push(...e)));function aR(t){for(var e=0;e=ug[e]&&t<=ug[e+1])return!0;return!1}var Tu=80,Loe=function(e,n){return"M95,"+(622+e+n)+` +`)),v+=m.move(p),x(),v}function r(i,l,c){let d=i.value||"",h=1;for(e||h++;new RegExp("(^|[^$])"+"\\$".repeat(h)+"([^$]|$)").test(d);)h++;const m="$".repeat(h);/[^ \r\n]/.test(d)&&(/^[ \r\n]/.test(d)&&/[ \r\n]$/.test(d)||/^\$|\$$/.test(d))&&(d=" "+d+" ");let p=-1;for(;++p15?h="…"+c.slice(s-15,s):h=c.slice(0,s);var m;i+15":">","<":"<",'"':""","'":"'"},joe=/[&><"']/g;function Noe(t){return String(t).replace(joe,e=>Ooe[e])}var iR=function t(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?t(e.body[0]):e:e.type==="font"?t(e.body):e},Coe=function(e){var n=iR(e);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},Toe=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},Aoe=function(e){var n=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},tn={deflt:woe,escape:Noe,hyphenate:koe,getBaseElem:iR,isCharacterBox:Coe,protocolFromUrl:Aoe},cg={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand ",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function Moe(t){if(t.default)return t.default;var e=t.type,n=Array.isArray(e)?e[0]:e;if(typeof n!="string")return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class C5{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var n in cg)if(cg.hasOwnProperty(n)){var r=cg[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:Moe(r)}}reportNonstrict(e,n,r){var s=this.strict;if(typeof s=="function"&&(s=s(e,n,r)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new De("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+e+"]"),r);s==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]"))}}useStrictBehavior(e,n,r){var s=this.strict;if(typeof s=="function")try{s=s(e,n,r)}catch{s="error"}return!s||s==="ignore"?!1:s===!0||s==="error"?!0:s==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var n=tn.protocolFromUrl(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class Yl{constructor(e,n,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=n,this.cramped=r}sup(){return la[Eoe[this.id]]}sub(){return la[_oe[this.id]]}fracNum(){return la[Doe[this.id]]}fracDen(){return la[Roe[this.id]]}cramp(){return la[zoe[this.id]]}text(){return la[Poe[this.id]]}isTight(){return this.size>=2}}var T5=0,Gg=1,ed=2,ul=3,If=4,Oi=5,yd=6,hs=7,la=[new Yl(T5,0,!1),new Yl(Gg,0,!0),new Yl(ed,1,!1),new Yl(ul,1,!0),new Yl(If,2,!1),new Yl(Oi,2,!0),new Yl(yd,3,!1),new Yl(hs,3,!0)],Eoe=[If,Oi,If,Oi,yd,hs,yd,hs],_oe=[Oi,Oi,Oi,Oi,hs,hs,hs,hs],Doe=[ed,ul,If,Oi,yd,hs,yd,hs],Roe=[ul,ul,Oi,Oi,hs,hs,hs,hs],zoe=[Gg,Gg,ul,ul,Oi,Oi,hs,hs],Poe=[T5,Gg,ed,ul,ed,ul,ed,ul],at={DISPLAY:la[T5],TEXT:la[ed],SCRIPT:la[If],SCRIPTSCRIPT:la[yd]},S4=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function Boe(t){for(var e=0;e=s[0]&&t<=s[1])return n.name}return null}var ug=[];S4.forEach(t=>t.blocks.forEach(e=>ug.push(...e)));function aR(t){for(var e=0;e=ug[e]&&t<=ug[e+1])return!0;return!1}var Tu=80,Loe=function(e,n){return"M95,"+(622+e+n)+` c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 @@ -347,13 +347,13 @@ c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6 c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, --470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class w0{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),n=0;nn.toText();return this.children.map(e).join("")}}var pa={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Tp={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},rN={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function Goe(t,e){pa[t]=e}function A5(t,e,n){if(!pa[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),s=pa[e][r];if(!s&&t[0]in rN&&(r=rN[t[0]].charCodeAt(0),s=pa[e][r]),!s&&n==="text"&&aR(r)&&(s=pa[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var Ab={};function Xoe(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!Ab[e]){var n=Ab[e]={cssEmPerMu:Tp.quad[e]/18};for(var r in Tp)Tp.hasOwnProperty(r)&&(n[r]=Tp[r][e])}return Ab[e]}var Yoe=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],sN=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],iN=function(e,n){return n.size<2?e:Yoe[e-1][n.size-1]};class sl{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||sl.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=sN[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return new sl(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:iN(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:sN[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=iN(sl.BASESIZE,e);return this.size===n&&this.textSize===sl.BASESIZE&&this.style===e?this:this.extend({style:e,size:n})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==sl.BASESIZE?["sizing","reset-size"+this.size,"size"+sl.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Xoe(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}sl.BASESIZE=6;var k4={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},Koe={ex:!0,em:!0,mu:!0},lR=function(e){return typeof e!="string"&&(e=e.unit),e in k4||e in Koe||e==="ex"},Kn=function(e,n){var r;if(e.unit in k4)r=k4[e.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(e.unit==="mu")r=n.fontMetrics().cssEmPerMu;else{var s;if(n.style.isTight()?s=n.havingStyle(n.style.text()):s=n,e.unit==="ex")r=s.fontMetrics().xHeight;else if(e.unit==="em")r=s.fontMetrics().quad;else throw new De("Invalid unit: '"+e.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},Le=function(e){return+e.toFixed(4)+"em"},yo=function(e){return e.filter(n=>n).join(" ")},oR=function(e,n,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},n){n.style.isTight()&&this.classes.push("mtight");var s=n.getColor();s&&(this.style.color=s)}},cR=function(e){var n=document.createElement(e);n.className=yo(this.classes);for(var r in this.style)this.style.hasOwnProperty(r)&&(n.style[r]=this.style[r]);for(var s in this.attributes)this.attributes.hasOwnProperty(s)&&n.setAttribute(s,this.attributes[s]);for(var i=0;i/=\x00-\x1f]/,uR=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+tn.escape(yo(this.classes))+'"');var r="";for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=tn.hyphenate(s)+":"+this.style[s]+";");r&&(n+=' style="'+tn.escape(r)+'"');for(var i in this.attributes)if(this.attributes.hasOwnProperty(i)){if(Zoe.test(i))throw new De("Invalid attribute name '"+i+"'");n+=" "+i+'="'+tn.escape(this.attributes[i])+'"'}n+=">";for(var l=0;l",n};class S0{constructor(e,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,oR.call(this,e,r,s),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return cR.call(this,"span")}toMarkup(){return uR.call(this,"span")}}class M5{constructor(e,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,oR.call(this,n,s),this.children=r||[],this.setAttribute("href",e)}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return cR.call(this,"a")}toMarkup(){return uR.call(this,"a")}}class Joe{constructor(e,n,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=e,this.classes=["mord"],this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var n in this.style)this.style.hasOwnProperty(n)&&(e.style[n]=this.style[n]);return e}toMarkup(){var e=''+tn.escape(this.alt)+'0&&(n=document.createElement("span"),n.style.marginRight=Le(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=yo(this.classes));for(var r in this.style)this.style.hasOwnProperty(r)&&(n=n||document.createElement("span"),n.style[r]=this.style[r]);return n?(n.appendChild(e),n):e}toMarkup(){var e=!1,n="0&&(r+="margin-right:"+this.italic+"em;");for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=tn.hyphenate(s)+":"+this.style[s]+";");r&&(e=!0,n+=' style="'+tn.escape(r)+'"');var i=tn.escape(this.text);return e?(n+=">",n+=i,n+="",n):i}}class xl{constructor(e,n){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=n||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);for(var s=0;s':''}}class O4{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"line");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var e=" but got "+String(t)+".")}var nce={bin:1,close:1,inner:1,open:1,punct:1,rel:1},rce={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Ln={math:{},text:{}};function N(t,e,n,r,s,i){Ln[t][s]={font:e,group:n,replace:r},i&&r&&(Ln[t][r]=Ln[t][s])}var C="math",Ee="text",B="main",G="ams",Wn="accent-token",Ve="bin",xs="close",Rd="inner",st="mathord",yr="op-token",li="open",$x="punct",X="rel",Sl="spacing",le="textord";N(C,B,X,"≡","\\equiv",!0);N(C,B,X,"≺","\\prec",!0);N(C,B,X,"≻","\\succ",!0);N(C,B,X,"∼","\\sim",!0);N(C,B,X,"⊥","\\perp");N(C,B,X,"⪯","\\preceq",!0);N(C,B,X,"⪰","\\succeq",!0);N(C,B,X,"≃","\\simeq",!0);N(C,B,X,"∣","\\mid",!0);N(C,B,X,"≪","\\ll",!0);N(C,B,X,"≫","\\gg",!0);N(C,B,X,"≍","\\asymp",!0);N(C,B,X,"∥","\\parallel");N(C,B,X,"⋈","\\bowtie",!0);N(C,B,X,"⌣","\\smile",!0);N(C,B,X,"⊑","\\sqsubseteq",!0);N(C,B,X,"⊒","\\sqsupseteq",!0);N(C,B,X,"≐","\\doteq",!0);N(C,B,X,"⌢","\\frown",!0);N(C,B,X,"∋","\\ni",!0);N(C,B,X,"∝","\\propto",!0);N(C,B,X,"⊢","\\vdash",!0);N(C,B,X,"⊣","\\dashv",!0);N(C,B,X,"∋","\\owns");N(C,B,$x,".","\\ldotp");N(C,B,$x,"⋅","\\cdotp");N(C,B,le,"#","\\#");N(Ee,B,le,"#","\\#");N(C,B,le,"&","\\&");N(Ee,B,le,"&","\\&");N(C,B,le,"ℵ","\\aleph",!0);N(C,B,le,"∀","\\forall",!0);N(C,B,le,"ℏ","\\hbar",!0);N(C,B,le,"∃","\\exists",!0);N(C,B,le,"∇","\\nabla",!0);N(C,B,le,"♭","\\flat",!0);N(C,B,le,"ℓ","\\ell",!0);N(C,B,le,"♮","\\natural",!0);N(C,B,le,"♣","\\clubsuit",!0);N(C,B,le,"℘","\\wp",!0);N(C,B,le,"♯","\\sharp",!0);N(C,B,le,"♢","\\diamondsuit",!0);N(C,B,le,"ℜ","\\Re",!0);N(C,B,le,"♡","\\heartsuit",!0);N(C,B,le,"ℑ","\\Im",!0);N(C,B,le,"♠","\\spadesuit",!0);N(C,B,le,"§","\\S",!0);N(Ee,B,le,"§","\\S");N(C,B,le,"¶","\\P",!0);N(Ee,B,le,"¶","\\P");N(C,B,le,"†","\\dag");N(Ee,B,le,"†","\\dag");N(Ee,B,le,"†","\\textdagger");N(C,B,le,"‡","\\ddag");N(Ee,B,le,"‡","\\ddag");N(Ee,B,le,"‡","\\textdaggerdbl");N(C,B,xs,"⎱","\\rmoustache",!0);N(C,B,li,"⎰","\\lmoustache",!0);N(C,B,xs,"⟯","\\rgroup",!0);N(C,B,li,"⟮","\\lgroup",!0);N(C,B,Ve,"∓","\\mp",!0);N(C,B,Ve,"⊖","\\ominus",!0);N(C,B,Ve,"⊎","\\uplus",!0);N(C,B,Ve,"⊓","\\sqcap",!0);N(C,B,Ve,"∗","\\ast");N(C,B,Ve,"⊔","\\sqcup",!0);N(C,B,Ve,"◯","\\bigcirc",!0);N(C,B,Ve,"∙","\\bullet",!0);N(C,B,Ve,"‡","\\ddagger");N(C,B,Ve,"≀","\\wr",!0);N(C,B,Ve,"⨿","\\amalg");N(C,B,Ve,"&","\\And");N(C,B,X,"⟵","\\longleftarrow",!0);N(C,B,X,"⇐","\\Leftarrow",!0);N(C,B,X,"⟸","\\Longleftarrow",!0);N(C,B,X,"⟶","\\longrightarrow",!0);N(C,B,X,"⇒","\\Rightarrow",!0);N(C,B,X,"⟹","\\Longrightarrow",!0);N(C,B,X,"↔","\\leftrightarrow",!0);N(C,B,X,"⟷","\\longleftrightarrow",!0);N(C,B,X,"⇔","\\Leftrightarrow",!0);N(C,B,X,"⟺","\\Longleftrightarrow",!0);N(C,B,X,"↦","\\mapsto",!0);N(C,B,X,"⟼","\\longmapsto",!0);N(C,B,X,"↗","\\nearrow",!0);N(C,B,X,"↩","\\hookleftarrow",!0);N(C,B,X,"↪","\\hookrightarrow",!0);N(C,B,X,"↘","\\searrow",!0);N(C,B,X,"↼","\\leftharpoonup",!0);N(C,B,X,"⇀","\\rightharpoonup",!0);N(C,B,X,"↙","\\swarrow",!0);N(C,B,X,"↽","\\leftharpoondown",!0);N(C,B,X,"⇁","\\rightharpoondown",!0);N(C,B,X,"↖","\\nwarrow",!0);N(C,B,X,"⇌","\\rightleftharpoons",!0);N(C,G,X,"≮","\\nless",!0);N(C,G,X,"","\\@nleqslant");N(C,G,X,"","\\@nleqq");N(C,G,X,"⪇","\\lneq",!0);N(C,G,X,"≨","\\lneqq",!0);N(C,G,X,"","\\@lvertneqq");N(C,G,X,"⋦","\\lnsim",!0);N(C,G,X,"⪉","\\lnapprox",!0);N(C,G,X,"⊀","\\nprec",!0);N(C,G,X,"⋠","\\npreceq",!0);N(C,G,X,"⋨","\\precnsim",!0);N(C,G,X,"⪹","\\precnapprox",!0);N(C,G,X,"≁","\\nsim",!0);N(C,G,X,"","\\@nshortmid");N(C,G,X,"∤","\\nmid",!0);N(C,G,X,"⊬","\\nvdash",!0);N(C,G,X,"⊭","\\nvDash",!0);N(C,G,X,"⋪","\\ntriangleleft");N(C,G,X,"⋬","\\ntrianglelefteq",!0);N(C,G,X,"⊊","\\subsetneq",!0);N(C,G,X,"","\\@varsubsetneq");N(C,G,X,"⫋","\\subsetneqq",!0);N(C,G,X,"","\\@varsubsetneqq");N(C,G,X,"≯","\\ngtr",!0);N(C,G,X,"","\\@ngeqslant");N(C,G,X,"","\\@ngeqq");N(C,G,X,"⪈","\\gneq",!0);N(C,G,X,"≩","\\gneqq",!0);N(C,G,X,"","\\@gvertneqq");N(C,G,X,"⋧","\\gnsim",!0);N(C,G,X,"⪊","\\gnapprox",!0);N(C,G,X,"⊁","\\nsucc",!0);N(C,G,X,"⋡","\\nsucceq",!0);N(C,G,X,"⋩","\\succnsim",!0);N(C,G,X,"⪺","\\succnapprox",!0);N(C,G,X,"≆","\\ncong",!0);N(C,G,X,"","\\@nshortparallel");N(C,G,X,"∦","\\nparallel",!0);N(C,G,X,"⊯","\\nVDash",!0);N(C,G,X,"⋫","\\ntriangleright");N(C,G,X,"⋭","\\ntrianglerighteq",!0);N(C,G,X,"","\\@nsupseteqq");N(C,G,X,"⊋","\\supsetneq",!0);N(C,G,X,"","\\@varsupsetneq");N(C,G,X,"⫌","\\supsetneqq",!0);N(C,G,X,"","\\@varsupsetneqq");N(C,G,X,"⊮","\\nVdash",!0);N(C,G,X,"⪵","\\precneqq",!0);N(C,G,X,"⪶","\\succneqq",!0);N(C,G,X,"","\\@nsubseteqq");N(C,G,Ve,"⊴","\\unlhd");N(C,G,Ve,"⊵","\\unrhd");N(C,G,X,"↚","\\nleftarrow",!0);N(C,G,X,"↛","\\nrightarrow",!0);N(C,G,X,"⇍","\\nLeftarrow",!0);N(C,G,X,"⇏","\\nRightarrow",!0);N(C,G,X,"↮","\\nleftrightarrow",!0);N(C,G,X,"⇎","\\nLeftrightarrow",!0);N(C,G,X,"△","\\vartriangle");N(C,G,le,"ℏ","\\hslash");N(C,G,le,"▽","\\triangledown");N(C,G,le,"◊","\\lozenge");N(C,G,le,"Ⓢ","\\circledS");N(C,G,le,"®","\\circledR");N(Ee,G,le,"®","\\circledR");N(C,G,le,"∡","\\measuredangle",!0);N(C,G,le,"∄","\\nexists");N(C,G,le,"℧","\\mho");N(C,G,le,"Ⅎ","\\Finv",!0);N(C,G,le,"⅁","\\Game",!0);N(C,G,le,"‵","\\backprime");N(C,G,le,"▲","\\blacktriangle");N(C,G,le,"▼","\\blacktriangledown");N(C,G,le,"■","\\blacksquare");N(C,G,le,"⧫","\\blacklozenge");N(C,G,le,"★","\\bigstar");N(C,G,le,"∢","\\sphericalangle",!0);N(C,G,le,"∁","\\complement",!0);N(C,G,le,"ð","\\eth",!0);N(Ee,B,le,"ð","ð");N(C,G,le,"╱","\\diagup");N(C,G,le,"╲","\\diagdown");N(C,G,le,"□","\\square");N(C,G,le,"□","\\Box");N(C,G,le,"◊","\\Diamond");N(C,G,le,"¥","\\yen",!0);N(Ee,G,le,"¥","\\yen",!0);N(C,G,le,"✓","\\checkmark",!0);N(Ee,G,le,"✓","\\checkmark");N(C,G,le,"ℶ","\\beth",!0);N(C,G,le,"ℸ","\\daleth",!0);N(C,G,le,"ℷ","\\gimel",!0);N(C,G,le,"ϝ","\\digamma",!0);N(C,G,le,"ϰ","\\varkappa");N(C,G,li,"┌","\\@ulcorner",!0);N(C,G,xs,"┐","\\@urcorner",!0);N(C,G,li,"└","\\@llcorner",!0);N(C,G,xs,"┘","\\@lrcorner",!0);N(C,G,X,"≦","\\leqq",!0);N(C,G,X,"⩽","\\leqslant",!0);N(C,G,X,"⪕","\\eqslantless",!0);N(C,G,X,"≲","\\lesssim",!0);N(C,G,X,"⪅","\\lessapprox",!0);N(C,G,X,"≊","\\approxeq",!0);N(C,G,Ve,"⋖","\\lessdot");N(C,G,X,"⋘","\\lll",!0);N(C,G,X,"≶","\\lessgtr",!0);N(C,G,X,"⋚","\\lesseqgtr",!0);N(C,G,X,"⪋","\\lesseqqgtr",!0);N(C,G,X,"≑","\\doteqdot");N(C,G,X,"≓","\\risingdotseq",!0);N(C,G,X,"≒","\\fallingdotseq",!0);N(C,G,X,"∽","\\backsim",!0);N(C,G,X,"⋍","\\backsimeq",!0);N(C,G,X,"⫅","\\subseteqq",!0);N(C,G,X,"⋐","\\Subset",!0);N(C,G,X,"⊏","\\sqsubset",!0);N(C,G,X,"≼","\\preccurlyeq",!0);N(C,G,X,"⋞","\\curlyeqprec",!0);N(C,G,X,"≾","\\precsim",!0);N(C,G,X,"⪷","\\precapprox",!0);N(C,G,X,"⊲","\\vartriangleleft");N(C,G,X,"⊴","\\trianglelefteq");N(C,G,X,"⊨","\\vDash",!0);N(C,G,X,"⊪","\\Vvdash",!0);N(C,G,X,"⌣","\\smallsmile");N(C,G,X,"⌢","\\smallfrown");N(C,G,X,"≏","\\bumpeq",!0);N(C,G,X,"≎","\\Bumpeq",!0);N(C,G,X,"≧","\\geqq",!0);N(C,G,X,"⩾","\\geqslant",!0);N(C,G,X,"⪖","\\eqslantgtr",!0);N(C,G,X,"≳","\\gtrsim",!0);N(C,G,X,"⪆","\\gtrapprox",!0);N(C,G,Ve,"⋗","\\gtrdot");N(C,G,X,"⋙","\\ggg",!0);N(C,G,X,"≷","\\gtrless",!0);N(C,G,X,"⋛","\\gtreqless",!0);N(C,G,X,"⪌","\\gtreqqless",!0);N(C,G,X,"≖","\\eqcirc",!0);N(C,G,X,"≗","\\circeq",!0);N(C,G,X,"≜","\\triangleq",!0);N(C,G,X,"∼","\\thicksim");N(C,G,X,"≈","\\thickapprox");N(C,G,X,"⫆","\\supseteqq",!0);N(C,G,X,"⋑","\\Supset",!0);N(C,G,X,"⊐","\\sqsupset",!0);N(C,G,X,"≽","\\succcurlyeq",!0);N(C,G,X,"⋟","\\curlyeqsucc",!0);N(C,G,X,"≿","\\succsim",!0);N(C,G,X,"⪸","\\succapprox",!0);N(C,G,X,"⊳","\\vartriangleright");N(C,G,X,"⊵","\\trianglerighteq");N(C,G,X,"⊩","\\Vdash",!0);N(C,G,X,"∣","\\shortmid");N(C,G,X,"∥","\\shortparallel");N(C,G,X,"≬","\\between",!0);N(C,G,X,"⋔","\\pitchfork",!0);N(C,G,X,"∝","\\varpropto");N(C,G,X,"◀","\\blacktriangleleft");N(C,G,X,"∴","\\therefore",!0);N(C,G,X,"∍","\\backepsilon");N(C,G,X,"▶","\\blacktriangleright");N(C,G,X,"∵","\\because",!0);N(C,G,X,"⋘","\\llless");N(C,G,X,"⋙","\\gggtr");N(C,G,Ve,"⊲","\\lhd");N(C,G,Ve,"⊳","\\rhd");N(C,G,X,"≂","\\eqsim",!0);N(C,B,X,"⋈","\\Join");N(C,G,X,"≑","\\Doteq",!0);N(C,G,Ve,"∔","\\dotplus",!0);N(C,G,Ve,"∖","\\smallsetminus");N(C,G,Ve,"⋒","\\Cap",!0);N(C,G,Ve,"⋓","\\Cup",!0);N(C,G,Ve,"⩞","\\doublebarwedge",!0);N(C,G,Ve,"⊟","\\boxminus",!0);N(C,G,Ve,"⊞","\\boxplus",!0);N(C,G,Ve,"⋇","\\divideontimes",!0);N(C,G,Ve,"⋉","\\ltimes",!0);N(C,G,Ve,"⋊","\\rtimes",!0);N(C,G,Ve,"⋋","\\leftthreetimes",!0);N(C,G,Ve,"⋌","\\rightthreetimes",!0);N(C,G,Ve,"⋏","\\curlywedge",!0);N(C,G,Ve,"⋎","\\curlyvee",!0);N(C,G,Ve,"⊝","\\circleddash",!0);N(C,G,Ve,"⊛","\\circledast",!0);N(C,G,Ve,"⋅","\\centerdot");N(C,G,Ve,"⊺","\\intercal",!0);N(C,G,Ve,"⋒","\\doublecap");N(C,G,Ve,"⋓","\\doublecup");N(C,G,Ve,"⊠","\\boxtimes",!0);N(C,G,X,"⇢","\\dashrightarrow",!0);N(C,G,X,"⇠","\\dashleftarrow",!0);N(C,G,X,"⇇","\\leftleftarrows",!0);N(C,G,X,"⇆","\\leftrightarrows",!0);N(C,G,X,"⇚","\\Lleftarrow",!0);N(C,G,X,"↞","\\twoheadleftarrow",!0);N(C,G,X,"↢","\\leftarrowtail",!0);N(C,G,X,"↫","\\looparrowleft",!0);N(C,G,X,"⇋","\\leftrightharpoons",!0);N(C,G,X,"↶","\\curvearrowleft",!0);N(C,G,X,"↺","\\circlearrowleft",!0);N(C,G,X,"↰","\\Lsh",!0);N(C,G,X,"⇈","\\upuparrows",!0);N(C,G,X,"↿","\\upharpoonleft",!0);N(C,G,X,"⇃","\\downharpoonleft",!0);N(C,B,X,"⊶","\\origof",!0);N(C,B,X,"⊷","\\imageof",!0);N(C,G,X,"⊸","\\multimap",!0);N(C,G,X,"↭","\\leftrightsquigarrow",!0);N(C,G,X,"⇉","\\rightrightarrows",!0);N(C,G,X,"⇄","\\rightleftarrows",!0);N(C,G,X,"↠","\\twoheadrightarrow",!0);N(C,G,X,"↣","\\rightarrowtail",!0);N(C,G,X,"↬","\\looparrowright",!0);N(C,G,X,"↷","\\curvearrowright",!0);N(C,G,X,"↻","\\circlearrowright",!0);N(C,G,X,"↱","\\Rsh",!0);N(C,G,X,"⇊","\\downdownarrows",!0);N(C,G,X,"↾","\\upharpoonright",!0);N(C,G,X,"⇂","\\downharpoonright",!0);N(C,G,X,"⇝","\\rightsquigarrow",!0);N(C,G,X,"⇝","\\leadsto");N(C,G,X,"⇛","\\Rrightarrow",!0);N(C,G,X,"↾","\\restriction");N(C,B,le,"‘","`");N(C,B,le,"$","\\$");N(Ee,B,le,"$","\\$");N(Ee,B,le,"$","\\textdollar");N(C,B,le,"%","\\%");N(Ee,B,le,"%","\\%");N(C,B,le,"_","\\_");N(Ee,B,le,"_","\\_");N(Ee,B,le,"_","\\textunderscore");N(C,B,le,"∠","\\angle",!0);N(C,B,le,"∞","\\infty",!0);N(C,B,le,"′","\\prime");N(C,B,le,"△","\\triangle");N(C,B,le,"Γ","\\Gamma",!0);N(C,B,le,"Δ","\\Delta",!0);N(C,B,le,"Θ","\\Theta",!0);N(C,B,le,"Λ","\\Lambda",!0);N(C,B,le,"Ξ","\\Xi",!0);N(C,B,le,"Π","\\Pi",!0);N(C,B,le,"Σ","\\Sigma",!0);N(C,B,le,"Υ","\\Upsilon",!0);N(C,B,le,"Φ","\\Phi",!0);N(C,B,le,"Ψ","\\Psi",!0);N(C,B,le,"Ω","\\Omega",!0);N(C,B,le,"A","Α");N(C,B,le,"B","Β");N(C,B,le,"E","Ε");N(C,B,le,"Z","Ζ");N(C,B,le,"H","Η");N(C,B,le,"I","Ι");N(C,B,le,"K","Κ");N(C,B,le,"M","Μ");N(C,B,le,"N","Ν");N(C,B,le,"O","Ο");N(C,B,le,"P","Ρ");N(C,B,le,"T","Τ");N(C,B,le,"X","Χ");N(C,B,le,"¬","\\neg",!0);N(C,B,le,"¬","\\lnot");N(C,B,le,"⊤","\\top");N(C,B,le,"⊥","\\bot");N(C,B,le,"∅","\\emptyset");N(C,G,le,"∅","\\varnothing");N(C,B,st,"α","\\alpha",!0);N(C,B,st,"β","\\beta",!0);N(C,B,st,"γ","\\gamma",!0);N(C,B,st,"δ","\\delta",!0);N(C,B,st,"ϵ","\\epsilon",!0);N(C,B,st,"ζ","\\zeta",!0);N(C,B,st,"η","\\eta",!0);N(C,B,st,"θ","\\theta",!0);N(C,B,st,"ι","\\iota",!0);N(C,B,st,"κ","\\kappa",!0);N(C,B,st,"λ","\\lambda",!0);N(C,B,st,"μ","\\mu",!0);N(C,B,st,"ν","\\nu",!0);N(C,B,st,"ξ","\\xi",!0);N(C,B,st,"ο","\\omicron",!0);N(C,B,st,"π","\\pi",!0);N(C,B,st,"ρ","\\rho",!0);N(C,B,st,"σ","\\sigma",!0);N(C,B,st,"τ","\\tau",!0);N(C,B,st,"υ","\\upsilon",!0);N(C,B,st,"ϕ","\\phi",!0);N(C,B,st,"χ","\\chi",!0);N(C,B,st,"ψ","\\psi",!0);N(C,B,st,"ω","\\omega",!0);N(C,B,st,"ε","\\varepsilon",!0);N(C,B,st,"ϑ","\\vartheta",!0);N(C,B,st,"ϖ","\\varpi",!0);N(C,B,st,"ϱ","\\varrho",!0);N(C,B,st,"ς","\\varsigma",!0);N(C,B,st,"φ","\\varphi",!0);N(C,B,Ve,"∗","*",!0);N(C,B,Ve,"+","+");N(C,B,Ve,"−","-",!0);N(C,B,Ve,"⋅","\\cdot",!0);N(C,B,Ve,"∘","\\circ",!0);N(C,B,Ve,"÷","\\div",!0);N(C,B,Ve,"±","\\pm",!0);N(C,B,Ve,"×","\\times",!0);N(C,B,Ve,"∩","\\cap",!0);N(C,B,Ve,"∪","\\cup",!0);N(C,B,Ve,"∖","\\setminus",!0);N(C,B,Ve,"∧","\\land");N(C,B,Ve,"∨","\\lor");N(C,B,Ve,"∧","\\wedge",!0);N(C,B,Ve,"∨","\\vee",!0);N(C,B,le,"√","\\surd");N(C,B,li,"⟨","\\langle",!0);N(C,B,li,"∣","\\lvert");N(C,B,li,"∥","\\lVert");N(C,B,xs,"?","?");N(C,B,xs,"!","!");N(C,B,xs,"⟩","\\rangle",!0);N(C,B,xs,"∣","\\rvert");N(C,B,xs,"∥","\\rVert");N(C,B,X,"=","=");N(C,B,X,":",":");N(C,B,X,"≈","\\approx",!0);N(C,B,X,"≅","\\cong",!0);N(C,B,X,"≥","\\ge");N(C,B,X,"≥","\\geq",!0);N(C,B,X,"←","\\gets");N(C,B,X,">","\\gt",!0);N(C,B,X,"∈","\\in",!0);N(C,B,X,"","\\@not");N(C,B,X,"⊂","\\subset",!0);N(C,B,X,"⊃","\\supset",!0);N(C,B,X,"⊆","\\subseteq",!0);N(C,B,X,"⊇","\\supseteq",!0);N(C,G,X,"⊈","\\nsubseteq",!0);N(C,G,X,"⊉","\\nsupseteq",!0);N(C,B,X,"⊨","\\models");N(C,B,X,"←","\\leftarrow",!0);N(C,B,X,"≤","\\le");N(C,B,X,"≤","\\leq",!0);N(C,B,X,"<","\\lt",!0);N(C,B,X,"→","\\rightarrow",!0);N(C,B,X,"→","\\to");N(C,G,X,"≱","\\ngeq",!0);N(C,G,X,"≰","\\nleq",!0);N(C,B,Sl," ","\\ ");N(C,B,Sl," ","\\space");N(C,B,Sl," ","\\nobreakspace");N(Ee,B,Sl," ","\\ ");N(Ee,B,Sl," "," ");N(Ee,B,Sl," ","\\space");N(Ee,B,Sl," ","\\nobreakspace");N(C,B,Sl,null,"\\nobreak");N(C,B,Sl,null,"\\allowbreak");N(C,B,$x,",",",");N(C,B,$x,";",";");N(C,G,Ve,"⊼","\\barwedge",!0);N(C,G,Ve,"⊻","\\veebar",!0);N(C,B,Ve,"⊙","\\odot",!0);N(C,B,Ve,"⊕","\\oplus",!0);N(C,B,Ve,"⊗","\\otimes",!0);N(C,B,le,"∂","\\partial",!0);N(C,B,Ve,"⊘","\\oslash",!0);N(C,G,Ve,"⊚","\\circledcirc",!0);N(C,G,Ve,"⊡","\\boxdot",!0);N(C,B,Ve,"△","\\bigtriangleup");N(C,B,Ve,"▽","\\bigtriangledown");N(C,B,Ve,"†","\\dagger");N(C,B,Ve,"⋄","\\diamond");N(C,B,Ve,"⋆","\\star");N(C,B,Ve,"◃","\\triangleleft");N(C,B,Ve,"▹","\\triangleright");N(C,B,li,"{","\\{");N(Ee,B,le,"{","\\{");N(Ee,B,le,"{","\\textbraceleft");N(C,B,xs,"}","\\}");N(Ee,B,le,"}","\\}");N(Ee,B,le,"}","\\textbraceright");N(C,B,li,"{","\\lbrace");N(C,B,xs,"}","\\rbrace");N(C,B,li,"[","\\lbrack",!0);N(Ee,B,le,"[","\\lbrack",!0);N(C,B,xs,"]","\\rbrack",!0);N(Ee,B,le,"]","\\rbrack",!0);N(C,B,li,"(","\\lparen",!0);N(C,B,xs,")","\\rparen",!0);N(Ee,B,le,"<","\\textless",!0);N(Ee,B,le,">","\\textgreater",!0);N(C,B,li,"⌊","\\lfloor",!0);N(C,B,xs,"⌋","\\rfloor",!0);N(C,B,li,"⌈","\\lceil",!0);N(C,B,xs,"⌉","\\rceil",!0);N(C,B,le,"\\","\\backslash");N(C,B,le,"∣","|");N(C,B,le,"∣","\\vert");N(Ee,B,le,"|","\\textbar",!0);N(C,B,le,"∥","\\|");N(C,B,le,"∥","\\Vert");N(Ee,B,le,"∥","\\textbardbl");N(Ee,B,le,"~","\\textasciitilde");N(Ee,B,le,"\\","\\textbackslash");N(Ee,B,le,"^","\\textasciicircum");N(C,B,X,"↑","\\uparrow",!0);N(C,B,X,"⇑","\\Uparrow",!0);N(C,B,X,"↓","\\downarrow",!0);N(C,B,X,"⇓","\\Downarrow",!0);N(C,B,X,"↕","\\updownarrow",!0);N(C,B,X,"⇕","\\Updownarrow",!0);N(C,B,yr,"∐","\\coprod");N(C,B,yr,"⋁","\\bigvee");N(C,B,yr,"⋀","\\bigwedge");N(C,B,yr,"⨄","\\biguplus");N(C,B,yr,"⋂","\\bigcap");N(C,B,yr,"⋃","\\bigcup");N(C,B,yr,"∫","\\int");N(C,B,yr,"∫","\\intop");N(C,B,yr,"∬","\\iint");N(C,B,yr,"∭","\\iiint");N(C,B,yr,"∏","\\prod");N(C,B,yr,"∑","\\sum");N(C,B,yr,"⨂","\\bigotimes");N(C,B,yr,"⨁","\\bigoplus");N(C,B,yr,"⨀","\\bigodot");N(C,B,yr,"∮","\\oint");N(C,B,yr,"∯","\\oiint");N(C,B,yr,"∰","\\oiiint");N(C,B,yr,"⨆","\\bigsqcup");N(C,B,yr,"∫","\\smallint");N(Ee,B,Rd,"…","\\textellipsis");N(C,B,Rd,"…","\\mathellipsis");N(Ee,B,Rd,"…","\\ldots",!0);N(C,B,Rd,"…","\\ldots",!0);N(C,B,Rd,"⋯","\\@cdots",!0);N(C,B,Rd,"⋱","\\ddots",!0);N(C,B,le,"⋮","\\varvdots");N(Ee,B,le,"⋮","\\varvdots");N(C,B,Wn,"ˊ","\\acute");N(C,B,Wn,"ˋ","\\grave");N(C,B,Wn,"¨","\\ddot");N(C,B,Wn,"~","\\tilde");N(C,B,Wn,"ˉ","\\bar");N(C,B,Wn,"˘","\\breve");N(C,B,Wn,"ˇ","\\check");N(C,B,Wn,"^","\\hat");N(C,B,Wn,"⃗","\\vec");N(C,B,Wn,"˙","\\dot");N(C,B,Wn,"˚","\\mathring");N(C,B,st,"","\\@imath");N(C,B,st,"","\\@jmath");N(C,B,le,"ı","ı");N(C,B,le,"ȷ","ȷ");N(Ee,B,le,"ı","\\i",!0);N(Ee,B,le,"ȷ","\\j",!0);N(Ee,B,le,"ß","\\ss",!0);N(Ee,B,le,"æ","\\ae",!0);N(Ee,B,le,"œ","\\oe",!0);N(Ee,B,le,"ø","\\o",!0);N(Ee,B,le,"Æ","\\AE",!0);N(Ee,B,le,"Œ","\\OE",!0);N(Ee,B,le,"Ø","\\O",!0);N(Ee,B,Wn,"ˊ","\\'");N(Ee,B,Wn,"ˋ","\\`");N(Ee,B,Wn,"ˆ","\\^");N(Ee,B,Wn,"˜","\\~");N(Ee,B,Wn,"ˉ","\\=");N(Ee,B,Wn,"˘","\\u");N(Ee,B,Wn,"˙","\\.");N(Ee,B,Wn,"¸","\\c");N(Ee,B,Wn,"˚","\\r");N(Ee,B,Wn,"ˇ","\\v");N(Ee,B,Wn,"¨",'\\"');N(Ee,B,Wn,"˝","\\H");N(Ee,B,Wn,"◯","\\textcircled");var dR={"--":!0,"---":!0,"``":!0,"''":!0};N(Ee,B,le,"–","--",!0);N(Ee,B,le,"–","\\textendash");N(Ee,B,le,"—","---",!0);N(Ee,B,le,"—","\\textemdash");N(Ee,B,le,"‘","`",!0);N(Ee,B,le,"‘","\\textquoteleft");N(Ee,B,le,"’","'",!0);N(Ee,B,le,"’","\\textquoteright");N(Ee,B,le,"“","``",!0);N(Ee,B,le,"“","\\textquotedblleft");N(Ee,B,le,"”","''",!0);N(Ee,B,le,"”","\\textquotedblright");N(C,B,le,"°","\\degree",!0);N(Ee,B,le,"°","\\degree");N(Ee,B,le,"°","\\textdegree",!0);N(C,B,le,"£","\\pounds");N(C,B,le,"£","\\mathsterling",!0);N(Ee,B,le,"£","\\pounds");N(Ee,B,le,"£","\\textsterling",!0);N(C,G,le,"✠","\\maltese");N(Ee,G,le,"✠","\\maltese");var lN='0123456789/@."';for(var Mb=0;Mb0)return Li(i,h,s,n,l.concat(m));if(d){var p,x;if(d==="boldsymbol"){var v=ace(i,s,n,l,r);p=v.fontName,x=[v.fontClass]}else c?(p=mR[d].fontName,x=[d]):(p=_p(d,n.fontWeight,n.fontShape),x=[d,n.fontWeight,n.fontShape]);if(Hx(i,p,s).metrics)return Li(i,p,s,n,l.concat(x));if(dR.hasOwnProperty(i)&&p.slice(0,10)==="Typewriter"){for(var b=[],k=0;k{if(yo(t.classes)!==yo(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize)return!1;if(t.classes.length===1){var n=t.classes[0];if(n==="mbin"||n==="mord")return!1}for(var r in t.style)if(t.style.hasOwnProperty(r)&&t.style[r]!==e.style[r])return!1;for(var s in e.style)if(e.style.hasOwnProperty(s)&&t.style[s]!==e.style[s])return!1;return!0},cce=t=>{for(var e=0;en&&(n=l.height),l.depth>r&&(r=l.depth),l.maxFontSize>s&&(s=l.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=s},Cs=function(e,n,r,s){var i=new S0(e,n,r,s);return E5(i),i},hR=(t,e,n,r)=>new S0(t,e,n,r),uce=function(e,n,r){var s=Cs([e],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Le(s.height),s.maxFontSize=1,s},dce=function(e,n,r,s){var i=new M5(e,n,r,s);return E5(i),i},fR=function(e){var n=new w0(e);return E5(n),n},hce=function(e,n){return e instanceof w0?Cs([],[e],n):e},fce=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,l=1;l{var n=Cs(["mspace"],[],e),r=Kn(t,e);return n.style.marginRight=Le(r),n},_p=function(e,n,r){var s="";switch(e){case"amsrm":s="AMS";break;case"textrm":s="Main";break;case"textsf":s="SansSerif";break;case"texttt":s="Typewriter";break;default:s=e}var i;return n==="textbf"&&r==="textit"?i="BoldItalic":n==="textbf"?i="Bold":n==="textit"?i="Italic":i="Regular",s+"-"+i},mR={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},pR={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},gce=function(e,n){var[r,s,i]=pR[e],l=new bo(r),c=new xl([l],{width:Le(s),height:Le(i),style:"width:"+Le(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),d=hR(["overlay"],[c],n);return d.height=i,d.style.height=Le(i),d.style.width=Le(s),d},pe={fontMap:mR,makeSymbol:Li,mathsym:ice,makeSpan:Cs,makeSvgSpan:hR,makeLineSpan:uce,makeAnchor:dce,makeFragment:fR,wrapFragment:hce,makeVList:mce,makeOrd:lce,makeGlue:pce,staticSvg:gce,svgData:pR,tryCombineChars:cce},Xn={number:3,unit:"mu"},tc={number:4,unit:"mu"},Ka={number:5,unit:"mu"},xce={mord:{mop:Xn,mbin:tc,mrel:Ka,minner:Xn},mop:{mord:Xn,mop:Xn,mrel:Ka,minner:Xn},mbin:{mord:tc,mop:tc,mopen:tc,minner:tc},mrel:{mord:Ka,mop:Ka,mopen:Ka,minner:Ka},mopen:{},mclose:{mop:Xn,mbin:tc,mrel:Ka,minner:Xn},mpunct:{mord:Xn,mop:Xn,mrel:Ka,mopen:Xn,mclose:Xn,mpunct:Xn,minner:Xn},minner:{mord:Xn,mop:Xn,mbin:tc,mrel:Ka,mopen:Xn,mpunct:Xn,minner:Xn}},vce={mord:{mop:Xn},mop:{mord:Xn,mop:Xn},mbin:{},mrel:{},mopen:{},mclose:{mop:Xn},mpunct:{},minner:{mop:Xn}},gR={},Yg={},Kg={};function Qe(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:l}=t,c={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:s},d=0;d{var O=k.classes[0],j=b.classes[0];O==="mbin"&&bce.includes(j)?k.classes[0]="mord":j==="mbin"&&yce.includes(O)&&(b.classes[0]="mord")},{node:p},x,v),hN(i,(b,k)=>{var O=N4(k),j=N4(b),T=O&&j?b.hasClass("mtight")?vce[O][j]:xce[O][j]:null;if(T)return pe.makeGlue(T,h)},{node:p},x,v),i},hN=function t(e,n,r,s,i){s&&e.push(s);for(var l=0;lx=>{e.splice(p+1,0,x),l++})(l)}s&&e.pop()},xR=function(e){return e instanceof w0||e instanceof M5||e instanceof S0&&e.hasClass("enclosing")?e:null},kce=function t(e,n){var r=xR(e);if(r){var s=r.children;if(s.length){if(n==="right")return t(s[s.length-1],"right");if(n==="left")return t(s[0],"left")}}return e},N4=function(e,n){return e?(n&&(e=kce(e,n)),Sce[e.classes[0]]||null):null},qf=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return vl(n.concat(r))},Kt=function(e,n,r){if(!e)return vl();if(Yg[e.type]){var s=Yg[e.type](e,n);if(r&&n.size!==r.size){s=vl(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new De("Got group of unknown type: '"+e.type+"'")};function Dp(t,e){var n=vl(["base"],t,e),r=vl(["strut"]);return r.style.height=Le(n.height+n.depth),n.depth&&(r.style.verticalAlign=Le(-n.depth)),n.children.unshift(r),n}function C4(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=Ar(t,e,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],l=[],c=0;c0&&(i.push(Dp(l,e)),l=[]),i.push(r[c]));l.length>0&&i.push(Dp(l,e));var h;n?(h=Dp(Ar(n,e,!0)),h.classes=["tag"],i.push(h)):s&&i.push(s);var m=vl(["katex-html"],i);if(m.setAttribute("aria-hidden","true"),h){var p=h.children[0];p.style.height=Le(m.height+m.depth),m.depth&&(p.style.verticalAlign=Le(-m.depth))}return m}function vR(t){return new w0(t)}class ni{constructor(e,n,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=n||[],this.classes=r||[]}setAttribute(e,n){this.attributes[e]=n}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&e.setAttribute(n,this.attributes[n]);this.classes.length>0&&(e.className=yo(this.classes));for(var r=0;r0&&(e+=' class ="'+tn.escape(yo(this.classes))+'"'),e+=">";for(var r=0;r",e}toText(){return this.children.map(e=>e.toText()).join("")}}class ga{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return tn.escape(this.toText())}toText(){return this.text}}class Oce{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",Le(this.width)),e}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var _e={MathNode:ni,TextNode:ga,SpaceNode:Oce,newDocumentFragment:vR},Mi=function(e,n,r){return Ln[n][e]&&Ln[n][e].replace&&e.charCodeAt(0)!==55349&&!(dR.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=Ln[n][e].replace),new _e.TextNode(e)},_5=function(e){return e.length===1?e[0]:new _e.MathNode("mrow",e)},D5=function(e,n){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold";var r=n.font;if(!r||r==="mathnormal")return null;var s=e.mode;if(r==="mathit")return"italic";if(r==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(r==="mathbf")return"bold";if(r==="mathbb")return"double-struck";if(r==="mathsfit")return"sans-serif-italic";if(r==="mathfrak")return"fraktur";if(r==="mathscr"||r==="mathcal")return"script";if(r==="mathsf")return"sans-serif";if(r==="mathtt")return"monospace";var i=e.text;if(["\\imath","\\jmath"].includes(i))return null;Ln[s][i]&&Ln[s][i].replace&&(i=Ln[s][i].replace);var l=pe.fontMap[r].fontName;return A5(i,l,s)?pe.fontMap[r].variant:null};function Rb(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof ga&&e.text==="."}else if(t.type==="mo"&&t.children.length===1&&t.getAttribute("separator")==="true"&&t.getAttribute("lspace")==="0em"&&t.getAttribute("rspace")==="0em"){var n=t.children[0];return n instanceof ga&&n.text===","}else return!1}var Fs=function(e,n,r){if(e.length===1){var s=zn(e[0],n);return r&&s instanceof ni&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],l,c=0;c=1&&(l.type==="mn"||Rb(l))){var h=d.children[0];h instanceof ni&&h.type==="mn"&&(h.children=[...l.children,...h.children],i.pop())}else if(l.type==="mi"&&l.children.length===1){var m=l.children[0];if(m instanceof ga&&m.text==="̸"&&(d.type==="mo"||d.type==="mi"||d.type==="mn")){var p=d.children[0];p instanceof ga&&p.text.length>0&&(p.text=p.text.slice(0,1)+"̸"+p.text.slice(1),i.pop())}}}i.push(d),l=d}return i},wo=function(e,n,r){return _5(Fs(e,n,r))},zn=function(e,n){if(!e)return new _e.MathNode("mrow");if(Kg[e.type]){var r=Kg[e.type](e,n);return r}else throw new De("Got group of unknown type: '"+e.type+"'")};function fN(t,e,n,r,s){var i=Fs(t,n),l;i.length===1&&i[0]instanceof ni&&["mrow","mtable"].includes(i[0].type)?l=i[0]:l=new _e.MathNode("mrow",i);var c=new _e.MathNode("annotation",[new _e.TextNode(e)]);c.setAttribute("encoding","application/x-tex");var d=new _e.MathNode("semantics",[l,c]),h=new _e.MathNode("math",[d]);h.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&h.setAttribute("display","block");var m=s?"katex":"katex-mathml";return pe.makeSpan([m],[h])}var yR=function(e){return new sl({style:e.displayMode?at.DISPLAY:at.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},bR=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=pe.makeSpan(r,[e])}return e},jce=function(e,n,r){var s=yR(r),i;if(r.output==="mathml")return fN(e,n,s,r.displayMode,!0);if(r.output==="html"){var l=C4(e,s);i=pe.makeSpan(["katex"],[l])}else{var c=fN(e,n,s,r.displayMode,!1),d=C4(e,s);i=pe.makeSpan(["katex"],[c,d])}return bR(i,r)},Nce=function(e,n,r){var s=yR(r),i=C4(e,s),l=pe.makeSpan(["katex"],[i]);return bR(l,r)},Cce={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Tce=function(e){var n=new _e.MathNode("mo",[new _e.TextNode(Cce[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},Ace={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Mce=function(e){return e.type==="ordgroup"?e.body.length:1},Ece=function(e,n){function r(){var c=4e5,d=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(d)){var h=e,m=Mce(h.base),p,x,v;if(m>5)d==="widehat"||d==="widecheck"?(p=420,c=2364,v=.42,x=d+"4"):(p=312,c=2340,v=.34,x="tilde4");else{var b=[1,1,2,2,3,3][m];d==="widehat"||d==="widecheck"?(c=[0,1062,2364,2364,2364][b],p=[0,239,300,360,420][b],v=[0,.24,.3,.3,.36,.42][b],x=d+b):(c=[0,600,1033,2339,2340][b],p=[0,260,286,306,312][b],v=[0,.26,.286,.3,.306,.34][b],x="tilde"+b)}var k=new bo(x),O=new xl([k],{width:"100%",height:Le(v),viewBox:"0 0 "+c+" "+p,preserveAspectRatio:"none"});return{span:pe.makeSvgSpan([],[O],n),minWidth:0,height:v}}else{var j=[],T=Ace[d],[A,_,D]=T,E=D/1e3,R=A.length,Q,F;if(R===1){var L=T[3];Q=["hide-tail"],F=[L]}else if(R===2)Q=["halfarrow-left","halfarrow-right"],F=["xMinYMin","xMaxYMin"];else if(R===3)Q=["brace-left","brace-center","brace-right"],F=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support - `+R+" children.");for(var U=0;U0&&(s.style.minWidth=Le(i)),s},_ce=function(e,n,r,s,i){var l,c=e.height+e.depth+r+s;if(/fbox|color|angl/.test(n)){if(l=pe.makeSpan(["stretchy",n],[],i),n==="fbox"){var d=i.color&&i.getColor();d&&(l.style.borderColor=d)}}else{var h=[];/^[bx]cancel$/.test(n)&&h.push(new O4({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&h.push(new O4({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var m=new xl(h,{width:"100%",height:Le(c)});l=pe.makeSvgSpan([],[m],i)}return l.height=c,l.style.height=Le(c),l},yl={encloseSpan:_ce,mathMLnode:Tce,svgSpan:Ece};function Nt(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function R5(t){var e=Ux(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function Ux(t){return t&&(t.type==="atom"||rce.hasOwnProperty(t.type))?t:null}var z5=(t,e)=>{var n,r,s;t&&t.type==="supsub"?(r=Nt(t.base,"accent"),n=r.base,t.base=n,s=tce(Kt(t,e)),t.base=r):(r=Nt(t,"accent"),n=r.base);var i=Kt(n,e.havingCrampedStyle()),l=r.isShifty&&tn.isCharacterBox(n),c=0;if(l){var d=tn.getBaseElem(n),h=Kt(d,e.havingCrampedStyle());c=aN(h).skew}var m=r.label==="\\c",p=m?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),x;if(r.isStretchy)x=yl.svgSpan(r,e),x=pe.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:x,wrapperClasses:["svg-align"],wrapperStyle:c>0?{width:"calc(100% - "+Le(2*c)+")",marginLeft:Le(2*c)}:void 0}]},e);else{var v,b;r.label==="\\vec"?(v=pe.staticSvg("vec",e),b=pe.svgData.vec[1]):(v=pe.makeOrd({mode:r.mode,text:r.label},e,"textord"),v=aN(v),v.italic=0,b=v.width,m&&(p+=v.depth)),x=pe.makeSpan(["accent-body"],[v]);var k=r.label==="\\textcircled";k&&(x.classes.push("accent-full"),p=i.height);var O=c;k||(O-=b/2),x.style.left=Le(O),r.label==="\\textcircled"&&(x.style.top=".2em"),x=pe.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-p},{type:"elem",elem:x}]},e)}var j=pe.makeSpan(["mord","accent"],[x],e);return s?(s.children[0]=j,s.height=Math.max(j.height,s.height),s.classes[0]="mord",s):j},wR=(t,e)=>{var n=t.isStretchy?yl.mathMLnode(t.label):new _e.MathNode("mo",[Mi(t.label,t.mode)]),r=new _e.MathNode("mover",[zn(t.base,e),n]);return r.setAttribute("accent","true"),r},Dce=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));Qe({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(t,e)=>{var n=Zg(e[0]),r=!Dce.test(t.funcName),s=!r||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:r,isShifty:s,base:n}},htmlBuilder:z5,mathmlBuilder:wR});Qe({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(t,e)=>{var n=e[0],r=t.parser.mode;return r==="math"&&(t.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+t.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:t.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:z5,mathmlBuilder:wR});Qe({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"accentUnder",mode:n.mode,label:r,base:s}},htmlBuilder:(t,e)=>{var n=Kt(t.base,e),r=yl.svgSpan(t,e),s=t.label==="\\utilde"?.12:0,i=pe.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]},e);return pe.makeSpan(["mord","accentunder"],[i],e)},mathmlBuilder:(t,e)=>{var n=yl.mathMLnode(t.label),r=new _e.MathNode("munder",[zn(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var Rp=t=>{var e=new _e.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Qe({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r,funcName:s}=t;return{type:"xArrow",mode:r.mode,label:s,body:e[0],below:n[0]}},htmlBuilder(t,e){var n=e.style,r=e.havingStyle(n.sup()),s=pe.wrapFragment(Kt(t.body,r,e),e),i=t.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var l;t.below&&(r=e.havingStyle(n.sub()),l=pe.wrapFragment(Kt(t.below,r,e),e),l.classes.push(i+"-arrow-pad"));var c=yl.svgSpan(t,e),d=-e.fontMetrics().axisHeight+.5*c.height,h=-e.fontMetrics().axisHeight-.5*c.height-.111;(s.depth>.25||t.label==="\\xleftequilibrium")&&(h-=s.depth);var m;if(l){var p=-e.fontMetrics().axisHeight+l.height+.5*c.height+.111;m=pe.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:c,shift:d},{type:"elem",elem:l,shift:p}]},e)}else m=pe.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:c,shift:d}]},e);return m.children[0].children[0].children[1].classes.push("svg-align"),pe.makeSpan(["mrel","x-arrow"],[m],e)},mathmlBuilder(t,e){var n=yl.mathMLnode(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var s=Rp(zn(t.body,e));if(t.below){var i=Rp(zn(t.below,e));r=new _e.MathNode("munderover",[n,i,s])}else r=new _e.MathNode("mover",[n,s])}else if(t.below){var l=Rp(zn(t.below,e));r=new _e.MathNode("munder",[n,l])}else r=Rp(),r=new _e.MathNode("mover",[n,r]);return r}});var Rce=pe.makeSpan;function SR(t,e){var n=Ar(t.body,e,!0);return Rce([t.mclass],n,e)}function kR(t,e){var n,r=Fs(t.body,e);return t.mclass==="minner"?n=new _e.MathNode("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new _e.MathNode("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new _e.MathNode("mo",r),t.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):t.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):t.mclass==="mopen"||t.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):t.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}Qe({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:ar(s),isCharacterBox:tn.isCharacterBox(s)}},htmlBuilder:SR,mathmlBuilder:kR});var Vx=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};Qe({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:Vx(e[0]),body:ar(e[1]),isCharacterBox:tn.isCharacterBox(e[1])}}});Qe({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,s=e[1],i=e[0],l;r!=="\\stackrel"?l=Vx(s):l="mrel";var c={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:ar(s)},d={type:"supsub",mode:i.mode,base:c,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:l,body:[d],isCharacterBox:tn.isCharacterBox(d)}},htmlBuilder:SR,mathmlBuilder:kR});Qe({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:Vx(e[0]),body:ar(e[0])}},htmlBuilder(t,e){var n=Ar(t.body,e,!0),r=pe.makeSpan([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=Fs(t.body,e),r=new _e.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var zce={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},mN=()=>({type:"styling",body:[],mode:"math",style:"display"}),pN=t=>t.type==="textord"&&t.text==="@",Pce=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function Bce(t,e,n){var r=zce[t];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var s=n.callFunction("\\\\cdleft",[e[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},l=n.callFunction("\\Big",[i],[]),c=n.callFunction("\\\\cdright",[e[1]],[]),d={type:"ordgroup",mode:"math",body:[s,l,c]};return n.callFunction("\\\\cdparent",[d],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var h={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[h],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Lce(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var n=t.fetch().text;if(n==="&"||n==="\\\\")t.consume();else if(n==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new De("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],s=[r],i=0;i-1))if("<>AV".indexOf(h)>-1)for(var p=0;p<2;p++){for(var x=!0,v=d+1;vAV=|." after @',l[d]);var b=Bce(h,m,t),k={type:"styling",body:[b],mode:"math",style:"display"};r.push(k),c=mN()}i%2===0?r.push(c):r.shift(),r=[],s.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var O=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:O,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}Qe({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:e[0]}},htmlBuilder(t,e){var n=e.havingStyle(e.style.sup()),r=pe.wrapFragment(Kt(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=Le(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new _e.MathNode("mrow",[zn(t.label,e)]);return n=new _e.MathNode("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new _e.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Qe({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(t,e){var{parser:n}=t;return{type:"cdlabelparent",mode:n.mode,fragment:e[0]}},htmlBuilder(t,e){var n=pe.wrapFragment(Kt(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new _e.MathNode("mrow",[zn(t.fragment,e)])}});Qe({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=Nt(e[0],"ordgroup"),s=r.body,i="",l=0;l=1114111)throw new De("\\@char with invalid code point "+i);return d<=65535?h=String.fromCharCode(d):(d-=65536,h=String.fromCharCode((d>>10)+55296,(d&1023)+56320)),{type:"textord",mode:n.mode,text:h}}});var OR=(t,e)=>{var n=Ar(t.body,e.withColor(t.color),!1);return pe.makeFragment(n)},jR=(t,e)=>{var n=Fs(t.body,e.withColor(t.color)),r=new _e.MathNode("mstyle",n);return r.setAttribute("mathcolor",t.color),r};Qe({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=Nt(e[0],"color-token").color,s=e[1];return{type:"color",mode:n.mode,color:r,body:ar(s)}},htmlBuilder:OR,mathmlBuilder:jR});Qe({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,s=Nt(e[0],"color-token").color;n.gullet.macros.set("\\current@color",s);var i=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:s,body:i}},htmlBuilder:OR,mathmlBuilder:jR});Qe({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(t,e,n){var{parser:r}=t,s=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,i=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:i,size:s&&Nt(s,"size").value}},htmlBuilder(t,e){var n=pe.makeSpan(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=Le(Kn(t.size,e)))),n},mathmlBuilder(t,e){var n=new _e.MathNode("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",Le(Kn(t.size,e)))),n}});var T4={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},NR=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new De("Expected a control sequence",t);return e},Ice=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},CR=(t,e,n,r)=>{var s=t.gullet.macros.get(n.text);s==null&&(n.noexpand=!0,s={tokens:[n],numArgs:0,unexpandable:!t.gullet.isExpandable(n.text)}),t.gullet.macros.set(e,s,r)};Qe({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(t){var{parser:e,funcName:n}=t;e.consumeSpaces();var r=e.fetch();if(T4[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=T4[r.text]),Nt(e.parseFunction(),"internal");throw new De("Invalid token after macro prefix",r)}});Qe({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=e.gullet.popToken(),s=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new De("Expected a control sequence",r);for(var i=0,l,c=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){l=e.gullet.future(),c[i].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new De('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new De('Argument number "'+r.text+'" out of order');i++,c.push([])}else{if(r.text==="EOF")throw new De("Expected a macro definition");c[i].push(r.text)}var{tokens:d}=e.gullet.consumeArg();return l&&d.unshift(l),(n==="\\edef"||n==="\\xdef")&&(d=e.gullet.expandTokens(d),d.reverse()),e.gullet.macros.set(s,{tokens:d,numArgs:i,delimiters:c},n===T4[n]),{type:"internal",mode:e.mode}}});Qe({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=NR(e.gullet.popToken());e.gullet.consumeSpaces();var s=Ice(e);return CR(e,r,s,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});Qe({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=NR(e.gullet.popToken()),s=e.gullet.popToken(),i=e.gullet.popToken();return CR(e,r,i,n==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});var Vh=function(e,n,r){var s=Ln.math[e]&&Ln.math[e].replace,i=A5(s||e,n,r);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return i},P5=function(e,n,r,s){var i=r.havingBaseStyle(n),l=pe.makeSpan(s.concat(i.sizingClasses(r)),[e],r),c=i.sizeMultiplier/r.sizeMultiplier;return l.height*=c,l.depth*=c,l.maxFontSize=i.sizeMultiplier,l},TR=function(e,n,r){var s=n.havingBaseStyle(r),i=(1-n.sizeMultiplier/s.sizeMultiplier)*n.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=Le(i),e.height-=i,e.depth+=i},qce=function(e,n,r,s,i,l){var c=pe.makeSymbol(e,"Main-Regular",i,s),d=P5(c,n,s,l);return r&&TR(d,s,n),d},Fce=function(e,n,r,s){return pe.makeSymbol(e,"Size"+n+"-Regular",r,s)},AR=function(e,n,r,s,i,l){var c=Fce(e,n,i,s),d=P5(pe.makeSpan(["delimsizing","size"+n],[c],s),at.TEXT,s,l);return r&&TR(d,s,at.TEXT),d},zb=function(e,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=pe.makeSpan(["delimsizinginner",s],[pe.makeSpan([],[pe.makeSymbol(e,n,r)])]);return{type:"elem",elem:i}},Pb=function(e,n,r){var s=pa["Size4-Regular"][e.charCodeAt(0)]?pa["Size4-Regular"][e.charCodeAt(0)][4]:pa["Size1-Regular"][e.charCodeAt(0)][4],i=new bo("inner",Voe(e,Math.round(1e3*n))),l=new xl([i],{width:Le(s),height:Le(n),style:"width:"+Le(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),c=pe.makeSvgSpan([],[l],r);return c.height=n,c.style.height=Le(n),c.style.width=Le(s),{type:"elem",elem:c}},A4=.008,zp={type:"kern",size:-1*A4},Qce=["|","\\lvert","\\rvert","\\vert"],$ce=["\\|","\\lVert","\\rVert","\\Vert"],MR=function(e,n,r,s,i,l){var c,d,h,m,p="",x=0;c=h=m=e,d=null;var v="Size1-Regular";e==="\\uparrow"?h=m="⏐":e==="\\Uparrow"?h=m="‖":e==="\\downarrow"?c=h="⏐":e==="\\Downarrow"?c=h="‖":e==="\\updownarrow"?(c="\\uparrow",h="⏐",m="\\downarrow"):e==="\\Updownarrow"?(c="\\Uparrow",h="‖",m="\\Downarrow"):Qce.includes(e)?(h="∣",p="vert",x=333):$ce.includes(e)?(h="∥",p="doublevert",x=556):e==="["||e==="\\lbrack"?(c="⎡",h="⎢",m="⎣",v="Size4-Regular",p="lbrack",x=667):e==="]"||e==="\\rbrack"?(c="⎤",h="⎥",m="⎦",v="Size4-Regular",p="rbrack",x=667):e==="\\lfloor"||e==="⌊"?(h=c="⎢",m="⎣",v="Size4-Regular",p="lfloor",x=667):e==="\\lceil"||e==="⌈"?(c="⎡",h=m="⎢",v="Size4-Regular",p="lceil",x=667):e==="\\rfloor"||e==="⌋"?(h=c="⎥",m="⎦",v="Size4-Regular",p="rfloor",x=667):e==="\\rceil"||e==="⌉"?(c="⎤",h=m="⎥",v="Size4-Regular",p="rceil",x=667):e==="("||e==="\\lparen"?(c="⎛",h="⎜",m="⎝",v="Size4-Regular",p="lparen",x=875):e===")"||e==="\\rparen"?(c="⎞",h="⎟",m="⎠",v="Size4-Regular",p="rparen",x=875):e==="\\{"||e==="\\lbrace"?(c="⎧",d="⎨",m="⎩",h="⎪",v="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(c="⎫",d="⎬",m="⎭",h="⎪",v="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(c="⎧",m="⎩",h="⎪",v="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(c="⎫",m="⎭",h="⎪",v="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(c="⎧",m="⎭",h="⎪",v="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(c="⎫",m="⎩",h="⎪",v="Size4-Regular");var b=Vh(c,v,i),k=b.height+b.depth,O=Vh(h,v,i),j=O.height+O.depth,T=Vh(m,v,i),A=T.height+T.depth,_=0,D=1;if(d!==null){var E=Vh(d,v,i);_=E.height+E.depth,D=2}var R=k+A+_,Q=Math.max(0,Math.ceil((n-R)/(D*j))),F=R+Q*D*j,L=s.fontMetrics().axisHeight;r&&(L*=s.sizeMultiplier);var U=F/2-L,V=[];if(p.length>0){var de=F-k-A,W=Math.round(F*1e3),J=Woe(p,Math.round(de*1e3)),$=new bo(p,J),ae=(x/1e3).toFixed(3)+"em",ne=(W/1e3).toFixed(3)+"em",ce=new xl([$],{width:ae,height:ne,viewBox:"0 0 "+x+" "+W}),z=pe.makeSvgSpan([],[ce],s);z.height=W/1e3,z.style.width=ae,z.style.height=ne,V.push({type:"elem",elem:z})}else{if(V.push(zb(m,v,i)),V.push(zp),d===null){var xe=F-k-A+2*A4;V.push(Pb(h,xe,s))}else{var Y=(F-k-A-_)/2+2*A4;V.push(Pb(h,Y,s)),V.push(zp),V.push(zb(d,v,i)),V.push(zp),V.push(Pb(h,Y,s))}V.push(zp),V.push(zb(c,v,i))}var P=s.havingBaseStyle(at.TEXT),K=pe.makeVList({positionType:"bottom",positionData:U,children:V},P);return P5(pe.makeSpan(["delimsizing","mult"],[K],P),at.TEXT,s,l)},Bb=80,Lb=.08,Ib=function(e,n,r,s,i){var l=Uoe(e,s,r),c=new bo(e,l),d=new xl([c],{width:"400em",height:Le(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return pe.makeSvgSpan(["hide-tail"],[d],i)},Hce=function(e,n){var r=n.havingBaseSizing(),s=RR("\\surd",e*r.sizeMultiplier,DR,r),i=r.sizeMultiplier,l=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),c,d=0,h=0,m=0,p;return s.type==="small"?(m=1e3+1e3*l+Bb,e<1?i=1:e<1.4&&(i=.7),d=(1+l+Lb)/i,h=(1+l)/i,c=Ib("sqrtMain",d,m,l,n),c.style.minWidth="0.853em",p=.833/i):s.type==="large"?(m=(1e3+Bb)*cf[s.size],h=(cf[s.size]+l)/i,d=(cf[s.size]+l+Lb)/i,c=Ib("sqrtSize"+s.size,d,m,l,n),c.style.minWidth="1.02em",p=1/i):(d=e+l+Lb,h=e+l,m=Math.floor(1e3*e+l)+Bb,c=Ib("sqrtTall",d,m,l,n),c.style.minWidth="0.742em",p=1.056),c.height=h,c.style.height=Le(d),{span:c,advanceWidth:p,ruleWidth:(n.fontMetrics().sqrtRuleThickness+l)*i}},ER=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Uce=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],_R=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],cf=[0,1.2,1.8,2.4,3],Vce=function(e,n,r,s,i){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),ER.includes(e)||_R.includes(e))return AR(e,n,!1,r,s,i);if(Uce.includes(e))return MR(e,cf[n],!1,r,s,i);throw new De("Illegal delimiter: '"+e+"'")},Wce=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Gce=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"stack"}],DR=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Xce=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},RR=function(e,n,r,s){for(var i=Math.min(2,3-s.style.size),l=i;ln)return r[l]}return r[r.length-1]},zR=function(e,n,r,s,i,l){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var c;_R.includes(e)?c=Wce:ER.includes(e)?c=DR:c=Gce;var d=RR(e,n,c,s);return d.type==="small"?qce(e,d.style,r,s,i,l):d.type==="large"?AR(e,d.size,r,s,i,l):MR(e,n,r,s,i,l)},Yce=function(e,n,r,s,i,l){var c=s.fontMetrics().axisHeight*s.sizeMultiplier,d=901,h=5/s.fontMetrics().ptPerEm,m=Math.max(n-c,r+c),p=Math.max(m/500*d,2*m-h);return zR(e,p,!0,s,i,l)},dl={sqrtImage:Hce,sizedDelim:Vce,sizeToMaxHeight:cf,customSizedDelim:zR,leftRightDelim:Yce},gN={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Kce=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function Wx(t,e){var n=Ux(t);if(n&&Kce.includes(n.text))return n;throw n?new De("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new De("Invalid delimiter type '"+t.type+"'",t)}Qe({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,e)=>{var n=Wx(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:gN[t.funcName].size,mclass:gN[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?pe.makeSpan([t.mclass]):dl.sizedDelim(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(Mi(t.delim,t.mode));var n=new _e.MathNode("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Le(dl.sizeToMaxHeight[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function xN(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Qe({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=t.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new De("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:Wx(e[0],t).text,color:n}}});Qe({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Wx(e[0],t),r=t.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=Nt(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(t,e)=>{xN(t);for(var n=Ar(t.body,e,!0,["mopen","mclose"]),r=0,s=0,i=!1,l=0;l{xN(t);var n=Fs(t.body,e);if(t.left!=="."){var r=new _e.MathNode("mo",[Mi(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var s=new _e.MathNode("mo",[Mi(t.right,t.mode)]);s.setAttribute("fence","true"),t.rightColor&&s.setAttribute("mathcolor",t.rightColor),n.push(s)}return _5(n)}});Qe({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Wx(e[0],t);if(!t.parser.leftrightDepth)throw new De("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=qf(e,[]);else{n=dl.sizedDelim(t.delim,1,e,t.mode,[]);var r={delim:t.delim,options:e};n.isMiddle=r}return n},mathmlBuilder:(t,e)=>{var n=t.delim==="\\vert"||t.delim==="|"?Mi("|","text"):Mi(t.delim,t.mode),r=new _e.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var B5=(t,e)=>{var n=pe.wrapFragment(Kt(t.body,e),e),r=t.label.slice(1),s=e.sizeMultiplier,i,l=0,c=tn.isCharacterBox(t.body);if(r==="sout")i=pe.makeSpan(["stretchy","sout"]),i.height=e.fontMetrics().defaultRuleThickness/s,l=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var d=Kn({number:.6,unit:"pt"},e),h=Kn({number:.35,unit:"ex"},e),m=e.havingBaseSizing();s=s/m.sizeMultiplier;var p=n.height+n.depth+d+h;n.style.paddingLeft=Le(p/2+d);var x=Math.floor(1e3*p*s),v=$oe(x),b=new xl([new bo("phase",v)],{width:"400em",height:Le(x/1e3),viewBox:"0 0 400000 "+x,preserveAspectRatio:"xMinYMin slice"});i=pe.makeSvgSpan(["hide-tail"],[b],e),i.style.height=Le(p),l=n.depth+d+h}else{/cancel/.test(r)?c||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var k=0,O=0,j=0;/box/.test(r)?(j=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),k=e.fontMetrics().fboxsep+(r==="colorbox"?0:j),O=k):r==="angl"?(j=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),k=4*j,O=Math.max(0,.25-n.depth)):(k=c?.2:0,O=k),i=yl.encloseSpan(n,r,k,O,e),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Le(j)):r==="angl"&&j!==.049&&(i.style.borderTopWidth=Le(j),i.style.borderRightWidth=Le(j)),l=n.depth+O,t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor,t.borderColor&&(i.style.borderColor=t.borderColor))}var T;if(t.backgroundColor)T=pe.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:l},{type:"elem",elem:n,shift:0}]},e);else{var A=/cancel|phase/.test(r)?["svg-align"]:[];T=pe.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:l,wrapperClasses:A}]},e)}return/cancel/.test(r)&&(T.height=n.height,T.depth=n.depth),/cancel/.test(r)&&!c?pe.makeSpan(["mord","cancel-lap"],[T],e):pe.makeSpan(["mord"],[T],e)},L5=(t,e)=>{var n=0,r=new _e.MathNode(t.label.indexOf("colorbox")>-1?"mpadded":"menclose",[zn(t.body,e)]);switch(t.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),t.label==="\\fcolorbox"){var s=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+s+"em solid "+String(t.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};Qe({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Nt(e[0],"color-token").color,l=e[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:l}},htmlBuilder:B5,mathmlBuilder:L5});Qe({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Nt(e[0],"color-token").color,l=Nt(e[1],"color-token").color,c=e[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:l,borderColor:i,body:c}},htmlBuilder:B5,mathmlBuilder:L5});Qe({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\fbox",body:e[0]}}});Qe({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"enclose",mode:n.mode,label:r,body:s}},htmlBuilder:B5,mathmlBuilder:L5});Qe({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\angl",body:e[0]}}});var PR={};function Ca(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:l}=t,c={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},d=0;d{var e=t.parser.settings;if(!e.displayMode)throw new De("{"+t.envName+"} can be used only in display mode.")};function I5(t){if(t.indexOf("ed")===-1)return t.indexOf("*")===-1}function Mo(t,e,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:l,colSeparationType:c,autoTag:d,singleRow:h,emptySingleRow:m,maxNumCols:p,leqno:x}=e;if(t.gullet.beginGroup(),h||t.gullet.macros.set("\\cr","\\\\\\relax"),!l){var v=t.gullet.expandMacroAsText("\\arraystretch");if(v==null)l=1;else if(l=parseFloat(v),!l||l<0)throw new De("Invalid \\arraystretch: "+v)}t.gullet.beginGroup();var b=[],k=[b],O=[],j=[],T=d!=null?[]:void 0;function A(){d&&t.gullet.macros.set("\\@eqnsw","1",!0)}function _(){T&&(t.gullet.macros.get("\\df@tag")?(T.push(t.subparse([new ii("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):T.push(!!d&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(A(),j.push(vN(t));;){var D=t.parseExpression(!1,h?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),D={type:"ordgroup",mode:t.mode,body:D},n&&(D={type:"styling",mode:t.mode,style:n,body:[D]}),b.push(D);var E=t.fetch().text;if(E==="&"){if(p&&b.length===p){if(h||c)throw new De("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(E==="\\end"){_(),b.length===1&&D.type==="styling"&&D.body[0].body.length===0&&(k.length>1||!m)&&k.pop(),j.length0&&(A+=.25),h.push({pos:A,isDashed:Jn[nn]})}for(_(l[0]),r=0;r0&&(U+=T,RJn))for(r=0;r=c)){var ve=void 0;(s>0||e.hskipBeforeAndAfter)&&(ve=tn.deflt(Y.pregap,x),ve!==0&&(J=pe.makeSpan(["arraycolsep"],[]),J.style.width=Le(ve),W.push(J)));var Re=[];for(r=0;r0){for(var Oe=pe.makeLineSpan("hline",n,m),nt=pe.makeLineSpan("hdashline",n,m),ut=[{type:"elem",elem:d,shift:0}];h.length>0;){var Ct=h.pop(),In=Ct.pos-V;Ct.isDashed?ut.push({type:"elem",elem:nt,shift:In}):ut.push({type:"elem",elem:Oe,shift:In})}d=pe.makeVList({positionType:"individualShift",children:ut},n)}if(ae.length===0)return pe.makeSpan(["mord"],[d],n);var Tn=pe.makeVList({positionType:"individualShift",children:ae},n);return Tn=pe.makeSpan(["tag"],[Tn],n),pe.makeFragment([d,Tn])},Zce={c:"center ",l:"left ",r:"right "},Aa=function(e,n){for(var r=[],s=new _e.MathNode("mtd",[],["mtr-glue"]),i=new _e.MathNode("mtd",[],["mml-eqn-num"]),l=0;l0){var b=e.cols,k="",O=!1,j=0,T=b.length;b[0].type==="separator"&&(x+="top ",j=1),b[b.length-1].type==="separator"&&(x+="bottom ",T-=1);for(var A=j;A0?"left ":"",x+=Q[Q.length-1].length>0?"right ":"";for(var F=1;F-1?"alignat":"align",i=e.envName==="split",l=Mo(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:I5(e.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),c,d=0,h={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var m="",p=0;p0&&v&&(O=1),r[b]={type:"align",align:k,pregap:O,postgap:0}}return l.colSeparationType=v?"align":"alignat",l};Ca({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=Ux(e[0]),r=n?[e[0]]:Nt(e[0],"ordgroup").body,s=r.map(function(l){var c=R5(l),d=c.text;if("lcr".indexOf(d)!==-1)return{type:"align",align:d};if(d==="|")return{type:"separator",separator:"|"};if(d===":")return{type:"separator",separator:":"};throw new De("Unknown column alignment: "+d,l)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return Mo(t.parser,i,q5(t.envName))},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(t.envName.charAt(t.envName.length-1)==="*"){var s=t.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),n=s.fetch().text,"lcr".indexOf(n)===-1)throw new De("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=Mo(t.parser,r,q5(t.envName)),l=Math.max(0,...i.body.map(c=>c.length));return i.cols=new Array(l).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[i],left:e[0],right:e[1],rightColor:void 0}:i},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=Mo(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=Ux(e[0]),r=n?[e[0]]:Nt(e[0],"ordgroup").body,s=r.map(function(l){var c=R5(l),d=c.text;if("lc".indexOf(d)!==-1)return{type:"align",align:d};throw new De("Unknown column alignment: "+d,l)});if(s.length>1)throw new De("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5};if(i=Mo(t.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new De("{subarray} can contain only one column");return i},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=Mo(t.parser,e,q5(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.indexOf("r")>-1?".":"\\{",right:t.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:LR,htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){["gather","gather*"].includes(t.envName)&&Gx(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:I5(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return Mo(t.parser,e,"display")},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:LR,htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){Gx(t);var e={autoTag:I5(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return Mo(t.parser,e,"display")},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["CD"],props:{numArgs:0},handler(t){return Gx(t),Lce(t.parser)},htmlBuilder:Ta,mathmlBuilder:Aa});q("\\nonumber","\\gdef\\@eqnsw{0}");q("\\notag","\\nonumber");Qe({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new De(t.funcName+" valid only within array environment")}});var yN=PR;Qe({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];if(s.type!=="ordgroup")throw new De("Invalid environment name",s);for(var i="",l=0;l{var n=t.font,r=e.withFont(n);return Kt(t.body,r)},qR=(t,e)=>{var n=t.font,r=e.withFont(n);return zn(t.body,r)},bN={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Qe({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=Zg(e[0]),i=r;return i in bN&&(i=bN[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:IR,mathmlBuilder:qR});Qe({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0],s=tn.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:Vx(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:s}}});Qe({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,breakOnTokenText:s}=t,{mode:i}=n,l=n.parseExpression(!0,s),c="math"+r.slice(1);return{type:"font",mode:i,font:c,body:{type:"ordgroup",mode:n.mode,body:l}}},htmlBuilder:IR,mathmlBuilder:qR});var FR=(t,e)=>{var n=e;return t==="display"?n=n.id>=at.SCRIPT.id?n.text():at.DISPLAY:t==="text"&&n.size===at.DISPLAY.size?n=at.TEXT:t==="script"?n=at.SCRIPT:t==="scriptscript"&&(n=at.SCRIPTSCRIPT),n},F5=(t,e)=>{var n=FR(t.size,e.style),r=n.fracNum(),s=n.fracDen(),i;i=e.havingStyle(r);var l=Kt(t.numer,i,e);if(t.continued){var c=8.5/e.fontMetrics().ptPerEm,d=3.5/e.fontMetrics().ptPerEm;l.height=l.height0?b=3*x:b=7*x,k=e.fontMetrics().denom1):(p>0?(v=e.fontMetrics().num2,b=x):(v=e.fontMetrics().num3,b=3*x),k=e.fontMetrics().denom2);var O;if(m){var T=e.fontMetrics().axisHeight;v-l.depth-(T+.5*p){var n=new _e.MathNode("mfrac",[zn(t.numer,e),zn(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=Kn(t.barSize,e);n.setAttribute("linethickness",Le(r))}var s=FR(t.size,e.style);if(s.size!==e.style.size){n=new _e.MathNode("mstyle",[n]);var i=s.size===at.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",i),n.setAttribute("scriptlevel","0")}if(t.leftDelim!=null||t.rightDelim!=null){var l=[];if(t.leftDelim!=null){var c=new _e.MathNode("mo",[new _e.TextNode(t.leftDelim.replace("\\",""))]);c.setAttribute("fence","true"),l.push(c)}if(l.push(n),t.rightDelim!=null){var d=new _e.MathNode("mo",[new _e.TextNode(t.rightDelim.replace("\\",""))]);d.setAttribute("fence","true"),l.push(d)}return _5(l)}return n};Qe({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1],l,c=null,d=null,h="auto";switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":l=!0;break;case"\\\\atopfrac":l=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":l=!1,c="(",d=")";break;case"\\\\bracefrac":l=!1,c="\\{",d="\\}";break;case"\\\\brackfrac":l=!1,c="[",d="]";break;default:throw new Error("Unrecognized genfrac command")}switch(r){case"\\dfrac":case"\\dbinom":h="display";break;case"\\tfrac":case"\\tbinom":h="text";break}return{type:"genfrac",mode:n.mode,continued:!1,numer:s,denom:i,hasBarLine:l,leftDelim:c,rightDelim:d,size:h,barSize:null}},htmlBuilder:F5,mathmlBuilder:Q5});Qe({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1];return{type:"genfrac",mode:n.mode,continued:!0,numer:s,denom:i,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});Qe({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(t){var{parser:e,funcName:n,token:r}=t,s;switch(n){case"\\over":s="\\frac";break;case"\\choose":s="\\binom";break;case"\\atop":s="\\\\atopfrac";break;case"\\brace":s="\\\\bracefrac";break;case"\\brack":s="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:s,token:r}}});var wN=["display","text","script","scriptscript"],SN=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};Qe({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(t,e){var{parser:n}=t,r=e[4],s=e[5],i=Zg(e[0]),l=i.type==="atom"&&i.family==="open"?SN(i.text):null,c=Zg(e[1]),d=c.type==="atom"&&c.family==="close"?SN(c.text):null,h=Nt(e[2],"size"),m,p=null;h.isBlank?m=!0:(p=h.value,m=p.number>0);var x="auto",v=e[3];if(v.type==="ordgroup"){if(v.body.length>0){var b=Nt(v.body[0],"textord");x=wN[Number(b.text)]}}else v=Nt(v,"textord"),x=wN[Number(v.text)];return{type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:m,barSize:p,leftDelim:l,rightDelim:d,size:x}},htmlBuilder:F5,mathmlBuilder:Q5});Qe({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(t,e){var{parser:n,funcName:r,token:s}=t;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:Nt(e[0],"size").value,token:s}}});Qe({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=Toe(Nt(e[1],"infix").size),l=e[2],c=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:l,continued:!1,hasBarLine:c,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:F5,mathmlBuilder:Q5});var QR=(t,e)=>{var n=e.style,r,s;t.type==="supsub"?(r=t.sup?Kt(t.sup,e.havingStyle(n.sup()),e):Kt(t.sub,e.havingStyle(n.sub()),e),s=Nt(t.base,"horizBrace")):s=Nt(t,"horizBrace");var i=Kt(s.base,e.havingBaseStyle(at.DISPLAY)),l=yl.svgSpan(s,e),c;if(s.isOver?(c=pe.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:l}]},e),c.children[0].children[0].children[1].classes.push("svg-align")):(c=pe.makeVList({positionType:"bottom",positionData:i.depth+.1+l.height,children:[{type:"elem",elem:l},{type:"kern",size:.1},{type:"elem",elem:i}]},e),c.children[0].children[0].children[0].classes.push("svg-align")),r){var d=pe.makeSpan(["mord",s.isOver?"mover":"munder"],[c],e);s.isOver?c=pe.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:d},{type:"kern",size:.2},{type:"elem",elem:r}]},e):c=pe.makeVList({positionType:"bottom",positionData:d.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:d}]},e)}return pe.makeSpan(["mord",s.isOver?"mover":"munder"],[c],e)},Jce=(t,e)=>{var n=yl.mathMLnode(t.label);return new _e.MathNode(t.isOver?"mover":"munder",[zn(t.base,e),n])};Qe({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"horizBrace",mode:n.mode,label:r,isOver:/^\\over/.test(r),base:e[0]}},htmlBuilder:QR,mathmlBuilder:Jce});Qe({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],s=Nt(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:ar(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=Ar(t.body,e,!1);return pe.makeAnchor(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=wo(t.body,e);return n instanceof ni||(n=new ni("mrow",[n])),n.setAttribute("href",t.href),n}});Qe({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=Nt(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var s=[],i=0;i{var{parser:n,funcName:r,token:s}=t,i=Nt(e[0],"raw").string,l=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var c,d={};switch(r){case"\\htmlClass":d.class=i,c={command:"\\htmlClass",class:i};break;case"\\htmlId":d.id=i,c={command:"\\htmlId",id:i};break;case"\\htmlStyle":d.style=i,c={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var h=i.split(","),m=0;m{var n=Ar(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var s=pe.makeSpan(r,n,e);for(var i in t.attributes)i!=="class"&&t.attributes.hasOwnProperty(i)&&s.setAttribute(i,t.attributes[i]);return s},mathmlBuilder:(t,e)=>wo(t.body,e)});Qe({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:ar(e[0]),mathml:ar(e[1])}},htmlBuilder:(t,e)=>{var n=Ar(t.html,e,!1);return pe.makeFragment(n)},mathmlBuilder:(t,e)=>wo(t.mathml,e)});var qb=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!n)throw new De("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!lR(r))throw new De("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Qe({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(t,e,n)=>{var{parser:r}=t,s={number:0,unit:"em"},i={number:.9,unit:"em"},l={number:0,unit:"em"},c="";if(n[0])for(var d=Nt(n[0],"raw").string,h=d.split(","),m=0;m{var n=Kn(t.height,e),r=0;t.totalheight.number>0&&(r=Kn(t.totalheight,e)-n);var s=0;t.width.number>0&&(s=Kn(t.width,e));var i={height:Le(n+r)};s>0&&(i.width=Le(s)),r>0&&(i.verticalAlign=Le(-r));var l=new Joe(t.src,t.alt,i);return l.height=n,l.depth=r,l},mathmlBuilder:(t,e)=>{var n=new _e.MathNode("mglyph",[]);n.setAttribute("alt",t.alt);var r=Kn(t.height,e),s=0;if(t.totalheight.number>0&&(s=Kn(t.totalheight,e)-r,n.setAttribute("valign",Le(-s))),n.setAttribute("height",Le(r+s)),t.width.number>0){var i=Kn(t.width,e);n.setAttribute("width",Le(i))}return n.setAttribute("src",t.src),n}});Qe({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=Nt(e[0],"size");if(n.settings.strict){var i=r[1]==="m",l=s.value.unit==="mu";i?(l||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):l&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:s.value}},htmlBuilder(t,e){return pe.makeGlue(t.dimension,e)},mathmlBuilder(t,e){var n=Kn(t.dimension,e);return new _e.SpaceNode(n)}});Qe({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:s}},htmlBuilder:(t,e)=>{var n;t.alignment==="clap"?(n=pe.makeSpan([],[Kt(t.body,e)]),n=pe.makeSpan(["inner"],[n],e)):n=pe.makeSpan(["inner"],[Kt(t.body,e)]);var r=pe.makeSpan(["fix"],[]),s=pe.makeSpan([t.alignment],[n,r],e),i=pe.makeSpan(["strut"]);return i.style.height=Le(s.height+s.depth),s.depth&&(i.style.verticalAlign=Le(-s.depth)),s.children.unshift(i),s=pe.makeSpan(["thinbox"],[s],e),pe.makeSpan(["mord","vbox"],[s],e)},mathmlBuilder:(t,e)=>{var n=new _e.MathNode("mpadded",[zn(t.body,e)]);if(t.alignment!=="rlap"){var r=t.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});Qe({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){var{funcName:n,parser:r}=t,s=r.mode;r.switchMode("math");var i=n==="\\("?"\\)":"$",l=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",body:l}}});Qe({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new De("Mismatched "+t.funcName)}});var kN=(t,e)=>{switch(e.style.size){case at.DISPLAY.size:return t.display;case at.TEXT.size:return t.text;case at.SCRIPT.size:return t.script;case at.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};Qe({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:ar(e[0]),text:ar(e[1]),script:ar(e[2]),scriptscript:ar(e[3])}},htmlBuilder:(t,e)=>{var n=kN(t,e),r=Ar(n,e,!1);return pe.makeFragment(r)},mathmlBuilder:(t,e)=>{var n=kN(t,e);return wo(n,e)}});var $R=(t,e,n,r,s,i,l)=>{t=pe.makeSpan([],[t]);var c=n&&tn.isCharacterBox(n),d,h;if(e){var m=Kt(e,r.havingStyle(s.sup()),r);h={elem:m,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-m.depth)}}if(n){var p=Kt(n,r.havingStyle(s.sub()),r);d={elem:p,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-p.height)}}var x;if(h&&d){var v=r.fontMetrics().bigOpSpacing5+d.elem.height+d.elem.depth+d.kern+t.depth+l;x=pe.makeVList({positionType:"bottom",positionData:v,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:d.elem,marginLeft:Le(-i)},{type:"kern",size:d.kern},{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Le(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(d){var b=t.height-l;x=pe.makeVList({positionType:"top",positionData:b,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:d.elem,marginLeft:Le(-i)},{type:"kern",size:d.kern},{type:"elem",elem:t}]},r)}else if(h){var k=t.depth+l;x=pe.makeVList({positionType:"bottom",positionData:k,children:[{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Le(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else return t;var O=[x];if(d&&i!==0&&!c){var j=pe.makeSpan(["mspace"],[],r);j.style.marginRight=Le(i),O.unshift(j)}return pe.makeSpan(["mop","op-limits"],O,r)},HR=["\\smallint"],zd=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Nt(t.base,"op"),s=!0):i=Nt(t,"op");var l=e.style,c=!1;l.size===at.DISPLAY.size&&i.symbol&&!HR.includes(i.name)&&(c=!0);var d;if(i.symbol){var h=c?"Size2-Regular":"Size1-Regular",m="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(m=i.name.slice(1),i.name=m==="oiint"?"\\iint":"\\iiint"),d=pe.makeSymbol(i.name,h,"math",e,["mop","op-symbol",c?"large-op":"small-op"]),m.length>0){var p=d.italic,x=pe.staticSvg(m+"Size"+(c?"2":"1"),e);d=pe.makeVList({positionType:"individualShift",children:[{type:"elem",elem:d,shift:0},{type:"elem",elem:x,shift:c?.08:0}]},e),i.name="\\"+m,d.classes.unshift("mop"),d.italic=p}}else if(i.body){var v=Ar(i.body,e,!0);v.length===1&&v[0]instanceof Ai?(d=v[0],d.classes[0]="mop"):d=pe.makeSpan(["mop"],v,e)}else{for(var b=[],k=1;k{var n;if(t.symbol)n=new ni("mo",[Mi(t.name,t.mode)]),HR.includes(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new ni("mo",Fs(t.body,e));else{n=new ni("mi",[new ga(t.name.slice(1))]);var r=new ni("mo",[Mi("⁡","text")]);t.parentIsSupSub?n=new ni("mrow",[n,r]):n=vR([n,r])}return n},eue={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Qe({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=r;return s.length===1&&(s=eue[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:zd,mathmlBuilder:k0});Qe({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:ar(r)}},htmlBuilder:zd,mathmlBuilder:k0});var tue={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Qe({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:zd,mathmlBuilder:k0});Qe({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:zd,mathmlBuilder:k0});Qe({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t,r=n;return r.length===1&&(r=tue[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:zd,mathmlBuilder:k0});var UR=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Nt(t.base,"operatorname"),s=!0):i=Nt(t,"operatorname");var l;if(i.body.length>0){for(var c=i.body.map(p=>{var x=p.text;return typeof x=="string"?{type:"textord",mode:p.mode,text:x}:p}),d=Ar(c,e.withFont("mathrm"),!0),h=0;h{for(var n=Fs(t.body,e.withFont("mathrm")),r=!0,s=0;sm.toText()).join("");n=[new _e.TextNode(c)]}var d=new _e.MathNode("mi",n);d.setAttribute("mathvariant","normal");var h=new _e.MathNode("mo",[Mi("⁡","text")]);return t.parentIsSupSub?new _e.MathNode("mrow",[d,h]):_e.newDocumentFragment([d,h])};Qe({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"operatorname",mode:n.mode,body:ar(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:UR,mathmlBuilder:nue});q("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Rc({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?pe.makeFragment(Ar(t.body,e,!1)):pe.makeSpan(["mord"],Ar(t.body,e,!0),e)},mathmlBuilder(t,e){return wo(t.body,e,!0)}});Qe({type:"overline",names:["\\overline"],props:{numArgs:1},handler(t,e){var{parser:n}=t,r=e[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(t,e){var n=Kt(t.body,e.havingCrampedStyle()),r=pe.makeLineSpan("overline-line",e),s=e.fontMetrics().defaultRuleThickness,i=pe.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]},e);return pe.makeSpan(["mord","overline"],[i],e)},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[new _e.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new _e.MathNode("mover",[zn(t.body,e),n]);return r.setAttribute("accent","true"),r}});Qe({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"phantom",mode:n.mode,body:ar(r)}},htmlBuilder:(t,e)=>{var n=Ar(t.body,e.withPhantom(),!1);return pe.makeFragment(n)},mathmlBuilder:(t,e)=>{var n=Fs(t.body,e);return new _e.MathNode("mphantom",n)}});Qe({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=pe.makeSpan([],[Kt(t.body,e.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r{var n=Fs(ar(t.body),e),r=new _e.MathNode("mphantom",n),s=new _e.MathNode("mpadded",[r]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});Qe({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=pe.makeSpan(["inner"],[Kt(t.body,e.withPhantom())]),r=pe.makeSpan(["fix"],[]);return pe.makeSpan(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=Fs(ar(t.body),e),r=new _e.MathNode("mphantom",n),s=new _e.MathNode("mpadded",[r]);return s.setAttribute("width","0px"),s}});Qe({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=Nt(e[0],"size").value,s=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(t,e){var n=Kt(t.body,e),r=Kn(t.dy,e);return pe.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){var n=new _e.MathNode("mpadded",[zn(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});Qe({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});Qe({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(t,e,n){var{parser:r}=t,s=n[0],i=Nt(e[0],"size"),l=Nt(e[1],"size");return{type:"rule",mode:r.mode,shift:s&&Nt(s,"size").value,width:i.value,height:l.value}},htmlBuilder(t,e){var n=pe.makeSpan(["mord","rule"],[],e),r=Kn(t.width,e),s=Kn(t.height,e),i=t.shift?Kn(t.shift,e):0;return n.style.borderRightWidth=Le(r),n.style.borderTopWidth=Le(s),n.style.bottom=Le(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=Kn(t.width,e),r=Kn(t.height,e),s=t.shift?Kn(t.shift,e):0,i=e.color&&e.getColor()||"black",l=new _e.MathNode("mspace");l.setAttribute("mathbackground",i),l.setAttribute("width",Le(n)),l.setAttribute("height",Le(r));var c=new _e.MathNode("mpadded",[l]);return s>=0?c.setAttribute("height",Le(s)):(c.setAttribute("height",Le(s)),c.setAttribute("depth",Le(-s))),c.setAttribute("voffset",Le(s)),c}});function VR(t,e,n){for(var r=Ar(t,e,!1),s=e.sizeMultiplier/n.sizeMultiplier,i=0;i{var n=e.havingSize(t.size);return VR(t.body,n,e)};Qe({type:"sizing",names:ON,props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!1,n);return{type:"sizing",mode:s.mode,size:ON.indexOf(r)+1,body:i}},htmlBuilder:rue,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=Fs(t.body,n),s=new _e.MathNode("mstyle",r);return s.setAttribute("mathsize",Le(n.sizeMultiplier)),s}});Qe({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,s=!1,i=!1,l=n[0]&&Nt(n[0],"ordgroup");if(l)for(var c="",d=0;d{var n=pe.makeSpan([],[Kt(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return n;if(t.smashHeight&&(n.height=0,n.children))for(var r=0;r{var n=new _e.MathNode("mpadded",[zn(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});Qe({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r}=t,s=n[0],i=e[0];return{type:"sqrt",mode:r.mode,body:i,index:s}},htmlBuilder(t,e){var n=Kt(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=pe.wrapFragment(n,e);var r=e.fontMetrics(),s=r.defaultRuleThickness,i=s;e.style.idn.height+n.depth+l&&(l=(l+p-n.height-n.depth)/2);var x=d.height-n.height-l-h;n.style.paddingLeft=Le(m);var v=pe.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+x)},{type:"elem",elem:d},{type:"kern",size:h}]},e);if(t.index){var b=e.havingStyle(at.SCRIPTSCRIPT),k=Kt(t.index,b,e),O=.6*(v.height-v.depth),j=pe.makeVList({positionType:"shift",positionData:-O,children:[{type:"elem",elem:k}]},e),T=pe.makeSpan(["root"],[j]);return pe.makeSpan(["mord","sqrt"],[T,v],e)}else return pe.makeSpan(["mord","sqrt"],[v],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new _e.MathNode("mroot",[zn(n,e),zn(r,e)]):new _e.MathNode("msqrt",[zn(n,e)])}});var jN={display:at.DISPLAY,text:at.TEXT,script:at.SCRIPT,scriptscript:at.SCRIPTSCRIPT};Qe({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t,e){var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!0,n),l=r.slice(1,r.length-5);return{type:"styling",mode:s.mode,style:l,body:i}},htmlBuilder(t,e){var n=jN[t.style],r=e.havingStyle(n).withFont("");return VR(t.body,r,e)},mathmlBuilder(t,e){var n=jN[t.style],r=e.havingStyle(n),s=Fs(t.body,r),i=new _e.MathNode("mstyle",s),l={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},c=l[t.style];return i.setAttribute("scriptlevel",c[0]),i.setAttribute("displaystyle",c[1]),i}});var sue=function(e,n){var r=e.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===at.DISPLAY.size||r.alwaysHandleSupSub);return s?zd:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===at.DISPLAY.size||r.limits);return i?UR:null}else{if(r.type==="accent")return tn.isCharacterBox(r.base)?z5:null;if(r.type==="horizBrace"){var l=!e.sub;return l===r.isOver?QR:null}else return null}else return null};Rc({type:"supsub",htmlBuilder(t,e){var n=sue(t,e);if(n)return n(t,e);var{base:r,sup:s,sub:i}=t,l=Kt(r,e),c,d,h=e.fontMetrics(),m=0,p=0,x=r&&tn.isCharacterBox(r);if(s){var v=e.havingStyle(e.style.sup());c=Kt(s,v,e),x||(m=l.height-v.fontMetrics().supDrop*v.sizeMultiplier/e.sizeMultiplier)}if(i){var b=e.havingStyle(e.style.sub());d=Kt(i,b,e),x||(p=l.depth+b.fontMetrics().subDrop*b.sizeMultiplier/e.sizeMultiplier)}var k;e.style===at.DISPLAY?k=h.sup1:e.style.cramped?k=h.sup3:k=h.sup2;var O=e.sizeMultiplier,j=Le(.5/h.ptPerEm/O),T=null;if(d){var A=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(l instanceof Ai||A)&&(T=Le(-l.italic))}var _;if(c&&d){m=Math.max(m,k,c.depth+.25*h.xHeight),p=Math.max(p,h.sub2);var D=h.defaultRuleThickness,E=4*D;if(m-c.depth-(d.height-p)0&&(m+=R,p-=R)}var Q=[{type:"elem",elem:d,shift:p,marginRight:j,marginLeft:T},{type:"elem",elem:c,shift:-m,marginRight:j}];_=pe.makeVList({positionType:"individualShift",children:Q},e)}else if(d){p=Math.max(p,h.sub1,d.height-.8*h.xHeight);var F=[{type:"elem",elem:d,marginLeft:T,marginRight:j}];_=pe.makeVList({positionType:"shift",positionData:p,children:F},e)}else if(c)m=Math.max(m,k,c.depth+.25*h.xHeight),_=pe.makeVList({positionType:"shift",positionData:-m,children:[{type:"elem",elem:c,marginRight:j}]},e);else throw new Error("supsub must have either sup or sub.");var L=N4(l,"right")||"mord";return pe.makeSpan([L],[l,pe.makeSpan(["msupsub"],[_])],e)},mathmlBuilder(t,e){var n=!1,r,s;t.base&&t.base.type==="horizBrace"&&(s=!!t.sup,s===t.base.isOver&&(n=!0,r=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var i=[zn(t.base,e)];t.sub&&i.push(zn(t.sub,e)),t.sup&&i.push(zn(t.sup,e));var l;if(n)l=r?"mover":"munder";else if(t.sub)if(t.sup){var h=t.base;h&&h.type==="op"&&h.limits&&e.style===at.DISPLAY||h&&h.type==="operatorname"&&h.alwaysHandleSupSub&&(e.style===at.DISPLAY||h.limits)?l="munderover":l="msubsup"}else{var d=t.base;d&&d.type==="op"&&d.limits&&(e.style===at.DISPLAY||d.alwaysHandleSupSub)||d&&d.type==="operatorname"&&d.alwaysHandleSupSub&&(d.limits||e.style===at.DISPLAY)?l="munder":l="msub"}else{var c=t.base;c&&c.type==="op"&&c.limits&&(e.style===at.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||e.style===at.DISPLAY)?l="mover":l="msup"}return new _e.MathNode(l,i)}});Rc({type:"atom",htmlBuilder(t,e){return pe.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[Mi(t.text,t.mode)]);if(t.family==="bin"){var r=D5(t,e);r==="bold-italic"&&n.setAttribute("mathvariant",r)}else t.family==="punct"?n.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&n.setAttribute("stretchy","false");return n}});var WR={mi:"italic",mn:"normal",mtext:"normal"};Rc({type:"mathord",htmlBuilder(t,e){return pe.makeOrd(t,e,"mathord")},mathmlBuilder(t,e){var n=new _e.MathNode("mi",[Mi(t.text,t.mode,e)]),r=D5(t,e)||"italic";return r!==WR[n.type]&&n.setAttribute("mathvariant",r),n}});Rc({type:"textord",htmlBuilder(t,e){return pe.makeOrd(t,e,"textord")},mathmlBuilder(t,e){var n=Mi(t.text,t.mode,e),r=D5(t,e)||"normal",s;return t.mode==="text"?s=new _e.MathNode("mtext",[n]):/[0-9]/.test(t.text)?s=new _e.MathNode("mn",[n]):t.text==="\\prime"?s=new _e.MathNode("mo",[n]):s=new _e.MathNode("mi",[n]),r!==WR[s.type]&&s.setAttribute("mathvariant",r),s}});var Fb={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Qb={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Rc({type:"spacing",htmlBuilder(t,e){if(Qb.hasOwnProperty(t.text)){var n=Qb[t.text].className||"";if(t.mode==="text"){var r=pe.makeOrd(t,e,"textord");return r.classes.push(n),r}else return pe.makeSpan(["mspace",n],[pe.mathsym(t.text,t.mode,e)],e)}else{if(Fb.hasOwnProperty(t.text))return pe.makeSpan(["mspace",Fb[t.text]],[],e);throw new De('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(Qb.hasOwnProperty(t.text))n=new _e.MathNode("mtext",[new _e.TextNode(" ")]);else{if(Fb.hasOwnProperty(t.text))return new _e.MathNode("mspace");throw new De('Unknown type of space "'+t.text+'"')}return n}});var NN=()=>{var t=new _e.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};Rc({type:"tag",mathmlBuilder(t,e){var n=new _e.MathNode("mtable",[new _e.MathNode("mtr",[NN(),new _e.MathNode("mtd",[wo(t.body,e)]),NN(),new _e.MathNode("mtd",[wo(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var CN={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},TN={"\\textbf":"textbf","\\textmd":"textmd"},iue={"\\textit":"textit","\\textup":"textup"},AN=(t,e)=>{var n=t.font;if(n){if(CN[n])return e.withTextFontFamily(CN[n]);if(TN[n])return e.withTextFontWeight(TN[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(iue[n])};Qe({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"text",mode:n.mode,body:ar(s),font:r}},htmlBuilder(t,e){var n=AN(t,e),r=Ar(t.body,n,!0);return pe.makeSpan(["mord","text"],r,n)},mathmlBuilder(t,e){var n=AN(t,e);return wo(t.body,n)}});Qe({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"underline",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Kt(t.body,e),r=pe.makeLineSpan("underline-line",e),s=e.fontMetrics().defaultRuleThickness,i=pe.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]},e);return pe.makeSpan(["mord","underline"],[i],e)},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[new _e.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new _e.MathNode("munder",[zn(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});Qe({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"vcenter",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Kt(t.body,e),r=e.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return pe.makeVList({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){return new _e.MathNode("mpadded",[zn(t.body,e)],["vcenter"])}});Qe({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new De("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=MN(t),r=[],s=e.havingStyle(e.style.text()),i=0;it.body.replace(/ /g,t.star?"␣":" "),io=gR,GR=`[ \r +-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class w0{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),n=0;nn.toText();return this.children.map(e).join("")}}var pa={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Tp={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},rN={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function Goe(t,e){pa[t]=e}function A5(t,e,n){if(!pa[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),s=pa[e][r];if(!s&&t[0]in rN&&(r=rN[t[0]].charCodeAt(0),s=pa[e][r]),!s&&n==="text"&&aR(r)&&(s=pa[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var Ab={};function Xoe(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!Ab[e]){var n=Ab[e]={cssEmPerMu:Tp.quad[e]/18};for(var r in Tp)Tp.hasOwnProperty(r)&&(n[r]=Tp[r][e])}return Ab[e]}var Yoe=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],sN=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],iN=function(e,n){return n.size<2?e:Yoe[e-1][n.size-1]};class sl{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||sl.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=sN[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return new sl(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:iN(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:sN[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=iN(sl.BASESIZE,e);return this.size===n&&this.textSize===sl.BASESIZE&&this.style===e?this:this.extend({style:e,size:n})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==sl.BASESIZE?["sizing","reset-size"+this.size,"size"+sl.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Xoe(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}sl.BASESIZE=6;var k4={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},Koe={ex:!0,em:!0,mu:!0},lR=function(e){return typeof e!="string"&&(e=e.unit),e in k4||e in Koe||e==="ex"},Kn=function(e,n){var r;if(e.unit in k4)r=k4[e.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(e.unit==="mu")r=n.fontMetrics().cssEmPerMu;else{var s;if(n.style.isTight()?s=n.havingStyle(n.style.text()):s=n,e.unit==="ex")r=s.fontMetrics().xHeight;else if(e.unit==="em")r=s.fontMetrics().quad;else throw new De("Invalid unit: '"+e.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},Le=function(e){return+e.toFixed(4)+"em"},yo=function(e){return e.filter(n=>n).join(" ")},oR=function(e,n,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},n){n.style.isTight()&&this.classes.push("mtight");var s=n.getColor();s&&(this.style.color=s)}},cR=function(e){var n=document.createElement(e);n.className=yo(this.classes);for(var r in this.style)this.style.hasOwnProperty(r)&&(n.style[r]=this.style[r]);for(var s in this.attributes)this.attributes.hasOwnProperty(s)&&n.setAttribute(s,this.attributes[s]);for(var i=0;i/=\x00-\x1f]/,uR=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+tn.escape(yo(this.classes))+'"');var r="";for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=tn.hyphenate(s)+":"+this.style[s]+";");r&&(n+=' style="'+tn.escape(r)+'"');for(var i in this.attributes)if(this.attributes.hasOwnProperty(i)){if(Zoe.test(i))throw new De("Invalid attribute name '"+i+"'");n+=" "+i+'="'+tn.escape(this.attributes[i])+'"'}n+=">";for(var l=0;l",n};class S0{constructor(e,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,oR.call(this,e,r,s),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return cR.call(this,"span")}toMarkup(){return uR.call(this,"span")}}class M5{constructor(e,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,oR.call(this,n,s),this.children=r||[],this.setAttribute("href",e)}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return cR.call(this,"a")}toMarkup(){return uR.call(this,"a")}}class Joe{constructor(e,n,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=e,this.classes=["mord"],this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var n in this.style)this.style.hasOwnProperty(n)&&(e.style[n]=this.style[n]);return e}toMarkup(){var e=''+tn.escape(this.alt)+'0&&(n=document.createElement("span"),n.style.marginRight=Le(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=yo(this.classes));for(var r in this.style)this.style.hasOwnProperty(r)&&(n=n||document.createElement("span"),n.style[r]=this.style[r]);return n?(n.appendChild(e),n):e}toMarkup(){var e=!1,n="0&&(r+="margin-right:"+this.italic+"em;");for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=tn.hyphenate(s)+":"+this.style[s]+";");r&&(e=!0,n+=' style="'+tn.escape(r)+'"');var i=tn.escape(this.text);return e?(n+=">",n+=i,n+="",n):i}}class xl{constructor(e,n){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=n||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);for(var s=0;s':''}}class O4{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"line");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var e=" but got "+String(t)+".")}var nce={bin:1,close:1,inner:1,open:1,punct:1,rel:1},rce={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Ln={math:{},text:{}};function N(t,e,n,r,s,i){Ln[t][s]={font:e,group:n,replace:r},i&&r&&(Ln[t][r]=Ln[t][s])}var C="math",Ee="text",B="main",G="ams",Wn="accent-token",Ve="bin",xs="close",Rd="inner",st="mathord",yr="op-token",li="open",$x="punct",X="rel",Sl="spacing",le="textord";N(C,B,X,"≡","\\equiv",!0);N(C,B,X,"≺","\\prec",!0);N(C,B,X,"≻","\\succ",!0);N(C,B,X,"∼","\\sim",!0);N(C,B,X,"⊥","\\perp");N(C,B,X,"⪯","\\preceq",!0);N(C,B,X,"⪰","\\succeq",!0);N(C,B,X,"≃","\\simeq",!0);N(C,B,X,"∣","\\mid",!0);N(C,B,X,"≪","\\ll",!0);N(C,B,X,"≫","\\gg",!0);N(C,B,X,"≍","\\asymp",!0);N(C,B,X,"∥","\\parallel");N(C,B,X,"⋈","\\bowtie",!0);N(C,B,X,"⌣","\\smile",!0);N(C,B,X,"⊑","\\sqsubseteq",!0);N(C,B,X,"⊒","\\sqsupseteq",!0);N(C,B,X,"≐","\\doteq",!0);N(C,B,X,"⌢","\\frown",!0);N(C,B,X,"∋","\\ni",!0);N(C,B,X,"∝","\\propto",!0);N(C,B,X,"⊢","\\vdash",!0);N(C,B,X,"⊣","\\dashv",!0);N(C,B,X,"∋","\\owns");N(C,B,$x,".","\\ldotp");N(C,B,$x,"⋅","\\cdotp");N(C,B,le,"#","\\#");N(Ee,B,le,"#","\\#");N(C,B,le,"&","\\&");N(Ee,B,le,"&","\\&");N(C,B,le,"ℵ","\\aleph",!0);N(C,B,le,"∀","\\forall",!0);N(C,B,le,"ℏ","\\hbar",!0);N(C,B,le,"∃","\\exists",!0);N(C,B,le,"∇","\\nabla",!0);N(C,B,le,"♭","\\flat",!0);N(C,B,le,"ℓ","\\ell",!0);N(C,B,le,"♮","\\natural",!0);N(C,B,le,"♣","\\clubsuit",!0);N(C,B,le,"℘","\\wp",!0);N(C,B,le,"♯","\\sharp",!0);N(C,B,le,"♢","\\diamondsuit",!0);N(C,B,le,"ℜ","\\Re",!0);N(C,B,le,"♡","\\heartsuit",!0);N(C,B,le,"ℑ","\\Im",!0);N(C,B,le,"♠","\\spadesuit",!0);N(C,B,le,"§","\\S",!0);N(Ee,B,le,"§","\\S");N(C,B,le,"¶","\\P",!0);N(Ee,B,le,"¶","\\P");N(C,B,le,"†","\\dag");N(Ee,B,le,"†","\\dag");N(Ee,B,le,"†","\\textdagger");N(C,B,le,"‡","\\ddag");N(Ee,B,le,"‡","\\ddag");N(Ee,B,le,"‡","\\textdaggerdbl");N(C,B,xs,"⎱","\\rmoustache",!0);N(C,B,li,"⎰","\\lmoustache",!0);N(C,B,xs,"⟯","\\rgroup",!0);N(C,B,li,"⟮","\\lgroup",!0);N(C,B,Ve,"∓","\\mp",!0);N(C,B,Ve,"⊖","\\ominus",!0);N(C,B,Ve,"⊎","\\uplus",!0);N(C,B,Ve,"⊓","\\sqcap",!0);N(C,B,Ve,"∗","\\ast");N(C,B,Ve,"⊔","\\sqcup",!0);N(C,B,Ve,"◯","\\bigcirc",!0);N(C,B,Ve,"∙","\\bullet",!0);N(C,B,Ve,"‡","\\ddagger");N(C,B,Ve,"≀","\\wr",!0);N(C,B,Ve,"⨿","\\amalg");N(C,B,Ve,"&","\\And");N(C,B,X,"⟵","\\longleftarrow",!0);N(C,B,X,"⇐","\\Leftarrow",!0);N(C,B,X,"⟸","\\Longleftarrow",!0);N(C,B,X,"⟶","\\longrightarrow",!0);N(C,B,X,"⇒","\\Rightarrow",!0);N(C,B,X,"⟹","\\Longrightarrow",!0);N(C,B,X,"↔","\\leftrightarrow",!0);N(C,B,X,"⟷","\\longleftrightarrow",!0);N(C,B,X,"⇔","\\Leftrightarrow",!0);N(C,B,X,"⟺","\\Longleftrightarrow",!0);N(C,B,X,"↦","\\mapsto",!0);N(C,B,X,"⟼","\\longmapsto",!0);N(C,B,X,"↗","\\nearrow",!0);N(C,B,X,"↩","\\hookleftarrow",!0);N(C,B,X,"↪","\\hookrightarrow",!0);N(C,B,X,"↘","\\searrow",!0);N(C,B,X,"↼","\\leftharpoonup",!0);N(C,B,X,"⇀","\\rightharpoonup",!0);N(C,B,X,"↙","\\swarrow",!0);N(C,B,X,"↽","\\leftharpoondown",!0);N(C,B,X,"⇁","\\rightharpoondown",!0);N(C,B,X,"↖","\\nwarrow",!0);N(C,B,X,"⇌","\\rightleftharpoons",!0);N(C,G,X,"≮","\\nless",!0);N(C,G,X,"","\\@nleqslant");N(C,G,X,"","\\@nleqq");N(C,G,X,"⪇","\\lneq",!0);N(C,G,X,"≨","\\lneqq",!0);N(C,G,X,"","\\@lvertneqq");N(C,G,X,"⋦","\\lnsim",!0);N(C,G,X,"⪉","\\lnapprox",!0);N(C,G,X,"⊀","\\nprec",!0);N(C,G,X,"⋠","\\npreceq",!0);N(C,G,X,"⋨","\\precnsim",!0);N(C,G,X,"⪹","\\precnapprox",!0);N(C,G,X,"≁","\\nsim",!0);N(C,G,X,"","\\@nshortmid");N(C,G,X,"∤","\\nmid",!0);N(C,G,X,"⊬","\\nvdash",!0);N(C,G,X,"⊭","\\nvDash",!0);N(C,G,X,"⋪","\\ntriangleleft");N(C,G,X,"⋬","\\ntrianglelefteq",!0);N(C,G,X,"⊊","\\subsetneq",!0);N(C,G,X,"","\\@varsubsetneq");N(C,G,X,"⫋","\\subsetneqq",!0);N(C,G,X,"","\\@varsubsetneqq");N(C,G,X,"≯","\\ngtr",!0);N(C,G,X,"","\\@ngeqslant");N(C,G,X,"","\\@ngeqq");N(C,G,X,"⪈","\\gneq",!0);N(C,G,X,"≩","\\gneqq",!0);N(C,G,X,"","\\@gvertneqq");N(C,G,X,"⋧","\\gnsim",!0);N(C,G,X,"⪊","\\gnapprox",!0);N(C,G,X,"⊁","\\nsucc",!0);N(C,G,X,"⋡","\\nsucceq",!0);N(C,G,X,"⋩","\\succnsim",!0);N(C,G,X,"⪺","\\succnapprox",!0);N(C,G,X,"≆","\\ncong",!0);N(C,G,X,"","\\@nshortparallel");N(C,G,X,"∦","\\nparallel",!0);N(C,G,X,"⊯","\\nVDash",!0);N(C,G,X,"⋫","\\ntriangleright");N(C,G,X,"⋭","\\ntrianglerighteq",!0);N(C,G,X,"","\\@nsupseteqq");N(C,G,X,"⊋","\\supsetneq",!0);N(C,G,X,"","\\@varsupsetneq");N(C,G,X,"⫌","\\supsetneqq",!0);N(C,G,X,"","\\@varsupsetneqq");N(C,G,X,"⊮","\\nVdash",!0);N(C,G,X,"⪵","\\precneqq",!0);N(C,G,X,"⪶","\\succneqq",!0);N(C,G,X,"","\\@nsubseteqq");N(C,G,Ve,"⊴","\\unlhd");N(C,G,Ve,"⊵","\\unrhd");N(C,G,X,"↚","\\nleftarrow",!0);N(C,G,X,"↛","\\nrightarrow",!0);N(C,G,X,"⇍","\\nLeftarrow",!0);N(C,G,X,"⇏","\\nRightarrow",!0);N(C,G,X,"↮","\\nleftrightarrow",!0);N(C,G,X,"⇎","\\nLeftrightarrow",!0);N(C,G,X,"△","\\vartriangle");N(C,G,le,"ℏ","\\hslash");N(C,G,le,"▽","\\triangledown");N(C,G,le,"◊","\\lozenge");N(C,G,le,"Ⓢ","\\circledS");N(C,G,le,"®","\\circledR");N(Ee,G,le,"®","\\circledR");N(C,G,le,"∡","\\measuredangle",!0);N(C,G,le,"∄","\\nexists");N(C,G,le,"℧","\\mho");N(C,G,le,"Ⅎ","\\Finv",!0);N(C,G,le,"⅁","\\Game",!0);N(C,G,le,"‵","\\backprime");N(C,G,le,"▲","\\blacktriangle");N(C,G,le,"▼","\\blacktriangledown");N(C,G,le,"■","\\blacksquare");N(C,G,le,"⧫","\\blacklozenge");N(C,G,le,"★","\\bigstar");N(C,G,le,"∢","\\sphericalangle",!0);N(C,G,le,"∁","\\complement",!0);N(C,G,le,"ð","\\eth",!0);N(Ee,B,le,"ð","ð");N(C,G,le,"╱","\\diagup");N(C,G,le,"╲","\\diagdown");N(C,G,le,"□","\\square");N(C,G,le,"□","\\Box");N(C,G,le,"◊","\\Diamond");N(C,G,le,"¥","\\yen",!0);N(Ee,G,le,"¥","\\yen",!0);N(C,G,le,"✓","\\checkmark",!0);N(Ee,G,le,"✓","\\checkmark");N(C,G,le,"ℶ","\\beth",!0);N(C,G,le,"ℸ","\\daleth",!0);N(C,G,le,"ℷ","\\gimel",!0);N(C,G,le,"ϝ","\\digamma",!0);N(C,G,le,"ϰ","\\varkappa");N(C,G,li,"┌","\\@ulcorner",!0);N(C,G,xs,"┐","\\@urcorner",!0);N(C,G,li,"└","\\@llcorner",!0);N(C,G,xs,"┘","\\@lrcorner",!0);N(C,G,X,"≦","\\leqq",!0);N(C,G,X,"⩽","\\leqslant",!0);N(C,G,X,"⪕","\\eqslantless",!0);N(C,G,X,"≲","\\lesssim",!0);N(C,G,X,"⪅","\\lessapprox",!0);N(C,G,X,"≊","\\approxeq",!0);N(C,G,Ve,"⋖","\\lessdot");N(C,G,X,"⋘","\\lll",!0);N(C,G,X,"≶","\\lessgtr",!0);N(C,G,X,"⋚","\\lesseqgtr",!0);N(C,G,X,"⪋","\\lesseqqgtr",!0);N(C,G,X,"≑","\\doteqdot");N(C,G,X,"≓","\\risingdotseq",!0);N(C,G,X,"≒","\\fallingdotseq",!0);N(C,G,X,"∽","\\backsim",!0);N(C,G,X,"⋍","\\backsimeq",!0);N(C,G,X,"⫅","\\subseteqq",!0);N(C,G,X,"⋐","\\Subset",!0);N(C,G,X,"⊏","\\sqsubset",!0);N(C,G,X,"≼","\\preccurlyeq",!0);N(C,G,X,"⋞","\\curlyeqprec",!0);N(C,G,X,"≾","\\precsim",!0);N(C,G,X,"⪷","\\precapprox",!0);N(C,G,X,"⊲","\\vartriangleleft");N(C,G,X,"⊴","\\trianglelefteq");N(C,G,X,"⊨","\\vDash",!0);N(C,G,X,"⊪","\\Vvdash",!0);N(C,G,X,"⌣","\\smallsmile");N(C,G,X,"⌢","\\smallfrown");N(C,G,X,"≏","\\bumpeq",!0);N(C,G,X,"≎","\\Bumpeq",!0);N(C,G,X,"≧","\\geqq",!0);N(C,G,X,"⩾","\\geqslant",!0);N(C,G,X,"⪖","\\eqslantgtr",!0);N(C,G,X,"≳","\\gtrsim",!0);N(C,G,X,"⪆","\\gtrapprox",!0);N(C,G,Ve,"⋗","\\gtrdot");N(C,G,X,"⋙","\\ggg",!0);N(C,G,X,"≷","\\gtrless",!0);N(C,G,X,"⋛","\\gtreqless",!0);N(C,G,X,"⪌","\\gtreqqless",!0);N(C,G,X,"≖","\\eqcirc",!0);N(C,G,X,"≗","\\circeq",!0);N(C,G,X,"≜","\\triangleq",!0);N(C,G,X,"∼","\\thicksim");N(C,G,X,"≈","\\thickapprox");N(C,G,X,"⫆","\\supseteqq",!0);N(C,G,X,"⋑","\\Supset",!0);N(C,G,X,"⊐","\\sqsupset",!0);N(C,G,X,"≽","\\succcurlyeq",!0);N(C,G,X,"⋟","\\curlyeqsucc",!0);N(C,G,X,"≿","\\succsim",!0);N(C,G,X,"⪸","\\succapprox",!0);N(C,G,X,"⊳","\\vartriangleright");N(C,G,X,"⊵","\\trianglerighteq");N(C,G,X,"⊩","\\Vdash",!0);N(C,G,X,"∣","\\shortmid");N(C,G,X,"∥","\\shortparallel");N(C,G,X,"≬","\\between",!0);N(C,G,X,"⋔","\\pitchfork",!0);N(C,G,X,"∝","\\varpropto");N(C,G,X,"◀","\\blacktriangleleft");N(C,G,X,"∴","\\therefore",!0);N(C,G,X,"∍","\\backepsilon");N(C,G,X,"▶","\\blacktriangleright");N(C,G,X,"∵","\\because",!0);N(C,G,X,"⋘","\\llless");N(C,G,X,"⋙","\\gggtr");N(C,G,Ve,"⊲","\\lhd");N(C,G,Ve,"⊳","\\rhd");N(C,G,X,"≂","\\eqsim",!0);N(C,B,X,"⋈","\\Join");N(C,G,X,"≑","\\Doteq",!0);N(C,G,Ve,"∔","\\dotplus",!0);N(C,G,Ve,"∖","\\smallsetminus");N(C,G,Ve,"⋒","\\Cap",!0);N(C,G,Ve,"⋓","\\Cup",!0);N(C,G,Ve,"⩞","\\doublebarwedge",!0);N(C,G,Ve,"⊟","\\boxminus",!0);N(C,G,Ve,"⊞","\\boxplus",!0);N(C,G,Ve,"⋇","\\divideontimes",!0);N(C,G,Ve,"⋉","\\ltimes",!0);N(C,G,Ve,"⋊","\\rtimes",!0);N(C,G,Ve,"⋋","\\leftthreetimes",!0);N(C,G,Ve,"⋌","\\rightthreetimes",!0);N(C,G,Ve,"⋏","\\curlywedge",!0);N(C,G,Ve,"⋎","\\curlyvee",!0);N(C,G,Ve,"⊝","\\circleddash",!0);N(C,G,Ve,"⊛","\\circledast",!0);N(C,G,Ve,"⋅","\\centerdot");N(C,G,Ve,"⊺","\\intercal",!0);N(C,G,Ve,"⋒","\\doublecap");N(C,G,Ve,"⋓","\\doublecup");N(C,G,Ve,"⊠","\\boxtimes",!0);N(C,G,X,"⇢","\\dashrightarrow",!0);N(C,G,X,"⇠","\\dashleftarrow",!0);N(C,G,X,"⇇","\\leftleftarrows",!0);N(C,G,X,"⇆","\\leftrightarrows",!0);N(C,G,X,"⇚","\\Lleftarrow",!0);N(C,G,X,"↞","\\twoheadleftarrow",!0);N(C,G,X,"↢","\\leftarrowtail",!0);N(C,G,X,"↫","\\looparrowleft",!0);N(C,G,X,"⇋","\\leftrightharpoons",!0);N(C,G,X,"↶","\\curvearrowleft",!0);N(C,G,X,"↺","\\circlearrowleft",!0);N(C,G,X,"↰","\\Lsh",!0);N(C,G,X,"⇈","\\upuparrows",!0);N(C,G,X,"↿","\\upharpoonleft",!0);N(C,G,X,"⇃","\\downharpoonleft",!0);N(C,B,X,"⊶","\\origof",!0);N(C,B,X,"⊷","\\imageof",!0);N(C,G,X,"⊸","\\multimap",!0);N(C,G,X,"↭","\\leftrightsquigarrow",!0);N(C,G,X,"⇉","\\rightrightarrows",!0);N(C,G,X,"⇄","\\rightleftarrows",!0);N(C,G,X,"↠","\\twoheadrightarrow",!0);N(C,G,X,"↣","\\rightarrowtail",!0);N(C,G,X,"↬","\\looparrowright",!0);N(C,G,X,"↷","\\curvearrowright",!0);N(C,G,X,"↻","\\circlearrowright",!0);N(C,G,X,"↱","\\Rsh",!0);N(C,G,X,"⇊","\\downdownarrows",!0);N(C,G,X,"↾","\\upharpoonright",!0);N(C,G,X,"⇂","\\downharpoonright",!0);N(C,G,X,"⇝","\\rightsquigarrow",!0);N(C,G,X,"⇝","\\leadsto");N(C,G,X,"⇛","\\Rrightarrow",!0);N(C,G,X,"↾","\\restriction");N(C,B,le,"‘","`");N(C,B,le,"$","\\$");N(Ee,B,le,"$","\\$");N(Ee,B,le,"$","\\textdollar");N(C,B,le,"%","\\%");N(Ee,B,le,"%","\\%");N(C,B,le,"_","\\_");N(Ee,B,le,"_","\\_");N(Ee,B,le,"_","\\textunderscore");N(C,B,le,"∠","\\angle",!0);N(C,B,le,"∞","\\infty",!0);N(C,B,le,"′","\\prime");N(C,B,le,"△","\\triangle");N(C,B,le,"Γ","\\Gamma",!0);N(C,B,le,"Δ","\\Delta",!0);N(C,B,le,"Θ","\\Theta",!0);N(C,B,le,"Λ","\\Lambda",!0);N(C,B,le,"Ξ","\\Xi",!0);N(C,B,le,"Π","\\Pi",!0);N(C,B,le,"Σ","\\Sigma",!0);N(C,B,le,"Υ","\\Upsilon",!0);N(C,B,le,"Φ","\\Phi",!0);N(C,B,le,"Ψ","\\Psi",!0);N(C,B,le,"Ω","\\Omega",!0);N(C,B,le,"A","Α");N(C,B,le,"B","Β");N(C,B,le,"E","Ε");N(C,B,le,"Z","Ζ");N(C,B,le,"H","Η");N(C,B,le,"I","Ι");N(C,B,le,"K","Κ");N(C,B,le,"M","Μ");N(C,B,le,"N","Ν");N(C,B,le,"O","Ο");N(C,B,le,"P","Ρ");N(C,B,le,"T","Τ");N(C,B,le,"X","Χ");N(C,B,le,"¬","\\neg",!0);N(C,B,le,"¬","\\lnot");N(C,B,le,"⊤","\\top");N(C,B,le,"⊥","\\bot");N(C,B,le,"∅","\\emptyset");N(C,G,le,"∅","\\varnothing");N(C,B,st,"α","\\alpha",!0);N(C,B,st,"β","\\beta",!0);N(C,B,st,"γ","\\gamma",!0);N(C,B,st,"δ","\\delta",!0);N(C,B,st,"ϵ","\\epsilon",!0);N(C,B,st,"ζ","\\zeta",!0);N(C,B,st,"η","\\eta",!0);N(C,B,st,"θ","\\theta",!0);N(C,B,st,"ι","\\iota",!0);N(C,B,st,"κ","\\kappa",!0);N(C,B,st,"λ","\\lambda",!0);N(C,B,st,"μ","\\mu",!0);N(C,B,st,"ν","\\nu",!0);N(C,B,st,"ξ","\\xi",!0);N(C,B,st,"ο","\\omicron",!0);N(C,B,st,"π","\\pi",!0);N(C,B,st,"ρ","\\rho",!0);N(C,B,st,"σ","\\sigma",!0);N(C,B,st,"τ","\\tau",!0);N(C,B,st,"υ","\\upsilon",!0);N(C,B,st,"ϕ","\\phi",!0);N(C,B,st,"χ","\\chi",!0);N(C,B,st,"ψ","\\psi",!0);N(C,B,st,"ω","\\omega",!0);N(C,B,st,"ε","\\varepsilon",!0);N(C,B,st,"ϑ","\\vartheta",!0);N(C,B,st,"ϖ","\\varpi",!0);N(C,B,st,"ϱ","\\varrho",!0);N(C,B,st,"ς","\\varsigma",!0);N(C,B,st,"φ","\\varphi",!0);N(C,B,Ve,"∗","*",!0);N(C,B,Ve,"+","+");N(C,B,Ve,"−","-",!0);N(C,B,Ve,"⋅","\\cdot",!0);N(C,B,Ve,"∘","\\circ",!0);N(C,B,Ve,"÷","\\div",!0);N(C,B,Ve,"±","\\pm",!0);N(C,B,Ve,"×","\\times",!0);N(C,B,Ve,"∩","\\cap",!0);N(C,B,Ve,"∪","\\cup",!0);N(C,B,Ve,"∖","\\setminus",!0);N(C,B,Ve,"∧","\\land");N(C,B,Ve,"∨","\\lor");N(C,B,Ve,"∧","\\wedge",!0);N(C,B,Ve,"∨","\\vee",!0);N(C,B,le,"√","\\surd");N(C,B,li,"⟨","\\langle",!0);N(C,B,li,"∣","\\lvert");N(C,B,li,"∥","\\lVert");N(C,B,xs,"?","?");N(C,B,xs,"!","!");N(C,B,xs,"⟩","\\rangle",!0);N(C,B,xs,"∣","\\rvert");N(C,B,xs,"∥","\\rVert");N(C,B,X,"=","=");N(C,B,X,":",":");N(C,B,X,"≈","\\approx",!0);N(C,B,X,"≅","\\cong",!0);N(C,B,X,"≥","\\ge");N(C,B,X,"≥","\\geq",!0);N(C,B,X,"←","\\gets");N(C,B,X,">","\\gt",!0);N(C,B,X,"∈","\\in",!0);N(C,B,X,"","\\@not");N(C,B,X,"⊂","\\subset",!0);N(C,B,X,"⊃","\\supset",!0);N(C,B,X,"⊆","\\subseteq",!0);N(C,B,X,"⊇","\\supseteq",!0);N(C,G,X,"⊈","\\nsubseteq",!0);N(C,G,X,"⊉","\\nsupseteq",!0);N(C,B,X,"⊨","\\models");N(C,B,X,"←","\\leftarrow",!0);N(C,B,X,"≤","\\le");N(C,B,X,"≤","\\leq",!0);N(C,B,X,"<","\\lt",!0);N(C,B,X,"→","\\rightarrow",!0);N(C,B,X,"→","\\to");N(C,G,X,"≱","\\ngeq",!0);N(C,G,X,"≰","\\nleq",!0);N(C,B,Sl," ","\\ ");N(C,B,Sl," ","\\space");N(C,B,Sl," ","\\nobreakspace");N(Ee,B,Sl," ","\\ ");N(Ee,B,Sl," "," ");N(Ee,B,Sl," ","\\space");N(Ee,B,Sl," ","\\nobreakspace");N(C,B,Sl,null,"\\nobreak");N(C,B,Sl,null,"\\allowbreak");N(C,B,$x,",",",");N(C,B,$x,";",";");N(C,G,Ve,"⊼","\\barwedge",!0);N(C,G,Ve,"⊻","\\veebar",!0);N(C,B,Ve,"⊙","\\odot",!0);N(C,B,Ve,"⊕","\\oplus",!0);N(C,B,Ve,"⊗","\\otimes",!0);N(C,B,le,"∂","\\partial",!0);N(C,B,Ve,"⊘","\\oslash",!0);N(C,G,Ve,"⊚","\\circledcirc",!0);N(C,G,Ve,"⊡","\\boxdot",!0);N(C,B,Ve,"△","\\bigtriangleup");N(C,B,Ve,"▽","\\bigtriangledown");N(C,B,Ve,"†","\\dagger");N(C,B,Ve,"⋄","\\diamond");N(C,B,Ve,"⋆","\\star");N(C,B,Ve,"◃","\\triangleleft");N(C,B,Ve,"▹","\\triangleright");N(C,B,li,"{","\\{");N(Ee,B,le,"{","\\{");N(Ee,B,le,"{","\\textbraceleft");N(C,B,xs,"}","\\}");N(Ee,B,le,"}","\\}");N(Ee,B,le,"}","\\textbraceright");N(C,B,li,"{","\\lbrace");N(C,B,xs,"}","\\rbrace");N(C,B,li,"[","\\lbrack",!0);N(Ee,B,le,"[","\\lbrack",!0);N(C,B,xs,"]","\\rbrack",!0);N(Ee,B,le,"]","\\rbrack",!0);N(C,B,li,"(","\\lparen",!0);N(C,B,xs,")","\\rparen",!0);N(Ee,B,le,"<","\\textless",!0);N(Ee,B,le,">","\\textgreater",!0);N(C,B,li,"⌊","\\lfloor",!0);N(C,B,xs,"⌋","\\rfloor",!0);N(C,B,li,"⌈","\\lceil",!0);N(C,B,xs,"⌉","\\rceil",!0);N(C,B,le,"\\","\\backslash");N(C,B,le,"∣","|");N(C,B,le,"∣","\\vert");N(Ee,B,le,"|","\\textbar",!0);N(C,B,le,"∥","\\|");N(C,B,le,"∥","\\Vert");N(Ee,B,le,"∥","\\textbardbl");N(Ee,B,le,"~","\\textasciitilde");N(Ee,B,le,"\\","\\textbackslash");N(Ee,B,le,"^","\\textasciicircum");N(C,B,X,"↑","\\uparrow",!0);N(C,B,X,"⇑","\\Uparrow",!0);N(C,B,X,"↓","\\downarrow",!0);N(C,B,X,"⇓","\\Downarrow",!0);N(C,B,X,"↕","\\updownarrow",!0);N(C,B,X,"⇕","\\Updownarrow",!0);N(C,B,yr,"∐","\\coprod");N(C,B,yr,"⋁","\\bigvee");N(C,B,yr,"⋀","\\bigwedge");N(C,B,yr,"⨄","\\biguplus");N(C,B,yr,"⋂","\\bigcap");N(C,B,yr,"⋃","\\bigcup");N(C,B,yr,"∫","\\int");N(C,B,yr,"∫","\\intop");N(C,B,yr,"∬","\\iint");N(C,B,yr,"∭","\\iiint");N(C,B,yr,"∏","\\prod");N(C,B,yr,"∑","\\sum");N(C,B,yr,"⨂","\\bigotimes");N(C,B,yr,"⨁","\\bigoplus");N(C,B,yr,"⨀","\\bigodot");N(C,B,yr,"∮","\\oint");N(C,B,yr,"∯","\\oiint");N(C,B,yr,"∰","\\oiiint");N(C,B,yr,"⨆","\\bigsqcup");N(C,B,yr,"∫","\\smallint");N(Ee,B,Rd,"…","\\textellipsis");N(C,B,Rd,"…","\\mathellipsis");N(Ee,B,Rd,"…","\\ldots",!0);N(C,B,Rd,"…","\\ldots",!0);N(C,B,Rd,"⋯","\\@cdots",!0);N(C,B,Rd,"⋱","\\ddots",!0);N(C,B,le,"⋮","\\varvdots");N(Ee,B,le,"⋮","\\varvdots");N(C,B,Wn,"ˊ","\\acute");N(C,B,Wn,"ˋ","\\grave");N(C,B,Wn,"¨","\\ddot");N(C,B,Wn,"~","\\tilde");N(C,B,Wn,"ˉ","\\bar");N(C,B,Wn,"˘","\\breve");N(C,B,Wn,"ˇ","\\check");N(C,B,Wn,"^","\\hat");N(C,B,Wn,"⃗","\\vec");N(C,B,Wn,"˙","\\dot");N(C,B,Wn,"˚","\\mathring");N(C,B,st,"","\\@imath");N(C,B,st,"","\\@jmath");N(C,B,le,"ı","ı");N(C,B,le,"ȷ","ȷ");N(Ee,B,le,"ı","\\i",!0);N(Ee,B,le,"ȷ","\\j",!0);N(Ee,B,le,"ß","\\ss",!0);N(Ee,B,le,"æ","\\ae",!0);N(Ee,B,le,"œ","\\oe",!0);N(Ee,B,le,"ø","\\o",!0);N(Ee,B,le,"Æ","\\AE",!0);N(Ee,B,le,"Œ","\\OE",!0);N(Ee,B,le,"Ø","\\O",!0);N(Ee,B,Wn,"ˊ","\\'");N(Ee,B,Wn,"ˋ","\\`");N(Ee,B,Wn,"ˆ","\\^");N(Ee,B,Wn,"˜","\\~");N(Ee,B,Wn,"ˉ","\\=");N(Ee,B,Wn,"˘","\\u");N(Ee,B,Wn,"˙","\\.");N(Ee,B,Wn,"¸","\\c");N(Ee,B,Wn,"˚","\\r");N(Ee,B,Wn,"ˇ","\\v");N(Ee,B,Wn,"¨",'\\"');N(Ee,B,Wn,"˝","\\H");N(Ee,B,Wn,"◯","\\textcircled");var dR={"--":!0,"---":!0,"``":!0,"''":!0};N(Ee,B,le,"–","--",!0);N(Ee,B,le,"–","\\textendash");N(Ee,B,le,"—","---",!0);N(Ee,B,le,"—","\\textemdash");N(Ee,B,le,"‘","`",!0);N(Ee,B,le,"‘","\\textquoteleft");N(Ee,B,le,"’","'",!0);N(Ee,B,le,"’","\\textquoteright");N(Ee,B,le,"“","``",!0);N(Ee,B,le,"“","\\textquotedblleft");N(Ee,B,le,"”","''",!0);N(Ee,B,le,"”","\\textquotedblright");N(C,B,le,"°","\\degree",!0);N(Ee,B,le,"°","\\degree");N(Ee,B,le,"°","\\textdegree",!0);N(C,B,le,"£","\\pounds");N(C,B,le,"£","\\mathsterling",!0);N(Ee,B,le,"£","\\pounds");N(Ee,B,le,"£","\\textsterling",!0);N(C,G,le,"✠","\\maltese");N(Ee,G,le,"✠","\\maltese");var lN='0123456789/@."';for(var Mb=0;Mb0)return Li(i,h,s,n,l.concat(m));if(d){var p,x;if(d==="boldsymbol"){var v=ace(i,s,n,l,r);p=v.fontName,x=[v.fontClass]}else c?(p=mR[d].fontName,x=[d]):(p=_p(d,n.fontWeight,n.fontShape),x=[d,n.fontWeight,n.fontShape]);if(Hx(i,p,s).metrics)return Li(i,p,s,n,l.concat(x));if(dR.hasOwnProperty(i)&&p.slice(0,10)==="Typewriter"){for(var b=[],k=0;k{if(yo(t.classes)!==yo(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize)return!1;if(t.classes.length===1){var n=t.classes[0];if(n==="mbin"||n==="mord")return!1}for(var r in t.style)if(t.style.hasOwnProperty(r)&&t.style[r]!==e.style[r])return!1;for(var s in e.style)if(e.style.hasOwnProperty(s)&&t.style[s]!==e.style[s])return!1;return!0},cce=t=>{for(var e=0;en&&(n=l.height),l.depth>r&&(r=l.depth),l.maxFontSize>s&&(s=l.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=s},Cs=function(e,n,r,s){var i=new S0(e,n,r,s);return E5(i),i},hR=(t,e,n,r)=>new S0(t,e,n,r),uce=function(e,n,r){var s=Cs([e],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Le(s.height),s.maxFontSize=1,s},dce=function(e,n,r,s){var i=new M5(e,n,r,s);return E5(i),i},fR=function(e){var n=new w0(e);return E5(n),n},hce=function(e,n){return e instanceof w0?Cs([],[e],n):e},fce=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,l=1;l{var n=Cs(["mspace"],[],e),r=Kn(t,e);return n.style.marginRight=Le(r),n},_p=function(e,n,r){var s="";switch(e){case"amsrm":s="AMS";break;case"textrm":s="Main";break;case"textsf":s="SansSerif";break;case"texttt":s="Typewriter";break;default:s=e}var i;return n==="textbf"&&r==="textit"?i="BoldItalic":n==="textbf"?i="Bold":n==="textit"?i="Italic":i="Regular",s+"-"+i},mR={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},pR={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},gce=function(e,n){var[r,s,i]=pR[e],l=new bo(r),c=new xl([l],{width:Le(s),height:Le(i),style:"width:"+Le(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),d=hR(["overlay"],[c],n);return d.height=i,d.style.height=Le(i),d.style.width=Le(s),d},ge={fontMap:mR,makeSymbol:Li,mathsym:ice,makeSpan:Cs,makeSvgSpan:hR,makeLineSpan:uce,makeAnchor:dce,makeFragment:fR,wrapFragment:hce,makeVList:mce,makeOrd:lce,makeGlue:pce,staticSvg:gce,svgData:pR,tryCombineChars:cce},Xn={number:3,unit:"mu"},tc={number:4,unit:"mu"},Ka={number:5,unit:"mu"},xce={mord:{mop:Xn,mbin:tc,mrel:Ka,minner:Xn},mop:{mord:Xn,mop:Xn,mrel:Ka,minner:Xn},mbin:{mord:tc,mop:tc,mopen:tc,minner:tc},mrel:{mord:Ka,mop:Ka,mopen:Ka,minner:Ka},mopen:{},mclose:{mop:Xn,mbin:tc,mrel:Ka,minner:Xn},mpunct:{mord:Xn,mop:Xn,mrel:Ka,mopen:Xn,mclose:Xn,mpunct:Xn,minner:Xn},minner:{mord:Xn,mop:Xn,mbin:tc,mrel:Ka,mopen:Xn,mpunct:Xn,minner:Xn}},vce={mord:{mop:Xn},mop:{mord:Xn,mop:Xn},mbin:{},mrel:{},mopen:{},mclose:{mop:Xn},mpunct:{},minner:{mop:Xn}},gR={},Yg={},Kg={};function Qe(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:l}=t,c={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:s},d=0;d{var O=k.classes[0],j=b.classes[0];O==="mbin"&&bce.includes(j)?k.classes[0]="mord":j==="mbin"&&yce.includes(O)&&(b.classes[0]="mord")},{node:p},x,v),hN(i,(b,k)=>{var O=N4(k),j=N4(b),T=O&&j?b.hasClass("mtight")?vce[O][j]:xce[O][j]:null;if(T)return ge.makeGlue(T,h)},{node:p},x,v),i},hN=function t(e,n,r,s,i){s&&e.push(s);for(var l=0;lx=>{e.splice(p+1,0,x),l++})(l)}s&&e.pop()},xR=function(e){return e instanceof w0||e instanceof M5||e instanceof S0&&e.hasClass("enclosing")?e:null},kce=function t(e,n){var r=xR(e);if(r){var s=r.children;if(s.length){if(n==="right")return t(s[s.length-1],"right");if(n==="left")return t(s[0],"left")}}return e},N4=function(e,n){return e?(n&&(e=kce(e,n)),Sce[e.classes[0]]||null):null},qf=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return vl(n.concat(r))},Kt=function(e,n,r){if(!e)return vl();if(Yg[e.type]){var s=Yg[e.type](e,n);if(r&&n.size!==r.size){s=vl(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new De("Got group of unknown type: '"+e.type+"'")};function Dp(t,e){var n=vl(["base"],t,e),r=vl(["strut"]);return r.style.height=Le(n.height+n.depth),n.depth&&(r.style.verticalAlign=Le(-n.depth)),n.children.unshift(r),n}function C4(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=Ar(t,e,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],l=[],c=0;c0&&(i.push(Dp(l,e)),l=[]),i.push(r[c]));l.length>0&&i.push(Dp(l,e));var h;n?(h=Dp(Ar(n,e,!0)),h.classes=["tag"],i.push(h)):s&&i.push(s);var m=vl(["katex-html"],i);if(m.setAttribute("aria-hidden","true"),h){var p=h.children[0];p.style.height=Le(m.height+m.depth),m.depth&&(p.style.verticalAlign=Le(-m.depth))}return m}function vR(t){return new w0(t)}class ni{constructor(e,n,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=n||[],this.classes=r||[]}setAttribute(e,n){this.attributes[e]=n}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&e.setAttribute(n,this.attributes[n]);this.classes.length>0&&(e.className=yo(this.classes));for(var r=0;r0&&(e+=' class ="'+tn.escape(yo(this.classes))+'"'),e+=">";for(var r=0;r",e}toText(){return this.children.map(e=>e.toText()).join("")}}class ga{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return tn.escape(this.toText())}toText(){return this.text}}class Oce{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",Le(this.width)),e}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var _e={MathNode:ni,TextNode:ga,SpaceNode:Oce,newDocumentFragment:vR},Mi=function(e,n,r){return Ln[n][e]&&Ln[n][e].replace&&e.charCodeAt(0)!==55349&&!(dR.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=Ln[n][e].replace),new _e.TextNode(e)},_5=function(e){return e.length===1?e[0]:new _e.MathNode("mrow",e)},D5=function(e,n){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold";var r=n.font;if(!r||r==="mathnormal")return null;var s=e.mode;if(r==="mathit")return"italic";if(r==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(r==="mathbf")return"bold";if(r==="mathbb")return"double-struck";if(r==="mathsfit")return"sans-serif-italic";if(r==="mathfrak")return"fraktur";if(r==="mathscr"||r==="mathcal")return"script";if(r==="mathsf")return"sans-serif";if(r==="mathtt")return"monospace";var i=e.text;if(["\\imath","\\jmath"].includes(i))return null;Ln[s][i]&&Ln[s][i].replace&&(i=Ln[s][i].replace);var l=ge.fontMap[r].fontName;return A5(i,l,s)?ge.fontMap[r].variant:null};function Rb(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof ga&&e.text==="."}else if(t.type==="mo"&&t.children.length===1&&t.getAttribute("separator")==="true"&&t.getAttribute("lspace")==="0em"&&t.getAttribute("rspace")==="0em"){var n=t.children[0];return n instanceof ga&&n.text===","}else return!1}var Fs=function(e,n,r){if(e.length===1){var s=zn(e[0],n);return r&&s instanceof ni&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],l,c=0;c=1&&(l.type==="mn"||Rb(l))){var h=d.children[0];h instanceof ni&&h.type==="mn"&&(h.children=[...l.children,...h.children],i.pop())}else if(l.type==="mi"&&l.children.length===1){var m=l.children[0];if(m instanceof ga&&m.text==="̸"&&(d.type==="mo"||d.type==="mi"||d.type==="mn")){var p=d.children[0];p instanceof ga&&p.text.length>0&&(p.text=p.text.slice(0,1)+"̸"+p.text.slice(1),i.pop())}}}i.push(d),l=d}return i},wo=function(e,n,r){return _5(Fs(e,n,r))},zn=function(e,n){if(!e)return new _e.MathNode("mrow");if(Kg[e.type]){var r=Kg[e.type](e,n);return r}else throw new De("Got group of unknown type: '"+e.type+"'")};function fN(t,e,n,r,s){var i=Fs(t,n),l;i.length===1&&i[0]instanceof ni&&["mrow","mtable"].includes(i[0].type)?l=i[0]:l=new _e.MathNode("mrow",i);var c=new _e.MathNode("annotation",[new _e.TextNode(e)]);c.setAttribute("encoding","application/x-tex");var d=new _e.MathNode("semantics",[l,c]),h=new _e.MathNode("math",[d]);h.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&h.setAttribute("display","block");var m=s?"katex":"katex-mathml";return ge.makeSpan([m],[h])}var yR=function(e){return new sl({style:e.displayMode?at.DISPLAY:at.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},bR=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=ge.makeSpan(r,[e])}return e},jce=function(e,n,r){var s=yR(r),i;if(r.output==="mathml")return fN(e,n,s,r.displayMode,!0);if(r.output==="html"){var l=C4(e,s);i=ge.makeSpan(["katex"],[l])}else{var c=fN(e,n,s,r.displayMode,!1),d=C4(e,s);i=ge.makeSpan(["katex"],[c,d])}return bR(i,r)},Nce=function(e,n,r){var s=yR(r),i=C4(e,s),l=ge.makeSpan(["katex"],[i]);return bR(l,r)},Cce={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Tce=function(e){var n=new _e.MathNode("mo",[new _e.TextNode(Cce[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},Ace={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Mce=function(e){return e.type==="ordgroup"?e.body.length:1},Ece=function(e,n){function r(){var c=4e5,d=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(d)){var h=e,m=Mce(h.base),p,x,v;if(m>5)d==="widehat"||d==="widecheck"?(p=420,c=2364,v=.42,x=d+"4"):(p=312,c=2340,v=.34,x="tilde4");else{var b=[1,1,2,2,3,3][m];d==="widehat"||d==="widecheck"?(c=[0,1062,2364,2364,2364][b],p=[0,239,300,360,420][b],v=[0,.24,.3,.3,.36,.42][b],x=d+b):(c=[0,600,1033,2339,2340][b],p=[0,260,286,306,312][b],v=[0,.26,.286,.3,.306,.34][b],x="tilde"+b)}var k=new bo(x),O=new xl([k],{width:"100%",height:Le(v),viewBox:"0 0 "+c+" "+p,preserveAspectRatio:"none"});return{span:ge.makeSvgSpan([],[O],n),minWidth:0,height:v}}else{var j=[],T=Ace[d],[A,_,D]=T,E=D/1e3,z=A.length,Q,F;if(z===1){var L=T[3];Q=["hide-tail"],F=[L]}else if(z===2)Q=["halfarrow-left","halfarrow-right"],F=["xMinYMin","xMaxYMin"];else if(z===3)Q=["brace-left","brace-center","brace-right"],F=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support + `+z+" children.");for(var U=0;U0&&(s.style.minWidth=Le(i)),s},_ce=function(e,n,r,s,i){var l,c=e.height+e.depth+r+s;if(/fbox|color|angl/.test(n)){if(l=ge.makeSpan(["stretchy",n],[],i),n==="fbox"){var d=i.color&&i.getColor();d&&(l.style.borderColor=d)}}else{var h=[];/^[bx]cancel$/.test(n)&&h.push(new O4({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&h.push(new O4({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var m=new xl(h,{width:"100%",height:Le(c)});l=ge.makeSvgSpan([],[m],i)}return l.height=c,l.style.height=Le(c),l},yl={encloseSpan:_ce,mathMLnode:Tce,svgSpan:Ece};function Nt(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function R5(t){var e=Ux(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function Ux(t){return t&&(t.type==="atom"||rce.hasOwnProperty(t.type))?t:null}var z5=(t,e)=>{var n,r,s;t&&t.type==="supsub"?(r=Nt(t.base,"accent"),n=r.base,t.base=n,s=tce(Kt(t,e)),t.base=r):(r=Nt(t,"accent"),n=r.base);var i=Kt(n,e.havingCrampedStyle()),l=r.isShifty&&tn.isCharacterBox(n),c=0;if(l){var d=tn.getBaseElem(n),h=Kt(d,e.havingCrampedStyle());c=aN(h).skew}var m=r.label==="\\c",p=m?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),x;if(r.isStretchy)x=yl.svgSpan(r,e),x=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:x,wrapperClasses:["svg-align"],wrapperStyle:c>0?{width:"calc(100% - "+Le(2*c)+")",marginLeft:Le(2*c)}:void 0}]},e);else{var v,b;r.label==="\\vec"?(v=ge.staticSvg("vec",e),b=ge.svgData.vec[1]):(v=ge.makeOrd({mode:r.mode,text:r.label},e,"textord"),v=aN(v),v.italic=0,b=v.width,m&&(p+=v.depth)),x=ge.makeSpan(["accent-body"],[v]);var k=r.label==="\\textcircled";k&&(x.classes.push("accent-full"),p=i.height);var O=c;k||(O-=b/2),x.style.left=Le(O),r.label==="\\textcircled"&&(x.style.top=".2em"),x=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-p},{type:"elem",elem:x}]},e)}var j=ge.makeSpan(["mord","accent"],[x],e);return s?(s.children[0]=j,s.height=Math.max(j.height,s.height),s.classes[0]="mord",s):j},wR=(t,e)=>{var n=t.isStretchy?yl.mathMLnode(t.label):new _e.MathNode("mo",[Mi(t.label,t.mode)]),r=new _e.MathNode("mover",[zn(t.base,e),n]);return r.setAttribute("accent","true"),r},Dce=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));Qe({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(t,e)=>{var n=Zg(e[0]),r=!Dce.test(t.funcName),s=!r||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:r,isShifty:s,base:n}},htmlBuilder:z5,mathmlBuilder:wR});Qe({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(t,e)=>{var n=e[0],r=t.parser.mode;return r==="math"&&(t.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+t.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:t.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:z5,mathmlBuilder:wR});Qe({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"accentUnder",mode:n.mode,label:r,base:s}},htmlBuilder:(t,e)=>{var n=Kt(t.base,e),r=yl.svgSpan(t,e),s=t.label==="\\utilde"?.12:0,i=ge.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]},e);return ge.makeSpan(["mord","accentunder"],[i],e)},mathmlBuilder:(t,e)=>{var n=yl.mathMLnode(t.label),r=new _e.MathNode("munder",[zn(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var Rp=t=>{var e=new _e.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Qe({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r,funcName:s}=t;return{type:"xArrow",mode:r.mode,label:s,body:e[0],below:n[0]}},htmlBuilder(t,e){var n=e.style,r=e.havingStyle(n.sup()),s=ge.wrapFragment(Kt(t.body,r,e),e),i=t.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var l;t.below&&(r=e.havingStyle(n.sub()),l=ge.wrapFragment(Kt(t.below,r,e),e),l.classes.push(i+"-arrow-pad"));var c=yl.svgSpan(t,e),d=-e.fontMetrics().axisHeight+.5*c.height,h=-e.fontMetrics().axisHeight-.5*c.height-.111;(s.depth>.25||t.label==="\\xleftequilibrium")&&(h-=s.depth);var m;if(l){var p=-e.fontMetrics().axisHeight+l.height+.5*c.height+.111;m=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:c,shift:d},{type:"elem",elem:l,shift:p}]},e)}else m=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:c,shift:d}]},e);return m.children[0].children[0].children[1].classes.push("svg-align"),ge.makeSpan(["mrel","x-arrow"],[m],e)},mathmlBuilder(t,e){var n=yl.mathMLnode(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var s=Rp(zn(t.body,e));if(t.below){var i=Rp(zn(t.below,e));r=new _e.MathNode("munderover",[n,i,s])}else r=new _e.MathNode("mover",[n,s])}else if(t.below){var l=Rp(zn(t.below,e));r=new _e.MathNode("munder",[n,l])}else r=Rp(),r=new _e.MathNode("mover",[n,r]);return r}});var Rce=ge.makeSpan;function SR(t,e){var n=Ar(t.body,e,!0);return Rce([t.mclass],n,e)}function kR(t,e){var n,r=Fs(t.body,e);return t.mclass==="minner"?n=new _e.MathNode("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new _e.MathNode("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new _e.MathNode("mo",r),t.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):t.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):t.mclass==="mopen"||t.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):t.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}Qe({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:ar(s),isCharacterBox:tn.isCharacterBox(s)}},htmlBuilder:SR,mathmlBuilder:kR});var Vx=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};Qe({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:Vx(e[0]),body:ar(e[1]),isCharacterBox:tn.isCharacterBox(e[1])}}});Qe({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,s=e[1],i=e[0],l;r!=="\\stackrel"?l=Vx(s):l="mrel";var c={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:ar(s)},d={type:"supsub",mode:i.mode,base:c,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:l,body:[d],isCharacterBox:tn.isCharacterBox(d)}},htmlBuilder:SR,mathmlBuilder:kR});Qe({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:Vx(e[0]),body:ar(e[0])}},htmlBuilder(t,e){var n=Ar(t.body,e,!0),r=ge.makeSpan([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=Fs(t.body,e),r=new _e.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var zce={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},mN=()=>({type:"styling",body:[],mode:"math",style:"display"}),pN=t=>t.type==="textord"&&t.text==="@",Pce=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function Bce(t,e,n){var r=zce[t];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var s=n.callFunction("\\\\cdleft",[e[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},l=n.callFunction("\\Big",[i],[]),c=n.callFunction("\\\\cdright",[e[1]],[]),d={type:"ordgroup",mode:"math",body:[s,l,c]};return n.callFunction("\\\\cdparent",[d],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var h={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[h],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Lce(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var n=t.fetch().text;if(n==="&"||n==="\\\\")t.consume();else if(n==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new De("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],s=[r],i=0;i-1))if("<>AV".indexOf(h)>-1)for(var p=0;p<2;p++){for(var x=!0,v=d+1;vAV=|." after @',l[d]);var b=Bce(h,m,t),k={type:"styling",body:[b],mode:"math",style:"display"};r.push(k),c=mN()}i%2===0?r.push(c):r.shift(),r=[],s.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var O=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:O,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}Qe({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:e[0]}},htmlBuilder(t,e){var n=e.havingStyle(e.style.sup()),r=ge.wrapFragment(Kt(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=Le(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new _e.MathNode("mrow",[zn(t.label,e)]);return n=new _e.MathNode("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new _e.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Qe({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(t,e){var{parser:n}=t;return{type:"cdlabelparent",mode:n.mode,fragment:e[0]}},htmlBuilder(t,e){var n=ge.wrapFragment(Kt(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new _e.MathNode("mrow",[zn(t.fragment,e)])}});Qe({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=Nt(e[0],"ordgroup"),s=r.body,i="",l=0;l=1114111)throw new De("\\@char with invalid code point "+i);return d<=65535?h=String.fromCharCode(d):(d-=65536,h=String.fromCharCode((d>>10)+55296,(d&1023)+56320)),{type:"textord",mode:n.mode,text:h}}});var OR=(t,e)=>{var n=Ar(t.body,e.withColor(t.color),!1);return ge.makeFragment(n)},jR=(t,e)=>{var n=Fs(t.body,e.withColor(t.color)),r=new _e.MathNode("mstyle",n);return r.setAttribute("mathcolor",t.color),r};Qe({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=Nt(e[0],"color-token").color,s=e[1];return{type:"color",mode:n.mode,color:r,body:ar(s)}},htmlBuilder:OR,mathmlBuilder:jR});Qe({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,s=Nt(e[0],"color-token").color;n.gullet.macros.set("\\current@color",s);var i=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:s,body:i}},htmlBuilder:OR,mathmlBuilder:jR});Qe({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(t,e,n){var{parser:r}=t,s=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,i=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:i,size:s&&Nt(s,"size").value}},htmlBuilder(t,e){var n=ge.makeSpan(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=Le(Kn(t.size,e)))),n},mathmlBuilder(t,e){var n=new _e.MathNode("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",Le(Kn(t.size,e)))),n}});var T4={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},NR=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new De("Expected a control sequence",t);return e},Ice=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},CR=(t,e,n,r)=>{var s=t.gullet.macros.get(n.text);s==null&&(n.noexpand=!0,s={tokens:[n],numArgs:0,unexpandable:!t.gullet.isExpandable(n.text)}),t.gullet.macros.set(e,s,r)};Qe({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(t){var{parser:e,funcName:n}=t;e.consumeSpaces();var r=e.fetch();if(T4[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=T4[r.text]),Nt(e.parseFunction(),"internal");throw new De("Invalid token after macro prefix",r)}});Qe({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=e.gullet.popToken(),s=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new De("Expected a control sequence",r);for(var i=0,l,c=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){l=e.gullet.future(),c[i].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new De('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new De('Argument number "'+r.text+'" out of order');i++,c.push([])}else{if(r.text==="EOF")throw new De("Expected a macro definition");c[i].push(r.text)}var{tokens:d}=e.gullet.consumeArg();return l&&d.unshift(l),(n==="\\edef"||n==="\\xdef")&&(d=e.gullet.expandTokens(d),d.reverse()),e.gullet.macros.set(s,{tokens:d,numArgs:i,delimiters:c},n===T4[n]),{type:"internal",mode:e.mode}}});Qe({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=NR(e.gullet.popToken());e.gullet.consumeSpaces();var s=Ice(e);return CR(e,r,s,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});Qe({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=NR(e.gullet.popToken()),s=e.gullet.popToken(),i=e.gullet.popToken();return CR(e,r,i,n==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});var Vh=function(e,n,r){var s=Ln.math[e]&&Ln.math[e].replace,i=A5(s||e,n,r);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return i},P5=function(e,n,r,s){var i=r.havingBaseStyle(n),l=ge.makeSpan(s.concat(i.sizingClasses(r)),[e],r),c=i.sizeMultiplier/r.sizeMultiplier;return l.height*=c,l.depth*=c,l.maxFontSize=i.sizeMultiplier,l},TR=function(e,n,r){var s=n.havingBaseStyle(r),i=(1-n.sizeMultiplier/s.sizeMultiplier)*n.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=Le(i),e.height-=i,e.depth+=i},qce=function(e,n,r,s,i,l){var c=ge.makeSymbol(e,"Main-Regular",i,s),d=P5(c,n,s,l);return r&&TR(d,s,n),d},Fce=function(e,n,r,s){return ge.makeSymbol(e,"Size"+n+"-Regular",r,s)},AR=function(e,n,r,s,i,l){var c=Fce(e,n,i,s),d=P5(ge.makeSpan(["delimsizing","size"+n],[c],s),at.TEXT,s,l);return r&&TR(d,s,at.TEXT),d},zb=function(e,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=ge.makeSpan(["delimsizinginner",s],[ge.makeSpan([],[ge.makeSymbol(e,n,r)])]);return{type:"elem",elem:i}},Pb=function(e,n,r){var s=pa["Size4-Regular"][e.charCodeAt(0)]?pa["Size4-Regular"][e.charCodeAt(0)][4]:pa["Size1-Regular"][e.charCodeAt(0)][4],i=new bo("inner",Voe(e,Math.round(1e3*n))),l=new xl([i],{width:Le(s),height:Le(n),style:"width:"+Le(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),c=ge.makeSvgSpan([],[l],r);return c.height=n,c.style.height=Le(n),c.style.width=Le(s),{type:"elem",elem:c}},A4=.008,zp={type:"kern",size:-1*A4},Qce=["|","\\lvert","\\rvert","\\vert"],$ce=["\\|","\\lVert","\\rVert","\\Vert"],MR=function(e,n,r,s,i,l){var c,d,h,m,p="",x=0;c=h=m=e,d=null;var v="Size1-Regular";e==="\\uparrow"?h=m="⏐":e==="\\Uparrow"?h=m="‖":e==="\\downarrow"?c=h="⏐":e==="\\Downarrow"?c=h="‖":e==="\\updownarrow"?(c="\\uparrow",h="⏐",m="\\downarrow"):e==="\\Updownarrow"?(c="\\Uparrow",h="‖",m="\\Downarrow"):Qce.includes(e)?(h="∣",p="vert",x=333):$ce.includes(e)?(h="∥",p="doublevert",x=556):e==="["||e==="\\lbrack"?(c="⎡",h="⎢",m="⎣",v="Size4-Regular",p="lbrack",x=667):e==="]"||e==="\\rbrack"?(c="⎤",h="⎥",m="⎦",v="Size4-Regular",p="rbrack",x=667):e==="\\lfloor"||e==="⌊"?(h=c="⎢",m="⎣",v="Size4-Regular",p="lfloor",x=667):e==="\\lceil"||e==="⌈"?(c="⎡",h=m="⎢",v="Size4-Regular",p="lceil",x=667):e==="\\rfloor"||e==="⌋"?(h=c="⎥",m="⎦",v="Size4-Regular",p="rfloor",x=667):e==="\\rceil"||e==="⌉"?(c="⎤",h=m="⎥",v="Size4-Regular",p="rceil",x=667):e==="("||e==="\\lparen"?(c="⎛",h="⎜",m="⎝",v="Size4-Regular",p="lparen",x=875):e===")"||e==="\\rparen"?(c="⎞",h="⎟",m="⎠",v="Size4-Regular",p="rparen",x=875):e==="\\{"||e==="\\lbrace"?(c="⎧",d="⎨",m="⎩",h="⎪",v="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(c="⎫",d="⎬",m="⎭",h="⎪",v="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(c="⎧",m="⎩",h="⎪",v="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(c="⎫",m="⎭",h="⎪",v="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(c="⎧",m="⎭",h="⎪",v="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(c="⎫",m="⎩",h="⎪",v="Size4-Regular");var b=Vh(c,v,i),k=b.height+b.depth,O=Vh(h,v,i),j=O.height+O.depth,T=Vh(m,v,i),A=T.height+T.depth,_=0,D=1;if(d!==null){var E=Vh(d,v,i);_=E.height+E.depth,D=2}var z=k+A+_,Q=Math.max(0,Math.ceil((n-z)/(D*j))),F=z+Q*D*j,L=s.fontMetrics().axisHeight;r&&(L*=s.sizeMultiplier);var U=F/2-L,V=[];if(p.length>0){var ce=F-k-A,W=Math.round(F*1e3),J=Woe(p,Math.round(ce*1e3)),$=new bo(p,J),ae=(x/1e3).toFixed(3)+"em",ne=(W/1e3).toFixed(3)+"em",ue=new xl([$],{width:ae,height:ne,viewBox:"0 0 "+x+" "+W}),R=ge.makeSvgSpan([],[ue],s);R.height=W/1e3,R.style.width=ae,R.style.height=ne,V.push({type:"elem",elem:R})}else{if(V.push(zb(m,v,i)),V.push(zp),d===null){var me=F-k-A+2*A4;V.push(Pb(h,me,s))}else{var Y=(F-k-A-_)/2+2*A4;V.push(Pb(h,Y,s)),V.push(zp),V.push(zb(d,v,i)),V.push(zp),V.push(Pb(h,Y,s))}V.push(zp),V.push(zb(c,v,i))}var P=s.havingBaseStyle(at.TEXT),K=ge.makeVList({positionType:"bottom",positionData:U,children:V},P);return P5(ge.makeSpan(["delimsizing","mult"],[K],P),at.TEXT,s,l)},Bb=80,Lb=.08,Ib=function(e,n,r,s,i){var l=Uoe(e,s,r),c=new bo(e,l),d=new xl([c],{width:"400em",height:Le(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return ge.makeSvgSpan(["hide-tail"],[d],i)},Hce=function(e,n){var r=n.havingBaseSizing(),s=RR("\\surd",e*r.sizeMultiplier,DR,r),i=r.sizeMultiplier,l=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),c,d=0,h=0,m=0,p;return s.type==="small"?(m=1e3+1e3*l+Bb,e<1?i=1:e<1.4&&(i=.7),d=(1+l+Lb)/i,h=(1+l)/i,c=Ib("sqrtMain",d,m,l,n),c.style.minWidth="0.853em",p=.833/i):s.type==="large"?(m=(1e3+Bb)*cf[s.size],h=(cf[s.size]+l)/i,d=(cf[s.size]+l+Lb)/i,c=Ib("sqrtSize"+s.size,d,m,l,n),c.style.minWidth="1.02em",p=1/i):(d=e+l+Lb,h=e+l,m=Math.floor(1e3*e+l)+Bb,c=Ib("sqrtTall",d,m,l,n),c.style.minWidth="0.742em",p=1.056),c.height=h,c.style.height=Le(d),{span:c,advanceWidth:p,ruleWidth:(n.fontMetrics().sqrtRuleThickness+l)*i}},ER=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Uce=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],_R=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],cf=[0,1.2,1.8,2.4,3],Vce=function(e,n,r,s,i){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),ER.includes(e)||_R.includes(e))return AR(e,n,!1,r,s,i);if(Uce.includes(e))return MR(e,cf[n],!1,r,s,i);throw new De("Illegal delimiter: '"+e+"'")},Wce=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Gce=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"stack"}],DR=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Xce=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},RR=function(e,n,r,s){for(var i=Math.min(2,3-s.style.size),l=i;ln)return r[l]}return r[r.length-1]},zR=function(e,n,r,s,i,l){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var c;_R.includes(e)?c=Wce:ER.includes(e)?c=DR:c=Gce;var d=RR(e,n,c,s);return d.type==="small"?qce(e,d.style,r,s,i,l):d.type==="large"?AR(e,d.size,r,s,i,l):MR(e,n,r,s,i,l)},Yce=function(e,n,r,s,i,l){var c=s.fontMetrics().axisHeight*s.sizeMultiplier,d=901,h=5/s.fontMetrics().ptPerEm,m=Math.max(n-c,r+c),p=Math.max(m/500*d,2*m-h);return zR(e,p,!0,s,i,l)},dl={sqrtImage:Hce,sizedDelim:Vce,sizeToMaxHeight:cf,customSizedDelim:zR,leftRightDelim:Yce},gN={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Kce=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function Wx(t,e){var n=Ux(t);if(n&&Kce.includes(n.text))return n;throw n?new De("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new De("Invalid delimiter type '"+t.type+"'",t)}Qe({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,e)=>{var n=Wx(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:gN[t.funcName].size,mclass:gN[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?ge.makeSpan([t.mclass]):dl.sizedDelim(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(Mi(t.delim,t.mode));var n=new _e.MathNode("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Le(dl.sizeToMaxHeight[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function xN(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Qe({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=t.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new De("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:Wx(e[0],t).text,color:n}}});Qe({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Wx(e[0],t),r=t.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=Nt(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(t,e)=>{xN(t);for(var n=Ar(t.body,e,!0,["mopen","mclose"]),r=0,s=0,i=!1,l=0;l{xN(t);var n=Fs(t.body,e);if(t.left!=="."){var r=new _e.MathNode("mo",[Mi(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var s=new _e.MathNode("mo",[Mi(t.right,t.mode)]);s.setAttribute("fence","true"),t.rightColor&&s.setAttribute("mathcolor",t.rightColor),n.push(s)}return _5(n)}});Qe({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Wx(e[0],t);if(!t.parser.leftrightDepth)throw new De("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=qf(e,[]);else{n=dl.sizedDelim(t.delim,1,e,t.mode,[]);var r={delim:t.delim,options:e};n.isMiddle=r}return n},mathmlBuilder:(t,e)=>{var n=t.delim==="\\vert"||t.delim==="|"?Mi("|","text"):Mi(t.delim,t.mode),r=new _e.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var B5=(t,e)=>{var n=ge.wrapFragment(Kt(t.body,e),e),r=t.label.slice(1),s=e.sizeMultiplier,i,l=0,c=tn.isCharacterBox(t.body);if(r==="sout")i=ge.makeSpan(["stretchy","sout"]),i.height=e.fontMetrics().defaultRuleThickness/s,l=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var d=Kn({number:.6,unit:"pt"},e),h=Kn({number:.35,unit:"ex"},e),m=e.havingBaseSizing();s=s/m.sizeMultiplier;var p=n.height+n.depth+d+h;n.style.paddingLeft=Le(p/2+d);var x=Math.floor(1e3*p*s),v=$oe(x),b=new xl([new bo("phase",v)],{width:"400em",height:Le(x/1e3),viewBox:"0 0 400000 "+x,preserveAspectRatio:"xMinYMin slice"});i=ge.makeSvgSpan(["hide-tail"],[b],e),i.style.height=Le(p),l=n.depth+d+h}else{/cancel/.test(r)?c||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var k=0,O=0,j=0;/box/.test(r)?(j=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),k=e.fontMetrics().fboxsep+(r==="colorbox"?0:j),O=k):r==="angl"?(j=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),k=4*j,O=Math.max(0,.25-n.depth)):(k=c?.2:0,O=k),i=yl.encloseSpan(n,r,k,O,e),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Le(j)):r==="angl"&&j!==.049&&(i.style.borderTopWidth=Le(j),i.style.borderRightWidth=Le(j)),l=n.depth+O,t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor,t.borderColor&&(i.style.borderColor=t.borderColor))}var T;if(t.backgroundColor)T=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:l},{type:"elem",elem:n,shift:0}]},e);else{var A=/cancel|phase/.test(r)?["svg-align"]:[];T=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:l,wrapperClasses:A}]},e)}return/cancel/.test(r)&&(T.height=n.height,T.depth=n.depth),/cancel/.test(r)&&!c?ge.makeSpan(["mord","cancel-lap"],[T],e):ge.makeSpan(["mord"],[T],e)},L5=(t,e)=>{var n=0,r=new _e.MathNode(t.label.indexOf("colorbox")>-1?"mpadded":"menclose",[zn(t.body,e)]);switch(t.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),t.label==="\\fcolorbox"){var s=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+s+"em solid "+String(t.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};Qe({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Nt(e[0],"color-token").color,l=e[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:l}},htmlBuilder:B5,mathmlBuilder:L5});Qe({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Nt(e[0],"color-token").color,l=Nt(e[1],"color-token").color,c=e[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:l,borderColor:i,body:c}},htmlBuilder:B5,mathmlBuilder:L5});Qe({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\fbox",body:e[0]}}});Qe({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"enclose",mode:n.mode,label:r,body:s}},htmlBuilder:B5,mathmlBuilder:L5});Qe({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\angl",body:e[0]}}});var PR={};function Ca(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:l}=t,c={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},d=0;d{var e=t.parser.settings;if(!e.displayMode)throw new De("{"+t.envName+"} can be used only in display mode.")};function I5(t){if(t.indexOf("ed")===-1)return t.indexOf("*")===-1}function Mo(t,e,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:l,colSeparationType:c,autoTag:d,singleRow:h,emptySingleRow:m,maxNumCols:p,leqno:x}=e;if(t.gullet.beginGroup(),h||t.gullet.macros.set("\\cr","\\\\\\relax"),!l){var v=t.gullet.expandMacroAsText("\\arraystretch");if(v==null)l=1;else if(l=parseFloat(v),!l||l<0)throw new De("Invalid \\arraystretch: "+v)}t.gullet.beginGroup();var b=[],k=[b],O=[],j=[],T=d!=null?[]:void 0;function A(){d&&t.gullet.macros.set("\\@eqnsw","1",!0)}function _(){T&&(t.gullet.macros.get("\\df@tag")?(T.push(t.subparse([new ii("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):T.push(!!d&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(A(),j.push(vN(t));;){var D=t.parseExpression(!1,h?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),D={type:"ordgroup",mode:t.mode,body:D},n&&(D={type:"styling",mode:t.mode,style:n,body:[D]}),b.push(D);var E=t.fetch().text;if(E==="&"){if(p&&b.length===p){if(h||c)throw new De("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(E==="\\end"){_(),b.length===1&&D.type==="styling"&&D.body[0].body.length===0&&(k.length>1||!m)&&k.pop(),j.length0&&(A+=.25),h.push({pos:A,isDashed:Jn[nn]})}for(_(l[0]),r=0;r0&&(U+=T,zJn))for(r=0;r=c)){var ve=void 0;(s>0||e.hskipBeforeAndAfter)&&(ve=tn.deflt(Y.pregap,x),ve!==0&&(J=ge.makeSpan(["arraycolsep"],[]),J.style.width=Le(ve),W.push(J)));var Re=[];for(r=0;r0){for(var Oe=ge.makeLineSpan("hline",n,m),nt=ge.makeLineSpan("hdashline",n,m),ut=[{type:"elem",elem:d,shift:0}];h.length>0;){var Ct=h.pop(),In=Ct.pos-V;Ct.isDashed?ut.push({type:"elem",elem:nt,shift:In}):ut.push({type:"elem",elem:Oe,shift:In})}d=ge.makeVList({positionType:"individualShift",children:ut},n)}if(ae.length===0)return ge.makeSpan(["mord"],[d],n);var Tn=ge.makeVList({positionType:"individualShift",children:ae},n);return Tn=ge.makeSpan(["tag"],[Tn],n),ge.makeFragment([d,Tn])},Zce={c:"center ",l:"left ",r:"right "},Aa=function(e,n){for(var r=[],s=new _e.MathNode("mtd",[],["mtr-glue"]),i=new _e.MathNode("mtd",[],["mml-eqn-num"]),l=0;l0){var b=e.cols,k="",O=!1,j=0,T=b.length;b[0].type==="separator"&&(x+="top ",j=1),b[b.length-1].type==="separator"&&(x+="bottom ",T-=1);for(var A=j;A0?"left ":"",x+=Q[Q.length-1].length>0?"right ":"";for(var F=1;F-1?"alignat":"align",i=e.envName==="split",l=Mo(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:I5(e.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),c,d=0,h={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var m="",p=0;p0&&v&&(O=1),r[b]={type:"align",align:k,pregap:O,postgap:0}}return l.colSeparationType=v?"align":"alignat",l};Ca({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=Ux(e[0]),r=n?[e[0]]:Nt(e[0],"ordgroup").body,s=r.map(function(l){var c=R5(l),d=c.text;if("lcr".indexOf(d)!==-1)return{type:"align",align:d};if(d==="|")return{type:"separator",separator:"|"};if(d===":")return{type:"separator",separator:":"};throw new De("Unknown column alignment: "+d,l)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return Mo(t.parser,i,q5(t.envName))},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(t.envName.charAt(t.envName.length-1)==="*"){var s=t.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),n=s.fetch().text,"lcr".indexOf(n)===-1)throw new De("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=Mo(t.parser,r,q5(t.envName)),l=Math.max(0,...i.body.map(c=>c.length));return i.cols=new Array(l).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[i],left:e[0],right:e[1],rightColor:void 0}:i},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=Mo(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=Ux(e[0]),r=n?[e[0]]:Nt(e[0],"ordgroup").body,s=r.map(function(l){var c=R5(l),d=c.text;if("lc".indexOf(d)!==-1)return{type:"align",align:d};throw new De("Unknown column alignment: "+d,l)});if(s.length>1)throw new De("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5};if(i=Mo(t.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new De("{subarray} can contain only one column");return i},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=Mo(t.parser,e,q5(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.indexOf("r")>-1?".":"\\{",right:t.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:LR,htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){["gather","gather*"].includes(t.envName)&&Gx(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:I5(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return Mo(t.parser,e,"display")},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:LR,htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){Gx(t);var e={autoTag:I5(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return Mo(t.parser,e,"display")},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["CD"],props:{numArgs:0},handler(t){return Gx(t),Lce(t.parser)},htmlBuilder:Ta,mathmlBuilder:Aa});q("\\nonumber","\\gdef\\@eqnsw{0}");q("\\notag","\\nonumber");Qe({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new De(t.funcName+" valid only within array environment")}});var yN=PR;Qe({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];if(s.type!=="ordgroup")throw new De("Invalid environment name",s);for(var i="",l=0;l{var n=t.font,r=e.withFont(n);return Kt(t.body,r)},qR=(t,e)=>{var n=t.font,r=e.withFont(n);return zn(t.body,r)},bN={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Qe({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=Zg(e[0]),i=r;return i in bN&&(i=bN[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:IR,mathmlBuilder:qR});Qe({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0],s=tn.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:Vx(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:s}}});Qe({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,breakOnTokenText:s}=t,{mode:i}=n,l=n.parseExpression(!0,s),c="math"+r.slice(1);return{type:"font",mode:i,font:c,body:{type:"ordgroup",mode:n.mode,body:l}}},htmlBuilder:IR,mathmlBuilder:qR});var FR=(t,e)=>{var n=e;return t==="display"?n=n.id>=at.SCRIPT.id?n.text():at.DISPLAY:t==="text"&&n.size===at.DISPLAY.size?n=at.TEXT:t==="script"?n=at.SCRIPT:t==="scriptscript"&&(n=at.SCRIPTSCRIPT),n},F5=(t,e)=>{var n=FR(t.size,e.style),r=n.fracNum(),s=n.fracDen(),i;i=e.havingStyle(r);var l=Kt(t.numer,i,e);if(t.continued){var c=8.5/e.fontMetrics().ptPerEm,d=3.5/e.fontMetrics().ptPerEm;l.height=l.height0?b=3*x:b=7*x,k=e.fontMetrics().denom1):(p>0?(v=e.fontMetrics().num2,b=x):(v=e.fontMetrics().num3,b=3*x),k=e.fontMetrics().denom2);var O;if(m){var T=e.fontMetrics().axisHeight;v-l.depth-(T+.5*p){var n=new _e.MathNode("mfrac",[zn(t.numer,e),zn(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=Kn(t.barSize,e);n.setAttribute("linethickness",Le(r))}var s=FR(t.size,e.style);if(s.size!==e.style.size){n=new _e.MathNode("mstyle",[n]);var i=s.size===at.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",i),n.setAttribute("scriptlevel","0")}if(t.leftDelim!=null||t.rightDelim!=null){var l=[];if(t.leftDelim!=null){var c=new _e.MathNode("mo",[new _e.TextNode(t.leftDelim.replace("\\",""))]);c.setAttribute("fence","true"),l.push(c)}if(l.push(n),t.rightDelim!=null){var d=new _e.MathNode("mo",[new _e.TextNode(t.rightDelim.replace("\\",""))]);d.setAttribute("fence","true"),l.push(d)}return _5(l)}return n};Qe({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1],l,c=null,d=null,h="auto";switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":l=!0;break;case"\\\\atopfrac":l=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":l=!1,c="(",d=")";break;case"\\\\bracefrac":l=!1,c="\\{",d="\\}";break;case"\\\\brackfrac":l=!1,c="[",d="]";break;default:throw new Error("Unrecognized genfrac command")}switch(r){case"\\dfrac":case"\\dbinom":h="display";break;case"\\tfrac":case"\\tbinom":h="text";break}return{type:"genfrac",mode:n.mode,continued:!1,numer:s,denom:i,hasBarLine:l,leftDelim:c,rightDelim:d,size:h,barSize:null}},htmlBuilder:F5,mathmlBuilder:Q5});Qe({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1];return{type:"genfrac",mode:n.mode,continued:!0,numer:s,denom:i,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});Qe({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(t){var{parser:e,funcName:n,token:r}=t,s;switch(n){case"\\over":s="\\frac";break;case"\\choose":s="\\binom";break;case"\\atop":s="\\\\atopfrac";break;case"\\brace":s="\\\\bracefrac";break;case"\\brack":s="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:s,token:r}}});var wN=["display","text","script","scriptscript"],SN=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};Qe({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(t,e){var{parser:n}=t,r=e[4],s=e[5],i=Zg(e[0]),l=i.type==="atom"&&i.family==="open"?SN(i.text):null,c=Zg(e[1]),d=c.type==="atom"&&c.family==="close"?SN(c.text):null,h=Nt(e[2],"size"),m,p=null;h.isBlank?m=!0:(p=h.value,m=p.number>0);var x="auto",v=e[3];if(v.type==="ordgroup"){if(v.body.length>0){var b=Nt(v.body[0],"textord");x=wN[Number(b.text)]}}else v=Nt(v,"textord"),x=wN[Number(v.text)];return{type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:m,barSize:p,leftDelim:l,rightDelim:d,size:x}},htmlBuilder:F5,mathmlBuilder:Q5});Qe({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(t,e){var{parser:n,funcName:r,token:s}=t;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:Nt(e[0],"size").value,token:s}}});Qe({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=Toe(Nt(e[1],"infix").size),l=e[2],c=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:l,continued:!1,hasBarLine:c,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:F5,mathmlBuilder:Q5});var QR=(t,e)=>{var n=e.style,r,s;t.type==="supsub"?(r=t.sup?Kt(t.sup,e.havingStyle(n.sup()),e):Kt(t.sub,e.havingStyle(n.sub()),e),s=Nt(t.base,"horizBrace")):s=Nt(t,"horizBrace");var i=Kt(s.base,e.havingBaseStyle(at.DISPLAY)),l=yl.svgSpan(s,e),c;if(s.isOver?(c=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:l}]},e),c.children[0].children[0].children[1].classes.push("svg-align")):(c=ge.makeVList({positionType:"bottom",positionData:i.depth+.1+l.height,children:[{type:"elem",elem:l},{type:"kern",size:.1},{type:"elem",elem:i}]},e),c.children[0].children[0].children[0].classes.push("svg-align")),r){var d=ge.makeSpan(["mord",s.isOver?"mover":"munder"],[c],e);s.isOver?c=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:d},{type:"kern",size:.2},{type:"elem",elem:r}]},e):c=ge.makeVList({positionType:"bottom",positionData:d.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:d}]},e)}return ge.makeSpan(["mord",s.isOver?"mover":"munder"],[c],e)},Jce=(t,e)=>{var n=yl.mathMLnode(t.label);return new _e.MathNode(t.isOver?"mover":"munder",[zn(t.base,e),n])};Qe({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"horizBrace",mode:n.mode,label:r,isOver:/^\\over/.test(r),base:e[0]}},htmlBuilder:QR,mathmlBuilder:Jce});Qe({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],s=Nt(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:ar(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=Ar(t.body,e,!1);return ge.makeAnchor(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=wo(t.body,e);return n instanceof ni||(n=new ni("mrow",[n])),n.setAttribute("href",t.href),n}});Qe({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=Nt(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var s=[],i=0;i{var{parser:n,funcName:r,token:s}=t,i=Nt(e[0],"raw").string,l=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var c,d={};switch(r){case"\\htmlClass":d.class=i,c={command:"\\htmlClass",class:i};break;case"\\htmlId":d.id=i,c={command:"\\htmlId",id:i};break;case"\\htmlStyle":d.style=i,c={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var h=i.split(","),m=0;m{var n=Ar(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var s=ge.makeSpan(r,n,e);for(var i in t.attributes)i!=="class"&&t.attributes.hasOwnProperty(i)&&s.setAttribute(i,t.attributes[i]);return s},mathmlBuilder:(t,e)=>wo(t.body,e)});Qe({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:ar(e[0]),mathml:ar(e[1])}},htmlBuilder:(t,e)=>{var n=Ar(t.html,e,!1);return ge.makeFragment(n)},mathmlBuilder:(t,e)=>wo(t.mathml,e)});var qb=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!n)throw new De("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!lR(r))throw new De("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Qe({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(t,e,n)=>{var{parser:r}=t,s={number:0,unit:"em"},i={number:.9,unit:"em"},l={number:0,unit:"em"},c="";if(n[0])for(var d=Nt(n[0],"raw").string,h=d.split(","),m=0;m{var n=Kn(t.height,e),r=0;t.totalheight.number>0&&(r=Kn(t.totalheight,e)-n);var s=0;t.width.number>0&&(s=Kn(t.width,e));var i={height:Le(n+r)};s>0&&(i.width=Le(s)),r>0&&(i.verticalAlign=Le(-r));var l=new Joe(t.src,t.alt,i);return l.height=n,l.depth=r,l},mathmlBuilder:(t,e)=>{var n=new _e.MathNode("mglyph",[]);n.setAttribute("alt",t.alt);var r=Kn(t.height,e),s=0;if(t.totalheight.number>0&&(s=Kn(t.totalheight,e)-r,n.setAttribute("valign",Le(-s))),n.setAttribute("height",Le(r+s)),t.width.number>0){var i=Kn(t.width,e);n.setAttribute("width",Le(i))}return n.setAttribute("src",t.src),n}});Qe({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=Nt(e[0],"size");if(n.settings.strict){var i=r[1]==="m",l=s.value.unit==="mu";i?(l||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):l&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:s.value}},htmlBuilder(t,e){return ge.makeGlue(t.dimension,e)},mathmlBuilder(t,e){var n=Kn(t.dimension,e);return new _e.SpaceNode(n)}});Qe({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:s}},htmlBuilder:(t,e)=>{var n;t.alignment==="clap"?(n=ge.makeSpan([],[Kt(t.body,e)]),n=ge.makeSpan(["inner"],[n],e)):n=ge.makeSpan(["inner"],[Kt(t.body,e)]);var r=ge.makeSpan(["fix"],[]),s=ge.makeSpan([t.alignment],[n,r],e),i=ge.makeSpan(["strut"]);return i.style.height=Le(s.height+s.depth),s.depth&&(i.style.verticalAlign=Le(-s.depth)),s.children.unshift(i),s=ge.makeSpan(["thinbox"],[s],e),ge.makeSpan(["mord","vbox"],[s],e)},mathmlBuilder:(t,e)=>{var n=new _e.MathNode("mpadded",[zn(t.body,e)]);if(t.alignment!=="rlap"){var r=t.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});Qe({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){var{funcName:n,parser:r}=t,s=r.mode;r.switchMode("math");var i=n==="\\("?"\\)":"$",l=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",body:l}}});Qe({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new De("Mismatched "+t.funcName)}});var kN=(t,e)=>{switch(e.style.size){case at.DISPLAY.size:return t.display;case at.TEXT.size:return t.text;case at.SCRIPT.size:return t.script;case at.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};Qe({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:ar(e[0]),text:ar(e[1]),script:ar(e[2]),scriptscript:ar(e[3])}},htmlBuilder:(t,e)=>{var n=kN(t,e),r=Ar(n,e,!1);return ge.makeFragment(r)},mathmlBuilder:(t,e)=>{var n=kN(t,e);return wo(n,e)}});var $R=(t,e,n,r,s,i,l)=>{t=ge.makeSpan([],[t]);var c=n&&tn.isCharacterBox(n),d,h;if(e){var m=Kt(e,r.havingStyle(s.sup()),r);h={elem:m,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-m.depth)}}if(n){var p=Kt(n,r.havingStyle(s.sub()),r);d={elem:p,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-p.height)}}var x;if(h&&d){var v=r.fontMetrics().bigOpSpacing5+d.elem.height+d.elem.depth+d.kern+t.depth+l;x=ge.makeVList({positionType:"bottom",positionData:v,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:d.elem,marginLeft:Le(-i)},{type:"kern",size:d.kern},{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Le(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(d){var b=t.height-l;x=ge.makeVList({positionType:"top",positionData:b,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:d.elem,marginLeft:Le(-i)},{type:"kern",size:d.kern},{type:"elem",elem:t}]},r)}else if(h){var k=t.depth+l;x=ge.makeVList({positionType:"bottom",positionData:k,children:[{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Le(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else return t;var O=[x];if(d&&i!==0&&!c){var j=ge.makeSpan(["mspace"],[],r);j.style.marginRight=Le(i),O.unshift(j)}return ge.makeSpan(["mop","op-limits"],O,r)},HR=["\\smallint"],zd=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Nt(t.base,"op"),s=!0):i=Nt(t,"op");var l=e.style,c=!1;l.size===at.DISPLAY.size&&i.symbol&&!HR.includes(i.name)&&(c=!0);var d;if(i.symbol){var h=c?"Size2-Regular":"Size1-Regular",m="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(m=i.name.slice(1),i.name=m==="oiint"?"\\iint":"\\iiint"),d=ge.makeSymbol(i.name,h,"math",e,["mop","op-symbol",c?"large-op":"small-op"]),m.length>0){var p=d.italic,x=ge.staticSvg(m+"Size"+(c?"2":"1"),e);d=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:d,shift:0},{type:"elem",elem:x,shift:c?.08:0}]},e),i.name="\\"+m,d.classes.unshift("mop"),d.italic=p}}else if(i.body){var v=Ar(i.body,e,!0);v.length===1&&v[0]instanceof Ai?(d=v[0],d.classes[0]="mop"):d=ge.makeSpan(["mop"],v,e)}else{for(var b=[],k=1;k{var n;if(t.symbol)n=new ni("mo",[Mi(t.name,t.mode)]),HR.includes(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new ni("mo",Fs(t.body,e));else{n=new ni("mi",[new ga(t.name.slice(1))]);var r=new ni("mo",[Mi("⁡","text")]);t.parentIsSupSub?n=new ni("mrow",[n,r]):n=vR([n,r])}return n},eue={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Qe({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=r;return s.length===1&&(s=eue[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:zd,mathmlBuilder:k0});Qe({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:ar(r)}},htmlBuilder:zd,mathmlBuilder:k0});var tue={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Qe({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:zd,mathmlBuilder:k0});Qe({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:zd,mathmlBuilder:k0});Qe({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t,r=n;return r.length===1&&(r=tue[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:zd,mathmlBuilder:k0});var UR=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Nt(t.base,"operatorname"),s=!0):i=Nt(t,"operatorname");var l;if(i.body.length>0){for(var c=i.body.map(p=>{var x=p.text;return typeof x=="string"?{type:"textord",mode:p.mode,text:x}:p}),d=Ar(c,e.withFont("mathrm"),!0),h=0;h{for(var n=Fs(t.body,e.withFont("mathrm")),r=!0,s=0;sm.toText()).join("");n=[new _e.TextNode(c)]}var d=new _e.MathNode("mi",n);d.setAttribute("mathvariant","normal");var h=new _e.MathNode("mo",[Mi("⁡","text")]);return t.parentIsSupSub?new _e.MathNode("mrow",[d,h]):_e.newDocumentFragment([d,h])};Qe({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"operatorname",mode:n.mode,body:ar(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:UR,mathmlBuilder:nue});q("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Rc({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?ge.makeFragment(Ar(t.body,e,!1)):ge.makeSpan(["mord"],Ar(t.body,e,!0),e)},mathmlBuilder(t,e){return wo(t.body,e,!0)}});Qe({type:"overline",names:["\\overline"],props:{numArgs:1},handler(t,e){var{parser:n}=t,r=e[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(t,e){var n=Kt(t.body,e.havingCrampedStyle()),r=ge.makeLineSpan("overline-line",e),s=e.fontMetrics().defaultRuleThickness,i=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]},e);return ge.makeSpan(["mord","overline"],[i],e)},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[new _e.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new _e.MathNode("mover",[zn(t.body,e),n]);return r.setAttribute("accent","true"),r}});Qe({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"phantom",mode:n.mode,body:ar(r)}},htmlBuilder:(t,e)=>{var n=Ar(t.body,e.withPhantom(),!1);return ge.makeFragment(n)},mathmlBuilder:(t,e)=>{var n=Fs(t.body,e);return new _e.MathNode("mphantom",n)}});Qe({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=ge.makeSpan([],[Kt(t.body,e.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r{var n=Fs(ar(t.body),e),r=new _e.MathNode("mphantom",n),s=new _e.MathNode("mpadded",[r]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});Qe({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=ge.makeSpan(["inner"],[Kt(t.body,e.withPhantom())]),r=ge.makeSpan(["fix"],[]);return ge.makeSpan(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=Fs(ar(t.body),e),r=new _e.MathNode("mphantom",n),s=new _e.MathNode("mpadded",[r]);return s.setAttribute("width","0px"),s}});Qe({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=Nt(e[0],"size").value,s=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(t,e){var n=Kt(t.body,e),r=Kn(t.dy,e);return ge.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){var n=new _e.MathNode("mpadded",[zn(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});Qe({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});Qe({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(t,e,n){var{parser:r}=t,s=n[0],i=Nt(e[0],"size"),l=Nt(e[1],"size");return{type:"rule",mode:r.mode,shift:s&&Nt(s,"size").value,width:i.value,height:l.value}},htmlBuilder(t,e){var n=ge.makeSpan(["mord","rule"],[],e),r=Kn(t.width,e),s=Kn(t.height,e),i=t.shift?Kn(t.shift,e):0;return n.style.borderRightWidth=Le(r),n.style.borderTopWidth=Le(s),n.style.bottom=Le(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=Kn(t.width,e),r=Kn(t.height,e),s=t.shift?Kn(t.shift,e):0,i=e.color&&e.getColor()||"black",l=new _e.MathNode("mspace");l.setAttribute("mathbackground",i),l.setAttribute("width",Le(n)),l.setAttribute("height",Le(r));var c=new _e.MathNode("mpadded",[l]);return s>=0?c.setAttribute("height",Le(s)):(c.setAttribute("height",Le(s)),c.setAttribute("depth",Le(-s))),c.setAttribute("voffset",Le(s)),c}});function VR(t,e,n){for(var r=Ar(t,e,!1),s=e.sizeMultiplier/n.sizeMultiplier,i=0;i{var n=e.havingSize(t.size);return VR(t.body,n,e)};Qe({type:"sizing",names:ON,props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!1,n);return{type:"sizing",mode:s.mode,size:ON.indexOf(r)+1,body:i}},htmlBuilder:rue,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=Fs(t.body,n),s=new _e.MathNode("mstyle",r);return s.setAttribute("mathsize",Le(n.sizeMultiplier)),s}});Qe({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,s=!1,i=!1,l=n[0]&&Nt(n[0],"ordgroup");if(l)for(var c="",d=0;d{var n=ge.makeSpan([],[Kt(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return n;if(t.smashHeight&&(n.height=0,n.children))for(var r=0;r{var n=new _e.MathNode("mpadded",[zn(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});Qe({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r}=t,s=n[0],i=e[0];return{type:"sqrt",mode:r.mode,body:i,index:s}},htmlBuilder(t,e){var n=Kt(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=ge.wrapFragment(n,e);var r=e.fontMetrics(),s=r.defaultRuleThickness,i=s;e.style.idn.height+n.depth+l&&(l=(l+p-n.height-n.depth)/2);var x=d.height-n.height-l-h;n.style.paddingLeft=Le(m);var v=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+x)},{type:"elem",elem:d},{type:"kern",size:h}]},e);if(t.index){var b=e.havingStyle(at.SCRIPTSCRIPT),k=Kt(t.index,b,e),O=.6*(v.height-v.depth),j=ge.makeVList({positionType:"shift",positionData:-O,children:[{type:"elem",elem:k}]},e),T=ge.makeSpan(["root"],[j]);return ge.makeSpan(["mord","sqrt"],[T,v],e)}else return ge.makeSpan(["mord","sqrt"],[v],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new _e.MathNode("mroot",[zn(n,e),zn(r,e)]):new _e.MathNode("msqrt",[zn(n,e)])}});var jN={display:at.DISPLAY,text:at.TEXT,script:at.SCRIPT,scriptscript:at.SCRIPTSCRIPT};Qe({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t,e){var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!0,n),l=r.slice(1,r.length-5);return{type:"styling",mode:s.mode,style:l,body:i}},htmlBuilder(t,e){var n=jN[t.style],r=e.havingStyle(n).withFont("");return VR(t.body,r,e)},mathmlBuilder(t,e){var n=jN[t.style],r=e.havingStyle(n),s=Fs(t.body,r),i=new _e.MathNode("mstyle",s),l={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},c=l[t.style];return i.setAttribute("scriptlevel",c[0]),i.setAttribute("displaystyle",c[1]),i}});var sue=function(e,n){var r=e.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===at.DISPLAY.size||r.alwaysHandleSupSub);return s?zd:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===at.DISPLAY.size||r.limits);return i?UR:null}else{if(r.type==="accent")return tn.isCharacterBox(r.base)?z5:null;if(r.type==="horizBrace"){var l=!e.sub;return l===r.isOver?QR:null}else return null}else return null};Rc({type:"supsub",htmlBuilder(t,e){var n=sue(t,e);if(n)return n(t,e);var{base:r,sup:s,sub:i}=t,l=Kt(r,e),c,d,h=e.fontMetrics(),m=0,p=0,x=r&&tn.isCharacterBox(r);if(s){var v=e.havingStyle(e.style.sup());c=Kt(s,v,e),x||(m=l.height-v.fontMetrics().supDrop*v.sizeMultiplier/e.sizeMultiplier)}if(i){var b=e.havingStyle(e.style.sub());d=Kt(i,b,e),x||(p=l.depth+b.fontMetrics().subDrop*b.sizeMultiplier/e.sizeMultiplier)}var k;e.style===at.DISPLAY?k=h.sup1:e.style.cramped?k=h.sup3:k=h.sup2;var O=e.sizeMultiplier,j=Le(.5/h.ptPerEm/O),T=null;if(d){var A=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(l instanceof Ai||A)&&(T=Le(-l.italic))}var _;if(c&&d){m=Math.max(m,k,c.depth+.25*h.xHeight),p=Math.max(p,h.sub2);var D=h.defaultRuleThickness,E=4*D;if(m-c.depth-(d.height-p)0&&(m+=z,p-=z)}var Q=[{type:"elem",elem:d,shift:p,marginRight:j,marginLeft:T},{type:"elem",elem:c,shift:-m,marginRight:j}];_=ge.makeVList({positionType:"individualShift",children:Q},e)}else if(d){p=Math.max(p,h.sub1,d.height-.8*h.xHeight);var F=[{type:"elem",elem:d,marginLeft:T,marginRight:j}];_=ge.makeVList({positionType:"shift",positionData:p,children:F},e)}else if(c)m=Math.max(m,k,c.depth+.25*h.xHeight),_=ge.makeVList({positionType:"shift",positionData:-m,children:[{type:"elem",elem:c,marginRight:j}]},e);else throw new Error("supsub must have either sup or sub.");var L=N4(l,"right")||"mord";return ge.makeSpan([L],[l,ge.makeSpan(["msupsub"],[_])],e)},mathmlBuilder(t,e){var n=!1,r,s;t.base&&t.base.type==="horizBrace"&&(s=!!t.sup,s===t.base.isOver&&(n=!0,r=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var i=[zn(t.base,e)];t.sub&&i.push(zn(t.sub,e)),t.sup&&i.push(zn(t.sup,e));var l;if(n)l=r?"mover":"munder";else if(t.sub)if(t.sup){var h=t.base;h&&h.type==="op"&&h.limits&&e.style===at.DISPLAY||h&&h.type==="operatorname"&&h.alwaysHandleSupSub&&(e.style===at.DISPLAY||h.limits)?l="munderover":l="msubsup"}else{var d=t.base;d&&d.type==="op"&&d.limits&&(e.style===at.DISPLAY||d.alwaysHandleSupSub)||d&&d.type==="operatorname"&&d.alwaysHandleSupSub&&(d.limits||e.style===at.DISPLAY)?l="munder":l="msub"}else{var c=t.base;c&&c.type==="op"&&c.limits&&(e.style===at.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||e.style===at.DISPLAY)?l="mover":l="msup"}return new _e.MathNode(l,i)}});Rc({type:"atom",htmlBuilder(t,e){return ge.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[Mi(t.text,t.mode)]);if(t.family==="bin"){var r=D5(t,e);r==="bold-italic"&&n.setAttribute("mathvariant",r)}else t.family==="punct"?n.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&n.setAttribute("stretchy","false");return n}});var WR={mi:"italic",mn:"normal",mtext:"normal"};Rc({type:"mathord",htmlBuilder(t,e){return ge.makeOrd(t,e,"mathord")},mathmlBuilder(t,e){var n=new _e.MathNode("mi",[Mi(t.text,t.mode,e)]),r=D5(t,e)||"italic";return r!==WR[n.type]&&n.setAttribute("mathvariant",r),n}});Rc({type:"textord",htmlBuilder(t,e){return ge.makeOrd(t,e,"textord")},mathmlBuilder(t,e){var n=Mi(t.text,t.mode,e),r=D5(t,e)||"normal",s;return t.mode==="text"?s=new _e.MathNode("mtext",[n]):/[0-9]/.test(t.text)?s=new _e.MathNode("mn",[n]):t.text==="\\prime"?s=new _e.MathNode("mo",[n]):s=new _e.MathNode("mi",[n]),r!==WR[s.type]&&s.setAttribute("mathvariant",r),s}});var Fb={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Qb={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Rc({type:"spacing",htmlBuilder(t,e){if(Qb.hasOwnProperty(t.text)){var n=Qb[t.text].className||"";if(t.mode==="text"){var r=ge.makeOrd(t,e,"textord");return r.classes.push(n),r}else return ge.makeSpan(["mspace",n],[ge.mathsym(t.text,t.mode,e)],e)}else{if(Fb.hasOwnProperty(t.text))return ge.makeSpan(["mspace",Fb[t.text]],[],e);throw new De('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(Qb.hasOwnProperty(t.text))n=new _e.MathNode("mtext",[new _e.TextNode(" ")]);else{if(Fb.hasOwnProperty(t.text))return new _e.MathNode("mspace");throw new De('Unknown type of space "'+t.text+'"')}return n}});var NN=()=>{var t=new _e.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};Rc({type:"tag",mathmlBuilder(t,e){var n=new _e.MathNode("mtable",[new _e.MathNode("mtr",[NN(),new _e.MathNode("mtd",[wo(t.body,e)]),NN(),new _e.MathNode("mtd",[wo(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var CN={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},TN={"\\textbf":"textbf","\\textmd":"textmd"},iue={"\\textit":"textit","\\textup":"textup"},AN=(t,e)=>{var n=t.font;if(n){if(CN[n])return e.withTextFontFamily(CN[n]);if(TN[n])return e.withTextFontWeight(TN[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(iue[n])};Qe({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"text",mode:n.mode,body:ar(s),font:r}},htmlBuilder(t,e){var n=AN(t,e),r=Ar(t.body,n,!0);return ge.makeSpan(["mord","text"],r,n)},mathmlBuilder(t,e){var n=AN(t,e);return wo(t.body,n)}});Qe({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"underline",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Kt(t.body,e),r=ge.makeLineSpan("underline-line",e),s=e.fontMetrics().defaultRuleThickness,i=ge.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]},e);return ge.makeSpan(["mord","underline"],[i],e)},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[new _e.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new _e.MathNode("munder",[zn(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});Qe({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"vcenter",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Kt(t.body,e),r=e.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return ge.makeVList({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){return new _e.MathNode("mpadded",[zn(t.body,e)],["vcenter"])}});Qe({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new De("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=MN(t),r=[],s=e.havingStyle(e.style.text()),i=0;it.body.replace(/ /g,t.star?"␣":" "),io=gR,GR=`[ \r ]`,aue="\\\\[a-zA-Z@]+",lue="\\\\[^\uD800-\uDFFF]",oue="("+aue+")"+GR+"*",cue=`\\\\( |[ \r ]+ ?)[ \r ]*`,M4="[̀-ͯ]",uue=new RegExp(M4+"+$"),due="("+GR+"+)|"+(cue+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(M4+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(M4+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+oue)+("|"+lue+")");class EN{constructor(e,n){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=n,this.tokenRegex=new RegExp(due,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,n){this.catcodes[e]=n}lex(){var e=this.input,n=this.tokenRegex.lastIndex;if(n===e.length)return new ii("EOF",new Ts(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new De("Unexpected character: '"+e[n]+"'",new ii(e[n],new Ts(this,n,n+1)));var s=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[s]===14){var i=e.indexOf(` `,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new ii(s,new Ts(this,n,this.tokenRegex.lastIndex))}}class hue{constructor(e,n){e===void 0&&(e={}),n===void 0&&(n={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=n,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new De("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var n in e)e.hasOwnProperty(n)&&(e[n]==null?delete this.current[n]:this.current[n]=e[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,n,r){if(r===void 0&&(r=!1),r){for(var s=0;s0&&(this.undefStack[this.undefStack.length-1][e]=n)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(e)&&(i[e]=this.current[e])}n==null?delete this.current[e]:this.current[e]=n}}var fue=BR;q("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});q("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});q("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});q("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});q("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var n=t.future();return e[0].length===1&&e[0][0].text===n.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});q("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");q("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var _N={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};q("\\char",function(t){var e=t.popToken(),n,r="";if(e.text==="'")n=8,e=t.popToken();else if(e.text==='"')n=16,e=t.popToken();else if(e.text==="`")if(e=t.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new De("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=_N[e.text],r==null||r>=n)throw new De("Invalid base-"+n+" digit "+e.text);for(var s;(s=_N[t.future().text])!=null&&s{var s=t.consumeArg().tokens;if(s.length!==1)throw new De("\\newcommand's first argument must be a macro name");var i=s[0].text,l=t.isDefined(i);if(l&&!e)throw new De("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!l&&!n)throw new De("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var c=0;if(s=t.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var d="",h=t.expandNextToken();h.text!=="]"&&h.text!=="EOF";)d+=h.text,h=t.expandNextToken();if(!d.match(/^\s*[0-9]+\s*$/))throw new De("Invalid number of arguments: "+d);c=parseInt(d),s=t.consumeArg().tokens}return l&&r||t.macros.set(i,{tokens:s,numArgs:c}),""};q("\\newcommand",t=>$5(t,!1,!0,!1));q("\\renewcommand",t=>$5(t,!0,!1,!1));q("\\providecommand",t=>$5(t,!0,!0,!0));q("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});q("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});q("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),io[n],Ln.math[n],Ln.text[n]),""});q("\\bgroup","{");q("\\egroup","}");q("~","\\nobreakspace");q("\\lq","`");q("\\rq","'");q("\\aa","\\r a");q("\\AA","\\r A");q("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");q("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");q("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");q("ℬ","\\mathscr{B}");q("ℰ","\\mathscr{E}");q("ℱ","\\mathscr{F}");q("ℋ","\\mathscr{H}");q("ℐ","\\mathscr{I}");q("ℒ","\\mathscr{L}");q("ℳ","\\mathscr{M}");q("ℛ","\\mathscr{R}");q("ℭ","\\mathfrak{C}");q("ℌ","\\mathfrak{H}");q("ℨ","\\mathfrak{Z}");q("\\Bbbk","\\Bbb{k}");q("·","\\cdotp");q("\\llap","\\mathllap{\\textrm{#1}}");q("\\rlap","\\mathrlap{\\textrm{#1}}");q("\\clap","\\mathclap{\\textrm{#1}}");q("\\mathstrut","\\vphantom{(}");q("\\underbar","\\underline{\\text{#1}}");q("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');q("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");q("\\ne","\\neq");q("≠","\\neq");q("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");q("∉","\\notin");q("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");q("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");q("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");q("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");q("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");q("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");q("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");q("⟂","\\perp");q("‼","\\mathclose{!\\mkern-0.8mu!}");q("∌","\\notni");q("⌜","\\ulcorner");q("⌝","\\urcorner");q("⌞","\\llcorner");q("⌟","\\lrcorner");q("©","\\copyright");q("®","\\textregistered");q("️","\\textregistered");q("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');q("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');q("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');q("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');q("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");q("⋮","\\vdots");q("\\varGamma","\\mathit{\\Gamma}");q("\\varDelta","\\mathit{\\Delta}");q("\\varTheta","\\mathit{\\Theta}");q("\\varLambda","\\mathit{\\Lambda}");q("\\varXi","\\mathit{\\Xi}");q("\\varPi","\\mathit{\\Pi}");q("\\varSigma","\\mathit{\\Sigma}");q("\\varUpsilon","\\mathit{\\Upsilon}");q("\\varPhi","\\mathit{\\Phi}");q("\\varPsi","\\mathit{\\Psi}");q("\\varOmega","\\mathit{\\Omega}");q("\\substack","\\begin{subarray}{c}#1\\end{subarray}");q("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");q("\\boxed","\\fbox{$\\displaystyle{#1}$}");q("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");q("\\implies","\\DOTSB\\;\\Longrightarrow\\;");q("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");q("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");q("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var DN={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};q("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in DN?e=DN[n]:(n.slice(0,4)==="\\not"||n in Ln.math&&["bin","rel"].includes(Ln.math[n].group))&&(e="\\dotsb"),e});var H5={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};q("\\dotso",function(t){var e=t.future().text;return e in H5?"\\ldots\\,":"\\ldots"});q("\\dotsc",function(t){var e=t.future().text;return e in H5&&e!==","?"\\ldots\\,":"\\ldots"});q("\\cdots",function(t){var e=t.future().text;return e in H5?"\\@cdots\\,":"\\@cdots"});q("\\dotsb","\\cdots");q("\\dotsm","\\cdots");q("\\dotsi","\\!\\cdots");q("\\dotsx","\\ldots\\,");q("\\DOTSI","\\relax");q("\\DOTSB","\\relax");q("\\DOTSX","\\relax");q("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");q("\\,","\\tmspace+{3mu}{.1667em}");q("\\thinspace","\\,");q("\\>","\\mskip{4mu}");q("\\:","\\tmspace+{4mu}{.2222em}");q("\\medspace","\\:");q("\\;","\\tmspace+{5mu}{.2777em}");q("\\thickspace","\\;");q("\\!","\\tmspace-{3mu}{.1667em}");q("\\negthinspace","\\!");q("\\negmedspace","\\tmspace-{4mu}{.2222em}");q("\\negthickspace","\\tmspace-{5mu}{.277em}");q("\\enspace","\\kern.5em ");q("\\enskip","\\hskip.5em\\relax");q("\\quad","\\hskip1em\\relax");q("\\qquad","\\hskip2em\\relax");q("\\tag","\\@ifstar\\tag@literal\\tag@paren");q("\\tag@paren","\\tag@literal{({#1})}");q("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new De("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});q("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");q("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");q("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");q("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");q("\\newline","\\\\\\relax");q("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var XR=Le(pa["Main-Regular"][84][1]-.7*pa["Main-Regular"][65][1]);q("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+XR+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");q("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+XR+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");q("\\hspace","\\@ifstar\\@hspacer\\@hspace");q("\\@hspace","\\hskip #1\\relax");q("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");q("\\ordinarycolon",":");q("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");q("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');q("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');q("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');q("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');q("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');q("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');q("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');q("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');q("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');q("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');q("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');q("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');q("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');q("∷","\\dblcolon");q("∹","\\eqcolon");q("≔","\\coloneqq");q("≕","\\eqqcolon");q("⩴","\\Coloneqq");q("\\ratio","\\vcentcolon");q("\\coloncolon","\\dblcolon");q("\\colonequals","\\coloneqq");q("\\coloncolonequals","\\Coloneqq");q("\\equalscolon","\\eqqcolon");q("\\equalscoloncolon","\\Eqqcolon");q("\\colonminus","\\coloneq");q("\\coloncolonminus","\\Coloneq");q("\\minuscolon","\\eqcolon");q("\\minuscoloncolon","\\Eqcolon");q("\\coloncolonapprox","\\Colonapprox");q("\\coloncolonsim","\\Colonsim");q("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");q("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");q("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");q("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");q("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");q("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");q("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");q("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");q("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");q("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");q("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");q("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");q("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");q("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");q("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");q("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");q("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");q("\\nleqq","\\html@mathml{\\@nleqq}{≰}");q("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");q("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");q("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");q("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");q("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");q("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");q("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");q("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");q("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");q("\\imath","\\html@mathml{\\@imath}{ı}");q("\\jmath","\\html@mathml{\\@jmath}{ȷ}");q("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");q("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");q("⟦","\\llbracket");q("⟧","\\rrbracket");q("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");q("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");q("⦃","\\lBrace");q("⦄","\\rBrace");q("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");q("⦵","\\minuso");q("\\darr","\\downarrow");q("\\dArr","\\Downarrow");q("\\Darr","\\Downarrow");q("\\lang","\\langle");q("\\rang","\\rangle");q("\\uarr","\\uparrow");q("\\uArr","\\Uparrow");q("\\Uarr","\\Uparrow");q("\\N","\\mathbb{N}");q("\\R","\\mathbb{R}");q("\\Z","\\mathbb{Z}");q("\\alef","\\aleph");q("\\alefsym","\\aleph");q("\\Alpha","\\mathrm{A}");q("\\Beta","\\mathrm{B}");q("\\bull","\\bullet");q("\\Chi","\\mathrm{X}");q("\\clubs","\\clubsuit");q("\\cnums","\\mathbb{C}");q("\\Complex","\\mathbb{C}");q("\\Dagger","\\ddagger");q("\\diamonds","\\diamondsuit");q("\\empty","\\emptyset");q("\\Epsilon","\\mathrm{E}");q("\\Eta","\\mathrm{H}");q("\\exist","\\exists");q("\\harr","\\leftrightarrow");q("\\hArr","\\Leftrightarrow");q("\\Harr","\\Leftrightarrow");q("\\hearts","\\heartsuit");q("\\image","\\Im");q("\\infin","\\infty");q("\\Iota","\\mathrm{I}");q("\\isin","\\in");q("\\Kappa","\\mathrm{K}");q("\\larr","\\leftarrow");q("\\lArr","\\Leftarrow");q("\\Larr","\\Leftarrow");q("\\lrarr","\\leftrightarrow");q("\\lrArr","\\Leftrightarrow");q("\\Lrarr","\\Leftrightarrow");q("\\Mu","\\mathrm{M}");q("\\natnums","\\mathbb{N}");q("\\Nu","\\mathrm{N}");q("\\Omicron","\\mathrm{O}");q("\\plusmn","\\pm");q("\\rarr","\\rightarrow");q("\\rArr","\\Rightarrow");q("\\Rarr","\\Rightarrow");q("\\real","\\Re");q("\\reals","\\mathbb{R}");q("\\Reals","\\mathbb{R}");q("\\Rho","\\mathrm{P}");q("\\sdot","\\cdot");q("\\sect","\\S");q("\\spades","\\spadesuit");q("\\sub","\\subset");q("\\sube","\\subseteq");q("\\supe","\\supseteq");q("\\Tau","\\mathrm{T}");q("\\thetasym","\\vartheta");q("\\weierp","\\wp");q("\\Zeta","\\mathrm{Z}");q("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");q("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");q("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");q("\\bra","\\mathinner{\\langle{#1}|}");q("\\ket","\\mathinner{|{#1}\\rangle}");q("\\braket","\\mathinner{\\langle{#1}\\rangle}");q("\\Bra","\\left\\langle#1\\right|");q("\\Ket","\\left|#1\\right\\rangle");var YR=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,s=e.consumeArg().tokens,i=e.consumeArg().tokens,l=e.macros.get("|"),c=e.macros.get("\\|");e.macros.beginGroup();var d=p=>x=>{t&&(x.macros.set("|",l),s.length&&x.macros.set("\\|",c));var v=p;if(!p&&s.length){var b=x.future();b.text==="|"&&(x.popToken(),v=!0)}return{tokens:v?s:r,numArgs:0}};e.macros.set("|",d(!1)),s.length&&e.macros.set("\\|",d(!0));var h=e.consumeArg().tokens,m=e.expandTokens([...i,...h,...n]);return e.macros.endGroup(),{tokens:m.reverse(),numArgs:0}};q("\\bra@ket",YR(!1));q("\\bra@set",YR(!0));q("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");q("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");q("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");q("\\angln","{\\angl n}");q("\\blue","\\textcolor{##6495ed}{#1}");q("\\orange","\\textcolor{##ffa500}{#1}");q("\\pink","\\textcolor{##ff00af}{#1}");q("\\red","\\textcolor{##df0030}{#1}");q("\\green","\\textcolor{##28ae7b}{#1}");q("\\gray","\\textcolor{gray}{#1}");q("\\purple","\\textcolor{##9d38bd}{#1}");q("\\blueA","\\textcolor{##ccfaff}{#1}");q("\\blueB","\\textcolor{##80f6ff}{#1}");q("\\blueC","\\textcolor{##63d9ea}{#1}");q("\\blueD","\\textcolor{##11accd}{#1}");q("\\blueE","\\textcolor{##0c7f99}{#1}");q("\\tealA","\\textcolor{##94fff5}{#1}");q("\\tealB","\\textcolor{##26edd5}{#1}");q("\\tealC","\\textcolor{##01d1c1}{#1}");q("\\tealD","\\textcolor{##01a995}{#1}");q("\\tealE","\\textcolor{##208170}{#1}");q("\\greenA","\\textcolor{##b6ffb0}{#1}");q("\\greenB","\\textcolor{##8af281}{#1}");q("\\greenC","\\textcolor{##74cf70}{#1}");q("\\greenD","\\textcolor{##1fab54}{#1}");q("\\greenE","\\textcolor{##0d923f}{#1}");q("\\goldA","\\textcolor{##ffd0a9}{#1}");q("\\goldB","\\textcolor{##ffbb71}{#1}");q("\\goldC","\\textcolor{##ff9c39}{#1}");q("\\goldD","\\textcolor{##e07d10}{#1}");q("\\goldE","\\textcolor{##a75a05}{#1}");q("\\redA","\\textcolor{##fca9a9}{#1}");q("\\redB","\\textcolor{##ff8482}{#1}");q("\\redC","\\textcolor{##f9685d}{#1}");q("\\redD","\\textcolor{##e84d39}{#1}");q("\\redE","\\textcolor{##bc2612}{#1}");q("\\maroonA","\\textcolor{##ffbde0}{#1}");q("\\maroonB","\\textcolor{##ff92c6}{#1}");q("\\maroonC","\\textcolor{##ed5fa6}{#1}");q("\\maroonD","\\textcolor{##ca337c}{#1}");q("\\maroonE","\\textcolor{##9e034e}{#1}");q("\\purpleA","\\textcolor{##ddd7ff}{#1}");q("\\purpleB","\\textcolor{##c6b9fc}{#1}");q("\\purpleC","\\textcolor{##aa87ff}{#1}");q("\\purpleD","\\textcolor{##7854ab}{#1}");q("\\purpleE","\\textcolor{##543b78}{#1}");q("\\mintA","\\textcolor{##f5f9e8}{#1}");q("\\mintB","\\textcolor{##edf2df}{#1}");q("\\mintC","\\textcolor{##e0e5cc}{#1}");q("\\grayA","\\textcolor{##f6f7f7}{#1}");q("\\grayB","\\textcolor{##f0f1f2}{#1}");q("\\grayC","\\textcolor{##e3e5e6}{#1}");q("\\grayD","\\textcolor{##d6d8da}{#1}");q("\\grayE","\\textcolor{##babec2}{#1}");q("\\grayF","\\textcolor{##888d93}{#1}");q("\\grayG","\\textcolor{##626569}{#1}");q("\\grayH","\\textcolor{##3b3e40}{#1}");q("\\grayI","\\textcolor{##21242c}{#1}");q("\\kaBlue","\\textcolor{##314453}{#1}");q("\\kaGreen","\\textcolor{##71B307}{#1}");var KR={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class mue{constructor(e,n,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(e),this.macros=new hue(fue,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new EN(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var n,r,s;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:s,end:r}=this.consumeArg(["]"])}else({tokens:s,start:n,end:r}=this.consumeArg());return this.pushToken(new ii("EOF",r.loc)),this.pushTokens(s),new ii("",Ts.range(n,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var n=[],r=e&&e.length>0;r||this.consumeSpaces();var s=this.future(),i,l=0,c=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++l;else if(i.text==="}"){if(--l,l===-1)throw new De("Extra }",i)}else if(i.text==="EOF")throw new De("Unexpected end of input in a macro argument, expected '"+(e&&r?e[c]:"}")+"'",i);if(e&&r)if((l===0||l===1&&e[c]==="{")&&i.text===e[c]){if(++c,c===e.length){n.splice(-c,c);break}}else c=0}while(l!==0||r);return s.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:s,end:i}}consumeArgs(e,n){if(n){if(n.length!==e+1)throw new De("The length of delimiters doesn't match the number of args!");for(var r=n[0],s=0;sthis.settings.maxExpand)throw new De("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var n=this.popToken(),r=n.text,s=n.noexpand?null:this._getExpansion(r);if(s==null||e&&s.unexpandable){if(e&&s==null&&r[0]==="\\"&&!this.isDefined(r))throw new De("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var i=s.tokens,l=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var c=i.length-1;c>=0;--c){var d=i[c];if(d.text==="#"){if(c===0)throw new De("Incomplete placeholder at end of macro body",d);if(d=i[--c],d.text==="#")i.splice(c+1,1);else if(/^[1-9]$/.test(d.text))i.splice(c,2,...l[+d.text-1]);else throw new De("Not a valid argument number",d)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new ii(e)]):void 0}expandTokens(e){var n=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),n.push(s)}return this.countExpansion(n.length),n}expandMacroAsText(e){var n=this.expandMacro(e);return n&&n.map(r=>r.text).join("")}_getExpansion(e){var n=this.macros.get(e);if(n==null)return n;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var s=typeof n=="function"?n(this):n;if(typeof s=="string"){var i=0;if(s.indexOf("#")!==-1)for(var l=s.replace(/##/g,"");l.indexOf("#"+(i+1))!==-1;)++i;for(var c=new EN(s,this.settings),d=[],h=c.lex();h.text!=="EOF";)d.push(h),h=c.lex();d.reverse();var m={tokens:d,numArgs:i};return m}return s}isDefined(e){return this.macros.has(e)||io.hasOwnProperty(e)||Ln.math.hasOwnProperty(e)||Ln.text.hasOwnProperty(e)||KR.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:io.hasOwnProperty(e)&&!io[e].primitive}}var RN=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Pp=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),$b={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},zN={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Xx{constructor(e,n){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new mue(e,n,this.mode),this.settings=n,this.leftrightDepth=0}expect(e,n){if(n===void 0&&(n=!0),this.fetch().text!==e)throw new De("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var n=this.nextToken;this.consume(),this.gullet.pushToken(new ii("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,r}parseExpression(e,n){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var s=this.fetch();if(Xx.endOfExpression.indexOf(s.text)!==-1||n&&s.text===n||e&&io[s.text]&&io[s.text].infix)break;var i=this.parseAtom(n);if(i){if(i.type==="internal")continue}else break;r.push(i)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var n=-1,r,s=0;s=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var c=Ln[this.mode][n].group,d=Ts.range(e),h;if(nce.hasOwnProperty(c)){var m=c;h={type:"atom",mode:this.mode,family:m,loc:d,text:n}}else h={type:c,mode:this.mode,loc:d,text:n};l=h}else if(n.charCodeAt(0)>=128)this.settings.strict&&(aR(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),e)),l={type:"textord",mode:"text",loc:Ts.range(e),text:n};else return null;if(this.consume(),i)for(var p=0;ph&&(h=m):m&&(h!==void 0&&h>-1&&d.push(` + please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:s}}zN.hasOwnProperty(n[0])&&!Ln[this.mode][n[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+n[0]+'" used in math mode',e),n=zN[n[0]]+n.slice(1));var i=uue.exec(n);i&&(n=n.substring(0,i.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var l;if(Ln[this.mode][n]){this.settings.strict&&this.mode==="math"&&j4.indexOf(n)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var c=Ln[this.mode][n].group,d=Ts.range(e),h;if(nce.hasOwnProperty(c)){var m=c;h={type:"atom",mode:this.mode,family:m,loc:d,text:n}}else h={type:c,mode:this.mode,loc:d,text:n};l=h}else if(n.charCodeAt(0)>=128)this.settings.strict&&(aR(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),e)),l={type:"textord",mode:"text",loc:Ts.range(e),text:n};else return null;if(this.consume(),i)for(var p=0;ph&&(h=m):m&&(h!==void 0&&h>-1&&d.push(` `.repeat(h)||" "),h=-1,d.push(m))}return d.join("")}function sz(t,e,n){return t.type==="element"?Uue(t,e,n):t.type==="text"?n.whitespace==="normal"?iz(t,n):Vue(t):[]}function Uue(t,e,n){const r=az(t,n),s=t.children||[];let i=-1,l=[];if($ue(t))return l;let c,d;for(_4(t)||HN(t)&&qN(e,t,HN)?d=` -`:Que(t)?(c=2,d=2):rz(t)&&(c=1,d=1);++i{try{i(!0);const Oe=await nde({page:l,page_size:m,search:x||void 0,is_registered:b==="all"?void 0:b==="registered",is_banned:O==="all"?void 0:O==="banned",format:T==="all"?void 0:T,sort_by:"usage_count",sort_order:"desc"});e(Oe.data),h(Oe.total)}catch(Oe){const nt=Oe instanceof Error?Oe.message:"加载表情包列表失败";ne({title:"错误",description:nt,variant:"destructive"})}finally{i(!1)}},[l,m,x,b,O,T,ne]),z=async()=>{try{const Oe=await ade();r(Oe.data)}catch(Oe){console.error("加载统计数据失败:",Oe)}};S.useEffect(()=>{ce()},[ce]),S.useEffect(()=>{z()},[]);const xe=async Oe=>{try{const nt=await rde(Oe.id);D(nt.data),R(!0)}catch(nt){const ut=nt instanceof Error?nt.message:"加载详情失败";ne({title:"错误",description:ut,variant:"destructive"})}},Y=Oe=>{D(Oe),F(!0)},P=Oe=>{D(Oe),U(!0)},K=async()=>{if(_)try{await ide(_.id),ne({title:"成功",description:"表情包已删除"}),U(!1),D(null),ce(),z()}catch(Oe){const nt=Oe instanceof Error?Oe.message:"删除失败";ne({title:"错误",description:nt,variant:"destructive"})}},H=async Oe=>{try{await lde(Oe.id),ne({title:"成功",description:"表情包已注册"}),ce(),z()}catch(nt){const ut=nt instanceof Error?nt.message:"注册失败";ne({title:"错误",description:ut,variant:"destructive"})}},fe=async Oe=>{try{await ode(Oe.id),ne({title:"成功",description:"表情包已封禁"}),ce(),z()}catch(nt){const ut=nt instanceof Error?nt.message:"封禁失败";ne({title:"错误",description:ut,variant:"destructive"})}},ve=Oe=>{const nt=new Set(V);nt.has(Oe)?nt.delete(Oe):nt.add(Oe),de(nt)},Re=()=>{V.size===t.length&&t.length>0?de(new Set):de(new Set(t.map(Oe=>Oe.id)))},ue=async()=>{try{const Oe=await cde(Array.from(V));ne({title:"批量删除完成",description:Oe.message}),de(new Set),J(!1),ce(),z()}catch(Oe){ne({title:"批量删除失败",description:Oe instanceof Error?Oe.message:"批量删除失败",variant:"destructive"})}},We=()=>{const Oe=parseInt($),nt=Math.ceil(d/m);Oe>=1&&Oe<=nt?(c(Oe),ae("")):ne({title:"无效的页码",description:`请输入1-${nt}之间的页码`,variant:"destructive"})},ct=n?.formats?Object.keys(n.formats):[];return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsxs("div",{className:"mb-4 sm:mb-6",children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),a.jsx(vn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&a.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"总数"}),a.jsx(Gt,{className:"text-2xl",children:n.total})]})}),a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"已注册"}),a.jsx(Gt,{className:"text-2xl text-green-600",children:n.registered})]})}),a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"已封禁"}),a.jsx(Gt,{className:"text-2xl text-red-600",children:n.banned})]})}),a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"未注册"}),a.jsx(Gt,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),a.jsxs(gt,{children:[a.jsx(Wt,{children:a.jsxs(Gt,{className:"flex items-center gap-2",children:[a.jsx(t2,{className:"h-5 w-5"}),"搜索和筛选"]})}),a.jsxs(an,{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"搜索"}),a.jsxs("div",{className:"relative",children:[a.jsx(Bs,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"描述或哈希值...",value:x,onChange:Oe=>{v(Oe.target.value),c(1)},className:"pl-8"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"注册状态"}),a.jsxs(Lt,{value:b,onValueChange:Oe=>{k(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"registered",children:"已注册"}),a.jsx(Pe,{value:"unregistered",children:"未注册"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"封禁状态"}),a.jsxs(Lt,{value:O,onValueChange:Oe=>{j(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"banned",children:"已封禁"}),a.jsx(Pe,{value:"unbanned",children:"未封禁"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"格式"}),a.jsxs(Lt,{value:T,onValueChange:Oe=>{A(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),ct.map(Oe=>a.jsxs(Pe,{value:Oe,children:[Oe.toUpperCase()," (",n?.formats[Oe],")"]},Oe))]})]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:V.size>0&&a.jsxs("span",{children:["已选择 ",V.size," 个表情包"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:m.toString(),onValueChange:Oe=>{p(parseInt(Oe)),c(1),de(new Set)},children:[a.jsx(Dt,{id:"emoji-page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),V.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>de(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:()=>J(!0),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),a.jsx("div",{className:"flex justify-end pt-4 border-t",children:a.jsxs(ie,{variant:"outline",size:"sm",onClick:ce,disabled:s,children:[a.jsx(Fi,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"表情包列表"}),a.jsxs(Sr,{children:["共 ",d," 个表情包,当前第 ",l," 页"]})]}),a.jsxs(an,{children:[a.jsx("div",{className:"hidden md:block rounded-md border overflow-hidden",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:t.length>0&&V.size===t.length,onCheckedChange:Re,"aria-label":"全选"})}),a.jsx(xt,{className:"w-16",children:"预览"}),a.jsx(xt,{children:"描述"}),a.jsx(xt,{children:"格式"}),a.jsx(xt,{children:"情绪标签"}),a.jsx(xt,{className:"text-center",children:"状态"}),a.jsx(xt,{className:"text-right",children:"使用次数"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(Oe=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:V.has(Oe.id),onCheckedChange:()=>ve(Oe.id),"aria-label":`选择 ${Oe.description}`})}),a.jsx(it,{children:a.jsx("div",{className:"w-20 h-20 bg-muted rounded flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(Oe.id),alt:Oe.description||"表情包",className:"w-full h-full object-cover",onError:nt=>{const ut=nt.target;ut.style.display="none";const Ct=ut.parentElement;Ct&&(Ct.innerHTML='')}})})}),a.jsx(it,{children:a.jsxs("div",{className:"space-y-1 max-w-xs",children:[a.jsx("div",{className:"font-medium truncate",title:Oe.description||"无描述",children:Oe.description||"无描述"}),a.jsxs("div",{className:"text-xs text-muted-foreground font-mono",children:[Oe.emoji_hash.slice(0,16),"..."]})]})}),a.jsx(it,{children:a.jsx(On,{variant:"outline",children:Oe.format.toUpperCase()})}),a.jsx(it,{children:a.jsx(UN,{emotions:Oe.emotion})}),a.jsx(it,{className:"align-middle",children:a.jsxs("div",{className:"flex gap-2 justify-center",children:[Oe.is_registered&&a.jsxs(On,{variant:"default",className:"bg-green-600",children:[a.jsx(Es,{className:"h-3 w-3 mr-1"}),"已注册"]}),Oe.is_banned&&a.jsxs(On,{variant:"destructive",children:[a.jsx(Kb,{className:"h-3 w-3 mr-1"}),"已封禁"]})]})}),a.jsx(it,{className:"text-right font-mono",children:Oe.usage_count}),a.jsx(it,{children:a.jsxs("div",{className:"flex items-center justify-end gap-1 flex-wrap",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>xe(Oe),children:[a.jsx(co,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Y(Oe),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),!Oe.is_registered&&a.jsxs(ie,{size:"sm",onClick:()=>H(Oe),className:"bg-green-600 hover:bg-green-700 text-white",children:[a.jsx(Es,{className:"h-4 w-4 mr-1"}),"注册"]}),!Oe.is_banned&&a.jsxs(ie,{size:"sm",onClick:()=>fe(Oe),className:"bg-orange-600 hover:bg-orange-700 text-white",children:[a.jsx(cO,{className:"h-4 w-4 mr-1"}),"封禁"]}),a.jsxs(ie,{size:"sm",onClick:()=>P(Oe),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},Oe.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3",children:t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(Oe=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex gap-3",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("div",{className:"w-16 h-16 bg-muted rounded flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(Oe.id),alt:Oe.description||"表情包",className:"w-full h-full object-cover",onError:nt=>{const ut=nt.target;ut.style.display="none";const Ct=ut.parentElement;Ct&&(Ct.innerHTML='')}})})}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[a.jsxs("div",{className:"min-w-0 w-full overflow-hidden",children:[a.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",title:Oe.description||"无描述",children:Oe.description||"无描述"}),a.jsxs("p",{className:"text-xs text-muted-foreground font-mono line-clamp-1 w-full break-all",children:[Oe.emoji_hash.slice(0,16),"..."]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 items-center min-w-0",children:[a.jsx(On,{variant:"outline",className:"text-xs flex-shrink-0",children:Oe.format.toUpperCase()}),Oe.is_registered&&a.jsxs(On,{variant:"default",className:"bg-green-600 text-xs flex-shrink-0",children:[a.jsx(Es,{className:"h-3 w-3 mr-1"}),"已注册"]}),Oe.is_banned&&a.jsxs(On,{variant:"destructive",className:"text-xs flex-shrink-0",children:[a.jsx(Kb,{className:"h-3 w-3 mr-1"}),"已封禁"]}),a.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:["使用: ",Oe.usage_count]})]}),Oe.emotion&&Oe.emotion.length>0&&a.jsx("div",{className:"min-w-0 overflow-hidden",children:a.jsx(UN,{emotions:Oe.emotion})})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>xe(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(co,{className:"h-3 w-3 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Y(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),!Oe.is_registered&&a.jsxs(ie,{size:"sm",onClick:()=>H(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-green-600 hover:bg-green-700 text-white",children:[a.jsx(Es,{className:"h-3 w-3 mr-1"}),"注册"]}),!Oe.is_banned&&a.jsxs(ie,{size:"sm",onClick:()=>fe(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-orange-600 hover:bg-orange-700 text-white",children:[a.jsx(cO,{className:"h-3 w-3 mr-1"}),"封禁"]}),a.jsxs(ie,{size:"sm",onClick:()=>P(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},Oe.id))}),d>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(l-1)*m+1," 到"," ",Math.min(l*m,d)," 条,共 ",d," 条"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(Oe=>Math.max(1,Oe-1)),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:$,onChange:Oe=>ae(Oe.target.value),onKeyDown:Oe=>Oe.key==="Enter"&&We(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/m)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:We,disabled:!$,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(Oe=>Oe+1),disabled:l>=Math.ceil(d/m),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(d/m)),disabled:l>=Math.ceil(d/m),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]}),a.jsx(dde,{emoji:_,open:E,onOpenChange:R}),a.jsx(hde,{emoji:_,open:Q,onOpenChange:F,onSuccess:()=>{ce(),z()}})]})}),a.jsx(mn,{open:W,onOpenChange:J,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["你确定要删除选中的 ",V.size," 个表情包吗?此操作不可撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:ue,children:"确认删除"})]})]})}),a.jsx(Rr,{open:L,onOpenChange:U,children:a.jsxs(Nr,{children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"确认删除"}),a.jsx(Gr,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>U(!1),children:"取消"}),a.jsx(ie,{variant:"destructive",onClick:K,children:"删除"})]})]})})]})}function dde({emoji:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[90vh]",children:[a.jsx(Cr,{children:a.jsx(Tr,{children:"表情包详情"})}),a.jsx(vn,{className:"max-h-[calc(90vh-8rem)] pr-4",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex justify-center",children:a.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(t.id),alt:t.description||"表情包",className:"w-full h-full object-cover",onError:s=>{const i=s.target;i.style.display="none";const l=i.parentElement;l&&(l.innerHTML='')}})})}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"ID"}),a.jsx("div",{className:"mt-1 font-mono",children:t.id})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"格式"}),a.jsx("div",{className:"mt-1",children:a.jsx(On,{variant:"outline",children:t.format.toUpperCase()})})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"文件路径"}),a.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.full_path})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"哈希值"}),a.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.emoji_hash})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"描述"}),t.description?a.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:a.jsx(tde,{className:"prose-sm",children:t.description})}):a.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"情绪标签"}),a.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:(()=>{const s=t.emotion?t.emotion.split(/[,,]/).map(i=>i.trim()).filter(Boolean):[];return s.length>0?s.map((i,l)=>a.jsx(On,{variant:"secondary",children:i},l)):a.jsx("span",{className:"text-sm text-muted-foreground",children:"无"})})()})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"状态"}),a.jsxs("div",{className:"mt-2 flex gap-2",children:[t.is_registered&&a.jsx(On,{variant:"default",className:"bg-green-600",children:"已注册"}),t.is_banned&&a.jsx(On,{variant:"destructive",children:"已封禁"}),!t.is_registered&&!t.is_banned&&a.jsx(On,{variant:"outline",children:"未注册"})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"使用次数"}),a.jsx("div",{className:"mt-1 font-mono text-lg",children:t.usage_count})]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"记录时间"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.record_time)})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"注册时间"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.register_time)})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"最后使用"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.last_used_time)})]})]})})]})})}function hde({emoji:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState(""),[l,c]=S.useState(""),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState(!1),{toast:b}=Pr();S.useEffect(()=>{t&&(i(t.description||""),c(t.emotion||""),h(t.is_registered),p(t.is_banned))},[t]);const k=async()=>{if(t)try{v(!0);const O=l.split(/[,,]/).map(j=>j.trim()).filter(Boolean).join(",");await sde(t.id,{description:s||void 0,emotion:O||void 0,is_registered:d,is_banned:m}),b({title:"成功",description:"表情包信息已更新"}),n(!1),r()}catch(O){const j=O instanceof Error?O.message:"保存失败";b({title:"错误",description:j,variant:"destructive"})}finally{v(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑表情包"}),a.jsx(Gr,{children:"修改表情包的描述和标签信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(te,{children:"描述"}),a.jsx(_n,{value:s,onChange:O=>i(O.target.value),placeholder:"输入表情包描述...",rows:3,className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(te,{children:"情绪标签"}),a.jsx(Me,{value:l,onChange:O=>c(O.target.value),placeholder:"使用逗号分隔多个标签,如:开心, 微笑, 快乐",className:"mt-1"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入多个标签时使用逗号分隔(支持中英文逗号)"})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"is_registered",checked:d,onCheckedChange:O=>h(O===!0)}),a.jsx(te,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"is_banned",checked:m,onCheckedChange:O=>p(O===!0)}),a.jsx(te,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:k,disabled:x,children:x?"保存中...":"保存"})]})]})}):null}function UN({emotions:t}){const e=t?t.split(/[,,]/).map(i=>i.trim()).filter(Boolean):[];if(e.length===0)return a.jsx("span",{className:"text-xs text-muted-foreground",children:"-"});const n=(i,l=6)=>i.length<=l?i:i.slice(0,l)+"...",r=e.slice(0,3),s=e.length-3;return a.jsxs("div",{className:"flex flex-wrap gap-1 max-w-full overflow-hidden",children:[r.map((i,l)=>a.jsx(On,{variant:"secondary",className:"text-xs flex-shrink-0",title:i,children:n(i)},l)),s>0&&a.jsxs(On,{variant:"outline",className:"text-xs flex-shrink-0",title:`还有 ${s} 个标签: ${e.slice(3).join(", ")}`,children:["+",s]})]})}const Pc="/api/webui/expression";async function fde(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.chat_id&&e.append("chat_id",t.chat_id);const n=await ot(`${Pc}/list?${e}`,{headers:bt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取表达方式列表失败")}return n.json()}async function mde(t){const e=await ot(`${Pc}/${t}`,{headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取表达方式详情失败")}return e.json()}async function pde(t){const e=await ot(`${Pc}/`,{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"创建表达方式失败")}return e.json()}async function gde(t,e){const n=await ot(`${Pc}/${t}`,{method:"PATCH",headers:bt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新表达方式失败")}return n.json()}async function xde(t){const e=await ot(`${Pc}/${t}`,{method:"DELETE",headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除表达方式失败")}return e.json()}async function vde(t){const e=await ot(`${Pc}/batch/delete`,{method:"POST",headers:bt(),body:JSON.stringify({ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除表达方式失败")}return e.json()}async function yde(){const t=await ot(`${Pc}/stats/summary`,{headers:bt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}function bde(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(1),[d,h]=S.useState(20),[m,p]=S.useState(""),[x,v]=S.useState(null),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,A]=S.useState(!1),[_,D]=S.useState(null),[E,R]=S.useState(new Set),[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,de]=S.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),{toast:W}=Pr(),J=async()=>{try{r(!0);const H=await fde({page:l,page_size:d,search:m||void 0});e(H.data),i(H.total)}catch(H){W({title:"加载失败",description:H instanceof Error?H.message:"无法加载表达方式",variant:"destructive"})}finally{r(!1)}},$=async()=>{try{const H=await yde();de(H.data)}catch(H){console.error("加载统计数据失败:",H)}};S.useEffect(()=>{J(),$()},[l,d,m]);const ae=async H=>{try{const fe=await mde(H.id);v(fe.data),k(!0)}catch(fe){W({title:"加载详情失败",description:fe instanceof Error?fe.message:"无法加载表达方式详情",variant:"destructive"})}},ne=H=>{v(H),j(!0)},ce=async H=>{try{await xde(H.id),W({title:"删除成功",description:`已删除表达方式: ${H.situation}`}),D(null),J(),$()}catch(fe){W({title:"删除失败",description:fe instanceof Error?fe.message:"无法删除表达方式",variant:"destructive"})}},z=H=>{const fe=new Set(E);fe.has(H)?fe.delete(H):fe.add(H),R(fe)},xe=()=>{E.size===t.length&&t.length>0?R(new Set):R(new Set(t.map(H=>H.id)))},Y=async()=>{try{await vde(Array.from(E)),W({title:"批量删除成功",description:`已删除 ${E.size} 个表达方式`}),R(new Set),F(!1),J(),$()}catch(H){W({title:"批量删除失败",description:H instanceof Error?H.message:"无法批量删除表达方式",variant:"destructive"})}},P=()=>{const H=parseInt(L),fe=Math.ceil(s/d);H>=1&&H<=fe?(c(H),U("")):W({title:"无效的页码",description:`请输入1-${fe}之间的页码`,variant:"destructive"})},K=H=>H?new Date(H*1e3).toLocaleString("zh-CN"):"-";return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsx("div",{className:"mb-4 sm:mb-6",children:a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[a.jsx(Wf,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),a.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),a.jsxs(ie,{onClick:()=>A(!0),className:"gap-2",children:[a.jsx(Wr,{className:"h-4 w-4"}),"新增表达方式"]})]})}),a.jsx(vn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),a.jsx("div",{className:"text-2xl font-bold mt-1",children:V.total})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:V.recent_7days})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:V.chat_count})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx(te,{htmlFor:"search",children:"搜索"}),a.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Bs,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{id:"search",placeholder:"搜索情境、风格或上下文...",value:m,onChange:H=>p(H.target.value),className:"pl-9"})]})}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:E.size>0&&a.jsxs("span",{children:["已选择 ",E.size," 个表达方式"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:d.toString(),onValueChange:H=>{h(parseInt(H)),c(1),R(new Set)},children:[a.jsx(Dt,{id:"page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),E.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>R(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:()=>F(!0),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card",children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:E.size===t.length&&t.length>0,onCheckedChange:xe})}),a.jsx(xt,{children:"情境"}),a.jsx(xt,{children:"风格"}),a.jsx(xt,{children:"聊天ID"}),a.jsx(xt,{children:"最后活跃"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n?a.jsx(xr,{children:a.jsx(it,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(H=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:E.has(H.id),onCheckedChange:()=>z(H.id)})}),a.jsx(it,{className:"font-medium max-w-xs truncate",children:H.situation}),a.jsx(it,{className:"max-w-xs truncate",children:H.style}),a.jsx(it,{className:"font-mono text-sm",children:H.chat_id}),a.jsx(it,{className:"text-sm text-muted-foreground",children:K(H.last_active_time)}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ae(H),children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ne(H),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>D(H),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},H.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(H=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ss,{checked:E.has(H.id),onCheckedChange:()=>z(H.id),className:"mt-1"}),a.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),a.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:H.situation,children:H.situation})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),a.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:H.style,children:H.style})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天ID"}),a.jsx("p",{className:"font-mono text-xs truncate",children:H.chat_id})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后活跃"}),a.jsx("p",{className:"text-xs",children:K(H.last_active_time)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(H),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx($i,{className:"h-3 w-3 mr-1"}),"查看"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ne(H),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>D(H),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},H.id))}),s>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",l," / ",Math.ceil(s/d)," 页"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l-1),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:L,onChange:H=>U(H.target.value),onKeyDown:H=>H.key==="Enter"&&P(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/d)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:P,disabled:!L,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l+1),disabled:l>=Math.ceil(s/d),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(s/d)),disabled:l>=Math.ceil(s/d),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]})}),a.jsx(wde,{expression:x,open:b,onOpenChange:k}),a.jsx(Sde,{open:T,onOpenChange:A,onSuccess:()=>{J(),$(),A(!1)}}),a.jsx(kde,{expression:x,open:O,onOpenChange:j,onSuccess:()=>{J(),$(),j(!1)}}),a.jsx(mn,{open:!!_,onOpenChange:()=>D(null),children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除表达方式 "',_?.situation,'" 吗? 此操作不可撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>_&&ce(_),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),a.jsx(Ode,{open:Q,onOpenChange:F,onConfirm:Y,count:E.size})]})}function wde({expression:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"表达方式详情"}),a.jsx(Gr,{children:"查看表达方式的完整信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Au,{label:"情境",value:t.situation}),a.jsx(Au,{label:"风格",value:t.style}),a.jsx(Au,{icon:mg,label:"聊天ID",value:t.chat_id,mono:!0}),a.jsx(Au,{icon:mg,label:"记录ID",value:t.id.toString(),mono:!0})]}),t.context&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"上下文"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.context})]}),t.up_content&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"上文内容"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.up_content})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Au,{icon:dc,label:"最后活跃",value:r(t.last_active_time)}),a.jsx(Au,{icon:dc,label:"创建时间",value:r(t.create_date)})]})]}),a.jsx(ps,{children:a.jsx(ie,{onClick:()=>n(!1),children:"关闭"})})]})})}function Au({icon:t,label:e,value:n,mono:r=!1}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs(te,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&a.jsx(t,{className:"h-3 w-3"}),e]}),a.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Sde({open:t,onOpenChange:e,onSuccess:n}){const[r,s]=S.useState({situation:"",style:"",context:"",up_content:"",chat_id:""}),[i,l]=S.useState(!1),{toast:c}=Pr(),d=async()=>{if(!r.situation||!r.style||!r.chat_id){c({title:"验证失败",description:"请填写必填字段:情境、风格和聊天ID",variant:"destructive"});return}try{l(!0),await pde(r),c({title:"创建成功",description:"表达方式已创建"}),s({situation:"",style:"",context:"",up_content:"",chat_id:""}),n()}catch(h){c({title:"创建失败",description:h instanceof Error?h.message:"无法创建表达方式",variant:"destructive"})}finally{l(!1)}};return a.jsx(Rr,{open:t,onOpenChange:e,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"新增表达方式"}),a.jsx(Gr,{children:"创建新的表达方式记录"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"situation",children:["情境 ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Me,{id:"situation",value:r.situation,onChange:h=>s({...r,situation:h.target.value}),placeholder:"描述使用场景"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"style",children:["风格 ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Me,{id:"style",value:r.style,onChange:h=>s({...r,style:h.target.value}),placeholder:"描述表达风格"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"chat_id",children:["聊天ID ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Me,{id:"chat_id",value:r.chat_id,onChange:h=>s({...r,chat_id:h.target.value}),placeholder:"关联的聊天ID"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"context",children:"上下文"}),a.jsx(_n,{id:"context",value:r.context,onChange:h=>s({...r,context:h.target.value}),placeholder:"上下文信息(可选)",rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"up_content",children:"上文内容"}),a.jsx(_n,{id:"up_content",value:r.up_content,onChange:h=>s({...r,up_content:h.target.value}),placeholder:"上文内容(可选)",rows:3})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>e(!1),children:"取消"}),a.jsx(ie,{onClick:d,disabled:i,children:i?"创建中...":"创建"})]})]})})}function kde({expression:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState({}),[l,c]=S.useState(!1),{toast:d}=Pr();S.useEffect(()=>{t&&i({situation:t.situation,style:t.style,context:t.context||"",up_content:t.up_content||"",chat_id:t.chat_id})},[t]);const h=async()=>{if(t)try{c(!0),await gde(t.id,s),d({title:"保存成功",description:"表达方式已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新表达方式",variant:"destructive"})}finally{c(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑表达方式"}),a.jsx(Gr,{children:"修改表达方式的信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_situation",children:"情境"}),a.jsx(Me,{id:"edit_situation",value:s.situation||"",onChange:m=>i({...s,situation:m.target.value}),placeholder:"描述使用场景"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_style",children:"风格"}),a.jsx(Me,{id:"edit_style",value:s.style||"",onChange:m=>i({...s,style:m.target.value}),placeholder:"描述表达风格"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_chat_id",children:"聊天ID"}),a.jsx(Me,{id:"edit_chat_id",value:s.chat_id||"",onChange:m=>i({...s,chat_id:m.target.value}),placeholder:"关联的聊天ID"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_context",children:"上下文"}),a.jsx(_n,{id:"edit_context",value:s.context||"",onChange:m=>i({...s,context:m.target.value}),placeholder:"上下文信息",rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_up_content",children:"上文内容"}),a.jsx(_n,{id:"edit_up_content",value:s.up_content||"",onChange:m=>i({...s,up_content:m.target.value}),placeholder:"上文内容",rows:3})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:h,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function Ode({open:t,onOpenChange:e,onConfirm:n,count:r}){return a.jsx(mn,{open:t,onOpenChange:e,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["您即将删除 ",r," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const Pd="/api/webui/person";async function jde(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.is_known!==void 0&&e.append("is_known",t.is_known.toString()),t.platform&&e.append("platform",t.platform);const n=await ot(`${Pd}/list?${e}`,{headers:bt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取人物列表失败")}return n.json()}async function Nde(t){const e=await ot(`${Pd}/${t}`,{headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取人物详情失败")}return e.json()}async function Cde(t,e){const n=await ot(`${Pd}/${t}`,{method:"PATCH",headers:bt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新人物信息失败")}return n.json()}async function Tde(t){const e=await ot(`${Pd}/${t}`,{method:"DELETE",headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除人物信息失败")}return e.json()}async function Ade(){const t=await ot(`${Pd}/stats/summary`,{headers:bt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}async function Mde(t){const e=await ot(`${Pd}/batch/delete`,{method:"POST",headers:bt(),body:JSON.stringify({person_ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除失败")}return e.json()}function Ede(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(1),[d,h]=S.useState(20),[m,p]=S.useState(""),[x,v]=S.useState(void 0),[b,k]=S.useState(void 0),[O,j]=S.useState(null),[T,A]=S.useState(!1),[_,D]=S.useState(!1),[E,R]=S.useState(null),[Q,F]=S.useState({total:0,known:0,unknown:0,platforms:{}}),[L,U]=S.useState(new Set),[V,de]=S.useState(!1),[W,J]=S.useState(""),{toast:$}=Pr(),ae=async()=>{try{r(!0);const ue=await jde({page:l,page_size:d,search:m||void 0,is_known:x,platform:b});e(ue.data),i(ue.total)}catch(ue){$({title:"加载失败",description:ue instanceof Error?ue.message:"无法加载人物信息",variant:"destructive"})}finally{r(!1)}},ne=async()=>{try{const ue=await Ade();F(ue.data)}catch(ue){console.error("加载统计数据失败:",ue)}};S.useEffect(()=>{ae(),ne()},[l,d,m,x,b]);const ce=async ue=>{try{const We=await Nde(ue.person_id);j(We.data),A(!0)}catch(We){$({title:"加载详情失败",description:We instanceof Error?We.message:"无法加载人物详情",variant:"destructive"})}},z=ue=>{j(ue),D(!0)},xe=async ue=>{try{await Tde(ue.person_id),$({title:"删除成功",description:`已删除人物信息: ${ue.person_name||ue.nickname||ue.user_id}`}),R(null),ae(),ne()}catch(We){$({title:"删除失败",description:We instanceof Error?We.message:"无法删除人物信息",variant:"destructive"})}},Y=S.useMemo(()=>Object.keys(Q.platforms),[Q.platforms]),P=ue=>{const We=new Set(L);We.has(ue)?We.delete(ue):We.add(ue),U(We)},K=()=>{L.size===t.length&&t.length>0?U(new Set):U(new Set(t.map(ue=>ue.person_id)))},H=()=>{if(L.size===0){$({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}de(!0)},fe=async()=>{try{const ue=await Mde(Array.from(L));$({title:"批量删除完成",description:ue.message}),U(new Set),de(!1),ae(),ne()}catch(ue){$({title:"批量删除失败",description:ue instanceof Error?ue.message:"批量删除失败",variant:"destructive"})}},ve=()=>{const ue=parseInt(W),We=Math.ceil(s/d);ue>=1&&ue<=We?(c(ue),J("")):$({title:"无效的页码",description:`请输入1-${We}之间的页码`,variant:"destructive"})},Re=ue=>ue?new Date(ue*1e3).toLocaleString("zh-CN"):"-";return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsx("div",{className:"mb-4 sm:mb-6",children:a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[a.jsx(Oq,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),a.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),a.jsx(vn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),a.jsx("div",{className:"text-2xl font-bold mt-1",children:Q.total})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:Q.known})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:Q.unknown})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"sm:col-span-2",children:[a.jsx(te,{htmlFor:"search",children:"搜索"}),a.jsxs("div",{className:"relative mt-1.5",children:[a.jsx(Bs,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:m,onChange:ue=>p(ue.target.value),className:"pl-9"})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"filter-known",children:"认识状态"}),a.jsxs(Lt,{value:x===void 0?"all":x.toString(),onValueChange:ue=>{v(ue==="all"?void 0:ue==="true"),c(1)},children:[a.jsx(Dt,{id:"filter-known",className:"mt-1.5",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"true",children:"已认识"}),a.jsx(Pe,{value:"false",children:"未认识"})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"filter-platform",children:"平台"}),a.jsxs(Lt,{value:b||"all",onValueChange:ue=>{k(ue==="all"?void 0:ue),c(1)},children:[a.jsx(Dt,{id:"filter-platform",className:"mt-1.5",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部平台"}),Y.map(ue=>a.jsxs(Pe,{value:ue,children:[ue," (",Q.platforms[ue],")"]},ue))]})]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:L.size>0&&a.jsxs("span",{children:["已选择 ",L.size," 个人物"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:d.toString(),onValueChange:ue=>{h(parseInt(ue)),c(1),U(new Set)},children:[a.jsx(Dt,{id:"page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),L.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>U(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:H,children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card",children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:t.length>0&&L.size===t.length,onCheckedChange:K,"aria-label":"全选"})}),a.jsx(xt,{children:"状态"}),a.jsx(xt,{children:"名称"}),a.jsx(xt,{children:"昵称"}),a.jsx(xt,{children:"平台"}),a.jsx(xt,{children:"用户ID"}),a.jsx(xt,{children:"最后更新"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(ue=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:L.has(ue.person_id),onCheckedChange:()=>P(ue.person_id),"aria-label":`选择 ${ue.person_name||ue.nickname||ue.user_id}`})}),a.jsx(it,{children:a.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",ue.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:ue.is_known?"已认识":"未认识"})}),a.jsx(it,{className:"font-medium",children:ue.person_name||a.jsx("span",{className:"text-muted-foreground",children:"-"})}),a.jsx(it,{children:ue.nickname||"-"}),a.jsx(it,{children:ue.platform}),a.jsx(it,{className:"font-mono text-sm",children:ue.user_id}),a.jsx(it,{className:"text-sm text-muted-foreground",children:Re(ue.last_know)}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ce(ue),children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>z(ue),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>R(ue),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},ue.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(ue=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ss,{checked:L.has(ue.person_id),onCheckedChange:()=>P(ue.person_id),className:"mt-1"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",ue.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:ue.is_known?"已认识":"未认识"}),a.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:ue.person_name||a.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),ue.nickname&&a.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",ue.nickname]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),a.jsx("p",{className:"font-medium text-xs",children:ue.platform})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),a.jsx("p",{className:"font-mono text-xs truncate",title:ue.user_id,children:ue.user_id})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),a.jsx("p",{className:"text-xs",children:Re(ue.last_know)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ce(ue),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx($i,{className:"h-3 w-3 mr-1"}),"查看"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>z(ue),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>R(ue),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},ue.id))}),s>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",l," / ",Math.ceil(s/d)," 页"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l-1),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:W,onChange:ue=>J(ue.target.value),onKeyDown:ue=>ue.key==="Enter"&&ve(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/d)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:ve,disabled:!W,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l+1),disabled:l>=Math.ceil(s/d),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(s/d)),disabled:l>=Math.ceil(s/d),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]})}),a.jsx(_de,{person:O,open:T,onOpenChange:A}),a.jsx(Dde,{person:O,open:_,onOpenChange:D,onSuccess:()=>{ae(),ne(),D(!1)}}),a.jsx(mn,{open:!!E,onOpenChange:()=>R(null),children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除人物信息 "',E?.person_name||E?.nickname||E?.user_id,'" 吗? 此操作不可撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>E&&xe(E),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),a.jsx(mn,{open:V,onOpenChange:de,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["确定要删除选中的 ",L.size," 个人物信息吗? 此操作不可撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:fe,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function _de({person:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"人物详情"}),a.jsxs(Gr,{children:["查看 ",t.person_name||t.nickname||t.user_id," 的完整信息"]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Za,{icon:D9,label:"人物名称",value:t.person_name}),a.jsx(Za,{icon:Wf,label:"昵称",value:t.nickname}),a.jsx(Za,{icon:mg,label:"用户ID",value:t.user_id,mono:!0}),a.jsx(Za,{icon:mg,label:"人物ID",value:t.person_id,mono:!0}),a.jsx(Za,{label:"平台",value:t.platform}),a.jsx(Za,{label:"状态",value:t.is_known?"已认识":"未认识"})]}),t.name_reason&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),a.jsx("p",{className:"mt-1 text-sm",children:t.name_reason})]}),t.memory_points&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"个人印象"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.memory_points})]}),t.group_nick_name&&t.group_nick_name.length>0&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"群昵称"}),a.jsx("div",{className:"mt-2 space-y-1",children:t.group_nick_name.map((s,i)=>a.jsxs("div",{className:"text-sm flex items-center gap-2",children:[a.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:s.group_id}),a.jsx("span",{children:"→"}),a.jsx("span",{children:s.group_nick_name})]},i))})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsx(Za,{icon:dc,label:"认识时间",value:r(t.know_times)}),a.jsx(Za,{icon:dc,label:"首次记录",value:r(t.know_since)}),a.jsx(Za,{icon:dc,label:"最后更新",value:r(t.last_know)})]})]}),a.jsx(ps,{children:a.jsx(ie,{onClick:()=>n(!1),children:"关闭"})})]})})}function Za({icon:t,label:e,value:n,mono:r=!1}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs(te,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&a.jsx(t,{className:"h-3 w-3"}),e]}),a.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Dde({person:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState({}),[l,c]=S.useState(!1),{toast:d}=Pr();S.useEffect(()=>{t&&i({person_name:t.person_name||"",name_reason:t.name_reason||"",nickname:t.nickname||"",memory_points:t.memory_points||"",is_known:t.is_known})},[t]);const h=async()=>{if(t)try{c(!0),await Cde(t.person_id,s),d({title:"保存成功",description:"人物信息已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新人物信息",variant:"destructive"})}finally{c(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑人物信息"}),a.jsxs(Gr,{children:["修改 ",t.person_name||t.nickname||t.user_id," 的信息"]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"person_name",children:"人物名称"}),a.jsx(Me,{id:"person_name",value:s.person_name||"",onChange:m=>i({...s,person_name:m.target.value}),placeholder:"为这个人设置一个名称"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称"}),a.jsx(Me,{id:"nickname",value:s.nickname||"",onChange:m=>i({...s,nickname:m.target.value}),placeholder:"昵称"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"name_reason",children:"名称设定原因"}),a.jsx(_n,{id:"name_reason",value:s.name_reason||"",onChange:m=>i({...s,name_reason:m.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"memory_points",children:"个人印象"}),a.jsx(_n,{id:"memory_points",value:s.memory_points||"",onChange:m=>i({...s,memory_points:m.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),a.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[a.jsxs("div",{children:[a.jsx(te,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),a.jsx(jt,{id:"is_known",checked:s.is_known,onCheckedChange:m=>i({...s,is_known:m})})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:h,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function Rde(t,e,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:n}).format(e).split(/\s/g).slice(2).join(" ")}const zde={},Wh={};function uc(t,e){try{const r=(zde[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in Wh?Wh[r]:VN(r,r.split(":"))}catch{if(t in Wh)return Wh[t];const n=t?.match(Pde);return n?VN(t,n.slice(1)):NaN}}const Pde=/([+-]\d\d):?(\d\d)?/;function VN(t,e){const n=+(e[0]||0),r=+(e[1]||0),s=+(e[2]||0)/60;return Wh[t]=n*60+r>0?n*60+r+s:n*60-r-s}class xa extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(uc(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),lz(this),R4(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new xa(...n,e):new xa(Date.now(),e)}withTimeZone(e){return new xa(+this,e)}getTimezoneOffset(){const e=-uc(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),R4(this),+this}[Symbol.for("constructDateFrom")](e){return new xa(+new Date(e),this.timeZone)}}const WN=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!WN.test(t))return;const e=t.replace(WN,"$1UTC");xa.prototype[e]&&(t.startsWith("get")?xa.prototype[t]=function(){return this.internal[e]()}:(xa.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),Bde(this),+this},xa.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),R4(this),+this}))});function R4(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-uc(t.timeZone,t)*60))}function Bde(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),lz(t)}function lz(t){const e=uc(t.timeZone,t),n=e>0?Math.floor(e):Math.ceil(e),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const s=-new Date(+t).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),l=s-i,c=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();l&&c&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+l);const d=s-n;d&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+d);const h=new Date(+t);h.setUTCSeconds(0);const m=s>0?h.getSeconds():(h.getSeconds()-60)%60,p=Math.round(-(uc(t.timeZone,t)*60))%60;(p||m)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+p),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+p+m));const x=uc(t.timeZone,t),v=x>0?Math.floor(x):Math.ceil(x),k=-new Date(+t).getTimezoneOffset()-v,O=v!==n,j=k-d;if(O&&j){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+j);const T=uc(t.timeZone,t),A=T>0?Math.floor(T):Math.ceil(T),_=v-A;_&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+_),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+_))}}class Zr extends xa{static tz(e,...n){return n.length?new Zr(...n,e):new Zr(Date.now(),e)}toISOString(){const[e,n,r]=this.tzComponents(),s=`${e}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,n,r,s]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${r} ${n} ${s}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[n,r,s]=this.tzComponents();return`${e} GMT${n}${r}${s} (${Rde(this.timeZone,this)})`}toLocaleString(e,n){return Date.prototype.toLocaleString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(e,n){return Date.prototype.toLocaleDateString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(e,n){return Date.prototype.toLocaleTimeString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),n=e>0?"-":"+",r=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),s=String(Math.abs(e)%60).padStart(2,"0");return[n,r,s]}withTimeZone(e){return new Zr(+this,e)}[Symbol.for("constructDateFrom")](e){return new Zr(+new Date(e),this.timeZone)}}const oz=6048e5,Lde=864e5,GN=Symbol.for("constructDateFrom");function vr(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&GN in t?t[GN](e):t instanceof Date?new t.constructor(e):new Date(e)}function Nn(t,e){return vr(e||t,t)}function cz(t,e,n){const r=Nn(t,n?.in);return isNaN(e)?vr(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function uz(t,e,n){const r=Nn(t,n?.in);if(isNaN(e))return vr(t,NaN);if(!e)return r;const s=r.getDate(),i=vr(t,r.getTime());i.setMonth(r.getMonth()+e+1,0);const l=i.getDate();return s>=l?i:(r.setFullYear(i.getFullYear(),i.getMonth(),s),r)}let Ide={};function O0(){return Ide}function So(t,e){const n=O0(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Nn(t,e?.in),i=s.getDay(),l=(i=i.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function XN(t){const e=Nn(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Bc(t,...e){const n=vr.bind(null,t||e.find(r=>typeof r=="object"));return e.map(n)}function Qf(t,e){const n=Nn(t,e?.in);return n.setHours(0,0,0,0),n}function hz(t,e,n){const[r,s]=Bc(n?.in,t,e),i=Qf(r),l=Qf(s),c=+i-XN(i),d=+l-XN(l);return Math.round((c-d)/Lde)}function qde(t,e){const n=dz(t,e),r=vr(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Ff(r)}function Fde(t,e,n){return cz(t,e*7,n)}function Qde(t,e,n){return uz(t,e*12,n)}function $de(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=vr.bind(null,s));const i=Nn(s,r);(!n||n{!r&&typeof s=="object"&&(r=vr.bind(null,s));const i=Nn(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),vr(r,n||NaN)}function Ude(t,e,n){const[r,s]=Bc(n?.in,t,e);return+Qf(r)==+Qf(s)}function fz(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Vde(t){return!(!fz(t)&&typeof t!="number"||isNaN(+Nn(t)))}function Wde(t,e,n){const[r,s]=Bc(n?.in,t,e),i=r.getFullYear()-s.getFullYear(),l=r.getMonth()-s.getMonth();return i*12+l}function Gde(t,e){const n=Nn(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function mz(t,e){const[n,r]=Bc(t,e.start,e.end);return{start:n,end:r}}function Xde(t,e){const{start:n,end:r}=mz(e?.in,t);let s=+n>+r;const i=s?+n:+r,l=s?r:n;l.setHours(0,0,0,0),l.setDate(1);let c=1;const d=[];for(;+l<=i;)d.push(vr(n,l)),l.setMonth(l.getMonth()+c);return s?d.reverse():d}function Yde(t,e){const n=Nn(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Kde(t,e){const n=Nn(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function pz(t,e){const n=Nn(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Zde(t,e){const{start:n,end:r}=mz(e?.in,t);let s=+n>+r;const i=s?+n:+r,l=s?r:n;l.setHours(0,0,0,0),l.setMonth(0,1);let c=1;const d=[];for(;+l<=i;)d.push(vr(n,l)),l.setFullYear(l.getFullYear()+c);return s?d.reverse():d}function gz(t,e){const n=O0(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Nn(t,e?.in),i=s.getDay(),l=(i{let r;const s=ehe[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function td(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const nhe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},rhe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},she={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ihe={date:td({formats:nhe,defaultWidth:"full"}),time:td({formats:rhe,defaultWidth:"full"}),dateTime:td({formats:she,defaultWidth:"full"})},ahe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},lhe=(t,e,n,r)=>ahe[t];function ua(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const l=t.defaultFormattingWidth||t.defaultWidth,c=n?.width?String(n.width):l;s=t.formattingValues[c]||t.formattingValues[l]}else{const l=t.defaultWidth,c=n?.width?String(n.width):t.defaultWidth;s=t.values[c]||t.values[l]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const ohe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},che={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},uhe={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},dhe={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},hhe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},fhe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},mhe=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},phe={ordinalNumber:mhe,era:ua({values:ohe,defaultWidth:"wide"}),quarter:ua({values:che,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ua({values:uhe,defaultWidth:"wide"}),day:ua({values:dhe,defaultWidth:"wide"}),dayPeriod:ua({values:hhe,defaultWidth:"wide",formattingValues:fhe,defaultFormattingWidth:"wide"})};function da(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const l=i[0],c=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],d=Array.isArray(c)?xhe(c,p=>p.test(l)):ghe(c,p=>p.test(l));let h;h=t.valueCallback?t.valueCallback(d):d,h=n.valueCallback?n.valueCallback(h):h;const m=e.slice(l.length);return{value:h,rest:m}}}function ghe(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function xhe(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let l=t.valueCallback?t.valueCallback(i[0]):i[0];l=n.valueCallback?n.valueCallback(l):l;const c=e.slice(s.length);return{value:l,rest:c}}}const vhe=/^(\d+)(th|st|nd|rd)?/i,yhe=/\d+/i,bhe={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},whe={any:[/^b/i,/^(a|c)/i]},She={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},khe={any:[/1/i,/2/i,/3/i,/4/i]},Ohe={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},jhe={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Nhe={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Che={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},The={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Ahe={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Mhe={ordinalNumber:xz({matchPattern:vhe,parsePattern:yhe,valueCallback:t=>parseInt(t,10)}),era:da({matchPatterns:bhe,defaultMatchWidth:"wide",parsePatterns:whe,defaultParseWidth:"any"}),quarter:da({matchPatterns:She,defaultMatchWidth:"wide",parsePatterns:khe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:da({matchPatterns:Ohe,defaultMatchWidth:"wide",parsePatterns:jhe,defaultParseWidth:"any"}),day:da({matchPatterns:Nhe,defaultMatchWidth:"wide",parsePatterns:Che,defaultParseWidth:"any"}),dayPeriod:da({matchPatterns:The,defaultMatchWidth:"any",parsePatterns:Ahe,defaultParseWidth:"any"})},G5={code:"en-US",formatDistance:the,formatLong:ihe,formatRelative:lhe,localize:phe,match:Mhe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ehe(t,e){const n=Nn(t,e?.in);return hz(n,pz(n))+1}function vz(t,e){const n=Nn(t,e?.in),r=+Ff(n)-+qde(n);return Math.round(r/oz)+1}function yz(t,e){const n=Nn(t,e?.in),r=n.getFullYear(),s=O0(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,l=vr(e?.in||t,0);l.setFullYear(r+1,0,i),l.setHours(0,0,0,0);const c=So(l,e),d=vr(e?.in||t,0);d.setFullYear(r,0,i),d.setHours(0,0,0,0);const h=So(d,e);return+n>=+c?r+1:+n>=+h?r:r-1}function _he(t,e){const n=O0(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=yz(t,e),i=vr(e?.in||t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),So(i,e)}function bz(t,e){const n=Nn(t,e?.in),r=+So(n,e)-+_he(n,e);return Math.round(r/oz)+1}function xn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const Zl={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return xn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):xn(n+1,2)},d(t,e){return xn(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return xn(t.getHours()%12||12,e.length)},H(t,e){return xn(t.getHours(),e.length)},m(t,e){return xn(t.getMinutes(),e.length)},s(t,e){return xn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return xn(s,e.length)}},Mu={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},YN={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return Zl.y(t,e)},Y:function(t,e,n,r){const s=yz(t,r),i=s>0?s:1-s;if(e==="YY"){const l=i%100;return xn(l,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):xn(i,e.length)},R:function(t,e){const n=dz(t);return xn(n,e.length)},u:function(t,e){const n=t.getFullYear();return xn(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return xn(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return xn(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return Zl.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return xn(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const s=bz(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):xn(s,e.length)},I:function(t,e,n){const r=vz(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):xn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Zl.d(t,e)},D:function(t,e,n){const r=Ehe(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):xn(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return xn(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return xn(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return xn(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let s;switch(r===12?s=Mu.noon:r===0?s=Mu.midnight:s=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let s;switch(r>=17?s=Mu.evening:r>=12?s=Mu.afternoon:r>=4?s=Mu.morning:s=Mu.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Zl.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Zl.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):xn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):xn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Zl.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Zl.s(t,e)},S:function(t,e){return Zl.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return ZN(r);case"XXXX":case"XX":return rc(r);case"XXXXX":case"XXX":default:return rc(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return ZN(r);case"xxxx":case"xx":return rc(r);case"xxxxx":case"xxx":default:return rc(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+KN(r,":");case"OOOO":default:return"GMT"+rc(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+KN(r,":");case"zzzz":default:return"GMT"+rc(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return xn(r,e.length)},T:function(t,e,n){return xn(+t,e.length)}};function KN(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+e+xn(i,2)}function ZN(t,e){return t%60===0?(t>0?"-":"+")+xn(Math.abs(t)/60,2):rc(t,e)}function rc(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=xn(Math.trunc(r/60),2),i=xn(r%60,2);return n+s+e+i}const JN=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},wz=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Dhe=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return JN(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",JN(r,e)).replace("{{time}}",wz(s,e))},Rhe={p:wz,P:Dhe},zhe=/^D+$/,Phe=/^Y+$/,Bhe=["D","DD","YY","YYYY"];function Lhe(t){return zhe.test(t)}function Ihe(t){return Phe.test(t)}function qhe(t,e,n){const r=Fhe(t,e,n);if(console.warn(r),Bhe.includes(t))throw new RangeError(r)}function Fhe(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Qhe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,$he=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Hhe=/^'([^]*?)'?$/,Uhe=/''/g,Vhe=/[a-zA-Z]/;function dg(t,e,n){const r=O0(),s=n?.locale??r.locale??G5,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,l=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,c=Nn(t,n?.in);if(!Vde(c))throw new RangeError("Invalid time value");let d=e.match($he).map(m=>{const p=m[0];if(p==="p"||p==="P"){const x=Rhe[p];return x(m,s.formatLong)}return m}).join("").match(Qhe).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const p=m[0];if(p==="'")return{isToken:!1,value:Whe(m)};if(YN[p])return{isToken:!0,value:m};if(p.match(Vhe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+p+"`");return{isToken:!1,value:m}});s.localize.preprocessor&&(d=s.localize.preprocessor(c,d));const h={firstWeekContainsDate:i,weekStartsOn:l,locale:s};return d.map(m=>{if(!m.isToken)return m.value;const p=m.value;(!n?.useAdditionalWeekYearTokens&&Ihe(p)||!n?.useAdditionalDayOfYearTokens&&Lhe(p))&&qhe(p,e,String(t));const x=YN[p[0]];return x(c,p,s.localize,h)}).join("")}function Whe(t){const e=t.match(Hhe);return e?e[1].replace(Uhe,"'"):t}function Ghe(t,e){const n=Nn(t,e?.in),r=n.getFullYear(),s=n.getMonth(),i=vr(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function Xhe(t,e){return Nn(t,e?.in).getMonth()}function Yhe(t,e){return Nn(t,e?.in).getFullYear()}function Khe(t,e){return+Nn(t)>+Nn(e)}function Zhe(t,e){return+Nn(t)<+Nn(e)}function Jhe(t,e,n){const[r,s]=Bc(n?.in,t,e);return+So(r,n)==+So(s,n)}function efe(t,e,n){const[r,s]=Bc(n?.in,t,e);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function tfe(t,e,n){const[r,s]=Bc(n?.in,t,e);return r.getFullYear()===s.getFullYear()}function nfe(t,e,n){const r=Nn(t,n?.in),s=r.getFullYear(),i=r.getDate(),l=vr(t,0);l.setFullYear(s,e,15),l.setHours(0,0,0,0);const c=Ghe(l);return r.setMonth(e,Math.min(i,c)),r}function rfe(t,e,n){const r=Nn(t,n?.in);return isNaN(+r)?vr(t,NaN):(r.setFullYear(e),r)}const e9=5,sfe=4;function ife(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,s=e.addDays(t,-r+1),i=e.addDays(s,e9*7-1);return e.getMonth(t)===e.getMonth(i)?e9:sfe}function Sz(t,e){const n=e.startOfMonth(t),r=n.getDay();return r===1?n:r===0?e.addDays(n,-6):e.addDays(n,-1*(r-1))}function afe(t,e){const n=Sz(t,e),r=ife(t,e);return e.addDays(n,r*7-1)}class ai{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Zr.tz(this.options.timeZone):new this.Date,this.newDate=(r,s,i)=>this.overrides?.newDate?this.overrides.newDate(r,s,i):this.options.timeZone?new Zr(r,s,i,this.options.timeZone):new Date(r,s,i),this.addDays=(r,s)=>this.overrides?.addDays?this.overrides.addDays(r,s):cz(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):uz(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):Fde(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):Qde(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):hz(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):Wde(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Xde(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):Zde(r),i=new Set(s.map(c=>this.getYear(c)));if(i.size===s.length)return s;const l=[];return i.forEach(c=>{l.push(new Date(c,0,1))}),l},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):afe(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):Jde(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):Gde(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):gz(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):Kde(r),this.format=(r,s,i)=>{const l=this.overrides?.format?this.overrides.format(r,s,this.options):dg(r,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(l):l},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):vz(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):Xhe(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):Yhe(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):bz(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):Khe(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):Zhe(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):fz(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):Ude(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):efe(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):tfe(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):$de(r),this.min=r=>this.overrides?.min?this.overrides.min(r):Hde(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):nfe(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):rfe(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):Sz(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):Qf(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Ff(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):Yde(r),this.startOfWeek=(r,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):So(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):pz(r),this.options={locale:G5,...e},this.overrides=n}getDigitMap(){const{numerals:e="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:e}),r={};for(let s=0;s<10;s++)r[s.toString()]=n.format(s);return r}replaceDigits(e){const n=this.getDigitMap();return e.replace(/\d/g,r=>n[r]||r)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&ai.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:s}=this.options,i=n?.code;if(i&&ai.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:s}).format(e)}catch{}const l=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,l)}}ai.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Ma=new ai;class kz{constructor(e,n,r=Ma){this.date=e,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(e,n)),this.dateLib=r}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class lfe{constructor(e,n){this.date=e,this.weeks=n}}class ofe{constructor(e,n){this.days=n,this.weekNumber=e}}function cfe(t){return Ue.createElement("button",{...t})}function ufe(t){return Ue.createElement("span",{...t})}function dfe(t){const{size:e=24,orientation:n="left",className:r}=t;return Ue.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&Ue.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&Ue.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&Ue.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&Ue.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function hfe(t){const{day:e,modifiers:n,...r}=t;return Ue.createElement("td",{...r})}function ffe(t){const{day:e,modifiers:n,...r}=t,s=Ue.useRef(null);return Ue.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),Ue.createElement("button",{ref:s,...r})}var et;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})(et||(et={}));var Yn;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(Yn||(Yn={}));var qi;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(qi||(qi={}));var ti;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(ti||(ti={}));function mfe(t){const{options:e,className:n,components:r,classNames:s,...i}=t,l=[s[et.Dropdown],n].join(" "),c=e?.find(({value:d})=>d===i.value);return Ue.createElement("span",{"data-disabled":i.disabled,className:s[et.DropdownRoot]},Ue.createElement(r.Select,{className:l,...i},e?.map(({value:d,label:h,disabled:m})=>Ue.createElement(r.Option,{key:d,value:d,disabled:m},h))),Ue.createElement("span",{className:s[et.CaptionLabel],"aria-hidden":!0},c?.label,Ue.createElement(r.Chevron,{orientation:"down",size:18,className:s[et.Chevron]})))}function pfe(t){return Ue.createElement("div",{...t})}function gfe(t){return Ue.createElement("div",{...t})}function xfe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return Ue.createElement("div",{...r},t.children)}function vfe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return Ue.createElement("div",{...r})}function yfe(t){return Ue.createElement("table",{...t})}function bfe(t){return Ue.createElement("div",{...t})}const Oz=S.createContext(void 0);function j0(){const t=S.useContext(Oz);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function wfe(t){const{components:e}=j0();return Ue.createElement(e.Dropdown,{...t})}function Sfe(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:s,...i}=t,{components:l,classNames:c,labels:{labelPrevious:d,labelNext:h}}=j0(),m=S.useCallback(x=>{s&&n?.(x)},[s,n]),p=S.useCallback(x=>{r&&e?.(x)},[r,e]);return Ue.createElement("nav",{...i},Ue.createElement(l.PreviousMonthButton,{type:"button",className:c[et.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":d(r),onClick:p},Ue.createElement(l.Chevron,{disabled:r?void 0:!0,className:c[et.Chevron],orientation:"left"})),Ue.createElement(l.NextMonthButton,{type:"button",className:c[et.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":h(s),onClick:m},Ue.createElement(l.Chevron,{disabled:s?void 0:!0,orientation:"right",className:c[et.Chevron]})))}function kfe(t){const{components:e}=j0();return Ue.createElement(e.Button,{...t})}function Ofe(t){return Ue.createElement("option",{...t})}function jfe(t){const{components:e}=j0();return Ue.createElement(e.Button,{...t})}function Nfe(t){const{rootRef:e,...n}=t;return Ue.createElement("div",{...n,ref:e})}function Cfe(t){return Ue.createElement("select",{...t})}function Tfe(t){const{week:e,...n}=t;return Ue.createElement("tr",{...n})}function Afe(t){return Ue.createElement("th",{...t})}function Mfe(t){return Ue.createElement("thead",{"aria-hidden":!0},Ue.createElement("tr",{...t}))}function Efe(t){const{week:e,...n}=t;return Ue.createElement("th",{...n})}function _fe(t){return Ue.createElement("th",{...t})}function Dfe(t){return Ue.createElement("tbody",{...t})}function Rfe(t){const{components:e}=j0();return Ue.createElement(e.Dropdown,{...t})}const zfe=Object.freeze(Object.defineProperty({__proto__:null,Button:cfe,CaptionLabel:ufe,Chevron:dfe,Day:hfe,DayButton:ffe,Dropdown:mfe,DropdownNav:pfe,Footer:gfe,Month:xfe,MonthCaption:vfe,MonthGrid:yfe,Months:bfe,MonthsDropdown:wfe,Nav:Sfe,NextMonthButton:kfe,Option:Ofe,PreviousMonthButton:jfe,Root:Nfe,Select:Cfe,Week:Tfe,WeekNumber:Efe,WeekNumberHeader:_fe,Weekday:Afe,Weekdays:Mfe,Weeks:Dfe,YearsDropdown:Rfe},Symbol.toStringTag,{value:"Module"}));function ll(t,e,n=!1,r=Ma){let{from:s,to:i}=t;const{differenceInCalendarDays:l,isSameDay:c}=r;return s&&i?(l(i,s)<0&&([s,i]=[i,s]),l(e,s)>=(n?1:0)&&l(i,e)>=(n?1:0)):!n&&i?c(i,e):!n&&s?c(s,e):!1}function jz(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function X5(t){return!!(t&&typeof t=="object"&&"from"in t)}function Nz(t){return!!(t&&typeof t=="object"&&"after"in t)}function Cz(t){return!!(t&&typeof t=="object"&&"before"in t)}function Tz(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function Az(t,e){return Array.isArray(t)&&t.every(e.isDate)}function ol(t,e,n=Ma){const r=Array.isArray(e)?e:[e],{isSameDay:s,differenceInCalendarDays:i,isAfter:l}=n;return r.some(c=>{if(typeof c=="boolean")return c;if(n.isDate(c))return s(t,c);if(Az(c,n))return c.includes(t);if(X5(c))return ll(c,t,!1,n);if(Tz(c))return Array.isArray(c.dayOfWeek)?c.dayOfWeek.includes(t.getDay()):c.dayOfWeek===t.getDay();if(jz(c)){const d=i(c.before,t),h=i(c.after,t),m=d>0,p=h<0;return l(c.before,c.after)?p&&m:m||p}return Nz(c)?i(t,c.after)>0:Cz(c)?i(c.before,t)>0:typeof c=="function"?c(t):!1})}function Pfe(t,e,n,r,s){const{disabled:i,hidden:l,modifiers:c,showOutsideDays:d,broadcastCalendar:h,today:m}=e,{isSameDay:p,isSameMonth:x,startOfMonth:v,isBefore:b,endOfMonth:k,isAfter:O}=s,j=n&&v(n),T=r&&k(r),A={[Yn.focused]:[],[Yn.outside]:[],[Yn.disabled]:[],[Yn.hidden]:[],[Yn.today]:[]},_={};for(const D of t){const{date:E,displayMonth:R}=D,Q=!!(R&&!x(E,R)),F=!!(j&&b(E,j)),L=!!(T&&O(E,T)),U=!!(i&&ol(E,i,s)),V=!!(l&&ol(E,l,s))||F||L||!h&&!d&&Q||h&&d===!1&&Q,de=p(E,m??s.today());Q&&A.outside.push(D),U&&A.disabled.push(D),V&&A.hidden.push(D),de&&A.today.push(D),c&&Object.keys(c).forEach(W=>{const J=c?.[W];J&&ol(E,J,s)&&(_[W]?_[W].push(D):_[W]=[D])})}return D=>{const E={[Yn.focused]:!1,[Yn.disabled]:!1,[Yn.hidden]:!1,[Yn.outside]:!1,[Yn.today]:!1},R={};for(const Q in A){const F=A[Q];E[Q]=F.some(L=>L===D)}for(const Q in _)R[Q]=_[Q].some(F=>F===D);return{...E,...R}}}function Bfe(t,e,n={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):e[Yn[i]]?s.push(e[Yn[i]]):e[qi[i]]&&s.push(e[qi[i]]),s),[e[et.Day]])}function Lfe(t){return{...zfe,...t}}function Ife(t){const e={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([n,r])=>{n.startsWith("data-")&&(e[n]=r)}),e}function Y5(){const t={};for(const e in et)t[et[e]]=`rdp-${et[e]}`;for(const e in Yn)t[Yn[e]]=`rdp-${Yn[e]}`;for(const e in qi)t[qi[e]]=`rdp-${qi[e]}`;for(const e in ti)t[ti[e]]=`rdp-${ti[e]}`;return t}function Mz(t,e,n){return(n??new ai(e)).formatMonthYear(t)}const qfe=Mz;function Ffe(t,e,n){return(n??new ai(e)).format(t,"d")}function Qfe(t,e=Ma){return e.format(t,"LLLL")}function $fe(t,e,n){return(n??new ai(e)).format(t,"cccccc")}function Hfe(t,e=Ma){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function Ufe(){return""}function Ez(t,e=Ma){return e.format(t,"yyyy")}const Vfe=Ez,Wfe=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:Mz,formatDay:Ffe,formatMonthCaption:qfe,formatMonthDropdown:Qfe,formatWeekNumber:Hfe,formatWeekNumberHeader:Ufe,formatWeekdayName:$fe,formatYearCaption:Vfe,formatYearDropdown:Ez},Symbol.toStringTag,{value:"Module"}));function Gfe(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...Wfe,...t}}function Xfe(t,e,n,r,s){const{startOfMonth:i,startOfYear:l,endOfYear:c,eachMonthOfInterval:d,getMonth:h}=s;return d({start:l(t),end:c(t)}).map(x=>{const v=r.formatMonthDropdown(x,s),b=h(x),k=e&&xi(n)||!1;return{value:b,label:v,disabled:k}})}function Yfe(t,e={},n={}){let r={...e?.[et.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function Kfe(t,e,n){const r=t.today(),s=e?t.startOfISOWeek(r):t.startOfWeek(r),i=[];for(let l=0;l<7;l++){const c=t.addDays(s,l);i.push(c)}return i}function Zfe(t,e,n,r,s=!1){if(!t||!e)return;const{startOfYear:i,endOfYear:l,eachYearOfInterval:c,getYear:d}=r,h=i(t),m=l(e),p=c({start:h,end:m});return s&&p.reverse(),p.map(x=>{const v=n.formatYearDropdown(x,r);return{value:d(x),label:v,disabled:!1}})}function _z(t,e,n,r){let s=(r??new ai(n)).format(t,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s}const Jfe=_z;function Dz(t,e,n){return(n??new ai(e)).formatMonthYear(t)}const e0e=Dz;function t0e(t,e,n,r){let s=(r??new ai(n)).format(t,"PPPP");return e?.today&&(s=`Today, ${s}`),s}function n0e(t){return"Choose the Month"}function r0e(){return""}function s0e(t){return"Go to the Next Month"}function i0e(t){return"Go to the Previous Month"}function a0e(t,e,n){return(n??new ai(e)).format(t,"cccc")}function l0e(t,e){return`Week ${t}`}function o0e(t){return"Week Number"}function c0e(t){return"Choose the Year"}const u0e=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:e0e,labelDay:Jfe,labelDayButton:_z,labelGrid:Dz,labelGridcell:t0e,labelMonthDropdown:n0e,labelNav:r0e,labelNext:s0e,labelPrevious:i0e,labelWeekNumber:l0e,labelWeekNumberHeader:o0e,labelWeekday:a0e,labelYearDropdown:c0e},Symbol.toStringTag,{value:"Module"})),N0=t=>t instanceof HTMLElement?t:null,Ub=t=>[...t.querySelectorAll("[data-animated-month]")??[]],d0e=t=>N0(t.querySelector("[data-animated-month]")),Vb=t=>N0(t.querySelector("[data-animated-caption]")),Wb=t=>N0(t.querySelector("[data-animated-weeks]")),h0e=t=>N0(t.querySelector("[data-animated-nav]")),f0e=t=>N0(t.querySelector("[data-animated-weekdays]"));function m0e(t,e,{classNames:n,months:r,focused:s,dateLib:i}){const l=S.useRef(null),c=S.useRef(r),d=S.useRef(!1);S.useLayoutEffect(()=>{const h=c.current;if(c.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||h.length===0||r.length!==h.length)return;const m=i.isSameMonth(r[0].date,h[0].date),p=i.isAfter(r[0].date,h[0].date),x=p?n[ti.caption_after_enter]:n[ti.caption_before_enter],v=p?n[ti.weeks_after_enter]:n[ti.weeks_before_enter],b=l.current,k=t.current.cloneNode(!0);if(k instanceof HTMLElement?(Ub(k).forEach(A=>{if(!(A instanceof HTMLElement))return;const _=d0e(A);_&&A.contains(_)&&A.removeChild(_);const D=Vb(A);D&&D.classList.remove(x);const E=Wb(A);E&&E.classList.remove(v)}),l.current=k):l.current=null,d.current||m||s)return;const O=b instanceof HTMLElement?Ub(b):[],j=Ub(t.current);if(j?.every(T=>T instanceof HTMLElement)&&O&&O.every(T=>T instanceof HTMLElement)){d.current=!0,t.current.style.isolation="isolate";const T=h0e(t.current);T&&(T.style.zIndex="1"),j.forEach((A,_)=>{const D=O[_];if(!D)return;A.style.position="relative",A.style.overflow="hidden";const E=Vb(A);E&&E.classList.add(x);const R=Wb(A);R&&R.classList.add(v);const Q=()=>{d.current=!1,t.current&&(t.current.style.isolation=""),T&&(T.style.zIndex=""),E&&E.classList.remove(x),R&&R.classList.remove(v),A.style.position="",A.style.overflow="",A.contains(D)&&A.removeChild(D)};D.style.pointerEvents="none",D.style.position="absolute",D.style.overflow="hidden",D.setAttribute("aria-hidden","true");const F=f0e(D);F&&(F.style.opacity="0");const L=Vb(D);L&&(L.classList.add(p?n[ti.caption_before_exit]:n[ti.caption_after_exit]),L.addEventListener("animationend",Q));const U=Wb(D);U&&U.classList.add(p?n[ti.weeks_before_exit]:n[ti.weeks_after_exit]),A.insertBefore(D,A.firstChild)})}})}function p0e(t,e,n,r){const s=t[0],i=t[t.length-1],{ISOWeek:l,fixedWeeks:c,broadcastCalendar:d}=n??{},{addDays:h,differenceInCalendarDays:m,differenceInCalendarMonths:p,endOfBroadcastWeek:x,endOfISOWeek:v,endOfMonth:b,endOfWeek:k,isAfter:O,startOfBroadcastWeek:j,startOfISOWeek:T,startOfWeek:A}=r,_=d?j(s,r):l?T(s):A(s),D=d?x(i):l?v(b(i)):k(b(i)),E=m(D,_),R=p(i,s)+1,Q=[];for(let U=0;U<=E;U++){const V=h(_,U);if(e&&O(V,e))break;Q.push(V)}const L=(d?35:42)*R;if(c&&Q.length{const s=r.weeks.reduce((i,l)=>i.concat(l.days.slice()),e.slice());return n.concat(s.slice())},e.slice())}function x0e(t,e,n,r){const{numberOfMonths:s=1}=n,i=[];for(let l=0;le)break;i.push(c)}return i}function t9(t,e,n,r){const{month:s,defaultMonth:i,today:l=r.today(),numberOfMonths:c=1}=t;let d=s||i||l;const{differenceInCalendarMonths:h,addMonths:m,startOfMonth:p}=r;if(n&&h(n,d){const j=n.broadcastCalendar?p(O,r):n.ISOWeek?x(O):v(O),T=n.broadcastCalendar?i(O):n.ISOWeek?l(c(O)):d(c(O)),A=e.filter(R=>R>=j&&R<=T),_=n.broadcastCalendar?35:42;if(n.fixedWeeks&&A.length<_){const R=e.filter(Q=>{const F=_-A.length;return Q>T&&Q<=s(T,F)});A.push(...R)}const D=A.reduce((R,Q)=>{const F=n.ISOWeek?h(Q):m(Q),L=R.find(V=>V.weekNumber===F),U=new kz(Q,O,r);return L?L.days.push(U):R.push(new ofe(F,[U])),R},[]),E=new lfe(O,D);return k.push(E),k},[]);return n.reverseMonths?b.reverse():b}function y0e(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:s,startOfDay:i,startOfMonth:l,endOfMonth:c,addYears:d,endOfYear:h,newDate:m,today:p}=e,{fromYear:x,toYear:v,fromMonth:b,toMonth:k}=t;!n&&b&&(n=b),!n&&x&&(n=e.newDate(x,0,1)),!r&&k&&(r=k),!r&&v&&(r=m(v,11,31));const O=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=l(n):x?n=m(x,0,1):!n&&O&&(n=s(d(t.today??p(),-100))),r?r=c(r):v?r=m(v,11,31):!r&&O&&(r=h(t.today??p())),[n&&i(n),r&&i(r)]}function b0e(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:l,addMonths:c,differenceInCalendarMonths:d}=r,h=s?i:1,m=l(t);if(!e)return c(m,h);if(!(d(e,t)n.concat(r.weeks.slice()),e.slice())}function Yx(t,e){const[n,r]=S.useState(t);return[e===void 0?n:e,r]}function k0e(t,e){const[n,r]=y0e(t,e),{startOfMonth:s,endOfMonth:i}=e,l=t9(t,n,r,e),[c,d]=Yx(l,t.month?l:void 0);S.useEffect(()=>{const E=t9(t,n,r,e);d(E)},[t.timeZone]);const h=x0e(c,r,t,e),m=p0e(h,t.endMonth?i(t.endMonth):void 0,t,e),p=v0e(h,m,t,e),x=S0e(p),v=g0e(p),b=w0e(c,n,t,e),k=b0e(c,r,t,e),{disableNavigation:O,onMonthChange:j}=t,T=E=>x.some(R=>R.days.some(Q=>Q.isEqualTo(E))),A=E=>{if(O)return;let R=s(E);n&&Rs(r)&&(R=s(r)),d(R),j?.(R)};return{months:p,weeks:x,days:v,navStart:n,navEnd:r,previousMonth:b,nextMonth:k,goToMonth:A,goToDay:E=>{T(E)||A(E.date)}}}var aa;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(aa||(aa={}));function n9(t){return!t[Yn.disabled]&&!t[Yn.hidden]&&!t[Yn.outside]}function O0e(t,e,n,r){let s,i=-1;for(const l of t){const c=e(l);n9(c)&&(c[Yn.focused]&&in9(e(l)))),s}function j0e(t,e,n,r,s,i,l){const{ISOWeek:c,broadcastCalendar:d}=i,{addDays:h,addMonths:m,addWeeks:p,addYears:x,endOfBroadcastWeek:v,endOfISOWeek:b,endOfWeek:k,max:O,min:j,startOfBroadcastWeek:T,startOfISOWeek:A,startOfWeek:_}=l;let E={day:h,week:p,month:m,year:x,startOfWeek:R=>d?T(R,l):c?A(R):_(R),endOfWeek:R=>d?v(R):c?b(R):k(R)}[t](n,e==="after"?1:-1);return e==="before"&&r?E=O([r,E]):e==="after"&&s&&(E=j([s,E])),E}function Rz(t,e,n,r,s,i,l,c=0){if(c>365)return;const d=j0e(t,e,n.date,r,s,i,l),h=!!(i.disabled&&ol(d,i.disabled,l)),m=!!(i.hidden&&ol(d,i.hidden,l)),p=d,x=new kz(d,p,l);return!h&&!m?x:Rz(t,e,x,r,s,i,l,c+1)}function N0e(t,e,n,r,s){const{autoFocus:i}=t,[l,c]=S.useState(),d=O0e(e.days,n,r||(()=>!1),l),[h,m]=S.useState(i?d:void 0);return{isFocusTarget:k=>!!d?.isEqualTo(k),setFocused:m,focused:h,blur:()=>{c(h),m(void 0)},moveFocus:(k,O)=>{if(!h)return;const j=Rz(k,O,h,e.navStart,e.navEnd,t,s);j&&(t.disableNavigation&&!e.days.some(A=>A.isEqualTo(j))||(e.goToDay(j),m(j)))}}}function C0e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,l]=Yx(n,s?n:void 0),c=s?n:i,{isSameDay:d}=e,h=v=>c?.some(b=>d(b,v))??!1,{min:m,max:p}=t;return{selected:c,select:(v,b,k)=>{let O=[...c??[]];if(h(v)){if(c?.length===m||r&&c?.length===1)return;O=c?.filter(j=>!d(j,v))}else c?.length===p?O=[v]:O=[...O,v];return s||l(O),s?.(O,v,b,k),O},isSelected:h}}function T0e(t,e,n=0,r=0,s=!1,i=Ma){const{from:l,to:c}=e||{},{isSameDay:d,isAfter:h,isBefore:m}=i;let p;if(!l&&!c)p={from:t,to:n>0?void 0:t};else if(l&&!c)d(l,t)?n===0?p={from:l,to:t}:s?p={from:l,to:void 0}:p=void 0:m(t,l)?p={from:t,to:l}:p={from:l,to:t};else if(l&&c)if(d(l,t)&&d(c,t))s?p={from:l,to:c}:p=void 0;else if(d(l,t))p={from:l,to:n>0?void 0:t};else if(d(c,t))p={from:t,to:n>0?void 0:t};else if(m(t,l))p={from:t,to:c};else if(h(t,l))p={from:l,to:t};else if(h(t,c))p={from:l,to:t};else throw new Error("Invalid range");if(p?.from&&p?.to){const x=i.differenceInCalendarDays(p.to,p.from);r>0&&x>r?p={from:t,to:void 0}:n>1&&xtypeof c!="function").some(c=>typeof c=="boolean"?c:n.isDate(c)?ll(t,c,!1,n):Az(c,n)?c.some(d=>ll(t,d,!1,n)):X5(c)?c.from&&c.to?r9(t,{from:c.from,to:c.to},n):!1:Tz(c)?A0e(t,c.dayOfWeek,n):jz(c)?n.isAfter(c.before,c.after)?r9(t,{from:n.addDays(c.after,1),to:n.addDays(c.before,-1)},n):ol(t.from,c,n)||ol(t.to,c,n):Nz(c)||Cz(c)?ol(t.from,c,n)||ol(t.to,c,n):!1))return!0;const l=r.filter(c=>typeof c=="function");if(l.length){let c=t.from;const d=n.differenceInCalendarDays(t.to,t.from);for(let h=0;h<=d;h++){if(l.some(m=>m(c)))return!0;c=n.addDays(c,1)}}return!1}function E0e(t,e){const{disabled:n,excludeDisabled:r,selected:s,required:i,onSelect:l}=t,[c,d]=Yx(s,l?s:void 0),h=l?s:c;return{selected:h,select:(x,v,b)=>{const{min:k,max:O}=t,j=x?T0e(x,h,k,O,i,e):void 0;return r&&n&&j?.from&&j.to&&M0e({from:j.from,to:j.to},n,e)&&(j.from=x,j.to=void 0),l||d(j),l?.(j,x,v,b),j},isSelected:x=>h&&ll(h,x,!1,e)}}function _0e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,l]=Yx(n,s?n:void 0),c=s?n:i,{isSameDay:d}=e;return{selected:c,select:(p,x,v)=>{let b=p;return!r&&c&&c&&d(p,c)&&(b=void 0),s||l(b),s?.(b,p,x,v),b},isSelected:p=>c?d(c,p):!1}}function D0e(t,e){const n=_0e(t,e),r=C0e(t,e),s=E0e(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function R0e(t){let e=t;e.timeZone&&(e={...t},e.today&&(e.today=new Zr(e.today,e.timeZone)),e.month&&(e.month=new Zr(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new Zr(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new Zr(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new Zr(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new Zr(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(dt=>new Zr(dt,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new Zr(e.selected.from,e.timeZone):void 0,to:e.selected.to?new Zr(e.selected.to,e.timeZone):void 0}));const{components:n,formatters:r,labels:s,dateLib:i,locale:l,classNames:c}=S.useMemo(()=>{const dt={...G5,...e.locale};return{dateLib:new ai({locale:dt,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib),components:Lfe(e.components),formatters:Gfe(e.formatters),labels:{...u0e,...e.labels},locale:dt,classNames:{...Y5(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]),{captionLayout:d,mode:h,navLayout:m,numberOfMonths:p=1,onDayBlur:x,onDayClick:v,onDayFocus:b,onDayKeyDown:k,onDayMouseEnter:O,onDayMouseLeave:j,onNextClick:T,onPrevClick:A,showWeekNumber:_,styles:D}=e,{formatCaption:E,formatDay:R,formatMonthDropdown:Q,formatWeekNumber:F,formatWeekNumberHeader:L,formatWeekdayName:U,formatYearDropdown:V}=r,de=k0e(e,i),{days:W,months:J,navStart:$,navEnd:ae,previousMonth:ne,nextMonth:ce,goToMonth:z}=de,xe=Pfe(W,e,$,ae,i),{isSelected:Y,select:P,selected:K}=D0e(e,i)??{},{blur:H,focused:fe,isFocusTarget:ve,moveFocus:Re,setFocused:ue}=N0e(e,de,xe,Y??(()=>!1),i),{labelDayButton:We,labelGridcell:ct,labelGrid:Oe,labelMonthDropdown:nt,labelNav:ut,labelPrevious:Ct,labelNext:In,labelWeekday:Tn,labelWeekNumber:Jn,labelWeekNumberHeader:nn,labelYearDropdown:_t}=s,Yr=S.useMemo(()=>Kfe(i,e.ISOWeek),[i,e.ISOWeek]),qn=h!==void 0||v!==void 0,or=S.useCallback(()=>{ne&&(z(ne),A?.(ne))},[ne,z,A]),yn=S.useCallback(()=>{ce&&(z(ce),T?.(ce))},[z,ce,T]),ft=S.useCallback((dt,Pn)=>mt=>{mt.preventDefault(),mt.stopPropagation(),ue(dt),P?.(dt.date,Pn,mt),v?.(dt.date,Pn,mt)},[P,v,ue]),ee=S.useCallback((dt,Pn)=>mt=>{ue(dt),b?.(dt.date,Pn,mt)},[b,ue]),Se=S.useCallback((dt,Pn)=>mt=>{H(),x?.(dt.date,Pn,mt)},[H,x]),Be=S.useCallback((dt,Pn)=>mt=>{const rn={ArrowLeft:[mt.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[mt.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[mt.shiftKey?"year":"week","after"],ArrowUp:[mt.shiftKey?"year":"week","before"],PageUp:[mt.shiftKey?"year":"month","before"],PageDown:[mt.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(rn[mt.key]){mt.preventDefault(),mt.stopPropagation();const[Mr,At]=rn[mt.key];Re(Mr,At)}k?.(dt.date,Pn,mt)},[Re,k,e.dir]),rt=S.useCallback((dt,Pn)=>mt=>{O?.(dt.date,Pn,mt)},[O]),Tt=S.useCallback((dt,Pn)=>mt=>{j?.(dt.date,Pn,mt)},[j]),cr=S.useCallback(dt=>Pn=>{const mt=Number(Pn.target.value),rn=i.setMonth(i.startOfMonth(dt),mt);z(rn)},[i,z]),Kr=S.useCallback(dt=>Pn=>{const mt=Number(Pn.target.value),rn=i.setYear(i.startOfMonth(dt),mt);z(rn)},[i,z]),{className:re,style:Ae}=S.useMemo(()=>({className:[c[et.Root],e.className].filter(Boolean).join(" "),style:{...D?.[et.Root],...e.style}}),[c,e.className,e.style,D]),pt=Ife(e),yt=S.useRef(null);m0e(yt,!!e.animate,{classNames:c,months:J,focused:fe,dateLib:i});const vs={dayPickerProps:e,selected:K,select:P,isSelected:Y,months:J,nextMonth:ce,previousMonth:ne,goToMonth:z,getModifiers:xe,components:n,classNames:c,styles:D,labels:s,formatters:r};return Ue.createElement(Oz.Provider,{value:vs},Ue.createElement(n.Root,{rootRef:e.animate?yt:void 0,className:re,style:Ae,dir:e.dir,id:e.id,lang:e.lang,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...pt},Ue.createElement(n.Months,{className:c[et.Months],style:D?.[et.Months]},!e.hideNavigation&&!m&&Ue.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[et.Nav],style:D?.[et.Nav],"aria-label":ut(),onPreviousClick:or,onNextClick:yn,previousMonth:ne,nextMonth:ce}),J.map((dt,Pn)=>Ue.createElement(n.Month,{"data-animated-month":e.animate?"true":void 0,className:c[et.Month],style:D?.[et.Month],key:Pn,displayIndex:Pn,calendarMonth:dt},m==="around"&&!e.hideNavigation&&Pn===0&&Ue.createElement(n.PreviousMonthButton,{type:"button",className:c[et.PreviousMonthButton],tabIndex:ne?void 0:-1,"aria-disabled":ne?void 0:!0,"aria-label":Ct(ne),onClick:or,"data-animated-button":e.animate?"true":void 0},Ue.createElement(n.Chevron,{disabled:ne?void 0:!0,className:c[et.Chevron],orientation:e.dir==="rtl"?"right":"left"})),Ue.createElement(n.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:c[et.MonthCaption],style:D?.[et.MonthCaption],calendarMonth:dt,displayIndex:Pn},d?.startsWith("dropdown")?Ue.createElement(n.DropdownNav,{className:c[et.Dropdowns],style:D?.[et.Dropdowns]},(()=>{const mt=d==="dropdown"||d==="dropdown-months"?Ue.createElement(n.MonthsDropdown,{key:"month",className:c[et.MonthsDropdown],"aria-label":nt(),classNames:c,components:n,disabled:!!e.disableNavigation,onChange:cr(dt.date),options:Xfe(dt.date,$,ae,r,i),style:D?.[et.Dropdown],value:i.getMonth(dt.date)}):Ue.createElement("span",{key:"month"},Q(dt.date,i)),rn=d==="dropdown"||d==="dropdown-years"?Ue.createElement(n.YearsDropdown,{key:"year",className:c[et.YearsDropdown],"aria-label":_t(i.options),classNames:c,components:n,disabled:!!e.disableNavigation,onChange:Kr(dt.date),options:Zfe($,ae,r,i,!!e.reverseYears),style:D?.[et.Dropdown],value:i.getYear(dt.date)}):Ue.createElement("span",{key:"year"},V(dt.date,i));return i.getMonthYearOrder()==="year-first"?[rn,mt]:[mt,rn]})(),Ue.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},E(dt.date,i.options,i))):Ue.createElement(n.CaptionLabel,{className:c[et.CaptionLabel],role:"status","aria-live":"polite"},E(dt.date,i.options,i))),m==="around"&&!e.hideNavigation&&Pn===p-1&&Ue.createElement(n.NextMonthButton,{type:"button",className:c[et.NextMonthButton],tabIndex:ce?void 0:-1,"aria-disabled":ce?void 0:!0,"aria-label":In(ce),onClick:yn,"data-animated-button":e.animate?"true":void 0},Ue.createElement(n.Chevron,{disabled:ce?void 0:!0,className:c[et.Chevron],orientation:e.dir==="rtl"?"left":"right"})),Pn===p-1&&m==="after"&&!e.hideNavigation&&Ue.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[et.Nav],style:D?.[et.Nav],"aria-label":ut(),onPreviousClick:or,onNextClick:yn,previousMonth:ne,nextMonth:ce}),Ue.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":h==="multiple"||h==="range","aria-label":Oe(dt.date,i.options,i)||void 0,className:c[et.MonthGrid],style:D?.[et.MonthGrid]},!e.hideWeekdays&&Ue.createElement(n.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:c[et.Weekdays],style:D?.[et.Weekdays]},_&&Ue.createElement(n.WeekNumberHeader,{"aria-label":nn(i.options),className:c[et.WeekNumberHeader],style:D?.[et.WeekNumberHeader],scope:"col"},L()),Yr.map(mt=>Ue.createElement(n.Weekday,{"aria-label":Tn(mt,i.options,i),className:c[et.Weekday],key:String(mt),style:D?.[et.Weekday],scope:"col"},U(mt,i.options,i)))),Ue.createElement(n.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:c[et.Weeks],style:D?.[et.Weeks]},dt.weeks.map(mt=>Ue.createElement(n.Week,{className:c[et.Week],key:mt.weekNumber,style:D?.[et.Week],week:mt},_&&Ue.createElement(n.WeekNumber,{week:mt,style:D?.[et.WeekNumber],"aria-label":Jn(mt.weekNumber,{locale:l}),className:c[et.WeekNumber],scope:"row",role:"rowheader"},F(mt.weekNumber,i)),mt.days.map(rn=>{const{date:Mr}=rn,At=xe(rn);if(At[Yn.focused]=!At.hidden&&!!fe?.isEqualTo(rn),At[qi.selected]=Y?.(Mr)||At.selected,X5(K)){const{from:qc,to:Do}=K;At[qi.range_start]=!!(qc&&Do&&i.isSameDay(Mr,qc)),At[qi.range_end]=!!(qc&&Do&&i.isSameDay(Mr,Do)),At[qi.range_middle]=ll(K,Mr,!0,i)}const Ic=Yfe(At,D,e.modifiersStyles),_o=Bfe(At,c,e.modifiersClassNames),t1=!qn&&!At.hidden?ct(Mr,At,i.options,i):void 0;return Ue.createElement(n.Day,{key:`${i.format(Mr,"yyyy-MM-dd")}_${i.format(rn.displayMonth,"yyyy-MM")}`,day:rn,modifiers:At,className:_o.join(" "),style:Ic,role:"gridcell","aria-selected":At.selected||void 0,"aria-label":t1,"data-day":i.format(Mr,"yyyy-MM-dd"),"data-month":rn.outside?i.format(Mr,"yyyy-MM"):void 0,"data-selected":At.selected||void 0,"data-disabled":At.disabled||void 0,"data-hidden":At.hidden||void 0,"data-outside":rn.outside||void 0,"data-focused":At.focused||void 0,"data-today":At.today||void 0},!At.hidden&&qn?Ue.createElement(n.DayButton,{className:c[et.DayButton],style:D?.[et.DayButton],type:"button",day:rn,modifiers:At,disabled:At.disabled||void 0,tabIndex:ve(rn)?0:-1,"aria-label":We(Mr,At,i.options,i),onClick:ft(rn,At),onBlur:Se(rn,At),onFocus:ee(rn,At),onKeyDown:Be(rn,At),onMouseEnter:rt(rn,At),onMouseLeave:Tt(rn,At)},R(Mr,i.options,i)):!At.hidden&&R(rn.date,i.options,i))})))))))),e.footer&&Ue.createElement(n.Footer,{className:c[et.Footer],style:D?.[et.Footer],role:"status","aria-live":"polite"},e.footer)))}function s9({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:l,...c}){const d=Y5();return a.jsx(R0e,{showOutsideDays:n,className:ye("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,t),captionLayout:r,formatters:{formatMonthDropdown:h=>h.toLocaleString("default",{month:"short"}),...i},classNames:{root:ye("w-fit",d.root),months:ye("relative flex flex-col gap-4 md:flex-row",d.months),month:ye("flex w-full flex-col gap-4",d.month),nav:ye("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",d.nav),button_previous:ye(ff({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_previous),button_next:ye(ff({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_next),month_caption:ye("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",d.month_caption),dropdowns:ye("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",d.dropdowns),dropdown_root:ye("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",d.dropdown_root),dropdown:ye("bg-popover absolute inset-0 opacity-0",d.dropdown),caption_label:ye("select-none font-medium",r==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",d.caption_label),table:"w-full border-collapse",weekdays:ye("flex",d.weekdays),weekday:ye("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",d.weekday),week:ye("mt-2 flex w-full",d.week),week_number_header:ye("w-[--cell-size] select-none",d.week_number_header),week_number:ye("text-muted-foreground select-none text-[0.8rem]",d.week_number),day:ye("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",d.day),range_start:ye("bg-accent rounded-l-md",d.range_start),range_middle:ye("rounded-none",d.range_middle),range_end:ye("bg-accent rounded-r-md",d.range_end),today:ye("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",d.today),outside:ye("text-muted-foreground aria-selected:text-muted-foreground",d.outside),disabled:ye("text-muted-foreground opacity-50",d.disabled),hidden:ye("invisible",d.hidden),...e},components:{Root:({className:h,rootRef:m,...p})=>a.jsx("div",{"data-slot":"calendar",ref:m,className:ye(h),...p}),Chevron:({className:h,orientation:m,...p})=>m==="left"?a.jsx(Tc,{className:ye("size-4",h),...p}):m==="right"?a.jsx(Ac,{className:ye("size-4",h),...p}):a.jsx(df,{className:ye("size-4",h),...p}),DayButton:z0e,WeekNumber:({children:h,...m})=>a.jsx("td",{...m,children:a.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:h})}),...l},...c})}function z0e({className:t,day:e,modifiers:n,...r}){const s=Y5(),i=S.useRef(null);return S.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),a.jsx(ie,{ref:i,variant:"ghost",size:"icon","data-day":e.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:ye("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",s.day,t),...r})}class P0e{ws=null;reconnectTimeout=null;reconnectAttempts=0;maxReconnectAttempts=10;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];maxCacheSize=1e3;getWebSocketUrl(){{const e=window.location.protocol==="https:"?"wss:":"ws:",n=window.location.host;return`${e}//${n}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const e=this.getWebSocketUrl();try{this.ws=new WebSocket(e),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=n=>{try{if(n.data==="pong")return;const r=JSON.parse(n.data);this.notifyLog(r)}catch(r){console.error("解析日志消息失败:",r)}},this.ws.onerror=n=>{console.error("❌ WebSocket 错误:",n),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(n){console.error("创建 WebSocket 连接失败:",n),this.attemptReconnect()}}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return;this.reconnectAttempts+=1;const e=Math.min(1e3*this.reconnectAttempts,1e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},e)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(e){return this.logCallbacks.add(e),()=>this.logCallbacks.delete(e)}onConnectionChange(e){return this.connectionCallbacks.add(e),e(this.isConnected),()=>this.connectionCallbacks.delete(e)}notifyLog(e){this.logCache.some(r=>r.id===e.id)||(this.logCache.push(e),this.logCache.length>this.maxCacheSize&&(this.logCache=this.logCache.slice(-this.maxCacheSize)),this.logCallbacks.forEach(r=>{try{r(e)}catch(s){console.error("日志回调执行失败:",s)}}))}notifyConnection(e){this.connectionCallbacks.forEach(n=>{try{n(e)}catch(r){console.error("连接状态回调执行失败:",r)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const Iu=new P0e;typeof window<"u"&&Iu.connect();const B0e={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},L0e=(t,e,n)=>{let r;const s=B0e[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",String(e)),n?.addSuffix?n.comparison&&n.comparison>0?r+"内":r+"前":r},I0e={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},q0e={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},F0e={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Q0e={date:td({formats:I0e,defaultWidth:"full"}),time:td({formats:q0e,defaultWidth:"full"}),dateTime:td({formats:F0e,defaultWidth:"full"})};function i9(t,e,n){const r="eeee p";return Jhe(t,e,n)?r:t.getTime()>e.getTime()?"'下个'"+r:"'上个'"+r}const $0e={lastWeek:i9,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:i9,other:"PP p"},H0e=(t,e,n,r)=>{const s=$0e[t];return typeof s=="function"?s(e,n,r):s},U0e={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},V0e={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},W0e={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},G0e={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},X0e={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},Y0e={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},K0e=(t,e)=>{const n=Number(t);switch(e?.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},Z0e={ordinalNumber:K0e,era:ua({values:U0e,defaultWidth:"wide"}),quarter:ua({values:V0e,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ua({values:W0e,defaultWidth:"wide"}),day:ua({values:G0e,defaultWidth:"wide"}),dayPeriod:ua({values:X0e,defaultWidth:"wide",formattingValues:Y0e,defaultFormattingWidth:"wide"})},J0e=/^(第\s*)?\d+(日|时|分|秒)?/i,eme=/\d+/i,tme={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},nme={any:[/^(前)/i,/^(公元)/i]},rme={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},sme={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},ime={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},ame={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},lme={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},ome={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},cme={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},ume={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},dme={ordinalNumber:xz({matchPattern:J0e,parsePattern:eme,valueCallback:t=>parseInt(t,10)}),era:da({matchPatterns:tme,defaultMatchWidth:"wide",parsePatterns:nme,defaultParseWidth:"any"}),quarter:da({matchPatterns:rme,defaultMatchWidth:"wide",parsePatterns:sme,defaultParseWidth:"any",valueCallback:t=>t+1}),month:da({matchPatterns:ime,defaultMatchWidth:"wide",parsePatterns:ame,defaultParseWidth:"any"}),day:da({matchPatterns:lme,defaultMatchWidth:"wide",parsePatterns:ome,defaultParseWidth:"any"}),dayPeriod:da({matchPatterns:cme,defaultMatchWidth:"any",parsePatterns:ume,defaultParseWidth:"any"})},Bp={code:"zh-CN",formatDistance:L0e,formatLong:Q0e,formatRelative:H0e,localize:Z0e,match:dme,options:{weekStartsOn:1,firstWeekContainsDate:4}};function hme(){const[t,e]=S.useState([]),[n,r]=S.useState(""),[s,i]=S.useState("all"),[l,c]=S.useState("all"),[d,h]=S.useState(void 0),[m,p]=S.useState(void 0),[x,v]=S.useState(!0),[b,k]=S.useState(!1),O=S.useRef(null),j=S.useRef(null);S.useEffect(()=>{const U=Iu.getAllLogs();e(U);const V=Iu.onLog(()=>{e(Iu.getAllLogs())}),de=Iu.onConnectionChange(W=>{k(W)});return()=>{V(),de()}},[]),S.useEffect(()=>{x&&j.current&&j.current.scrollIntoView({behavior:"smooth",block:"end"})},[t,x]);const T=S.useMemo(()=>{const U=new Set(t.map(V=>V.module));return Array.from(U).sort()},[t]),A=U=>{switch(U){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},_=U=>{switch(U){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},D=()=>{window.location.reload()},E=()=>{Iu.clearLogs(),e([])},R=()=>{const U=L.map(J=>`${J.timestamp} [${J.level.padEnd(8)}] [${J.module}] ${J.message}`).join(` -`),V=new Blob([U],{type:"text/plain;charset=utf-8"}),de=URL.createObjectURL(V),W=document.createElement("a");W.href=de,W.download=`logs-${dg(new Date,"yyyy-MM-dd-HHmmss")}.txt`,W.click(),URL.revokeObjectURL(de)},Q=()=>{v(!x)},F=()=>{h(void 0),p(void 0)},L=S.useMemo(()=>t.filter(U=>{const V=n===""||U.message.toLowerCase().includes(n.toLowerCase())||U.module.toLowerCase().includes(n.toLowerCase()),de=s==="all"||U.level===s,W=l==="all"||U.module===l;let J=!0;if(d||m){const $=new Date(U.timestamp);if(d){const ae=new Date(d);ae.setHours(0,0,0,0),J=J&&$>=ae}if(m){const ae=new Date(m);ae.setHours(23,59,59,999),J=J&&$<=ae}}return V&&de&&W&&J}),[t,n,s,l,d,m]);return a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 p-3 sm:p-4 lg:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:ye("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",b?"bg-green-500 animate-pulse":"bg-red-500")}),a.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:b?"已连接":"未连接"})]})]}),a.jsx(gt,{className:"p-3 sm:p-4",children:a.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索日志...",value:n,onChange:U=>r(U.target.value),className:"pl-9 h-9 text-sm"})]}),a.jsxs(Lt,{value:s,onValueChange:i,children:[a.jsxs(Dt,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[a.jsx(t2,{className:"h-4 w-4 mr-2"}),a.jsx(It,{placeholder:"级别"})]}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部级别"}),a.jsx(Pe,{value:"DEBUG",children:"DEBUG"}),a.jsx(Pe,{value:"INFO",children:"INFO"}),a.jsx(Pe,{value:"WARNING",children:"WARNING"}),a.jsx(Pe,{value:"ERROR",children:"ERROR"}),a.jsx(Pe,{value:"CRITICAL",children:"CRITICAL"})]})]}),a.jsxs(Lt,{value:l,onValueChange:c,children:[a.jsxs(Dt,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[a.jsx(t2,{className:"h-4 w-4 mr-2"}),a.jsx(It,{placeholder:"模块"})]}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部模块"}),T.map(U=>a.jsx(Pe,{value:U,children:U},U))]})]})]}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!d&&"text-muted-foreground"),children:[a.jsx(uO,{className:"mr-2 h-4 w-4"}),a.jsx("span",{className:"text-xs sm:text-sm",children:d?dg(d,"PPP",{locale:Bp}):"开始日期"})]})}),a.jsx(fl,{className:"w-auto p-0",align:"start",children:a.jsx(s9,{mode:"single",selected:d,onSelect:h,initialFocus:!0,locale:Bp})})]}),a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!m&&"text-muted-foreground"),children:[a.jsx(uO,{className:"mr-2 h-4 w-4"}),a.jsx("span",{className:"text-xs sm:text-sm",children:m?dg(m,"PPP",{locale:Bp}):"结束日期"})]})}),a.jsx(fl,{className:"w-auto p-0",align:"start",children:a.jsx(s9,{mode:"single",selected:m,onSelect:p,initialFocus:!0,locale:Bp})})]}),(d||m)&&a.jsxs(ie,{variant:"outline",size:"sm",onClick:F,className:"w-full sm:w-auto h-9",children:[a.jsx(Gf,{className:"h-4 w-4 sm:mr-2"}),a.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),a.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[a.jsxs(ie,{variant:x?"default":"outline",size:"sm",onClick:Q,className:"flex-1 sm:flex-none h-9",children:[x?a.jsx(jq,{className:"h-4 w-4"}):a.jsx(Nq,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:x?"自动滚动":"已暂停"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:D,className:"flex-1 sm:flex-none h-9",children:[a.jsx(Fi,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:E,className:"flex-1 sm:flex-none h-9",children:[a.jsx(Ht,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:R,className:"flex-1 sm:flex-none h-9",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),a.jsx("div",{className:"flex-1 hidden sm:block"}),a.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[a.jsxs("span",{className:"font-mono",children:[L.length," / ",t.length]}),a.jsx("span",{className:"ml-1",children:"条日志"})]})]})]})}),a.jsx(gt,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900",children:a.jsx(vn,{className:"h-[calc(100vh-280px)] sm:h-[calc(100vh-320px)] lg:h-[calc(100vh-400px)]",children:a.jsxs("div",{ref:O,className:"p-2 sm:p-3 lg:p-4 font-mono text-xs sm:text-sm space-y-1",children:[L.length===0?a.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):L.map(U=>a.jsxs("div",{className:ye("py-2 px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",_(U.level)),children:[a.jsxs("div",{className:"flex flex-col gap-1 sm:hidden",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-600 text-xs",children:U.timestamp}),a.jsxs("span",{className:ye("text-xs font-semibold",A(U.level)),children:["[",U.level,"]"]})]}),a.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 text-xs truncate",children:U.module}),a.jsx("div",{className:"text-gray-300 dark:text-gray-400 text-xs break-all",children:U.message})]}),a.jsxs("div",{className:"hidden sm:flex gap-3 items-start",children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[140px] lg:w-[180px] text-xs lg:text-sm",children:U.timestamp}),a.jsxs("span",{className:ye("flex-shrink-0 w-[70px] lg:w-[80px] font-semibold text-xs lg:text-sm",A(U.level)),children:["[",U.level,"]"]}),a.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[120px] lg:w-[150px] truncate text-xs lg:text-sm",children:U.module}),a.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 break-all text-xs lg:text-sm",children:U.message})]})]},U.id)),a.jsx("div",{ref:j,className:"h-4"})]})})})]})})}const fme="Mai-with-u",mme="plugin-repo",pme="main",gme="plugin_details.json";async function xme(){try{const t=await ot("/api/webui/plugins/fetch-raw",{method:"POST",headers:bt(),body:JSON.stringify({owner:fme,repo:mme,branch:pme,file_path:gme})});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success||!e.data)throw new Error(e.error||"获取插件列表失败");return JSON.parse(e.data).filter(s=>!s?.id||!s?.manifest?(console.warn("跳过无效插件数据:",s),!1):!s.manifest.name||!s.manifest.version?(console.warn("跳过缺少必需字段的插件:",s.id),!1):!0).map(s=>({id:s.id,manifest:{manifest_version:s.manifest.manifest_version||1,name:s.manifest.name,version:s.manifest.version,description:s.manifest.description||"",author:s.manifest.author||{name:"Unknown"},license:s.manifest.license||"Unknown",host_application:s.manifest.host_application||{min_version:"0.0.0"},homepage_url:s.manifest.homepage_url,repository_url:s.manifest.repository_url,keywords:s.manifest.keywords||[],categories:s.manifest.categories||[],default_locale:s.manifest.default_locale||"zh-CN",locales_path:s.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(t){throw console.error("Failed to fetch plugin list:",t),t}}async function vme(){try{const t=await ot("/api/webui/plugins/git-status");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to check Git status:",t),{installed:!1,error:"无法检测 Git 安装状态"}}}async function yme(){try{const t=await ot("/api/webui/plugins/version");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to get Maimai version:",t),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function bme(t,e,n){const r=t.split(".").map(c=>parseInt(c)||0),s=r[0]||0,i=r[1]||0,l=r[2]||0;if(n.version_majorparseInt(p)||0),d=c[0]||0,h=c[1]||0,m=c[2]||0;if(n.version_major>d||n.version_major===d&&n.version_minor>h||n.version_major===d&&n.version_minor===h&&n.version_patch>m)return!1}return!0}function wme(t,e){const n=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host,s=new WebSocket(`${n}//${r}/api/webui/ws/plugin-progress`);return s.onopen=()=>{console.log("Plugin progress WebSocket connected");const i=setInterval(()=>{s.readyState===WebSocket.OPEN?s.send("ping"):clearInterval(i)},3e4)},s.onmessage=i=>{try{if(i.data==="pong")return;const l=JSON.parse(i.data);t(l)}catch(l){console.error("Failed to parse progress data:",l)}},s.onerror=i=>{console.error("Plugin progress WebSocket error:",i),e?.(i)},s.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},s}async function Lp(){try{const t=await ot("/api/webui/plugins/installed",{headers:bt()});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success)throw new Error(e.message||"获取已安装插件列表失败");return e.plugins||[]}catch(t){return console.error("Failed to get installed plugins:",t),[]}}function Ip(t,e){return e.some(n=>n.id===t)}function qp(t,e){const n=e.find(r=>r.id===t);if(n)return n.manifest?.version||n.version}async function Sme(t,e,n="main"){const r=await ot("/api/webui/plugins/install",{method:"POST",headers:bt(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"安装失败")}return await r.json()}async function kme(t){const e=await ot("/api/webui/plugins/uninstall",{method:"POST",headers:bt(),body:JSON.stringify({plugin_id:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"卸载失败")}return await e.json()}async function Ome(t,e,n="main"){const r=await ot("/api/webui/plugins/update",{method:"POST",headers:bt(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"更新失败")}return await r.json()}const C0="https://maibot-plugin-stats.maibot-webui.workers.dev";async function zz(t){try{const e=await fetch(`${C0}/stats/${t}`);return e.ok?await e.json():(console.error("Failed to fetch plugin stats:",e.statusText),null)}catch(e){return console.error("Error fetching plugin stats:",e),null}}async function jme(t,e){try{const n=e||K5(),r=await fetch(`${C0}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点赞失败"}}catch(n){return console.error("Error liking plugin:",n),{success:!1,error:"网络错误"}}}async function Nme(t,e){try{const n=e||K5(),r=await fetch(`${C0}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点踩失败"}}catch(n){return console.error("Error disliking plugin:",n),{success:!1,error:"网络错误"}}}async function Cme(t,e,n,r){if(e<1||e>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const s=r||K5(),i=await fetch(`${C0}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,rating:e,comment:n,user_id:s})}),l=await i.json();return i.status===429?{success:!1,error:"每天最多评分 3 次"}:i.ok?{success:!0,...l}:{success:!1,error:l.error||"评分失败"}}catch(s){return console.error("Error rating plugin:",s),{success:!1,error:"网络错误"}}}async function Tme(t){try{const e=await fetch(`${C0}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t})}),n=await e.json();return e.status===429?(console.warn("Download recording rate limited"),{success:!0}):e.ok?{success:!0,...n}:(console.error("Failed to record download:",n.error),{success:!1,error:n.error})}catch(e){return console.error("Error recording download:",e),{success:!1,error:"网络错误"}}}function Ame(){const t=navigator,e=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,t.deviceMemory||0].join("|");let n=0;for(let r=0;r{i(!0);const j=await zz(t);j&&r(j),i(!1)};S.useEffect(()=>{v()},[t]);const b=async()=>{const j=await jme(t);j.success?(x({title:"已点赞",description:"感谢你的支持!"}),v()):x({title:"点赞失败",description:j.error||"未知错误",variant:"destructive"})},k=async()=>{const j=await Nme(t);j.success?(x({title:"已反馈",description:"感谢你的反馈!"}),v()):x({title:"操作失败",description:j.error||"未知错误",variant:"destructive"})},O=async()=>{if(l===0){x({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const j=await Cme(t,l,d||void 0);j.success?(x({title:"评分成功",description:"感谢你的评价!"}),p(!1),c(0),h(""),v()):x({title:"评分失败",description:j.error||"未知错误",variant:"destructive"})};return s?a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:"-"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Jl,{className:"h-4 w-4"}),a.jsx("span",{children:"-"})]})]}):n?e?a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${n.downloads.toLocaleString()}`,children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:n.downloads.toLocaleString()})]}),a.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${n.rating.toFixed(1)} (${n.rating_count} 条评价)`,children:[a.jsx(Jl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsx("span",{children:n.rating.toFixed(1)})]}),a.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${n.likes}`,children:[a.jsx(my,{className:"h-4 w-4"}),a.jsx("span",{children:n.likes})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(fc,{className:"h-5 w-5 text-muted-foreground mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.downloads.toLocaleString()}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(Jl,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),a.jsx("span",{className:"text-2xl font-bold",children:n.rating.toFixed(1)}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.rating_count," 条评价"]})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(my,{className:"h-5 w-5 text-green-500 mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.likes}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(dO,{className:"h-5 w-5 text-red-500 mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.dislikes}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:b,children:[a.jsx(my,{className:"h-4 w-4 mr-1"}),"点赞"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:k,children:[a.jsx(dO,{className:"h-4 w-4 mr-1"}),"点踩"]}),a.jsxs(Rr,{open:m,onOpenChange:p,children:[a.jsx(mw,{asChild:!0,children:a.jsxs(ie,{variant:"default",size:"sm",children:[a.jsx(Jl,{className:"h-4 w-4 mr-1"}),"评分"]})}),a.jsxs(Nr,{children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"为插件评分"}),a.jsx(Gr,{children:"分享你的使用体验,帮助其他用户"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(j=>a.jsx("button",{onClick:()=>c(j),className:"focus:outline-none",children:a.jsx(Jl,{className:`h-8 w-8 transition-colors ${j<=l?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},j))}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[l===0&&"点击星星进行评分",l===1&&"很差",l===2&&"一般",l===3&&"还行",l===4&&"不错",l===5&&"非常好"]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),a.jsx(_n,{value:d,onChange:j=>h(j.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[d.length," / 500"]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>p(!1),children:"取消"}),a.jsx(ie,{onClick:O,disabled:l===0,children:"提交评分"})]})]})]})]}),n.recent_ratings&&n.recent_ratings.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),a.jsx("div",{className:"space-y-3",children:n.recent_ratings.map((j,T)=>a.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(A=>a.jsx(Jl,{className:`h-3 w-3 ${A<=j.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},A))}),a.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(j.created_at).toLocaleDateString()})]}),j.comment&&a.jsx("p",{className:"text-sm text-muted-foreground",children:j.comment})]},T))})]})]}):null}const a9={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function Eme(){const t=wa(),[e,n]=S.useState(null),[r,s]=S.useState(""),[i,l]=S.useState("all"),[c,d]=S.useState("all"),[h,m]=S.useState(!1),[p,x]=S.useState([]),[v,b]=S.useState(!0),[k,O]=S.useState(null),[j,T]=S.useState(null),[A,_]=S.useState(null),[D,E]=S.useState(null),[,R]=S.useState([]),[Q,F]=S.useState({}),{toast:L}=Pr(),U=async z=>{const xe=z.map(async K=>{try{const H=await zz(K.id);return{id:K.id,stats:H}}catch(H){return console.warn(`Failed to load stats for ${K.id}:`,H),{id:K.id,stats:null}}}),Y=await Promise.all(xe),P={};Y.forEach(({id:K,stats:H})=>{H&&(P[K]=H)}),F(P)};S.useEffect(()=>{let z=null,xe=!1;return(async()=>{if(z=wme(P=>{xe||(_(P),P.stage==="success"?setTimeout(()=>{xe||_(null)},2e3):P.stage==="error"&&(b(!1),O(P.error||"加载失败")))},P=>{console.error("WebSocket error:",P),xe||L({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(P=>{if(!z){P();return}const K=()=>{z&&z.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),P()):z&&z.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),P()):setTimeout(K,100)};K()}),!xe){const P=await vme();T(P),P.installed||L({title:"Git 未安装",description:P.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!xe){const P=await yme();E(P)}if(!xe)try{b(!0),O(null);const P=await xme();if(!xe){const K=await Lp();R(K);const H=P.map(fe=>{const ve=Ip(fe.id,K),Re=qp(fe.id,K);return{...fe,installed:ve,installed_version:Re}});for(const fe of K)!H.some(Re=>Re.id===fe.id)&&fe.manifest&&H.push({id:fe.id,manifest:{manifest_version:fe.manifest.manifest_version||1,name:fe.manifest.name,version:fe.manifest.version,description:fe.manifest.description||"",author:fe.manifest.author,license:fe.manifest.license||"Unknown",host_application:fe.manifest.host_application,homepage_url:fe.manifest.homepage_url,repository_url:fe.manifest.repository_url,keywords:fe.manifest.keywords||[],categories:fe.manifest.categories||[],default_locale:fe.manifest.default_locale||"zh-CN",locales_path:fe.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:fe.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});x(H),U(H)}}catch(P){if(!xe){const K=P instanceof Error?P.message:"加载插件列表失败";O(K),L({title:"加载失败",description:K,variant:"destructive"})}}finally{xe||b(!1)}})(),()=>{xe=!0,z&&z.close()}},[L]);const V=z=>{if(!z.installed&&D&&!de(z))return a.jsxs(On,{variant:"destructive",className:"gap-1",children:[a.jsx(xc,{className:"h-3 w-3"}),"不兼容"]});if(z.installed){const xe=z.installed_version?.trim(),Y=z.manifest.version?.trim();if(xe!==Y){const P=xe?.split(".").map(Number)||[0,0,0],K=Y?.split(".").map(Number)||[0,0,0];for(let H=0;H<3;H++){if((K[H]||0)>(P[H]||0))return a.jsxs(On,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[a.jsx(xc,{className:"h-3 w-3"}),"可更新"]});if((K[H]||0)<(P[H]||0))break}}return a.jsxs(On,{variant:"default",className:"gap-1",children:[a.jsx(Es,{className:"h-3 w-3"}),"已安装"]})}return null},de=z=>!D||!z.manifest?.host_application?!0:bme(z.manifest.host_application.min_version,z.manifest.host_application.max_version,D),W=z=>{if(!z.installed||!z.installed_version||!z.manifest?.version)return!1;const xe=z.installed_version.trim(),Y=z.manifest.version.trim();if(xe===Y)return!1;const P=xe.split(".").map(Number),K=Y.split(".").map(Number);for(let H=0;H<3;H++){if((K[H]||0)>(P[H]||0))return!0;if((K[H]||0)<(P[H]||0))return!1}return!1},J=p.filter(z=>{if(!z.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",z.id),!1;const xe=r===""||z.manifest.name?.toLowerCase().includes(r.toLowerCase())||z.manifest.description?.toLowerCase().includes(r.toLowerCase())||z.manifest.keywords&&z.manifest.keywords.some(H=>H.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||z.manifest.categories&&z.manifest.categories.includes(i);let P=!0;c==="installed"?P=z.installed===!0:c==="updates"&&(P=z.installed===!0&&W(z));const K=!h||!D||de(z);return xe&&Y&&P&&K}),$=()=>{n(null)},ae=async z=>{if(!j?.installed){L({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(D&&!de(z)){L({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await Sme(z.id,z.manifest.repository_url||"","main"),Tme(z.id).catch(Y=>{console.warn("Failed to record download:",Y)}),L({title:"安装成功",description:`${z.manifest.name} 已成功安装`});const xe=await Lp();R(xe),x(Y=>Y.map(P=>{if(P.id===z.id){const K=Ip(P.id,xe),H=qp(P.id,xe);return{...P,installed:K,installed_version:H}}return P}))}catch(xe){L({title:"安装失败",description:xe instanceof Error?xe.message:"未知错误",variant:"destructive"})}},ne=async z=>{try{await kme(z.id),L({title:"卸载成功",description:`${z.manifest.name} 已成功卸载`});const xe=await Lp();R(xe),x(Y=>Y.map(P=>{if(P.id===z.id){const K=Ip(P.id,xe),H=qp(P.id,xe);return{...P,installed:K,installed_version:H}}return P}))}catch(xe){L({title:"卸载失败",description:xe instanceof Error?xe.message:"未知错误",variant:"destructive"})}},ce=async z=>{if(!j?.installed){L({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const xe=await Ome(z.id,z.manifest.repository_url||"","main");L({title:"更新成功",description:`${z.manifest.name} 已从 ${xe.old_version} 更新到 ${xe.new_version}`});const Y=await Lp();R(Y),x(P=>P.map(K=>{if(K.id===z.id){const H=Ip(K.id,Y),fe=qp(K.id,Y);return{...K,installed:H,installed_version:fe}}return K}))}catch(xe){L({title:"更新失败",description:xe instanceof Error?xe.message:"未知错误",variant:"destructive"})}};return a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),a.jsxs(ie,{onClick:()=>t({to:"/plugin-mirrors"}),children:[a.jsx(Cq,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),j&&!j.installed&&a.jsxs(gt,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[a.jsx(Wt,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Hu,{className:"h-5 w-5 text-orange-600"}),a.jsxs("div",{children:[a.jsx(Gt,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),a.jsx(Sr,{className:"text-orange-800 dark:text-orange-200",children:j.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),a.jsx(an,{children:a.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",a.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索插件...",value:r,onChange:z=>s(z.target.value),className:"pl-9"})]}),a.jsxs(Lt,{value:i,onValueChange:l,children:[a.jsx(Dt,{className:"w-full sm:w-[200px]",children:a.jsx(It,{placeholder:"选择分类"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部分类"}),a.jsx(Pe,{value:"Group Management",children:"群组管理"}),a.jsx(Pe,{value:"Entertainment & Interaction",children:"娱乐互动"}),a.jsx(Pe,{value:"Utility Tools",children:"实用工具"}),a.jsx(Pe,{value:"Content Generation",children:"内容生成"}),a.jsx(Pe,{value:"Multimedia",children:"多媒体"}),a.jsx(Pe,{value:"External Integration",children:"外部集成"}),a.jsx(Pe,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),a.jsx(Pe,{value:"Other",children:"其他"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"compatible-only",checked:h,onCheckedChange:z=>m(z===!0)}),a.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),a.jsx(hl,{value:c,onValueChange:d,className:"w-full",children:a.jsxs(ya,{className:"grid w-full grid-cols-3",children:[a.jsxs($t,{value:"all",children:["全部插件 (",p.length,")"]}),a.jsxs($t,{value:"installed",children:["已安装 (",p.filter(z=>z.installed).length,")"]}),a.jsxs($t,{value:"updates",children:["可更新 (",p.filter(z=>z.installed&&W(z)).length,")"]})]})}),A&&A.stage==="loading"&&a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(hf,{className:"h-4 w-4 animate-spin"}),a.jsxs("span",{className:"text-sm font-medium",children:[A.operation==="fetch"&&"加载插件列表",A.operation==="install"&&`安装插件${A.plugin_id?`: ${A.plugin_id}`:""}`,A.operation==="uninstall"&&`卸载插件${A.plugin_id?`: ${A.plugin_id}`:""}`,A.operation==="update"&&`更新插件${A.plugin_id?`: ${A.plugin_id}`:""}`]})]}),a.jsxs("span",{className:"text-sm font-medium",children:[A.progress,"%"]})]}),a.jsx(n0,{value:A.progress,className:"h-2"}),a.jsx("div",{className:"text-xs text-muted-foreground",children:A.message}),A.operation==="fetch"&&A.total_plugins>0&&a.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",A.loaded_plugins," / ",A.total_plugins," 个插件"]})]})}),A&&A.stage==="error"&&A.error&&a.jsx(gt,{className:"border-destructive bg-destructive/10",children:a.jsx(Wt,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Hu,{className:"h-5 w-5 text-destructive"}),a.jsxs("div",{children:[a.jsx(Gt,{className:"text-lg text-destructive",children:"加载失败"}),a.jsx(Sr,{className:"text-destructive/80",children:A.error})]})]})})}),v?a.jsxs("div",{className:"flex items-center justify-center py-12",children:[a.jsx(hf,{className:"h-8 w-8 animate-spin text-muted-foreground"}),a.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):k?a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Hu,{className:"h-12 w-12 text-destructive mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:k}),a.jsx(ie,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):J.length===0?a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Bs,{className:"h-12 w-12 text-muted-foreground mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:r||i!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:J.map(z=>a.jsxs(gt,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[a.jsxs(Wt,{children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx(Gt,{className:"text-xl",children:z.manifest?.name||z.id}),a.jsxs("div",{className:"flex flex-col gap-1",children:[z.manifest?.categories&&z.manifest.categories[0]&&a.jsx(On,{variant:"secondary",className:"text-xs whitespace-nowrap",children:a9[z.manifest.categories[0]]||z.manifest.categories[0]}),V(z)]})]}),a.jsx(Sr,{className:"line-clamp-2",children:z.manifest?.description||"无描述"})]}),a.jsx(an,{className:"flex-1",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:(Q[z.id]?.downloads??z.downloads??0).toLocaleString()})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Jl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsx("span",{children:(Q[z.id]?.rating??z.rating??0).toFixed(1)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[z.manifest?.keywords&&z.manifest.keywords.slice(0,3).map(xe=>a.jsx(On,{variant:"outline",className:"text-xs",children:xe},xe)),z.manifest?.keywords&&z.manifest.keywords.length>3&&a.jsxs(On,{variant:"outline",className:"text-xs",children:["+",z.manifest.keywords.length-3]})]}),a.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[a.jsxs("div",{children:["v",z.manifest?.version||"unknown"," · ",z.manifest?.author?.name||"Unknown"]}),z.manifest?.host_application&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{children:"支持:"}),a.jsxs("span",{className:"font-medium",children:[z.manifest.host_application.min_version,z.manifest.host_application.max_version?` - ${z.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),a.jsx(bC,{className:"pt-4",children:a.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>n(z),children:"查看详情"}),z.installed?W(z)?a.jsxs(ie,{size:"sm",disabled:!j?.installed,title:j?.installed?void 0:"Git 未安装",onClick:()=>ce(z),children:[a.jsx(Fi,{className:"h-4 w-4 mr-1"}),"更新"]}):a.jsxs(ie,{variant:"destructive",size:"sm",disabled:!j?.installed,title:j?.installed?void 0:"Git 未安装",onClick:()=>ne(z),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"卸载"]}):a.jsxs(ie,{size:"sm",disabled:!j?.installed||A?.operation==="install"||D!==null&&!de(z),title:j?.installed?D!==null&&!de(z)?`不兼容当前版本 (需要 ${z.manifest?.host_application?.min_version||"未知"}${z.manifest?.host_application?.max_version?` - ${z.manifest.host_application.max_version}`:"+"},当前 ${D?.version})`:void 0:"Git 未安装",onClick:()=>ae(z),children:[a.jsx(fc,{className:"h-4 w-4 mr-1"}),A?.operation==="install"&&A?.plugin_id===z.id?"安装中...":"安装"]})]})})]},z.id))}),a.jsx(Rr,{open:e!==null,onOpenChange:$,children:e&&e.manifest&&a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsx(Cr,{children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"space-y-2 flex-1",children:[a.jsx(Tr,{className:"text-2xl",children:e.manifest.name}),a.jsxs(Gr,{children:["作者: ",e.manifest.author?.name||"Unknown",e.manifest.author?.url&&a.jsx("a",{href:e.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:a.jsx(Yh,{className:"h-3 w-3 inline"})})]})]}),a.jsxs("div",{className:"flex flex-col gap-2",children:[e.manifest.categories&&e.manifest.categories[0]&&a.jsx(On,{variant:"secondary",children:a9[e.manifest.categories[0]]||e.manifest.categories[0]}),V(e)]})]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(Mme,{pluginId:e.id}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"版本"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",e.manifest?.version||"unknown"]}),e.installed&&e.installed_version&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",e.installed_version]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"下载量"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:(Q[e.id]?.downloads??e.downloads??0).toLocaleString()})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"评分"}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Jl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[(Q[e.id]?.rating??e.rating??0).toFixed(1)," (",Q[e.id]?.rating_count??e.review_count??0,")"]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"许可证"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.license||"Unknown"})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.manifest.host_application?.min_version||"未知",e.manifest.host_application?.max_version?` - ${e.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:e.manifest.keywords&&e.manifest.keywords.map(z=>a.jsx(On,{variant:"outline",children:z},z))})]}),e.detailed_description&&a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),a.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:e.detailed_description})]}),!e.detailed_description&&a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.description||"无描述"})]}),a.jsxs("div",{className:"space-y-2",children:[e.manifest.homepage_url&&a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium",children:"主页: "}),a.jsx("a",{href:e.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.homepage_url})]}),e.manifest.repository_url&&a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium",children:"仓库: "}),a.jsx("a",{href:e.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.repository_url})]})]})]}),a.jsxs(ps,{children:[e.manifest.homepage_url&&a.jsxs(ie,{onClick:()=>window.open(e.manifest.homepage_url,"_blank"),children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"访问主页"]}),e.manifest.repository_url&&a.jsxs(ie,{variant:"outline",onClick:()=>window.open(e.manifest.repository_url,"_blank"),children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function _me(){return a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(Fi,{className:"h-4 w-4 mr-2"}),"刷新"]}),a.jsxs(ie,{size:"sm",children:[a.jsx(Ii,{className:"h-4 w-4 mr-2"}),"全局设置"]})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"已安装插件"}),a.jsx(pg,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"正在加载..."})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"已启用"}),a.jsx(Es,{className:"h-4 w-4 text-green-600"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"已禁用"}),a.jsx(xc,{className:"h-4 w-4 text-orange-600"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"可更新"}),a.jsx(Fi,{className:"h-4 w-4 text-blue-600"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"有新版本可用"})]})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"已安装的插件"}),a.jsx(Sr,{children:"查看和管理已安装插件的配置"})]}),a.jsx(an,{children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[a.jsx(pg,{className:"h-16 w-16 text-muted-foreground/50"}),a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"插件配置功能开发中"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"即将支持插件的启用/禁用、参数配置等功能"})]}),a.jsx("div",{className:"flex gap-2",children:a.jsx(ie,{variant:"outline",asChild:!0,children:a.jsxs("a",{href:"/plugins",children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"前往插件市场"]})})})]})})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(gt,{children:[a.jsx(Wt,{children:a.jsx(Gt,{className:"text-base",children:"即将推出的功能"})}),a.jsx(an,{children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"插件启用/禁用"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"快速切换插件运行状态"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"配置参数编辑"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"可视化编辑插件配置文件"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"依赖管理"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"查看和安装插件依赖包"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"插件日志"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"查看插件运行日志和错误信息"})]})]})]})})]}),a.jsxs(gt,{children:[a.jsx(Wt,{children:a.jsx(Gt,{className:"text-base",children:"开发者工具"})}),a.jsx(an,{children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"热重载"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"无需重启即可重新加载插件"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"配置验证"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查配置文件格式和完整性"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"性能监控"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"监控插件的资源占用情况"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"调试模式"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"详细的调试信息和错误追踪"})]})]})]})})]})]}),a.jsx(gt,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:a.jsx(an,{className:"pt-6",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(xc,{className:"h-5 w-5 text-blue-600 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"开发进行中"}),a.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["插件配置功能正在积极开发中。目前您可以通过",a.jsx("strong",{children:"插件市场"}),"安装和卸载插件,完整的配置管理功能即将推出。"]})]})]})})})]})})}function Dme(){const t=wa(),{toast:e}=Pr(),[n,r]=S.useState([]),[s,i]=S.useState(!0),[l,c]=S.useState(null),[d,h]=S.useState(null),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O=S.useCallback(async()=>{try{i(!0),c(null);const R=localStorage.getItem("access-token"),Q=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${R}`}});if(!Q.ok)throw new Error("获取镜像源列表失败");const F=await Q.json();r(F.mirrors||[])}catch(R){const Q=R instanceof Error?R.message:"加载镜像源失败";c(Q),e({title:"加载失败",description:Q,variant:"destructive"})}finally{i(!1)}},[e]);S.useEffect(()=>{O()},[O]);const j=async()=>{try{const R=localStorage.getItem("access-token"),Q=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${R}`,"Content-Type":"application/json"},body:JSON.stringify(b)});if(!Q.ok){const F=await Q.json();throw new Error(F.detail||"添加镜像源失败")}e({title:"添加成功",description:"镜像源已添加"}),p(!1),k({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O()}catch(R){e({title:"添加失败",description:R instanceof Error?R.message:"未知错误",variant:"destructive"})}},T=async()=>{if(d)try{const R=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${d.id}`,{method:"PUT",headers:{Authorization:`Bearer ${R}`,"Content-Type":"application/json"},body:JSON.stringify({name:b.name,raw_prefix:b.raw_prefix,clone_prefix:b.clone_prefix,enabled:b.enabled,priority:b.priority})})).ok)throw new Error("更新镜像源失败");e({title:"更新成功",description:"镜像源已更新"}),v(!1),h(null),O()}catch(R){e({title:"更新失败",description:R instanceof Error?R.message:"未知错误",variant:"destructive"})}},A=async R=>{if(confirm("确定要删除这个镜像源吗?"))try{const Q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${R}`,{method:"DELETE",headers:{Authorization:`Bearer ${Q}`}})).ok)throw new Error("删除镜像源失败");e({title:"删除成功",description:"镜像源已删除"}),O()}catch(Q){e({title:"删除失败",description:Q instanceof Error?Q.message:"未知错误",variant:"destructive"})}},_=async R=>{try{const Q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${R.id}`,{method:"PUT",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!R.enabled})})).ok)throw new Error("更新状态失败");O()}catch(Q){e({title:"更新失败",description:Q instanceof Error?Q.message:"未知错误",variant:"destructive"})}},D=R=>{h(R),k({id:R.id,name:R.name,raw_prefix:R.raw_prefix,clone_prefix:R.clone_prefix,enabled:R.enabled,priority:R.priority}),v(!0)},E=async(R,Q)=>{const F=Q==="up"?R.priority-1:R.priority+1;if(!(F<1))try{const L=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${R.id}`,{method:"PUT",headers:{Authorization:`Bearer ${L}`,"Content-Type":"application/json"},body:JSON.stringify({priority:F})})).ok)throw new Error("更新优先级失败");O()}catch(L){e({title:"更新失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}};return a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>t({to:"/plugins"}),children:a.jsx(R9,{className:"h-5 w-5"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),a.jsxs(ie,{onClick:()=>p(!0),children:[a.jsx(Wr,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),s?a.jsx(gt,{className:"p-6",children:a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(hf,{className:"h-8 w-8 animate-spin text-primary"})})}):l?a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Hu,{className:"h-12 w-12 text-destructive mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:l}),a.jsx(ie,{onClick:O,children:"重新加载"})]})}):a.jsxs(gt,{children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{children:"状态"}),a.jsx(xt,{children:"名称"}),a.jsx(xt,{children:"ID"}),a.jsx(xt,{children:"优先级"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n.map(R=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(jt,{checked:R.enabled,onCheckedChange:()=>_(R)})}),a.jsx(it,{children:a.jsxs("div",{children:[a.jsx("div",{className:"font-medium",children:R.name}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",R.raw_prefix]})]})}),a.jsx(it,{children:a.jsx(On,{variant:"outline",children:R.id})}),a.jsx(it,{children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-mono",children:R.priority}),a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx(ie,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(R,"up"),disabled:R.priority===1,children:a.jsx(e2,{className:"h-3 w-3"})}),a.jsx(ie,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(R,"down"),children:a.jsx(df,{className:"h-3 w-3"})})]})]})}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>D(R),children:a.jsx(nd,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>A(R.id),children:a.jsx(Ht,{className:"h-4 w-4 text-destructive"})})]})})]},R.id))})]})}),a.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(R=>a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:"font-semibold",children:R.name}),R.enabled&&a.jsx(On,{variant:"default",className:"text-xs",children:"启用"})]}),a.jsx(On,{variant:"outline",className:"mt-1 text-xs",children:R.id})]}),a.jsx(jt,{checked:R.enabled,onCheckedChange:()=>_(R)})]}),a.jsxs("div",{className:"text-sm space-y-1",children:[a.jsxs("div",{className:"text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"Raw: "}),a.jsx("span",{className:"break-all",children:R.raw_prefix})]}),a.jsxs("div",{className:"text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"优先级: "}),a.jsx("span",{className:"font-mono",children:R.priority})]})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[a.jsxs(ie,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>D(R),children:[a.jsx(nd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>E(R,"up"),disabled:R.priority===1,children:a.jsx(e2,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>E(R,"down"),children:a.jsx(df,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"destructive",size:"sm",onClick:()=>A(R.id),children:a.jsx(Ht,{className:"h-4 w-4"})})]})]})},R.id))})]}),a.jsx(Rr,{open:m,onOpenChange:p,children:a.jsxs(Nr,{className:"max-w-lg",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"添加镜像源"}),a.jsx(Gr,{children:"添加新的 Git 镜像源配置"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-id",children:"镜像源 ID *"}),a.jsx(Me,{id:"add-id",placeholder:"例如: my-mirror",value:b.id,onChange:R=>k({...b,id:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-name",children:"名称 *"}),a.jsx(Me,{id:"add-name",placeholder:"例如: 我的镜像源",value:b.name,onChange:R=>k({...b,name:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),a.jsx(Me,{id:"add-raw",placeholder:"https://example.com/raw",value:b.raw_prefix,onChange:R=>k({...b,raw_prefix:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-clone",children:"克隆前缀 *"}),a.jsx(Me,{id:"add-clone",placeholder:"https://example.com/clone",value:b.clone_prefix,onChange:R=>k({...b,clone_prefix:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-priority",children:"优先级"}),a.jsx(Me,{id:"add-priority",type:"number",min:"1",value:b.priority,onChange:R=>k({...b,priority:parseInt(R.target.value)||1})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"add-enabled",checked:b.enabled,onCheckedChange:R=>k({...b,enabled:R})}),a.jsx(te,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>p(!1),children:"取消"}),a.jsx(ie,{onClick:j,children:"添加"})]})]})}),a.jsx(Rr,{open:x,onOpenChange:v,children:a.jsxs(Nr,{className:"max-w-lg",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑镜像源"}),a.jsx(Gr,{children:"修改镜像源配置"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"镜像源 ID"}),a.jsx(Me,{value:b.id,disabled:!0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-name",children:"名称 *"}),a.jsx(Me,{id:"edit-name",value:b.name,onChange:R=>k({...b,name:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),a.jsx(Me,{id:"edit-raw",value:b.raw_prefix,onChange:R=>k({...b,raw_prefix:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-clone",children:"克隆前缀 *"}),a.jsx(Me,{id:"edit-clone",value:b.clone_prefix,onChange:R=>k({...b,clone_prefix:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-priority",children:"优先级"}),a.jsx(Me,{id:"edit-priority",type:"number",min:"1",value:b.priority,onChange:R=>k({...b,priority:parseInt(R.target.value)||1})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"edit-enabled",checked:b.enabled,onCheckedChange:R=>k({...b,enabled:R})}),a.jsx(te,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>v(!1),children:"取消"}),a.jsx(ie,{onClick:T,children:"保存"})]})]})})]})})}const Rme=Nd("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),Pz=S.forwardRef(({className:t,size:e,abbrTitle:n,children:r,...s},i)=>a.jsx("kbd",{className:ye(Rme({size:e,className:t})),ref:i,...s,children:n?a.jsx("abbr",{title:n,children:r}):r}));Pz.displayName="Kbd";const zme=[{icon:hg,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:ao,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:z9,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:P9,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:K4,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Wf,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:B9,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:Tq,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:pg,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:fg,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:Ii,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function Pme({open:t,onOpenChange:e}){const[n,r]=S.useState(""),[s,i]=S.useState(0),l=wa(),c=zme.filter(m=>m.title.toLowerCase().includes(n.toLowerCase())||m.description.toLowerCase().includes(n.toLowerCase())||m.category.toLowerCase().includes(n.toLowerCase()));S.useEffect(()=>{t&&(r(""),i(0))},[t]);const d=S.useCallback(m=>{l({to:m}),e(!1)},[l,e]),h=S.useCallback(m=>{m.key==="ArrowDown"?(m.preventDefault(),i(p=>(p+1)%c.length)):m.key==="ArrowUp"?(m.preventDefault(),i(p=>(p-1+c.length)%c.length)):m.key==="Enter"&&c[s]&&(m.preventDefault(),d(c[s].path))},[c,s,d]);return a.jsx(Rr,{open:t,onOpenChange:e,children:a.jsxs(Nr,{className:"max-w-2xl p-0 gap-0",children:[a.jsxs(Cr,{className:"px-4 pt-4 pb-0",children:[a.jsx(Tr,{className:"sr-only",children:"搜索"}),a.jsxs("div",{className:"relative",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),a.jsx(Me,{value:n,onChange:m=>{r(m.target.value),i(0)},onKeyDown:h,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),a.jsx("div",{className:"border-t",children:a.jsx(vn,{className:"h-[400px]",children:c.length>0?a.jsx("div",{className:"p-2",children:c.map((m,p)=>{const x=m.icon;return a.jsxs("button",{onClick:()=>d(m.path),onMouseEnter:()=>i(p),className:ye("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",p===s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[a.jsx(x,{className:"h-5 w-5 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium text-sm",children:m.title}),a.jsx("div",{className:"text-xs text-muted-foreground truncate",children:m.description})]}),a.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:m.category})]},m.path)})}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx(Bs,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),a.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function Bme(t){const e=Lme(t),n=S.forwardRef((r,s)=>{const{children:i,...l}=r,c=S.Children.toArray(i),d=c.find(qme);if(d){const h=d.props.children,m=c.map(p=>p===d?S.Children.count(h)>1?S.Children.only(null):S.isValidElement(h)?h.props.children:null:p);return a.jsx(e,{...l,ref:s,children:S.isValidElement(h)?S.cloneElement(h,void 0,m):null})}return a.jsx(e,{...l,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function Lme(t){const e=S.forwardRef((n,r)=>{const{children:s,...i}=n;if(S.isValidElement(s)){const l=Qme(s),c=Fme(i,s.props);return s.type!==S.Fragment&&(c.ref=r?oo(r,l):l),S.cloneElement(s,c)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Ime=Symbol("radix.slottable");function qme(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Ime}function Fme(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...c)=>{const d=i(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function Qme(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var z4=["Enter"," "],$me=["ArrowDown","PageUp","Home"],Bz=["ArrowUp","PageDown","End"],Hme=[...$me,...Bz],Ume={ltr:[...z4,"ArrowRight"],rtl:[...z4,"ArrowLeft"]},Vme={ltr:["ArrowLeft"],rtl:["ArrowRight"]},T0="Menu",[$f,Wme,Gme]=tx(T0),[Lc,Lz]=Vi(T0,[Gme,wd,fx]),A0=wd(),Iz=fx(),[qz,Eo]=Lc(T0),[Xme,M0]=Lc(T0),Fz=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:l=!0}=t,c=A0(e),[d,h]=S.useState(null),m=S.useRef(!1),p=es(i),x=Vf(s);return S.useEffect(()=>{const v=()=>{m.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>m.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),a.jsx(ix,{...c,children:a.jsx(qz,{scope:e,open:n,onOpenChange:p,content:d,onContentChange:h,children:a.jsx(Xme,{scope:e,onClose:S.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:m,dir:x,modal:l,children:r})})})};Fz.displayName=T0;var Yme="MenuAnchor",Z5=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=A0(n);return a.jsx(ax,{...s,...r,ref:e})});Z5.displayName=Yme;var J5="MenuPortal",[Kme,Qz]=Lc(J5,{forceMount:void 0}),$z=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=Eo(J5,e);return a.jsx(Kme,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};$z.displayName=J5;var Ci="MenuContent",[Zme,e3]=Lc(Ci),Hz=S.forwardRef((t,e)=>{const n=Qz(Ci,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Eo(Ci,t.__scopeMenu),l=M0(Ci,t.__scopeMenu);return a.jsx($f.Provider,{scope:t.__scopeMenu,children:a.jsx(Ls,{present:r||i.open,children:a.jsx($f.Slot,{scope:t.__scopeMenu,children:l.modal?a.jsx(Jme,{...s,ref:e}):a.jsx(epe,{...s,ref:e})})})})}),Jme=S.forwardRef((t,e)=>{const n=Eo(Ci,t.__scopeMenu),r=S.useRef(null),s=Cn(e,r);return S.useEffect(()=>{const i=r.current;if(i)return j9(i)},[]),a.jsx(t3,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:$e(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),epe=S.forwardRef((t,e)=>{const n=Eo(Ci,t.__scopeMenu);return a.jsx(t3,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),tpe=Bme("MenuContent.ScrollLock"),t3=S.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:d,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:x,onDismiss:v,disableOutsideScroll:b,...k}=t,O=Eo(Ci,n),j=M0(Ci,n),T=A0(n),A=Iz(n),_=Wme(n),[D,E]=S.useState(null),R=S.useRef(null),Q=Cn(e,R,O.onContentChange),F=S.useRef(0),L=S.useRef(""),U=S.useRef(0),V=S.useRef(null),de=S.useRef("right"),W=S.useRef(0),J=b?N9:S.Fragment,$=b?{as:tpe,allowPinchZoom:!0}:void 0,ae=ce=>{const z=L.current+ce,xe=_().filter(ve=>!ve.disabled),Y=document.activeElement,P=xe.find(ve=>ve.ref.current===Y)?.textValue,K=xe.map(ve=>ve.textValue),H=fpe(K,z,P),fe=xe.find(ve=>ve.textValue===H)?.ref.current;(function ve(Re){L.current=Re,window.clearTimeout(F.current),Re!==""&&(F.current=window.setTimeout(()=>ve(""),1e3))})(z),fe&&setTimeout(()=>fe.focus())};S.useEffect(()=>()=>window.clearTimeout(F.current),[]),C9();const ne=S.useCallback(ce=>de.current===V.current?.side&&ppe(ce,V.current?.area),[]);return a.jsx(Zme,{scope:n,searchRef:L,onItemEnter:S.useCallback(ce=>{ne(ce)&&ce.preventDefault()},[ne]),onItemLeave:S.useCallback(ce=>{ne(ce)||(R.current?.focus(),E(null))},[ne]),onTriggerLeave:S.useCallback(ce=>{ne(ce)&&ce.preventDefault()},[ne]),pointerGraceTimerRef:U,onPointerGraceIntentChange:S.useCallback(ce=>{V.current=ce},[]),children:a.jsx(J,{...$,children:a.jsx(T9,{asChild:!0,trapped:s,onMountAutoFocus:$e(i,ce=>{ce.preventDefault(),R.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:x,onDismiss:v,children:a.jsx(NC,{asChild:!0,...A,dir:j.dir,orientation:"vertical",loop:r,currentTabStopId:D,onCurrentTabStopIdChange:E,onEntryFocus:$e(d,ce=>{j.isUsingKeyboardRef.current||ce.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(X4,{role:"menu","aria-orientation":"vertical","data-state":lP(O.open),"data-radix-menu-content":"",dir:j.dir,...T,...k,ref:Q,style:{outline:"none",...k.style},onKeyDown:$e(k.onKeyDown,ce=>{const xe=ce.target.closest("[data-radix-menu-content]")===ce.currentTarget,Y=ce.ctrlKey||ce.altKey||ce.metaKey,P=ce.key.length===1;xe&&(ce.key==="Tab"&&ce.preventDefault(),!Y&&P&&ae(ce.key));const K=R.current;if(ce.target!==K||!Hme.includes(ce.key))return;ce.preventDefault();const fe=_().filter(ve=>!ve.disabled).map(ve=>ve.ref.current);Bz.includes(ce.key)&&fe.reverse(),dpe(fe)}),onBlur:$e(t.onBlur,ce=>{ce.currentTarget.contains(ce.target)||(window.clearTimeout(F.current),L.current="")}),onPointerMove:$e(t.onPointerMove,Hf(ce=>{const z=ce.target,xe=W.current!==ce.clientX;if(ce.currentTarget.contains(z)&&xe){const Y=ce.clientX>W.current?"right":"left";de.current=Y,W.current=ce.clientX}}))})})})})})})});Hz.displayName=Ci;var npe="MenuGroup",n3=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Zt.div,{role:"group",...r,ref:e})});n3.displayName=npe;var rpe="MenuLabel",Uz=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Zt.div,{...r,ref:e})});Uz.displayName=rpe;var Jg="MenuItem",l9="menu.itemSelect",Kx=S.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=S.useRef(null),l=M0(Jg,t.__scopeMenu),c=e3(Jg,t.__scopeMenu),d=Cn(e,i),h=S.useRef(!1),m=()=>{const p=i.current;if(!n&&p){const x=new CustomEvent(l9,{bubbles:!0,cancelable:!0});p.addEventListener(l9,v=>r?.(v),{once:!0}),M9(p,x),x.defaultPrevented?h.current=!1:l.onClose()}};return a.jsx(Vz,{...s,ref:d,disabled:n,onClick:$e(t.onClick,m),onPointerDown:p=>{t.onPointerDown?.(p),h.current=!0},onPointerUp:$e(t.onPointerUp,p=>{h.current||p.currentTarget?.click()}),onKeyDown:$e(t.onKeyDown,p=>{const x=c.searchRef.current!=="";n||x&&p.key===" "||z4.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Kx.displayName=Jg;var Vz=S.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,l=e3(Jg,n),c=Iz(n),d=S.useRef(null),h=Cn(e,d),[m,p]=S.useState(!1),[x,v]=S.useState("");return S.useEffect(()=>{const b=d.current;b&&v((b.textContent??"").trim())},[i.children]),a.jsx($f.ItemSlot,{scope:n,disabled:r,textValue:s??x,children:a.jsx(CC,{asChild:!0,...c,focusable:!r,children:a.jsx(Zt.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:h,onPointerMove:$e(t.onPointerMove,Hf(b=>{r?l.onItemLeave(b):(l.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:$e(t.onPointerLeave,Hf(b=>l.onItemLeave(b))),onFocus:$e(t.onFocus,()=>p(!0)),onBlur:$e(t.onBlur,()=>p(!1))})})})}),spe="MenuCheckboxItem",Wz=S.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return a.jsx(Zz,{scope:t.__scopeMenu,checked:n,children:a.jsx(Kx,{role:"menuitemcheckbox","aria-checked":ex(n)?"mixed":n,...s,ref:e,"data-state":i3(n),onSelect:$e(s.onSelect,()=>r?.(ex(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Wz.displayName=spe;var Gz="MenuRadioGroup",[ipe,ape]=Lc(Gz,{value:void 0,onValueChange:()=>{}}),Xz=S.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=es(r);return a.jsx(ipe,{scope:t.__scopeMenu,value:n,onValueChange:i,children:a.jsx(n3,{...s,ref:e})})});Xz.displayName=Gz;var Yz="MenuRadioItem",Kz=S.forwardRef((t,e)=>{const{value:n,...r}=t,s=ape(Yz,t.__scopeMenu),i=n===s.value;return a.jsx(Zz,{scope:t.__scopeMenu,checked:i,children:a.jsx(Kx,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":i3(i),onSelect:$e(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Kz.displayName=Yz;var r3="MenuItemIndicator",[Zz,lpe]=Lc(r3,{checked:!1}),Jz=S.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=lpe(r3,n);return a.jsx(Ls,{present:r||ex(i.checked)||i.checked===!0,children:a.jsx(Zt.span,{...s,ref:e,"data-state":i3(i.checked)})})});Jz.displayName=r3;var ope="MenuSeparator",eP=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Zt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});eP.displayName=ope;var cpe="MenuArrow",tP=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=A0(n);return a.jsx(Y4,{...s,...r,ref:e})});tP.displayName=cpe;var s3="MenuSub",[upe,nP]=Lc(s3),rP=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:s}=t,i=Eo(s3,e),l=A0(e),[c,d]=S.useState(null),[h,m]=S.useState(null),p=es(s);return S.useEffect(()=>(i.open===!1&&p(!1),()=>p(!1)),[i.open,p]),a.jsx(ix,{...l,children:a.jsx(qz,{scope:e,open:r,onOpenChange:p,content:h,onContentChange:m,children:a.jsx(upe,{scope:e,contentId:ji(),triggerId:ji(),trigger:c,onTriggerChange:d,children:n})})})};rP.displayName=s3;var Gh="MenuSubTrigger",sP=S.forwardRef((t,e)=>{const n=Eo(Gh,t.__scopeMenu),r=M0(Gh,t.__scopeMenu),s=nP(Gh,t.__scopeMenu),i=e3(Gh,t.__scopeMenu),l=S.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:d}=i,h={__scopeMenu:t.__scopeMenu},m=S.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return S.useEffect(()=>m,[m]),S.useEffect(()=>{const p=c.current;return()=>{window.clearTimeout(p),d(null)}},[c,d]),a.jsx(Z5,{asChild:!0,...h,children:a.jsx(Vz,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":lP(n.open),...t,ref:oo(e,s.onTriggerChange),onClick:p=>{t.onClick?.(p),!(t.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:$e(t.onPointerMove,Hf(p=>{i.onItemEnter(p),!p.defaultPrevented&&!t.disabled&&!n.open&&!l.current&&(i.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:$e(t.onPointerLeave,Hf(p=>{m();const x=n.content?.getBoundingClientRect();if(x){const v=n.content?.dataset.side,b=v==="right",k=b?-5:5,O=x[b?"left":"right"],j=x[b?"right":"left"];i.onPointerGraceIntentChange({area:[{x:p.clientX+k,y:p.clientY},{x:O,y:x.top},{x:j,y:x.top},{x:j,y:x.bottom},{x:O,y:x.bottom}],side:v}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(p),p.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:$e(t.onKeyDown,p=>{const x=i.searchRef.current!=="";t.disabled||x&&p.key===" "||Ume[r.dir].includes(p.key)&&(n.onOpenChange(!0),n.content?.focus(),p.preventDefault())})})})});sP.displayName=Gh;var iP="MenuSubContent",aP=S.forwardRef((t,e)=>{const n=Qz(Ci,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Eo(Ci,t.__scopeMenu),l=M0(Ci,t.__scopeMenu),c=nP(iP,t.__scopeMenu),d=S.useRef(null),h=Cn(e,d);return a.jsx($f.Provider,{scope:t.__scopeMenu,children:a.jsx(Ls,{present:r||i.open,children:a.jsx($f.Slot,{scope:t.__scopeMenu,children:a.jsx(t3,{id:c.contentId,"aria-labelledby":c.triggerId,...s,ref:h,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{l.isUsingKeyboardRef.current&&d.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:$e(t.onFocusOutside,m=>{m.target!==c.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:$e(t.onEscapeKeyDown,m=>{l.onClose(),m.preventDefault()}),onKeyDown:$e(t.onKeyDown,m=>{const p=m.currentTarget.contains(m.target),x=Vme[l.dir].includes(m.key);p&&x&&(i.onOpenChange(!1),c.trigger?.focus(),m.preventDefault())})})})})})});aP.displayName=iP;function lP(t){return t?"open":"closed"}function ex(t){return t==="indeterminate"}function i3(t){return ex(t)?"indeterminate":t?"checked":"unchecked"}function dpe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function hpe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function fpe(t,e,n){const s=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let l=hpe(t,Math.max(i,0));s.length===1&&(l=l.filter(h=>h!==n));const d=l.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return d!==n?d:void 0}function mpe(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,l=e.length-1;ir!=x>r&&n<(p-h)*(r-m)/(x-m)+h&&(s=!s)}return s}function ppe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return mpe(n,e)}function Hf(t){return e=>e.pointerType==="mouse"?t(e):void 0}var gpe=Fz,xpe=Z5,vpe=$z,ype=Hz,bpe=n3,wpe=Uz,Spe=Kx,kpe=Wz,Ope=Xz,jpe=Kz,Npe=Jz,Cpe=eP,Tpe=tP,Ape=rP,Mpe=sP,Epe=aP,a3="ContextMenu",[_pe]=Vi(a3,[Lz]),ls=Lz(),[Dpe,oP]=_pe(a3),cP=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:s,modal:i=!0}=t,[l,c]=S.useState(!1),d=ls(e),h=es(r),m=S.useCallback(p=>{c(p),h(p)},[h]);return a.jsx(Dpe,{scope:e,open:l,onOpenChange:m,modal:i,children:a.jsx(gpe,{...d,dir:s,open:l,onOpenChange:m,modal:i,children:n})})};cP.displayName=a3;var uP="ContextMenuTrigger",dP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=t,i=oP(uP,n),l=ls(n),c=S.useRef({x:0,y:0}),d=S.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...c.current})}),h=S.useRef(0),m=S.useCallback(()=>window.clearTimeout(h.current),[]),p=x=>{c.current={x:x.clientX,y:x.clientY},i.onOpenChange(!0)};return S.useEffect(()=>m,[m]),S.useEffect(()=>void(r&&m()),[r,m]),a.jsxs(a.Fragment,{children:[a.jsx(xpe,{...l,virtualRef:d}),a.jsx(Zt.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:$e(t.onContextMenu,x=>{m(),p(x),x.preventDefault()}),onPointerDown:r?t.onPointerDown:$e(t.onPointerDown,Fp(x=>{m(),h.current=window.setTimeout(()=>p(x),700)})),onPointerMove:r?t.onPointerMove:$e(t.onPointerMove,Fp(m)),onPointerCancel:r?t.onPointerCancel:$e(t.onPointerCancel,Fp(m)),onPointerUp:r?t.onPointerUp:$e(t.onPointerUp,Fp(m))})]})});dP.displayName=uP;var Rpe="ContextMenuPortal",hP=t=>{const{__scopeContextMenu:e,...n}=t,r=ls(e);return a.jsx(vpe,{...r,...n})};hP.displayName=Rpe;var fP="ContextMenuContent",mP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=oP(fP,n),i=ls(n),l=S.useRef(!1);return a.jsx(ype,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:c=>{t.onCloseAutoFocus?.(c),!c.defaultPrevented&&l.current&&c.preventDefault(),l.current=!1},onInteractOutside:c=>{t.onInteractOutside?.(c),!c.defaultPrevented&&!s.modal&&(l.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});mP.displayName=fP;var zpe="ContextMenuGroup",Ppe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(bpe,{...s,...r,ref:e})});Ppe.displayName=zpe;var Bpe="ContextMenuLabel",pP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(wpe,{...s,...r,ref:e})});pP.displayName=Bpe;var Lpe="ContextMenuItem",gP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Spe,{...s,...r,ref:e})});gP.displayName=Lpe;var Ipe="ContextMenuCheckboxItem",xP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(kpe,{...s,...r,ref:e})});xP.displayName=Ipe;var qpe="ContextMenuRadioGroup",Fpe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Ope,{...s,...r,ref:e})});Fpe.displayName=qpe;var Qpe="ContextMenuRadioItem",vP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(jpe,{...s,...r,ref:e})});vP.displayName=Qpe;var $pe="ContextMenuItemIndicator",yP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Npe,{...s,...r,ref:e})});yP.displayName=$pe;var Hpe="ContextMenuSeparator",bP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Cpe,{...s,...r,ref:e})});bP.displayName=Hpe;var Upe="ContextMenuArrow",Vpe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Tpe,{...s,...r,ref:e})});Vpe.displayName=Upe;var wP="ContextMenuSub",SP=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,open:s,defaultOpen:i}=t,l=ls(e),[c,d]=ko({prop:s,defaultProp:i??!1,onChange:r,caller:wP});return a.jsx(Ape,{...l,open:c,onOpenChange:d,children:n})};SP.displayName=wP;var Wpe="ContextMenuSubTrigger",kP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Mpe,{...s,...r,ref:e})});kP.displayName=Wpe;var Gpe="ContextMenuSubContent",OP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Epe,{...s,...r,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});OP.displayName=Gpe;function Fp(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var Xpe=cP,Ype=dP,Kpe=hP,jP=mP,NP=pP,CP=gP,TP=xP,AP=vP,MP=yP,EP=bP,Zpe=SP,_P=kP,DP=OP;const Jpe=Xpe,ege=Ype,tge=Zpe,RP=S.forwardRef(({className:t,inset:e,children:n,...r},s)=>a.jsxs(_P,{ref:s,className:ye("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...r,children:[n,a.jsx(Ac,{className:"ml-auto h-4 w-4"})]}));RP.displayName=_P.displayName;const zP=S.forwardRef(({className:t,...e},n)=>a.jsx(DP,{ref:n,className:ye("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 origin-[--radix-context-menu-content-transform-origin]",t),...e}));zP.displayName=DP.displayName;const PP=S.forwardRef(({className:t,...e},n)=>a.jsx(Kpe,{children:a.jsx(jP,{ref:n,className:ye("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-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 origin-[--radix-context-menu-content-transform-origin]",t),...e})}));PP.displayName=jP.displayName;const Bi=S.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(CP,{ref:r,className:ye("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));Bi.displayName=CP.displayName;const nge=S.forwardRef(({className:t,children:e,checked:n,...r},s)=>a.jsxs(TP,{ref:s,className:ye("relative flex 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),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(MP,{children:a.jsx(hc,{className:"h-4 w-4"})})}),e]}));nge.displayName=TP.displayName;const rge=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(AP,{ref:r,className:ye("relative flex 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(MP,{children:a.jsx(Aq,{className:"h-2 w-2 fill-current"})})}),e]}));rge.displayName=AP.displayName;const sge=S.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(NP,{ref:r,className:ye("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...n}));sge.displayName=NP.displayName;const Xh=S.forwardRef(({className:t,...e},n)=>a.jsx(EP,{ref:n,className:ye("-mx-1 my-1 h-px bg-border",t),...e}));Xh.displayName=EP.displayName;const qu=({className:t,...e})=>a.jsx("span",{className:ye("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});qu.displayName="ContextMenuShortcut";var ige=Symbol("radix.slottable");function age(t){const e=({children:n})=>a.jsx(a.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=ige,e}var[Zx]=Vi("Tooltip",[wd]),Jx=wd(),BP="TooltipProvider",lge=700,P4="tooltip.open",[oge,l3]=Zx(BP),LP=t=>{const{__scopeTooltip:e,delayDuration:n=lge,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,l=S.useRef(!0),c=S.useRef(!1),d=S.useRef(0);return S.useEffect(()=>{const h=d.current;return()=>window.clearTimeout(h)},[]),a.jsx(oge,{scope:e,isOpenDelayedRef:l,delayDuration:n,onOpen:S.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:S.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:S.useCallback(h=>{c.current=h},[]),disableHoverableContent:s,children:i})};LP.displayName=BP;var Uf="Tooltip",[cge,E0]=Zx(Uf),IP=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:l,delayDuration:c}=t,d=l3(Uf,t.__scopeTooltip),h=Jx(e),[m,p]=S.useState(null),x=ji(),v=S.useRef(0),b=l??d.disableHoverableContent,k=c??d.delayDuration,O=S.useRef(!1),[j,T]=ko({prop:r,defaultProp:s??!1,onChange:R=>{R?(d.onOpen(),document.dispatchEvent(new CustomEvent(P4))):d.onClose(),i?.(R)},caller:Uf}),A=S.useMemo(()=>j?O.current?"delayed-open":"instant-open":"closed",[j]),_=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,O.current=!1,T(!0)},[T]),D=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,T(!1)},[T]),E=S.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{O.current=!0,T(!0),v.current=0},k)},[k,T]);return S.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),a.jsx(ix,{...h,children:a.jsx(cge,{scope:e,contentId:x,open:j,stateAttribute:A,trigger:m,onTriggerChange:p,onTriggerEnter:S.useCallback(()=>{d.isOpenDelayedRef.current?E():_()},[d.isOpenDelayedRef,E,_]),onTriggerLeave:S.useCallback(()=>{b?D():(window.clearTimeout(v.current),v.current=0)},[D,b]),onOpen:_,onClose:D,disableHoverableContent:b,children:n})})};IP.displayName=Uf;var B4="TooltipTrigger",qP=S.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=E0(B4,n),i=l3(B4,n),l=Jx(n),c=S.useRef(null),d=Cn(e,c,s.onTriggerChange),h=S.useRef(!1),m=S.useRef(!1),p=S.useCallback(()=>h.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),a.jsx(ax,{asChild:!0,...l,children:a.jsx(Zt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:d,onPointerMove:$e(t.onPointerMove,x=>{x.pointerType!=="touch"&&!m.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),m.current=!0)}),onPointerLeave:$e(t.onPointerLeave,()=>{s.onTriggerLeave(),m.current=!1}),onPointerDown:$e(t.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:$e(t.onFocus,()=>{h.current||s.onOpen()}),onBlur:$e(t.onBlur,s.onClose),onClick:$e(t.onClick,s.onClose)})})});qP.displayName=B4;var o3="TooltipPortal",[uge,dge]=Zx(o3,{forceMount:void 0}),FP=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=E0(o3,e);return a.jsx(uge,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};FP.displayName=o3;var bd="TooltipContent",QP=S.forwardRef((t,e)=>{const n=dge(bd,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,l=E0(bd,t.__scopeTooltip);return a.jsx(Ls,{present:r||l.open,children:l.disableHoverableContent?a.jsx($P,{side:s,...i,ref:e}):a.jsx(hge,{side:s,...i,ref:e})})}),hge=S.forwardRef((t,e)=>{const n=E0(bd,t.__scopeTooltip),r=l3(bd,t.__scopeTooltip),s=S.useRef(null),i=Cn(e,s),[l,c]=S.useState(null),{trigger:d,onClose:h}=n,m=s.current,{onPointerInTransitChange:p}=r,x=S.useCallback(()=>{c(null),p(!1)},[p]),v=S.useCallback((b,k)=>{const O=b.currentTarget,j={x:b.clientX,y:b.clientY},T=xge(j,O.getBoundingClientRect()),A=vge(j,T),_=yge(k.getBoundingClientRect()),D=wge([...A,..._]);c(D),p(!0)},[p]);return S.useEffect(()=>()=>x(),[x]),S.useEffect(()=>{if(d&&m){const b=O=>v(O,m),k=O=>v(O,d);return d.addEventListener("pointerleave",b),m.addEventListener("pointerleave",k),()=>{d.removeEventListener("pointerleave",b),m.removeEventListener("pointerleave",k)}}},[d,m,v,x]),S.useEffect(()=>{if(l){const b=k=>{const O=k.target,j={x:k.clientX,y:k.clientY},T=d?.contains(O)||m?.contains(O),A=!bge(j,l);T?x():A&&(x(),h())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[d,m,l,h,x]),a.jsx($P,{...t,ref:i})}),[fge,mge]=Zx(Uf,{isInside:!1}),pge=age("TooltipContent"),$P=S.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:l,...c}=t,d=E0(bd,n),h=Jx(n),{onClose:m}=d;return S.useEffect(()=>(document.addEventListener(P4,m),()=>document.removeEventListener(P4,m)),[m]),S.useEffect(()=>{if(d.trigger){const p=x=>{x.target?.contains(d.trigger)&&m()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[d.trigger,m]),a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:p=>p.preventDefault(),onDismiss:m,children:a.jsxs(X4,{"data-state":d.stateAttribute,...h,...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(pge,{children:r}),a.jsx(fge,{scope:n,isInside:!0,children:a.jsx(sq,{id:d.contentId,role:"tooltip",children:s||r})})]})})});QP.displayName=bd;var HP="TooltipArrow",gge=S.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Jx(n);return mge(HP,n).isInside?null:a.jsx(Y4,{...s,...r,ref:e})});gge.displayName=HP;function xge(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function vge(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 yge(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function bge(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,l=e.length-1;ir!=x>r&&n<(p-h)*(r-m)/(x-m)+h&&(s=!s)}return s}function wge(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),Sge(e)}function Sge(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const i=e[e.length-1],l=e[e.length-2];if((i.x-l.x)*(s.y-l.y)>=(i.y-l.y)*(s.x-l.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],l=n[n.length-2];if((i.x-l.x)*(s.y-l.y)>=(i.y-l.y)*(s.x-l.x))n.pop();else break}n.push(s)}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 kge=LP,Oge=IP,jge=qP,Nge=FP,UP=QP;const Cge=kge,Tge=Oge,Age=jge,VP=S.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(Nge,{children:a.jsx(UP,{ref:r,sideOffset:e,className:ye("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",t),...n})}));VP.displayName=UP.displayName;function Mge({children:t}){CH();const[e,n]=S.useState(!0),[r,s]=S.useState(!1),[i,l]=S.useState(!1),{theme:c,setTheme:d}=dw(),h=AI(),m=wa();S.useEffect(()=>{const k=O=>{(O.metaKey||O.ctrlKey)&&O.key==="k"&&(O.preventDefault(),l(!0))};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[]);const p=[{title:"概览",items:[{icon:hg,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:ao,label:"麦麦主程序配置",path:"/config/bot"},{icon:z9,label:"麦麦模型提供商配置",path:"/config/modelProvider"},{icon:P9,label:"麦麦模型配置",path:"/config/model"},{icon:hO,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:K4,label:"表情包管理",path:"/resource/emoji"},{icon:Wf,label:"表达方式管理",path:"/resource/expression"},{icon:B9,label:"人物信息管理",path:"/resource/person"}]},{title:"扩展与监控",items:[{icon:pg,label:"插件市场",path:"/plugins"},{icon:hO,label:"插件配置",path:"/plugin-config"},{icon:fg,label:"日志查看器",path:"/logs"}]},{title:"系统",items:[{icon:Ii,label:"系统设置",path:"/settings"}]}],v=c==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":c,b=()=>{localStorage.removeItem("access-token"),m({to:"/auth"})};return a.jsx(Cge,{delayDuration:300,children:a.jsxs("div",{className:"flex h-screen overflow-hidden",children:[a.jsxs("aside",{className:ye("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",e?"lg:w-64":"lg:w-16",r?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[a.jsx("div",{className:"flex h-16 items-center border-b px-4",children:a.jsxs("div",{className:ye("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!e&&"lg:flex-none lg:w-8"),children:[a.jsxs("div",{className:ye("flex items-baseline gap-2",!e&&"lg:hidden"),children:[a.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),a.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:rH()})]}),!e&&a.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),a.jsx("nav",{className:"flex-1 overflow-y-auto p-4",children:a.jsx("ul",{className:ye("space-y-6",!e&&"lg:space-y-3"),children:p.map((k,O)=>a.jsxs("li",{children:[a.jsx("div",{className:ye("px-3 h-[1.25rem]","mb-2",!e&&"lg:mb-1 lg:invisible"),children:a.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:k.title})}),!e&&O>0&&a.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),a.jsx("ul",{className:"space-y-1",children:k.items.map(j=>{const T=h({to:j.path}),A=j.icon,_=a.jsxs(a.Fragment,{children:[T&&a.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),a.jsxs("div",{className:ye("flex items-center transition-all duration-300",e?"gap-3":"lg:gap-0"),children:[a.jsx(A,{className:ye("h-5 w-5 flex-shrink-0",T&&"text-primary"),strokeWidth:2,fill:"none"}),a.jsx("span",{className:ye("text-sm font-medium whitespace-nowrap transition-all duration-300",T&&"font-semibold",e?"opacity-100 max-w-[200px]":"lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:j.label})]})]});return a.jsx("li",{className:"relative",children:a.jsxs(Tge,{children:[a.jsx(Age,{asChild:!0,children:a.jsx(MI,{to:j.path,className:ye("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",T?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",e?"px-3":"lg:px-0 lg:justify-center"),onClick:()=>s(!1),children:_})}),!e&&a.jsx(VP,{side:"right",className:"hidden lg:block",children:a.jsx("p",{children:j.label})})]})},j.path)})})]},k.title))})})]}),r&&a.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>s(!1)}),a.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[a.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:()=>s(!r),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:a.jsx(Mq,{className:"h-5 w-5"})}),a.jsx("button",{onClick:()=>n(!e),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:e?"收起侧边栏":"展开侧边栏",children:a.jsx(Tc,{className:ye("h-5 w-5 transition-transform",!e&&"rotate-180")})})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>l(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),a.jsxs(Pz,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[a.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),a.jsx(Pme,{open:i,onOpenChange:l}),a.jsxs(ie,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[a.jsx(Eq,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),a.jsx("button",{onClick:k=>{Q$(v==="dark"?"light":"dark",d,k)},className:"rounded-lg p-2 hover:bg-accent",title:v==="dark"?"切换到浅色模式":"切换到深色模式",children:v==="dark"?a.jsx(Zb,{className:"h-5 w-5"}):a.jsx(Jb,{className:"h-5 w-5"})}),a.jsx("div",{className:"h-6 w-px bg-border"}),a.jsxs(ie,{variant:"ghost",size:"sm",onClick:b,className:"gap-2",title:"登出系统",children:[a.jsx(fO,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),a.jsxs(Jpe,{children:[a.jsx(ege,{asChild:!0,children:a.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:t})}),a.jsxs(PP,{className:"w-64",children:[a.jsxs(Bi,{onClick:()=>m({to:"/"}),children:[a.jsx(hg,{className:"mr-2 h-4 w-4"}),"首页"]}),a.jsxs(Bi,{onClick:()=>m({to:"/settings"}),children:[a.jsx(Ii,{className:"mr-2 h-4 w-4"}),"系统设置"]}),a.jsxs(Bi,{onClick:()=>m({to:"/logs"}),children:[a.jsx(fg,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),a.jsx(Xh,{}),a.jsxs(tge,{children:[a.jsxs(RP,{children:[a.jsx(_9,{className:"mr-2 h-4 w-4"}),"切换主题"]}),a.jsxs(zP,{className:"w-48",children:[a.jsxs(Bi,{onClick:()=>d("light"),disabled:c==="light",children:[a.jsx(Zb,{className:"mr-2 h-4 w-4"}),"浅色",c==="light"&&a.jsx(qu,{children:"✓"})]}),a.jsxs(Bi,{onClick:()=>d("dark"),disabled:c==="dark",children:[a.jsx(Jb,{className:"mr-2 h-4 w-4"}),"深色",c==="dark"&&a.jsx(qu,{children:"✓"})]}),a.jsxs(Bi,{onClick:()=>d("system"),disabled:c==="system",children:[a.jsx(Ii,{className:"mr-2 h-4 w-4"}),"跟随系统",c==="system"&&a.jsx(qu,{children:"✓"})]})]})]}),a.jsx(Xh,{}),a.jsxs(Bi,{onClick:()=>window.location.reload(),children:[a.jsx(_q,{className:"mr-2 h-4 w-4"}),"刷新页面",a.jsx(qu,{children:"⌘R"})]}),a.jsxs(Bi,{onClick:()=>l(!0),children:[a.jsx(Bs,{className:"mr-2 h-4 w-4"}),"搜索",a.jsx(qu,{children:"⌘K"})]}),a.jsx(Xh,{}),a.jsxs(Bi,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[a.jsx(Yh,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),a.jsx(Xh,{}),a.jsxs(Bi,{onClick:b,className:"text-destructive focus:text-destructive",children:[a.jsx(fO,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}const _0=EI({component:()=>a.jsxs(a.Fragment,{children:[a.jsx(c9,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!qT())throw DI({to:"/auth"})}}),Ege=Xr({getParentRoute:()=>_0,path:"/auth",component:TH}),_ge=Xr({getParentRoute:()=>_0,path:"/setup",component:WH}),Qs=Xr({getParentRoute:()=>_0,id:"protected",component:()=>a.jsx(Mge,{children:a.jsx(c9,{})})}),Dge=Xr({getParentRoute:()=>Qs,path:"/",component:q$}),Rge=Xr({getParentRoute:()=>Qs,path:"/config/bot",component:Vee}),zge=Xr({getParentRoute:()=>Qs,path:"/config/modelProvider",component:ote}),Pge=Xr({getParentRoute:()=>Qs,path:"/config/model",component:Pte}),Bge=Xr({getParentRoute:()=>Qs,path:"/config/adapter",component:qte}),Lge=Xr({getParentRoute:()=>Qs,path:"/resource/emoji",component:ude}),Ige=Xr({getParentRoute:()=>Qs,path:"/resource/expression",component:bde}),qge=Xr({getParentRoute:()=>Qs,path:"/resource/person",component:Ede}),Fge=Xr({getParentRoute:()=>Qs,path:"/logs",component:hme}),Qge=Xr({getParentRoute:()=>Qs,path:"/plugins",component:Eme}),$ge=Xr({getParentRoute:()=>Qs,path:"/plugin-config",component:_me}),Hge=Xr({getParentRoute:()=>Qs,path:"/plugin-mirrors",component:Dme}),Uge=Xr({getParentRoute:()=>Qs,path:"/settings",component:bH}),Vge=Xr({getParentRoute:()=>_0,path:"*",component:$T}),Wge=_0.addChildren([Ege,_ge,Qs.addChildren([Dge,Rge,zge,Pge,Bge,Lge,Ige,qge,Qge,$ge,Hge,Fge,Uge]),Vge]),Gge=_I({routeTree:Wge,defaultNotFoundComponent:$T});function Xge({children:t,defaultTheme:e="system",storageKey:n="ui-theme",...r}){const[s,i]=S.useState(()=>localStorage.getItem(n)||e);S.useEffect(()=>{const c=window.document.documentElement;if(c.classList.remove("light","dark"),s==="system"){const d=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";c.classList.add(d);return}c.classList.add(s)},[s]),S.useEffect(()=>{const c=localStorage.getItem("accent-color");if(c){const d=document.documentElement,m={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[c];m&&(d.style.setProperty("--primary",m.hsl),m.gradient?(d.style.setProperty("--primary-gradient",m.gradient),d.classList.add("has-gradient")):(d.style.removeProperty("--primary-gradient"),d.classList.remove("has-gradient")))}},[]);const l={theme:s,setTheme:c=>{localStorage.setItem(n,c),i(c)}};return a.jsx(uT.Provider,{...r,value:l,children:t})}function Yge({children:t,defaultEnabled:e=!0,defaultWavesEnabled:n=!0,storageKey:r="enable-animations",wavesStorageKey:s="enable-waves-background"}){const[i,l]=S.useState(()=>{const m=localStorage.getItem(r);return m!==null?m==="true":e}),[c,d]=S.useState(()=>{const m=localStorage.getItem(s);return m!==null?m==="true":n});S.useEffect(()=>{const m=document.documentElement;i?m.classList.remove("no-animations"):m.classList.add("no-animations"),localStorage.setItem(r,String(i))},[i,r]),S.useEffect(()=>{localStorage.setItem(s,String(c))},[c,s]);const h={enableAnimations:i,setEnableAnimations:l,enableWavesBackground:c,setEnableWavesBackground:d};return a.jsx(dT.Provider,{value:h,children:t})}var c3="ToastProvider",[u3,Kge,Zge]=tx("Toast"),[WP]=Vi("Toast",[Zge]),[Jge,e1]=WP(c3),GP=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:l}=t,[c,d]=S.useState(null),[h,m]=S.useState(0),p=S.useRef(!1),x=S.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${c3}\`. Expected non-empty \`string\`.`),a.jsx(u3.Provider,{scope:e,children:a.jsx(Jge,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:h,viewport:c,onViewportChange:d,onToastAdd:S.useCallback(()=>m(v=>v+1),[]),onToastRemove:S.useCallback(()=>m(v=>v-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:x,children:l})})};GP.displayName=c3;var XP="ToastViewport",exe=["F8"],L4="toast.viewportPause",I4="toast.viewportResume",YP=S.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=exe,label:s="Notifications ({hotkey})",...i}=t,l=e1(XP,n),c=Kge(n),d=S.useRef(null),h=S.useRef(null),m=S.useRef(null),p=S.useRef(null),x=Cn(e,p,l.onViewportChange),v=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=l.toastCount>0;S.useEffect(()=>{const O=j=>{r.length!==0&&r.every(A=>j[A]||j.code===A)&&p.current?.focus()};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[r]),S.useEffect(()=>{const O=d.current,j=p.current;if(b&&O&&j){const T=()=>{if(!l.isClosePausedRef.current){const E=new CustomEvent(L4);j.dispatchEvent(E),l.isClosePausedRef.current=!0}},A=()=>{if(l.isClosePausedRef.current){const E=new CustomEvent(I4);j.dispatchEvent(E),l.isClosePausedRef.current=!1}},_=E=>{!O.contains(E.relatedTarget)&&A()},D=()=>{O.contains(document.activeElement)||A()};return O.addEventListener("focusin",T),O.addEventListener("focusout",_),O.addEventListener("pointermove",T),O.addEventListener("pointerleave",D),window.addEventListener("blur",T),window.addEventListener("focus",A),()=>{O.removeEventListener("focusin",T),O.removeEventListener("focusout",_),O.removeEventListener("pointermove",T),O.removeEventListener("pointerleave",D),window.removeEventListener("blur",T),window.removeEventListener("focus",A)}}},[b,l.isClosePausedRef]);const k=S.useCallback(({tabbingDirection:O})=>{const T=c().map(A=>{const _=A.ref.current,D=[_,...fxe(_)];return O==="forwards"?D:D.reverse()});return(O==="forwards"?T.reverse():T).flat()},[c]);return S.useEffect(()=>{const O=p.current;if(O){const j=T=>{const A=T.altKey||T.ctrlKey||T.metaKey;if(T.key==="Tab"&&!A){const D=document.activeElement,E=T.shiftKey;if(T.target===O&&E){h.current?.focus();return}const F=k({tabbingDirection:E?"backwards":"forwards"}),L=F.findIndex(U=>U===D);Gb(F.slice(L+1))?T.preventDefault():E?h.current?.focus():m.current?.focus()}};return O.addEventListener("keydown",j),()=>O.removeEventListener("keydown",j)}},[c,k]),a.jsxs(iq,{ref:d,role:"region","aria-label":s.replace("{hotkey}",v),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&a.jsx(q4,{ref:h,onFocusFromOutsideViewport:()=>{const O=k({tabbingDirection:"forwards"});Gb(O)}}),a.jsx(u3.Slot,{scope:n,children:a.jsx(Zt.ol,{tabIndex:-1,...i,ref:x})}),b&&a.jsx(q4,{ref:m,onFocusFromOutsideViewport:()=>{const O=k({tabbingDirection:"backwards"});Gb(O)}})]})});YP.displayName=XP;var KP="ToastFocusProxy",q4=S.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=e1(KP,n);return a.jsx(E9,{tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:l=>{const c=l.relatedTarget;!i.viewport?.contains(c)&&r()}})});q4.displayName=KP;var D0="Toast",txe="toast.swipeStart",nxe="toast.swipeMove",rxe="toast.swipeCancel",sxe="toast.swipeEnd",ZP=S.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...l}=t,[c,d]=ko({prop:r,defaultProp:s??!0,onChange:i,caller:D0});return a.jsx(Ls,{present:n||c,children:a.jsx(lxe,{open:c,...l,ref:e,onClose:()=>d(!1),onPause:es(t.onPause),onResume:es(t.onResume),onSwipeStart:$e(t.onSwipeStart,h=>{h.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:$e(t.onSwipeMove,h=>{const{x:m,y:p}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","move"),h.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${m}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:$e(t.onSwipeCancel,h=>{h.currentTarget.setAttribute("data-swipe","cancel"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:$e(t.onSwipeEnd,h=>{const{x:m,y:p}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","end"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${m}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),d(!1)})})})});ZP.displayName=D0;var[ixe,axe]=WP(D0,{onClose(){}}),lxe=S.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:l,onEscapeKeyDown:c,onPause:d,onResume:h,onSwipeStart:m,onSwipeMove:p,onSwipeCancel:x,onSwipeEnd:v,...b}=t,k=e1(D0,n),[O,j]=S.useState(null),T=Cn(e,W=>j(W)),A=S.useRef(null),_=S.useRef(null),D=s||k.duration,E=S.useRef(0),R=S.useRef(D),Q=S.useRef(0),{onToastAdd:F,onToastRemove:L}=k,U=es(()=>{O?.contains(document.activeElement)&&k.viewport?.focus(),l()}),V=S.useCallback(W=>{!W||W===1/0||(window.clearTimeout(Q.current),E.current=new Date().getTime(),Q.current=window.setTimeout(U,W))},[U]);S.useEffect(()=>{const W=k.viewport;if(W){const J=()=>{V(R.current),h?.()},$=()=>{const ae=new Date().getTime()-E.current;R.current=R.current-ae,window.clearTimeout(Q.current),d?.()};return W.addEventListener(L4,$),W.addEventListener(I4,J),()=>{W.removeEventListener(L4,$),W.removeEventListener(I4,J)}}},[k.viewport,D,d,h,V]),S.useEffect(()=>{i&&!k.isClosePausedRef.current&&V(D)},[i,D,k.isClosePausedRef,V]),S.useEffect(()=>(F(),()=>L()),[F,L]);const de=S.useMemo(()=>O?iB(O):null,[O]);return k.viewport?a.jsxs(a.Fragment,{children:[de&&a.jsx(oxe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:de}),a.jsx(ixe,{scope:n,onClose:U,children:RI.createPortal(a.jsx(u3.ItemSlot,{scope:n,children:a.jsx(aq,{asChild:!0,onEscapeKeyDown:$e(c,()=>{k.isFocusedToastEscapeKeyDownRef.current||U(),k.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(Zt.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":k.swipeDirection,...b,ref:T,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:$e(t.onKeyDown,W=>{W.key==="Escape"&&(c?.(W.nativeEvent),W.nativeEvent.defaultPrevented||(k.isFocusedToastEscapeKeyDownRef.current=!0,U()))}),onPointerDown:$e(t.onPointerDown,W=>{W.button===0&&(A.current={x:W.clientX,y:W.clientY})}),onPointerMove:$e(t.onPointerMove,W=>{if(!A.current)return;const J=W.clientX-A.current.x,$=W.clientY-A.current.y,ae=!!_.current,ne=["left","right"].includes(k.swipeDirection),ce=["left","up"].includes(k.swipeDirection)?Math.min:Math.max,z=ne?ce(0,J):0,xe=ne?0:ce(0,$),Y=W.pointerType==="touch"?10:2,P={x:z,y:xe},K={originalEvent:W,delta:P};ae?(_.current=P,Qp(nxe,p,K,{discrete:!1})):o9(P,k.swipeDirection,Y)?(_.current=P,Qp(txe,m,K,{discrete:!1}),W.target.setPointerCapture(W.pointerId)):(Math.abs(J)>Y||Math.abs($)>Y)&&(A.current=null)}),onPointerUp:$e(t.onPointerUp,W=>{const J=_.current,$=W.target;if($.hasPointerCapture(W.pointerId)&&$.releasePointerCapture(W.pointerId),_.current=null,A.current=null,J){const ae=W.currentTarget,ne={originalEvent:W,delta:J};o9(J,k.swipeDirection,k.swipeThreshold)?Qp(sxe,v,ne,{discrete:!0}):Qp(rxe,x,ne,{discrete:!0}),ae.addEventListener("click",ce=>ce.preventDefault(),{once:!0})}})})})}),k.viewport)})]}):null}),oxe=t=>{const{__scopeToast:e,children:n,...r}=t,s=e1(D0,e),[i,l]=S.useState(!1),[c,d]=S.useState(!1);return dxe(()=>l(!0)),S.useEffect(()=>{const h=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(h)},[]),c?null:a.jsx(sx,{asChild:!0,children:a.jsx(E9,{...r,children:i&&a.jsxs(a.Fragment,{children:[s.label," ",n]})})})},cxe="ToastTitle",JP=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(Zt.div,{...r,ref:e})});JP.displayName=cxe;var uxe="ToastDescription",eB=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(Zt.div,{...r,ref:e})});eB.displayName=uxe;var tB="ToastAction",nB=S.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?a.jsx(sB,{altText:n,asChild:!0,children:a.jsx(d3,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${tB}\`. Expected non-empty \`string\`.`),null)});nB.displayName=tB;var rB="ToastClose",d3=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=axe(rB,n);return a.jsx(sB,{asChild:!0,children:a.jsx(Zt.button,{type:"button",...r,ref:e,onClick:$e(t.onClick,s.onClose)})})});d3.displayName=rB;var sB=S.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return a.jsx(Zt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function iB(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),hxe(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const l=r.dataset.radixToastAnnounceAlt;l&&e.push(l)}else e.push(...iB(r))}}),e}function Qp(t,e,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?M9(s,i):s.dispatchEvent(i)}var o9=(t,e,n=0)=>{const r=Math.abs(t.x),s=Math.abs(t.y),i=r>s;return e==="left"||e==="right"?i&&r>n:!i&&s>n};function dxe(t=()=>{}){const e=es(t);h9(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function hxe(t){return t.nodeType===t.ELEMENT_NODE}function fxe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Gb(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var mxe=GP,aB=YP,lB=ZP,oB=JP,cB=eB,uB=nB,dB=d3;const pxe=mxe,hB=S.forwardRef(({className:t,...e},n)=>a.jsx(aB,{ref:n,className:ye("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));hB.displayName=aB.displayName;const gxe=Nd("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),fB=S.forwardRef(({className:t,variant:e,...n},r)=>a.jsx(lB,{ref:r,className:ye(gxe({variant:e}),t),...n}));fB.displayName=lB.displayName;const xxe=S.forwardRef(({className:t,...e},n)=>a.jsx(uB,{ref:n,className:ye("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));xxe.displayName=uB.displayName;const mB=S.forwardRef(({className:t,...e},n)=>a.jsx(dB,{ref:n,className:ye("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:a.jsx(Gf,{className:"h-4 w-4"})}));mB.displayName=dB.displayName;const pB=S.forwardRef(({className:t,...e},n)=>a.jsx(oB,{ref:n,className:ye("text-sm font-semibold [&+div]:text-xs",t),...e}));pB.displayName=oB.displayName;const gB=S.forwardRef(({className:t,...e},n)=>a.jsx(cB,{ref:n,className:ye("text-sm opacity-90",t),...e}));gB.displayName=cB.displayName;function vxe(){const{toasts:t}=Pr();return a.jsxs(pxe,{children:[t.map(function({id:e,title:n,description:r,action:s,...i}){return a.jsxs(fB,{...i,children:[a.jsxs("div",{className:"grid gap-1",children:[n&&a.jsx(pB,{children:n}),r&&a.jsx(gB,{children:r})]}),s,a.jsx(mB,{})]},e)}),a.jsx(hB,{})]})}Bq.createRoot(document.getElementById("root")).render(a.jsx(S.StrictMode,{children:a.jsx(Xge,{defaultTheme:"system",children:a.jsxs(Yge,{children:[a.jsx(zI,{router:Gge}),a.jsx(vxe,{})]})})})); +`:Que(t)?(c=2,d=2):rz(t)&&(c=1,d=1);++i{try{i(!0);const Oe=await nde({page:l,page_size:m,search:x||void 0,is_registered:b==="all"?void 0:b==="registered",is_banned:O==="all"?void 0:O==="banned",format:T==="all"?void 0:T,sort_by:"usage_count",sort_order:"desc"});e(Oe.data),h(Oe.total)}catch(Oe){const nt=Oe instanceof Error?Oe.message:"加载表情包列表失败";ne({title:"错误",description:nt,variant:"destructive"})}finally{i(!1)}},[l,m,x,b,O,T,ne]),R=async()=>{try{const Oe=await ade();r(Oe.data)}catch(Oe){console.error("加载统计数据失败:",Oe)}};S.useEffect(()=>{ue()},[ue]),S.useEffect(()=>{R()},[]);const me=async Oe=>{try{const nt=await rde(Oe.id);D(nt.data),z(!0)}catch(nt){const ut=nt instanceof Error?nt.message:"加载详情失败";ne({title:"错误",description:ut,variant:"destructive"})}},Y=Oe=>{D(Oe),F(!0)},P=Oe=>{D(Oe),U(!0)},K=async()=>{if(_)try{await ide(_.id),ne({title:"成功",description:"表情包已删除"}),U(!1),D(null),ue(),R()}catch(Oe){const nt=Oe instanceof Error?Oe.message:"删除失败";ne({title:"错误",description:nt,variant:"destructive"})}},H=async Oe=>{try{await lde(Oe.id),ne({title:"成功",description:"表情包已注册"}),ue(),R()}catch(nt){const ut=nt instanceof Error?nt.message:"注册失败";ne({title:"错误",description:ut,variant:"destructive"})}},fe=async Oe=>{try{await ode(Oe.id),ne({title:"成功",description:"表情包已封禁"}),ue(),R()}catch(nt){const ut=nt instanceof Error?nt.message:"封禁失败";ne({title:"错误",description:ut,variant:"destructive"})}},ve=Oe=>{const nt=new Set(V);nt.has(Oe)?nt.delete(Oe):nt.add(Oe),ce(nt)},Re=()=>{V.size===t.length&&t.length>0?ce(new Set):ce(new Set(t.map(Oe=>Oe.id)))},de=async()=>{try{const Oe=await cde(Array.from(V));ne({title:"批量删除完成",description:Oe.message}),ce(new Set),J(!1),ue(),R()}catch(Oe){ne({title:"批量删除失败",description:Oe instanceof Error?Oe.message:"批量删除失败",variant:"destructive"})}},We=()=>{const Oe=parseInt($),nt=Math.ceil(d/m);Oe>=1&&Oe<=nt?(c(Oe),ae("")):ne({title:"无效的页码",description:`请输入1-${nt}之间的页码`,variant:"destructive"})},ct=n?.formats?Object.keys(n.formats):[];return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsxs("div",{className:"mb-4 sm:mb-6",children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),a.jsx(mn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&a.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"总数"}),a.jsx(Gt,{className:"text-2xl",children:n.total})]})}),a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"已注册"}),a.jsx(Gt,{className:"text-2xl text-green-600",children:n.registered})]})}),a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"已封禁"}),a.jsx(Gt,{className:"text-2xl text-red-600",children:n.banned})]})}),a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"未注册"}),a.jsx(Gt,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),a.jsxs(gt,{children:[a.jsx(Wt,{children:a.jsxs(Gt,{className:"flex items-center gap-2",children:[a.jsx(t2,{className:"h-5 w-5"}),"搜索和筛选"]})}),a.jsxs(an,{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"搜索"}),a.jsxs("div",{className:"relative",children:[a.jsx(Bs,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"描述或哈希值...",value:x,onChange:Oe=>{v(Oe.target.value),c(1)},className:"pl-8"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"注册状态"}),a.jsxs(Lt,{value:b,onValueChange:Oe=>{k(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"registered",children:"已注册"}),a.jsx(Pe,{value:"unregistered",children:"未注册"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"封禁状态"}),a.jsxs(Lt,{value:O,onValueChange:Oe=>{j(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"banned",children:"已封禁"}),a.jsx(Pe,{value:"unbanned",children:"未封禁"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"格式"}),a.jsxs(Lt,{value:T,onValueChange:Oe=>{A(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),ct.map(Oe=>a.jsxs(Pe,{value:Oe,children:[Oe.toUpperCase()," (",n?.formats[Oe],")"]},Oe))]})]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:V.size>0&&a.jsxs("span",{children:["已选择 ",V.size," 个表情包"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:m.toString(),onValueChange:Oe=>{p(parseInt(Oe)),c(1),ce(new Set)},children:[a.jsx(Dt,{id:"emoji-page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),V.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ce(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:()=>J(!0),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),a.jsx("div",{className:"flex justify-end pt-4 border-t",children:a.jsxs(ie,{variant:"outline",size:"sm",onClick:ue,disabled:s,children:[a.jsx(Fi,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"表情包列表"}),a.jsxs(Sr,{children:["共 ",d," 个表情包,当前第 ",l," 页"]})]}),a.jsxs(an,{children:[a.jsx("div",{className:"hidden md:block rounded-md border overflow-hidden",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:t.length>0&&V.size===t.length,onCheckedChange:Re,"aria-label":"全选"})}),a.jsx(xt,{className:"w-16",children:"预览"}),a.jsx(xt,{children:"描述"}),a.jsx(xt,{children:"格式"}),a.jsx(xt,{children:"情绪标签"}),a.jsx(xt,{className:"text-center",children:"状态"}),a.jsx(xt,{className:"text-right",children:"使用次数"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(Oe=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:V.has(Oe.id),onCheckedChange:()=>ve(Oe.id),"aria-label":`选择 ${Oe.description}`})}),a.jsx(it,{children:a.jsx("div",{className:"w-20 h-20 bg-muted rounded flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(Oe.id),alt:Oe.description||"表情包",className:"w-full h-full object-cover",onError:nt=>{const ut=nt.target;ut.style.display="none";const Ct=ut.parentElement;Ct&&(Ct.innerHTML='')}})})}),a.jsx(it,{children:a.jsxs("div",{className:"space-y-1 max-w-xs",children:[a.jsx("div",{className:"font-medium truncate",title:Oe.description||"无描述",children:Oe.description||"无描述"}),a.jsxs("div",{className:"text-xs text-muted-foreground font-mono",children:[Oe.emoji_hash.slice(0,16),"..."]})]})}),a.jsx(it,{children:a.jsx(On,{variant:"outline",children:Oe.format.toUpperCase()})}),a.jsx(it,{children:a.jsx(UN,{emotions:Oe.emotion})}),a.jsx(it,{className:"align-middle",children:a.jsxs("div",{className:"flex gap-2 justify-center",children:[Oe.is_registered&&a.jsxs(On,{variant:"default",className:"bg-green-600",children:[a.jsx(Es,{className:"h-3 w-3 mr-1"}),"已注册"]}),Oe.is_banned&&a.jsxs(On,{variant:"destructive",children:[a.jsx(Kb,{className:"h-3 w-3 mr-1"}),"已封禁"]})]})}),a.jsx(it,{className:"text-right font-mono",children:Oe.usage_count}),a.jsx(it,{children:a.jsxs("div",{className:"flex items-center justify-end gap-1 flex-wrap",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>me(Oe),children:[a.jsx(co,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Y(Oe),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),!Oe.is_registered&&a.jsxs(ie,{size:"sm",onClick:()=>H(Oe),className:"bg-green-600 hover:bg-green-700 text-white",children:[a.jsx(Es,{className:"h-4 w-4 mr-1"}),"注册"]}),!Oe.is_banned&&a.jsxs(ie,{size:"sm",onClick:()=>fe(Oe),className:"bg-orange-600 hover:bg-orange-700 text-white",children:[a.jsx(cO,{className:"h-4 w-4 mr-1"}),"封禁"]}),a.jsxs(ie,{size:"sm",onClick:()=>P(Oe),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},Oe.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3",children:t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(Oe=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex gap-3",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("div",{className:"w-16 h-16 bg-muted rounded flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(Oe.id),alt:Oe.description||"表情包",className:"w-full h-full object-cover",onError:nt=>{const ut=nt.target;ut.style.display="none";const Ct=ut.parentElement;Ct&&(Ct.innerHTML='')}})})}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[a.jsxs("div",{className:"min-w-0 w-full overflow-hidden",children:[a.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",title:Oe.description||"无描述",children:Oe.description||"无描述"}),a.jsxs("p",{className:"text-xs text-muted-foreground font-mono line-clamp-1 w-full break-all",children:[Oe.emoji_hash.slice(0,16),"..."]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 items-center min-w-0",children:[a.jsx(On,{variant:"outline",className:"text-xs flex-shrink-0",children:Oe.format.toUpperCase()}),Oe.is_registered&&a.jsxs(On,{variant:"default",className:"bg-green-600 text-xs flex-shrink-0",children:[a.jsx(Es,{className:"h-3 w-3 mr-1"}),"已注册"]}),Oe.is_banned&&a.jsxs(On,{variant:"destructive",className:"text-xs flex-shrink-0",children:[a.jsx(Kb,{className:"h-3 w-3 mr-1"}),"已封禁"]}),a.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:["使用: ",Oe.usage_count]})]}),Oe.emotion&&Oe.emotion.length>0&&a.jsx("div",{className:"min-w-0 overflow-hidden",children:a.jsx(UN,{emotions:Oe.emotion})})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>me(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(co,{className:"h-3 w-3 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Y(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),!Oe.is_registered&&a.jsxs(ie,{size:"sm",onClick:()=>H(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-green-600 hover:bg-green-700 text-white",children:[a.jsx(Es,{className:"h-3 w-3 mr-1"}),"注册"]}),!Oe.is_banned&&a.jsxs(ie,{size:"sm",onClick:()=>fe(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-orange-600 hover:bg-orange-700 text-white",children:[a.jsx(cO,{className:"h-3 w-3 mr-1"}),"封禁"]}),a.jsxs(ie,{size:"sm",onClick:()=>P(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},Oe.id))}),d>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(l-1)*m+1," 到"," ",Math.min(l*m,d)," 条,共 ",d," 条"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(Oe=>Math.max(1,Oe-1)),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:$,onChange:Oe=>ae(Oe.target.value),onKeyDown:Oe=>Oe.key==="Enter"&&We(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/m)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:We,disabled:!$,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(Oe=>Oe+1),disabled:l>=Math.ceil(d/m),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(d/m)),disabled:l>=Math.ceil(d/m),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]}),a.jsx(dde,{emoji:_,open:E,onOpenChange:z}),a.jsx(hde,{emoji:_,open:Q,onOpenChange:F,onSuccess:()=>{ue(),R()}})]})}),a.jsx(pn,{open:W,onOpenChange:J,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["你确定要删除选中的 ",V.size," 个表情包吗?此操作不可撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:de,children:"确认删除"})]})]})}),a.jsx(Rr,{open:L,onOpenChange:U,children:a.jsxs(Nr,{children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"确认删除"}),a.jsx(Gr,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>U(!1),children:"取消"}),a.jsx(ie,{variant:"destructive",onClick:K,children:"删除"})]})]})})]})}function dde({emoji:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[90vh]",children:[a.jsx(Cr,{children:a.jsx(Tr,{children:"表情包详情"})}),a.jsx(mn,{className:"max-h-[calc(90vh-8rem)] pr-4",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex justify-center",children:a.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(t.id),alt:t.description||"表情包",className:"w-full h-full object-cover",onError:s=>{const i=s.target;i.style.display="none";const l=i.parentElement;l&&(l.innerHTML='')}})})}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"ID"}),a.jsx("div",{className:"mt-1 font-mono",children:t.id})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"格式"}),a.jsx("div",{className:"mt-1",children:a.jsx(On,{variant:"outline",children:t.format.toUpperCase()})})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"文件路径"}),a.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.full_path})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"哈希值"}),a.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.emoji_hash})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"描述"}),t.description?a.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:a.jsx(tde,{className:"prose-sm",children:t.description})}):a.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"情绪标签"}),a.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:(()=>{const s=t.emotion?t.emotion.split(/[,,]/).map(i=>i.trim()).filter(Boolean):[];return s.length>0?s.map((i,l)=>a.jsx(On,{variant:"secondary",children:i},l)):a.jsx("span",{className:"text-sm text-muted-foreground",children:"无"})})()})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"状态"}),a.jsxs("div",{className:"mt-2 flex gap-2",children:[t.is_registered&&a.jsx(On,{variant:"default",className:"bg-green-600",children:"已注册"}),t.is_banned&&a.jsx(On,{variant:"destructive",children:"已封禁"}),!t.is_registered&&!t.is_banned&&a.jsx(On,{variant:"outline",children:"未注册"})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"使用次数"}),a.jsx("div",{className:"mt-1 font-mono text-lg",children:t.usage_count})]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"记录时间"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.record_time)})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"注册时间"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.register_time)})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"最后使用"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.last_used_time)})]})]})})]})})}function hde({emoji:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState(""),[l,c]=S.useState(""),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState(!1),{toast:b}=Pr();S.useEffect(()=>{t&&(i(t.description||""),c(t.emotion||""),h(t.is_registered),p(t.is_banned))},[t]);const k=async()=>{if(t)try{v(!0);const O=l.split(/[,,]/).map(j=>j.trim()).filter(Boolean).join(",");await sde(t.id,{description:s||void 0,emotion:O||void 0,is_registered:d,is_banned:m}),b({title:"成功",description:"表情包信息已更新"}),n(!1),r()}catch(O){const j=O instanceof Error?O.message:"保存失败";b({title:"错误",description:j,variant:"destructive"})}finally{v(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑表情包"}),a.jsx(Gr,{children:"修改表情包的描述和标签信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(te,{children:"描述"}),a.jsx(_n,{value:s,onChange:O=>i(O.target.value),placeholder:"输入表情包描述...",rows:3,className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(te,{children:"情绪标签"}),a.jsx(Me,{value:l,onChange:O=>c(O.target.value),placeholder:"使用逗号分隔多个标签,如:开心, 微笑, 快乐",className:"mt-1"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入多个标签时使用逗号分隔(支持中英文逗号)"})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"is_registered",checked:d,onCheckedChange:O=>h(O===!0)}),a.jsx(te,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"is_banned",checked:m,onCheckedChange:O=>p(O===!0)}),a.jsx(te,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:k,disabled:x,children:x?"保存中...":"保存"})]})]})}):null}function UN({emotions:t}){const e=t?t.split(/[,,]/).map(i=>i.trim()).filter(Boolean):[];if(e.length===0)return a.jsx("span",{className:"text-xs text-muted-foreground",children:"-"});const n=(i,l=6)=>i.length<=l?i:i.slice(0,l)+"...",r=e.slice(0,3),s=e.length-3;return a.jsxs("div",{className:"flex flex-wrap gap-1 max-w-full overflow-hidden",children:[r.map((i,l)=>a.jsx(On,{variant:"secondary",className:"text-xs flex-shrink-0",title:i,children:n(i)},l)),s>0&&a.jsxs(On,{variant:"outline",className:"text-xs flex-shrink-0",title:`还有 ${s} 个标签: ${e.slice(3).join(", ")}`,children:["+",s]})]})}const Pc="/api/webui/expression";async function fde(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.chat_id&&e.append("chat_id",t.chat_id);const n=await ot(`${Pc}/list?${e}`,{headers:bt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取表达方式列表失败")}return n.json()}async function mde(t){const e=await ot(`${Pc}/${t}`,{headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取表达方式详情失败")}return e.json()}async function pde(t){const e=await ot(`${Pc}/`,{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"创建表达方式失败")}return e.json()}async function gde(t,e){const n=await ot(`${Pc}/${t}`,{method:"PATCH",headers:bt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新表达方式失败")}return n.json()}async function xde(t){const e=await ot(`${Pc}/${t}`,{method:"DELETE",headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除表达方式失败")}return e.json()}async function vde(t){const e=await ot(`${Pc}/batch/delete`,{method:"POST",headers:bt(),body:JSON.stringify({ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除表达方式失败")}return e.json()}async function yde(){const t=await ot(`${Pc}/stats/summary`,{headers:bt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}function bde(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(1),[d,h]=S.useState(20),[m,p]=S.useState(""),[x,v]=S.useState(null),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,A]=S.useState(!1),[_,D]=S.useState(null),[E,z]=S.useState(new Set),[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,ce]=S.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),{toast:W}=Pr(),J=async()=>{try{r(!0);const H=await fde({page:l,page_size:d,search:m||void 0});e(H.data),i(H.total)}catch(H){W({title:"加载失败",description:H instanceof Error?H.message:"无法加载表达方式",variant:"destructive"})}finally{r(!1)}},$=async()=>{try{const H=await yde();ce(H.data)}catch(H){console.error("加载统计数据失败:",H)}};S.useEffect(()=>{J(),$()},[l,d,m]);const ae=async H=>{try{const fe=await mde(H.id);v(fe.data),k(!0)}catch(fe){W({title:"加载详情失败",description:fe instanceof Error?fe.message:"无法加载表达方式详情",variant:"destructive"})}},ne=H=>{v(H),j(!0)},ue=async H=>{try{await xde(H.id),W({title:"删除成功",description:`已删除表达方式: ${H.situation}`}),D(null),J(),$()}catch(fe){W({title:"删除失败",description:fe instanceof Error?fe.message:"无法删除表达方式",variant:"destructive"})}},R=H=>{const fe=new Set(E);fe.has(H)?fe.delete(H):fe.add(H),z(fe)},me=()=>{E.size===t.length&&t.length>0?z(new Set):z(new Set(t.map(H=>H.id)))},Y=async()=>{try{await vde(Array.from(E)),W({title:"批量删除成功",description:`已删除 ${E.size} 个表达方式`}),z(new Set),F(!1),J(),$()}catch(H){W({title:"批量删除失败",description:H instanceof Error?H.message:"无法批量删除表达方式",variant:"destructive"})}},P=()=>{const H=parseInt(L),fe=Math.ceil(s/d);H>=1&&H<=fe?(c(H),U("")):W({title:"无效的页码",description:`请输入1-${fe}之间的页码`,variant:"destructive"})},K=H=>H?new Date(H*1e3).toLocaleString("zh-CN"):"-";return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsx("div",{className:"mb-4 sm:mb-6",children:a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[a.jsx(Wf,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),a.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),a.jsxs(ie,{onClick:()=>A(!0),className:"gap-2",children:[a.jsx(Wr,{className:"h-4 w-4"}),"新增表达方式"]})]})}),a.jsx(mn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),a.jsx("div",{className:"text-2xl font-bold mt-1",children:V.total})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:V.recent_7days})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:V.chat_count})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx(te,{htmlFor:"search",children:"搜索"}),a.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Bs,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{id:"search",placeholder:"搜索情境、风格或上下文...",value:m,onChange:H=>p(H.target.value),className:"pl-9"})]})}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:E.size>0&&a.jsxs("span",{children:["已选择 ",E.size," 个表达方式"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:d.toString(),onValueChange:H=>{h(parseInt(H)),c(1),z(new Set)},children:[a.jsx(Dt,{id:"page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),E.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>z(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:()=>F(!0),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card",children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:E.size===t.length&&t.length>0,onCheckedChange:me})}),a.jsx(xt,{children:"情境"}),a.jsx(xt,{children:"风格"}),a.jsx(xt,{children:"聊天ID"}),a.jsx(xt,{children:"最后活跃"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n?a.jsx(xr,{children:a.jsx(it,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(H=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:E.has(H.id),onCheckedChange:()=>R(H.id)})}),a.jsx(it,{className:"font-medium max-w-xs truncate",children:H.situation}),a.jsx(it,{className:"max-w-xs truncate",children:H.style}),a.jsx(it,{className:"font-mono text-sm",children:H.chat_id}),a.jsx(it,{className:"text-sm text-muted-foreground",children:K(H.last_active_time)}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ae(H),children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ne(H),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>D(H),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},H.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(H=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ss,{checked:E.has(H.id),onCheckedChange:()=>R(H.id),className:"mt-1"}),a.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),a.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:H.situation,children:H.situation})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),a.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:H.style,children:H.style})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天ID"}),a.jsx("p",{className:"font-mono text-xs truncate",children:H.chat_id})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后活跃"}),a.jsx("p",{className:"text-xs",children:K(H.last_active_time)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(H),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx($i,{className:"h-3 w-3 mr-1"}),"查看"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ne(H),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>D(H),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},H.id))}),s>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",l," / ",Math.ceil(s/d)," 页"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l-1),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:L,onChange:H=>U(H.target.value),onKeyDown:H=>H.key==="Enter"&&P(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/d)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:P,disabled:!L,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l+1),disabled:l>=Math.ceil(s/d),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(s/d)),disabled:l>=Math.ceil(s/d),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]})}),a.jsx(wde,{expression:x,open:b,onOpenChange:k}),a.jsx(Sde,{open:T,onOpenChange:A,onSuccess:()=>{J(),$(),A(!1)}}),a.jsx(kde,{expression:x,open:O,onOpenChange:j,onSuccess:()=>{J(),$(),j(!1)}}),a.jsx(pn,{open:!!_,onOpenChange:()=>D(null),children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除表达方式 "',_?.situation,'" 吗? 此操作不可撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>_&&ue(_),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),a.jsx(Ode,{open:Q,onOpenChange:F,onConfirm:Y,count:E.size})]})}function wde({expression:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"表达方式详情"}),a.jsx(Gr,{children:"查看表达方式的完整信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Au,{label:"情境",value:t.situation}),a.jsx(Au,{label:"风格",value:t.style}),a.jsx(Au,{icon:mg,label:"聊天ID",value:t.chat_id,mono:!0}),a.jsx(Au,{icon:mg,label:"记录ID",value:t.id.toString(),mono:!0})]}),t.context&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"上下文"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.context})]}),t.up_content&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"上文内容"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.up_content})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Au,{icon:dc,label:"最后活跃",value:r(t.last_active_time)}),a.jsx(Au,{icon:dc,label:"创建时间",value:r(t.create_date)})]})]}),a.jsx(ps,{children:a.jsx(ie,{onClick:()=>n(!1),children:"关闭"})})]})})}function Au({icon:t,label:e,value:n,mono:r=!1}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs(te,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&a.jsx(t,{className:"h-3 w-3"}),e]}),a.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Sde({open:t,onOpenChange:e,onSuccess:n}){const[r,s]=S.useState({situation:"",style:"",context:"",up_content:"",chat_id:""}),[i,l]=S.useState(!1),{toast:c}=Pr(),d=async()=>{if(!r.situation||!r.style||!r.chat_id){c({title:"验证失败",description:"请填写必填字段:情境、风格和聊天ID",variant:"destructive"});return}try{l(!0),await pde(r),c({title:"创建成功",description:"表达方式已创建"}),s({situation:"",style:"",context:"",up_content:"",chat_id:""}),n()}catch(h){c({title:"创建失败",description:h instanceof Error?h.message:"无法创建表达方式",variant:"destructive"})}finally{l(!1)}};return a.jsx(Rr,{open:t,onOpenChange:e,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"新增表达方式"}),a.jsx(Gr,{children:"创建新的表达方式记录"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"situation",children:["情境 ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Me,{id:"situation",value:r.situation,onChange:h=>s({...r,situation:h.target.value}),placeholder:"描述使用场景"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"style",children:["风格 ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Me,{id:"style",value:r.style,onChange:h=>s({...r,style:h.target.value}),placeholder:"描述表达风格"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"chat_id",children:["聊天ID ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Me,{id:"chat_id",value:r.chat_id,onChange:h=>s({...r,chat_id:h.target.value}),placeholder:"关联的聊天ID"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"context",children:"上下文"}),a.jsx(_n,{id:"context",value:r.context,onChange:h=>s({...r,context:h.target.value}),placeholder:"上下文信息(可选)",rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"up_content",children:"上文内容"}),a.jsx(_n,{id:"up_content",value:r.up_content,onChange:h=>s({...r,up_content:h.target.value}),placeholder:"上文内容(可选)",rows:3})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>e(!1),children:"取消"}),a.jsx(ie,{onClick:d,disabled:i,children:i?"创建中...":"创建"})]})]})})}function kde({expression:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState({}),[l,c]=S.useState(!1),{toast:d}=Pr();S.useEffect(()=>{t&&i({situation:t.situation,style:t.style,context:t.context||"",up_content:t.up_content||"",chat_id:t.chat_id})},[t]);const h=async()=>{if(t)try{c(!0),await gde(t.id,s),d({title:"保存成功",description:"表达方式已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新表达方式",variant:"destructive"})}finally{c(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑表达方式"}),a.jsx(Gr,{children:"修改表达方式的信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_situation",children:"情境"}),a.jsx(Me,{id:"edit_situation",value:s.situation||"",onChange:m=>i({...s,situation:m.target.value}),placeholder:"描述使用场景"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_style",children:"风格"}),a.jsx(Me,{id:"edit_style",value:s.style||"",onChange:m=>i({...s,style:m.target.value}),placeholder:"描述表达风格"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_chat_id",children:"聊天ID"}),a.jsx(Me,{id:"edit_chat_id",value:s.chat_id||"",onChange:m=>i({...s,chat_id:m.target.value}),placeholder:"关联的聊天ID"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_context",children:"上下文"}),a.jsx(_n,{id:"edit_context",value:s.context||"",onChange:m=>i({...s,context:m.target.value}),placeholder:"上下文信息",rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_up_content",children:"上文内容"}),a.jsx(_n,{id:"edit_up_content",value:s.up_content||"",onChange:m=>i({...s,up_content:m.target.value}),placeholder:"上文内容",rows:3})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:h,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function Ode({open:t,onOpenChange:e,onConfirm:n,count:r}){return a.jsx(pn,{open:t,onOpenChange:e,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["您即将删除 ",r," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const Pd="/api/webui/person";async function jde(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.is_known!==void 0&&e.append("is_known",t.is_known.toString()),t.platform&&e.append("platform",t.platform);const n=await ot(`${Pd}/list?${e}`,{headers:bt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取人物列表失败")}return n.json()}async function Nde(t){const e=await ot(`${Pd}/${t}`,{headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取人物详情失败")}return e.json()}async function Cde(t,e){const n=await ot(`${Pd}/${t}`,{method:"PATCH",headers:bt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新人物信息失败")}return n.json()}async function Tde(t){const e=await ot(`${Pd}/${t}`,{method:"DELETE",headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除人物信息失败")}return e.json()}async function Ade(){const t=await ot(`${Pd}/stats/summary`,{headers:bt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}async function Mde(t){const e=await ot(`${Pd}/batch/delete`,{method:"POST",headers:bt(),body:JSON.stringify({person_ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除失败")}return e.json()}function Ede(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(1),[d,h]=S.useState(20),[m,p]=S.useState(""),[x,v]=S.useState(void 0),[b,k]=S.useState(void 0),[O,j]=S.useState(null),[T,A]=S.useState(!1),[_,D]=S.useState(!1),[E,z]=S.useState(null),[Q,F]=S.useState({total:0,known:0,unknown:0,platforms:{}}),[L,U]=S.useState(new Set),[V,ce]=S.useState(!1),[W,J]=S.useState(""),{toast:$}=Pr(),ae=async()=>{try{r(!0);const de=await jde({page:l,page_size:d,search:m||void 0,is_known:x,platform:b});e(de.data),i(de.total)}catch(de){$({title:"加载失败",description:de instanceof Error?de.message:"无法加载人物信息",variant:"destructive"})}finally{r(!1)}},ne=async()=>{try{const de=await Ade();F(de.data)}catch(de){console.error("加载统计数据失败:",de)}};S.useEffect(()=>{ae(),ne()},[l,d,m,x,b]);const ue=async de=>{try{const We=await Nde(de.person_id);j(We.data),A(!0)}catch(We){$({title:"加载详情失败",description:We instanceof Error?We.message:"无法加载人物详情",variant:"destructive"})}},R=de=>{j(de),D(!0)},me=async de=>{try{await Tde(de.person_id),$({title:"删除成功",description:`已删除人物信息: ${de.person_name||de.nickname||de.user_id}`}),z(null),ae(),ne()}catch(We){$({title:"删除失败",description:We instanceof Error?We.message:"无法删除人物信息",variant:"destructive"})}},Y=S.useMemo(()=>Object.keys(Q.platforms),[Q.platforms]),P=de=>{const We=new Set(L);We.has(de)?We.delete(de):We.add(de),U(We)},K=()=>{L.size===t.length&&t.length>0?U(new Set):U(new Set(t.map(de=>de.person_id)))},H=()=>{if(L.size===0){$({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}ce(!0)},fe=async()=>{try{const de=await Mde(Array.from(L));$({title:"批量删除完成",description:de.message}),U(new Set),ce(!1),ae(),ne()}catch(de){$({title:"批量删除失败",description:de instanceof Error?de.message:"批量删除失败",variant:"destructive"})}},ve=()=>{const de=parseInt(W),We=Math.ceil(s/d);de>=1&&de<=We?(c(de),J("")):$({title:"无效的页码",description:`请输入1-${We}之间的页码`,variant:"destructive"})},Re=de=>de?new Date(de*1e3).toLocaleString("zh-CN"):"-";return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsx("div",{className:"mb-4 sm:mb-6",children:a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[a.jsx(Oq,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),a.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),a.jsx(mn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),a.jsx("div",{className:"text-2xl font-bold mt-1",children:Q.total})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:Q.known})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:Q.unknown})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"sm:col-span-2",children:[a.jsx(te,{htmlFor:"search",children:"搜索"}),a.jsxs("div",{className:"relative mt-1.5",children:[a.jsx(Bs,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:m,onChange:de=>p(de.target.value),className:"pl-9"})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"filter-known",children:"认识状态"}),a.jsxs(Lt,{value:x===void 0?"all":x.toString(),onValueChange:de=>{v(de==="all"?void 0:de==="true"),c(1)},children:[a.jsx(Dt,{id:"filter-known",className:"mt-1.5",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"true",children:"已认识"}),a.jsx(Pe,{value:"false",children:"未认识"})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"filter-platform",children:"平台"}),a.jsxs(Lt,{value:b||"all",onValueChange:de=>{k(de==="all"?void 0:de),c(1)},children:[a.jsx(Dt,{id:"filter-platform",className:"mt-1.5",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部平台"}),Y.map(de=>a.jsxs(Pe,{value:de,children:[de," (",Q.platforms[de],")"]},de))]})]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:L.size>0&&a.jsxs("span",{children:["已选择 ",L.size," 个人物"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:d.toString(),onValueChange:de=>{h(parseInt(de)),c(1),U(new Set)},children:[a.jsx(Dt,{id:"page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),L.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>U(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:H,children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card",children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:t.length>0&&L.size===t.length,onCheckedChange:K,"aria-label":"全选"})}),a.jsx(xt,{children:"状态"}),a.jsx(xt,{children:"名称"}),a.jsx(xt,{children:"昵称"}),a.jsx(xt,{children:"平台"}),a.jsx(xt,{children:"用户ID"}),a.jsx(xt,{children:"最后更新"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(de=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:L.has(de.person_id),onCheckedChange:()=>P(de.person_id),"aria-label":`选择 ${de.person_name||de.nickname||de.user_id}`})}),a.jsx(it,{children:a.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",de.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:de.is_known?"已认识":"未认识"})}),a.jsx(it,{className:"font-medium",children:de.person_name||a.jsx("span",{className:"text-muted-foreground",children:"-"})}),a.jsx(it,{children:de.nickname||"-"}),a.jsx(it,{children:de.platform}),a.jsx(it,{className:"font-mono text-sm",children:de.user_id}),a.jsx(it,{className:"text-sm text-muted-foreground",children:Re(de.last_know)}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ue(de),children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>R(de),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>z(de),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},de.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(de=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ss,{checked:L.has(de.person_id),onCheckedChange:()=>P(de.person_id),className:"mt-1"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",de.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:de.is_known?"已认识":"未认识"}),a.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:de.person_name||a.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),de.nickname&&a.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",de.nickname]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),a.jsx("p",{className:"font-medium text-xs",children:de.platform})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),a.jsx("p",{className:"font-mono text-xs truncate",title:de.user_id,children:de.user_id})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),a.jsx("p",{className:"text-xs",children:Re(de.last_know)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ue(de),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx($i,{className:"h-3 w-3 mr-1"}),"查看"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>R(de),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>z(de),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},de.id))}),s>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",l," / ",Math.ceil(s/d)," 页"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l-1),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:W,onChange:de=>J(de.target.value),onKeyDown:de=>de.key==="Enter"&&ve(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/d)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:ve,disabled:!W,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l+1),disabled:l>=Math.ceil(s/d),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(s/d)),disabled:l>=Math.ceil(s/d),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]})}),a.jsx(_de,{person:O,open:T,onOpenChange:A}),a.jsx(Dde,{person:O,open:_,onOpenChange:D,onSuccess:()=>{ae(),ne(),D(!1)}}),a.jsx(pn,{open:!!E,onOpenChange:()=>z(null),children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除人物信息 "',E?.person_name||E?.nickname||E?.user_id,'" 吗? 此操作不可撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>E&&me(E),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),a.jsx(pn,{open:V,onOpenChange:ce,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["确定要删除选中的 ",L.size," 个人物信息吗? 此操作不可撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:fe,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function _de({person:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"人物详情"}),a.jsxs(Gr,{children:["查看 ",t.person_name||t.nickname||t.user_id," 的完整信息"]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Za,{icon:D9,label:"人物名称",value:t.person_name}),a.jsx(Za,{icon:Wf,label:"昵称",value:t.nickname}),a.jsx(Za,{icon:mg,label:"用户ID",value:t.user_id,mono:!0}),a.jsx(Za,{icon:mg,label:"人物ID",value:t.person_id,mono:!0}),a.jsx(Za,{label:"平台",value:t.platform}),a.jsx(Za,{label:"状态",value:t.is_known?"已认识":"未认识"})]}),t.name_reason&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),a.jsx("p",{className:"mt-1 text-sm",children:t.name_reason})]}),t.memory_points&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"个人印象"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.memory_points})]}),t.group_nick_name&&t.group_nick_name.length>0&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"群昵称"}),a.jsx("div",{className:"mt-2 space-y-1",children:t.group_nick_name.map((s,i)=>a.jsxs("div",{className:"text-sm flex items-center gap-2",children:[a.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:s.group_id}),a.jsx("span",{children:"→"}),a.jsx("span",{children:s.group_nick_name})]},i))})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsx(Za,{icon:dc,label:"认识时间",value:r(t.know_times)}),a.jsx(Za,{icon:dc,label:"首次记录",value:r(t.know_since)}),a.jsx(Za,{icon:dc,label:"最后更新",value:r(t.last_know)})]})]}),a.jsx(ps,{children:a.jsx(ie,{onClick:()=>n(!1),children:"关闭"})})]})})}function Za({icon:t,label:e,value:n,mono:r=!1}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs(te,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&a.jsx(t,{className:"h-3 w-3"}),e]}),a.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Dde({person:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState({}),[l,c]=S.useState(!1),{toast:d}=Pr();S.useEffect(()=>{t&&i({person_name:t.person_name||"",name_reason:t.name_reason||"",nickname:t.nickname||"",memory_points:t.memory_points||"",is_known:t.is_known})},[t]);const h=async()=>{if(t)try{c(!0),await Cde(t.person_id,s),d({title:"保存成功",description:"人物信息已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新人物信息",variant:"destructive"})}finally{c(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑人物信息"}),a.jsxs(Gr,{children:["修改 ",t.person_name||t.nickname||t.user_id," 的信息"]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"person_name",children:"人物名称"}),a.jsx(Me,{id:"person_name",value:s.person_name||"",onChange:m=>i({...s,person_name:m.target.value}),placeholder:"为这个人设置一个名称"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称"}),a.jsx(Me,{id:"nickname",value:s.nickname||"",onChange:m=>i({...s,nickname:m.target.value}),placeholder:"昵称"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"name_reason",children:"名称设定原因"}),a.jsx(_n,{id:"name_reason",value:s.name_reason||"",onChange:m=>i({...s,name_reason:m.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"memory_points",children:"个人印象"}),a.jsx(_n,{id:"memory_points",value:s.memory_points||"",onChange:m=>i({...s,memory_points:m.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),a.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[a.jsxs("div",{children:[a.jsx(te,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),a.jsx(jt,{id:"is_known",checked:s.is_known,onCheckedChange:m=>i({...s,is_known:m})})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:h,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function Rde(t,e,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:n}).format(e).split(/\s/g).slice(2).join(" ")}const zde={},Wh={};function uc(t,e){try{const r=(zde[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in Wh?Wh[r]:VN(r,r.split(":"))}catch{if(t in Wh)return Wh[t];const n=t?.match(Pde);return n?VN(t,n.slice(1)):NaN}}const Pde=/([+-]\d\d):?(\d\d)?/;function VN(t,e){const n=+(e[0]||0),r=+(e[1]||0),s=+(e[2]||0)/60;return Wh[t]=n*60+r>0?n*60+r+s:n*60-r-s}class xa extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(uc(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),lz(this),R4(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new xa(...n,e):new xa(Date.now(),e)}withTimeZone(e){return new xa(+this,e)}getTimezoneOffset(){const e=-uc(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),R4(this),+this}[Symbol.for("constructDateFrom")](e){return new xa(+new Date(e),this.timeZone)}}const WN=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!WN.test(t))return;const e=t.replace(WN,"$1UTC");xa.prototype[e]&&(t.startsWith("get")?xa.prototype[t]=function(){return this.internal[e]()}:(xa.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),Bde(this),+this},xa.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),R4(this),+this}))});function R4(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-uc(t.timeZone,t)*60))}function Bde(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),lz(t)}function lz(t){const e=uc(t.timeZone,t),n=e>0?Math.floor(e):Math.ceil(e),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const s=-new Date(+t).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),l=s-i,c=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();l&&c&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+l);const d=s-n;d&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+d);const h=new Date(+t);h.setUTCSeconds(0);const m=s>0?h.getSeconds():(h.getSeconds()-60)%60,p=Math.round(-(uc(t.timeZone,t)*60))%60;(p||m)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+p),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+p+m));const x=uc(t.timeZone,t),v=x>0?Math.floor(x):Math.ceil(x),k=-new Date(+t).getTimezoneOffset()-v,O=v!==n,j=k-d;if(O&&j){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+j);const T=uc(t.timeZone,t),A=T>0?Math.floor(T):Math.ceil(T),_=v-A;_&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+_),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+_))}}class Zr extends xa{static tz(e,...n){return n.length?new Zr(...n,e):new Zr(Date.now(),e)}toISOString(){const[e,n,r]=this.tzComponents(),s=`${e}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,n,r,s]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${r} ${n} ${s}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[n,r,s]=this.tzComponents();return`${e} GMT${n}${r}${s} (${Rde(this.timeZone,this)})`}toLocaleString(e,n){return Date.prototype.toLocaleString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(e,n){return Date.prototype.toLocaleDateString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(e,n){return Date.prototype.toLocaleTimeString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),n=e>0?"-":"+",r=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),s=String(Math.abs(e)%60).padStart(2,"0");return[n,r,s]}withTimeZone(e){return new Zr(+this,e)}[Symbol.for("constructDateFrom")](e){return new Zr(+new Date(e),this.timeZone)}}const oz=6048e5,Lde=864e5,GN=Symbol.for("constructDateFrom");function vr(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&GN in t?t[GN](e):t instanceof Date?new t.constructor(e):new Date(e)}function Nn(t,e){return vr(e||t,t)}function cz(t,e,n){const r=Nn(t,n?.in);return isNaN(e)?vr(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function uz(t,e,n){const r=Nn(t,n?.in);if(isNaN(e))return vr(t,NaN);if(!e)return r;const s=r.getDate(),i=vr(t,r.getTime());i.setMonth(r.getMonth()+e+1,0);const l=i.getDate();return s>=l?i:(r.setFullYear(i.getFullYear(),i.getMonth(),s),r)}let Ide={};function O0(){return Ide}function So(t,e){const n=O0(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Nn(t,e?.in),i=s.getDay(),l=(i=i.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function XN(t){const e=Nn(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Bc(t,...e){const n=vr.bind(null,t||e.find(r=>typeof r=="object"));return e.map(n)}function Qf(t,e){const n=Nn(t,e?.in);return n.setHours(0,0,0,0),n}function hz(t,e,n){const[r,s]=Bc(n?.in,t,e),i=Qf(r),l=Qf(s),c=+i-XN(i),d=+l-XN(l);return Math.round((c-d)/Lde)}function qde(t,e){const n=dz(t,e),r=vr(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Ff(r)}function Fde(t,e,n){return cz(t,e*7,n)}function Qde(t,e,n){return uz(t,e*12,n)}function $de(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=vr.bind(null,s));const i=Nn(s,r);(!n||n{!r&&typeof s=="object"&&(r=vr.bind(null,s));const i=Nn(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),vr(r,n||NaN)}function Ude(t,e,n){const[r,s]=Bc(n?.in,t,e);return+Qf(r)==+Qf(s)}function fz(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Vde(t){return!(!fz(t)&&typeof t!="number"||isNaN(+Nn(t)))}function Wde(t,e,n){const[r,s]=Bc(n?.in,t,e),i=r.getFullYear()-s.getFullYear(),l=r.getMonth()-s.getMonth();return i*12+l}function Gde(t,e){const n=Nn(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function mz(t,e){const[n,r]=Bc(t,e.start,e.end);return{start:n,end:r}}function Xde(t,e){const{start:n,end:r}=mz(e?.in,t);let s=+n>+r;const i=s?+n:+r,l=s?r:n;l.setHours(0,0,0,0),l.setDate(1);let c=1;const d=[];for(;+l<=i;)d.push(vr(n,l)),l.setMonth(l.getMonth()+c);return s?d.reverse():d}function Yde(t,e){const n=Nn(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Kde(t,e){const n=Nn(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function pz(t,e){const n=Nn(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Zde(t,e){const{start:n,end:r}=mz(e?.in,t);let s=+n>+r;const i=s?+n:+r,l=s?r:n;l.setHours(0,0,0,0),l.setMonth(0,1);let c=1;const d=[];for(;+l<=i;)d.push(vr(n,l)),l.setFullYear(l.getFullYear()+c);return s?d.reverse():d}function gz(t,e){const n=O0(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Nn(t,e?.in),i=s.getDay(),l=(i{let r;const s=ehe[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function td(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const nhe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},rhe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},she={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ihe={date:td({formats:nhe,defaultWidth:"full"}),time:td({formats:rhe,defaultWidth:"full"}),dateTime:td({formats:she,defaultWidth:"full"})},ahe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},lhe=(t,e,n,r)=>ahe[t];function ua(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const l=t.defaultFormattingWidth||t.defaultWidth,c=n?.width?String(n.width):l;s=t.formattingValues[c]||t.formattingValues[l]}else{const l=t.defaultWidth,c=n?.width?String(n.width):t.defaultWidth;s=t.values[c]||t.values[l]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const ohe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},che={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},uhe={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},dhe={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},hhe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},fhe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},mhe=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},phe={ordinalNumber:mhe,era:ua({values:ohe,defaultWidth:"wide"}),quarter:ua({values:che,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ua({values:uhe,defaultWidth:"wide"}),day:ua({values:dhe,defaultWidth:"wide"}),dayPeriod:ua({values:hhe,defaultWidth:"wide",formattingValues:fhe,defaultFormattingWidth:"wide"})};function da(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const l=i[0],c=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],d=Array.isArray(c)?xhe(c,p=>p.test(l)):ghe(c,p=>p.test(l));let h;h=t.valueCallback?t.valueCallback(d):d,h=n.valueCallback?n.valueCallback(h):h;const m=e.slice(l.length);return{value:h,rest:m}}}function ghe(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function xhe(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let l=t.valueCallback?t.valueCallback(i[0]):i[0];l=n.valueCallback?n.valueCallback(l):l;const c=e.slice(s.length);return{value:l,rest:c}}}const vhe=/^(\d+)(th|st|nd|rd)?/i,yhe=/\d+/i,bhe={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},whe={any:[/^b/i,/^(a|c)/i]},She={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},khe={any:[/1/i,/2/i,/3/i,/4/i]},Ohe={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},jhe={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Nhe={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Che={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},The={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Ahe={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Mhe={ordinalNumber:xz({matchPattern:vhe,parsePattern:yhe,valueCallback:t=>parseInt(t,10)}),era:da({matchPatterns:bhe,defaultMatchWidth:"wide",parsePatterns:whe,defaultParseWidth:"any"}),quarter:da({matchPatterns:She,defaultMatchWidth:"wide",parsePatterns:khe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:da({matchPatterns:Ohe,defaultMatchWidth:"wide",parsePatterns:jhe,defaultParseWidth:"any"}),day:da({matchPatterns:Nhe,defaultMatchWidth:"wide",parsePatterns:Che,defaultParseWidth:"any"}),dayPeriod:da({matchPatterns:The,defaultMatchWidth:"any",parsePatterns:Ahe,defaultParseWidth:"any"})},G5={code:"en-US",formatDistance:the,formatLong:ihe,formatRelative:lhe,localize:phe,match:Mhe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ehe(t,e){const n=Nn(t,e?.in);return hz(n,pz(n))+1}function vz(t,e){const n=Nn(t,e?.in),r=+Ff(n)-+qde(n);return Math.round(r/oz)+1}function yz(t,e){const n=Nn(t,e?.in),r=n.getFullYear(),s=O0(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,l=vr(e?.in||t,0);l.setFullYear(r+1,0,i),l.setHours(0,0,0,0);const c=So(l,e),d=vr(e?.in||t,0);d.setFullYear(r,0,i),d.setHours(0,0,0,0);const h=So(d,e);return+n>=+c?r+1:+n>=+h?r:r-1}function _he(t,e){const n=O0(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=yz(t,e),i=vr(e?.in||t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),So(i,e)}function bz(t,e){const n=Nn(t,e?.in),r=+So(n,e)-+_he(n,e);return Math.round(r/oz)+1}function vn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const Zl={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return vn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):vn(n+1,2)},d(t,e){return vn(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return vn(t.getHours()%12||12,e.length)},H(t,e){return vn(t.getHours(),e.length)},m(t,e){return vn(t.getMinutes(),e.length)},s(t,e){return vn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return vn(s,e.length)}},Mu={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},YN={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return Zl.y(t,e)},Y:function(t,e,n,r){const s=yz(t,r),i=s>0?s:1-s;if(e==="YY"){const l=i%100;return vn(l,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):vn(i,e.length)},R:function(t,e){const n=dz(t);return vn(n,e.length)},u:function(t,e){const n=t.getFullYear();return vn(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return vn(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return vn(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return Zl.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return vn(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const s=bz(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):vn(s,e.length)},I:function(t,e,n){const r=vz(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):vn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Zl.d(t,e)},D:function(t,e,n){const r=Ehe(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):vn(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return vn(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return vn(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return vn(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let s;switch(r===12?s=Mu.noon:r===0?s=Mu.midnight:s=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let s;switch(r>=17?s=Mu.evening:r>=12?s=Mu.afternoon:r>=4?s=Mu.morning:s=Mu.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Zl.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Zl.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):vn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):vn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Zl.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Zl.s(t,e)},S:function(t,e){return Zl.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return ZN(r);case"XXXX":case"XX":return rc(r);case"XXXXX":case"XXX":default:return rc(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return ZN(r);case"xxxx":case"xx":return rc(r);case"xxxxx":case"xxx":default:return rc(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+KN(r,":");case"OOOO":default:return"GMT"+rc(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+KN(r,":");case"zzzz":default:return"GMT"+rc(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return vn(r,e.length)},T:function(t,e,n){return vn(+t,e.length)}};function KN(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+e+vn(i,2)}function ZN(t,e){return t%60===0?(t>0?"-":"+")+vn(Math.abs(t)/60,2):rc(t,e)}function rc(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=vn(Math.trunc(r/60),2),i=vn(r%60,2);return n+s+e+i}const JN=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},wz=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Dhe=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return JN(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",JN(r,e)).replace("{{time}}",wz(s,e))},Rhe={p:wz,P:Dhe},zhe=/^D+$/,Phe=/^Y+$/,Bhe=["D","DD","YY","YYYY"];function Lhe(t){return zhe.test(t)}function Ihe(t){return Phe.test(t)}function qhe(t,e,n){const r=Fhe(t,e,n);if(console.warn(r),Bhe.includes(t))throw new RangeError(r)}function Fhe(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Qhe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,$he=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Hhe=/^'([^]*?)'?$/,Uhe=/''/g,Vhe=/[a-zA-Z]/;function dg(t,e,n){const r=O0(),s=n?.locale??r.locale??G5,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,l=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,c=Nn(t,n?.in);if(!Vde(c))throw new RangeError("Invalid time value");let d=e.match($he).map(m=>{const p=m[0];if(p==="p"||p==="P"){const x=Rhe[p];return x(m,s.formatLong)}return m}).join("").match(Qhe).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const p=m[0];if(p==="'")return{isToken:!1,value:Whe(m)};if(YN[p])return{isToken:!0,value:m};if(p.match(Vhe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+p+"`");return{isToken:!1,value:m}});s.localize.preprocessor&&(d=s.localize.preprocessor(c,d));const h={firstWeekContainsDate:i,weekStartsOn:l,locale:s};return d.map(m=>{if(!m.isToken)return m.value;const p=m.value;(!n?.useAdditionalWeekYearTokens&&Ihe(p)||!n?.useAdditionalDayOfYearTokens&&Lhe(p))&&qhe(p,e,String(t));const x=YN[p[0]];return x(c,p,s.localize,h)}).join("")}function Whe(t){const e=t.match(Hhe);return e?e[1].replace(Uhe,"'"):t}function Ghe(t,e){const n=Nn(t,e?.in),r=n.getFullYear(),s=n.getMonth(),i=vr(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function Xhe(t,e){return Nn(t,e?.in).getMonth()}function Yhe(t,e){return Nn(t,e?.in).getFullYear()}function Khe(t,e){return+Nn(t)>+Nn(e)}function Zhe(t,e){return+Nn(t)<+Nn(e)}function Jhe(t,e,n){const[r,s]=Bc(n?.in,t,e);return+So(r,n)==+So(s,n)}function efe(t,e,n){const[r,s]=Bc(n?.in,t,e);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function tfe(t,e,n){const[r,s]=Bc(n?.in,t,e);return r.getFullYear()===s.getFullYear()}function nfe(t,e,n){const r=Nn(t,n?.in),s=r.getFullYear(),i=r.getDate(),l=vr(t,0);l.setFullYear(s,e,15),l.setHours(0,0,0,0);const c=Ghe(l);return r.setMonth(e,Math.min(i,c)),r}function rfe(t,e,n){const r=Nn(t,n?.in);return isNaN(+r)?vr(t,NaN):(r.setFullYear(e),r)}const e9=5,sfe=4;function ife(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,s=e.addDays(t,-r+1),i=e.addDays(s,e9*7-1);return e.getMonth(t)===e.getMonth(i)?e9:sfe}function Sz(t,e){const n=e.startOfMonth(t),r=n.getDay();return r===1?n:r===0?e.addDays(n,-6):e.addDays(n,-1*(r-1))}function afe(t,e){const n=Sz(t,e),r=ife(t,e);return e.addDays(n,r*7-1)}class ai{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Zr.tz(this.options.timeZone):new this.Date,this.newDate=(r,s,i)=>this.overrides?.newDate?this.overrides.newDate(r,s,i):this.options.timeZone?new Zr(r,s,i,this.options.timeZone):new Date(r,s,i),this.addDays=(r,s)=>this.overrides?.addDays?this.overrides.addDays(r,s):cz(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):uz(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):Fde(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):Qde(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):hz(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):Wde(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Xde(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):Zde(r),i=new Set(s.map(c=>this.getYear(c)));if(i.size===s.length)return s;const l=[];return i.forEach(c=>{l.push(new Date(c,0,1))}),l},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):afe(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):Jde(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):Gde(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):gz(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):Kde(r),this.format=(r,s,i)=>{const l=this.overrides?.format?this.overrides.format(r,s,this.options):dg(r,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(l):l},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):vz(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):Xhe(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):Yhe(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):bz(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):Khe(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):Zhe(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):fz(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):Ude(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):efe(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):tfe(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):$de(r),this.min=r=>this.overrides?.min?this.overrides.min(r):Hde(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):nfe(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):rfe(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):Sz(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):Qf(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Ff(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):Yde(r),this.startOfWeek=(r,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):So(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):pz(r),this.options={locale:G5,...e},this.overrides=n}getDigitMap(){const{numerals:e="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:e}),r={};for(let s=0;s<10;s++)r[s.toString()]=n.format(s);return r}replaceDigits(e){const n=this.getDigitMap();return e.replace(/\d/g,r=>n[r]||r)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&ai.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:s}=this.options,i=n?.code;if(i&&ai.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:s}).format(e)}catch{}const l=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,l)}}ai.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Ma=new ai;class kz{constructor(e,n,r=Ma){this.date=e,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(e,n)),this.dateLib=r}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class lfe{constructor(e,n){this.date=e,this.weeks=n}}class ofe{constructor(e,n){this.days=n,this.weekNumber=e}}function cfe(t){return Ue.createElement("button",{...t})}function ufe(t){return Ue.createElement("span",{...t})}function dfe(t){const{size:e=24,orientation:n="left",className:r}=t;return Ue.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&Ue.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&Ue.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&Ue.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&Ue.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function hfe(t){const{day:e,modifiers:n,...r}=t;return Ue.createElement("td",{...r})}function ffe(t){const{day:e,modifiers:n,...r}=t,s=Ue.useRef(null);return Ue.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),Ue.createElement("button",{ref:s,...r})}var et;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})(et||(et={}));var Yn;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(Yn||(Yn={}));var qi;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(qi||(qi={}));var ti;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(ti||(ti={}));function mfe(t){const{options:e,className:n,components:r,classNames:s,...i}=t,l=[s[et.Dropdown],n].join(" "),c=e?.find(({value:d})=>d===i.value);return Ue.createElement("span",{"data-disabled":i.disabled,className:s[et.DropdownRoot]},Ue.createElement(r.Select,{className:l,...i},e?.map(({value:d,label:h,disabled:m})=>Ue.createElement(r.Option,{key:d,value:d,disabled:m},h))),Ue.createElement("span",{className:s[et.CaptionLabel],"aria-hidden":!0},c?.label,Ue.createElement(r.Chevron,{orientation:"down",size:18,className:s[et.Chevron]})))}function pfe(t){return Ue.createElement("div",{...t})}function gfe(t){return Ue.createElement("div",{...t})}function xfe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return Ue.createElement("div",{...r},t.children)}function vfe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return Ue.createElement("div",{...r})}function yfe(t){return Ue.createElement("table",{...t})}function bfe(t){return Ue.createElement("div",{...t})}const Oz=S.createContext(void 0);function j0(){const t=S.useContext(Oz);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function wfe(t){const{components:e}=j0();return Ue.createElement(e.Dropdown,{...t})}function Sfe(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:s,...i}=t,{components:l,classNames:c,labels:{labelPrevious:d,labelNext:h}}=j0(),m=S.useCallback(x=>{s&&n?.(x)},[s,n]),p=S.useCallback(x=>{r&&e?.(x)},[r,e]);return Ue.createElement("nav",{...i},Ue.createElement(l.PreviousMonthButton,{type:"button",className:c[et.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":d(r),onClick:p},Ue.createElement(l.Chevron,{disabled:r?void 0:!0,className:c[et.Chevron],orientation:"left"})),Ue.createElement(l.NextMonthButton,{type:"button",className:c[et.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":h(s),onClick:m},Ue.createElement(l.Chevron,{disabled:s?void 0:!0,orientation:"right",className:c[et.Chevron]})))}function kfe(t){const{components:e}=j0();return Ue.createElement(e.Button,{...t})}function Ofe(t){return Ue.createElement("option",{...t})}function jfe(t){const{components:e}=j0();return Ue.createElement(e.Button,{...t})}function Nfe(t){const{rootRef:e,...n}=t;return Ue.createElement("div",{...n,ref:e})}function Cfe(t){return Ue.createElement("select",{...t})}function Tfe(t){const{week:e,...n}=t;return Ue.createElement("tr",{...n})}function Afe(t){return Ue.createElement("th",{...t})}function Mfe(t){return Ue.createElement("thead",{"aria-hidden":!0},Ue.createElement("tr",{...t}))}function Efe(t){const{week:e,...n}=t;return Ue.createElement("th",{...n})}function _fe(t){return Ue.createElement("th",{...t})}function Dfe(t){return Ue.createElement("tbody",{...t})}function Rfe(t){const{components:e}=j0();return Ue.createElement(e.Dropdown,{...t})}const zfe=Object.freeze(Object.defineProperty({__proto__:null,Button:cfe,CaptionLabel:ufe,Chevron:dfe,Day:hfe,DayButton:ffe,Dropdown:mfe,DropdownNav:pfe,Footer:gfe,Month:xfe,MonthCaption:vfe,MonthGrid:yfe,Months:bfe,MonthsDropdown:wfe,Nav:Sfe,NextMonthButton:kfe,Option:Ofe,PreviousMonthButton:jfe,Root:Nfe,Select:Cfe,Week:Tfe,WeekNumber:Efe,WeekNumberHeader:_fe,Weekday:Afe,Weekdays:Mfe,Weeks:Dfe,YearsDropdown:Rfe},Symbol.toStringTag,{value:"Module"}));function ll(t,e,n=!1,r=Ma){let{from:s,to:i}=t;const{differenceInCalendarDays:l,isSameDay:c}=r;return s&&i?(l(i,s)<0&&([s,i]=[i,s]),l(e,s)>=(n?1:0)&&l(i,e)>=(n?1:0)):!n&&i?c(i,e):!n&&s?c(s,e):!1}function jz(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function X5(t){return!!(t&&typeof t=="object"&&"from"in t)}function Nz(t){return!!(t&&typeof t=="object"&&"after"in t)}function Cz(t){return!!(t&&typeof t=="object"&&"before"in t)}function Tz(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function Az(t,e){return Array.isArray(t)&&t.every(e.isDate)}function ol(t,e,n=Ma){const r=Array.isArray(e)?e:[e],{isSameDay:s,differenceInCalendarDays:i,isAfter:l}=n;return r.some(c=>{if(typeof c=="boolean")return c;if(n.isDate(c))return s(t,c);if(Az(c,n))return c.includes(t);if(X5(c))return ll(c,t,!1,n);if(Tz(c))return Array.isArray(c.dayOfWeek)?c.dayOfWeek.includes(t.getDay()):c.dayOfWeek===t.getDay();if(jz(c)){const d=i(c.before,t),h=i(c.after,t),m=d>0,p=h<0;return l(c.before,c.after)?p&&m:m||p}return Nz(c)?i(t,c.after)>0:Cz(c)?i(c.before,t)>0:typeof c=="function"?c(t):!1})}function Pfe(t,e,n,r,s){const{disabled:i,hidden:l,modifiers:c,showOutsideDays:d,broadcastCalendar:h,today:m}=e,{isSameDay:p,isSameMonth:x,startOfMonth:v,isBefore:b,endOfMonth:k,isAfter:O}=s,j=n&&v(n),T=r&&k(r),A={[Yn.focused]:[],[Yn.outside]:[],[Yn.disabled]:[],[Yn.hidden]:[],[Yn.today]:[]},_={};for(const D of t){const{date:E,displayMonth:z}=D,Q=!!(z&&!x(E,z)),F=!!(j&&b(E,j)),L=!!(T&&O(E,T)),U=!!(i&&ol(E,i,s)),V=!!(l&&ol(E,l,s))||F||L||!h&&!d&&Q||h&&d===!1&&Q,ce=p(E,m??s.today());Q&&A.outside.push(D),U&&A.disabled.push(D),V&&A.hidden.push(D),ce&&A.today.push(D),c&&Object.keys(c).forEach(W=>{const J=c?.[W];J&&ol(E,J,s)&&(_[W]?_[W].push(D):_[W]=[D])})}return D=>{const E={[Yn.focused]:!1,[Yn.disabled]:!1,[Yn.hidden]:!1,[Yn.outside]:!1,[Yn.today]:!1},z={};for(const Q in A){const F=A[Q];E[Q]=F.some(L=>L===D)}for(const Q in _)z[Q]=_[Q].some(F=>F===D);return{...E,...z}}}function Bfe(t,e,n={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):e[Yn[i]]?s.push(e[Yn[i]]):e[qi[i]]&&s.push(e[qi[i]]),s),[e[et.Day]])}function Lfe(t){return{...zfe,...t}}function Ife(t){const e={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([n,r])=>{n.startsWith("data-")&&(e[n]=r)}),e}function Y5(){const t={};for(const e in et)t[et[e]]=`rdp-${et[e]}`;for(const e in Yn)t[Yn[e]]=`rdp-${Yn[e]}`;for(const e in qi)t[qi[e]]=`rdp-${qi[e]}`;for(const e in ti)t[ti[e]]=`rdp-${ti[e]}`;return t}function Mz(t,e,n){return(n??new ai(e)).formatMonthYear(t)}const qfe=Mz;function Ffe(t,e,n){return(n??new ai(e)).format(t,"d")}function Qfe(t,e=Ma){return e.format(t,"LLLL")}function $fe(t,e,n){return(n??new ai(e)).format(t,"cccccc")}function Hfe(t,e=Ma){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function Ufe(){return""}function Ez(t,e=Ma){return e.format(t,"yyyy")}const Vfe=Ez,Wfe=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:Mz,formatDay:Ffe,formatMonthCaption:qfe,formatMonthDropdown:Qfe,formatWeekNumber:Hfe,formatWeekNumberHeader:Ufe,formatWeekdayName:$fe,formatYearCaption:Vfe,formatYearDropdown:Ez},Symbol.toStringTag,{value:"Module"}));function Gfe(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...Wfe,...t}}function Xfe(t,e,n,r,s){const{startOfMonth:i,startOfYear:l,endOfYear:c,eachMonthOfInterval:d,getMonth:h}=s;return d({start:l(t),end:c(t)}).map(x=>{const v=r.formatMonthDropdown(x,s),b=h(x),k=e&&xi(n)||!1;return{value:b,label:v,disabled:k}})}function Yfe(t,e={},n={}){let r={...e?.[et.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function Kfe(t,e,n){const r=t.today(),s=e?t.startOfISOWeek(r):t.startOfWeek(r),i=[];for(let l=0;l<7;l++){const c=t.addDays(s,l);i.push(c)}return i}function Zfe(t,e,n,r,s=!1){if(!t||!e)return;const{startOfYear:i,endOfYear:l,eachYearOfInterval:c,getYear:d}=r,h=i(t),m=l(e),p=c({start:h,end:m});return s&&p.reverse(),p.map(x=>{const v=n.formatYearDropdown(x,r);return{value:d(x),label:v,disabled:!1}})}function _z(t,e,n,r){let s=(r??new ai(n)).format(t,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s}const Jfe=_z;function Dz(t,e,n){return(n??new ai(e)).formatMonthYear(t)}const e0e=Dz;function t0e(t,e,n,r){let s=(r??new ai(n)).format(t,"PPPP");return e?.today&&(s=`Today, ${s}`),s}function n0e(t){return"Choose the Month"}function r0e(){return""}function s0e(t){return"Go to the Next Month"}function i0e(t){return"Go to the Previous Month"}function a0e(t,e,n){return(n??new ai(e)).format(t,"cccc")}function l0e(t,e){return`Week ${t}`}function o0e(t){return"Week Number"}function c0e(t){return"Choose the Year"}const u0e=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:e0e,labelDay:Jfe,labelDayButton:_z,labelGrid:Dz,labelGridcell:t0e,labelMonthDropdown:n0e,labelNav:r0e,labelNext:s0e,labelPrevious:i0e,labelWeekNumber:l0e,labelWeekNumberHeader:o0e,labelWeekday:a0e,labelYearDropdown:c0e},Symbol.toStringTag,{value:"Module"})),N0=t=>t instanceof HTMLElement?t:null,Ub=t=>[...t.querySelectorAll("[data-animated-month]")??[]],d0e=t=>N0(t.querySelector("[data-animated-month]")),Vb=t=>N0(t.querySelector("[data-animated-caption]")),Wb=t=>N0(t.querySelector("[data-animated-weeks]")),h0e=t=>N0(t.querySelector("[data-animated-nav]")),f0e=t=>N0(t.querySelector("[data-animated-weekdays]"));function m0e(t,e,{classNames:n,months:r,focused:s,dateLib:i}){const l=S.useRef(null),c=S.useRef(r),d=S.useRef(!1);S.useLayoutEffect(()=>{const h=c.current;if(c.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||h.length===0||r.length!==h.length)return;const m=i.isSameMonth(r[0].date,h[0].date),p=i.isAfter(r[0].date,h[0].date),x=p?n[ti.caption_after_enter]:n[ti.caption_before_enter],v=p?n[ti.weeks_after_enter]:n[ti.weeks_before_enter],b=l.current,k=t.current.cloneNode(!0);if(k instanceof HTMLElement?(Ub(k).forEach(A=>{if(!(A instanceof HTMLElement))return;const _=d0e(A);_&&A.contains(_)&&A.removeChild(_);const D=Vb(A);D&&D.classList.remove(x);const E=Wb(A);E&&E.classList.remove(v)}),l.current=k):l.current=null,d.current||m||s)return;const O=b instanceof HTMLElement?Ub(b):[],j=Ub(t.current);if(j?.every(T=>T instanceof HTMLElement)&&O&&O.every(T=>T instanceof HTMLElement)){d.current=!0,t.current.style.isolation="isolate";const T=h0e(t.current);T&&(T.style.zIndex="1"),j.forEach((A,_)=>{const D=O[_];if(!D)return;A.style.position="relative",A.style.overflow="hidden";const E=Vb(A);E&&E.classList.add(x);const z=Wb(A);z&&z.classList.add(v);const Q=()=>{d.current=!1,t.current&&(t.current.style.isolation=""),T&&(T.style.zIndex=""),E&&E.classList.remove(x),z&&z.classList.remove(v),A.style.position="",A.style.overflow="",A.contains(D)&&A.removeChild(D)};D.style.pointerEvents="none",D.style.position="absolute",D.style.overflow="hidden",D.setAttribute("aria-hidden","true");const F=f0e(D);F&&(F.style.opacity="0");const L=Vb(D);L&&(L.classList.add(p?n[ti.caption_before_exit]:n[ti.caption_after_exit]),L.addEventListener("animationend",Q));const U=Wb(D);U&&U.classList.add(p?n[ti.weeks_before_exit]:n[ti.weeks_after_exit]),A.insertBefore(D,A.firstChild)})}})}function p0e(t,e,n,r){const s=t[0],i=t[t.length-1],{ISOWeek:l,fixedWeeks:c,broadcastCalendar:d}=n??{},{addDays:h,differenceInCalendarDays:m,differenceInCalendarMonths:p,endOfBroadcastWeek:x,endOfISOWeek:v,endOfMonth:b,endOfWeek:k,isAfter:O,startOfBroadcastWeek:j,startOfISOWeek:T,startOfWeek:A}=r,_=d?j(s,r):l?T(s):A(s),D=d?x(i):l?v(b(i)):k(b(i)),E=m(D,_),z=p(i,s)+1,Q=[];for(let U=0;U<=E;U++){const V=h(_,U);if(e&&O(V,e))break;Q.push(V)}const L=(d?35:42)*z;if(c&&Q.length{const s=r.weeks.reduce((i,l)=>i.concat(l.days.slice()),e.slice());return n.concat(s.slice())},e.slice())}function x0e(t,e,n,r){const{numberOfMonths:s=1}=n,i=[];for(let l=0;le)break;i.push(c)}return i}function t9(t,e,n,r){const{month:s,defaultMonth:i,today:l=r.today(),numberOfMonths:c=1}=t;let d=s||i||l;const{differenceInCalendarMonths:h,addMonths:m,startOfMonth:p}=r;if(n&&h(n,d){const j=n.broadcastCalendar?p(O,r):n.ISOWeek?x(O):v(O),T=n.broadcastCalendar?i(O):n.ISOWeek?l(c(O)):d(c(O)),A=e.filter(z=>z>=j&&z<=T),_=n.broadcastCalendar?35:42;if(n.fixedWeeks&&A.length<_){const z=e.filter(Q=>{const F=_-A.length;return Q>T&&Q<=s(T,F)});A.push(...z)}const D=A.reduce((z,Q)=>{const F=n.ISOWeek?h(Q):m(Q),L=z.find(V=>V.weekNumber===F),U=new kz(Q,O,r);return L?L.days.push(U):z.push(new ofe(F,[U])),z},[]),E=new lfe(O,D);return k.push(E),k},[]);return n.reverseMonths?b.reverse():b}function y0e(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:s,startOfDay:i,startOfMonth:l,endOfMonth:c,addYears:d,endOfYear:h,newDate:m,today:p}=e,{fromYear:x,toYear:v,fromMonth:b,toMonth:k}=t;!n&&b&&(n=b),!n&&x&&(n=e.newDate(x,0,1)),!r&&k&&(r=k),!r&&v&&(r=m(v,11,31));const O=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=l(n):x?n=m(x,0,1):!n&&O&&(n=s(d(t.today??p(),-100))),r?r=c(r):v?r=m(v,11,31):!r&&O&&(r=h(t.today??p())),[n&&i(n),r&&i(r)]}function b0e(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:l,addMonths:c,differenceInCalendarMonths:d}=r,h=s?i:1,m=l(t);if(!e)return c(m,h);if(!(d(e,t)n.concat(r.weeks.slice()),e.slice())}function Yx(t,e){const[n,r]=S.useState(t);return[e===void 0?n:e,r]}function k0e(t,e){const[n,r]=y0e(t,e),{startOfMonth:s,endOfMonth:i}=e,l=t9(t,n,r,e),[c,d]=Yx(l,t.month?l:void 0);S.useEffect(()=>{const E=t9(t,n,r,e);d(E)},[t.timeZone]);const h=x0e(c,r,t,e),m=p0e(h,t.endMonth?i(t.endMonth):void 0,t,e),p=v0e(h,m,t,e),x=S0e(p),v=g0e(p),b=w0e(c,n,t,e),k=b0e(c,r,t,e),{disableNavigation:O,onMonthChange:j}=t,T=E=>x.some(z=>z.days.some(Q=>Q.isEqualTo(E))),A=E=>{if(O)return;let z=s(E);n&&zs(r)&&(z=s(r)),d(z),j?.(z)};return{months:p,weeks:x,days:v,navStart:n,navEnd:r,previousMonth:b,nextMonth:k,goToMonth:A,goToDay:E=>{T(E)||A(E.date)}}}var aa;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(aa||(aa={}));function n9(t){return!t[Yn.disabled]&&!t[Yn.hidden]&&!t[Yn.outside]}function O0e(t,e,n,r){let s,i=-1;for(const l of t){const c=e(l);n9(c)&&(c[Yn.focused]&&in9(e(l)))),s}function j0e(t,e,n,r,s,i,l){const{ISOWeek:c,broadcastCalendar:d}=i,{addDays:h,addMonths:m,addWeeks:p,addYears:x,endOfBroadcastWeek:v,endOfISOWeek:b,endOfWeek:k,max:O,min:j,startOfBroadcastWeek:T,startOfISOWeek:A,startOfWeek:_}=l;let E={day:h,week:p,month:m,year:x,startOfWeek:z=>d?T(z,l):c?A(z):_(z),endOfWeek:z=>d?v(z):c?b(z):k(z)}[t](n,e==="after"?1:-1);return e==="before"&&r?E=O([r,E]):e==="after"&&s&&(E=j([s,E])),E}function Rz(t,e,n,r,s,i,l,c=0){if(c>365)return;const d=j0e(t,e,n.date,r,s,i,l),h=!!(i.disabled&&ol(d,i.disabled,l)),m=!!(i.hidden&&ol(d,i.hidden,l)),p=d,x=new kz(d,p,l);return!h&&!m?x:Rz(t,e,x,r,s,i,l,c+1)}function N0e(t,e,n,r,s){const{autoFocus:i}=t,[l,c]=S.useState(),d=O0e(e.days,n,r||(()=>!1),l),[h,m]=S.useState(i?d:void 0);return{isFocusTarget:k=>!!d?.isEqualTo(k),setFocused:m,focused:h,blur:()=>{c(h),m(void 0)},moveFocus:(k,O)=>{if(!h)return;const j=Rz(k,O,h,e.navStart,e.navEnd,t,s);j&&(t.disableNavigation&&!e.days.some(A=>A.isEqualTo(j))||(e.goToDay(j),m(j)))}}}function C0e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,l]=Yx(n,s?n:void 0),c=s?n:i,{isSameDay:d}=e,h=v=>c?.some(b=>d(b,v))??!1,{min:m,max:p}=t;return{selected:c,select:(v,b,k)=>{let O=[...c??[]];if(h(v)){if(c?.length===m||r&&c?.length===1)return;O=c?.filter(j=>!d(j,v))}else c?.length===p?O=[v]:O=[...O,v];return s||l(O),s?.(O,v,b,k),O},isSelected:h}}function T0e(t,e,n=0,r=0,s=!1,i=Ma){const{from:l,to:c}=e||{},{isSameDay:d,isAfter:h,isBefore:m}=i;let p;if(!l&&!c)p={from:t,to:n>0?void 0:t};else if(l&&!c)d(l,t)?n===0?p={from:l,to:t}:s?p={from:l,to:void 0}:p=void 0:m(t,l)?p={from:t,to:l}:p={from:l,to:t};else if(l&&c)if(d(l,t)&&d(c,t))s?p={from:l,to:c}:p=void 0;else if(d(l,t))p={from:l,to:n>0?void 0:t};else if(d(c,t))p={from:t,to:n>0?void 0:t};else if(m(t,l))p={from:t,to:c};else if(h(t,l))p={from:l,to:t};else if(h(t,c))p={from:l,to:t};else throw new Error("Invalid range");if(p?.from&&p?.to){const x=i.differenceInCalendarDays(p.to,p.from);r>0&&x>r?p={from:t,to:void 0}:n>1&&xtypeof c!="function").some(c=>typeof c=="boolean"?c:n.isDate(c)?ll(t,c,!1,n):Az(c,n)?c.some(d=>ll(t,d,!1,n)):X5(c)?c.from&&c.to?r9(t,{from:c.from,to:c.to},n):!1:Tz(c)?A0e(t,c.dayOfWeek,n):jz(c)?n.isAfter(c.before,c.after)?r9(t,{from:n.addDays(c.after,1),to:n.addDays(c.before,-1)},n):ol(t.from,c,n)||ol(t.to,c,n):Nz(c)||Cz(c)?ol(t.from,c,n)||ol(t.to,c,n):!1))return!0;const l=r.filter(c=>typeof c=="function");if(l.length){let c=t.from;const d=n.differenceInCalendarDays(t.to,t.from);for(let h=0;h<=d;h++){if(l.some(m=>m(c)))return!0;c=n.addDays(c,1)}}return!1}function E0e(t,e){const{disabled:n,excludeDisabled:r,selected:s,required:i,onSelect:l}=t,[c,d]=Yx(s,l?s:void 0),h=l?s:c;return{selected:h,select:(x,v,b)=>{const{min:k,max:O}=t,j=x?T0e(x,h,k,O,i,e):void 0;return r&&n&&j?.from&&j.to&&M0e({from:j.from,to:j.to},n,e)&&(j.from=x,j.to=void 0),l||d(j),l?.(j,x,v,b),j},isSelected:x=>h&&ll(h,x,!1,e)}}function _0e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,l]=Yx(n,s?n:void 0),c=s?n:i,{isSameDay:d}=e;return{selected:c,select:(p,x,v)=>{let b=p;return!r&&c&&c&&d(p,c)&&(b=void 0),s||l(b),s?.(b,p,x,v),b},isSelected:p=>c?d(c,p):!1}}function D0e(t,e){const n=_0e(t,e),r=C0e(t,e),s=E0e(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function R0e(t){let e=t;e.timeZone&&(e={...t},e.today&&(e.today=new Zr(e.today,e.timeZone)),e.month&&(e.month=new Zr(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new Zr(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new Zr(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new Zr(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new Zr(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(dt=>new Zr(dt,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new Zr(e.selected.from,e.timeZone):void 0,to:e.selected.to?new Zr(e.selected.to,e.timeZone):void 0}));const{components:n,formatters:r,labels:s,dateLib:i,locale:l,classNames:c}=S.useMemo(()=>{const dt={...G5,...e.locale};return{dateLib:new ai({locale:dt,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib),components:Lfe(e.components),formatters:Gfe(e.formatters),labels:{...u0e,...e.labels},locale:dt,classNames:{...Y5(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]),{captionLayout:d,mode:h,navLayout:m,numberOfMonths:p=1,onDayBlur:x,onDayClick:v,onDayFocus:b,onDayKeyDown:k,onDayMouseEnter:O,onDayMouseLeave:j,onNextClick:T,onPrevClick:A,showWeekNumber:_,styles:D}=e,{formatCaption:E,formatDay:z,formatMonthDropdown:Q,formatWeekNumber:F,formatWeekNumberHeader:L,formatWeekdayName:U,formatYearDropdown:V}=r,ce=k0e(e,i),{days:W,months:J,navStart:$,navEnd:ae,previousMonth:ne,nextMonth:ue,goToMonth:R}=ce,me=Pfe(W,e,$,ae,i),{isSelected:Y,select:P,selected:K}=D0e(e,i)??{},{blur:H,focused:fe,isFocusTarget:ve,moveFocus:Re,setFocused:de}=N0e(e,ce,me,Y??(()=>!1),i),{labelDayButton:We,labelGridcell:ct,labelGrid:Oe,labelMonthDropdown:nt,labelNav:ut,labelPrevious:Ct,labelNext:In,labelWeekday:Tn,labelWeekNumber:Jn,labelWeekNumberHeader:nn,labelYearDropdown:_t}=s,Yr=S.useMemo(()=>Kfe(i,e.ISOWeek),[i,e.ISOWeek]),qn=h!==void 0||v!==void 0,or=S.useCallback(()=>{ne&&(R(ne),A?.(ne))},[ne,R,A]),yn=S.useCallback(()=>{ue&&(R(ue),T?.(ue))},[R,ue,T]),ft=S.useCallback((dt,Pn)=>mt=>{mt.preventDefault(),mt.stopPropagation(),de(dt),P?.(dt.date,Pn,mt),v?.(dt.date,Pn,mt)},[P,v,de]),ee=S.useCallback((dt,Pn)=>mt=>{de(dt),b?.(dt.date,Pn,mt)},[b,de]),Se=S.useCallback((dt,Pn)=>mt=>{H(),x?.(dt.date,Pn,mt)},[H,x]),Be=S.useCallback((dt,Pn)=>mt=>{const rn={ArrowLeft:[mt.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[mt.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[mt.shiftKey?"year":"week","after"],ArrowUp:[mt.shiftKey?"year":"week","before"],PageUp:[mt.shiftKey?"year":"month","before"],PageDown:[mt.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(rn[mt.key]){mt.preventDefault(),mt.stopPropagation();const[Mr,At]=rn[mt.key];Re(Mr,At)}k?.(dt.date,Pn,mt)},[Re,k,e.dir]),rt=S.useCallback((dt,Pn)=>mt=>{O?.(dt.date,Pn,mt)},[O]),Tt=S.useCallback((dt,Pn)=>mt=>{j?.(dt.date,Pn,mt)},[j]),cr=S.useCallback(dt=>Pn=>{const mt=Number(Pn.target.value),rn=i.setMonth(i.startOfMonth(dt),mt);R(rn)},[i,R]),Kr=S.useCallback(dt=>Pn=>{const mt=Number(Pn.target.value),rn=i.setYear(i.startOfMonth(dt),mt);R(rn)},[i,R]),{className:re,style:Ae}=S.useMemo(()=>({className:[c[et.Root],e.className].filter(Boolean).join(" "),style:{...D?.[et.Root],...e.style}}),[c,e.className,e.style,D]),pt=Ife(e),yt=S.useRef(null);m0e(yt,!!e.animate,{classNames:c,months:J,focused:fe,dateLib:i});const vs={dayPickerProps:e,selected:K,select:P,isSelected:Y,months:J,nextMonth:ue,previousMonth:ne,goToMonth:R,getModifiers:me,components:n,classNames:c,styles:D,labels:s,formatters:r};return Ue.createElement(Oz.Provider,{value:vs},Ue.createElement(n.Root,{rootRef:e.animate?yt:void 0,className:re,style:Ae,dir:e.dir,id:e.id,lang:e.lang,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...pt},Ue.createElement(n.Months,{className:c[et.Months],style:D?.[et.Months]},!e.hideNavigation&&!m&&Ue.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[et.Nav],style:D?.[et.Nav],"aria-label":ut(),onPreviousClick:or,onNextClick:yn,previousMonth:ne,nextMonth:ue}),J.map((dt,Pn)=>Ue.createElement(n.Month,{"data-animated-month":e.animate?"true":void 0,className:c[et.Month],style:D?.[et.Month],key:Pn,displayIndex:Pn,calendarMonth:dt},m==="around"&&!e.hideNavigation&&Pn===0&&Ue.createElement(n.PreviousMonthButton,{type:"button",className:c[et.PreviousMonthButton],tabIndex:ne?void 0:-1,"aria-disabled":ne?void 0:!0,"aria-label":Ct(ne),onClick:or,"data-animated-button":e.animate?"true":void 0},Ue.createElement(n.Chevron,{disabled:ne?void 0:!0,className:c[et.Chevron],orientation:e.dir==="rtl"?"right":"left"})),Ue.createElement(n.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:c[et.MonthCaption],style:D?.[et.MonthCaption],calendarMonth:dt,displayIndex:Pn},d?.startsWith("dropdown")?Ue.createElement(n.DropdownNav,{className:c[et.Dropdowns],style:D?.[et.Dropdowns]},(()=>{const mt=d==="dropdown"||d==="dropdown-months"?Ue.createElement(n.MonthsDropdown,{key:"month",className:c[et.MonthsDropdown],"aria-label":nt(),classNames:c,components:n,disabled:!!e.disableNavigation,onChange:cr(dt.date),options:Xfe(dt.date,$,ae,r,i),style:D?.[et.Dropdown],value:i.getMonth(dt.date)}):Ue.createElement("span",{key:"month"},Q(dt.date,i)),rn=d==="dropdown"||d==="dropdown-years"?Ue.createElement(n.YearsDropdown,{key:"year",className:c[et.YearsDropdown],"aria-label":_t(i.options),classNames:c,components:n,disabled:!!e.disableNavigation,onChange:Kr(dt.date),options:Zfe($,ae,r,i,!!e.reverseYears),style:D?.[et.Dropdown],value:i.getYear(dt.date)}):Ue.createElement("span",{key:"year"},V(dt.date,i));return i.getMonthYearOrder()==="year-first"?[rn,mt]:[mt,rn]})(),Ue.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},E(dt.date,i.options,i))):Ue.createElement(n.CaptionLabel,{className:c[et.CaptionLabel],role:"status","aria-live":"polite"},E(dt.date,i.options,i))),m==="around"&&!e.hideNavigation&&Pn===p-1&&Ue.createElement(n.NextMonthButton,{type:"button",className:c[et.NextMonthButton],tabIndex:ue?void 0:-1,"aria-disabled":ue?void 0:!0,"aria-label":In(ue),onClick:yn,"data-animated-button":e.animate?"true":void 0},Ue.createElement(n.Chevron,{disabled:ue?void 0:!0,className:c[et.Chevron],orientation:e.dir==="rtl"?"left":"right"})),Pn===p-1&&m==="after"&&!e.hideNavigation&&Ue.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[et.Nav],style:D?.[et.Nav],"aria-label":ut(),onPreviousClick:or,onNextClick:yn,previousMonth:ne,nextMonth:ue}),Ue.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":h==="multiple"||h==="range","aria-label":Oe(dt.date,i.options,i)||void 0,className:c[et.MonthGrid],style:D?.[et.MonthGrid]},!e.hideWeekdays&&Ue.createElement(n.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:c[et.Weekdays],style:D?.[et.Weekdays]},_&&Ue.createElement(n.WeekNumberHeader,{"aria-label":nn(i.options),className:c[et.WeekNumberHeader],style:D?.[et.WeekNumberHeader],scope:"col"},L()),Yr.map(mt=>Ue.createElement(n.Weekday,{"aria-label":Tn(mt,i.options,i),className:c[et.Weekday],key:String(mt),style:D?.[et.Weekday],scope:"col"},U(mt,i.options,i)))),Ue.createElement(n.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:c[et.Weeks],style:D?.[et.Weeks]},dt.weeks.map(mt=>Ue.createElement(n.Week,{className:c[et.Week],key:mt.weekNumber,style:D?.[et.Week],week:mt},_&&Ue.createElement(n.WeekNumber,{week:mt,style:D?.[et.WeekNumber],"aria-label":Jn(mt.weekNumber,{locale:l}),className:c[et.WeekNumber],scope:"row",role:"rowheader"},F(mt.weekNumber,i)),mt.days.map(rn=>{const{date:Mr}=rn,At=me(rn);if(At[Yn.focused]=!At.hidden&&!!fe?.isEqualTo(rn),At[qi.selected]=Y?.(Mr)||At.selected,X5(K)){const{from:qc,to:Do}=K;At[qi.range_start]=!!(qc&&Do&&i.isSameDay(Mr,qc)),At[qi.range_end]=!!(qc&&Do&&i.isSameDay(Mr,Do)),At[qi.range_middle]=ll(K,Mr,!0,i)}const Ic=Yfe(At,D,e.modifiersStyles),_o=Bfe(At,c,e.modifiersClassNames),t1=!qn&&!At.hidden?ct(Mr,At,i.options,i):void 0;return Ue.createElement(n.Day,{key:`${i.format(Mr,"yyyy-MM-dd")}_${i.format(rn.displayMonth,"yyyy-MM")}`,day:rn,modifiers:At,className:_o.join(" "),style:Ic,role:"gridcell","aria-selected":At.selected||void 0,"aria-label":t1,"data-day":i.format(Mr,"yyyy-MM-dd"),"data-month":rn.outside?i.format(Mr,"yyyy-MM"):void 0,"data-selected":At.selected||void 0,"data-disabled":At.disabled||void 0,"data-hidden":At.hidden||void 0,"data-outside":rn.outside||void 0,"data-focused":At.focused||void 0,"data-today":At.today||void 0},!At.hidden&&qn?Ue.createElement(n.DayButton,{className:c[et.DayButton],style:D?.[et.DayButton],type:"button",day:rn,modifiers:At,disabled:At.disabled||void 0,tabIndex:ve(rn)?0:-1,"aria-label":We(Mr,At,i.options,i),onClick:ft(rn,At),onBlur:Se(rn,At),onFocus:ee(rn,At),onKeyDown:Be(rn,At),onMouseEnter:rt(rn,At),onMouseLeave:Tt(rn,At)},z(Mr,i.options,i)):!At.hidden&&z(rn.date,i.options,i))})))))))),e.footer&&Ue.createElement(n.Footer,{className:c[et.Footer],style:D?.[et.Footer],role:"status","aria-live":"polite"},e.footer)))}function s9({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:l,...c}){const d=Y5();return a.jsx(R0e,{showOutsideDays:n,className:ye("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,t),captionLayout:r,formatters:{formatMonthDropdown:h=>h.toLocaleString("default",{month:"short"}),...i},classNames:{root:ye("w-fit",d.root),months:ye("relative flex flex-col gap-4 md:flex-row",d.months),month:ye("flex w-full flex-col gap-4",d.month),nav:ye("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",d.nav),button_previous:ye(ff({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_previous),button_next:ye(ff({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_next),month_caption:ye("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",d.month_caption),dropdowns:ye("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",d.dropdowns),dropdown_root:ye("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",d.dropdown_root),dropdown:ye("bg-popover absolute inset-0 opacity-0",d.dropdown),caption_label:ye("select-none font-medium",r==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",d.caption_label),table:"w-full border-collapse",weekdays:ye("flex",d.weekdays),weekday:ye("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",d.weekday),week:ye("mt-2 flex w-full",d.week),week_number_header:ye("w-[--cell-size] select-none",d.week_number_header),week_number:ye("text-muted-foreground select-none text-[0.8rem]",d.week_number),day:ye("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",d.day),range_start:ye("bg-accent rounded-l-md",d.range_start),range_middle:ye("rounded-none",d.range_middle),range_end:ye("bg-accent rounded-r-md",d.range_end),today:ye("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",d.today),outside:ye("text-muted-foreground aria-selected:text-muted-foreground",d.outside),disabled:ye("text-muted-foreground opacity-50",d.disabled),hidden:ye("invisible",d.hidden),...e},components:{Root:({className:h,rootRef:m,...p})=>a.jsx("div",{"data-slot":"calendar",ref:m,className:ye(h),...p}),Chevron:({className:h,orientation:m,...p})=>m==="left"?a.jsx(Tc,{className:ye("size-4",h),...p}):m==="right"?a.jsx(Ac,{className:ye("size-4",h),...p}):a.jsx(df,{className:ye("size-4",h),...p}),DayButton:z0e,WeekNumber:({children:h,...m})=>a.jsx("td",{...m,children:a.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:h})}),...l},...c})}function z0e({className:t,day:e,modifiers:n,...r}){const s=Y5(),i=S.useRef(null);return S.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),a.jsx(ie,{ref:i,variant:"ghost",size:"icon","data-day":e.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:ye("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",s.day,t),...r})}class P0e{ws=null;reconnectTimeout=null;reconnectAttempts=0;maxReconnectAttempts=10;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];maxCacheSize=1e3;getWebSocketUrl(){{const e=window.location.protocol==="https:"?"wss:":"ws:",n=window.location.host;return`${e}//${n}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const e=this.getWebSocketUrl();try{this.ws=new WebSocket(e),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=n=>{try{if(n.data==="pong")return;const r=JSON.parse(n.data);this.notifyLog(r)}catch(r){console.error("解析日志消息失败:",r)}},this.ws.onerror=n=>{console.error("❌ WebSocket 错误:",n),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(n){console.error("创建 WebSocket 连接失败:",n),this.attemptReconnect()}}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return;this.reconnectAttempts+=1;const e=Math.min(1e3*this.reconnectAttempts,1e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},e)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(e){return this.logCallbacks.add(e),()=>this.logCallbacks.delete(e)}onConnectionChange(e){return this.connectionCallbacks.add(e),e(this.isConnected),()=>this.connectionCallbacks.delete(e)}notifyLog(e){this.logCache.some(r=>r.id===e.id)||(this.logCache.push(e),this.logCache.length>this.maxCacheSize&&(this.logCache=this.logCache.slice(-this.maxCacheSize)),this.logCallbacks.forEach(r=>{try{r(e)}catch(s){console.error("日志回调执行失败:",s)}}))}notifyConnection(e){this.connectionCallbacks.forEach(n=>{try{n(e)}catch(r){console.error("连接状态回调执行失败:",r)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const Iu=new P0e;typeof window<"u"&&Iu.connect();const B0e={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},L0e=(t,e,n)=>{let r;const s=B0e[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",String(e)),n?.addSuffix?n.comparison&&n.comparison>0?r+"内":r+"前":r},I0e={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},q0e={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},F0e={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Q0e={date:td({formats:I0e,defaultWidth:"full"}),time:td({formats:q0e,defaultWidth:"full"}),dateTime:td({formats:F0e,defaultWidth:"full"})};function i9(t,e,n){const r="eeee p";return Jhe(t,e,n)?r:t.getTime()>e.getTime()?"'下个'"+r:"'上个'"+r}const $0e={lastWeek:i9,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:i9,other:"PP p"},H0e=(t,e,n,r)=>{const s=$0e[t];return typeof s=="function"?s(e,n,r):s},U0e={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},V0e={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},W0e={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},G0e={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},X0e={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},Y0e={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},K0e=(t,e)=>{const n=Number(t);switch(e?.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},Z0e={ordinalNumber:K0e,era:ua({values:U0e,defaultWidth:"wide"}),quarter:ua({values:V0e,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ua({values:W0e,defaultWidth:"wide"}),day:ua({values:G0e,defaultWidth:"wide"}),dayPeriod:ua({values:X0e,defaultWidth:"wide",formattingValues:Y0e,defaultFormattingWidth:"wide"})},J0e=/^(第\s*)?\d+(日|时|分|秒)?/i,eme=/\d+/i,tme={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},nme={any:[/^(前)/i,/^(公元)/i]},rme={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},sme={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},ime={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},ame={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},lme={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},ome={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},cme={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},ume={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},dme={ordinalNumber:xz({matchPattern:J0e,parsePattern:eme,valueCallback:t=>parseInt(t,10)}),era:da({matchPatterns:tme,defaultMatchWidth:"wide",parsePatterns:nme,defaultParseWidth:"any"}),quarter:da({matchPatterns:rme,defaultMatchWidth:"wide",parsePatterns:sme,defaultParseWidth:"any",valueCallback:t=>t+1}),month:da({matchPatterns:ime,defaultMatchWidth:"wide",parsePatterns:ame,defaultParseWidth:"any"}),day:da({matchPatterns:lme,defaultMatchWidth:"wide",parsePatterns:ome,defaultParseWidth:"any"}),dayPeriod:da({matchPatterns:cme,defaultMatchWidth:"any",parsePatterns:ume,defaultParseWidth:"any"})},Bp={code:"zh-CN",formatDistance:L0e,formatLong:Q0e,formatRelative:H0e,localize:Z0e,match:dme,options:{weekStartsOn:1,firstWeekContainsDate:4}};function hme(){const[t,e]=S.useState([]),[n,r]=S.useState(""),[s,i]=S.useState("all"),[l,c]=S.useState("all"),[d,h]=S.useState(void 0),[m,p]=S.useState(void 0),[x,v]=S.useState(!0),[b,k]=S.useState(!1),O=S.useRef(null),j=S.useRef(null);S.useEffect(()=>{const U=Iu.getAllLogs();e(U);const V=Iu.onLog(()=>{e(Iu.getAllLogs())}),ce=Iu.onConnectionChange(W=>{k(W)});return()=>{V(),ce()}},[]),S.useEffect(()=>{x&&j.current&&j.current.scrollIntoView({behavior:"smooth",block:"end"})},[t,x]);const T=S.useMemo(()=>{const U=new Set(t.map(V=>V.module));return Array.from(U).sort()},[t]),A=U=>{switch(U){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},_=U=>{switch(U){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},D=()=>{window.location.reload()},E=()=>{Iu.clearLogs(),e([])},z=()=>{const U=L.map(J=>`${J.timestamp} [${J.level.padEnd(8)}] [${J.module}] ${J.message}`).join(` +`),V=new Blob([U],{type:"text/plain;charset=utf-8"}),ce=URL.createObjectURL(V),W=document.createElement("a");W.href=ce,W.download=`logs-${dg(new Date,"yyyy-MM-dd-HHmmss")}.txt`,W.click(),URL.revokeObjectURL(ce)},Q=()=>{v(!x)},F=()=>{h(void 0),p(void 0)},L=S.useMemo(()=>t.filter(U=>{const V=n===""||U.message.toLowerCase().includes(n.toLowerCase())||U.module.toLowerCase().includes(n.toLowerCase()),ce=s==="all"||U.level===s,W=l==="all"||U.module===l;let J=!0;if(d||m){const $=new Date(U.timestamp);if(d){const ae=new Date(d);ae.setHours(0,0,0,0),J=J&&$>=ae}if(m){const ae=new Date(m);ae.setHours(23,59,59,999),J=J&&$<=ae}}return V&&ce&&W&&J}),[t,n,s,l,d,m]);return a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 p-3 sm:p-4 lg:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:ye("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",b?"bg-green-500 animate-pulse":"bg-red-500")}),a.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:b?"已连接":"未连接"})]})]}),a.jsx(gt,{className:"p-3 sm:p-4",children:a.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索日志...",value:n,onChange:U=>r(U.target.value),className:"pl-9 h-9 text-sm"})]}),a.jsxs(Lt,{value:s,onValueChange:i,children:[a.jsxs(Dt,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[a.jsx(t2,{className:"h-4 w-4 mr-2"}),a.jsx(It,{placeholder:"级别"})]}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部级别"}),a.jsx(Pe,{value:"DEBUG",children:"DEBUG"}),a.jsx(Pe,{value:"INFO",children:"INFO"}),a.jsx(Pe,{value:"WARNING",children:"WARNING"}),a.jsx(Pe,{value:"ERROR",children:"ERROR"}),a.jsx(Pe,{value:"CRITICAL",children:"CRITICAL"})]})]}),a.jsxs(Lt,{value:l,onValueChange:c,children:[a.jsxs(Dt,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[a.jsx(t2,{className:"h-4 w-4 mr-2"}),a.jsx(It,{placeholder:"模块"})]}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部模块"}),T.map(U=>a.jsx(Pe,{value:U,children:U},U))]})]})]}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!d&&"text-muted-foreground"),children:[a.jsx(uO,{className:"mr-2 h-4 w-4"}),a.jsx("span",{className:"text-xs sm:text-sm",children:d?dg(d,"PPP",{locale:Bp}):"开始日期"})]})}),a.jsx(fl,{className:"w-auto p-0",align:"start",children:a.jsx(s9,{mode:"single",selected:d,onSelect:h,initialFocus:!0,locale:Bp})})]}),a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!m&&"text-muted-foreground"),children:[a.jsx(uO,{className:"mr-2 h-4 w-4"}),a.jsx("span",{className:"text-xs sm:text-sm",children:m?dg(m,"PPP",{locale:Bp}):"结束日期"})]})}),a.jsx(fl,{className:"w-auto p-0",align:"start",children:a.jsx(s9,{mode:"single",selected:m,onSelect:p,initialFocus:!0,locale:Bp})})]}),(d||m)&&a.jsxs(ie,{variant:"outline",size:"sm",onClick:F,className:"w-full sm:w-auto h-9",children:[a.jsx(Gf,{className:"h-4 w-4 sm:mr-2"}),a.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),a.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[a.jsxs(ie,{variant:x?"default":"outline",size:"sm",onClick:Q,className:"flex-1 sm:flex-none h-9",children:[x?a.jsx(jq,{className:"h-4 w-4"}):a.jsx(Nq,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:x?"自动滚动":"已暂停"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:D,className:"flex-1 sm:flex-none h-9",children:[a.jsx(Fi,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:E,className:"flex-1 sm:flex-none h-9",children:[a.jsx(Ht,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:z,className:"flex-1 sm:flex-none h-9",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),a.jsx("div",{className:"flex-1 hidden sm:block"}),a.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[a.jsxs("span",{className:"font-mono",children:[L.length," / ",t.length]}),a.jsx("span",{className:"ml-1",children:"条日志"})]})]})]})}),a.jsx(gt,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900",children:a.jsx(mn,{className:"h-[calc(100vh-280px)] sm:h-[calc(100vh-320px)] lg:h-[calc(100vh-400px)]",children:a.jsxs("div",{ref:O,className:"p-2 sm:p-3 lg:p-4 font-mono text-xs sm:text-sm space-y-1",children:[L.length===0?a.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):L.map(U=>a.jsxs("div",{className:ye("py-2 px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",_(U.level)),children:[a.jsxs("div",{className:"flex flex-col gap-1 sm:hidden",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-600 text-xs",children:U.timestamp}),a.jsxs("span",{className:ye("text-xs font-semibold",A(U.level)),children:["[",U.level,"]"]})]}),a.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 text-xs truncate",children:U.module}),a.jsx("div",{className:"text-gray-300 dark:text-gray-400 text-xs whitespace-pre-wrap break-words",children:U.message})]}),a.jsxs("div",{className:"hidden sm:flex gap-3 items-start",children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[140px] lg:w-[180px] text-xs lg:text-sm",children:U.timestamp}),a.jsxs("span",{className:ye("flex-shrink-0 w-[70px] lg:w-[80px] font-semibold text-xs lg:text-sm",A(U.level)),children:["[",U.level,"]"]}),a.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[120px] lg:w-[150px] truncate text-xs lg:text-sm",children:U.module}),a.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words text-xs lg:text-sm",children:U.message})]})]},U.id)),a.jsx("div",{ref:j,className:"h-4"})]})})})]})})}const fme="Mai-with-u",mme="plugin-repo",pme="main",gme="plugin_details.json";async function xme(){try{const t=await ot("/api/webui/plugins/fetch-raw",{method:"POST",headers:bt(),body:JSON.stringify({owner:fme,repo:mme,branch:pme,file_path:gme})});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success||!e.data)throw new Error(e.error||"获取插件列表失败");return JSON.parse(e.data).filter(s=>!s?.id||!s?.manifest?(console.warn("跳过无效插件数据:",s),!1):!s.manifest.name||!s.manifest.version?(console.warn("跳过缺少必需字段的插件:",s.id),!1):!0).map(s=>({id:s.id,manifest:{manifest_version:s.manifest.manifest_version||1,name:s.manifest.name,version:s.manifest.version,description:s.manifest.description||"",author:s.manifest.author||{name:"Unknown"},license:s.manifest.license||"Unknown",host_application:s.manifest.host_application||{min_version:"0.0.0"},homepage_url:s.manifest.homepage_url,repository_url:s.manifest.repository_url,keywords:s.manifest.keywords||[],categories:s.manifest.categories||[],default_locale:s.manifest.default_locale||"zh-CN",locales_path:s.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(t){throw console.error("Failed to fetch plugin list:",t),t}}async function vme(){try{const t=await ot("/api/webui/plugins/git-status");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to check Git status:",t),{installed:!1,error:"无法检测 Git 安装状态"}}}async function yme(){try{const t=await ot("/api/webui/plugins/version");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to get Maimai version:",t),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function bme(t,e,n){const r=t.split(".").map(c=>parseInt(c)||0),s=r[0]||0,i=r[1]||0,l=r[2]||0;if(n.version_majorparseInt(p)||0),d=c[0]||0,h=c[1]||0,m=c[2]||0;if(n.version_major>d||n.version_major===d&&n.version_minor>h||n.version_major===d&&n.version_minor===h&&n.version_patch>m)return!1}return!0}function wme(t,e){const n=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host,s=new WebSocket(`${n}//${r}/api/webui/ws/plugin-progress`);return s.onopen=()=>{console.log("Plugin progress WebSocket connected");const i=setInterval(()=>{s.readyState===WebSocket.OPEN?s.send("ping"):clearInterval(i)},3e4)},s.onmessage=i=>{try{if(i.data==="pong")return;const l=JSON.parse(i.data);t(l)}catch(l){console.error("Failed to parse progress data:",l)}},s.onerror=i=>{console.error("Plugin progress WebSocket error:",i),e?.(i)},s.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},s}async function Lp(){try{const t=await ot("/api/webui/plugins/installed",{headers:bt()});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success)throw new Error(e.message||"获取已安装插件列表失败");return e.plugins||[]}catch(t){return console.error("Failed to get installed plugins:",t),[]}}function Ip(t,e){return e.some(n=>n.id===t)}function qp(t,e){const n=e.find(r=>r.id===t);if(n)return n.manifest?.version||n.version}async function Sme(t,e,n="main"){const r=await ot("/api/webui/plugins/install",{method:"POST",headers:bt(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"安装失败")}return await r.json()}async function kme(t){const e=await ot("/api/webui/plugins/uninstall",{method:"POST",headers:bt(),body:JSON.stringify({plugin_id:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"卸载失败")}return await e.json()}async function Ome(t,e,n="main"){const r=await ot("/api/webui/plugins/update",{method:"POST",headers:bt(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"更新失败")}return await r.json()}const C0="https://maibot-plugin-stats.maibot-webui.workers.dev";async function zz(t){try{const e=await fetch(`${C0}/stats/${t}`);return e.ok?await e.json():(console.error("Failed to fetch plugin stats:",e.statusText),null)}catch(e){return console.error("Error fetching plugin stats:",e),null}}async function jme(t,e){try{const n=e||K5(),r=await fetch(`${C0}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点赞失败"}}catch(n){return console.error("Error liking plugin:",n),{success:!1,error:"网络错误"}}}async function Nme(t,e){try{const n=e||K5(),r=await fetch(`${C0}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点踩失败"}}catch(n){return console.error("Error disliking plugin:",n),{success:!1,error:"网络错误"}}}async function Cme(t,e,n,r){if(e<1||e>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const s=r||K5(),i=await fetch(`${C0}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,rating:e,comment:n,user_id:s})}),l=await i.json();return i.status===429?{success:!1,error:"每天最多评分 3 次"}:i.ok?{success:!0,...l}:{success:!1,error:l.error||"评分失败"}}catch(s){return console.error("Error rating plugin:",s),{success:!1,error:"网络错误"}}}async function Tme(t){try{const e=await fetch(`${C0}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t})}),n=await e.json();return e.status===429?(console.warn("Download recording rate limited"),{success:!0}):e.ok?{success:!0,...n}:(console.error("Failed to record download:",n.error),{success:!1,error:n.error})}catch(e){return console.error("Error recording download:",e),{success:!1,error:"网络错误"}}}function Ame(){const t=navigator,e=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,t.deviceMemory||0].join("|");let n=0;for(let r=0;r{i(!0);const j=await zz(t);j&&r(j),i(!1)};S.useEffect(()=>{v()},[t]);const b=async()=>{const j=await jme(t);j.success?(x({title:"已点赞",description:"感谢你的支持!"}),v()):x({title:"点赞失败",description:j.error||"未知错误",variant:"destructive"})},k=async()=>{const j=await Nme(t);j.success?(x({title:"已反馈",description:"感谢你的反馈!"}),v()):x({title:"操作失败",description:j.error||"未知错误",variant:"destructive"})},O=async()=>{if(l===0){x({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const j=await Cme(t,l,d||void 0);j.success?(x({title:"评分成功",description:"感谢你的评价!"}),p(!1),c(0),h(""),v()):x({title:"评分失败",description:j.error||"未知错误",variant:"destructive"})};return s?a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:"-"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Jl,{className:"h-4 w-4"}),a.jsx("span",{children:"-"})]})]}):n?e?a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${n.downloads.toLocaleString()}`,children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:n.downloads.toLocaleString()})]}),a.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${n.rating.toFixed(1)} (${n.rating_count} 条评价)`,children:[a.jsx(Jl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsx("span",{children:n.rating.toFixed(1)})]}),a.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${n.likes}`,children:[a.jsx(my,{className:"h-4 w-4"}),a.jsx("span",{children:n.likes})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(fc,{className:"h-5 w-5 text-muted-foreground mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.downloads.toLocaleString()}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(Jl,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),a.jsx("span",{className:"text-2xl font-bold",children:n.rating.toFixed(1)}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.rating_count," 条评价"]})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(my,{className:"h-5 w-5 text-green-500 mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.likes}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(dO,{className:"h-5 w-5 text-red-500 mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.dislikes}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:b,children:[a.jsx(my,{className:"h-4 w-4 mr-1"}),"点赞"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:k,children:[a.jsx(dO,{className:"h-4 w-4 mr-1"}),"点踩"]}),a.jsxs(Rr,{open:m,onOpenChange:p,children:[a.jsx(mw,{asChild:!0,children:a.jsxs(ie,{variant:"default",size:"sm",children:[a.jsx(Jl,{className:"h-4 w-4 mr-1"}),"评分"]})}),a.jsxs(Nr,{children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"为插件评分"}),a.jsx(Gr,{children:"分享你的使用体验,帮助其他用户"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(j=>a.jsx("button",{onClick:()=>c(j),className:"focus:outline-none",children:a.jsx(Jl,{className:`h-8 w-8 transition-colors ${j<=l?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},j))}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[l===0&&"点击星星进行评分",l===1&&"很差",l===2&&"一般",l===3&&"还行",l===4&&"不错",l===5&&"非常好"]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),a.jsx(_n,{value:d,onChange:j=>h(j.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[d.length," / 500"]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>p(!1),children:"取消"}),a.jsx(ie,{onClick:O,disabled:l===0,children:"提交评分"})]})]})]})]}),n.recent_ratings&&n.recent_ratings.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),a.jsx("div",{className:"space-y-3",children:n.recent_ratings.map((j,T)=>a.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(A=>a.jsx(Jl,{className:`h-3 w-3 ${A<=j.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},A))}),a.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(j.created_at).toLocaleDateString()})]}),j.comment&&a.jsx("p",{className:"text-sm text-muted-foreground",children:j.comment})]},T))})]})]}):null}const a9={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function Eme(){const t=wa(),[e,n]=S.useState(null),[r,s]=S.useState(""),[i,l]=S.useState("all"),[c,d]=S.useState("all"),[h,m]=S.useState(!0),[p,x]=S.useState([]),[v,b]=S.useState(!0),[k,O]=S.useState(null),[j,T]=S.useState(null),[A,_]=S.useState(null),[D,E]=S.useState(null),[,z]=S.useState([]),[Q,F]=S.useState({}),{toast:L}=Pr(),U=async R=>{const me=R.map(async K=>{try{const H=await zz(K.id);return{id:K.id,stats:H}}catch(H){return console.warn(`Failed to load stats for ${K.id}:`,H),{id:K.id,stats:null}}}),Y=await Promise.all(me),P={};Y.forEach(({id:K,stats:H})=>{H&&(P[K]=H)}),F(P)};S.useEffect(()=>{let R=null,me=!1;return(async()=>{if(R=wme(P=>{me||(_(P),P.stage==="success"?setTimeout(()=>{me||_(null)},2e3):P.stage==="error"&&(b(!1),O(P.error||"加载失败")))},P=>{console.error("WebSocket error:",P),me||L({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(P=>{if(!R){P();return}const K=()=>{R&&R.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),P()):R&&R.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),P()):setTimeout(K,100)};K()}),!me){const P=await vme();T(P),P.installed||L({title:"Git 未安装",description:P.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!me){const P=await yme();E(P)}if(!me)try{b(!0),O(null);const P=await xme();if(!me){const K=await Lp();z(K);const H=P.map(fe=>{const ve=Ip(fe.id,K),Re=qp(fe.id,K);return{...fe,installed:ve,installed_version:Re}});for(const fe of K)!H.some(Re=>Re.id===fe.id)&&fe.manifest&&H.push({id:fe.id,manifest:{manifest_version:fe.manifest.manifest_version||1,name:fe.manifest.name,version:fe.manifest.version,description:fe.manifest.description||"",author:fe.manifest.author,license:fe.manifest.license||"Unknown",host_application:fe.manifest.host_application,homepage_url:fe.manifest.homepage_url,repository_url:fe.manifest.repository_url,keywords:fe.manifest.keywords||[],categories:fe.manifest.categories||[],default_locale:fe.manifest.default_locale||"zh-CN",locales_path:fe.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:fe.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});x(H),U(H)}}catch(P){if(!me){const K=P instanceof Error?P.message:"加载插件列表失败";O(K),L({title:"加载失败",description:K,variant:"destructive"})}}finally{me||b(!1)}})(),()=>{me=!0,R&&R.close()}},[L]);const V=R=>{if(!R.installed&&D&&!ce(R))return a.jsxs(On,{variant:"destructive",className:"gap-1",children:[a.jsx(xc,{className:"h-3 w-3"}),"不兼容"]});if(R.installed){const me=R.installed_version?.trim(),Y=R.manifest.version?.trim();if(me!==Y){const P=me?.split(".").map(Number)||[0,0,0],K=Y?.split(".").map(Number)||[0,0,0];for(let H=0;H<3;H++){if((K[H]||0)>(P[H]||0))return a.jsxs(On,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[a.jsx(xc,{className:"h-3 w-3"}),"可更新"]});if((K[H]||0)<(P[H]||0))break}}return a.jsxs(On,{variant:"default",className:"gap-1",children:[a.jsx(Es,{className:"h-3 w-3"}),"已安装"]})}return null},ce=R=>!D||!R.manifest?.host_application?!0:bme(R.manifest.host_application.min_version,R.manifest.host_application.max_version,D),W=R=>{if(!R.installed||!R.installed_version||!R.manifest?.version)return!1;const me=R.installed_version.trim(),Y=R.manifest.version.trim();if(me===Y)return!1;const P=me.split(".").map(Number),K=Y.split(".").map(Number);for(let H=0;H<3;H++){if((K[H]||0)>(P[H]||0))return!0;if((K[H]||0)<(P[H]||0))return!1}return!1},J=p.filter(R=>{if(!R.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",R.id),!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(H=>H.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i);let P=!0;c==="installed"?P=R.installed===!0:c==="updates"&&(P=R.installed===!0&&W(R));const K=!h||!D||ce(R);return me&&Y&&P&&K}),$=()=>{n(null)},ae=async R=>{if(!j?.installed){L({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(D&&!ce(R)){L({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await Sme(R.id,R.manifest.repository_url||"","main"),Tme(R.id).catch(Y=>{console.warn("Failed to record download:",Y)}),L({title:"安装成功",description:`${R.manifest.name} 已成功安装`});const me=await Lp();z(me),x(Y=>Y.map(P=>{if(P.id===R.id){const K=Ip(P.id,me),H=qp(P.id,me);return{...P,installed:K,installed_version:H}}return P}))}catch(me){L({title:"安装失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}},ne=async R=>{try{await kme(R.id),L({title:"卸载成功",description:`${R.manifest.name} 已成功卸载`});const me=await Lp();z(me),x(Y=>Y.map(P=>{if(P.id===R.id){const K=Ip(P.id,me),H=qp(P.id,me);return{...P,installed:K,installed_version:H}}return P}))}catch(me){L({title:"卸载失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}},ue=async R=>{if(!j?.installed){L({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const me=await Ome(R.id,R.manifest.repository_url||"","main");L({title:"更新成功",description:`${R.manifest.name} 已从 ${me.old_version} 更新到 ${me.new_version}`});const Y=await Lp();z(Y),x(P=>P.map(K=>{if(K.id===R.id){const H=Ip(K.id,Y),fe=qp(K.id,Y);return{...K,installed:H,installed_version:fe}}return K}))}catch(me){L({title:"更新失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}};return a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),a.jsxs(ie,{onClick:()=>t({to:"/plugin-mirrors"}),children:[a.jsx(Cq,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),j&&!j.installed&&a.jsxs(gt,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[a.jsx(Wt,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Hu,{className:"h-5 w-5 text-orange-600"}),a.jsxs("div",{children:[a.jsx(Gt,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),a.jsx(Sr,{className:"text-orange-800 dark:text-orange-200",children:j.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),a.jsx(an,{children:a.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",a.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索插件...",value:r,onChange:R=>s(R.target.value),className:"pl-9"})]}),a.jsxs(Lt,{value:i,onValueChange:l,children:[a.jsx(Dt,{className:"w-full sm:w-[200px]",children:a.jsx(It,{placeholder:"选择分类"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部分类"}),a.jsx(Pe,{value:"Group Management",children:"群组管理"}),a.jsx(Pe,{value:"Entertainment & Interaction",children:"娱乐互动"}),a.jsx(Pe,{value:"Utility Tools",children:"实用工具"}),a.jsx(Pe,{value:"Content Generation",children:"内容生成"}),a.jsx(Pe,{value:"Multimedia",children:"多媒体"}),a.jsx(Pe,{value:"External Integration",children:"外部集成"}),a.jsx(Pe,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),a.jsx(Pe,{value:"Other",children:"其他"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"compatible-only",checked:h,onCheckedChange:R=>m(R===!0)}),a.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),a.jsx(hl,{value:c,onValueChange:d,className:"w-full",children:a.jsxs(ya,{className:"grid w-full grid-cols-3",children:[a.jsxs($t,{value:"all",children:["全部插件 (",p.filter(R=>{if(!R.manifest)return!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(K=>K.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),P=!h||!D||ce(R);return me&&Y&&P}).length,")"]}),a.jsxs($t,{value:"installed",children:["已安装 (",p.filter(R=>{if(!R.manifest)return!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(K=>K.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),P=!h||!D||ce(R);return R.installed&&me&&Y&&P}).length,")"]}),a.jsxs($t,{value:"updates",children:["可更新 (",p.filter(R=>{if(!R.manifest)return!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(K=>K.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),P=!h||!D||ce(R);return R.installed&&W(R)&&me&&Y&&P}).length,")"]})]})}),A&&A.stage==="loading"&&a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(hf,{className:"h-4 w-4 animate-spin"}),a.jsxs("span",{className:"text-sm font-medium",children:[A.operation==="fetch"&&"加载插件列表",A.operation==="install"&&`安装插件${A.plugin_id?`: ${A.plugin_id}`:""}`,A.operation==="uninstall"&&`卸载插件${A.plugin_id?`: ${A.plugin_id}`:""}`,A.operation==="update"&&`更新插件${A.plugin_id?`: ${A.plugin_id}`:""}`]})]}),a.jsxs("span",{className:"text-sm font-medium",children:[A.progress,"%"]})]}),a.jsx(n0,{value:A.progress,className:"h-2"}),a.jsx("div",{className:"text-xs text-muted-foreground",children:A.message}),A.operation==="fetch"&&A.total_plugins>0&&a.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",A.loaded_plugins," / ",A.total_plugins," 个插件"]})]})}),A&&A.stage==="error"&&A.error&&a.jsx(gt,{className:"border-destructive bg-destructive/10",children:a.jsx(Wt,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Hu,{className:"h-5 w-5 text-destructive"}),a.jsxs("div",{children:[a.jsx(Gt,{className:"text-lg text-destructive",children:"加载失败"}),a.jsx(Sr,{className:"text-destructive/80",children:A.error})]})]})})}),v?a.jsxs("div",{className:"flex items-center justify-center py-12",children:[a.jsx(hf,{className:"h-8 w-8 animate-spin text-muted-foreground"}),a.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):k?a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Hu,{className:"h-12 w-12 text-destructive mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:k}),a.jsx(ie,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):J.length===0?a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Bs,{className:"h-12 w-12 text-muted-foreground mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:r||i!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:J.map(R=>a.jsxs(gt,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[a.jsxs(Wt,{children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx(Gt,{className:"text-xl",children:R.manifest?.name||R.id}),a.jsxs("div",{className:"flex flex-col gap-1",children:[R.manifest?.categories&&R.manifest.categories[0]&&a.jsx(On,{variant:"secondary",className:"text-xs whitespace-nowrap",children:a9[R.manifest.categories[0]]||R.manifest.categories[0]}),V(R)]})]}),a.jsx(Sr,{className:"line-clamp-2",children:R.manifest?.description||"无描述"})]}),a.jsx(an,{className:"flex-1",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:(Q[R.id]?.downloads??R.downloads??0).toLocaleString()})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Jl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsx("span",{children:(Q[R.id]?.rating??R.rating??0).toFixed(1)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[R.manifest?.keywords&&R.manifest.keywords.slice(0,3).map(me=>a.jsx(On,{variant:"outline",className:"text-xs",children:me},me)),R.manifest?.keywords&&R.manifest.keywords.length>3&&a.jsxs(On,{variant:"outline",className:"text-xs",children:["+",R.manifest.keywords.length-3]})]}),a.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[a.jsxs("div",{children:["v",R.manifest?.version||"unknown"," · ",R.manifest?.author?.name||"Unknown"]}),R.manifest?.host_application&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{children:"支持:"}),a.jsxs("span",{className:"font-medium",children:[R.manifest.host_application.min_version,R.manifest.host_application.max_version?` - ${R.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),a.jsx(bC,{className:"pt-4",children:a.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>n(R),children:"查看详情"}),R.installed?W(R)?a.jsxs(ie,{size:"sm",disabled:!j?.installed,title:j?.installed?void 0:"Git 未安装",onClick:()=>ue(R),children:[a.jsx(Fi,{className:"h-4 w-4 mr-1"}),"更新"]}):a.jsxs(ie,{variant:"destructive",size:"sm",disabled:!j?.installed,title:j?.installed?void 0:"Git 未安装",onClick:()=>ne(R),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"卸载"]}):a.jsxs(ie,{size:"sm",disabled:!j?.installed||A?.operation==="install"||D!==null&&!ce(R),title:j?.installed?D!==null&&!ce(R)?`不兼容当前版本 (需要 ${R.manifest?.host_application?.min_version||"未知"}${R.manifest?.host_application?.max_version?` - ${R.manifest.host_application.max_version}`:"+"},当前 ${D?.version})`:void 0:"Git 未安装",onClick:()=>ae(R),children:[a.jsx(fc,{className:"h-4 w-4 mr-1"}),A?.operation==="install"&&A?.plugin_id===R.id?"安装中...":"安装"]})]})})]},R.id))}),a.jsx(Rr,{open:e!==null,onOpenChange:$,children:e&&e.manifest&&a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsx(Cr,{children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"space-y-2 flex-1",children:[a.jsx(Tr,{className:"text-2xl",children:e.manifest.name}),a.jsxs(Gr,{children:["作者: ",e.manifest.author?.name||"Unknown",e.manifest.author?.url&&a.jsx("a",{href:e.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:a.jsx(Yh,{className:"h-3 w-3 inline"})})]})]}),a.jsxs("div",{className:"flex flex-col gap-2",children:[e.manifest.categories&&e.manifest.categories[0]&&a.jsx(On,{variant:"secondary",children:a9[e.manifest.categories[0]]||e.manifest.categories[0]}),V(e)]})]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(Mme,{pluginId:e.id}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"版本"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",e.manifest?.version||"unknown"]}),e.installed&&e.installed_version&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",e.installed_version]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"下载量"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:(Q[e.id]?.downloads??e.downloads??0).toLocaleString()})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"评分"}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Jl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[(Q[e.id]?.rating??e.rating??0).toFixed(1)," (",Q[e.id]?.rating_count??e.review_count??0,")"]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"许可证"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.license||"Unknown"})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.manifest.host_application?.min_version||"未知",e.manifest.host_application?.max_version?` - ${e.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:e.manifest.keywords&&e.manifest.keywords.map(R=>a.jsx(On,{variant:"outline",children:R},R))})]}),e.detailed_description&&a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),a.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:e.detailed_description})]}),!e.detailed_description&&a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.description||"无描述"})]}),a.jsxs("div",{className:"space-y-2",children:[e.manifest.homepage_url&&a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium",children:"主页: "}),a.jsx("a",{href:e.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.homepage_url})]}),e.manifest.repository_url&&a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium",children:"仓库: "}),a.jsx("a",{href:e.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.repository_url})]})]})]}),a.jsxs(ps,{children:[e.manifest.homepage_url&&a.jsxs(ie,{onClick:()=>window.open(e.manifest.homepage_url,"_blank"),children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"访问主页"]}),e.manifest.repository_url&&a.jsxs(ie,{variant:"outline",onClick:()=>window.open(e.manifest.repository_url,"_blank"),children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function _me(){return a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(Fi,{className:"h-4 w-4 mr-2"}),"刷新"]}),a.jsxs(ie,{size:"sm",children:[a.jsx(Ii,{className:"h-4 w-4 mr-2"}),"全局设置"]})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"已安装插件"}),a.jsx(pg,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"正在加载..."})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"已启用"}),a.jsx(Es,{className:"h-4 w-4 text-green-600"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"已禁用"}),a.jsx(xc,{className:"h-4 w-4 text-orange-600"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"可更新"}),a.jsx(Fi,{className:"h-4 w-4 text-blue-600"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"有新版本可用"})]})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"已安装的插件"}),a.jsx(Sr,{children:"查看和管理已安装插件的配置"})]}),a.jsx(an,{children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[a.jsx(pg,{className:"h-16 w-16 text-muted-foreground/50"}),a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"插件配置功能开发中"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"即将支持插件的启用/禁用、参数配置等功能"})]}),a.jsx("div",{className:"flex gap-2",children:a.jsx(ie,{variant:"outline",asChild:!0,children:a.jsxs("a",{href:"/plugins",children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"前往插件市场"]})})})]})})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(gt,{children:[a.jsx(Wt,{children:a.jsx(Gt,{className:"text-base",children:"即将推出的功能"})}),a.jsx(an,{children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"插件启用/禁用"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"快速切换插件运行状态"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"配置参数编辑"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"可视化编辑插件配置文件"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"依赖管理"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"查看和安装插件依赖包"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"插件日志"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"查看插件运行日志和错误信息"})]})]})]})})]}),a.jsxs(gt,{children:[a.jsx(Wt,{children:a.jsx(Gt,{className:"text-base",children:"开发者工具"})}),a.jsx(an,{children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"热重载"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"无需重启即可重新加载插件"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"配置验证"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查配置文件格式和完整性"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"性能监控"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"监控插件的资源占用情况"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"调试模式"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"详细的调试信息和错误追踪"})]})]})]})})]})]}),a.jsx(gt,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:a.jsx(an,{className:"pt-6",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(xc,{className:"h-5 w-5 text-blue-600 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"开发进行中"}),a.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["插件配置功能正在积极开发中。目前您可以通过",a.jsx("strong",{children:"插件市场"}),"安装和卸载插件,完整的配置管理功能即将推出。"]})]})]})})})]})})}function Dme(){const t=wa(),{toast:e}=Pr(),[n,r]=S.useState([]),[s,i]=S.useState(!0),[l,c]=S.useState(null),[d,h]=S.useState(null),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O=S.useCallback(async()=>{try{i(!0),c(null);const z=localStorage.getItem("access-token"),Q=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${z}`}});if(!Q.ok)throw new Error("获取镜像源列表失败");const F=await Q.json();r(F.mirrors||[])}catch(z){const Q=z instanceof Error?z.message:"加载镜像源失败";c(Q),e({title:"加载失败",description:Q,variant:"destructive"})}finally{i(!1)}},[e]);S.useEffect(()=>{O()},[O]);const j=async()=>{try{const z=localStorage.getItem("access-token"),Q=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${z}`,"Content-Type":"application/json"},body:JSON.stringify(b)});if(!Q.ok){const F=await Q.json();throw new Error(F.detail||"添加镜像源失败")}e({title:"添加成功",description:"镜像源已添加"}),p(!1),k({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O()}catch(z){e({title:"添加失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"})}},T=async()=>{if(d)try{const z=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${d.id}`,{method:"PUT",headers:{Authorization:`Bearer ${z}`,"Content-Type":"application/json"},body:JSON.stringify({name:b.name,raw_prefix:b.raw_prefix,clone_prefix:b.clone_prefix,enabled:b.enabled,priority:b.priority})})).ok)throw new Error("更新镜像源失败");e({title:"更新成功",description:"镜像源已更新"}),v(!1),h(null),O()}catch(z){e({title:"更新失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"})}},A=async z=>{if(confirm("确定要删除这个镜像源吗?"))try{const Q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z}`,{method:"DELETE",headers:{Authorization:`Bearer ${Q}`}})).ok)throw new Error("删除镜像源失败");e({title:"删除成功",description:"镜像源已删除"}),O()}catch(Q){e({title:"删除失败",description:Q instanceof Error?Q.message:"未知错误",variant:"destructive"})}},_=async z=>{try{const Q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z.id}`,{method:"PUT",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!z.enabled})})).ok)throw new Error("更新状态失败");O()}catch(Q){e({title:"更新失败",description:Q instanceof Error?Q.message:"未知错误",variant:"destructive"})}},D=z=>{h(z),k({id:z.id,name:z.name,raw_prefix:z.raw_prefix,clone_prefix:z.clone_prefix,enabled:z.enabled,priority:z.priority}),v(!0)},E=async(z,Q)=>{const F=Q==="up"?z.priority-1:z.priority+1;if(!(F<1))try{const L=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z.id}`,{method:"PUT",headers:{Authorization:`Bearer ${L}`,"Content-Type":"application/json"},body:JSON.stringify({priority:F})})).ok)throw new Error("更新优先级失败");O()}catch(L){e({title:"更新失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}};return a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>t({to:"/plugins"}),children:a.jsx(R9,{className:"h-5 w-5"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),a.jsxs(ie,{onClick:()=>p(!0),children:[a.jsx(Wr,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),s?a.jsx(gt,{className:"p-6",children:a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(hf,{className:"h-8 w-8 animate-spin text-primary"})})}):l?a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Hu,{className:"h-12 w-12 text-destructive mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:l}),a.jsx(ie,{onClick:O,children:"重新加载"})]})}):a.jsxs(gt,{children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{children:"状态"}),a.jsx(xt,{children:"名称"}),a.jsx(xt,{children:"ID"}),a.jsx(xt,{children:"优先级"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n.map(z=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(jt,{checked:z.enabled,onCheckedChange:()=>_(z)})}),a.jsx(it,{children:a.jsxs("div",{children:[a.jsx("div",{className:"font-medium",children:z.name}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",z.raw_prefix]})]})}),a.jsx(it,{children:a.jsx(On,{variant:"outline",children:z.id})}),a.jsx(it,{children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-mono",children:z.priority}),a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx(ie,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(z,"up"),disabled:z.priority===1,children:a.jsx(e2,{className:"h-3 w-3"})}),a.jsx(ie,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(z,"down"),children:a.jsx(df,{className:"h-3 w-3"})})]})]})}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>D(z),children:a.jsx(nd,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>A(z.id),children:a.jsx(Ht,{className:"h-4 w-4 text-destructive"})})]})})]},z.id))})]})}),a.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(z=>a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:"font-semibold",children:z.name}),z.enabled&&a.jsx(On,{variant:"default",className:"text-xs",children:"启用"})]}),a.jsx(On,{variant:"outline",className:"mt-1 text-xs",children:z.id})]}),a.jsx(jt,{checked:z.enabled,onCheckedChange:()=>_(z)})]}),a.jsxs("div",{className:"text-sm space-y-1",children:[a.jsxs("div",{className:"text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"Raw: "}),a.jsx("span",{className:"break-all",children:z.raw_prefix})]}),a.jsxs("div",{className:"text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"优先级: "}),a.jsx("span",{className:"font-mono",children:z.priority})]})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[a.jsxs(ie,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>D(z),children:[a.jsx(nd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>E(z,"up"),disabled:z.priority===1,children:a.jsx(e2,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>E(z,"down"),children:a.jsx(df,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"destructive",size:"sm",onClick:()=>A(z.id),children:a.jsx(Ht,{className:"h-4 w-4"})})]})]})},z.id))})]}),a.jsx(Rr,{open:m,onOpenChange:p,children:a.jsxs(Nr,{className:"max-w-lg",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"添加镜像源"}),a.jsx(Gr,{children:"添加新的 Git 镜像源配置"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-id",children:"镜像源 ID *"}),a.jsx(Me,{id:"add-id",placeholder:"例如: my-mirror",value:b.id,onChange:z=>k({...b,id:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-name",children:"名称 *"}),a.jsx(Me,{id:"add-name",placeholder:"例如: 我的镜像源",value:b.name,onChange:z=>k({...b,name:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),a.jsx(Me,{id:"add-raw",placeholder:"https://example.com/raw",value:b.raw_prefix,onChange:z=>k({...b,raw_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-clone",children:"克隆前缀 *"}),a.jsx(Me,{id:"add-clone",placeholder:"https://example.com/clone",value:b.clone_prefix,onChange:z=>k({...b,clone_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-priority",children:"优先级"}),a.jsx(Me,{id:"add-priority",type:"number",min:"1",value:b.priority,onChange:z=>k({...b,priority:parseInt(z.target.value)||1})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"add-enabled",checked:b.enabled,onCheckedChange:z=>k({...b,enabled:z})}),a.jsx(te,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>p(!1),children:"取消"}),a.jsx(ie,{onClick:j,children:"添加"})]})]})}),a.jsx(Rr,{open:x,onOpenChange:v,children:a.jsxs(Nr,{className:"max-w-lg",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑镜像源"}),a.jsx(Gr,{children:"修改镜像源配置"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"镜像源 ID"}),a.jsx(Me,{value:b.id,disabled:!0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-name",children:"名称 *"}),a.jsx(Me,{id:"edit-name",value:b.name,onChange:z=>k({...b,name:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),a.jsx(Me,{id:"edit-raw",value:b.raw_prefix,onChange:z=>k({...b,raw_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-clone",children:"克隆前缀 *"}),a.jsx(Me,{id:"edit-clone",value:b.clone_prefix,onChange:z=>k({...b,clone_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-priority",children:"优先级"}),a.jsx(Me,{id:"edit-priority",type:"number",min:"1",value:b.priority,onChange:z=>k({...b,priority:parseInt(z.target.value)||1})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"edit-enabled",checked:b.enabled,onCheckedChange:z=>k({...b,enabled:z})}),a.jsx(te,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>v(!1),children:"取消"}),a.jsx(ie,{onClick:T,children:"保存"})]})]})})]})})}const Rme=Nd("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),Pz=S.forwardRef(({className:t,size:e,abbrTitle:n,children:r,...s},i)=>a.jsx("kbd",{className:ye(Rme({size:e,className:t})),ref:i,...s,children:n?a.jsx("abbr",{title:n,children:r}):r}));Pz.displayName="Kbd";const zme=[{icon:hg,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:ao,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:z9,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:P9,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:K4,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Wf,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:B9,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:Tq,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:pg,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:fg,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:Ii,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function Pme({open:t,onOpenChange:e}){const[n,r]=S.useState(""),[s,i]=S.useState(0),l=wa(),c=zme.filter(m=>m.title.toLowerCase().includes(n.toLowerCase())||m.description.toLowerCase().includes(n.toLowerCase())||m.category.toLowerCase().includes(n.toLowerCase()));S.useEffect(()=>{t&&(r(""),i(0))},[t]);const d=S.useCallback(m=>{l({to:m}),e(!1)},[l,e]),h=S.useCallback(m=>{m.key==="ArrowDown"?(m.preventDefault(),i(p=>(p+1)%c.length)):m.key==="ArrowUp"?(m.preventDefault(),i(p=>(p-1+c.length)%c.length)):m.key==="Enter"&&c[s]&&(m.preventDefault(),d(c[s].path))},[c,s,d]);return a.jsx(Rr,{open:t,onOpenChange:e,children:a.jsxs(Nr,{className:"max-w-2xl p-0 gap-0",children:[a.jsxs(Cr,{className:"px-4 pt-4 pb-0",children:[a.jsx(Tr,{className:"sr-only",children:"搜索"}),a.jsxs("div",{className:"relative",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),a.jsx(Me,{value:n,onChange:m=>{r(m.target.value),i(0)},onKeyDown:h,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),a.jsx("div",{className:"border-t",children:a.jsx(mn,{className:"h-[400px]",children:c.length>0?a.jsx("div",{className:"p-2",children:c.map((m,p)=>{const x=m.icon;return a.jsxs("button",{onClick:()=>d(m.path),onMouseEnter:()=>i(p),className:ye("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",p===s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[a.jsx(x,{className:"h-5 w-5 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium text-sm",children:m.title}),a.jsx("div",{className:"text-xs text-muted-foreground truncate",children:m.description})]}),a.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:m.category})]},m.path)})}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx(Bs,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),a.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function Bme(t){const e=Lme(t),n=S.forwardRef((r,s)=>{const{children:i,...l}=r,c=S.Children.toArray(i),d=c.find(qme);if(d){const h=d.props.children,m=c.map(p=>p===d?S.Children.count(h)>1?S.Children.only(null):S.isValidElement(h)?h.props.children:null:p);return a.jsx(e,{...l,ref:s,children:S.isValidElement(h)?S.cloneElement(h,void 0,m):null})}return a.jsx(e,{...l,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function Lme(t){const e=S.forwardRef((n,r)=>{const{children:s,...i}=n;if(S.isValidElement(s)){const l=Qme(s),c=Fme(i,s.props);return s.type!==S.Fragment&&(c.ref=r?oo(r,l):l),S.cloneElement(s,c)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Ime=Symbol("radix.slottable");function qme(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Ime}function Fme(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...c)=>{const d=i(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function Qme(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var z4=["Enter"," "],$me=["ArrowDown","PageUp","Home"],Bz=["ArrowUp","PageDown","End"],Hme=[...$me,...Bz],Ume={ltr:[...z4,"ArrowRight"],rtl:[...z4,"ArrowLeft"]},Vme={ltr:["ArrowLeft"],rtl:["ArrowRight"]},T0="Menu",[$f,Wme,Gme]=tx(T0),[Lc,Lz]=Vi(T0,[Gme,wd,fx]),A0=wd(),Iz=fx(),[qz,Eo]=Lc(T0),[Xme,M0]=Lc(T0),Fz=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:l=!0}=t,c=A0(e),[d,h]=S.useState(null),m=S.useRef(!1),p=es(i),x=Vf(s);return S.useEffect(()=>{const v=()=>{m.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>m.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),a.jsx(ix,{...c,children:a.jsx(qz,{scope:e,open:n,onOpenChange:p,content:d,onContentChange:h,children:a.jsx(Xme,{scope:e,onClose:S.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:m,dir:x,modal:l,children:r})})})};Fz.displayName=T0;var Yme="MenuAnchor",Z5=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=A0(n);return a.jsx(ax,{...s,...r,ref:e})});Z5.displayName=Yme;var J5="MenuPortal",[Kme,Qz]=Lc(J5,{forceMount:void 0}),$z=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=Eo(J5,e);return a.jsx(Kme,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};$z.displayName=J5;var Ci="MenuContent",[Zme,e3]=Lc(Ci),Hz=S.forwardRef((t,e)=>{const n=Qz(Ci,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Eo(Ci,t.__scopeMenu),l=M0(Ci,t.__scopeMenu);return a.jsx($f.Provider,{scope:t.__scopeMenu,children:a.jsx(Ls,{present:r||i.open,children:a.jsx($f.Slot,{scope:t.__scopeMenu,children:l.modal?a.jsx(Jme,{...s,ref:e}):a.jsx(epe,{...s,ref:e})})})})}),Jme=S.forwardRef((t,e)=>{const n=Eo(Ci,t.__scopeMenu),r=S.useRef(null),s=Cn(e,r);return S.useEffect(()=>{const i=r.current;if(i)return j9(i)},[]),a.jsx(t3,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:$e(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),epe=S.forwardRef((t,e)=>{const n=Eo(Ci,t.__scopeMenu);return a.jsx(t3,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),tpe=Bme("MenuContent.ScrollLock"),t3=S.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:d,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:x,onDismiss:v,disableOutsideScroll:b,...k}=t,O=Eo(Ci,n),j=M0(Ci,n),T=A0(n),A=Iz(n),_=Wme(n),[D,E]=S.useState(null),z=S.useRef(null),Q=Cn(e,z,O.onContentChange),F=S.useRef(0),L=S.useRef(""),U=S.useRef(0),V=S.useRef(null),ce=S.useRef("right"),W=S.useRef(0),J=b?N9:S.Fragment,$=b?{as:tpe,allowPinchZoom:!0}:void 0,ae=ue=>{const R=L.current+ue,me=_().filter(ve=>!ve.disabled),Y=document.activeElement,P=me.find(ve=>ve.ref.current===Y)?.textValue,K=me.map(ve=>ve.textValue),H=fpe(K,R,P),fe=me.find(ve=>ve.textValue===H)?.ref.current;(function ve(Re){L.current=Re,window.clearTimeout(F.current),Re!==""&&(F.current=window.setTimeout(()=>ve(""),1e3))})(R),fe&&setTimeout(()=>fe.focus())};S.useEffect(()=>()=>window.clearTimeout(F.current),[]),C9();const ne=S.useCallback(ue=>ce.current===V.current?.side&&ppe(ue,V.current?.area),[]);return a.jsx(Zme,{scope:n,searchRef:L,onItemEnter:S.useCallback(ue=>{ne(ue)&&ue.preventDefault()},[ne]),onItemLeave:S.useCallback(ue=>{ne(ue)||(z.current?.focus(),E(null))},[ne]),onTriggerLeave:S.useCallback(ue=>{ne(ue)&&ue.preventDefault()},[ne]),pointerGraceTimerRef:U,onPointerGraceIntentChange:S.useCallback(ue=>{V.current=ue},[]),children:a.jsx(J,{...$,children:a.jsx(T9,{asChild:!0,trapped:s,onMountAutoFocus:$e(i,ue=>{ue.preventDefault(),z.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:x,onDismiss:v,children:a.jsx(NC,{asChild:!0,...A,dir:j.dir,orientation:"vertical",loop:r,currentTabStopId:D,onCurrentTabStopIdChange:E,onEntryFocus:$e(d,ue=>{j.isUsingKeyboardRef.current||ue.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(X4,{role:"menu","aria-orientation":"vertical","data-state":lP(O.open),"data-radix-menu-content":"",dir:j.dir,...T,...k,ref:Q,style:{outline:"none",...k.style},onKeyDown:$e(k.onKeyDown,ue=>{const me=ue.target.closest("[data-radix-menu-content]")===ue.currentTarget,Y=ue.ctrlKey||ue.altKey||ue.metaKey,P=ue.key.length===1;me&&(ue.key==="Tab"&&ue.preventDefault(),!Y&&P&&ae(ue.key));const K=z.current;if(ue.target!==K||!Hme.includes(ue.key))return;ue.preventDefault();const fe=_().filter(ve=>!ve.disabled).map(ve=>ve.ref.current);Bz.includes(ue.key)&&fe.reverse(),dpe(fe)}),onBlur:$e(t.onBlur,ue=>{ue.currentTarget.contains(ue.target)||(window.clearTimeout(F.current),L.current="")}),onPointerMove:$e(t.onPointerMove,Hf(ue=>{const R=ue.target,me=W.current!==ue.clientX;if(ue.currentTarget.contains(R)&&me){const Y=ue.clientX>W.current?"right":"left";ce.current=Y,W.current=ue.clientX}}))})})})})})})});Hz.displayName=Ci;var npe="MenuGroup",n3=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Zt.div,{role:"group",...r,ref:e})});n3.displayName=npe;var rpe="MenuLabel",Uz=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Zt.div,{...r,ref:e})});Uz.displayName=rpe;var Jg="MenuItem",l9="menu.itemSelect",Kx=S.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=S.useRef(null),l=M0(Jg,t.__scopeMenu),c=e3(Jg,t.__scopeMenu),d=Cn(e,i),h=S.useRef(!1),m=()=>{const p=i.current;if(!n&&p){const x=new CustomEvent(l9,{bubbles:!0,cancelable:!0});p.addEventListener(l9,v=>r?.(v),{once:!0}),M9(p,x),x.defaultPrevented?h.current=!1:l.onClose()}};return a.jsx(Vz,{...s,ref:d,disabled:n,onClick:$e(t.onClick,m),onPointerDown:p=>{t.onPointerDown?.(p),h.current=!0},onPointerUp:$e(t.onPointerUp,p=>{h.current||p.currentTarget?.click()}),onKeyDown:$e(t.onKeyDown,p=>{const x=c.searchRef.current!=="";n||x&&p.key===" "||z4.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Kx.displayName=Jg;var Vz=S.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,l=e3(Jg,n),c=Iz(n),d=S.useRef(null),h=Cn(e,d),[m,p]=S.useState(!1),[x,v]=S.useState("");return S.useEffect(()=>{const b=d.current;b&&v((b.textContent??"").trim())},[i.children]),a.jsx($f.ItemSlot,{scope:n,disabled:r,textValue:s??x,children:a.jsx(CC,{asChild:!0,...c,focusable:!r,children:a.jsx(Zt.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:h,onPointerMove:$e(t.onPointerMove,Hf(b=>{r?l.onItemLeave(b):(l.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:$e(t.onPointerLeave,Hf(b=>l.onItemLeave(b))),onFocus:$e(t.onFocus,()=>p(!0)),onBlur:$e(t.onBlur,()=>p(!1))})})})}),spe="MenuCheckboxItem",Wz=S.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return a.jsx(Zz,{scope:t.__scopeMenu,checked:n,children:a.jsx(Kx,{role:"menuitemcheckbox","aria-checked":ex(n)?"mixed":n,...s,ref:e,"data-state":i3(n),onSelect:$e(s.onSelect,()=>r?.(ex(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Wz.displayName=spe;var Gz="MenuRadioGroup",[ipe,ape]=Lc(Gz,{value:void 0,onValueChange:()=>{}}),Xz=S.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=es(r);return a.jsx(ipe,{scope:t.__scopeMenu,value:n,onValueChange:i,children:a.jsx(n3,{...s,ref:e})})});Xz.displayName=Gz;var Yz="MenuRadioItem",Kz=S.forwardRef((t,e)=>{const{value:n,...r}=t,s=ape(Yz,t.__scopeMenu),i=n===s.value;return a.jsx(Zz,{scope:t.__scopeMenu,checked:i,children:a.jsx(Kx,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":i3(i),onSelect:$e(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Kz.displayName=Yz;var r3="MenuItemIndicator",[Zz,lpe]=Lc(r3,{checked:!1}),Jz=S.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=lpe(r3,n);return a.jsx(Ls,{present:r||ex(i.checked)||i.checked===!0,children:a.jsx(Zt.span,{...s,ref:e,"data-state":i3(i.checked)})})});Jz.displayName=r3;var ope="MenuSeparator",eP=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Zt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});eP.displayName=ope;var cpe="MenuArrow",tP=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=A0(n);return a.jsx(Y4,{...s,...r,ref:e})});tP.displayName=cpe;var s3="MenuSub",[upe,nP]=Lc(s3),rP=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:s}=t,i=Eo(s3,e),l=A0(e),[c,d]=S.useState(null),[h,m]=S.useState(null),p=es(s);return S.useEffect(()=>(i.open===!1&&p(!1),()=>p(!1)),[i.open,p]),a.jsx(ix,{...l,children:a.jsx(qz,{scope:e,open:r,onOpenChange:p,content:h,onContentChange:m,children:a.jsx(upe,{scope:e,contentId:ji(),triggerId:ji(),trigger:c,onTriggerChange:d,children:n})})})};rP.displayName=s3;var Gh="MenuSubTrigger",sP=S.forwardRef((t,e)=>{const n=Eo(Gh,t.__scopeMenu),r=M0(Gh,t.__scopeMenu),s=nP(Gh,t.__scopeMenu),i=e3(Gh,t.__scopeMenu),l=S.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:d}=i,h={__scopeMenu:t.__scopeMenu},m=S.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return S.useEffect(()=>m,[m]),S.useEffect(()=>{const p=c.current;return()=>{window.clearTimeout(p),d(null)}},[c,d]),a.jsx(Z5,{asChild:!0,...h,children:a.jsx(Vz,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":lP(n.open),...t,ref:oo(e,s.onTriggerChange),onClick:p=>{t.onClick?.(p),!(t.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:$e(t.onPointerMove,Hf(p=>{i.onItemEnter(p),!p.defaultPrevented&&!t.disabled&&!n.open&&!l.current&&(i.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:$e(t.onPointerLeave,Hf(p=>{m();const x=n.content?.getBoundingClientRect();if(x){const v=n.content?.dataset.side,b=v==="right",k=b?-5:5,O=x[b?"left":"right"],j=x[b?"right":"left"];i.onPointerGraceIntentChange({area:[{x:p.clientX+k,y:p.clientY},{x:O,y:x.top},{x:j,y:x.top},{x:j,y:x.bottom},{x:O,y:x.bottom}],side:v}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(p),p.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:$e(t.onKeyDown,p=>{const x=i.searchRef.current!=="";t.disabled||x&&p.key===" "||Ume[r.dir].includes(p.key)&&(n.onOpenChange(!0),n.content?.focus(),p.preventDefault())})})})});sP.displayName=Gh;var iP="MenuSubContent",aP=S.forwardRef((t,e)=>{const n=Qz(Ci,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Eo(Ci,t.__scopeMenu),l=M0(Ci,t.__scopeMenu),c=nP(iP,t.__scopeMenu),d=S.useRef(null),h=Cn(e,d);return a.jsx($f.Provider,{scope:t.__scopeMenu,children:a.jsx(Ls,{present:r||i.open,children:a.jsx($f.Slot,{scope:t.__scopeMenu,children:a.jsx(t3,{id:c.contentId,"aria-labelledby":c.triggerId,...s,ref:h,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{l.isUsingKeyboardRef.current&&d.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:$e(t.onFocusOutside,m=>{m.target!==c.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:$e(t.onEscapeKeyDown,m=>{l.onClose(),m.preventDefault()}),onKeyDown:$e(t.onKeyDown,m=>{const p=m.currentTarget.contains(m.target),x=Vme[l.dir].includes(m.key);p&&x&&(i.onOpenChange(!1),c.trigger?.focus(),m.preventDefault())})})})})})});aP.displayName=iP;function lP(t){return t?"open":"closed"}function ex(t){return t==="indeterminate"}function i3(t){return ex(t)?"indeterminate":t?"checked":"unchecked"}function dpe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function hpe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function fpe(t,e,n){const s=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let l=hpe(t,Math.max(i,0));s.length===1&&(l=l.filter(h=>h!==n));const d=l.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return d!==n?d:void 0}function mpe(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,l=e.length-1;ir!=x>r&&n<(p-h)*(r-m)/(x-m)+h&&(s=!s)}return s}function ppe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return mpe(n,e)}function Hf(t){return e=>e.pointerType==="mouse"?t(e):void 0}var gpe=Fz,xpe=Z5,vpe=$z,ype=Hz,bpe=n3,wpe=Uz,Spe=Kx,kpe=Wz,Ope=Xz,jpe=Kz,Npe=Jz,Cpe=eP,Tpe=tP,Ape=rP,Mpe=sP,Epe=aP,a3="ContextMenu",[_pe]=Vi(a3,[Lz]),ls=Lz(),[Dpe,oP]=_pe(a3),cP=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:s,modal:i=!0}=t,[l,c]=S.useState(!1),d=ls(e),h=es(r),m=S.useCallback(p=>{c(p),h(p)},[h]);return a.jsx(Dpe,{scope:e,open:l,onOpenChange:m,modal:i,children:a.jsx(gpe,{...d,dir:s,open:l,onOpenChange:m,modal:i,children:n})})};cP.displayName=a3;var uP="ContextMenuTrigger",dP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=t,i=oP(uP,n),l=ls(n),c=S.useRef({x:0,y:0}),d=S.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...c.current})}),h=S.useRef(0),m=S.useCallback(()=>window.clearTimeout(h.current),[]),p=x=>{c.current={x:x.clientX,y:x.clientY},i.onOpenChange(!0)};return S.useEffect(()=>m,[m]),S.useEffect(()=>void(r&&m()),[r,m]),a.jsxs(a.Fragment,{children:[a.jsx(xpe,{...l,virtualRef:d}),a.jsx(Zt.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:$e(t.onContextMenu,x=>{m(),p(x),x.preventDefault()}),onPointerDown:r?t.onPointerDown:$e(t.onPointerDown,Fp(x=>{m(),h.current=window.setTimeout(()=>p(x),700)})),onPointerMove:r?t.onPointerMove:$e(t.onPointerMove,Fp(m)),onPointerCancel:r?t.onPointerCancel:$e(t.onPointerCancel,Fp(m)),onPointerUp:r?t.onPointerUp:$e(t.onPointerUp,Fp(m))})]})});dP.displayName=uP;var Rpe="ContextMenuPortal",hP=t=>{const{__scopeContextMenu:e,...n}=t,r=ls(e);return a.jsx(vpe,{...r,...n})};hP.displayName=Rpe;var fP="ContextMenuContent",mP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=oP(fP,n),i=ls(n),l=S.useRef(!1);return a.jsx(ype,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:c=>{t.onCloseAutoFocus?.(c),!c.defaultPrevented&&l.current&&c.preventDefault(),l.current=!1},onInteractOutside:c=>{t.onInteractOutside?.(c),!c.defaultPrevented&&!s.modal&&(l.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});mP.displayName=fP;var zpe="ContextMenuGroup",Ppe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(bpe,{...s,...r,ref:e})});Ppe.displayName=zpe;var Bpe="ContextMenuLabel",pP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(wpe,{...s,...r,ref:e})});pP.displayName=Bpe;var Lpe="ContextMenuItem",gP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Spe,{...s,...r,ref:e})});gP.displayName=Lpe;var Ipe="ContextMenuCheckboxItem",xP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(kpe,{...s,...r,ref:e})});xP.displayName=Ipe;var qpe="ContextMenuRadioGroup",Fpe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Ope,{...s,...r,ref:e})});Fpe.displayName=qpe;var Qpe="ContextMenuRadioItem",vP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(jpe,{...s,...r,ref:e})});vP.displayName=Qpe;var $pe="ContextMenuItemIndicator",yP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Npe,{...s,...r,ref:e})});yP.displayName=$pe;var Hpe="ContextMenuSeparator",bP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Cpe,{...s,...r,ref:e})});bP.displayName=Hpe;var Upe="ContextMenuArrow",Vpe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Tpe,{...s,...r,ref:e})});Vpe.displayName=Upe;var wP="ContextMenuSub",SP=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,open:s,defaultOpen:i}=t,l=ls(e),[c,d]=ko({prop:s,defaultProp:i??!1,onChange:r,caller:wP});return a.jsx(Ape,{...l,open:c,onOpenChange:d,children:n})};SP.displayName=wP;var Wpe="ContextMenuSubTrigger",kP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Mpe,{...s,...r,ref:e})});kP.displayName=Wpe;var Gpe="ContextMenuSubContent",OP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Epe,{...s,...r,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});OP.displayName=Gpe;function Fp(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var Xpe=cP,Ype=dP,Kpe=hP,jP=mP,NP=pP,CP=gP,TP=xP,AP=vP,MP=yP,EP=bP,Zpe=SP,_P=kP,DP=OP;const Jpe=Xpe,ege=Ype,tge=Zpe,RP=S.forwardRef(({className:t,inset:e,children:n,...r},s)=>a.jsxs(_P,{ref:s,className:ye("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...r,children:[n,a.jsx(Ac,{className:"ml-auto h-4 w-4"})]}));RP.displayName=_P.displayName;const zP=S.forwardRef(({className:t,...e},n)=>a.jsx(DP,{ref:n,className:ye("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 origin-[--radix-context-menu-content-transform-origin]",t),...e}));zP.displayName=DP.displayName;const PP=S.forwardRef(({className:t,...e},n)=>a.jsx(Kpe,{children:a.jsx(jP,{ref:n,className:ye("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-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 origin-[--radix-context-menu-content-transform-origin]",t),...e})}));PP.displayName=jP.displayName;const Bi=S.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(CP,{ref:r,className:ye("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));Bi.displayName=CP.displayName;const nge=S.forwardRef(({className:t,children:e,checked:n,...r},s)=>a.jsxs(TP,{ref:s,className:ye("relative flex 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),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(MP,{children:a.jsx(hc,{className:"h-4 w-4"})})}),e]}));nge.displayName=TP.displayName;const rge=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(AP,{ref:r,className:ye("relative flex 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(MP,{children:a.jsx(Aq,{className:"h-2 w-2 fill-current"})})}),e]}));rge.displayName=AP.displayName;const sge=S.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(NP,{ref:r,className:ye("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...n}));sge.displayName=NP.displayName;const Xh=S.forwardRef(({className:t,...e},n)=>a.jsx(EP,{ref:n,className:ye("-mx-1 my-1 h-px bg-border",t),...e}));Xh.displayName=EP.displayName;const qu=({className:t,...e})=>a.jsx("span",{className:ye("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});qu.displayName="ContextMenuShortcut";var ige=Symbol("radix.slottable");function age(t){const e=({children:n})=>a.jsx(a.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=ige,e}var[Zx]=Vi("Tooltip",[wd]),Jx=wd(),BP="TooltipProvider",lge=700,P4="tooltip.open",[oge,l3]=Zx(BP),LP=t=>{const{__scopeTooltip:e,delayDuration:n=lge,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,l=S.useRef(!0),c=S.useRef(!1),d=S.useRef(0);return S.useEffect(()=>{const h=d.current;return()=>window.clearTimeout(h)},[]),a.jsx(oge,{scope:e,isOpenDelayedRef:l,delayDuration:n,onOpen:S.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:S.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:S.useCallback(h=>{c.current=h},[]),disableHoverableContent:s,children:i})};LP.displayName=BP;var Uf="Tooltip",[cge,E0]=Zx(Uf),IP=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:l,delayDuration:c}=t,d=l3(Uf,t.__scopeTooltip),h=Jx(e),[m,p]=S.useState(null),x=ji(),v=S.useRef(0),b=l??d.disableHoverableContent,k=c??d.delayDuration,O=S.useRef(!1),[j,T]=ko({prop:r,defaultProp:s??!1,onChange:z=>{z?(d.onOpen(),document.dispatchEvent(new CustomEvent(P4))):d.onClose(),i?.(z)},caller:Uf}),A=S.useMemo(()=>j?O.current?"delayed-open":"instant-open":"closed",[j]),_=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,O.current=!1,T(!0)},[T]),D=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,T(!1)},[T]),E=S.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{O.current=!0,T(!0),v.current=0},k)},[k,T]);return S.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),a.jsx(ix,{...h,children:a.jsx(cge,{scope:e,contentId:x,open:j,stateAttribute:A,trigger:m,onTriggerChange:p,onTriggerEnter:S.useCallback(()=>{d.isOpenDelayedRef.current?E():_()},[d.isOpenDelayedRef,E,_]),onTriggerLeave:S.useCallback(()=>{b?D():(window.clearTimeout(v.current),v.current=0)},[D,b]),onOpen:_,onClose:D,disableHoverableContent:b,children:n})})};IP.displayName=Uf;var B4="TooltipTrigger",qP=S.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=E0(B4,n),i=l3(B4,n),l=Jx(n),c=S.useRef(null),d=Cn(e,c,s.onTriggerChange),h=S.useRef(!1),m=S.useRef(!1),p=S.useCallback(()=>h.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),a.jsx(ax,{asChild:!0,...l,children:a.jsx(Zt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:d,onPointerMove:$e(t.onPointerMove,x=>{x.pointerType!=="touch"&&!m.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),m.current=!0)}),onPointerLeave:$e(t.onPointerLeave,()=>{s.onTriggerLeave(),m.current=!1}),onPointerDown:$e(t.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:$e(t.onFocus,()=>{h.current||s.onOpen()}),onBlur:$e(t.onBlur,s.onClose),onClick:$e(t.onClick,s.onClose)})})});qP.displayName=B4;var o3="TooltipPortal",[uge,dge]=Zx(o3,{forceMount:void 0}),FP=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=E0(o3,e);return a.jsx(uge,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};FP.displayName=o3;var bd="TooltipContent",QP=S.forwardRef((t,e)=>{const n=dge(bd,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,l=E0(bd,t.__scopeTooltip);return a.jsx(Ls,{present:r||l.open,children:l.disableHoverableContent?a.jsx($P,{side:s,...i,ref:e}):a.jsx(hge,{side:s,...i,ref:e})})}),hge=S.forwardRef((t,e)=>{const n=E0(bd,t.__scopeTooltip),r=l3(bd,t.__scopeTooltip),s=S.useRef(null),i=Cn(e,s),[l,c]=S.useState(null),{trigger:d,onClose:h}=n,m=s.current,{onPointerInTransitChange:p}=r,x=S.useCallback(()=>{c(null),p(!1)},[p]),v=S.useCallback((b,k)=>{const O=b.currentTarget,j={x:b.clientX,y:b.clientY},T=xge(j,O.getBoundingClientRect()),A=vge(j,T),_=yge(k.getBoundingClientRect()),D=wge([...A,..._]);c(D),p(!0)},[p]);return S.useEffect(()=>()=>x(),[x]),S.useEffect(()=>{if(d&&m){const b=O=>v(O,m),k=O=>v(O,d);return d.addEventListener("pointerleave",b),m.addEventListener("pointerleave",k),()=>{d.removeEventListener("pointerleave",b),m.removeEventListener("pointerleave",k)}}},[d,m,v,x]),S.useEffect(()=>{if(l){const b=k=>{const O=k.target,j={x:k.clientX,y:k.clientY},T=d?.contains(O)||m?.contains(O),A=!bge(j,l);T?x():A&&(x(),h())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[d,m,l,h,x]),a.jsx($P,{...t,ref:i})}),[fge,mge]=Zx(Uf,{isInside:!1}),pge=age("TooltipContent"),$P=S.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:l,...c}=t,d=E0(bd,n),h=Jx(n),{onClose:m}=d;return S.useEffect(()=>(document.addEventListener(P4,m),()=>document.removeEventListener(P4,m)),[m]),S.useEffect(()=>{if(d.trigger){const p=x=>{x.target?.contains(d.trigger)&&m()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[d.trigger,m]),a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:p=>p.preventDefault(),onDismiss:m,children:a.jsxs(X4,{"data-state":d.stateAttribute,...h,...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(pge,{children:r}),a.jsx(fge,{scope:n,isInside:!0,children:a.jsx(sq,{id:d.contentId,role:"tooltip",children:s||r})})]})})});QP.displayName=bd;var HP="TooltipArrow",gge=S.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Jx(n);return mge(HP,n).isInside?null:a.jsx(Y4,{...s,...r,ref:e})});gge.displayName=HP;function xge(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function vge(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 yge(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function bge(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,l=e.length-1;ir!=x>r&&n<(p-h)*(r-m)/(x-m)+h&&(s=!s)}return s}function wge(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),Sge(e)}function Sge(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const i=e[e.length-1],l=e[e.length-2];if((i.x-l.x)*(s.y-l.y)>=(i.y-l.y)*(s.x-l.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],l=n[n.length-2];if((i.x-l.x)*(s.y-l.y)>=(i.y-l.y)*(s.x-l.x))n.pop();else break}n.push(s)}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 kge=LP,Oge=IP,jge=qP,Nge=FP,UP=QP;const Cge=kge,Tge=Oge,Age=jge,VP=S.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(Nge,{children:a.jsx(UP,{ref:r,sideOffset:e,className:ye("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",t),...n})}));VP.displayName=UP.displayName;function Mge({children:t}){CH();const[e,n]=S.useState(!0),[r,s]=S.useState(!1),[i,l]=S.useState(!1),{theme:c,setTheme:d}=dw(),h=AI(),m=wa();S.useEffect(()=>{const k=O=>{(O.metaKey||O.ctrlKey)&&O.key==="k"&&(O.preventDefault(),l(!0))};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[]);const p=[{title:"概览",items:[{icon:hg,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:ao,label:"麦麦主程序配置",path:"/config/bot"},{icon:z9,label:"麦麦模型提供商配置",path:"/config/modelProvider"},{icon:P9,label:"麦麦模型配置",path:"/config/model"},{icon:hO,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:K4,label:"表情包管理",path:"/resource/emoji"},{icon:Wf,label:"表达方式管理",path:"/resource/expression"},{icon:B9,label:"人物信息管理",path:"/resource/person"}]},{title:"扩展与监控",items:[{icon:pg,label:"插件市场",path:"/plugins"},{icon:hO,label:"插件配置",path:"/plugin-config"},{icon:fg,label:"日志查看器",path:"/logs"}]},{title:"系统",items:[{icon:Ii,label:"系统设置",path:"/settings"}]}],v=c==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":c,b=()=>{localStorage.removeItem("access-token"),m({to:"/auth"})};return a.jsx(Cge,{delayDuration:300,children:a.jsxs("div",{className:"flex h-screen overflow-hidden",children:[a.jsxs("aside",{className:ye("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",e?"lg:w-64":"lg:w-16",r?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[a.jsx("div",{className:"flex h-16 items-center border-b px-4",children:a.jsxs("div",{className:ye("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!e&&"lg:flex-none lg:w-8"),children:[a.jsxs("div",{className:ye("flex items-baseline gap-2",!e&&"lg:hidden"),children:[a.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),a.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:rH()})]}),!e&&a.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),a.jsx(mn,{className:"flex-1",children:a.jsx("nav",{className:"p-4",children:a.jsx("ul",{className:ye("space-y-6",!e&&"lg:space-y-3"),children:p.map((k,O)=>a.jsxs("li",{children:[a.jsx("div",{className:ye("px-3 h-[1.25rem]","mb-2",!e&&"lg:mb-1 lg:invisible"),children:a.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:k.title})}),!e&&O>0&&a.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),a.jsx("ul",{className:"space-y-1",children:k.items.map(j=>{const T=h({to:j.path}),A=j.icon,_=a.jsxs(a.Fragment,{children:[T&&a.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),a.jsxs("div",{className:ye("flex items-center transition-all duration-300",e?"gap-3":"lg:gap-0"),children:[a.jsx(A,{className:ye("h-5 w-5 flex-shrink-0",T&&"text-primary"),strokeWidth:2,fill:"none"}),a.jsx("span",{className:ye("text-sm font-medium whitespace-nowrap transition-all duration-300",T&&"font-semibold",e?"opacity-100 max-w-[200px]":"lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:j.label})]})]});return a.jsx("li",{className:"relative",children:a.jsxs(Tge,{children:[a.jsx(Age,{asChild:!0,children:a.jsx(MI,{to:j.path,className:ye("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",T?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",e?"px-3":"lg:px-0 lg:justify-center"),onClick:()=>s(!1),children:_})}),!e&&a.jsx(VP,{side:"right",className:"hidden lg:block",children:a.jsx("p",{children:j.label})})]})},j.path)})})]},k.title))})})})]}),r&&a.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>s(!1)}),a.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[a.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:()=>s(!r),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:a.jsx(Mq,{className:"h-5 w-5"})}),a.jsx("button",{onClick:()=>n(!e),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:e?"收起侧边栏":"展开侧边栏",children:a.jsx(Tc,{className:ye("h-5 w-5 transition-transform",!e&&"rotate-180")})})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>l(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),a.jsxs(Pz,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[a.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),a.jsx(Pme,{open:i,onOpenChange:l}),a.jsxs(ie,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[a.jsx(Eq,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),a.jsx("button",{onClick:k=>{Q$(v==="dark"?"light":"dark",d,k)},className:"rounded-lg p-2 hover:bg-accent",title:v==="dark"?"切换到浅色模式":"切换到深色模式",children:v==="dark"?a.jsx(Zb,{className:"h-5 w-5"}):a.jsx(Jb,{className:"h-5 w-5"})}),a.jsx("div",{className:"h-6 w-px bg-border"}),a.jsxs(ie,{variant:"ghost",size:"sm",onClick:b,className:"gap-2",title:"登出系统",children:[a.jsx(fO,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),a.jsxs(Jpe,{children:[a.jsx(ege,{asChild:!0,children:a.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:t})}),a.jsxs(PP,{className:"w-64",children:[a.jsxs(Bi,{onClick:()=>m({to:"/"}),children:[a.jsx(hg,{className:"mr-2 h-4 w-4"}),"首页"]}),a.jsxs(Bi,{onClick:()=>m({to:"/settings"}),children:[a.jsx(Ii,{className:"mr-2 h-4 w-4"}),"系统设置"]}),a.jsxs(Bi,{onClick:()=>m({to:"/logs"}),children:[a.jsx(fg,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),a.jsx(Xh,{}),a.jsxs(tge,{children:[a.jsxs(RP,{children:[a.jsx(_9,{className:"mr-2 h-4 w-4"}),"切换主题"]}),a.jsxs(zP,{className:"w-48",children:[a.jsxs(Bi,{onClick:()=>d("light"),disabled:c==="light",children:[a.jsx(Zb,{className:"mr-2 h-4 w-4"}),"浅色",c==="light"&&a.jsx(qu,{children:"✓"})]}),a.jsxs(Bi,{onClick:()=>d("dark"),disabled:c==="dark",children:[a.jsx(Jb,{className:"mr-2 h-4 w-4"}),"深色",c==="dark"&&a.jsx(qu,{children:"✓"})]}),a.jsxs(Bi,{onClick:()=>d("system"),disabled:c==="system",children:[a.jsx(Ii,{className:"mr-2 h-4 w-4"}),"跟随系统",c==="system"&&a.jsx(qu,{children:"✓"})]})]})]}),a.jsx(Xh,{}),a.jsxs(Bi,{onClick:()=>window.location.reload(),children:[a.jsx(_q,{className:"mr-2 h-4 w-4"}),"刷新页面",a.jsx(qu,{children:"⌘R"})]}),a.jsxs(Bi,{onClick:()=>l(!0),children:[a.jsx(Bs,{className:"mr-2 h-4 w-4"}),"搜索",a.jsx(qu,{children:"⌘K"})]}),a.jsx(Xh,{}),a.jsxs(Bi,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[a.jsx(Yh,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),a.jsx(Xh,{}),a.jsxs(Bi,{onClick:b,className:"text-destructive focus:text-destructive",children:[a.jsx(fO,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}const _0=EI({component:()=>a.jsxs(a.Fragment,{children:[a.jsx(c9,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!qT())throw DI({to:"/auth"})}}),Ege=Xr({getParentRoute:()=>_0,path:"/auth",component:TH}),_ge=Xr({getParentRoute:()=>_0,path:"/setup",component:WH}),Qs=Xr({getParentRoute:()=>_0,id:"protected",component:()=>a.jsx(Mge,{children:a.jsx(c9,{})})}),Dge=Xr({getParentRoute:()=>Qs,path:"/",component:q$}),Rge=Xr({getParentRoute:()=>Qs,path:"/config/bot",component:Vee}),zge=Xr({getParentRoute:()=>Qs,path:"/config/modelProvider",component:ote}),Pge=Xr({getParentRoute:()=>Qs,path:"/config/model",component:Pte}),Bge=Xr({getParentRoute:()=>Qs,path:"/config/adapter",component:qte}),Lge=Xr({getParentRoute:()=>Qs,path:"/resource/emoji",component:ude}),Ige=Xr({getParentRoute:()=>Qs,path:"/resource/expression",component:bde}),qge=Xr({getParentRoute:()=>Qs,path:"/resource/person",component:Ede}),Fge=Xr({getParentRoute:()=>Qs,path:"/logs",component:hme}),Qge=Xr({getParentRoute:()=>Qs,path:"/plugins",component:Eme}),$ge=Xr({getParentRoute:()=>Qs,path:"/plugin-config",component:_me}),Hge=Xr({getParentRoute:()=>Qs,path:"/plugin-mirrors",component:Dme}),Uge=Xr({getParentRoute:()=>Qs,path:"/settings",component:bH}),Vge=Xr({getParentRoute:()=>_0,path:"*",component:$T}),Wge=_0.addChildren([Ege,_ge,Qs.addChildren([Dge,Rge,zge,Pge,Bge,Lge,Ige,qge,Qge,$ge,Hge,Fge,Uge]),Vge]),Gge=_I({routeTree:Wge,defaultNotFoundComponent:$T});function Xge({children:t,defaultTheme:e="system",storageKey:n="ui-theme",...r}){const[s,i]=S.useState(()=>localStorage.getItem(n)||e);S.useEffect(()=>{const c=window.document.documentElement;if(c.classList.remove("light","dark"),s==="system"){const d=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";c.classList.add(d);return}c.classList.add(s)},[s]),S.useEffect(()=>{const c=localStorage.getItem("accent-color");if(c){const d=document.documentElement,m={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[c];m&&(d.style.setProperty("--primary",m.hsl),m.gradient?(d.style.setProperty("--primary-gradient",m.gradient),d.classList.add("has-gradient")):(d.style.removeProperty("--primary-gradient"),d.classList.remove("has-gradient")))}},[]);const l={theme:s,setTheme:c=>{localStorage.setItem(n,c),i(c)}};return a.jsx(uT.Provider,{...r,value:l,children:t})}function Yge({children:t,defaultEnabled:e=!0,defaultWavesEnabled:n=!0,storageKey:r="enable-animations",wavesStorageKey:s="enable-waves-background"}){const[i,l]=S.useState(()=>{const m=localStorage.getItem(r);return m!==null?m==="true":e}),[c,d]=S.useState(()=>{const m=localStorage.getItem(s);return m!==null?m==="true":n});S.useEffect(()=>{const m=document.documentElement;i?m.classList.remove("no-animations"):m.classList.add("no-animations"),localStorage.setItem(r,String(i))},[i,r]),S.useEffect(()=>{localStorage.setItem(s,String(c))},[c,s]);const h={enableAnimations:i,setEnableAnimations:l,enableWavesBackground:c,setEnableWavesBackground:d};return a.jsx(dT.Provider,{value:h,children:t})}var c3="ToastProvider",[u3,Kge,Zge]=tx("Toast"),[WP]=Vi("Toast",[Zge]),[Jge,e1]=WP(c3),GP=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:l}=t,[c,d]=S.useState(null),[h,m]=S.useState(0),p=S.useRef(!1),x=S.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${c3}\`. Expected non-empty \`string\`.`),a.jsx(u3.Provider,{scope:e,children:a.jsx(Jge,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:h,viewport:c,onViewportChange:d,onToastAdd:S.useCallback(()=>m(v=>v+1),[]),onToastRemove:S.useCallback(()=>m(v=>v-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:x,children:l})})};GP.displayName=c3;var XP="ToastViewport",exe=["F8"],L4="toast.viewportPause",I4="toast.viewportResume",YP=S.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=exe,label:s="Notifications ({hotkey})",...i}=t,l=e1(XP,n),c=Kge(n),d=S.useRef(null),h=S.useRef(null),m=S.useRef(null),p=S.useRef(null),x=Cn(e,p,l.onViewportChange),v=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=l.toastCount>0;S.useEffect(()=>{const O=j=>{r.length!==0&&r.every(A=>j[A]||j.code===A)&&p.current?.focus()};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[r]),S.useEffect(()=>{const O=d.current,j=p.current;if(b&&O&&j){const T=()=>{if(!l.isClosePausedRef.current){const E=new CustomEvent(L4);j.dispatchEvent(E),l.isClosePausedRef.current=!0}},A=()=>{if(l.isClosePausedRef.current){const E=new CustomEvent(I4);j.dispatchEvent(E),l.isClosePausedRef.current=!1}},_=E=>{!O.contains(E.relatedTarget)&&A()},D=()=>{O.contains(document.activeElement)||A()};return O.addEventListener("focusin",T),O.addEventListener("focusout",_),O.addEventListener("pointermove",T),O.addEventListener("pointerleave",D),window.addEventListener("blur",T),window.addEventListener("focus",A),()=>{O.removeEventListener("focusin",T),O.removeEventListener("focusout",_),O.removeEventListener("pointermove",T),O.removeEventListener("pointerleave",D),window.removeEventListener("blur",T),window.removeEventListener("focus",A)}}},[b,l.isClosePausedRef]);const k=S.useCallback(({tabbingDirection:O})=>{const T=c().map(A=>{const _=A.ref.current,D=[_,...fxe(_)];return O==="forwards"?D:D.reverse()});return(O==="forwards"?T.reverse():T).flat()},[c]);return S.useEffect(()=>{const O=p.current;if(O){const j=T=>{const A=T.altKey||T.ctrlKey||T.metaKey;if(T.key==="Tab"&&!A){const D=document.activeElement,E=T.shiftKey;if(T.target===O&&E){h.current?.focus();return}const F=k({tabbingDirection:E?"backwards":"forwards"}),L=F.findIndex(U=>U===D);Gb(F.slice(L+1))?T.preventDefault():E?h.current?.focus():m.current?.focus()}};return O.addEventListener("keydown",j),()=>O.removeEventListener("keydown",j)}},[c,k]),a.jsxs(iq,{ref:d,role:"region","aria-label":s.replace("{hotkey}",v),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&a.jsx(q4,{ref:h,onFocusFromOutsideViewport:()=>{const O=k({tabbingDirection:"forwards"});Gb(O)}}),a.jsx(u3.Slot,{scope:n,children:a.jsx(Zt.ol,{tabIndex:-1,...i,ref:x})}),b&&a.jsx(q4,{ref:m,onFocusFromOutsideViewport:()=>{const O=k({tabbingDirection:"backwards"});Gb(O)}})]})});YP.displayName=XP;var KP="ToastFocusProxy",q4=S.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=e1(KP,n);return a.jsx(E9,{tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:l=>{const c=l.relatedTarget;!i.viewport?.contains(c)&&r()}})});q4.displayName=KP;var D0="Toast",txe="toast.swipeStart",nxe="toast.swipeMove",rxe="toast.swipeCancel",sxe="toast.swipeEnd",ZP=S.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...l}=t,[c,d]=ko({prop:r,defaultProp:s??!0,onChange:i,caller:D0});return a.jsx(Ls,{present:n||c,children:a.jsx(lxe,{open:c,...l,ref:e,onClose:()=>d(!1),onPause:es(t.onPause),onResume:es(t.onResume),onSwipeStart:$e(t.onSwipeStart,h=>{h.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:$e(t.onSwipeMove,h=>{const{x:m,y:p}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","move"),h.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${m}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:$e(t.onSwipeCancel,h=>{h.currentTarget.setAttribute("data-swipe","cancel"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:$e(t.onSwipeEnd,h=>{const{x:m,y:p}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","end"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${m}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),d(!1)})})})});ZP.displayName=D0;var[ixe,axe]=WP(D0,{onClose(){}}),lxe=S.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:l,onEscapeKeyDown:c,onPause:d,onResume:h,onSwipeStart:m,onSwipeMove:p,onSwipeCancel:x,onSwipeEnd:v,...b}=t,k=e1(D0,n),[O,j]=S.useState(null),T=Cn(e,W=>j(W)),A=S.useRef(null),_=S.useRef(null),D=s||k.duration,E=S.useRef(0),z=S.useRef(D),Q=S.useRef(0),{onToastAdd:F,onToastRemove:L}=k,U=es(()=>{O?.contains(document.activeElement)&&k.viewport?.focus(),l()}),V=S.useCallback(W=>{!W||W===1/0||(window.clearTimeout(Q.current),E.current=new Date().getTime(),Q.current=window.setTimeout(U,W))},[U]);S.useEffect(()=>{const W=k.viewport;if(W){const J=()=>{V(z.current),h?.()},$=()=>{const ae=new Date().getTime()-E.current;z.current=z.current-ae,window.clearTimeout(Q.current),d?.()};return W.addEventListener(L4,$),W.addEventListener(I4,J),()=>{W.removeEventListener(L4,$),W.removeEventListener(I4,J)}}},[k.viewport,D,d,h,V]),S.useEffect(()=>{i&&!k.isClosePausedRef.current&&V(D)},[i,D,k.isClosePausedRef,V]),S.useEffect(()=>(F(),()=>L()),[F,L]);const ce=S.useMemo(()=>O?iB(O):null,[O]);return k.viewport?a.jsxs(a.Fragment,{children:[ce&&a.jsx(oxe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:ce}),a.jsx(ixe,{scope:n,onClose:U,children:RI.createPortal(a.jsx(u3.ItemSlot,{scope:n,children:a.jsx(aq,{asChild:!0,onEscapeKeyDown:$e(c,()=>{k.isFocusedToastEscapeKeyDownRef.current||U(),k.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(Zt.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":k.swipeDirection,...b,ref:T,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:$e(t.onKeyDown,W=>{W.key==="Escape"&&(c?.(W.nativeEvent),W.nativeEvent.defaultPrevented||(k.isFocusedToastEscapeKeyDownRef.current=!0,U()))}),onPointerDown:$e(t.onPointerDown,W=>{W.button===0&&(A.current={x:W.clientX,y:W.clientY})}),onPointerMove:$e(t.onPointerMove,W=>{if(!A.current)return;const J=W.clientX-A.current.x,$=W.clientY-A.current.y,ae=!!_.current,ne=["left","right"].includes(k.swipeDirection),ue=["left","up"].includes(k.swipeDirection)?Math.min:Math.max,R=ne?ue(0,J):0,me=ne?0:ue(0,$),Y=W.pointerType==="touch"?10:2,P={x:R,y:me},K={originalEvent:W,delta:P};ae?(_.current=P,Qp(nxe,p,K,{discrete:!1})):o9(P,k.swipeDirection,Y)?(_.current=P,Qp(txe,m,K,{discrete:!1}),W.target.setPointerCapture(W.pointerId)):(Math.abs(J)>Y||Math.abs($)>Y)&&(A.current=null)}),onPointerUp:$e(t.onPointerUp,W=>{const J=_.current,$=W.target;if($.hasPointerCapture(W.pointerId)&&$.releasePointerCapture(W.pointerId),_.current=null,A.current=null,J){const ae=W.currentTarget,ne={originalEvent:W,delta:J};o9(J,k.swipeDirection,k.swipeThreshold)?Qp(sxe,v,ne,{discrete:!0}):Qp(rxe,x,ne,{discrete:!0}),ae.addEventListener("click",ue=>ue.preventDefault(),{once:!0})}})})})}),k.viewport)})]}):null}),oxe=t=>{const{__scopeToast:e,children:n,...r}=t,s=e1(D0,e),[i,l]=S.useState(!1),[c,d]=S.useState(!1);return dxe(()=>l(!0)),S.useEffect(()=>{const h=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(h)},[]),c?null:a.jsx(sx,{asChild:!0,children:a.jsx(E9,{...r,children:i&&a.jsxs(a.Fragment,{children:[s.label," ",n]})})})},cxe="ToastTitle",JP=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(Zt.div,{...r,ref:e})});JP.displayName=cxe;var uxe="ToastDescription",eB=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(Zt.div,{...r,ref:e})});eB.displayName=uxe;var tB="ToastAction",nB=S.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?a.jsx(sB,{altText:n,asChild:!0,children:a.jsx(d3,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${tB}\`. Expected non-empty \`string\`.`),null)});nB.displayName=tB;var rB="ToastClose",d3=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=axe(rB,n);return a.jsx(sB,{asChild:!0,children:a.jsx(Zt.button,{type:"button",...r,ref:e,onClick:$e(t.onClick,s.onClose)})})});d3.displayName=rB;var sB=S.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return a.jsx(Zt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function iB(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),hxe(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const l=r.dataset.radixToastAnnounceAlt;l&&e.push(l)}else e.push(...iB(r))}}),e}function Qp(t,e,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?M9(s,i):s.dispatchEvent(i)}var o9=(t,e,n=0)=>{const r=Math.abs(t.x),s=Math.abs(t.y),i=r>s;return e==="left"||e==="right"?i&&r>n:!i&&s>n};function dxe(t=()=>{}){const e=es(t);h9(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function hxe(t){return t.nodeType===t.ELEMENT_NODE}function fxe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Gb(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var mxe=GP,aB=YP,lB=ZP,oB=JP,cB=eB,uB=nB,dB=d3;const pxe=mxe,hB=S.forwardRef(({className:t,...e},n)=>a.jsx(aB,{ref:n,className:ye("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));hB.displayName=aB.displayName;const gxe=Nd("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),fB=S.forwardRef(({className:t,variant:e,...n},r)=>a.jsx(lB,{ref:r,className:ye(gxe({variant:e}),t),...n}));fB.displayName=lB.displayName;const xxe=S.forwardRef(({className:t,...e},n)=>a.jsx(uB,{ref:n,className:ye("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));xxe.displayName=uB.displayName;const mB=S.forwardRef(({className:t,...e},n)=>a.jsx(dB,{ref:n,className:ye("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:a.jsx(Gf,{className:"h-4 w-4"})}));mB.displayName=dB.displayName;const pB=S.forwardRef(({className:t,...e},n)=>a.jsx(oB,{ref:n,className:ye("text-sm font-semibold [&+div]:text-xs",t),...e}));pB.displayName=oB.displayName;const gB=S.forwardRef(({className:t,...e},n)=>a.jsx(cB,{ref:n,className:ye("text-sm opacity-90",t),...e}));gB.displayName=cB.displayName;function vxe(){const{toasts:t}=Pr();return a.jsxs(pxe,{children:[t.map(function({id:e,title:n,description:r,action:s,...i}){return a.jsxs(fB,{...i,children:[a.jsxs("div",{className:"grid gap-1",children:[n&&a.jsx(pB,{children:n}),r&&a.jsx(gB,{children:r})]}),s,a.jsx(mB,{})]},e)}),a.jsx(hB,{})]})}Bq.createRoot(document.getElementById("root")).render(a.jsx(S.StrictMode,{children:a.jsx(Xge,{defaultTheme:"system",children:a.jsxs(Yge,{children:[a.jsx(zI,{router:Gge}),a.jsx(vxe,{})]})})})); diff --git a/webui/dist/index.html b/webui/dist/index.html index e0bd7ed3..dad21f82 100644 --- a/webui/dist/index.html +++ b/webui/dist/index.html @@ -5,7 +5,7 @@ MaiBot Dashboard - + From 4284e0f860526b31007c07fbed9cb70e1bd31124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Thu, 20 Nov 2025 19:01:10 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=8B=AC=E7=AB=8B?= =?UTF-8?q?=E7=9A=84=20WebUI=20=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=94=AF?= =?UTF-8?q?=E6=8C=81=EF=BC=8C=E9=87=8D=E6=9E=84=E7=9B=B8=E5=85=B3=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=92=8C=E5=90=AF=E5=8A=A8=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot.py | 9 +++ src/common/server.py | 16 ----- src/main.py | 43 +++++------ src/webui/manager.py | 109 ---------------------------- src/webui/webui_server.py | 148 ++++++++++++++++++++++++++++++++++++++ template/template.env | 7 +- 6 files changed, 185 insertions(+), 147 deletions(-) delete mode 100644 src/webui/manager.py create mode 100644 src/webui/webui_server.py diff --git a/bot.py b/bot.py index 7ba9af4b..68c6e110 100644 --- a/bot.py +++ b/bot.py @@ -75,6 +75,15 @@ async def graceful_shutdown(): # sourcery skip: use-named-expression try: logger.info("正在优雅关闭麦麦...") + # 关闭 WebUI 服务器 + try: + from src.webui.webui_server import get_webui_server + webui_server = get_webui_server() + if webui_server and webui_server._server: + await webui_server.shutdown() + except Exception as e: + logger.warning(f"关闭 WebUI 服务器时出错: {e}") + from src.plugin_system.core.events_manager import events_manager from src.plugin_system.base.component_types import EventType diff --git a/src/common/server.py b/src/common/server.py index ebdc9fa2..88608677 100644 --- a/src/common/server.py +++ b/src/common/server.py @@ -1,5 +1,4 @@ from fastapi import FastAPI, APIRouter -from fastapi.middleware.cors import CORSMiddleware # 新增导入 from typing import Optional from uvicorn import Config, Server as UvicornServer import asyncio @@ -17,21 +16,6 @@ class Server: self._server: Optional[UvicornServer] = None self.set_address(host, port) - # 配置 CORS - origins = [ - "http://localhost:7999", # 允许的前端源 - "http://127.0.0.1:7999", - # 在生产环境中,您应该添加实际的前端域名 - ] - - self.app.add_middleware( - CORSMiddleware, - allow_origins=origins, - allow_credentials=True, # 是否支持 cookie - allow_methods=["*"], # 允许所有 HTTP 方法 - allow_headers=["*"], # 允许所有 HTTP 请求头 - ) - def register_router(self, router: APIRouter, prefix: str = ""): """注册路由 diff --git a/src/main.py b/src/main.py index b442f29d..09ead248 100644 --- a/src/main.py +++ b/src/main.py @@ -36,25 +36,13 @@ class MainSystem: # 使用消息API替代直接的FastAPI实例 self.app: MessageServer = get_global_api() self.server: Server = get_global_server() + self.webui_server = None # 独立的 WebUI 服务器 - # 注册 WebUI API 路由 - self._register_webui_routes() + # 设置独立的 WebUI 服务器 + self._setup_webui_server() - # 设置 WebUI(开发/生产模式) - self._setup_webui() - - def _register_webui_routes(self): - """注册 WebUI API 路由""" - try: - from src.webui.routes import router as webui_router - - self.server.register_router(webui_router) - logger.info("WebUI API 路由已注册") - except Exception as e: - logger.warning(f"注册 WebUI API 路由失败: {e}") - - def _setup_webui(self): - """设置 WebUI(根据环境变量决定模式)""" + def _setup_webui_server(self): + """设置独立的 WebUI 服务器""" import os webui_enabled = os.getenv("WEBUI_ENABLED", "false").lower() == "true" @@ -65,11 +53,22 @@ class MainSystem: webui_mode = os.getenv("WEBUI_MODE", "production").lower() try: - from src.webui.manager import setup_webui + from src.webui.webui_server import get_webui_server - setup_webui(mode=webui_mode) + self.webui_server = get_webui_server() + + if webui_mode == "development": + logger.info("📝 WebUI 开发模式已启用") + logger.info("🌐 后端 API 将运行在 http://0.0.0.0:8001") + logger.info("💡 请手动启动前端开发服务器: cd MaiBot-Dashboard && bun dev") + logger.info("💡 前端将运行在 http://localhost:7999") + else: + logger.info("✅ WebUI 生产模式已启用") + logger.info(f"🌐 WebUI 将运行在 http://0.0.0.0:8001") + logger.info("💡 请确保已构建前端: cd MaiBot-Dashboard && bun run build") + except Exception as e: - logger.error(f"设置 WebUI 失败: {e}") + logger.error(f"❌ 初始化 WebUI 服务器失败: {e}") async def initialize(self): """初始化系统组件""" @@ -164,6 +163,10 @@ class MainSystem: self.server.run(), ] + # 如果 WebUI 服务器已初始化,添加到任务列表 + if self.webui_server: + tasks.append(self.webui_server.start()) + await asyncio.gather(*tasks) # async def forget_memory_task(self): diff --git a/src/webui/manager.py b/src/webui/manager.py deleted file mode 100644 index 4dc472e2..00000000 --- a/src/webui/manager.py +++ /dev/null @@ -1,109 +0,0 @@ -"""WebUI 管理器 - 处理开发/生产环境的 WebUI 启动""" - -import os -from pathlib import Path -from src.common.logger import get_logger -from .token_manager import get_token_manager - -logger = get_logger("webui") - - -def setup_webui(mode: str = "production") -> bool: - """ - 设置 WebUI - - Args: - mode: 运行模式,"development" 或 "production" - - Returns: - bool: 是否成功设置 - """ - # 初始化 Token 管理器(确保 token 文件存在) - token_manager = get_token_manager() - current_token = token_manager.get_token() - logger.info(f"🔑 WebUI Access Token: {current_token}") - logger.info("💡 请使用此 Token 登录 WebUI") - - if mode == "development": - return setup_dev_mode() - else: - return setup_production_mode() - - -def setup_dev_mode() -> bool: - """设置开发模式 - 仅启用 CORS,前端自行启动""" - from src.common.server import get_global_server - from .logs_ws import router as logs_router - - # 注册 WebSocket 日志路由(开发模式也需要) - server = get_global_server() - server.register_router(logs_router) - logger.info("✅ WebSocket 日志推送路由已注册") - - logger.info("📝 WebUI 开发模式已启用") - logger.info("🌐 请手动启动前端开发服务器: cd webui && npm run dev") - logger.info("💡 前端将运行在 http://localhost:7999") - return True - - -def setup_production_mode() -> bool: - """设置生产模式 - 挂载静态文件""" - try: - from src.common.server import get_global_server - from starlette.responses import FileResponse - from .logs_ws import router as logs_router - import mimetypes - - # 确保正确的 MIME 类型映射 - mimetypes.init() - mimetypes.add_type("application/javascript", ".js") - mimetypes.add_type("application/javascript", ".mjs") - mimetypes.add_type("text/css", ".css") - mimetypes.add_type("application/json", ".json") - - server = get_global_server() - - # 注册 WebSocket 日志路由 - server.register_router(logs_router) - logger.info("✅ WebSocket 日志推送路由已注册") - - base_dir = Path(__file__).parent.parent.parent - static_path = base_dir / "webui" / "dist" - - if not static_path.exists(): - logger.warning(f"❌ WebUI 静态文件目录不存在: {static_path}") - logger.warning("💡 请先构建前端: cd webui && npm run build") - return False - - if not (static_path / "index.html").exists(): - logger.warning(f"❌ 未找到 index.html: {static_path / 'index.html'}") - logger.warning("💡 请确认前端已正确构建") - return False - - # 处理 SPA 路由 - @server.app.get("/{full_path:path}") - async def serve_spa(full_path: str): - """服务单页应用""" - # API 路由不处理 - if full_path.startswith("api/"): - return None - - # 检查文件是否存在 - file_path = static_path / full_path - if file_path.is_file(): - # 自动检测 MIME 类型 - media_type = mimetypes.guess_type(str(file_path))[0] - return FileResponse(file_path, media_type=media_type) - - # 返回 index.html(SPA 路由) - return FileResponse(static_path / "index.html", media_type="text/html") - - host = os.getenv("HOST", "127.0.0.1") - port = os.getenv("PORT", "8000") - logger.info("✅ WebUI 生产模式已挂载") - logger.info(f"🌐 访问 http://{host}:{port} 查看 WebUI") - return True - - except Exception as e: - logger.error(f"挂载 WebUI 静态文件失败: {e}") - return False diff --git a/src/webui/webui_server.py b/src/webui/webui_server.py new file mode 100644 index 00000000..61d279e2 --- /dev/null +++ b/src/webui/webui_server.py @@ -0,0 +1,148 @@ +"""独立的 WebUI 服务器 - 运行在 0.0.0.0:8001""" + +import os +import asyncio +import mimetypes +from pathlib import Path +from fastapi import FastAPI +from fastapi.responses import FileResponse +from uvicorn import Config, Server as UvicornServer +from src.common.logger import get_logger + +logger = get_logger("webui_server") + + +class WebUIServer: + """独立的 WebUI 服务器""" + + def __init__(self, host: str = "0.0.0.0", port: int = 8001): + self.host = host + self.port = port + self.app = FastAPI(title="MaiBot WebUI") + self._server = None + + # 显示 Access Token + self._show_access_token() + + # 重要:先注册 API 路由,再设置静态文件 + self._register_api_routes() + self._setup_static_files() + + def _show_access_token(self): + """显示 WebUI Access Token""" + try: + from src.webui.token_manager import get_token_manager + + token_manager = get_token_manager() + current_token = token_manager.get_token() + logger.info(f"🔑 WebUI Access Token: {current_token}") + logger.info("💡 请使用此 Token 登录 WebUI") + except Exception as e: + logger.error(f"❌ 获取 Access Token 失败: {e}") + + def _setup_static_files(self): + """设置静态文件服务""" + # 确保正确的 MIME 类型映射 + mimetypes.init() + mimetypes.add_type("application/javascript", ".js") + mimetypes.add_type("application/javascript", ".mjs") + mimetypes.add_type("text/css", ".css") + mimetypes.add_type("application/json", ".json") + + base_dir = Path(__file__).parent.parent.parent + static_path = base_dir / "webui" / "dist" + + if not static_path.exists(): + logger.warning(f"❌ WebUI 静态文件目录不存在: {static_path}") + logger.warning("💡 请先构建前端: cd webui && npm run build") + return + + if not (static_path / "index.html").exists(): + logger.warning(f"❌ 未找到 index.html: {static_path / 'index.html'}") + logger.warning("💡 请确认前端已正确构建") + return + + # 处理 SPA 路由 - 注意:这个路由优先级最低 + @self.app.get("/{full_path:path}", include_in_schema=False) + async def serve_spa(full_path: str): + """服务单页应用 - 只处理非 API 请求""" + # 如果是根路径,直接返回 index.html + if not full_path or full_path == "/": + return FileResponse(static_path / "index.html", media_type="text/html") + + # 检查是否是静态文件 + file_path = static_path / full_path + if file_path.is_file() and file_path.exists(): + # 自动检测 MIME 类型 + media_type = mimetypes.guess_type(str(file_path))[0] + return FileResponse(file_path, media_type=media_type) + + # 其他路径返回 index.html(SPA 路由) + return FileResponse(static_path / "index.html", media_type="text/html") + + logger.info(f"✅ WebUI 静态文件服务已配置: {static_path}") + + def _register_api_routes(self): + """注册所有 WebUI API 路由""" + try: + # 导入所有 WebUI 路由 + from src.webui.routes import router as webui_router + from src.webui.logs_ws import router as logs_router + + # 注册路由 + self.app.include_router(webui_router) + self.app.include_router(logs_router) + + logger.info("✅ WebUI API 路由已注册") + except Exception as e: + logger.error(f"❌ 注册 WebUI API 路由失败: {e}") + + async def start(self): + """启动服务器""" + config = Config( + app=self.app, + host=self.host, + port=self.port, + log_config=None, + access_log=False, + ) + self._server = UvicornServer(config=config) + + logger.info("🌐 WebUI 服务器启动中...") + logger.info(f"🌐 访问地址: http://{self.host}:{self.port}") + + try: + await self._server.serve() + except Exception as e: + logger.error(f"❌ WebUI 服务器运行错误: {e}") + raise + + async def shutdown(self): + """关闭服务器""" + if self._server: + logger.info("正在关闭 WebUI 服务器...") + self._server.should_exit = True + try: + await asyncio.wait_for(self._server.shutdown(), timeout=3.0) + logger.info("✅ WebUI 服务器已关闭") + except asyncio.TimeoutError: + logger.warning("⚠️ WebUI 服务器关闭超时") + except Exception as e: + logger.error(f"❌ WebUI 服务器关闭失败: {e}") + finally: + self._server = None + + +# 全局 WebUI 服务器实例 +_webui_server = None + + +def get_webui_server() -> WebUIServer: + """获取全局 WebUI 服务器实例""" + global _webui_server + if _webui_server is None: + # 从环境变量读取配置 + host = os.getenv("WEBUI_HOST", "0.0.0.0") + port = int(os.getenv("WEBUI_PORT", "8001")) + _webui_server = WebUIServer(host=host, port=port) + return _webui_server diff --git a/template/template.env b/template/template.env index d19678e7..b6dd0e5c 100644 --- a/template/template.env +++ b/template/template.env @@ -1,6 +1,9 @@ +# 麦麦主程序配置 HOST=127.0.0.1 PORT=8000 -# WebUI 配置 +# WebUI 独立服务器配置 WEBUI_ENABLED=true -WEBUI_MODE=production # 生产模式 \ No newline at end of file +WEBUI_MODE=production # 模式: development(开发) 或 production(生产) +WEBUI_HOST=0.0.0.0 # WebUI 服务器监听地址 +WEBUI_PORT=8001 # WebUI 服务器端口 \ No newline at end of file From a29444f7666f297567b826d73d155937664c92e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Thu, 20 Nov 2025 19:05:58 +0800 Subject: [PATCH 11/11] upload WebUI 0.11.5 DashBoard after Build Files --- webui/dist/assets/index-BGzEu9LP.css | 1 - webui/dist/assets/index-BmybQ2BG.css | 1 + .../{index-DjSFnv4K.js => index-CRpNZMM_.js} | 86 +++++++++---------- webui/dist/index.html | 4 +- 4 files changed, 46 insertions(+), 46 deletions(-) delete mode 100644 webui/dist/assets/index-BGzEu9LP.css create mode 100644 webui/dist/assets/index-BmybQ2BG.css rename webui/dist/assets/{index-DjSFnv4K.js => index-CRpNZMM_.js} (75%) diff --git a/webui/dist/assets/index-BGzEu9LP.css b/webui/dist/assets/index-BGzEu9LP.css deleted file mode 100644 index 0abdc436..00000000 --- a/webui/dist/assets/index-BGzEu9LP.css +++ /dev/null @@ -1 +0,0 @@ -*,: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:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";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: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem;--chart-1: 221.2 83.2% 53.3%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 217.2 91.2% 59.8%;--primary-foreground: 222.2 47.4% 11.2%;--primary-gradient: none;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 224.3 76.3% 48%;--chart-1: 217.2 91.2% 59.8%;--chart-2: 160 60% 50%;--chart-3: 30 80% 60%;--chart-4: 280 65% 65%;--chart-5: 340 75% 60%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.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}.pointer-events-auto{pointer-events:auto}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-1\/4{bottom:25%}.bottom-4{bottom:1rem}.left-0{left:0}.left-1\/2{left:50%}.left-1\/4{left:25%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-1\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.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-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.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-3{margin-left:.75rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.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-9{height:2.25rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[1px\]{height:1px}.h-\[250px\]{height:250px}.h-\[300px\]{height:300px}.h-\[400px\]{height:400px}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-240px\)\]{height:calc(100vh - 240px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.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-screen{height:100vh}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[300px\]{max-height:300px}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-screen{max-height:100vh}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[300px\]{min-height:300px}.min-h-\[60px\]{min-height:60px}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-1\/4{width:25%}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.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-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[1px\]{width:1px}.w-\[70px\]{width:70px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-full{--tw-translate-x: -100%;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-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))}.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-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-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))}.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))}@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{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.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))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.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-0{gap:0px}.gap-0\.5{gap:.125rem}.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}.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-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))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-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))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.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-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.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-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.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-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.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-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / 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-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / 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\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / 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-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / 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-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-900\/20{background-color:#713f1233}.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))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 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-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-yellow-400{fill:#facc15}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.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-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.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-2\.5{padding-top:.625rem;padding-bottom:.625rem}.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}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{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}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.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-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.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-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / 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-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / 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-900{--tw-text-opacity: 1;color:rgb(17 24 39 / 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-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / 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-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.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-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.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)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px 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-offset-background{--tw-ring-offset-color: hsl(var(--background))}.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)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-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,backdrop-filter;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-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.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))}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.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-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-yellow-300:hover{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.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)}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\: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)}.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-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-0: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(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)}.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-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.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\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-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:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.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-4[data-state=checked]{--tw-translate-x: 1rem;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],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--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-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);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-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);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-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.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\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.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-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-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\=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\=active\]\:shadow[data-state=active]{--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)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--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(3px + 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\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-blue-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 58 138 / var(--tw-border-opacity, 1))}.dark\:border-gray-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:top-auto{top:auto}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mr-2{margin-right:.5rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-24{height:6rem}.sm\:h-3{height:.75rem}.sm\:h-4{height:1rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:h-\[calc\(100vh-320px\)\]{height:calc(100vh - 320px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-24{width:6rem}.sm\:w-3{width:.75rem}.sm\:w-4{width:1rem}.sm\:w-\[140px\]{width:140px}.sm\:w-\[160px\]{width:160px}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.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\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:flex-wrap{flex-wrap:wrap}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.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-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))}.sm\: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))}.sm\: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))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:mb-4{margin-bottom:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-5{height:1.25rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-5{width:1.25rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-\[420px\]{max-width:420px}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:gap-3{gap:.75rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\: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))}.md\: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))}.md\:whitespace-normal{white-space:normal}.md\:p-12{padding:3rem}.md\:p-4{padding:1rem}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:mb-1{margin-bottom:.25rem}.lg\:block{display:block}.lg\:hidden{display:none}.lg\:h-\[calc\(100vh-400px\)\]{height:calc(100vh - 400px)}.lg\:w-16{width:4rem}.lg\:w-64{width:16rem}.lg\:w-8{width:2rem}.lg\:w-\[150px\]{width:150px}.lg\:w-\[180px\]{width:180px}.lg\:w-\[200px\]{width:200px}.lg\:w-\[240px\]{width:240px}.lg\:w-\[80px\]{width:80px}.lg\:w-auto{width:auto}.lg\:max-w-0{max-width:0px}.lg\:flex-1{flex:1 1 0%}.lg\:flex-none{flex:none}.lg\: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))}.lg\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.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\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\: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))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-4{padding:1rem}.lg\:p-6{padding:1.5rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:text-3xl{font-size:1.875rem;line-height:2.25rem}.lg\:text-sm{font-size:.875rem;line-height:1.25rem}.lg\:opacity-0{opacity:0}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--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))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>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\]\: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\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&_\.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\]\:invisible svg{visibility:hidden}.\[\&_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-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.16.25"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.1666666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.6666666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.4566666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.1466666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.7142857143em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.8571428571em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.1428571429em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.2857142857em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.4285714286em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.7142857143em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.0571428571em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.4685714286em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.9628571429em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.5542857143em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.7777777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.8888888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.1111111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.3044444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.7644444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.5833333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.7283333333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.0733333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.4861111111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.4402777778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.7277777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.2893518519em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.4050925926em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462962963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.5208333333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.2002314815em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.4398148148em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.2410800386em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2892960463em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512054em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.3857280617em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.4339440694em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.4821600771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.5785920926em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.6943105111em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8331726133em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.1996142719em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.2009646302em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.2411575563em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.2813504823em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.3215434084em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.3617363344em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.4019292605em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.4823151125em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778135em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.6945337621em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.8336012862em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo} diff --git a/webui/dist/assets/index-BmybQ2BG.css b/webui/dist/assets/index-BmybQ2BG.css new file mode 100644 index 00000000..bb6e4a9a --- /dev/null +++ b/webui/dist/assets/index-BmybQ2BG.css @@ -0,0 +1 @@ +*,: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:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";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: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem;--chart-1: 221.2 83.2% 53.3%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 217.2 91.2% 59.8%;--primary-foreground: 222.2 47.4% 11.2%;--primary-gradient: none;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 224.3 76.3% 48%;--chart-1: 217.2 91.2% 59.8%;--chart-2: 160 60% 50%;--chart-3: 30 80% 60%;--chart-4: 280 65% 65%;--chart-5: 340 75% 60%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.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}.pointer-events-auto{pointer-events:auto}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-1\/4{bottom:25%}.bottom-4{bottom:1rem}.left-0{left:0}.left-1\/2{left:50%}.left-1\/4{left:25%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-1\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.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-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.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-3{margin-left:.75rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.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-9{height:2.25rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[1px\]{height:1px}.h-\[250px\]{height:250px}.h-\[300px\]{height:300px}.h-\[400px\]{height:400px}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-240px\)\]{height:calc(100vh - 240px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.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-screen{height:100vh}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[300px\]{max-height:300px}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-screen{max-height:100vh}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[300px\]{min-height:300px}.min-h-\[60px\]{min-height:60px}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-1\/4{width:25%}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.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-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[1px\]{width:1px}.w-\[70px\]{width:70px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-full{--tw-translate-x: -100%;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-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))}.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-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-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))}.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))}@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{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.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))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.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-0{gap:0px}.gap-0\.5{gap:.125rem}.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}.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-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))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-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))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.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-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.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-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.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-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/30{border-color:hsl(var(--primary) / .3)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.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-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / 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-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / 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\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / 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-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / 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-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-900\/20{background-color:#713f1233}.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))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 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-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-primary\/10{--tw-gradient-to: hsl(var(--primary) / .1) var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-yellow-400{fill:#facc15}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.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-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.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-2\.5{padding-top:.625rem;padding-bottom:.625rem}.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}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{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}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.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-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.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-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / 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-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / 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-900{--tw-text-opacity: 1;color:rgb(17 24 39 / 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-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / 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-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.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-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.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)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px 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-offset-background{--tw-ring-offset-color: hsl(var(--background))}.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)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-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,backdrop-filter;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-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.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))}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.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-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-yellow-300:hover{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.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)}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\: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)}.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-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-0: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(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)}.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-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.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\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-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:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.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-4[data-state=checked]{--tw-translate-x: 1rem;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],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--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-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);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-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);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-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.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\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.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-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-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\=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\=active\]\:shadow[data-state=active]{--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)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--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(3px + 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\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-blue-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 58 138 / var(--tw-border-opacity, 1))}.dark\:border-gray-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:top-auto{top:auto}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mr-2{margin-right:.5rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-24{height:6rem}.sm\:h-3{height:.75rem}.sm\:h-4{height:1rem}.sm\:h-8{height:2rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:h-\[calc\(100vh-320px\)\]{height:calc(100vh - 320px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-24{width:6rem}.sm\:w-3{width:.75rem}.sm\:w-4{width:1rem}.sm\:w-8{width:2rem}.sm\:w-\[140px\]{width:140px}.sm\:w-\[160px\]{width:160px}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.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\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:flex-wrap{flex-wrap:wrap}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.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-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))}.sm\: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))}.sm\: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))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:mb-4{margin-bottom:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-5{height:1.25rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-5{width:1.25rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-\[420px\]{max-width:420px}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:gap-3{gap:.75rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\: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))}.md\: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))}.md\:whitespace-normal{white-space:normal}.md\:p-12{padding:3rem}.md\:p-4{padding:1rem}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:mb-1{margin-bottom:.25rem}.lg\:block{display:block}.lg\:hidden{display:none}.lg\:h-\[calc\(100vh-400px\)\]{height:calc(100vh - 400px)}.lg\:w-16{width:4rem}.lg\:w-64{width:16rem}.lg\:w-8{width:2rem}.lg\:w-\[150px\]{width:150px}.lg\:w-\[180px\]{width:180px}.lg\:w-\[200px\]{width:200px}.lg\:w-\[240px\]{width:240px}.lg\:w-\[80px\]{width:80px}.lg\:w-auto{width:auto}.lg\:max-w-0{max-width:0px}.lg\:flex-1{flex:1 1 0%}.lg\:flex-none{flex:none}.lg\: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))}.lg\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.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\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\: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))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-4{padding:1rem}.lg\:p-6{padding:1.5rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:text-3xl{font-size:1.875rem;line-height:2.25rem}.lg\:text-sm{font-size:.875rem;line-height:1.25rem}.lg\:opacity-0{opacity:0}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--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))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>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\]\: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\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&_\.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\]\:invisible svg{visibility:hidden}.\[\&_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-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.16.25"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.1666666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.6666666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.4566666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.1466666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.7142857143em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.8571428571em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.1428571429em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.2857142857em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.4285714286em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.7142857143em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.0571428571em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.4685714286em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.9628571429em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.5542857143em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.7777777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.8888888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.1111111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.3044444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.7644444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.5833333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.7283333333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.0733333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.4861111111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.4402777778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.7277777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.2893518519em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.4050925926em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462962963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.5208333333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.2002314815em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.4398148148em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.2410800386em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2892960463em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512054em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.3857280617em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.4339440694em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.4821600771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.5785920926em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.6943105111em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8331726133em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.1996142719em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.2009646302em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.2411575563em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.2813504823em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.3215434084em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.3617363344em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.4019292605em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.4823151125em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778135em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.6945337621em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.8336012862em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo} diff --git a/webui/dist/assets/index-DjSFnv4K.js b/webui/dist/assets/index-CRpNZMM_.js similarity index 75% rename from webui/dist/assets/index-DjSFnv4K.js rename to webui/dist/assets/index-CRpNZMM_.js index f3ad35f9..4b579329 100644 --- a/webui/dist/assets/index-DjSFnv4K.js +++ b/webui/dist/assets/index-CRpNZMM_.js @@ -1,17 +1,17 @@ -import{r as S,j as a,u as wa,R as Ue,d as AI,L as MI,e as EI,f as Xr,g as _I,h as DI,O as c9,b as RI,k as zI}from"./router-BWgTyY51.js";import{a as PI,b as BI,g as u9}from"./react-vendor-Dtc2IqVY.js";import{c as d9,R as LI,T as II,L as qI,a as FI,C as Vm,X as Wm,Y as Ch,b as QI,B as fy,d as Gm,P as $I,e as HI,f as UI,_ as VI,g as WI}from"./charts-B1JvyJzO.js";import{c as Vi,a as tx,u as ji,P as Zt,b as $e,d as Cn,e as Vf,f as ko,g as es,h as Ls,i as h9,j as F4,k as Q4,S as GI,l as f9,m as m9,R as p9,O as nx,n as $4,C as rx,o as H4,T as U4,D as V4,p as W4,q as g9,r as x9,W as XI,s as v9,I as YI,t as y9,v as b9,w as KI,x as w9,V as ZI,L as S9,y as k9,z as JI,A as eq,B as O9,E as tq,F as nq,G as oo,H as sx,J as wd,K as j9,M as N9,N as C9,Q as T9,U as G4,X as X4,Y as ix,Z as ax,_ as Y4,$ as A9,a0 as rq,a1 as M9,a2 as sq,a3 as iq,a4 as E9,a5 as aq}from"./ui-vendor-nTGLnMlb.js";import{R as Fi,A as lq,D as oq,a as cq,Z as uf,C as dc,M as Wf,T as uq,X as Gf,P as _9,S as dq,b as Ii,I as co,c as Hu,d as hc,e as Xb,E as Yb,f as $i,g as Es,h as Kb,i as hq,j as Zb,k as Jb,L as lO,K as fq,l as xc,m as mq,n as pq,F as ao,o as gq,B as xq,U as D9,p as K4,q as vq,r as yq,s as Bs,H as hg,t as R9,u as df,v as e2,w as hf,x as bq,y as wq,z as lx,G as Z4,J as Wr,N as Ht,O as fg,Q as nd,V as Xf,W as Tc,Y as Ac,_ as Yf,$ as Sq,a0 as oO,a1 as kq,a2 as fc,a3 as t2,a4 as rd,a5 as cO,a6 as mg,a7 as Oq,a8 as uO,a9 as jq,aa as Nq,ab as Jl,ac as my,ad as dO,ae as Cq,af as Yh,ag as pg,ah as z9,ai as P9,aj as B9,ak as Tq,al as Aq,am as hO,an as Mq,ao as Eq,ap as fO,aq as _q}from"./icons-D6w7t-x9.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var py={exports:{}},Th={},gy={exports:{}},xy={};var mO;function Dq(){return mO||(mO=1,(function(t){function e($,ae){var ne=$.length;$.push(ae);e:for(;0>>1,R=$[ue];if(0>>1;ues(P,ne))Ks(H,P)?($[ue]=H,$[K]=ne,ue=K):($[ue]=P,$[Y]=ne,ue=Y);else if(Ks(H,ne))$[ue]=H,$[K]=ne,ue=K;else break e}}return ae}function s($,ae){var ne=$.sortIndex-ae.sortIndex;return ne!==0?ne:$.id-ae.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var l=Date,c=l.now();t.unstable_now=function(){return l.now()-c}}var d=[],h=[],m=1,p=null,x=3,v=!1,b=!1,k=!1,O=!1,j=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function _($){for(var ae=n(h);ae!==null;){if(ae.callback===null)r(h);else if(ae.startTime<=$)r(h),ae.sortIndex=ae.expirationTime,e(d,ae);else break;ae=n(h)}}function D($){if(k=!1,_($),!b)if(n(d)!==null)b=!0,E||(E=!0,V());else{var ae=n(h);ae!==null&&J(D,ae.startTime-$)}}var E=!1,z=-1,Q=5,F=-1;function L(){return O?!0:!(t.unstable_now()-F$&&L());){var ue=p.callback;if(typeof ue=="function"){p.callback=null,x=p.priorityLevel;var R=ue(p.expirationTime<=$);if($=t.unstable_now(),typeof R=="function"){p.callback=R,_($),ae=!0;break t}p===n(d)&&r(d),_($)}else r(d);p=n(d)}if(p!==null)ae=!0;else{var me=n(h);me!==null&&J(D,me.startTime-$),ae=!1}}break e}finally{p=null,x=ne,v=!1}ae=void 0}}finally{ae?V():E=!1}}}var V;if(typeof A=="function")V=function(){A(U)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,W=ce.port2;ce.port1.onmessage=U,V=function(){W.postMessage(null)}}else V=function(){j(U,0)};function J($,ae){z=j(function(){$(t.unstable_now())},ae)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function($){$.callback=null},t.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<$?Math.floor(1e3/$):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_next=function($){switch(x){case 1:case 2:case 3:var ae=3;break;default:ae=x}var ne=x;x=ae;try{return $()}finally{x=ne}},t.unstable_requestPaint=function(){O=!0},t.unstable_runWithPriority=function($,ae){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var ne=x;x=$;try{return ae()}finally{x=ne}},t.unstable_scheduleCallback=function($,ae,ne){var ue=t.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0ue?($.sortIndex=ne,e(h,$),n(d)===null&&$===n(h)&&(k?(T(z),z=-1):k=!0,J(D,ne-ue))):($.sortIndex=R,e(d,$),b||v||(b=!0,E||(E=!0,V()))),$},t.unstable_shouldYield=L,t.unstable_wrapCallback=function($){var ae=x;return function(){var ne=x;x=ae;try{return $.apply(this,arguments)}finally{x=ne}}}})(xy)),xy}var pO;function Rq(){return pO||(pO=1,gy.exports=Dq()),gy.exports}var gO;function zq(){if(gO)return Th;gO=1;var t=Rq(),e=PI(),n=BI();function r(o){var u="https://react.dev/errors/"+o;if(1R||(o.current=ue[R],ue[R]=null,R--)}function P(o,u){R++,ue[R]=o.current,o.current=u}var K=me(null),H=me(null),fe=me(null),ve=me(null);function Re(o,u){switch(P(fe,u),P(H,o),P(K,null),u.nodeType){case 9:case 11:o=(o=u.documentElement)&&(o=o.namespaceURI)?Mk(o):0;break;default:if(o=u.tagName,u=u.namespaceURI)u=Mk(u),o=Ek(u,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}Y(K),P(K,o)}function de(){Y(K),Y(H),Y(fe)}function We(o){o.memoizedState!==null&&P(ve,o);var u=K.current,f=Ek(u,o.type);u!==f&&(P(H,o),P(K,f))}function ct(o){H.current===o&&(Y(K),Y(H)),ve.current===o&&(Y(ve),kh._currentValue=ne)}var Oe,nt;function ut(o){if(Oe===void 0)try{throw Error()}catch(f){var u=f.stack.trim().match(/\n( *(at )?)/);Oe=u&&u[1]||"",nt=-1{for(const i of s)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var py={exports:{}},Th={},gy={exports:{}},xy={};var mO;function Dq(){return mO||(mO=1,(function(t){function e(H,ae){var ne=H.length;H.push(ae);e:for(;0>>1,R=H[ue];if(0>>1;ues(P,ne))Ks($,P)?(H[ue]=$,H[K]=ne,ue=K):(H[ue]=P,H[Y]=ne,ue=Y);else if(Ks($,ne))H[ue]=$,H[K]=ne,ue=K;else break e}}return ae}function s(H,ae){var ne=H.sortIndex-ae.sortIndex;return ne!==0?ne:H.id-ae.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var l=Date,c=l.now();t.unstable_now=function(){return l.now()-c}}var d=[],h=[],m=1,p=null,x=3,v=!1,b=!1,k=!1,O=!1,j=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function _(H){for(var ae=n(h);ae!==null;){if(ae.callback===null)r(h);else if(ae.startTime<=H)r(h),ae.sortIndex=ae.expirationTime,e(d,ae);else break;ae=n(h)}}function D(H){if(k=!1,_(H),!b)if(n(d)!==null)b=!0,E||(E=!0,V());else{var ae=n(h);ae!==null&&J(D,ae.startTime-H)}}var E=!1,z=-1,Q=5,F=-1;function L(){return O?!0:!(t.unstable_now()-FH&&L());){var ue=p.callback;if(typeof ue=="function"){p.callback=null,x=p.priorityLevel;var R=ue(p.expirationTime<=H);if(H=t.unstable_now(),typeof R=="function"){p.callback=R,_(H),ae=!0;break t}p===n(d)&&r(d),_(H)}else r(d);p=n(d)}if(p!==null)ae=!0;else{var me=n(h);me!==null&&J(D,me.startTime-H),ae=!1}}break e}finally{p=null,x=ne,v=!1}ae=void 0}}finally{ae?V():E=!1}}}var V;if(typeof M=="function")V=function(){M(U)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,W=ce.port2;ce.port1.onmessage=U,V=function(){W.postMessage(null)}}else V=function(){j(U,0)};function J(H,ae){z=j(function(){H(t.unstable_now())},ae)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(H){H.callback=null},t.unstable_forceFrameRate=function(H){0>H||125ue?(H.sortIndex=ne,e(h,H),n(d)===null&&H===n(h)&&(k?(T(z),z=-1):k=!0,J(D,ne-ue))):(H.sortIndex=R,e(d,H),b||v||(b=!0,E||(E=!0,V()))),H},t.unstable_shouldYield=L,t.unstable_wrapCallback=function(H){var ae=x;return function(){var ne=x;x=ae;try{return H.apply(this,arguments)}finally{x=ne}}}})(xy)),xy}var pO;function Rq(){return pO||(pO=1,gy.exports=Dq()),gy.exports}var gO;function zq(){if(gO)return Th;gO=1;var t=Rq(),e=PI(),n=BI();function r(o){var u="https://react.dev/errors/"+o;if(1R||(o.current=ue[R],ue[R]=null,R--)}function P(o,u){R++,ue[R]=o.current,o.current=u}var K=me(null),$=me(null),fe=me(null),ve=me(null);function Re(o,u){switch(P(fe,u),P($,o),P(K,null),u.nodeType){case 9:case 11:o=(o=u.documentElement)&&(o=o.namespaceURI)?Ak(o):0;break;default:if(o=u.tagName,u=u.namespaceURI)u=Ak(u),o=Ek(u,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}Y(K),P(K,o)}function de(){Y(K),Y($),Y(fe)}function We(o){o.memoizedState!==null&&P(ve,o);var u=K.current,f=Ek(u,o.type);u!==f&&(P($,o),P(K,f))}function ct(o){$.current===o&&(Y(K),Y($)),ve.current===o&&(Y(ve),kh._currentValue=ne)}var Oe,nt;function ut(o){if(Oe===void 0)try{throw Error()}catch(f){var u=f.stack.trim().match(/\n( *(at )?)/);Oe=u&&u[1]||"",nt=-1)":-1y||Z[g]!==xe[y]){var je=` `+Z[g].replace(" at new "," at ");return o.displayName&&je.includes("")&&(je=je.replace("",o.displayName)),je}while(1<=g&&0<=y);break}}}finally{Ct=!1,Error.prepareStackTrace=f}return(f=o?o.displayName||o.name:"")?ut(f):""}function Tn(o,u){switch(o.tag){case 26:case 27:case 5:return ut(o.type);case 16:return ut("Lazy");case 13:return o.child!==u&&u!==null?ut("Suspense Fallback"):ut("Suspense");case 19:return ut("SuspenseList");case 0:case 15:return In(o.type,!1);case 11:return In(o.type.render,!1);case 1:return In(o.type,!0);case 31:return ut("Activity");default:return""}}function Jn(o){try{var u="",f=null;do u+=Tn(o,f),f=o,o=o.return;while(o);return u}catch(g){return` Error generating stack: `+g.message+` -`+g.stack}}var nn=Object.prototype.hasOwnProperty,_t=t.unstable_scheduleCallback,Yr=t.unstable_cancelCallback,qn=t.unstable_shouldYield,or=t.unstable_requestPaint,yn=t.unstable_now,ft=t.unstable_getCurrentPriorityLevel,ee=t.unstable_ImmediatePriority,Se=t.unstable_UserBlockingPriority,Be=t.unstable_NormalPriority,rt=t.unstable_LowPriority,Tt=t.unstable_IdlePriority,cr=t.log,Kr=t.unstable_setDisableYieldValue,re=null,Ae=null;function pt(o){if(typeof cr=="function"&&Kr(o),Ae&&typeof Ae.setStrictMode=="function")try{Ae.setStrictMode(re,o)}catch{}}var yt=Math.clz32?Math.clz32:Pn,vs=Math.log,dt=Math.LN2;function Pn(o){return o>>>=0,o===0?32:31-(vs(o)/dt|0)|0}var mt=256,rn=262144,Mr=4194304;function At(o){var u=o&42;if(u!==0)return u;switch(o&-o){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Ic(o,u,f){var g=o.pendingLanes;if(g===0)return 0;var y=0,w=o.suspendedLanes,M=o.pingedLanes;o=o.warmLanes;var I=g&134217727;return I!==0?(g=I&~w,g!==0?y=At(g):(M&=I,M!==0?y=At(M):f||(f=I&~o,f!==0&&(y=At(f))))):(I=g&~w,I!==0?y=At(I):M!==0?y=At(M):f||(f=g&~o,f!==0&&(y=At(f)))),y===0?0:u!==0&&u!==y&&(u&w)===0&&(w=y&-y,f=u&-u,w>=f||w===32&&(f&4194048)!==0)?u:y}function _o(o,u){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&u)===0}function t1(o,u){switch(o){case 1:case 2:case 4:case 8:case 64:return u+250;case 16:case 32: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 u+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function qc(){var o=Mr;return Mr<<=1,(Mr&62914560)===0&&(Mr=4194304),o}function Do(o){for(var u=[],f=0;31>f;f++)u.push(o);return u}function Bd(o,u){o.pendingLanes|=u,u!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function xB(o,u,f,g,y,w){var M=o.pendingLanes;o.pendingLanes=f,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=f,o.entangledLanes&=f,o.errorRecoveryDisabledLanes&=f,o.shellSuspendCounter=0;var I=o.entanglements,Z=o.expirationTimes,xe=o.hiddenUpdates;for(f=M&~f;0"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var kB=/[\n"\\]/g;function ci(o){return o.replace(kB,function(u){return"\\"+u.charCodeAt(0).toString(16)+" "})}function l1(o,u,f,g,y,w,M,I){o.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?o.type=M:o.removeAttribute("type"),u!=null?M==="number"?(u===0&&o.value===""||o.value!=u)&&(o.value=""+oi(u)):o.value!==""+oi(u)&&(o.value=""+oi(u)):M!=="submit"&&M!=="reset"||o.removeAttribute("value"),u!=null?o1(o,M,oi(u)):f!=null?o1(o,M,oi(f)):g!=null&&o.removeAttribute("value"),y==null&&w!=null&&(o.defaultChecked=!!w),y!=null&&(o.checked=y&&typeof y!="function"&&typeof y!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?o.name=""+oi(I):o.removeAttribute("name")}function O3(o,u,f,g,y,w,M,I){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(o.type=w),u!=null||f!=null){if(!(w!=="submit"&&w!=="reset"||u!=null)){a1(o);return}f=f!=null?""+oi(f):"",u=u!=null?""+oi(u):f,I||u===o.value||(o.value=u),o.defaultValue=u}g=g??y,g=typeof g!="function"&&typeof g!="symbol"&&!!g,o.checked=I?o.checked:!!g,o.defaultChecked=!!g,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(o.name=M),a1(o)}function o1(o,u,f){u==="number"&&P0(o.ownerDocument)===o||o.defaultValue===""+f||(o.defaultValue=""+f)}function Vc(o,u,f,g){if(o=o.options,u){u={};for(var y=0;y"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f1=!1;if(Da)try{var Fd={};Object.defineProperty(Fd,"passive",{get:function(){f1=!0}}),window.addEventListener("test",Fd,Fd),window.removeEventListener("test",Fd,Fd)}catch{f1=!1}var jl=null,m1=null,L0=null;function E3(){if(L0)return L0;var o,u=m1,f=u.length,g,y="value"in jl?jl.value:jl.textContent,w=y.length;for(o=0;o=Hd),B3=" ",L3=!1;function I3(o,u){switch(o){case"keyup":return KB.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function q3(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Yc=!1;function JB(o,u){switch(o){case"compositionend":return q3(u);case"keypress":return u.which!==32?null:(L3=!0,B3);case"textInput":return o=u.data,o===B3&&L3?null:o;default:return null}}function eL(o,u){if(Yc)return o==="compositionend"||!y1&&I3(o,u)?(o=E3(),L0=m1=jl=null,Yc=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1=u)return{node:f,offset:u-o};o=g}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=G3(f)}}function Y3(o,u){return o&&u?o===u?!0:o&&o.nodeType===3?!1:u&&u.nodeType===3?Y3(o,u.parentNode):"contains"in o?o.contains(u):o.compareDocumentPosition?!!(o.compareDocumentPosition(u)&16):!1:!1}function K3(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var u=P0(o.document);u instanceof o.HTMLIFrameElement;){try{var f=typeof u.contentWindow.location.href=="string"}catch{f=!1}if(f)o=u.contentWindow;else break;u=P0(o.document)}return u}function S1(o){var u=o&&o.nodeName&&o.nodeName.toLowerCase();return u&&(u==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||u==="textarea"||o.contentEditable==="true")}var oL=Da&&"documentMode"in document&&11>=document.documentMode,Kc=null,k1=null,Gd=null,O1=!1;function Z3(o,u,f){var g=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;O1||Kc==null||Kc!==P0(g)||(g=Kc,"selectionStart"in g&&S1(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Gd&&Wd(Gd,g)||(Gd=g,g=Em(k1,"onSelect"),0>=M,y-=M,Yi=1<<32-yt(u)+y|f<kt?(Qt=Ke,Ke=null):Qt=Ke.sibling;var en=be(oe,Ke,pe[kt],Ne);if(en===null){Ke===null&&(Ke=Qt);break}o&&Ke&&en.alternate===null&&u(oe,Ke),se=w(en,se,kt),Jt===null?tt=en:Jt.sibling=en,Jt=en,Ke=Qt}if(kt===pe.length)return f(oe,Ke),Ut&&za(oe,kt),tt;if(Ke===null){for(;ktkt?(Qt=Ke,Ke=null):Qt=Ke.sibling;var Wl=be(oe,Ke,en.value,Ne);if(Wl===null){Ke===null&&(Ke=Qt);break}o&&Ke&&Wl.alternate===null&&u(oe,Ke),se=w(Wl,se,kt),Jt===null?tt=Wl:Jt.sibling=Wl,Jt=Wl,Ke=Qt}if(en.done)return f(oe,Ke),Ut&&za(oe,kt),tt;if(Ke===null){for(;!en.done;kt++,en=pe.next())en=Te(oe,en.value,Ne),en!==null&&(se=w(en,se,kt),Jt===null?tt=en:Jt.sibling=en,Jt=en);return Ut&&za(oe,kt),tt}for(Ke=g(Ke);!en.done;kt++,en=pe.next())en=ke(Ke,oe,kt,en.value,Ne),en!==null&&(o&&en.alternate!==null&&Ke.delete(en.key===null?kt:en.key),se=w(en,se,kt),Jt===null?tt=en:Jt.sibling=en,Jt=en);return o&&Ke.forEach(function(TI){return u(oe,TI)}),Ut&&za(oe,kt),tt}function Sn(oe,se,pe,Ne){if(typeof pe=="object"&&pe!==null&&pe.type===k&&pe.key===null&&(pe=pe.props.children),typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case v:e:{for(var tt=pe.key;se!==null;){if(se.key===tt){if(tt=pe.type,tt===k){if(se.tag===7){f(oe,se.sibling),Ne=y(se,pe.props.children),Ne.return=oe,oe=Ne;break e}}else if(se.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===Q&&Ho(tt)===se.type){f(oe,se.sibling),Ne=y(se,pe.props),eh(Ne,pe),Ne.return=oe,oe=Ne;break e}f(oe,se);break}else u(oe,se);se=se.sibling}pe.type===k?(Ne=Io(pe.props.children,oe.mode,Ne,pe.key),Ne.return=oe,oe=Ne):(Ne=G0(pe.type,pe.key,pe.props,null,oe.mode,Ne),eh(Ne,pe),Ne.return=oe,oe=Ne)}return M(oe);case b:e:{for(tt=pe.key;se!==null;){if(se.key===tt)if(se.tag===4&&se.stateNode.containerInfo===pe.containerInfo&&se.stateNode.implementation===pe.implementation){f(oe,se.sibling),Ne=y(se,pe.children||[]),Ne.return=oe,oe=Ne;break e}else{f(oe,se);break}else u(oe,se);se=se.sibling}Ne=E1(pe,oe.mode,Ne),Ne.return=oe,oe=Ne}return M(oe);case Q:return pe=Ho(pe),Sn(oe,se,pe,Ne)}if(J(pe))return Ge(oe,se,pe,Ne);if(V(pe)){if(tt=V(pe),typeof tt!="function")throw Error(r(150));return pe=tt.call(pe),lt(oe,se,pe,Ne)}if(typeof pe.then=="function")return Sn(oe,se,tm(pe),Ne);if(pe.$$typeof===A)return Sn(oe,se,K0(oe,pe),Ne);nm(oe,pe)}return typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint"?(pe=""+pe,se!==null&&se.tag===6?(f(oe,se.sibling),Ne=y(se,pe),Ne.return=oe,oe=Ne):(f(oe,se),Ne=M1(pe,oe.mode,Ne),Ne.return=oe,oe=Ne),M(oe)):f(oe,se)}return function(oe,se,pe,Ne){try{Jd=0;var tt=Sn(oe,se,pe,Ne);return ou=null,tt}catch(Ke){if(Ke===lu||Ke===J0)throw Ke;var Jt=Hs(29,Ke,null,oe.mode);return Jt.lanes=Ne,Jt.return=oe,Jt}finally{}}}var Vo=w6(!0),S6=w6(!1),Ml=!1;function $1(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function H1(o,u){o=o.updateQueue,u.updateQueue===o&&(u.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function El(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function _l(o,u,f){var g=o.updateQueue;if(g===null)return null;if(g=g.shared,(sn&2)!==0){var y=g.pending;return y===null?u.next=u:(u.next=y.next,y.next=u),g.pending=u,u=W0(o),i6(o,null,f),u}return V0(o,g,u,f),W0(o)}function th(o,u,f){if(u=u.updateQueue,u!==null&&(u=u.shared,(f&4194048)!==0)){var g=u.lanes;g&=o.pendingLanes,f|=g,u.lanes=f,f3(o,f)}}function U1(o,u){var f=o.updateQueue,g=o.alternate;if(g!==null&&(g=g.updateQueue,f===g)){var y=null,w=null;if(f=f.firstBaseUpdate,f!==null){do{var M={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};w===null?y=w=M:w=w.next=M,f=f.next}while(f!==null);w===null?y=w=u:w=w.next=u}else y=w=u;f={baseState:g.baseState,firstBaseUpdate:y,lastBaseUpdate:w,shared:g.shared,callbacks:g.callbacks},o.updateQueue=f;return}o=f.lastBaseUpdate,o===null?f.firstBaseUpdate=u:o.next=u,f.lastBaseUpdate=u}var V1=!1;function nh(){if(V1){var o=au;if(o!==null)throw o}}function rh(o,u,f,g){V1=!1;var y=o.updateQueue;Ml=!1;var w=y.firstBaseUpdate,M=y.lastBaseUpdate,I=y.shared.pending;if(I!==null){y.shared.pending=null;var Z=I,xe=Z.next;Z.next=null,M===null?w=xe:M.next=xe,M=Z;var je=o.alternate;je!==null&&(je=je.updateQueue,I=je.lastBaseUpdate,I!==M&&(I===null?je.firstBaseUpdate=xe:I.next=xe,je.lastBaseUpdate=Z))}if(w!==null){var Te=y.baseState;M=0,je=xe=Z=null,I=w;do{var be=I.lane&-536870913,ke=be!==I.lane;if(ke?(Ft&be)===be:(g&be)===be){be!==0&&be===iu&&(V1=!0),je!==null&&(je=je.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});e:{var Ge=o,lt=I;be=u;var Sn=f;switch(lt.tag){case 1:if(Ge=lt.payload,typeof Ge=="function"){Te=Ge.call(Sn,Te,be);break e}Te=Ge;break e;case 3:Ge.flags=Ge.flags&-65537|128;case 0:if(Ge=lt.payload,be=typeof Ge=="function"?Ge.call(Sn,Te,be):Ge,be==null)break e;Te=p({},Te,be);break e;case 2:Ml=!0}}be=I.callback,be!==null&&(o.flags|=64,ke&&(o.flags|=8192),ke=y.callbacks,ke===null?y.callbacks=[be]:ke.push(be))}else ke={lane:be,tag:I.tag,payload:I.payload,callback:I.callback,next:null},je===null?(xe=je=ke,Z=Te):je=je.next=ke,M|=be;if(I=I.next,I===null){if(I=y.shared.pending,I===null)break;ke=I,I=ke.next,ke.next=null,y.lastBaseUpdate=ke,y.shared.pending=null}}while(!0);je===null&&(Z=Te),y.baseState=Z,y.firstBaseUpdate=xe,y.lastBaseUpdate=je,w===null&&(y.shared.lanes=0),Bl|=M,o.lanes=M,o.memoizedState=Te}}function k6(o,u){if(typeof o!="function")throw Error(r(191,o));o.call(u)}function O6(o,u){var f=o.callbacks;if(f!==null)for(o.callbacks=null,o=0;ow?w:8;var M=$.T,I={};$.T=I,dv(o,!1,u,f);try{var Z=y(),xe=$.S;if(xe!==null&&xe(I,Z),Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var je=xL(Z,g);ah(o,u,je,Xs(o))}else ah(o,u,g,Xs(o))}catch(Te){ah(o,u,{then:function(){},status:"rejected",reason:Te},Xs())}finally{ae.p=w,M!==null&&I.types!==null&&(M.types=I.types),$.T=M}}function kL(){}function cv(o,u,f,g){if(o.tag!==5)throw Error(r(476));var y=nS(o).queue;tS(o,y,u,ne,f===null?kL:function(){return rS(o),f(g)})}function nS(o){var u=o.memoizedState;if(u!==null)return u;u={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ia,lastRenderedState:ne},next:null};var f={};return u.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ia,lastRenderedState:f},next:null},o.memoizedState=u,o=o.alternate,o!==null&&(o.memoizedState=u),u}function rS(o){var u=nS(o);u.next===null&&(u=o.alternate.memoizedState),ah(o,u.next.queue,{},Xs())}function uv(){return qr(kh)}function sS(){return sr().memoizedState}function iS(){return sr().memoizedState}function OL(o){for(var u=o.return;u!==null;){switch(u.tag){case 24:case 3:var f=Xs();o=El(f);var g=_l(u,o,f);g!==null&&(js(g,u,f),th(g,u,f)),u={cache:I1()},o.payload=u;return}u=u.return}}function jL(o,u,f){var g=Xs();f={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},hm(o)?lS(u,f):(f=T1(o,u,f,g),f!==null&&(js(f,o,g),oS(f,u,g)))}function aS(o,u,f){var g=Xs();ah(o,u,f,g)}function ah(o,u,f,g){var y={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(hm(o))lS(u,y);else{var w=o.alternate;if(o.lanes===0&&(w===null||w.lanes===0)&&(w=u.lastRenderedReducer,w!==null))try{var M=u.lastRenderedState,I=w(M,f);if(y.hasEagerState=!0,y.eagerState=I,$s(I,M))return V0(o,u,y,0),An===null&&U0(),!1}catch{}finally{}if(f=T1(o,u,y,g),f!==null)return js(f,o,g),oS(f,u,g),!0}return!1}function dv(o,u,f,g){if(g={lane:2,revertLane:$v(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},hm(o)){if(u)throw Error(r(479))}else u=T1(o,f,g,2),u!==null&&js(u,o,2)}function hm(o){var u=o.alternate;return o===wt||u!==null&&u===wt}function lS(o,u){uu=im=!0;var f=o.pending;f===null?u.next=u:(u.next=f.next,f.next=u),o.pending=u}function oS(o,u,f){if((f&4194048)!==0){var g=u.lanes;g&=o.pendingLanes,f|=g,u.lanes=f,f3(o,f)}}var lh={readContext:qr,use:om,useCallback:er,useContext:er,useEffect:er,useImperativeHandle:er,useLayoutEffect:er,useInsertionEffect:er,useMemo:er,useReducer:er,useRef:er,useState:er,useDebugValue:er,useDeferredValue:er,useTransition:er,useSyncExternalStore:er,useId:er,useHostTransitionStatus:er,useFormState:er,useActionState:er,useOptimistic:er,useMemoCache:er,useCacheRefresh:er};lh.useEffectEvent=er;var cS={readContext:qr,use:om,useCallback:function(o,u){return os().memoizedState=[o,u===void 0?null:u],o},useContext:qr,useEffect:V6,useImperativeHandle:function(o,u,f){f=f!=null?f.concat([o]):null,um(4194308,4,Y6.bind(null,u,o),f)},useLayoutEffect:function(o,u){return um(4194308,4,o,u)},useInsertionEffect:function(o,u){um(4,2,o,u)},useMemo:function(o,u){var f=os();u=u===void 0?null:u;var g=o();if(Wo){pt(!0);try{o()}finally{pt(!1)}}return f.memoizedState=[g,u],g},useReducer:function(o,u,f){var g=os();if(f!==void 0){var y=f(u);if(Wo){pt(!0);try{f(u)}finally{pt(!1)}}}else y=u;return g.memoizedState=g.baseState=y,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:y},g.queue=o,o=o.dispatch=jL.bind(null,wt,o),[g.memoizedState,o]},useRef:function(o){var u=os();return o={current:o},u.memoizedState=o},useState:function(o){o=sv(o);var u=o.queue,f=aS.bind(null,wt,u);return u.dispatch=f,[o.memoizedState,f]},useDebugValue:lv,useDeferredValue:function(o,u){var f=os();return ov(f,o,u)},useTransition:function(){var o=sv(!1);return o=tS.bind(null,wt,o.queue,!0,!1),os().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,u,f){var g=wt,y=os();if(Ut){if(f===void 0)throw Error(r(407));f=f()}else{if(f=u(),An===null)throw Error(r(349));(Ft&127)!==0||M6(g,u,f)}y.memoizedState=f;var w={value:f,getSnapshot:u};return y.queue=w,V6(_6.bind(null,g,w,o),[o]),g.flags|=2048,hu(9,{destroy:void 0},E6.bind(null,g,w,f,u),null),f},useId:function(){var o=os(),u=An.identifierPrefix;if(Ut){var f=Ki,g=Yi;f=(g&~(1<<32-yt(g)-1)).toString(32)+f,u="_"+u+"R_"+f,f=am++,0<\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof g.is=="string"?M.createElement("select",{is:g.is}):M.createElement("select"),g.multiple?w.multiple=!0:g.size&&(w.size=g.size);break;default:w=typeof g.is=="string"?M.createElement(y,{is:g.is}):M.createElement(y)}}w[Lr]=u,w[ys]=g;e:for(M=u.child;M!==null;){if(M.tag===5||M.tag===6)w.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===u)break e;for(;M.sibling===null;){if(M.return===null||M.return===u)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}u.stateNode=w;e:switch(Qr(w,y,g),y){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&Fa(u)}}return Qn(u),jv(u,u.type,o===null?null:o.memoizedProps,u.pendingProps,f),null;case 6:if(o&&u.stateNode!=null)o.memoizedProps!==g&&Fa(u);else{if(typeof g!="string"&&u.stateNode===null)throw Error(r(166));if(o=fe.current,ru(u)){if(o=u.stateNode,f=u.memoizedProps,g=null,y=Ir,y!==null)switch(y.tag){case 27:case 5:g=y.memoizedProps}o[Lr]=u,o=!!(o.nodeValue===f||g!==null&&g.suppressHydrationWarning===!0||Tk(o.nodeValue,f)),o||Tl(u,!0)}else o=_m(o).createTextNode(g),o[Lr]=u,u.stateNode=o}return Qn(u),null;case 31:if(f=u.memoizedState,o===null||o.memoizedState!==null){if(g=ru(u),f!==null){if(o===null){if(!g)throw Error(r(318));if(o=u.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[Lr]=u}else qo(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Qn(u),o=!1}else f=z1(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=f),o=!0;if(!o)return u.flags&256?(Vs(u),u):(Vs(u),null);if((u.flags&128)!==0)throw Error(r(558))}return Qn(u),null;case 13:if(g=u.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(y=ru(u),g!==null&&g.dehydrated!==null){if(o===null){if(!y)throw Error(r(318));if(y=u.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(r(317));y[Lr]=u}else qo(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Qn(u),y=!1}else y=z1(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=y),y=!0;if(!y)return u.flags&256?(Vs(u),u):(Vs(u),null)}return Vs(u),(u.flags&128)!==0?(u.lanes=f,u):(f=g!==null,o=o!==null&&o.memoizedState!==null,f&&(g=u.child,y=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(y=g.alternate.memoizedState.cachePool.pool),w=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(w=g.memoizedState.cachePool.pool),w!==y&&(g.flags|=2048)),f!==o&&f&&(u.child.flags|=8192),xm(u,u.updateQueue),Qn(u),null);case 4:return de(),o===null&&Wv(u.stateNode.containerInfo),Qn(u),null;case 10:return Ba(u.type),Qn(u),null;case 19:if(Y(rr),g=u.memoizedState,g===null)return Qn(u),null;if(y=(u.flags&128)!==0,w=g.rendering,w===null)if(y)ch(g,!1);else{if(tr!==0||o!==null&&(o.flags&128)!==0)for(o=u.child;o!==null;){if(w=sm(o),w!==null){for(u.flags|=128,ch(g,!1),o=w.updateQueue,u.updateQueue=o,xm(u,o),u.subtreeFlags=0,o=f,f=u.child;f!==null;)a6(f,o),f=f.sibling;return P(rr,rr.current&1|2),Ut&&za(u,g.treeForkCount),u.child}o=o.sibling}g.tail!==null&&yn()>Sm&&(u.flags|=128,y=!0,ch(g,!1),u.lanes=4194304)}else{if(!y)if(o=sm(w),o!==null){if(u.flags|=128,y=!0,o=o.updateQueue,u.updateQueue=o,xm(u,o),ch(g,!0),g.tail===null&&g.tailMode==="hidden"&&!w.alternate&&!Ut)return Qn(u),null}else 2*yn()-g.renderingStartTime>Sm&&f!==536870912&&(u.flags|=128,y=!0,ch(g,!1),u.lanes=4194304);g.isBackwards?(w.sibling=u.child,u.child=w):(o=g.last,o!==null?o.sibling=w:u.child=w,g.last=w)}return g.tail!==null?(o=g.tail,g.rendering=o,g.tail=o.sibling,g.renderingStartTime=yn(),o.sibling=null,f=rr.current,P(rr,y?f&1|2:f&1),Ut&&za(u,g.treeForkCount),o):(Qn(u),null);case 22:case 23:return Vs(u),G1(),g=u.memoizedState!==null,o!==null?o.memoizedState!==null!==g&&(u.flags|=8192):g&&(u.flags|=8192),g?(f&536870912)!==0&&(u.flags&128)===0&&(Qn(u),u.subtreeFlags&6&&(u.flags|=8192)):Qn(u),f=u.updateQueue,f!==null&&xm(u,f.retryQueue),f=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==f&&(u.flags|=2048),o!==null&&Y($o),null;case 24:return f=null,o!==null&&(f=o.memoizedState.cache),u.memoizedState.cache!==f&&(u.flags|=2048),Ba(ur),Qn(u),null;case 25:return null;case 30:return null}throw Error(r(156,u.tag))}function ML(o,u){switch(D1(u),u.tag){case 1:return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 3:return Ba(ur),de(),o=u.flags,(o&65536)!==0&&(o&128)===0?(u.flags=o&-65537|128,u):null;case 26:case 27:case 5:return ct(u),null;case 31:if(u.memoizedState!==null){if(Vs(u),u.alternate===null)throw Error(r(340));qo()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 13:if(Vs(u),o=u.memoizedState,o!==null&&o.dehydrated!==null){if(u.alternate===null)throw Error(r(340));qo()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 19:return Y(rr),null;case 4:return de(),null;case 10:return Ba(u.type),null;case 22:case 23:return Vs(u),G1(),o!==null&&Y($o),o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 24:return Ba(ur),null;case 25:return null;default:return null}}function DS(o,u){switch(D1(u),u.tag){case 3:Ba(ur),de();break;case 26:case 27:case 5:ct(u);break;case 4:de();break;case 31:u.memoizedState!==null&&Vs(u);break;case 13:Vs(u);break;case 19:Y(rr);break;case 10:Ba(u.type);break;case 22:case 23:Vs(u),G1(),o!==null&&Y($o);break;case 24:Ba(ur)}}function uh(o,u){try{var f=u.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var y=g.next;f=y;do{if((f.tag&o)===o){g=void 0;var w=f.create,M=f.inst;g=w(),M.destroy=g}f=f.next}while(f!==y)}}catch(I){xn(u,u.return,I)}}function zl(o,u,f){try{var g=u.updateQueue,y=g!==null?g.lastEffect:null;if(y!==null){var w=y.next;g=w;do{if((g.tag&o)===o){var M=g.inst,I=M.destroy;if(I!==void 0){M.destroy=void 0,y=u;var Z=f,xe=I;try{xe()}catch(je){xn(y,Z,je)}}}g=g.next}while(g!==w)}}catch(je){xn(u,u.return,je)}}function RS(o){var u=o.updateQueue;if(u!==null){var f=o.stateNode;try{O6(u,f)}catch(g){xn(o,o.return,g)}}}function zS(o,u,f){f.props=Go(o.type,o.memoizedProps),f.state=o.memoizedState;try{f.componentWillUnmount()}catch(g){xn(o,u,g)}}function dh(o,u){try{var f=o.ref;if(f!==null){switch(o.tag){case 26:case 27:case 5:var g=o.stateNode;break;case 30:g=o.stateNode;break;default:g=o.stateNode}typeof f=="function"?o.refCleanup=f(g):f.current=g}}catch(y){xn(o,u,y)}}function Zi(o,u){var f=o.ref,g=o.refCleanup;if(f!==null)if(typeof g=="function")try{g()}catch(y){xn(o,u,y)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(y){xn(o,u,y)}else f.current=null}function PS(o){var u=o.type,f=o.memoizedProps,g=o.stateNode;try{e:switch(u){case"button":case"input":case"select":case"textarea":f.autoFocus&&g.focus();break e;case"img":f.src?g.src=f.src:f.srcSet&&(g.srcset=f.srcSet)}}catch(y){xn(o,o.return,y)}}function Nv(o,u,f){try{var g=o.stateNode;ZL(g,o.type,f,u),g[ys]=u}catch(y){xn(o,o.return,y)}}function BS(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Ql(o.type)||o.tag===4}function Cv(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||BS(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Ql(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Tv(o,u,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,u?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(o,u):(u=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,u.appendChild(o),f=f._reactRootContainer,f!=null||u.onclick!==null||(u.onclick=_a));else if(g!==4&&(g===27&&Ql(o.type)&&(f=o.stateNode,u=null),o=o.child,o!==null))for(Tv(o,u,f),o=o.sibling;o!==null;)Tv(o,u,f),o=o.sibling}function vm(o,u,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,u?f.insertBefore(o,u):f.appendChild(o);else if(g!==4&&(g===27&&Ql(o.type)&&(f=o.stateNode),o=o.child,o!==null))for(vm(o,u,f),o=o.sibling;o!==null;)vm(o,u,f),o=o.sibling}function LS(o){var u=o.stateNode,f=o.memoizedProps;try{for(var g=o.type,y=u.attributes;y.length;)u.removeAttributeNode(y[0]);Qr(u,g,f),u[Lr]=o,u[ys]=f}catch(w){xn(o,o.return,w)}}var Qa=!1,fr=!1,Av=!1,IS=typeof WeakSet=="function"?WeakSet:Set,_r=null;function EL(o,u){if(o=o.containerInfo,Yv=Im,o=K3(o),S1(o)){if("selectionStart"in o)var f={start:o.selectionStart,end:o.selectionEnd};else e:{f=(f=o.ownerDocument)&&f.defaultView||window;var g=f.getSelection&&f.getSelection();if(g&&g.rangeCount!==0){f=g.anchorNode;var y=g.anchorOffset,w=g.focusNode;g=g.focusOffset;try{f.nodeType,w.nodeType}catch{f=null;break e}var M=0,I=-1,Z=-1,xe=0,je=0,Te=o,be=null;t:for(;;){for(var ke;Te!==f||y!==0&&Te.nodeType!==3||(I=M+y),Te!==w||g!==0&&Te.nodeType!==3||(Z=M+g),Te.nodeType===3&&(M+=Te.nodeValue.length),(ke=Te.firstChild)!==null;)be=Te,Te=ke;for(;;){if(Te===o)break t;if(be===f&&++xe===y&&(I=M),be===w&&++je===g&&(Z=M),(ke=Te.nextSibling)!==null)break;Te=be,be=Te.parentNode}Te=ke}f=I===-1||Z===-1?null:{start:I,end:Z}}else f=null}f=f||{start:0,end:0}}else f=null;for(Kv={focusedElem:o,selectionRange:f},Im=!1,_r=u;_r!==null;)if(u=_r,o=u.child,(u.subtreeFlags&1028)!==0&&o!==null)o.return=u,_r=o;else for(;_r!==null;){switch(u=_r,w=u.alternate,o=u.flags,u.tag){case 0:if((o&4)!==0&&(o=u.updateQueue,o=o!==null?o.events:null,o!==null))for(f=0;f title"))),Qr(w,g,f),w[Lr]=o,Er(w),g=w;break e;case"link":var M=Uk("link","href",y).get(g+(f.href||""));if(M){for(var I=0;ISn&&(M=Sn,Sn=lt,lt=M);var oe=X3(I,lt),se=X3(I,Sn);if(oe&&se&&(ke.rangeCount!==1||ke.anchorNode!==oe.node||ke.anchorOffset!==oe.offset||ke.focusNode!==se.node||ke.focusOffset!==se.offset)){var pe=Te.createRange();pe.setStart(oe.node,oe.offset),ke.removeAllRanges(),lt>Sn?(ke.addRange(pe),ke.extend(se.node,se.offset)):(pe.setEnd(se.node,se.offset),ke.addRange(pe))}}}}for(Te=[],ke=I;ke=ke.parentNode;)ke.nodeType===1&&Te.push({element:ke,left:ke.scrollLeft,top:ke.scrollTop});for(typeof I.focus=="function"&&I.focus(),I=0;If?32:f,$.T=null,f=Pv,Pv=null;var w=Il,M=Wa;if(br=0,xu=Il=null,Wa=0,(sn&6)!==0)throw Error(r(331));var I=sn;if(sn|=4,YS(w.current),WS(w,w.current,M,f),sn=I,xh(0,!1),Ae&&typeof Ae.onPostCommitFiberRoot=="function")try{Ae.onPostCommitFiberRoot(re,w)}catch{}return!0}finally{ae.p=y,$.T=g,mk(o,u)}}function gk(o,u,f){u=di(f,u),u=pv(o.stateNode,u,2),o=_l(o,u,2),o!==null&&(Bd(o,2),Ji(o))}function xn(o,u,f){if(o.tag===3)gk(o,o,f);else for(;u!==null;){if(u.tag===3){gk(u,o,f);break}else if(u.tag===1){var g=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Ll===null||!Ll.has(g))){o=di(f,o),f=xS(2),g=_l(u,f,2),g!==null&&(vS(f,g,u,o),Bd(g,2),Ji(g));break}}u=u.return}}function qv(o,u,f){var g=o.pingCache;if(g===null){g=o.pingCache=new RL;var y=new Set;g.set(u,y)}else y=g.get(u),y===void 0&&(y=new Set,g.set(u,y));y.has(f)||(_v=!0,y.add(f),o=IL.bind(null,o,u,f),u.then(o,o))}function IL(o,u,f){var g=o.pingCache;g!==null&&g.delete(u),o.pingedLanes|=o.suspendedLanes&f,o.warmLanes&=~f,An===o&&(Ft&f)===f&&(tr===4||tr===3&&(Ft&62914560)===Ft&&300>yn()-wm?(sn&2)===0&&vu(o,0):Dv|=f,gu===Ft&&(gu=0)),Ji(o)}function xk(o,u){u===0&&(u=qc()),o=Lo(o,u),o!==null&&(Bd(o,u),Ji(o))}function qL(o){var u=o.memoizedState,f=0;u!==null&&(f=u.retryLane),xk(o,f)}function FL(o,u){var f=0;switch(o.tag){case 31:case 13:var g=o.stateNode,y=o.memoizedState;y!==null&&(f=y.retryLane);break;case 19:g=o.stateNode;break;case 22:g=o.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(u),xk(o,f)}function QL(o,u){return _t(o,u)}var Tm=null,bu=null,Fv=!1,Am=!1,Qv=!1,Fl=0;function Ji(o){o!==bu&&o.next===null&&(bu===null?Tm=bu=o:bu=bu.next=o),Am=!0,Fv||(Fv=!0,HL())}function xh(o,u){if(!Qv&&Am){Qv=!0;do for(var f=!1,g=Tm;g!==null;){if(o!==0){var y=g.pendingLanes;if(y===0)var w=0;else{var M=g.suspendedLanes,I=g.pingedLanes;w=(1<<31-yt(42|o)+1)-1,w&=y&~(M&~I),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(f=!0,wk(g,w))}else w=Ft,w=Ic(g,g===An?w:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(w&3)===0||_o(g,w)||(f=!0,wk(g,w));g=g.next}while(f);Qv=!1}}function $L(){vk()}function vk(){Am=Fv=!1;var o=0;Fl!==0&&eI()&&(o=Fl);for(var u=yn(),f=null,g=Tm;g!==null;){var y=g.next,w=yk(g,u);w===0?(g.next=null,f===null?Tm=y:f.next=y,y===null&&(bu=f)):(f=g,(o!==0||(w&3)!==0)&&(Am=!0)),g=y}br!==0&&br!==5||xh(o),Fl!==0&&(Fl=0)}function yk(o,u){for(var f=o.suspendedLanes,g=o.pingedLanes,y=o.expirationTimes,w=o.pendingLanes&-62914561;0I)break;var je=Z.transferSize,Te=Z.initiatorType;je&&Ak(Te)&&(Z=Z.responseEnd,M+=je*(Z"u"?null:document;function Fk(o,u,f){var g=wu;if(g&&typeof u=="string"&&u){var y=ci(u);y='link[rel="'+o+'"][href="'+y+'"]',typeof f=="string"&&(y+='[crossorigin="'+f+'"]'),qk.has(y)||(qk.add(y),o={rel:o,crossOrigin:f,href:u},g.querySelector(y)===null&&(u=g.createElement("link"),Qr(u,"link",o),Er(u),g.head.appendChild(u)))}}function cI(o){Ga.D(o),Fk("dns-prefetch",o,null)}function uI(o,u){Ga.C(o,u),Fk("preconnect",o,u)}function dI(o,u,f){Ga.L(o,u,f);var g=wu;if(g&&o&&u){var y='link[rel="preload"][as="'+ci(u)+'"]';u==="image"&&f&&f.imageSrcSet?(y+='[imagesrcset="'+ci(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(y+='[imagesizes="'+ci(f.imageSizes)+'"]')):y+='[href="'+ci(o)+'"]';var w=y;switch(u){case"style":w=Su(o);break;case"script":w=ku(o)}xi.has(w)||(o=p({rel:"preload",href:u==="image"&&f&&f.imageSrcSet?void 0:o,as:u},f),xi.set(w,o),g.querySelector(y)!==null||u==="style"&&g.querySelector(wh(w))||u==="script"&&g.querySelector(Sh(w))||(u=g.createElement("link"),Qr(u,"link",o),Er(u),g.head.appendChild(u)))}}function hI(o,u){Ga.m(o,u);var f=wu;if(f&&o){var g=u&&typeof u.as=="string"?u.as:"script",y='link[rel="modulepreload"][as="'+ci(g)+'"][href="'+ci(o)+'"]',w=y;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=ku(o)}if(!xi.has(w)&&(o=p({rel:"modulepreload",href:o},u),xi.set(w,o),f.querySelector(y)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(Sh(w)))return}g=f.createElement("link"),Qr(g,"link",o),Er(g),f.head.appendChild(g)}}}function fI(o,u,f){Ga.S(o,u,f);var g=wu;if(g&&o){var y=Hc(g).hoistableStyles,w=Su(o);u=u||"default";var M=y.get(w);if(!M){var I={loading:0,preload:null};if(M=g.querySelector(wh(w)))I.loading=5;else{o=p({rel:"stylesheet",href:o,"data-precedence":u},f),(f=xi.get(w))&&sy(o,f);var Z=M=g.createElement("link");Er(Z),Qr(Z,"link",o),Z._p=new Promise(function(xe,je){Z.onload=xe,Z.onerror=je}),Z.addEventListener("load",function(){I.loading|=1}),Z.addEventListener("error",function(){I.loading|=2}),I.loading|=4,Rm(M,u,g)}M={type:"stylesheet",instance:M,count:1,state:I},y.set(w,M)}}}function mI(o,u){Ga.X(o,u);var f=wu;if(f&&o){var g=Hc(f).hoistableScripts,y=ku(o),w=g.get(y);w||(w=f.querySelector(Sh(y)),w||(o=p({src:o,async:!0},u),(u=xi.get(y))&&iy(o,u),w=f.createElement("script"),Er(w),Qr(w,"link",o),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(y,w))}}function pI(o,u){Ga.M(o,u);var f=wu;if(f&&o){var g=Hc(f).hoistableScripts,y=ku(o),w=g.get(y);w||(w=f.querySelector(Sh(y)),w||(o=p({src:o,async:!0,type:"module"},u),(u=xi.get(y))&&iy(o,u),w=f.createElement("script"),Er(w),Qr(w,"link",o),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(y,w))}}function Qk(o,u,f,g){var y=(y=fe.current)?Dm(y):null;if(!y)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(u=Su(f.href),f=Hc(y).hoistableStyles,g=f.get(u),g||(g={type:"style",instance:null,count:0,state:null},f.set(u,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){o=Su(f.href);var w=Hc(y).hoistableStyles,M=w.get(o);if(M||(y=y.ownerDocument||y,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(o,M),(w=y.querySelector(wh(o)))&&!w._p&&(M.instance=w,M.state.loading=5),xi.has(o)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},xi.set(o,f),w||gI(y,o,f,M.state))),u&&g===null)throw Error(r(528,""));return M}if(u&&g!==null)throw Error(r(529,""));return null;case"script":return u=f.async,f=f.src,typeof f=="string"&&u&&typeof u!="function"&&typeof u!="symbol"?(u=ku(f),f=Hc(y).hoistableScripts,g=f.get(u),g||(g={type:"script",instance:null,count:0,state:null},f.set(u,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function Su(o){return'href="'+ci(o)+'"'}function wh(o){return'link[rel="stylesheet"]['+o+"]"}function $k(o){return p({},o,{"data-precedence":o.precedence,precedence:null})}function gI(o,u,f,g){o.querySelector('link[rel="preload"][as="style"]['+u+"]")?g.loading=1:(u=o.createElement("link"),g.preload=u,u.addEventListener("load",function(){return g.loading|=1}),u.addEventListener("error",function(){return g.loading|=2}),Qr(u,"link",f),Er(u),o.head.appendChild(u))}function ku(o){return'[src="'+ci(o)+'"]'}function Sh(o){return"script[async]"+o}function Hk(o,u,f){if(u.count++,u.instance===null)switch(u.type){case"style":var g=o.querySelector('style[data-href~="'+ci(f.href)+'"]');if(g)return u.instance=g,Er(g),g;var y=p({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return g=(o.ownerDocument||o).createElement("style"),Er(g),Qr(g,"style",y),Rm(g,f.precedence,o),u.instance=g;case"stylesheet":y=Su(f.href);var w=o.querySelector(wh(y));if(w)return u.state.loading|=4,u.instance=w,Er(w),w;g=$k(f),(y=xi.get(y))&&sy(g,y),w=(o.ownerDocument||o).createElement("link"),Er(w);var M=w;return M._p=new Promise(function(I,Z){M.onload=I,M.onerror=Z}),Qr(w,"link",g),u.state.loading|=4,Rm(w,f.precedence,o),u.instance=w;case"script":return w=ku(f.src),(y=o.querySelector(Sh(w)))?(u.instance=y,Er(y),y):(g=f,(y=xi.get(w))&&(g=p({},f),iy(g,y)),o=o.ownerDocument||o,y=o.createElement("script"),Er(y),Qr(y,"link",g),o.head.appendChild(y),u.instance=y);case"void":return null;default:throw Error(r(443,u.type))}else u.type==="stylesheet"&&(u.state.loading&4)===0&&(g=u.instance,u.state.loading|=4,Rm(g,f.precedence,o));return u.instance}function Rm(o,u,f){for(var g=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=g.length?g[g.length-1]:null,w=y,M=0;M title"):null)}function xI(o,u,f){if(f===1||u.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof u.precedence!="string"||typeof u.href!="string"||u.href==="")break;return!0;case"link":if(typeof u.rel!="string"||typeof u.href!="string"||u.href===""||u.onLoad||u.onError)break;switch(u.rel){case"stylesheet":return o=u.disabled,typeof u.precedence=="string"&&o==null;default:return!0}case"script":if(u.async&&typeof u.async!="function"&&typeof u.async!="symbol"&&!u.onLoad&&!u.onError&&u.src&&typeof u.src=="string")return!0}return!1}function Wk(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function vI(o,u,f,g){if(f.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var y=Su(g.href),w=u.querySelector(wh(y));if(w){u=w._p,u!==null&&typeof u=="object"&&typeof u.then=="function"&&(o.count++,o=Pm.bind(o),u.then(o,o)),f.state.loading|=4,f.instance=w,Er(w);return}w=u.ownerDocument||u,g=$k(g),(y=xi.get(y))&&sy(g,y),w=w.createElement("link"),Er(w);var M=w;M._p=new Promise(function(I,Z){M.onload=I,M.onerror=Z}),Qr(w,"link",g),f.instance=w}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(f,u),(u=f.state.preload)&&(f.state.loading&3)===0&&(o.count++,f=Pm.bind(o),u.addEventListener("load",f),u.addEventListener("error",f))}}var ay=0;function yI(o,u){return o.stylesheets&&o.count===0&&Lm(o,o.stylesheets),0ay?50:800)+u);return o.unsuspend=f,function(){o.unsuspend=null,clearTimeout(g),clearTimeout(y)}}:null}function Pm(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Lm(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Bm=null;function Lm(o,u){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Bm=new Map,u.forEach(bI,o),Bm=null,Pm.call(o))}function bI(o,u){if(!(u.state.loading&4)){var f=Bm.get(o);if(f)var g=f.get(null);else{f=new Map,Bm.set(o,f);for(var y=o.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),py.exports=zq(),py.exports}var Bq=Pq();function L9(t,e){return function(){return t.apply(e,arguments)}}const{toString:Lq}=Object.prototype,{getPrototypeOf:J4}=Object,{iterator:ox,toStringTag:I9}=Symbol,cx=(t=>e=>{const n=Lq.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Wi=t=>(t=t.toLowerCase(),e=>cx(e)===t),ux=t=>e=>typeof e===t,{isArray:Sd}=Array,sd=ux("undefined");function Kf(t){return t!==null&&!sd(t)&&t.constructor!==null&&!sd(t.constructor)&&Rs(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const q9=Wi("ArrayBuffer");function Iq(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&q9(t.buffer),e}const qq=ux("string"),Rs=ux("function"),F9=ux("number"),Zf=t=>t!==null&&typeof t=="object",Fq=t=>t===!0||t===!1,$p=t=>{if(cx(t)!=="object")return!1;const e=J4(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(I9 in t)&&!(ox in t)},Qq=t=>{if(!Zf(t)||Kf(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},$q=Wi("Date"),Hq=Wi("File"),Uq=Wi("Blob"),Vq=Wi("FileList"),Wq=t=>Zf(t)&&Rs(t.pipe),Gq=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Rs(t.append)&&((e=cx(t))==="formdata"||e==="object"&&Rs(t.toString)&&t.toString()==="[object FormData]"))},Xq=Wi("URLSearchParams"),[Yq,Kq,Zq,Jq]=["ReadableStream","Request","Response","Headers"].map(Wi),eF=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Jf(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),Sd(t))for(r=0,s=t.length;r0;)if(s=n[r],e===s.toLowerCase())return s;return null}const ac=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,$9=t=>!sd(t)&&t!==ac;function n2(){const{caseless:t,skipUndefined:e}=$9(this)&&this||{},n={},r=(s,i)=>{const l=t&&Q9(n,i)||i;$p(n[l])&&$p(s)?n[l]=n2(n[l],s):$p(s)?n[l]=n2({},s):Sd(s)?n[l]=s.slice():(!e||!sd(s))&&(n[l]=s)};for(let s=0,i=arguments.length;s(Jf(e,(s,i)=>{n&&Rs(s)?t[i]=L9(s,n):t[i]=s},{allOwnKeys:r}),t),nF=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),rF=(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)},sF=(t,e,n,r)=>{let s,i,l;const c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)l=s[i],(!r||r(l,t,e))&&!c[l]&&(e[l]=t[l],c[l]=!0);t=n!==!1&&J4(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},iF=(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},aF=t=>{if(!t)return null;if(Sd(t))return t;let e=t.length;if(!F9(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},lF=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&J4(Uint8Array)),oF=(t,e)=>{const r=(t&&t[ox]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},cF=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},uF=Wi("HTMLFormElement"),dF=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),vO=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),hF=Wi("RegExp"),H9=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Jf(n,(s,i)=>{let l;(l=e(s,i,t))!==!1&&(r[i]=l||s)}),Object.defineProperties(t,r)},fF=t=>{H9(t,(e,n)=>{if(Rs(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Rs(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+"'")})}})},mF=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Sd(t)?r(t):r(String(t).split(e)),n},pF=()=>{},gF=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function xF(t){return!!(t&&Rs(t.append)&&t[I9]==="FormData"&&t[ox])}const vF=t=>{const e=new Array(10),n=(r,s)=>{if(Zf(r)){if(e.indexOf(r)>=0)return;if(Kf(r))return r;if(!("toJSON"in r)){e[s]=r;const i=Sd(r)?[]:{};return Jf(r,(l,c)=>{const d=n(l,s+1);!sd(d)&&(i[c]=d)}),e[s]=void 0,i}}return r};return n(t,0)},yF=Wi("AsyncFunction"),bF=t=>t&&(Zf(t)||Rs(t))&&Rs(t.then)&&Rs(t.catch),U9=((t,e)=>t?setImmediate:e?((n,r)=>(ac.addEventListener("message",({source:s,data:i})=>{s===ac&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),ac.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Rs(ac.postMessage)),wF=typeof queueMicrotask<"u"?queueMicrotask.bind(ac):typeof process<"u"&&process.nextTick||U9,SF=t=>t!=null&&Rs(t[ox]),we={isArray:Sd,isArrayBuffer:q9,isBuffer:Kf,isFormData:Gq,isArrayBufferView:Iq,isString:qq,isNumber:F9,isBoolean:Fq,isObject:Zf,isPlainObject:$p,isEmptyObject:Qq,isReadableStream:Yq,isRequest:Kq,isResponse:Zq,isHeaders:Jq,isUndefined:sd,isDate:$q,isFile:Hq,isBlob:Uq,isRegExp:hF,isFunction:Rs,isStream:Wq,isURLSearchParams:Xq,isTypedArray:lF,isFileList:Vq,forEach:Jf,merge:n2,extend:tF,trim:eF,stripBOM:nF,inherits:rF,toFlatObject:sF,kindOf:cx,kindOfTest:Wi,endsWith:iF,toArray:aF,forEachEntry:oF,matchAll:cF,isHTMLForm:uF,hasOwnProperty:vO,hasOwnProp:vO,reduceDescriptors:H9,freezeMethods:fF,toObjectSet:mF,toCamelCase:dF,noop:pF,toFiniteNumber:gF,findKey:Q9,global:ac,isContextDefined:$9,isSpecCompliantForm:xF,toJSONObject:vF,isAsyncFn:yF,isThenable:bF,setImmediate:U9,asap:wF,isIterable:SF};function St(t,e,n,r,s){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),s&&(this.response=s,this.status=s.status?s.status:null)}we.inherits(St,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:we.toJSONObject(this.config),code:this.code,status:this.status}}});const V9=St.prototype,W9={};["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=>{W9[t]={value:t}});Object.defineProperties(St,W9);Object.defineProperty(V9,"isAxiosError",{value:!0});St.from=(t,e,n,r,s,i)=>{const l=Object.create(V9);we.toFlatObject(t,l,function(m){return m!==Error.prototype},h=>h!=="isAxiosError");const c=t&&t.message?t.message:"Error",d=e==null&&t?t.code:e;return St.call(l,c,d,n,r,s),t&&l.cause==null&&Object.defineProperty(l,"cause",{value:t,configurable:!0}),l.name=t&&t.name||"Error",i&&Object.assign(l,i),l};const kF=null;function r2(t){return we.isPlainObject(t)||we.isArray(t)}function G9(t){return we.endsWith(t,"[]")?t.slice(0,-2):t}function yO(t,e,n){return t?t.concat(e).map(function(s,i){return s=G9(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function OF(t){return we.isArray(t)&&!t.some(r2)}const jF=we.toFlatObject(we,{},null,function(e){return/^is[A-Z]/.test(e)});function dx(t,e,n){if(!we.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=we.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(k,O){return!we.isUndefined(O[k])});const r=n.metaTokens,s=n.visitor||m,i=n.dots,l=n.indexes,d=(n.Blob||typeof Blob<"u"&&Blob)&&we.isSpecCompliantForm(e);if(!we.isFunction(s))throw new TypeError("visitor must be a function");function h(b){if(b===null)return"";if(we.isDate(b))return b.toISOString();if(we.isBoolean(b))return b.toString();if(!d&&we.isBlob(b))throw new St("Blob is not supported. Use a Buffer instead.");return we.isArrayBuffer(b)||we.isTypedArray(b)?d&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function m(b,k,O){let j=b;if(b&&!O&&typeof b=="object"){if(we.endsWith(k,"{}"))k=r?k:k.slice(0,-2),b=JSON.stringify(b);else if(we.isArray(b)&&OF(b)||(we.isFileList(b)||we.endsWith(k,"[]"))&&(j=we.toArray(b)))return k=G9(k),j.forEach(function(A,_){!(we.isUndefined(A)||A===null)&&e.append(l===!0?yO([k],_,i):l===null?k:k+"[]",h(A))}),!1}return r2(b)?!0:(e.append(yO(O,k,i),h(b)),!1)}const p=[],x=Object.assign(jF,{defaultVisitor:m,convertValue:h,isVisitable:r2});function v(b,k){if(!we.isUndefined(b)){if(p.indexOf(b)!==-1)throw Error("Circular reference detected in "+k.join("."));p.push(b),we.forEach(b,function(j,T){(!(we.isUndefined(j)||j===null)&&s.call(e,j,we.isString(T)?T.trim():T,k,x))===!0&&v(j,k?k.concat(T):[T])}),p.pop()}}if(!we.isObject(t))throw new TypeError("data must be an object");return v(t),e}function bO(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function ew(t,e){this._pairs=[],t&&dx(t,this,e)}const X9=ew.prototype;X9.append=function(e,n){this._pairs.push([e,n])};X9.toString=function(e){const n=e?function(r){return e.call(this,r,bO)}:bO;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function NF(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Y9(t,e,n){if(!e)return t;const r=n&&n.encode||NF;we.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=we.isURLSearchParams(e)?e.toString():new ew(e,n).toString(r),i){const l=t.indexOf("#");l!==-1&&(t=t.slice(0,l)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class wO{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){we.forEach(this.handlers,function(r){r!==null&&e(r)})}}const K9={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},CF=typeof URLSearchParams<"u"?URLSearchParams:ew,TF=typeof FormData<"u"?FormData:null,AF=typeof Blob<"u"?Blob:null,MF={isBrowser:!0,classes:{URLSearchParams:CF,FormData:TF,Blob:AF},protocols:["http","https","file","blob","url","data"]},tw=typeof window<"u"&&typeof document<"u",s2=typeof navigator=="object"&&navigator||void 0,EF=tw&&(!s2||["ReactNative","NativeScript","NS"].indexOf(s2.product)<0),_F=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",DF=tw&&window.location.href||"http://localhost",RF=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:tw,hasStandardBrowserEnv:EF,hasStandardBrowserWebWorkerEnv:_F,navigator:s2,origin:DF},Symbol.toStringTag,{value:"Module"})),ts={...RF,...MF};function zF(t,e){return dx(t,new ts.classes.URLSearchParams,{visitor:function(n,r,s,i){return ts.isNode&&we.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function PF(t){return we.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function BF(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r=n.length;return l=!l&&we.isArray(s)?s.length:l,d?(we.hasOwnProp(s,l)?s[l]=[s[l],r]:s[l]=r,!c):((!s[l]||!we.isObject(s[l]))&&(s[l]=[]),e(n,r,s[l],i)&&we.isArray(s[l])&&(s[l]=BF(s[l])),!c)}if(we.isFormData(t)&&we.isFunction(t.entries)){const n={};return we.forEachEntry(t,(r,s)=>{e(PF(r),s,n,0)}),n}return null}function LF(t,e,n){if(we.isString(t))try{return(e||JSON.parse)(t),we.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const e0={transitional:K9,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=we.isObject(e);if(i&&we.isHTMLForm(e)&&(e=new FormData(e)),we.isFormData(e))return s?JSON.stringify(Z9(e)):e;if(we.isArrayBuffer(e)||we.isBuffer(e)||we.isStream(e)||we.isFile(e)||we.isBlob(e)||we.isReadableStream(e))return e;if(we.isArrayBufferView(e))return e.buffer;if(we.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return zF(e,this.formSerializer).toString();if((c=we.isFileList(e))||r.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return dx(c?{"files[]":e}:e,d&&new d,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),LF(e)):e}],transformResponse:[function(e){const n=this.transitional||e0.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(we.isResponse(e)||we.isReadableStream(e))return e;if(e&&we.isString(e)&&(r&&!this.responseType||s)){const l=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(l)throw c.name==="SyntaxError"?St.from(c,St.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:ts.classes.FormData,Blob:ts.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};we.forEach(["delete","get","head","post","put","patch"],t=>{e0.headers[t]={}});const IF=we.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"]),qF=t=>{const e={};let n,r,s;return t&&t.split(` -`).forEach(function(l){s=l.indexOf(":"),n=l.substring(0,s).trim().toLowerCase(),r=l.substring(s+1).trim(),!(!n||e[n]&&IF[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},SO=Symbol("internals");function Ah(t){return t&&String(t).trim().toLowerCase()}function Hp(t){return t===!1||t==null?t:we.isArray(t)?t.map(Hp):String(t)}function FF(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 QF=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function vy(t,e,n,r,s){if(we.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!we.isString(e)){if(we.isString(r))return e.indexOf(r)!==-1;if(we.isRegExp(r))return r.test(e)}}function $F(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function HF(t,e){const n=we.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,l){return this[r].call(this,e,s,i,l)},configurable:!0})})}let zs=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(c,d,h){const m=Ah(d);if(!m)throw new Error("header name must be a non-empty string");const p=we.findKey(s,m);(!p||s[p]===void 0||h===!0||h===void 0&&s[p]!==!1)&&(s[p||d]=Hp(c))}const l=(c,d)=>we.forEach(c,(h,m)=>i(h,m,d));if(we.isPlainObject(e)||e instanceof this.constructor)l(e,n);else if(we.isString(e)&&(e=e.trim())&&!QF(e))l(qF(e),n);else if(we.isObject(e)&&we.isIterable(e)){let c={},d,h;for(const m of e){if(!we.isArray(m))throw TypeError("Object iterator must return a key-value pair");c[h=m[0]]=(d=c[h])?we.isArray(d)?[...d,m[1]]:[d,m[1]]:m[1]}l(c,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=Ah(e),e){const r=we.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return FF(s);if(we.isFunction(n))return n.call(this,s,r);if(we.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Ah(e),e){const r=we.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||vy(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(l){if(l=Ah(l),l){const c=we.findKey(r,l);c&&(!n||vy(r,r[c],c,n))&&(delete r[c],s=!0)}}return we.isArray(e)?e.forEach(i):i(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!e||vy(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const n=this,r={};return we.forEach(this,(s,i)=>{const l=we.findKey(r,i);if(l){n[l]=Hp(s),delete n[i];return}const c=e?$F(i):String(i).trim();c!==i&&delete n[i],n[c]=Hp(s),r[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return we.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&we.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(s=>r.set(s)),r}static accessor(e){const r=(this[SO]=this[SO]={accessors:{}}).accessors,s=this.prototype;function i(l){const c=Ah(l);r[c]||(HF(s,l),r[c]=!0)}return we.isArray(e)?e.forEach(i):i(e),this}};zs.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);we.reduceDescriptors(zs.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});we.freezeMethods(zs);function yy(t,e){const n=this||e0,r=e||n,s=zs.from(r.headers);let i=r.data;return we.forEach(t,function(c){i=c.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function J9(t){return!!(t&&t.__CANCEL__)}function kd(t,e,n){St.call(this,t??"canceled",St.ERR_CANCELED,e,n),this.name="CanceledError"}we.inherits(kd,St,{__CANCEL__:!0});function eC(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new St("Request failed with status code "+n.status,[St.ERR_BAD_REQUEST,St.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function UF(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function VF(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,l;return e=e!==void 0?e:1e3,function(d){const h=Date.now(),m=r[i];l||(l=h),n[s]=d,r[s]=h;let p=i,x=0;for(;p!==s;)x+=n[p++],p=p%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),h-l{n=m,s=null,i&&(clearTimeout(i),i=null),t(...h)};return[(...h)=>{const m=Date.now(),p=m-n;p>=r?l(h,m):(s=h,i||(i=setTimeout(()=>{i=null,l(s)},r-p)))},()=>s&&l(s)]}const gg=(t,e,n=3)=>{let r=0;const s=VF(50,250);return WF(i=>{const l=i.loaded,c=i.lengthComputable?i.total:void 0,d=l-r,h=s(d),m=l<=c;r=l;const p={loaded:l,total:c,progress:c?l/c:void 0,bytes:d,rate:h||void 0,estimated:h&&c&&m?(c-l)/h:void 0,event:i,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(p)},n)},kO=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},OO=t=>(...e)=>we.asap(()=>t(...e)),GF=ts.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,ts.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(ts.origin),ts.navigator&&/(msie|trident)/i.test(ts.navigator.userAgent)):()=>!0,XF=ts.hasStandardBrowserEnv?{write(t,e,n,r,s,i,l){if(typeof document>"u")return;const c=[`${t}=${encodeURIComponent(e)}`];we.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),we.isString(r)&&c.push(`path=${r}`),we.isString(s)&&c.push(`domain=${s}`),i===!0&&c.push("secure"),we.isString(l)&&c.push(`SameSite=${l}`),document.cookie=c.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function YF(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function KF(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function tC(t,e,n){let r=!YF(e);return t&&(r||n==!1)?KF(t,e):e}const jO=t=>t instanceof zs?{...t}:t;function vc(t,e){e=e||{};const n={};function r(h,m,p,x){return we.isPlainObject(h)&&we.isPlainObject(m)?we.merge.call({caseless:x},h,m):we.isPlainObject(m)?we.merge({},m):we.isArray(m)?m.slice():m}function s(h,m,p,x){if(we.isUndefined(m)){if(!we.isUndefined(h))return r(void 0,h,p,x)}else return r(h,m,p,x)}function i(h,m){if(!we.isUndefined(m))return r(void 0,m)}function l(h,m){if(we.isUndefined(m)){if(!we.isUndefined(h))return r(void 0,h)}else return r(void 0,m)}function c(h,m,p){if(p in e)return r(h,m);if(p in t)return r(void 0,h)}const d={url:i,method:i,data:i,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:c,headers:(h,m,p)=>s(jO(h),jO(m),p,!0)};return we.forEach(Object.keys({...t,...e}),function(m){const p=d[m]||s,x=p(t[m],e[m],m);we.isUndefined(x)&&p!==c||(n[m]=x)}),n}const nC=t=>{const e=vc({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:l,auth:c}=e;if(e.headers=l=zs.from(l),e.url=Y9(tC(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&l.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),we.isFormData(n)){if(ts.hasStandardBrowserEnv||ts.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if(we.isFunction(n.getHeaders)){const d=n.getHeaders(),h=["content-type","content-length"];Object.entries(d).forEach(([m,p])=>{h.includes(m.toLowerCase())&&l.set(m,p)})}}if(ts.hasStandardBrowserEnv&&(r&&we.isFunction(r)&&(r=r(e)),r||r!==!1&&GF(e.url))){const d=s&&i&&XF.read(i);d&&l.set(s,d)}return e},ZF=typeof XMLHttpRequest<"u",JF=ZF&&function(t){return new Promise(function(n,r){const s=nC(t);let i=s.data;const l=zs.from(s.headers).normalize();let{responseType:c,onUploadProgress:d,onDownloadProgress:h}=s,m,p,x,v,b;function k(){v&&v(),b&&b(),s.cancelToken&&s.cancelToken.unsubscribe(m),s.signal&&s.signal.removeEventListener("abort",m)}let O=new XMLHttpRequest;O.open(s.method.toUpperCase(),s.url,!0),O.timeout=s.timeout;function j(){if(!O)return;const A=zs.from("getAllResponseHeaders"in O&&O.getAllResponseHeaders()),D={data:!c||c==="text"||c==="json"?O.responseText:O.response,status:O.status,statusText:O.statusText,headers:A,config:t,request:O};eC(function(z){n(z),k()},function(z){r(z),k()},D),O=null}"onloadend"in O?O.onloadend=j:O.onreadystatechange=function(){!O||O.readyState!==4||O.status===0&&!(O.responseURL&&O.responseURL.indexOf("file:")===0)||setTimeout(j)},O.onabort=function(){O&&(r(new St("Request aborted",St.ECONNABORTED,t,O)),O=null)},O.onerror=function(_){const D=_&&_.message?_.message:"Network Error",E=new St(D,St.ERR_NETWORK,t,O);E.event=_||null,r(E),O=null},O.ontimeout=function(){let _=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const D=s.transitional||K9;s.timeoutErrorMessage&&(_=s.timeoutErrorMessage),r(new St(_,D.clarifyTimeoutError?St.ETIMEDOUT:St.ECONNABORTED,t,O)),O=null},i===void 0&&l.setContentType(null),"setRequestHeader"in O&&we.forEach(l.toJSON(),function(_,D){O.setRequestHeader(D,_)}),we.isUndefined(s.withCredentials)||(O.withCredentials=!!s.withCredentials),c&&c!=="json"&&(O.responseType=s.responseType),h&&([x,b]=gg(h,!0),O.addEventListener("progress",x)),d&&O.upload&&([p,v]=gg(d),O.upload.addEventListener("progress",p),O.upload.addEventListener("loadend",v)),(s.cancelToken||s.signal)&&(m=A=>{O&&(r(!A||A.type?new kd(null,t,O):A),O.abort(),O=null)},s.cancelToken&&s.cancelToken.subscribe(m),s.signal&&(s.signal.aborted?m():s.signal.addEventListener("abort",m)));const T=UF(s.url);if(T&&ts.protocols.indexOf(T)===-1){r(new St("Unsupported protocol "+T+":",St.ERR_BAD_REQUEST,t));return}O.send(i||null)})},eQ=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(h){if(!s){s=!0,c();const m=h instanceof Error?h:this.reason;r.abort(m instanceof St?m:new kd(m instanceof Error?m.message:m))}};let l=e&&setTimeout(()=>{l=null,i(new St(`timeout ${e} of ms exceeded`,St.ETIMEDOUT))},e);const c=()=>{t&&(l&&clearTimeout(l),l=null,t.forEach(h=>{h.unsubscribe?h.unsubscribe(i):h.removeEventListener("abort",i)}),t=null)};t.forEach(h=>h.addEventListener("abort",i));const{signal:d}=r;return d.unsubscribe=()=>we.asap(c),d}},tQ=function*(t,e){let n=t.byteLength;if(n{const s=nQ(t,e);let i=0,l,c=d=>{l||(l=!0,r&&r(d))};return new ReadableStream({async pull(d){try{const{done:h,value:m}=await s.next();if(h){c(),d.close();return}let p=m.byteLength;if(n){let x=i+=p;n(x)}d.enqueue(new Uint8Array(m))}catch(h){throw c(h),h}},cancel(d){return c(d),s.return()}},{highWaterMark:2})},CO=64*1024,{isFunction:Xm}=we,sQ=(({Request:t,Response:e})=>({Request:t,Response:e}))(we.global),{ReadableStream:TO,TextEncoder:AO}=we.global,MO=(t,...e)=>{try{return!!t(...e)}catch{return!1}},iQ=t=>{t=we.merge.call({skipUndefined:!0},sQ,t);const{fetch:e,Request:n,Response:r}=t,s=e?Xm(e):typeof fetch=="function",i=Xm(n),l=Xm(r);if(!s)return!1;const c=s&&Xm(TO),d=s&&(typeof AO=="function"?(b=>k=>b.encode(k))(new AO):async b=>new Uint8Array(await new n(b).arrayBuffer())),h=i&&c&&MO(()=>{let b=!1;const k=new n(ts.origin,{body:new TO,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!k}),m=l&&c&&MO(()=>we.isReadableStream(new r("").body)),p={stream:m&&(b=>b.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!p[b]&&(p[b]=(k,O)=>{let j=k&&k[b];if(j)return j.call(k);throw new St(`Response type '${b}' is not supported`,St.ERR_NOT_SUPPORT,O)})});const x=async b=>{if(b==null)return 0;if(we.isBlob(b))return b.size;if(we.isSpecCompliantForm(b))return(await new n(ts.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(we.isArrayBufferView(b)||we.isArrayBuffer(b))return b.byteLength;if(we.isURLSearchParams(b)&&(b=b+""),we.isString(b))return(await d(b)).byteLength},v=async(b,k)=>{const O=we.toFiniteNumber(b.getContentLength());return O??x(k)};return async b=>{let{url:k,method:O,data:j,signal:T,cancelToken:A,timeout:_,onDownloadProgress:D,onUploadProgress:E,responseType:z,headers:Q,withCredentials:F="same-origin",fetchOptions:L}=nC(b),U=e||fetch;z=z?(z+"").toLowerCase():"text";let V=eQ([T,A&&A.toAbortSignal()],_),ce=null;const W=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let J;try{if(E&&h&&O!=="get"&&O!=="head"&&(J=await v(Q,j))!==0){let me=new n(k,{method:"POST",body:j,duplex:"half"}),Y;if(we.isFormData(j)&&(Y=me.headers.get("content-type"))&&Q.setContentType(Y),me.body){const[P,K]=kO(J,gg(OO(E)));j=NO(me.body,CO,P,K)}}we.isString(F)||(F=F?"include":"omit");const $=i&&"credentials"in n.prototype,ae={...L,signal:V,method:O.toUpperCase(),headers:Q.normalize().toJSON(),body:j,duplex:"half",credentials:$?F:void 0};ce=i&&new n(k,ae);let ne=await(i?U(ce,L):U(k,ae));const ue=m&&(z==="stream"||z==="response");if(m&&(D||ue&&W)){const me={};["status","statusText","headers"].forEach(H=>{me[H]=ne[H]});const Y=we.toFiniteNumber(ne.headers.get("content-length")),[P,K]=D&&kO(Y,gg(OO(D),!0))||[];ne=new r(NO(ne.body,CO,P,()=>{K&&K(),W&&W()}),me)}z=z||"text";let R=await p[we.findKey(p,z)||"text"](ne,b);return!ue&&W&&W(),await new Promise((me,Y)=>{eC(me,Y,{data:R,headers:zs.from(ne.headers),status:ne.status,statusText:ne.statusText,config:b,request:ce})})}catch($){throw W&&W(),$&&$.name==="TypeError"&&/Load failed|fetch/i.test($.message)?Object.assign(new St("Network Error",St.ERR_NETWORK,b,ce),{cause:$.cause||$}):St.from($,$&&$.code,b,ce)}}},aQ=new Map,rC=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,i=[r,s,n];let l=i.length,c=l,d,h,m=aQ;for(;c--;)d=i[c],h=m.get(d),h===void 0&&m.set(d,h=c?new Map:iQ(e)),m=h;return h};rC();const nw={http:kF,xhr:JF,fetch:{get:rC}};we.forEach(nw,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const EO=t=>`- ${t}`,lQ=t=>we.isFunction(t)||t===null||t===!1;function oQ(t,e){t=we.isArray(t)?t:[t];const{length:n}=t;let r,s;const i={};for(let l=0;l`adapter ${d} `+(h===!1?"is not supported by the environment":"is not available in the build"));let c=n?l.length>1?`since : +`+g.stack}}var nn=Object.prototype.hasOwnProperty,_t=t.unstable_scheduleCallback,Yr=t.unstable_cancelCallback,qn=t.unstable_shouldYield,or=t.unstable_requestPaint,yn=t.unstable_now,ft=t.unstable_getCurrentPriorityLevel,ee=t.unstable_ImmediatePriority,Se=t.unstable_UserBlockingPriority,Be=t.unstable_NormalPriority,rt=t.unstable_LowPriority,Tt=t.unstable_IdlePriority,cr=t.log,Kr=t.unstable_setDisableYieldValue,re=null,Me=null;function pt(o){if(typeof cr=="function"&&Kr(o),Me&&typeof Me.setStrictMode=="function")try{Me.setStrictMode(re,o)}catch{}}var vt=Math.clz32?Math.clz32:Pn,vs=Math.log,dt=Math.LN2;function Pn(o){return o>>>=0,o===0?32:31-(vs(o)/dt|0)|0}var mt=256,rn=262144,Ar=4194304;function Mt(o){var u=o&42;if(u!==0)return u;switch(o&-o){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Ic(o,u,f){var g=o.pendingLanes;if(g===0)return 0;var y=0,w=o.suspendedLanes,A=o.pingedLanes;o=o.warmLanes;var I=g&134217727;return I!==0?(g=I&~w,g!==0?y=Mt(g):(A&=I,A!==0?y=Mt(A):f||(f=I&~o,f!==0&&(y=Mt(f))))):(I=g&~w,I!==0?y=Mt(I):A!==0?y=Mt(A):f||(f=g&~o,f!==0&&(y=Mt(f)))),y===0?0:u!==0&&u!==y&&(u&w)===0&&(w=y&-y,f=u&-u,w>=f||w===32&&(f&4194048)!==0)?u:y}function Eo(o,u){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&u)===0}function t1(o,u){switch(o){case 1:case 2:case 4:case 8:case 64:return u+250;case 16:case 32: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 u+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function qc(){var o=Ar;return Ar<<=1,(Ar&62914560)===0&&(Ar=4194304),o}function _o(o){for(var u=[],f=0;31>f;f++)u.push(o);return u}function Bd(o,u){o.pendingLanes|=u,u!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function xB(o,u,f,g,y,w){var A=o.pendingLanes;o.pendingLanes=f,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=f,o.entangledLanes&=f,o.errorRecoveryDisabledLanes&=f,o.shellSuspendCounter=0;var I=o.entanglements,Z=o.expirationTimes,xe=o.hiddenUpdates;for(f=A&~f;0"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var kB=/[\n"\\]/g;function oi(o){return o.replace(kB,function(u){return"\\"+u.charCodeAt(0).toString(16)+" "})}function l1(o,u,f,g,y,w,A,I){o.name="",A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?o.type=A:o.removeAttribute("type"),u!=null?A==="number"?(u===0&&o.value===""||o.value!=u)&&(o.value=""+li(u)):o.value!==""+li(u)&&(o.value=""+li(u)):A!=="submit"&&A!=="reset"||o.removeAttribute("value"),u!=null?o1(o,A,li(u)):f!=null?o1(o,A,li(f)):g!=null&&o.removeAttribute("value"),y==null&&w!=null&&(o.defaultChecked=!!w),y!=null&&(o.checked=y&&typeof y!="function"&&typeof y!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?o.name=""+li(I):o.removeAttribute("name")}function O3(o,u,f,g,y,w,A,I){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(o.type=w),u!=null||f!=null){if(!(w!=="submit"&&w!=="reset"||u!=null)){a1(o);return}f=f!=null?""+li(f):"",u=u!=null?""+li(u):f,I||u===o.value||(o.value=u),o.defaultValue=u}g=g??y,g=typeof g!="function"&&typeof g!="symbol"&&!!g,o.checked=I?o.checked:!!g,o.defaultChecked=!!g,A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(o.name=A),a1(o)}function o1(o,u,f){u==="number"&&P0(o.ownerDocument)===o||o.defaultValue===""+f||(o.defaultValue=""+f)}function Vc(o,u,f,g){if(o=o.options,u){u={};for(var y=0;y"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f1=!1;if(_a)try{var Fd={};Object.defineProperty(Fd,"passive",{get:function(){f1=!0}}),window.addEventListener("test",Fd,Fd),window.removeEventListener("test",Fd,Fd)}catch{f1=!1}var Ol=null,m1=null,L0=null;function E3(){if(L0)return L0;var o,u=m1,f=u.length,g,y="value"in Ol?Ol.value:Ol.textContent,w=y.length;for(o=0;o=Hd),B3=" ",L3=!1;function I3(o,u){switch(o){case"keyup":return KB.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function q3(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Yc=!1;function JB(o,u){switch(o){case"compositionend":return q3(u);case"keypress":return u.which!==32?null:(L3=!0,B3);case"textInput":return o=u.data,o===B3&&L3?null:o;default:return null}}function eL(o,u){if(Yc)return o==="compositionend"||!y1&&I3(o,u)?(o=E3(),L0=m1=Ol=null,Yc=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1=u)return{node:f,offset:u-o};o=g}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=G3(f)}}function Y3(o,u){return o&&u?o===u?!0:o&&o.nodeType===3?!1:u&&u.nodeType===3?Y3(o,u.parentNode):"contains"in o?o.contains(u):o.compareDocumentPosition?!!(o.compareDocumentPosition(u)&16):!1:!1}function K3(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var u=P0(o.document);u instanceof o.HTMLIFrameElement;){try{var f=typeof u.contentWindow.location.href=="string"}catch{f=!1}if(f)o=u.contentWindow;else break;u=P0(o.document)}return u}function S1(o){var u=o&&o.nodeName&&o.nodeName.toLowerCase();return u&&(u==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||u==="textarea"||o.contentEditable==="true")}var oL=_a&&"documentMode"in document&&11>=document.documentMode,Kc=null,k1=null,Gd=null,O1=!1;function Z3(o,u,f){var g=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;O1||Kc==null||Kc!==P0(g)||(g=Kc,"selectionStart"in g&&S1(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Gd&&Wd(Gd,g)||(Gd=g,g=Em(k1,"onSelect"),0>=A,y-=A,Gi=1<<32-vt(u)+y|f<kt?(Qt=Ke,Ke=null):Qt=Ke.sibling;var Zt=be(oe,Ke,pe[kt],Ne);if(Zt===null){Ke===null&&(Ke=Qt);break}o&&Ke&&Zt.alternate===null&&u(oe,Ke),se=w(Zt,se,kt),Kt===null?tt=Zt:Kt.sibling=Zt,Kt=Zt,Ke=Qt}if(kt===pe.length)return f(oe,Ke),Ut&&Ra(oe,kt),tt;if(Ke===null){for(;ktkt?(Qt=Ke,Ke=null):Qt=Ke.sibling;var Vl=be(oe,Ke,Zt.value,Ne);if(Vl===null){Ke===null&&(Ke=Qt);break}o&&Ke&&Vl.alternate===null&&u(oe,Ke),se=w(Vl,se,kt),Kt===null?tt=Vl:Kt.sibling=Vl,Kt=Vl,Ke=Qt}if(Zt.done)return f(oe,Ke),Ut&&Ra(oe,kt),tt;if(Ke===null){for(;!Zt.done;kt++,Zt=pe.next())Zt=Te(oe,Zt.value,Ne),Zt!==null&&(se=w(Zt,se,kt),Kt===null?tt=Zt:Kt.sibling=Zt,Kt=Zt);return Ut&&Ra(oe,kt),tt}for(Ke=g(Ke);!Zt.done;kt++,Zt=pe.next())Zt=ke(Ke,oe,kt,Zt.value,Ne),Zt!==null&&(o&&Zt.alternate!==null&&Ke.delete(Zt.key===null?kt:Zt.key),se=w(Zt,se,kt),Kt===null?tt=Zt:Kt.sibling=Zt,Kt=Zt);return o&&Ke.forEach(function(TI){return u(oe,TI)}),Ut&&Ra(oe,kt),tt}function Sn(oe,se,pe,Ne){if(typeof pe=="object"&&pe!==null&&pe.type===k&&pe.key===null&&(pe=pe.props.children),typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case v:e:{for(var tt=pe.key;se!==null;){if(se.key===tt){if(tt=pe.type,tt===k){if(se.tag===7){f(oe,se.sibling),Ne=y(se,pe.props.children),Ne.return=oe,oe=Ne;break e}}else if(se.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===Q&&$o(tt)===se.type){f(oe,se.sibling),Ne=y(se,pe.props),eh(Ne,pe),Ne.return=oe,oe=Ne;break e}f(oe,se);break}else u(oe,se);se=se.sibling}pe.type===k?(Ne=Lo(pe.props.children,oe.mode,Ne,pe.key),Ne.return=oe,oe=Ne):(Ne=G0(pe.type,pe.key,pe.props,null,oe.mode,Ne),eh(Ne,pe),Ne.return=oe,oe=Ne)}return A(oe);case b:e:{for(tt=pe.key;se!==null;){if(se.key===tt)if(se.tag===4&&se.stateNode.containerInfo===pe.containerInfo&&se.stateNode.implementation===pe.implementation){f(oe,se.sibling),Ne=y(se,pe.children||[]),Ne.return=oe,oe=Ne;break e}else{f(oe,se);break}else u(oe,se);se=se.sibling}Ne=E1(pe,oe.mode,Ne),Ne.return=oe,oe=Ne}return A(oe);case Q:return pe=$o(pe),Sn(oe,se,pe,Ne)}if(J(pe))return Ge(oe,se,pe,Ne);if(V(pe)){if(tt=V(pe),typeof tt!="function")throw Error(r(150));return pe=tt.call(pe),lt(oe,se,pe,Ne)}if(typeof pe.then=="function")return Sn(oe,se,tm(pe),Ne);if(pe.$$typeof===M)return Sn(oe,se,K0(oe,pe),Ne);nm(oe,pe)}return typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint"?(pe=""+pe,se!==null&&se.tag===6?(f(oe,se.sibling),Ne=y(se,pe),Ne.return=oe,oe=Ne):(f(oe,se),Ne=A1(pe,oe.mode,Ne),Ne.return=oe,oe=Ne),A(oe)):f(oe,se)}return function(oe,se,pe,Ne){try{Jd=0;var tt=Sn(oe,se,pe,Ne);return ou=null,tt}catch(Ke){if(Ke===lu||Ke===J0)throw Ke;var Kt=$s(29,Ke,null,oe.mode);return Kt.lanes=Ne,Kt.return=oe,Kt}finally{}}}var Uo=w6(!0),S6=w6(!1),Ml=!1;function $1(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function H1(o,u){o=o.updateQueue,u.updateQueue===o&&(u.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Al(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function El(o,u,f){var g=o.updateQueue;if(g===null)return null;if(g=g.shared,(sn&2)!==0){var y=g.pending;return y===null?u.next=u:(u.next=y.next,y.next=u),g.pending=u,u=W0(o),i6(o,null,f),u}return V0(o,g,u,f),W0(o)}function th(o,u,f){if(u=u.updateQueue,u!==null&&(u=u.shared,(f&4194048)!==0)){var g=u.lanes;g&=o.pendingLanes,f|=g,u.lanes=f,f3(o,f)}}function U1(o,u){var f=o.updateQueue,g=o.alternate;if(g!==null&&(g=g.updateQueue,f===g)){var y=null,w=null;if(f=f.firstBaseUpdate,f!==null){do{var A={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};w===null?y=w=A:w=w.next=A,f=f.next}while(f!==null);w===null?y=w=u:w=w.next=u}else y=w=u;f={baseState:g.baseState,firstBaseUpdate:y,lastBaseUpdate:w,shared:g.shared,callbacks:g.callbacks},o.updateQueue=f;return}o=f.lastBaseUpdate,o===null?f.firstBaseUpdate=u:o.next=u,f.lastBaseUpdate=u}var V1=!1;function nh(){if(V1){var o=au;if(o!==null)throw o}}function rh(o,u,f,g){V1=!1;var y=o.updateQueue;Ml=!1;var w=y.firstBaseUpdate,A=y.lastBaseUpdate,I=y.shared.pending;if(I!==null){y.shared.pending=null;var Z=I,xe=Z.next;Z.next=null,A===null?w=xe:A.next=xe,A=Z;var je=o.alternate;je!==null&&(je=je.updateQueue,I=je.lastBaseUpdate,I!==A&&(I===null?je.firstBaseUpdate=xe:I.next=xe,je.lastBaseUpdate=Z))}if(w!==null){var Te=y.baseState;A=0,je=xe=Z=null,I=w;do{var be=I.lane&-536870913,ke=be!==I.lane;if(ke?(Ft&be)===be:(g&be)===be){be!==0&&be===iu&&(V1=!0),je!==null&&(je=je.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});e:{var Ge=o,lt=I;be=u;var Sn=f;switch(lt.tag){case 1:if(Ge=lt.payload,typeof Ge=="function"){Te=Ge.call(Sn,Te,be);break e}Te=Ge;break e;case 3:Ge.flags=Ge.flags&-65537|128;case 0:if(Ge=lt.payload,be=typeof Ge=="function"?Ge.call(Sn,Te,be):Ge,be==null)break e;Te=p({},Te,be);break e;case 2:Ml=!0}}be=I.callback,be!==null&&(o.flags|=64,ke&&(o.flags|=8192),ke=y.callbacks,ke===null?y.callbacks=[be]:ke.push(be))}else ke={lane:be,tag:I.tag,payload:I.payload,callback:I.callback,next:null},je===null?(xe=je=ke,Z=Te):je=je.next=ke,A|=be;if(I=I.next,I===null){if(I=y.shared.pending,I===null)break;ke=I,I=ke.next,ke.next=null,y.lastBaseUpdate=ke,y.shared.pending=null}}while(!0);je===null&&(Z=Te),y.baseState=Z,y.firstBaseUpdate=xe,y.lastBaseUpdate=je,w===null&&(y.shared.lanes=0),Pl|=A,o.lanes=A,o.memoizedState=Te}}function k6(o,u){if(typeof o!="function")throw Error(r(191,o));o.call(u)}function O6(o,u){var f=o.callbacks;if(f!==null)for(o.callbacks=null,o=0;ow?w:8;var A=H.T,I={};H.T=I,dv(o,!1,u,f);try{var Z=y(),xe=H.S;if(xe!==null&&xe(I,Z),Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var je=xL(Z,g);ah(o,u,je,Gs(o))}else ah(o,u,g,Gs(o))}catch(Te){ah(o,u,{then:function(){},status:"rejected",reason:Te},Gs())}finally{ae.p=w,A!==null&&I.types!==null&&(A.types=I.types),H.T=A}}function kL(){}function cv(o,u,f,g){if(o.tag!==5)throw Error(r(476));var y=nS(o).queue;tS(o,y,u,ne,f===null?kL:function(){return rS(o),f(g)})}function nS(o){var u=o.memoizedState;if(u!==null)return u;u={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:La,lastRenderedState:ne},next:null};var f={};return u.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:La,lastRenderedState:f},next:null},o.memoizedState=u,o=o.alternate,o!==null&&(o.memoizedState=u),u}function rS(o){var u=nS(o);u.next===null&&(u=o.alternate.memoizedState),ah(o,u.next.queue,{},Gs())}function uv(){return qr(kh)}function sS(){return sr().memoizedState}function iS(){return sr().memoizedState}function OL(o){for(var u=o.return;u!==null;){switch(u.tag){case 24:case 3:var f=Gs();o=Al(f);var g=El(u,o,f);g!==null&&(js(g,u,f),th(g,u,f)),u={cache:I1()},o.payload=u;return}u=u.return}}function jL(o,u,f){var g=Gs();f={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},hm(o)?lS(u,f):(f=T1(o,u,f,g),f!==null&&(js(f,o,g),oS(f,u,g)))}function aS(o,u,f){var g=Gs();ah(o,u,f,g)}function ah(o,u,f,g){var y={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(hm(o))lS(u,y);else{var w=o.alternate;if(o.lanes===0&&(w===null||w.lanes===0)&&(w=u.lastRenderedReducer,w!==null))try{var A=u.lastRenderedState,I=w(A,f);if(y.hasEagerState=!0,y.eagerState=I,Qs(I,A))return V0(o,u,y,0),Mn===null&&U0(),!1}catch{}finally{}if(f=T1(o,u,y,g),f!==null)return js(f,o,g),oS(f,u,g),!0}return!1}function dv(o,u,f,g){if(g={lane:2,revertLane:$v(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},hm(o)){if(u)throw Error(r(479))}else u=T1(o,f,g,2),u!==null&&js(u,o,2)}function hm(o){var u=o.alternate;return o===wt||u!==null&&u===wt}function lS(o,u){uu=im=!0;var f=o.pending;f===null?u.next=u:(u.next=f.next,f.next=u),o.pending=u}function oS(o,u,f){if((f&4194048)!==0){var g=u.lanes;g&=o.pendingLanes,f|=g,u.lanes=f,f3(o,f)}}var lh={readContext:qr,use:om,useCallback:er,useContext:er,useEffect:er,useImperativeHandle:er,useLayoutEffect:er,useInsertionEffect:er,useMemo:er,useReducer:er,useRef:er,useState:er,useDebugValue:er,useDeferredValue:er,useTransition:er,useSyncExternalStore:er,useId:er,useHostTransitionStatus:er,useFormState:er,useActionState:er,useOptimistic:er,useMemoCache:er,useCacheRefresh:er};lh.useEffectEvent=er;var cS={readContext:qr,use:om,useCallback:function(o,u){return os().memoizedState=[o,u===void 0?null:u],o},useContext:qr,useEffect:V6,useImperativeHandle:function(o,u,f){f=f!=null?f.concat([o]):null,um(4194308,4,Y6.bind(null,u,o),f)},useLayoutEffect:function(o,u){return um(4194308,4,o,u)},useInsertionEffect:function(o,u){um(4,2,o,u)},useMemo:function(o,u){var f=os();u=u===void 0?null:u;var g=o();if(Vo){pt(!0);try{o()}finally{pt(!1)}}return f.memoizedState=[g,u],g},useReducer:function(o,u,f){var g=os();if(f!==void 0){var y=f(u);if(Vo){pt(!0);try{f(u)}finally{pt(!1)}}}else y=u;return g.memoizedState=g.baseState=y,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:y},g.queue=o,o=o.dispatch=jL.bind(null,wt,o),[g.memoizedState,o]},useRef:function(o){var u=os();return o={current:o},u.memoizedState=o},useState:function(o){o=sv(o);var u=o.queue,f=aS.bind(null,wt,u);return u.dispatch=f,[o.memoizedState,f]},useDebugValue:lv,useDeferredValue:function(o,u){var f=os();return ov(f,o,u)},useTransition:function(){var o=sv(!1);return o=tS.bind(null,wt,o.queue,!0,!1),os().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,u,f){var g=wt,y=os();if(Ut){if(f===void 0)throw Error(r(407));f=f()}else{if(f=u(),Mn===null)throw Error(r(349));(Ft&127)!==0||A6(g,u,f)}y.memoizedState=f;var w={value:f,getSnapshot:u};return y.queue=w,V6(_6.bind(null,g,w,o),[o]),g.flags|=2048,hu(9,{destroy:void 0},E6.bind(null,g,w,f,u),null),f},useId:function(){var o=os(),u=Mn.identifierPrefix;if(Ut){var f=Xi,g=Gi;f=(g&~(1<<32-vt(g)-1)).toString(32)+f,u="_"+u+"R_"+f,f=am++,0<\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof g.is=="string"?A.createElement("select",{is:g.is}):A.createElement("select"),g.multiple?w.multiple=!0:g.size&&(w.size=g.size);break;default:w=typeof g.is=="string"?A.createElement(y,{is:g.is}):A.createElement(y)}}w[Lr]=u,w[ys]=g;e:for(A=u.child;A!==null;){if(A.tag===5||A.tag===6)w.appendChild(A.stateNode);else if(A.tag!==4&&A.tag!==27&&A.child!==null){A.child.return=A,A=A.child;continue}if(A===u)break e;for(;A.sibling===null;){if(A.return===null||A.return===u)break e;A=A.return}A.sibling.return=A.return,A=A.sibling}u.stateNode=w;e:switch(Qr(w,y,g),y){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&qa(u)}}return Qn(u),jv(u,u.type,o===null?null:o.memoizedProps,u.pendingProps,f),null;case 6:if(o&&u.stateNode!=null)o.memoizedProps!==g&&qa(u);else{if(typeof g!="string"&&u.stateNode===null)throw Error(r(166));if(o=fe.current,ru(u)){if(o=u.stateNode,f=u.memoizedProps,g=null,y=Ir,y!==null)switch(y.tag){case 27:case 5:g=y.memoizedProps}o[Lr]=u,o=!!(o.nodeValue===f||g!==null&&g.suppressHydrationWarning===!0||Tk(o.nodeValue,f)),o||Cl(u,!0)}else o=_m(o).createTextNode(g),o[Lr]=u,u.stateNode=o}return Qn(u),null;case 31:if(f=u.memoizedState,o===null||o.memoizedState!==null){if(g=ru(u),f!==null){if(o===null){if(!g)throw Error(r(318));if(o=u.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[Lr]=u}else Io(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Qn(u),o=!1}else f=z1(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=f),o=!0;if(!o)return u.flags&256?(Us(u),u):(Us(u),null);if((u.flags&128)!==0)throw Error(r(558))}return Qn(u),null;case 13:if(g=u.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(y=ru(u),g!==null&&g.dehydrated!==null){if(o===null){if(!y)throw Error(r(318));if(y=u.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(r(317));y[Lr]=u}else Io(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Qn(u),y=!1}else y=z1(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=y),y=!0;if(!y)return u.flags&256?(Us(u),u):(Us(u),null)}return Us(u),(u.flags&128)!==0?(u.lanes=f,u):(f=g!==null,o=o!==null&&o.memoizedState!==null,f&&(g=u.child,y=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(y=g.alternate.memoizedState.cachePool.pool),w=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(w=g.memoizedState.cachePool.pool),w!==y&&(g.flags|=2048)),f!==o&&f&&(u.child.flags|=8192),xm(u,u.updateQueue),Qn(u),null);case 4:return de(),o===null&&Wv(u.stateNode.containerInfo),Qn(u),null;case 10:return Pa(u.type),Qn(u),null;case 19:if(Y(rr),g=u.memoizedState,g===null)return Qn(u),null;if(y=(u.flags&128)!==0,w=g.rendering,w===null)if(y)ch(g,!1);else{if(tr!==0||o!==null&&(o.flags&128)!==0)for(o=u.child;o!==null;){if(w=sm(o),w!==null){for(u.flags|=128,ch(g,!1),o=w.updateQueue,u.updateQueue=o,xm(u,o),u.subtreeFlags=0,o=f,f=u.child;f!==null;)a6(f,o),f=f.sibling;return P(rr,rr.current&1|2),Ut&&Ra(u,g.treeForkCount),u.child}o=o.sibling}g.tail!==null&&yn()>Sm&&(u.flags|=128,y=!0,ch(g,!1),u.lanes=4194304)}else{if(!y)if(o=sm(w),o!==null){if(u.flags|=128,y=!0,o=o.updateQueue,u.updateQueue=o,xm(u,o),ch(g,!0),g.tail===null&&g.tailMode==="hidden"&&!w.alternate&&!Ut)return Qn(u),null}else 2*yn()-g.renderingStartTime>Sm&&f!==536870912&&(u.flags|=128,y=!0,ch(g,!1),u.lanes=4194304);g.isBackwards?(w.sibling=u.child,u.child=w):(o=g.last,o!==null?o.sibling=w:u.child=w,g.last=w)}return g.tail!==null?(o=g.tail,g.rendering=o,g.tail=o.sibling,g.renderingStartTime=yn(),o.sibling=null,f=rr.current,P(rr,y?f&1|2:f&1),Ut&&Ra(u,g.treeForkCount),o):(Qn(u),null);case 22:case 23:return Us(u),G1(),g=u.memoizedState!==null,o!==null?o.memoizedState!==null!==g&&(u.flags|=8192):g&&(u.flags|=8192),g?(f&536870912)!==0&&(u.flags&128)===0&&(Qn(u),u.subtreeFlags&6&&(u.flags|=8192)):Qn(u),f=u.updateQueue,f!==null&&xm(u,f.retryQueue),f=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==f&&(u.flags|=2048),o!==null&&Y(Qo),null;case 24:return f=null,o!==null&&(f=o.memoizedState.cache),u.memoizedState.cache!==f&&(u.flags|=2048),Pa(ur),Qn(u),null;case 25:return null;case 30:return null}throw Error(r(156,u.tag))}function AL(o,u){switch(D1(u),u.tag){case 1:return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 3:return Pa(ur),de(),o=u.flags,(o&65536)!==0&&(o&128)===0?(u.flags=o&-65537|128,u):null;case 26:case 27:case 5:return ct(u),null;case 31:if(u.memoizedState!==null){if(Us(u),u.alternate===null)throw Error(r(340));Io()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 13:if(Us(u),o=u.memoizedState,o!==null&&o.dehydrated!==null){if(u.alternate===null)throw Error(r(340));Io()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 19:return Y(rr),null;case 4:return de(),null;case 10:return Pa(u.type),null;case 22:case 23:return Us(u),G1(),o!==null&&Y(Qo),o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 24:return Pa(ur),null;case 25:return null;default:return null}}function DS(o,u){switch(D1(u),u.tag){case 3:Pa(ur),de();break;case 26:case 27:case 5:ct(u);break;case 4:de();break;case 31:u.memoizedState!==null&&Us(u);break;case 13:Us(u);break;case 19:Y(rr);break;case 10:Pa(u.type);break;case 22:case 23:Us(u),G1(),o!==null&&Y(Qo);break;case 24:Pa(ur)}}function uh(o,u){try{var f=u.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var y=g.next;f=y;do{if((f.tag&o)===o){g=void 0;var w=f.create,A=f.inst;g=w(),A.destroy=g}f=f.next}while(f!==y)}}catch(I){gn(u,u.return,I)}}function Rl(o,u,f){try{var g=u.updateQueue,y=g!==null?g.lastEffect:null;if(y!==null){var w=y.next;g=w;do{if((g.tag&o)===o){var A=g.inst,I=A.destroy;if(I!==void 0){A.destroy=void 0,y=u;var Z=f,xe=I;try{xe()}catch(je){gn(y,Z,je)}}}g=g.next}while(g!==w)}}catch(je){gn(u,u.return,je)}}function RS(o){var u=o.updateQueue;if(u!==null){var f=o.stateNode;try{O6(u,f)}catch(g){gn(o,o.return,g)}}}function zS(o,u,f){f.props=Wo(o.type,o.memoizedProps),f.state=o.memoizedState;try{f.componentWillUnmount()}catch(g){gn(o,u,g)}}function dh(o,u){try{var f=o.ref;if(f!==null){switch(o.tag){case 26:case 27:case 5:var g=o.stateNode;break;case 30:g=o.stateNode;break;default:g=o.stateNode}typeof f=="function"?o.refCleanup=f(g):f.current=g}}catch(y){gn(o,u,y)}}function Yi(o,u){var f=o.ref,g=o.refCleanup;if(f!==null)if(typeof g=="function")try{g()}catch(y){gn(o,u,y)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(y){gn(o,u,y)}else f.current=null}function PS(o){var u=o.type,f=o.memoizedProps,g=o.stateNode;try{e:switch(u){case"button":case"input":case"select":case"textarea":f.autoFocus&&g.focus();break e;case"img":f.src?g.src=f.src:f.srcSet&&(g.srcset=f.srcSet)}}catch(y){gn(o,o.return,y)}}function Nv(o,u,f){try{var g=o.stateNode;ZL(g,o.type,f,u),g[ys]=u}catch(y){gn(o,o.return,y)}}function BS(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Fl(o.type)||o.tag===4}function Cv(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||BS(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Fl(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Tv(o,u,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,u?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(o,u):(u=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,u.appendChild(o),f=f._reactRootContainer,f!=null||u.onclick!==null||(u.onclick=Ea));else if(g!==4&&(g===27&&Fl(o.type)&&(f=o.stateNode,u=null),o=o.child,o!==null))for(Tv(o,u,f),o=o.sibling;o!==null;)Tv(o,u,f),o=o.sibling}function vm(o,u,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,u?f.insertBefore(o,u):f.appendChild(o);else if(g!==4&&(g===27&&Fl(o.type)&&(f=o.stateNode),o=o.child,o!==null))for(vm(o,u,f),o=o.sibling;o!==null;)vm(o,u,f),o=o.sibling}function LS(o){var u=o.stateNode,f=o.memoizedProps;try{for(var g=o.type,y=u.attributes;y.length;)u.removeAttributeNode(y[0]);Qr(u,g,f),u[Lr]=o,u[ys]=f}catch(w){gn(o,o.return,w)}}var Fa=!1,fr=!1,Mv=!1,IS=typeof WeakSet=="function"?WeakSet:Set,_r=null;function EL(o,u){if(o=o.containerInfo,Yv=Im,o=K3(o),S1(o)){if("selectionStart"in o)var f={start:o.selectionStart,end:o.selectionEnd};else e:{f=(f=o.ownerDocument)&&f.defaultView||window;var g=f.getSelection&&f.getSelection();if(g&&g.rangeCount!==0){f=g.anchorNode;var y=g.anchorOffset,w=g.focusNode;g=g.focusOffset;try{f.nodeType,w.nodeType}catch{f=null;break e}var A=0,I=-1,Z=-1,xe=0,je=0,Te=o,be=null;t:for(;;){for(var ke;Te!==f||y!==0&&Te.nodeType!==3||(I=A+y),Te!==w||g!==0&&Te.nodeType!==3||(Z=A+g),Te.nodeType===3&&(A+=Te.nodeValue.length),(ke=Te.firstChild)!==null;)be=Te,Te=ke;for(;;){if(Te===o)break t;if(be===f&&++xe===y&&(I=A),be===w&&++je===g&&(Z=A),(ke=Te.nextSibling)!==null)break;Te=be,be=Te.parentNode}Te=ke}f=I===-1||Z===-1?null:{start:I,end:Z}}else f=null}f=f||{start:0,end:0}}else f=null;for(Kv={focusedElem:o,selectionRange:f},Im=!1,_r=u;_r!==null;)if(u=_r,o=u.child,(u.subtreeFlags&1028)!==0&&o!==null)o.return=u,_r=o;else for(;_r!==null;){switch(u=_r,w=u.alternate,o=u.flags,u.tag){case 0:if((o&4)!==0&&(o=u.updateQueue,o=o!==null?o.events:null,o!==null))for(f=0;f title"))),Qr(w,g,f),w[Lr]=o,Er(w),g=w;break e;case"link":var A=Uk("link","href",y).get(g+(f.href||""));if(A){for(var I=0;ISn&&(A=Sn,Sn=lt,lt=A);var oe=X3(I,lt),se=X3(I,Sn);if(oe&&se&&(ke.rangeCount!==1||ke.anchorNode!==oe.node||ke.anchorOffset!==oe.offset||ke.focusNode!==se.node||ke.focusOffset!==se.offset)){var pe=Te.createRange();pe.setStart(oe.node,oe.offset),ke.removeAllRanges(),lt>Sn?(ke.addRange(pe),ke.extend(se.node,se.offset)):(pe.setEnd(se.node,se.offset),ke.addRange(pe))}}}}for(Te=[],ke=I;ke=ke.parentNode;)ke.nodeType===1&&Te.push({element:ke,left:ke.scrollLeft,top:ke.scrollTop});for(typeof I.focus=="function"&&I.focus(),I=0;If?32:f,H.T=null,f=Pv,Pv=null;var w=Ll,A=Va;if(br=0,xu=Ll=null,Va=0,(sn&6)!==0)throw Error(r(331));var I=sn;if(sn|=4,YS(w.current),WS(w,w.current,A,f),sn=I,xh(0,!1),Me&&typeof Me.onPostCommitFiberRoot=="function")try{Me.onPostCommitFiberRoot(re,w)}catch{}return!0}finally{ae.p=y,H.T=g,mk(o,u)}}function gk(o,u,f){u=ui(f,u),u=pv(o.stateNode,u,2),o=El(o,u,2),o!==null&&(Bd(o,2),Ki(o))}function gn(o,u,f){if(o.tag===3)gk(o,o,f);else for(;u!==null;){if(u.tag===3){gk(u,o,f);break}else if(u.tag===1){var g=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Bl===null||!Bl.has(g))){o=ui(f,o),f=xS(2),g=El(u,f,2),g!==null&&(vS(f,g,u,o),Bd(g,2),Ki(g));break}}u=u.return}}function qv(o,u,f){var g=o.pingCache;if(g===null){g=o.pingCache=new RL;var y=new Set;g.set(u,y)}else y=g.get(u),y===void 0&&(y=new Set,g.set(u,y));y.has(f)||(_v=!0,y.add(f),o=IL.bind(null,o,u,f),u.then(o,o))}function IL(o,u,f){var g=o.pingCache;g!==null&&g.delete(u),o.pingedLanes|=o.suspendedLanes&f,o.warmLanes&=~f,Mn===o&&(Ft&f)===f&&(tr===4||tr===3&&(Ft&62914560)===Ft&&300>yn()-wm?(sn&2)===0&&vu(o,0):Dv|=f,gu===Ft&&(gu=0)),Ki(o)}function xk(o,u){u===0&&(u=qc()),o=Bo(o,u),o!==null&&(Bd(o,u),Ki(o))}function qL(o){var u=o.memoizedState,f=0;u!==null&&(f=u.retryLane),xk(o,f)}function FL(o,u){var f=0;switch(o.tag){case 31:case 13:var g=o.stateNode,y=o.memoizedState;y!==null&&(f=y.retryLane);break;case 19:g=o.stateNode;break;case 22:g=o.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(u),xk(o,f)}function QL(o,u){return _t(o,u)}var Tm=null,bu=null,Fv=!1,Mm=!1,Qv=!1,ql=0;function Ki(o){o!==bu&&o.next===null&&(bu===null?Tm=bu=o:bu=bu.next=o),Mm=!0,Fv||(Fv=!0,HL())}function xh(o,u){if(!Qv&&Mm){Qv=!0;do for(var f=!1,g=Tm;g!==null;){if(o!==0){var y=g.pendingLanes;if(y===0)var w=0;else{var A=g.suspendedLanes,I=g.pingedLanes;w=(1<<31-vt(42|o)+1)-1,w&=y&~(A&~I),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(f=!0,wk(g,w))}else w=Ft,w=Ic(g,g===Mn?w:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(w&3)===0||Eo(g,w)||(f=!0,wk(g,w));g=g.next}while(f);Qv=!1}}function $L(){vk()}function vk(){Mm=Fv=!1;var o=0;ql!==0&&eI()&&(o=ql);for(var u=yn(),f=null,g=Tm;g!==null;){var y=g.next,w=yk(g,u);w===0?(g.next=null,f===null?Tm=y:f.next=y,y===null&&(bu=f)):(f=g,(o!==0||(w&3)!==0)&&(Mm=!0)),g=y}br!==0&&br!==5||xh(o),ql!==0&&(ql=0)}function yk(o,u){for(var f=o.suspendedLanes,g=o.pingedLanes,y=o.expirationTimes,w=o.pendingLanes&-62914561;0I)break;var je=Z.transferSize,Te=Z.initiatorType;je&&Mk(Te)&&(Z=Z.responseEnd,A+=je*(Z"u"?null:document;function Fk(o,u,f){var g=wu;if(g&&typeof u=="string"&&u){var y=oi(u);y='link[rel="'+o+'"][href="'+y+'"]',typeof f=="string"&&(y+='[crossorigin="'+f+'"]'),qk.has(y)||(qk.add(y),o={rel:o,crossOrigin:f,href:u},g.querySelector(y)===null&&(u=g.createElement("link"),Qr(u,"link",o),Er(u),g.head.appendChild(u)))}}function cI(o){Wa.D(o),Fk("dns-prefetch",o,null)}function uI(o,u){Wa.C(o,u),Fk("preconnect",o,u)}function dI(o,u,f){Wa.L(o,u,f);var g=wu;if(g&&o&&u){var y='link[rel="preload"][as="'+oi(u)+'"]';u==="image"&&f&&f.imageSrcSet?(y+='[imagesrcset="'+oi(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(y+='[imagesizes="'+oi(f.imageSizes)+'"]')):y+='[href="'+oi(o)+'"]';var w=y;switch(u){case"style":w=Su(o);break;case"script":w=ku(o)}gi.has(w)||(o=p({rel:"preload",href:u==="image"&&f&&f.imageSrcSet?void 0:o,as:u},f),gi.set(w,o),g.querySelector(y)!==null||u==="style"&&g.querySelector(wh(w))||u==="script"&&g.querySelector(Sh(w))||(u=g.createElement("link"),Qr(u,"link",o),Er(u),g.head.appendChild(u)))}}function hI(o,u){Wa.m(o,u);var f=wu;if(f&&o){var g=u&&typeof u.as=="string"?u.as:"script",y='link[rel="modulepreload"][as="'+oi(g)+'"][href="'+oi(o)+'"]',w=y;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=ku(o)}if(!gi.has(w)&&(o=p({rel:"modulepreload",href:o},u),gi.set(w,o),f.querySelector(y)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(Sh(w)))return}g=f.createElement("link"),Qr(g,"link",o),Er(g),f.head.appendChild(g)}}}function fI(o,u,f){Wa.S(o,u,f);var g=wu;if(g&&o){var y=Hc(g).hoistableStyles,w=Su(o);u=u||"default";var A=y.get(w);if(!A){var I={loading:0,preload:null};if(A=g.querySelector(wh(w)))I.loading=5;else{o=p({rel:"stylesheet",href:o,"data-precedence":u},f),(f=gi.get(w))&&sy(o,f);var Z=A=g.createElement("link");Er(Z),Qr(Z,"link",o),Z._p=new Promise(function(xe,je){Z.onload=xe,Z.onerror=je}),Z.addEventListener("load",function(){I.loading|=1}),Z.addEventListener("error",function(){I.loading|=2}),I.loading|=4,Rm(A,u,g)}A={type:"stylesheet",instance:A,count:1,state:I},y.set(w,A)}}}function mI(o,u){Wa.X(o,u);var f=wu;if(f&&o){var g=Hc(f).hoistableScripts,y=ku(o),w=g.get(y);w||(w=f.querySelector(Sh(y)),w||(o=p({src:o,async:!0},u),(u=gi.get(y))&&iy(o,u),w=f.createElement("script"),Er(w),Qr(w,"link",o),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(y,w))}}function pI(o,u){Wa.M(o,u);var f=wu;if(f&&o){var g=Hc(f).hoistableScripts,y=ku(o),w=g.get(y);w||(w=f.querySelector(Sh(y)),w||(o=p({src:o,async:!0,type:"module"},u),(u=gi.get(y))&&iy(o,u),w=f.createElement("script"),Er(w),Qr(w,"link",o),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(y,w))}}function Qk(o,u,f,g){var y=(y=fe.current)?Dm(y):null;if(!y)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(u=Su(f.href),f=Hc(y).hoistableStyles,g=f.get(u),g||(g={type:"style",instance:null,count:0,state:null},f.set(u,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){o=Su(f.href);var w=Hc(y).hoistableStyles,A=w.get(o);if(A||(y=y.ownerDocument||y,A={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(o,A),(w=y.querySelector(wh(o)))&&!w._p&&(A.instance=w,A.state.loading=5),gi.has(o)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},gi.set(o,f),w||gI(y,o,f,A.state))),u&&g===null)throw Error(r(528,""));return A}if(u&&g!==null)throw Error(r(529,""));return null;case"script":return u=f.async,f=f.src,typeof f=="string"&&u&&typeof u!="function"&&typeof u!="symbol"?(u=ku(f),f=Hc(y).hoistableScripts,g=f.get(u),g||(g={type:"script",instance:null,count:0,state:null},f.set(u,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function Su(o){return'href="'+oi(o)+'"'}function wh(o){return'link[rel="stylesheet"]['+o+"]"}function $k(o){return p({},o,{"data-precedence":o.precedence,precedence:null})}function gI(o,u,f,g){o.querySelector('link[rel="preload"][as="style"]['+u+"]")?g.loading=1:(u=o.createElement("link"),g.preload=u,u.addEventListener("load",function(){return g.loading|=1}),u.addEventListener("error",function(){return g.loading|=2}),Qr(u,"link",f),Er(u),o.head.appendChild(u))}function ku(o){return'[src="'+oi(o)+'"]'}function Sh(o){return"script[async]"+o}function Hk(o,u,f){if(u.count++,u.instance===null)switch(u.type){case"style":var g=o.querySelector('style[data-href~="'+oi(f.href)+'"]');if(g)return u.instance=g,Er(g),g;var y=p({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return g=(o.ownerDocument||o).createElement("style"),Er(g),Qr(g,"style",y),Rm(g,f.precedence,o),u.instance=g;case"stylesheet":y=Su(f.href);var w=o.querySelector(wh(y));if(w)return u.state.loading|=4,u.instance=w,Er(w),w;g=$k(f),(y=gi.get(y))&&sy(g,y),w=(o.ownerDocument||o).createElement("link"),Er(w);var A=w;return A._p=new Promise(function(I,Z){A.onload=I,A.onerror=Z}),Qr(w,"link",g),u.state.loading|=4,Rm(w,f.precedence,o),u.instance=w;case"script":return w=ku(f.src),(y=o.querySelector(Sh(w)))?(u.instance=y,Er(y),y):(g=f,(y=gi.get(w))&&(g=p({},f),iy(g,y)),o=o.ownerDocument||o,y=o.createElement("script"),Er(y),Qr(y,"link",g),o.head.appendChild(y),u.instance=y);case"void":return null;default:throw Error(r(443,u.type))}else u.type==="stylesheet"&&(u.state.loading&4)===0&&(g=u.instance,u.state.loading|=4,Rm(g,f.precedence,o));return u.instance}function Rm(o,u,f){for(var g=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=g.length?g[g.length-1]:null,w=y,A=0;A title"):null)}function xI(o,u,f){if(f===1||u.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof u.precedence!="string"||typeof u.href!="string"||u.href==="")break;return!0;case"link":if(typeof u.rel!="string"||typeof u.href!="string"||u.href===""||u.onLoad||u.onError)break;switch(u.rel){case"stylesheet":return o=u.disabled,typeof u.precedence=="string"&&o==null;default:return!0}case"script":if(u.async&&typeof u.async!="function"&&typeof u.async!="symbol"&&!u.onLoad&&!u.onError&&u.src&&typeof u.src=="string")return!0}return!1}function Wk(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function vI(o,u,f,g){if(f.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var y=Su(g.href),w=u.querySelector(wh(y));if(w){u=w._p,u!==null&&typeof u=="object"&&typeof u.then=="function"&&(o.count++,o=Pm.bind(o),u.then(o,o)),f.state.loading|=4,f.instance=w,Er(w);return}w=u.ownerDocument||u,g=$k(g),(y=gi.get(y))&&sy(g,y),w=w.createElement("link"),Er(w);var A=w;A._p=new Promise(function(I,Z){A.onload=I,A.onerror=Z}),Qr(w,"link",g),f.instance=w}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(f,u),(u=f.state.preload)&&(f.state.loading&3)===0&&(o.count++,f=Pm.bind(o),u.addEventListener("load",f),u.addEventListener("error",f))}}var ay=0;function yI(o,u){return o.stylesheets&&o.count===0&&Lm(o,o.stylesheets),0ay?50:800)+u);return o.unsuspend=f,function(){o.unsuspend=null,clearTimeout(g),clearTimeout(y)}}:null}function Pm(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Lm(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Bm=null;function Lm(o,u){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Bm=new Map,u.forEach(bI,o),Bm=null,Pm.call(o))}function bI(o,u){if(!(u.state.loading&4)){var f=Bm.get(o);if(f)var g=f.get(null);else{f=new Map,Bm.set(o,f);for(var y=o.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),py.exports=zq(),py.exports}var Bq=Pq();function L9(t,e){return function(){return t.apply(e,arguments)}}const{toString:Lq}=Object.prototype,{getPrototypeOf:J4}=Object,{iterator:ox,toStringTag:I9}=Symbol,cx=(t=>e=>{const n=Lq.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ui=t=>(t=t.toLowerCase(),e=>cx(e)===t),ux=t=>e=>typeof e===t,{isArray:Sd}=Array,sd=ux("undefined");function Kf(t){return t!==null&&!sd(t)&&t.constructor!==null&&!sd(t.constructor)&&Ds(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const q9=Ui("ArrayBuffer");function Iq(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&q9(t.buffer),e}const qq=ux("string"),Ds=ux("function"),F9=ux("number"),Zf=t=>t!==null&&typeof t=="object",Fq=t=>t===!0||t===!1,$p=t=>{if(cx(t)!=="object")return!1;const e=J4(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(I9 in t)&&!(ox in t)},Qq=t=>{if(!Zf(t)||Kf(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},$q=Ui("Date"),Hq=Ui("File"),Uq=Ui("Blob"),Vq=Ui("FileList"),Wq=t=>Zf(t)&&Ds(t.pipe),Gq=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Ds(t.append)&&((e=cx(t))==="formdata"||e==="object"&&Ds(t.toString)&&t.toString()==="[object FormData]"))},Xq=Ui("URLSearchParams"),[Yq,Kq,Zq,Jq]=["ReadableStream","Request","Response","Headers"].map(Ui),eF=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Jf(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),Sd(t))for(r=0,s=t.length;r0;)if(s=n[r],e===s.toLowerCase())return s;return null}const ic=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,$9=t=>!sd(t)&&t!==ic;function n2(){const{caseless:t,skipUndefined:e}=$9(this)&&this||{},n={},r=(s,i)=>{const l=t&&Q9(n,i)||i;$p(n[l])&&$p(s)?n[l]=n2(n[l],s):$p(s)?n[l]=n2({},s):Sd(s)?n[l]=s.slice():(!e||!sd(s))&&(n[l]=s)};for(let s=0,i=arguments.length;s(Jf(e,(s,i)=>{n&&Ds(s)?t[i]=L9(s,n):t[i]=s},{allOwnKeys:r}),t),nF=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),rF=(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)},sF=(t,e,n,r)=>{let s,i,l;const c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)l=s[i],(!r||r(l,t,e))&&!c[l]&&(e[l]=t[l],c[l]=!0);t=n!==!1&&J4(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},iF=(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},aF=t=>{if(!t)return null;if(Sd(t))return t;let e=t.length;if(!F9(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},lF=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&J4(Uint8Array)),oF=(t,e)=>{const r=(t&&t[ox]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},cF=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},uF=Ui("HTMLFormElement"),dF=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),vO=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),hF=Ui("RegExp"),H9=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Jf(n,(s,i)=>{let l;(l=e(s,i,t))!==!1&&(r[i]=l||s)}),Object.defineProperties(t,r)},fF=t=>{H9(t,(e,n)=>{if(Ds(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Ds(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+"'")})}})},mF=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Sd(t)?r(t):r(String(t).split(e)),n},pF=()=>{},gF=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function xF(t){return!!(t&&Ds(t.append)&&t[I9]==="FormData"&&t[ox])}const vF=t=>{const e=new Array(10),n=(r,s)=>{if(Zf(r)){if(e.indexOf(r)>=0)return;if(Kf(r))return r;if(!("toJSON"in r)){e[s]=r;const i=Sd(r)?[]:{};return Jf(r,(l,c)=>{const d=n(l,s+1);!sd(d)&&(i[c]=d)}),e[s]=void 0,i}}return r};return n(t,0)},yF=Ui("AsyncFunction"),bF=t=>t&&(Zf(t)||Ds(t))&&Ds(t.then)&&Ds(t.catch),U9=((t,e)=>t?setImmediate:e?((n,r)=>(ic.addEventListener("message",({source:s,data:i})=>{s===ic&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),ic.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Ds(ic.postMessage)),wF=typeof queueMicrotask<"u"?queueMicrotask.bind(ic):typeof process<"u"&&process.nextTick||U9,SF=t=>t!=null&&Ds(t[ox]),we={isArray:Sd,isArrayBuffer:q9,isBuffer:Kf,isFormData:Gq,isArrayBufferView:Iq,isString:qq,isNumber:F9,isBoolean:Fq,isObject:Zf,isPlainObject:$p,isEmptyObject:Qq,isReadableStream:Yq,isRequest:Kq,isResponse:Zq,isHeaders:Jq,isUndefined:sd,isDate:$q,isFile:Hq,isBlob:Uq,isRegExp:hF,isFunction:Ds,isStream:Wq,isURLSearchParams:Xq,isTypedArray:lF,isFileList:Vq,forEach:Jf,merge:n2,extend:tF,trim:eF,stripBOM:nF,inherits:rF,toFlatObject:sF,kindOf:cx,kindOfTest:Ui,endsWith:iF,toArray:aF,forEachEntry:oF,matchAll:cF,isHTMLForm:uF,hasOwnProperty:vO,hasOwnProp:vO,reduceDescriptors:H9,freezeMethods:fF,toObjectSet:mF,toCamelCase:dF,noop:pF,toFiniteNumber:gF,findKey:Q9,global:ic,isContextDefined:$9,isSpecCompliantForm:xF,toJSONObject:vF,isAsyncFn:yF,isThenable:bF,setImmediate:U9,asap:wF,isIterable:SF};function St(t,e,n,r,s){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),s&&(this.response=s,this.status=s.status?s.status:null)}we.inherits(St,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:we.toJSONObject(this.config),code:this.code,status:this.status}}});const V9=St.prototype,W9={};["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=>{W9[t]={value:t}});Object.defineProperties(St,W9);Object.defineProperty(V9,"isAxiosError",{value:!0});St.from=(t,e,n,r,s,i)=>{const l=Object.create(V9);we.toFlatObject(t,l,function(m){return m!==Error.prototype},h=>h!=="isAxiosError");const c=t&&t.message?t.message:"Error",d=e==null&&t?t.code:e;return St.call(l,c,d,n,r,s),t&&l.cause==null&&Object.defineProperty(l,"cause",{value:t,configurable:!0}),l.name=t&&t.name||"Error",i&&Object.assign(l,i),l};const kF=null;function r2(t){return we.isPlainObject(t)||we.isArray(t)}function G9(t){return we.endsWith(t,"[]")?t.slice(0,-2):t}function yO(t,e,n){return t?t.concat(e).map(function(s,i){return s=G9(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function OF(t){return we.isArray(t)&&!t.some(r2)}const jF=we.toFlatObject(we,{},null,function(e){return/^is[A-Z]/.test(e)});function dx(t,e,n){if(!we.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=we.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(k,O){return!we.isUndefined(O[k])});const r=n.metaTokens,s=n.visitor||m,i=n.dots,l=n.indexes,d=(n.Blob||typeof Blob<"u"&&Blob)&&we.isSpecCompliantForm(e);if(!we.isFunction(s))throw new TypeError("visitor must be a function");function h(b){if(b===null)return"";if(we.isDate(b))return b.toISOString();if(we.isBoolean(b))return b.toString();if(!d&&we.isBlob(b))throw new St("Blob is not supported. Use a Buffer instead.");return we.isArrayBuffer(b)||we.isTypedArray(b)?d&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function m(b,k,O){let j=b;if(b&&!O&&typeof b=="object"){if(we.endsWith(k,"{}"))k=r?k:k.slice(0,-2),b=JSON.stringify(b);else if(we.isArray(b)&&OF(b)||(we.isFileList(b)||we.endsWith(k,"[]"))&&(j=we.toArray(b)))return k=G9(k),j.forEach(function(M,_){!(we.isUndefined(M)||M===null)&&e.append(l===!0?yO([k],_,i):l===null?k:k+"[]",h(M))}),!1}return r2(b)?!0:(e.append(yO(O,k,i),h(b)),!1)}const p=[],x=Object.assign(jF,{defaultVisitor:m,convertValue:h,isVisitable:r2});function v(b,k){if(!we.isUndefined(b)){if(p.indexOf(b)!==-1)throw Error("Circular reference detected in "+k.join("."));p.push(b),we.forEach(b,function(j,T){(!(we.isUndefined(j)||j===null)&&s.call(e,j,we.isString(T)?T.trim():T,k,x))===!0&&v(j,k?k.concat(T):[T])}),p.pop()}}if(!we.isObject(t))throw new TypeError("data must be an object");return v(t),e}function bO(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function ew(t,e){this._pairs=[],t&&dx(t,this,e)}const X9=ew.prototype;X9.append=function(e,n){this._pairs.push([e,n])};X9.toString=function(e){const n=e?function(r){return e.call(this,r,bO)}:bO;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function NF(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Y9(t,e,n){if(!e)return t;const r=n&&n.encode||NF;we.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=we.isURLSearchParams(e)?e.toString():new ew(e,n).toString(r),i){const l=t.indexOf("#");l!==-1&&(t=t.slice(0,l)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class wO{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){we.forEach(this.handlers,function(r){r!==null&&e(r)})}}const K9={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},CF=typeof URLSearchParams<"u"?URLSearchParams:ew,TF=typeof FormData<"u"?FormData:null,MF=typeof Blob<"u"?Blob:null,AF={isBrowser:!0,classes:{URLSearchParams:CF,FormData:TF,Blob:MF},protocols:["http","https","file","blob","url","data"]},tw=typeof window<"u"&&typeof document<"u",s2=typeof navigator=="object"&&navigator||void 0,EF=tw&&(!s2||["ReactNative","NativeScript","NS"].indexOf(s2.product)<0),_F=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",DF=tw&&window.location.href||"http://localhost",RF=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:tw,hasStandardBrowserEnv:EF,hasStandardBrowserWebWorkerEnv:_F,navigator:s2,origin:DF},Symbol.toStringTag,{value:"Module"})),ts={...RF,...AF};function zF(t,e){return dx(t,new ts.classes.URLSearchParams,{visitor:function(n,r,s,i){return ts.isNode&&we.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function PF(t){return we.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function BF(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r=n.length;return l=!l&&we.isArray(s)?s.length:l,d?(we.hasOwnProp(s,l)?s[l]=[s[l],r]:s[l]=r,!c):((!s[l]||!we.isObject(s[l]))&&(s[l]=[]),e(n,r,s[l],i)&&we.isArray(s[l])&&(s[l]=BF(s[l])),!c)}if(we.isFormData(t)&&we.isFunction(t.entries)){const n={};return we.forEachEntry(t,(r,s)=>{e(PF(r),s,n,0)}),n}return null}function LF(t,e,n){if(we.isString(t))try{return(e||JSON.parse)(t),we.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const e0={transitional:K9,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=we.isObject(e);if(i&&we.isHTMLForm(e)&&(e=new FormData(e)),we.isFormData(e))return s?JSON.stringify(Z9(e)):e;if(we.isArrayBuffer(e)||we.isBuffer(e)||we.isStream(e)||we.isFile(e)||we.isBlob(e)||we.isReadableStream(e))return e;if(we.isArrayBufferView(e))return e.buffer;if(we.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return zF(e,this.formSerializer).toString();if((c=we.isFileList(e))||r.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return dx(c?{"files[]":e}:e,d&&new d,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),LF(e)):e}],transformResponse:[function(e){const n=this.transitional||e0.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(we.isResponse(e)||we.isReadableStream(e))return e;if(e&&we.isString(e)&&(r&&!this.responseType||s)){const l=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(l)throw c.name==="SyntaxError"?St.from(c,St.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:ts.classes.FormData,Blob:ts.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};we.forEach(["delete","get","head","post","put","patch"],t=>{e0.headers[t]={}});const IF=we.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"]),qF=t=>{const e={};let n,r,s;return t&&t.split(` +`).forEach(function(l){s=l.indexOf(":"),n=l.substring(0,s).trim().toLowerCase(),r=l.substring(s+1).trim(),!(!n||e[n]&&IF[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},SO=Symbol("internals");function Mh(t){return t&&String(t).trim().toLowerCase()}function Hp(t){return t===!1||t==null?t:we.isArray(t)?t.map(Hp):String(t)}function FF(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 QF=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function vy(t,e,n,r,s){if(we.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!we.isString(e)){if(we.isString(r))return e.indexOf(r)!==-1;if(we.isRegExp(r))return r.test(e)}}function $F(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function HF(t,e){const n=we.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,l){return this[r].call(this,e,s,i,l)},configurable:!0})})}let Rs=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(c,d,h){const m=Mh(d);if(!m)throw new Error("header name must be a non-empty string");const p=we.findKey(s,m);(!p||s[p]===void 0||h===!0||h===void 0&&s[p]!==!1)&&(s[p||d]=Hp(c))}const l=(c,d)=>we.forEach(c,(h,m)=>i(h,m,d));if(we.isPlainObject(e)||e instanceof this.constructor)l(e,n);else if(we.isString(e)&&(e=e.trim())&&!QF(e))l(qF(e),n);else if(we.isObject(e)&&we.isIterable(e)){let c={},d,h;for(const m of e){if(!we.isArray(m))throw TypeError("Object iterator must return a key-value pair");c[h=m[0]]=(d=c[h])?we.isArray(d)?[...d,m[1]]:[d,m[1]]:m[1]}l(c,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=Mh(e),e){const r=we.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return FF(s);if(we.isFunction(n))return n.call(this,s,r);if(we.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Mh(e),e){const r=we.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||vy(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(l){if(l=Mh(l),l){const c=we.findKey(r,l);c&&(!n||vy(r,r[c],c,n))&&(delete r[c],s=!0)}}return we.isArray(e)?e.forEach(i):i(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!e||vy(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const n=this,r={};return we.forEach(this,(s,i)=>{const l=we.findKey(r,i);if(l){n[l]=Hp(s),delete n[i];return}const c=e?$F(i):String(i).trim();c!==i&&delete n[i],n[c]=Hp(s),r[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return we.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&we.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(s=>r.set(s)),r}static accessor(e){const r=(this[SO]=this[SO]={accessors:{}}).accessors,s=this.prototype;function i(l){const c=Mh(l);r[c]||(HF(s,l),r[c]=!0)}return we.isArray(e)?e.forEach(i):i(e),this}};Rs.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);we.reduceDescriptors(Rs.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});we.freezeMethods(Rs);function yy(t,e){const n=this||e0,r=e||n,s=Rs.from(r.headers);let i=r.data;return we.forEach(t,function(c){i=c.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function J9(t){return!!(t&&t.__CANCEL__)}function kd(t,e,n){St.call(this,t??"canceled",St.ERR_CANCELED,e,n),this.name="CanceledError"}we.inherits(kd,St,{__CANCEL__:!0});function eC(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new St("Request failed with status code "+n.status,[St.ERR_BAD_REQUEST,St.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function UF(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function VF(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,l;return e=e!==void 0?e:1e3,function(d){const h=Date.now(),m=r[i];l||(l=h),n[s]=d,r[s]=h;let p=i,x=0;for(;p!==s;)x+=n[p++],p=p%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),h-l{n=m,s=null,i&&(clearTimeout(i),i=null),t(...h)};return[(...h)=>{const m=Date.now(),p=m-n;p>=r?l(h,m):(s=h,i||(i=setTimeout(()=>{i=null,l(s)},r-p)))},()=>s&&l(s)]}const gg=(t,e,n=3)=>{let r=0;const s=VF(50,250);return WF(i=>{const l=i.loaded,c=i.lengthComputable?i.total:void 0,d=l-r,h=s(d),m=l<=c;r=l;const p={loaded:l,total:c,progress:c?l/c:void 0,bytes:d,rate:h||void 0,estimated:h&&c&&m?(c-l)/h:void 0,event:i,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(p)},n)},kO=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},OO=t=>(...e)=>we.asap(()=>t(...e)),GF=ts.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,ts.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(ts.origin),ts.navigator&&/(msie|trident)/i.test(ts.navigator.userAgent)):()=>!0,XF=ts.hasStandardBrowserEnv?{write(t,e,n,r,s,i,l){if(typeof document>"u")return;const c=[`${t}=${encodeURIComponent(e)}`];we.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),we.isString(r)&&c.push(`path=${r}`),we.isString(s)&&c.push(`domain=${s}`),i===!0&&c.push("secure"),we.isString(l)&&c.push(`SameSite=${l}`),document.cookie=c.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function YF(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function KF(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function tC(t,e,n){let r=!YF(e);return t&&(r||n==!1)?KF(t,e):e}const jO=t=>t instanceof Rs?{...t}:t;function vc(t,e){e=e||{};const n={};function r(h,m,p,x){return we.isPlainObject(h)&&we.isPlainObject(m)?we.merge.call({caseless:x},h,m):we.isPlainObject(m)?we.merge({},m):we.isArray(m)?m.slice():m}function s(h,m,p,x){if(we.isUndefined(m)){if(!we.isUndefined(h))return r(void 0,h,p,x)}else return r(h,m,p,x)}function i(h,m){if(!we.isUndefined(m))return r(void 0,m)}function l(h,m){if(we.isUndefined(m)){if(!we.isUndefined(h))return r(void 0,h)}else return r(void 0,m)}function c(h,m,p){if(p in e)return r(h,m);if(p in t)return r(void 0,h)}const d={url:i,method:i,data:i,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:c,headers:(h,m,p)=>s(jO(h),jO(m),p,!0)};return we.forEach(Object.keys({...t,...e}),function(m){const p=d[m]||s,x=p(t[m],e[m],m);we.isUndefined(x)&&p!==c||(n[m]=x)}),n}const nC=t=>{const e=vc({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:l,auth:c}=e;if(e.headers=l=Rs.from(l),e.url=Y9(tC(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&l.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),we.isFormData(n)){if(ts.hasStandardBrowserEnv||ts.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if(we.isFunction(n.getHeaders)){const d=n.getHeaders(),h=["content-type","content-length"];Object.entries(d).forEach(([m,p])=>{h.includes(m.toLowerCase())&&l.set(m,p)})}}if(ts.hasStandardBrowserEnv&&(r&&we.isFunction(r)&&(r=r(e)),r||r!==!1&&GF(e.url))){const d=s&&i&&XF.read(i);d&&l.set(s,d)}return e},ZF=typeof XMLHttpRequest<"u",JF=ZF&&function(t){return new Promise(function(n,r){const s=nC(t);let i=s.data;const l=Rs.from(s.headers).normalize();let{responseType:c,onUploadProgress:d,onDownloadProgress:h}=s,m,p,x,v,b;function k(){v&&v(),b&&b(),s.cancelToken&&s.cancelToken.unsubscribe(m),s.signal&&s.signal.removeEventListener("abort",m)}let O=new XMLHttpRequest;O.open(s.method.toUpperCase(),s.url,!0),O.timeout=s.timeout;function j(){if(!O)return;const M=Rs.from("getAllResponseHeaders"in O&&O.getAllResponseHeaders()),D={data:!c||c==="text"||c==="json"?O.responseText:O.response,status:O.status,statusText:O.statusText,headers:M,config:t,request:O};eC(function(z){n(z),k()},function(z){r(z),k()},D),O=null}"onloadend"in O?O.onloadend=j:O.onreadystatechange=function(){!O||O.readyState!==4||O.status===0&&!(O.responseURL&&O.responseURL.indexOf("file:")===0)||setTimeout(j)},O.onabort=function(){O&&(r(new St("Request aborted",St.ECONNABORTED,t,O)),O=null)},O.onerror=function(_){const D=_&&_.message?_.message:"Network Error",E=new St(D,St.ERR_NETWORK,t,O);E.event=_||null,r(E),O=null},O.ontimeout=function(){let _=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const D=s.transitional||K9;s.timeoutErrorMessage&&(_=s.timeoutErrorMessage),r(new St(_,D.clarifyTimeoutError?St.ETIMEDOUT:St.ECONNABORTED,t,O)),O=null},i===void 0&&l.setContentType(null),"setRequestHeader"in O&&we.forEach(l.toJSON(),function(_,D){O.setRequestHeader(D,_)}),we.isUndefined(s.withCredentials)||(O.withCredentials=!!s.withCredentials),c&&c!=="json"&&(O.responseType=s.responseType),h&&([x,b]=gg(h,!0),O.addEventListener("progress",x)),d&&O.upload&&([p,v]=gg(d),O.upload.addEventListener("progress",p),O.upload.addEventListener("loadend",v)),(s.cancelToken||s.signal)&&(m=M=>{O&&(r(!M||M.type?new kd(null,t,O):M),O.abort(),O=null)},s.cancelToken&&s.cancelToken.subscribe(m),s.signal&&(s.signal.aborted?m():s.signal.addEventListener("abort",m)));const T=UF(s.url);if(T&&ts.protocols.indexOf(T)===-1){r(new St("Unsupported protocol "+T+":",St.ERR_BAD_REQUEST,t));return}O.send(i||null)})},eQ=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(h){if(!s){s=!0,c();const m=h instanceof Error?h:this.reason;r.abort(m instanceof St?m:new kd(m instanceof Error?m.message:m))}};let l=e&&setTimeout(()=>{l=null,i(new St(`timeout ${e} of ms exceeded`,St.ETIMEDOUT))},e);const c=()=>{t&&(l&&clearTimeout(l),l=null,t.forEach(h=>{h.unsubscribe?h.unsubscribe(i):h.removeEventListener("abort",i)}),t=null)};t.forEach(h=>h.addEventListener("abort",i));const{signal:d}=r;return d.unsubscribe=()=>we.asap(c),d}},tQ=function*(t,e){let n=t.byteLength;if(n{const s=nQ(t,e);let i=0,l,c=d=>{l||(l=!0,r&&r(d))};return new ReadableStream({async pull(d){try{const{done:h,value:m}=await s.next();if(h){c(),d.close();return}let p=m.byteLength;if(n){let x=i+=p;n(x)}d.enqueue(new Uint8Array(m))}catch(h){throw c(h),h}},cancel(d){return c(d),s.return()}},{highWaterMark:2})},CO=64*1024,{isFunction:Xm}=we,sQ=(({Request:t,Response:e})=>({Request:t,Response:e}))(we.global),{ReadableStream:TO,TextEncoder:MO}=we.global,AO=(t,...e)=>{try{return!!t(...e)}catch{return!1}},iQ=t=>{t=we.merge.call({skipUndefined:!0},sQ,t);const{fetch:e,Request:n,Response:r}=t,s=e?Xm(e):typeof fetch=="function",i=Xm(n),l=Xm(r);if(!s)return!1;const c=s&&Xm(TO),d=s&&(typeof MO=="function"?(b=>k=>b.encode(k))(new MO):async b=>new Uint8Array(await new n(b).arrayBuffer())),h=i&&c&&AO(()=>{let b=!1;const k=new n(ts.origin,{body:new TO,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!k}),m=l&&c&&AO(()=>we.isReadableStream(new r("").body)),p={stream:m&&(b=>b.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!p[b]&&(p[b]=(k,O)=>{let j=k&&k[b];if(j)return j.call(k);throw new St(`Response type '${b}' is not supported`,St.ERR_NOT_SUPPORT,O)})});const x=async b=>{if(b==null)return 0;if(we.isBlob(b))return b.size;if(we.isSpecCompliantForm(b))return(await new n(ts.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(we.isArrayBufferView(b)||we.isArrayBuffer(b))return b.byteLength;if(we.isURLSearchParams(b)&&(b=b+""),we.isString(b))return(await d(b)).byteLength},v=async(b,k)=>{const O=we.toFiniteNumber(b.getContentLength());return O??x(k)};return async b=>{let{url:k,method:O,data:j,signal:T,cancelToken:M,timeout:_,onDownloadProgress:D,onUploadProgress:E,responseType:z,headers:Q,withCredentials:F="same-origin",fetchOptions:L}=nC(b),U=e||fetch;z=z?(z+"").toLowerCase():"text";let V=eQ([T,M&&M.toAbortSignal()],_),ce=null;const W=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let J;try{if(E&&h&&O!=="get"&&O!=="head"&&(J=await v(Q,j))!==0){let me=new n(k,{method:"POST",body:j,duplex:"half"}),Y;if(we.isFormData(j)&&(Y=me.headers.get("content-type"))&&Q.setContentType(Y),me.body){const[P,K]=kO(J,gg(OO(E)));j=NO(me.body,CO,P,K)}}we.isString(F)||(F=F?"include":"omit");const H=i&&"credentials"in n.prototype,ae={...L,signal:V,method:O.toUpperCase(),headers:Q.normalize().toJSON(),body:j,duplex:"half",credentials:H?F:void 0};ce=i&&new n(k,ae);let ne=await(i?U(ce,L):U(k,ae));const ue=m&&(z==="stream"||z==="response");if(m&&(D||ue&&W)){const me={};["status","statusText","headers"].forEach($=>{me[$]=ne[$]});const Y=we.toFiniteNumber(ne.headers.get("content-length")),[P,K]=D&&kO(Y,gg(OO(D),!0))||[];ne=new r(NO(ne.body,CO,P,()=>{K&&K(),W&&W()}),me)}z=z||"text";let R=await p[we.findKey(p,z)||"text"](ne,b);return!ue&&W&&W(),await new Promise((me,Y)=>{eC(me,Y,{data:R,headers:Rs.from(ne.headers),status:ne.status,statusText:ne.statusText,config:b,request:ce})})}catch(H){throw W&&W(),H&&H.name==="TypeError"&&/Load failed|fetch/i.test(H.message)?Object.assign(new St("Network Error",St.ERR_NETWORK,b,ce),{cause:H.cause||H}):St.from(H,H&&H.code,b,ce)}}},aQ=new Map,rC=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,i=[r,s,n];let l=i.length,c=l,d,h,m=aQ;for(;c--;)d=i[c],h=m.get(d),h===void 0&&m.set(d,h=c?new Map:iQ(e)),m=h;return h};rC();const nw={http:kF,xhr:JF,fetch:{get:rC}};we.forEach(nw,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const EO=t=>`- ${t}`,lQ=t=>we.isFunction(t)||t===null||t===!1;function oQ(t,e){t=we.isArray(t)?t:[t];const{length:n}=t;let r,s;const i={};for(let l=0;l`adapter ${d} `+(h===!1?"is not supported by the environment":"is not available in the build"));let c=n?l.length>1?`since : `+l.map(EO).join(` -`):" "+EO(l[0]):"as no adapter specified";throw new St("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const sC={getAdapter:oQ,adapters:nw};function by(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new kd(null,t)}function _O(t){return by(t),t.headers=zs.from(t.headers),t.data=yy.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),sC.getAdapter(t.adapter||e0.adapter,t)(t).then(function(r){return by(t),r.data=yy.call(t,t.transformResponse,r),r.headers=zs.from(r.headers),r},function(r){return J9(r)||(by(t),r&&r.response&&(r.response.data=yy.call(t,t.transformResponse,r.response),r.response.headers=zs.from(r.response.headers))),Promise.reject(r)})}const iC="1.13.2",hx={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{hx[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const DO={};hx.transitional=function(e,n,r){function s(i,l){return"[Axios v"+iC+"] Transitional option '"+i+"'"+l+(r?". "+r:"")}return(i,l,c)=>{if(e===!1)throw new St(s(l," has been removed"+(n?" in "+n:"")),St.ERR_DEPRECATED);return n&&!DO[l]&&(DO[l]=!0,console.warn(s(l," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,l,c):!0}};hx.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function cQ(t,e,n){if(typeof t!="object")throw new St("options must be an object",St.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const i=r[s],l=e[i];if(l){const c=t[i],d=c===void 0||l(c,i,t);if(d!==!0)throw new St("option "+i+" must be "+d,St.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new St("Unknown option "+i,St.ERR_BAD_OPTION)}}const Up={assertOptions:cQ,validators:hx},ea=Up.validators;let mc=class{constructor(e){this.defaults=e||{},this.interceptors={request:new wO,response:new wO}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=vc(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Up.assertOptions(r,{silentJSONParsing:ea.transitional(ea.boolean),forcedJSONParsing:ea.transitional(ea.boolean),clarifyTimeoutError:ea.transitional(ea.boolean)},!1),s!=null&&(we.isFunction(s)?n.paramsSerializer={serialize:s}:Up.assertOptions(s,{encode:ea.function,serialize:ea.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Up.assertOptions(n,{baseUrl:ea.spelling("baseURL"),withXsrfToken:ea.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=i&&we.merge(i.common,i[n.method]);i&&we.forEach(["delete","get","head","post","put","patch","common"],b=>{delete i[b]}),n.headers=zs.concat(l,i);const c=[];let d=!0;this.interceptors.request.forEach(function(k){typeof k.runWhen=="function"&&k.runWhen(n)===!1||(d=d&&k.synchronous,c.unshift(k.fulfilled,k.rejected))});const h=[];this.interceptors.response.forEach(function(k){h.push(k.fulfilled,k.rejected)});let m,p=0,x;if(!d){const b=[_O.bind(this),void 0];for(b.unshift(...c),b.push(...h),x=b.length,m=Promise.resolve(n);p{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const l=new Promise(c=>{r.subscribe(c),i=c}).then(s);return l.cancel=function(){r.unsubscribe(i)},l},e(function(i,l,c){r.reason||(r.reason=new kd(i,l,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 aC(function(s){e=s}),cancel:e}}};function dQ(t){return function(n){return t.apply(null,n)}}function hQ(t){return we.isObject(t)&&t.isAxiosError===!0}const i2={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(i2).forEach(([t,e])=>{i2[e]=t});function lC(t){const e=new mc(t),n=L9(mc.prototype.request,e);return we.extend(n,mc.prototype,e,{allOwnKeys:!0}),we.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return lC(vc(t,s))},n}const Zn=lC(e0);Zn.Axios=mc;Zn.CanceledError=kd;Zn.CancelToken=uQ;Zn.isCancel=J9;Zn.VERSION=iC;Zn.toFormData=dx;Zn.AxiosError=St;Zn.Cancel=Zn.CanceledError;Zn.all=function(e){return Promise.all(e)};Zn.spread=dQ;Zn.isAxiosError=hQ;Zn.mergeConfig=vc;Zn.AxiosHeaders=zs;Zn.formToJSON=t=>Z9(we.isHTMLForm(t)?new FormData(t):t);Zn.getAdapter=sC.getAdapter;Zn.HttpStatusCode=i2;Zn.default=Zn;const{Axios:Nxe,AxiosError:Cxe,CanceledError:Txe,isCancel:Axe,CancelToken:Mxe,VERSION:Exe,all:_xe,Cancel:Dxe,isAxiosError:Rxe,spread:zxe,toFormData:Pxe,AxiosHeaders:Bxe,HttpStatusCode:Lxe,formToJSON:Ixe,getAdapter:qxe,mergeConfig:Fxe}=Zn,fQ=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),oC=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),xg="-",RO=[],pQ="arbitrary..",gQ=t=>{const e=vQ(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return xQ(l);const c=l.split(xg),d=c[0]===""&&c.length>1?1:0;return cC(c,d,e)},getConflictingClassGroupIds:(l,c)=>{if(c){const d=r[l],h=n[l];return d?h?fQ(h,d):d:h||RO}return n[l]||RO}}},cC=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const h=cC(t,e+1,i);if(h)return h}const l=n.validators;if(l===null)return;const c=e===0?t.join(xg):t.slice(e).join(xg),d=l.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?pQ+r:void 0})(),vQ=t=>{const{theme:e,classGroups:n}=t;return yQ(n,e)},yQ=(t,e)=>{const n=oC();for(const r in t){const s=t[r];rw(s,n,r,e)}return n},rw=(t,e,n,r)=>{const s=t.length;for(let i=0;i{if(typeof t=="string"){wQ(t,e,n);return}if(typeof t=="function"){SQ(t,e,n,r);return}kQ(t,e,n,r)},wQ=(t,e,n)=>{const r=t===""?e:uC(e,t);r.classGroupId=n},SQ=(t,e,n,r)=>{if(OQ(t)){rw(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(mQ(n,t))},kQ=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let l=0;l{let n=t;const r=e.split(xg),s=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,jQ=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,l)=>{n[i]=l,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let l=n[i];if(l!==void 0)return l;if((l=r[i])!==void 0)return s(i,l),l},set(i,l){i in n?n[i]=l:s(i,l)}}},a2="!",zO=":",NQ=[],PO=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),CQ=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let l=0,c=0,d=0,h;const m=s.length;for(let k=0;kd?h-d:void 0;return PO(i,v,x,b)};if(e){const s=e+zO,i=r;r=l=>l.startsWith(s)?i(l.slice(s.length)):PO(NQ,!1,l,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},TQ=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i0&&(s.sort(),r.push(...s),s=[]),r.push(l)):s.push(l)}return s.length>0&&(s.sort(),r.push(...s)),r}},AQ=t=>({cache:jQ(t.cacheSize),parseClassName:CQ(t),sortModifiers:TQ(t),...gQ(t)}),MQ=/\s+/,EQ=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,l=[],c=t.trim().split(MQ);let d="";for(let h=c.length-1;h>=0;h-=1){const m=c[h],{isExternal:p,modifiers:x,hasImportantModifier:v,baseClassName:b,maybePostfixModifierPosition:k}=n(m);if(p){d=m+(d.length>0?" "+d:d);continue}let O=!!k,j=r(O?b.substring(0,k):b);if(!j){if(!O){d=m+(d.length>0?" "+d:d);continue}if(j=r(b),!j){d=m+(d.length>0?" "+d:d);continue}O=!1}const T=x.length===0?"":x.length===1?x[0]:i(x).join(":"),A=v?T+a2:T,_=A+j;if(l.indexOf(_)>-1)continue;l.push(_);const D=s(j,O);for(let E=0;E0?" "+d:d)}return d},_Q=(...t)=>{let e=0,n,r,s="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,s,i;const l=d=>{const h=e.reduce((m,p)=>p(m),t());return n=AQ(h),r=n.cache.get,s=n.cache.set,i=c,c(d)},c=d=>{const h=r(d);if(h)return h;const m=EQ(d,n);return s(d,m),m};return i=l,(...d)=>i(_Q(...d))},RQ=[],wr=t=>{const e=n=>n[t]||RQ;return e.isThemeGetter=!0,e},hC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zQ=/^\d+\/\d+$/,PQ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,BQ=/\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$/,LQ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,IQ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qQ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ju=t=>zQ.test(t),Mt=t=>!!t&&!Number.isNaN(Number(t)),Gl=t=>!!t&&Number.isInteger(Number(t)),wy=t=>t.endsWith("%")&&Mt(t.slice(0,-1)),Xa=t=>PQ.test(t),FQ=()=>!0,QQ=t=>BQ.test(t)&&!LQ.test(t),mC=()=>!1,$Q=t=>IQ.test(t),HQ=t=>qQ.test(t),UQ=t=>!Xe(t)&&!Ye(t),VQ=t=>Od(t,xC,mC),Xe=t=>hC.test(t),Ko=t=>Od(t,vC,QQ),Sy=t=>Od(t,KQ,Mt),BO=t=>Od(t,pC,mC),WQ=t=>Od(t,gC,HQ),Ym=t=>Od(t,yC,$Q),Ye=t=>fC.test(t),Mh=t=>jd(t,vC),GQ=t=>jd(t,ZQ),LO=t=>jd(t,pC),XQ=t=>jd(t,xC),YQ=t=>jd(t,gC),Km=t=>jd(t,yC,!0),Od=(t,e,n)=>{const r=hC.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},jd=(t,e,n=!1)=>{const r=fC.exec(t);return r?r[1]?e(r[1]):n:!1},pC=t=>t==="position"||t==="percentage",gC=t=>t==="image"||t==="url",xC=t=>t==="length"||t==="size"||t==="bg-size",vC=t=>t==="length",KQ=t=>t==="number",ZQ=t=>t==="family-name",yC=t=>t==="shadow",JQ=()=>{const t=wr("color"),e=wr("font"),n=wr("text"),r=wr("font-weight"),s=wr("tracking"),i=wr("leading"),l=wr("breakpoint"),c=wr("container"),d=wr("spacing"),h=wr("radius"),m=wr("shadow"),p=wr("inset-shadow"),x=wr("text-shadow"),v=wr("drop-shadow"),b=wr("blur"),k=wr("perspective"),O=wr("aspect"),j=wr("ease"),T=wr("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[..._(),Ye,Xe],E=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],Q=()=>[Ye,Xe,d],F=()=>[ju,"full","auto",...Q()],L=()=>[Gl,"none","subgrid",Ye,Xe],U=()=>["auto",{span:["full",Gl,Ye,Xe]},Gl,Ye,Xe],V=()=>[Gl,"auto",Ye,Xe],ce=()=>["auto","min","max","fr",Ye,Xe],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...Q()],ae=()=>[ju,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...Q()],ne=()=>[t,Ye,Xe],ue=()=>[..._(),LO,BO,{position:[Ye,Xe]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],me=()=>["auto","cover","contain",XQ,VQ,{size:[Ye,Xe]}],Y=()=>[wy,Mh,Ko],P=()=>["","none","full",h,Ye,Xe],K=()=>["",Mt,Mh,Ko],H=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ve=()=>[Mt,wy,LO,BO],Re=()=>["","none",b,Ye,Xe],de=()=>["none",Mt,Ye,Xe],We=()=>["none",Mt,Ye,Xe],ct=()=>[Mt,Ye,Xe],Oe=()=>[ju,"full",...Q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xa],breakpoint:[Xa],color:[FQ],container:[Xa],"drop-shadow":[Xa],ease:["in","out","in-out"],font:[UQ],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xa],shadow:[Xa],spacing:["px",Mt],text:[Xa],"text-shadow":[Xa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ju,Xe,Ye,O]}],container:["container"],columns:[{columns:[Mt,Xe,Ye,c]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"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"],sr:["sr-only","not-sr-only"],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:D()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:F()}],"inset-x":[{"inset-x":F()}],"inset-y":[{"inset-y":F()}],start:[{start:F()}],end:[{end:F()}],top:[{top:F()}],right:[{right:F()}],bottom:[{bottom:F()}],left:[{left:F()}],visibility:["visible","invisible","collapse"],z:[{z:[Gl,"auto",Ye,Xe]}],basis:[{basis:[ju,"full","auto",c,...Q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Mt,ju,"auto","initial","none",Xe]}],grow:[{grow:["",Mt,Ye,Xe]}],shrink:[{shrink:["",Mt,Ye,Xe]}],order:[{order:[Gl,"first","last","none",Ye,Xe]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:U()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ce()}],"auto-rows":[{"auto-rows":ce()}],gap:[{gap:Q()}],"gap-x":[{"gap-x":Q()}],"gap-y":[{"gap-y":Q()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...J(),"baseline"]}],"place-self":[{"place-self":["auto",...J()]}],p:[{p:Q()}],px:[{px:Q()}],py:[{py:Q()}],ps:[{ps:Q()}],pe:[{pe:Q()}],pt:[{pt:Q()}],pr:[{pr:Q()}],pb:[{pb:Q()}],pl:[{pl:Q()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":Q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":Q()}],"space-y-reverse":["space-y-reverse"],size:[{size:ae()}],w:[{w:[c,"screen",...ae()]}],"min-w":[{"min-w":[c,"screen","none",...ae()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...ae()]}],h:[{h:["screen","lh",...ae()]}],"min-h":[{"min-h":["screen","lh","none",...ae()]}],"max-h":[{"max-h":["screen","lh",...ae()]}],"font-size":[{text:["base",n,Mh,Ko]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Ye,Sy]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",wy,Xe]}],"font-family":[{font:[GQ,Xe,e]}],"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-fractions"],tracking:[{tracking:[s,Ye,Xe]}],"line-clamp":[{"line-clamp":[Mt,"none",Ye,Sy]}],leading:[{leading:[i,...Q()]}],"list-image":[{"list-image":["none",Ye,Xe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ye,Xe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:ne()}],"text-color":[{text:ne()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:[Mt,"from-font","auto",Ye,Ko]}],"text-decoration-color":[{decoration:ne()}],"underline-offset":[{"underline-offset":[Mt,"auto",Ye,Xe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Q()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ye,Xe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ye,Xe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ue()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:me()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Gl,Ye,Xe],radial:["",Ye,Xe],conic:[Gl,Ye,Xe]},YQ,WQ]}],"bg-color":[{bg:ne()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:ne()}],"gradient-via":[{via:ne()}],"gradient-to":[{to:ne()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...H(),"hidden","none"]}],"divide-style":[{divide:[...H(),"hidden","none"]}],"border-color":[{border:ne()}],"border-color-x":[{"border-x":ne()}],"border-color-y":[{"border-y":ne()}],"border-color-s":[{"border-s":ne()}],"border-color-e":[{"border-e":ne()}],"border-color-t":[{"border-t":ne()}],"border-color-r":[{"border-r":ne()}],"border-color-b":[{"border-b":ne()}],"border-color-l":[{"border-l":ne()}],"divide-color":[{divide:ne()}],"outline-style":[{outline:[...H(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Mt,Ye,Xe]}],"outline-w":[{outline:["",Mt,Mh,Ko]}],"outline-color":[{outline:ne()}],shadow:[{shadow:["","none",m,Km,Ym]}],"shadow-color":[{shadow:ne()}],"inset-shadow":[{"inset-shadow":["none",p,Km,Ym]}],"inset-shadow-color":[{"inset-shadow":ne()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:ne()}],"ring-offset-w":[{"ring-offset":[Mt,Ko]}],"ring-offset-color":[{"ring-offset":ne()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":ne()}],"text-shadow":[{"text-shadow":["none",x,Km,Ym]}],"text-shadow-color":[{"text-shadow":ne()}],opacity:[{opacity:[Mt,Ye,Xe]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Mt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ve()}],"mask-image-linear-to-pos":[{"mask-linear-to":ve()}],"mask-image-linear-from-color":[{"mask-linear-from":ne()}],"mask-image-linear-to-color":[{"mask-linear-to":ne()}],"mask-image-t-from-pos":[{"mask-t-from":ve()}],"mask-image-t-to-pos":[{"mask-t-to":ve()}],"mask-image-t-from-color":[{"mask-t-from":ne()}],"mask-image-t-to-color":[{"mask-t-to":ne()}],"mask-image-r-from-pos":[{"mask-r-from":ve()}],"mask-image-r-to-pos":[{"mask-r-to":ve()}],"mask-image-r-from-color":[{"mask-r-from":ne()}],"mask-image-r-to-color":[{"mask-r-to":ne()}],"mask-image-b-from-pos":[{"mask-b-from":ve()}],"mask-image-b-to-pos":[{"mask-b-to":ve()}],"mask-image-b-from-color":[{"mask-b-from":ne()}],"mask-image-b-to-color":[{"mask-b-to":ne()}],"mask-image-l-from-pos":[{"mask-l-from":ve()}],"mask-image-l-to-pos":[{"mask-l-to":ve()}],"mask-image-l-from-color":[{"mask-l-from":ne()}],"mask-image-l-to-color":[{"mask-l-to":ne()}],"mask-image-x-from-pos":[{"mask-x-from":ve()}],"mask-image-x-to-pos":[{"mask-x-to":ve()}],"mask-image-x-from-color":[{"mask-x-from":ne()}],"mask-image-x-to-color":[{"mask-x-to":ne()}],"mask-image-y-from-pos":[{"mask-y-from":ve()}],"mask-image-y-to-pos":[{"mask-y-to":ve()}],"mask-image-y-from-color":[{"mask-y-from":ne()}],"mask-image-y-to-color":[{"mask-y-to":ne()}],"mask-image-radial":[{"mask-radial":[Ye,Xe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ve()}],"mask-image-radial-to-pos":[{"mask-radial-to":ve()}],"mask-image-radial-from-color":[{"mask-radial-from":ne()}],"mask-image-radial-to-color":[{"mask-radial-to":ne()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[Mt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ve()}],"mask-image-conic-to-pos":[{"mask-conic-to":ve()}],"mask-image-conic-from-color":[{"mask-conic-from":ne()}],"mask-image-conic-to-color":[{"mask-conic-to":ne()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ue()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:me()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ye,Xe]}],filter:[{filter:["","none",Ye,Xe]}],blur:[{blur:Re()}],brightness:[{brightness:[Mt,Ye,Xe]}],contrast:[{contrast:[Mt,Ye,Xe]}],"drop-shadow":[{"drop-shadow":["","none",v,Km,Ym]}],"drop-shadow-color":[{"drop-shadow":ne()}],grayscale:[{grayscale:["",Mt,Ye,Xe]}],"hue-rotate":[{"hue-rotate":[Mt,Ye,Xe]}],invert:[{invert:["",Mt,Ye,Xe]}],saturate:[{saturate:[Mt,Ye,Xe]}],sepia:[{sepia:["",Mt,Ye,Xe]}],"backdrop-filter":[{"backdrop-filter":["","none",Ye,Xe]}],"backdrop-blur":[{"backdrop-blur":Re()}],"backdrop-brightness":[{"backdrop-brightness":[Mt,Ye,Xe]}],"backdrop-contrast":[{"backdrop-contrast":[Mt,Ye,Xe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Mt,Ye,Xe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Mt,Ye,Xe]}],"backdrop-invert":[{"backdrop-invert":["",Mt,Ye,Xe]}],"backdrop-opacity":[{"backdrop-opacity":[Mt,Ye,Xe]}],"backdrop-saturate":[{"backdrop-saturate":[Mt,Ye,Xe]}],"backdrop-sepia":[{"backdrop-sepia":["",Mt,Ye,Xe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":Q()}],"border-spacing-x":[{"border-spacing-x":Q()}],"border-spacing-y":[{"border-spacing-y":Q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ye,Xe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Mt,"initial",Ye,Xe]}],ease:[{ease:["linear","initial",j,Ye,Xe]}],delay:[{delay:[Mt,Ye,Xe]}],animate:[{animate:["none",T,Ye,Xe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,Ye,Xe]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:We()}],"scale-x":[{"scale-x":We()}],"scale-y":[{"scale-y":We()}],"scale-z":[{"scale-z":We()}],"scale-3d":["scale-3d"],skew:[{skew:ct()}],"skew-x":[{"skew-x":ct()}],"skew-y":[{"skew-y":ct()}],transform:[{transform:[Ye,Xe,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Oe()}],"translate-x":[{"translate-x":Oe()}],"translate-y":[{"translate-y":Oe()}],"translate-z":[{"translate-z":Oe()}],"translate-none":["translate-none"],accent:[{accent:ne()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:ne()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",Ye,Xe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":Q()}],"scroll-mx":[{"scroll-mx":Q()}],"scroll-my":[{"scroll-my":Q()}],"scroll-ms":[{"scroll-ms":Q()}],"scroll-me":[{"scroll-me":Q()}],"scroll-mt":[{"scroll-mt":Q()}],"scroll-mr":[{"scroll-mr":Q()}],"scroll-mb":[{"scroll-mb":Q()}],"scroll-ml":[{"scroll-ml":Q()}],"scroll-p":[{"scroll-p":Q()}],"scroll-px":[{"scroll-px":Q()}],"scroll-py":[{"scroll-py":Q()}],"scroll-ps":[{"scroll-ps":Q()}],"scroll-pe":[{"scroll-pe":Q()}],"scroll-pt":[{"scroll-pt":Q()}],"scroll-pr":[{"scroll-pr":Q()}],"scroll-pb":[{"scroll-pb":Q()}],"scroll-pl":[{"scroll-pl":Q()}],"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",Ye,Xe]}],fill:[{fill:["none",...ne()]}],"stroke-w":[{stroke:[Mt,Mh,Ko,Sy]}],stroke:[{stroke:["none",...ne()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},e$=DQ(JQ);function ye(...t){return e$(d9(t))}const gt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("rounded-xl border bg-card text-card-foreground shadow",t),...e}));gt.displayName="Card";const Wt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("flex flex-col space-y-1.5 p-6",t),...e}));Wt.displayName="CardHeader";const Gt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("font-semibold leading-none tracking-tight",t),...e}));Gt.displayName="CardTitle";const Sr=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Sr.displayName="CardDescription";const an=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("p-6 pt-0",t),...e}));an.displayName="CardContent";const bC=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("flex items-center p-6 pt-0",t),...e}));bC.displayName="CardFooter";var ky="rovingFocusGroup.onEntryFocus",t$={bubbles:!1,cancelable:!0},t0="RovingFocusGroup",[l2,wC,n$]=tx(t0),[r$,fx]=Vi(t0,[n$]),[s$,i$]=r$(t0),SC=S.forwardRef((t,e)=>a.jsx(l2.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(l2.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(a$,{...t,ref:e})})}));SC.displayName=t0;var a$=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:h,preventScrollOnEntryFocus:m=!1,...p}=t,x=S.useRef(null),v=Cn(e,x),b=Vf(i),[k,O]=ko({prop:l,defaultProp:c??null,onChange:d,caller:t0}),[j,T]=S.useState(!1),A=es(h),_=wC(n),D=S.useRef(!1),[E,z]=S.useState(0);return S.useEffect(()=>{const Q=x.current;if(Q)return Q.addEventListener(ky,A),()=>Q.removeEventListener(ky,A)},[A]),a.jsx(s$,{scope:n,orientation:r,dir:b,loop:s,currentTabStopId:k,onItemFocus:S.useCallback(Q=>O(Q),[O]),onItemShiftTab:S.useCallback(()=>T(!0),[]),onFocusableItemAdd:S.useCallback(()=>z(Q=>Q+1),[]),onFocusableItemRemove:S.useCallback(()=>z(Q=>Q-1),[]),children:a.jsx(Zt.div,{tabIndex:j||E===0?-1:0,"data-orientation":r,...p,ref:v,style:{outline:"none",...t.style},onMouseDown:$e(t.onMouseDown,()=>{D.current=!0}),onFocus:$e(t.onFocus,Q=>{const F=!D.current;if(Q.target===Q.currentTarget&&F&&!j){const L=new CustomEvent(ky,t$);if(Q.currentTarget.dispatchEvent(L),!L.defaultPrevented){const U=_().filter($=>$.focusable),V=U.find($=>$.active),ce=U.find($=>$.id===k),J=[V,ce,...U].filter(Boolean).map($=>$.ref.current);jC(J,m)}}D.current=!1}),onBlur:$e(t.onBlur,()=>T(!1))})})}),kC="RovingFocusGroupItem",OC=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:l,...c}=t,d=ji(),h=i||d,m=i$(kC,n),p=m.currentTabStopId===h,x=wC(n),{onFocusableItemAdd:v,onFocusableItemRemove:b,currentTabStopId:k}=m;return S.useEffect(()=>{if(r)return v(),()=>b()},[r,v,b]),a.jsx(l2.ItemSlot,{scope:n,id:h,focusable:r,active:s,children:a.jsx(Zt.span,{tabIndex:p?0:-1,"data-orientation":m.orientation,...c,ref:e,onMouseDown:$e(t.onMouseDown,O=>{r?m.onItemFocus(h):O.preventDefault()}),onFocus:$e(t.onFocus,()=>m.onItemFocus(h)),onKeyDown:$e(t.onKeyDown,O=>{if(O.key==="Tab"&&O.shiftKey){m.onItemShiftTab();return}if(O.target!==O.currentTarget)return;const j=c$(O,m.orientation,m.dir);if(j!==void 0){if(O.metaKey||O.ctrlKey||O.altKey||O.shiftKey)return;O.preventDefault();let A=x().filter(_=>_.focusable).map(_=>_.ref.current);if(j==="last")A.reverse();else if(j==="prev"||j==="next"){j==="prev"&&A.reverse();const _=A.indexOf(O.currentTarget);A=m.loop?u$(A,_+1):A.slice(_+1)}setTimeout(()=>jC(A))}}),children:typeof l=="function"?l({isCurrentTabStop:p,hasTabStop:k!=null}):l})})});OC.displayName=kC;var l$={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function o$(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function c$(t,e,n){const r=o$(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return l$[r]}function jC(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function u$(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var NC=SC,CC=OC,mx="Tabs",[d$]=Vi(mx,[fx]),TC=fx(),[h$,sw]=d$(mx),AC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:l="horizontal",dir:c,activationMode:d="automatic",...h}=t,m=Vf(c),[p,x]=ko({prop:r,onChange:s,defaultProp:i??"",caller:mx});return a.jsx(h$,{scope:n,baseId:ji(),value:p,onValueChange:x,orientation:l,dir:m,activationMode:d,children:a.jsx(Zt.div,{dir:m,"data-orientation":l,...h,ref:e})})});AC.displayName=mx;var MC="TabsList",EC=S.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=sw(MC,n),l=TC(n);return a.jsx(NC,{asChild:!0,...l,orientation:i.orientation,dir:i.dir,loop:r,children:a.jsx(Zt.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});EC.displayName=MC;var _C="TabsTrigger",DC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,l=sw(_C,n),c=TC(n),d=PC(l.baseId,r),h=BC(l.baseId,r),m=r===l.value;return a.jsx(CC,{asChild:!0,...c,focusable:!s,active:m,children:a.jsx(Zt.button,{type:"button",role:"tab","aria-selected":m,"aria-controls":h,"data-state":m?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:d,...i,ref:e,onMouseDown:$e(t.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?l.onValueChange(r):p.preventDefault()}),onKeyDown:$e(t.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&l.onValueChange(r)}),onFocus:$e(t.onFocus,()=>{const p=l.activationMode!=="manual";!m&&!s&&p&&l.onValueChange(r)})})})});DC.displayName=_C;var RC="TabsContent",zC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...l}=t,c=sw(RC,n),d=PC(c.baseId,r),h=BC(c.baseId,r),m=r===c.value,p=S.useRef(m);return S.useEffect(()=>{const x=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(x)},[]),a.jsx(Ls,{present:s||m,children:({present:x})=>a.jsx(Zt.div,{"data-state":m?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":d,hidden:!x,id:h,tabIndex:0,...l,ref:e,style:{...t.style,animationDuration:p.current?"0s":void 0},children:x&&i})})});zC.displayName=RC;function PC(t,e){return`${t}-trigger-${e}`}function BC(t,e){return`${t}-content-${e}`}var f$=AC,LC=EC,IC=DC,qC=zC;const hl=f$,ya=S.forwardRef(({className:t,...e},n)=>a.jsx(LC,{ref:n,className:ye("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));ya.displayName=LC.displayName;const $t=S.forwardRef(({className:t,...e},n)=>a.jsx(IC,{ref:n,className:ye("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 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",t),...e}));$t.displayName=IC.displayName;const kn=S.forwardRef(({className:t,...e},n)=>a.jsx(qC,{ref:n,className:ye("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",t),...e}));kn.displayName=qC.displayName;function m$(t,e){return S.useReducer((n,r)=>e[n][r]??n,t)}var iw="ScrollArea",[FC]=Vi(iw),[p$,Ei]=FC(iw),QC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...l}=t,[c,d]=S.useState(null),[h,m]=S.useState(null),[p,x]=S.useState(null),[v,b]=S.useState(null),[k,O]=S.useState(null),[j,T]=S.useState(0),[A,_]=S.useState(0),[D,E]=S.useState(!1),[z,Q]=S.useState(!1),F=Cn(e,U=>d(U)),L=Vf(s);return a.jsx(p$,{scope:n,type:r,dir:L,scrollHideDelay:i,scrollArea:c,viewport:h,onViewportChange:m,content:p,onContentChange:x,scrollbarX:v,onScrollbarXChange:b,scrollbarXEnabled:D,onScrollbarXEnabledChange:E,scrollbarY:k,onScrollbarYChange:O,scrollbarYEnabled:z,onScrollbarYEnabledChange:Q,onCornerWidthChange:T,onCornerHeightChange:_,children:a.jsx(Zt.div,{dir:L,...l,ref:F,style:{position:"relative","--radix-scroll-area-corner-width":j+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})});QC.displayName=iw;var $C="ScrollAreaViewport",HC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,l=Ei($C,n),c=S.useRef(null),d=Cn(e,c,l.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}"},nonce:s}),a.jsx(Zt.div,{"data-radix-scroll-area-viewport":"",...i,ref:d,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:a.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});HC.displayName=$C;var Sa="ScrollAreaScrollbar",aw=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ei(Sa,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:l}=s,c=t.orientation==="horizontal";return S.useEffect(()=>(c?i(!0):l(!0),()=>{c?i(!1):l(!1)}),[c,i,l]),s.type==="hover"?a.jsx(g$,{...r,ref:e,forceMount:n}):s.type==="scroll"?a.jsx(x$,{...r,ref:e,forceMount:n}):s.type==="auto"?a.jsx(UC,{...r,ref:e,forceMount:n}):s.type==="always"?a.jsx(lw,{...r,ref:e}):null});aw.displayName=Sa;var g$=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ei(Sa,t.__scopeScrollArea),[i,l]=S.useState(!1);return S.useEffect(()=>{const c=s.scrollArea;let d=0;if(c){const h=()=>{window.clearTimeout(d),l(!0)},m=()=>{d=window.setTimeout(()=>l(!1),s.scrollHideDelay)};return c.addEventListener("pointerenter",h),c.addEventListener("pointerleave",m),()=>{window.clearTimeout(d),c.removeEventListener("pointerenter",h),c.removeEventListener("pointerleave",m)}}},[s.scrollArea,s.scrollHideDelay]),a.jsx(Ls,{present:n||i,children:a.jsx(UC,{"data-state":i?"visible":"hidden",...r,ref:e})})}),x$=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ei(Sa,t.__scopeScrollArea),i=t.orientation==="horizontal",l=gx(()=>d("SCROLL_END"),100),[c,d]=m$("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 S.useEffect(()=>{if(c==="idle"){const h=window.setTimeout(()=>d("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(h)}},[c,s.scrollHideDelay,d]),S.useEffect(()=>{const h=s.viewport,m=i?"scrollLeft":"scrollTop";if(h){let p=h[m];const x=()=>{const v=h[m];p!==v&&(d("SCROLL"),l()),p=v};return h.addEventListener("scroll",x),()=>h.removeEventListener("scroll",x)}},[s.viewport,i,d,l]),a.jsx(Ls,{present:n||c!=="hidden",children:a.jsx(lw,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:$e(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:$e(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),UC=S.forwardRef((t,e)=>{const n=Ei(Sa,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,l]=S.useState(!1),c=t.orientation==="horizontal",d=gx(()=>{if(n.viewport){const h=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,s=Ei(Sa,t.__scopeScrollArea),i=S.useRef(null),l=S.useRef(0),[c,d]=S.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=YC(c.viewport,c.content),m={...r,sizes:c,onSizesChange:d,hasThumb:h>0&&h<1,onThumbChange:x=>i.current=x,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:x=>l.current=x};function p(x,v){return k$(x,l.current,c,v)}return n==="horizontal"?a.jsx(v$,{...m,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const x=s.viewport.scrollLeft,v=IO(x,c,s.dir);i.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollLeft=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollLeft=p(x,s.dir))}}):n==="vertical"?a.jsx(y$,{...m,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const x=s.viewport.scrollTop,v=IO(x,c);i.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollTop=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollTop=p(x))}}):null}),v$=S.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Ei(Sa,t.__scopeScrollArea),[l,c]=S.useState(),d=S.useRef(null),h=Cn(e,d,i.onScrollbarXChange);return S.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(WC,{"data-orientation":"horizontal",...s,ref:h,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":px(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.x),onDragScroll:m=>t.onDragScroll(m.x),onWheelScroll:(m,p)=>{if(i.viewport){const x=i.viewport.scrollLeft+m.deltaX;t.onWheelScroll(x),ZC(x,p)&&m.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:yg(l.paddingLeft),paddingEnd:yg(l.paddingRight)}})}})}),y$=S.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Ei(Sa,t.__scopeScrollArea),[l,c]=S.useState(),d=S.useRef(null),h=Cn(e,d,i.onScrollbarYChange);return S.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(WC,{"data-orientation":"vertical",...s,ref:h,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":px(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.y),onDragScroll:m=>t.onDragScroll(m.y),onWheelScroll:(m,p)=>{if(i.viewport){const x=i.viewport.scrollTop+m.deltaY;t.onWheelScroll(x),ZC(x,p)&&m.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:yg(l.paddingTop),paddingEnd:yg(l.paddingBottom)}})}})}),[b$,VC]=FC(Sa),WC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:l,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:h,onWheelScroll:m,onResize:p,...x}=t,v=Ei(Sa,n),[b,k]=S.useState(null),O=Cn(e,F=>k(F)),j=S.useRef(null),T=S.useRef(""),A=v.viewport,_=r.content-r.viewport,D=es(m),E=es(d),z=gx(p,10);function Q(F){if(j.current){const L=F.clientX-j.current.left,U=F.clientY-j.current.top;h({x:L,y:U})}}return S.useEffect(()=>{const F=L=>{const U=L.target;b?.contains(U)&&D(L,_)};return document.addEventListener("wheel",F,{passive:!1}),()=>document.removeEventListener("wheel",F,{passive:!1})},[A,b,_,D]),S.useEffect(E,[r,E]),id(b,z),id(v.content,z),a.jsx(b$,{scope:n,scrollbar:b,hasThumb:s,onThumbChange:es(i),onThumbPointerUp:es(l),onThumbPositionChange:E,onThumbPointerDown:es(c),children:a.jsx(Zt.div,{...x,ref:O,style:{position:"absolute",...x.style},onPointerDown:$e(t.onPointerDown,F=>{F.button===0&&(F.target.setPointerCapture(F.pointerId),j.current=b.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),Q(F))}),onPointerMove:$e(t.onPointerMove,Q),onPointerUp:$e(t.onPointerUp,F=>{const L=F.target;L.hasPointerCapture(F.pointerId)&&L.releasePointerCapture(F.pointerId),document.body.style.webkitUserSelect=T.current,v.viewport&&(v.viewport.style.scrollBehavior=""),j.current=null})})})}),vg="ScrollAreaThumb",GC=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=VC(vg,t.__scopeScrollArea);return a.jsx(Ls,{present:n||s.hasThumb,children:a.jsx(w$,{ref:e,...r})})}),w$=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=Ei(vg,n),l=VC(vg,n),{onThumbPositionChange:c}=l,d=Cn(e,p=>l.onThumbChange(p)),h=S.useRef(void 0),m=gx(()=>{h.current&&(h.current(),h.current=void 0)},100);return S.useEffect(()=>{const p=i.viewport;if(p){const x=()=>{if(m(),!h.current){const v=O$(p,c);h.current=v,c()}};return c(),p.addEventListener("scroll",x),()=>p.removeEventListener("scroll",x)}},[i.viewport,m,c]),a.jsx(Zt.div,{"data-state":l.hasThumb?"visible":"hidden",...s,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:$e(t.onPointerDownCapture,p=>{const v=p.target.getBoundingClientRect(),b=p.clientX-v.left,k=p.clientY-v.top;l.onThumbPointerDown({x:b,y:k})}),onPointerUp:$e(t.onPointerUp,l.onThumbPointerUp)})});GC.displayName=vg;var ow="ScrollAreaCorner",XC=S.forwardRef((t,e)=>{const n=Ei(ow,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(S$,{...t,ref:e}):null});XC.displayName=ow;var S$=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=Ei(ow,n),[i,l]=S.useState(0),[c,d]=S.useState(0),h=!!(i&&c);return id(s.scrollbarX,()=>{const m=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(m),d(m)}),id(s.scrollbarY,()=>{const m=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(m),l(m)}),h?a.jsx(Zt.div,{...r,ref:e,style:{width:i,height:c,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function yg(t){return t?parseInt(t,10):0}function YC(t,e){const n=t/e;return isNaN(n)?0:n}function px(t){const e=YC(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function k$(t,e,n,r="ltr"){const s=px(n),i=s/2,l=e||i,c=s-l,d=n.scrollbar.paddingStart+l,h=n.scrollbar.size-n.scrollbar.paddingEnd-c,m=n.content-n.viewport,p=r==="ltr"?[0,m]:[m*-1,0];return KC([d,h],p)(t)}function IO(t,e,n="ltr"){const r=px(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,l=e.content-e.viewport,c=i-r,d=n==="ltr"?[0,l]:[l*-1,0],h=F4(t,d);return KC([0,l],[0,c])(h)}function KC(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 ZC(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function s(){const i={left:t.scrollLeft,top:t.scrollTop},l=n.left!==i.left,c=n.top!==i.top;(l||c)&&e(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function gx(t,e){const n=es(t),r=S.useRef(0);return S.useEffect(()=>()=>window.clearTimeout(r.current),[]),S.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function id(t,e){const n=es(e);h9(()=>{let r=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(t),()=>{window.cancelAnimationFrame(r),s.unobserve(t)}}},[t,n])}var JC=QC,j$=HC,N$=XC;const mn=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(JC,{ref:r,className:ye("relative overflow-hidden",t),...n,children:[a.jsx(j$,{className:"h-full w-full rounded-[inherit]",children:e}),a.jsx(eT,{}),a.jsx(N$,{})]}));mn.displayName=JC.displayName;const eT=S.forwardRef(({className:t,orientation:e="vertical",...n},r)=>a.jsx(aw,{ref:r,orientation:e,className:ye("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(GC,{className:"relative flex-1 rounded-full bg-border"})}));eT.displayName=aw.displayName;function qO({className:t,...e}){return a.jsx("div",{className:ye("animate-pulse rounded-md bg-primary/10",t),...e})}function C$(t,e=[]){let n=[];function r(i,l){const c=S.createContext(l);c.displayName=i+"Context";const d=n.length;n=[...n,l];const h=p=>{const{scope:x,children:v,...b}=p,k=x?.[t]?.[d]||c,O=S.useMemo(()=>b,Object.values(b));return a.jsx(k.Provider,{value:O,children:v})};h.displayName=i+"Provider";function m(p,x){const v=x?.[t]?.[d]||c,b=S.useContext(v);if(b)return b;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[h,m]}const s=()=>{const i=n.map(l=>S.createContext(l));return function(c){const d=c?.[t]||i;return S.useMemo(()=>({[`__scope${t}`]:{...c,[t]:d}}),[c,d])}};return s.scopeName=t,[r,T$(s,...e)]}function T$(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const l=r.reduce((c,{useScope:d,scopeName:h})=>{const p=d(i)[`__scope${h}`];return{...c,...p}},{});return S.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return n.scopeName=e.scopeName,n}var A$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],tT=A$.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),cw="Progress",uw=100,[M$]=C$(cw),[E$,_$]=M$(cw),nT=S.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=D$,...l}=t;(s||s===0)&&!FO(s)&&console.error(R$(`${s}`,"Progress"));const c=FO(s)?s:uw;r!==null&&!QO(r,c)&&console.error(z$(`${r}`,"Progress"));const d=QO(r,c)?r:null,h=bg(d)?i(d,c):void 0;return a.jsx(E$,{scope:n,value:d,max:c,children:a.jsx(tT.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":bg(d)?d:void 0,"aria-valuetext":h,role:"progressbar","data-state":iT(d,c),"data-value":d??void 0,"data-max":c,...l,ref:e})})});nT.displayName=cw;var rT="ProgressIndicator",sT=S.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=_$(rT,n);return a.jsx(tT.div,{"data-state":iT(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});sT.displayName=rT;function D$(t,e){return`${Math.round(t/e*100)}%`}function iT(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function bg(t){return typeof t=="number"}function FO(t){return bg(t)&&!isNaN(t)&&t>0}function QO(t,e){return bg(t)&&!isNaN(t)&&t<=e&&t>=0}function R$(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${uw}\`.`}function z$(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: +`):" "+EO(l[0]):"as no adapter specified";throw new St("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const sC={getAdapter:oQ,adapters:nw};function by(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new kd(null,t)}function _O(t){return by(t),t.headers=Rs.from(t.headers),t.data=yy.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),sC.getAdapter(t.adapter||e0.adapter,t)(t).then(function(r){return by(t),r.data=yy.call(t,t.transformResponse,r),r.headers=Rs.from(r.headers),r},function(r){return J9(r)||(by(t),r&&r.response&&(r.response.data=yy.call(t,t.transformResponse,r.response),r.response.headers=Rs.from(r.response.headers))),Promise.reject(r)})}const iC="1.13.2",hx={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{hx[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const DO={};hx.transitional=function(e,n,r){function s(i,l){return"[Axios v"+iC+"] Transitional option '"+i+"'"+l+(r?". "+r:"")}return(i,l,c)=>{if(e===!1)throw new St(s(l," has been removed"+(n?" in "+n:"")),St.ERR_DEPRECATED);return n&&!DO[l]&&(DO[l]=!0,console.warn(s(l," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,l,c):!0}};hx.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function cQ(t,e,n){if(typeof t!="object")throw new St("options must be an object",St.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const i=r[s],l=e[i];if(l){const c=t[i],d=c===void 0||l(c,i,t);if(d!==!0)throw new St("option "+i+" must be "+d,St.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new St("Unknown option "+i,St.ERR_BAD_OPTION)}}const Up={assertOptions:cQ,validators:hx},Zi=Up.validators;let mc=class{constructor(e){this.defaults=e||{},this.interceptors={request:new wO,response:new wO}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=vc(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Up.assertOptions(r,{silentJSONParsing:Zi.transitional(Zi.boolean),forcedJSONParsing:Zi.transitional(Zi.boolean),clarifyTimeoutError:Zi.transitional(Zi.boolean)},!1),s!=null&&(we.isFunction(s)?n.paramsSerializer={serialize:s}:Up.assertOptions(s,{encode:Zi.function,serialize:Zi.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Up.assertOptions(n,{baseUrl:Zi.spelling("baseURL"),withXsrfToken:Zi.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=i&&we.merge(i.common,i[n.method]);i&&we.forEach(["delete","get","head","post","put","patch","common"],b=>{delete i[b]}),n.headers=Rs.concat(l,i);const c=[];let d=!0;this.interceptors.request.forEach(function(k){typeof k.runWhen=="function"&&k.runWhen(n)===!1||(d=d&&k.synchronous,c.unshift(k.fulfilled,k.rejected))});const h=[];this.interceptors.response.forEach(function(k){h.push(k.fulfilled,k.rejected)});let m,p=0,x;if(!d){const b=[_O.bind(this),void 0];for(b.unshift(...c),b.push(...h),x=b.length,m=Promise.resolve(n);p{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const l=new Promise(c=>{r.subscribe(c),i=c}).then(s);return l.cancel=function(){r.unsubscribe(i)},l},e(function(i,l,c){r.reason||(r.reason=new kd(i,l,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 aC(function(s){e=s}),cancel:e}}};function dQ(t){return function(n){return t.apply(null,n)}}function hQ(t){return we.isObject(t)&&t.isAxiosError===!0}const i2={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(i2).forEach(([t,e])=>{i2[e]=t});function lC(t){const e=new mc(t),n=L9(mc.prototype.request,e);return we.extend(n,mc.prototype,e,{allOwnKeys:!0}),we.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return lC(vc(t,s))},n}const Zn=lC(e0);Zn.Axios=mc;Zn.CanceledError=kd;Zn.CancelToken=uQ;Zn.isCancel=J9;Zn.VERSION=iC;Zn.toFormData=dx;Zn.AxiosError=St;Zn.Cancel=Zn.CanceledError;Zn.all=function(e){return Promise.all(e)};Zn.spread=dQ;Zn.isAxiosError=hQ;Zn.mergeConfig=vc;Zn.AxiosHeaders=Rs;Zn.formToJSON=t=>Z9(we.isHTMLForm(t)?new FormData(t):t);Zn.getAdapter=sC.getAdapter;Zn.HttpStatusCode=i2;Zn.default=Zn;const{Axios:Nxe,AxiosError:Cxe,CanceledError:Txe,isCancel:Mxe,CancelToken:Axe,VERSION:Exe,all:_xe,Cancel:Dxe,isAxiosError:Rxe,spread:zxe,toFormData:Pxe,AxiosHeaders:Bxe,HttpStatusCode:Lxe,formToJSON:Ixe,getAdapter:qxe,mergeConfig:Fxe}=Zn,fQ=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),oC=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),xg="-",RO=[],pQ="arbitrary..",gQ=t=>{const e=vQ(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return xQ(l);const c=l.split(xg),d=c[0]===""&&c.length>1?1:0;return cC(c,d,e)},getConflictingClassGroupIds:(l,c)=>{if(c){const d=r[l],h=n[l];return d?h?fQ(h,d):d:h||RO}return n[l]||RO}}},cC=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const h=cC(t,e+1,i);if(h)return h}const l=n.validators;if(l===null)return;const c=e===0?t.join(xg):t.slice(e).join(xg),d=l.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?pQ+r:void 0})(),vQ=t=>{const{theme:e,classGroups:n}=t;return yQ(n,e)},yQ=(t,e)=>{const n=oC();for(const r in t){const s=t[r];rw(s,n,r,e)}return n},rw=(t,e,n,r)=>{const s=t.length;for(let i=0;i{if(typeof t=="string"){wQ(t,e,n);return}if(typeof t=="function"){SQ(t,e,n,r);return}kQ(t,e,n,r)},wQ=(t,e,n)=>{const r=t===""?e:uC(e,t);r.classGroupId=n},SQ=(t,e,n,r)=>{if(OQ(t)){rw(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(mQ(n,t))},kQ=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let l=0;l{let n=t;const r=e.split(xg),s=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,jQ=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,l)=>{n[i]=l,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let l=n[i];if(l!==void 0)return l;if((l=r[i])!==void 0)return s(i,l),l},set(i,l){i in n?n[i]=l:s(i,l)}}},a2="!",zO=":",NQ=[],PO=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),CQ=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let l=0,c=0,d=0,h;const m=s.length;for(let k=0;kd?h-d:void 0;return PO(i,v,x,b)};if(e){const s=e+zO,i=r;r=l=>l.startsWith(s)?i(l.slice(s.length)):PO(NQ,!1,l,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},TQ=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i0&&(s.sort(),r.push(...s),s=[]),r.push(l)):s.push(l)}return s.length>0&&(s.sort(),r.push(...s)),r}},MQ=t=>({cache:jQ(t.cacheSize),parseClassName:CQ(t),sortModifiers:TQ(t),...gQ(t)}),AQ=/\s+/,EQ=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,l=[],c=t.trim().split(AQ);let d="";for(let h=c.length-1;h>=0;h-=1){const m=c[h],{isExternal:p,modifiers:x,hasImportantModifier:v,baseClassName:b,maybePostfixModifierPosition:k}=n(m);if(p){d=m+(d.length>0?" "+d:d);continue}let O=!!k,j=r(O?b.substring(0,k):b);if(!j){if(!O){d=m+(d.length>0?" "+d:d);continue}if(j=r(b),!j){d=m+(d.length>0?" "+d:d);continue}O=!1}const T=x.length===0?"":x.length===1?x[0]:i(x).join(":"),M=v?T+a2:T,_=M+j;if(l.indexOf(_)>-1)continue;l.push(_);const D=s(j,O);for(let E=0;E0?" "+d:d)}return d},_Q=(...t)=>{let e=0,n,r,s="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,s,i;const l=d=>{const h=e.reduce((m,p)=>p(m),t());return n=MQ(h),r=n.cache.get,s=n.cache.set,i=c,c(d)},c=d=>{const h=r(d);if(h)return h;const m=EQ(d,n);return s(d,m),m};return i=l,(...d)=>i(_Q(...d))},RQ=[],wr=t=>{const e=n=>n[t]||RQ;return e.isThemeGetter=!0,e},hC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zQ=/^\d+\/\d+$/,PQ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,BQ=/\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$/,LQ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,IQ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qQ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ju=t=>zQ.test(t),At=t=>!!t&&!Number.isNaN(Number(t)),Wl=t=>!!t&&Number.isInteger(Number(t)),wy=t=>t.endsWith("%")&&At(t.slice(0,-1)),Ga=t=>PQ.test(t),FQ=()=>!0,QQ=t=>BQ.test(t)&&!LQ.test(t),mC=()=>!1,$Q=t=>IQ.test(t),HQ=t=>qQ.test(t),UQ=t=>!Xe(t)&&!Ye(t),VQ=t=>Od(t,xC,mC),Xe=t=>hC.test(t),Yo=t=>Od(t,vC,QQ),Sy=t=>Od(t,KQ,At),BO=t=>Od(t,pC,mC),WQ=t=>Od(t,gC,HQ),Ym=t=>Od(t,yC,$Q),Ye=t=>fC.test(t),Ah=t=>jd(t,vC),GQ=t=>jd(t,ZQ),LO=t=>jd(t,pC),XQ=t=>jd(t,xC),YQ=t=>jd(t,gC),Km=t=>jd(t,yC,!0),Od=(t,e,n)=>{const r=hC.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},jd=(t,e,n=!1)=>{const r=fC.exec(t);return r?r[1]?e(r[1]):n:!1},pC=t=>t==="position"||t==="percentage",gC=t=>t==="image"||t==="url",xC=t=>t==="length"||t==="size"||t==="bg-size",vC=t=>t==="length",KQ=t=>t==="number",ZQ=t=>t==="family-name",yC=t=>t==="shadow",JQ=()=>{const t=wr("color"),e=wr("font"),n=wr("text"),r=wr("font-weight"),s=wr("tracking"),i=wr("leading"),l=wr("breakpoint"),c=wr("container"),d=wr("spacing"),h=wr("radius"),m=wr("shadow"),p=wr("inset-shadow"),x=wr("text-shadow"),v=wr("drop-shadow"),b=wr("blur"),k=wr("perspective"),O=wr("aspect"),j=wr("ease"),T=wr("animate"),M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[..._(),Ye,Xe],E=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],Q=()=>[Ye,Xe,d],F=()=>[ju,"full","auto",...Q()],L=()=>[Wl,"none","subgrid",Ye,Xe],U=()=>["auto",{span:["full",Wl,Ye,Xe]},Wl,Ye,Xe],V=()=>[Wl,"auto",Ye,Xe],ce=()=>["auto","min","max","fr",Ye,Xe],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...Q()],ae=()=>[ju,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...Q()],ne=()=>[t,Ye,Xe],ue=()=>[..._(),LO,BO,{position:[Ye,Xe]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],me=()=>["auto","cover","contain",XQ,VQ,{size:[Ye,Xe]}],Y=()=>[wy,Ah,Yo],P=()=>["","none","full",h,Ye,Xe],K=()=>["",At,Ah,Yo],$=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ve=()=>[At,wy,LO,BO],Re=()=>["","none",b,Ye,Xe],de=()=>["none",At,Ye,Xe],We=()=>["none",At,Ye,Xe],ct=()=>[At,Ye,Xe],Oe=()=>[ju,"full",...Q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ga],breakpoint:[Ga],color:[FQ],container:[Ga],"drop-shadow":[Ga],ease:["in","out","in-out"],font:[UQ],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ga],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ga],shadow:[Ga],spacing:["px",At],text:[Ga],"text-shadow":[Ga],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ju,Xe,Ye,O]}],container:["container"],columns:[{columns:[At,Xe,Ye,c]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"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"],sr:["sr-only","not-sr-only"],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:D()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:F()}],"inset-x":[{"inset-x":F()}],"inset-y":[{"inset-y":F()}],start:[{start:F()}],end:[{end:F()}],top:[{top:F()}],right:[{right:F()}],bottom:[{bottom:F()}],left:[{left:F()}],visibility:["visible","invisible","collapse"],z:[{z:[Wl,"auto",Ye,Xe]}],basis:[{basis:[ju,"full","auto",c,...Q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[At,ju,"auto","initial","none",Xe]}],grow:[{grow:["",At,Ye,Xe]}],shrink:[{shrink:["",At,Ye,Xe]}],order:[{order:[Wl,"first","last","none",Ye,Xe]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:U()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ce()}],"auto-rows":[{"auto-rows":ce()}],gap:[{gap:Q()}],"gap-x":[{"gap-x":Q()}],"gap-y":[{"gap-y":Q()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...J(),"baseline"]}],"place-self":[{"place-self":["auto",...J()]}],p:[{p:Q()}],px:[{px:Q()}],py:[{py:Q()}],ps:[{ps:Q()}],pe:[{pe:Q()}],pt:[{pt:Q()}],pr:[{pr:Q()}],pb:[{pb:Q()}],pl:[{pl:Q()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":Q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":Q()}],"space-y-reverse":["space-y-reverse"],size:[{size:ae()}],w:[{w:[c,"screen",...ae()]}],"min-w":[{"min-w":[c,"screen","none",...ae()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...ae()]}],h:[{h:["screen","lh",...ae()]}],"min-h":[{"min-h":["screen","lh","none",...ae()]}],"max-h":[{"max-h":["screen","lh",...ae()]}],"font-size":[{text:["base",n,Ah,Yo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Ye,Sy]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",wy,Xe]}],"font-family":[{font:[GQ,Xe,e]}],"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-fractions"],tracking:[{tracking:[s,Ye,Xe]}],"line-clamp":[{"line-clamp":[At,"none",Ye,Sy]}],leading:[{leading:[i,...Q()]}],"list-image":[{"list-image":["none",Ye,Xe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ye,Xe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:ne()}],"text-color":[{text:ne()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:[At,"from-font","auto",Ye,Yo]}],"text-decoration-color":[{decoration:ne()}],"underline-offset":[{"underline-offset":[At,"auto",Ye,Xe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Q()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ye,Xe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ye,Xe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ue()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:me()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Wl,Ye,Xe],radial:["",Ye,Xe],conic:[Wl,Ye,Xe]},YQ,WQ]}],"bg-color":[{bg:ne()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:ne()}],"gradient-via":[{via:ne()}],"gradient-to":[{to:ne()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...$(),"hidden","none"]}],"divide-style":[{divide:[...$(),"hidden","none"]}],"border-color":[{border:ne()}],"border-color-x":[{"border-x":ne()}],"border-color-y":[{"border-y":ne()}],"border-color-s":[{"border-s":ne()}],"border-color-e":[{"border-e":ne()}],"border-color-t":[{"border-t":ne()}],"border-color-r":[{"border-r":ne()}],"border-color-b":[{"border-b":ne()}],"border-color-l":[{"border-l":ne()}],"divide-color":[{divide:ne()}],"outline-style":[{outline:[...$(),"none","hidden"]}],"outline-offset":[{"outline-offset":[At,Ye,Xe]}],"outline-w":[{outline:["",At,Ah,Yo]}],"outline-color":[{outline:ne()}],shadow:[{shadow:["","none",m,Km,Ym]}],"shadow-color":[{shadow:ne()}],"inset-shadow":[{"inset-shadow":["none",p,Km,Ym]}],"inset-shadow-color":[{"inset-shadow":ne()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:ne()}],"ring-offset-w":[{"ring-offset":[At,Yo]}],"ring-offset-color":[{"ring-offset":ne()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":ne()}],"text-shadow":[{"text-shadow":["none",x,Km,Ym]}],"text-shadow-color":[{"text-shadow":ne()}],opacity:[{opacity:[At,Ye,Xe]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[At]}],"mask-image-linear-from-pos":[{"mask-linear-from":ve()}],"mask-image-linear-to-pos":[{"mask-linear-to":ve()}],"mask-image-linear-from-color":[{"mask-linear-from":ne()}],"mask-image-linear-to-color":[{"mask-linear-to":ne()}],"mask-image-t-from-pos":[{"mask-t-from":ve()}],"mask-image-t-to-pos":[{"mask-t-to":ve()}],"mask-image-t-from-color":[{"mask-t-from":ne()}],"mask-image-t-to-color":[{"mask-t-to":ne()}],"mask-image-r-from-pos":[{"mask-r-from":ve()}],"mask-image-r-to-pos":[{"mask-r-to":ve()}],"mask-image-r-from-color":[{"mask-r-from":ne()}],"mask-image-r-to-color":[{"mask-r-to":ne()}],"mask-image-b-from-pos":[{"mask-b-from":ve()}],"mask-image-b-to-pos":[{"mask-b-to":ve()}],"mask-image-b-from-color":[{"mask-b-from":ne()}],"mask-image-b-to-color":[{"mask-b-to":ne()}],"mask-image-l-from-pos":[{"mask-l-from":ve()}],"mask-image-l-to-pos":[{"mask-l-to":ve()}],"mask-image-l-from-color":[{"mask-l-from":ne()}],"mask-image-l-to-color":[{"mask-l-to":ne()}],"mask-image-x-from-pos":[{"mask-x-from":ve()}],"mask-image-x-to-pos":[{"mask-x-to":ve()}],"mask-image-x-from-color":[{"mask-x-from":ne()}],"mask-image-x-to-color":[{"mask-x-to":ne()}],"mask-image-y-from-pos":[{"mask-y-from":ve()}],"mask-image-y-to-pos":[{"mask-y-to":ve()}],"mask-image-y-from-color":[{"mask-y-from":ne()}],"mask-image-y-to-color":[{"mask-y-to":ne()}],"mask-image-radial":[{"mask-radial":[Ye,Xe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ve()}],"mask-image-radial-to-pos":[{"mask-radial-to":ve()}],"mask-image-radial-from-color":[{"mask-radial-from":ne()}],"mask-image-radial-to-color":[{"mask-radial-to":ne()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[At]}],"mask-image-conic-from-pos":[{"mask-conic-from":ve()}],"mask-image-conic-to-pos":[{"mask-conic-to":ve()}],"mask-image-conic-from-color":[{"mask-conic-from":ne()}],"mask-image-conic-to-color":[{"mask-conic-to":ne()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ue()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:me()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ye,Xe]}],filter:[{filter:["","none",Ye,Xe]}],blur:[{blur:Re()}],brightness:[{brightness:[At,Ye,Xe]}],contrast:[{contrast:[At,Ye,Xe]}],"drop-shadow":[{"drop-shadow":["","none",v,Km,Ym]}],"drop-shadow-color":[{"drop-shadow":ne()}],grayscale:[{grayscale:["",At,Ye,Xe]}],"hue-rotate":[{"hue-rotate":[At,Ye,Xe]}],invert:[{invert:["",At,Ye,Xe]}],saturate:[{saturate:[At,Ye,Xe]}],sepia:[{sepia:["",At,Ye,Xe]}],"backdrop-filter":[{"backdrop-filter":["","none",Ye,Xe]}],"backdrop-blur":[{"backdrop-blur":Re()}],"backdrop-brightness":[{"backdrop-brightness":[At,Ye,Xe]}],"backdrop-contrast":[{"backdrop-contrast":[At,Ye,Xe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",At,Ye,Xe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[At,Ye,Xe]}],"backdrop-invert":[{"backdrop-invert":["",At,Ye,Xe]}],"backdrop-opacity":[{"backdrop-opacity":[At,Ye,Xe]}],"backdrop-saturate":[{"backdrop-saturate":[At,Ye,Xe]}],"backdrop-sepia":[{"backdrop-sepia":["",At,Ye,Xe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":Q()}],"border-spacing-x":[{"border-spacing-x":Q()}],"border-spacing-y":[{"border-spacing-y":Q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ye,Xe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[At,"initial",Ye,Xe]}],ease:[{ease:["linear","initial",j,Ye,Xe]}],delay:[{delay:[At,Ye,Xe]}],animate:[{animate:["none",T,Ye,Xe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,Ye,Xe]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:We()}],"scale-x":[{"scale-x":We()}],"scale-y":[{"scale-y":We()}],"scale-z":[{"scale-z":We()}],"scale-3d":["scale-3d"],skew:[{skew:ct()}],"skew-x":[{"skew-x":ct()}],"skew-y":[{"skew-y":ct()}],transform:[{transform:[Ye,Xe,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Oe()}],"translate-x":[{"translate-x":Oe()}],"translate-y":[{"translate-y":Oe()}],"translate-z":[{"translate-z":Oe()}],"translate-none":["translate-none"],accent:[{accent:ne()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:ne()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",Ye,Xe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":Q()}],"scroll-mx":[{"scroll-mx":Q()}],"scroll-my":[{"scroll-my":Q()}],"scroll-ms":[{"scroll-ms":Q()}],"scroll-me":[{"scroll-me":Q()}],"scroll-mt":[{"scroll-mt":Q()}],"scroll-mr":[{"scroll-mr":Q()}],"scroll-mb":[{"scroll-mb":Q()}],"scroll-ml":[{"scroll-ml":Q()}],"scroll-p":[{"scroll-p":Q()}],"scroll-px":[{"scroll-px":Q()}],"scroll-py":[{"scroll-py":Q()}],"scroll-ps":[{"scroll-ps":Q()}],"scroll-pe":[{"scroll-pe":Q()}],"scroll-pt":[{"scroll-pt":Q()}],"scroll-pr":[{"scroll-pr":Q()}],"scroll-pb":[{"scroll-pb":Q()}],"scroll-pl":[{"scroll-pl":Q()}],"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",Ye,Xe]}],fill:[{fill:["none",...ne()]}],"stroke-w":[{stroke:[At,Ah,Yo,Sy]}],stroke:[{stroke:["none",...ne()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},e$=DQ(JQ);function ye(...t){return e$(d9(t))}const yt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("rounded-xl border bg-card text-card-foreground shadow",t),...e}));yt.displayName="Card";const Jt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("flex flex-col space-y-1.5 p-6",t),...e}));Jt.displayName="CardHeader";const en=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("font-semibold leading-none tracking-tight",t),...e}));en.displayName="CardTitle";const Sr=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Sr.displayName="CardDescription";const vn=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("p-6 pt-0",t),...e}));vn.displayName="CardContent";const bC=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("flex items-center p-6 pt-0",t),...e}));bC.displayName="CardFooter";var ky="rovingFocusGroup.onEntryFocus",t$={bubbles:!1,cancelable:!0},t0="RovingFocusGroup",[l2,wC,n$]=tx(t0),[r$,fx]=Hi(t0,[n$]),[s$,i$]=r$(t0),SC=S.forwardRef((t,e)=>a.jsx(l2.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(l2.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(a$,{...t,ref:e})})}));SC.displayName=t0;var a$=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:h,preventScrollOnEntryFocus:m=!1,...p}=t,x=S.useRef(null),v=Cn(e,x),b=Vf(i),[k,O]=So({prop:l,defaultProp:c??null,onChange:d,caller:t0}),[j,T]=S.useState(!1),M=es(h),_=wC(n),D=S.useRef(!1),[E,z]=S.useState(0);return S.useEffect(()=>{const Q=x.current;if(Q)return Q.addEventListener(ky,M),()=>Q.removeEventListener(ky,M)},[M]),a.jsx(s$,{scope:n,orientation:r,dir:b,loop:s,currentTabStopId:k,onItemFocus:S.useCallback(Q=>O(Q),[O]),onItemShiftTab:S.useCallback(()=>T(!0),[]),onFocusableItemAdd:S.useCallback(()=>z(Q=>Q+1),[]),onFocusableItemRemove:S.useCallback(()=>z(Q=>Q-1),[]),children:a.jsx(Yt.div,{tabIndex:j||E===0?-1:0,"data-orientation":r,...p,ref:v,style:{outline:"none",...t.style},onMouseDown:$e(t.onMouseDown,()=>{D.current=!0}),onFocus:$e(t.onFocus,Q=>{const F=!D.current;if(Q.target===Q.currentTarget&&F&&!j){const L=new CustomEvent(ky,t$);if(Q.currentTarget.dispatchEvent(L),!L.defaultPrevented){const U=_().filter(H=>H.focusable),V=U.find(H=>H.active),ce=U.find(H=>H.id===k),J=[V,ce,...U].filter(Boolean).map(H=>H.ref.current);jC(J,m)}}D.current=!1}),onBlur:$e(t.onBlur,()=>T(!1))})})}),kC="RovingFocusGroupItem",OC=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:l,...c}=t,d=Oi(),h=i||d,m=i$(kC,n),p=m.currentTabStopId===h,x=wC(n),{onFocusableItemAdd:v,onFocusableItemRemove:b,currentTabStopId:k}=m;return S.useEffect(()=>{if(r)return v(),()=>b()},[r,v,b]),a.jsx(l2.ItemSlot,{scope:n,id:h,focusable:r,active:s,children:a.jsx(Yt.span,{tabIndex:p?0:-1,"data-orientation":m.orientation,...c,ref:e,onMouseDown:$e(t.onMouseDown,O=>{r?m.onItemFocus(h):O.preventDefault()}),onFocus:$e(t.onFocus,()=>m.onItemFocus(h)),onKeyDown:$e(t.onKeyDown,O=>{if(O.key==="Tab"&&O.shiftKey){m.onItemShiftTab();return}if(O.target!==O.currentTarget)return;const j=c$(O,m.orientation,m.dir);if(j!==void 0){if(O.metaKey||O.ctrlKey||O.altKey||O.shiftKey)return;O.preventDefault();let M=x().filter(_=>_.focusable).map(_=>_.ref.current);if(j==="last")M.reverse();else if(j==="prev"||j==="next"){j==="prev"&&M.reverse();const _=M.indexOf(O.currentTarget);M=m.loop?u$(M,_+1):M.slice(_+1)}setTimeout(()=>jC(M))}}),children:typeof l=="function"?l({isCurrentTabStop:p,hasTabStop:k!=null}):l})})});OC.displayName=kC;var l$={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function o$(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function c$(t,e,n){const r=o$(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return l$[r]}function jC(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function u$(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var NC=SC,CC=OC,mx="Tabs",[d$]=Hi(mx,[fx]),TC=fx(),[h$,sw]=d$(mx),MC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:l="horizontal",dir:c,activationMode:d="automatic",...h}=t,m=Vf(c),[p,x]=So({prop:r,onChange:s,defaultProp:i??"",caller:mx});return a.jsx(h$,{scope:n,baseId:Oi(),value:p,onValueChange:x,orientation:l,dir:m,activationMode:d,children:a.jsx(Yt.div,{dir:m,"data-orientation":l,...h,ref:e})})});MC.displayName=mx;var AC="TabsList",EC=S.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=sw(AC,n),l=TC(n);return a.jsx(NC,{asChild:!0,...l,orientation:i.orientation,dir:i.dir,loop:r,children:a.jsx(Yt.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});EC.displayName=AC;var _C="TabsTrigger",DC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,l=sw(_C,n),c=TC(n),d=PC(l.baseId,r),h=BC(l.baseId,r),m=r===l.value;return a.jsx(CC,{asChild:!0,...c,focusable:!s,active:m,children:a.jsx(Yt.button,{type:"button",role:"tab","aria-selected":m,"aria-controls":h,"data-state":m?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:d,...i,ref:e,onMouseDown:$e(t.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?l.onValueChange(r):p.preventDefault()}),onKeyDown:$e(t.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&l.onValueChange(r)}),onFocus:$e(t.onFocus,()=>{const p=l.activationMode!=="manual";!m&&!s&&p&&l.onValueChange(r)})})})});DC.displayName=_C;var RC="TabsContent",zC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...l}=t,c=sw(RC,n),d=PC(c.baseId,r),h=BC(c.baseId,r),m=r===c.value,p=S.useRef(m);return S.useEffect(()=>{const x=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(x)},[]),a.jsx(Bs,{present:s||m,children:({present:x})=>a.jsx(Yt.div,{"data-state":m?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":d,hidden:!x,id:h,tabIndex:0,...l,ref:e,style:{...t.style,animationDuration:p.current?"0s":void 0},children:x&&i})})});zC.displayName=RC;function PC(t,e){return`${t}-trigger-${e}`}function BC(t,e){return`${t}-content-${e}`}var f$=MC,LC=EC,IC=DC,qC=zC;const dl=f$,va=S.forwardRef(({className:t,...e},n)=>a.jsx(LC,{ref:n,className:ye("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));va.displayName=LC.displayName;const $t=S.forwardRef(({className:t,...e},n)=>a.jsx(IC,{ref:n,className:ye("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 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",t),...e}));$t.displayName=IC.displayName;const kn=S.forwardRef(({className:t,...e},n)=>a.jsx(qC,{ref:n,className:ye("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",t),...e}));kn.displayName=qC.displayName;function m$(t,e){return S.useReducer((n,r)=>e[n][r]??n,t)}var iw="ScrollArea",[FC]=Hi(iw),[p$,Ai]=FC(iw),QC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...l}=t,[c,d]=S.useState(null),[h,m]=S.useState(null),[p,x]=S.useState(null),[v,b]=S.useState(null),[k,O]=S.useState(null),[j,T]=S.useState(0),[M,_]=S.useState(0),[D,E]=S.useState(!1),[z,Q]=S.useState(!1),F=Cn(e,U=>d(U)),L=Vf(s);return a.jsx(p$,{scope:n,type:r,dir:L,scrollHideDelay:i,scrollArea:c,viewport:h,onViewportChange:m,content:p,onContentChange:x,scrollbarX:v,onScrollbarXChange:b,scrollbarXEnabled:D,onScrollbarXEnabledChange:E,scrollbarY:k,onScrollbarYChange:O,scrollbarYEnabled:z,onScrollbarYEnabledChange:Q,onCornerWidthChange:T,onCornerHeightChange:_,children:a.jsx(Yt.div,{dir:L,...l,ref:F,style:{position:"relative","--radix-scroll-area-corner-width":j+"px","--radix-scroll-area-corner-height":M+"px",...t.style}})})});QC.displayName=iw;var $C="ScrollAreaViewport",HC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,l=Ai($C,n),c=S.useRef(null),d=Cn(e,c,l.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}"},nonce:s}),a.jsx(Yt.div,{"data-radix-scroll-area-viewport":"",...i,ref:d,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:a.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});HC.displayName=$C;var wa="ScrollAreaScrollbar",aw=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ai(wa,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:l}=s,c=t.orientation==="horizontal";return S.useEffect(()=>(c?i(!0):l(!0),()=>{c?i(!1):l(!1)}),[c,i,l]),s.type==="hover"?a.jsx(g$,{...r,ref:e,forceMount:n}):s.type==="scroll"?a.jsx(x$,{...r,ref:e,forceMount:n}):s.type==="auto"?a.jsx(UC,{...r,ref:e,forceMount:n}):s.type==="always"?a.jsx(lw,{...r,ref:e}):null});aw.displayName=wa;var g$=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ai(wa,t.__scopeScrollArea),[i,l]=S.useState(!1);return S.useEffect(()=>{const c=s.scrollArea;let d=0;if(c){const h=()=>{window.clearTimeout(d),l(!0)},m=()=>{d=window.setTimeout(()=>l(!1),s.scrollHideDelay)};return c.addEventListener("pointerenter",h),c.addEventListener("pointerleave",m),()=>{window.clearTimeout(d),c.removeEventListener("pointerenter",h),c.removeEventListener("pointerleave",m)}}},[s.scrollArea,s.scrollHideDelay]),a.jsx(Bs,{present:n||i,children:a.jsx(UC,{"data-state":i?"visible":"hidden",...r,ref:e})})}),x$=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ai(wa,t.__scopeScrollArea),i=t.orientation==="horizontal",l=gx(()=>d("SCROLL_END"),100),[c,d]=m$("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 S.useEffect(()=>{if(c==="idle"){const h=window.setTimeout(()=>d("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(h)}},[c,s.scrollHideDelay,d]),S.useEffect(()=>{const h=s.viewport,m=i?"scrollLeft":"scrollTop";if(h){let p=h[m];const x=()=>{const v=h[m];p!==v&&(d("SCROLL"),l()),p=v};return h.addEventListener("scroll",x),()=>h.removeEventListener("scroll",x)}},[s.viewport,i,d,l]),a.jsx(Bs,{present:n||c!=="hidden",children:a.jsx(lw,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:$e(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:$e(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),UC=S.forwardRef((t,e)=>{const n=Ai(wa,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,l]=S.useState(!1),c=t.orientation==="horizontal",d=gx(()=>{if(n.viewport){const h=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,s=Ai(wa,t.__scopeScrollArea),i=S.useRef(null),l=S.useRef(0),[c,d]=S.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=YC(c.viewport,c.content),m={...r,sizes:c,onSizesChange:d,hasThumb:h>0&&h<1,onThumbChange:x=>i.current=x,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:x=>l.current=x};function p(x,v){return k$(x,l.current,c,v)}return n==="horizontal"?a.jsx(v$,{...m,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const x=s.viewport.scrollLeft,v=IO(x,c,s.dir);i.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollLeft=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollLeft=p(x,s.dir))}}):n==="vertical"?a.jsx(y$,{...m,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const x=s.viewport.scrollTop,v=IO(x,c);i.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollTop=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollTop=p(x))}}):null}),v$=S.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Ai(wa,t.__scopeScrollArea),[l,c]=S.useState(),d=S.useRef(null),h=Cn(e,d,i.onScrollbarXChange);return S.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(WC,{"data-orientation":"horizontal",...s,ref:h,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":px(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.x),onDragScroll:m=>t.onDragScroll(m.x),onWheelScroll:(m,p)=>{if(i.viewport){const x=i.viewport.scrollLeft+m.deltaX;t.onWheelScroll(x),ZC(x,p)&&m.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:yg(l.paddingLeft),paddingEnd:yg(l.paddingRight)}})}})}),y$=S.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Ai(wa,t.__scopeScrollArea),[l,c]=S.useState(),d=S.useRef(null),h=Cn(e,d,i.onScrollbarYChange);return S.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(WC,{"data-orientation":"vertical",...s,ref:h,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":px(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.y),onDragScroll:m=>t.onDragScroll(m.y),onWheelScroll:(m,p)=>{if(i.viewport){const x=i.viewport.scrollTop+m.deltaY;t.onWheelScroll(x),ZC(x,p)&&m.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:yg(l.paddingTop),paddingEnd:yg(l.paddingBottom)}})}})}),[b$,VC]=FC(wa),WC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:l,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:h,onWheelScroll:m,onResize:p,...x}=t,v=Ai(wa,n),[b,k]=S.useState(null),O=Cn(e,F=>k(F)),j=S.useRef(null),T=S.useRef(""),M=v.viewport,_=r.content-r.viewport,D=es(m),E=es(d),z=gx(p,10);function Q(F){if(j.current){const L=F.clientX-j.current.left,U=F.clientY-j.current.top;h({x:L,y:U})}}return S.useEffect(()=>{const F=L=>{const U=L.target;b?.contains(U)&&D(L,_)};return document.addEventListener("wheel",F,{passive:!1}),()=>document.removeEventListener("wheel",F,{passive:!1})},[M,b,_,D]),S.useEffect(E,[r,E]),id(b,z),id(v.content,z),a.jsx(b$,{scope:n,scrollbar:b,hasThumb:s,onThumbChange:es(i),onThumbPointerUp:es(l),onThumbPositionChange:E,onThumbPointerDown:es(c),children:a.jsx(Yt.div,{...x,ref:O,style:{position:"absolute",...x.style},onPointerDown:$e(t.onPointerDown,F=>{F.button===0&&(F.target.setPointerCapture(F.pointerId),j.current=b.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),Q(F))}),onPointerMove:$e(t.onPointerMove,Q),onPointerUp:$e(t.onPointerUp,F=>{const L=F.target;L.hasPointerCapture(F.pointerId)&&L.releasePointerCapture(F.pointerId),document.body.style.webkitUserSelect=T.current,v.viewport&&(v.viewport.style.scrollBehavior=""),j.current=null})})})}),vg="ScrollAreaThumb",GC=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=VC(vg,t.__scopeScrollArea);return a.jsx(Bs,{present:n||s.hasThumb,children:a.jsx(w$,{ref:e,...r})})}),w$=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=Ai(vg,n),l=VC(vg,n),{onThumbPositionChange:c}=l,d=Cn(e,p=>l.onThumbChange(p)),h=S.useRef(void 0),m=gx(()=>{h.current&&(h.current(),h.current=void 0)},100);return S.useEffect(()=>{const p=i.viewport;if(p){const x=()=>{if(m(),!h.current){const v=O$(p,c);h.current=v,c()}};return c(),p.addEventListener("scroll",x),()=>p.removeEventListener("scroll",x)}},[i.viewport,m,c]),a.jsx(Yt.div,{"data-state":l.hasThumb?"visible":"hidden",...s,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:$e(t.onPointerDownCapture,p=>{const v=p.target.getBoundingClientRect(),b=p.clientX-v.left,k=p.clientY-v.top;l.onThumbPointerDown({x:b,y:k})}),onPointerUp:$e(t.onPointerUp,l.onThumbPointerUp)})});GC.displayName=vg;var ow="ScrollAreaCorner",XC=S.forwardRef((t,e)=>{const n=Ai(ow,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(S$,{...t,ref:e}):null});XC.displayName=ow;var S$=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=Ai(ow,n),[i,l]=S.useState(0),[c,d]=S.useState(0),h=!!(i&&c);return id(s.scrollbarX,()=>{const m=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(m),d(m)}),id(s.scrollbarY,()=>{const m=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(m),l(m)}),h?a.jsx(Yt.div,{...r,ref:e,style:{width:i,height:c,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function yg(t){return t?parseInt(t,10):0}function YC(t,e){const n=t/e;return isNaN(n)?0:n}function px(t){const e=YC(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function k$(t,e,n,r="ltr"){const s=px(n),i=s/2,l=e||i,c=s-l,d=n.scrollbar.paddingStart+l,h=n.scrollbar.size-n.scrollbar.paddingEnd-c,m=n.content-n.viewport,p=r==="ltr"?[0,m]:[m*-1,0];return KC([d,h],p)(t)}function IO(t,e,n="ltr"){const r=px(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,l=e.content-e.viewport,c=i-r,d=n==="ltr"?[0,l]:[l*-1,0],h=F4(t,d);return KC([0,l],[0,c])(h)}function KC(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 ZC(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function s(){const i={left:t.scrollLeft,top:t.scrollTop},l=n.left!==i.left,c=n.top!==i.top;(l||c)&&e(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function gx(t,e){const n=es(t),r=S.useRef(0);return S.useEffect(()=>()=>window.clearTimeout(r.current),[]),S.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function id(t,e){const n=es(e);h9(()=>{let r=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(t),()=>{window.cancelAnimationFrame(r),s.unobserve(t)}}},[t,n])}var JC=QC,j$=HC,N$=XC;const fn=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(JC,{ref:r,className:ye("relative overflow-hidden",t),...n,children:[a.jsx(j$,{className:"h-full w-full rounded-[inherit]",children:e}),a.jsx(eT,{}),a.jsx(N$,{})]}));fn.displayName=JC.displayName;const eT=S.forwardRef(({className:t,orientation:e="vertical",...n},r)=>a.jsx(aw,{ref:r,orientation:e,className:ye("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(GC,{className:"relative flex-1 rounded-full bg-border"})}));eT.displayName=aw.displayName;function qO({className:t,...e}){return a.jsx("div",{className:ye("animate-pulse rounded-md bg-primary/10",t),...e})}function C$(t,e=[]){let n=[];function r(i,l){const c=S.createContext(l);c.displayName=i+"Context";const d=n.length;n=[...n,l];const h=p=>{const{scope:x,children:v,...b}=p,k=x?.[t]?.[d]||c,O=S.useMemo(()=>b,Object.values(b));return a.jsx(k.Provider,{value:O,children:v})};h.displayName=i+"Provider";function m(p,x){const v=x?.[t]?.[d]||c,b=S.useContext(v);if(b)return b;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[h,m]}const s=()=>{const i=n.map(l=>S.createContext(l));return function(c){const d=c?.[t]||i;return S.useMemo(()=>({[`__scope${t}`]:{...c,[t]:d}}),[c,d])}};return s.scopeName=t,[r,T$(s,...e)]}function T$(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const l=r.reduce((c,{useScope:d,scopeName:h})=>{const p=d(i)[`__scope${h}`];return{...c,...p}},{});return S.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return n.scopeName=e.scopeName,n}var M$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],tT=M$.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),cw="Progress",uw=100,[A$]=C$(cw),[E$,_$]=A$(cw),nT=S.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=D$,...l}=t;(s||s===0)&&!FO(s)&&console.error(R$(`${s}`,"Progress"));const c=FO(s)?s:uw;r!==null&&!QO(r,c)&&console.error(z$(`${r}`,"Progress"));const d=QO(r,c)?r:null,h=bg(d)?i(d,c):void 0;return a.jsx(E$,{scope:n,value:d,max:c,children:a.jsx(tT.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":bg(d)?d:void 0,"aria-valuetext":h,role:"progressbar","data-state":iT(d,c),"data-value":d??void 0,"data-max":c,...l,ref:e})})});nT.displayName=cw;var rT="ProgressIndicator",sT=S.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=_$(rT,n);return a.jsx(tT.div,{"data-state":iT(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});sT.displayName=rT;function D$(t,e){return`${Math.round(t/e*100)}%`}function iT(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function bg(t){return typeof t=="number"}function FO(t){return bg(t)&&!isNaN(t)&&t>0}function QO(t,e){return bg(t)&&!isNaN(t)&&t<=e&&t>=0}function R$(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${uw}\`.`}function z$(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 ${uw} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. @@ -22,60 +22,60 @@ ${n.map(([i,l])=>{const c=l.theme?.[r]||l.color;return c?` --color-${i}: ${c};` `)} } `).join(` -`)}}):null},Eh=II,_u=S.forwardRef(({active:t,payload:e,className:n,indicator:r="dot",hideLabel:s=!1,hideIndicator:i=!1,label:l,labelFormatter:c,labelClassName:d,formatter:h,color:m,nameKey:p,labelKey:x},v)=>{const{config:b}=oT(),k=S.useMemo(()=>{if(s||!e?.length)return null;const[j]=e,T=`${x||j?.dataKey||j?.name||"value"}`,A=o2(b,j,T),_=!x&&typeof l=="string"?b[l]?.label||l:A?.label;return c?a.jsx("div",{className:ye("font-medium",d),children:c(_,e)}):_?a.jsx("div",{className:ye("font-medium",d),children:_}):null},[l,c,e,s,d,b,x]);if(!t||!e?.length)return null;const O=e.length===1&&r!=="dot";return a.jsxs("div",{ref:v,className:ye("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[O?null:k,a.jsx("div",{className:"grid gap-1.5",children:e.filter(j=>j.type!=="none").map((j,T)=>{const A=`${p||j.name||j.dataKey||"value"}`,_=o2(b,j,A),D=m||j.payload.fill||j.color;return a.jsx("div",{className:ye("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",r==="dot"&&"items-center"),children:h&&j?.value!==void 0&&j.name?h(j.value,j.name,j,T,j.payload):a.jsxs(a.Fragment,{children:[_?.icon?a.jsx(_.icon,{}):!i&&a.jsx("div",{className:ye("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":O&&r==="dashed"}),style:{"--color-bg":D,"--color-border":D}}),a.jsxs("div",{className:ye("flex flex-1 justify-between leading-none",O?"items-end":"items-center"),children:[a.jsxs("div",{className:"grid gap-1.5",children:[O?k:null,a.jsx("span",{className:"text-muted-foreground",children:_?.label||j.name})]}),j.value&&a.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:j.value.toLocaleString()})]})]})},j.dataKey)})})]})});_u.displayName="ChartTooltip";const I$=qI,cT=S.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:s},i)=>{const{config:l}=oT();return n?.length?a.jsx("div",{ref:i,className:ye("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.filter(c=>c.type!=="none").map(c=>{const d=`${s||c.dataKey||"value"}`,h=o2(l,c,d);return a.jsxs("div",{className:ye("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[h?.icon&&!e?a.jsx(h.icon,{}):a.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:c.color}}),h?.label]},c.value)})}):null});cT.displayName="ChartLegend";function o2(t,e,n){if(typeof e!="object"||e===null)return;const r="payload"in e&&typeof e.payload=="object"&&e.payload!==null?e.payload:void 0;let s=n;return n in e&&typeof e[n]=="string"?s=e[n]:r&&n in r&&typeof r[n]=="string"&&(s=r[n]),s in t?t[s]:t[n]}const $O=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,HO=d9,Nd=(t,e)=>n=>{var r;if(e?.variants==null)return HO(t,n?.class,n?.className);const{variants:s,defaultVariants:i}=e,l=Object.keys(s).map(h=>{const m=n?.[h],p=i?.[h];if(m===null)return null;const x=$O(m)||$O(p);return s[h][x]}),c=n&&Object.entries(n).reduce((h,m)=>{let[p,x]=m;return x===void 0||(h[p]=x),h},{}),d=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,m)=>{let{class:p,className:x,...v}=m;return Object.entries(v).every(b=>{let[k,O]=b;return Array.isArray(O)?O.includes({...i,...c}[k]):{...i,...c}[k]===O})?[...h,p,x]:h},[]);return HO(t,l,d,n?.class,n?.className)},ff=Nd("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring 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 shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ie=S.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const l=r?GI:"button";return a.jsx(l,{className:ye(ff({variant:e,size:n,className:t})),ref:i,...s})});ie.displayName="Button";function q$(){const[t,e]=S.useState(null),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(24),[d,h]=S.useState(!0),[m,p]=S.useState(null),[x,v]=S.useState(!0),b=S.useCallback(async()=>{try{v(!0);const F=await Zn.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");p({hitokoto:F.data.hitokoto,from:F.data.from||F.data.from_who||"未知"})}catch(F){console.error("获取一言失败:",F),p({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{v(!1)}},[]),k=S.useCallback(async()=>{try{const F=localStorage.getItem("access-token"),L=await Zn.get(`/api/webui/statistics/dashboard?hours=${l}`,{headers:{Authorization:`Bearer ${F}`}});e(L.data),r(!1),i(100)}catch(F){console.error("Failed to fetch dashboard data:",F),r(!1),i(100)}},[l]);if(S.useEffect(()=>{if(!n)return;i(0);const F=setTimeout(()=>i(15),200),L=setTimeout(()=>i(30),800),U=setTimeout(()=>i(45),2e3),V=setTimeout(()=>i(60),4e3),ce=setTimeout(()=>i(75),6500),W=setTimeout(()=>i(85),9e3),J=setTimeout(()=>i(92),11e3);return()=>{clearTimeout(F),clearTimeout(L),clearTimeout(U),clearTimeout(V),clearTimeout(ce),clearTimeout(W),clearTimeout(J)}},[n]),S.useEffect(()=>{k(),b()},[k,b]),S.useEffect(()=>{if(!d)return;const F=setInterval(()=>{k()},3e4);return()=>clearInterval(F)},[d,k]),n||!t)return a.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:a.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[a.jsx(Fi,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(n0,{value:s,className:"h-2"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[s,"%"]})]})]})});const{summary:O,model_stats:j,hourly_data:T,daily_data:A,recent_activity:_}=t,D=F=>{const L=Math.floor(F/3600),U=Math.floor(F%3600/60);return`${L}小时${U}分钟`},E=F=>new Date(F).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),z=j.slice(0,6).map(F=>({name:F.model_name,value:F.request_count,fill:`hsl(var(--chart-${j.indexOf(F)%5+1}))`})),Q={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(hl,{value:l.toString(),onValueChange:F=>c(Number(F)),children:a.jsxs(ya,{className:"grid grid-cols-3 w-full sm:w-auto",children:[a.jsx($t,{value:"24",children:"24小时"}),a.jsx($t,{value:"168",children:"7天"}),a.jsx($t,{value:"720",children:"30天"})]})}),a.jsxs(ie,{variant:d?"default":"outline",size:"sm",onClick:()=>h(!d),className:"gap-2",children:[a.jsx(Fi,{className:`h-4 w-4 ${d?"animate-spin":""}`}),a.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:k,children:a.jsx(Fi,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"总请求数"}),a.jsx(lq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:O.total_requests.toLocaleString()}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",l<48?l+"小时":Math.floor(l/24)+"天"]})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"总花费"}),a.jsx(oq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:["¥",O.total_cost.toFixed(2)]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:O.cost_per_hour>0?`¥${O.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"Token消耗"}),a.jsx(cq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:[(O.total_tokens/1e3).toFixed(1),"K"]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:O.tokens_per_hour>0?`${(O.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"平均响应"}),a.jsx(uf,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:[O.avg_response_time.toFixed(2),"s"]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"在线时长"}),a.jsx(dc,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsx(an,{children:a.jsx("div",{className:"text-xl font-bold",children:D(O.online_time)})})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"消息处理"}),a.jsx(Wf,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-xl font-bold",children:O.total_messages.toLocaleString()}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",O.total_replies.toLocaleString()," 条"]})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"成本效率"}),a.jsx(uq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-xl font-bold",children:O.total_messages>0?`¥${(O.total_cost/O.total_messages*100).toFixed(2)}`:"¥0.00"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),a.jsxs(hl,{defaultValue:"trends",className:"space-y-4",children:[a.jsxs(ya,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[a.jsx($t,{value:"trends",children:"趋势"}),a.jsx($t,{value:"models",children:"模型"}),a.jsx($t,{value:"activity",children:"活动"}),a.jsx($t,{value:"daily",children:"日统计"})]}),a.jsxs(kn,{value:"trends",className:"space-y-4",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"请求趋势"}),a.jsxs(Sr,{children:["最近",l,"小时的请求量变化"]})]}),a.jsx(an,{children:a.jsx(Eu,{config:Q,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:a.jsxs(FI,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(QI,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"花费趋势"}),a.jsx(Sr,{children:"API调用成本变化"})]}),a.jsx(an,{children:a.jsx(Eu,{config:Q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:a.jsxs(fy,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(Gm,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"Token消耗"}),a.jsx(Sr,{children:"Token使用量变化"})]}),a.jsx(an,{children:a.jsx(Eu,{config:Q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:a.jsxs(fy,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(Gm,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),a.jsx(kn,{value:"models",className:"space-y-4",children:a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"模型请求分布"}),a.jsx(Sr,{children:"各模型使用占比"})]}),a.jsx(an,{children:a.jsx(Eu,{config:Object.fromEntries(j.slice(0,6).map((F,L)=>[F.model_name,{label:F.model_name,color:`hsl(var(--chart-${L%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:a.jsxs($I,{children:[a.jsx(Eh,{content:a.jsx(_u,{})}),a.jsx(HI,{data:z,cx:"50%",cy:"50%",labelLine:!1,label:({name:F,percent:L})=>`${F} ${L?(L*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:z.map((F,L)=>a.jsx(UI,{fill:F.fill},`cell-${L}`))})]})})})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"模型详细统计"}),a.jsx(Sr,{children:"请求数、花费和性能"})]}),a.jsx(an,{children:a.jsx(mn,{className:"h-[300px] sm:h-[400px]",children:a.jsx("div",{className:"space-y-3",children:j.map((F,L)=>a.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:F.model_name}),a.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${L%5+1}))`}})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),a.jsx("span",{className:"ml-1 font-medium",children:F.request_count.toLocaleString()})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"花费:"}),a.jsxs("span",{className:"ml-1 font-medium",children:["¥",F.total_cost.toFixed(2)]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),a.jsxs("span",{className:"ml-1 font-medium",children:[(F.total_tokens/1e3).toFixed(1),"K"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),a.jsxs("span",{className:"ml-1 font-medium",children:[F.avg_response_time.toFixed(2),"s"]})]})]})]},L))})})})]})]})}),a.jsx(kn,{value:"activity",children:a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"最近活动"}),a.jsx(Sr,{children:"最新的API调用记录"})]}),a.jsx(an,{children:a.jsx(mn,{className:"h-[400px] sm:h-[500px]",children:a.jsx("div",{className:"space-y-2",children:_.map((F,L)=>a.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium text-sm truncate",children:F.model}),a.jsx("div",{className:"text-xs text-muted-foreground",children:F.request_type})]}),a.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:E(F.timestamp)})]}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),a.jsx("span",{className:"ml-1",children:F.tokens})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"花费:"}),a.jsxs("span",{className:"ml-1",children:["¥",F.cost.toFixed(4)]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),a.jsxs("span",{className:"ml-1",children:[F.time_cost.toFixed(2),"s"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"状态:"}),a.jsx("span",{className:`ml-1 ${F.status==="success"?"text-green-600":"text-red-600"}`,children:F.status})]})]})]},L))})})})]})}),a.jsx(kn,{value:"daily",children:a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"每日统计"}),a.jsx(Sr,{children:"最近7天的数据汇总"})]}),a.jsx(an,{children:a.jsx(Eu,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:a.jsxs(fy,{data:A,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>{const L=new Date(F);return`${L.getMonth()+1}/${L.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>new Date(F).toLocaleDateString("zh-CN")})}),a.jsx(I$,{content:a.jsx(cT,{})}),a.jsx(Gm,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),a.jsx(Gm,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),a.jsxs(gt,{className:"border-2 border-primary/20",children:[a.jsx(Wt,{className:"pb-3",children:a.jsx(Gt,{className:"text-lg",children:"每日一言"})}),a.jsx(an,{children:x?a.jsxs("div",{className:"space-y-2",children:[a.jsx(qO,{className:"h-6 w-3/4"}),a.jsx(qO,{className:"h-4 w-1/4"})]}):m?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("p",{className:"text-lg font-medium leading-relaxed italic",children:['"',m.hitokoto,'"']}),a.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["—— ",m.from]})]}):null})]})]})})}const F$={theme:"system",setTheme:()=>null},uT=S.createContext(F$),dw=()=>{const t=S.useContext(uT);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},Q$=(t,e,n)=>{const r=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||r){e(t);return}const s=n.clientX,i=n.clientY,l=Math.hypot(Math.max(s,innerWidth-s),Math.max(i,innerHeight-i));document.startViewTransition(()=>{e(t)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${s}px ${i}px)`,`circle(${l}px at ${s}px ${i}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},dT=S.createContext(void 0),hT=()=>{const t=S.useContext(dT);if(t===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return t};var xx="Switch",[$$]=Vi(xx),[H$,U$]=$$(xx),fT=S.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:l,disabled:c,value:d="on",onCheckedChange:h,form:m,...p}=t,[x,v]=S.useState(null),b=Cn(e,A=>v(A)),k=S.useRef(!1),O=x?m||!!x.closest("form"):!0,[j,T]=ko({prop:s,defaultProp:i??!1,onChange:h,caller:xx});return a.jsxs(H$,{scope:n,checked:j,disabled:c,children:[a.jsx(Zt.button,{type:"button",role:"switch","aria-checked":j,"aria-required":l,"data-state":xT(j),"data-disabled":c?"":void 0,disabled:c,value:d,...p,ref:b,onClick:$e(t.onClick,A=>{T(_=>!_),O&&(k.current=A.isPropagationStopped(),k.current||A.stopPropagation())})}),O&&a.jsx(gT,{control:x,bubbles:!k.current,name:r,value:d,checked:j,required:l,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});fT.displayName=xx;var mT="SwitchThumb",pT=S.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=U$(mT,n);return a.jsx(Zt.span,{"data-state":xT(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});pT.displayName=mT;var V$="SwitchBubbleInput",gT=S.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const l=S.useRef(null),c=Cn(l,i),d=f9(n),h=m9(e);return S.useEffect(()=>{const m=l.current;if(!m)return;const p=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(p,"checked").set;if(d!==n&&v){const b=new Event("click",{bubbles:r});v.call(m,n),m.dispatchEvent(b)}},[d,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:c,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});gT.displayName=V$;function xT(t){return t?"checked":"unchecked"}var vT=fT,W$=pT;const jt=S.forwardRef(({className:t,...e},n)=>a.jsx(vT,{className:ye("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm 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(W$,{className:ye("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));jt.displayName=vT.displayName;const G$=Nd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),te=S.forwardRef(({className:t,...e},n)=>a.jsx(p9,{ref:n,className:ye(G$(),t),...e}));te.displayName=p9.displayName;const Me=S.forwardRef(({className:t,type:e,...n},r)=>a.jsx("input",{type:e,className:ye("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors 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-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Me.displayName="Input";const X$=1,Y$=1e6;let Oy=0;function K$(){return Oy=(Oy+1)%Number.MAX_SAFE_INTEGER,Oy.toString()}const jy=new Map,UO=t=>{if(jy.has(t))return;const e=setTimeout(()=>{jy.delete(t),Kh({type:"REMOVE_TOAST",toastId:t})},Y$);jy.set(t,e)},Z$=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,X$)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?UO(n):t.toasts.forEach(r=>{UO(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},Vp=[];let Wp={toasts:[]};function Kh(t){Wp=Z$(Wp,t),Vp.forEach(e=>{e(Wp)})}function J$({...t}){const e=K$(),n=s=>Kh({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>Kh({type:"DISMISS_TOAST",toastId:e});return Kh({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function Pr(){const[t,e]=S.useState(Wp);return S.useEffect(()=>(Vp.push(e),()=>{const n=Vp.indexOf(e);n>-1&&Vp.splice(n,1)}),[t]),{...t,toast:J$,dismiss:n=>Kh({type:"DISMISS_TOAST",toastId:n})}}const eH=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:t=>t.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:t=>/[A-Z]/.test(t)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:t=>/[a-z]/.test(t)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:t=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(t)}];function tH(t){const e=eH.map(r=>({id:r.id,label:r.label,description:r.description,passed:r.validate(t)}));return{isValid:e.every(r=>r.passed),rules:e}}const hw="0.11.5 Beta",fw="MaiBot Dashboard",nH=`${fw} v${hw}`,rH=(t="v")=>`${t}${hw}`,Rr=W4,mw=g9,sH=$4,yT=S.forwardRef(({className:t,...e},n)=>a.jsx(nx,{ref:n,className:ye("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}));yT.displayName=nx.displayName;const Nr=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(sH,{children:[a.jsx(yT,{}),a.jsxs(rx,{ref:r,className:ye("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(H4,{className:"absolute right-4 top-4 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(Gf,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Nr.displayName=rx.displayName;const Cr=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Cr.displayName="DialogHeader";const ps=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ps.displayName="DialogFooter";const Tr=S.forwardRef(({className:t,...e},n)=>a.jsx(U4,{ref:n,className:ye("text-lg font-semibold leading-none tracking-tight",t),...e}));Tr.displayName=U4.displayName;const Gr=S.forwardRef(({className:t,...e},n)=>a.jsx(V4,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Gr.displayName=V4.displayName;var iH=Symbol("radix.slottable");function aH(t){const e=({children:n})=>a.jsx(a.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=iH,e}var bT="AlertDialog",[lH]=Vi(bT,[x9]),bl=x9(),wT=t=>{const{__scopeAlertDialog:e,...n}=t,r=bl(e);return a.jsx(W4,{...r,...n,modal:!0})};wT.displayName=bT;var oH="AlertDialogTrigger",ST=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(g9,{...s,...r,ref:e})});ST.displayName=oH;var cH="AlertDialogPortal",kT=t=>{const{__scopeAlertDialog:e,...n}=t,r=bl(e);return a.jsx($4,{...r,...n})};kT.displayName=cH;var uH="AlertDialogOverlay",OT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(nx,{...s,...r,ref:e})});OT.displayName=uH;var Uu="AlertDialogContent",[dH,hH]=lH(Uu),fH=aH("AlertDialogContent"),jT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=bl(n),l=S.useRef(null),c=Cn(e,l),d=S.useRef(null);return a.jsx(XI,{contentName:Uu,titleName:NT,docsSlug:"alert-dialog",children:a.jsx(dH,{scope:n,cancelRef:d,children:a.jsxs(rx,{role:"alertdialog",...i,...s,ref:c,onOpenAutoFocus:$e(s.onOpenAutoFocus,h=>{h.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:[a.jsx(fH,{children:r}),a.jsx(pH,{contentRef:l})]})})})});jT.displayName=Uu;var NT="AlertDialogTitle",CT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(U4,{...s,...r,ref:e})});CT.displayName=NT;var TT="AlertDialogDescription",AT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(V4,{...s,...r,ref:e})});AT.displayName=TT;var mH="AlertDialogAction",MT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(H4,{...s,...r,ref:e})});MT.displayName=mH;var ET="AlertDialogCancel",_T=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=hH(ET,n),i=bl(n),l=Cn(e,s);return a.jsx(H4,{...i,...r,ref:l})});_T.displayName=ET;var pH=({contentRef:t})=>{const e=`\`${Uu}\` requires a description for the component to be accessible for screen reader users. +`)}}):null},Eh=II,_u=S.forwardRef(({active:t,payload:e,className:n,indicator:r="dot",hideLabel:s=!1,hideIndicator:i=!1,label:l,labelFormatter:c,labelClassName:d,formatter:h,color:m,nameKey:p,labelKey:x},v)=>{const{config:b}=oT(),k=S.useMemo(()=>{if(s||!e?.length)return null;const[j]=e,T=`${x||j?.dataKey||j?.name||"value"}`,M=o2(b,j,T),_=!x&&typeof l=="string"?b[l]?.label||l:M?.label;return c?a.jsx("div",{className:ye("font-medium",d),children:c(_,e)}):_?a.jsx("div",{className:ye("font-medium",d),children:_}):null},[l,c,e,s,d,b,x]);if(!t||!e?.length)return null;const O=e.length===1&&r!=="dot";return a.jsxs("div",{ref:v,className:ye("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[O?null:k,a.jsx("div",{className:"grid gap-1.5",children:e.filter(j=>j.type!=="none").map((j,T)=>{const M=`${p||j.name||j.dataKey||"value"}`,_=o2(b,j,M),D=m||j.payload.fill||j.color;return a.jsx("div",{className:ye("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",r==="dot"&&"items-center"),children:h&&j?.value!==void 0&&j.name?h(j.value,j.name,j,T,j.payload):a.jsxs(a.Fragment,{children:[_?.icon?a.jsx(_.icon,{}):!i&&a.jsx("div",{className:ye("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":O&&r==="dashed"}),style:{"--color-bg":D,"--color-border":D}}),a.jsxs("div",{className:ye("flex flex-1 justify-between leading-none",O?"items-end":"items-center"),children:[a.jsxs("div",{className:"grid gap-1.5",children:[O?k:null,a.jsx("span",{className:"text-muted-foreground",children:_?.label||j.name})]}),j.value&&a.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:j.value.toLocaleString()})]})]})},j.dataKey)})})]})});_u.displayName="ChartTooltip";const I$=qI,cT=S.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:s},i)=>{const{config:l}=oT();return n?.length?a.jsx("div",{ref:i,className:ye("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.filter(c=>c.type!=="none").map(c=>{const d=`${s||c.dataKey||"value"}`,h=o2(l,c,d);return a.jsxs("div",{className:ye("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[h?.icon&&!e?a.jsx(h.icon,{}):a.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:c.color}}),h?.label]},c.value)})}):null});cT.displayName="ChartLegend";function o2(t,e,n){if(typeof e!="object"||e===null)return;const r="payload"in e&&typeof e.payload=="object"&&e.payload!==null?e.payload:void 0;let s=n;return n in e&&typeof e[n]=="string"?s=e[n]:r&&n in r&&typeof r[n]=="string"&&(s=r[n]),s in t?t[s]:t[n]}const $O=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,HO=d9,Nd=(t,e)=>n=>{var r;if(e?.variants==null)return HO(t,n?.class,n?.className);const{variants:s,defaultVariants:i}=e,l=Object.keys(s).map(h=>{const m=n?.[h],p=i?.[h];if(m===null)return null;const x=$O(m)||$O(p);return s[h][x]}),c=n&&Object.entries(n).reduce((h,m)=>{let[p,x]=m;return x===void 0||(h[p]=x),h},{}),d=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,m)=>{let{class:p,className:x,...v}=m;return Object.entries(v).every(b=>{let[k,O]=b;return Array.isArray(O)?O.includes({...i,...c}[k]):{...i,...c}[k]===O})?[...h,p,x]:h},[]);return HO(t,l,d,n?.class,n?.className)},ff=Nd("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring 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 shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ie=S.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const l=r?GI:"button";return a.jsx(l,{className:ye(ff({variant:e,size:n,className:t})),ref:i,...s})});ie.displayName="Button";function q$(){const[t,e]=S.useState(null),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(24),[d,h]=S.useState(!0),[m,p]=S.useState(null),[x,v]=S.useState(!0),b=S.useCallback(async()=>{try{v(!0);const F=await Zn.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");p({hitokoto:F.data.hitokoto,from:F.data.from||F.data.from_who||"未知"})}catch(F){console.error("获取一言失败:",F),p({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{v(!1)}},[]),k=S.useCallback(async()=>{try{const F=localStorage.getItem("access-token"),L=await Zn.get(`/api/webui/statistics/dashboard?hours=${l}`,{headers:{Authorization:`Bearer ${F}`}});e(L.data),r(!1),i(100)}catch(F){console.error("Failed to fetch dashboard data:",F),r(!1),i(100)}},[l]);if(S.useEffect(()=>{if(!n)return;i(0);const F=setTimeout(()=>i(15),200),L=setTimeout(()=>i(30),800),U=setTimeout(()=>i(45),2e3),V=setTimeout(()=>i(60),4e3),ce=setTimeout(()=>i(75),6500),W=setTimeout(()=>i(85),9e3),J=setTimeout(()=>i(92),11e3);return()=>{clearTimeout(F),clearTimeout(L),clearTimeout(U),clearTimeout(V),clearTimeout(ce),clearTimeout(W),clearTimeout(J)}},[n]),S.useEffect(()=>{k(),b()},[k,b]),S.useEffect(()=>{if(!d)return;const F=setInterval(()=>{k()},3e4);return()=>clearInterval(F)},[d,k]),n||!t)return a.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:a.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[a.jsx(Ii,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(n0,{value:s,className:"h-2"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[s,"%"]})]})]})});const{summary:O,model_stats:j,hourly_data:T,daily_data:M,recent_activity:_}=t,D=F=>{const L=Math.floor(F/3600),U=Math.floor(F%3600/60);return`${L}小时${U}分钟`},E=F=>new Date(F).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),z=j.slice(0,6).map(F=>({name:F.model_name,value:F.request_count,fill:`hsl(var(--chart-${j.indexOf(F)%5+1}))`})),Q={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return a.jsx(fn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(dl,{value:l.toString(),onValueChange:F=>c(Number(F)),children:a.jsxs(va,{className:"grid grid-cols-3 w-full sm:w-auto",children:[a.jsx($t,{value:"24",children:"24小时"}),a.jsx($t,{value:"168",children:"7天"}),a.jsx($t,{value:"720",children:"30天"})]})}),a.jsxs(ie,{variant:d?"default":"outline",size:"sm",onClick:()=>h(!d),className:"gap-2",children:[a.jsx(Ii,{className:`h-4 w-4 ${d?"animate-spin":""}`}),a.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:k,children:a.jsx(Ii,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"总请求数"}),a.jsx(lq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(vn,{children:[a.jsx("div",{className:"text-2xl font-bold",children:O.total_requests.toLocaleString()}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",l<48?l+"小时":Math.floor(l/24)+"天"]})]})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"总花费"}),a.jsx(oq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(vn,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:["¥",O.total_cost.toFixed(2)]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:O.cost_per_hour>0?`¥${O.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"Token消耗"}),a.jsx(cq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(vn,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:[(O.total_tokens/1e3).toFixed(1),"K"]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:O.tokens_per_hour>0?`${(O.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"平均响应"}),a.jsx(uf,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(vn,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:[O.avg_response_time.toFixed(2),"s"]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"在线时长"}),a.jsx(uc,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsx(vn,{children:a.jsx("div",{className:"text-xl font-bold",children:D(O.online_time)})})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"消息处理"}),a.jsx(Wf,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(vn,{children:[a.jsx("div",{className:"text-xl font-bold",children:O.total_messages.toLocaleString()}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",O.total_replies.toLocaleString()," 条"]})]})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"成本效率"}),a.jsx(uq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(vn,{children:[a.jsx("div",{className:"text-xl font-bold",children:O.total_messages>0?`¥${(O.total_cost/O.total_messages*100).toFixed(2)}`:"¥0.00"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),a.jsxs(dl,{defaultValue:"trends",className:"space-y-4",children:[a.jsxs(va,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[a.jsx($t,{value:"trends",children:"趋势"}),a.jsx($t,{value:"models",children:"模型"}),a.jsx($t,{value:"activity",children:"活动"}),a.jsx($t,{value:"daily",children:"日统计"})]}),a.jsxs(kn,{value:"trends",className:"space-y-4",children:[a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"请求趋势"}),a.jsxs(Sr,{children:["最近",l,"小时的请求量变化"]})]}),a.jsx(vn,{children:a.jsx(Eu,{config:Q,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:a.jsxs(FI,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(QI,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"花费趋势"}),a.jsx(Sr,{children:"API调用成本变化"})]}),a.jsx(vn,{children:a.jsx(Eu,{config:Q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:a.jsxs(fy,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(Gm,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"Token消耗"}),a.jsx(Sr,{children:"Token使用量变化"})]}),a.jsx(vn,{children:a.jsx(Eu,{config:Q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:a.jsxs(fy,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(Gm,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),a.jsx(kn,{value:"models",className:"space-y-4",children:a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"模型请求分布"}),a.jsx(Sr,{children:"各模型使用占比"})]}),a.jsx(vn,{children:a.jsx(Eu,{config:Object.fromEntries(j.slice(0,6).map((F,L)=>[F.model_name,{label:F.model_name,color:`hsl(var(--chart-${L%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:a.jsxs($I,{children:[a.jsx(Eh,{content:a.jsx(_u,{})}),a.jsx(HI,{data:z,cx:"50%",cy:"50%",labelLine:!1,label:({name:F,percent:L})=>`${F} ${L?(L*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:z.map((F,L)=>a.jsx(UI,{fill:F.fill},`cell-${L}`))})]})})})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"模型详细统计"}),a.jsx(Sr,{children:"请求数、花费和性能"})]}),a.jsx(vn,{children:a.jsx(fn,{className:"h-[300px] sm:h-[400px]",children:a.jsx("div",{className:"space-y-3",children:j.map((F,L)=>a.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:F.model_name}),a.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${L%5+1}))`}})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),a.jsx("span",{className:"ml-1 font-medium",children:F.request_count.toLocaleString()})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"花费:"}),a.jsxs("span",{className:"ml-1 font-medium",children:["¥",F.total_cost.toFixed(2)]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),a.jsxs("span",{className:"ml-1 font-medium",children:[(F.total_tokens/1e3).toFixed(1),"K"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),a.jsxs("span",{className:"ml-1 font-medium",children:[F.avg_response_time.toFixed(2),"s"]})]})]})]},L))})})})]})]})}),a.jsx(kn,{value:"activity",children:a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"最近活动"}),a.jsx(Sr,{children:"最新的API调用记录"})]}),a.jsx(vn,{children:a.jsx(fn,{className:"h-[400px] sm:h-[500px]",children:a.jsx("div",{className:"space-y-2",children:_.map((F,L)=>a.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium text-sm truncate",children:F.model}),a.jsx("div",{className:"text-xs text-muted-foreground",children:F.request_type})]}),a.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:E(F.timestamp)})]}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),a.jsx("span",{className:"ml-1",children:F.tokens})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"花费:"}),a.jsxs("span",{className:"ml-1",children:["¥",F.cost.toFixed(4)]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),a.jsxs("span",{className:"ml-1",children:[F.time_cost.toFixed(2),"s"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"状态:"}),a.jsx("span",{className:`ml-1 ${F.status==="success"?"text-green-600":"text-red-600"}`,children:F.status})]})]})]},L))})})})]})}),a.jsx(kn,{value:"daily",children:a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"每日统计"}),a.jsx(Sr,{children:"最近7天的数据汇总"})]}),a.jsx(vn,{children:a.jsx(Eu,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:a.jsxs(fy,{data:M,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>{const L=new Date(F);return`${L.getMonth()+1}/${L.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>new Date(F).toLocaleDateString("zh-CN")})}),a.jsx(I$,{content:a.jsx(cT,{})}),a.jsx(Gm,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),a.jsx(Gm,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),a.jsxs(yt,{className:"border-2 border-primary/20",children:[a.jsx(Jt,{className:"pb-3",children:a.jsx(en,{className:"text-lg",children:"每日一言"})}),a.jsx(vn,{children:x?a.jsxs("div",{className:"space-y-2",children:[a.jsx(qO,{className:"h-6 w-3/4"}),a.jsx(qO,{className:"h-4 w-1/4"})]}):m?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("p",{className:"text-lg font-medium leading-relaxed italic",children:['"',m.hitokoto,'"']}),a.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["—— ",m.from]})]}):null})]})]})})}const F$={theme:"system",setTheme:()=>null},uT=S.createContext(F$),dw=()=>{const t=S.useContext(uT);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},Q$=(t,e,n)=>{const r=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||r){e(t);return}const s=n.clientX,i=n.clientY,l=Math.hypot(Math.max(s,innerWidth-s),Math.max(i,innerHeight-i));document.startViewTransition(()=>{e(t)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${s}px ${i}px)`,`circle(${l}px at ${s}px ${i}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},dT=S.createContext(void 0),hT=()=>{const t=S.useContext(dT);if(t===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return t};var xx="Switch",[$$]=Hi(xx),[H$,U$]=$$(xx),fT=S.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:l,disabled:c,value:d="on",onCheckedChange:h,form:m,...p}=t,[x,v]=S.useState(null),b=Cn(e,M=>v(M)),k=S.useRef(!1),O=x?m||!!x.closest("form"):!0,[j,T]=So({prop:s,defaultProp:i??!1,onChange:h,caller:xx});return a.jsxs(H$,{scope:n,checked:j,disabled:c,children:[a.jsx(Yt.button,{type:"button",role:"switch","aria-checked":j,"aria-required":l,"data-state":xT(j),"data-disabled":c?"":void 0,disabled:c,value:d,...p,ref:b,onClick:$e(t.onClick,M=>{T(_=>!_),O&&(k.current=M.isPropagationStopped(),k.current||M.stopPropagation())})}),O&&a.jsx(gT,{control:x,bubbles:!k.current,name:r,value:d,checked:j,required:l,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});fT.displayName=xx;var mT="SwitchThumb",pT=S.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=U$(mT,n);return a.jsx(Yt.span,{"data-state":xT(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});pT.displayName=mT;var V$="SwitchBubbleInput",gT=S.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const l=S.useRef(null),c=Cn(l,i),d=f9(n),h=m9(e);return S.useEffect(()=>{const m=l.current;if(!m)return;const p=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(p,"checked").set;if(d!==n&&v){const b=new Event("click",{bubbles:r});v.call(m,n),m.dispatchEvent(b)}},[d,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:c,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});gT.displayName=V$;function xT(t){return t?"checked":"unchecked"}var vT=fT,W$=pT;const jt=S.forwardRef(({className:t,...e},n)=>a.jsx(vT,{className:ye("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm 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(W$,{className:ye("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));jt.displayName=vT.displayName;const G$=Nd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),te=S.forwardRef(({className:t,...e},n)=>a.jsx(p9,{ref:n,className:ye(G$(),t),...e}));te.displayName=p9.displayName;const Ae=S.forwardRef(({className:t,type:e,...n},r)=>a.jsx("input",{type:e,className:ye("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors 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-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Ae.displayName="Input";const X$=1,Y$=1e6;let Oy=0;function K$(){return Oy=(Oy+1)%Number.MAX_SAFE_INTEGER,Oy.toString()}const jy=new Map,UO=t=>{if(jy.has(t))return;const e=setTimeout(()=>{jy.delete(t),Kh({type:"REMOVE_TOAST",toastId:t})},Y$);jy.set(t,e)},Z$=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,X$)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?UO(n):t.toasts.forEach(r=>{UO(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},Vp=[];let Wp={toasts:[]};function Kh(t){Wp=Z$(Wp,t),Vp.forEach(e=>{e(Wp)})}function J$({...t}){const e=K$(),n=s=>Kh({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>Kh({type:"DISMISS_TOAST",toastId:e});return Kh({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function Pr(){const[t,e]=S.useState(Wp);return S.useEffect(()=>(Vp.push(e),()=>{const n=Vp.indexOf(e);n>-1&&Vp.splice(n,1)}),[t]),{...t,toast:J$,dismiss:n=>Kh({type:"DISMISS_TOAST",toastId:n})}}const eH=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:t=>t.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:t=>/[A-Z]/.test(t)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:t=>/[a-z]/.test(t)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:t=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(t)}];function tH(t){const e=eH.map(r=>({id:r.id,label:r.label,description:r.description,passed:r.validate(t)}));return{isValid:e.every(r=>r.passed),rules:e}}const hw="0.11.5",fw="MaiBot Dashboard",nH=`${fw} v${hw}`,rH=(t="v")=>`${t}${hw}`,Rr=W4,mw=g9,sH=$4,yT=S.forwardRef(({className:t,...e},n)=>a.jsx(nx,{ref:n,className:ye("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}));yT.displayName=nx.displayName;const Nr=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(sH,{children:[a.jsx(yT,{}),a.jsxs(rx,{ref:r,className:ye("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(H4,{className:"absolute right-4 top-4 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(Gf,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Nr.displayName=rx.displayName;const Cr=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Cr.displayName="DialogHeader";const ps=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ps.displayName="DialogFooter";const Tr=S.forwardRef(({className:t,...e},n)=>a.jsx(U4,{ref:n,className:ye("text-lg font-semibold leading-none tracking-tight",t),...e}));Tr.displayName=U4.displayName;const Gr=S.forwardRef(({className:t,...e},n)=>a.jsx(V4,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Gr.displayName=V4.displayName;var iH=Symbol("radix.slottable");function aH(t){const e=({children:n})=>a.jsx(a.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=iH,e}var bT="AlertDialog",[lH]=Hi(bT,[x9]),yl=x9(),wT=t=>{const{__scopeAlertDialog:e,...n}=t,r=yl(e);return a.jsx(W4,{...r,...n,modal:!0})};wT.displayName=bT;var oH="AlertDialogTrigger",ST=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return a.jsx(g9,{...s,...r,ref:e})});ST.displayName=oH;var cH="AlertDialogPortal",kT=t=>{const{__scopeAlertDialog:e,...n}=t,r=yl(e);return a.jsx($4,{...r,...n})};kT.displayName=cH;var uH="AlertDialogOverlay",OT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return a.jsx(nx,{...s,...r,ref:e})});OT.displayName=uH;var Uu="AlertDialogContent",[dH,hH]=lH(Uu),fH=aH("AlertDialogContent"),jT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=yl(n),l=S.useRef(null),c=Cn(e,l),d=S.useRef(null);return a.jsx(XI,{contentName:Uu,titleName:NT,docsSlug:"alert-dialog",children:a.jsx(dH,{scope:n,cancelRef:d,children:a.jsxs(rx,{role:"alertdialog",...i,...s,ref:c,onOpenAutoFocus:$e(s.onOpenAutoFocus,h=>{h.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:[a.jsx(fH,{children:r}),a.jsx(pH,{contentRef:l})]})})})});jT.displayName=Uu;var NT="AlertDialogTitle",CT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return a.jsx(U4,{...s,...r,ref:e})});CT.displayName=NT;var TT="AlertDialogDescription",MT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return a.jsx(V4,{...s,...r,ref:e})});MT.displayName=TT;var mH="AlertDialogAction",AT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return a.jsx(H4,{...s,...r,ref:e})});AT.displayName=mH;var ET="AlertDialogCancel",_T=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=hH(ET,n),i=yl(n),l=Cn(e,s);return a.jsx(H4,{...i,...r,ref:l})});_T.displayName=ET;var pH=({contentRef:t})=>{const e=`\`${Uu}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${Uu}\` by passing a \`${TT}\` 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 \`${Uu}\`. 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 S.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},gH=wT,xH=ST,vH=kT,DT=OT,RT=jT,zT=MT,PT=_T,BT=CT,LT=AT;const pn=gH,jr=xH,yH=vH,IT=S.forwardRef(({className:t,...e},n)=>a.jsx(DT,{className:ye("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}));IT.displayName=DT.displayName;const ln=S.forwardRef(({className:t,...e},n)=>a.jsxs(yH,{children:[a.jsx(IT,{}),a.jsx(RT,{ref:n,className:ye("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})]}));ln.displayName=RT.displayName;const on=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col space-y-2 text-center sm:text-left",t),...e});on.displayName="AlertDialogHeader";const cn=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});cn.displayName="AlertDialogFooter";const un=S.forwardRef(({className:t,...e},n)=>a.jsx(BT,{ref:n,className:ye("text-lg font-semibold",t),...e}));un.displayName=BT.displayName;const dn=S.forwardRef(({className:t,...e},n)=>a.jsx(LT,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));dn.displayName=LT.displayName;const hn=S.forwardRef(({className:t,...e},n)=>a.jsx(zT,{ref:n,className:ye(ff(),t),...e}));hn.displayName=zT.displayName;const fn=S.forwardRef(({className:t,...e},n)=>a.jsx(PT,{ref:n,className:ye(ff({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));fn.displayName=PT.displayName;function bH(){return a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),a.jsxs(hl,{defaultValue:"appearance",className:"w-full",children:[a.jsxs(ya,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[a.jsxs($t,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(_9,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"外观"})]}),a.jsxs($t,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(dq,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"安全"})]}),a.jsxs($t,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(Ii,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"其他"})]}),a.jsxs($t,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(co,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"关于"})]})]}),a.jsxs(mn,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[a.jsx(kn,{value:"appearance",className:"mt-0",children:a.jsx(wH,{})}),a.jsx(kn,{value:"security",className:"mt-0",children:a.jsx(SH,{})}),a.jsx(kn,{value:"other",className:"mt-0",children:a.jsx(kH,{})}),a.jsx(kn,{value:"about",className:"mt-0",children:a.jsx(OH,{})})]})]})]})}function VO(t){const e=document.documentElement,r={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[t];if(r)e.style.setProperty("--primary",r.hsl),r.gradient?(e.style.setProperty("--primary-gradient",r.gradient),e.classList.add("has-gradient")):(e.style.removeProperty("--primary-gradient"),e.classList.remove("has-gradient"));else if(t.startsWith("#")){const s=i=>{i=i.replace("#","");const l=parseInt(i.substring(0,2),16)/255,c=parseInt(i.substring(2,4),16)/255,d=parseInt(i.substring(4,6),16)/255,h=Math.max(l,c,d),m=Math.min(l,c,d);let p=0,x=0;const v=(h+m)/2;if(h!==m){const b=h-m;switch(x=v>.5?b/(2-h-m):b/(h+m),h){case l:p=((c-d)/b+(clocalStorage.getItem("accent-color")||"blue");S.useEffect(()=>{const h=localStorage.getItem("accent-color")||"blue";VO(h)},[]);const d=h=>{c(h),localStorage.setItem("accent-color",h),VO(h)};return a.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[a.jsx(Ny,{value:"light",current:t,onChange:e,label:"浅色",description:"始终使用浅色主题"}),a.jsx(Ny,{value:"dark",current:t,onChange:e,label:"深色",description:"始终使用深色主题"}),a.jsx(Ny,{value:"system",current:t,onChange:e,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),a.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[a.jsx(vi,{value:"blue",current:l,onChange:d,label:"蓝色",colorClass:"bg-blue-500"}),a.jsx(vi,{value:"purple",current:l,onChange:d,label:"紫色",colorClass:"bg-purple-500"}),a.jsx(vi,{value:"green",current:l,onChange:d,label:"绿色",colorClass:"bg-green-500"}),a.jsx(vi,{value:"orange",current:l,onChange:d,label:"橙色",colorClass:"bg-orange-500"}),a.jsx(vi,{value:"pink",current:l,onChange:d,label:"粉色",colorClass:"bg-pink-500"}),a.jsx(vi,{value:"red",current:l,onChange:d,label:"红色",colorClass:"bg-red-500"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),a.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[a.jsx(vi,{value:"gradient-sunset",current:l,onChange:d,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),a.jsx(vi,{value:"gradient-ocean",current:l,onChange:d,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),a.jsx(vi,{value:"gradient-forest",current:l,onChange:d,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),a.jsx(vi,{value:"gradient-aurora",current:l,onChange:d,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),a.jsx(vi,{value:"gradient-fire",current:l,onChange:d,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),a.jsx(vi,{value:"gradient-twilight",current:l,onChange:d,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[a.jsx("div",{className:"flex-1",children:a.jsx("input",{type:"color",value:l.startsWith("#")?l:"#3b82f6",onChange:h=>d(h.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),a.jsx("div",{className:"flex-1",children:a.jsx(Me,{type:"text",value:l,onChange:h=>d(h.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),a.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),a.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[a.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5 flex-1",children:[a.jsx(te,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),a.jsx(jt,{id:"animations",checked:n,onCheckedChange:r})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5 flex-1",children:[a.jsx(te,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),a.jsx(jt,{id:"waves-background",checked:s,onCheckedChange:i})]})})]})]})]})}function SH(){const t=wa(),[e,n]=S.useState(""),[r,s]=S.useState(""),[i,l]=S.useState(!1),[c,d]=S.useState(!1),[h,m]=S.useState(!1),[p,x]=S.useState(!1),[v,b]=S.useState(!1),[k,O]=S.useState(!1),[j,T]=S.useState(""),[A,_]=S.useState(!1),{toast:D}=Pr(),E=S.useMemo(()=>tH(r),[r]),z=()=>localStorage.getItem("access-token")||"",Q=async W=>{try{await navigator.clipboard.writeText(W),b(!0),D({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>b(!1),2e3)}catch{D({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},F=async()=>{if(!r.trim()){D({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!E.isValid){const W=E.rules.filter(J=>!J.passed).map(J=>J.label).join(", ");D({title:"格式错误",description:`Token 不符合要求: ${W}`,variant:"destructive"});return}m(!0);try{const W=z(),J=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${W}`},body:JSON.stringify({new_token:r.trim()})}),$=await J.json();J.ok&&$.success?(localStorage.setItem("access-token",r.trim()),s(""),e&&n(r.trim()),D({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},1500)):D({title:"更新失败",description:$.message||"无法更新 Token",variant:"destructive"})}catch(W){console.error("更新 Token 错误:",W),D({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{m(!1)}},L=async()=>{x(!0);try{const W=z(),J=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${W}`}}),$=await J.json();J.ok&&$.success?(localStorage.setItem("access-token",$.token),n($.token),T($.token),O(!0),_(!1),D({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):D({title:"生成失败",description:$.message||"无法生成新 Token",variant:"destructive"})}catch(W){console.error("生成 Token 错误:",W),D({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{x(!1)}},U=async()=>{try{await navigator.clipboard.writeText(j),_(!0),D({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{D({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},V=()=>{O(!1),setTimeout(()=>{T(""),_(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},500)},ce=W=>{W||V()};return a.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[a.jsx(Rr,{open:k,onOpenChange:ce,children:a.jsxs(Nr,{className:"sm:max-w-md",children:[a.jsxs(Cr,{children:[a.jsxs(Tr,{className:"flex items-center gap-2",children:[a.jsx(Hu,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),a.jsx(Gr,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[a.jsx(te,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),a.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:j})]}),a.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Hu,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),a.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[a.jsx("p",{className:"font-semibold",children:"重要提示"}),a.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[a.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),a.jsx("li",{children:"请立即复制并保存到安全的位置"}),a.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),a.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),a.jsxs(ps,{className:"gap-2 sm:gap-0",children:[a.jsx(ie,{variant:"outline",onClick:U,className:"gap-2",children:A?a.jsxs(a.Fragment,{children:[a.jsx(hc,{className:"h-4 w-4 text-green-500"}),"已复制"]}):a.jsxs(a.Fragment,{children:[a.jsx(Xb,{className:"h-4 w-4"}),"复制 Token"]})}),a.jsx(ie,{onClick:V,children:"我已保存,关闭"})]})]})}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),a.jsx("div",{className:"space-y-3 sm:space-y-4",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(Me,{id:"current-token",type:i?"text":"password",value:e||z(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),a.jsx("button",{onClick:()=>{e||n(z()),l(!i)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:i?"隐藏":"显示",children:i?a.jsx(Yb,{className:"h-4 w-4 text-muted-foreground"}):a.jsx($i,{className:"h-4 w-4 text-muted-foreground"})})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[a.jsx(ie,{variant:"outline",size:"icon",onClick:()=>Q(z()),title:"复制到剪贴板",className:"flex-shrink-0",children:v?a.jsx(hc,{className:"h-4 w-4 text-green-500"}):a.jsx(Xb,{className:"h-4 w-4"})}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{variant:"outline",disabled:p,className:"gap-2 flex-1 sm:flex-none",children:[a.jsx(Fi,{className:ye("h-4 w-4",p&&"animate-spin")}),a.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),a.jsx("span",{className:"sm:hidden",children:"生成"})]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重新生成 Token"}),a.jsx(dn,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:L,children:"确认生成"})]})]})]})]})]}),a.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),a.jsxs("div",{className:"relative",children:[a.jsx(Me,{id:"new-token",type:c?"text":"password",value:r,onChange:W=>s(W.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),a.jsx("button",{onClick:()=>d(!c),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:c?"隐藏":"显示",children:c?a.jsx(Yb,{className:"h-4 w-4 text-muted-foreground"}):a.jsx($i,{className:"h-4 w-4 text-muted-foreground"})})]}),r&&a.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),a.jsx("div",{className:"space-y-1.5",children:E.rules.map(W=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[W.passed?a.jsx(Es,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):a.jsx(Kb,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),a.jsx("span",{className:ye(W.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:W.label})]},W.id))}),E.isValid&&a.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:a.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[a.jsx(hc,{className:"h-4 w-4"}),a.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),a.jsx(ie,{onClick:F,disabled:h||!E.isValid||!r,className:"w-full sm:w-auto",children:h?"更新中...":"更新自定义 Token"})]})]}),a.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[a.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),a.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),a.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),a.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),a.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),a.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),a.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function kH(){const t=wa(),{toast:e}=Pr(),[n,r]=S.useState(!1),s=async()=>{r(!0);try{const i=localStorage.getItem("access-token"),l=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${i}`}}),c=await l.json();l.ok&&c.success?(e({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{t({to:"/setup"})},1e3)):e({title:"重置失败",description:c.message||"无法重置配置状态",variant:"destructive"})}catch(i){console.error("重置配置状态错误:",i),e({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{r(!1)}};return a.jsx("div",{className:"space-y-4 sm:space-y-6",children:a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsx("div",{className:"space-y-2",children:a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{variant:"outline",disabled:n,className:"gap-2",children:[a.jsx(hq,{className:ye("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重新配置"}),a.jsx(dn,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:s,children:"确认重置"})]})]})]})]})]})})}function OH(){return a.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",fw]}),a.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[a.jsxs("p",{children:["版本: ",hw]}),a.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),a.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",a.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"React 19.2.0"}),a.jsx("li",{children:"TypeScript 5.7.2"}),a.jsx("li",{children:"Vite 6.0.7"}),a.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"shadcn/ui"}),a.jsx("li",{children:"Radix UI"}),a.jsx("li",{children:"Tailwind CSS 3.4.17"}),a.jsx("li",{children:"Lucide Icons"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"后端"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"Python 3.12+"}),a.jsx("li",{children:"FastAPI"}),a.jsx("li",{children:"Uvicorn"}),a.jsx("li",{children:"WebSocket"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"Bun / npm"}),a.jsx("li",{children:"ESLint 9.17.0"}),a.jsx("li",{children:"PostCSS"})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),a.jsx(mn,{className:"h-[300px] sm:h-[400px]",children:a.jsxs("div",{className:"space-y-4 pr-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"React",description:"用户界面构建库",license:"MIT"}),a.jsx(Gn,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),a.jsx(Gn,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),a.jsx(Gn,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),a.jsx(Gn,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),a.jsx(Gn,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),a.jsx(Gn,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),a.jsx(Gn,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),a.jsx(Gn,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),a.jsx(Gn,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),a.jsx(Gn,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),a.jsx(Gn,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),a.jsx(Gn,{name:"Pydantic",description:"数据验证库",license:"MIT"}),a.jsx(Gn,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),a.jsx(Gn,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),a.jsx(Gn,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),a.jsx(Gn,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:a.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:a.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Gn({name:t,description:e,license:n}){return a.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium text-foreground truncate",children:t}),a.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:e})]}),a.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:n})]})}function Ny({value:t,current:e,onChange:n,label:r,description:s}){const i=e===t;return a.jsxs("button",{onClick:()=>n(t),className:ye("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&a.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-sm sm:text-base font-medium",children:r}),a.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:s})]}),a.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[t==="light"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),t==="dark"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),t==="system"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function vi({value:t,current:e,onChange:n,label:r,colorClass:s}){const i=e===t;return a.jsxs("button",{onClick:()=>n(t),className:ye("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&a.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),a.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[a.jsx("div",{className:ye("h-8 w-8 sm:h-10 sm:w-10 rounded-full",s)}),a.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:r})]})]})}class jH{grad3;p;perm;constructor(e=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let n=0;n<256;n++)this.p[n]=Math.floor(Math.random()*256);this.perm=[];for(let n=0;n<512;n++)this.perm[n]=this.p[n&255]}dot(e,n,r){return e[0]*n+e[1]*r}mix(e,n,r){return(1-r)*e+r*n}fade(e){return e*e*e*(e*(e*6-15)+10)}perlin2(e,n){const r=Math.floor(e)&255,s=Math.floor(n)&255;e-=Math.floor(e),n-=Math.floor(n);const i=this.fade(e),l=this.fade(n),c=this.perm[r]+s,d=this.perm[c],h=this.perm[c+1],m=this.perm[r+1]+s,p=this.perm[m],x=this.perm[m+1];return this.mix(this.mix(this.dot(this.grad3[d%12],e,n),this.dot(this.grad3[p%12],e-1,n),i),this.mix(this.dot(this.grad3[h%12],e,n-1),this.dot(this.grad3[x%12],e-1,n-1),i),l)}}function NH(){const t=S.useRef(null),e=S.useRef(null),n=S.useRef(void 0),r=S.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new jH(Math.random()),bounding:null});return S.useEffect(()=>{const s=e.current,i=t.current;if(!s||!i)return;const l=r.current,c=()=>{const k=s.getBoundingClientRect();l.bounding=k,i.style.width=`${k.width}px`,i.style.height=`${k.height}px`},d=()=>{if(!l.bounding)return;const{width:k,height:O}=l.bounding;l.lines=[],l.paths.forEach(F=>F.remove()),l.paths=[];const j=10,T=32,A=k+200,_=O+30,D=Math.ceil(A/j),E=Math.ceil(_/T),z=(k-j*D)/2,Q=(O-T*E)/2;for(let F=0;F<=D;F++){const L=[];for(let V=0;V<=E;V++){const ce={x:z+j*F,y:Q+T*V,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};L.push(ce)}const U=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild(U),l.paths.push(U),l.lines.push(L)}},h=k=>{const{lines:O,mouse:j,noise:T}=l;O.forEach(A=>{A.forEach(_=>{const D=T.perlin2((_.x+k*.0125)*.002,(_.y+k*.005)*.0015)*12;_.wave.x=Math.cos(D)*32,_.wave.y=Math.sin(D)*16;const E=_.x-j.sx,z=_.y-j.sy,Q=Math.hypot(E,z),F=Math.max(175,j.vs);if(Q{const j={x:k.x+k.wave.x+(O?k.cursor.x:0),y:k.y+k.wave.y+(O?k.cursor.y:0)};return j.x=Math.round(j.x*10)/10,j.y=Math.round(j.y*10)/10,j},p=()=>{const{lines:k,paths:O}=l;k.forEach((j,T)=>{let A=m(j[0],!1),_=`M ${A.x} ${A.y}`;j.forEach((D,E)=>{const z=E===j.length-1;A=m(D,!z),_+=`L ${A.x} ${A.y}`}),O[T].setAttribute("d",_)})},x=k=>{const{mouse:O}=l;O.sx+=(O.x-O.sx)*.1,O.sy+=(O.y-O.sy)*.1;const j=O.x-O.lx,T=O.y-O.ly,A=Math.hypot(j,T);O.v=A,O.vs+=(A-O.vs)*.1,O.vs=Math.min(100,O.vs),O.lx=O.x,O.ly=O.y,O.a=Math.atan2(T,j),s&&(s.style.setProperty("--x",`${O.sx}px`),s.style.setProperty("--y",`${O.sy}px`)),h(k),p(),n.current=requestAnimationFrame(x)},v=k=>{if(!l.bounding)return;const{mouse:O}=l;O.x=k.pageX-l.bounding.left,O.y=k.pageY-l.bounding.top+window.scrollY,O.set||(O.sx=O.x,O.sy=O.y,O.lx=O.x,O.ly=O.y,O.set=!0)},b=()=>{c(),d()};return c(),d(),window.addEventListener("resize",b),window.addEventListener("mousemove",v),n.current=requestAnimationFrame(x),()=>{window.removeEventListener("resize",b),window.removeEventListener("mousemove",v),n.current&&cancelAnimationFrame(n.current)}},[]),a.jsxs("div",{ref:e,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[a.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),a.jsx("svg",{ref:t,style:{display:"block",width:"100%",height:"100%"},children:a.jsx("style",{children:` +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return S.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},gH=wT,xH=ST,vH=kT,DT=OT,RT=jT,zT=AT,PT=_T,BT=CT,LT=MT;const mn=gH,jr=xH,yH=vH,IT=S.forwardRef(({className:t,...e},n)=>a.jsx(DT,{className:ye("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}));IT.displayName=DT.displayName;const an=S.forwardRef(({className:t,...e},n)=>a.jsxs(yH,{children:[a.jsx(IT,{}),a.jsx(RT,{ref:n,className:ye("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})]}));an.displayName=RT.displayName;const ln=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col space-y-2 text-center sm:text-left",t),...e});ln.displayName="AlertDialogHeader";const on=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});on.displayName="AlertDialogFooter";const cn=S.forwardRef(({className:t,...e},n)=>a.jsx(BT,{ref:n,className:ye("text-lg font-semibold",t),...e}));cn.displayName=BT.displayName;const un=S.forwardRef(({className:t,...e},n)=>a.jsx(LT,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));un.displayName=LT.displayName;const dn=S.forwardRef(({className:t,...e},n)=>a.jsx(zT,{ref:n,className:ye(ff(),t),...e}));dn.displayName=zT.displayName;const hn=S.forwardRef(({className:t,...e},n)=>a.jsx(PT,{ref:n,className:ye(ff({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));hn.displayName=PT.displayName;function bH(){return a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),a.jsxs(dl,{defaultValue:"appearance",className:"w-full",children:[a.jsxs(va,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[a.jsxs($t,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(_9,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"外观"})]}),a.jsxs($t,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(dq,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"安全"})]}),a.jsxs($t,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(dc,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"其他"})]}),a.jsxs($t,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(oo,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"关于"})]})]}),a.jsxs(fn,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[a.jsx(kn,{value:"appearance",className:"mt-0",children:a.jsx(wH,{})}),a.jsx(kn,{value:"security",className:"mt-0",children:a.jsx(SH,{})}),a.jsx(kn,{value:"other",className:"mt-0",children:a.jsx(kH,{})}),a.jsx(kn,{value:"about",className:"mt-0",children:a.jsx(OH,{})})]})]})]})}function VO(t){const e=document.documentElement,r={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[t];if(r)e.style.setProperty("--primary",r.hsl),r.gradient?(e.style.setProperty("--primary-gradient",r.gradient),e.classList.add("has-gradient")):(e.style.removeProperty("--primary-gradient"),e.classList.remove("has-gradient"));else if(t.startsWith("#")){const s=i=>{i=i.replace("#","");const l=parseInt(i.substring(0,2),16)/255,c=parseInt(i.substring(2,4),16)/255,d=parseInt(i.substring(4,6),16)/255,h=Math.max(l,c,d),m=Math.min(l,c,d);let p=0,x=0;const v=(h+m)/2;if(h!==m){const b=h-m;switch(x=v>.5?b/(2-h-m):b/(h+m),h){case l:p=((c-d)/b+(clocalStorage.getItem("accent-color")||"blue");S.useEffect(()=>{const h=localStorage.getItem("accent-color")||"blue";VO(h)},[]);const d=h=>{c(h),localStorage.setItem("accent-color",h),VO(h)};return a.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[a.jsx(Ny,{value:"light",current:t,onChange:e,label:"浅色",description:"始终使用浅色主题"}),a.jsx(Ny,{value:"dark",current:t,onChange:e,label:"深色",description:"始终使用深色主题"}),a.jsx(Ny,{value:"system",current:t,onChange:e,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),a.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[a.jsx(xi,{value:"blue",current:l,onChange:d,label:"蓝色",colorClass:"bg-blue-500"}),a.jsx(xi,{value:"purple",current:l,onChange:d,label:"紫色",colorClass:"bg-purple-500"}),a.jsx(xi,{value:"green",current:l,onChange:d,label:"绿色",colorClass:"bg-green-500"}),a.jsx(xi,{value:"orange",current:l,onChange:d,label:"橙色",colorClass:"bg-orange-500"}),a.jsx(xi,{value:"pink",current:l,onChange:d,label:"粉色",colorClass:"bg-pink-500"}),a.jsx(xi,{value:"red",current:l,onChange:d,label:"红色",colorClass:"bg-red-500"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),a.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[a.jsx(xi,{value:"gradient-sunset",current:l,onChange:d,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),a.jsx(xi,{value:"gradient-ocean",current:l,onChange:d,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),a.jsx(xi,{value:"gradient-forest",current:l,onChange:d,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),a.jsx(xi,{value:"gradient-aurora",current:l,onChange:d,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),a.jsx(xi,{value:"gradient-fire",current:l,onChange:d,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),a.jsx(xi,{value:"gradient-twilight",current:l,onChange:d,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[a.jsx("div",{className:"flex-1",children:a.jsx("input",{type:"color",value:l.startsWith("#")?l:"#3b82f6",onChange:h=>d(h.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),a.jsx("div",{className:"flex-1",children:a.jsx(Ae,{type:"text",value:l,onChange:h=>d(h.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),a.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),a.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[a.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5 flex-1",children:[a.jsx(te,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),a.jsx(jt,{id:"animations",checked:n,onCheckedChange:r})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5 flex-1",children:[a.jsx(te,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),a.jsx(jt,{id:"waves-background",checked:s,onCheckedChange:i})]})})]})]})]})}function SH(){const t=ba(),[e,n]=S.useState(""),[r,s]=S.useState(""),[i,l]=S.useState(!1),[c,d]=S.useState(!1),[h,m]=S.useState(!1),[p,x]=S.useState(!1),[v,b]=S.useState(!1),[k,O]=S.useState(!1),[j,T]=S.useState(""),[M,_]=S.useState(!1),{toast:D}=Pr(),E=S.useMemo(()=>tH(r),[r]),z=()=>localStorage.getItem("access-token")||"",Q=async W=>{try{await navigator.clipboard.writeText(W),b(!0),D({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>b(!1),2e3)}catch{D({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},F=async()=>{if(!r.trim()){D({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!E.isValid){const W=E.rules.filter(J=>!J.passed).map(J=>J.label).join(", ");D({title:"格式错误",description:`Token 不符合要求: ${W}`,variant:"destructive"});return}m(!0);try{const W=z(),J=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${W}`},body:JSON.stringify({new_token:r.trim()})}),H=await J.json();J.ok&&H.success?(localStorage.setItem("access-token",r.trim()),s(""),e&&n(r.trim()),D({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},1500)):D({title:"更新失败",description:H.message||"无法更新 Token",variant:"destructive"})}catch(W){console.error("更新 Token 错误:",W),D({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{m(!1)}},L=async()=>{x(!0);try{const W=z(),J=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${W}`}}),H=await J.json();J.ok&&H.success?(localStorage.setItem("access-token",H.token),n(H.token),T(H.token),O(!0),_(!1),D({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):D({title:"生成失败",description:H.message||"无法生成新 Token",variant:"destructive"})}catch(W){console.error("生成 Token 错误:",W),D({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{x(!1)}},U=async()=>{try{await navigator.clipboard.writeText(j),_(!0),D({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{D({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},V=()=>{O(!1),setTimeout(()=>{T(""),_(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},500)},ce=W=>{W||V()};return a.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[a.jsx(Rr,{open:k,onOpenChange:ce,children:a.jsxs(Nr,{className:"sm:max-w-md",children:[a.jsxs(Cr,{children:[a.jsxs(Tr,{className:"flex items-center gap-2",children:[a.jsx(Hu,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),a.jsx(Gr,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[a.jsx(te,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),a.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:j})]}),a.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Hu,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),a.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[a.jsx("p",{className:"font-semibold",children:"重要提示"}),a.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[a.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),a.jsx("li",{children:"请立即复制并保存到安全的位置"}),a.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),a.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),a.jsxs(ps,{className:"gap-2 sm:gap-0",children:[a.jsx(ie,{variant:"outline",onClick:U,className:"gap-2",children:M?a.jsxs(a.Fragment,{children:[a.jsx(hc,{className:"h-4 w-4 text-green-500"}),"已复制"]}):a.jsxs(a.Fragment,{children:[a.jsx(Xb,{className:"h-4 w-4"}),"复制 Token"]})}),a.jsx(ie,{onClick:V,children:"我已保存,关闭"})]})]})}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),a.jsx("div",{className:"space-y-3 sm:space-y-4",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(Ae,{id:"current-token",type:i?"text":"password",value:e||z(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),a.jsx("button",{onClick:()=>{e||n(z()),l(!i)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:i?"隐藏":"显示",children:i?a.jsx(Yb,{className:"h-4 w-4 text-muted-foreground"}):a.jsx(Fi,{className:"h-4 w-4 text-muted-foreground"})})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[a.jsx(ie,{variant:"outline",size:"icon",onClick:()=>Q(z()),title:"复制到剪贴板",className:"flex-shrink-0",children:v?a.jsx(hc,{className:"h-4 w-4 text-green-500"}):a.jsx(Xb,{className:"h-4 w-4"})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{variant:"outline",disabled:p,className:"gap-2 flex-1 sm:flex-none",children:[a.jsx(Ii,{className:ye("h-4 w-4",p&&"animate-spin")}),a.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),a.jsx("span",{className:"sm:hidden",children:"生成"})]})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认重新生成 Token"}),a.jsx(un,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:L,children:"确认生成"})]})]})]})]})]}),a.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),a.jsxs("div",{className:"relative",children:[a.jsx(Ae,{id:"new-token",type:c?"text":"password",value:r,onChange:W=>s(W.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),a.jsx("button",{onClick:()=>d(!c),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:c?"隐藏":"显示",children:c?a.jsx(Yb,{className:"h-4 w-4 text-muted-foreground"}):a.jsx(Fi,{className:"h-4 w-4 text-muted-foreground"})})]}),r&&a.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),a.jsx("div",{className:"space-y-1.5",children:E.rules.map(W=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[W.passed?a.jsx(ua,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):a.jsx(Kb,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),a.jsx("span",{className:ye(W.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:W.label})]},W.id))}),E.isValid&&a.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:a.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[a.jsx(hc,{className:"h-4 w-4"}),a.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),a.jsx(ie,{onClick:F,disabled:h||!E.isValid||!r,className:"w-full sm:w-auto",children:h?"更新中...":"更新自定义 Token"})]})]}),a.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[a.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),a.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),a.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),a.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),a.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),a.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),a.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function kH(){const t=ba(),{toast:e}=Pr(),[n,r]=S.useState(!1),s=async()=>{r(!0);try{const i=localStorage.getItem("access-token"),l=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${i}`}}),c=await l.json();l.ok&&c.success?(e({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{t({to:"/setup"})},1e3)):e({title:"重置失败",description:c.message||"无法重置配置状态",variant:"destructive"})}catch(i){console.error("重置配置状态错误:",i),e({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{r(!1)}};return a.jsx("div",{className:"space-y-4 sm:space-y-6",children:a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsx("div",{className:"space-y-2",children:a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{variant:"outline",disabled:n,className:"gap-2",children:[a.jsx(hq,{className:ye("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认重新配置"}),a.jsx(un,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:s,children:"确认重置"})]})]})]})]})]})})}function OH(){return a.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[a.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10 p-4 sm:p-6",children:a.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[a.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:a.jsx("svg",{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"开源项目"}),a.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"本项目在 GitHub 开源,欢迎 Star ⭐ 支持!"}),a.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:ye("inline-flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[a.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),"前往 GitHub",a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",fw]}),a.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[a.jsxs("p",{children:["版本: ",hw]}),a.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),a.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",a.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"React 19.2.0"}),a.jsx("li",{children:"TypeScript 5.7.2"}),a.jsx("li",{children:"Vite 6.0.7"}),a.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"shadcn/ui"}),a.jsx("li",{children:"Radix UI"}),a.jsx("li",{children:"Tailwind CSS 3.4.17"}),a.jsx("li",{children:"Lucide Icons"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"后端"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"Python 3.12+"}),a.jsx("li",{children:"FastAPI"}),a.jsx("li",{children:"Uvicorn"}),a.jsx("li",{children:"WebSocket"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"Bun / npm"}),a.jsx("li",{children:"ESLint 9.17.0"}),a.jsx("li",{children:"PostCSS"})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),a.jsx(fn,{className:"h-[300px] sm:h-[400px]",children:a.jsxs("div",{className:"space-y-4 pr-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"React",description:"用户界面构建库",license:"MIT"}),a.jsx(Gn,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),a.jsx(Gn,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),a.jsx(Gn,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),a.jsx(Gn,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),a.jsx(Gn,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),a.jsx(Gn,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),a.jsx(Gn,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),a.jsx(Gn,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),a.jsx(Gn,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),a.jsx(Gn,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),a.jsx(Gn,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),a.jsx(Gn,{name:"Pydantic",description:"数据验证库",license:"MIT"}),a.jsx(Gn,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),a.jsx(Gn,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),a.jsx(Gn,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),a.jsx(Gn,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:a.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:a.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Gn({name:t,description:e,license:n}){return a.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium text-foreground truncate",children:t}),a.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:e})]}),a.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:n})]})}function Ny({value:t,current:e,onChange:n,label:r,description:s}){const i=e===t;return a.jsxs("button",{onClick:()=>n(t),className:ye("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&a.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-sm sm:text-base font-medium",children:r}),a.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:s})]}),a.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[t==="light"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),t==="dark"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),t==="system"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function xi({value:t,current:e,onChange:n,label:r,colorClass:s}){const i=e===t;return a.jsxs("button",{onClick:()=>n(t),className:ye("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&a.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),a.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[a.jsx("div",{className:ye("h-8 w-8 sm:h-10 sm:w-10 rounded-full",s)}),a.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:r})]})]})}class jH{grad3;p;perm;constructor(e=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let n=0;n<256;n++)this.p[n]=Math.floor(Math.random()*256);this.perm=[];for(let n=0;n<512;n++)this.perm[n]=this.p[n&255]}dot(e,n,r){return e[0]*n+e[1]*r}mix(e,n,r){return(1-r)*e+r*n}fade(e){return e*e*e*(e*(e*6-15)+10)}perlin2(e,n){const r=Math.floor(e)&255,s=Math.floor(n)&255;e-=Math.floor(e),n-=Math.floor(n);const i=this.fade(e),l=this.fade(n),c=this.perm[r]+s,d=this.perm[c],h=this.perm[c+1],m=this.perm[r+1]+s,p=this.perm[m],x=this.perm[m+1];return this.mix(this.mix(this.dot(this.grad3[d%12],e,n),this.dot(this.grad3[p%12],e-1,n),i),this.mix(this.dot(this.grad3[h%12],e,n-1),this.dot(this.grad3[x%12],e-1,n-1),i),l)}}function NH(){const t=S.useRef(null),e=S.useRef(null),n=S.useRef(void 0),r=S.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new jH(Math.random()),bounding:null});return S.useEffect(()=>{const s=e.current,i=t.current;if(!s||!i)return;const l=r.current,c=()=>{const k=s.getBoundingClientRect();l.bounding=k,i.style.width=`${k.width}px`,i.style.height=`${k.height}px`},d=()=>{if(!l.bounding)return;const{width:k,height:O}=l.bounding;l.lines=[],l.paths.forEach(F=>F.remove()),l.paths=[];const j=10,T=32,M=k+200,_=O+30,D=Math.ceil(M/j),E=Math.ceil(_/T),z=(k-j*D)/2,Q=(O-T*E)/2;for(let F=0;F<=D;F++){const L=[];for(let V=0;V<=E;V++){const ce={x:z+j*F,y:Q+T*V,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};L.push(ce)}const U=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild(U),l.paths.push(U),l.lines.push(L)}},h=k=>{const{lines:O,mouse:j,noise:T}=l;O.forEach(M=>{M.forEach(_=>{const D=T.perlin2((_.x+k*.0125)*.002,(_.y+k*.005)*.0015)*12;_.wave.x=Math.cos(D)*32,_.wave.y=Math.sin(D)*16;const E=_.x-j.sx,z=_.y-j.sy,Q=Math.hypot(E,z),F=Math.max(175,j.vs);if(Q{const j={x:k.x+k.wave.x+(O?k.cursor.x:0),y:k.y+k.wave.y+(O?k.cursor.y:0)};return j.x=Math.round(j.x*10)/10,j.y=Math.round(j.y*10)/10,j},p=()=>{const{lines:k,paths:O}=l;k.forEach((j,T)=>{let M=m(j[0],!1),_=`M ${M.x} ${M.y}`;j.forEach((D,E)=>{const z=E===j.length-1;M=m(D,!z),_+=`L ${M.x} ${M.y}`}),O[T].setAttribute("d",_)})},x=k=>{const{mouse:O}=l;O.sx+=(O.x-O.sx)*.1,O.sy+=(O.y-O.sy)*.1;const j=O.x-O.lx,T=O.y-O.ly,M=Math.hypot(j,T);O.v=M,O.vs+=(M-O.vs)*.1,O.vs=Math.min(100,O.vs),O.lx=O.x,O.ly=O.y,O.a=Math.atan2(T,j),s&&(s.style.setProperty("--x",`${O.sx}px`),s.style.setProperty("--y",`${O.sy}px`)),h(k),p(),n.current=requestAnimationFrame(x)},v=k=>{if(!l.bounding)return;const{mouse:O}=l;O.x=k.pageX-l.bounding.left,O.y=k.pageY-l.bounding.top+window.scrollY,O.set||(O.sx=O.x,O.sy=O.y,O.lx=O.x,O.ly=O.y,O.set=!0)},b=()=>{c(),d()};return c(),d(),window.addEventListener("resize",b),window.addEventListener("mousemove",v),n.current=requestAnimationFrame(x),()=>{window.removeEventListener("resize",b),window.removeEventListener("mousemove",v),n.current&&cancelAnimationFrame(n.current)}},[]),a.jsxs("div",{ref:e,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[a.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),a.jsx("svg",{ref:t,style:{display:"block",width:"100%",height:"100%"},children:a.jsx("style",{children:` path { fill: none; stroke: hsl(var(--primary) / 0.20); stroke-width: 1px; } - `})})]})}function CH(){const t=wa();S.useEffect(()=>{localStorage.getItem("access-token")||t({to:"/auth"})},[t])}function qT(){return!!localStorage.getItem("access-token")}function TH(){const[t,e]=S.useState(""),[n,r]=S.useState(!1),[s,i]=S.useState(""),l=wa(),{enableWavesBackground:c,setEnableWavesBackground:d}=hT(),{theme:h,setTheme:m}=dw();S.useEffect(()=>{qT()&&l({to:"/"})},[l]);const x=h==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":h,v=()=>{m(x==="dark"?"light":"dark")},b=async k=>{if(k.preventDefault(),i(""),!t.trim()){i("请输入 Access Token");return}r(!0);try{const O=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t.trim()})}),j=await O.json();if(O.ok&&j.valid){localStorage.setItem("access-token",t.trim());const T=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${t.trim()}`}}),A=await T.json();T.ok&&A.is_first_setup?l({to:"/setup"}):l({to:"/"})}else i(j.message||"Token 验证失败,请检查后重试")}catch(O){console.error("Token 验证错误:",O),i("连接服务器失败,请检查网络连接")}finally{r(!1)}};return a.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[c&&a.jsx(NH,{}),a.jsxs(gt,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[a.jsx("button",{onClick:v,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:x==="dark"?"切换到浅色模式":"切换到深色模式",children:x==="dark"?a.jsx(Zb,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):a.jsx(Jb,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),a.jsxs(Wt,{className:"space-y-4 text-center",children:[a.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:a.jsx(lO,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Gt,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),a.jsx(Sr,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),a.jsx(an,{children:a.jsxs("form",{onSubmit:b,className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),a.jsxs("div",{className:"relative",children:[a.jsx(fq,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),a.jsx(Me,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:t,onChange:k=>e(k.target.value),className:ye("pl-10",s&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),s&&a.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[a.jsx(xc,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),a.jsx("span",{children:s})]}),a.jsx(ie,{type:"submit",className:"w-full",disabled:n,children:n?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),a.jsxs(Rr,{children:[a.jsx(mw,{asChild:!0,children:a.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[a.jsx(mq,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),a.jsxs(Nr,{className:"sm:max-w-md",children:[a.jsxs(Cr,{children:[a.jsxs(Tr,{className:"flex items-center gap-2",children:[a.jsx(lO,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),a.jsx(Gr,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(pq,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),a.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[a.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),a.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ao,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),a.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:a.jsx("code",{className:"text-primary",children:"data/webui.json"})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",a.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),a.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(xc,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[a.jsx("p",{className:"font-semibold",children:"安全提示"}),a.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[a.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),a.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[a.jsx(uf,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsxs(un,{className:"flex items-center gap-2",children:[a.jsx(uf,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),a.jsx(dn,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>d(!1),children:"关闭动画"})]})]})]})]})})]}),a.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:a.jsx("p",{children:nH})})]})}const _n=S.forwardRef(({className:t,...e},n)=>a.jsx("textarea",{className:ye("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...e}));_n.displayName="Textarea";var AH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],MH=AH.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),EH="Separator",WO="horizontal",_H=["horizontal","vertical"],FT=S.forwardRef((t,e)=>{const{decorative:n,orientation:r=WO,...s}=t,i=DH(r)?r:WO,c=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return a.jsx(MH.div,{"data-orientation":i,...c,...s,ref:e})});FT.displayName=EH;function DH(t){return _H.includes(t)}var QT=FT;const mf=S.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},s)=>a.jsx(QT,{ref:s,decorative:n,orientation:e,className:ye("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));mf.displayName=QT.displayName;const RH=Nd("inline-flex items-center rounded-md 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 shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function On({className:t,variant:e,...n}){return a.jsx("div",{className:ye(RH({variant:e}),t),...n})}function zH({config:t,onChange:e}){const n=s=>{s.trim()&&!t.alias_names.includes(s.trim())&&e({...t,alias_names:[...t.alias_names,s.trim()]})},r=s=>{e({...t,alias_names:t.alias_names.filter((i,l)=>l!==s)})};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"qq_account",children:"QQ账号 *"}),a.jsx(Me,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:t.qq_account||"",onChange:s=>e({...t,qq_account:Number(s.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称 *"}),a.jsx(Me,{id:"nickname",placeholder:"请输入机器人的昵称",value:t.nickname,onChange:s=>e({...t,nickname:s.target.value})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{children:"别名"}),a.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.alias_names.map((s,i)=>a.jsxs(On,{variant:"secondary",className:"gap-1",children:[s,a.jsx("button",{type:"button",onClick:()=>r(i),className:"ml-1 hover:text-destructive",children:a.jsx(Gf,{className:"h-3 w-3"})})]},i))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:s=>{s.key==="Enter"&&(n(s.target.value),s.target.value="")}}),a.jsx(ie,{type:"button",variant:"outline",onClick:()=>{const s=document.getElementById("alias_input");s&&(n(s.value),s.value="")},children:"添加"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function PH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"personality",children:"人格特征 *"}),a.jsx(_n,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:t.personality,onChange:n=>e({...t,personality:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"reply_style",children:"表达风格 *"}),a.jsx(_n,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:t.reply_style,onChange:n=>e({...t,reply_style:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"interest",children:"兴趣 *"}),a.jsx(_n,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:t.interest,onChange:n=>e({...t,interest:n.target.value}),rows:2}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),a.jsx(mf,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"plan_style",children:"群聊说话规则 *"}),a.jsx(_n,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:t.plan_style,onChange:n=>e({...t,plan_style:n.target.value}),rows:4}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),a.jsx(_n,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:t.private_plan_style,onChange:n=>e({...t,private_plan_style:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function BH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{htmlFor:"emoji_chance",children:"表情包激活概率"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[(t.emoji_chance*100).toFixed(0),"%"]})]}),a.jsx(Me,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:t.emoji_chance,onChange:n=>e({...t,emoji_chance:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"max_reg_num",children:"最大表情包数量"}),a.jsx(Me,{id:"max_reg_num",type:"number",min:"1",max:"200",value:t.max_reg_num,onChange:n=>e({...t,max_reg_num:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"do_replace",children:"达到最大数量时替换"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),a.jsx(jt,{id:"do_replace",checked:t.do_replace,onCheckedChange:n=>e({...t,do_replace:n})})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),a.jsx(Me,{id:"check_interval",type:"number",min:"1",max:"120",value:t.check_interval,onChange:n=>e({...t,check_interval:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"steal_emoji",children:"偷取表情包"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),a.jsx(jt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:n=>e({...t,steal_emoji:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"content_filtration",children:"启用表情包过滤"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),a.jsx(jt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:n=>e({...t,content_filtration:n})})]}),t.content_filtration&&a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"filtration_prompt",children:"过滤要求"}),a.jsx(Me,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:t.filtration_prompt,onChange:n=>e({...t,filtration_prompt:n.target.value})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function LH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"enable_tool",children:"启用工具系统"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),a.jsx(jt,{id:"enable_tool",checked:t.enable_tool,onCheckedChange:n=>e({...t,enable_tool:n})})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"enable_mood",children:"启用情绪系统"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),a.jsx(jt,{id:"enable_mood",checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})})]}),t.enable_mood&&a.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),a.jsx(Me,{id:"mood_update_threshold",type:"number",min:"0.1",max:"10",step:"0.1",value:t.mood_update_threshold||1,onChange:n=>e({...t,mood_update_threshold:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"emotion_style",children:"情感特征"}),a.jsx(_n,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:t.emotion_style||"",onChange:n=>e({...t,emotion_style:n.target.value}),rows:2}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"all_global",children:"启用全局黑话模式"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),a.jsx(jt,{id:"all_global",checked:t.all_global,onCheckedChange:n=>e({...t,all_global:n})})]})]})}async function ot(t,e){const n=await fetch(t,e);if(n.status===401)throw localStorage.removeItem("access-token"),window.location.href="/auth",new Error("认证失败,请重新登录");return n}function bt(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function IH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取Bot配置失败");const n=(await t.json()).config.bot||{};return{qq_account:n.qq_account||0,nickname:n.nickname||"",alias_names:n.alias_names||[]}}async function qH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取人格配置失败");const n=(await t.json()).config.personality||{};return{personality:n.personality||"",reply_style:n.reply_style||"",interest:n.interest||"",plan_style:n.plan_style||"",private_plan_style:n.private_plan_style||""}}async function FH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取表情包配置失败");const n=(await t.json()).config.emoji||{};return{emoji_chance:n.emoji_chance??.4,max_reg_num:n.max_reg_num??40,do_replace:n.do_replace??!0,check_interval:n.check_interval??10,steal_emoji:n.steal_emoji??!0,content_filtration:n.content_filtration??!1,filtration_prompt:n.filtration_prompt||""}}async function QH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取其他配置失败");const n=(await t.json()).config,r=n.tool||{},s=n.mood||{},i=n.jargon||{};return{enable_tool:r.enable_tool??!0,enable_mood:s.enable_mood??!1,mood_update_threshold:s.mood_update_threshold,emotion_style:s.emotion_style,all_global:i.all_global??!0}}async function $H(t){const e=await ot("/api/webui/config/bot/section/bot",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await e.json()}async function HH(t){const e=await ot("/api/webui/config/bot/section/personality",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存人格配置失败")}return await e.json()}async function UH(t){const e=await ot("/api/webui/config/bot/section/emoji",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存表情包配置失败")}return await e.json()}async function VH(t){const e=[];e.push(ot("/api/webui/config/bot/section/tool",{method:"POST",headers:bt(),body:JSON.stringify({enable_tool:t.enable_tool})})),e.push(ot("/api/webui/config/bot/section/jargon",{method:"POST",headers:bt(),body:JSON.stringify({all_global:t.all_global})}));const n={enable_mood:t.enable_mood};t.enable_mood&&(n.mood_update_threshold=t.mood_update_threshold||1,n.emotion_style=t.emotion_style||""),e.push(ot("/api/webui/config/bot/section/mood",{method:"POST",headers:bt(),body:JSON.stringify(n)}));const r=await Promise.all(e);for(const s of r)if(!s.ok){const i=await s.json();throw new Error(i.detail||"保存其他配置失败")}return{success:!0}}async function GO(){const t=localStorage.getItem("access-token"),e=await ot("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!e.ok){const n=await e.json();throw new Error(n.message||"标记配置完成失败")}return await e.json()}function WH(){const t=wa(),{toast:e}=Pr(),[n,r]=S.useState(0),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!0),[m,p]=S.useState({qq_account:0,nickname:"",alias_names:[]}),[x,v]=S.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 + `})})]})}function CH(){const t=ba();S.useEffect(()=>{localStorage.getItem("access-token")||t({to:"/auth"})},[t])}function qT(){return!!localStorage.getItem("access-token")}function TH(){const[t,e]=S.useState(""),[n,r]=S.useState(!1),[s,i]=S.useState(""),l=ba(),{enableWavesBackground:c,setEnableWavesBackground:d}=hT(),{theme:h,setTheme:m}=dw();S.useEffect(()=>{qT()&&l({to:"/"})},[l]);const x=h==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":h,v=()=>{m(x==="dark"?"light":"dark")},b=async k=>{if(k.preventDefault(),i(""),!t.trim()){i("请输入 Access Token");return}r(!0);try{const O=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t.trim()})}),j=await O.json();if(O.ok&&j.valid){localStorage.setItem("access-token",t.trim());const T=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${t.trim()}`}}),M=await T.json();T.ok&&M.is_first_setup?l({to:"/setup"}):l({to:"/"})}else i(j.message||"Token 验证失败,请检查后重试")}catch(O){console.error("Token 验证错误:",O),i("连接服务器失败,请检查网络连接")}finally{r(!1)}};return a.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[c&&a.jsx(NH,{}),a.jsxs(yt,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[a.jsx("button",{onClick:v,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:x==="dark"?"切换到浅色模式":"切换到深色模式",children:x==="dark"?a.jsx(Zb,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):a.jsx(Jb,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),a.jsxs(Jt,{className:"space-y-4 text-center",children:[a.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:a.jsx(lO,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(en,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),a.jsx(Sr,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),a.jsx(vn,{children:a.jsxs("form",{onSubmit:b,className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),a.jsxs("div",{className:"relative",children:[a.jsx(fq,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),a.jsx(Ae,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:t,onChange:k=>e(k.target.value),className:ye("pl-10",s&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),s&&a.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[a.jsx(xc,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),a.jsx("span",{children:s})]}),a.jsx(ie,{type:"submit",className:"w-full",disabled:n,children:n?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),a.jsxs(Rr,{children:[a.jsx(mw,{asChild:!0,children:a.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[a.jsx(mq,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),a.jsxs(Nr,{className:"sm:max-w-md",children:[a.jsxs(Cr,{children:[a.jsxs(Tr,{className:"flex items-center gap-2",children:[a.jsx(lO,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),a.jsx(Gr,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(pq,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),a.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[a.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),a.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(io,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),a.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:a.jsx("code",{className:"text-primary",children:"data/webui.json"})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",a.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),a.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(xc,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[a.jsx("p",{className:"font-semibold",children:"安全提示"}),a.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[a.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),a.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[a.jsx(uf,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsxs(cn,{className:"flex items-center gap-2",children:[a.jsx(uf,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),a.jsx(un,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>d(!1),children:"关闭动画"})]})]})]})]})})]}),a.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:a.jsx("p",{children:nH})})]})}const _n=S.forwardRef(({className:t,...e},n)=>a.jsx("textarea",{className:ye("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...e}));_n.displayName="Textarea";var MH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],AH=MH.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),EH="Separator",WO="horizontal",_H=["horizontal","vertical"],FT=S.forwardRef((t,e)=>{const{decorative:n,orientation:r=WO,...s}=t,i=DH(r)?r:WO,c=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return a.jsx(AH.div,{"data-orientation":i,...c,...s,ref:e})});FT.displayName=EH;function DH(t){return _H.includes(t)}var QT=FT;const mf=S.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},s)=>a.jsx(QT,{ref:s,decorative:n,orientation:e,className:ye("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));mf.displayName=QT.displayName;const RH=Nd("inline-flex items-center rounded-md 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 shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function On({className:t,variant:e,...n}){return a.jsx("div",{className:ye(RH({variant:e}),t),...n})}function zH({config:t,onChange:e}){const n=s=>{s.trim()&&!t.alias_names.includes(s.trim())&&e({...t,alias_names:[...t.alias_names,s.trim()]})},r=s=>{e({...t,alias_names:t.alias_names.filter((i,l)=>l!==s)})};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"qq_account",children:"QQ账号 *"}),a.jsx(Ae,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:t.qq_account||"",onChange:s=>e({...t,qq_account:Number(s.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称 *"}),a.jsx(Ae,{id:"nickname",placeholder:"请输入机器人的昵称",value:t.nickname,onChange:s=>e({...t,nickname:s.target.value})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{children:"别名"}),a.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.alias_names.map((s,i)=>a.jsxs(On,{variant:"secondary",className:"gap-1",children:[s,a.jsx("button",{type:"button",onClick:()=>r(i),className:"ml-1 hover:text-destructive",children:a.jsx(Gf,{className:"h-3 w-3"})})]},i))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ae,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:s=>{s.key==="Enter"&&(n(s.target.value),s.target.value="")}}),a.jsx(ie,{type:"button",variant:"outline",onClick:()=>{const s=document.getElementById("alias_input");s&&(n(s.value),s.value="")},children:"添加"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function PH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"personality",children:"人格特征 *"}),a.jsx(_n,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:t.personality,onChange:n=>e({...t,personality:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"reply_style",children:"表达风格 *"}),a.jsx(_n,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:t.reply_style,onChange:n=>e({...t,reply_style:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"interest",children:"兴趣 *"}),a.jsx(_n,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:t.interest,onChange:n=>e({...t,interest:n.target.value}),rows:2}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),a.jsx(mf,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"plan_style",children:"群聊说话规则 *"}),a.jsx(_n,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:t.plan_style,onChange:n=>e({...t,plan_style:n.target.value}),rows:4}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),a.jsx(_n,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:t.private_plan_style,onChange:n=>e({...t,private_plan_style:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function BH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{htmlFor:"emoji_chance",children:"表情包激活概率"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[(t.emoji_chance*100).toFixed(0),"%"]})]}),a.jsx(Ae,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:t.emoji_chance,onChange:n=>e({...t,emoji_chance:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"max_reg_num",children:"最大表情包数量"}),a.jsx(Ae,{id:"max_reg_num",type:"number",min:"1",max:"200",value:t.max_reg_num,onChange:n=>e({...t,max_reg_num:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"do_replace",children:"达到最大数量时替换"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),a.jsx(jt,{id:"do_replace",checked:t.do_replace,onCheckedChange:n=>e({...t,do_replace:n})})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),a.jsx(Ae,{id:"check_interval",type:"number",min:"1",max:"120",value:t.check_interval,onChange:n=>e({...t,check_interval:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"steal_emoji",children:"偷取表情包"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),a.jsx(jt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:n=>e({...t,steal_emoji:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"content_filtration",children:"启用表情包过滤"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),a.jsx(jt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:n=>e({...t,content_filtration:n})})]}),t.content_filtration&&a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"filtration_prompt",children:"过滤要求"}),a.jsx(Ae,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:t.filtration_prompt,onChange:n=>e({...t,filtration_prompt:n.target.value})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function LH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"enable_tool",children:"启用工具系统"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),a.jsx(jt,{id:"enable_tool",checked:t.enable_tool,onCheckedChange:n=>e({...t,enable_tool:n})})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"enable_mood",children:"启用情绪系统"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),a.jsx(jt,{id:"enable_mood",checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})})]}),t.enable_mood&&a.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),a.jsx(Ae,{id:"mood_update_threshold",type:"number",min:"0.1",max:"10",step:"0.1",value:t.mood_update_threshold||1,onChange:n=>e({...t,mood_update_threshold:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"emotion_style",children:"情感特征"}),a.jsx(_n,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:t.emotion_style||"",onChange:n=>e({...t,emotion_style:n.target.value}),rows:2}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"all_global",children:"启用全局黑话模式"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),a.jsx(jt,{id:"all_global",checked:t.all_global,onCheckedChange:n=>e({...t,all_global:n})})]})]})}async function ot(t,e){const n=await fetch(t,e);if(n.status===401)throw localStorage.removeItem("access-token"),window.location.href="/auth",new Error("认证失败,请重新登录");return n}function bt(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function IH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取Bot配置失败");const n=(await t.json()).config.bot||{};return{qq_account:n.qq_account||0,nickname:n.nickname||"",alias_names:n.alias_names||[]}}async function qH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取人格配置失败");const n=(await t.json()).config.personality||{};return{personality:n.personality||"",reply_style:n.reply_style||"",interest:n.interest||"",plan_style:n.plan_style||"",private_plan_style:n.private_plan_style||""}}async function FH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取表情包配置失败");const n=(await t.json()).config.emoji||{};return{emoji_chance:n.emoji_chance??.4,max_reg_num:n.max_reg_num??40,do_replace:n.do_replace??!0,check_interval:n.check_interval??10,steal_emoji:n.steal_emoji??!0,content_filtration:n.content_filtration??!1,filtration_prompt:n.filtration_prompt||""}}async function QH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});if(!t.ok)throw new Error("读取其他配置失败");const n=(await t.json()).config,r=n.tool||{},s=n.mood||{},i=n.jargon||{};return{enable_tool:r.enable_tool??!0,enable_mood:s.enable_mood??!1,mood_update_threshold:s.mood_update_threshold,emotion_style:s.emotion_style,all_global:i.all_global??!0}}async function $H(t){const e=await ot("/api/webui/config/bot/section/bot",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await e.json()}async function HH(t){const e=await ot("/api/webui/config/bot/section/personality",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存人格配置失败")}return await e.json()}async function UH(t){const e=await ot("/api/webui/config/bot/section/emoji",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存表情包配置失败")}return await e.json()}async function VH(t){const e=[];e.push(ot("/api/webui/config/bot/section/tool",{method:"POST",headers:bt(),body:JSON.stringify({enable_tool:t.enable_tool})})),e.push(ot("/api/webui/config/bot/section/jargon",{method:"POST",headers:bt(),body:JSON.stringify({all_global:t.all_global})}));const n={enable_mood:t.enable_mood};t.enable_mood&&(n.mood_update_threshold=t.mood_update_threshold||1,n.emotion_style=t.emotion_style||""),e.push(ot("/api/webui/config/bot/section/mood",{method:"POST",headers:bt(),body:JSON.stringify(n)}));const r=await Promise.all(e);for(const s of r)if(!s.ok){const i=await s.json();throw new Error(i.detail||"保存其他配置失败")}return{success:!0}}async function GO(){const t=localStorage.getItem("access-token"),e=await ot("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!e.ok){const n=await e.json();throw new Error(n.message||"标记配置完成失败")}return await e.json()}function WH(){const t=ba(),{toast:e}=Pr(),[n,r]=S.useState(0),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!0),[m,p]=S.useState({qq_account:0,nickname:"",alias_names:[]}),[x,v]=S.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 3.请控制你的发言频率,不要太过频繁的发言 4.如果有人对你感到厌烦,请减少回复 5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 -3.某句话如果已经被回复过,不要重复回复`}),[b,k]=S.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[O,j]=S.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遭遇特定事件的时候起伏较大",all_global:!0}),T=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:xq},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:D9},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:K4},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:Ii},{id:"complete",title:"完成设置",description:"后续配置提示",icon:uf}],A=(n+1)/T.length*100;S.useEffect(()=>{(async()=>{try{h(!0);const[U,V,ce,W]=await Promise.all([IH(),qH(),FH(),QH()]);p(U),v(V),k(ce),j(W)}catch(U){e({title:"加载配置失败",description:U instanceof Error?U.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{h(!1)}})()},[e]);const _=async()=>{c(!0);try{switch(n){case 0:await $H(m);break;case 1:await HH(x);break;case 2:await UH(b);break;case 3:await VH(O);break}return e({title:"保存成功",description:`${T[n].title}配置已保存`}),!0}catch(L){return e({title:"保存失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"}),!1}finally{c(!1)}},D=async()=>{await _()&&n{n>0&&r(n-1)},z=async()=>{i(!0);try{if(!await _()){i(!1);return}await GO(),e({title:"配置完成",description:"所有配置已保存,正在跳转..."}),setTimeout(()=>{t({to:"/"})},500)}catch(L){e({title:"完成失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}finally{i(!1)}},Q=async()=>{try{await GO(),t({to:"/"})}catch(L){e({title:"跳过失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},F=()=>{switch(n){case 0:return a.jsx(zH,{config:m,onChange:p});case 1:return a.jsx(PH,{config:x,onChange:v});case 2:return a.jsx(BH,{config:b,onChange:k});case 3:return a.jsx(LH,{config:O,onChange:j});case 4:return a.jsxs("div",{className:"space-y-6 text-center py-8",children:[a.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:a.jsx(uf,{className:"h-8 w-8 text-primary",strokeWidth:2})}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h3",{className:"text-xl font-semibold",children:"模型配置"}),a.jsx("p",{className:"text-muted-foreground max-w-md mx-auto",children:"为了让机器人正常工作,您需要配置 AI 模型提供商和模型。"})]}),a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-6 max-w-md mx-auto text-left space-y-4",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"1"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"配置 API 提供商"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → API 提供商"中添加您的 API 提供商信息'})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"2"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"添加模型"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型列表"中添加需要使用的模型'})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"3"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"配置模型任务"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型任务配置"中为不同任务分配模型'})]})]})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"💡 提示:完成向导后,您可以在系统设置中进行详细的模型配置"})]});default:return null}};return a.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[a.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[a.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),a.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),d?a.jsxs("div",{className:"relative z-10 text-center",children:[a.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:a.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),a.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),a.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[a.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[a.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:a.jsx(gq,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),a.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),a.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",fw," 的初始配置"]})]}),a.jsxs("div",{className:"mb-6 md:mb-8",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[a.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",T.length]}),a.jsxs("span",{className:"font-medium text-primary",children:[Math.round(A),"%"]})]}),a.jsx(n0,{value:A,className:"h-2"})]}),a.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:T.map((L,U)=>{const V=L.icon;return a.jsxs("div",{className:ye("flex flex-1 flex-col items-center gap-1 md:gap-2",Ut({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[a.jsx(hg,{className:"h-4 w-4"}),"返回首页"]}),a.jsxs(ie,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[a.jsx(R9,{className:"h-4 w-4"}),"返回上一页"]})]}),a.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var HT=["PageUp","PageDown"],UT=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],VT={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Cd="Slider",[c2,GH,XH]=tx(Cd),[WT]=Vi(Cd,[XH]),[YH,vx]=WT(Cd),GT=S.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:l="horizontal",disabled:c=!1,minStepsBetweenThumbs:d=0,defaultValue:h=[r],value:m,onValueChange:p=()=>{},onValueCommit:x=()=>{},inverted:v=!1,form:b,...k}=t,O=S.useRef(new Set),j=S.useRef(0),A=l==="horizontal"?KH:ZH,[_=[],D]=ko({prop:m,defaultProp:h,onChange:U=>{[...O.current][j.current]?.focus(),p(U)}}),E=S.useRef(_);function z(U){const V=rU(_,U);L(U,V)}function Q(U){L(U,j.current)}function F(){const U=E.current[j.current];_[j.current]!==U&&x(_)}function L(U,V,{commit:ce}={commit:!1}){const W=lU(i),J=oU(Math.round((U-r)/i)*i+r,W),$=F4(J,[r,s]);D((ae=[])=>{const ne=tU(ae,$,V);if(aU(ne,d*i)){j.current=ne.indexOf($);const ue=String(ne)!==String(ae);return ue&&ce&&x(ne),ue?ne:ae}else return ae})}return a.jsx(YH,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:s,valueIndexToChangeRef:j,thumbs:O.current,values:_,orientation:l,form:b,children:a.jsx(c2.Provider,{scope:t.__scopeSlider,children:a.jsx(c2.Slot,{scope:t.__scopeSlider,children:a.jsx(A,{"aria-disabled":c,"data-disabled":c?"":void 0,...k,ref:e,onPointerDown:$e(k.onPointerDown,()=>{c||(E.current=_)}),min:r,max:s,inverted:v,onSlideStart:c?void 0:z,onSlideMove:c?void 0:Q,onSlideEnd:c?void 0:F,onHomeKeyDown:()=>!c&&L(r,0,{commit:!0}),onEndKeyDown:()=>!c&&L(s,_.length-1,{commit:!0}),onStepKeyDown:({event:U,direction:V})=>{if(!c){const J=HT.includes(U.key)||U.shiftKey&&UT.includes(U.key)?10:1,$=j.current,ae=_[$],ne=i*J*V;L(ae+ne,$,{commit:!0})}}})})})})});GT.displayName=Cd;var[XT,YT]=WT(Cd,{startEdge:"left",endEdge:"right",size:"width",direction:1}),KH=S.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:l,onSlideMove:c,onSlideEnd:d,onStepKeyDown:h,...m}=t,[p,x]=S.useState(null),v=Cn(e,A=>x(A)),b=S.useRef(void 0),k=Vf(s),O=k==="ltr",j=O&&!i||!O&&i;function T(A){const _=b.current||p.getBoundingClientRect(),D=[0,_.width],z=pw(D,j?[n,r]:[r,n]);return b.current=_,z(A-_.left)}return a.jsx(XT,{scope:t.__scopeSlider,startEdge:j?"left":"right",endEdge:j?"right":"left",direction:j?1:-1,size:"width",children:a.jsx(KT,{dir:k,"data-orientation":"horizontal",...m,ref:v,style:{...m.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:A=>{const _=T(A.clientX);l?.(_)},onSlideMove:A=>{const _=T(A.clientX);c?.(_)},onSlideEnd:()=>{b.current=void 0,d?.()},onStepKeyDown:A=>{const D=VT[j?"from-left":"from-right"].includes(A.key);h?.({event:A,direction:D?-1:1})}})})}),ZH=S.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...h}=t,m=S.useRef(null),p=Cn(e,m),x=S.useRef(void 0),v=!s;function b(k){const O=x.current||m.current.getBoundingClientRect(),j=[0,O.height],A=pw(j,v?[r,n]:[n,r]);return x.current=O,A(k-O.top)}return a.jsx(XT,{scope:t.__scopeSlider,startEdge:v?"bottom":"top",endEdge:v?"top":"bottom",size:"height",direction:v?1:-1,children:a.jsx(KT,{"data-orientation":"vertical",...h,ref:p,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:k=>{const O=b(k.clientY);i?.(O)},onSlideMove:k=>{const O=b(k.clientY);l?.(O)},onSlideEnd:()=>{x.current=void 0,c?.()},onStepKeyDown:k=>{const j=VT[v?"from-bottom":"from-top"].includes(k.key);d?.({event:k,direction:j?-1:1})}})})}),KT=S.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:l,onEndKeyDown:c,onStepKeyDown:d,...h}=t,m=vx(Cd,n);return a.jsx(Zt.span,{...h,ref:e,onKeyDown:$e(t.onKeyDown,p=>{p.key==="Home"?(l(p),p.preventDefault()):p.key==="End"?(c(p),p.preventDefault()):HT.concat(UT).includes(p.key)&&(d(p),p.preventDefault())}),onPointerDown:$e(t.onPointerDown,p=>{const x=p.target;x.setPointerCapture(p.pointerId),p.preventDefault(),m.thumbs.has(x)?x.focus():r(p)}),onPointerMove:$e(t.onPointerMove,p=>{p.target.hasPointerCapture(p.pointerId)&&s(p)}),onPointerUp:$e(t.onPointerUp,p=>{const x=p.target;x.hasPointerCapture(p.pointerId)&&(x.releasePointerCapture(p.pointerId),i(p))})})}),ZT="SliderTrack",JT=S.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=vx(ZT,n);return a.jsx(Zt.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});JT.displayName=ZT;var u2="SliderRange",eA=S.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=vx(u2,n),i=YT(u2,n),l=S.useRef(null),c=Cn(e,l),d=s.values.length,h=s.values.map(x=>rA(x,s.min,s.max)),m=d>1?Math.min(...h):0,p=100-Math.max(...h);return a.jsx(Zt.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:m+"%",[i.endEdge]:p+"%"}})});eA.displayName=u2;var d2="SliderThumb",tA=S.forwardRef((t,e)=>{const n=GH(t.__scopeSlider),[r,s]=S.useState(null),i=Cn(e,c=>s(c)),l=S.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return a.jsx(JH,{...t,ref:i,index:l})}),JH=S.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...i}=t,l=vx(d2,n),c=YT(d2,n),[d,h]=S.useState(null),m=Cn(e,T=>h(T)),p=d?l.form||!!d.closest("form"):!0,x=m9(d),v=l.values[r],b=v===void 0?0:rA(v,l.min,l.max),k=nU(r,l.values.length),O=x?.[c.size],j=O?sU(O,b,c.direction):0;return S.useEffect(()=>{if(d)return l.thumbs.add(d),()=>{l.thumbs.delete(d)}},[d,l.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${b}% + ${j}px)`},children:[a.jsx(c2.ItemSlot,{scope:t.__scopeSlider,children:a.jsx(Zt.span,{role:"slider","aria-label":t["aria-label"]||k,"aria-valuemin":l.min,"aria-valuenow":v,"aria-valuemax":l.max,"aria-orientation":l.orientation,"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,tabIndex:l.disabled?void 0:0,...i,ref:m,style:v===void 0?{display:"none"}:t.style,onFocus:$e(t.onFocus,()=>{l.valueIndexToChangeRef.current=r})})}),p&&a.jsx(nA,{name:s??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:v},r)]})});tA.displayName=d2;var eU="RadioBubbleInput",nA=S.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=S.useRef(null),i=Cn(s,r),l=f9(e);return S.useEffect(()=>{const c=s.current;if(!c)return;const d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==e&&m){const p=new Event("input",{bubbles:!0});m.call(c,e),c.dispatchEvent(p)}},[l,e]),a.jsx(Zt.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});nA.displayName=eU;function tU(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,i)=>s-i)}function rA(t,e,n){const i=100/(n-e)*(t-e);return F4(i,[0,100])}function nU(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function rU(t,e){if(t.length===1)return 0;const n=t.map(s=>Math.abs(s-e)),r=Math.min(...n);return n.indexOf(r)}function sU(t,e,n){const r=t/2,i=pw([0,50],[0,r]);return(r-i(e)*n)*n}function iU(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function aU(t,e){if(e>0){const n=iU(t);return Math.min(...n)>=e}return!0}function pw(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 lU(t){return(String(t).split(".")[1]||"").length}function oU(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var sA=GT,cU=JT,uU=eA,dU=tA;const yx=S.forwardRef(({className:t,...e},n)=>a.jsxs(sA,{ref:n,className:ye("relative flex w-full touch-none select-none items-center",t),...e,children:[a.jsx(cU,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:a.jsx(uU,{className:"absolute h-full bg-primary"})}),a.jsx(dU,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));yx.displayName=sA.displayName;const Lt=tq,It=nq,Dt=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(v9,{ref:r,className:ye("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,a.jsx(YI,{asChild:!0,children:a.jsx(df,{className:"h-4 w-4 opacity-50"})})]}));Dt.displayName=v9.displayName;const iA=S.forwardRef(({className:t,...e},n)=>a.jsx(y9,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(e2,{className:"h-4 w-4"})}));iA.displayName=y9.displayName;const aA=S.forwardRef(({className:t,...e},n)=>a.jsx(b9,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(df,{className:"h-4 w-4"})}));aA.displayName=b9.displayName;const Rt=S.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>a.jsx(KI,{children:a.jsxs(w9,{ref:s,className:ye("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 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 origin-[--radix-select-content-transform-origin]",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(iA,{}),a.jsx(ZI,{className:ye("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(aA,{})]})}));Rt.displayName=w9.displayName;const hU=S.forwardRef(({className:t,...e},n)=>a.jsx(S9,{ref:n,className:ye("px-2 py-1.5 text-sm font-semibold",t),...e}));hU.displayName=S9.displayName;const Pe=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(k9,{ref:r,className:ye("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[a.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(JI,{children:a.jsx(hc,{className:"h-4 w-4"})})}),a.jsx(eq,{children:e})]}));Pe.displayName=k9.displayName;const fU=S.forwardRef(({className:t,...e},n)=>a.jsx(O9,{ref:n,className:ye("-mx-1 my-1 h-px bg-muted",t),...e}));fU.displayName=O9.displayName;function mU(t){const e=pU(t),n=S.forwardRef((r,s)=>{const{children:i,...l}=r,c=S.Children.toArray(i),d=c.find(xU);if(d){const h=d.props.children,m=c.map(p=>p===d?S.Children.count(h)>1?S.Children.only(null):S.isValidElement(h)?h.props.children:null:p);return a.jsx(e,{...l,ref:s,children:S.isValidElement(h)?S.cloneElement(h,void 0,m):null})}return a.jsx(e,{...l,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function pU(t){const e=S.forwardRef((n,r)=>{const{children:s,...i}=n;if(S.isValidElement(s)){const l=yU(s),c=vU(i,s.props);return s.type!==S.Fragment&&(c.ref=r?oo(r,l):l),S.cloneElement(s,c)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var gU=Symbol("radix.slottable");function xU(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===gU}function vU(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...c)=>{const d=i(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function yU(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var bx="Popover",[lA]=Vi(bx,[wd]),r0=wd(),[bU,Oo]=lA(bx),oA=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:l=!1}=t,c=r0(e),d=S.useRef(null),[h,m]=S.useState(!1),[p,x]=ko({prop:r,defaultProp:s??!1,onChange:i,caller:bx});return a.jsx(ix,{...c,children:a.jsx(bU,{scope:e,contentId:ji(),triggerRef:d,open:p,onOpenChange:x,onOpenToggle:S.useCallback(()=>x(v=>!v),[x]),hasCustomAnchor:h,onCustomAnchorAdd:S.useCallback(()=>m(!0),[]),onCustomAnchorRemove:S.useCallback(()=>m(!1),[]),modal:l,children:n})})};oA.displayName=bx;var cA="PopoverAnchor",wU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Oo(cA,n),i=r0(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=s;return S.useEffect(()=>(l(),()=>c()),[l,c]),a.jsx(ax,{...i,...r,ref:e})});wU.displayName=cA;var uA="PopoverTrigger",dA=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Oo(uA,n),i=r0(n),l=Cn(e,s.triggerRef),c=a.jsx(Zt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":gA(s.open),...r,ref:l,onClick:$e(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:a.jsx(ax,{asChild:!0,...i,children:c})});dA.displayName=uA;var gw="PopoverPortal",[SU,kU]=lA(gw,{forceMount:void 0}),hA=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=Oo(gw,e);return a.jsx(SU,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};hA.displayName=gw;var ad="PopoverContent",fA=S.forwardRef((t,e)=>{const n=kU(ad,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=Oo(ad,t.__scopePopover);return a.jsx(Ls,{present:r||i.open,children:i.modal?a.jsx(jU,{...s,ref:e}):a.jsx(NU,{...s,ref:e})})});fA.displayName=ad;var OU=mU("PopoverContent.RemoveScroll"),jU=S.forwardRef((t,e)=>{const n=Oo(ad,t.__scopePopover),r=S.useRef(null),s=Cn(e,r),i=S.useRef(!1);return S.useEffect(()=>{const l=r.current;if(l)return j9(l)},[]),a.jsx(N9,{as:OU,allowPinchZoom:!0,children:a.jsx(mA,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:$e(t.onCloseAutoFocus,l=>{l.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:$e(t.onPointerDownOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,h=c.button===2||d;i.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:$e(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),NU=S.forwardRef((t,e)=>{const n=Oo(ad,t.__scopePopover),r=S.useRef(!1),s=S.useRef(!1);return a.jsx(mA,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=i.target;n.triggerRef.current?.contains(l)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),mA=S.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:m,...p}=t,x=Oo(ad,n),v=r0(n);return C9(),a.jsx(T9,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:m,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onDismiss:()=>x.onOpenChange(!1),children:a.jsx(X4,{"data-state":gA(x.open),role:"dialog",id:x.contentId,...v,...p,ref:e,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),pA="PopoverClose",CU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Oo(pA,n);return a.jsx(Zt.button,{type:"button",...r,ref:e,onClick:$e(t.onClick,()=>s.onOpenChange(!1))})});CU.displayName=pA;var TU="PopoverArrow",AU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=r0(n);return a.jsx(Y4,{...s,...r,ref:e})});AU.displayName=TU;function gA(t){return t?"open":"closed"}var MU=oA,EU=dA,_U=hA,xA=fA;const uo=MU,ho=EU,fl=S.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>a.jsx(_U,{children:a.jsx(xA,{ref:s,align:e,sideOffset:n,className:ye("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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 origin-[--radix-popover-content-transform-origin]",t),...r})}));fl.displayName=xA.displayName;const jo="/api/webui/config";async function DU(){const e=await(await ot(`${jo}/bot`)).json();if(!e.success)throw new Error("获取配置数据失败");return e.config}async function Vu(){const e=await(await ot(`${jo}/model`)).json();if(!e.success)throw new Error("获取模型配置数据失败");return e.config}async function XO(t){const n=await(await ot(`${jo}/bot`,{method:"POST",headers:bt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function RU(){const e=await(await ot(`${jo}/bot/raw`)).json();if(!e.success)throw new Error("获取配置源代码失败");return e.content}async function zU(t){const n=await(await ot(`${jo}/bot/raw`,{method:"POST",headers:bt(),body:JSON.stringify({raw_content:t})})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function wg(t){const n=await(await ot(`${jo}/model`,{method:"POST",headers:bt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function PU(t,e){const r=await(await ot(`${jo}/bot/section/${t}`,{method:"POST",headers:bt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function h2(t,e){const r=await(await ot(`${jo}/model/section/${t}`,{method:"POST",headers:bt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}const BU=Zn.create({baseURL:"",timeout:1e4});async function xw(){try{return(await BU.post("/api/webui/system/restart")).data}catch(t){throw console.error("重启麦麦失败:",t),t}}const LU=Nd("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),ld=S.forwardRef(({className:t,variant:e,...n},r)=>a.jsx("div",{ref:r,role:"alert",className:ye(LU({variant:e}),t),...n}));ld.displayName="Alert";const IU=S.forwardRef(({className:t,...e},n)=>a.jsx("h5",{ref:n,className:ye("mb-1 font-medium leading-none tracking-tight",t),...e}));IU.displayName="AlertTitle";const od=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("text-sm [&_p]:leading-relaxed",t),...e}));od.displayName="AlertDescription";function vw({onRestartComplete:t,onRestartFailed:e}){const[n,r]=S.useState(0),[s,i]=S.useState("restarting"),[l,c]=S.useState(0),[d,h]=S.useState(0);S.useEffect(()=>{const x=setInterval(()=>{r(k=>k>=90?k:k+1)},200),v=setInterval(()=>{c(k=>k+1)},1e3),b=setTimeout(()=>{i("checking"),m()},3e3);return()=>{clearInterval(x),clearInterval(v),clearTimeout(b)}},[]);const m=()=>{const v=async()=>{try{if(h(k=>k+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)r(100),i("success"),setTimeout(()=>{t?.()},1500);else throw new Error("Status check failed")}catch{d<60?setTimeout(v,2e3):(i("failed"),e?.())}};v()},p=x=>{const v=Math.floor(x/60),b=x%60;return`${v}:${b.toString().padStart(2,"0")}`};return a.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:a.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[a.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s==="restarting"&&a.jsxs(a.Fragment,{children:[a.jsx(hf,{className:"h-16 w-16 text-primary animate-spin"}),a.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),s==="checking"&&a.jsxs(a.Fragment,{children:[a.jsx(hf,{className:"h-16 w-16 text-primary animate-spin"}),a.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),a.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",d,"/60)"]})]}),s==="success"&&a.jsxs(a.Fragment,{children:[a.jsx(Es,{className:"h-16 w-16 text-green-500"}),a.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),s==="failed"&&a.jsxs(a.Fragment,{children:[a.jsx(xc,{className:"h-16 w-16 text-destructive"}),a.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),s!=="failed"&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(n0,{value:n,className:"h-2"}),a.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[a.jsxs("span",{children:[n,"%"]}),a.jsxs("span",{children:["已用时: ",p(l)]})]})]}),a.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="restarting"&&"🔄 配置已保存,正在重启主程序...",s==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",s==="success"&&"✅ 配置已生效,服务运行正常",s==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),s==="failed"&&a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),a.jsx("button",{onClick:()=>{i("checking"),h(0),m()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}let f2=[],vA=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e>1;if(t=vA[r])e=r+1;else return!0;if(e==n)return!1}}function YO(t){return t>=127462&&t<=127487}const KO=8205;function FU(t,e,n=!0,r=!0){return(n?yA:QU)(t,e,r)}function yA(t,e,n){if(e==t.length)return e;e&&bA(t.charCodeAt(e))&&wA(t.charCodeAt(e-1))&&e--;let r=Cy(t,e);for(e+=ZO(r);e=0&&YO(Cy(t,l));)i++,l-=2;if(i%2==0)break;e+=2}else break}return e}function QU(t,e,n){for(;e>0;){let r=yA(t,e-2,n);if(r=56320&&t<57344}function wA(t){return t>=55296&&t<56320}function ZO(t){return t<65536?1:2}class Xt{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=cd(this,e,n);let s=[];return this.decompose(0,e,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(n,this.length,s,1),Gp.from(s,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=cd(this,e,n);let r=[];return this.decompose(e,n,r,0),Gp.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),s=new Zh(this),i=new Zh(e);for(let l=n,c=n;;){if(s.next(l),i.next(l),l=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(c+=s.value.length,s.done||c>=r)return!0}}iter(e=1){return new Zh(this,e)}iterRange(e,n=this.length){return new SA(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let s=this.line(e).from;r=this.iterRange(s,Math.max(s,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new kA(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Xt.empty:e.length<=32?new ir(e):Gp.from(ir.split(e,[]))}}class ir extends Xt{constructor(e,n=$U(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,s){for(let i=0;;i++){let l=this.text[i],c=s+l.length;if((n?r:c)>=e)return new HU(s,c,r,l);s=c+1,r++}}decompose(e,n,r,s){let i=e<=0&&n>=this.length?this:new ir(JO(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let l=r.pop(),c=Xp(i.text,l.text.slice(),0,i.length);if(c.length<=32)r.push(new ir(c,l.length+i.length));else{let d=c.length>>1;r.push(new ir(c.slice(0,d)),new ir(c.slice(d)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof ir))return super.replace(e,n,r);[e,n]=cd(this,e,n);let s=Xp(this.text,Xp(r.text,JO(this.text,0,e)),n),i=this.length+r.length-(n-e);return s.length<=32?new ir(s,i):Gp.from(ir.split(s,[]),i)}sliceString(e,n=this.length,r=` -`){[e,n]=cd(this,e,n);let s="";for(let i=0,l=0;i<=n&&le&&l&&(s+=r),ei&&(s+=c.slice(Math.max(0,e-i),n-i)),i=d+1}return s}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],s=-1;for(let i of e)r.push(i),s+=i.length+1,r.length==32&&(n.push(new ir(r,s)),r=[],s=-1);return s>-1&&n.push(new ir(r,s)),n}}let Gp=class Du extends Xt{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,s){for(let i=0;;i++){let l=this.children[i],c=s+l.length,d=r+l.lines-1;if((n?d:c)>=e)return l.lineInner(e,n,r,s);s=c+1,r=d+1}}decompose(e,n,r,s){for(let i=0,l=0;l<=n&&i=l){let h=s&((l<=e?1:0)|(d>=n?2:0));l>=e&&d<=n&&!h?r.push(c):c.decompose(e-l,n-l,r,h)}l=d+1}}replace(e,n,r){if([e,n]=cd(this,e,n),r.lines=i&&n<=c){let d=l.replace(e-i,n-i,r),h=this.lines-l.lines+d.lines;if(d.lines>4&&d.lines>h>>6){let m=this.children.slice();return m[s]=d,new Du(m,this.length-(n-e)+r.length)}return super.replace(i,c,d)}i=c+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` -`){[e,n]=cd(this,e,n);let s="";for(let i=0,l=0;ie&&i&&(s+=r),el&&(s+=c.sliceString(e-l,n-l,r)),l=d+1}return s}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Du))return 0;let r=0,[s,i,l,c]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=n,i+=n){if(s==l||i==c)return r;let d=this.children[s],h=e.children[i];if(d!=h)return r+d.scanIdentical(h,n);r+=d.length+1}}static from(e,n=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let v of e)r+=v.lines;if(r<32){let v=[];for(let b of e)b.flatten(v);return new ir(v,n)}let s=Math.max(32,r>>5),i=s<<1,l=s>>1,c=[],d=0,h=-1,m=[];function p(v){let b;if(v.lines>i&&v instanceof Du)for(let k of v.children)p(k);else v.lines>l&&(d>l||!d)?(x(),c.push(v)):v instanceof ir&&d&&(b=m[m.length-1])instanceof ir&&v.lines+b.lines<=32?(d+=v.lines,h+=v.length+1,m[m.length-1]=new ir(b.text.concat(v.text),b.length+1+v.length)):(d+v.lines>s&&x(),d+=v.lines,h+=v.length+1,m.push(v))}function x(){d!=0&&(c.push(m.length==1?m[0]:Du.from(m,h)),h=-1,d=m.length=0)}for(let v of e)p(v);return x(),c.length==1?c[0]:new Du(c,n)}};Xt.empty=new ir([""],0);function $U(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Xp(t,e,n=0,r=1e9){for(let s=0,i=0,l=!0;i=n&&(d>r&&(c=c.slice(0,r-s)),s0?1:(e instanceof ir?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],i=this.offsets[r],l=i>>1,c=s instanceof ir?s.text.length:s.children.length;if(l==(n>0?c:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=` -`,this;e--}else if(s instanceof ir){let d=s.text[l+(n<0?-1:0)];if(this.offsets[r]+=n,d.length>Math.max(0,e))return this.value=e==0?d:n>0?d.slice(e):d.slice(0,d.length-e),this;e-=d.length}else{let d=s.children[l+(n<0?-1:0)];e>d.length?(e-=d.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(d),this.offsets.push(n>0?1:(d instanceof ir?d.text.length:d.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class SA{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new Zh(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*n,this.value=s.length<=r?s:n<0?s.slice(s.length-r):s.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class kA{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:s}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Xt.prototype[Symbol.iterator]=function(){return this.iter()},Zh.prototype[Symbol.iterator]=SA.prototype[Symbol.iterator]=kA.prototype[Symbol.iterator]=function(){return this});class HU{constructor(e,n,r,s){this.from=e,this.to=n,this.number=r,this.text=s}get length(){return this.to-this.from}}function cd(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function Vr(t,e,n=!0,r=!0){return FU(t,e,n,r)}function UU(t){return t>=56320&&t<57344}function VU(t){return t>=55296&&t<56320}function As(t,e){let n=t.charCodeAt(e);if(!VU(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return UU(r)?(n-55296<<10)+(r-56320)+65536:n}function yw(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function oa(t){return t<65536?1:2}const m2=/\r\n?|\n/;var Ur=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(Ur||(Ur={}));class va{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return i+(e-s);i+=c}else{if(r!=Ur.Simple&&h>=e&&(r==Ur.TrackDel&&se||r==Ur.TrackBefore&&se))return null;if(h>e||h==e&&n<0&&!c)return e==s||n<0?i:i+d;i+=d}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return i}touchesRange(e,n=e){for(let r=0,s=0;r=0&&s<=n&&c>=e)return sn?"cover":!0;s=c}return!1}toString(){let e="";for(let n=0;n=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new va(e)}static create(e){return new va(e)}}class kr extends va{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return p2(this,(n,r,s,i,l)=>e=e.replace(s,s+(r-n),l),!1),e}mapDesc(e,n=!1){return g2(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let s=0,i=0;s=0){n[s]=c,n[s+1]=l;let d=s>>1;for(;r.length0&&ro(r,n,i.text),i.forward(m),c+=m}let h=e[l++];for(;c>1].toJSON()))}return e}static of(e,n,r){let s=[],i=[],l=0,c=null;function d(m=!1){if(!m&&!s.length)return;lx||p<0||x>n)throw new RangeError(`Invalid change range ${p} to ${x} (in doc of length ${n})`);let b=v?typeof v=="string"?Xt.of(v.split(r||m2)):v:Xt.empty,k=b.length;if(p==x&&k==0)return;pl&&Jr(s,p-l,-1),Jr(s,x-p,k),ro(i,s,b),l=x}}return h(e),d(!c),c}static empty(e){return new kr(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let s=0;sc&&typeof l!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length=0&&n<=0&&n==t[s+1]?t[s]+=e:s>=0&&e==0&&t[s]==0?t[s+1]+=n:r?(t[s]+=e,t[s+1]+=n):t.push(e,n)}function ro(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r>1])),!(n||l==t.sections.length||t.sections[l+1]<0);)c=t.sections[l++],d=t.sections[l++];e(s,h,i,m,p),s=h,i=m}}}function g2(t,e,n,r=!1){let s=[],i=r?[]:null,l=new pf(t),c=new pf(e);for(let d=-1;;){if(l.done&&c.len||c.done&&l.len)throw new Error("Mismatched change set lengths");if(l.ins==-1&&c.ins==-1){let h=Math.min(l.len,c.len);Jr(s,h,-1),l.forward(h),c.forward(h)}else if(c.ins>=0&&(l.ins<0||d==l.i||l.off==0&&(c.len=0&&d=0){let h=0,m=l.len;for(;m;)if(c.ins==-1){let p=Math.min(m,c.len);h+=p,m-=p,c.forward(p)}else if(c.ins==0&&c.lend||l.ins>=0&&l.len>d)&&(c||r.length>h),i.forward2(d),l.forward(d)}}}}class pf{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?Xt.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?Xt.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class lc{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,s;return this.empty?r=s=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new lc(r,s,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return Ce.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return Ce.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Ce.range(e.anchor,e.head)}static create(e,n,r){return new lc(e,n,r)}}class Ce{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:Ce.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Ce(e.ranges.map(n=>lc.fromJSON(n)),e.main)}static single(e,n=e){return new Ce([Ce.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;se?8:0)|i)}static normalized(e,n=0){let r=e[n];e.sort((s,i)=>s.from-i.from),n=e.indexOf(r);for(let s=1;si.head?Ce.range(d,c):Ce.range(c,d))}}return new Ce(e,n)}}function jA(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let bw=0;class He{constructor(e,n,r,s,i){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=bw++,this.default=e([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(e={}){return new He(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:ww),!!e.static,e.enables)}of(e){return new Yp([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yp(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yp(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function ww(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Yp{constructor(e,n,r,s){this.dependencies=e,this.facet=n,this.type=r,this.value=s,this.id=bw++}dynamicSlot(e){var n;let r=this.value,s=this.facet.compareInput,i=this.id,l=e[i]>>1,c=this.type==2,d=!1,h=!1,m=[];for(let p of this.dependencies)p=="doc"?d=!0:p=="selection"?h=!0:(((n=e[p.id])!==null&&n!==void 0?n:1)&1)==0&&m.push(e[p.id]);return{create(p){return p.values[l]=r(p),1},update(p,x){if(d&&x.docChanged||h&&(x.docChanged||x.selection)||x2(p,m)){let v=r(p);if(c?!ej(v,p.values[l],s):!s(v,p.values[l]))return p.values[l]=v,1}return 0},reconfigure:(p,x)=>{let v,b=x.config.address[i];if(b!=null){let k=kg(x,b);if(this.dependencies.every(O=>O instanceof He?x.facet(O)===p.facet(O):O instanceof Br?x.field(O,!1)==p.field(O,!1):!0)||(c?ej(v=r(p),k,s):s(v=r(p),k)))return p.values[l]=k,0}else v=r(p);return p.values[l]=v,1}}}}function ej(t,e,n){if(t.length!=e.length)return!1;for(let r=0;rt[d.id]),s=n.map(d=>d.type),i=r.filter(d=>!(d&1)),l=t[e.id]>>1;function c(d){let h=[];for(let m=0;mr===s),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Zm).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let i=r.values[n],l=this.updateF(i,s);return this.compareF(i,l)?0:(r.values[n]=l,1)},reconfigure:(r,s)=>{let i=r.facet(Zm),l=s.facet(Zm),c;return(c=i.find(d=>d.field==this))&&c!=l.find(d=>d.field==this)?(r.values[n]=c.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Zm.of({field:this,create:e})]}get extension(){return this}}const sc={lowest:4,low:3,default:2,high:1,highest:0};function _h(t){return e=>new NA(e,t)}const No={highest:_h(sc.highest),high:_h(sc.high),default:_h(sc.default),low:_h(sc.low),lowest:_h(sc.lowest)};class NA{constructor(e,n){this.inner=e,this.prec=n}}class wx{of(e){return new v2(this,e)}reconfigure(e){return wx.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class v2{constructor(e,n){this.compartment=e,this.inner=n}}class Sg{constructor(e,n,r,s,i,l){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=l,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,r){let s=[],i=Object.create(null),l=new Map;for(let x of GU(e,n,l))x instanceof Br?s.push(x):(i[x.facet.id]||(i[x.facet.id]=[])).push(x);let c=Object.create(null),d=[],h=[];for(let x of s)c[x.id]=h.length<<1,h.push(v=>x.slot(v));let m=r?.config.facets;for(let x in i){let v=i[x],b=v[0].facet,k=m&&m[x]||[];if(v.every(O=>O.type==0))if(c[b.id]=d.length<<1|1,ww(k,v))d.push(r.facet(b));else{let O=b.combine(v.map(j=>j.value));d.push(r&&b.compare(O,r.facet(b))?r.facet(b):O)}else{for(let O of v)O.type==0?(c[O.id]=d.length<<1|1,d.push(O.value)):(c[O.id]=h.length<<1,h.push(j=>O.dynamicSlot(j)));c[b.id]=h.length<<1,h.push(O=>WU(O,b,v))}}let p=h.map(x=>x(c));return new Sg(e,l,p,c,d,i)}}function GU(t,e,n){let r=[[],[],[],[],[]],s=new Map;function i(l,c){let d=s.get(l);if(d!=null){if(d<=c)return;let h=r[d].indexOf(l);h>-1&&r[d].splice(h,1),l instanceof v2&&n.delete(l.compartment)}if(s.set(l,c),Array.isArray(l))for(let h of l)i(h,c);else if(l instanceof v2){if(n.has(l.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(l.compartment)||l.inner;n.set(l.compartment,h),i(h,c)}else if(l instanceof NA)i(l.inner,l.prec);else if(l instanceof Br)r[c].push(l),l.provides&&i(l.provides,c);else if(l instanceof Yp)r[c].push(l),l.facet.extensions&&i(l.facet.extensions,sc.default);else{let h=l.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${l}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(h,c)}}return i(t,sc.default),r.reduce((l,c)=>l.concat(c))}function Jh(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let s=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|s}function kg(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const CA=He.define(),y2=He.define({combine:t=>t.some(e=>e),static:!0}),TA=He.define({combine:t=>t.length?t[0]:void 0,static:!0}),AA=He.define(),MA=He.define(),EA=He.define(),_A=He.define({combine:t=>t.length?t[0]:!1});class ka{constructor(e,n){this.type=e,this.value=n}static define(){return new XU}}class XU{of(e){return new ka(this,e)}}class YU{constructor(e){this.map=e}of(e){return new vt(this,e)}}class vt{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new vt(this.type,n)}is(e){return this.type==e}static define(e={}){return new YU(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let s of e){let i=s.map(n);i&&r.push(i)}return r}}vt.reconfigure=vt.define();vt.appendConfig=vt.define();class gr{constructor(e,n,r,s,i,l){this.startState=e,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=l,this._doc=null,this._state=null,r&&jA(r,n.newLength),i.some(c=>c.type==gr.time)||(this.annotations=i.concat(gr.time.of(Date.now())))}static create(e,n,r,s,i,l){return new gr(e,n,r,s,i,l)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(gr.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}gr.time=ka.define();gr.userEvent=ka.define();gr.addToHistory=ka.define();gr.remote=ka.define();function KU(t,e){let n=[];for(let r=0,s=0;;){let i,l;if(r=t[r]))i=t[r++],l=t[r++];else if(s=0;s--){let i=r[s](t);i instanceof gr?t=i:Array.isArray(i)&&i.length==1&&i[0]instanceof gr?t=i[0]:t=RA(e,Wu(i),!1)}return t}function JU(t){let e=t.startState,n=e.facet(EA),r=t;for(let s=n.length-1;s>=0;s--){let i=n[s](t);i&&Object.keys(i).length&&(r=DA(r,b2(e,i,t.changes.newLength),!0))}return r==t?t:gr.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const eV=[];function Wu(t){return t==null?eV:Array.isArray(t)?t:[t]}var Vn=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(Vn||(Vn={}));const tV=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let w2;try{w2=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function nV(t){if(w2)return w2.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||tV.test(n)))return!0}return!1}function rV(t){return e=>{if(!/\S/.test(e))return Vn.Space;if(nV(e))return Vn.Word;for(let n=0;n-1)return Vn.Word;return Vn.Other}}class Vt{constructor(e,n,r,s,i,l){this.config=e,this.doc=n,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=i,l&&(l._state=this);for(let c=0;cs.set(h,d)),n=null),s.set(c.value.compartment,c.value.extension)):c.is(vt.reconfigure)?(n=null,r=c.value):c.is(vt.appendConfig)&&(n=null,r=Wu(r).concat(c.value));let i;n?i=e.startState.values.slice():(n=Sg.resolve(r,s,this),i=new Vt(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(d,h)=>h.reconfigure(d,this),null).values);let l=e.startState.facet(y2)?e.newSelection:e.newSelection.asSingle();new Vt(n,e.newDoc,l,i,(c,d)=>d.update(c,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:Ce.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),s=this.changes(r.changes),i=[r.range],l=Wu(r.effects);for(let c=1;cl.spec.fromJSON(c,d)))}}return Vt.create({doc:e.doc,selection:Ce.fromJSON(e.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(e={}){let n=Sg.resolve(e.extensions||[],new Map),r=e.doc instanceof Xt?e.doc:Xt.of((e.doc||"").split(n.staticFacet(Vt.lineSeparator)||m2)),s=e.selection?e.selection instanceof Ce?e.selection:Ce.single(e.selection.anchor,e.selection.head):Ce.single(0);return jA(s,r.length),n.staticFacet(y2)||(s=s.asSingle()),new Vt(n,r,s,n.dynamicSlots.map(()=>null),(i,l)=>l.create(i),null)}get tabSize(){return this.facet(Vt.tabSize)}get lineBreak(){return this.facet(Vt.lineSeparator)||` -`}get readOnly(){return this.facet(_A)}phrase(e,...n){for(let r of this.facet(Vt.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let i=+(s||1);return!i||i>n.length?r:n[i-1]})),e}languageDataAt(e,n,r=-1){let s=[];for(let i of this.facet(CA))for(let l of i(this,n,r))Object.prototype.hasOwnProperty.call(l,e)&&s.push(l[e]);return s}charCategorizer(e){return rV(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:r,length:s}=this.doc.lineAt(e),i=this.charCategorizer(e),l=e-r,c=e-r;for(;l>0;){let d=Vr(n,l,!1);if(i(n.slice(d,l))!=Vn.Word)break;l=d}for(;ct.length?t[0]:4});Vt.lineSeparator=TA;Vt.readOnly=_A;Vt.phrases=He.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(s=>t[s]==e[s])}});Vt.languageData=CA;Vt.changeFilter=AA;Vt.transactionFilter=MA;Vt.transactionExtender=EA;wx.reconfigure=vt.define();function Oa(t,e,n={}){let r={};for(let s of t)for(let i of Object.keys(s)){let l=s[i],c=r[i];if(c===void 0)r[i]=l;else if(!(c===l||l===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](c,l);else throw new Error("Config merge conflict for field "+i)}for(let s in e)r[s]===void 0&&(r[s]=e[s]);return r}class yc{eq(e){return this==e}range(e,n=e){return S2.create(e,n,this)}}yc.prototype.startSide=yc.prototype.endSide=0;yc.prototype.point=!1;yc.prototype.mapMode=Ur.TrackDel;let S2=class zA{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new zA(e,n,r)}};function k2(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Sw{constructor(e,n,r,s){this.from=e,this.to=n,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,s=0){let i=r?this.to:this.from;for(let l=s,c=i.length;;){if(l==c)return l;let d=l+c>>1,h=i[d]-e||(r?this.value[d].endSide:this.value[d].startSide)-n;if(d==l)return h>=0?l:c;h>=0?c=d:l=d+1}}between(e,n,r,s){for(let i=this.findIndex(n,-1e9,!0),l=this.findIndex(r,1e9,!1,i);iv||x==v&&h.startSide>0&&h.endSide<=0)continue;(v-x||h.endSide-h.startSide)<0||(l<0&&(l=x),h.point&&(c=Math.max(c,v-x)),r.push(h),s.push(x-l),i.push(v-l))}return{mapped:r.length?new Sw(s,i,r,c):null,pos:l}}}class Yt{constructor(e,n,r,s){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=s}static create(e,n,r,s){return new Yt(e,n,r,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:s=0,filterTo:i=this.length}=e,l=e.filter;if(n.length==0&&!l)return this;if(r&&(n=n.slice().sort(k2)),this.isEmpty)return n.length?Yt.of(n):this;let c=new PA(this,null,-1).goto(0),d=0,h=[],m=new ml;for(;c.value||d=0){let p=n[d++];m.addInner(p.from,p.to,p.value)||h.push(p)}else c.rangeIndex==1&&c.chunkIndexthis.chunkEnd(c.chunkIndex)||ic.to||i=i&&e<=i+l.length&&l.between(i,e-i,n-i,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return gf.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return gf.from(e).goto(n)}static compare(e,n,r,s,i=-1){let l=e.filter(p=>p.maxPoint>0||!p.isEmpty&&p.maxPoint>=i),c=n.filter(p=>p.maxPoint>0||!p.isEmpty&&p.maxPoint>=i),d=tj(l,c,r),h=new Dh(l,d,i),m=new Dh(c,d,i);r.iterGaps((p,x,v)=>nj(h,p,m,x,v,s)),r.empty&&r.length==0&&nj(h,0,m,0,0,s)}static eq(e,n,r=0,s){s==null&&(s=999999999);let i=e.filter(m=>!m.isEmpty&&n.indexOf(m)<0),l=n.filter(m=>!m.isEmpty&&e.indexOf(m)<0);if(i.length!=l.length)return!1;if(!i.length)return!0;let c=tj(i,l),d=new Dh(i,c,0).goto(r),h=new Dh(l,c,0).goto(r);for(;;){if(d.to!=h.to||!O2(d.active,h.active)||d.point&&(!h.point||!d.point.eq(h.point)))return!1;if(d.to>s)return!0;d.next(),h.next()}}static spans(e,n,r,s,i=-1){let l=new Dh(e,null,i).goto(n),c=n,d=l.openStart;for(;;){let h=Math.min(l.to,r);if(l.point){let m=l.activeForPoint(l.to),p=l.pointFromc&&(s.span(c,h,l.active,d),d=l.openEnd(h));if(l.to>r)return d+(l.point&&l.to>r?1:0);c=l.to,l.next()}}static of(e,n=!1){let r=new ml;for(let s of e instanceof S2?[e]:n?sV(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return Yt.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=Yt.empty;s=s.nextLayer)n=new Yt(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}Yt.empty=new Yt([],[],null,-1);function sV(t){if(t.length>1)for(let e=t[0],n=1;n0)return t.slice().sort(k2);e=r}return t}Yt.empty.nextLayer=Yt.empty;class ml{finishChunk(e){this.chunks.push(new Sw(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new ml)).add(e,n,r)}addInner(e,n,r){let s=e-this.lastTo||r.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(Yt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=Yt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function tj(t,e,n){let r=new Map;for(let i of t)for(let l=0;l=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&s.push(new PA(l,n,r,i));return s.length==1?s[0]:new gf(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)Ty(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)Ty(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Ty(this.heap,0)}}}function Ty(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let s=t[r];if(r+1=0&&(s=t[r+1],r++),n.compare(s)<0)break;t[r]=n,t[e]=s,e=r}}class Dh{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=gf.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){Jm(this.active,e),Jm(this.activeTo,e),Jm(this.activeRank,e),this.minActive=rj(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:s,rank:i}=this.cursor;for(;n0;)n++;ep(this.active,n,r),ep(this.activeTo,n,s),ep(this.activeRank,n,i),e&&ep(e,n,this.cursor.from),this.minActive=rj(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&Jm(r,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&r[s]=0&&!(this.activeRank[r]e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function nj(t,e,n,r,s,i){t.goto(e),n.goto(r);let l=r+s,c=r,d=r-e;for(;;){let h=t.to+d-n.to,m=h||t.endSide-n.endSide,p=m<0?t.to+d:n.to,x=Math.min(p,l);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&O2(t.activeForPoint(t.to),n.activeForPoint(n.to))||i.comparePoint(c,x,t.point,n.point):x>c&&!O2(t.active,n.active)&&i.compareRange(c,x,t.active,n.active),p>l)break;(h||t.openEnd!=n.openEnd)&&i.boundChange&&i.boundChange(p),c=p,m<=0&&t.next(),m>=0&&n.next()}}function O2(t,e){if(t.length!=e.length)return!1;for(let n=0;n=e;r--)t[r+1]=t[r];t[e]=n}function rj(t,e){let n=-1,r=1e9;for(let s=0;s=e)return s;if(s==t.length)break;i+=t.charCodeAt(s)==9?n-i%n:1,s=Vr(t,s)}return r===!0?-1:t.length}const N2="ͼ",sj=typeof Symbol>"u"?"__"+N2:Symbol.for(N2),C2=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),ij=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class fo{constructor(e,n){this.rules=[];let{finish:r}=n||{};function s(l){return/^@/.test(l)?[l]:l.split(/,\s*/)}function i(l,c,d,h){let m=[],p=/^@(\w+)\b/.exec(l[0]),x=p&&p[1]=="keyframes";if(p&&c==null)return d.push(l[0]+";");for(let v in c){let b=c[v];if(/&/.test(v))i(v.split(/,\s*/).map(k=>l.map(O=>k.replace(/&/,O))).reduce((k,O)=>k.concat(O)),b,d);else if(b&&typeof b=="object"){if(!p)throw new RangeError("The value of a property ("+v+") should be a primitive value.");i(s(v),b,m,x)}else b!=null&&m.push(v.replace(/_.*/,"").replace(/[A-Z]/g,k=>"-"+k.toLowerCase())+": "+b+";")}(m.length||x)&&d.push((r&&!p&&!h?l.map(r):l).join(", ")+" {"+m.join(" ")+"}")}for(let l in e)i(s(l),e[l],this.rules)}getRules(){return this.rules.join(` +3.某句话如果已经被回复过,不要重复回复`}),[b,k]=S.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[O,j]=S.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遭遇特定事件的时候起伏较大",all_global:!0}),T=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:xq},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:D9},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:K4},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:dc},{id:"complete",title:"完成设置",description:"后续配置提示",icon:uf}],M=(n+1)/T.length*100;S.useEffect(()=>{(async()=>{try{h(!0);const[U,V,ce,W]=await Promise.all([IH(),qH(),FH(),QH()]);p(U),v(V),k(ce),j(W)}catch(U){e({title:"加载配置失败",description:U instanceof Error?U.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{h(!1)}})()},[e]);const _=async()=>{c(!0);try{switch(n){case 0:await $H(m);break;case 1:await HH(x);break;case 2:await UH(b);break;case 3:await VH(O);break}return e({title:"保存成功",description:`${T[n].title}配置已保存`}),!0}catch(L){return e({title:"保存失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"}),!1}finally{c(!1)}},D=async()=>{await _()&&n{n>0&&r(n-1)},z=async()=>{i(!0);try{if(!await _()){i(!1);return}await GO(),e({title:"配置完成",description:"所有配置已保存,正在跳转..."}),setTimeout(()=>{t({to:"/"})},500)}catch(L){e({title:"完成失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}finally{i(!1)}},Q=async()=>{try{await GO(),t({to:"/"})}catch(L){e({title:"跳过失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},F=()=>{switch(n){case 0:return a.jsx(zH,{config:m,onChange:p});case 1:return a.jsx(PH,{config:x,onChange:v});case 2:return a.jsx(BH,{config:b,onChange:k});case 3:return a.jsx(LH,{config:O,onChange:j});case 4:return a.jsxs("div",{className:"space-y-6 text-center py-8",children:[a.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:a.jsx(uf,{className:"h-8 w-8 text-primary",strokeWidth:2})}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h3",{className:"text-xl font-semibold",children:"模型配置"}),a.jsx("p",{className:"text-muted-foreground max-w-md mx-auto",children:"为了让机器人正常工作,您需要配置 AI 模型提供商和模型。"})]}),a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-6 max-w-md mx-auto text-left space-y-4",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"1"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"配置 API 提供商"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → API 提供商"中添加您的 API 提供商信息'})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"2"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"添加模型"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型列表"中添加需要使用的模型'})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"3"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"配置模型任务"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型任务配置"中为不同任务分配模型'})]})]})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"💡 提示:完成向导后,您可以在系统设置中进行详细的模型配置"})]});default:return null}};return a.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[a.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[a.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),a.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),d?a.jsxs("div",{className:"relative z-10 text-center",children:[a.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:a.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),a.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),a.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[a.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[a.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:a.jsx(gq,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),a.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),a.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",fw," 的初始配置"]})]}),a.jsxs("div",{className:"mb-6 md:mb-8",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[a.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",T.length]}),a.jsxs("span",{className:"font-medium text-primary",children:[Math.round(M),"%"]})]}),a.jsx(n0,{value:M,className:"h-2"})]}),a.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:T.map((L,U)=>{const V=L.icon;return a.jsxs("div",{className:ye("flex flex-1 flex-col items-center gap-1 md:gap-2",Ut({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[a.jsx(hg,{className:"h-4 w-4"}),"返回首页"]}),a.jsxs(ie,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[a.jsx(R9,{className:"h-4 w-4"}),"返回上一页"]})]}),a.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var HT=["PageUp","PageDown"],UT=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],VT={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Cd="Slider",[c2,GH,XH]=tx(Cd),[WT]=Hi(Cd,[XH]),[YH,vx]=WT(Cd),GT=S.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:l="horizontal",disabled:c=!1,minStepsBetweenThumbs:d=0,defaultValue:h=[r],value:m,onValueChange:p=()=>{},onValueCommit:x=()=>{},inverted:v=!1,form:b,...k}=t,O=S.useRef(new Set),j=S.useRef(0),M=l==="horizontal"?KH:ZH,[_=[],D]=So({prop:m,defaultProp:h,onChange:U=>{[...O.current][j.current]?.focus(),p(U)}}),E=S.useRef(_);function z(U){const V=rU(_,U);L(U,V)}function Q(U){L(U,j.current)}function F(){const U=E.current[j.current];_[j.current]!==U&&x(_)}function L(U,V,{commit:ce}={commit:!1}){const W=lU(i),J=oU(Math.round((U-r)/i)*i+r,W),H=F4(J,[r,s]);D((ae=[])=>{const ne=tU(ae,H,V);if(aU(ne,d*i)){j.current=ne.indexOf(H);const ue=String(ne)!==String(ae);return ue&&ce&&x(ne),ue?ne:ae}else return ae})}return a.jsx(YH,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:s,valueIndexToChangeRef:j,thumbs:O.current,values:_,orientation:l,form:b,children:a.jsx(c2.Provider,{scope:t.__scopeSlider,children:a.jsx(c2.Slot,{scope:t.__scopeSlider,children:a.jsx(M,{"aria-disabled":c,"data-disabled":c?"":void 0,...k,ref:e,onPointerDown:$e(k.onPointerDown,()=>{c||(E.current=_)}),min:r,max:s,inverted:v,onSlideStart:c?void 0:z,onSlideMove:c?void 0:Q,onSlideEnd:c?void 0:F,onHomeKeyDown:()=>!c&&L(r,0,{commit:!0}),onEndKeyDown:()=>!c&&L(s,_.length-1,{commit:!0}),onStepKeyDown:({event:U,direction:V})=>{if(!c){const J=HT.includes(U.key)||U.shiftKey&&UT.includes(U.key)?10:1,H=j.current,ae=_[H],ne=i*J*V;L(ae+ne,H,{commit:!0})}}})})})})});GT.displayName=Cd;var[XT,YT]=WT(Cd,{startEdge:"left",endEdge:"right",size:"width",direction:1}),KH=S.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:l,onSlideMove:c,onSlideEnd:d,onStepKeyDown:h,...m}=t,[p,x]=S.useState(null),v=Cn(e,M=>x(M)),b=S.useRef(void 0),k=Vf(s),O=k==="ltr",j=O&&!i||!O&&i;function T(M){const _=b.current||p.getBoundingClientRect(),D=[0,_.width],z=pw(D,j?[n,r]:[r,n]);return b.current=_,z(M-_.left)}return a.jsx(XT,{scope:t.__scopeSlider,startEdge:j?"left":"right",endEdge:j?"right":"left",direction:j?1:-1,size:"width",children:a.jsx(KT,{dir:k,"data-orientation":"horizontal",...m,ref:v,style:{...m.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:M=>{const _=T(M.clientX);l?.(_)},onSlideMove:M=>{const _=T(M.clientX);c?.(_)},onSlideEnd:()=>{b.current=void 0,d?.()},onStepKeyDown:M=>{const D=VT[j?"from-left":"from-right"].includes(M.key);h?.({event:M,direction:D?-1:1})}})})}),ZH=S.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...h}=t,m=S.useRef(null),p=Cn(e,m),x=S.useRef(void 0),v=!s;function b(k){const O=x.current||m.current.getBoundingClientRect(),j=[0,O.height],M=pw(j,v?[r,n]:[n,r]);return x.current=O,M(k-O.top)}return a.jsx(XT,{scope:t.__scopeSlider,startEdge:v?"bottom":"top",endEdge:v?"top":"bottom",size:"height",direction:v?1:-1,children:a.jsx(KT,{"data-orientation":"vertical",...h,ref:p,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:k=>{const O=b(k.clientY);i?.(O)},onSlideMove:k=>{const O=b(k.clientY);l?.(O)},onSlideEnd:()=>{x.current=void 0,c?.()},onStepKeyDown:k=>{const j=VT[v?"from-bottom":"from-top"].includes(k.key);d?.({event:k,direction:j?-1:1})}})})}),KT=S.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:l,onEndKeyDown:c,onStepKeyDown:d,...h}=t,m=vx(Cd,n);return a.jsx(Yt.span,{...h,ref:e,onKeyDown:$e(t.onKeyDown,p=>{p.key==="Home"?(l(p),p.preventDefault()):p.key==="End"?(c(p),p.preventDefault()):HT.concat(UT).includes(p.key)&&(d(p),p.preventDefault())}),onPointerDown:$e(t.onPointerDown,p=>{const x=p.target;x.setPointerCapture(p.pointerId),p.preventDefault(),m.thumbs.has(x)?x.focus():r(p)}),onPointerMove:$e(t.onPointerMove,p=>{p.target.hasPointerCapture(p.pointerId)&&s(p)}),onPointerUp:$e(t.onPointerUp,p=>{const x=p.target;x.hasPointerCapture(p.pointerId)&&(x.releasePointerCapture(p.pointerId),i(p))})})}),ZT="SliderTrack",JT=S.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=vx(ZT,n);return a.jsx(Yt.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});JT.displayName=ZT;var u2="SliderRange",eM=S.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=vx(u2,n),i=YT(u2,n),l=S.useRef(null),c=Cn(e,l),d=s.values.length,h=s.values.map(x=>rM(x,s.min,s.max)),m=d>1?Math.min(...h):0,p=100-Math.max(...h);return a.jsx(Yt.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:m+"%",[i.endEdge]:p+"%"}})});eM.displayName=u2;var d2="SliderThumb",tM=S.forwardRef((t,e)=>{const n=GH(t.__scopeSlider),[r,s]=S.useState(null),i=Cn(e,c=>s(c)),l=S.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return a.jsx(JH,{...t,ref:i,index:l})}),JH=S.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...i}=t,l=vx(d2,n),c=YT(d2,n),[d,h]=S.useState(null),m=Cn(e,T=>h(T)),p=d?l.form||!!d.closest("form"):!0,x=m9(d),v=l.values[r],b=v===void 0?0:rM(v,l.min,l.max),k=nU(r,l.values.length),O=x?.[c.size],j=O?sU(O,b,c.direction):0;return S.useEffect(()=>{if(d)return l.thumbs.add(d),()=>{l.thumbs.delete(d)}},[d,l.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${b}% + ${j}px)`},children:[a.jsx(c2.ItemSlot,{scope:t.__scopeSlider,children:a.jsx(Yt.span,{role:"slider","aria-label":t["aria-label"]||k,"aria-valuemin":l.min,"aria-valuenow":v,"aria-valuemax":l.max,"aria-orientation":l.orientation,"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,tabIndex:l.disabled?void 0:0,...i,ref:m,style:v===void 0?{display:"none"}:t.style,onFocus:$e(t.onFocus,()=>{l.valueIndexToChangeRef.current=r})})}),p&&a.jsx(nM,{name:s??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:v},r)]})});tM.displayName=d2;var eU="RadioBubbleInput",nM=S.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=S.useRef(null),i=Cn(s,r),l=f9(e);return S.useEffect(()=>{const c=s.current;if(!c)return;const d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==e&&m){const p=new Event("input",{bubbles:!0});m.call(c,e),c.dispatchEvent(p)}},[l,e]),a.jsx(Yt.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});nM.displayName=eU;function tU(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,i)=>s-i)}function rM(t,e,n){const i=100/(n-e)*(t-e);return F4(i,[0,100])}function nU(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function rU(t,e){if(t.length===1)return 0;const n=t.map(s=>Math.abs(s-e)),r=Math.min(...n);return n.indexOf(r)}function sU(t,e,n){const r=t/2,i=pw([0,50],[0,r]);return(r-i(e)*n)*n}function iU(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function aU(t,e){if(e>0){const n=iU(t);return Math.min(...n)>=e}return!0}function pw(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 lU(t){return(String(t).split(".")[1]||"").length}function oU(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var sM=GT,cU=JT,uU=eM,dU=tM;const yx=S.forwardRef(({className:t,...e},n)=>a.jsxs(sM,{ref:n,className:ye("relative flex w-full touch-none select-none items-center",t),...e,children:[a.jsx(cU,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:a.jsx(uU,{className:"absolute h-full bg-primary"})}),a.jsx(dU,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));yx.displayName=sM.displayName;const Lt=tq,It=nq,Dt=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(v9,{ref:r,className:ye("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,a.jsx(YI,{asChild:!0,children:a.jsx(df,{className:"h-4 w-4 opacity-50"})})]}));Dt.displayName=v9.displayName;const iM=S.forwardRef(({className:t,...e},n)=>a.jsx(y9,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(e2,{className:"h-4 w-4"})}));iM.displayName=y9.displayName;const aM=S.forwardRef(({className:t,...e},n)=>a.jsx(b9,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(df,{className:"h-4 w-4"})}));aM.displayName=b9.displayName;const Rt=S.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>a.jsx(KI,{children:a.jsxs(w9,{ref:s,className:ye("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 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 origin-[--radix-select-content-transform-origin]",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(iM,{}),a.jsx(ZI,{className:ye("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(aM,{})]})}));Rt.displayName=w9.displayName;const hU=S.forwardRef(({className:t,...e},n)=>a.jsx(S9,{ref:n,className:ye("px-2 py-1.5 text-sm font-semibold",t),...e}));hU.displayName=S9.displayName;const Pe=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(k9,{ref:r,className:ye("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[a.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(JI,{children:a.jsx(hc,{className:"h-4 w-4"})})}),a.jsx(eq,{children:e})]}));Pe.displayName=k9.displayName;const fU=S.forwardRef(({className:t,...e},n)=>a.jsx(O9,{ref:n,className:ye("-mx-1 my-1 h-px bg-muted",t),...e}));fU.displayName=O9.displayName;function mU(t){const e=pU(t),n=S.forwardRef((r,s)=>{const{children:i,...l}=r,c=S.Children.toArray(i),d=c.find(xU);if(d){const h=d.props.children,m=c.map(p=>p===d?S.Children.count(h)>1?S.Children.only(null):S.isValidElement(h)?h.props.children:null:p);return a.jsx(e,{...l,ref:s,children:S.isValidElement(h)?S.cloneElement(h,void 0,m):null})}return a.jsx(e,{...l,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function pU(t){const e=S.forwardRef((n,r)=>{const{children:s,...i}=n;if(S.isValidElement(s)){const l=yU(s),c=vU(i,s.props);return s.type!==S.Fragment&&(c.ref=r?lo(r,l):l),S.cloneElement(s,c)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var gU=Symbol("radix.slottable");function xU(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===gU}function vU(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...c)=>{const d=i(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function yU(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var bx="Popover",[lM]=Hi(bx,[wd]),r0=wd(),[bU,ko]=lM(bx),oM=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:l=!1}=t,c=r0(e),d=S.useRef(null),[h,m]=S.useState(!1),[p,x]=So({prop:r,defaultProp:s??!1,onChange:i,caller:bx});return a.jsx(ix,{...c,children:a.jsx(bU,{scope:e,contentId:Oi(),triggerRef:d,open:p,onOpenChange:x,onOpenToggle:S.useCallback(()=>x(v=>!v),[x]),hasCustomAnchor:h,onCustomAnchorAdd:S.useCallback(()=>m(!0),[]),onCustomAnchorRemove:S.useCallback(()=>m(!1),[]),modal:l,children:n})})};oM.displayName=bx;var cM="PopoverAnchor",wU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=ko(cM,n),i=r0(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=s;return S.useEffect(()=>(l(),()=>c()),[l,c]),a.jsx(ax,{...i,...r,ref:e})});wU.displayName=cM;var uM="PopoverTrigger",dM=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=ko(uM,n),i=r0(n),l=Cn(e,s.triggerRef),c=a.jsx(Yt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":gM(s.open),...r,ref:l,onClick:$e(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:a.jsx(ax,{asChild:!0,...i,children:c})});dM.displayName=uM;var gw="PopoverPortal",[SU,kU]=lM(gw,{forceMount:void 0}),hM=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=ko(gw,e);return a.jsx(SU,{scope:e,forceMount:n,children:a.jsx(Bs,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};hM.displayName=gw;var ad="PopoverContent",fM=S.forwardRef((t,e)=>{const n=kU(ad,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=ko(ad,t.__scopePopover);return a.jsx(Bs,{present:r||i.open,children:i.modal?a.jsx(jU,{...s,ref:e}):a.jsx(NU,{...s,ref:e})})});fM.displayName=ad;var OU=mU("PopoverContent.RemoveScroll"),jU=S.forwardRef((t,e)=>{const n=ko(ad,t.__scopePopover),r=S.useRef(null),s=Cn(e,r),i=S.useRef(!1);return S.useEffect(()=>{const l=r.current;if(l)return j9(l)},[]),a.jsx(N9,{as:OU,allowPinchZoom:!0,children:a.jsx(mM,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:$e(t.onCloseAutoFocus,l=>{l.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:$e(t.onPointerDownOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,h=c.button===2||d;i.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:$e(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),NU=S.forwardRef((t,e)=>{const n=ko(ad,t.__scopePopover),r=S.useRef(!1),s=S.useRef(!1);return a.jsx(mM,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=i.target;n.triggerRef.current?.contains(l)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),mM=S.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:m,...p}=t,x=ko(ad,n),v=r0(n);return C9(),a.jsx(T9,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:m,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onDismiss:()=>x.onOpenChange(!1),children:a.jsx(X4,{"data-state":gM(x.open),role:"dialog",id:x.contentId,...v,...p,ref:e,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),pM="PopoverClose",CU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=ko(pM,n);return a.jsx(Yt.button,{type:"button",...r,ref:e,onClick:$e(t.onClick,()=>s.onOpenChange(!1))})});CU.displayName=pM;var TU="PopoverArrow",MU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=r0(n);return a.jsx(Y4,{...s,...r,ref:e})});MU.displayName=TU;function gM(t){return t?"open":"closed"}var AU=oM,EU=dM,_U=hM,xM=fM;const co=AU,uo=EU,hl=S.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>a.jsx(_U,{children:a.jsx(xM,{ref:s,align:e,sideOffset:n,className:ye("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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 origin-[--radix-popover-content-transform-origin]",t),...r})}));hl.displayName=xM.displayName;const Oo="/api/webui/config";async function DU(){const e=await(await ot(`${Oo}/bot`)).json();if(!e.success)throw new Error("获取配置数据失败");return e.config}async function Vu(){const e=await(await ot(`${Oo}/model`)).json();if(!e.success)throw new Error("获取模型配置数据失败");return e.config}async function XO(t){const n=await(await ot(`${Oo}/bot`,{method:"POST",headers:bt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function RU(){const e=await(await ot(`${Oo}/bot/raw`)).json();if(!e.success)throw new Error("获取配置源代码失败");return e.content}async function zU(t){const n=await(await ot(`${Oo}/bot/raw`,{method:"POST",headers:bt(),body:JSON.stringify({raw_content:t})})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function wg(t){const n=await(await ot(`${Oo}/model`,{method:"POST",headers:bt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function PU(t,e){const r=await(await ot(`${Oo}/bot/section/${t}`,{method:"POST",headers:bt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function h2(t,e){const r=await(await ot(`${Oo}/model/section/${t}`,{method:"POST",headers:bt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}const BU=Zn.create({baseURL:"",timeout:1e4});async function xw(){try{return(await BU.post("/api/webui/system/restart")).data}catch(t){throw console.error("重启麦麦失败:",t),t}}const LU=Nd("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),ld=S.forwardRef(({className:t,variant:e,...n},r)=>a.jsx("div",{ref:r,role:"alert",className:ye(LU({variant:e}),t),...n}));ld.displayName="Alert";const IU=S.forwardRef(({className:t,...e},n)=>a.jsx("h5",{ref:n,className:ye("mb-1 font-medium leading-none tracking-tight",t),...e}));IU.displayName="AlertTitle";const od=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("text-sm [&_p]:leading-relaxed",t),...e}));od.displayName="AlertDescription";function vw({onRestartComplete:t,onRestartFailed:e}){const[n,r]=S.useState(0),[s,i]=S.useState("restarting"),[l,c]=S.useState(0),[d,h]=S.useState(0);S.useEffect(()=>{const x=setInterval(()=>{r(k=>k>=90?k:k+1)},200),v=setInterval(()=>{c(k=>k+1)},1e3),b=setTimeout(()=>{i("checking"),m()},3e3);return()=>{clearInterval(x),clearInterval(v),clearTimeout(b)}},[]);const m=()=>{const v=async()=>{try{if(h(k=>k+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)r(100),i("success"),setTimeout(()=>{t?.()},1500);else throw new Error("Status check failed")}catch{d<60?setTimeout(v,2e3):(i("failed"),e?.())}};v()},p=x=>{const v=Math.floor(x/60),b=x%60;return`${v}:${b.toString().padStart(2,"0")}`};return a.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:a.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[a.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s==="restarting"&&a.jsxs(a.Fragment,{children:[a.jsx(hf,{className:"h-16 w-16 text-primary animate-spin"}),a.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),s==="checking"&&a.jsxs(a.Fragment,{children:[a.jsx(hf,{className:"h-16 w-16 text-primary animate-spin"}),a.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),a.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",d,"/60)"]})]}),s==="success"&&a.jsxs(a.Fragment,{children:[a.jsx(ua,{className:"h-16 w-16 text-green-500"}),a.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),s==="failed"&&a.jsxs(a.Fragment,{children:[a.jsx(xc,{className:"h-16 w-16 text-destructive"}),a.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),s!=="failed"&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(n0,{value:n,className:"h-2"}),a.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[a.jsxs("span",{children:[n,"%"]}),a.jsxs("span",{children:["已用时: ",p(l)]})]})]}),a.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="restarting"&&"🔄 配置已保存,正在重启主程序...",s==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",s==="success"&&"✅ 配置已生效,服务运行正常",s==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),s==="failed"&&a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),a.jsx("button",{onClick:()=>{i("checking"),h(0),m()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}let f2=[],vM=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e>1;if(t=vM[r])e=r+1;else return!0;if(e==n)return!1}}function YO(t){return t>=127462&&t<=127487}const KO=8205;function FU(t,e,n=!0,r=!0){return(n?yM:QU)(t,e,r)}function yM(t,e,n){if(e==t.length)return e;e&&bM(t.charCodeAt(e))&&wM(t.charCodeAt(e-1))&&e--;let r=Cy(t,e);for(e+=ZO(r);e=0&&YO(Cy(t,l));)i++,l-=2;if(i%2==0)break;e+=2}else break}return e}function QU(t,e,n){for(;e>0;){let r=yM(t,e-2,n);if(r=56320&&t<57344}function wM(t){return t>=55296&&t<56320}function ZO(t){return t<65536?1:2}class Wt{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=cd(this,e,n);let s=[];return this.decompose(0,e,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(n,this.length,s,1),Gp.from(s,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=cd(this,e,n);let r=[];return this.decompose(e,n,r,0),Gp.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),s=new Zh(this),i=new Zh(e);for(let l=n,c=n;;){if(s.next(l),i.next(l),l=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(c+=s.value.length,s.done||c>=r)return!0}}iter(e=1){return new Zh(this,e)}iterRange(e,n=this.length){return new SM(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let s=this.line(e).from;r=this.iterRange(s,Math.max(s,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new kM(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Wt.empty:e.length<=32?new ir(e):Gp.from(ir.split(e,[]))}}class ir extends Wt{constructor(e,n=$U(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,s){for(let i=0;;i++){let l=this.text[i],c=s+l.length;if((n?r:c)>=e)return new HU(s,c,r,l);s=c+1,r++}}decompose(e,n,r,s){let i=e<=0&&n>=this.length?this:new ir(JO(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let l=r.pop(),c=Xp(i.text,l.text.slice(),0,i.length);if(c.length<=32)r.push(new ir(c,l.length+i.length));else{let d=c.length>>1;r.push(new ir(c.slice(0,d)),new ir(c.slice(d)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof ir))return super.replace(e,n,r);[e,n]=cd(this,e,n);let s=Xp(this.text,Xp(r.text,JO(this.text,0,e)),n),i=this.length+r.length-(n-e);return s.length<=32?new ir(s,i):Gp.from(ir.split(s,[]),i)}sliceString(e,n=this.length,r=` +`){[e,n]=cd(this,e,n);let s="";for(let i=0,l=0;i<=n&&le&&l&&(s+=r),ei&&(s+=c.slice(Math.max(0,e-i),n-i)),i=d+1}return s}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],s=-1;for(let i of e)r.push(i),s+=i.length+1,r.length==32&&(n.push(new ir(r,s)),r=[],s=-1);return s>-1&&n.push(new ir(r,s)),n}}let Gp=class Du extends Wt{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,s){for(let i=0;;i++){let l=this.children[i],c=s+l.length,d=r+l.lines-1;if((n?d:c)>=e)return l.lineInner(e,n,r,s);s=c+1,r=d+1}}decompose(e,n,r,s){for(let i=0,l=0;l<=n&&i=l){let h=s&((l<=e?1:0)|(d>=n?2:0));l>=e&&d<=n&&!h?r.push(c):c.decompose(e-l,n-l,r,h)}l=d+1}}replace(e,n,r){if([e,n]=cd(this,e,n),r.lines=i&&n<=c){let d=l.replace(e-i,n-i,r),h=this.lines-l.lines+d.lines;if(d.lines>4&&d.lines>h>>6){let m=this.children.slice();return m[s]=d,new Du(m,this.length-(n-e)+r.length)}return super.replace(i,c,d)}i=c+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` +`){[e,n]=cd(this,e,n);let s="";for(let i=0,l=0;ie&&i&&(s+=r),el&&(s+=c.sliceString(e-l,n-l,r)),l=d+1}return s}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Du))return 0;let r=0,[s,i,l,c]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=n,i+=n){if(s==l||i==c)return r;let d=this.children[s],h=e.children[i];if(d!=h)return r+d.scanIdentical(h,n);r+=d.length+1}}static from(e,n=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let v of e)r+=v.lines;if(r<32){let v=[];for(let b of e)b.flatten(v);return new ir(v,n)}let s=Math.max(32,r>>5),i=s<<1,l=s>>1,c=[],d=0,h=-1,m=[];function p(v){let b;if(v.lines>i&&v instanceof Du)for(let k of v.children)p(k);else v.lines>l&&(d>l||!d)?(x(),c.push(v)):v instanceof ir&&d&&(b=m[m.length-1])instanceof ir&&v.lines+b.lines<=32?(d+=v.lines,h+=v.length+1,m[m.length-1]=new ir(b.text.concat(v.text),b.length+1+v.length)):(d+v.lines>s&&x(),d+=v.lines,h+=v.length+1,m.push(v))}function x(){d!=0&&(c.push(m.length==1?m[0]:Du.from(m,h)),h=-1,d=m.length=0)}for(let v of e)p(v);return x(),c.length==1?c[0]:new Du(c,n)}};Wt.empty=new ir([""],0);function $U(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Xp(t,e,n=0,r=1e9){for(let s=0,i=0,l=!0;i=n&&(d>r&&(c=c.slice(0,r-s)),s0?1:(e instanceof ir?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],i=this.offsets[r],l=i>>1,c=s instanceof ir?s.text.length:s.children.length;if(l==(n>0?c:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(s instanceof ir){let d=s.text[l+(n<0?-1:0)];if(this.offsets[r]+=n,d.length>Math.max(0,e))return this.value=e==0?d:n>0?d.slice(e):d.slice(0,d.length-e),this;e-=d.length}else{let d=s.children[l+(n<0?-1:0)];e>d.length?(e-=d.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(d),this.offsets.push(n>0?1:(d instanceof ir?d.text.length:d.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class SM{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new Zh(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*n,this.value=s.length<=r?s:n<0?s.slice(s.length-r):s.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class kM{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:s}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Wt.prototype[Symbol.iterator]=function(){return this.iter()},Zh.prototype[Symbol.iterator]=SM.prototype[Symbol.iterator]=kM.prototype[Symbol.iterator]=function(){return this});class HU{constructor(e,n,r,s){this.from=e,this.to=n,this.number=r,this.text=s}get length(){return this.to-this.from}}function cd(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function Vr(t,e,n=!0,r=!0){return FU(t,e,n,r)}function UU(t){return t>=56320&&t<57344}function VU(t){return t>=55296&&t<56320}function Ms(t,e){let n=t.charCodeAt(e);if(!VU(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return UU(r)?(n-55296<<10)+(r-56320)+65536:n}function yw(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function aa(t){return t<65536?1:2}const m2=/\r\n?|\n/;var Ur=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(Ur||(Ur={}));class xa{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return i+(e-s);i+=c}else{if(r!=Ur.Simple&&h>=e&&(r==Ur.TrackDel&&se||r==Ur.TrackBefore&&se))return null;if(h>e||h==e&&n<0&&!c)return e==s||n<0?i:i+d;i+=d}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return i}touchesRange(e,n=e){for(let r=0,s=0;r=0&&s<=n&&c>=e)return sn?"cover":!0;s=c}return!1}toString(){let e="";for(let n=0;n=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new xa(e)}static create(e){return new xa(e)}}class kr extends xa{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return p2(this,(n,r,s,i,l)=>e=e.replace(s,s+(r-n),l),!1),e}mapDesc(e,n=!1){return g2(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let s=0,i=0;s=0){n[s]=c,n[s+1]=l;let d=s>>1;for(;r.length0&&no(r,n,i.text),i.forward(m),c+=m}let h=e[l++];for(;c>1].toJSON()))}return e}static of(e,n,r){let s=[],i=[],l=0,c=null;function d(m=!1){if(!m&&!s.length)return;lx||p<0||x>n)throw new RangeError(`Invalid change range ${p} to ${x} (in doc of length ${n})`);let b=v?typeof v=="string"?Wt.of(v.split(r||m2)):v:Wt.empty,k=b.length;if(p==x&&k==0)return;pl&&Jr(s,p-l,-1),Jr(s,x-p,k),no(i,s,b),l=x}}return h(e),d(!c),c}static empty(e){return new kr(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let s=0;sc&&typeof l!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length=0&&n<=0&&n==t[s+1]?t[s]+=e:s>=0&&e==0&&t[s]==0?t[s+1]+=n:r?(t[s]+=e,t[s+1]+=n):t.push(e,n)}function no(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r>1])),!(n||l==t.sections.length||t.sections[l+1]<0);)c=t.sections[l++],d=t.sections[l++];e(s,h,i,m,p),s=h,i=m}}}function g2(t,e,n,r=!1){let s=[],i=r?[]:null,l=new pf(t),c=new pf(e);for(let d=-1;;){if(l.done&&c.len||c.done&&l.len)throw new Error("Mismatched change set lengths");if(l.ins==-1&&c.ins==-1){let h=Math.min(l.len,c.len);Jr(s,h,-1),l.forward(h),c.forward(h)}else if(c.ins>=0&&(l.ins<0||d==l.i||l.off==0&&(c.len=0&&d=0){let h=0,m=l.len;for(;m;)if(c.ins==-1){let p=Math.min(m,c.len);h+=p,m-=p,c.forward(p)}else if(c.ins==0&&c.lend||l.ins>=0&&l.len>d)&&(c||r.length>h),i.forward2(d),l.forward(d)}}}}class pf{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?Wt.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?Wt.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class ac{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,s;return this.empty?r=s=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new ac(r,s,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return Ce.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return Ce.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Ce.range(e.anchor,e.head)}static create(e,n,r){return new ac(e,n,r)}}class Ce{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:Ce.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Ce(e.ranges.map(n=>ac.fromJSON(n)),e.main)}static single(e,n=e){return new Ce([Ce.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;se?8:0)|i)}static normalized(e,n=0){let r=e[n];e.sort((s,i)=>s.from-i.from),n=e.indexOf(r);for(let s=1;si.head?Ce.range(d,c):Ce.range(c,d))}}return new Ce(e,n)}}function jM(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let bw=0;class He{constructor(e,n,r,s,i){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=bw++,this.default=e([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(e={}){return new He(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:ww),!!e.static,e.enables)}of(e){return new Yp([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yp(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yp(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function ww(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Yp{constructor(e,n,r,s){this.dependencies=e,this.facet=n,this.type=r,this.value=s,this.id=bw++}dynamicSlot(e){var n;let r=this.value,s=this.facet.compareInput,i=this.id,l=e[i]>>1,c=this.type==2,d=!1,h=!1,m=[];for(let p of this.dependencies)p=="doc"?d=!0:p=="selection"?h=!0:(((n=e[p.id])!==null&&n!==void 0?n:1)&1)==0&&m.push(e[p.id]);return{create(p){return p.values[l]=r(p),1},update(p,x){if(d&&x.docChanged||h&&(x.docChanged||x.selection)||x2(p,m)){let v=r(p);if(c?!ej(v,p.values[l],s):!s(v,p.values[l]))return p.values[l]=v,1}return 0},reconfigure:(p,x)=>{let v,b=x.config.address[i];if(b!=null){let k=kg(x,b);if(this.dependencies.every(O=>O instanceof He?x.facet(O)===p.facet(O):O instanceof Br?x.field(O,!1)==p.field(O,!1):!0)||(c?ej(v=r(p),k,s):s(v=r(p),k)))return p.values[l]=k,0}else v=r(p);return p.values[l]=v,1}}}}function ej(t,e,n){if(t.length!=e.length)return!1;for(let r=0;rt[d.id]),s=n.map(d=>d.type),i=r.filter(d=>!(d&1)),l=t[e.id]>>1;function c(d){let h=[];for(let m=0;mr===s),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Zm).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let i=r.values[n],l=this.updateF(i,s);return this.compareF(i,l)?0:(r.values[n]=l,1)},reconfigure:(r,s)=>{let i=r.facet(Zm),l=s.facet(Zm),c;return(c=i.find(d=>d.field==this))&&c!=l.find(d=>d.field==this)?(r.values[n]=c.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Zm.of({field:this,create:e})]}get extension(){return this}}const rc={lowest:4,low:3,default:2,high:1,highest:0};function _h(t){return e=>new NM(e,t)}const jo={highest:_h(rc.highest),high:_h(rc.high),default:_h(rc.default),low:_h(rc.low),lowest:_h(rc.lowest)};class NM{constructor(e,n){this.inner=e,this.prec=n}}class wx{of(e){return new v2(this,e)}reconfigure(e){return wx.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class v2{constructor(e,n){this.compartment=e,this.inner=n}}class Sg{constructor(e,n,r,s,i,l){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=l,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,r){let s=[],i=Object.create(null),l=new Map;for(let x of GU(e,n,l))x instanceof Br?s.push(x):(i[x.facet.id]||(i[x.facet.id]=[])).push(x);let c=Object.create(null),d=[],h=[];for(let x of s)c[x.id]=h.length<<1,h.push(v=>x.slot(v));let m=r?.config.facets;for(let x in i){let v=i[x],b=v[0].facet,k=m&&m[x]||[];if(v.every(O=>O.type==0))if(c[b.id]=d.length<<1|1,ww(k,v))d.push(r.facet(b));else{let O=b.combine(v.map(j=>j.value));d.push(r&&b.compare(O,r.facet(b))?r.facet(b):O)}else{for(let O of v)O.type==0?(c[O.id]=d.length<<1|1,d.push(O.value)):(c[O.id]=h.length<<1,h.push(j=>O.dynamicSlot(j)));c[b.id]=h.length<<1,h.push(O=>WU(O,b,v))}}let p=h.map(x=>x(c));return new Sg(e,l,p,c,d,i)}}function GU(t,e,n){let r=[[],[],[],[],[]],s=new Map;function i(l,c){let d=s.get(l);if(d!=null){if(d<=c)return;let h=r[d].indexOf(l);h>-1&&r[d].splice(h,1),l instanceof v2&&n.delete(l.compartment)}if(s.set(l,c),Array.isArray(l))for(let h of l)i(h,c);else if(l instanceof v2){if(n.has(l.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(l.compartment)||l.inner;n.set(l.compartment,h),i(h,c)}else if(l instanceof NM)i(l.inner,l.prec);else if(l instanceof Br)r[c].push(l),l.provides&&i(l.provides,c);else if(l instanceof Yp)r[c].push(l),l.facet.extensions&&i(l.facet.extensions,rc.default);else{let h=l.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${l}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(h,c)}}return i(t,rc.default),r.reduce((l,c)=>l.concat(c))}function Jh(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let s=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|s}function kg(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const CM=He.define(),y2=He.define({combine:t=>t.some(e=>e),static:!0}),TM=He.define({combine:t=>t.length?t[0]:void 0,static:!0}),MM=He.define(),AM=He.define(),EM=He.define(),_M=He.define({combine:t=>t.length?t[0]:!1});class Sa{constructor(e,n){this.type=e,this.value=n}static define(){return new XU}}class XU{of(e){return new Sa(this,e)}}class YU{constructor(e){this.map=e}of(e){return new xt(this,e)}}class xt{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new xt(this.type,n)}is(e){return this.type==e}static define(e={}){return new YU(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let s of e){let i=s.map(n);i&&r.push(i)}return r}}xt.reconfigure=xt.define();xt.appendConfig=xt.define();class gr{constructor(e,n,r,s,i,l){this.startState=e,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=l,this._doc=null,this._state=null,r&&jM(r,n.newLength),i.some(c=>c.type==gr.time)||(this.annotations=i.concat(gr.time.of(Date.now())))}static create(e,n,r,s,i,l){return new gr(e,n,r,s,i,l)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(gr.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}gr.time=Sa.define();gr.userEvent=Sa.define();gr.addToHistory=Sa.define();gr.remote=Sa.define();function KU(t,e){let n=[];for(let r=0,s=0;;){let i,l;if(r=t[r]))i=t[r++],l=t[r++];else if(s=0;s--){let i=r[s](t);i instanceof gr?t=i:Array.isArray(i)&&i.length==1&&i[0]instanceof gr?t=i[0]:t=RM(e,Wu(i),!1)}return t}function JU(t){let e=t.startState,n=e.facet(EM),r=t;for(let s=n.length-1;s>=0;s--){let i=n[s](t);i&&Object.keys(i).length&&(r=DM(r,b2(e,i,t.changes.newLength),!0))}return r==t?t:gr.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const eV=[];function Wu(t){return t==null?eV:Array.isArray(t)?t:[t]}var Vn=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(Vn||(Vn={}));const tV=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let w2;try{w2=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function nV(t){if(w2)return w2.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||tV.test(n)))return!0}return!1}function rV(t){return e=>{if(!/\S/.test(e))return Vn.Space;if(nV(e))return Vn.Word;for(let n=0;n-1)return Vn.Word;return Vn.Other}}class Vt{constructor(e,n,r,s,i,l){this.config=e,this.doc=n,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=i,l&&(l._state=this);for(let c=0;cs.set(h,d)),n=null),s.set(c.value.compartment,c.value.extension)):c.is(xt.reconfigure)?(n=null,r=c.value):c.is(xt.appendConfig)&&(n=null,r=Wu(r).concat(c.value));let i;n?i=e.startState.values.slice():(n=Sg.resolve(r,s,this),i=new Vt(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(d,h)=>h.reconfigure(d,this),null).values);let l=e.startState.facet(y2)?e.newSelection:e.newSelection.asSingle();new Vt(n,e.newDoc,l,i,(c,d)=>d.update(c,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:Ce.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),s=this.changes(r.changes),i=[r.range],l=Wu(r.effects);for(let c=1;cl.spec.fromJSON(c,d)))}}return Vt.create({doc:e.doc,selection:Ce.fromJSON(e.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(e={}){let n=Sg.resolve(e.extensions||[],new Map),r=e.doc instanceof Wt?e.doc:Wt.of((e.doc||"").split(n.staticFacet(Vt.lineSeparator)||m2)),s=e.selection?e.selection instanceof Ce?e.selection:Ce.single(e.selection.anchor,e.selection.head):Ce.single(0);return jM(s,r.length),n.staticFacet(y2)||(s=s.asSingle()),new Vt(n,r,s,n.dynamicSlots.map(()=>null),(i,l)=>l.create(i),null)}get tabSize(){return this.facet(Vt.tabSize)}get lineBreak(){return this.facet(Vt.lineSeparator)||` +`}get readOnly(){return this.facet(_M)}phrase(e,...n){for(let r of this.facet(Vt.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let i=+(s||1);return!i||i>n.length?r:n[i-1]})),e}languageDataAt(e,n,r=-1){let s=[];for(let i of this.facet(CM))for(let l of i(this,n,r))Object.prototype.hasOwnProperty.call(l,e)&&s.push(l[e]);return s}charCategorizer(e){return rV(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:r,length:s}=this.doc.lineAt(e),i=this.charCategorizer(e),l=e-r,c=e-r;for(;l>0;){let d=Vr(n,l,!1);if(i(n.slice(d,l))!=Vn.Word)break;l=d}for(;ct.length?t[0]:4});Vt.lineSeparator=TM;Vt.readOnly=_M;Vt.phrases=He.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(s=>t[s]==e[s])}});Vt.languageData=CM;Vt.changeFilter=MM;Vt.transactionFilter=AM;Vt.transactionExtender=EM;wx.reconfigure=xt.define();function ka(t,e,n={}){let r={};for(let s of t)for(let i of Object.keys(s)){let l=s[i],c=r[i];if(c===void 0)r[i]=l;else if(!(c===l||l===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](c,l);else throw new Error("Config merge conflict for field "+i)}for(let s in e)r[s]===void 0&&(r[s]=e[s]);return r}class yc{eq(e){return this==e}range(e,n=e){return S2.create(e,n,this)}}yc.prototype.startSide=yc.prototype.endSide=0;yc.prototype.point=!1;yc.prototype.mapMode=Ur.TrackDel;let S2=class zM{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new zM(e,n,r)}};function k2(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Sw{constructor(e,n,r,s){this.from=e,this.to=n,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,s=0){let i=r?this.to:this.from;for(let l=s,c=i.length;;){if(l==c)return l;let d=l+c>>1,h=i[d]-e||(r?this.value[d].endSide:this.value[d].startSide)-n;if(d==l)return h>=0?l:c;h>=0?c=d:l=d+1}}between(e,n,r,s){for(let i=this.findIndex(n,-1e9,!0),l=this.findIndex(r,1e9,!1,i);iv||x==v&&h.startSide>0&&h.endSide<=0)continue;(v-x||h.endSide-h.startSide)<0||(l<0&&(l=x),h.point&&(c=Math.max(c,v-x)),r.push(h),s.push(x-l),i.push(v-l))}return{mapped:r.length?new Sw(s,i,r,c):null,pos:l}}}class Gt{constructor(e,n,r,s){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=s}static create(e,n,r,s){return new Gt(e,n,r,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:s=0,filterTo:i=this.length}=e,l=e.filter;if(n.length==0&&!l)return this;if(r&&(n=n.slice().sort(k2)),this.isEmpty)return n.length?Gt.of(n):this;let c=new PM(this,null,-1).goto(0),d=0,h=[],m=new fl;for(;c.value||d=0){let p=n[d++];m.addInner(p.from,p.to,p.value)||h.push(p)}else c.rangeIndex==1&&c.chunkIndexthis.chunkEnd(c.chunkIndex)||ic.to||i=i&&e<=i+l.length&&l.between(i,e-i,n-i,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return gf.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return gf.from(e).goto(n)}static compare(e,n,r,s,i=-1){let l=e.filter(p=>p.maxPoint>0||!p.isEmpty&&p.maxPoint>=i),c=n.filter(p=>p.maxPoint>0||!p.isEmpty&&p.maxPoint>=i),d=tj(l,c,r),h=new Dh(l,d,i),m=new Dh(c,d,i);r.iterGaps((p,x,v)=>nj(h,p,m,x,v,s)),r.empty&&r.length==0&&nj(h,0,m,0,0,s)}static eq(e,n,r=0,s){s==null&&(s=999999999);let i=e.filter(m=>!m.isEmpty&&n.indexOf(m)<0),l=n.filter(m=>!m.isEmpty&&e.indexOf(m)<0);if(i.length!=l.length)return!1;if(!i.length)return!0;let c=tj(i,l),d=new Dh(i,c,0).goto(r),h=new Dh(l,c,0).goto(r);for(;;){if(d.to!=h.to||!O2(d.active,h.active)||d.point&&(!h.point||!d.point.eq(h.point)))return!1;if(d.to>s)return!0;d.next(),h.next()}}static spans(e,n,r,s,i=-1){let l=new Dh(e,null,i).goto(n),c=n,d=l.openStart;for(;;){let h=Math.min(l.to,r);if(l.point){let m=l.activeForPoint(l.to),p=l.pointFromc&&(s.span(c,h,l.active,d),d=l.openEnd(h));if(l.to>r)return d+(l.point&&l.to>r?1:0);c=l.to,l.next()}}static of(e,n=!1){let r=new fl;for(let s of e instanceof S2?[e]:n?sV(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return Gt.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=Gt.empty;s=s.nextLayer)n=new Gt(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}Gt.empty=new Gt([],[],null,-1);function sV(t){if(t.length>1)for(let e=t[0],n=1;n0)return t.slice().sort(k2);e=r}return t}Gt.empty.nextLayer=Gt.empty;class fl{finishChunk(e){this.chunks.push(new Sw(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new fl)).add(e,n,r)}addInner(e,n,r){let s=e-this.lastTo||r.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(Gt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=Gt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function tj(t,e,n){let r=new Map;for(let i of t)for(let l=0;l=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&s.push(new PM(l,n,r,i));return s.length==1?s[0]:new gf(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)Ty(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)Ty(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Ty(this.heap,0)}}}function Ty(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let s=t[r];if(r+1=0&&(s=t[r+1],r++),n.compare(s)<0)break;t[r]=n,t[e]=s,e=r}}class Dh{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=gf.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){Jm(this.active,e),Jm(this.activeTo,e),Jm(this.activeRank,e),this.minActive=rj(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:s,rank:i}=this.cursor;for(;n0;)n++;ep(this.active,n,r),ep(this.activeTo,n,s),ep(this.activeRank,n,i),e&&ep(e,n,this.cursor.from),this.minActive=rj(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&Jm(r,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&r[s]=0&&!(this.activeRank[r]e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function nj(t,e,n,r,s,i){t.goto(e),n.goto(r);let l=r+s,c=r,d=r-e;for(;;){let h=t.to+d-n.to,m=h||t.endSide-n.endSide,p=m<0?t.to+d:n.to,x=Math.min(p,l);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&O2(t.activeForPoint(t.to),n.activeForPoint(n.to))||i.comparePoint(c,x,t.point,n.point):x>c&&!O2(t.active,n.active)&&i.compareRange(c,x,t.active,n.active),p>l)break;(h||t.openEnd!=n.openEnd)&&i.boundChange&&i.boundChange(p),c=p,m<=0&&t.next(),m>=0&&n.next()}}function O2(t,e){if(t.length!=e.length)return!1;for(let n=0;n=e;r--)t[r+1]=t[r];t[e]=n}function rj(t,e){let n=-1,r=1e9;for(let s=0;s=e)return s;if(s==t.length)break;i+=t.charCodeAt(s)==9?n-i%n:1,s=Vr(t,s)}return r===!0?-1:t.length}const N2="ͼ",sj=typeof Symbol>"u"?"__"+N2:Symbol.for(N2),C2=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),ij=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ho{constructor(e,n){this.rules=[];let{finish:r}=n||{};function s(l){return/^@/.test(l)?[l]:l.split(/,\s*/)}function i(l,c,d,h){let m=[],p=/^@(\w+)\b/.exec(l[0]),x=p&&p[1]=="keyframes";if(p&&c==null)return d.push(l[0]+";");for(let v in c){let b=c[v];if(/&/.test(v))i(v.split(/,\s*/).map(k=>l.map(O=>k.replace(/&/,O))).reduce((k,O)=>k.concat(O)),b,d);else if(b&&typeof b=="object"){if(!p)throw new RangeError("The value of a property ("+v+") should be a primitive value.");i(s(v),b,m,x)}else b!=null&&m.push(v.replace(/_.*/,"").replace(/[A-Z]/g,k=>"-"+k.toLowerCase())+": "+b+";")}(m.length||x)&&d.push((r&&!p&&!h?l.map(r):l).join(", ")+" {"+m.join(" ")+"}")}for(let l in e)i(s(l),e[l],this.rules)}getRules(){return this.rules.join(` `)}static newName(){let e=ij[sj]||1;return ij[sj]=e+1,N2+e.toString(36)}static mount(e,n,r){let s=e[C2],i=r&&r.nonce;s?i&&s.setNonce(i):s=new iV(e,i),s.mount(Array.isArray(n)?n:[n],e)}}let aj=new Map;class iV{constructor(e,n){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let i=aj.get(r);if(i)return e[C2]=i;this.sheet=new s.CSSStyleSheet,aj.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[C2]=this}mount(e,n){let r=this.sheet,s=0,i=0;for(let l=0;l-1&&(this.modules.splice(d,1),i--,d=-1),d==-1){if(this.modules.splice(i++,0,c),r)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},aV=typeof navigator<"u"&&/Mac/.test(navigator.platform),lV=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Hr=0;Hr<10;Hr++)mo[48+Hr]=mo[96+Hr]=String(Hr);for(var Hr=1;Hr<=24;Hr++)mo[Hr+111]="F"+Hr;for(var Hr=65;Hr<=90;Hr++)mo[Hr]=String.fromCharCode(Hr+32),xf[Hr]=String.fromCharCode(Hr);for(var Ay in mo)xf.hasOwnProperty(Ay)||(xf[Ay]=mo[Ay]);function oV(t){var e=aV&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||lV&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?xf:mo)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function Mn(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var s=n[r];typeof s=="string"?t.setAttribute(r,s):s!=null&&(t[r]=s)}e++}for(;e2);var Fe={mac:oj||/Mac/.test(us.platform),windows:/Win/.test(us.platform),linux:/Linux|X11/.test(us.platform),ie:Sx,ie_version:LA?T2.documentMode||6:M2?+M2[1]:A2?+A2[1]:0,gecko:lj,gecko_version:lj?+(/Firefox\/(\d+)/.exec(us.userAgent)||[0,0])[1]:0,chrome:!!My,chrome_version:My?+My[1]:0,ios:oj,android:/Android\b/.test(us.userAgent),webkit_version:cV?+(/\bAppleWebKit\/(\d+)/.exec(us.userAgent)||[0,0])[1]:0,safari:E2,safari_version:E2?+(/\bVersion\/(\d+(\.\d+)?)/.exec(us.userAgent)||[0,0])[1]:0,tabSize:T2.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function vf(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function _2(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Kp(t,e){if(!e.anchorNode)return!1;try{return _2(t,e.anchorNode)}catch{return!1}}function ud(t){return t.nodeType==3?wc(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function ef(t,e,n,r){return n?cj(t,e,n,r,-1)||cj(t,e,n,r,1):!1}function bc(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Og(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function cj(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:ba(t))){if(t.nodeName=="DIV")return!1;let i=t.parentNode;if(!i||i.nodeType!=1)return!1;e=bc(t)+(s<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=s<0?ba(t):0}else return!1}}function ba(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function s0(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function uV(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function IA(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function dV(t,e,n,r,s,i,l,c){let d=t.ownerDocument,h=d.defaultView||window;for(let m=t,p=!1;m&&!p;)if(m.nodeType==1){let x,v=m==d.body,b=1,k=1;if(v)x=uV(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(m).position)&&(p=!0),m.scrollHeight<=m.clientHeight&&m.scrollWidth<=m.clientWidth){m=m.assignedSlot||m.parentNode;continue}let T=m.getBoundingClientRect();({scaleX:b,scaleY:k}=IA(m,T)),x={left:T.left,right:T.left+m.clientWidth*b,top:T.top,bottom:T.top+m.clientHeight*k}}let O=0,j=0;if(s=="nearest")e.top0&&e.bottom>x.bottom+j&&(j=e.bottom-x.bottom+l)):e.bottom>x.bottom&&(j=e.bottom-x.bottom+l,n<0&&e.top-j0&&e.right>x.right+O&&(O=e.right-x.right+i)):e.right>x.right&&(O=e.right-x.right+i,n<0&&e.leftx.bottom||e.leftx.right)&&(e={left:Math.max(e.left,x.left),right:Math.min(e.right,x.right),top:Math.max(e.top,x.top),bottom:Math.min(e.bottom,x.bottom)}),m=m.assignedSlot||m.parentNode}else if(m.nodeType==11)m=m.host;else break}function hV(t){let e=t.ownerDocument,n,r;for(let s=t.parentNode;s&&!(s==e.body||n&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),!n&&s.scrollWidth>s.clientWidth&&(n=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:n,y:r}}class fV{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?ba(n):0),r,Math.min(e.focusOffset,r?ba(r):0))}set(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let nc=null;Fe.safari&&Fe.safari_version>=26&&(nc=!1);function qA(t){if(t.setActive)return t.setActive();if(nc)return t.focus(nc);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(nc==null?{get preventScroll(){return nc={preventScroll:!0},!0}}:void 0),!nc){nc=!1;for(let n=0;nMath.max(1,t.scrollHeight-t.clientHeight-4)}function $A(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=ba(n)}else if(n.parentNode&&!Og(n))r=bc(n),n=n.parentNode;else return null}}function HA(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&rn)return p.domBoundsAround(e,n,h);if(x>=e&&s==-1&&(s=d,i=h),h>n&&p.dom.parentNode==this.dom){l=d,c=m;break}m=x,h=x+p.breakAfter}return{from:i,to:c<0?r+this.length:c,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:l=0?this.children[l].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,r=kw){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}}function VA(t,e,n,r,s,i,l,c,d){let{children:h}=t,m=h.length?h[e]:null,p=i.length?i[i.length-1]:null,x=p?p.breakAfter:l;if(!(e==r&&m&&!l&&!x&&i.length<2&&m.merge(n,s,i.length?p:null,n==0,c,d))){if(r0&&(!l&&i.length&&m.merge(n,m.length,i[0],!1,c,0)?m.breakAfter=i.shift().breakAfter:(ngV||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new Hi(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new ns(this.dom,e)}domBoundsAround(e,n,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return xV(this.dom,e,n)}}class pl extends jn{constructor(e,n=[],r=0){super(),this.mark=e,this.children=n,this.length=r;for(let s of n)s.setParent(this)}setAttrs(e){if(FA(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,r,s,i,l){return r&&(!(r instanceof pl&&r.mark.eq(this.mark))||e&&i<=0||ne&&n.push(r=e&&(s=i),r=d,i++}let l=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new pl(this.mark,n,l)}domAtPos(e){return GA(this,e)}coordsAt(e,n){return YA(this,e,n)}}function xV(t,e,n){let r=t.nodeValue.length;e>r&&(e=r);let s=e,i=e,l=0;e==0&&n<0||e==r&&n>=0?Fe.chrome||Fe.gecko||(e?(s--,l=1):i=0)?0:c.length-1];return Fe.safari&&!l&&d.width==0&&(d=Array.prototype.find.call(c,h=>h.width)||d),l?s0(d,l<0):d||null}class al extends jn{static create(e,n,r){return new al(e,n,r)}constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}split(e){let n=al.create(this.widget,this.length-e,this.side);return this.length-=e,n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,n,r,s,i,l){return r&&(!(r instanceof al)||!this.widget.compare(r.widget)||e>0&&i<=0||n0)?ns.before(this.dom):ns.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);if(r)return r;let s=this.dom.getClientRects(),i=null;if(!s.length)return null;let l=this.side?this.side<0:e>0;for(let c=l?s.length-1:0;i=s[c],!(e>0?c==0:c==s.length-1||i.top0?ns.before(this.dom):ns.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Xt.empty}get isHidden(){return!0}}Hi.prototype.children=al.prototype.children=dd.prototype.children=kw;function GA(t,e){let n=t.dom,{children:r}=t,s=0;for(let i=0;si&&e0;i--){let l=r[i-1];if(l.dom.parentNode==n)return l.domAtPos(l.length)}for(let i=s;i0&&e instanceof pl&&s.length&&(r=s[s.length-1])instanceof pl&&r.mark.eq(e.mark)?XA(r,e.children[0],n-1):(s.push(e),e.setParent(t)),t.length+=e.length}function YA(t,e,n){let r=null,s=-1,i=null,l=-1;function c(h,m){for(let p=0,x=0;p=m&&(v.children.length?c(v,m-x):(!i||i.isHidden&&(n>0||yV(i,v)))&&(b>m||x==b&&v.getSide()>0)?(i=v,l=m-x):(x-1?1:0)!=s.length-(n&&s.indexOf(n)>-1?1:0))return!1;for(let i of r)if(i!=n&&(s.indexOf(i)==-1||t[i]!==e[i]))return!1;return!0}function R2(t,e,n){let r=!1;if(e)for(let s in e)n&&s in n||(r=!0,s=="style"?t.style.cssText="":t.removeAttribute(s));if(n)for(let s in n)e&&e[s]==n[s]||(r=!0,s=="style"?t.style.cssText=n[s]:t.setAttribute(s,n[s]));return r}function bV(t){let e=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new po(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,s;if(e.isBlockGap)r=-5e8,s=4e8;else{let{start:i,end:l}=KA(e,n);r=(i?n?-3e8:-1:5e8)-1,s=(l?n?2e8:1:-6e8)+1}return new po(e,r,s,n,e.widget||null,!0)}static line(e){return new a0(e)}static set(e,n=!1){return Yt.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Je.none=Yt.empty;class i0 extends Je{constructor(e){let{start:n,end:r}=KA(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var n,r;return this==e||e instanceof i0&&this.tagName==e.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&jg(this.attrs,e.attrs,"class")}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}i0.prototype.point=!1;class a0 extends Je{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof a0&&this.spec.class==e.spec.class&&jg(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}a0.prototype.mapMode=Ur.TrackBefore;a0.prototype.point=!0;class po extends Je{constructor(e,n,r,s,i,l){super(n,r,i,e),this.block=s,this.isReplace=l,this.mapMode=s?n<=0?Ur.TrackBefore:Ur.TrackAfter:Ur.TrackDel}get type(){return this.startSide!=this.endSide?fs.WidgetRange:this.startSide<=0?fs.WidgetBefore:fs.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof po&&wV(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}po.prototype.point=!0;function KA(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function wV(t,e){return t==e||!!(t&&e&&t.compare(e))}function Zp(t,e,n,r=0){let s=n.length-1;s>=0&&n[s]+r>=t?n[s]=Math.max(n[s],e):n.push(t,e)}class pr extends jn{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,r,s,i,l){if(r){if(!(r instanceof pr))return!1;this.dom||r.transferDOM(this)}return s&&this.setDeco(r?r.attrs:null),WA(this,e,n,r?r.children.slice():[],i,l),!0}split(e){let n=new pr;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i:r,off:s}=this.childPos(e);s&&(n.append(this.children[r].split(s),0),this.children[r].merge(s,this.children[r].length,null,!1,0,0),r++);for(let i=r;i0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,n}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){jg(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){XA(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=D2(n,this.attrs||{})),r&&(this.attrs=D2({class:r},this.attrs||{}))}domAtPos(e){return GA(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(FA(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(R2(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,n);let s=this.dom.lastChild;for(;s&&jn.get(s)instanceof pl;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((r=jn.get(s))===null||r===void 0?void 0:r.isEditable)==!1&&(!Fe.ios||!this.children.some(i=>i instanceof Hi))){let i=document.createElement("BR");i.cmIgnore=!0,this.dom.appendChild(i)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,n;for(let r of this.children){if(!(r instanceof Hi)||/[^ -~]/.test(r.text))return null;let s=ud(r.dom);if(s.length!=1)return null;e+=s[0].width,n=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:n}:null}coordsAt(e,n){let r=YA(this,e,n);if(!this.children.length&&r&&this.parent){let{heightOracle:s}=this.parent.view.viewState,i=r.bottom-r.top;if(Math.abs(i-s.lineHeight)<2&&s.textHeight=n){if(i instanceof pr)return i;if(l>n)break}s=l+i.breakAfter}return null}}class cl extends jn{constructor(e,n,r){super(),this.widget=e,this.length=n,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,n,r,s,i,l){return r&&(!(r instanceof cl)||!this.widget.compare(r.widget)||e>0&&i<=0||n0}}class z2 extends ja{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class tf{constructor(e,n,r,s){this.doc=e,this.pos=n,this.end=r,this.disallowBlockEffectsFor=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=n}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof cl&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new pr),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(tp(new dd(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof cl)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:l,lineBreak:c,done:d}=this.cursor.next(this.skip);if(this.skip=0,d)throw new Error("Ran out of text content when drawing inline views");if(c){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=l,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e),i=Math.min(s,512);this.flushBuffer(n.slice(n.length-r)),this.getLine().append(tp(new Hi(this.text.slice(this.textOff,this.textOff+i)),n),r),this.atCursorPos=!0,this.textOff+=i,e-=i,r=s<=i?0:n.length}}span(e,n,r,s){this.buildText(n-e,r,s),this.pos=n,this.openStart<0&&(this.openStart=s)}point(e,n,r,s,i,l){if(this.disallowBlockEffectsFor[l]&&r instanceof po){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let c=n-e;if(r instanceof po)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new cl(r.widget||hd.block,c,r));else{let d=al.create(r.widget||hd.inline,c,c?0:r.startSide),h=this.atCursorPos&&!d.isEditable&&i<=s.length&&(e0),m=!d.isEditable&&(es.length||r.startSide<=0),p=this.getLine();this.pendingBuffer==2&&!h&&!d.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),h&&(p.append(tp(new dd(1),s),i),i=s.length+Math.max(0,i-s.length)),p.append(tp(d,s),i),this.atCursorPos=m,this.pendingBuffer=m?es.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);c&&(this.textOff+c<=this.text.length?this.textOff+=c:(this.skip+=c-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=i)}static build(e,n,r,s,i){let l=new tf(e,n,r,i);return l.openEnd=Yt.spans(s,n,r,l),l.openStart<0&&(l.openStart=l.openEnd),l.finish(l.openEnd),l}}function tp(t,e){for(let n of e)t=new pl(n,[t],t.length);return t}class hd extends ja{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}hd.inline=new hd("span");hd.block=new hd("div");var Hn=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(Hn||(Hn={}));const Sc=Hn.LTR,Ow=Hn.RTL;function ZA(t){let e=[];for(let n=0;n=n){if(c.level==r)return l;(i<0||(s!=0?s<0?c.fromn:e[i].level>c.level))&&(i=l)}}if(i<0)throw new RangeError("Index out of range");return i}}function eM(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;k-=3)if(ta[k+1]==-v){let O=ta[k+2],j=O&2?s:O&4?O&1?i:s:0;j&&(En[p]=En[ta[k]]=j),c=k;break}}else{if(ta.length==189)break;ta[c++]=p,ta[c++]=x,ta[c++]=d}else if((b=En[p])==2||b==1){let k=b==s;d=k?0:1;for(let O=c-3;O>=0;O-=3){let j=ta[O+2];if(j&2)break;if(k)ta[O+2]|=2;else{if(j&4)break;ta[O+2]|=4}}}}}function CV(t,e,n,r){for(let s=0,i=r;s<=n.length;s++){let l=s?n[s-1].to:t,c=sd;)b==O&&(b=n[--k].from,O=k?n[k-1].to:t),En[--b]=v;d=m}else i=h,d++}}}function B2(t,e,n,r,s,i,l){let c=r%2?2:1;if(r%2==s%2)for(let d=e,h=0;dd&&l.push(new so(d,k.from,v));let O=k.direction==Sc!=!(v%2);L2(t,O?r+1:r,s,k.inner,k.from,k.to,l),d=k.to}b=k.to}else{if(b==n||(m?En[b]!=c:En[b]==c))break;b++}x?B2(t,d,b,r+1,s,x,l):de;){let m=!0,p=!1;if(!h||d>i[h-1].to){let k=En[d-1];k!=c&&(m=!1,p=k==16)}let x=!m&&c==1?[]:null,v=m?r:r+1,b=d;e:for(;;)if(h&&b==i[h-1].to){if(p)break e;let k=i[--h];if(!m)for(let O=k.from,j=h;;){if(O==e)break e;if(j&&i[j-1].to==O)O=i[--j].from;else{if(En[O-1]==c)break e;break}}if(x)x.push(k);else{k.toEn.length;)En[En.length]=256;let r=[],s=e==Sc?0:1;return L2(t,s,s,n,0,t.length,r),r}function tM(t){return[new so(0,t,0)]}let nM="";function AV(t,e,n,r,s){var i;let l=r.head-t.from,c=so.find(e,l,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),d=e[c],h=d.side(s,n);if(l==h){let x=c+=s?1:-1;if(x<0||x>=e.length)return null;d=e[c=x],l=d.side(!s,n),h=d.side(s,n)}let m=Vr(t.text,l,d.forward(s,n));(md.to)&&(m=h),nM=t.text.slice(Math.min(l,m),Math.max(l,m));let p=c==(s?e.length-1:0)?null:e[c+(s?1:-1)];return p&&m==h&&p.level+(s?0:1)t.some(e=>e)}),uM=He.define({combine:t=>t.some(e=>e)}),dM=He.define();class Xu{constructor(e,n="nearest",r="nearest",s=5,i=5,l=!1){this.range=e,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=l}map(e){return e.empty?this:new Xu(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Xu(Ce.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const np=vt.define({map:(t,e)=>t.map(e)}),hM=vt.define();function _s(t,e,n){let r=t.facet(aM);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const il=He.define({combine:t=>t.length?t[0]:!0});let EV=0;const Fu=He.define({combine(t){return t.filter((e,n)=>{for(let r=0;r{let d=[];return l&&d.push(yf.of(h=>{let m=h.plugin(c);return m?l(m):Je.none})),i&&d.push(i(c)),d})}static fromClass(e,n){return lr.define((r,s)=>new e(r,s),n)}}class Ey{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(_s(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(n){_s(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){_s(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const fM=He.define(),Cw=He.define(),yf=He.define(),mM=He.define(),l0=He.define(),pM=He.define();function fj(t,e){let n=t.state.facet(pM);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(t):i),s=[];return Yt.spans(r,e.from,e.to,{point(){},span(i,l,c,d){let h=i-e.from,m=l-e.from,p=s;for(let x=c.length-1;x>=0;x--,d--){let v=c[x].spec.bidiIsolate,b;if(v==null&&(v=MV(e.text,h,m)),d>0&&p.length&&(b=p[p.length-1]).to==h&&b.direction==v)b.to=m,p=b.inner;else{let k={from:h,to:m,direction:v,inner:[]};p.push(k),p=k.inner}}}}),s}const gM=He.define();function Tw(t){let e=0,n=0,r=0,s=0;for(let i of t.state.facet(gM)){let l=i(t);l&&(l.left!=null&&(e=Math.max(e,l.left)),l.right!=null&&(n=Math.max(n,l.right)),l.top!=null&&(r=Math.max(r,l.top)),l.bottom!=null&&(s=Math.max(s,l.bottom)))}return{left:e,right:n,top:r,bottom:s}}const Qh=He.define();class Ni{constructor(e,n,r,s){this.fromA=e,this.toA=n,this.fromB=r,this.toB=s}join(e){return new Ni(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let s=e[n-1];if(!(s.fromA>r.toA)){if(s.toAm)break;i+=2}if(!d)return r;new Ni(d.fromA,d.toA,d.fromB,d.toB).addToSet(r),l=d.toA,c=d.toB}}}class Ng{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=kr.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,l,c,d)=>s.push(new Ni(i,l,c,d))),this.changedRanges=s}static create(e,n,r){return new Ng(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class mj extends jn{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=Je.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new pr],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Ni(0,0,0,e.state.doc.length)],0,null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:h,toA:m})=>mthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?s=this.domChanged.newSel.head:!LV(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let i=s>-1?DV(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:m}=this.hasComposition;r=new Ni(h,m,e.changes.mapPos(h,-1),e.changes.mapPos(m,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(Fe.ie||Fe.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let l=this.decorations,c=this.updateDeco(),d=PV(l,c,e.changes);return r=Ni.extendWithRanges(r,d),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,r);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let l=Fe.chrome||Fe.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,l),this.flags&=-8,l&&(l.written||s.selectionRange.focusNode!=l.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(l=>l.flags&=-9);let i=[];if(this.view.viewport.from||this.view.viewport.to=0?s[l]:null;if(!c)break;let{fromA:d,toA:h,fromB:m,toB:p}=c,x,v,b,k;if(r&&r.range.fromBm){let _=tf.build(this.view.state.doc,m,r.range.fromB,this.decorations,this.dynamicDecorationMap),D=tf.build(this.view.state.doc,r.range.toB,p,this.decorations,this.dynamicDecorationMap);v=_.breakAtStart,b=_.openStart,k=D.openEnd;let E=this.compositionView(r);D.breakAtStart?E.breakAfter=1:D.content.length&&E.merge(E.length,E.length,D.content[0],!1,D.openStart,0)&&(E.breakAfter=D.content[0].breakAfter,D.content.shift()),_.content.length&&E.merge(0,0,_.content[_.content.length-1],!0,0,_.openEnd)&&_.content.pop(),x=_.content.concat(E).concat(D.content)}else({content:x,breakAtStart:v,openStart:b,openEnd:k}=tf.build(this.view.state.doc,m,p,this.decorations,this.dynamicDecorationMap));let{i:O,off:j}=i.findPos(h,1),{i:T,off:A}=i.findPos(d,-1);VA(this,T,A,O,j,x,v,b,k)}r&&this.fixCompositionDOM(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(hM)&&(this.editContextFormatting=r.value)}compositionView(e){let n=new Hi(e.text.nodeValue);n.flags|=8;for(let{deco:s}of e.marks)n=new pl(s,[n],n.length);let r=new pr;return r.append(n,0),r}fixCompositionDOM(e){let n=(i,l)=>{l.flags|=8|(l.children.some(d=>d.flags&7)?1:0),this.markedForComposition.add(l);let c=jn.get(i);c&&c!=l&&(c.dom=null),l.setDOM(i)},r=this.childPos(e.range.fromB,1),s=this.children[r.i];n(e.line,s);for(let i=e.marks.length-1;i>=-1;i--)r=s.childPos(r.off,1),s=s.children[r.i],n(i>=0?e.marks[i].node:e.text,s)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,s=r==this.dom,i=!s&&!(this.view.state.facet(il)||this.dom.tabIndex>-1)&&Kp(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(s||n||i))return;let l=this.forceSelection;this.forceSelection=!1;let c=this.view.state.selection.main,d=this.moveToLine(this.domAtPos(c.anchor)),h=c.empty?d:this.moveToLine(this.domAtPos(c.head));if(Fe.gecko&&c.empty&&!this.hasComposition&&_V(d)){let p=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(p,d.node.childNodes[d.offset]||null)),d=h=new ns(p,0),l=!0}let m=this.view.observer.selectionRange;(l||!m.focusNode||(!ef(d.node,d.offset,m.anchorNode,m.anchorOffset)||!ef(h.node,h.offset,m.focusNode,m.focusOffset))&&!this.suppressWidgetCursorChange(m,c))&&(this.view.observer.ignore(()=>{Fe.android&&Fe.chrome&&this.dom.contains(m.focusNode)&&BV(m.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let p=vf(this.view.root);if(p)if(c.empty){if(Fe.gecko){let x=RV(d.node,d.offset);if(x&&x!=3){let v=(x==1?$A:HA)(d.node,d.offset);v&&(d=new ns(v.node,v.offset))}}p.collapse(d.node,d.offset),c.bidiLevel!=null&&p.caretBidiLevel!==void 0&&(p.caretBidiLevel=c.bidiLevel)}else if(p.extend){p.collapse(d.node,d.offset);try{p.extend(h.node,h.offset)}catch{}}else{let x=document.createRange();c.anchor>c.head&&([d,h]=[h,d]),x.setEnd(h.node,h.offset),x.setStart(d.node,d.offset),p.removeAllRanges(),p.addRange(x)}i&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(d,h)),this.impreciseAnchor=d.precise?null:new ns(m.anchorNode,m.anchorOffset),this.impreciseHead=h.precise?null:new ns(m.focusNode,m.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&ef(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=vf(e.root),{anchorNode:s,anchorOffset:i}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let l=pr.find(this,n.head);if(!l)return;let c=l.posAtStart;if(n.head==c||n.head==c+l.length)return;let d=this.coordsAt(n.head,-1),h=this.coordsAt(n.head,1);if(!d||!h||d.bottom>h.top)return;let m=this.domAtPos(n.head+n.assoc);r.collapse(m.node,m.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let p=e.observer.selectionRange;e.docView.posFromDOM(p.anchorNode,p.anchorOffset)!=n.from&&r.collapse(s,i)}moveToLine(e){let n=this.dom,r;if(e.node!=n)return e;for(let s=e.offset;!r&&s=0;s--){let i=jn.get(n.childNodes[s]);i instanceof pr&&(r=i.domAtPos(i.length))}return r?new ns(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=jn.get(n);if(r&&r.rootView==this)return r;n=n.parentNode}return null}posFromDOM(e,n){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,n)+r.posAtStart}domAtPos(e){let{i:n,off:r}=this.childCursor().findPos(e,-1);for(;n=0;l--){let c=this.children[l],d=i-c.breakAfter,h=d-c.length;if(de||c.covers(1))&&(!r||c instanceof pr&&!(r instanceof pr&&n>=0)))r=c,s=h;else if(r&&h==e&&d==e&&c instanceof cl&&Math.abs(n)<2){if(c.deco.startSide<0)break;l&&(r=null)}i=h}return r?r.coordsAt(e-s,n):null}coordsForChar(e){let{i:n,off:r}=this.childPos(e,1),s=this.children[n];if(!(s instanceof pr))return null;for(;s.children.length;){let{i:c,off:d}=s.childPos(r,1);for(;;c++){if(c==s.children.length)return null;if((s=s.children[c]).length)break}r=d}if(!(s instanceof Hi))return null;let i=Vr(s.text,r);if(i==r)return null;let l=wc(s.dom,r,i).getClientRects();for(let c=0;cMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,c=-1,d=this.view.textDirection==Hn.LTR;for(let h=0,m=0;ms)break;if(h>=r){let v=p.dom.getBoundingClientRect();if(n.push(v.height),l){let b=p.dom.lastChild,k=b?ud(b):[];if(k.length){let O=k[k.length-1],j=d?O.right-v.left:v.right-O.left;j>c&&(c=j,this.minWidth=i,this.minWidthFrom=h,this.minWidthTo=x)}}}h=x+p.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?Hn.RTL:Hn.LTR}measureTextSize(){for(let i of this.children)if(i instanceof pr){let l=i.measureTextSize();if(l)return l}let e=document.createElement("div"),n,r,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let i=ud(e.firstChild)[0];n=e.getBoundingClientRect().height,r=i?i.width/27:7,s=i?i.height:n,e.remove()}),{lineHeight:n,charWidth:r,textHeight:s}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new UA(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,s=0;;s++){let i=s==n.viewports.length?null:n.viewports[s],l=i?i.from-1:this.length;if(l>r){let c=(n.lineBlockAt(l).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(Je.replace({widget:new z2(c),block:!0,inclusive:!0,isBlockGap:!0}).range(r,l))}if(!i)break;r=i.to+1}return Je.set(e)}updateDeco(){let e=1,n=this.view.state.facet(yf).map(i=>(this.dynamicDecorationMap[e++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(mM).map((i,l)=>{let c=typeof i=="function";return c&&(r=!0),c?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[e++]=r,n.push(Yt.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];en.anchor?-1:1),s;if(!r)return;!n.empty&&(s=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let i=Tw(this.view),l={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:c,offsetHeight:d}=this.view.scrollDOM;dV(this.view.scrollDOM,l,n.heads instanceof al||s.children.some(r);return r(this.children[n])}}function _V(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function xM(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=$A(n.focusNode,n.focusOffset),s=HA(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let c=jn.get(s.node);if(!c||c instanceof Hi&&c.text!=s.node.nodeValue)i=s;else if(t.docView.lastCompositionAfterCursor){let d=jn.get(r.node);!d||d instanceof Hi&&d.text!=r.node.nodeValue||(i=s)}}if(t.docView.lastCompositionAfterCursor=i!=r,!i)return null;let l=e-i.offset;return{from:l,to:l+i.node.nodeValue.length,node:i.node}}function DV(t,e,n){let r=xM(t,n);if(!r)return null;let{node:s,from:i,to:l}=r,c=s.nodeValue;if(/[\n\r]/.test(c)||t.state.doc.sliceString(r.from,r.to)!=c)return null;let d=e.invertedDesc,h=new Ni(d.mapPos(i),d.mapPos(l),i,l),m=[];for(let p=s.parentNode;;p=p.parentNode){let x=jn.get(p);if(x instanceof pl)m.push({node:p,deco:x.mark});else{if(x instanceof pr||p.nodeName=="DIV"&&p.parentNode==t.contentDOM)return{range:h,text:s,marks:m,line:p};if(p!=t.contentDOM)m.push({node:p,deco:new i0({inclusive:!0,attributes:bV(p),tagName:p.tagName.toLowerCase()})});else return null}}}function RV(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{re.from&&(n=!0)}),n}function IV(t,e,n=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),i=e-s.from;if(s.length==0)return Ce.cursor(e);i==0?n=1:i==s.length&&(n=-1);let l=i,c=i;n<0?l=Vr(s.text,i,!1):c=Vr(s.text,i);let d=r(s.text.slice(l,c));for(;l>0;){let h=Vr(s.text,l,!1);if(r(s.text.slice(h,l))!=d)break;l=h}for(;ct?e.left-t:Math.max(0,t-e.right)}function FV(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function _y(t,e){return t.tope.top+1}function pj(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function q2(t,e,n){let r,s,i,l,c=!1,d,h,m,p;for(let b=t.firstChild;b;b=b.nextSibling){let k=ud(b);for(let O=0;OA||l==A&&i>T)&&(r=b,s=j,i=T,l=A,c=T?e0:Oj.bottom&&(!m||m.bottomj.top)&&(h=b,p=j):m&&_y(m,j)?m=gj(m,j.bottom):p&&_y(p,j)&&(p=pj(p,j.top))}}if(m&&m.bottom>=n?(r=d,s=m):p&&p.top<=n&&(r=h,s=p),!r)return{node:t,offset:0};let x=Math.max(s.left,Math.min(s.right,e));if(r.nodeType==3)return xj(r,x,n);if(c&&r.contentEditable!="false")return q2(r,x,n);let v=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(s.left+s.right)/2?1:0);return{node:t,offset:v}}function xj(t,e,n){let r=t.nodeValue.length,s=-1,i=1e9,l=0;for(let c=0;cn?m.top-n:n-m.bottom)-1;if(m.left-1<=e&&m.right+1>=e&&p=(m.left+m.right)/2,v=x;if(Fe.chrome||Fe.gecko){let b=wc(t,c).getBoundingClientRect();Math.abs(b.left-m.right)<.1&&(v=!x)}if(p<=0)return{node:t,offset:c+(v?1:0)};s=c+(v?1:0),i=p}}}return{node:t,offset:s>-1?s:l>0?t.nodeValue.length:0}}function vM(t,e,n,r=-1){var s,i;let l=t.contentDOM.getBoundingClientRect(),c=l.top+t.viewState.paddingTop,d,{docHeight:h}=t.viewState,{x:m,y:p}=e,x=p-c;if(x<0)return 0;if(x>h)return t.state.doc.length;for(let _=t.viewState.heightOracle.textHeight/2,D=!1;d=t.elementAtHeight(x),d.type!=fs.Text;)for(;x=r>0?d.bottom+_:d.top-_,!(x>=0&&x<=h);){if(D)return n?null:0;D=!0,r=-r}p=c+x;let v=d.from;if(vt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:vj(t,l,d,m,p);let b=t.dom.ownerDocument,k=t.root.elementFromPoint?t.root:b,O=k.elementFromPoint(m,p);O&&!t.contentDOM.contains(O)&&(O=null),O||(m=Math.max(l.left+1,Math.min(l.right-1,m)),O=k.elementFromPoint(m,p),O&&!t.contentDOM.contains(O)&&(O=null));let j,T=-1;if(O&&((s=t.docView.nearest(O))===null||s===void 0?void 0:s.isEditable)!=!1){if(b.caretPositionFromPoint){let _=b.caretPositionFromPoint(m,p);_&&({offsetNode:j,offset:T}=_)}else if(b.caretRangeFromPoint){let _=b.caretRangeFromPoint(m,p);_&&({startContainer:j,startOffset:T}=_)}j&&(!t.contentDOM.contains(j)||Fe.safari&&QV(j,T,m)||Fe.chrome&&$V(j,T,m))&&(j=void 0),j&&(T=Math.min(ba(j),T))}if(!j||!t.docView.dom.contains(j)){let _=pr.find(t.docView,v);if(!_)return x>d.top+d.height/2?d.to:d.from;({node:j,offset:T}=q2(_.dom,m,p))}let A=t.docView.nearest(j);if(!A)return null;if(A.isWidget&&((i=A.dom)===null||i===void 0?void 0:i.nodeType)==1){let _=A.dom.getBoundingClientRect();return e.y<_.top||e.y<=_.bottom&&e.x<=(_.left+_.right)/2?A.posAtStart:A.posAtEnd}else return A.localPosFromDOM(j,T)+A.posAtStart}function vj(t,e,n,r,s){let i=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let c=t.viewState.heightOracle.textHeight,d=Math.floor((s-n.top-(t.defaultLineHeight-c)*.5)/c);i+=d*t.viewState.heightOracle.lineLength}let l=t.state.sliceDoc(n.from,n.to);return n.from+j2(l,i,t.state.tabSize)}function yM(t,e,n){let r,s=t;if(t.nodeType!=3||e!=(r=t.nodeValue.length))return!1;for(;;){let i=s.nextSibling;if(i){if(i.nodeName=="BR")break;return!1}else{let l=s.parentNode;if(!l||l.nodeName=="DIV")break;s=l}}return wc(t,r-1,r).getBoundingClientRect().right>n}function QV(t,e,n){return yM(t,e,n)}function $V(t,e,n){if(e!=0)return yM(t,e,n);for(let s=t;;){let i=s.parentNode;if(!i||i.nodeType!=1||i.firstChild!=s)return!1;if(i.classList.contains("cm-line"))break;s=i}let r=t.nodeType==1?t.getBoundingClientRect():wc(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function F2(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let s;for(let i of r.type){if(i.from>e)break;if(!(i.toe)return i;(!s||i.type==fs.Text&&(s.type!=i.type||(n<0?i.frome)))&&(s=i)}}return s||r}return r}function HV(t,e,n,r){let s=F2(t,e.head,e.assoc||-1),i=!r||s.type!=fs.Text||!(t.lineWrapping||s.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(i){let l=t.dom.getBoundingClientRect(),c=t.textDirectionAt(s.from),d=t.posAtCoords({x:n==(c==Hn.LTR)?l.right-1:l.left+1,y:(i.top+i.bottom)/2});if(d!=null)return Ce.cursor(d,n?-1:1)}return Ce.cursor(n?s.to:s.from,n?-1:1)}function yj(t,e,n,r){let s=t.state.doc.lineAt(e.head),i=t.bidiSpans(s),l=t.textDirectionAt(s.from);for(let c=e,d=null;;){let h=AV(s,i,l,c,n),m=nM;if(!h){if(s.number==(n?t.state.doc.lines:1))return c;m=` -`,s=t.state.doc.line(s.number+(n?1:-1)),i=t.bidiSpans(s),h=t.visualLineSide(s,!n)}if(d){if(!d(m))return c}else{if(!r)return h;d=r(m)}c=h}}function UV(t,e,n){let r=t.state.charCategorizer(e),s=r(n);return i=>{let l=r(i);return s==Vn.Space&&(s=l),s==l}}function VV(t,e,n,r){let s=e.head,i=n?1:-1;if(s==(n?t.state.doc.length:0))return Ce.cursor(s,e.assoc);let l=e.goalColumn,c,d=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s,e.assoc||-1),m=t.documentTop;if(h)l==null&&(l=h.left-d.left),c=i<0?h.top:h.bottom;else{let v=t.viewState.lineBlockAt(s);l==null&&(l=Math.min(d.right-d.left,t.defaultCharacterWidth*(s-v.from))),c=(i<0?v.top:v.bottom)+m}let p=d.left+l,x=r??t.viewState.heightOracle.textHeight>>1;for(let v=0;;v+=10){let b=c+(x+v)*i,k=vM(t,{x:p,y:b},!1,i);if(bd.bottom||(i<0?ks)){let O=t.docView.coordsForChar(k),j=!O||b{if(e>i&&es(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:Ce.cursor(r,ri)&&!XV(l,n)&&this.lineBreak(),s=l}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,l=1,c;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),l=this.lineSeparator.length):(c=s.exec(n))&&(i=c.index,l=c[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),l>1)for(let d of this.points)d.node==e&&d.pos>this.text.length&&(d.pos-=l-1);r=i+l}}readNode(e){if(e.cmIgnore)return;let n=jn.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(GV(e,r.node,r.offset)?n:0))}}function GV(t,e,n){for(;;){if(!e||n-1;let{impreciseHead:i,impreciseAnchor:l}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let c=i||l?[]:ZV(e),d=new WV(c,e.state);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=JV(c,this.bounds.from)}else{let c=e.observer.selectionRange,d=i&&i.node==c.focusNode&&i.offset==c.focusOffset||!_2(e.contentDOM,c.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(c.focusNode,c.focusOffset),h=l&&l.node==c.anchorNode&&l.offset==c.anchorOffset||!_2(e.contentDOM,c.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(c.anchorNode,c.anchorOffset),m=e.viewport;if((Fe.ios||Fe.chrome)&&e.state.selection.main.empty&&d!=h&&(m.from>0||m.to-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Ce.range(h,d)):this.newSel=Ce.single(h,d)}}}function wM(t,e){let n,{newSel:r}=e,s=t.state.selection.main,i=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:l,to:c}=e.bounds,d=s.from,h=null;(i===8||Fe.android&&e.text.length=s.from&&n.to<=s.to&&(n.from!=s.from||n.to!=s.to)&&s.to-s.from-(n.to-n.from)<=4?n={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,s.to))}:t.state.doc.lineAt(s.from).toDate.now()-50?n={from:s.from,to:s.to,insert:t.state.toText(t.inputState.insertingText)}:Fe.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` - `&&t.lineWrapping&&(r&&(r=Ce.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:Xt.of([" "])}),n)return Aw(t,n,r,i);if(r&&!r.main.eq(s)){let l=!1,c="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(l=!0),c=t.inputState.lastSelectionOrigin,c=="select.pointer"&&(r=bM(t.state.facet(l0).map(d=>d(t)),r))),t.dispatch({selection:r,scrollIntoView:l,userEvent:c}),!0}else return!1}function Aw(t,e,n,r=-1){if(Fe.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(Fe.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&t.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Gu(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.lengths.head)&&Gu(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Gu(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let l,c=()=>l||(l=KV(t,e,n));return t.state.facet(lM).some(d=>d(t,e.from,e.to,i,c))||t.dispatch(c()),!0}function KV(t,e,n){let r,s=t.state,i=s.selection.main,l=-1;if(e.from==e.to&&e.fromi.to){let d=e.fromp(t)),h,d);e.from==m&&(l=m)}if(l>-1)r={changes:e,selection:Ce.cursor(e.from+e.insert.length,-1)};else if(e.from>=i.from&&e.to<=i.to&&e.to-e.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let d=i.frome.to?s.sliceDoc(e.to,i.to):"";r=s.replaceSelection(t.state.toText(d+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let d=s.changes(e),h=n&&n.main.to<=d.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=i.to+10&&e.to>=i.to-10){let m=t.state.sliceDoc(e.from,e.to),p,x=n&&xM(t,n.main.head);if(x){let b=e.insert.length-(e.to-e.from);p={from:x.from,to:x.to-b}}else p=t.state.doc.lineAt(i.head);let v=i.to-e.to;r=s.changeByRange(b=>{if(b.from==i.from&&b.to==i.to)return{changes:d,range:h||b.map(d)};let k=b.to-v,O=k-m.length;if(t.state.sliceDoc(O,k)!=m||k>=p.from&&O<=p.to)return{range:b};let j=s.changes({from:O,to:k,insert:e.insert}),T=b.to-i.to;return{changes:j,range:h?Ce.range(Math.max(0,h.anchor+T),Math.max(0,h.head+T)):b.map(j)}})}else r={changes:d,selection:h&&s.selection.replaceRange(h)}}let c="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,c+=".compose",t.inputState.compositionFirstChange&&(c+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:c,scrollIntoView:!0})}function SM(t,e,n,r){let s=Math.min(t.length,e.length),i=0;for(;i0&&c>0&&t.charCodeAt(l-1)==e.charCodeAt(c-1);)l--,c--;if(r=="end"){let d=Math.max(0,i-Math.min(l,c));n-=l+d-i}if(l=l?i-n:0;i-=d,c=i+(c-l),l=i}else if(c=c?i-n:0;i-=d,l=i+(l-c),c=i}return{from:i,toA:l,toB:c}}function ZV(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}=t.observer.selectionRange;return n&&(e.push(new bj(n,r)),(s!=n||i!=r)&&e.push(new bj(s,i))),e}function JV(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?Ce.single(n+e,r+e):null}class eW{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Fe.safari&&e.contentDOM.addEventListener("input",()=>null),Fe.gecko&&gW(e.contentDOM.ownerDocument)}handleEvent(e){!oW(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let s of r.observers)s(this.view,n);for(let s of r.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=tW(e),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let l=!n[i].handlers.length,c=r[i];c&&l!=!c.handlers.length&&(s.removeEventListener(i,this.handleEvent),c=null),c||s.addEventListener(i,this.handleEvent,{passive:l})}for(let i in r)i!="scroll"&&!n[i]&&s.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&OM.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Fe.android&&Fe.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return Fe.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=kM.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||nW.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from0?!0:Fe.safari&&!Fe.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function wj(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){_s(n.state,s)}}}function tW(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let s=r.spec,i=s&&s.plugin.domEventHandlers,l=s&&s.plugin.domEventObservers;if(i)for(let c in i){let d=i[c];d&&n(c).handlers.push(wj(r.value,d))}if(l)for(let c in l){let d=l[c];d&&n(c).observers.push(wj(r.value,d))}}for(let r in Ui)n(r).handlers.push(Ui[r]);for(let r in Ti)n(r).observers.push(Ti[r]);return e}const kM=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],nW="dthko",OM=[16,17,18,20,91,92,224,225],rp=6;function sp(t){return Math.max(0,t)*.7+8}function rW(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class sW{constructor(e,n,r,s){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=hV(e.contentDOM),this.atoms=e.state.facet(l0).map(l=>l(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Vt.allowMultipleSelections)&&iW(e,n),this.dragging=lW(e,n)&&CM(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&rW(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,i=0,l=this.view.win.innerWidth,c=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:l}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:c}=this.scrollParents.y.getBoundingClientRect());let d=Tw(this.view);e.clientX-d.left<=s+rp?n=-sp(s-e.clientX):e.clientX+d.right>=l-rp&&(n=sp(e.clientX-l)),e.clientY-d.top<=i+rp?r=-sp(i-e.clientY):e.clientY+d.bottom>=c-rp&&(r=sp(e.clientY-c)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=bM(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function iW(t,e){let n=t.state.facet(rM);return n.length?n[0](e):Fe.mac?e.metaKey:e.ctrlKey}function aW(t,e){let n=t.state.facet(sM);return n.length?n[0](e):Fe.mac?!e.altKey:!e.ctrlKey}function lW(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=vf(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i=e.clientX&&l.top<=e.clientY&&l.bottom>=e.clientY)return!0}return!1}function oW(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=jn.get(n))&&r.ignoreEvent(e))return!1;return!0}const Ui=Object.create(null),Ti=Object.create(null),jM=Fe.ie&&Fe.ie_version<15||Fe.ios&&Fe.webkit_version<604;function cW(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),NM(t,n.value)},50)}function kx(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function NM(t,e){e=kx(t.state,jw,e);let{state:n}=t,r,s=1,i=n.toText(e),l=i.lines==n.selection.ranges.length;if(Q2!=null&&n.selection.ranges.every(d=>d.empty)&&Q2==i.toString()){let d=-1;r=n.changeByRange(h=>{let m=n.doc.lineAt(h.from);if(m.from==d)return{range:h};d=m.from;let p=n.toText((l?i.line(s++).text:e)+n.lineBreak);return{changes:{from:m.from,insert:p},range:Ce.cursor(h.from+p.length)}})}else l?r=n.changeByRange(d=>{let h=i.line(s++);return{changes:{from:d.from,to:d.to,insert:h.text},range:Ce.cursor(d.from+h.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Ti.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};Ui.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Ti.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Ti.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Ui.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(iM))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=hW(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new sW(t,e,n,r)),r&&t.observer.ignore(()=>{qA(t.contentDOM);let i=t.root.activeElement;i&&!i.contains(t.contentDOM)&&i.blur()});let s=t.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function Sj(t,e,n,r){if(r==1)return Ce.cursor(e,n);if(r==2)return IV(t.state,e,n);{let s=pr.find(t.docView,e),i=t.state.doc.lineAt(s?s.posAtEnd:e),l=s?s.posAtStart:i.from,c=s?s.posAtEnd:i.to;return ce>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function uW(t,e,n,r){let s=pr.find(t.docView,e);if(!s)return 1;let i=e-s.posAtStart;if(i==0)return 1;if(i==s.length)return-1;let l=s.coordsAt(i,-1);if(l&&kj(n,r,l))return-1;let c=s.coordsAt(i,1);return c&&kj(n,r,c)?1:l&&l.bottom>=r?-1:1}function Oj(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:uW(t,n,e.clientX,e.clientY)}}const dW=Fe.ie&&Fe.ie_version<=11;let jj=null,Nj=0,Cj=0;function CM(t){if(!dW)return t.detail;let e=jj,n=Cj;return jj=t,Cj=Date.now(),Nj=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Nj+1)%3:1}function hW(t,e){let n=Oj(t,e),r=CM(e),s=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,l,c){let d=Oj(t,i),h,m=Sj(t,d.pos,d.bias,r);if(n.pos!=d.pos&&!l){let p=Sj(t,n.pos,n.bias,r),x=Math.min(p.from,m.from),v=Math.max(p.to,m.to);m=x1&&(h=fW(s,d.pos))?h:c?s.addRange(m):Ce.create([m])}}}function fW(t,e){for(let n=0;n=e)return Ce.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}Ui.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let s=t.docView.nearest(e.target);if(s&&s.isWidget){let i=s.posAtStart,l=i+s.length;(i>=n.to||l<=n.from)&&(n=Ce.range(i,l))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",kx(t.state,Nw,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ui.dragend=t=>(t.inputState.draggedContent=null,!1);function Tj(t,e,n,r){if(n=kx(t.state,jw,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,l=r&&i&&aW(t,e)?{from:i.from,to:i.to}:null,c={from:s,insert:n},d=t.state.changes(l?[l,c]:c);t.focus(),t.dispatch({changes:d,selection:{anchor:d.mapPos(s,-1),head:d.mapPos(s,1)},userEvent:l?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Ui.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,i=()=>{++s==n.length&&Tj(t,e,r.filter(l=>l!=null).join(t.state.lineBreak),!1)};for(let l=0;l{/[\x00-\x08\x0e-\x1f]{2}/.test(c.result)||(r[l]=c.result),i()},c.readAsText(n[l])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Tj(t,e,r,!0),!0}return!1};Ui.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=jM?null:e.clipboardData;return n?(NM(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(cW(t),!1)};function mW(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function pW(t){let e=[],n=[],r=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),n.push(s));if(!e.length){let s=-1;for(let{from:i}of t.selection.ranges){let l=t.doc.lineAt(i);l.number>s&&(e.push(l.text),n.push({from:l.from,to:Math.min(t.doc.length,l.to+1)})),s=l.number}r=!0}return{text:kx(t,Nw,e.join(t.lineBreak)),ranges:n,linewise:r}}let Q2=null;Ui.copy=Ui.cut=(t,e)=>{let{text:n,ranges:r,linewise:s}=pW(t.state);if(!n&&!s)return!1;Q2=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=jM?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(mW(t,n),!1)};const TM=ka.define();function AM(t,e){let n=[];for(let r of t.facet(oM)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:TM.of(!0)}):null}function MM(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=AM(t.state,e);n?t.dispatch(n):t.update([])}},10)}Ti.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),MM(t)};Ti.blur=t=>{t.observer.clearSelectionRange(),MM(t)};Ti.compositionstart=Ti.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Ti.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Fe.chrome&&Fe.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Ti.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Ui.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let i=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),l=e.getTargetRanges();if(i&&l.length){let c=l[0],d=t.posAtDOM(c.startContainer,c.startOffset),h=t.posAtDOM(c.endContainer,c.endOffset);return Aw(t,{from:d,to:h,insert:t.state.toText(i)},null),!0}}let s;if(Fe.chrome&&Fe.android&&(s=kM.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var l;(((l=window.visualViewport)===null||l===void 0?void 0:l.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Fe.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Fe.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Ti.compositionend(t,e),20),!1};const Aj=new Set;function gW(t){Aj.has(t)||(Aj.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const Mj=["pre-wrap","normal","pre-line","break-spaces"];let fd=!1;function Ej(){fd=!1}class xW{constructor(e){this.lineWrapping=e,this.doc=Xt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Mj.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,d=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=c;if(this.lineWrapping=c,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,d){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Jp&&(fd=!0),this.height=e)}replace(e,n,r){return ms.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,s){let i=this,l=r.doc;for(let c=s.length-1;c>=0;c--){let{fromA:d,toA:h,fromB:m,toB:p}=s[c],x=i.lineAt(d,$n.ByPosNoHeight,r.setDoc(n),0,0),v=x.to>=h?x:i.lineAt(h,$n.ByPosNoHeight,r,0,0);for(p+=v.to-h,h=v.to;c>0&&x.from<=s[c-1].toA;)d=s[c-1].fromA,m=s[c-1].fromB,c--,di*2){let c=e[n-1];c.break?e.splice(--n,1,c.left,null,c.right):e.splice(--n,1,c.left,c.right),r+=1+c.break,s-=c.size}else if(i>s*2){let c=e[r];c.break?e.splice(r,1,c.left,null,c.right):e.splice(r,1,c.left,c.right),r+=2+c.break,i-=c.size}else break;else if(s=i&&l(this.blockAt(0,r,s,i))}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class ei extends EM{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,s){return new ca(s,this.length,r,this.height,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof ei||s instanceof $r&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof $r?s=new ei(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):ms.of(r)}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setHeight(s.heights[s.index++]):(r||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class $r extends ms{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,s=e.doc.lineAt(n+this.length).number,i=s-r+1,l,c=0;if(e.lineWrapping){let d=Math.min(this.height,e.lineHeight*i);l=d/i,this.length>i+1&&(c=(this.height-d)/(this.length-i-1))}else l=this.height/i;return{firstLine:r,lastLine:s,perLine:l,perChar:c}}blockAt(e,n,r,s){let{firstLine:i,lastLine:l,perLine:c,perChar:d}=this.heightMetrics(n,s);if(n.lineWrapping){let h=s+(e0){let i=r[r.length-1];i instanceof $r?r[r.length-1]=new $r(i.length+s):r.push(null,new $r(s-1))}if(e>0){let i=r[0];i instanceof $r?r[0]=new $r(e+i.length):r.unshift(new $r(e-1),null)}return ms.of(r)}decomposeLeft(e,n){n.push(new $r(e-1),null)}decomposeRight(e,n){n.push(null,new $r(this.length-e-1))}updateHeight(e,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let l=[],c=Math.max(n,s.from),d=-1;for(s.from>n&&l.push(new $r(s.from-n-1).updateHeight(e,n));c<=i&&s.more;){let m=e.doc.lineAt(c).length;l.length&&l.push(null);let p=s.heights[s.index++];d==-1?d=p:Math.abs(p-d)>=Jp&&(d=-2);let x=new ei(m,p);x.outdated=!1,l.push(x),c+=m+1}c<=i&&l.push(null,new $r(i-c).updateHeight(e,c));let h=ms.of(l);return(d<0||Math.abs(h.height-this.height)>=Jp||Math.abs(d-this.heightMetrics(e,n).perLine)>=Jp)&&(fd=!0),Cg(this,h)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class yW extends ms{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,s){let i=r+this.left.height;return ec))return h;let m=n==$n.ByPosNoHeight?$n.ByPosNoHeight:$n.ByPos;return d?h.join(this.right.lineAt(c,m,r,l,c)):this.left.lineAt(c,m,r,s,i).join(h)}forEachLine(e,n,r,s,i,l){let c=s+this.left.height,d=i+this.left.length+this.break;if(this.break)e=d&&this.right.forEachLine(e,n,r,c,d,l);else{let h=this.lineAt(d,$n.ByPos,r,s,i);e=e&&h.from<=n&&l(h),n>h.to&&this.right.forEachLine(h.to+1,n,r,c,d,l)}}replace(e,n,r){let s=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-s,n-s,r));let i=[];e>0&&this.decomposeLeft(e,i);let l=i.length;for(let c of r)i.push(c);if(e>0&&_j(i,l-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,n);e2*n.size||n.size>2*e.size?ms.of(this.break?[e,null,n]:[e,n]):(this.left=Cg(this.left,e),this.right=Cg(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,s){let{left:i,right:l}=this,c=n+i.length+this.break,d=null;return s&&s.from<=n+i.length&&s.more?d=i=i.updateHeight(e,n,r,s):i.updateHeight(e,n,r),s&&s.from<=c+l.length&&s.more?d=l=l.updateHeight(e,c,r,s):l.updateHeight(e,c,r),d?this.balanced(i,l):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function _j(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof $r&&(r=t[e+1])instanceof $r&&t.splice(e-1,3,new $r(n.length+1+r.length))}const bW=5;class Mw{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof ei?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new ei(r-this.pos,-1)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e=bW)&&this.addLineDeco(s,i,l)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new ei(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new $r(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof ei)return e;let n=new ei(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof ei)&&!this.isCovered?this.nodes.push(new ei(0,-1)):(this.writtenTom.clientHeight||m.scrollWidth>m.clientWidth)&&p.overflow!="visible"){let x=m.getBoundingClientRect();i=Math.max(i,x.left),l=Math.min(l,x.right),c=Math.max(c,x.top),d=Math.min(h==t.parentNode?s.innerHeight:d,x.bottom)}h=p.position=="absolute"||p.position=="fixed"?m.offsetParent:m.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:i-n.left,right:Math.max(i,l)-n.left,top:c-(n.top+e),bottom:Math.max(c,d)-(n.top+e)}}function OW(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function jW(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class Ry{constructor(e,n,r,s){this.from=e,this.to=n,this.size=r,this.displaySize=s}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;rtypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new xW(n),this.stateDeco=e.facet(yf).filter(r=>typeof r!="function"),this.heightMap=ms.empty().applyChanges(this.stateDeco,Xt.empty,this.heightOracle.setDoc(e.doc),[new Ni(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Je.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!e.some(({from:i,to:l})=>s>=i&&s<=l)){let{from:i,to:l}=this.lineBlockAt(s);e.push(new ip(i,l))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Rj:new Ew(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Hh(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(yf).filter(m=>typeof m!="function");let s=e.changedRanges,i=Ni.extendWithRanges(s,wW(r,this.stateDeco,e?e.changes:kr.empty(this.state.doc.length))),l=this.heightMap.height,c=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Ej(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=l||fd)&&(e.flags|=2),c?(this.scrollAnchorPos=e.changes.mapPos(c.from,-1),this.scrollAnchorHeight=c.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=l);let d=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.headd.to)||!this.viewportIsAppropriate(d))&&(d=this.getViewport(0,n));let h=d.from!=this.viewport.from||d.to!=this.viewport.to;this.viewport=d,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(uM)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Hn.RTL:Hn.LTR;let l=this.heightOracle.mustRefreshForWrapping(i),c=n.getBoundingClientRect(),d=l||this.mustMeasureContent||this.contentDOMHeight!=c.height;this.contentDOMHeight=c.height,this.mustMeasureContent=!1;let h=0,m=0;if(c.width&&c.height){let{scaleX:_,scaleY:D}=IA(n,c);(_>.005&&Math.abs(this.scaleX-_)>.005||D>.005&&Math.abs(this.scaleY-D)>.005)&&(this.scaleX=_,this.scaleY=D,h|=16,l=d=!0)}let p=(parseInt(r.paddingTop)||0)*this.scaleY,x=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=p||this.paddingBottom!=x)&&(this.paddingTop=p,this.paddingBottom=x,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(d=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let v=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=v&&(this.scrollAnchorHeight=-1,this.scrollTop=v),this.scrolledToBottom=QA(e.scrollDOM);let b=(this.printing?jW:kW)(n,this.paddingTop),k=b.top-this.pixelViewport.top,O=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let j=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(j!=this.inView&&(this.inView=j,j&&(d=!0)),!this.inView&&!this.scrollTarget&&!OW(e.dom))return 0;let T=c.width;if((this.contentDOMWidth!=T||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=c.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),d){let _=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(_)&&(l=!0),l||s.lineWrapping&&Math.abs(T-this.contentDOMWidth)>s.charWidth){let{lineHeight:D,charWidth:E,textHeight:z}=e.docView.measureTextSize();l=D>0&&s.refresh(i,D,E,z,Math.max(5,T/E),_),l&&(e.docView.minWidth=0,h|=16)}k>0&&O>0?m=Math.max(k,O):k<0&&O<0&&(m=Math.min(k,O)),Ej();for(let D of this.viewports){let E=D.from==this.viewport.from?_:e.docView.measureVisibleLineHeights(D);this.heightMap=(l?ms.empty().applyChanges(this.stateDeco,Xt.empty,this.heightOracle,[new Ni(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,l,new vW(D.from,E))}fd&&(h|=2)}let A=!this.viewportIsAppropriate(this.viewport,m)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return A&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(m,this.scrollTarget),h|=this.updateForViewport()),(h&2||A)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(l?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:l,visibleBottom:c}=this,d=new ip(s.lineAt(l-r*1e3,$n.ByHeight,i,0,0).from,s.lineAt(c+(1-r)*1e3,$n.ByHeight,i,0,0).to);if(n){let{head:h}=n.range;if(hd.to){let m=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),p=s.lineAt(h,$n.ByPos,i,0,0),x;n.y=="center"?x=(p.top+p.bottom)/2-m/2:n.y=="start"||n.y=="nearest"&&h=c+Math.max(10,Math.min(r,250)))&&s>l-2*1e3&&i>1,l=s<<1;if(this.defaultTextDirection!=Hn.LTR&&!r)return[];let c=[],d=(m,p,x,v)=>{if(p-mm&&jj.from>=x.from&&j.to<=x.to&&Math.abs(j.from-m)j.fromT));if(!O){if(pA.from<=p&&A.to>=p)){let A=n.moveToLineBoundary(Ce.cursor(p),!1,!0).head;A>m&&(p=A)}let j=this.gapSize(x,m,p,v),T=r||j<2e6?j:2e6;O=new Ry(m,p,j,T)}c.push(O)},h=m=>{if(m.length2e6)for(let E of e)E.from>=m.from&&E.fromm.from&&d(m.from,v,m,p),bn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];Yt.spans(n,this.viewport.from,this.viewport.to,{span(i,l){r.push({from:i,to:l})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||Hh(this.heightMap.lineAt(e,$n.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||Hh(this.heightMap.lineAt(this.scaler.fromDOM(e),$n.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return Hh(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}let ip=class{constructor(e,n){this.from=e,this.to=n}};function CW(t,e,n){let r=[],s=t,i=0;return Yt.spans(n,t,e,{span(){},point(l,c){l>s&&(r.push({from:s,to:l}),i+=l-s),s=c}},20),s=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let s=0;;s++){let{from:i,to:l}=e[s],c=l-i;if(r<=c)return i+r;r-=c}}function lp(t,e){let n=0;for(let{from:r,to:s}of t.ranges){if(e<=s){n+=e-r;break}n+=s-r}return n/t.total}function TW(t,e){for(let n of t)if(e(n))return n}const Rj={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class Ew{constructor(e,n,r){let s=0,i=0,l=0;this.viewports=r.map(({from:c,to:d})=>{let h=n.lineAt(c,$n.ByPos,e,0,0).top,m=n.lineAt(d,$n.ByPos,e,0,0).bottom;return s+=m-h,{from:c,to:d,top:h,bottom:m,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let c of this.viewports)c.domTop=l+(c.top-i)*this.scale,l=c.domBottom=c.domTop+(c.bottom-c.top),i=c.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let i=nn.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function Hh(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new ca(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>Hh(s,e)):t._content)}const op=He.define({combine:t=>t.join(" ")}),$2=He.define({combine:t=>t.indexOf(!0)>-1}),H2=fo.newName(),_M=fo.newName(),DM=fo.newName(),RM={"&light":"."+_M,"&dark":"."+DM};function U2(t,e,n){return new fo(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return t;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):t+" "+r}})}const AW=U2("."+H2,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},RM),MW={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},zy=Fe.ie&&Fe.ie_version<=11;class EW{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new fV,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(Fe.ie&&Fe.ie_version<=11||Fe.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Fe.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Fe.chrome&&Fe.chrome_version<126)&&(this.editContext=new DW(e),e.state.facet(il)&&(e.contentDOM.editContext=this.editContext.editContext)),zy&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(il)?r.root.activeElement!=this.dom:!Kp(this.dom,s))return;let i=s.anchorNode&&r.docView.nearest(s.anchorNode);if(i&&i.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Fe.ie&&Fe.ie_version<=11||Fe.android&&Fe.chrome)&&!r.state.selection.main.empty&&s.focusNode&&ef(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=vf(e.root);if(!n)return!1;let r=Fe.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&_W(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=Kp(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&Gu(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of e){let l=this.readMutation(i);l&&(l.typeOver&&(s=!0),n==-1?{from:n,to:r}=l:(n=Math.min(l.from,n),r=Math.max(l.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&Kp(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new YV(this.view,e,n,r);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,s=wM(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let r=zj(n,e.previousSibling||e.target.previousSibling,-1),s=zj(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(il)!=e.state.facet(il)&&(e.view.contentDOM.editContext=e.state.facet(il)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function zj(t,e,n){for(;e;){let r=jn.get(e);if(r&&r.parent==t)return r;let s=e.parentNode;e=s!=t.dom?s:n>0?e.nextSibling:e.previousSibling}return null}function Pj(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,l=t.docView.domAtPos(t.state.selection.main.anchor);return ef(l.node,l.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function _W(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return Pj(t,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?Pj(t,n):null}class DW{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let s=e.state.selection.main,{anchor:i,head:l}=s,c=this.toEditorPos(r.updateRangeStart),d=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:c,drifted:!1});let h=d-c>r.text.length;c==this.from&&ithis.to&&(d=i);let m=SM(e.state.sliceDoc(c,d),r.text,(h?s.from:s.to)-c,h?"end":null);if(!m){let x=Ce.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));x.main.eq(s)||e.dispatch({selection:x,userEvent:"select"});return}let p={from:m.from+c,to:m.toA+c,insert:Xt.of(r.text.slice(m.from,m.toB).split(` -`))};if((Fe.mac||Fe.android)&&p.from==l-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(p={from:c,to:d,insert:Xt.of([r.text.replace("."," ")])}),this.pendingContextChange=p,!e.state.readOnly){let x=this.to-this.from+(p.to-p.from+p.insert.length);Aw(e,p,Ce.single(this.toEditorPos(r.selectionStart,x),this.toEditorPos(r.selectionEnd,x)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),p.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let l=this.toEditorPos(r.rangeStart),c=this.toEditorPos(r.rangeEnd);l{let s=[];for(let i of r.getTextFormats()){let l=i.underlineStyle,c=i.underlineThickness;if(!/none/i.test(l)&&!/none/i.test(c)){let d=this.toEditorPos(i.rangeStart),h=this.toEditorPos(i.rangeEnd);if(d{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=vf(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((i,l,c,d,h)=>{if(r)return;let m=h.length-(l-i);if(s&&l>=s.to)if(s.from==i&&s.to==l&&s.insert.eq(h)){s=this.pendingContextChange=null,n+=m,this.to+=m;return}else s=null,this.revertPending(e.state);if(i+=n,l+=n,l<=this.from)this.from+=m,this.to+=m;else if(ithis.to||this.to-this.from+h.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(l),h.toString()),this.to+=m}n+=m}),s&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class qe{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(s=>s.forEach(i=>r(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||mV(e.parent)||document,this.viewState=new Dj(e.state||Vt.create(e)),e.scrollTo&&e.scrollTo.is(np)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Fu).map(s=>new Ey(s));for(let s of this.plugins)s.update(this);this.observer=new EW(this),this.inputState=new eW(this),this.inputState.ensureHandlers(this.plugins),this.docView=new mj(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof gr?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let x of e){if(x.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=x.state}if(this.destroyed){this.viewState.state=i;return}let l=this.hasFocus,c=0,d=null;e.some(x=>x.annotation(TM))?(this.inputState.notifiedFocused=l,c=1):l!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=l,d=AM(i,l),d||(c=1));let h=this.observer.delayedAndroidKey,m=null;if(h?(this.observer.clearDelayedAndroidKey(),m=this.observer.readChange(),(m&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(m=null)):this.observer.clear(),i.facet(Vt.phrases)!=this.state.facet(Vt.phrases))return this.setState(i);s=Ng.create(this,i,e),s.flags|=c;let p=this.viewState.scrollTarget;try{this.updateState=2;for(let x of e){if(p&&(p=p.map(x.changes)),x.scrollIntoView){let{main:v}=x.state.selection;p=new Xu(v.empty?v:Ce.cursor(v.head,v.head>v.anchor?-1:1))}for(let v of x.effects)v.is(np)&&(p=v.value.clip(this.state))}this.viewState.update(s,p),this.bidiCache=Tg.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(Qh)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(x=>x.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(op)!=s.state.facet(op)&&(this.viewState.mustMeasureContent=!0),(n||r||p||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let x of this.state.facet(I2))try{x(s)}catch(v){_s(this.state,v,"update listener")}(d||m)&&Promise.resolve().then(()=>{d&&this.state==d.startState&&this.dispatch(d),m&&!wM(this,m)&&h.force&&Gu(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new Dj(e),this.plugins=e.facet(Fu).map(r=>new Ey(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new mj(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Fu),r=e.state.facet(Fu);if(n!=r){let s=[];for(let i of r){let l=n.indexOf(i);if(l<0)s.push(new Ey(i));else{let c=this.plugins[l];c.mustUpdate=e,s.push(c)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:l}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(l=-1),this.viewState.scrollAnchorHeight=-1;try{for(let c=0;;c++){if(l<0)if(QA(r))i=-1,l=this.viewState.heightMap.height;else{let v=this.viewState.scrollAnchorAt(s);i=v.from,l=v.top}this.updateState=1;let d=this.viewState.measure(this);if(!d&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(c>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];d&4||([this.measureRequests,h]=[h,this.measureRequests]);let m=h.map(v=>{try{return v.read(this)}catch(b){return _s(this.state,b),Bj}}),p=Ng.create(this,this.state,[]),x=!1;p.flags|=d,n?n.flags|=d:n=p,this.updateState=2,p.empty||(this.updatePlugins(p),this.inputState.update(p),this.updateAttrs(),x=this.docView.update(p),x&&this.docViewUpdate());for(let v=0;v1||b<-1){s=s+b,r.scrollTop=s/this.scaleY,l=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let c of this.state.facet(I2))c(n)}get themeClasses(){return H2+" "+(this.state.facet($2)?DM:_M)+" "+this.state.facet(op)}updateAttrs(){let e=Lj(this,fM,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(il)?"true":"false",class:"cm-content",style:`${Fe.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),Lj(this,Cw,n);let r=this.observer.ignore(()=>{let s=R2(this.contentDOM,this.contentAttrs,n),i=R2(this.dom,this.editorAttrs,e);return s||i});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let s of r.effects)if(s.is(qe.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Qh);let e=this.state.facet(qe.cspNonce);fo.mount(this.root,this.styleModules.concat(AW).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;nr.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return Dy(this,e,yj(this,e,n,r))}moveByGroup(e,n){return Dy(this,e,yj(this,e,n,r=>UV(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),i=r[n?r.length-1:0];return Ce.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return HV(this,e,n,r)}moveVertically(e,n,r){return Dy(this,e,VV(this,e,n,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),vM(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(e),i=this.bidiSpans(s),l=i[so.find(i,e-s.from,-1,n)];return s0(r,l.dir==Hn.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(cM)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>RW)return tM(e.length);let n=this.textDirectionAt(e.from),r;for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||eM(i.isolates,r=fj(this,e))))return i.order;r||(r=fj(this,e));let s=TV(e.text,n,r);return this.bidiCache.push(new Tg(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Fe.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{qA(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return np.of(new Xu(typeof e=="number"?Ce.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return np.of(new Xu(Ce.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return lr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return lr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=fo.newName(),s=[op.of(r),Qh.of(U2(`.${r}`,e))];return n&&n.dark&&s.push($2.of(!0)),s}static baseTheme(e){return No.lowest(Qh.of(U2("."+H2,e,RM)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&jn.get(r)||jn.get(e);return((n=s?.rootView)===null||n===void 0?void 0:n.view)||null}}qe.styleModule=Qh;qe.inputHandler=lM;qe.clipboardInputFilter=jw;qe.clipboardOutputFilter=Nw;qe.scrollHandler=dM;qe.focusChangeEffect=oM;qe.perLineTextDirection=cM;qe.exceptionSink=aM;qe.updateListener=I2;qe.editable=il;qe.mouseSelectionStyle=iM;qe.dragMovesSelection=sM;qe.clickAddsSelectionRange=rM;qe.decorations=yf;qe.outerDecorations=mM;qe.atomicRanges=l0;qe.bidiIsolatedRanges=pM;qe.scrollMargins=gM;qe.darkTheme=$2;qe.cspNonce=He.define({combine:t=>t.length?t[0]:""});qe.contentAttributes=Cw;qe.editorAttributes=fM;qe.lineWrapping=qe.contentAttributes.of({class:"cm-lineWrapping"});qe.announce=vt.define();const RW=4096,Bj={};class Tg{constructor(e,n,r,s,i,l){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=l}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:Hn.LTR;for(let i=Math.max(0,e.length-10);i=0;s--){let i=r[s],l=typeof i=="function"?i(t):i;l&&D2(l,n)}return n}const zW=Fe.mac?"mac":Fe.windows?"win":Fe.linux?"linux":"key";function PW(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,l,c;for(let d=0;dr.concat(s),[]))),n}function LW(t,e,n){return PM(zM(t.state),e,t,n)}let no=null;const IW=4e3;function qW(t,e=zW){let n=Object.create(null),r=Object.create(null),s=(l,c)=>{let d=r[l];if(d==null)r[l]=c;else if(d!=c)throw new Error("Key binding "+l+" is used both as a regular binding and as a multi-stroke prefix")},i=(l,c,d,h,m)=>{var p,x;let v=n[l]||(n[l]=Object.create(null)),b=c.split(/ (?!$)/).map(j=>PW(j,e));for(let j=1;j{let _=no={view:A,prefix:T,scope:l};return setTimeout(()=>{no==_&&(no=null)},IW),!0}]})}let k=b.join(" ");s(k,!1);let O=v[k]||(v[k]={preventDefault:!1,stopPropagation:!1,run:((x=(p=v._any)===null||p===void 0?void 0:p.run)===null||x===void 0?void 0:x.slice())||[]});d&&O.run.push(d),h&&(O.preventDefault=!0),m&&(O.stopPropagation=!0)};for(let l of t){let c=l.scope?l.scope.split(" "):["editor"];if(l.any)for(let h of c){let m=n[h]||(n[h]=Object.create(null));m._any||(m._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:p}=l;for(let x in m)m[x].run.push(v=>p(v,V2))}let d=l[e]||l.key;if(d)for(let h of c)i(h,d,l.run,l.preventDefault,l.stopPropagation),l.shift&&i(h,"Shift-"+d,l.shift,l.preventDefault,l.stopPropagation)}return n}let V2=null;function PM(t,e,n,r){V2=e;let s=oV(e),i=As(s,0),l=oa(i)==s.length&&s!=" ",c="",d=!1,h=!1,m=!1;no&&no.view==n&&no.scope==r&&(c=no.prefix+" ",OM.indexOf(e.keyCode)<0&&(h=!0,no=null));let p=new Set,x=O=>{if(O){for(let j of O.run)if(!p.has(j)&&(p.add(j),j(n)))return O.stopPropagation&&(m=!0),!0;O.preventDefault&&(O.stopPropagation&&(m=!0),h=!0)}return!1},v=t[r],b,k;return v&&(x(v[c+cp(s,e,!l)])?d=!0:l&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Fe.windows&&e.ctrlKey&&e.altKey)&&!(Fe.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(b=mo[e.keyCode])&&b!=s?(x(v[c+cp(b,e,!0)])||e.shiftKey&&(k=xf[e.keyCode])!=s&&k!=b&&x(v[c+cp(k,e,!1)]))&&(d=!0):l&&e.shiftKey&&x(v[c+cp(s,e,!0)])&&(d=!0),!d&&x(v._any)&&(d=!0)),h&&(d=!0),d&&m&&e.stopPropagation(),V2=null,d}class c0{constructor(e,n,r,s,i){this.className=e,this.left=n,this.top=r,this.width=s,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let s=e.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let i=BM(e);return[new c0(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return FW(e,n,r)}}function BM(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Hn.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function qj(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let i=t.dom.getBoundingClientRect(),l=(s.top+s.bottom)/2,c=t.posAtCoords({x:i.left+1,y:l}),d=t.posAtCoords({x:i.right-1,y:l});return c==null||d==null?r:{from:Math.max(r.from,Math.min(c,d)),to:Math.min(r.to,Math.max(c,d))}}function FW(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),s=Math.min(n.to,t.viewport.to),i=t.textDirection==Hn.LTR,l=t.contentDOM,c=l.getBoundingClientRect(),d=BM(t),h=l.querySelector(".cm-line"),m=h&&window.getComputedStyle(h),p=c.left+(m?parseInt(m.paddingLeft)+Math.min(0,parseInt(m.textIndent)):0),x=c.right-(m?parseInt(m.paddingRight):0),v=F2(t,r,1),b=F2(t,s,-1),k=v.type==fs.Text?v:null,O=b.type==fs.Text?b:null;if(k&&(t.lineWrapping||v.widgetLineBreaks)&&(k=qj(t,r,1,k)),O&&(t.lineWrapping||b.widgetLineBreaks)&&(O=qj(t,s,-1,O)),k&&O&&k.from==O.from&&k.to==O.to)return T(A(n.from,n.to,k));{let D=k?A(n.from,null,k):_(v,!1),E=O?A(null,n.to,O):_(b,!0),z=[];return(k||v).to<(O||b).from-(k&&O?1:0)||v.widgetLineBreaks>1&&D.bottom+t.defaultLineHeight/2V&&W.from=$)break;R>J&&U(Math.max(ue,J),D==null&&ue<=V,Math.min(R,$),E==null&&R>=ce,ne.dir)}if(J=ae.to+1,J>=$)break}return L.length==0&&U(V,D==null,ce,E==null,t.textDirection),{top:Q,bottom:F,horizontal:L}}function _(D,E){let z=c.top+(E?D.top:D.bottom);return{top:z,bottom:z,horizontal:[]}}}function QW(t,e){return t.constructor==e.constructor&&t.eq(e)}class $W{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(eg)!=e.state.facet(eg)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(eg);for(;n!QW(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of e)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=e,Fe.safari&&Fe.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const eg=He.define();function LM(t){return[lr.define(e=>new $W(e,t)),eg.of(t)]}const bf=He.define({combine(t){return Oa(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function HW(t={}){return[bf.of(t),UW,VW,WW,uM.of(!0)]}function IM(t){return t.startState.facet(bf)!=t.state.facet(bf)}const UW=LM({above:!0,markers(t){let{state:e}=t,n=e.facet(bf),r=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||n.drawRangeCursor){let l=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",c=s.empty?s:Ce.cursor(s.head,s.head>s.anchor?-1:1);for(let d of c0.forRange(t,l,c))r.push(d)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=IM(t);return n&&Fj(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){Fj(e.state,t)},class:"cm-cursorLayer"});function Fj(t,e){e.style.animationDuration=t.facet(bf).cursorBlinkRate+"ms"}const VW=LM({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:c0.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||IM(t)},class:"cm-selectionLayer"}),WW=No.highest(qe.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),qM=vt.define({map(t,e){return t==null?null:e.mapPos(t)}}),Uh=Br.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(qM)?r.value:n,t)}}),GW=lr.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(Uh);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Uh)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Uh),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Uh)!=t&&this.view.dispatch({effects:qM.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function XW(){return[Uh,GW]}function Qj(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),l=n,c;!i.next().done;l+=i.value.length)if(!i.lineBreak)for(;c=e.exec(i.value);)s(l+c.index,c)}function YW(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:s,to:i}of n)s=Math.max(t.state.doc.lineAt(s).from,s-e),i=Math.min(t.state.doc.lineAt(i).to,i+e),r.length&&r[r.length-1].to>=s?r[r.length-1].to=i:r.push({from:s,to:i});return r}class KW{constructor(e){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:l=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(c,d,h,m)=>s(m,h,h+c[0].length,c,d);else if(typeof r=="function")this.addMatch=(c,d,h,m)=>{let p=r(c,d,h);p&&m(h,h+c[0].length,p)};else if(r)this.addMatch=(c,d,h,m)=>m(h,h+c[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=l}createDeco(e){let n=new ml,r=n.add.bind(n);for(let{from:s,to:i}of YW(e,this.maxLength))Qj(e.state.doc,this.regexp,s,i,(l,c)=>this.addMatch(c,e,l,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,l,c,d)=>{d>=e.view.viewport.from&&c<=e.view.viewport.to&&(r=Math.min(c,r),s=Math.max(d,s))}),e.viewportMoved||s-r>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,n.map(e.changes),r,s):n}updateRange(e,n,r,s){for(let i of e.visibleRanges){let l=Math.max(i.from,r),c=Math.min(i.to,s);if(c>=l){let d=e.state.doc.lineAt(l),h=d.tod.from;l--)if(this.boundary.test(d.text[l-1-d.from])){m=l;break}for(;cx.push(j.range(k,O));if(d==h)for(this.regexp.lastIndex=m-d.from;(v=this.regexp.exec(d.text))&&v.indexthis.addMatch(O,e,k,b));n=n.update({filterFrom:m,filterTo:p,filter:(k,O)=>kp,add:x})}}return n}}const W2=/x/.unicode!=null?"gu":"g",ZW=new RegExp(`[\0-\b ---Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,W2),JW={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Py=null;function eG(){var t;if(Py==null&&typeof document<"u"&&document.body){let e=document.body.style;Py=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Py||!1}const tg=He.define({combine(t){let e=Oa(t,{render:null,specialChars:ZW,addSpecialChars:null});return(e.replaceTabs=!eG())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,W2)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,W2)),e}});function tG(t={}){return[tg.of(t),nG()]}let $j=null;function nG(){return $j||($j=lr.fromClass(class{constructor(t){this.view=t,this.decorations=Je.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(tg)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new KW({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=As(e[0],0);if(i==9){let l=s.lineAt(r),c=n.state.tabSize,d=Td(l.text,c,r-l.from);return Je.replace({widget:new aG((c-d%c)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=Je.replace({widget:new iG(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(tg);t.startState.facet(tg)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const rG="•";function sG(t){return t>=32?rG:t==10?"␤":String.fromCharCode(9216+t)}class iG extends ja{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=sG(this.code),r=e.state.phrase("Control character")+" "+(JW[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,n);if(s)return s;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class aG extends ja{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function lG(){return cG}const oG=Je.line({class:"cm-activeLine"}),cG=lr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let s=t.lineBlockAt(r.head);s.from>e&&(n.push(oG.range(s.from)),e=s.from)}return Je.set(n)}},{decorations:t=>t.decorations});class uG extends ja{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?ud(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),s=s0(n[0],r.direction!="rtl"),i=parseInt(r.lineHeight);return s.bottom-s.top>i*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+i}:s}ignoreEvent(){return!1}}function dG(t){let e=lr.fromClass(class{constructor(n){this.view=n,this.placeholder=t?Je.set([Je.widget({widget:new uG(t),side:1}).range(0)]):Je.none}get decorations(){return this.view.state.doc.length?Je.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,qe.contentAttributes.of({"aria-placeholder":t})]:e}const G2=2e3;function hG(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>G2||n.off>G2||e.col<0||n.col<0){let l=Math.min(e.off,n.off),c=Math.max(e.off,n.off);for(let d=r;d<=s;d++){let h=t.doc.line(d);h.length<=c&&i.push(Ce.range(h.from+l,h.to+c))}}else{let l=Math.min(e.col,n.col),c=Math.max(e.col,n.col);for(let d=r;d<=s;d++){let h=t.doc.line(d),m=j2(h.text,l,t.tabSize,!0);if(m<0)i.push(Ce.cursor(h.to));else{let p=j2(h.text,c,t.tabSize);i.push(Ce.range(h.from+m,h.from+p))}}}return i}function fG(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function Hj(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),s=n-r.from,i=s>G2?-1:s==r.length?fG(t,e.clientX):Td(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function mG(t,e){let n=Hj(t,e),r=t.state.selection;return n?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(n.line).from),l=s.state.doc.lineAt(i);n={line:l.number,col:n.col,off:Math.min(n.off,l.length)},r=r.map(s.changes)}},get(s,i,l){let c=Hj(t,s);if(!c)return r;let d=hG(t.state,n,c);return d.length?l?Ce.create(d.concat(r.ranges)):Ce.create(d):r}}:null}function pG(t){let e=(n=>n.altKey&&n.button==0);return qe.mouseSelectionStyle.of((n,r)=>e(r)?mG(n,r):null)}const gG={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},xG={style:"cursor: crosshair"};function vG(t={}){let[e,n]=gG[t.key||"Alt"],r=lr.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||n(s))},keyup(s){(s.keyCode==e||!n(s))&&this.set(!1)},mousemove(s){this.set(n(s))}}});return[r,qe.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?xG:null})]}const up="-10000px";class FM{constructor(e,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=e.state.facet(n),this.tooltips=this.input.filter(l=>l);let i=null;this.tooltipViews=this.tooltips.map(l=>i=r(l,i))}update(e,n){var r;let s=e.state.facet(this.facet),i=s.filter(d=>d);if(s===this.input){for(let d of this.tooltipViews)d.update&&d.update(e);return!1}let l=[],c=n?[]:null;for(let d=0;dn[h]=d),n.length=c.length),this.input=s,this.tooltips=i,this.tooltipViews=l,!0}}function yG(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const By=He.define({combine:t=>{var e,n,r;return{position:Fe.ios?"absolute":((e=t.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(s=>s.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||yG}}}),Uj=new WeakMap,_w=lr.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(By);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new FM(t,Dw,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(By);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",n.dom.appendChild(s)}return n.dom.style.position=this.position,n.dom.style.top=up,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(Fe.safari){let l=i.getBoundingClientRect();n=Math.abs(l.top+1e4)>1||Math.abs(l.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=Tw(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,l)=>{let c=this.manager.tooltipViews[l];return c.getCoords?c.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(By).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let c of this.manager.tooltipViews)c.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,l=[];for(let c=0;c=Math.min(n.bottom,r.bottom)||p.rightMath.min(n.right,r.right)+.1)){m.style.top=up;continue}let v=d.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,b=v?7:0,k=x.right-x.left,O=(e=Uj.get(h))!==null&&e!==void 0?e:x.bottom-x.top,j=h.offset||wG,T=this.view.textDirection==Hn.LTR,A=x.width>r.right-r.left?T?r.left:r.right-x.width:T?Math.max(r.left,Math.min(p.left-(v?14:0)+j.x,r.right-k)):Math.min(Math.max(r.left,p.left-k+(v?14:0)-j.x),r.right-k),_=this.above[c];!d.strictSide&&(_?p.top-O-b-j.yr.bottom)&&_==r.bottom-p.bottom>p.top-r.top&&(_=this.above[c]=!_);let D=(_?p.top-r.top:r.bottom-p.bottom)-b;if(DA&&Q.topE&&(E=_?Q.top-O-2-b:Q.bottom+b+2);if(this.position=="absolute"?(m.style.top=(E-t.parent.top)/i+"px",Vj(m,(A-t.parent.left)/s)):(m.style.top=E/i+"px",Vj(m,A/s)),v){let Q=p.left+(T?j.x:-j.x)-(A+14-7);v.style.left=Q/s+"px"}h.overlap!==!0&&l.push({left:A,top:E,right:z,bottom:E+O}),m.classList.toggle("cm-tooltip-above",_),m.classList.toggle("cm-tooltip-below",!_),h.positioned&&h.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=up}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Vj(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const bG=qe.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),wG={x:0,y:0},Dw=He.define({enables:[_w,bG]}),Ag=He.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Ox{static create(e){return new Ox(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new FM(e,Ag,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let s=r[e];if(s!==void 0){if(n===void 0)n=s;else if(n!==s)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const SG=Dw.compute([Ag],t=>{let e=t.facet(Ag);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:Ox.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class kG{constructor(e,n,r,s,i){this.view=e,this.source=n,this.field=r,this.setHover=s,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;ec.bottom||n.xc.right+e.defaultCharacterWidth)return;let d=e.bidiSpans(e.state.doc.lineAt(s)).find(m=>m.from<=s&&m.to>=s),h=d&&d.dir==Hn.RTL?-1:1;i=n.x{this.pending==c&&(this.pending=null,d&&!(Array.isArray(d)&&!d.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(d)?d:[d])}))},d=>_s(e.state,d,"hover tooltip"))}else l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])})}get tooltip(){let e=this.view.plugin(_w),n=e?e.manager.tooltips.findIndex(r=>r.create==Ox.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:i}=this;if(s.length&&i&&!OG(i.dom,e)||this.pending){let{pos:l}=s[0]||this.pending,c=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:l;(l==c?this.view.posAtCoords(this.lastMove)!=l:!jG(this.view,l,c,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const dp=4;function OG(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),l;if(l=t.querySelector(".cm-tooltip-arrow")){let c=l.getBoundingClientRect();s=Math.min(c.top,s),i=Math.max(c.bottom,i)}return e.clientX>=n-dp&&e.clientX<=r+dp&&e.clientY>=s-dp&&e.clientY<=i+dp}function jG(t,e,n,r,s,i){let l=t.scrollDOM.getBoundingClientRect(),c=t.documentTop+t.documentPadding.top+t.contentHeight;if(l.left>r||l.rights||Math.min(l.bottom,c)=e&&d<=n}function NG(t,e={}){let n=vt.define(),r=Br.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(l=>!e.hideOn(i,l))),i.docChanged)){let l=[];for(let c of s){let d=i.changes.mapPos(c.pos,-1,Ur.TrackDel);if(d!=null){let h=Object.assign(Object.create(null),c);h.pos=d,h.end!=null&&(h.end=i.changes.mapPos(h.end)),l.push(h)}}s=l}for(let l of i.effects)l.is(n)&&(s=l.value),l.is(CG)&&(s=[]);return s},provide:s=>Ag.from(s)});return{active:r,extension:[r,lr.define(s=>new kG(s,t,r,n,e.hoverTime||300)),SG]}}function QM(t,e){let n=t.plugin(_w);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const CG=vt.define(),Wj=He.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function wf(t,e){let n=t.plugin($M),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const $M=lr.fromClass(class{constructor(t){this.input=t.state.facet(Sf),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(Wj);this.top=new hp(t,!0,e.topContainer),this.bottom=new hp(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(Wj);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new hp(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new hp(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Sf);if(n!=this.input){let r=n.filter(d=>d),s=[],i=[],l=[],c=[];for(let d of r){let h=this.specs.indexOf(d),m;h<0?(m=d(t.view),c.push(m)):(m=this.panels[h],m.update&&m.update(t)),s.push(m),(m.top?i:l).push(m)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(l);for(let d of c)d.dom.classList.add("cm-panel"),d.mount&&d.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>qe.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class hp{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=Gj(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=Gj(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Gj(t){let e=t.nextSibling;return t.remove(),e}const Sf=He.define({enables:$M});class gl extends yc{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}gl.prototype.elementClass="";gl.prototype.toDOM=void 0;gl.prototype.mapMode=Ur.TrackBefore;gl.prototype.startSide=gl.prototype.endSide=-1;gl.prototype.point=!0;const ng=He.define(),TG=He.define(),AG={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Yt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},rf=He.define();function MG(t){return[HM(),rf.of({...AG,...t})]}const Xj=He.define({combine:t=>t.some(e=>e)});function HM(t){return[EG]}const EG=lr.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(rf).map(e=>new Kj(t,e)),this.fixed=!t.state.facet(Xj);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Xj)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=Yt.iter(this.view.state.facet(ng),this.view.viewport.from),r=[],s=this.gutters.map(i=>new _G(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let l=!0;for(let c of i.type)if(c.type==fs.Text&&l){X2(n,r,c.from);for(let d of s)d.line(this.view,c,r);l=!1}else if(c.widget)for(let d of s)d.widget(this.view,c)}else if(i.type==fs.Text){X2(n,r,i.from);for(let l of s)l.line(this.view,i,r)}else if(i.widget)for(let l of s)l.widget(this.view,i);for(let i of s)i.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(rf),n=t.state.facet(rf),r=t.docChanged||t.heightChanged||t.viewportChanged||!Yt.eq(t.startState.facet(ng),t.state.facet(ng),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let i of n){let l=e.indexOf(i);l<0?s.push(new Kj(this.view,i)):(this.gutters[l].update(t),s.push(this.gutters[l]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>qe.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,s=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Hn.LTR?{left:r,right:s}:{right:r,left:s}})});function Yj(t){return Array.isArray(t)?t:[t]}function X2(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class _G{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Yt.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,i=(n.top-this.height)/e.scaleY,l=n.height/e.scaleY;if(this.i==s.elements.length){let c=new UM(e,l,i,r);s.elements.push(c),s.dom.appendChild(c.dom)}else s.elements[this.i].update(e,l,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];X2(this.cursor,s,n.from),r.length&&(s=s.concat(r));let i=this.gutter.config.lineMarker(e,n,s);i&&s.unshift(i);let l=this.gutter;s.length==0&&!l.config.renderEmptyElements||this.addElement(e,n,s)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),s=r?[r]:null;for(let i of e.state.facet(TG)){let l=i(e,n.widget,n);l&&(s||(s=[])).push(l)}s&&this.addElement(e,n,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class Kj{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let i=s.target,l;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let d=i.getBoundingClientRect();l=(d.top+d.bottom)/2}else l=s.clientY;let c=e.lineBlockAtHeight(l-e.documentTop);n.domEventHandlers[r](e,c,s)&&s.preventDefault()});this.markers=Yj(n.markers(e)),n.initialSpacer&&(this.spacer=new UM(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=Yj(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let r=e.view.viewport;return!Yt.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class UM{constructor(e,n,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,s)}update(e,n,r,s){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),DG(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,l=0;;){let c=l,d=ii(c,d,h)||l(c,d,h):l}return r}})}});class Ly extends gl{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Iy(t,e){return t.state.facet(Qu).formatNumber(e,t.state)}const PG=rf.compute([Qu],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(RG)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new Ly(Iy(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(zG)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Qu)!=e.state.facet(Qu),initialSpacer(e){return new Ly(Iy(e,Zj(e.state.doc.lines)))},updateSpacer(e,n){let r=Iy(n.view,Zj(n.view.state.doc.lines));return r==e.number?e:new Ly(r)},domEventHandlers:t.facet(Qu).domEventHandlers,side:"before"}));function BG(t={}){return[Qu.of(t),HM(),PG]}function Zj(t){let e=9;for(;e{let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>n&&(n=s,e.push(LG.range(s)))}return Yt.of(e)});function qG(){return IG}const VM=1024;let FG=0;class qy{constructor(e,n){this.from=e,this.to=n}}class Et{constructor(e={}){this.id=FG++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=gs.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Et.closedBy=new Et({deserialize:t=>t.split(" ")});Et.openedBy=new Et({deserialize:t=>t.split(" ")});Et.group=new Et({deserialize:t=>t.split(" ")});Et.isolate=new Et({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Et.contextHash=new Et({perNode:!0});Et.lookAhead=new Et({perNode:!0});Et.mounted=new Et({perNode:!0});class Mg{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[Et.mounted.id]}}const QG=Object.create(null);class gs{constructor(e,n,r,s=0){this.name=e,this.props=n,this.id=r,this.flags=s}static define(e){let n=e.props&&e.props.length?Object.create(null):QG,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new gs(e.name||"",n,e.id,r);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(s)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Et.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let s of r.split(" "))n[s]=e[r];return r=>{for(let s=r.prop(Et.group),i=-1;i<(s?s.length:0);i++){let l=n[i<0?r.name:s[i]];if(l)return l}}}}gs.none=new gs("",Object.create(null),0,8);class jx{constructor(e){this.types=e;for(let n=0;n0;for(let d=this.cursor(l|Or.IncludeAnonymous);;){let h=!1;if(d.from<=i&&d.to>=s&&(!c&&d.type.isAnonymous||n(d)!==!1)){if(d.firstChild())continue;h=!0}for(;h&&r&&(c||!d.type.isAnonymous)&&r(d),!d.nextSibling();){if(!d.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Pw(gs.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new Dn(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new Dn(gs.none,n,r,s)))}static build(e){return VG(e)}}Dn.empty=new Dn(gs.none,[],[],0);class Rw{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Rw(this.buffer,this.index)}}class go{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return gs.none}toString(){let e=[];for(let n=0;n0));d=l[d+3]);return c}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),l=0;for(let c=e,d=0;c=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function kf(t,e,n,r){for(var s;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?c.length:-1;e!=h;e+=n){let m=c[e],p=d[e]+l.from;if(WM(s,r,p,p+m.length)){if(m instanceof go){if(i&Or.ExcludeBuffers)continue;let x=m.findChild(0,m.buffer.length,n,r-p,s);if(x>-1)return new ha(new $G(l,m,e,p),null,x)}else if(i&Or.IncludeAnonymous||!m.type.isAnonymous||zw(m)){let x;if(!(i&Or.IgnoreMounts)&&(x=Mg.get(m))&&!x.overlay)return new Ps(x.tree,p,e,l);let v=new Ps(m,p,e,l);return i&Or.IncludeAnonymous||!v.type.isAnonymous?v:v.nextChild(n<0?m.children.length-1:0,n,r,s)}}}if(i&Or.IncludeAnonymous||!l.type.isAnonymous||(l.index>=0?e=l.index+n:e=n<0?-1:l._parent._tree.children.length,l=l._parent,!l))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let s;if(!(r&Or.IgnoreOverlays)&&(s=Mg.get(this._tree))&&s.overlay){let i=e-this.from;for(let{from:l,to:c}of s.overlay)if((n>0?l<=i:l=i:c>i))return new Ps(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function e7(t,e,n,r){let s=t.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let l=!1;!l;)if(l=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(e)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function Y2(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class $G{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class ha extends GM{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.context.start,r);return i<0?null:new ha(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&Or.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return i<0?null:new ha(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new ha(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new ha(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let l=r.buffer[this.index+1];e.push(r.slice(s,i,l)),n.push(0)}return new Dn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function XM(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;in.from||l.to=e){let c=new Ps(l.tree,l.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(kf(c,e,n,!1))}}return s?XM(s):r}class K2{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ps)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof Ps?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Or.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Or.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Or.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let i=n+e,l=e<0?-1:r._tree.children.length;i!=l;i+=e){let c=r._tree.children[i];if(this.mode&Or.IncludeAnonymous||c instanceof go||!c.type.isAnonymous||zw(c))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let l=e;l;l=l._parent)if(l.index==s){if(s==this.index)return l;n=l,r=i+1;break e}s=this.stack[--i]}for(let s=r;s=0;i--){if(i<0)return Y2(this._tree,e,s);let l=r[n.buffer[this.stack[i]]];if(!l.isAnonymous){if(e[s]&&e[s]!=l.name)return!1;s--}}return!0}}function zw(t){return t.children.some(e=>e instanceof go||!e.type.isAnonymous||zw(e))}function VG(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=VM,reused:i=[],minRepeatType:l=r.types.length}=t,c=Array.isArray(n)?new Rw(n,n.length):n,d=r.types,h=0,m=0;function p(D,E,z,Q,F,L){let{id:U,start:V,end:ce,size:W}=c,J=m,$=h;if(W<0)if(c.next(),W==-1){let me=i[U];z.push(me),Q.push(V-D);return}else if(W==-3){h=U;return}else if(W==-4){m=U;return}else throw new RangeError(`Unrecognized record size: ${W}`);let ae=d[U],ne,ue,R=V-D;if(ce-V<=s&&(ue=O(c.pos-E,F))){let me=new Uint16Array(ue.size-ue.skip),Y=c.pos-ue.size,P=me.length;for(;c.pos>Y;)P=j(ue.start,me,P);ne=new go(me,ce-ue.start,r),R=ue.start-D}else{let me=c.pos-W;c.next();let Y=[],P=[],K=U>=l?U:-1,H=0,fe=ce;for(;c.pos>me;)K>=0&&c.id==K&&c.size>=0?(c.end<=fe-s&&(b(Y,P,V,H,c.end,fe,K,J,$),H=Y.length,fe=c.end),c.next()):L>2500?x(V,me,Y,P):p(V,me,Y,P,K,L+1);if(K>=0&&H>0&&H-1&&H>0){let ve=v(ae,$);ne=Pw(ae,Y,P,0,Y.length,0,ce-V,ve,ve)}else ne=k(ae,Y,P,ce-V,J-ce,$)}z.push(ne),Q.push(R)}function x(D,E,z,Q){let F=[],L=0,U=-1;for(;c.pos>E;){let{id:V,start:ce,end:W,size:J}=c;if(J>4)c.next();else{if(U>-1&&ce=0;W-=3)V[J++]=F[W],V[J++]=F[W+1]-ce,V[J++]=F[W+2]-ce,V[J++]=J;z.push(new go(V,F[2]-ce,r)),Q.push(ce-D)}}function v(D,E){return(z,Q,F)=>{let L=0,U=z.length-1,V,ce;if(U>=0&&(V=z[U])instanceof Dn){if(!U&&V.type==D&&V.length==F)return V;(ce=V.prop(Et.lookAhead))&&(L=Q[U]+V.length+ce)}return k(D,z,Q,F,L,E)}}function b(D,E,z,Q,F,L,U,V,ce){let W=[],J=[];for(;D.length>Q;)W.push(D.pop()),J.push(E.pop()+z-F);D.push(k(r.types[U],W,J,L-F,V-L,ce)),E.push(F-z)}function k(D,E,z,Q,F,L,U){if(L){let V=[Et.contextHash,L];U=U?[V].concat(U):[V]}if(F>25){let V=[Et.lookAhead,F];U=U?[V].concat(U):[V]}return new Dn(D,E,z,Q,U)}function O(D,E){let z=c.fork(),Q=0,F=0,L=0,U=z.end-s,V={size:0,start:0,skip:0};e:for(let ce=z.pos-D;z.pos>ce;){let W=z.size;if(z.id==E&&W>=0){V.size=Q,V.start=F,V.skip=L,L+=4,Q+=4,z.next();continue}let J=z.pos-W;if(W<0||J=l?4:0,ae=z.start;for(z.next();z.pos>J;){if(z.size<0)if(z.size==-3)$+=4;else break e;else z.id>=l&&($+=4);z.next()}F=ae,Q+=W,L+=$}return(E<0||Q==D)&&(V.size=Q,V.start=F,V.skip=L),V.size>4?V:void 0}function j(D,E,z){let{id:Q,start:F,end:L,size:U}=c;if(c.next(),U>=0&&Q4){let ce=c.pos-(U-4);for(;c.pos>ce;)z=j(D,E,z)}E[--z]=V,E[--z]=L-D,E[--z]=F-D,E[--z]=Q}else U==-3?h=Q:U==-4&&(m=Q);return z}let T=[],A=[];for(;c.pos>0;)p(t.start||0,t.bufferStart||0,T,A,-1,0);let _=(e=t.length)!==null&&e!==void 0?e:T.length?A[0]+T[0].length:0;return new Dn(d[t.topID],T.reverse(),A.reverse(),_)}const t7=new WeakMap;function rg(t,e){if(!t.isAnonymous||e instanceof go||e.type!=t)return 1;let n=t7.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Dn)){n=1;break}n+=rg(t,r)}t7.set(e,n)}return n}function Pw(t,e,n,r,s,i,l,c,d){let h=0;for(let b=r;b=m)break;E+=z}if(A==_+1){if(E>m){let z=b[_];v(z.children,z.positions,0,z.children.length,k[_]+T);continue}p.push(b[_])}else{let z=k[A-1]+b[A-1].length-D;p.push(Pw(t,b,k,_,A,D,z,null,d))}x.push(D+T-i)}}return v(e,n,r,s,0),(c||d)(p,x,l)}class WG{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof ha?this.setBuffer(e.context.buffer,e.index,n):e instanceof Ps&&this.map.set(e.tree,n)}get(e){return e instanceof ha?this.getBuffer(e.context.buffer,e.index):e instanceof Ps?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class pc{constructor(e,n,r,s,i=!1,l=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(l?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let s=[new pc(0,e.length,e,0,!1,r)];for(let i of n)i.to>e.length&&s.push(i);return s}static applyChanges(e,n,r=128){if(!n.length)return e;let s=[],i=1,l=e.length?e[0]:null;for(let c=0,d=0,h=0;;c++){let m=c=r)for(;l&&l.from=x.from||p<=x.to||h){let v=Math.max(x.from,d)-h,b=Math.min(x.to,p)-h;x=v>=b?null:new pc(v,b,x.tree,x.offset+h,c>0,!!m)}if(x&&s.push(x),l.to>p)break;l=inew qy(s.from,s.to)):[new qy(0,0)]:[new qy(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let s=this.startParse(e,n,r);for(;;){let i=s.advance();if(i)return i}}};class GG{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new Et({perNode:!0});let XG=0;class yi{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=XG++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof yi&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new yi(r,[],null,[]);if(s.set.push(s),n)for(let i of n.set)s.set.push(i);return s}static defineModifier(e){let n=new Eg(e);return r=>r.modified.indexOf(n)>-1?r:Eg.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let YG=0;class Eg{constructor(e){this.name=e,this.instances=[],this.id=YG++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(c=>c.base==e&&KG(n,c.modified));if(r)return r;let s=[],i=new yi(e.name,s,e,n);for(let c of n)c.instances.push(i);let l=ZG(n);for(let c of e.set)if(!c.modified.length)for(let d of l)s.push(Eg.get(c,d));return i}}function KG(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function ZG(t){let e=[[]];for(let n=0;nr.length-n.length)}function Lw(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],l=2,c=s;for(let p=0;;){if(c=="..."&&p>0&&p+3==s.length){l=1;break}let x=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(c);if(!x)throw new RangeError("Invalid path: "+s);if(i.push(x[0]=="*"?"":x[0][0]=='"'?JSON.parse(x[0]):x[0]),p+=x[0].length,p==s.length)break;let v=s[p++];if(p==s.length&&v=="!"){l=0;break}if(v!="/")throw new RangeError("Invalid path: "+s);c=s.slice(p)}let d=i.length-1,h=i[d];if(!h)throw new RangeError("Invalid path: "+s);let m=new Of(r,l,d>0?i.slice(0,d):null);e[h]=m.sort(e[h])}}return YM.add(e)}const YM=new Et({combine(t,e){let n,r,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let i=new Of(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class Of{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let l=s;for(let c of i)for(let d of c.set){let h=n[d.id];if(h){l=l?l+" "+h:h;break}}return l},scope:r}}function JG(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function eX(t,e,n,r=0,s=t.length){let i=new tX(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class tX{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,s,i){let{type:l,from:c,to:d}=e;if(c>=r||d<=n)return;l.isTop&&(i=this.highlighters.filter(v=>!v.scope||v.scope(l)));let h=s,m=nX(e)||Of.empty,p=JG(i,m.tags);if(p&&(h&&(h+=" "),h+=p,m.mode==1&&(s+=(s?" ":"")+p)),this.startSpan(Math.max(n,c),h),m.opaque)return;let x=e.tree&&e.tree.prop(Et.mounted);if(x&&x.overlay){let v=e.node.enter(x.overlay[0].from+c,1),b=this.highlighters.filter(O=>!O.scope||O.scope(x.tree.type)),k=e.firstChild();for(let O=0,j=c;;O++){let T=O=A||!e.nextSibling())););if(!T||A>r)break;j=T.to+c,j>n&&(this.highlightRange(v.cursor(),Math.max(n,T.from+c),Math.min(r,j),"",b),this.startSpan(Math.min(r,j),h))}k&&e.parent()}else if(e.firstChild()){x&&(s="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,s,i),this.startSpan(Math.min(r,e.to),h)}while(e.nextSibling());e.parent()}}}function nX(t){let e=t.type.prop(YM);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ie=yi.define,mp=Ie(),eo=Ie(),n7=Ie(eo),r7=Ie(eo),to=Ie(),pp=Ie(to),Fy=Ie(to),sa=Ie(),Zo=Ie(sa),na=Ie(),ra=Ie(),Z2=Ie(),Rh=Ie(Z2),gp=Ie(),he={comment:mp,lineComment:Ie(mp),blockComment:Ie(mp),docComment:Ie(mp),name:eo,variableName:Ie(eo),typeName:n7,tagName:Ie(n7),propertyName:r7,attributeName:Ie(r7),className:Ie(eo),labelName:Ie(eo),namespace:Ie(eo),macroName:Ie(eo),literal:to,string:pp,docString:Ie(pp),character:Ie(pp),attributeValue:Ie(pp),number:Fy,integer:Ie(Fy),float:Ie(Fy),bool:Ie(to),regexp:Ie(to),escape:Ie(to),color:Ie(to),url:Ie(to),keyword:na,self:Ie(na),null:Ie(na),atom:Ie(na),unit:Ie(na),modifier:Ie(na),operatorKeyword:Ie(na),controlKeyword:Ie(na),definitionKeyword:Ie(na),moduleKeyword:Ie(na),operator:ra,derefOperator:Ie(ra),arithmeticOperator:Ie(ra),logicOperator:Ie(ra),bitwiseOperator:Ie(ra),compareOperator:Ie(ra),updateOperator:Ie(ra),definitionOperator:Ie(ra),typeOperator:Ie(ra),controlOperator:Ie(ra),punctuation:Z2,separator:Ie(Z2),bracket:Rh,angleBracket:Ie(Rh),squareBracket:Ie(Rh),paren:Ie(Rh),brace:Ie(Rh),content:sa,heading:Zo,heading1:Ie(Zo),heading2:Ie(Zo),heading3:Ie(Zo),heading4:Ie(Zo),heading5:Ie(Zo),heading6:Ie(Zo),contentSeparator:Ie(sa),list:Ie(sa),quote:Ie(sa),emphasis:Ie(sa),strong:Ie(sa),link:Ie(sa),monospace:Ie(sa),strikethrough:Ie(sa),inserted:Ie(),deleted:Ie(),changed:Ie(),invalid:Ie(),meta:gp,documentMeta:Ie(gp),annotation:Ie(gp),processingInstruction:Ie(gp),definition:yi.defineModifier("definition"),constant:yi.defineModifier("constant"),function:yi.defineModifier("function"),standard:yi.defineModifier("standard"),local:yi.defineModifier("local"),special:yi.defineModifier("special")};for(let t in he){let e=he[t];e instanceof yi&&(e.name=t)}KM([{tag:he.link,class:"tok-link"},{tag:he.heading,class:"tok-heading"},{tag:he.emphasis,class:"tok-emphasis"},{tag:he.strong,class:"tok-strong"},{tag:he.keyword,class:"tok-keyword"},{tag:he.atom,class:"tok-atom"},{tag:he.bool,class:"tok-bool"},{tag:he.url,class:"tok-url"},{tag:he.labelName,class:"tok-labelName"},{tag:he.inserted,class:"tok-inserted"},{tag:he.deleted,class:"tok-deleted"},{tag:he.literal,class:"tok-literal"},{tag:he.string,class:"tok-string"},{tag:he.number,class:"tok-number"},{tag:[he.regexp,he.escape,he.special(he.string)],class:"tok-string2"},{tag:he.variableName,class:"tok-variableName"},{tag:he.local(he.variableName),class:"tok-variableName tok-local"},{tag:he.definition(he.variableName),class:"tok-variableName tok-definition"},{tag:he.special(he.variableName),class:"tok-variableName2"},{tag:he.definition(he.propertyName),class:"tok-propertyName tok-definition"},{tag:he.typeName,class:"tok-typeName"},{tag:he.namespace,class:"tok-namespace"},{tag:he.className,class:"tok-className"},{tag:he.macroName,class:"tok-macroName"},{tag:he.propertyName,class:"tok-propertyName"},{tag:he.operator,class:"tok-operator"},{tag:he.comment,class:"tok-comment"},{tag:he.meta,class:"tok-meta"},{tag:he.invalid,class:"tok-invalid"},{tag:he.punctuation,class:"tok-punctuation"}]);var Qy;const oc=new Et;function ZM(t){return He.define({combine:t?e=>e.concat(t):void 0})}const rX=new Et;class wi{constructor(e,n,r=[],s=""){this.data=e,this.name=s,Vt.prototype.hasOwnProperty("tree")||Object.defineProperty(Vt.prototype,"tree",{get(){return zr(this)}}),this.parser=n,this.extension=[xo.of(this),Vt.languageData.of((i,l,c)=>{let d=s7(i,l,c),h=d.type.prop(oc);if(!h)return[];let m=i.facet(h),p=d.type.prop(rX);if(p){let x=d.resolve(l-d.from,c);for(let v of p)if(v.test(x,i)){let b=i.facet(v.facet);return v.type=="replace"?b:b.concat(m)}}return m})].concat(r)}isActiveAt(e,n,r=-1){return s7(e,n,r).type.prop(oc)==this.data}findRegions(e){let n=e.facet(xo);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,l)=>{if(i.prop(oc)==this.data){r.push({from:l,to:l+i.length});return}let c=i.prop(Et.mounted);if(c){if(c.tree.prop(oc)==this.data){if(c.overlay)for(let d of c.overlay)r.push({from:d.from+l,to:d.to+l});else r.push({from:l,to:l+i.length});return}else if(c.overlay){let d=r.length;if(s(c.tree,c.overlay[0].from+l),r.length>d)return}}for(let d=0;dr.isTop?n:void 0)]}),e.name)}configure(e,n){return new jf(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function zr(t){let e=t.field(wi.state,!1);return e?e.tree:Dn.empty}class sX{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let zh=null;class md{constructor(e,n,r=[],s,i,l,c,d){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=l,this.skipped=c,this.scheduleOn=d,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new md(e,n,[],Dn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new sX(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Dn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(pc.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=zh;zh=this;try{return e()}finally{zh=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=i7(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:l,skipped:c}=this;if(this.takeTree(),!e.empty){let d=[];if(e.iterChangedRanges((h,m,p,x)=>d.push({fromA:h,toA:m,fromB:p,toB:x})),r=pc.applyChanges(r,d),s=Dn.empty,i=0,l={from:e.mapPos(l.from,-1),to:e.mapPos(l.to,1)},this.skipped.length){c=[];for(let h of this.skipped){let m=e.mapPos(h.from,1),p=e.mapPos(h.to,-1);me.from&&(this.fragments=i7(this.fragments,s,i),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends Bw{createParse(n,r,s){let i=s[0].from,l=s[s.length-1].to;return{parsedPos:i,advance(){let d=zh;if(d){for(let h of s)d.tempSkipped.push(h);e&&(d.scheduleOn=d.scheduleOn?Promise.all([d.scheduleOn,e]):e)}return this.parsedPos=l,new Dn(gs.none,[],[],l-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return zh}}function i7(t,e,n){return pc.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class pd{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new pd(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=md.create(e.facet(xo).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new pd(r)}}wi.state=Br.define({create:pd.init,update(t,e){for(let n of e.effects)if(n.is(wi.setState))return n.value;return e.startState.facet(xo)!=e.state.facet(xo)?pd.init(e.state):t.apply(e)}});let JM=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(JM=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const $y=typeof navigator<"u"&&(!((Qy=navigator.scheduling)===null||Qy===void 0)&&Qy.isInputPending)?()=>navigator.scheduling.isInputPending():null,iX=lr.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(wi.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(wi.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=JM(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnds+1e3,d=i.context.work(()=>$y&&$y()||Date.now()>l,s+(c?0:1e5));this.chunkBudget-=Date.now()-n,(d||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:wi.setState.of(new pd(i.context))})),this.chunkBudget>0&&!(d&&!c)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>_s(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),xo=He.define({combine(t){return t.length?t[0]:null},enables:t=>[wi.state,iX,qe.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class eE{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const aX=He.define(),u0=He.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function kc(t){let e=t.facet(u0);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Nf(t,e){let n="",r=t.tabSize,s=t.facet(u0)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i=e?lX(t,n,e):null}class Nx{constructor(e,n={}){this.state=e,this.options=n,this.unit=kc(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==e?{text:"",from:e}:(n<0?s-1&&(i+=l-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return Td(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let l=i(s);if(l>-1)return l}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Cx=new Et;function lX(t,e,n){let r=e.resolveStack(n),s=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let l=s;l&&!(l.fromr.node.to||l.from==r.node.from&&l.type==r.node.type);l=l.parent)i.push(l);for(let l=i.length-1;l>=0;l--)r={node:i[l],next:r}}return tE(r,t,n)}function tE(t,e,n){for(let r=t;r;r=r.next){let s=cX(r.node);if(s)return s(qw.create(e,n,r))}return 0}function oX(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function cX(t){let e=t.type.prop(Cx);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Et.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return l=>nE(l,!0,1,void 0,i&&!oX(l)?s.from:void 0)}return t.parent==null?uX:null}function uX(){return 0}class qw extends Nx{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new qw(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(dX(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return tE(this.context.next,this.base,this.pos)}}function dX(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function hX(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let s=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),l=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let c=n.to;;){let d=e.childAfter(c);if(!d||d==r)return null;if(!d.type.isSkipped){if(d.from>=l)return null;let h=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+h}}c=d.to}}function Hy({closing:t,align:e=!0,units:n=1}){return r=>nE(r,e,n,t)}function nE(t,e,n,r,s){let i=t.textAfter,l=i.match(/^\s*/)[0].length,c=r&&i.slice(l,l+r.length)==r||s==t.pos+l,d=e?hX(t):null;return d?c?t.column(d.from):t.column(d.to):t.baseIndent+(c?0:t.unit*n)}function a7({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const fX=200;function mX(){return Vt.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,s=n.lineAt(r);if(r>s.from+fX)return t;let i=n.sliceString(s.from,r);if(!e.some(h=>h.test(i)))return t;let{state:l}=t,c=-1,d=[];for(let{head:h}of l.selection.ranges){let m=l.doc.lineAt(h);if(m.from==c)continue;c=m.from;let p=Iw(l,m.from);if(p==null)continue;let x=/^\s*/.exec(m.text)[0],v=Nf(l,p);x!=v&&d.push({from:m.from,to:m.from+x.length,insert:v})}return d.length?[t,{changes:d,sequential:!0}]:t})}const pX=He.define(),Fw=new Et;function rE(t){let e=t.firstChild,n=t.lastChild;return e&&e.ton)continue;if(i&&c.from=e&&h.to>n&&(i=h)}}return i}function xX(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function _g(t,e,n){for(let r of t.facet(pX)){let s=r(t,e,n);if(s)return s}return gX(t,e,n)}function sE(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const Tx=vt.define({map:sE}),d0=vt.define({map:sE});function iE(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const Oc=Br.define({create(){return Je.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=l7(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(Tx)&&!vX(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(oE),s=r?Je.replace({widget:new jX(r(e.state,n.value))}):o7;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(d0)&&(t=t.update({filter:(r,s)=>n.value.from!=r||n.value.to!=s,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=l7(t,e.selection.main.head)),t},provide:t=>qe.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,s)=>{n.push(r,s)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n{se&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(s,i)=>s>=n||i<=e}):t}function Dg(t,e,n){var r;let s=null;return(r=t.field(Oc,!1))===null||r===void 0||r.between(e,n,(i,l)=>{(!s||s.from>i)&&(s={from:i,to:l})}),s}function vX(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function aE(t,e){return t.field(Oc,!1)?e:e.concat(vt.appendConfig.of(cE()))}const yX=t=>{for(let e of iE(t)){let n=_g(t.state,e.from,e.to);if(n)return t.dispatch({effects:aE(t.state,[Tx.of(n),lE(t,n)])}),!0}return!1},bX=t=>{if(!t.state.field(Oc,!1))return!1;let e=[];for(let n of iE(t)){let r=Dg(t.state,n.from,n.to);r&&e.push(d0.of(r),lE(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function lE(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return qe.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const wX=t=>{let{state:e}=t,n=[];for(let r=0;r{let e=t.state.field(Oc,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(d0.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},kX=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:yX},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:bX},{key:"Ctrl-Alt-[",run:wX},{key:"Ctrl-Alt-]",run:SX}],OX={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},oE=He.define({combine(t){return Oa(t,OX)}});function cE(t){return[Oc,TX]}function uE(t,e){let{state:n}=t,r=n.facet(oE),s=l=>{let c=t.lineBlockAt(t.posAtDOM(l.target)),d=Dg(t.state,c.from,c.to);d&&t.dispatch({effects:d0.of(d)}),l.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,s,e);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const o7=Je.replace({widget:new class extends ja{toDOM(t){return uE(t,null)}}});class jX extends ja{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return uE(e,this.value)}}const NX={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Uy extends gl{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function CX(t={}){let e={...NX,...t},n=new Uy(e,!0),r=new Uy(e,!1),s=lr.fromClass(class{constructor(l){this.from=l.viewport.from,this.markers=this.buildMarkers(l)}update(l){(l.docChanged||l.viewportChanged||l.startState.facet(xo)!=l.state.facet(xo)||l.startState.field(Oc,!1)!=l.state.field(Oc,!1)||zr(l.startState)!=zr(l.state)||e.foldingChanged(l))&&(this.markers=this.buildMarkers(l.view))}buildMarkers(l){let c=new ml;for(let d of l.viewportLineBlocks){let h=Dg(l.state,d.from,d.to)?r:_g(l.state,d.from,d.to)?n:null;h&&c.add(d.from,d.from,h)}return c.finish()}}),{domEventHandlers:i}=e;return[s,MG({class:"cm-foldGutter",markers(l){var c;return((c=l.plugin(s))===null||c===void 0?void 0:c.markers)||Yt.empty},initialSpacer(){return new Uy(e,!1)},domEventHandlers:{...i,click:(l,c,d)=>{if(i.click&&i.click(l,c,d))return!0;let h=Dg(l.state,c.from,c.to);if(h)return l.dispatch({effects:d0.of(h)}),!0;let m=_g(l.state,c.from,c.to);return m?(l.dispatch({effects:Tx.of(m)}),!0):!1}}}),cE()]}const TX=qe.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class h0{constructor(e,n){this.specs=e;let r;function s(c){let d=fo.newName();return(r||(r=Object.create(null)))["."+d]=c,d}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,l=n.scope;this.scope=l instanceof wi?c=>c.prop(oc)==l.data:l?c=>c==l:void 0,this.style=KM(e.map(c=>({tag:c.tag,class:c.class||s(Object.assign({},c,{tag:null}))})),{all:i}).style,this.module=r?new fo(r):null,this.themeType=n.themeType}static define(e,n){return new h0(e,n||{})}}const J2=He.define(),dE=He.define({combine(t){return t.length?[t[0]]:null}});function Vy(t){let e=t.facet(J2);return e.length?e:t.facet(dE)}function hE(t,e){let n=[MX],r;return t instanceof h0&&(t.module&&n.push(qe.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(dE.of(t)):r?n.push(J2.computeN([qe.darkTheme],s=>s.facet(qe.darkTheme)==(r=="dark")?[t]:[])):n.push(J2.of(t)),n}class AX{constructor(e){this.markCache=Object.create(null),this.tree=zr(e.state),this.decorations=this.buildDeco(e,Vy(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=zr(e.state),r=Vy(e.state),s=r!=Vy(e.startState),{viewport:i}=e.view,l=e.changes.mapPos(this.decoratedTo,1);n.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=l):(n!=this.tree||e.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return Je.none;let r=new ml;for(let{from:s,to:i}of e.visibleRanges)eX(this.tree,n,(l,c,d)=>{r.add(l,c,this.markCache[d]||(this.markCache[d]=Je.mark({class:d})))},s,i);return r.finish()}}const MX=No.high(lr.fromClass(AX,{decorations:t=>t.decorations})),EX=h0.define([{tag:he.meta,color:"#404740"},{tag:he.link,textDecoration:"underline"},{tag:he.heading,textDecoration:"underline",fontWeight:"bold"},{tag:he.emphasis,fontStyle:"italic"},{tag:he.strong,fontWeight:"bold"},{tag:he.strikethrough,textDecoration:"line-through"},{tag:he.keyword,color:"#708"},{tag:[he.atom,he.bool,he.url,he.contentSeparator,he.labelName],color:"#219"},{tag:[he.literal,he.inserted],color:"#164"},{tag:[he.string,he.deleted],color:"#a11"},{tag:[he.regexp,he.escape,he.special(he.string)],color:"#e40"},{tag:he.definition(he.variableName),color:"#00f"},{tag:he.local(he.variableName),color:"#30a"},{tag:[he.typeName,he.namespace],color:"#085"},{tag:he.className,color:"#167"},{tag:[he.special(he.variableName),he.macroName],color:"#256"},{tag:he.definition(he.propertyName),color:"#00c"},{tag:he.comment,color:"#940"},{tag:he.invalid,color:"#f00"}]),_X=qe.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),fE=1e4,mE="()[]{}",pE=He.define({combine(t){return Oa(t,{afterCursor:!0,brackets:mE,maxScanDistance:fE,renderMatch:zX})}}),DX=Je.mark({class:"cm-matchingBracket"}),RX=Je.mark({class:"cm-nonmatchingBracket"});function zX(t){let e=[],n=t.matched?DX:RX;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const PX=Br.define({create(){return Je.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(pE);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=fa(e.state,s.head,-1,r)||s.head>0&&fa(e.state,s.head-1,1,r)||r.afterCursor&&(fa(e.state,s.head,1,r)||s.headqe.decorations.from(t)}),BX=[PX,_X];function LX(t={}){return[pE.of(t),BX]}const IX=new Et;function e4(t,e,n){let r=t.prop(e<0?Et.openedBy:Et.closedBy);if(r)return r;if(t.name.length==1){let s=n.indexOf(t.name);if(s>-1&&s%2==(e<0?1:0))return[n[s+e]]}return null}function t4(t){let e=t.type.prop(IX);return e?e(t.node):t}function fa(t,e,n,r={}){let s=r.maxScanDistance||fE,i=r.brackets||mE,l=zr(t),c=l.resolveInner(e,n);for(let d=c;d;d=d.parent){let h=e4(d.type,n,i);if(h&&d.from0?e>=m.from&&em.from&&e<=m.to))return qX(t,e,n,d,m,h,i)}}return FX(t,e,n,l,c.type,s,i)}function qX(t,e,n,r,s,i,l){let c=r.parent,d={from:s.from,to:s.to},h=0,m=c?.cursor();if(m&&(n<0?m.childBefore(r.from):m.childAfter(r.to)))do if(n<0?m.to<=r.from:m.from>=r.to){if(h==0&&i.indexOf(m.type.name)>-1&&m.from0)return null;let h={from:n<0?e-1:e,to:n>0?e+1:e},m=t.doc.iterRange(e,n>0?t.doc.length:0),p=0;for(let x=0;!m.next().done&&x<=i;){let v=m.value;n<0&&(x+=v.length);let b=e+x*n;for(let k=n>0?0:v.length-1,O=n>0?v.length:-1;k!=O;k+=n){let j=l.indexOf(v[k]);if(!(j<0||r.resolveInner(b+k,1).type!=s))if(j%2==0==n>0)p++;else{if(p==1)return{start:h,end:{from:b+k,to:b+k+1},matched:j>>1==d>>1};p--}}n>0&&(x+=v.length)}return m.done?{start:h,matched:!1}:null}function c7(t,e,n,r=0,s=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let i=s;for(let l=r;l=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosr?l.toLowerCase():l,i=this.string.substr(this.pos,e.length);return s(i)==s(e)?(n!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&n!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function QX(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||$X,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||Hw,mergeTokens:t.mergeTokens!==!1}}function $X(t){if(typeof t!="object")return t;let e={};for(let n in t){let r=t[n];e[n]=r instanceof Array?r.slice():r}return e}const u7=new WeakMap;class Qw extends wi{constructor(e){let n=ZM(e.languageData),r=QX(e),s,i=new class extends Bw{createParse(l,c,d){return new UX(s,l,c,d)}};super(n,i,[],e.name),this.topNode=GX(n,this),s=this,this.streamParser=r,this.stateAfter=new Et({perNode:!0}),this.tokenTable=e.tokenTable?new bE(r.tokenTable):WX}static define(e){return new Qw(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=u7.get(e.state),n!=null&&n1e4)return null;for(;i=r&&n+e.length<=s&&e.prop(t.stateAfter);if(i)return{state:t.streamParser.copyState(i),pos:n+e.length};for(let l=e.children.length-1;l>=0;l--){let c=e.children[l],d=n+e.positions[l],h=c instanceof Dn&&d=e.length)return e;!s&&n==0&&e.type==t.topNode&&(s=!0);for(let i=e.children.length-1;i>=0;i--){let l=e.positions[i],c=e.children[i],d;if(ln&&$w(t,i.tree,0-i.offset,n,c),h;if(d&&d.pos<=r&&(h=xE(t,i.tree,n+i.offset,d.pos+i.offset,!1)))return{state:d.state,tree:h}}return{state:t.streamParser.startState(s?kc(s):4),tree:Dn.empty}}let UX=class{constructor(e,n,r,s){this.lang=e,this.input=n,this.fragments=r,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let i=md.get(),l=s[0].from,{state:c,tree:d}=HX(e,r,l,this.to,i?.state);this.state=c,this.parsedPos=this.chunkStart=l+d.length;for(let h=0;hh.from<=i.viewport.from&&h.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(kc(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=md.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos=n?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let n=this.input.chunk(e);if(this.input.lineChunks)n==` +`;this.styleTag.textContent=l;let c=n.head||n;this.styleTag.parentNode!=c&&c.insertBefore(this.styleTag,c.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var fo={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},xf={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},aV=typeof navigator<"u"&&/Mac/.test(navigator.platform),lV=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Hr=0;Hr<10;Hr++)fo[48+Hr]=fo[96+Hr]=String(Hr);for(var Hr=1;Hr<=24;Hr++)fo[Hr+111]="F"+Hr;for(var Hr=65;Hr<=90;Hr++)fo[Hr]=String.fromCharCode(Hr+32),xf[Hr]=String.fromCharCode(Hr);for(var My in fo)xf.hasOwnProperty(My)||(xf[My]=fo[My]);function oV(t){var e=aV&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||lV&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?xf:fo)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function An(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var s=n[r];typeof s=="string"?t.setAttribute(r,s):s!=null&&(t[r]=s)}e++}for(;e2);var Fe={mac:oj||/Mac/.test(us.platform),windows:/Win/.test(us.platform),linux:/Linux|X11/.test(us.platform),ie:Sx,ie_version:LM?T2.documentMode||6:A2?+A2[1]:M2?+M2[1]:0,gecko:lj,gecko_version:lj?+(/Firefox\/(\d+)/.exec(us.userAgent)||[0,0])[1]:0,chrome:!!Ay,chrome_version:Ay?+Ay[1]:0,ios:oj,android:/Android\b/.test(us.userAgent),webkit_version:cV?+(/\bAppleWebKit\/(\d+)/.exec(us.userAgent)||[0,0])[1]:0,safari:E2,safari_version:E2?+(/\bVersion\/(\d+(\.\d+)?)/.exec(us.userAgent)||[0,0])[1]:0,tabSize:T2.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function vf(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function _2(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Kp(t,e){if(!e.anchorNode)return!1;try{return _2(t,e.anchorNode)}catch{return!1}}function ud(t){return t.nodeType==3?wc(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function ef(t,e,n,r){return n?cj(t,e,n,r,-1)||cj(t,e,n,r,1):!1}function bc(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Og(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function cj(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:ya(t))){if(t.nodeName=="DIV")return!1;let i=t.parentNode;if(!i||i.nodeType!=1)return!1;e=bc(t)+(s<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=s<0?ya(t):0}else return!1}}function ya(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function s0(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function uV(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function IM(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function dV(t,e,n,r,s,i,l,c){let d=t.ownerDocument,h=d.defaultView||window;for(let m=t,p=!1;m&&!p;)if(m.nodeType==1){let x,v=m==d.body,b=1,k=1;if(v)x=uV(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(m).position)&&(p=!0),m.scrollHeight<=m.clientHeight&&m.scrollWidth<=m.clientWidth){m=m.assignedSlot||m.parentNode;continue}let T=m.getBoundingClientRect();({scaleX:b,scaleY:k}=IM(m,T)),x={left:T.left,right:T.left+m.clientWidth*b,top:T.top,bottom:T.top+m.clientHeight*k}}let O=0,j=0;if(s=="nearest")e.top0&&e.bottom>x.bottom+j&&(j=e.bottom-x.bottom+l)):e.bottom>x.bottom&&(j=e.bottom-x.bottom+l,n<0&&e.top-j0&&e.right>x.right+O&&(O=e.right-x.right+i)):e.right>x.right&&(O=e.right-x.right+i,n<0&&e.leftx.bottom||e.leftx.right)&&(e={left:Math.max(e.left,x.left),right:Math.min(e.right,x.right),top:Math.max(e.top,x.top),bottom:Math.min(e.bottom,x.bottom)}),m=m.assignedSlot||m.parentNode}else if(m.nodeType==11)m=m.host;else break}function hV(t){let e=t.ownerDocument,n,r;for(let s=t.parentNode;s&&!(s==e.body||n&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),!n&&s.scrollWidth>s.clientWidth&&(n=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:n,y:r}}class fV{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?ya(n):0),r,Math.min(e.focusOffset,r?ya(r):0))}set(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let tc=null;Fe.safari&&Fe.safari_version>=26&&(tc=!1);function qM(t){if(t.setActive)return t.setActive();if(tc)return t.focus(tc);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(tc==null?{get preventScroll(){return tc={preventScroll:!0},!0}}:void 0),!tc){tc=!1;for(let n=0;nMath.max(1,t.scrollHeight-t.clientHeight-4)}function $M(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=ya(n)}else if(n.parentNode&&!Og(n))r=bc(n),n=n.parentNode;else return null}}function HM(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&rn)return p.domBoundsAround(e,n,h);if(x>=e&&s==-1&&(s=d,i=h),h>n&&p.dom.parentNode==this.dom){l=d,c=m;break}m=x,h=x+p.breakAfter}return{from:i,to:c<0?r+this.length:c,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:l=0?this.children[l].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,r=kw){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}}function VM(t,e,n,r,s,i,l,c,d){let{children:h}=t,m=h.length?h[e]:null,p=i.length?i[i.length-1]:null,x=p?p.breakAfter:l;if(!(e==r&&m&&!l&&!x&&i.length<2&&m.merge(n,s,i.length?p:null,n==0,c,d))){if(r0&&(!l&&i.length&&m.merge(n,m.length,i[0],!1,c,0)?m.breakAfter=i.shift().breakAfter:(ngV||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new Qi(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new ns(this.dom,e)}domBoundsAround(e,n,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return xV(this.dom,e,n)}}class ml extends jn{constructor(e,n=[],r=0){super(),this.mark=e,this.children=n,this.length=r;for(let s of n)s.setParent(this)}setAttrs(e){if(FM(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,r,s,i,l){return r&&(!(r instanceof ml&&r.mark.eq(this.mark))||e&&i<=0||ne&&n.push(r=e&&(s=i),r=d,i++}let l=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new ml(this.mark,n,l)}domAtPos(e){return GM(this,e)}coordsAt(e,n){return YM(this,e,n)}}function xV(t,e,n){let r=t.nodeValue.length;e>r&&(e=r);let s=e,i=e,l=0;e==0&&n<0||e==r&&n>=0?Fe.chrome||Fe.gecko||(e?(s--,l=1):i=0)?0:c.length-1];return Fe.safari&&!l&&d.width==0&&(d=Array.prototype.find.call(c,h=>h.width)||d),l?s0(d,l<0):d||null}class il extends jn{static create(e,n,r){return new il(e,n,r)}constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}split(e){let n=il.create(this.widget,this.length-e,this.side);return this.length-=e,n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,n,r,s,i,l){return r&&(!(r instanceof il)||!this.widget.compare(r.widget)||e>0&&i<=0||n0)?ns.before(this.dom):ns.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);if(r)return r;let s=this.dom.getClientRects(),i=null;if(!s.length)return null;let l=this.side?this.side<0:e>0;for(let c=l?s.length-1:0;i=s[c],!(e>0?c==0:c==s.length-1||i.top0?ns.before(this.dom):ns.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Wt.empty}get isHidden(){return!0}}Qi.prototype.children=il.prototype.children=dd.prototype.children=kw;function GM(t,e){let n=t.dom,{children:r}=t,s=0;for(let i=0;si&&e0;i--){let l=r[i-1];if(l.dom.parentNode==n)return l.domAtPos(l.length)}for(let i=s;i0&&e instanceof ml&&s.length&&(r=s[s.length-1])instanceof ml&&r.mark.eq(e.mark)?XM(r,e.children[0],n-1):(s.push(e),e.setParent(t)),t.length+=e.length}function YM(t,e,n){let r=null,s=-1,i=null,l=-1;function c(h,m){for(let p=0,x=0;p=m&&(v.children.length?c(v,m-x):(!i||i.isHidden&&(n>0||yV(i,v)))&&(b>m||x==b&&v.getSide()>0)?(i=v,l=m-x):(x-1?1:0)!=s.length-(n&&s.indexOf(n)>-1?1:0))return!1;for(let i of r)if(i!=n&&(s.indexOf(i)==-1||t[i]!==e[i]))return!1;return!0}function R2(t,e,n){let r=!1;if(e)for(let s in e)n&&s in n||(r=!0,s=="style"?t.style.cssText="":t.removeAttribute(s));if(n)for(let s in n)e&&e[s]==n[s]||(r=!0,s=="style"?t.style.cssText=n[s]:t.setAttribute(s,n[s]));return r}function bV(t){let e=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new mo(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,s;if(e.isBlockGap)r=-5e8,s=4e8;else{let{start:i,end:l}=KM(e,n);r=(i?n?-3e8:-1:5e8)-1,s=(l?n?2e8:1:-6e8)+1}return new mo(e,r,s,n,e.widget||null,!0)}static line(e){return new a0(e)}static set(e,n=!1){return Gt.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Je.none=Gt.empty;class i0 extends Je{constructor(e){let{start:n,end:r}=KM(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var n,r;return this==e||e instanceof i0&&this.tagName==e.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&jg(this.attrs,e.attrs,"class")}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}i0.prototype.point=!1;class a0 extends Je{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof a0&&this.spec.class==e.spec.class&&jg(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}a0.prototype.mapMode=Ur.TrackBefore;a0.prototype.point=!0;class mo extends Je{constructor(e,n,r,s,i,l){super(n,r,i,e),this.block=s,this.isReplace=l,this.mapMode=s?n<=0?Ur.TrackBefore:Ur.TrackAfter:Ur.TrackDel}get type(){return this.startSide!=this.endSide?fs.WidgetRange:this.startSide<=0?fs.WidgetBefore:fs.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof mo&&wV(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}mo.prototype.point=!0;function KM(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function wV(t,e){return t==e||!!(t&&e&&t.compare(e))}function Zp(t,e,n,r=0){let s=n.length-1;s>=0&&n[s]+r>=t?n[s]=Math.max(n[s],e):n.push(t,e)}class pr extends jn{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,r,s,i,l){if(r){if(!(r instanceof pr))return!1;this.dom||r.transferDOM(this)}return s&&this.setDeco(r?r.attrs:null),WM(this,e,n,r?r.children.slice():[],i,l),!0}split(e){let n=new pr;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i:r,off:s}=this.childPos(e);s&&(n.append(this.children[r].split(s),0),this.children[r].merge(s,this.children[r].length,null,!1,0,0),r++);for(let i=r;i0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,n}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){jg(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){XM(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=D2(n,this.attrs||{})),r&&(this.attrs=D2({class:r},this.attrs||{}))}domAtPos(e){return GM(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(FM(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(R2(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,n);let s=this.dom.lastChild;for(;s&&jn.get(s)instanceof ml;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((r=jn.get(s))===null||r===void 0?void 0:r.isEditable)==!1&&(!Fe.ios||!this.children.some(i=>i instanceof Qi))){let i=document.createElement("BR");i.cmIgnore=!0,this.dom.appendChild(i)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,n;for(let r of this.children){if(!(r instanceof Qi)||/[^ -~]/.test(r.text))return null;let s=ud(r.dom);if(s.length!=1)return null;e+=s[0].width,n=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:n}:null}coordsAt(e,n){let r=YM(this,e,n);if(!this.children.length&&r&&this.parent){let{heightOracle:s}=this.parent.view.viewState,i=r.bottom-r.top;if(Math.abs(i-s.lineHeight)<2&&s.textHeight=n){if(i instanceof pr)return i;if(l>n)break}s=l+i.breakAfter}return null}}class ol extends jn{constructor(e,n,r){super(),this.widget=e,this.length=n,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,n,r,s,i,l){return r&&(!(r instanceof ol)||!this.widget.compare(r.widget)||e>0&&i<=0||n0}}class z2 extends Oa{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class tf{constructor(e,n,r,s){this.doc=e,this.pos=n,this.end=r,this.disallowBlockEffectsFor=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=n}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof ol&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new pr),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(tp(new dd(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof ol)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:l,lineBreak:c,done:d}=this.cursor.next(this.skip);if(this.skip=0,d)throw new Error("Ran out of text content when drawing inline views");if(c){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=l,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e),i=Math.min(s,512);this.flushBuffer(n.slice(n.length-r)),this.getLine().append(tp(new Qi(this.text.slice(this.textOff,this.textOff+i)),n),r),this.atCursorPos=!0,this.textOff+=i,e-=i,r=s<=i?0:n.length}}span(e,n,r,s){this.buildText(n-e,r,s),this.pos=n,this.openStart<0&&(this.openStart=s)}point(e,n,r,s,i,l){if(this.disallowBlockEffectsFor[l]&&r instanceof mo){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let c=n-e;if(r instanceof mo)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ol(r.widget||hd.block,c,r));else{let d=il.create(r.widget||hd.inline,c,c?0:r.startSide),h=this.atCursorPos&&!d.isEditable&&i<=s.length&&(e0),m=!d.isEditable&&(es.length||r.startSide<=0),p=this.getLine();this.pendingBuffer==2&&!h&&!d.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),h&&(p.append(tp(new dd(1),s),i),i=s.length+Math.max(0,i-s.length)),p.append(tp(d,s),i),this.atCursorPos=m,this.pendingBuffer=m?es.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);c&&(this.textOff+c<=this.text.length?this.textOff+=c:(this.skip+=c-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=i)}static build(e,n,r,s,i){let l=new tf(e,n,r,i);return l.openEnd=Gt.spans(s,n,r,l),l.openStart<0&&(l.openStart=l.openEnd),l.finish(l.openEnd),l}}function tp(t,e){for(let n of e)t=new ml(n,[t],t.length);return t}class hd extends Oa{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}hd.inline=new hd("span");hd.block=new hd("div");var Hn=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(Hn||(Hn={}));const Sc=Hn.LTR,Ow=Hn.RTL;function ZM(t){let e=[];for(let n=0;n=n){if(c.level==r)return l;(i<0||(s!=0?s<0?c.fromn:e[i].level>c.level))&&(i=l)}}if(i<0)throw new RangeError("Index out of range");return i}}function eA(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;k-=3)if(Ji[k+1]==-v){let O=Ji[k+2],j=O&2?s:O&4?O&1?i:s:0;j&&(En[p]=En[Ji[k]]=j),c=k;break}}else{if(Ji.length==189)break;Ji[c++]=p,Ji[c++]=x,Ji[c++]=d}else if((b=En[p])==2||b==1){let k=b==s;d=k?0:1;for(let O=c-3;O>=0;O-=3){let j=Ji[O+2];if(j&2)break;if(k)Ji[O+2]|=2;else{if(j&4)break;Ji[O+2]|=4}}}}}function CV(t,e,n,r){for(let s=0,i=r;s<=n.length;s++){let l=s?n[s-1].to:t,c=sd;)b==O&&(b=n[--k].from,O=k?n[k-1].to:t),En[--b]=v;d=m}else i=h,d++}}}function B2(t,e,n,r,s,i,l){let c=r%2?2:1;if(r%2==s%2)for(let d=e,h=0;dd&&l.push(new ro(d,k.from,v));let O=k.direction==Sc!=!(v%2);L2(t,O?r+1:r,s,k.inner,k.from,k.to,l),d=k.to}b=k.to}else{if(b==n||(m?En[b]!=c:En[b]==c))break;b++}x?B2(t,d,b,r+1,s,x,l):de;){let m=!0,p=!1;if(!h||d>i[h-1].to){let k=En[d-1];k!=c&&(m=!1,p=k==16)}let x=!m&&c==1?[]:null,v=m?r:r+1,b=d;e:for(;;)if(h&&b==i[h-1].to){if(p)break e;let k=i[--h];if(!m)for(let O=k.from,j=h;;){if(O==e)break e;if(j&&i[j-1].to==O)O=i[--j].from;else{if(En[O-1]==c)break e;break}}if(x)x.push(k);else{k.toEn.length;)En[En.length]=256;let r=[],s=e==Sc?0:1;return L2(t,s,s,n,0,t.length,r),r}function tA(t){return[new ro(0,t,0)]}let nA="";function MV(t,e,n,r,s){var i;let l=r.head-t.from,c=ro.find(e,l,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),d=e[c],h=d.side(s,n);if(l==h){let x=c+=s?1:-1;if(x<0||x>=e.length)return null;d=e[c=x],l=d.side(!s,n),h=d.side(s,n)}let m=Vr(t.text,l,d.forward(s,n));(md.to)&&(m=h),nA=t.text.slice(Math.min(l,m),Math.max(l,m));let p=c==(s?e.length-1:0)?null:e[c+(s?1:-1)];return p&&m==h&&p.level+(s?0:1)t.some(e=>e)}),uA=He.define({combine:t=>t.some(e=>e)}),dA=He.define();class Xu{constructor(e,n="nearest",r="nearest",s=5,i=5,l=!1){this.range=e,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=l}map(e){return e.empty?this:new Xu(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Xu(Ce.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const np=xt.define({map:(t,e)=>t.map(e)}),hA=xt.define();function Es(t,e,n){let r=t.facet(aA);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const sl=He.define({combine:t=>t.length?t[0]:!0});let EV=0;const Fu=He.define({combine(t){return t.filter((e,n)=>{for(let r=0;r{let d=[];return l&&d.push(yf.of(h=>{let m=h.plugin(c);return m?l(m):Je.none})),i&&d.push(i(c)),d})}static fromClass(e,n){return lr.define((r,s)=>new e(r,s),n)}}class Ey{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(Es(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(n){Es(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){Es(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const fA=He.define(),Cw=He.define(),yf=He.define(),mA=He.define(),l0=He.define(),pA=He.define();function fj(t,e){let n=t.state.facet(pA);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(t):i),s=[];return Gt.spans(r,e.from,e.to,{point(){},span(i,l,c,d){let h=i-e.from,m=l-e.from,p=s;for(let x=c.length-1;x>=0;x--,d--){let v=c[x].spec.bidiIsolate,b;if(v==null&&(v=AV(e.text,h,m)),d>0&&p.length&&(b=p[p.length-1]).to==h&&b.direction==v)b.to=m,p=b.inner;else{let k={from:h,to:m,direction:v,inner:[]};p.push(k),p=k.inner}}}}),s}const gA=He.define();function Tw(t){let e=0,n=0,r=0,s=0;for(let i of t.state.facet(gA)){let l=i(t);l&&(l.left!=null&&(e=Math.max(e,l.left)),l.right!=null&&(n=Math.max(n,l.right)),l.top!=null&&(r=Math.max(r,l.top)),l.bottom!=null&&(s=Math.max(s,l.bottom)))}return{left:e,right:n,top:r,bottom:s}}const Qh=He.define();class ji{constructor(e,n,r,s){this.fromA=e,this.toA=n,this.fromB=r,this.toB=s}join(e){return new ji(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let s=e[n-1];if(!(s.fromA>r.toA)){if(s.toAm)break;i+=2}if(!d)return r;new ji(d.fromA,d.toA,d.fromB,d.toB).addToSet(r),l=d.toA,c=d.toB}}}class Ng{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=kr.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,l,c,d)=>s.push(new ji(i,l,c,d))),this.changedRanges=s}static create(e,n,r){return new Ng(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class mj extends jn{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=Je.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new pr],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new ji(0,0,0,e.state.doc.length)],0,null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:h,toA:m})=>mthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?s=this.domChanged.newSel.head:!LV(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let i=s>-1?DV(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:m}=this.hasComposition;r=new ji(h,m,e.changes.mapPos(h,-1),e.changes.mapPos(m,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(Fe.ie||Fe.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let l=this.decorations,c=this.updateDeco(),d=PV(l,c,e.changes);return r=ji.extendWithRanges(r,d),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,r);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let l=Fe.chrome||Fe.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,l),this.flags&=-8,l&&(l.written||s.selectionRange.focusNode!=l.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(l=>l.flags&=-9);let i=[];if(this.view.viewport.from||this.view.viewport.to=0?s[l]:null;if(!c)break;let{fromA:d,toA:h,fromB:m,toB:p}=c,x,v,b,k;if(r&&r.range.fromBm){let _=tf.build(this.view.state.doc,m,r.range.fromB,this.decorations,this.dynamicDecorationMap),D=tf.build(this.view.state.doc,r.range.toB,p,this.decorations,this.dynamicDecorationMap);v=_.breakAtStart,b=_.openStart,k=D.openEnd;let E=this.compositionView(r);D.breakAtStart?E.breakAfter=1:D.content.length&&E.merge(E.length,E.length,D.content[0],!1,D.openStart,0)&&(E.breakAfter=D.content[0].breakAfter,D.content.shift()),_.content.length&&E.merge(0,0,_.content[_.content.length-1],!0,0,_.openEnd)&&_.content.pop(),x=_.content.concat(E).concat(D.content)}else({content:x,breakAtStart:v,openStart:b,openEnd:k}=tf.build(this.view.state.doc,m,p,this.decorations,this.dynamicDecorationMap));let{i:O,off:j}=i.findPos(h,1),{i:T,off:M}=i.findPos(d,-1);VM(this,T,M,O,j,x,v,b,k)}r&&this.fixCompositionDOM(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(hA)&&(this.editContextFormatting=r.value)}compositionView(e){let n=new Qi(e.text.nodeValue);n.flags|=8;for(let{deco:s}of e.marks)n=new ml(s,[n],n.length);let r=new pr;return r.append(n,0),r}fixCompositionDOM(e){let n=(i,l)=>{l.flags|=8|(l.children.some(d=>d.flags&7)?1:0),this.markedForComposition.add(l);let c=jn.get(i);c&&c!=l&&(c.dom=null),l.setDOM(i)},r=this.childPos(e.range.fromB,1),s=this.children[r.i];n(e.line,s);for(let i=e.marks.length-1;i>=-1;i--)r=s.childPos(r.off,1),s=s.children[r.i],n(i>=0?e.marks[i].node:e.text,s)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,s=r==this.dom,i=!s&&!(this.view.state.facet(sl)||this.dom.tabIndex>-1)&&Kp(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(s||n||i))return;let l=this.forceSelection;this.forceSelection=!1;let c=this.view.state.selection.main,d=this.moveToLine(this.domAtPos(c.anchor)),h=c.empty?d:this.moveToLine(this.domAtPos(c.head));if(Fe.gecko&&c.empty&&!this.hasComposition&&_V(d)){let p=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(p,d.node.childNodes[d.offset]||null)),d=h=new ns(p,0),l=!0}let m=this.view.observer.selectionRange;(l||!m.focusNode||(!ef(d.node,d.offset,m.anchorNode,m.anchorOffset)||!ef(h.node,h.offset,m.focusNode,m.focusOffset))&&!this.suppressWidgetCursorChange(m,c))&&(this.view.observer.ignore(()=>{Fe.android&&Fe.chrome&&this.dom.contains(m.focusNode)&&BV(m.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let p=vf(this.view.root);if(p)if(c.empty){if(Fe.gecko){let x=RV(d.node,d.offset);if(x&&x!=3){let v=(x==1?$M:HM)(d.node,d.offset);v&&(d=new ns(v.node,v.offset))}}p.collapse(d.node,d.offset),c.bidiLevel!=null&&p.caretBidiLevel!==void 0&&(p.caretBidiLevel=c.bidiLevel)}else if(p.extend){p.collapse(d.node,d.offset);try{p.extend(h.node,h.offset)}catch{}}else{let x=document.createRange();c.anchor>c.head&&([d,h]=[h,d]),x.setEnd(h.node,h.offset),x.setStart(d.node,d.offset),p.removeAllRanges(),p.addRange(x)}i&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(d,h)),this.impreciseAnchor=d.precise?null:new ns(m.anchorNode,m.anchorOffset),this.impreciseHead=h.precise?null:new ns(m.focusNode,m.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&ef(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=vf(e.root),{anchorNode:s,anchorOffset:i}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let l=pr.find(this,n.head);if(!l)return;let c=l.posAtStart;if(n.head==c||n.head==c+l.length)return;let d=this.coordsAt(n.head,-1),h=this.coordsAt(n.head,1);if(!d||!h||d.bottom>h.top)return;let m=this.domAtPos(n.head+n.assoc);r.collapse(m.node,m.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let p=e.observer.selectionRange;e.docView.posFromDOM(p.anchorNode,p.anchorOffset)!=n.from&&r.collapse(s,i)}moveToLine(e){let n=this.dom,r;if(e.node!=n)return e;for(let s=e.offset;!r&&s=0;s--){let i=jn.get(n.childNodes[s]);i instanceof pr&&(r=i.domAtPos(i.length))}return r?new ns(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=jn.get(n);if(r&&r.rootView==this)return r;n=n.parentNode}return null}posFromDOM(e,n){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,n)+r.posAtStart}domAtPos(e){let{i:n,off:r}=this.childCursor().findPos(e,-1);for(;n=0;l--){let c=this.children[l],d=i-c.breakAfter,h=d-c.length;if(de||c.covers(1))&&(!r||c instanceof pr&&!(r instanceof pr&&n>=0)))r=c,s=h;else if(r&&h==e&&d==e&&c instanceof ol&&Math.abs(n)<2){if(c.deco.startSide<0)break;l&&(r=null)}i=h}return r?r.coordsAt(e-s,n):null}coordsForChar(e){let{i:n,off:r}=this.childPos(e,1),s=this.children[n];if(!(s instanceof pr))return null;for(;s.children.length;){let{i:c,off:d}=s.childPos(r,1);for(;;c++){if(c==s.children.length)return null;if((s=s.children[c]).length)break}r=d}if(!(s instanceof Qi))return null;let i=Vr(s.text,r);if(i==r)return null;let l=wc(s.dom,r,i).getClientRects();for(let c=0;cMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,c=-1,d=this.view.textDirection==Hn.LTR;for(let h=0,m=0;ms)break;if(h>=r){let v=p.dom.getBoundingClientRect();if(n.push(v.height),l){let b=p.dom.lastChild,k=b?ud(b):[];if(k.length){let O=k[k.length-1],j=d?O.right-v.left:v.right-O.left;j>c&&(c=j,this.minWidth=i,this.minWidthFrom=h,this.minWidthTo=x)}}}h=x+p.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?Hn.RTL:Hn.LTR}measureTextSize(){for(let i of this.children)if(i instanceof pr){let l=i.measureTextSize();if(l)return l}let e=document.createElement("div"),n,r,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let i=ud(e.firstChild)[0];n=e.getBoundingClientRect().height,r=i?i.width/27:7,s=i?i.height:n,e.remove()}),{lineHeight:n,charWidth:r,textHeight:s}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new UM(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,s=0;;s++){let i=s==n.viewports.length?null:n.viewports[s],l=i?i.from-1:this.length;if(l>r){let c=(n.lineBlockAt(l).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(Je.replace({widget:new z2(c),block:!0,inclusive:!0,isBlockGap:!0}).range(r,l))}if(!i)break;r=i.to+1}return Je.set(e)}updateDeco(){let e=1,n=this.view.state.facet(yf).map(i=>(this.dynamicDecorationMap[e++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(mA).map((i,l)=>{let c=typeof i=="function";return c&&(r=!0),c?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[e++]=r,n.push(Gt.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];en.anchor?-1:1),s;if(!r)return;!n.empty&&(s=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let i=Tw(this.view),l={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:c,offsetHeight:d}=this.view.scrollDOM;dV(this.view.scrollDOM,l,n.heads instanceof il||s.children.some(r);return r(this.children[n])}}function _V(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function xA(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=$M(n.focusNode,n.focusOffset),s=HM(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let c=jn.get(s.node);if(!c||c instanceof Qi&&c.text!=s.node.nodeValue)i=s;else if(t.docView.lastCompositionAfterCursor){let d=jn.get(r.node);!d||d instanceof Qi&&d.text!=r.node.nodeValue||(i=s)}}if(t.docView.lastCompositionAfterCursor=i!=r,!i)return null;let l=e-i.offset;return{from:l,to:l+i.node.nodeValue.length,node:i.node}}function DV(t,e,n){let r=xA(t,n);if(!r)return null;let{node:s,from:i,to:l}=r,c=s.nodeValue;if(/[\n\r]/.test(c)||t.state.doc.sliceString(r.from,r.to)!=c)return null;let d=e.invertedDesc,h=new ji(d.mapPos(i),d.mapPos(l),i,l),m=[];for(let p=s.parentNode;;p=p.parentNode){let x=jn.get(p);if(x instanceof ml)m.push({node:p,deco:x.mark});else{if(x instanceof pr||p.nodeName=="DIV"&&p.parentNode==t.contentDOM)return{range:h,text:s,marks:m,line:p};if(p!=t.contentDOM)m.push({node:p,deco:new i0({inclusive:!0,attributes:bV(p),tagName:p.tagName.toLowerCase()})});else return null}}}function RV(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{re.from&&(n=!0)}),n}function IV(t,e,n=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),i=e-s.from;if(s.length==0)return Ce.cursor(e);i==0?n=1:i==s.length&&(n=-1);let l=i,c=i;n<0?l=Vr(s.text,i,!1):c=Vr(s.text,i);let d=r(s.text.slice(l,c));for(;l>0;){let h=Vr(s.text,l,!1);if(r(s.text.slice(h,l))!=d)break;l=h}for(;ct?e.left-t:Math.max(0,t-e.right)}function FV(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function _y(t,e){return t.tope.top+1}function pj(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function q2(t,e,n){let r,s,i,l,c=!1,d,h,m,p;for(let b=t.firstChild;b;b=b.nextSibling){let k=ud(b);for(let O=0;OM||l==M&&i>T)&&(r=b,s=j,i=T,l=M,c=T?e0:Oj.bottom&&(!m||m.bottomj.top)&&(h=b,p=j):m&&_y(m,j)?m=gj(m,j.bottom):p&&_y(p,j)&&(p=pj(p,j.top))}}if(m&&m.bottom>=n?(r=d,s=m):p&&p.top<=n&&(r=h,s=p),!r)return{node:t,offset:0};let x=Math.max(s.left,Math.min(s.right,e));if(r.nodeType==3)return xj(r,x,n);if(c&&r.contentEditable!="false")return q2(r,x,n);let v=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(s.left+s.right)/2?1:0);return{node:t,offset:v}}function xj(t,e,n){let r=t.nodeValue.length,s=-1,i=1e9,l=0;for(let c=0;cn?m.top-n:n-m.bottom)-1;if(m.left-1<=e&&m.right+1>=e&&p=(m.left+m.right)/2,v=x;if(Fe.chrome||Fe.gecko){let b=wc(t,c).getBoundingClientRect();Math.abs(b.left-m.right)<.1&&(v=!x)}if(p<=0)return{node:t,offset:c+(v?1:0)};s=c+(v?1:0),i=p}}}return{node:t,offset:s>-1?s:l>0?t.nodeValue.length:0}}function vA(t,e,n,r=-1){var s,i;let l=t.contentDOM.getBoundingClientRect(),c=l.top+t.viewState.paddingTop,d,{docHeight:h}=t.viewState,{x:m,y:p}=e,x=p-c;if(x<0)return 0;if(x>h)return t.state.doc.length;for(let _=t.viewState.heightOracle.textHeight/2,D=!1;d=t.elementAtHeight(x),d.type!=fs.Text;)for(;x=r>0?d.bottom+_:d.top-_,!(x>=0&&x<=h);){if(D)return n?null:0;D=!0,r=-r}p=c+x;let v=d.from;if(vt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:vj(t,l,d,m,p);let b=t.dom.ownerDocument,k=t.root.elementFromPoint?t.root:b,O=k.elementFromPoint(m,p);O&&!t.contentDOM.contains(O)&&(O=null),O||(m=Math.max(l.left+1,Math.min(l.right-1,m)),O=k.elementFromPoint(m,p),O&&!t.contentDOM.contains(O)&&(O=null));let j,T=-1;if(O&&((s=t.docView.nearest(O))===null||s===void 0?void 0:s.isEditable)!=!1){if(b.caretPositionFromPoint){let _=b.caretPositionFromPoint(m,p);_&&({offsetNode:j,offset:T}=_)}else if(b.caretRangeFromPoint){let _=b.caretRangeFromPoint(m,p);_&&({startContainer:j,startOffset:T}=_)}j&&(!t.contentDOM.contains(j)||Fe.safari&&QV(j,T,m)||Fe.chrome&&$V(j,T,m))&&(j=void 0),j&&(T=Math.min(ya(j),T))}if(!j||!t.docView.dom.contains(j)){let _=pr.find(t.docView,v);if(!_)return x>d.top+d.height/2?d.to:d.from;({node:j,offset:T}=q2(_.dom,m,p))}let M=t.docView.nearest(j);if(!M)return null;if(M.isWidget&&((i=M.dom)===null||i===void 0?void 0:i.nodeType)==1){let _=M.dom.getBoundingClientRect();return e.y<_.top||e.y<=_.bottom&&e.x<=(_.left+_.right)/2?M.posAtStart:M.posAtEnd}else return M.localPosFromDOM(j,T)+M.posAtStart}function vj(t,e,n,r,s){let i=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let c=t.viewState.heightOracle.textHeight,d=Math.floor((s-n.top-(t.defaultLineHeight-c)*.5)/c);i+=d*t.viewState.heightOracle.lineLength}let l=t.state.sliceDoc(n.from,n.to);return n.from+j2(l,i,t.state.tabSize)}function yA(t,e,n){let r,s=t;if(t.nodeType!=3||e!=(r=t.nodeValue.length))return!1;for(;;){let i=s.nextSibling;if(i){if(i.nodeName=="BR")break;return!1}else{let l=s.parentNode;if(!l||l.nodeName=="DIV")break;s=l}}return wc(t,r-1,r).getBoundingClientRect().right>n}function QV(t,e,n){return yA(t,e,n)}function $V(t,e,n){if(e!=0)return yA(t,e,n);for(let s=t;;){let i=s.parentNode;if(!i||i.nodeType!=1||i.firstChild!=s)return!1;if(i.classList.contains("cm-line"))break;s=i}let r=t.nodeType==1?t.getBoundingClientRect():wc(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function F2(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let s;for(let i of r.type){if(i.from>e)break;if(!(i.toe)return i;(!s||i.type==fs.Text&&(s.type!=i.type||(n<0?i.frome)))&&(s=i)}}return s||r}return r}function HV(t,e,n,r){let s=F2(t,e.head,e.assoc||-1),i=!r||s.type!=fs.Text||!(t.lineWrapping||s.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(i){let l=t.dom.getBoundingClientRect(),c=t.textDirectionAt(s.from),d=t.posAtCoords({x:n==(c==Hn.LTR)?l.right-1:l.left+1,y:(i.top+i.bottom)/2});if(d!=null)return Ce.cursor(d,n?-1:1)}return Ce.cursor(n?s.to:s.from,n?-1:1)}function yj(t,e,n,r){let s=t.state.doc.lineAt(e.head),i=t.bidiSpans(s),l=t.textDirectionAt(s.from);for(let c=e,d=null;;){let h=MV(s,i,l,c,n),m=nA;if(!h){if(s.number==(n?t.state.doc.lines:1))return c;m=` +`,s=t.state.doc.line(s.number+(n?1:-1)),i=t.bidiSpans(s),h=t.visualLineSide(s,!n)}if(d){if(!d(m))return c}else{if(!r)return h;d=r(m)}c=h}}function UV(t,e,n){let r=t.state.charCategorizer(e),s=r(n);return i=>{let l=r(i);return s==Vn.Space&&(s=l),s==l}}function VV(t,e,n,r){let s=e.head,i=n?1:-1;if(s==(n?t.state.doc.length:0))return Ce.cursor(s,e.assoc);let l=e.goalColumn,c,d=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s,e.assoc||-1),m=t.documentTop;if(h)l==null&&(l=h.left-d.left),c=i<0?h.top:h.bottom;else{let v=t.viewState.lineBlockAt(s);l==null&&(l=Math.min(d.right-d.left,t.defaultCharacterWidth*(s-v.from))),c=(i<0?v.top:v.bottom)+m}let p=d.left+l,x=r??t.viewState.heightOracle.textHeight>>1;for(let v=0;;v+=10){let b=c+(x+v)*i,k=vA(t,{x:p,y:b},!1,i);if(bd.bottom||(i<0?ks)){let O=t.docView.coordsForChar(k),j=!O||b{if(e>i&&es(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:Ce.cursor(r,ri)&&!XV(l,n)&&this.lineBreak(),s=l}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,l=1,c;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),l=this.lineSeparator.length):(c=s.exec(n))&&(i=c.index,l=c[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),l>1)for(let d of this.points)d.node==e&&d.pos>this.text.length&&(d.pos-=l-1);r=i+l}}readNode(e){if(e.cmIgnore)return;let n=jn.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(GV(e,r.node,r.offset)?n:0))}}function GV(t,e,n){for(;;){if(!e||n-1;let{impreciseHead:i,impreciseAnchor:l}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let c=i||l?[]:ZV(e),d=new WV(c,e.state);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=JV(c,this.bounds.from)}else{let c=e.observer.selectionRange,d=i&&i.node==c.focusNode&&i.offset==c.focusOffset||!_2(e.contentDOM,c.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(c.focusNode,c.focusOffset),h=l&&l.node==c.anchorNode&&l.offset==c.anchorOffset||!_2(e.contentDOM,c.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(c.anchorNode,c.anchorOffset),m=e.viewport;if((Fe.ios||Fe.chrome)&&e.state.selection.main.empty&&d!=h&&(m.from>0||m.to-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Ce.range(h,d)):this.newSel=Ce.single(h,d)}}}function wA(t,e){let n,{newSel:r}=e,s=t.state.selection.main,i=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:l,to:c}=e.bounds,d=s.from,h=null;(i===8||Fe.android&&e.text.length=s.from&&n.to<=s.to&&(n.from!=s.from||n.to!=s.to)&&s.to-s.from-(n.to-n.from)<=4?n={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,s.to))}:t.state.doc.lineAt(s.from).toDate.now()-50?n={from:s.from,to:s.to,insert:t.state.toText(t.inputState.insertingText)}:Fe.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` + `&&t.lineWrapping&&(r&&(r=Ce.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:Wt.of([" "])}),n)return Mw(t,n,r,i);if(r&&!r.main.eq(s)){let l=!1,c="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(l=!0),c=t.inputState.lastSelectionOrigin,c=="select.pointer"&&(r=bA(t.state.facet(l0).map(d=>d(t)),r))),t.dispatch({selection:r,scrollIntoView:l,userEvent:c}),!0}else return!1}function Mw(t,e,n,r=-1){if(Fe.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(Fe.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&t.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Gu(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.lengths.head)&&Gu(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Gu(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let l,c=()=>l||(l=KV(t,e,n));return t.state.facet(lA).some(d=>d(t,e.from,e.to,i,c))||t.dispatch(c()),!0}function KV(t,e,n){let r,s=t.state,i=s.selection.main,l=-1;if(e.from==e.to&&e.fromi.to){let d=e.fromp(t)),h,d);e.from==m&&(l=m)}if(l>-1)r={changes:e,selection:Ce.cursor(e.from+e.insert.length,-1)};else if(e.from>=i.from&&e.to<=i.to&&e.to-e.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let d=i.frome.to?s.sliceDoc(e.to,i.to):"";r=s.replaceSelection(t.state.toText(d+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let d=s.changes(e),h=n&&n.main.to<=d.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=i.to+10&&e.to>=i.to-10){let m=t.state.sliceDoc(e.from,e.to),p,x=n&&xA(t,n.main.head);if(x){let b=e.insert.length-(e.to-e.from);p={from:x.from,to:x.to-b}}else p=t.state.doc.lineAt(i.head);let v=i.to-e.to;r=s.changeByRange(b=>{if(b.from==i.from&&b.to==i.to)return{changes:d,range:h||b.map(d)};let k=b.to-v,O=k-m.length;if(t.state.sliceDoc(O,k)!=m||k>=p.from&&O<=p.to)return{range:b};let j=s.changes({from:O,to:k,insert:e.insert}),T=b.to-i.to;return{changes:j,range:h?Ce.range(Math.max(0,h.anchor+T),Math.max(0,h.head+T)):b.map(j)}})}else r={changes:d,selection:h&&s.selection.replaceRange(h)}}let c="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,c+=".compose",t.inputState.compositionFirstChange&&(c+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:c,scrollIntoView:!0})}function SA(t,e,n,r){let s=Math.min(t.length,e.length),i=0;for(;i0&&c>0&&t.charCodeAt(l-1)==e.charCodeAt(c-1);)l--,c--;if(r=="end"){let d=Math.max(0,i-Math.min(l,c));n-=l+d-i}if(l=l?i-n:0;i-=d,c=i+(c-l),l=i}else if(c=c?i-n:0;i-=d,l=i+(l-c),c=i}return{from:i,toA:l,toB:c}}function ZV(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}=t.observer.selectionRange;return n&&(e.push(new bj(n,r)),(s!=n||i!=r)&&e.push(new bj(s,i))),e}function JV(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?Ce.single(n+e,r+e):null}class eW{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Fe.safari&&e.contentDOM.addEventListener("input",()=>null),Fe.gecko&&gW(e.contentDOM.ownerDocument)}handleEvent(e){!oW(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let s of r.observers)s(this.view,n);for(let s of r.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=tW(e),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let l=!n[i].handlers.length,c=r[i];c&&l!=!c.handlers.length&&(s.removeEventListener(i,this.handleEvent),c=null),c||s.addEventListener(i,this.handleEvent,{passive:l})}for(let i in r)i!="scroll"&&!n[i]&&s.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&OA.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Fe.android&&Fe.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return Fe.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=kA.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||nW.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from0?!0:Fe.safari&&!Fe.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function wj(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){Es(n.state,s)}}}function tW(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let s=r.spec,i=s&&s.plugin.domEventHandlers,l=s&&s.plugin.domEventObservers;if(i)for(let c in i){let d=i[c];d&&n(c).handlers.push(wj(r.value,d))}if(l)for(let c in l){let d=l[c];d&&n(c).observers.push(wj(r.value,d))}}for(let r in $i)n(r).handlers.push($i[r]);for(let r in Ci)n(r).observers.push(Ci[r]);return e}const kA=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],nW="dthko",OA=[16,17,18,20,91,92,224,225],rp=6;function sp(t){return Math.max(0,t)*.7+8}function rW(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class sW{constructor(e,n,r,s){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=hV(e.contentDOM),this.atoms=e.state.facet(l0).map(l=>l(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Vt.allowMultipleSelections)&&iW(e,n),this.dragging=lW(e,n)&&CA(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&rW(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,i=0,l=this.view.win.innerWidth,c=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:l}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:c}=this.scrollParents.y.getBoundingClientRect());let d=Tw(this.view);e.clientX-d.left<=s+rp?n=-sp(s-e.clientX):e.clientX+d.right>=l-rp&&(n=sp(e.clientX-l)),e.clientY-d.top<=i+rp?r=-sp(i-e.clientY):e.clientY+d.bottom>=c-rp&&(r=sp(e.clientY-c)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=bA(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function iW(t,e){let n=t.state.facet(rA);return n.length?n[0](e):Fe.mac?e.metaKey:e.ctrlKey}function aW(t,e){let n=t.state.facet(sA);return n.length?n[0](e):Fe.mac?!e.altKey:!e.ctrlKey}function lW(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=vf(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i=e.clientX&&l.top<=e.clientY&&l.bottom>=e.clientY)return!0}return!1}function oW(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=jn.get(n))&&r.ignoreEvent(e))return!1;return!0}const $i=Object.create(null),Ci=Object.create(null),jA=Fe.ie&&Fe.ie_version<15||Fe.ios&&Fe.webkit_version<604;function cW(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),NA(t,n.value)},50)}function kx(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function NA(t,e){e=kx(t.state,jw,e);let{state:n}=t,r,s=1,i=n.toText(e),l=i.lines==n.selection.ranges.length;if(Q2!=null&&n.selection.ranges.every(d=>d.empty)&&Q2==i.toString()){let d=-1;r=n.changeByRange(h=>{let m=n.doc.lineAt(h.from);if(m.from==d)return{range:h};d=m.from;let p=n.toText((l?i.line(s++).text:e)+n.lineBreak);return{changes:{from:m.from,insert:p},range:Ce.cursor(h.from+p.length)}})}else l?r=n.changeByRange(d=>{let h=i.line(s++);return{changes:{from:d.from,to:d.to,insert:h.text},range:Ce.cursor(d.from+h.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Ci.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};$i.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Ci.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Ci.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};$i.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(iA))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=hW(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new sW(t,e,n,r)),r&&t.observer.ignore(()=>{qM(t.contentDOM);let i=t.root.activeElement;i&&!i.contains(t.contentDOM)&&i.blur()});let s=t.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function Sj(t,e,n,r){if(r==1)return Ce.cursor(e,n);if(r==2)return IV(t.state,e,n);{let s=pr.find(t.docView,e),i=t.state.doc.lineAt(s?s.posAtEnd:e),l=s?s.posAtStart:i.from,c=s?s.posAtEnd:i.to;return ce>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function uW(t,e,n,r){let s=pr.find(t.docView,e);if(!s)return 1;let i=e-s.posAtStart;if(i==0)return 1;if(i==s.length)return-1;let l=s.coordsAt(i,-1);if(l&&kj(n,r,l))return-1;let c=s.coordsAt(i,1);return c&&kj(n,r,c)?1:l&&l.bottom>=r?-1:1}function Oj(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:uW(t,n,e.clientX,e.clientY)}}const dW=Fe.ie&&Fe.ie_version<=11;let jj=null,Nj=0,Cj=0;function CA(t){if(!dW)return t.detail;let e=jj,n=Cj;return jj=t,Cj=Date.now(),Nj=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Nj+1)%3:1}function hW(t,e){let n=Oj(t,e),r=CA(e),s=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,l,c){let d=Oj(t,i),h,m=Sj(t,d.pos,d.bias,r);if(n.pos!=d.pos&&!l){let p=Sj(t,n.pos,n.bias,r),x=Math.min(p.from,m.from),v=Math.max(p.to,m.to);m=x1&&(h=fW(s,d.pos))?h:c?s.addRange(m):Ce.create([m])}}}function fW(t,e){for(let n=0;n=e)return Ce.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}$i.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let s=t.docView.nearest(e.target);if(s&&s.isWidget){let i=s.posAtStart,l=i+s.length;(i>=n.to||l<=n.from)&&(n=Ce.range(i,l))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",kx(t.state,Nw,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};$i.dragend=t=>(t.inputState.draggedContent=null,!1);function Tj(t,e,n,r){if(n=kx(t.state,jw,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,l=r&&i&&aW(t,e)?{from:i.from,to:i.to}:null,c={from:s,insert:n},d=t.state.changes(l?[l,c]:c);t.focus(),t.dispatch({changes:d,selection:{anchor:d.mapPos(s,-1),head:d.mapPos(s,1)},userEvent:l?"move.drop":"input.drop"}),t.inputState.draggedContent=null}$i.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,i=()=>{++s==n.length&&Tj(t,e,r.filter(l=>l!=null).join(t.state.lineBreak),!1)};for(let l=0;l{/[\x00-\x08\x0e-\x1f]{2}/.test(c.result)||(r[l]=c.result),i()},c.readAsText(n[l])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Tj(t,e,r,!0),!0}return!1};$i.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=jA?null:e.clipboardData;return n?(NA(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(cW(t),!1)};function mW(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function pW(t){let e=[],n=[],r=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),n.push(s));if(!e.length){let s=-1;for(let{from:i}of t.selection.ranges){let l=t.doc.lineAt(i);l.number>s&&(e.push(l.text),n.push({from:l.from,to:Math.min(t.doc.length,l.to+1)})),s=l.number}r=!0}return{text:kx(t,Nw,e.join(t.lineBreak)),ranges:n,linewise:r}}let Q2=null;$i.copy=$i.cut=(t,e)=>{let{text:n,ranges:r,linewise:s}=pW(t.state);if(!n&&!s)return!1;Q2=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=jA?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(mW(t,n),!1)};const TA=Sa.define();function MA(t,e){let n=[];for(let r of t.facet(oA)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:TA.of(!0)}):null}function AA(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=MA(t.state,e);n?t.dispatch(n):t.update([])}},10)}Ci.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),AA(t)};Ci.blur=t=>{t.observer.clearSelectionRange(),AA(t)};Ci.compositionstart=Ci.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Ci.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Fe.chrome&&Fe.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Ci.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};$i.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let i=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),l=e.getTargetRanges();if(i&&l.length){let c=l[0],d=t.posAtDOM(c.startContainer,c.startOffset),h=t.posAtDOM(c.endContainer,c.endOffset);return Mw(t,{from:d,to:h,insert:t.state.toText(i)},null),!0}}let s;if(Fe.chrome&&Fe.android&&(s=kA.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var l;(((l=window.visualViewport)===null||l===void 0?void 0:l.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Fe.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Fe.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Ci.compositionend(t,e),20),!1};const Mj=new Set;function gW(t){Mj.has(t)||(Mj.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const Aj=["pre-wrap","normal","pre-line","break-spaces"];let fd=!1;function Ej(){fd=!1}class xW{constructor(e){this.lineWrapping=e,this.doc=Wt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Aj.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,d=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=c;if(this.lineWrapping=c,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,d){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Jp&&(fd=!0),this.height=e)}replace(e,n,r){return ms.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,s){let i=this,l=r.doc;for(let c=s.length-1;c>=0;c--){let{fromA:d,toA:h,fromB:m,toB:p}=s[c],x=i.lineAt(d,$n.ByPosNoHeight,r.setDoc(n),0,0),v=x.to>=h?x:i.lineAt(h,$n.ByPosNoHeight,r,0,0);for(p+=v.to-h,h=v.to;c>0&&x.from<=s[c-1].toA;)d=s[c-1].fromA,m=s[c-1].fromB,c--,di*2){let c=e[n-1];c.break?e.splice(--n,1,c.left,null,c.right):e.splice(--n,1,c.left,c.right),r+=1+c.break,s-=c.size}else if(i>s*2){let c=e[r];c.break?e.splice(r,1,c.left,null,c.right):e.splice(r,1,c.left,c.right),r+=2+c.break,i-=c.size}else break;else if(s=i&&l(this.blockAt(0,r,s,i))}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Js extends EA{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,s){return new la(s,this.length,r,this.height,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof Js||s instanceof $r&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof $r?s=new Js(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):ms.of(r)}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setHeight(s.heights[s.index++]):(r||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class $r extends ms{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,s=e.doc.lineAt(n+this.length).number,i=s-r+1,l,c=0;if(e.lineWrapping){let d=Math.min(this.height,e.lineHeight*i);l=d/i,this.length>i+1&&(c=(this.height-d)/(this.length-i-1))}else l=this.height/i;return{firstLine:r,lastLine:s,perLine:l,perChar:c}}blockAt(e,n,r,s){let{firstLine:i,lastLine:l,perLine:c,perChar:d}=this.heightMetrics(n,s);if(n.lineWrapping){let h=s+(e0){let i=r[r.length-1];i instanceof $r?r[r.length-1]=new $r(i.length+s):r.push(null,new $r(s-1))}if(e>0){let i=r[0];i instanceof $r?r[0]=new $r(e+i.length):r.unshift(new $r(e-1),null)}return ms.of(r)}decomposeLeft(e,n){n.push(new $r(e-1),null)}decomposeRight(e,n){n.push(null,new $r(this.length-e-1))}updateHeight(e,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let l=[],c=Math.max(n,s.from),d=-1;for(s.from>n&&l.push(new $r(s.from-n-1).updateHeight(e,n));c<=i&&s.more;){let m=e.doc.lineAt(c).length;l.length&&l.push(null);let p=s.heights[s.index++];d==-1?d=p:Math.abs(p-d)>=Jp&&(d=-2);let x=new Js(m,p);x.outdated=!1,l.push(x),c+=m+1}c<=i&&l.push(null,new $r(i-c).updateHeight(e,c));let h=ms.of(l);return(d<0||Math.abs(h.height-this.height)>=Jp||Math.abs(d-this.heightMetrics(e,n).perLine)>=Jp)&&(fd=!0),Cg(this,h)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class yW extends ms{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,s){let i=r+this.left.height;return ec))return h;let m=n==$n.ByPosNoHeight?$n.ByPosNoHeight:$n.ByPos;return d?h.join(this.right.lineAt(c,m,r,l,c)):this.left.lineAt(c,m,r,s,i).join(h)}forEachLine(e,n,r,s,i,l){let c=s+this.left.height,d=i+this.left.length+this.break;if(this.break)e=d&&this.right.forEachLine(e,n,r,c,d,l);else{let h=this.lineAt(d,$n.ByPos,r,s,i);e=e&&h.from<=n&&l(h),n>h.to&&this.right.forEachLine(h.to+1,n,r,c,d,l)}}replace(e,n,r){let s=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-s,n-s,r));let i=[];e>0&&this.decomposeLeft(e,i);let l=i.length;for(let c of r)i.push(c);if(e>0&&_j(i,l-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,n);e2*n.size||n.size>2*e.size?ms.of(this.break?[e,null,n]:[e,n]):(this.left=Cg(this.left,e),this.right=Cg(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,s){let{left:i,right:l}=this,c=n+i.length+this.break,d=null;return s&&s.from<=n+i.length&&s.more?d=i=i.updateHeight(e,n,r,s):i.updateHeight(e,n,r),s&&s.from<=c+l.length&&s.more?d=l=l.updateHeight(e,c,r,s):l.updateHeight(e,c,r),d?this.balanced(i,l):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function _j(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof $r&&(r=t[e+1])instanceof $r&&t.splice(e-1,3,new $r(n.length+1+r.length))}const bW=5;class Aw{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Js?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Js(r-this.pos,-1)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e=bW)&&this.addLineDeco(s,i,l)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new Js(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new $r(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Js)return e;let n=new Js(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Js)&&!this.isCovered?this.nodes.push(new Js(0,-1)):(this.writtenTom.clientHeight||m.scrollWidth>m.clientWidth)&&p.overflow!="visible"){let x=m.getBoundingClientRect();i=Math.max(i,x.left),l=Math.min(l,x.right),c=Math.max(c,x.top),d=Math.min(h==t.parentNode?s.innerHeight:d,x.bottom)}h=p.position=="absolute"||p.position=="fixed"?m.offsetParent:m.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:i-n.left,right:Math.max(i,l)-n.left,top:c-(n.top+e),bottom:Math.max(c,d)-(n.top+e)}}function OW(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function jW(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class Ry{constructor(e,n,r,s){this.from=e,this.to=n,this.size=r,this.displaySize=s}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;rtypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new xW(n),this.stateDeco=e.facet(yf).filter(r=>typeof r!="function"),this.heightMap=ms.empty().applyChanges(this.stateDeco,Wt.empty,this.heightOracle.setDoc(e.doc),[new ji(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Je.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!e.some(({from:i,to:l})=>s>=i&&s<=l)){let{from:i,to:l}=this.lineBlockAt(s);e.push(new ip(i,l))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Rj:new Ew(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Hh(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(yf).filter(m=>typeof m!="function");let s=e.changedRanges,i=ji.extendWithRanges(s,wW(r,this.stateDeco,e?e.changes:kr.empty(this.state.doc.length))),l=this.heightMap.height,c=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Ej(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=l||fd)&&(e.flags|=2),c?(this.scrollAnchorPos=e.changes.mapPos(c.from,-1),this.scrollAnchorHeight=c.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=l);let d=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.headd.to)||!this.viewportIsAppropriate(d))&&(d=this.getViewport(0,n));let h=d.from!=this.viewport.from||d.to!=this.viewport.to;this.viewport=d,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(uA)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Hn.RTL:Hn.LTR;let l=this.heightOracle.mustRefreshForWrapping(i),c=n.getBoundingClientRect(),d=l||this.mustMeasureContent||this.contentDOMHeight!=c.height;this.contentDOMHeight=c.height,this.mustMeasureContent=!1;let h=0,m=0;if(c.width&&c.height){let{scaleX:_,scaleY:D}=IM(n,c);(_>.005&&Math.abs(this.scaleX-_)>.005||D>.005&&Math.abs(this.scaleY-D)>.005)&&(this.scaleX=_,this.scaleY=D,h|=16,l=d=!0)}let p=(parseInt(r.paddingTop)||0)*this.scaleY,x=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=p||this.paddingBottom!=x)&&(this.paddingTop=p,this.paddingBottom=x,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(d=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let v=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=v&&(this.scrollAnchorHeight=-1,this.scrollTop=v),this.scrolledToBottom=QM(e.scrollDOM);let b=(this.printing?jW:kW)(n,this.paddingTop),k=b.top-this.pixelViewport.top,O=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let j=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(j!=this.inView&&(this.inView=j,j&&(d=!0)),!this.inView&&!this.scrollTarget&&!OW(e.dom))return 0;let T=c.width;if((this.contentDOMWidth!=T||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=c.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),d){let _=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(_)&&(l=!0),l||s.lineWrapping&&Math.abs(T-this.contentDOMWidth)>s.charWidth){let{lineHeight:D,charWidth:E,textHeight:z}=e.docView.measureTextSize();l=D>0&&s.refresh(i,D,E,z,Math.max(5,T/E),_),l&&(e.docView.minWidth=0,h|=16)}k>0&&O>0?m=Math.max(k,O):k<0&&O<0&&(m=Math.min(k,O)),Ej();for(let D of this.viewports){let E=D.from==this.viewport.from?_:e.docView.measureVisibleLineHeights(D);this.heightMap=(l?ms.empty().applyChanges(this.stateDeco,Wt.empty,this.heightOracle,[new ji(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,l,new vW(D.from,E))}fd&&(h|=2)}let M=!this.viewportIsAppropriate(this.viewport,m)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return M&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(m,this.scrollTarget),h|=this.updateForViewport()),(h&2||M)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(l?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:l,visibleBottom:c}=this,d=new ip(s.lineAt(l-r*1e3,$n.ByHeight,i,0,0).from,s.lineAt(c+(1-r)*1e3,$n.ByHeight,i,0,0).to);if(n){let{head:h}=n.range;if(hd.to){let m=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),p=s.lineAt(h,$n.ByPos,i,0,0),x;n.y=="center"?x=(p.top+p.bottom)/2-m/2:n.y=="start"||n.y=="nearest"&&h=c+Math.max(10,Math.min(r,250)))&&s>l-2*1e3&&i>1,l=s<<1;if(this.defaultTextDirection!=Hn.LTR&&!r)return[];let c=[],d=(m,p,x,v)=>{if(p-mm&&jj.from>=x.from&&j.to<=x.to&&Math.abs(j.from-m)j.fromT));if(!O){if(pM.from<=p&&M.to>=p)){let M=n.moveToLineBoundary(Ce.cursor(p),!1,!0).head;M>m&&(p=M)}let j=this.gapSize(x,m,p,v),T=r||j<2e6?j:2e6;O=new Ry(m,p,j,T)}c.push(O)},h=m=>{if(m.length2e6)for(let E of e)E.from>=m.from&&E.fromm.from&&d(m.from,v,m,p),bn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];Gt.spans(n,this.viewport.from,this.viewport.to,{span(i,l){r.push({from:i,to:l})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||Hh(this.heightMap.lineAt(e,$n.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||Hh(this.heightMap.lineAt(this.scaler.fromDOM(e),$n.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return Hh(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}let ip=class{constructor(e,n){this.from=e,this.to=n}};function CW(t,e,n){let r=[],s=t,i=0;return Gt.spans(n,t,e,{span(){},point(l,c){l>s&&(r.push({from:s,to:l}),i+=l-s),s=c}},20),s=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let s=0;;s++){let{from:i,to:l}=e[s],c=l-i;if(r<=c)return i+r;r-=c}}function lp(t,e){let n=0;for(let{from:r,to:s}of t.ranges){if(e<=s){n+=e-r;break}n+=s-r}return n/t.total}function TW(t,e){for(let n of t)if(e(n))return n}const Rj={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class Ew{constructor(e,n,r){let s=0,i=0,l=0;this.viewports=r.map(({from:c,to:d})=>{let h=n.lineAt(c,$n.ByPos,e,0,0).top,m=n.lineAt(d,$n.ByPos,e,0,0).bottom;return s+=m-h,{from:c,to:d,top:h,bottom:m,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let c of this.viewports)c.domTop=l+(c.top-i)*this.scale,l=c.domBottom=c.domTop+(c.bottom-c.top),i=c.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let i=nn.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function Hh(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new la(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>Hh(s,e)):t._content)}const op=He.define({combine:t=>t.join(" ")}),$2=He.define({combine:t=>t.indexOf(!0)>-1}),H2=ho.newName(),_A=ho.newName(),DA=ho.newName(),RA={"&light":"."+_A,"&dark":"."+DA};function U2(t,e,n){return new ho(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return t;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):t+" "+r}})}const MW=U2("."+H2,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},RA),AW={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},zy=Fe.ie&&Fe.ie_version<=11;class EW{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new fV,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(Fe.ie&&Fe.ie_version<=11||Fe.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Fe.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Fe.chrome&&Fe.chrome_version<126)&&(this.editContext=new DW(e),e.state.facet(sl)&&(e.contentDOM.editContext=this.editContext.editContext)),zy&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(sl)?r.root.activeElement!=this.dom:!Kp(this.dom,s))return;let i=s.anchorNode&&r.docView.nearest(s.anchorNode);if(i&&i.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Fe.ie&&Fe.ie_version<=11||Fe.android&&Fe.chrome)&&!r.state.selection.main.empty&&s.focusNode&&ef(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=vf(e.root);if(!n)return!1;let r=Fe.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&_W(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=Kp(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&Gu(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of e){let l=this.readMutation(i);l&&(l.typeOver&&(s=!0),n==-1?{from:n,to:r}=l:(n=Math.min(l.from,n),r=Math.max(l.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&Kp(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new YV(this.view,e,n,r);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,s=wA(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let r=zj(n,e.previousSibling||e.target.previousSibling,-1),s=zj(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(sl)!=e.state.facet(sl)&&(e.view.contentDOM.editContext=e.state.facet(sl)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function zj(t,e,n){for(;e;){let r=jn.get(e);if(r&&r.parent==t)return r;let s=e.parentNode;e=s!=t.dom?s:n>0?e.nextSibling:e.previousSibling}return null}function Pj(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,l=t.docView.domAtPos(t.state.selection.main.anchor);return ef(l.node,l.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function _W(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return Pj(t,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?Pj(t,n):null}class DW{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let s=e.state.selection.main,{anchor:i,head:l}=s,c=this.toEditorPos(r.updateRangeStart),d=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:c,drifted:!1});let h=d-c>r.text.length;c==this.from&&ithis.to&&(d=i);let m=SA(e.state.sliceDoc(c,d),r.text,(h?s.from:s.to)-c,h?"end":null);if(!m){let x=Ce.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));x.main.eq(s)||e.dispatch({selection:x,userEvent:"select"});return}let p={from:m.from+c,to:m.toA+c,insert:Wt.of(r.text.slice(m.from,m.toB).split(` +`))};if((Fe.mac||Fe.android)&&p.from==l-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(p={from:c,to:d,insert:Wt.of([r.text.replace("."," ")])}),this.pendingContextChange=p,!e.state.readOnly){let x=this.to-this.from+(p.to-p.from+p.insert.length);Mw(e,p,Ce.single(this.toEditorPos(r.selectionStart,x),this.toEditorPos(r.selectionEnd,x)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),p.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let l=this.toEditorPos(r.rangeStart),c=this.toEditorPos(r.rangeEnd);l{let s=[];for(let i of r.getTextFormats()){let l=i.underlineStyle,c=i.underlineThickness;if(!/none/i.test(l)&&!/none/i.test(c)){let d=this.toEditorPos(i.rangeStart),h=this.toEditorPos(i.rangeEnd);if(d{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=vf(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((i,l,c,d,h)=>{if(r)return;let m=h.length-(l-i);if(s&&l>=s.to)if(s.from==i&&s.to==l&&s.insert.eq(h)){s=this.pendingContextChange=null,n+=m,this.to+=m;return}else s=null,this.revertPending(e.state);if(i+=n,l+=n,l<=this.from)this.from+=m,this.to+=m;else if(ithis.to||this.to-this.from+h.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(l),h.toString()),this.to+=m}n+=m}),s&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class qe{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(s=>s.forEach(i=>r(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||mV(e.parent)||document,this.viewState=new Dj(e.state||Vt.create(e)),e.scrollTo&&e.scrollTo.is(np)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Fu).map(s=>new Ey(s));for(let s of this.plugins)s.update(this);this.observer=new EW(this),this.inputState=new eW(this),this.inputState.ensureHandlers(this.plugins),this.docView=new mj(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof gr?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let x of e){if(x.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=x.state}if(this.destroyed){this.viewState.state=i;return}let l=this.hasFocus,c=0,d=null;e.some(x=>x.annotation(TA))?(this.inputState.notifiedFocused=l,c=1):l!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=l,d=MA(i,l),d||(c=1));let h=this.observer.delayedAndroidKey,m=null;if(h?(this.observer.clearDelayedAndroidKey(),m=this.observer.readChange(),(m&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(m=null)):this.observer.clear(),i.facet(Vt.phrases)!=this.state.facet(Vt.phrases))return this.setState(i);s=Ng.create(this,i,e),s.flags|=c;let p=this.viewState.scrollTarget;try{this.updateState=2;for(let x of e){if(p&&(p=p.map(x.changes)),x.scrollIntoView){let{main:v}=x.state.selection;p=new Xu(v.empty?v:Ce.cursor(v.head,v.head>v.anchor?-1:1))}for(let v of x.effects)v.is(np)&&(p=v.value.clip(this.state))}this.viewState.update(s,p),this.bidiCache=Tg.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(Qh)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(x=>x.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(op)!=s.state.facet(op)&&(this.viewState.mustMeasureContent=!0),(n||r||p||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let x of this.state.facet(I2))try{x(s)}catch(v){Es(this.state,v,"update listener")}(d||m)&&Promise.resolve().then(()=>{d&&this.state==d.startState&&this.dispatch(d),m&&!wA(this,m)&&h.force&&Gu(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new Dj(e),this.plugins=e.facet(Fu).map(r=>new Ey(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new mj(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Fu),r=e.state.facet(Fu);if(n!=r){let s=[];for(let i of r){let l=n.indexOf(i);if(l<0)s.push(new Ey(i));else{let c=this.plugins[l];c.mustUpdate=e,s.push(c)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:l}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(l=-1),this.viewState.scrollAnchorHeight=-1;try{for(let c=0;;c++){if(l<0)if(QM(r))i=-1,l=this.viewState.heightMap.height;else{let v=this.viewState.scrollAnchorAt(s);i=v.from,l=v.top}this.updateState=1;let d=this.viewState.measure(this);if(!d&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(c>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];d&4||([this.measureRequests,h]=[h,this.measureRequests]);let m=h.map(v=>{try{return v.read(this)}catch(b){return Es(this.state,b),Bj}}),p=Ng.create(this,this.state,[]),x=!1;p.flags|=d,n?n.flags|=d:n=p,this.updateState=2,p.empty||(this.updatePlugins(p),this.inputState.update(p),this.updateAttrs(),x=this.docView.update(p),x&&this.docViewUpdate());for(let v=0;v1||b<-1){s=s+b,r.scrollTop=s/this.scaleY,l=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let c of this.state.facet(I2))c(n)}get themeClasses(){return H2+" "+(this.state.facet($2)?DA:_A)+" "+this.state.facet(op)}updateAttrs(){let e=Lj(this,fA,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(sl)?"true":"false",class:"cm-content",style:`${Fe.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),Lj(this,Cw,n);let r=this.observer.ignore(()=>{let s=R2(this.contentDOM,this.contentAttrs,n),i=R2(this.dom,this.editorAttrs,e);return s||i});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let s of r.effects)if(s.is(qe.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Qh);let e=this.state.facet(qe.cspNonce);ho.mount(this.root,this.styleModules.concat(MW).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;nr.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return Dy(this,e,yj(this,e,n,r))}moveByGroup(e,n){return Dy(this,e,yj(this,e,n,r=>UV(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),i=r[n?r.length-1:0];return Ce.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return HV(this,e,n,r)}moveVertically(e,n,r){return Dy(this,e,VV(this,e,n,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),vA(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(e),i=this.bidiSpans(s),l=i[ro.find(i,e-s.from,-1,n)];return s0(r,l.dir==Hn.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(cA)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>RW)return tA(e.length);let n=this.textDirectionAt(e.from),r;for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||eA(i.isolates,r=fj(this,e))))return i.order;r||(r=fj(this,e));let s=TV(e.text,n,r);return this.bidiCache.push(new Tg(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Fe.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{qM(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return np.of(new Xu(typeof e=="number"?Ce.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return np.of(new Xu(Ce.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return lr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return lr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=ho.newName(),s=[op.of(r),Qh.of(U2(`.${r}`,e))];return n&&n.dark&&s.push($2.of(!0)),s}static baseTheme(e){return jo.lowest(Qh.of(U2("."+H2,e,RA)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&jn.get(r)||jn.get(e);return((n=s?.rootView)===null||n===void 0?void 0:n.view)||null}}qe.styleModule=Qh;qe.inputHandler=lA;qe.clipboardInputFilter=jw;qe.clipboardOutputFilter=Nw;qe.scrollHandler=dA;qe.focusChangeEffect=oA;qe.perLineTextDirection=cA;qe.exceptionSink=aA;qe.updateListener=I2;qe.editable=sl;qe.mouseSelectionStyle=iA;qe.dragMovesSelection=sA;qe.clickAddsSelectionRange=rA;qe.decorations=yf;qe.outerDecorations=mA;qe.atomicRanges=l0;qe.bidiIsolatedRanges=pA;qe.scrollMargins=gA;qe.darkTheme=$2;qe.cspNonce=He.define({combine:t=>t.length?t[0]:""});qe.contentAttributes=Cw;qe.editorAttributes=fA;qe.lineWrapping=qe.contentAttributes.of({class:"cm-lineWrapping"});qe.announce=xt.define();const RW=4096,Bj={};class Tg{constructor(e,n,r,s,i,l){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=l}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:Hn.LTR;for(let i=Math.max(0,e.length-10);i=0;s--){let i=r[s],l=typeof i=="function"?i(t):i;l&&D2(l,n)}return n}const zW=Fe.mac?"mac":Fe.windows?"win":Fe.linux?"linux":"key";function PW(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,l,c;for(let d=0;dr.concat(s),[]))),n}function LW(t,e,n){return PA(zA(t.state),e,t,n)}let to=null;const IW=4e3;function qW(t,e=zW){let n=Object.create(null),r=Object.create(null),s=(l,c)=>{let d=r[l];if(d==null)r[l]=c;else if(d!=c)throw new Error("Key binding "+l+" is used both as a regular binding and as a multi-stroke prefix")},i=(l,c,d,h,m)=>{var p,x;let v=n[l]||(n[l]=Object.create(null)),b=c.split(/ (?!$)/).map(j=>PW(j,e));for(let j=1;j{let _=to={view:M,prefix:T,scope:l};return setTimeout(()=>{to==_&&(to=null)},IW),!0}]})}let k=b.join(" ");s(k,!1);let O=v[k]||(v[k]={preventDefault:!1,stopPropagation:!1,run:((x=(p=v._any)===null||p===void 0?void 0:p.run)===null||x===void 0?void 0:x.slice())||[]});d&&O.run.push(d),h&&(O.preventDefault=!0),m&&(O.stopPropagation=!0)};for(let l of t){let c=l.scope?l.scope.split(" "):["editor"];if(l.any)for(let h of c){let m=n[h]||(n[h]=Object.create(null));m._any||(m._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:p}=l;for(let x in m)m[x].run.push(v=>p(v,V2))}let d=l[e]||l.key;if(d)for(let h of c)i(h,d,l.run,l.preventDefault,l.stopPropagation),l.shift&&i(h,"Shift-"+d,l.shift,l.preventDefault,l.stopPropagation)}return n}let V2=null;function PA(t,e,n,r){V2=e;let s=oV(e),i=Ms(s,0),l=aa(i)==s.length&&s!=" ",c="",d=!1,h=!1,m=!1;to&&to.view==n&&to.scope==r&&(c=to.prefix+" ",OA.indexOf(e.keyCode)<0&&(h=!0,to=null));let p=new Set,x=O=>{if(O){for(let j of O.run)if(!p.has(j)&&(p.add(j),j(n)))return O.stopPropagation&&(m=!0),!0;O.preventDefault&&(O.stopPropagation&&(m=!0),h=!0)}return!1},v=t[r],b,k;return v&&(x(v[c+cp(s,e,!l)])?d=!0:l&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Fe.windows&&e.ctrlKey&&e.altKey)&&!(Fe.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(b=fo[e.keyCode])&&b!=s?(x(v[c+cp(b,e,!0)])||e.shiftKey&&(k=xf[e.keyCode])!=s&&k!=b&&x(v[c+cp(k,e,!1)]))&&(d=!0):l&&e.shiftKey&&x(v[c+cp(s,e,!0)])&&(d=!0),!d&&x(v._any)&&(d=!0)),h&&(d=!0),d&&m&&e.stopPropagation(),V2=null,d}class c0{constructor(e,n,r,s,i){this.className=e,this.left=n,this.top=r,this.width=s,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let s=e.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let i=BA(e);return[new c0(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return FW(e,n,r)}}function BA(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Hn.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function qj(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let i=t.dom.getBoundingClientRect(),l=(s.top+s.bottom)/2,c=t.posAtCoords({x:i.left+1,y:l}),d=t.posAtCoords({x:i.right-1,y:l});return c==null||d==null?r:{from:Math.max(r.from,Math.min(c,d)),to:Math.min(r.to,Math.max(c,d))}}function FW(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),s=Math.min(n.to,t.viewport.to),i=t.textDirection==Hn.LTR,l=t.contentDOM,c=l.getBoundingClientRect(),d=BA(t),h=l.querySelector(".cm-line"),m=h&&window.getComputedStyle(h),p=c.left+(m?parseInt(m.paddingLeft)+Math.min(0,parseInt(m.textIndent)):0),x=c.right-(m?parseInt(m.paddingRight):0),v=F2(t,r,1),b=F2(t,s,-1),k=v.type==fs.Text?v:null,O=b.type==fs.Text?b:null;if(k&&(t.lineWrapping||v.widgetLineBreaks)&&(k=qj(t,r,1,k)),O&&(t.lineWrapping||b.widgetLineBreaks)&&(O=qj(t,s,-1,O)),k&&O&&k.from==O.from&&k.to==O.to)return T(M(n.from,n.to,k));{let D=k?M(n.from,null,k):_(v,!1),E=O?M(null,n.to,O):_(b,!0),z=[];return(k||v).to<(O||b).from-(k&&O?1:0)||v.widgetLineBreaks>1&&D.bottom+t.defaultLineHeight/2V&&W.from=H)break;R>J&&U(Math.max(ue,J),D==null&&ue<=V,Math.min(R,H),E==null&&R>=ce,ne.dir)}if(J=ae.to+1,J>=H)break}return L.length==0&&U(V,D==null,ce,E==null,t.textDirection),{top:Q,bottom:F,horizontal:L}}function _(D,E){let z=c.top+(E?D.top:D.bottom);return{top:z,bottom:z,horizontal:[]}}}function QW(t,e){return t.constructor==e.constructor&&t.eq(e)}class $W{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(eg)!=e.state.facet(eg)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(eg);for(;n!QW(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of e)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=e,Fe.safari&&Fe.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const eg=He.define();function LA(t){return[lr.define(e=>new $W(e,t)),eg.of(t)]}const bf=He.define({combine(t){return ka(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function HW(t={}){return[bf.of(t),UW,VW,WW,uA.of(!0)]}function IA(t){return t.startState.facet(bf)!=t.state.facet(bf)}const UW=LA({above:!0,markers(t){let{state:e}=t,n=e.facet(bf),r=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||n.drawRangeCursor){let l=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",c=s.empty?s:Ce.cursor(s.head,s.head>s.anchor?-1:1);for(let d of c0.forRange(t,l,c))r.push(d)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=IA(t);return n&&Fj(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){Fj(e.state,t)},class:"cm-cursorLayer"});function Fj(t,e){e.style.animationDuration=t.facet(bf).cursorBlinkRate+"ms"}const VW=LA({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:c0.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||IA(t)},class:"cm-selectionLayer"}),WW=jo.highest(qe.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),qA=xt.define({map(t,e){return t==null?null:e.mapPos(t)}}),Uh=Br.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(qA)?r.value:n,t)}}),GW=lr.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(Uh);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Uh)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Uh),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Uh)!=t&&this.view.dispatch({effects:qA.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function XW(){return[Uh,GW]}function Qj(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),l=n,c;!i.next().done;l+=i.value.length)if(!i.lineBreak)for(;c=e.exec(i.value);)s(l+c.index,c)}function YW(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:s,to:i}of n)s=Math.max(t.state.doc.lineAt(s).from,s-e),i=Math.min(t.state.doc.lineAt(i).to,i+e),r.length&&r[r.length-1].to>=s?r[r.length-1].to=i:r.push({from:s,to:i});return r}class KW{constructor(e){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:l=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(c,d,h,m)=>s(m,h,h+c[0].length,c,d);else if(typeof r=="function")this.addMatch=(c,d,h,m)=>{let p=r(c,d,h);p&&m(h,h+c[0].length,p)};else if(r)this.addMatch=(c,d,h,m)=>m(h,h+c[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=l}createDeco(e){let n=new fl,r=n.add.bind(n);for(let{from:s,to:i}of YW(e,this.maxLength))Qj(e.state.doc,this.regexp,s,i,(l,c)=>this.addMatch(c,e,l,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,l,c,d)=>{d>=e.view.viewport.from&&c<=e.view.viewport.to&&(r=Math.min(c,r),s=Math.max(d,s))}),e.viewportMoved||s-r>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,n.map(e.changes),r,s):n}updateRange(e,n,r,s){for(let i of e.visibleRanges){let l=Math.max(i.from,r),c=Math.min(i.to,s);if(c>=l){let d=e.state.doc.lineAt(l),h=d.tod.from;l--)if(this.boundary.test(d.text[l-1-d.from])){m=l;break}for(;cx.push(j.range(k,O));if(d==h)for(this.regexp.lastIndex=m-d.from;(v=this.regexp.exec(d.text))&&v.indexthis.addMatch(O,e,k,b));n=n.update({filterFrom:m,filterTo:p,filter:(k,O)=>kp,add:x})}}return n}}const W2=/x/.unicode!=null?"gu":"g",ZW=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,W2),JW={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Py=null;function eG(){var t;if(Py==null&&typeof document<"u"&&document.body){let e=document.body.style;Py=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Py||!1}const tg=He.define({combine(t){let e=ka(t,{render:null,specialChars:ZW,addSpecialChars:null});return(e.replaceTabs=!eG())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,W2)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,W2)),e}});function tG(t={}){return[tg.of(t),nG()]}let $j=null;function nG(){return $j||($j=lr.fromClass(class{constructor(t){this.view=t,this.decorations=Je.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(tg)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new KW({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=Ms(e[0],0);if(i==9){let l=s.lineAt(r),c=n.state.tabSize,d=Td(l.text,c,r-l.from);return Je.replace({widget:new aG((c-d%c)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=Je.replace({widget:new iG(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(tg);t.startState.facet(tg)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const rG="•";function sG(t){return t>=32?rG:t==10?"␤":String.fromCharCode(9216+t)}class iG extends Oa{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=sG(this.code),r=e.state.phrase("Control character")+" "+(JW[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,n);if(s)return s;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class aG extends Oa{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function lG(){return cG}const oG=Je.line({class:"cm-activeLine"}),cG=lr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let s=t.lineBlockAt(r.head);s.from>e&&(n.push(oG.range(s.from)),e=s.from)}return Je.set(n)}},{decorations:t=>t.decorations});class uG extends Oa{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?ud(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),s=s0(n[0],r.direction!="rtl"),i=parseInt(r.lineHeight);return s.bottom-s.top>i*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+i}:s}ignoreEvent(){return!1}}function dG(t){let e=lr.fromClass(class{constructor(n){this.view=n,this.placeholder=t?Je.set([Je.widget({widget:new uG(t),side:1}).range(0)]):Je.none}get decorations(){return this.view.state.doc.length?Je.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,qe.contentAttributes.of({"aria-placeholder":t})]:e}const G2=2e3;function hG(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>G2||n.off>G2||e.col<0||n.col<0){let l=Math.min(e.off,n.off),c=Math.max(e.off,n.off);for(let d=r;d<=s;d++){let h=t.doc.line(d);h.length<=c&&i.push(Ce.range(h.from+l,h.to+c))}}else{let l=Math.min(e.col,n.col),c=Math.max(e.col,n.col);for(let d=r;d<=s;d++){let h=t.doc.line(d),m=j2(h.text,l,t.tabSize,!0);if(m<0)i.push(Ce.cursor(h.to));else{let p=j2(h.text,c,t.tabSize);i.push(Ce.range(h.from+m,h.from+p))}}}return i}function fG(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function Hj(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),s=n-r.from,i=s>G2?-1:s==r.length?fG(t,e.clientX):Td(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function mG(t,e){let n=Hj(t,e),r=t.state.selection;return n?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(n.line).from),l=s.state.doc.lineAt(i);n={line:l.number,col:n.col,off:Math.min(n.off,l.length)},r=r.map(s.changes)}},get(s,i,l){let c=Hj(t,s);if(!c)return r;let d=hG(t.state,n,c);return d.length?l?Ce.create(d.concat(r.ranges)):Ce.create(d):r}}:null}function pG(t){let e=(n=>n.altKey&&n.button==0);return qe.mouseSelectionStyle.of((n,r)=>e(r)?mG(n,r):null)}const gG={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},xG={style:"cursor: crosshair"};function vG(t={}){let[e,n]=gG[t.key||"Alt"],r=lr.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||n(s))},keyup(s){(s.keyCode==e||!n(s))&&this.set(!1)},mousemove(s){this.set(n(s))}}});return[r,qe.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?xG:null})]}const up="-10000px";class FA{constructor(e,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=e.state.facet(n),this.tooltips=this.input.filter(l=>l);let i=null;this.tooltipViews=this.tooltips.map(l=>i=r(l,i))}update(e,n){var r;let s=e.state.facet(this.facet),i=s.filter(d=>d);if(s===this.input){for(let d of this.tooltipViews)d.update&&d.update(e);return!1}let l=[],c=n?[]:null;for(let d=0;dn[h]=d),n.length=c.length),this.input=s,this.tooltips=i,this.tooltipViews=l,!0}}function yG(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const By=He.define({combine:t=>{var e,n,r;return{position:Fe.ios?"absolute":((e=t.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(s=>s.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||yG}}}),Uj=new WeakMap,_w=lr.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(By);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new FA(t,Dw,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(By);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",n.dom.appendChild(s)}return n.dom.style.position=this.position,n.dom.style.top=up,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(Fe.safari){let l=i.getBoundingClientRect();n=Math.abs(l.top+1e4)>1||Math.abs(l.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=Tw(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,l)=>{let c=this.manager.tooltipViews[l];return c.getCoords?c.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(By).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let c of this.manager.tooltipViews)c.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,l=[];for(let c=0;c=Math.min(n.bottom,r.bottom)||p.rightMath.min(n.right,r.right)+.1)){m.style.top=up;continue}let v=d.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,b=v?7:0,k=x.right-x.left,O=(e=Uj.get(h))!==null&&e!==void 0?e:x.bottom-x.top,j=h.offset||wG,T=this.view.textDirection==Hn.LTR,M=x.width>r.right-r.left?T?r.left:r.right-x.width:T?Math.max(r.left,Math.min(p.left-(v?14:0)+j.x,r.right-k)):Math.min(Math.max(r.left,p.left-k+(v?14:0)-j.x),r.right-k),_=this.above[c];!d.strictSide&&(_?p.top-O-b-j.yr.bottom)&&_==r.bottom-p.bottom>p.top-r.top&&(_=this.above[c]=!_);let D=(_?p.top-r.top:r.bottom-p.bottom)-b;if(DM&&Q.topE&&(E=_?Q.top-O-2-b:Q.bottom+b+2);if(this.position=="absolute"?(m.style.top=(E-t.parent.top)/i+"px",Vj(m,(M-t.parent.left)/s)):(m.style.top=E/i+"px",Vj(m,M/s)),v){let Q=p.left+(T?j.x:-j.x)-(M+14-7);v.style.left=Q/s+"px"}h.overlap!==!0&&l.push({left:M,top:E,right:z,bottom:E+O}),m.classList.toggle("cm-tooltip-above",_),m.classList.toggle("cm-tooltip-below",!_),h.positioned&&h.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=up}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Vj(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const bG=qe.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),wG={x:0,y:0},Dw=He.define({enables:[_w,bG]}),Mg=He.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Ox{static create(e){return new Ox(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new FA(e,Mg,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let s=r[e];if(s!==void 0){if(n===void 0)n=s;else if(n!==s)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const SG=Dw.compute([Mg],t=>{let e=t.facet(Mg);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:Ox.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class kG{constructor(e,n,r,s,i){this.view=e,this.source=n,this.field=r,this.setHover=s,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;ec.bottom||n.xc.right+e.defaultCharacterWidth)return;let d=e.bidiSpans(e.state.doc.lineAt(s)).find(m=>m.from<=s&&m.to>=s),h=d&&d.dir==Hn.RTL?-1:1;i=n.x{this.pending==c&&(this.pending=null,d&&!(Array.isArray(d)&&!d.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(d)?d:[d])}))},d=>Es(e.state,d,"hover tooltip"))}else l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])})}get tooltip(){let e=this.view.plugin(_w),n=e?e.manager.tooltips.findIndex(r=>r.create==Ox.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:i}=this;if(s.length&&i&&!OG(i.dom,e)||this.pending){let{pos:l}=s[0]||this.pending,c=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:l;(l==c?this.view.posAtCoords(this.lastMove)!=l:!jG(this.view,l,c,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const dp=4;function OG(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),l;if(l=t.querySelector(".cm-tooltip-arrow")){let c=l.getBoundingClientRect();s=Math.min(c.top,s),i=Math.max(c.bottom,i)}return e.clientX>=n-dp&&e.clientX<=r+dp&&e.clientY>=s-dp&&e.clientY<=i+dp}function jG(t,e,n,r,s,i){let l=t.scrollDOM.getBoundingClientRect(),c=t.documentTop+t.documentPadding.top+t.contentHeight;if(l.left>r||l.rights||Math.min(l.bottom,c)=e&&d<=n}function NG(t,e={}){let n=xt.define(),r=Br.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(l=>!e.hideOn(i,l))),i.docChanged)){let l=[];for(let c of s){let d=i.changes.mapPos(c.pos,-1,Ur.TrackDel);if(d!=null){let h=Object.assign(Object.create(null),c);h.pos=d,h.end!=null&&(h.end=i.changes.mapPos(h.end)),l.push(h)}}s=l}for(let l of i.effects)l.is(n)&&(s=l.value),l.is(CG)&&(s=[]);return s},provide:s=>Mg.from(s)});return{active:r,extension:[r,lr.define(s=>new kG(s,t,r,n,e.hoverTime||300)),SG]}}function QA(t,e){let n=t.plugin(_w);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const CG=xt.define(),Wj=He.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function wf(t,e){let n=t.plugin($A),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const $A=lr.fromClass(class{constructor(t){this.input=t.state.facet(Sf),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(Wj);this.top=new hp(t,!0,e.topContainer),this.bottom=new hp(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(Wj);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new hp(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new hp(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Sf);if(n!=this.input){let r=n.filter(d=>d),s=[],i=[],l=[],c=[];for(let d of r){let h=this.specs.indexOf(d),m;h<0?(m=d(t.view),c.push(m)):(m=this.panels[h],m.update&&m.update(t)),s.push(m),(m.top?i:l).push(m)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(l);for(let d of c)d.dom.classList.add("cm-panel"),d.mount&&d.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>qe.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class hp{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=Gj(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=Gj(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Gj(t){let e=t.nextSibling;return t.remove(),e}const Sf=He.define({enables:$A});class pl extends yc{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}pl.prototype.elementClass="";pl.prototype.toDOM=void 0;pl.prototype.mapMode=Ur.TrackBefore;pl.prototype.startSide=pl.prototype.endSide=-1;pl.prototype.point=!0;const ng=He.define(),TG=He.define(),MG={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Gt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},rf=He.define();function AG(t){return[HA(),rf.of({...MG,...t})]}const Xj=He.define({combine:t=>t.some(e=>e)});function HA(t){return[EG]}const EG=lr.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(rf).map(e=>new Kj(t,e)),this.fixed=!t.state.facet(Xj);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Xj)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=Gt.iter(this.view.state.facet(ng),this.view.viewport.from),r=[],s=this.gutters.map(i=>new _G(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let l=!0;for(let c of i.type)if(c.type==fs.Text&&l){X2(n,r,c.from);for(let d of s)d.line(this.view,c,r);l=!1}else if(c.widget)for(let d of s)d.widget(this.view,c)}else if(i.type==fs.Text){X2(n,r,i.from);for(let l of s)l.line(this.view,i,r)}else if(i.widget)for(let l of s)l.widget(this.view,i);for(let i of s)i.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(rf),n=t.state.facet(rf),r=t.docChanged||t.heightChanged||t.viewportChanged||!Gt.eq(t.startState.facet(ng),t.state.facet(ng),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let i of n){let l=e.indexOf(i);l<0?s.push(new Kj(this.view,i)):(this.gutters[l].update(t),s.push(this.gutters[l]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>qe.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,s=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Hn.LTR?{left:r,right:s}:{right:r,left:s}})});function Yj(t){return Array.isArray(t)?t:[t]}function X2(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class _G{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Gt.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,i=(n.top-this.height)/e.scaleY,l=n.height/e.scaleY;if(this.i==s.elements.length){let c=new UA(e,l,i,r);s.elements.push(c),s.dom.appendChild(c.dom)}else s.elements[this.i].update(e,l,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];X2(this.cursor,s,n.from),r.length&&(s=s.concat(r));let i=this.gutter.config.lineMarker(e,n,s);i&&s.unshift(i);let l=this.gutter;s.length==0&&!l.config.renderEmptyElements||this.addElement(e,n,s)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),s=r?[r]:null;for(let i of e.state.facet(TG)){let l=i(e,n.widget,n);l&&(s||(s=[])).push(l)}s&&this.addElement(e,n,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class Kj{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let i=s.target,l;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let d=i.getBoundingClientRect();l=(d.top+d.bottom)/2}else l=s.clientY;let c=e.lineBlockAtHeight(l-e.documentTop);n.domEventHandlers[r](e,c,s)&&s.preventDefault()});this.markers=Yj(n.markers(e)),n.initialSpacer&&(this.spacer=new UA(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=Yj(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let r=e.view.viewport;return!Gt.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class UA{constructor(e,n,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,s)}update(e,n,r,s){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),DG(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,l=0;;){let c=l,d=ii(c,d,h)||l(c,d,h):l}return r}})}});class Ly extends pl{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Iy(t,e){return t.state.facet(Qu).formatNumber(e,t.state)}const PG=rf.compute([Qu],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(RG)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new Ly(Iy(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(zG)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Qu)!=e.state.facet(Qu),initialSpacer(e){return new Ly(Iy(e,Zj(e.state.doc.lines)))},updateSpacer(e,n){let r=Iy(n.view,Zj(n.view.state.doc.lines));return r==e.number?e:new Ly(r)},domEventHandlers:t.facet(Qu).domEventHandlers,side:"before"}));function BG(t={}){return[Qu.of(t),HA(),PG]}function Zj(t){let e=9;for(;e{let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>n&&(n=s,e.push(LG.range(s)))}return Gt.of(e)});function qG(){return IG}const VA=1024;let FG=0;class qy{constructor(e,n){this.from=e,this.to=n}}class Et{constructor(e={}){this.id=FG++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=gs.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Et.closedBy=new Et({deserialize:t=>t.split(" ")});Et.openedBy=new Et({deserialize:t=>t.split(" ")});Et.group=new Et({deserialize:t=>t.split(" ")});Et.isolate=new Et({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Et.contextHash=new Et({perNode:!0});Et.lookAhead=new Et({perNode:!0});Et.mounted=new Et({perNode:!0});class Ag{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[Et.mounted.id]}}const QG=Object.create(null);class gs{constructor(e,n,r,s=0){this.name=e,this.props=n,this.id=r,this.flags=s}static define(e){let n=e.props&&e.props.length?Object.create(null):QG,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new gs(e.name||"",n,e.id,r);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(s)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Et.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let s of r.split(" "))n[s]=e[r];return r=>{for(let s=r.prop(Et.group),i=-1;i<(s?s.length:0);i++){let l=n[i<0?r.name:s[i]];if(l)return l}}}}gs.none=new gs("",Object.create(null),0,8);class jx{constructor(e){this.types=e;for(let n=0;n0;for(let d=this.cursor(l|Or.IncludeAnonymous);;){let h=!1;if(d.from<=i&&d.to>=s&&(!c&&d.type.isAnonymous||n(d)!==!1)){if(d.firstChild())continue;h=!0}for(;h&&r&&(c||!d.type.isAnonymous)&&r(d),!d.nextSibling();){if(!d.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Pw(gs.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new Dn(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new Dn(gs.none,n,r,s)))}static build(e){return VG(e)}}Dn.empty=new Dn(gs.none,[],[],0);class Rw{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Rw(this.buffer,this.index)}}class po{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return gs.none}toString(){let e=[];for(let n=0;n0));d=l[d+3]);return c}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),l=0;for(let c=e,d=0;c=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function kf(t,e,n,r){for(var s;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?c.length:-1;e!=h;e+=n){let m=c[e],p=d[e]+l.from;if(WA(s,r,p,p+m.length)){if(m instanceof po){if(i&Or.ExcludeBuffers)continue;let x=m.findChild(0,m.buffer.length,n,r-p,s);if(x>-1)return new da(new $G(l,m,e,p),null,x)}else if(i&Or.IncludeAnonymous||!m.type.isAnonymous||zw(m)){let x;if(!(i&Or.IgnoreMounts)&&(x=Ag.get(m))&&!x.overlay)return new zs(x.tree,p,e,l);let v=new zs(m,p,e,l);return i&Or.IncludeAnonymous||!v.type.isAnonymous?v:v.nextChild(n<0?m.children.length-1:0,n,r,s)}}}if(i&Or.IncludeAnonymous||!l.type.isAnonymous||(l.index>=0?e=l.index+n:e=n<0?-1:l._parent._tree.children.length,l=l._parent,!l))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let s;if(!(r&Or.IgnoreOverlays)&&(s=Ag.get(this._tree))&&s.overlay){let i=e-this.from;for(let{from:l,to:c}of s.overlay)if((n>0?l<=i:l=i:c>i))return new zs(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function e7(t,e,n,r){let s=t.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let l=!1;!l;)if(l=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(e)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function Y2(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class $G{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class da extends GA{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.context.start,r);return i<0?null:new da(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&Or.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return i<0?null:new da(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new da(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new da(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let l=r.buffer[this.index+1];e.push(r.slice(s,i,l)),n.push(0)}return new Dn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function XA(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;in.from||l.to=e){let c=new zs(l.tree,l.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(kf(c,e,n,!1))}}return s?XA(s):r}class K2{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof zs)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof zs?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Or.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Or.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Or.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let i=n+e,l=e<0?-1:r._tree.children.length;i!=l;i+=e){let c=r._tree.children[i];if(this.mode&Or.IncludeAnonymous||c instanceof po||!c.type.isAnonymous||zw(c))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let l=e;l;l=l._parent)if(l.index==s){if(s==this.index)return l;n=l,r=i+1;break e}s=this.stack[--i]}for(let s=r;s=0;i--){if(i<0)return Y2(this._tree,e,s);let l=r[n.buffer[this.stack[i]]];if(!l.isAnonymous){if(e[s]&&e[s]!=l.name)return!1;s--}}return!0}}function zw(t){return t.children.some(e=>e instanceof po||!e.type.isAnonymous||zw(e))}function VG(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=VA,reused:i=[],minRepeatType:l=r.types.length}=t,c=Array.isArray(n)?new Rw(n,n.length):n,d=r.types,h=0,m=0;function p(D,E,z,Q,F,L){let{id:U,start:V,end:ce,size:W}=c,J=m,H=h;if(W<0)if(c.next(),W==-1){let me=i[U];z.push(me),Q.push(V-D);return}else if(W==-3){h=U;return}else if(W==-4){m=U;return}else throw new RangeError(`Unrecognized record size: ${W}`);let ae=d[U],ne,ue,R=V-D;if(ce-V<=s&&(ue=O(c.pos-E,F))){let me=new Uint16Array(ue.size-ue.skip),Y=c.pos-ue.size,P=me.length;for(;c.pos>Y;)P=j(ue.start,me,P);ne=new po(me,ce-ue.start,r),R=ue.start-D}else{let me=c.pos-W;c.next();let Y=[],P=[],K=U>=l?U:-1,$=0,fe=ce;for(;c.pos>me;)K>=0&&c.id==K&&c.size>=0?(c.end<=fe-s&&(b(Y,P,V,$,c.end,fe,K,J,H),$=Y.length,fe=c.end),c.next()):L>2500?x(V,me,Y,P):p(V,me,Y,P,K,L+1);if(K>=0&&$>0&&$-1&&$>0){let ve=v(ae,H);ne=Pw(ae,Y,P,0,Y.length,0,ce-V,ve,ve)}else ne=k(ae,Y,P,ce-V,J-ce,H)}z.push(ne),Q.push(R)}function x(D,E,z,Q){let F=[],L=0,U=-1;for(;c.pos>E;){let{id:V,start:ce,end:W,size:J}=c;if(J>4)c.next();else{if(U>-1&&ce=0;W-=3)V[J++]=F[W],V[J++]=F[W+1]-ce,V[J++]=F[W+2]-ce,V[J++]=J;z.push(new po(V,F[2]-ce,r)),Q.push(ce-D)}}function v(D,E){return(z,Q,F)=>{let L=0,U=z.length-1,V,ce;if(U>=0&&(V=z[U])instanceof Dn){if(!U&&V.type==D&&V.length==F)return V;(ce=V.prop(Et.lookAhead))&&(L=Q[U]+V.length+ce)}return k(D,z,Q,F,L,E)}}function b(D,E,z,Q,F,L,U,V,ce){let W=[],J=[];for(;D.length>Q;)W.push(D.pop()),J.push(E.pop()+z-F);D.push(k(r.types[U],W,J,L-F,V-L,ce)),E.push(F-z)}function k(D,E,z,Q,F,L,U){if(L){let V=[Et.contextHash,L];U=U?[V].concat(U):[V]}if(F>25){let V=[Et.lookAhead,F];U=U?[V].concat(U):[V]}return new Dn(D,E,z,Q,U)}function O(D,E){let z=c.fork(),Q=0,F=0,L=0,U=z.end-s,V={size:0,start:0,skip:0};e:for(let ce=z.pos-D;z.pos>ce;){let W=z.size;if(z.id==E&&W>=0){V.size=Q,V.start=F,V.skip=L,L+=4,Q+=4,z.next();continue}let J=z.pos-W;if(W<0||J=l?4:0,ae=z.start;for(z.next();z.pos>J;){if(z.size<0)if(z.size==-3)H+=4;else break e;else z.id>=l&&(H+=4);z.next()}F=ae,Q+=W,L+=H}return(E<0||Q==D)&&(V.size=Q,V.start=F,V.skip=L),V.size>4?V:void 0}function j(D,E,z){let{id:Q,start:F,end:L,size:U}=c;if(c.next(),U>=0&&Q4){let ce=c.pos-(U-4);for(;c.pos>ce;)z=j(D,E,z)}E[--z]=V,E[--z]=L-D,E[--z]=F-D,E[--z]=Q}else U==-3?h=Q:U==-4&&(m=Q);return z}let T=[],M=[];for(;c.pos>0;)p(t.start||0,t.bufferStart||0,T,M,-1,0);let _=(e=t.length)!==null&&e!==void 0?e:T.length?M[0]+T[0].length:0;return new Dn(d[t.topID],T.reverse(),M.reverse(),_)}const t7=new WeakMap;function rg(t,e){if(!t.isAnonymous||e instanceof po||e.type!=t)return 1;let n=t7.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Dn)){n=1;break}n+=rg(t,r)}t7.set(e,n)}return n}function Pw(t,e,n,r,s,i,l,c,d){let h=0;for(let b=r;b=m)break;E+=z}if(M==_+1){if(E>m){let z=b[_];v(z.children,z.positions,0,z.children.length,k[_]+T);continue}p.push(b[_])}else{let z=k[M-1]+b[M-1].length-D;p.push(Pw(t,b,k,_,M,D,z,null,d))}x.push(D+T-i)}}return v(e,n,r,s,0),(c||d)(p,x,l)}class WG{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof da?this.setBuffer(e.context.buffer,e.index,n):e instanceof zs&&this.map.set(e.tree,n)}get(e){return e instanceof da?this.getBuffer(e.context.buffer,e.index):e instanceof zs?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class pc{constructor(e,n,r,s,i=!1,l=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(l?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let s=[new pc(0,e.length,e,0,!1,r)];for(let i of n)i.to>e.length&&s.push(i);return s}static applyChanges(e,n,r=128){if(!n.length)return e;let s=[],i=1,l=e.length?e[0]:null;for(let c=0,d=0,h=0;;c++){let m=c=r)for(;l&&l.from=x.from||p<=x.to||h){let v=Math.max(x.from,d)-h,b=Math.min(x.to,p)-h;x=v>=b?null:new pc(v,b,x.tree,x.offset+h,c>0,!!m)}if(x&&s.push(x),l.to>p)break;l=inew qy(s.from,s.to)):[new qy(0,0)]:[new qy(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let s=this.startParse(e,n,r);for(;;){let i=s.advance();if(i)return i}}};class GG{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new Et({perNode:!0});let XG=0;class vi{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=XG++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof vi&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new vi(r,[],null,[]);if(s.set.push(s),n)for(let i of n.set)s.set.push(i);return s}static defineModifier(e){let n=new Eg(e);return r=>r.modified.indexOf(n)>-1?r:Eg.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let YG=0;class Eg{constructor(e){this.name=e,this.instances=[],this.id=YG++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(c=>c.base==e&&KG(n,c.modified));if(r)return r;let s=[],i=new vi(e.name,s,e,n);for(let c of n)c.instances.push(i);let l=ZG(n);for(let c of e.set)if(!c.modified.length)for(let d of l)s.push(Eg.get(c,d));return i}}function KG(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function ZG(t){let e=[[]];for(let n=0;nr.length-n.length)}function Lw(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],l=2,c=s;for(let p=0;;){if(c=="..."&&p>0&&p+3==s.length){l=1;break}let x=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(c);if(!x)throw new RangeError("Invalid path: "+s);if(i.push(x[0]=="*"?"":x[0][0]=='"'?JSON.parse(x[0]):x[0]),p+=x[0].length,p==s.length)break;let v=s[p++];if(p==s.length&&v=="!"){l=0;break}if(v!="/")throw new RangeError("Invalid path: "+s);c=s.slice(p)}let d=i.length-1,h=i[d];if(!h)throw new RangeError("Invalid path: "+s);let m=new Of(r,l,d>0?i.slice(0,d):null);e[h]=m.sort(e[h])}}return YA.add(e)}const YA=new Et({combine(t,e){let n,r,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let i=new Of(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class Of{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let l=s;for(let c of i)for(let d of c.set){let h=n[d.id];if(h){l=l?l+" "+h:h;break}}return l},scope:r}}function JG(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function eX(t,e,n,r=0,s=t.length){let i=new tX(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class tX{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,s,i){let{type:l,from:c,to:d}=e;if(c>=r||d<=n)return;l.isTop&&(i=this.highlighters.filter(v=>!v.scope||v.scope(l)));let h=s,m=nX(e)||Of.empty,p=JG(i,m.tags);if(p&&(h&&(h+=" "),h+=p,m.mode==1&&(s+=(s?" ":"")+p)),this.startSpan(Math.max(n,c),h),m.opaque)return;let x=e.tree&&e.tree.prop(Et.mounted);if(x&&x.overlay){let v=e.node.enter(x.overlay[0].from+c,1),b=this.highlighters.filter(O=>!O.scope||O.scope(x.tree.type)),k=e.firstChild();for(let O=0,j=c;;O++){let T=O=M||!e.nextSibling())););if(!T||M>r)break;j=T.to+c,j>n&&(this.highlightRange(v.cursor(),Math.max(n,T.from+c),Math.min(r,j),"",b),this.startSpan(Math.min(r,j),h))}k&&e.parent()}else if(e.firstChild()){x&&(s="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,s,i),this.startSpan(Math.min(r,e.to),h)}while(e.nextSibling());e.parent()}}}function nX(t){let e=t.type.prop(YA);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ie=vi.define,mp=Ie(),Jl=Ie(),n7=Ie(Jl),r7=Ie(Jl),eo=Ie(),pp=Ie(eo),Fy=Ie(eo),na=Ie(),Ko=Ie(na),ea=Ie(),ta=Ie(),Z2=Ie(),Rh=Ie(Z2),gp=Ie(),he={comment:mp,lineComment:Ie(mp),blockComment:Ie(mp),docComment:Ie(mp),name:Jl,variableName:Ie(Jl),typeName:n7,tagName:Ie(n7),propertyName:r7,attributeName:Ie(r7),className:Ie(Jl),labelName:Ie(Jl),namespace:Ie(Jl),macroName:Ie(Jl),literal:eo,string:pp,docString:Ie(pp),character:Ie(pp),attributeValue:Ie(pp),number:Fy,integer:Ie(Fy),float:Ie(Fy),bool:Ie(eo),regexp:Ie(eo),escape:Ie(eo),color:Ie(eo),url:Ie(eo),keyword:ea,self:Ie(ea),null:Ie(ea),atom:Ie(ea),unit:Ie(ea),modifier:Ie(ea),operatorKeyword:Ie(ea),controlKeyword:Ie(ea),definitionKeyword:Ie(ea),moduleKeyword:Ie(ea),operator:ta,derefOperator:Ie(ta),arithmeticOperator:Ie(ta),logicOperator:Ie(ta),bitwiseOperator:Ie(ta),compareOperator:Ie(ta),updateOperator:Ie(ta),definitionOperator:Ie(ta),typeOperator:Ie(ta),controlOperator:Ie(ta),punctuation:Z2,separator:Ie(Z2),bracket:Rh,angleBracket:Ie(Rh),squareBracket:Ie(Rh),paren:Ie(Rh),brace:Ie(Rh),content:na,heading:Ko,heading1:Ie(Ko),heading2:Ie(Ko),heading3:Ie(Ko),heading4:Ie(Ko),heading5:Ie(Ko),heading6:Ie(Ko),contentSeparator:Ie(na),list:Ie(na),quote:Ie(na),emphasis:Ie(na),strong:Ie(na),link:Ie(na),monospace:Ie(na),strikethrough:Ie(na),inserted:Ie(),deleted:Ie(),changed:Ie(),invalid:Ie(),meta:gp,documentMeta:Ie(gp),annotation:Ie(gp),processingInstruction:Ie(gp),definition:vi.defineModifier("definition"),constant:vi.defineModifier("constant"),function:vi.defineModifier("function"),standard:vi.defineModifier("standard"),local:vi.defineModifier("local"),special:vi.defineModifier("special")};for(let t in he){let e=he[t];e instanceof vi&&(e.name=t)}KA([{tag:he.link,class:"tok-link"},{tag:he.heading,class:"tok-heading"},{tag:he.emphasis,class:"tok-emphasis"},{tag:he.strong,class:"tok-strong"},{tag:he.keyword,class:"tok-keyword"},{tag:he.atom,class:"tok-atom"},{tag:he.bool,class:"tok-bool"},{tag:he.url,class:"tok-url"},{tag:he.labelName,class:"tok-labelName"},{tag:he.inserted,class:"tok-inserted"},{tag:he.deleted,class:"tok-deleted"},{tag:he.literal,class:"tok-literal"},{tag:he.string,class:"tok-string"},{tag:he.number,class:"tok-number"},{tag:[he.regexp,he.escape,he.special(he.string)],class:"tok-string2"},{tag:he.variableName,class:"tok-variableName"},{tag:he.local(he.variableName),class:"tok-variableName tok-local"},{tag:he.definition(he.variableName),class:"tok-variableName tok-definition"},{tag:he.special(he.variableName),class:"tok-variableName2"},{tag:he.definition(he.propertyName),class:"tok-propertyName tok-definition"},{tag:he.typeName,class:"tok-typeName"},{tag:he.namespace,class:"tok-namespace"},{tag:he.className,class:"tok-className"},{tag:he.macroName,class:"tok-macroName"},{tag:he.propertyName,class:"tok-propertyName"},{tag:he.operator,class:"tok-operator"},{tag:he.comment,class:"tok-comment"},{tag:he.meta,class:"tok-meta"},{tag:he.invalid,class:"tok-invalid"},{tag:he.punctuation,class:"tok-punctuation"}]);var Qy;const lc=new Et;function ZA(t){return He.define({combine:t?e=>e.concat(t):void 0})}const rX=new Et;class bi{constructor(e,n,r=[],s=""){this.data=e,this.name=s,Vt.prototype.hasOwnProperty("tree")||Object.defineProperty(Vt.prototype,"tree",{get(){return zr(this)}}),this.parser=n,this.extension=[go.of(this),Vt.languageData.of((i,l,c)=>{let d=s7(i,l,c),h=d.type.prop(lc);if(!h)return[];let m=i.facet(h),p=d.type.prop(rX);if(p){let x=d.resolve(l-d.from,c);for(let v of p)if(v.test(x,i)){let b=i.facet(v.facet);return v.type=="replace"?b:b.concat(m)}}return m})].concat(r)}isActiveAt(e,n,r=-1){return s7(e,n,r).type.prop(lc)==this.data}findRegions(e){let n=e.facet(go);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,l)=>{if(i.prop(lc)==this.data){r.push({from:l,to:l+i.length});return}let c=i.prop(Et.mounted);if(c){if(c.tree.prop(lc)==this.data){if(c.overlay)for(let d of c.overlay)r.push({from:d.from+l,to:d.to+l});else r.push({from:l,to:l+i.length});return}else if(c.overlay){let d=r.length;if(s(c.tree,c.overlay[0].from+l),r.length>d)return}}for(let d=0;dr.isTop?n:void 0)]}),e.name)}configure(e,n){return new jf(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function zr(t){let e=t.field(bi.state,!1);return e?e.tree:Dn.empty}class sX{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let zh=null;class md{constructor(e,n,r=[],s,i,l,c,d){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=l,this.skipped=c,this.scheduleOn=d,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new md(e,n,[],Dn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new sX(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Dn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(pc.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=zh;zh=this;try{return e()}finally{zh=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=i7(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:l,skipped:c}=this;if(this.takeTree(),!e.empty){let d=[];if(e.iterChangedRanges((h,m,p,x)=>d.push({fromA:h,toA:m,fromB:p,toB:x})),r=pc.applyChanges(r,d),s=Dn.empty,i=0,l={from:e.mapPos(l.from,-1),to:e.mapPos(l.to,1)},this.skipped.length){c=[];for(let h of this.skipped){let m=e.mapPos(h.from,1),p=e.mapPos(h.to,-1);me.from&&(this.fragments=i7(this.fragments,s,i),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends Bw{createParse(n,r,s){let i=s[0].from,l=s[s.length-1].to;return{parsedPos:i,advance(){let d=zh;if(d){for(let h of s)d.tempSkipped.push(h);e&&(d.scheduleOn=d.scheduleOn?Promise.all([d.scheduleOn,e]):e)}return this.parsedPos=l,new Dn(gs.none,[],[],l-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return zh}}function i7(t,e,n){return pc.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class pd{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new pd(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=md.create(e.facet(go).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new pd(r)}}bi.state=Br.define({create:pd.init,update(t,e){for(let n of e.effects)if(n.is(bi.setState))return n.value;return e.startState.facet(go)!=e.state.facet(go)?pd.init(e.state):t.apply(e)}});let JA=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(JA=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const $y=typeof navigator<"u"&&(!((Qy=navigator.scheduling)===null||Qy===void 0)&&Qy.isInputPending)?()=>navigator.scheduling.isInputPending():null,iX=lr.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(bi.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(bi.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=JA(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnds+1e3,d=i.context.work(()=>$y&&$y()||Date.now()>l,s+(c?0:1e5));this.chunkBudget-=Date.now()-n,(d||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:bi.setState.of(new pd(i.context))})),this.chunkBudget>0&&!(d&&!c)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Es(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),go=He.define({combine(t){return t.length?t[0]:null},enables:t=>[bi.state,iX,qe.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class eE{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const aX=He.define(),u0=He.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function kc(t){let e=t.facet(u0);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Nf(t,e){let n="",r=t.tabSize,s=t.facet(u0)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i=e?lX(t,n,e):null}class Nx{constructor(e,n={}){this.state=e,this.options=n,this.unit=kc(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==e?{text:"",from:e}:(n<0?s-1&&(i+=l-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return Td(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let l=i(s);if(l>-1)return l}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Cx=new Et;function lX(t,e,n){let r=e.resolveStack(n),s=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let l=s;l&&!(l.fromr.node.to||l.from==r.node.from&&l.type==r.node.type);l=l.parent)i.push(l);for(let l=i.length-1;l>=0;l--)r={node:i[l],next:r}}return tE(r,t,n)}function tE(t,e,n){for(let r=t;r;r=r.next){let s=cX(r.node);if(s)return s(qw.create(e,n,r))}return 0}function oX(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function cX(t){let e=t.type.prop(Cx);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Et.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return l=>nE(l,!0,1,void 0,i&&!oX(l)?s.from:void 0)}return t.parent==null?uX:null}function uX(){return 0}class qw extends Nx{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new qw(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(dX(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return tE(this.context.next,this.base,this.pos)}}function dX(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function hX(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let s=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),l=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let c=n.to;;){let d=e.childAfter(c);if(!d||d==r)return null;if(!d.type.isSkipped){if(d.from>=l)return null;let h=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+h}}c=d.to}}function Hy({closing:t,align:e=!0,units:n=1}){return r=>nE(r,e,n,t)}function nE(t,e,n,r,s){let i=t.textAfter,l=i.match(/^\s*/)[0].length,c=r&&i.slice(l,l+r.length)==r||s==t.pos+l,d=e?hX(t):null;return d?c?t.column(d.from):t.column(d.to):t.baseIndent+(c?0:t.unit*n)}function a7({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const fX=200;function mX(){return Vt.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,s=n.lineAt(r);if(r>s.from+fX)return t;let i=n.sliceString(s.from,r);if(!e.some(h=>h.test(i)))return t;let{state:l}=t,c=-1,d=[];for(let{head:h}of l.selection.ranges){let m=l.doc.lineAt(h);if(m.from==c)continue;c=m.from;let p=Iw(l,m.from);if(p==null)continue;let x=/^\s*/.exec(m.text)[0],v=Nf(l,p);x!=v&&d.push({from:m.from,to:m.from+x.length,insert:v})}return d.length?[t,{changes:d,sequential:!0}]:t})}const pX=He.define(),Fw=new Et;function rE(t){let e=t.firstChild,n=t.lastChild;return e&&e.ton)continue;if(i&&c.from=e&&h.to>n&&(i=h)}}return i}function xX(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function _g(t,e,n){for(let r of t.facet(pX)){let s=r(t,e,n);if(s)return s}return gX(t,e,n)}function sE(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const Tx=xt.define({map:sE}),d0=xt.define({map:sE});function iE(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const Oc=Br.define({create(){return Je.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=l7(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(Tx)&&!vX(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(oE),s=r?Je.replace({widget:new jX(r(e.state,n.value))}):o7;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(d0)&&(t=t.update({filter:(r,s)=>n.value.from!=r||n.value.to!=s,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=l7(t,e.selection.main.head)),t},provide:t=>qe.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,s)=>{n.push(r,s)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n{se&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(s,i)=>s>=n||i<=e}):t}function Dg(t,e,n){var r;let s=null;return(r=t.field(Oc,!1))===null||r===void 0||r.between(e,n,(i,l)=>{(!s||s.from>i)&&(s={from:i,to:l})}),s}function vX(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function aE(t,e){return t.field(Oc,!1)?e:e.concat(xt.appendConfig.of(cE()))}const yX=t=>{for(let e of iE(t)){let n=_g(t.state,e.from,e.to);if(n)return t.dispatch({effects:aE(t.state,[Tx.of(n),lE(t,n)])}),!0}return!1},bX=t=>{if(!t.state.field(Oc,!1))return!1;let e=[];for(let n of iE(t)){let r=Dg(t.state,n.from,n.to);r&&e.push(d0.of(r),lE(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function lE(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return qe.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const wX=t=>{let{state:e}=t,n=[];for(let r=0;r{let e=t.state.field(Oc,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(d0.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},kX=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:yX},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:bX},{key:"Ctrl-Alt-[",run:wX},{key:"Ctrl-Alt-]",run:SX}],OX={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},oE=He.define({combine(t){return ka(t,OX)}});function cE(t){return[Oc,TX]}function uE(t,e){let{state:n}=t,r=n.facet(oE),s=l=>{let c=t.lineBlockAt(t.posAtDOM(l.target)),d=Dg(t.state,c.from,c.to);d&&t.dispatch({effects:d0.of(d)}),l.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,s,e);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const o7=Je.replace({widget:new class extends Oa{toDOM(t){return uE(t,null)}}});class jX extends Oa{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return uE(e,this.value)}}const NX={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Uy extends pl{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function CX(t={}){let e={...NX,...t},n=new Uy(e,!0),r=new Uy(e,!1),s=lr.fromClass(class{constructor(l){this.from=l.viewport.from,this.markers=this.buildMarkers(l)}update(l){(l.docChanged||l.viewportChanged||l.startState.facet(go)!=l.state.facet(go)||l.startState.field(Oc,!1)!=l.state.field(Oc,!1)||zr(l.startState)!=zr(l.state)||e.foldingChanged(l))&&(this.markers=this.buildMarkers(l.view))}buildMarkers(l){let c=new fl;for(let d of l.viewportLineBlocks){let h=Dg(l.state,d.from,d.to)?r:_g(l.state,d.from,d.to)?n:null;h&&c.add(d.from,d.from,h)}return c.finish()}}),{domEventHandlers:i}=e;return[s,AG({class:"cm-foldGutter",markers(l){var c;return((c=l.plugin(s))===null||c===void 0?void 0:c.markers)||Gt.empty},initialSpacer(){return new Uy(e,!1)},domEventHandlers:{...i,click:(l,c,d)=>{if(i.click&&i.click(l,c,d))return!0;let h=Dg(l.state,c.from,c.to);if(h)return l.dispatch({effects:d0.of(h)}),!0;let m=_g(l.state,c.from,c.to);return m?(l.dispatch({effects:Tx.of(m)}),!0):!1}}}),cE()]}const TX=qe.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class h0{constructor(e,n){this.specs=e;let r;function s(c){let d=ho.newName();return(r||(r=Object.create(null)))["."+d]=c,d}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,l=n.scope;this.scope=l instanceof bi?c=>c.prop(lc)==l.data:l?c=>c==l:void 0,this.style=KA(e.map(c=>({tag:c.tag,class:c.class||s(Object.assign({},c,{tag:null}))})),{all:i}).style,this.module=r?new ho(r):null,this.themeType=n.themeType}static define(e,n){return new h0(e,n||{})}}const J2=He.define(),dE=He.define({combine(t){return t.length?[t[0]]:null}});function Vy(t){let e=t.facet(J2);return e.length?e:t.facet(dE)}function hE(t,e){let n=[AX],r;return t instanceof h0&&(t.module&&n.push(qe.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(dE.of(t)):r?n.push(J2.computeN([qe.darkTheme],s=>s.facet(qe.darkTheme)==(r=="dark")?[t]:[])):n.push(J2.of(t)),n}class MX{constructor(e){this.markCache=Object.create(null),this.tree=zr(e.state),this.decorations=this.buildDeco(e,Vy(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=zr(e.state),r=Vy(e.state),s=r!=Vy(e.startState),{viewport:i}=e.view,l=e.changes.mapPos(this.decoratedTo,1);n.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=l):(n!=this.tree||e.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return Je.none;let r=new fl;for(let{from:s,to:i}of e.visibleRanges)eX(this.tree,n,(l,c,d)=>{r.add(l,c,this.markCache[d]||(this.markCache[d]=Je.mark({class:d})))},s,i);return r.finish()}}const AX=jo.high(lr.fromClass(MX,{decorations:t=>t.decorations})),EX=h0.define([{tag:he.meta,color:"#404740"},{tag:he.link,textDecoration:"underline"},{tag:he.heading,textDecoration:"underline",fontWeight:"bold"},{tag:he.emphasis,fontStyle:"italic"},{tag:he.strong,fontWeight:"bold"},{tag:he.strikethrough,textDecoration:"line-through"},{tag:he.keyword,color:"#708"},{tag:[he.atom,he.bool,he.url,he.contentSeparator,he.labelName],color:"#219"},{tag:[he.literal,he.inserted],color:"#164"},{tag:[he.string,he.deleted],color:"#a11"},{tag:[he.regexp,he.escape,he.special(he.string)],color:"#e40"},{tag:he.definition(he.variableName),color:"#00f"},{tag:he.local(he.variableName),color:"#30a"},{tag:[he.typeName,he.namespace],color:"#085"},{tag:he.className,color:"#167"},{tag:[he.special(he.variableName),he.macroName],color:"#256"},{tag:he.definition(he.propertyName),color:"#00c"},{tag:he.comment,color:"#940"},{tag:he.invalid,color:"#f00"}]),_X=qe.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),fE=1e4,mE="()[]{}",pE=He.define({combine(t){return ka(t,{afterCursor:!0,brackets:mE,maxScanDistance:fE,renderMatch:zX})}}),DX=Je.mark({class:"cm-matchingBracket"}),RX=Je.mark({class:"cm-nonmatchingBracket"});function zX(t){let e=[],n=t.matched?DX:RX;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const PX=Br.define({create(){return Je.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(pE);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=ha(e.state,s.head,-1,r)||s.head>0&&ha(e.state,s.head-1,1,r)||r.afterCursor&&(ha(e.state,s.head,1,r)||s.headqe.decorations.from(t)}),BX=[PX,_X];function LX(t={}){return[pE.of(t),BX]}const IX=new Et;function e4(t,e,n){let r=t.prop(e<0?Et.openedBy:Et.closedBy);if(r)return r;if(t.name.length==1){let s=n.indexOf(t.name);if(s>-1&&s%2==(e<0?1:0))return[n[s+e]]}return null}function t4(t){let e=t.type.prop(IX);return e?e(t.node):t}function ha(t,e,n,r={}){let s=r.maxScanDistance||fE,i=r.brackets||mE,l=zr(t),c=l.resolveInner(e,n);for(let d=c;d;d=d.parent){let h=e4(d.type,n,i);if(h&&d.from0?e>=m.from&&em.from&&e<=m.to))return qX(t,e,n,d,m,h,i)}}return FX(t,e,n,l,c.type,s,i)}function qX(t,e,n,r,s,i,l){let c=r.parent,d={from:s.from,to:s.to},h=0,m=c?.cursor();if(m&&(n<0?m.childBefore(r.from):m.childAfter(r.to)))do if(n<0?m.to<=r.from:m.from>=r.to){if(h==0&&i.indexOf(m.type.name)>-1&&m.from0)return null;let h={from:n<0?e-1:e,to:n>0?e+1:e},m=t.doc.iterRange(e,n>0?t.doc.length:0),p=0;for(let x=0;!m.next().done&&x<=i;){let v=m.value;n<0&&(x+=v.length);let b=e+x*n;for(let k=n>0?0:v.length-1,O=n>0?v.length:-1;k!=O;k+=n){let j=l.indexOf(v[k]);if(!(j<0||r.resolveInner(b+k,1).type!=s))if(j%2==0==n>0)p++;else{if(p==1)return{start:h,end:{from:b+k,to:b+k+1},matched:j>>1==d>>1};p--}}n>0&&(x+=v.length)}return m.done?{start:h,matched:!1}:null}function c7(t,e,n,r=0,s=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let i=s;for(let l=r;l=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosr?l.toLowerCase():l,i=this.string.substr(this.pos,e.length);return s(i)==s(e)?(n!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&n!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function QX(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||$X,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||Hw,mergeTokens:t.mergeTokens!==!1}}function $X(t){if(typeof t!="object")return t;let e={};for(let n in t){let r=t[n];e[n]=r instanceof Array?r.slice():r}return e}const u7=new WeakMap;class Qw extends bi{constructor(e){let n=ZA(e.languageData),r=QX(e),s,i=new class extends Bw{createParse(l,c,d){return new UX(s,l,c,d)}};super(n,i,[],e.name),this.topNode=GX(n,this),s=this,this.streamParser=r,this.stateAfter=new Et({perNode:!0}),this.tokenTable=e.tokenTable?new bE(r.tokenTable):WX}static define(e){return new Qw(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=u7.get(e.state),n!=null&&n1e4)return null;for(;i=r&&n+e.length<=s&&e.prop(t.stateAfter);if(i)return{state:t.streamParser.copyState(i),pos:n+e.length};for(let l=e.children.length-1;l>=0;l--){let c=e.children[l],d=n+e.positions[l],h=c instanceof Dn&&d=e.length)return e;!s&&n==0&&e.type==t.topNode&&(s=!0);for(let i=e.children.length-1;i>=0;i--){let l=e.positions[i],c=e.children[i],d;if(ln&&$w(t,i.tree,0-i.offset,n,c),h;if(d&&d.pos<=r&&(h=xE(t,i.tree,n+i.offset,d.pos+i.offset,!1)))return{state:d.state,tree:h}}return{state:t.streamParser.startState(s?kc(s):4),tree:Dn.empty}}let UX=class{constructor(e,n,r,s){this.lang=e,this.input=n,this.fragments=r,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let i=md.get(),l=s[0].from,{state:c,tree:d}=HX(e,r,l,this.to,i?.state);this.state=c,this.parsedPos=this.chunkStart=l+d.length;for(let h=0;hh.from<=i.viewport.from&&h.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(kc(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=md.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos=n?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let n=this.input.chunk(e);if(this.input.lineChunks)n==` `&&(n="");else{let r=n.indexOf(` -`);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let s=this.rangeIndex;;){let i=this.ranges[s].to;if(i>=r||(n=n.slice(0,i-(r-n.length)),s++,s==this.ranges.length))break;let l=this.ranges[s].from,c=this.lineAfter(l);n+=c,r=l+c.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let s=this.ranges[this.rangeIndex].to,i=e+n;if(r>0?s>i:s>=i)break;let l=this.ranges[++this.rangeIndex].from;n+=l-s}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){s=this.skipGapsTo(n,s,1),n+=s;let c=this.chunk.length;s=this.skipGapsTo(r,s,-1),r+=s,i+=this.chunk.length-c}let l=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&l>=0&&this.chunk[l]==e&&this.chunk[l+2]==n?this.chunk[l+2]=r:this.chunk.push(e,n,r,i),s}parseLine(e){let{line:n,end:r}=this.nextLine(),s=0,{streamParser:i}=this.lang,l=new gE(n,e?e.state.tabSize:4,e?kc(e.state):2);if(l.eol())i.blankLine(this.state,l.indentUnit);else for(;!l.eol();){let c=vE(i.token,l,this.state);if(c&&(s=this.emitToken(this.lang.tokenTable.resolve(c),this.parsedPos+l.start,this.parsedPos+l.pos,s)),l.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const Hw=Object.create(null),Cf=[gs.none],VX=new jx(Cf),d7=[],h7=Object.create(null),yE=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])yE[t]=wE(Hw,e);class bE{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),yE)}resolve(e){return e?this.table[e]||(this.table[e]=wE(this.extra,e)):0}}const WX=new bE(Hw);function Wy(t,e){d7.indexOf(t)>-1||(d7.push(t),console.warn(e))}function wE(t,e){let n=[];for(let c of e.split(" ")){let d=[];for(let h of c.split(".")){let m=t[h]||he[h];m?typeof m=="function"?d.length?d=d.map(m):Wy(h,`Modifier ${h} used at start of tag`):d.length?Wy(h,`Tag ${h} used as modifier`):d=Array.isArray(m)?m:[m]:Wy(h,`Unknown highlighting tag ${h}`)}for(let h of d)n.push(h)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(c=>c.id),i=h7[s];if(i)return i.id;let l=h7[s]=gs.define({id:Cf.length,name:r,props:[Lw({[r]:n})]});return Cf.push(l),l.id}function GX(t,e){let n=gs.define({id:Cf.length,name:"Document",props:[oc.add(()=>t),Cx.add(()=>r=>e.getIndent(r))],top:!0});return Cf.push(n),n}Hn.RTL,Hn.LTR;const XX=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Vw(t.state,n.from);return r.line?YX(t):r.block?ZX(t):!1};function Uw(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=t(e,n);return s?(r(n.update(s)),!0):!1}}const YX=Uw(tY,0),KX=Uw(SE,0),ZX=Uw((t,e)=>SE(t,e,eY(e)),0);function Vw(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Ph=50;function JX(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-Ph,r),l=t.sliceDoc(s,s+Ph),c=/\s*$/.exec(i)[0].length,d=/^\s*/.exec(l)[0].length,h=i.length-c;if(i.slice(h-e.length,h)==e&&l.slice(d,d+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:s+d,margin:d&&1}};let m,p;s-r<=2*Ph?m=p=t.sliceDoc(r,s):(m=t.sliceDoc(r,r+Ph),p=t.sliceDoc(s-Ph,s));let x=/^\s*/.exec(m)[0].length,v=/\s*$/.exec(p)[0].length,b=p.length-v-n.length;return m.slice(x,x+e.length)==e&&p.slice(b,b+n.length)==n?{open:{pos:r+x+e.length,margin:/\s/.test(m.charAt(x+e.length))?1:0},close:{pos:s-v-n.length,margin:/\s/.test(p.charAt(b-1))?1:0}}:null}function eY(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),s=n.to<=r.to?r:t.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>r.from?e[i].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function SE(t,e,n=e.selection.ranges){let r=n.map(i=>Vw(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,l)=>JX(e,r[l],i.from,i.to));if(t!=2&&!s.every(i=>i))return{changes:e.changes(n.map((i,l)=>s[l]?[]:[{from:i.from,insert:r[l].open+" "},{from:i.to,insert:" "+r[l].close}]))};if(t!=1&&s.some(i=>i)){let i=[];for(let l=0,c;ls&&(i==l||l>p.from)){s=p.from;let x=/^\s*/.exec(p.text)[0].length,v=x==p.length,b=p.text.slice(x,x+h.length)==h?x:-1;xi.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:c,token:d,indent:h,empty:m,single:p}of r)(p||!m)&&i.push({from:c.from+h,insert:d+" "});let l=e.changes(i);return{changes:l,selection:e.selection.map(l,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:l,comment:c,token:d}of r)if(c>=0){let h=l.from+c,m=h+d.length;l.text[m-l.from]==" "&&m++,i.push({from:h,to:m})}return{changes:i}}return null}const n4=ka.define(),nY=ka.define(),rY=He.define(),kE=He.define({combine(t){return Oa(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,s)=>e(r,s)||n(r,s)})}}),OE=Br.define({create(){return ma.empty},update(t,e){let n=e.state.facet(kE),r=e.annotation(n4);if(r){let d=Ds.fromTransaction(e,r.selection),h=r.side,m=h==0?t.undone:t.done;return d?m=Rg(m,m.length,n.minDepth,d):m=CE(m,e.startState.selection),new ma(h==0?r.rest:m,h==0?m:r.rest)}let s=e.annotation(nY);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(gr.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=Ds.fromTransaction(e),l=e.annotation(gr.time),c=e.annotation(gr.userEvent);return i?t=t.addChanges(i,l,c,n,e):e.selection&&(t=t.addSelection(e.startState.selection,l,c,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new ma(t.done.map(Ds.fromJSON),t.undone.map(Ds.fromJSON))}});function sY(t={}){return[OE,kE.of(t),qe.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?jE:e.inputType=="historyRedo"?r4:null;return r?(e.preventDefault(),r(n)):!1}})]}function Ax(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(OE,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const jE=Ax(0,!1),r4=Ax(1,!1),iY=Ax(0,!0),aY=Ax(1,!0);class Ds{constructor(e,n,r,s,i){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(e){return new Ds(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new Ds(e.changes&&kr.fromJSON(e.changes),[],e.mapped&&va.fromJSON(e.mapped),e.startSelection&&Ce.fromJSON(e.startSelection),e.selectionsAfter.map(Ce.fromJSON))}static fromTransaction(e,n){let r=Si;for(let s of e.startState.facet(rY)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new Ds(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,Si)}static selection(e){return new Ds(void 0,Si,void 0,void 0,e)}}function Rg(t,e,n,r){let s=e+1>n+20?e-n-1:0,i=t.slice(s,e);return i.push(r),i}function lY(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,l,c)=>{for(let d=0;d=h&&l<=m&&(r=!0)}}),r}function oY(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function NE(t,e){return t.length?e.length?t.concat(e):t:e}const Si=[],cY=200;function CE(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-cY));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Rg(t,t.length-1,1e9,n.setSelAfter(r)))}else return[Ds.selection([e])]}function uY(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Gy(t,e){if(!t.length)return t;let n=t.length,r=Si;for(;n;){let s=dY(t[n-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=t.slice(0,n);return i[n-1]=s,i}else e=s.mapped,n--,r=s.selectionsAfter}return r.length?[Ds.selection(r)]:Si}function dY(t,e,n){let r=NE(t.selectionsAfter.length?t.selectionsAfter.map(c=>c.map(e)):Si,n);if(!t.changes)return Ds.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),l=t.mapped?t.mapped.composeDesc(i):i;return new Ds(s,vt.mapEffects(t.effects,e),l,t.startSelection.map(i),r)}const hY=/^(input\.type|delete)($|\.)/;class ma{constructor(e,n,r=0,s=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new ma(this.done,this.undone):this}addChanges(e,n,r,s,i){let l=this.done,c=l[l.length-1];return c&&c.changes&&!c.changes.empty&&e.changes&&(!r||hY.test(r))&&(!c.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):Mx(n,e))}function is(t){return t.textDirectionAt(t.state.selection.main.head)==Hn.LTR}const AE=t=>TE(t,!is(t)),ME=t=>TE(t,is(t));function EE(t,e){return Xi(t,n=>n.empty?t.moveByGroup(n,e):Mx(n,e))}const mY=t=>EE(t,!is(t)),pY=t=>EE(t,is(t));function gY(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Ex(t,e,n){let r=zr(t).resolveInner(e.head),s=n?Et.closedBy:Et.openedBy;for(let d=e.head;;){let h=n?r.childAfter(d):r.childBefore(d);if(!h)break;gY(t,h,s)?r=h:d=n?h.to:h.from}let i=r.type.prop(s),l,c;return i&&(l=n?fa(t,r.from,1):fa(t,r.to,-1))&&l.matched?c=n?l.end.to:l.end.from:c=n?r.to:r.from,Ce.cursor(c,n?-1:1)}const xY=t=>Xi(t,e=>Ex(t.state,e,!is(t))),vY=t=>Xi(t,e=>Ex(t.state,e,is(t)));function _E(t,e){return Xi(t,n=>{if(!n.empty)return Mx(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const DE=t=>_E(t,!1),RE=t=>_E(t,!0);function zE(t){let e=t.scrollDOM.clientHeightl.empty?t.moveVertically(l,e,n.height):Mx(l,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let l=t.coordsAtPos(r.selection.main.head),c=t.scrollDOM.getBoundingClientRect(),d=c.top+n.marginTop,h=c.bottom-n.marginBottom;l&&l.top>d&&l.bottomPE(t,!1),s4=t=>PE(t,!0);function Co(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(s=Ce.cursor(r.from+i))}return s}const yY=t=>Xi(t,e=>Co(t,e,!0)),bY=t=>Xi(t,e=>Co(t,e,!1)),wY=t=>Xi(t,e=>Co(t,e,!is(t))),SY=t=>Xi(t,e=>Co(t,e,is(t))),kY=t=>Xi(t,e=>Ce.cursor(t.lineBlockAt(e.head).from,1)),OY=t=>Xi(t,e=>Ce.cursor(t.lineBlockAt(e.head).to,-1));function jY(t,e,n){let r=!1,s=Ad(t.selection,i=>{let l=fa(t,i.head,-1)||fa(t,i.head,1)||i.head>0&&fa(t,i.head-1,1)||i.headjY(t,e);function _i(t,e){let n=Ad(t.state.selection,r=>{let s=e(r);return Ce.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(Gi(t.state,n)),!0)}function BE(t,e){return _i(t,n=>t.moveByChar(n,e))}const LE=t=>BE(t,!is(t)),IE=t=>BE(t,is(t));function qE(t,e){return _i(t,n=>t.moveByGroup(n,e))}const CY=t=>qE(t,!is(t)),TY=t=>qE(t,is(t)),AY=t=>_i(t,e=>Ex(t.state,e,!is(t))),MY=t=>_i(t,e=>Ex(t.state,e,is(t)));function FE(t,e){return _i(t,n=>t.moveVertically(n,e))}const QE=t=>FE(t,!1),$E=t=>FE(t,!0);function HE(t,e){return _i(t,n=>t.moveVertically(n,e,zE(t).height))}const m7=t=>HE(t,!1),p7=t=>HE(t,!0),EY=t=>_i(t,e=>Co(t,e,!0)),_Y=t=>_i(t,e=>Co(t,e,!1)),DY=t=>_i(t,e=>Co(t,e,!is(t))),RY=t=>_i(t,e=>Co(t,e,is(t))),zY=t=>_i(t,e=>Ce.cursor(t.lineBlockAt(e.head).from)),PY=t=>_i(t,e=>Ce.cursor(t.lineBlockAt(e.head).to)),g7=({state:t,dispatch:e})=>(e(Gi(t,{anchor:0})),!0),x7=({state:t,dispatch:e})=>(e(Gi(t,{anchor:t.doc.length})),!0),v7=({state:t,dispatch:e})=>(e(Gi(t,{anchor:t.selection.main.anchor,head:0})),!0),y7=({state:t,dispatch:e})=>(e(Gi(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),BY=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),LY=({state:t,dispatch:e})=>{let n=_x(t).map(({from:r,to:s})=>Ce.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Ce.create(n),userEvent:"select"})),!0},IY=({state:t,dispatch:e})=>{let n=Ad(t.selection,r=>{let s=zr(t),i=s.resolveStack(r.from,1);if(r.empty){let l=s.resolveStack(r.from,-1);l.node.from>=i.node.from&&l.node.to<=i.node.to&&(i=l)}for(let l=i;l;l=l.next){let{node:c}=l;if((c.from=r.to||c.to>r.to&&c.from<=r.from)&&l.next)return Ce.range(c.to,c.from)}return r});return n.eq(t.selection)?!1:(e(Gi(t,n)),!0)};function UE(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let l=n.doc.lineAt(i.head);if(e?l.to0)for(let c=i;;){let d=t.moveVertically(c,e);if(d.headl.to){s.some(h=>h.head==d.head)||s.push(d);break}else{if(d.head==c.head)break;c=d}}}return s.length==r.ranges.length?!1:(t.dispatch(Gi(n,Ce.create(s,s.length-1))),!0)}const qY=t=>UE(t,!1),FY=t=>UE(t,!0),QY=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Ce.create([n.main]):n.main.empty||(r=Ce.create([Ce.cursor(n.main.head)])),r?(e(Gi(t,r)),!0):!1};function f0(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:l,to:c}=i;if(l==c){let d=e(i);dl&&(n="delete.forward",d=xp(t,d,!0)),l=Math.min(l,d),c=Math.max(c,d)}else l=xp(t,l,!1),c=xp(t,c,!0);return l==c?{range:i}:{changes:{from:l,to:c},range:Ce.cursor(l,ls(t)))r.between(e,e,(s,i)=>{se&&(e=n?i:s)});return e}const VE=(t,e,n)=>f0(t,r=>{let s=r.from,{state:i}=t,l=i.doc.lineAt(s),c,d;if(n&&!e&&s>l.from&&sVE(t,!1,!0),WE=t=>VE(t,!0,!1),GE=(t,e)=>f0(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),l=s.charCategorizer(r);for(let c=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let d=Vr(i.text,r-i.from,e)+i.from,h=i.text.slice(Math.min(r,d)-i.from,Math.max(r,d)-i.from),m=l(h);if(c!=null&&m!=c)break;(h!=" "||r!=n.head)&&(c=m),r=d}return r}),XE=t=>GE(t,!1),$Y=t=>GE(t,!0),HY=t=>f0(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headf0(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),VY=t=>f0(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Xt.of(["",""])},range:Ce.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},GY=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,i=t.doc.lineAt(s),l=s==i.from?s-1:Vr(i.text,s-i.from,!1)+i.from,c=s==i.to?s+1:Vr(i.text,s-i.from,!0)+i.from;return{changes:{from:l,to:c,insert:t.doc.slice(s,c).append(t.doc.slice(l,s))},range:Ce.cursor(c)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function _x(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=s.number){let l=e[e.length-1];l.to=i.to,l.ranges.push(r)}else e.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return e}function YE(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of _x(t)){if(n?i.to==t.doc.length:i.from==0)continue;let l=t.doc.lineAt(n?i.to+1:i.from-1),c=l.length+1;if(n){r.push({from:i.to,to:l.to},{from:i.from,insert:l.text+t.lineBreak});for(let d of i.ranges)s.push(Ce.range(Math.min(t.doc.length,d.anchor+c),Math.min(t.doc.length,d.head+c)))}else{r.push({from:l.from,to:i.from},{from:i.to,insert:t.lineBreak+l.text});for(let d of i.ranges)s.push(Ce.range(d.anchor-c,d.head-c))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Ce.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const XY=({state:t,dispatch:e})=>YE(t,e,!1),YY=({state:t,dispatch:e})=>YE(t,e,!0);function KE(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of _x(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const KY=({state:t,dispatch:e})=>KE(t,e,!1),ZY=({state:t,dispatch:e})=>KE(t,e,!0),JY=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(_x(e).map(({from:s,to:i})=>(s>0?s--:i{let i;if(t.lineWrapping){let l=t.lineBlockAt(s.head),c=t.coordsAtPos(s.head,s.assoc||1);c&&(i=l.bottom+t.documentTop-c.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function eK(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=zr(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e),i;return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(Et.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const b7=ZE(!1),tK=ZE(!0);function ZE(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:l}=s,c=e.doc.lineAt(i),d=!t&&i==l&&eK(e,i);t&&(i=l=(l<=c.to?c:e.doc.lineAt(l)).to);let h=new Nx(e,{simulateBreak:i,simulateDoubleBreak:!!d}),m=Iw(h,i);for(m==null&&(m=Td(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));lc.from&&i{let s=[];for(let l=r.from;l<=r.to;){let c=t.doc.lineAt(l);c.number>n&&(r.empty||r.to>c.from)&&(e(c,s,r),n=c.number),l=c.to+1}let i=t.changes(s);return{changes:s,range:Ce.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const nK=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Nx(t,{overrideIndentation:i=>{let l=n[i];return l??-1}}),s=Ww(t,(i,l,c)=>{let d=Iw(r,i.from);if(d==null)return;/\S/.test(i.text)||(d=0);let h=/^\s*/.exec(i.text)[0],m=Nf(t,d);(h!=m||c.fromt.readOnly?!1:(e(t.update(Ww(t,(n,r)=>{r.push({from:n.from,insert:t.facet(u0)})}),{userEvent:"input.indent"})),!0),e_=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Ww(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Td(s,t.tabSize),l=0,c=Nf(t,Math.max(0,i-kc(t)));for(;l(t.setTabFocusMode(),!0),sK=[{key:"Ctrl-b",run:AE,shift:LE,preventDefault:!0},{key:"Ctrl-f",run:ME,shift:IE},{key:"Ctrl-p",run:DE,shift:QE},{key:"Ctrl-n",run:RE,shift:$E},{key:"Ctrl-a",run:kY,shift:zY},{key:"Ctrl-e",run:OY,shift:PY},{key:"Ctrl-d",run:WE},{key:"Ctrl-h",run:i4},{key:"Ctrl-k",run:HY},{key:"Ctrl-Alt-h",run:XE},{key:"Ctrl-o",run:WY},{key:"Ctrl-t",run:GY},{key:"Ctrl-v",run:s4}],iK=[{key:"ArrowLeft",run:AE,shift:LE,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:mY,shift:CY,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:wY,shift:DY,preventDefault:!0},{key:"ArrowRight",run:ME,shift:IE,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:pY,shift:TY,preventDefault:!0},{mac:"Cmd-ArrowRight",run:SY,shift:RY,preventDefault:!0},{key:"ArrowUp",run:DE,shift:QE,preventDefault:!0},{mac:"Cmd-ArrowUp",run:g7,shift:v7},{mac:"Ctrl-ArrowUp",run:f7,shift:m7},{key:"ArrowDown",run:RE,shift:$E,preventDefault:!0},{mac:"Cmd-ArrowDown",run:x7,shift:y7},{mac:"Ctrl-ArrowDown",run:s4,shift:p7},{key:"PageUp",run:f7,shift:m7},{key:"PageDown",run:s4,shift:p7},{key:"Home",run:bY,shift:_Y,preventDefault:!0},{key:"Mod-Home",run:g7,shift:v7},{key:"End",run:yY,shift:EY,preventDefault:!0},{key:"Mod-End",run:x7,shift:y7},{key:"Enter",run:b7,shift:b7},{key:"Mod-a",run:BY},{key:"Backspace",run:i4,shift:i4,preventDefault:!0},{key:"Delete",run:WE,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:XE,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:$Y,preventDefault:!0},{mac:"Mod-Backspace",run:UY,preventDefault:!0},{mac:"Mod-Delete",run:VY,preventDefault:!0}].concat(sK.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),aK=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:xY,shift:AY},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:vY,shift:MY},{key:"Alt-ArrowUp",run:XY},{key:"Shift-Alt-ArrowUp",run:KY},{key:"Alt-ArrowDown",run:YY},{key:"Shift-Alt-ArrowDown",run:ZY},{key:"Mod-Alt-ArrowUp",run:qY},{key:"Mod-Alt-ArrowDown",run:FY},{key:"Escape",run:QY},{key:"Mod-Enter",run:tK},{key:"Alt-l",mac:"Ctrl-l",run:LY},{key:"Mod-i",run:IY,preventDefault:!0},{key:"Mod-[",run:e_},{key:"Mod-]",run:JE},{key:"Mod-Alt-\\",run:nK},{key:"Shift-Mod-k",run:JY},{key:"Shift-Mod-\\",run:NY},{key:"Mod-/",run:XX},{key:"Alt-A",run:KX},{key:"Ctrl-m",mac:"Shift-Alt-m",run:rK}].concat(iK),lK={key:"Tab",run:JE,shift:e_},w7=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class gd{constructor(e,n,r=0,s=e.length,i,l){this.test=l,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=i?c=>i(w7(c)):w7,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return As(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=yw(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=oa(e);let s=this.normalize(n);if(s.length)for(let i=0,l=r;;i++){let c=s.charCodeAt(i),d=this.match(c,l,this.bufferPos+this.bufferStart);if(i==s.length-1){if(d)return this.value=d,this;break}l==r&&ithis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=zg(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||s.to<=n){let c=new Yu(n,e.sliceString(n,r));return Xy.set(e,c),c}if(s.from==n&&s.to==r)return s;let{text:i,from:l}=s;return l>n&&(i=e.sliceString(n,l)+i,l=n),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=zg(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Yu.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(n_.prototype[Symbol.iterator]=r_.prototype[Symbol.iterator]=function(){return this});function oK(t){try{return new RegExp(t,Gw),!0}catch{return!1}}function zg(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function a4(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=Mn("input",{class:"cm-textfield",name:"line",value:e}),r=Mn("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),t.dispatch({effects:sf.of(!1)}),t.focus()):i.keyCode==13&&(i.preventDefault(),s())},onsubmit:i=>{i.preventDefault(),s()}},Mn("label",t.state.phrase("Go to line"),": ",n)," ",Mn("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),Mn("button",{name:"close",onclick:()=>{t.dispatch({effects:sf.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function s(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!i)return;let{state:l}=t,c=l.doc.lineAt(l.selection.main.head),[,d,h,m,p]=i,x=m?+m.slice(1):0,v=h?+h:c.number;if(h&&p){let O=v/100;d&&(O=O*(d=="-"?-1:1)+c.number/l.doc.lines),v=Math.round(l.doc.lines*O)}else h&&d&&(v=v*(d=="-"?-1:1)+c.number);let b=l.doc.line(Math.max(1,Math.min(l.doc.lines,v))),k=Ce.cursor(b.from+Math.max(0,Math.min(x,b.length)));t.dispatch({effects:[sf.of(!1),qe.scrollIntoView(k.from,{y:"center"})],selection:k}),t.focus()}return{dom:r}}const sf=vt.define(),S7=Br.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(sf)&&(t=n.value);return t},provide:t=>Sf.from(t,e=>e?a4:null)}),cK=t=>{let e=wf(t,a4);if(!e){let n=[sf.of(!0)];t.state.field(S7,!1)==null&&n.push(vt.appendConfig.of([S7,uK])),t.dispatch({effects:n}),e=wf(t,a4)}return e&&e.dom.querySelector("input").select(),!0},uK=qe.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),dK={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},hK=He.define({combine(t){return Oa(t,dK,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function fK(t){return[vK,xK]}const mK=Je.mark({class:"cm-selectionMatch"}),pK=Je.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function k7(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Vn.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Vn.Word)}function gK(t,e,n,r){return t(e.sliceDoc(n,n+1))==Vn.Word&&t(e.sliceDoc(r-1,r))==Vn.Word}const xK=lr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(hK),{state:n}=t,r=n.selection;if(r.ranges.length>1)return Je.none;let s=r.main,i,l=null;if(s.empty){if(!e.highlightWordAroundCursor)return Je.none;let d=n.wordAt(s.head);if(!d)return Je.none;l=n.charCategorizer(s.head),i=n.sliceDoc(d.from,d.to)}else{let d=s.to-s.from;if(d200)return Je.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),l=n.charCategorizer(s.head),!(k7(l,n,s.from,s.to)&&gK(l,n,s.from,s.to)))return Je.none}else if(i=n.sliceDoc(s.from,s.to),!i)return Je.none}let c=[];for(let d of t.visibleRanges){let h=new gd(n.doc,i,d.from,d.to);for(;!h.next().done;){let{from:m,to:p}=h.value;if((!l||k7(l,n,m,p))&&(s.empty&&m<=s.from&&p>=s.to?c.push(pK.range(m,p)):(m>=s.to||p<=s.from)&&c.push(mK.range(m,p)),c.length>e.maxMatches))return Je.none}}return Je.set(c)}},{decorations:t=>t.decorations}),vK=qe.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),yK=({state:t,dispatch:e})=>{let{selection:n}=t,r=Ce.create(n.ranges.map(s=>t.wordAt(s.head)||Ce.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function bK(t,e){let{main:n,ranges:r}=t.selection,s=t.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let l=!1,c=new gd(t.doc,e,r[r.length-1].to);;)if(c.next(),c.done){if(l)return null;c=new gd(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),l=!0}else{if(l&&r.some(d=>d.from==c.value.from))continue;if(i){let d=t.wordAt(c.value.from);if(!d||d.from!=c.value.from||d.to!=c.value.to)continue}return c.value}}const wK=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return yK({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=r))return!1;let s=bK(t,r);return s?(e(t.update({selection:t.selection.addRange(Ce.range(s.from,s.to),!1),effects:qe.scrollIntoView(s.to)})),!0):!1},Md=He.define({combine(t){return Oa(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new DK(e),scrollToMatch:e=>qe.scrollIntoView(e)})}});class s_{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||oK(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?` -`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new jK(this):new kK(this)}getCursor(e,n=0,r){let s=e.doc?e:Vt.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?zu(this,s,n,r):Ru(this,s,n,r)}}class i_{constructor(e){this.spec=e}}function Ru(t,e,n,r){return new gd(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?SK(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function SK(t,e){return(n,r,s,i)=>((i>n||i+s.length=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=Ru(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}function zu(t,e,n,r){return new n_(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?OK(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function Pg(t,e){return t.slice(Vr(t,e,!1),e)}function Bg(t,e){return t.slice(e,Vr(t,e))}function OK(t){return(e,n,r)=>!r[0].length||(t(Pg(r.input,r.index))!=Vn.Word||t(Bg(r.input,r.index))!=Vn.Word)&&(t(Bg(r.input,r.index+r[0].length))!=Vn.Word||t(Pg(r.input,r.index+r[0].length))!=Vn.Word)}class jK extends i_{nextMatch(e,n,r){let s=zu(this.spec,e,r,e.doc.length).next();return s.done&&(s=zu(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),l=zu(this.spec,e,i,r),c=null;for(;!l.next().done;)c=l.value;if(c&&(i==n||c.from>i+10))return c;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=zu(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}const Tf=vt.define(),Xw=vt.define(),lo=Br.define({create(t){return new Yy(l4(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Tf)?t=new Yy(n.value.create(),t.panel):n.is(Xw)&&(t=new Yy(t.query,n.value?Yw:null));return t},provide:t=>Sf.from(t,e=>e.panel)});class Yy{constructor(e,n){this.query=e,this.panel=n}}const NK=Je.mark({class:"cm-searchMatch"}),CK=Je.mark({class:"cm-searchMatch cm-searchMatch-selected"}),TK=lr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(lo))}update(t){let e=t.state.field(lo);(e!=t.startState.field(lo)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return Je.none;let{view:n}=this,r=new ml;for(let s=0,i=n.visibleRanges,l=i.length;si[s+1].from-500;)d=i[++s].to;t.highlight(n.state,c,d,(h,m)=>{let p=n.state.selection.ranges.some(x=>x.from==h&&x.to==m);r.add(h,m,p?CK:NK)})}return r.finish()}},{decorations:t=>t.decorations});function m0(t){return e=>{let n=e.state.field(lo,!1);return n&&n.query.spec.valid?t(e,n):o_(e)}}const Lg=m0((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=Ce.single(r.from,r.to),i=t.state.facet(Md);return t.dispatch({selection:s,effects:[Kw(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),l_(t),!0}),Ig=m0((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=Ce.single(s.from,s.to),l=t.state.facet(Md);return t.dispatch({selection:i,effects:[Kw(t,s),l.scrollToMatch(i.main,t)],userEvent:"select.search"}),l_(t),!0}),AK=m0((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Ce.create(n.map(r=>Ce.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),MK=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],l=0;for(let c=new gd(t.doc,t.sliceDoc(r,s));!c.next().done;){if(i.length>1e3)return!1;c.value.from==r&&(l=i.length),i.push(Ce.range(c.value.from,c.value.to))}return e(t.update({selection:Ce.create(i,l),userEvent:"select.search.matches"})),!0},O7=m0((t,{query:e})=>{let{state:n}=t,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,r,r);if(!i)return!1;let l=i,c=[],d,h,m=[];l.from==r&&l.to==s&&(h=n.toText(e.getReplacement(l)),c.push({from:l.from,to:l.to,insert:h}),l=e.nextMatch(n,l.from,l.to),m.push(qe.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let p=t.state.changes(c);return l&&(d=Ce.single(l.from,l.to).map(p),m.push(Kw(t,l)),m.push(n.facet(Md).scrollToMatch(d.main,t))),t.dispatch({changes:p,selection:d,effects:m,userEvent:"input.replace"}),!0}),EK=m0((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(s=>{let{from:i,to:l}=s;return{from:i,to:l,insert:e.getReplacement(s)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:qe.announce.of(r),userEvent:"input.replace.all"}),!0});function Yw(t){return t.state.facet(Md).createPanel(t)}function l4(t,e){var n,r,s,i,l;let c=t.selection.main,d=c.empty||c.to>c.from+100?"":t.sliceDoc(c.from,c.to);if(e&&!d)return e;let h=t.facet(Md);return new s_({search:((n=e?.literal)!==null&&n!==void 0?n:h.literal)?d:d.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:h.regexp,wholeWord:(l=e?.wholeWord)!==null&&l!==void 0?l:h.wholeWord})}function a_(t){let e=wf(t,Yw);return e&&e.dom.querySelector("[main-field]")}function l_(t){let e=a_(t);e&&e==t.root.activeElement&&e.select()}const o_=t=>{let e=t.state.field(lo,!1);if(e&&e.panel){let n=a_(t);if(n&&n!=t.root.activeElement){let r=l4(t.state,e.query.spec);r.valid&&t.dispatch({effects:Tf.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[Xw.of(!0),e?Tf.of(l4(t.state,e.query.spec)):vt.appendConfig.of(zK)]});return!0},c_=t=>{let e=t.state.field(lo,!1);if(!e||!e.panel)return!1;let n=wf(t,Yw);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Xw.of(!1)}),!0},_K=[{key:"Mod-f",run:o_,scope:"editor search-panel"},{key:"F3",run:Lg,shift:Ig,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Lg,shift:Ig,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:c_,scope:"editor search-panel"},{key:"Mod-Shift-l",run:MK},{key:"Mod-Alt-g",run:cK},{key:"Mod-d",run:wK,preventDefault:!0}];class DK{constructor(e){this.view=e;let n=this.query=e.state.field(lo).query.spec;this.commit=this.commit.bind(this),this.searchField=Mn("input",{value:n.search,placeholder:Ys(e,"Find"),"aria-label":Ys(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mn("input",{value:n.replace,placeholder:Ys(e,"Replace"),"aria-label":Ys(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mn("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Mn("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Mn("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,l){return Mn("button",{class:"cm-button",name:s,onclick:i,type:"button"},l)}this.dom=Mn("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>Lg(e),[Ys(e,"next")]),r("prev",()=>Ig(e),[Ys(e,"previous")]),r("select",()=>AK(e),[Ys(e,"all")]),Mn("label",null,[this.caseField,Ys(e,"match case")]),Mn("label",null,[this.reField,Ys(e,"regexp")]),Mn("label",null,[this.wordField,Ys(e,"by word")]),...e.state.readOnly?[]:[Mn("br"),this.replaceField,r("replace",()=>O7(e),[Ys(e,"replace")]),r("replaceAll",()=>EK(e),[Ys(e,"replace all")])],Mn("button",{name:"close",onclick:()=>c_(e),"aria-label":Ys(e,"close"),type:"button"},["×"])])}commit(){let e=new s_({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Tf.of(e)}))}keydown(e){LW(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ig:Lg)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),O7(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Tf)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Md).top}}function Ys(t,e){return t.state.phrase(e)}const vp=30,yp=/[\s\.,:;?!]/;function Kw(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),s=t.state.doc.lineAt(n).to,i=Math.max(r.from,e-vp),l=Math.min(s,n+vp),c=t.state.sliceDoc(i,l);if(i!=r.from){for(let d=0;dc.length-vp;d--)if(!yp.test(c[d-1])&&yp.test(c[d])){c=c.slice(0,d);break}}return qe.announce.of(`${t.state.phrase("current match")}. ${c} ${t.state.phrase("on line")} ${r.number}.`)}const RK=qe.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),zK=[lo,No.low(TK),RK];class u_{constructor(e,n,r,s){this.state=e,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=zr(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(h_(e,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function j7(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function PK(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;itypeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:PK(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function BK(t,e){return n=>{for(let r=zr(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}let N7=class{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}};function gc(t){return t.selection.main.from}function h_(t,e){var n;let{source:r}=t,s=e&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const Zw=ka.define();function LK(t,e,n,r){let{main:s}=t.selection,i=n-s.from,l=r-s.from;return{...t.changeByRange(c=>{if(c!=s&&n!=r&&t.sliceDoc(c.from+i,c.from+l)!=t.sliceDoc(n,r))return{range:c};let d=t.toText(e);return{changes:{from:c.from+i,to:r==s.from?c.to:c.from+l,insert:d},range:Ce.cursor(c.from+i+d.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const C7=new WeakMap;function IK(t){if(!Array.isArray(t))return t;let e=C7.get(t);return e||C7.set(t,e=d_(t)),e}const qg=vt.define(),Af=vt.define();class qK{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&D<=57||D>=97&&D<=122?2:D>=65&&D<=90?1:0:(E=yw(D))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!T||z==1&&O||_==0&&z!=0)&&(n[p]==D||r[p]==D&&(x=!0)?l[p++]=T:l.length&&(j=!1)),_=z,T+=oa(D)}return p==d&&l[0]==0&&j?this.result(-100+(x?-200:0),l,e):v==d&&b==0?this.ret(-200-e.length+(k==e.length?0:-100),[0,k]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):v==d?this.ret(-900-e.length,[b,k]):p==d?this.result(-100+(x?-200:0)+-700+(j?0:-1100),l,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let l of n){let c=l+(this.astral?oa(As(r,l)):1);i&&s[i-1]==l?s[i-1]=c:(s[i++]=l,s[i++]=c)}return this.ret(e-r.length,s)}}class FK{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:QK,filterStrict:!1,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>T7(e(r),n(r)),optionClass:(e,n)=>r=>T7(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function T7(t,e){return t?e?t+" "+e:t:e}function QK(t,e,n,r,s,i){let l=t.textDirection==Hn.RTL,c=l,d=!1,h="top",m,p,x=e.left-s.left,v=s.right-e.right,b=r.right-r.left,k=r.bottom-r.top;if(c&&x=k||T>e.top?m=n.bottom-e.top:(h="bottom",m=e.bottom-n.top)}let O=(e.bottom-e.top)/i.offsetHeight,j=(e.right-e.left)/i.offsetWidth;return{style:`${h}: ${m/O}px; max-width: ${p/j}px`,class:"cm-completionInfo-"+(d?l?"left-narrow":"right-narrow":c?"left":"right")}}function $K(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let l=document.createElement("span");l.className="cm-completionLabel";let c=n.displayLabel||n.label,d=0;for(let h=0;hd&&l.appendChild(document.createTextNode(c.slice(d,m)));let x=l.appendChild(document.createElement("span"));x.appendChild(document.createTextNode(c.slice(m,p))),x.className="cm-completionMatchedText",d=p}return dn.position-r.position).map(n=>n.render)}function Ky(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/n);return{from:s*n,to:(s+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class HK{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:d=>this.placeInfo(d),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:l}=s.open,c=e.state.facet(Dr);this.optionContent=$K(c),this.optionClass=c.optionClass,this.tooltipClass=c.tooltipClass,this.range=Ky(i.length,l,c.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",d=>{let{options:h}=e.state.field(n).open;for(let m=d.target,p;m&&m!=this.dom;m=m.parentNode)if(m.nodeName=="LI"&&(p=/-(\d+)$/.exec(m.id))&&+p[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(Dr).closeOnBlur&&d.relatedTarget!=e.contentDOM&&e.dispatch({effects:Af.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:l,disabled:c}=r.open;(!s.open||s.open.options!=i)&&(this.range=Ky(i.length,l,e.state.facet(Dr).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),c!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!c)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=Ky(n.options.length,n.selected,this.view.state.facet(Dr).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let l=typeof i=="string"?document.createTextNode(i):i(s);if(!l)return;"then"in l?l.then(c=>{c&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(c,s)}).catch(c=>_s(this.view.state,c,"completion info")):(this.addInfoPane(l,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&VK(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let l=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:l.clientWidth,bottom:l.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom{l.target==s&&l.preventDefault()});let i=null;for(let l=r.from;lr.from||r.from==0))if(i=x,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let v=s.appendChild(document.createElement("completion-section"));v.textContent=x}}const m=s.appendChild(document.createElement("li"));m.id=n+"-"+l,m.setAttribute("role","option");let p=this.optionClass(c);p&&(m.className=p);for(let x of this.optionContent){let v=x(c,this.view.state,this.view,d);v&&m.appendChild(v)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.tonew HK(n,t,e)}function VK(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.topn.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function A7(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function WK(t,e){let n=[],r=null,s=null,i=m=>{n.push(m);let{section:p}=m.completion;if(p){r||(r=[]);let x=typeof p=="string"?p:p.name;r.some(v=>v.name==x)||r.push(typeof p=="string"?{name:x}:p)}},l=e.facet(Dr);for(let m of t)if(m.hasResult()){let p=m.result.getMatch;if(m.result.filter===!1)for(let x of m.result.options)i(new N7(x,m.source,p?p(x):[],1e9-n.length));else{let x=e.sliceDoc(m.from,m.to),v,b=l.filterStrict?new FK(x):new qK(x);for(let k of m.result.options)if(v=b.match(k.label)){let O=k.displayLabel?p?p(k,v.matched):[]:v.matched,j=v.score+(k.boost||0);if(i(new N7(k,m.source,O,j)),typeof k.section=="object"&&k.section.rank==="dynamic"){let{name:T}=k.section;s||(s=Object.create(null)),s[T]=Math.max(j,s[T]||-1e9)}}}}if(r){let m=Object.create(null),p=0,x=(v,b)=>(v.rank==="dynamic"&&b.rank==="dynamic"?s[b.name]-s[v.name]:0)||(typeof v.rank=="number"?v.rank:1e9)-(typeof b.rank=="number"?b.rank:1e9)||(v.namex.score-p.score||h(p.completion,x.completion))){let p=m.completion;!d||d.label!=p.label||d.detail!=p.detail||d.type!=null&&p.type!=null&&d.type!=p.type||d.apply!=p.apply||d.boost!=p.boost?c.push(m):A7(m.completion)>A7(d)&&(c[c.length-1]=m),d=m.completion}return c}class $u{constructor(e,n,r,s,i,l){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=l}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new $u(this.options,M7(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,l){if(s&&!l&&e.some(h=>h.isPending))return s.setDisabled();let c=WK(e,n);if(!c.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let d=n.facet(Dr).selectOnOpen?0:-1;if(s&&s.selected!=d&&s.selected!=-1){let h=s.options[s.selected].completion;for(let m=0;mm.hasResult()?Math.min(h,m.from):h,1e8),create:JK,above:i.aboveCursor},s?s.timestamp:Date.now(),d,!1)}map(e){return new $u(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new $u(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Fg{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new Fg(KK,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Dr),i=(r.override||n.languageDataAt("autocomplete",gc(n)).map(IK)).map(d=>(this.active.find(m=>m.source==d)||new ki(d,this.active.some(m=>m.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((d,h)=>d==this.active[h])&&(i=this.active);let l=this.open,c=e.effects.some(d=>d.is(Jw));l&&e.docChanged&&(l=l.map(e.changes)),e.selection||i.some(d=>d.hasResult()&&e.changes.touchesRange(d.from,d.to))||!GK(i,this.active)||c?l=$u.build(i,n,this.id,l,r,c):l&&l.disabled&&!i.some(d=>d.isPending)&&(l=null),!l&&i.every(d=>!d.isPending)&&i.some(d=>d.hasResult())&&(i=i.map(d=>d.hasResult()?new ki(d.source,0):d));for(let d of e.effects)d.is(m_)&&(l=l&&l.setSelected(d.value,this.id));return i==this.active&&l==this.open?this:new Fg(i,this.id,l)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?XK:YK}}function GK(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}const KK=[];function f_(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(Zw);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class ki{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=f_(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new ki(s.source,0)),r&4&&s.state==0&&(s=new ki(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(qg))s=new ki(s.source,1,i.value);else if(i.is(Af))s=new ki(s.source,0);else if(i.is(Jw))for(let l of i.value)l.source==s.source&&(s=l);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(gc(e.state))}}class Ku extends ki{constructor(e,n,r,s,i,l){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=l}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),l=e.changes.mapPos(this.to,1),c=gc(e.state);if(c>l||!s||n&2&&(gc(e.startState)==this.from||cn.map(e))}}),m_=vt.define(),Ms=Br.define({create(){return Fg.start()},update(t,e){return t.update(e)},provide:t=>[Dw.from(t,e=>e.tooltip),qe.contentAttributes.from(t,e=>e.attrs)]});function e5(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(Ms).active.find(s=>s.source==e.source);return r instanceof Ku?(typeof n=="string"?t.dispatch({...LK(t.state,n,r.from,r.to),annotations:Zw.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const JK=UK(Ms,e5);function bp(t,e="option"){return n=>{let r=n.state.field(Ms,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+s*(t?1:-1):t?0:l-1;return c<0?c=e=="page"?0:l-1:c>=l&&(c=e=="page"?l-1:0),n.dispatch({effects:m_.of(c)}),!0}}const eZ=t=>{let e=t.state.field(Ms,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(Ms,!1)?(t.dispatch({effects:qg.of(!0)}),!0):!1,tZ=t=>{let e=t.state.field(Ms,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Af.of(null)}),!0)};class nZ{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const rZ=50,sZ=1e3,iZ=lr.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(Ms).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Ms),n=t.state.facet(Dr);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Ms)==e)return;let r=t.transactions.some(i=>{let l=f_(i,n);return l&8||(i.selection||i.docChanged)&&!(l&3)});for(let i=0;irZ&&Date.now()-l.time>sZ){for(let c of l.context.abortListeners)try{c()}catch(d){_s(this.view.state,d)}l.context.abortListeners=null,this.running.splice(i--,1)}else l.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(l=>l.is(qg)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(l=>l.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(Ms);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Dr).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=gc(e),r=new u_(e,n,t.explicit,this.view),s=new nZ(t,r);this.running.push(s),Promise.resolve(t.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:Af.of(null)}),_s(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Dr).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Dr),r=this.view.state.field(Ms);for(let s=0;sc.source==i.active.source);if(l&&l.isPending)if(i.done==null){let c=new ki(i.active.source,0);for(let d of i.updates)c=c.update(d,n);c.isPending||e.push(c)}else this.startQuery(l)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:Jw.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Ms,!1);if(e&&e.tooltip&&this.view.state.facet(Dr).closeOnBlur){let n=e.open&&QM(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Af.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:qg.of(!1)}),20),this.composing=0}}}),aZ=typeof navigator=="object"&&/Win/.test(navigator.platform),lZ=No.highest(qe.domEventHandlers({keydown(t,e){let n=e.state.field(Ms,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(aZ&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(l=>l.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&e5(e,r),!1}})),p_=qe.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class oZ{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class t5{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Ur.TrackDel),r=e.mapPos(this.to,1,Ur.TrackDel);return n==null||r==null?null:new t5(this.field,n,r)}}class n5{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),l=/^\s*/.exec(i.text)[0];for(let d of this.lines){if(r.length){let h=l,m=/^\t*/.exec(d)[0].length;for(let p=0;pnew t5(d.field,s[d.line]+d.from,s[d.line]+d.to));return{text:r,ranges:c}}static parse(e){let n=[],r=[],s=[],i;for(let l of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(l);){let c=i[1]?+i[1]:null,d=i[2]||i[3]||"",h=-1,m=d.replace(/\\[{}]/g,p=>p[1]);for(let p=0;p=h&&x.field++}for(let p of s)if(p.line==r.length&&p.from>i.index){let x=i[2]?3+(i[1]||"").length:2;p.from-=x,p.to-=x}s.push(new oZ(h,r.length,i.index,i.index+m.length)),l=l.slice(0,i.index)+d+l.slice(i.index+i[0].length)}l=l.replace(/\\([{}])/g,(c,d,h)=>{for(let m of s)m.line==r.length&&m.from>h&&(m.from--,m.to--);return d}),r.push(l)}return new n5(r,s)}}let cZ=Je.widget({widget:new class extends ja{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),uZ=Je.mark({class:"cm-snippetField"});class Ed{constructor(e,n){this.ranges=e,this.active=n,this.deco=Je.set(e.map(r=>(r.from==r.to?cZ:uZ).range(r.from,r.to)),!0)}map(e){let n=[];for(let r of this.ranges){let s=r.map(e);if(!s)return null;n.push(s)}return new Ed(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const p0=vt.define({map(t,e){return t&&t.map(e)}}),dZ=vt.define(),Mf=Br.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(p0))return n.value;if(n.is(dZ)&&t)return new Ed(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>qe.decorations.from(t,e=>e?e.deco:Je.none)});function r5(t,e){return Ce.create(t.filter(n=>n.field==e).map(n=>Ce.range(n.from,n.to)))}function hZ(t){let e=n5.parse(t);return(n,r,s,i)=>{let{text:l,ranges:c}=e.instantiate(n.state,s),{main:d}=n.state.selection,h={changes:{from:s,to:i==d.from?d.to:i,insert:Xt.of(l)},scrollIntoView:!0,annotations:r?[Zw.of(r),gr.userEvent.of("input.complete")]:void 0};if(c.length&&(h.selection=r5(c,0)),c.some(m=>m.field>0)){let m=new Ed(c,0),p=h.effects=[p0.of(m)];n.state.field(Mf,!1)===void 0&&p.push(vt.appendConfig.of([Mf,xZ,vZ,p_]))}n.dispatch(n.state.update(h))}}function g_(t){return({state:e,dispatch:n})=>{let r=e.field(Mf,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(l=>l.field==s+t);return n(e.update({selection:r5(r.ranges,s),effects:p0.of(i?null:new Ed(r.ranges,s)),scrollIntoView:!0})),!0}}const fZ=({state:t,dispatch:e})=>t.field(Mf,!1)?(e(t.update({effects:p0.of(null)})),!0):!1,mZ=g_(1),pZ=g_(-1),gZ=[{key:"Tab",run:mZ,shift:pZ},{key:"Escape",run:fZ}],E7=He.define({combine(t){return t.length?t[0]:gZ}}),xZ=No.highest(o0.compute([E7],t=>t.facet(E7)));function Ya(t,e){return{...e,apply:hZ(t)}}const vZ=qe.domEventHandlers({mousedown(t,e){let n=e.state.field(Mf,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let s=n.ranges.find(i=>i.from<=r&&i.to>=r);return!s||s.field==n.active?!1:(e.dispatch({selection:r5(n.ranges,s.field),effects:p0.of(n.ranges.some(i=>i.field>s.field)?new Ed(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),Ef={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},cc=vt.define({map(t,e){let n=e.mapPos(t,-1,Ur.TrackAfter);return n??void 0}}),s5=new class extends yc{};s5.startSide=1;s5.endSide=-1;const x_=Br.define({create(){return Yt.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(cc)&&(t=t.update({add:[s5.range(n.value,n.value+1)]}));return t}});function yZ(){return[wZ,x_]}const Jy="()[]{}<>«»»«[]{}";function v_(t){for(let e=0;e{if((bZ?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&oa(As(r,0))==1||e!=s.from||n!=s.to)return!1;let i=OZ(t.state,r);return i?(t.dispatch(i),!0):!1}),SZ=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=y_(t,t.selection.main.head).brackets||Ef.brackets,s=null,i=t.changeByRange(l=>{if(l.empty){let c=jZ(t.doc,l.head);for(let d of r)if(d==c&&Dx(t.doc,l.head)==v_(As(d,0)))return{changes:{from:l.head-d.length,to:l.head+d.length},range:Ce.cursor(l.head-d.length)}}return{range:s=l}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},kZ=[{key:"Backspace",run:SZ}];function OZ(t,e){let n=y_(t,t.selection.main.head),r=n.brackets||Ef.brackets;for(let s of r){let i=v_(As(s,0));if(e==s)return i==s?TZ(t,s,r.indexOf(s+s+s)>-1,n):NZ(t,s,i,n.before||Ef.before);if(e==i&&b_(t,t.selection.main.from))return CZ(t,s,i)}return null}function b_(t,e){let n=!1;return t.field(x_).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function Dx(t,e){let n=t.sliceString(e,e+2);return n.slice(0,oa(As(n,0)))}function jZ(t,e){let n=t.sliceString(e-2,e);return oa(As(n,0))==n.length?n:n.slice(1)}function NZ(t,e,n,r){let s=null,i=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:n,from:l.to}],effects:cc.of(l.to+e.length),range:Ce.range(l.anchor+e.length,l.head+e.length)};let c=Dx(t.doc,l.head);return!c||/\s/.test(c)||r.indexOf(c)>-1?{changes:{insert:e+n,from:l.head},effects:cc.of(l.head+e.length),range:Ce.cursor(l.head+e.length)}:{range:s=l}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function CZ(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&Dx(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Ce.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function TZ(t,e,n,r){let s=r.stringPrefixes||Ef.stringPrefixes,i=null,l=t.changeByRange(c=>{if(!c.empty)return{changes:[{insert:e,from:c.from},{insert:e,from:c.to}],effects:cc.of(c.to+e.length),range:Ce.range(c.anchor+e.length,c.head+e.length)};let d=c.head,h=Dx(t.doc,d),m;if(h==e){if(_7(t,d))return{changes:{insert:e+e,from:d},effects:cc.of(d+e.length),range:Ce.cursor(d+e.length)};if(b_(t,d)){let x=n&&t.sliceDoc(d,d+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:d,to:d+x.length,insert:x},range:Ce.cursor(d+x.length)}}}else{if(n&&t.sliceDoc(d-2*e.length,d)==e+e&&(m=D7(t,d-2*e.length,s))>-1&&_7(t,m))return{changes:{insert:e+e+e+e,from:d},effects:cc.of(d+e.length),range:Ce.cursor(d+e.length)};if(t.charCategorizer(d)(h)!=Vn.Word&&D7(t,d,s)>-1&&!AZ(t,d,e,s))return{changes:{insert:e+e,from:d},effects:cc.of(d+e.length),range:Ce.cursor(d+e.length)}}return{range:i=c}});return i?null:t.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function _7(t,e){let n=zr(t).resolveInner(e+1);return n.parent&&n.from==e}function AZ(t,e,n,r){let s=zr(t).resolveInner(e,-1),i=r.reduce((l,c)=>Math.max(l,c.length),0);for(let l=0;l<5;l++){let c=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),d=c.indexOf(n);if(!d||d>-1&&r.indexOf(c.slice(0,d))>-1){let m=s.firstChild;for(;m&&m.from==s.from&&m.to-m.from>n.length+d;){if(t.sliceDoc(m.to-n.length,m.to)==n)return!1;m=m.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function D7(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Vn.Word)return e;for(let s of n){let i=e-s.length;if(t.sliceDoc(i,e)==s&&r(t.sliceDoc(i-1,i))!=Vn.Word)return i}return-1}function MZ(t={}){return[lZ,Ms,Dr.of(t),iZ,EZ,p_]}const w_=[{key:"Ctrl-Space",run:Zy},{mac:"Alt-`",run:Zy},{mac:"Alt-i",run:Zy},{key:"Escape",run:tZ},{key:"ArrowDown",run:bp(!0)},{key:"ArrowUp",run:bp(!1)},{key:"PageDown",run:bp(!0,"page")},{key:"PageUp",run:bp(!1,"page")},{key:"Enter",run:eZ}],EZ=No.highest(o0.computeN([Dr],t=>t.facet(Dr).defaultKeymap?[w_]:[]));class R7{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class ic{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(_f).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((v,b)=>v.from-b.from||v.to-b.to),l=new ml,c=[],d=0,h=r.doc.iter(),m=0,p=r.doc.length;for(let v=0;;){let b=v==i.length?null:i[v];if(!b&&!c.length)break;let k,O;if(c.length)k=d,O=c.reduce((A,_)=>Math.min(A,_.to),b&&b.from>k?b.from:1e8);else{if(k=b.from,k>p)break;O=b.to,c.push(b),v++}for(;vA.from||A.to==k))c.push(A),v++,O=Math.min(A.to,O);else{O=Math.min(A.from,O);break}}O=Math.min(O,p);let j=!1;if(c.some(A=>A.from==k&&(A.to==O||O==p))&&(j=k==O,!j&&O-k<10)){let A=k-(m+h.value.length);A>0&&(h.next(A),m=k);for(let _=k;;){if(_>=O){j=!0;break}if(!h.lineBreak&&m+h.value.length>_)break;_=m+h.value.length,m+=h.value.length,h.next()}}let T=HZ(c);if(j)l.add(k,k,Je.widget({widget:new qZ(T),diagnostics:c.slice()}));else{let A=c.reduce((_,D)=>D.markClass?_+" "+D.markClass:_,"");l.add(k,O,Je.mark({class:"cm-lintRange cm-lintRange-"+T+A,diagnostics:c.slice(),inclusiveEnd:c.some(_=>_.to>O)}))}if(d=O,d==p)break;for(let A=0;A{if(!(e&&l.diagnostics.indexOf(e)<0))if(!r)r=new R7(s,i,e||l.diagnostics[0]);else{if(l.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new R7(r.from,i,r.diagnostic)}}),r}function _Z(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(_f).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(l=>l.is(S_))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function DZ(t,e){return t.field(ri,!1)?e:e.concat(vt.appendConfig.of(UZ))}const S_=vt.define(),i5=vt.define(),k_=vt.define(),ri=Br.define({create(){return new ic(Je.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,s=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=xd(n,t.selected.diagnostic,i)||xd(n,null,i)}!n.size&&s&&e.state.facet(_f).autoPanel&&(s=null),t=new ic(n,s,r)}for(let n of e.effects)if(n.is(S_)){let r=e.state.facet(_f).autoPanel?n.value.length?Df.open:null:t.panel;t=ic.init(n.value,r,e.state)}else n.is(i5)?t=new ic(t.diagnostics,n.value?Df.open:null,t.selected):n.is(k_)&&(t=new ic(t.diagnostics,t.panel,n.value));return t},provide:t=>[Sf.from(t,e=>e.panel),qe.decorations.from(t,e=>e.diagnostics)]}),RZ=Je.mark({class:"cm-lintRange cm-lintRange-active"});function zZ(t,e,n){let{diagnostics:r}=t.state.field(ri),s,i=-1,l=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(d,h,{spec:m})=>{if(e>=d&&e<=h&&(d==h||(e>d||n>0)&&(ej_(t,n,!1)))}const BZ=t=>{let e=t.state.field(ri,!1);(!e||!e.panel)&&t.dispatch({effects:DZ(t.state,[i5.of(!0)])});let n=wf(t,Df.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},z7=t=>{let e=t.state.field(ri,!1);return!e||!e.panel?!1:(t.dispatch({effects:i5.of(!1)}),!0)},LZ=t=>{let e=t.state.field(ri,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},IZ=[{key:"Mod-Shift-m",run:BZ,preventDefault:!0},{key:"F8",run:LZ}],_f=He.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...Oa(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:P7,tooltipFilter:P7,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,s,i)=>e(r,s,i)||n(r,s,i):e:n,autoPanel:(e,n)=>e||n})}}});function P7(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function O_(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;ri.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function j_(t,e,n){var r;let s=n?O_(e.actions):[];return Mn("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Mn("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,l)=>{let c=!1,d=v=>{if(v.preventDefault(),c)return;c=!0;let b=xd(t.state.field(ri).diagnostics,e);b&&i.apply(t,b.from,b.to)},{name:h}=i,m=s[l]?h.indexOf(s[l]):-1,p=m<0?h:[h.slice(0,m),Mn("u",h.slice(m,m+1)),h.slice(m+1)],x=i.markClass?" "+i.markClass:"";return Mn("button",{type:"button",class:"cm-diagnosticAction"+x,onclick:d,onmousedown:d,"aria-label":` Action: ${h}${m<0?"":` (access key "${s[l]})"`}.`},p)}),e.source&&Mn("div",{class:"cm-diagnosticSource"},e.source))}class qZ extends ja{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Mn("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class B7{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=j_(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Df{constructor(e){this.view=e,this.items=[];let n=s=>{if(s.keyCode==27)z7(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],l=O_(i.actions);for(let c=0;c{for(let i=0;iz7(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(ri).selected;if(!e)return-1;for(let n=0;n{for(let m of h.diagnostics){if(l.has(m))continue;l.add(m);let p=-1,x;for(let v=r;vr&&(this.items.splice(r,p-r),s=!0)),n&&x.diagnostic==n.diagnostic?x.dom.hasAttribute("aria-selected")||(x.dom.setAttribute("aria-selected","true"),i=x):x.dom.hasAttribute("aria-selected")&&x.dom.removeAttribute("aria-selected"),r++}});r({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:c,panel:d})=>{let h=d.height/this.list.offsetHeight;c.topd.bottom&&(this.list.scrollTop+=(c.bottom-d.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(ri),r=xd(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:k_.of(r)})}static open(e){return new Df(e)}}function FZ(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function wp(t){return FZ(``,'width="6" height="3"')}const QZ=qe.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:wp("#d11")},".cm-lintRange-warning":{backgroundImage:wp("orange")},".cm-lintRange-info":{backgroundImage:wp("#999")},".cm-lintRange-hint":{backgroundImage:wp("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function $Z(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function HZ(t){let e="hint",n=1;for(let r of t){let s=$Z(r.severity);s>n&&(n=s,e=r.severity)}return e}const UZ=[ri,qe.decorations.compute([ri],t=>{let{selected:e,panel:n}=t.field(ri);return!e||!n||e.from==e.to?Je.none:Je.set([RZ.range(e.from,e.to)])}),NG(zZ,{hideOn:_Z}),QZ];var L7=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(kZ)),e.defaultKeymap!==!1&&(r=r.concat(aK)),e.searchKeymap!==!1&&(r=r.concat(_K)),e.historyKeymap!==!1&&(r=r.concat(fY)),e.foldKeymap!==!1&&(r=r.concat(kX)),e.completionKeymap!==!1&&(r=r.concat(w_)),e.lintKeymap!==!1&&(r=r.concat(IZ));var s=[];return e.lineNumbers!==!1&&s.push(BG()),e.highlightActiveLineGutter!==!1&&s.push(qG()),e.highlightSpecialChars!==!1&&s.push(tG()),e.history!==!1&&s.push(sY()),e.foldGutter!==!1&&s.push(CX()),e.drawSelection!==!1&&s.push(HW()),e.dropCursor!==!1&&s.push(XW()),e.allowMultipleSelections!==!1&&s.push(Vt.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(mX()),e.syntaxHighlighting!==!1&&s.push(hE(EX,{fallback:!0})),e.bracketMatching!==!1&&s.push(LX()),e.closeBrackets!==!1&&s.push(yZ()),e.autocompletion!==!1&&s.push(MZ()),e.rectangularSelection!==!1&&s.push(pG()),n!==!1&&s.push(vG()),e.highlightActiveLine!==!1&&s.push(lG()),e.highlightSelectionMatches!==!1&&s.push(fK()),e.tabSize&&typeof e.tabSize=="number"&&s.push(u0.of(" ".repeat(e.tabSize))),s.concat([o0.of(r.flat())]).filter(Boolean)};const VZ="#e5c07b",I7="#e06c75",WZ="#56b6c2",GZ="#ffffff",sg="#abb2bf",o4="#7d8799",XZ="#61afef",YZ="#98c379",q7="#d19a66",KZ="#c678dd",ZZ="#21252b",F7="#2c313a",Q7="#282c34",eb="#353a42",JZ="#3E4451",$7="#528bff",eJ=qe.theme({"&":{color:sg,backgroundColor:Q7},".cm-content":{caretColor:$7},".cm-cursor, .cm-dropCursor":{borderLeftColor:$7},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:JZ},".cm-panels":{backgroundColor:ZZ,color:sg},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Q7,color:o4,border:"none"},".cm-activeLineGutter":{backgroundColor:F7},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:eb},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:eb,borderBottomColor:eb},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:F7,color:sg}}},{dark:!0}),tJ=h0.define([{tag:he.keyword,color:KZ},{tag:[he.name,he.deleted,he.character,he.propertyName,he.macroName],color:I7},{tag:[he.function(he.variableName),he.labelName],color:XZ},{tag:[he.color,he.constant(he.name),he.standard(he.name)],color:q7},{tag:[he.definition(he.name),he.separator],color:sg},{tag:[he.typeName,he.className,he.number,he.changed,he.annotation,he.modifier,he.self,he.namespace],color:VZ},{tag:[he.operator,he.operatorKeyword,he.url,he.escape,he.regexp,he.link,he.special(he.string)],color:WZ},{tag:[he.meta,he.comment],color:o4},{tag:he.strong,fontWeight:"bold"},{tag:he.emphasis,fontStyle:"italic"},{tag:he.strikethrough,textDecoration:"line-through"},{tag:he.link,color:o4,textDecoration:"underline"},{tag:he.heading,fontWeight:"bold",color:I7},{tag:[he.atom,he.bool,he.special(he.variableName)],color:q7},{tag:[he.processingInstruction,he.string,he.inserted],color:YZ},{tag:he.invalid,color:GZ}]),N_=[eJ,hE(tJ)];var nJ=qe.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),rJ=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:i="light",placeholder:l="",basicSetup:c=!0}=e,d=[];switch(n&&d.unshift(o0.of([lK])),c&&(typeof c=="boolean"?d.unshift(L7()):d.unshift(L7(c))),l&&d.unshift(dG(l)),i){case"light":d.push(nJ);break;case"dark":d.push(N_);break;case"none":break;default:d.push(i);break}return r===!1&&d.push(qe.editable.of(!1)),s&&d.push(Vt.readOnly.of(!0)),[...d]},sJ=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class iJ{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class H7{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var tb=null,aJ=()=>typeof window>"u"?new H7:(tb||(tb=new H7),tb),U7=ka.define(),lJ=200,oJ=[];function cJ(t){var{value:e,selection:n,onChange:r,onStatistics:s,onCreateEditor:i,onUpdate:l,extensions:c=oJ,autoFocus:d,theme:h="light",height:m=null,minHeight:p=null,maxHeight:x=null,width:v=null,minWidth:b=null,maxWidth:k=null,placeholder:O="",editable:j=!0,readOnly:T=!1,indentWithTab:A=!0,basicSetup:_=!0,root:D,initialState:E}=t,[z,Q]=S.useState(),[F,L]=S.useState(),[U,V]=S.useState(),ce=S.useState(()=>({current:null}))[0],W=S.useState(()=>({current:null}))[0],J=qe.theme({"&":{height:m,minHeight:p,maxHeight:x,width:v,minWidth:b,maxWidth:k},"& .cm-scroller":{height:"100% !important"}}),$=qe.updateListener.of(ue=>{if(ue.docChanged&&typeof r=="function"&&!ue.transactions.some(Y=>Y.annotation(U7))){ce.current?ce.current.reset():(ce.current=new iJ(()=>{if(W.current){var Y=W.current;W.current=null,Y()}ce.current=null},lJ),aJ().add(ce.current));var R=ue.state.doc,me=R.toString();r(me,ue)}s&&s(sJ(ue))}),ae=rJ({theme:h,editable:j,readOnly:T,placeholder:O,indentWithTab:A,basicSetup:_}),ne=[$,J,...ae];return l&&typeof l=="function"&&ne.push(qe.updateListener.of(l)),ne=ne.concat(c),S.useLayoutEffect(()=>{if(z&&!U){var ue={doc:e,selection:n,extensions:ne},R=E?Vt.fromJSON(E.json,ue,E.fields):Vt.create(ue);if(V(R),!F){var me=new qe({state:R,parent:z,root:D});L(me),i&&i(me,R)}}return()=>{F&&(V(void 0),L(void 0))}},[z,U]),S.useEffect(()=>{t.container&&Q(t.container)},[t.container]),S.useEffect(()=>()=>{F&&(F.destroy(),L(void 0)),ce.current&&(ce.current.cancel(),ce.current=null)},[F]),S.useEffect(()=>{d&&F&&F.focus()},[d,F]),S.useEffect(()=>{F&&F.dispatch({effects:vt.reconfigure.of(ne)})},[h,c,m,p,x,v,b,k,O,j,T,A,_,r,l]),S.useEffect(()=>{if(e!==void 0){var ue=F?F.state.doc.toString():"";if(F&&e!==ue){var R=ce.current&&!ce.current.isDone,me=()=>{F&&e!==F.state.doc.toString()&&F.dispatch({changes:{from:0,to:F.state.doc.toString().length,insert:e||""},annotations:[U7.of(!0)]})};R?W.current=me:me()}}},[e,F]),{state:U,setState:V,view:F,setView:L,container:z,setContainer:Q}}var uJ=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],C_=S.forwardRef((t,e)=>{var{className:n,value:r="",selection:s,extensions:i=[],onChange:l,onStatistics:c,onCreateEditor:d,onUpdate:h,autoFocus:m,theme:p="light",height:x,minHeight:v,maxHeight:b,width:k,minWidth:O,maxWidth:j,basicSetup:T,placeholder:A,indentWithTab:_,editable:D,readOnly:E,root:z,initialState:Q}=t,F=VI(t,uJ),L=S.useRef(null),{state:U,view:V,container:ce,setContainer:W}=cJ({root:z,value:r,autoFocus:m,theme:p,height:x,minHeight:v,maxHeight:b,width:k,minWidth:O,maxWidth:j,basicSetup:T,placeholder:A,indentWithTab:_,editable:D,readOnly:E,selection:s,onChange:l,onStatistics:c,onCreateEditor:d,onUpdate:h,extensions:i,initialState:Q});S.useImperativeHandle(e,()=>({editor:L.current,state:U,view:V}),[L,ce,U,V]);var J=S.useCallback(ae=>{L.current=ae,W(ae)},[W]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var $=typeof p=="string"?"cm-theme-"+p:"cm-theme";return a.jsx("div",WI({ref:J,className:""+$+(n?" "+n:"")},F))});C_.displayName="CodeMirror";var V7={};class Qg{constructor(e,n,r,s,i,l,c,d,h,m=0,p){this.p=e,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=l,this.buffer=c,this.bufferBase=d,this.curContext=h,this.lookAhead=m,this.parent=p}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let s=e.parser.context;return new Qg(e,[],n,r,r,0,[],0,s?new W7(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,s=e&65535,{parser:i}=this.p,l=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=m):this.p.lastBigReductionSized;)this.stack.pop();this.reduceContext(s,h)}storeNode(e,n,r,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&l.buffer[c-4]==0&&l.buffer[c-1]>-1){if(n==r)return;if(l.buffer[c-2]>=n){l.buffer[c-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,s);else{let l=this.buffer.length;if(l>0&&(this.buffer[l-4]!=0||this.buffer[l-1]<0)){let c=!1;for(let d=l;d>0&&this.buffer[d-2]>r;d-=4)if(this.buffer[d-1]>=0){c=!0;break}if(c)for(;l>0&&this.buffer[l-2]>r;)this.buffer[l]=this.buffer[l-4],this.buffer[l+1]=this.buffer[l-3],this.buffer[l+2]=this.buffer[l-2],this.buffer[l+3]=this.buffer[l-1],l-=4,s>4&&(s-=4)}this.buffer[l]=e,this.buffer[l+1]=n,this.buffer[l+2]=r,this.buffer[l+3]=s}}shift(e,n,r,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:l}=this.p;(s>this.pos||n<=l.maxNode)&&(this.pos=s,l.stateFlag(i,1)||(this.reducePos=s)),this.pushState(i,r),this.shiftContext(n,r),n<=l.maxNode&&this.buffer.push(n,r,s,4)}else this.pos=s,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,s,4)}apply(e,n,r,s){e&65536?this.reduce(e):this.shift(e,n,r,s)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(n,s),this.buffer.push(r,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),s=e.bufferBase+n;for(;e&&s==e.bufferBase;)e=e.parent;return new Qg(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new dJ(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let s=[];for(let i=0,l;id&1&&c==l)||s.push(n[i],l)}n=s}let r=[];for(let s=0;s>19,s=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let l=this.findForcedReduction();if(l==null)return!1;n=l}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(s,i)=>{if(!n.includes(s))return n.push(s),e.allActions(s,l=>{if(!(l&393216))if(l&65536){let c=(l>>19)-i;if(c>1){let d=l&65535,h=this.stack.length-c*3;if(h>=0&&e.getGoto(this.stack[h],d,!1)>=0)return c<<19|65536|d}}else{let c=r(l,i+1);if(c!=null)return c}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;nthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class W7{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class dJ{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=s}}class $g{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new $g(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new $g(this.stack,this.pos,this.index)}}function Sp(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r=92&&l--,l>=34&&l--;let d=l-32;if(d>=46&&(d-=46,c=!0),i+=d,c)break;i*=46}n?n[s++]=i:n=new e(i)}return n}class ig{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const G7=new ig;class hJ{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=G7,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,s=this.rangeIndex,i=this.pos+e;for(;ir.to:i>=r.to;){if(s==this.ranges.length-1)return null;let l=this.ranges[++s];i+=l.from-r.to,r=l}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n=this.chunk2Pos&&rc.to&&(this.chunk2=this.chunk2.slice(0,c.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=G7,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let s of this.ranges){if(s.from>=n)break;s.to>e&&(r+=this.input.read(Math.max(s.from,e),Math.min(s.to,n)))}return r}}class Zu{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;fJ(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Zu.prototype.contextual=Zu.prototype.fallback=Zu.prototype.extend=!1;Zu.prototype.fallback=Zu.prototype.extend=!1;class Rx{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function fJ(t,e,n,r,s,i){let l=0,c=1<0){let b=t[v];if(d.allows(b)&&(e.token.value==-1||e.token.value==b||mJ(b,e.token.value,s,i))){e.acceptToken(b);break}}let m=e.next,p=0,x=t[l+2];if(e.next<0&&x>p&&t[h+x*3-3]==65535){l=t[h+x*3-1];continue e}for(;p>1,b=h+v+(v<<1),k=t[b],O=t[b+1]||65536;if(m=O)p=v+1;else{l=t[b+2],e.advance();continue e}}break}}function X7(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function mJ(t,e,n,r){let s=X7(n,r,e);return s<0||X7(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class pJ{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Y7(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Y7(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=l,null;if(i instanceof Dn){if(l==e){if(l=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(l),this.index.push(0))}else this.index[n]++,this.nextStart=l+i.length}}}class gJ{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new ig)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,l=s.stateSlot(e.state,3),c=e.curContext?e.curContext.hash:0,d=0;for(let h=0;hp.end+25&&(d=Math.max(p.lookAhead,d)),p.value!=0)){let x=n;if(p.extended>-1&&(n=this.addActions(e,p.extended,p.end,n)),n=this.addActions(e,p.value,p.end,n),!m.extend&&(r=p,n>x))break}}for(;this.actions.length>n;)this.actions.pop();return d&&e.setLookAhead(d),!r&&e.pos==this.stream.end&&(r=new ig,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new ig,{pos:r,p:s}=e;return n.start=r,n.end=Math.min(r+1,s.stream.end),n.value=r==s.stream.end?s.parser.eofTerm:0,n}updateCachedToken(e,n,r){let s=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(s,e),r),e.value>-1){let{parser:i}=r.p;for(let l=0;l=0&&r.p.parser.dialect.allows(c>>1)){(c&1)==0?e.value=c>>1:e.extended=c>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;ie.bufferLength*4?new pJ(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],s,i;if(this.bigReductionCount>300&&e.length==1){let[l]=e;for(;l.forceReduce()&&l.stack.length&&l.stack[l.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let l=0;ln)r.push(c);else{if(this.advanceStack(c,r,e))continue;{s||(s=[],i=[]),s.push(c);let d=this.tokens.getMainToken(c);i.push(d.value,d.end)}}break}}if(!r.length){let l=s&&bJ(s);if(l)return Ks&&console.log("Finish with "+this.stackID(l)),this.stackToTree(l);if(this.parser.strict)throw Ks&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&s){let l=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,r);if(l)return Ks&&console.log("Force-finish "+this.stackID(l)),this.stackToTree(l.forceAll())}if(this.recovering){let l=this.recovering==1?1:this.recovering*3;if(r.length>l)for(r.sort((c,d)=>d.score-c.score);r.length>l;)r.pop();r.some(c=>c.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let l=0;l500&&h.buffer.length>500)if((c.score-h.score||c.buffer.length-h.buffer.length)>0)r.splice(d--,1);else{r.splice(l--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let l=1;l ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,m=h?e.curContext.hash:0;for(let p=this.fragments.nodeAt(s);p;){let x=this.parser.nodeSet.types[p.type.id]==p.type?i.getGoto(e.state,p.type.id):-1;if(x>-1&&p.length&&(!h||(p.prop(Et.contextHash)||0)==m))return e.useNode(p,x),Ks&&console.log(l+this.stackID(e)+` (via reuse of ${i.getName(p.type.id)})`),!0;if(!(p instanceof Dn)||p.children.length==0||p.positions[0]>0)break;let v=p.children[0];if(v instanceof Dn&&p.positions[0]==0)p=v;else break}}let c=i.stateSlot(e.state,4);if(c>0)return e.reduce(c),Ks&&console.log(l+this.stackID(e)+` (via always-reduce ${i.getName(c&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let d=this.tokens.getActions(e);for(let h=0;hs?n.push(b):r.push(b)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return K7(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let l=0;l ":"";if(c.deadEnd&&(i||(i=!0,c.restart(),Ks&&console.log(m+this.stackID(c)+" (restarted)"),this.advanceFully(c,r))))continue;let p=c.split(),x=m;for(let v=0;v<10&&p.forceReduce()&&(Ks&&console.log(x+this.stackID(p)+" (via force-reduce)"),!this.advanceFully(p,r));v++)Ks&&(x=this.stackID(p)+" -> ");for(let v of c.recoverByInsert(d))Ks&&console.log(m+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,r);this.stream.end>c.pos?(h==c.pos&&(h++,d=0),c.recoverByDelete(d,h),Ks&&console.log(m+this.stackID(c)+` (via recover-delete ${this.parser.getName(d)})`),K7(c,r)):(!s||s.scoret;class yJ{constructor(e){this.start=e.start,this.shift=e.shift||rb,this.reduce=e.reduce||rb,this.reuse=e.reuse||rb,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Rf extends Bw{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let c=0;ce.topRules[c][1]),s=[];for(let c=0;c=0)i(m,d,c[h++]);else{let p=c[h+-m];for(let x=-m;x>0;x--)i(c[h++],d,p);h++}}}this.nodeSet=new jx(n.map((c,d)=>gs.define({name:d>=this.minRepeatTerm?void 0:c,id:d,props:s[d],top:r.indexOf(d)>-1,error:d==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(d)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=VM;let l=Sp(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let c=0;ctypeof c=="number"?new Zu(l,c):c),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let s=new xJ(this,e,n,r);for(let i of this.wrappers)s=i(s,e,n,r);return s}getGoto(e,n,r=!1){let s=this.goto;if(n>=s[0])return-1;for(let i=s[n+1];;){let l=s[i++],c=l&1,d=s[i++];if(c&&r)return d;for(let h=i+(l>>1);i0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),s=r?n(r):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=rl(this.data,i+2);else break;s=n(rl(this.data,i+1))}return s}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=rl(this.data,r+2);else break;if((this.data[r+2]&1)==0){let s=this.data[r+1];n.some((i,l)=>l&1&&i==s)||n.push(this.data[r],s)}}return n}configure(e){let n=Object.assign(Object.create(Rf.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let s=e.tokenizers.find(i=>i.from==r);return s?s.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,s)=>{let i=e.specializers.find(c=>c.from==r.external);if(!i)return r;let l=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=Z7(l),l})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let l=n.indexOf(i);l>=0&&(r[l]=!0)}let s=null;for(let i=0;ir)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}const wJ=1,T_=194,A_=195,SJ=196,J7=197,kJ=198,OJ=199,jJ=200,NJ=2,M_=3,e8=201,CJ=24,TJ=25,AJ=49,MJ=50,EJ=55,_J=56,DJ=57,RJ=59,zJ=60,PJ=61,BJ=62,LJ=63,IJ=65,qJ=238,FJ=71,QJ=241,$J=242,HJ=243,UJ=244,VJ=245,WJ=246,GJ=247,XJ=248,E_=72,YJ=249,KJ=250,ZJ=251,JJ=252,eee=253,tee=254,nee=255,ree=256,see=73,iee=77,aee=263,lee=112,oee=130,cee=151,uee=152,dee=155,jc=10,zf=13,a5=32,zx=9,l5=35,hee=40,fee=46,c4=123,t8=125,__=39,D_=34,n8=92,mee=111,pee=120,gee=78,xee=117,vee=85,yee=new Set([TJ,AJ,MJ,aee,IJ,oee,_J,DJ,qJ,BJ,LJ,E_,see,iee,zJ,PJ,cee,uee,dee,lee]);function sb(t){return t==jc||t==zf}function ib(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}const bee=new Rx((t,e)=>{let n;if(t.next<0)t.acceptToken(OJ);else if(e.context.flags&ag)sb(t.next)&&t.acceptToken(kJ,1);else if(((n=t.peek(-1))<0||sb(n))&&e.canShift(J7)){let r=0;for(;t.next==a5||t.next==zx;)t.advance(),r++;(t.next==jc||t.next==zf||t.next==l5)&&t.acceptToken(J7,-r)}else sb(t.next)&&t.acceptToken(SJ,1)},{contextual:!0}),wee=new Rx((t,e)=>{let n=e.context;if(n.flags)return;let r=t.peek(-1);if(r==jc||r==zf){let s=0,i=0;for(;;){if(t.next==a5)s++;else if(t.next==zx)s+=8-s%8;else break;t.advance(),i++}s!=n.indent&&t.next!=jc&&t.next!=zf&&t.next!=l5&&(s[t,e|R_])),Oee=new yJ({start:See,reduce(t,e,n,r){return t.flags&ag&&yee.has(e)||(e==FJ||e==E_)&&t.flags&R_?t.parent:t},shift(t,e,n,r){return e==T_?new lg(t,kee(r.read(r.pos,n.pos)),0):e==A_?t.parent:e==CJ||e==EJ||e==RJ||e==M_?new lg(t,0,ag):r8.has(e)?new lg(t,0,r8.get(e)|t.flags&ag):t},hash(t){return t.hash}}),jee=new Rx(t=>{for(let e=0;e<5;e++){if(t.next!="print".charCodeAt(e))return;t.advance()}if(!/\w/.test(String.fromCharCode(t.next)))for(let e=0;;e++){let n=t.peek(e);if(!(n==a5||n==zx)){n!=hee&&n!=fee&&n!=jc&&n!=zf&&n!=l5&&t.acceptToken(wJ);return}}}),Nee=new Rx((t,e)=>{let{flags:n}=e.context,r=n&Ja?D_:__,s=(n&el)>0,i=!(n&tl),l=(n&nl)>0,c=t.pos;for(;!(t.next<0);)if(l&&t.next==c4)if(t.peek(1)==c4)t.advance(2);else{if(t.pos==c){t.acceptToken(M_,1);return}break}else if(i&&t.next==n8){if(t.pos==c){t.advance();let d=t.next;d>=0&&(t.advance(),Cee(t,d)),t.acceptToken(NJ);return}break}else if(t.next==n8&&!i&&t.peek(1)>-1)t.advance(2);else if(t.next==r&&(!s||t.peek(1)==r&&t.peek(2)==r)){if(t.pos==c){t.acceptToken(e8,s?3:1);return}break}else if(t.next==jc){if(s)t.advance();else if(t.pos==c){t.acceptToken(e8);return}break}else t.advance();t.pos>c&&t.acceptToken(jJ)});function Cee(t,e){if(e==mee)for(let n=0;n<2&&t.next>=48&&t.next<=55;n++)t.advance();else if(e==pee)for(let n=0;n<2&&ib(t.next);n++)t.advance();else if(e==xee)for(let n=0;n<4&&ib(t.next);n++)t.advance();else if(e==vee)for(let n=0;n<8&&ib(t.next);n++)t.advance();else if(e==gee&&t.next==c4){for(t.advance();t.next>=0&&t.next!=t8&&t.next!=__&&t.next!=D_&&t.next!=jc;)t.advance();t.next==t8&&t.advance()}}const Tee=Lw({'async "*" "**" FormatConversion FormatSpec':he.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":he.controlKeyword,"in not and or is del":he.operatorKeyword,"from def class global nonlocal lambda":he.definitionKeyword,import:he.moduleKeyword,"with as print":he.keyword,Boolean:he.bool,None:he.null,VariableName:he.variableName,"CallExpression/VariableName":he.function(he.variableName),"FunctionDefinition/VariableName":he.function(he.definition(he.variableName)),"ClassDefinition/VariableName":he.definition(he.className),PropertyName:he.propertyName,"CallExpression/MemberExpression/PropertyName":he.function(he.propertyName),Comment:he.lineComment,Number:he.number,String:he.string,FormatString:he.special(he.string),Escape:he.escape,UpdateOp:he.updateOperator,"ArithOp!":he.arithmeticOperator,BitOp:he.bitwiseOperator,CompareOp:he.compareOperator,AssignOp:he.definitionOperator,Ellipsis:he.punctuation,At:he.meta,"( )":he.paren,"[ ]":he.squareBracket,"{ }":he.brace,".":he.derefOperator,", ;":he.separator}),Aee={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},Mee=Rf.deserialize({version:14,states:"##jO`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[jee,wee,bee,Nee,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:t=>Aee[t]||-1}],tokenPrec:7668}),s8=new WG,z_=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function kp(t){return(e,n,r)=>{if(r)return!1;let s=e.node.getChild("VariableName");return s&&n(s,t),!0}}const Eee={FunctionDefinition:kp("function"),ClassDefinition:kp("class"),ForStatement(t,e,n){if(n){for(let r=t.node.firstChild;r;r=r.nextSibling)if(r.name=="VariableName")e(r,"variable");else if(r.name=="in")break}},ImportStatement(t,e){var n,r;let{node:s}=t,i=((n=s.firstChild)===null||n===void 0?void 0:n.name)=="from";for(let l=s.getChild("import");l;l=l.nextSibling)l.name=="VariableName"&&((r=l.nextSibling)===null||r===void 0?void 0:r.name)!="as"&&e(l,i?"variable":"namespace")},AssignStatement(t,e){for(let n=t.node.firstChild;n;n=n.nextSibling)if(n.name=="VariableName")e(n,"variable");else if(n.name==":"||n.name=="AssignOp")break},ParamList(t,e){for(let n=null,r=t.node.firstChild;r;r=r.nextSibling)r.name=="VariableName"&&(!n||!/\*|AssignOp/.test(n.name))&&e(r,"variable"),n=r},CapturePattern:kp("variable"),AsPattern:kp("variable"),__proto__:null};function P_(t,e){let n=s8.get(e);if(n)return n;let r=[],s=!0;function i(l,c){let d=t.sliceString(l.from,l.to);r.push({label:d,type:c})}return e.cursor(Or.IncludeAnonymous).iterate(l=>{if(l.name){let c=Eee[l.name];if(c&&c(l,i,s)||!s&&z_.has(l.name))return!1;s=!1}else if(l.to-l.from>8192){for(let c of P_(t,l.node))r.push(c);return!1}}),s8.set(e,r),r}const i8=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,B_=["String","FormatString","Comment","PropertyName"];function _ee(t){let e=zr(t.state).resolveInner(t.pos,-1);if(B_.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&i8.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let s=e;s;s=s.parent)z_.has(s.name)&&(r=r.concat(P_(t.state.doc,s)));return{options:r,from:n?e.from:t.pos,validFor:i8}}const Dee=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(t=>({label:t,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(t=>({label:t,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(t=>({label:t,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(t=>({label:t,type:"function"}))),Ree=[Ya("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),Ya("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),Ya("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),Ya("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),Ya(`if \${}: +`);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let s=this.rangeIndex;;){let i=this.ranges[s].to;if(i>=r||(n=n.slice(0,i-(r-n.length)),s++,s==this.ranges.length))break;let l=this.ranges[s].from,c=this.lineAfter(l);n+=c,r=l+c.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let s=this.ranges[this.rangeIndex].to,i=e+n;if(r>0?s>i:s>=i)break;let l=this.ranges[++this.rangeIndex].from;n+=l-s}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){s=this.skipGapsTo(n,s,1),n+=s;let c=this.chunk.length;s=this.skipGapsTo(r,s,-1),r+=s,i+=this.chunk.length-c}let l=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&l>=0&&this.chunk[l]==e&&this.chunk[l+2]==n?this.chunk[l+2]=r:this.chunk.push(e,n,r,i),s}parseLine(e){let{line:n,end:r}=this.nextLine(),s=0,{streamParser:i}=this.lang,l=new gE(n,e?e.state.tabSize:4,e?kc(e.state):2);if(l.eol())i.blankLine(this.state,l.indentUnit);else for(;!l.eol();){let c=vE(i.token,l,this.state);if(c&&(s=this.emitToken(this.lang.tokenTable.resolve(c),this.parsedPos+l.start,this.parsedPos+l.pos,s)),l.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const Hw=Object.create(null),Cf=[gs.none],VX=new jx(Cf),d7=[],h7=Object.create(null),yE=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])yE[t]=wE(Hw,e);class bE{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),yE)}resolve(e){return e?this.table[e]||(this.table[e]=wE(this.extra,e)):0}}const WX=new bE(Hw);function Wy(t,e){d7.indexOf(t)>-1||(d7.push(t),console.warn(e))}function wE(t,e){let n=[];for(let c of e.split(" ")){let d=[];for(let h of c.split(".")){let m=t[h]||he[h];m?typeof m=="function"?d.length?d=d.map(m):Wy(h,`Modifier ${h} used at start of tag`):d.length?Wy(h,`Tag ${h} used as modifier`):d=Array.isArray(m)?m:[m]:Wy(h,`Unknown highlighting tag ${h}`)}for(let h of d)n.push(h)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(c=>c.id),i=h7[s];if(i)return i.id;let l=h7[s]=gs.define({id:Cf.length,name:r,props:[Lw({[r]:n})]});return Cf.push(l),l.id}function GX(t,e){let n=gs.define({id:Cf.length,name:"Document",props:[lc.add(()=>t),Cx.add(()=>r=>e.getIndent(r))],top:!0});return Cf.push(n),n}Hn.RTL,Hn.LTR;const XX=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Vw(t.state,n.from);return r.line?YX(t):r.block?ZX(t):!1};function Uw(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=t(e,n);return s?(r(n.update(s)),!0):!1}}const YX=Uw(tY,0),KX=Uw(SE,0),ZX=Uw((t,e)=>SE(t,e,eY(e)),0);function Vw(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Ph=50;function JX(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-Ph,r),l=t.sliceDoc(s,s+Ph),c=/\s*$/.exec(i)[0].length,d=/^\s*/.exec(l)[0].length,h=i.length-c;if(i.slice(h-e.length,h)==e&&l.slice(d,d+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:s+d,margin:d&&1}};let m,p;s-r<=2*Ph?m=p=t.sliceDoc(r,s):(m=t.sliceDoc(r,r+Ph),p=t.sliceDoc(s-Ph,s));let x=/^\s*/.exec(m)[0].length,v=/\s*$/.exec(p)[0].length,b=p.length-v-n.length;return m.slice(x,x+e.length)==e&&p.slice(b,b+n.length)==n?{open:{pos:r+x+e.length,margin:/\s/.test(m.charAt(x+e.length))?1:0},close:{pos:s-v-n.length,margin:/\s/.test(p.charAt(b-1))?1:0}}:null}function eY(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),s=n.to<=r.to?r:t.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>r.from?e[i].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function SE(t,e,n=e.selection.ranges){let r=n.map(i=>Vw(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,l)=>JX(e,r[l],i.from,i.to));if(t!=2&&!s.every(i=>i))return{changes:e.changes(n.map((i,l)=>s[l]?[]:[{from:i.from,insert:r[l].open+" "},{from:i.to,insert:" "+r[l].close}]))};if(t!=1&&s.some(i=>i)){let i=[];for(let l=0,c;ls&&(i==l||l>p.from)){s=p.from;let x=/^\s*/.exec(p.text)[0].length,v=x==p.length,b=p.text.slice(x,x+h.length)==h?x:-1;xi.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:c,token:d,indent:h,empty:m,single:p}of r)(p||!m)&&i.push({from:c.from+h,insert:d+" "});let l=e.changes(i);return{changes:l,selection:e.selection.map(l,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:l,comment:c,token:d}of r)if(c>=0){let h=l.from+c,m=h+d.length;l.text[m-l.from]==" "&&m++,i.push({from:h,to:m})}return{changes:i}}return null}const n4=Sa.define(),nY=Sa.define(),rY=He.define(),kE=He.define({combine(t){return ka(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,s)=>e(r,s)||n(r,s)})}}),OE=Br.define({create(){return fa.empty},update(t,e){let n=e.state.facet(kE),r=e.annotation(n4);if(r){let d=_s.fromTransaction(e,r.selection),h=r.side,m=h==0?t.undone:t.done;return d?m=Rg(m,m.length,n.minDepth,d):m=CE(m,e.startState.selection),new fa(h==0?r.rest:m,h==0?m:r.rest)}let s=e.annotation(nY);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(gr.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=_s.fromTransaction(e),l=e.annotation(gr.time),c=e.annotation(gr.userEvent);return i?t=t.addChanges(i,l,c,n,e):e.selection&&(t=t.addSelection(e.startState.selection,l,c,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new fa(t.done.map(_s.fromJSON),t.undone.map(_s.fromJSON))}});function sY(t={}){return[OE,kE.of(t),qe.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?jE:e.inputType=="historyRedo"?r4:null;return r?(e.preventDefault(),r(n)):!1}})]}function Mx(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(OE,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const jE=Mx(0,!1),r4=Mx(1,!1),iY=Mx(0,!0),aY=Mx(1,!0);class _s{constructor(e,n,r,s,i){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(e){return new _s(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new _s(e.changes&&kr.fromJSON(e.changes),[],e.mapped&&xa.fromJSON(e.mapped),e.startSelection&&Ce.fromJSON(e.startSelection),e.selectionsAfter.map(Ce.fromJSON))}static fromTransaction(e,n){let r=wi;for(let s of e.startState.facet(rY)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new _s(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,wi)}static selection(e){return new _s(void 0,wi,void 0,void 0,e)}}function Rg(t,e,n,r){let s=e+1>n+20?e-n-1:0,i=t.slice(s,e);return i.push(r),i}function lY(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,l,c)=>{for(let d=0;d=h&&l<=m&&(r=!0)}}),r}function oY(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function NE(t,e){return t.length?e.length?t.concat(e):t:e}const wi=[],cY=200;function CE(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-cY));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Rg(t,t.length-1,1e9,n.setSelAfter(r)))}else return[_s.selection([e])]}function uY(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Gy(t,e){if(!t.length)return t;let n=t.length,r=wi;for(;n;){let s=dY(t[n-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=t.slice(0,n);return i[n-1]=s,i}else e=s.mapped,n--,r=s.selectionsAfter}return r.length?[_s.selection(r)]:wi}function dY(t,e,n){let r=NE(t.selectionsAfter.length?t.selectionsAfter.map(c=>c.map(e)):wi,n);if(!t.changes)return _s.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),l=t.mapped?t.mapped.composeDesc(i):i;return new _s(s,xt.mapEffects(t.effects,e),l,t.startSelection.map(i),r)}const hY=/^(input\.type|delete)($|\.)/;class fa{constructor(e,n,r=0,s=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new fa(this.done,this.undone):this}addChanges(e,n,r,s,i){let l=this.done,c=l[l.length-1];return c&&c.changes&&!c.changes.empty&&e.changes&&(!r||hY.test(r))&&(!c.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):Ax(n,e))}function is(t){return t.textDirectionAt(t.state.selection.main.head)==Hn.LTR}const ME=t=>TE(t,!is(t)),AE=t=>TE(t,is(t));function EE(t,e){return Wi(t,n=>n.empty?t.moveByGroup(n,e):Ax(n,e))}const mY=t=>EE(t,!is(t)),pY=t=>EE(t,is(t));function gY(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Ex(t,e,n){let r=zr(t).resolveInner(e.head),s=n?Et.closedBy:Et.openedBy;for(let d=e.head;;){let h=n?r.childAfter(d):r.childBefore(d);if(!h)break;gY(t,h,s)?r=h:d=n?h.to:h.from}let i=r.type.prop(s),l,c;return i&&(l=n?ha(t,r.from,1):ha(t,r.to,-1))&&l.matched?c=n?l.end.to:l.end.from:c=n?r.to:r.from,Ce.cursor(c,n?-1:1)}const xY=t=>Wi(t,e=>Ex(t.state,e,!is(t))),vY=t=>Wi(t,e=>Ex(t.state,e,is(t)));function _E(t,e){return Wi(t,n=>{if(!n.empty)return Ax(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const DE=t=>_E(t,!1),RE=t=>_E(t,!0);function zE(t){let e=t.scrollDOM.clientHeightl.empty?t.moveVertically(l,e,n.height):Ax(l,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let l=t.coordsAtPos(r.selection.main.head),c=t.scrollDOM.getBoundingClientRect(),d=c.top+n.marginTop,h=c.bottom-n.marginBottom;l&&l.top>d&&l.bottomPE(t,!1),s4=t=>PE(t,!0);function No(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(s=Ce.cursor(r.from+i))}return s}const yY=t=>Wi(t,e=>No(t,e,!0)),bY=t=>Wi(t,e=>No(t,e,!1)),wY=t=>Wi(t,e=>No(t,e,!is(t))),SY=t=>Wi(t,e=>No(t,e,is(t))),kY=t=>Wi(t,e=>Ce.cursor(t.lineBlockAt(e.head).from,1)),OY=t=>Wi(t,e=>Ce.cursor(t.lineBlockAt(e.head).to,-1));function jY(t,e,n){let r=!1,s=Md(t.selection,i=>{let l=ha(t,i.head,-1)||ha(t,i.head,1)||i.head>0&&ha(t,i.head-1,1)||i.headjY(t,e);function Ei(t,e){let n=Md(t.state.selection,r=>{let s=e(r);return Ce.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(Vi(t.state,n)),!0)}function BE(t,e){return Ei(t,n=>t.moveByChar(n,e))}const LE=t=>BE(t,!is(t)),IE=t=>BE(t,is(t));function qE(t,e){return Ei(t,n=>t.moveByGroup(n,e))}const CY=t=>qE(t,!is(t)),TY=t=>qE(t,is(t)),MY=t=>Ei(t,e=>Ex(t.state,e,!is(t))),AY=t=>Ei(t,e=>Ex(t.state,e,is(t)));function FE(t,e){return Ei(t,n=>t.moveVertically(n,e))}const QE=t=>FE(t,!1),$E=t=>FE(t,!0);function HE(t,e){return Ei(t,n=>t.moveVertically(n,e,zE(t).height))}const m7=t=>HE(t,!1),p7=t=>HE(t,!0),EY=t=>Ei(t,e=>No(t,e,!0)),_Y=t=>Ei(t,e=>No(t,e,!1)),DY=t=>Ei(t,e=>No(t,e,!is(t))),RY=t=>Ei(t,e=>No(t,e,is(t))),zY=t=>Ei(t,e=>Ce.cursor(t.lineBlockAt(e.head).from)),PY=t=>Ei(t,e=>Ce.cursor(t.lineBlockAt(e.head).to)),g7=({state:t,dispatch:e})=>(e(Vi(t,{anchor:0})),!0),x7=({state:t,dispatch:e})=>(e(Vi(t,{anchor:t.doc.length})),!0),v7=({state:t,dispatch:e})=>(e(Vi(t,{anchor:t.selection.main.anchor,head:0})),!0),y7=({state:t,dispatch:e})=>(e(Vi(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),BY=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),LY=({state:t,dispatch:e})=>{let n=_x(t).map(({from:r,to:s})=>Ce.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Ce.create(n),userEvent:"select"})),!0},IY=({state:t,dispatch:e})=>{let n=Md(t.selection,r=>{let s=zr(t),i=s.resolveStack(r.from,1);if(r.empty){let l=s.resolveStack(r.from,-1);l.node.from>=i.node.from&&l.node.to<=i.node.to&&(i=l)}for(let l=i;l;l=l.next){let{node:c}=l;if((c.from=r.to||c.to>r.to&&c.from<=r.from)&&l.next)return Ce.range(c.to,c.from)}return r});return n.eq(t.selection)?!1:(e(Vi(t,n)),!0)};function UE(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let l=n.doc.lineAt(i.head);if(e?l.to0)for(let c=i;;){let d=t.moveVertically(c,e);if(d.headl.to){s.some(h=>h.head==d.head)||s.push(d);break}else{if(d.head==c.head)break;c=d}}}return s.length==r.ranges.length?!1:(t.dispatch(Vi(n,Ce.create(s,s.length-1))),!0)}const qY=t=>UE(t,!1),FY=t=>UE(t,!0),QY=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Ce.create([n.main]):n.main.empty||(r=Ce.create([Ce.cursor(n.main.head)])),r?(e(Vi(t,r)),!0):!1};function f0(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:l,to:c}=i;if(l==c){let d=e(i);dl&&(n="delete.forward",d=xp(t,d,!0)),l=Math.min(l,d),c=Math.max(c,d)}else l=xp(t,l,!1),c=xp(t,c,!0);return l==c?{range:i}:{changes:{from:l,to:c},range:Ce.cursor(l,ls(t)))r.between(e,e,(s,i)=>{se&&(e=n?i:s)});return e}const VE=(t,e,n)=>f0(t,r=>{let s=r.from,{state:i}=t,l=i.doc.lineAt(s),c,d;if(n&&!e&&s>l.from&&sVE(t,!1,!0),WE=t=>VE(t,!0,!1),GE=(t,e)=>f0(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),l=s.charCategorizer(r);for(let c=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let d=Vr(i.text,r-i.from,e)+i.from,h=i.text.slice(Math.min(r,d)-i.from,Math.max(r,d)-i.from),m=l(h);if(c!=null&&m!=c)break;(h!=" "||r!=n.head)&&(c=m),r=d}return r}),XE=t=>GE(t,!1),$Y=t=>GE(t,!0),HY=t=>f0(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headf0(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),VY=t=>f0(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Wt.of(["",""])},range:Ce.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},GY=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,i=t.doc.lineAt(s),l=s==i.from?s-1:Vr(i.text,s-i.from,!1)+i.from,c=s==i.to?s+1:Vr(i.text,s-i.from,!0)+i.from;return{changes:{from:l,to:c,insert:t.doc.slice(s,c).append(t.doc.slice(l,s))},range:Ce.cursor(c)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function _x(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=s.number){let l=e[e.length-1];l.to=i.to,l.ranges.push(r)}else e.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return e}function YE(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of _x(t)){if(n?i.to==t.doc.length:i.from==0)continue;let l=t.doc.lineAt(n?i.to+1:i.from-1),c=l.length+1;if(n){r.push({from:i.to,to:l.to},{from:i.from,insert:l.text+t.lineBreak});for(let d of i.ranges)s.push(Ce.range(Math.min(t.doc.length,d.anchor+c),Math.min(t.doc.length,d.head+c)))}else{r.push({from:l.from,to:i.from},{from:i.to,insert:t.lineBreak+l.text});for(let d of i.ranges)s.push(Ce.range(d.anchor-c,d.head-c))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Ce.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const XY=({state:t,dispatch:e})=>YE(t,e,!1),YY=({state:t,dispatch:e})=>YE(t,e,!0);function KE(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of _x(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const KY=({state:t,dispatch:e})=>KE(t,e,!1),ZY=({state:t,dispatch:e})=>KE(t,e,!0),JY=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(_x(e).map(({from:s,to:i})=>(s>0?s--:i{let i;if(t.lineWrapping){let l=t.lineBlockAt(s.head),c=t.coordsAtPos(s.head,s.assoc||1);c&&(i=l.bottom+t.documentTop-c.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function eK(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=zr(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e),i;return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(Et.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const b7=ZE(!1),tK=ZE(!0);function ZE(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:l}=s,c=e.doc.lineAt(i),d=!t&&i==l&&eK(e,i);t&&(i=l=(l<=c.to?c:e.doc.lineAt(l)).to);let h=new Nx(e,{simulateBreak:i,simulateDoubleBreak:!!d}),m=Iw(h,i);for(m==null&&(m=Td(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));lc.from&&i{let s=[];for(let l=r.from;l<=r.to;){let c=t.doc.lineAt(l);c.number>n&&(r.empty||r.to>c.from)&&(e(c,s,r),n=c.number),l=c.to+1}let i=t.changes(s);return{changes:s,range:Ce.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const nK=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Nx(t,{overrideIndentation:i=>{let l=n[i];return l??-1}}),s=Ww(t,(i,l,c)=>{let d=Iw(r,i.from);if(d==null)return;/\S/.test(i.text)||(d=0);let h=/^\s*/.exec(i.text)[0],m=Nf(t,d);(h!=m||c.fromt.readOnly?!1:(e(t.update(Ww(t,(n,r)=>{r.push({from:n.from,insert:t.facet(u0)})}),{userEvent:"input.indent"})),!0),e_=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Ww(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Td(s,t.tabSize),l=0,c=Nf(t,Math.max(0,i-kc(t)));for(;l(t.setTabFocusMode(),!0),sK=[{key:"Ctrl-b",run:ME,shift:LE,preventDefault:!0},{key:"Ctrl-f",run:AE,shift:IE},{key:"Ctrl-p",run:DE,shift:QE},{key:"Ctrl-n",run:RE,shift:$E},{key:"Ctrl-a",run:kY,shift:zY},{key:"Ctrl-e",run:OY,shift:PY},{key:"Ctrl-d",run:WE},{key:"Ctrl-h",run:i4},{key:"Ctrl-k",run:HY},{key:"Ctrl-Alt-h",run:XE},{key:"Ctrl-o",run:WY},{key:"Ctrl-t",run:GY},{key:"Ctrl-v",run:s4}],iK=[{key:"ArrowLeft",run:ME,shift:LE,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:mY,shift:CY,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:wY,shift:DY,preventDefault:!0},{key:"ArrowRight",run:AE,shift:IE,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:pY,shift:TY,preventDefault:!0},{mac:"Cmd-ArrowRight",run:SY,shift:RY,preventDefault:!0},{key:"ArrowUp",run:DE,shift:QE,preventDefault:!0},{mac:"Cmd-ArrowUp",run:g7,shift:v7},{mac:"Ctrl-ArrowUp",run:f7,shift:m7},{key:"ArrowDown",run:RE,shift:$E,preventDefault:!0},{mac:"Cmd-ArrowDown",run:x7,shift:y7},{mac:"Ctrl-ArrowDown",run:s4,shift:p7},{key:"PageUp",run:f7,shift:m7},{key:"PageDown",run:s4,shift:p7},{key:"Home",run:bY,shift:_Y,preventDefault:!0},{key:"Mod-Home",run:g7,shift:v7},{key:"End",run:yY,shift:EY,preventDefault:!0},{key:"Mod-End",run:x7,shift:y7},{key:"Enter",run:b7,shift:b7},{key:"Mod-a",run:BY},{key:"Backspace",run:i4,shift:i4,preventDefault:!0},{key:"Delete",run:WE,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:XE,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:$Y,preventDefault:!0},{mac:"Mod-Backspace",run:UY,preventDefault:!0},{mac:"Mod-Delete",run:VY,preventDefault:!0}].concat(sK.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),aK=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:xY,shift:MY},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:vY,shift:AY},{key:"Alt-ArrowUp",run:XY},{key:"Shift-Alt-ArrowUp",run:KY},{key:"Alt-ArrowDown",run:YY},{key:"Shift-Alt-ArrowDown",run:ZY},{key:"Mod-Alt-ArrowUp",run:qY},{key:"Mod-Alt-ArrowDown",run:FY},{key:"Escape",run:QY},{key:"Mod-Enter",run:tK},{key:"Alt-l",mac:"Ctrl-l",run:LY},{key:"Mod-i",run:IY,preventDefault:!0},{key:"Mod-[",run:e_},{key:"Mod-]",run:JE},{key:"Mod-Alt-\\",run:nK},{key:"Shift-Mod-k",run:JY},{key:"Shift-Mod-\\",run:NY},{key:"Mod-/",run:XX},{key:"Alt-A",run:KX},{key:"Ctrl-m",mac:"Shift-Alt-m",run:rK}].concat(iK),lK={key:"Tab",run:JE,shift:e_},w7=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class gd{constructor(e,n,r=0,s=e.length,i,l){this.test=l,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=i?c=>i(w7(c)):w7,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ms(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=yw(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=aa(e);let s=this.normalize(n);if(s.length)for(let i=0,l=r;;i++){let c=s.charCodeAt(i),d=this.match(c,l,this.bufferPos+this.bufferStart);if(i==s.length-1){if(d)return this.value=d,this;break}l==r&&ithis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=zg(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||s.to<=n){let c=new Yu(n,e.sliceString(n,r));return Xy.set(e,c),c}if(s.from==n&&s.to==r)return s;let{text:i,from:l}=s;return l>n&&(i=e.sliceString(n,l)+i,l=n),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=zg(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Yu.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(n_.prototype[Symbol.iterator]=r_.prototype[Symbol.iterator]=function(){return this});function oK(t){try{return new RegExp(t,Gw),!0}catch{return!1}}function zg(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function a4(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=An("input",{class:"cm-textfield",name:"line",value:e}),r=An("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),t.dispatch({effects:sf.of(!1)}),t.focus()):i.keyCode==13&&(i.preventDefault(),s())},onsubmit:i=>{i.preventDefault(),s()}},An("label",t.state.phrase("Go to line"),": ",n)," ",An("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),An("button",{name:"close",onclick:()=>{t.dispatch({effects:sf.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function s(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!i)return;let{state:l}=t,c=l.doc.lineAt(l.selection.main.head),[,d,h,m,p]=i,x=m?+m.slice(1):0,v=h?+h:c.number;if(h&&p){let O=v/100;d&&(O=O*(d=="-"?-1:1)+c.number/l.doc.lines),v=Math.round(l.doc.lines*O)}else h&&d&&(v=v*(d=="-"?-1:1)+c.number);let b=l.doc.line(Math.max(1,Math.min(l.doc.lines,v))),k=Ce.cursor(b.from+Math.max(0,Math.min(x,b.length)));t.dispatch({effects:[sf.of(!1),qe.scrollIntoView(k.from,{y:"center"})],selection:k}),t.focus()}return{dom:r}}const sf=xt.define(),S7=Br.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(sf)&&(t=n.value);return t},provide:t=>Sf.from(t,e=>e?a4:null)}),cK=t=>{let e=wf(t,a4);if(!e){let n=[sf.of(!0)];t.state.field(S7,!1)==null&&n.push(xt.appendConfig.of([S7,uK])),t.dispatch({effects:n}),e=wf(t,a4)}return e&&e.dom.querySelector("input").select(),!0},uK=qe.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),dK={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},hK=He.define({combine(t){return ka(t,dK,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function fK(t){return[vK,xK]}const mK=Je.mark({class:"cm-selectionMatch"}),pK=Je.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function k7(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Vn.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Vn.Word)}function gK(t,e,n,r){return t(e.sliceDoc(n,n+1))==Vn.Word&&t(e.sliceDoc(r-1,r))==Vn.Word}const xK=lr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(hK),{state:n}=t,r=n.selection;if(r.ranges.length>1)return Je.none;let s=r.main,i,l=null;if(s.empty){if(!e.highlightWordAroundCursor)return Je.none;let d=n.wordAt(s.head);if(!d)return Je.none;l=n.charCategorizer(s.head),i=n.sliceDoc(d.from,d.to)}else{let d=s.to-s.from;if(d200)return Je.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),l=n.charCategorizer(s.head),!(k7(l,n,s.from,s.to)&&gK(l,n,s.from,s.to)))return Je.none}else if(i=n.sliceDoc(s.from,s.to),!i)return Je.none}let c=[];for(let d of t.visibleRanges){let h=new gd(n.doc,i,d.from,d.to);for(;!h.next().done;){let{from:m,to:p}=h.value;if((!l||k7(l,n,m,p))&&(s.empty&&m<=s.from&&p>=s.to?c.push(pK.range(m,p)):(m>=s.to||p<=s.from)&&c.push(mK.range(m,p)),c.length>e.maxMatches))return Je.none}}return Je.set(c)}},{decorations:t=>t.decorations}),vK=qe.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),yK=({state:t,dispatch:e})=>{let{selection:n}=t,r=Ce.create(n.ranges.map(s=>t.wordAt(s.head)||Ce.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function bK(t,e){let{main:n,ranges:r}=t.selection,s=t.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let l=!1,c=new gd(t.doc,e,r[r.length-1].to);;)if(c.next(),c.done){if(l)return null;c=new gd(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),l=!0}else{if(l&&r.some(d=>d.from==c.value.from))continue;if(i){let d=t.wordAt(c.value.from);if(!d||d.from!=c.value.from||d.to!=c.value.to)continue}return c.value}}const wK=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return yK({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=r))return!1;let s=bK(t,r);return s?(e(t.update({selection:t.selection.addRange(Ce.range(s.from,s.to),!1),effects:qe.scrollIntoView(s.to)})),!0):!1},Ad=He.define({combine(t){return ka(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new DK(e),scrollToMatch:e=>qe.scrollIntoView(e)})}});class s_{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||oK(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?` +`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new jK(this):new kK(this)}getCursor(e,n=0,r){let s=e.doc?e:Vt.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?zu(this,s,n,r):Ru(this,s,n,r)}}class i_{constructor(e){this.spec=e}}function Ru(t,e,n,r){return new gd(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?SK(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function SK(t,e){return(n,r,s,i)=>((i>n||i+s.length=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=Ru(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}function zu(t,e,n,r){return new n_(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?OK(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function Pg(t,e){return t.slice(Vr(t,e,!1),e)}function Bg(t,e){return t.slice(e,Vr(t,e))}function OK(t){return(e,n,r)=>!r[0].length||(t(Pg(r.input,r.index))!=Vn.Word||t(Bg(r.input,r.index))!=Vn.Word)&&(t(Bg(r.input,r.index+r[0].length))!=Vn.Word||t(Pg(r.input,r.index+r[0].length))!=Vn.Word)}class jK extends i_{nextMatch(e,n,r){let s=zu(this.spec,e,r,e.doc.length).next();return s.done&&(s=zu(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),l=zu(this.spec,e,i,r),c=null;for(;!l.next().done;)c=l.value;if(c&&(i==n||c.from>i+10))return c;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=zu(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}const Tf=xt.define(),Xw=xt.define(),ao=Br.define({create(t){return new Yy(l4(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Tf)?t=new Yy(n.value.create(),t.panel):n.is(Xw)&&(t=new Yy(t.query,n.value?Yw:null));return t},provide:t=>Sf.from(t,e=>e.panel)});class Yy{constructor(e,n){this.query=e,this.panel=n}}const NK=Je.mark({class:"cm-searchMatch"}),CK=Je.mark({class:"cm-searchMatch cm-searchMatch-selected"}),TK=lr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(ao))}update(t){let e=t.state.field(ao);(e!=t.startState.field(ao)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return Je.none;let{view:n}=this,r=new fl;for(let s=0,i=n.visibleRanges,l=i.length;si[s+1].from-500;)d=i[++s].to;t.highlight(n.state,c,d,(h,m)=>{let p=n.state.selection.ranges.some(x=>x.from==h&&x.to==m);r.add(h,m,p?CK:NK)})}return r.finish()}},{decorations:t=>t.decorations});function m0(t){return e=>{let n=e.state.field(ao,!1);return n&&n.query.spec.valid?t(e,n):o_(e)}}const Lg=m0((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=Ce.single(r.from,r.to),i=t.state.facet(Ad);return t.dispatch({selection:s,effects:[Kw(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),l_(t),!0}),Ig=m0((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=Ce.single(s.from,s.to),l=t.state.facet(Ad);return t.dispatch({selection:i,effects:[Kw(t,s),l.scrollToMatch(i.main,t)],userEvent:"select.search"}),l_(t),!0}),MK=m0((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Ce.create(n.map(r=>Ce.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),AK=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],l=0;for(let c=new gd(t.doc,t.sliceDoc(r,s));!c.next().done;){if(i.length>1e3)return!1;c.value.from==r&&(l=i.length),i.push(Ce.range(c.value.from,c.value.to))}return e(t.update({selection:Ce.create(i,l),userEvent:"select.search.matches"})),!0},O7=m0((t,{query:e})=>{let{state:n}=t,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,r,r);if(!i)return!1;let l=i,c=[],d,h,m=[];l.from==r&&l.to==s&&(h=n.toText(e.getReplacement(l)),c.push({from:l.from,to:l.to,insert:h}),l=e.nextMatch(n,l.from,l.to),m.push(qe.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let p=t.state.changes(c);return l&&(d=Ce.single(l.from,l.to).map(p),m.push(Kw(t,l)),m.push(n.facet(Ad).scrollToMatch(d.main,t))),t.dispatch({changes:p,selection:d,effects:m,userEvent:"input.replace"}),!0}),EK=m0((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(s=>{let{from:i,to:l}=s;return{from:i,to:l,insert:e.getReplacement(s)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:qe.announce.of(r),userEvent:"input.replace.all"}),!0});function Yw(t){return t.state.facet(Ad).createPanel(t)}function l4(t,e){var n,r,s,i,l;let c=t.selection.main,d=c.empty||c.to>c.from+100?"":t.sliceDoc(c.from,c.to);if(e&&!d)return e;let h=t.facet(Ad);return new s_({search:((n=e?.literal)!==null&&n!==void 0?n:h.literal)?d:d.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:h.regexp,wholeWord:(l=e?.wholeWord)!==null&&l!==void 0?l:h.wholeWord})}function a_(t){let e=wf(t,Yw);return e&&e.dom.querySelector("[main-field]")}function l_(t){let e=a_(t);e&&e==t.root.activeElement&&e.select()}const o_=t=>{let e=t.state.field(ao,!1);if(e&&e.panel){let n=a_(t);if(n&&n!=t.root.activeElement){let r=l4(t.state,e.query.spec);r.valid&&t.dispatch({effects:Tf.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[Xw.of(!0),e?Tf.of(l4(t.state,e.query.spec)):xt.appendConfig.of(zK)]});return!0},c_=t=>{let e=t.state.field(ao,!1);if(!e||!e.panel)return!1;let n=wf(t,Yw);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Xw.of(!1)}),!0},_K=[{key:"Mod-f",run:o_,scope:"editor search-panel"},{key:"F3",run:Lg,shift:Ig,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Lg,shift:Ig,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:c_,scope:"editor search-panel"},{key:"Mod-Shift-l",run:AK},{key:"Mod-Alt-g",run:cK},{key:"Mod-d",run:wK,preventDefault:!0}];class DK{constructor(e){this.view=e;let n=this.query=e.state.field(ao).query.spec;this.commit=this.commit.bind(this),this.searchField=An("input",{value:n.search,placeholder:Xs(e,"Find"),"aria-label":Xs(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=An("input",{value:n.replace,placeholder:Xs(e,"Replace"),"aria-label":Xs(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=An("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=An("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=An("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,l){return An("button",{class:"cm-button",name:s,onclick:i,type:"button"},l)}this.dom=An("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>Lg(e),[Xs(e,"next")]),r("prev",()=>Ig(e),[Xs(e,"previous")]),r("select",()=>MK(e),[Xs(e,"all")]),An("label",null,[this.caseField,Xs(e,"match case")]),An("label",null,[this.reField,Xs(e,"regexp")]),An("label",null,[this.wordField,Xs(e,"by word")]),...e.state.readOnly?[]:[An("br"),this.replaceField,r("replace",()=>O7(e),[Xs(e,"replace")]),r("replaceAll",()=>EK(e),[Xs(e,"replace all")])],An("button",{name:"close",onclick:()=>c_(e),"aria-label":Xs(e,"close"),type:"button"},["×"])])}commit(){let e=new s_({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Tf.of(e)}))}keydown(e){LW(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ig:Lg)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),O7(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Tf)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Ad).top}}function Xs(t,e){return t.state.phrase(e)}const vp=30,yp=/[\s\.,:;?!]/;function Kw(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),s=t.state.doc.lineAt(n).to,i=Math.max(r.from,e-vp),l=Math.min(s,n+vp),c=t.state.sliceDoc(i,l);if(i!=r.from){for(let d=0;dc.length-vp;d--)if(!yp.test(c[d-1])&&yp.test(c[d])){c=c.slice(0,d);break}}return qe.announce.of(`${t.state.phrase("current match")}. ${c} ${t.state.phrase("on line")} ${r.number}.`)}const RK=qe.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),zK=[ao,jo.low(TK),RK];class u_{constructor(e,n,r,s){this.state=e,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=zr(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(h_(e,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function j7(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function PK(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;itypeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:PK(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function BK(t,e){return n=>{for(let r=zr(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}let N7=class{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}};function gc(t){return t.selection.main.from}function h_(t,e){var n;let{source:r}=t,s=e&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const Zw=Sa.define();function LK(t,e,n,r){let{main:s}=t.selection,i=n-s.from,l=r-s.from;return{...t.changeByRange(c=>{if(c!=s&&n!=r&&t.sliceDoc(c.from+i,c.from+l)!=t.sliceDoc(n,r))return{range:c};let d=t.toText(e);return{changes:{from:c.from+i,to:r==s.from?c.to:c.from+l,insert:d},range:Ce.cursor(c.from+i+d.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const C7=new WeakMap;function IK(t){if(!Array.isArray(t))return t;let e=C7.get(t);return e||C7.set(t,e=d_(t)),e}const qg=xt.define(),Mf=xt.define();class qK{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&D<=57||D>=97&&D<=122?2:D>=65&&D<=90?1:0:(E=yw(D))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!T||z==1&&O||_==0&&z!=0)&&(n[p]==D||r[p]==D&&(x=!0)?l[p++]=T:l.length&&(j=!1)),_=z,T+=aa(D)}return p==d&&l[0]==0&&j?this.result(-100+(x?-200:0),l,e):v==d&&b==0?this.ret(-200-e.length+(k==e.length?0:-100),[0,k]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):v==d?this.ret(-900-e.length,[b,k]):p==d?this.result(-100+(x?-200:0)+-700+(j?0:-1100),l,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let l of n){let c=l+(this.astral?aa(Ms(r,l)):1);i&&s[i-1]==l?s[i-1]=c:(s[i++]=l,s[i++]=c)}return this.ret(e-r.length,s)}}class FK{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:QK,filterStrict:!1,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>T7(e(r),n(r)),optionClass:(e,n)=>r=>T7(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function T7(t,e){return t?e?t+" "+e:t:e}function QK(t,e,n,r,s,i){let l=t.textDirection==Hn.RTL,c=l,d=!1,h="top",m,p,x=e.left-s.left,v=s.right-e.right,b=r.right-r.left,k=r.bottom-r.top;if(c&&x=k||T>e.top?m=n.bottom-e.top:(h="bottom",m=e.bottom-n.top)}let O=(e.bottom-e.top)/i.offsetHeight,j=(e.right-e.left)/i.offsetWidth;return{style:`${h}: ${m/O}px; max-width: ${p/j}px`,class:"cm-completionInfo-"+(d?l?"left-narrow":"right-narrow":c?"left":"right")}}function $K(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let l=document.createElement("span");l.className="cm-completionLabel";let c=n.displayLabel||n.label,d=0;for(let h=0;hd&&l.appendChild(document.createTextNode(c.slice(d,m)));let x=l.appendChild(document.createElement("span"));x.appendChild(document.createTextNode(c.slice(m,p))),x.className="cm-completionMatchedText",d=p}return dn.position-r.position).map(n=>n.render)}function Ky(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/n);return{from:s*n,to:(s+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class HK{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:d=>this.placeInfo(d),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:l}=s.open,c=e.state.facet(Dr);this.optionContent=$K(c),this.optionClass=c.optionClass,this.tooltipClass=c.tooltipClass,this.range=Ky(i.length,l,c.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",d=>{let{options:h}=e.state.field(n).open;for(let m=d.target,p;m&&m!=this.dom;m=m.parentNode)if(m.nodeName=="LI"&&(p=/-(\d+)$/.exec(m.id))&&+p[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(Dr).closeOnBlur&&d.relatedTarget!=e.contentDOM&&e.dispatch({effects:Mf.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:l,disabled:c}=r.open;(!s.open||s.open.options!=i)&&(this.range=Ky(i.length,l,e.state.facet(Dr).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),c!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!c)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=Ky(n.options.length,n.selected,this.view.state.facet(Dr).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let l=typeof i=="string"?document.createTextNode(i):i(s);if(!l)return;"then"in l?l.then(c=>{c&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(c,s)}).catch(c=>Es(this.view.state,c,"completion info")):(this.addInfoPane(l,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&VK(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let l=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:l.clientWidth,bottom:l.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom{l.target==s&&l.preventDefault()});let i=null;for(let l=r.from;lr.from||r.from==0))if(i=x,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let v=s.appendChild(document.createElement("completion-section"));v.textContent=x}}const m=s.appendChild(document.createElement("li"));m.id=n+"-"+l,m.setAttribute("role","option");let p=this.optionClass(c);p&&(m.className=p);for(let x of this.optionContent){let v=x(c,this.view.state,this.view,d);v&&m.appendChild(v)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.tonew HK(n,t,e)}function VK(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.topn.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function M7(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function WK(t,e){let n=[],r=null,s=null,i=m=>{n.push(m);let{section:p}=m.completion;if(p){r||(r=[]);let x=typeof p=="string"?p:p.name;r.some(v=>v.name==x)||r.push(typeof p=="string"?{name:x}:p)}},l=e.facet(Dr);for(let m of t)if(m.hasResult()){let p=m.result.getMatch;if(m.result.filter===!1)for(let x of m.result.options)i(new N7(x,m.source,p?p(x):[],1e9-n.length));else{let x=e.sliceDoc(m.from,m.to),v,b=l.filterStrict?new FK(x):new qK(x);for(let k of m.result.options)if(v=b.match(k.label)){let O=k.displayLabel?p?p(k,v.matched):[]:v.matched,j=v.score+(k.boost||0);if(i(new N7(k,m.source,O,j)),typeof k.section=="object"&&k.section.rank==="dynamic"){let{name:T}=k.section;s||(s=Object.create(null)),s[T]=Math.max(j,s[T]||-1e9)}}}}if(r){let m=Object.create(null),p=0,x=(v,b)=>(v.rank==="dynamic"&&b.rank==="dynamic"?s[b.name]-s[v.name]:0)||(typeof v.rank=="number"?v.rank:1e9)-(typeof b.rank=="number"?b.rank:1e9)||(v.namex.score-p.score||h(p.completion,x.completion))){let p=m.completion;!d||d.label!=p.label||d.detail!=p.detail||d.type!=null&&p.type!=null&&d.type!=p.type||d.apply!=p.apply||d.boost!=p.boost?c.push(m):M7(m.completion)>M7(d)&&(c[c.length-1]=m),d=m.completion}return c}class $u{constructor(e,n,r,s,i,l){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=l}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new $u(this.options,A7(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,l){if(s&&!l&&e.some(h=>h.isPending))return s.setDisabled();let c=WK(e,n);if(!c.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let d=n.facet(Dr).selectOnOpen?0:-1;if(s&&s.selected!=d&&s.selected!=-1){let h=s.options[s.selected].completion;for(let m=0;mm.hasResult()?Math.min(h,m.from):h,1e8),create:JK,above:i.aboveCursor},s?s.timestamp:Date.now(),d,!1)}map(e){return new $u(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new $u(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Fg{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new Fg(KK,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Dr),i=(r.override||n.languageDataAt("autocomplete",gc(n)).map(IK)).map(d=>(this.active.find(m=>m.source==d)||new Si(d,this.active.some(m=>m.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((d,h)=>d==this.active[h])&&(i=this.active);let l=this.open,c=e.effects.some(d=>d.is(Jw));l&&e.docChanged&&(l=l.map(e.changes)),e.selection||i.some(d=>d.hasResult()&&e.changes.touchesRange(d.from,d.to))||!GK(i,this.active)||c?l=$u.build(i,n,this.id,l,r,c):l&&l.disabled&&!i.some(d=>d.isPending)&&(l=null),!l&&i.every(d=>!d.isPending)&&i.some(d=>d.hasResult())&&(i=i.map(d=>d.hasResult()?new Si(d.source,0):d));for(let d of e.effects)d.is(m_)&&(l=l&&l.setSelected(d.value,this.id));return i==this.active&&l==this.open?this:new Fg(i,this.id,l)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?XK:YK}}function GK(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}const KK=[];function f_(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(Zw);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Si{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=f_(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new Si(s.source,0)),r&4&&s.state==0&&(s=new Si(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(qg))s=new Si(s.source,1,i.value);else if(i.is(Mf))s=new Si(s.source,0);else if(i.is(Jw))for(let l of i.value)l.source==s.source&&(s=l);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(gc(e.state))}}class Ku extends Si{constructor(e,n,r,s,i,l){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=l}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),l=e.changes.mapPos(this.to,1),c=gc(e.state);if(c>l||!s||n&2&&(gc(e.startState)==this.from||cn.map(e))}}),m_=xt.define(),As=Br.define({create(){return Fg.start()},update(t,e){return t.update(e)},provide:t=>[Dw.from(t,e=>e.tooltip),qe.contentAttributes.from(t,e=>e.attrs)]});function e5(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(As).active.find(s=>s.source==e.source);return r instanceof Ku?(typeof n=="string"?t.dispatch({...LK(t.state,n,r.from,r.to),annotations:Zw.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const JK=UK(As,e5);function bp(t,e="option"){return n=>{let r=n.state.field(As,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+s*(t?1:-1):t?0:l-1;return c<0?c=e=="page"?0:l-1:c>=l&&(c=e=="page"?l-1:0),n.dispatch({effects:m_.of(c)}),!0}}const eZ=t=>{let e=t.state.field(As,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(As,!1)?(t.dispatch({effects:qg.of(!0)}),!0):!1,tZ=t=>{let e=t.state.field(As,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Mf.of(null)}),!0)};class nZ{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const rZ=50,sZ=1e3,iZ=lr.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(As).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(As),n=t.state.facet(Dr);if(!t.selectionSet&&!t.docChanged&&t.startState.field(As)==e)return;let r=t.transactions.some(i=>{let l=f_(i,n);return l&8||(i.selection||i.docChanged)&&!(l&3)});for(let i=0;irZ&&Date.now()-l.time>sZ){for(let c of l.context.abortListeners)try{c()}catch(d){Es(this.view.state,d)}l.context.abortListeners=null,this.running.splice(i--,1)}else l.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(l=>l.is(qg)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(l=>l.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(As);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Dr).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=gc(e),r=new u_(e,n,t.explicit,this.view),s=new nZ(t,r);this.running.push(s),Promise.resolve(t.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:Mf.of(null)}),Es(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Dr).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Dr),r=this.view.state.field(As);for(let s=0;sc.source==i.active.source);if(l&&l.isPending)if(i.done==null){let c=new Si(i.active.source,0);for(let d of i.updates)c=c.update(d,n);c.isPending||e.push(c)}else this.startQuery(l)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:Jw.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(As,!1);if(e&&e.tooltip&&this.view.state.facet(Dr).closeOnBlur){let n=e.open&&QA(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Mf.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:qg.of(!1)}),20),this.composing=0}}}),aZ=typeof navigator=="object"&&/Win/.test(navigator.platform),lZ=jo.highest(qe.domEventHandlers({keydown(t,e){let n=e.state.field(As,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(aZ&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(l=>l.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&e5(e,r),!1}})),p_=qe.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class oZ{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class t5{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Ur.TrackDel),r=e.mapPos(this.to,1,Ur.TrackDel);return n==null||r==null?null:new t5(this.field,n,r)}}class n5{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),l=/^\s*/.exec(i.text)[0];for(let d of this.lines){if(r.length){let h=l,m=/^\t*/.exec(d)[0].length;for(let p=0;pnew t5(d.field,s[d.line]+d.from,s[d.line]+d.to));return{text:r,ranges:c}}static parse(e){let n=[],r=[],s=[],i;for(let l of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(l);){let c=i[1]?+i[1]:null,d=i[2]||i[3]||"",h=-1,m=d.replace(/\\[{}]/g,p=>p[1]);for(let p=0;p=h&&x.field++}for(let p of s)if(p.line==r.length&&p.from>i.index){let x=i[2]?3+(i[1]||"").length:2;p.from-=x,p.to-=x}s.push(new oZ(h,r.length,i.index,i.index+m.length)),l=l.slice(0,i.index)+d+l.slice(i.index+i[0].length)}l=l.replace(/\\([{}])/g,(c,d,h)=>{for(let m of s)m.line==r.length&&m.from>h&&(m.from--,m.to--);return d}),r.push(l)}return new n5(r,s)}}let cZ=Je.widget({widget:new class extends Oa{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),uZ=Je.mark({class:"cm-snippetField"});class Ed{constructor(e,n){this.ranges=e,this.active=n,this.deco=Je.set(e.map(r=>(r.from==r.to?cZ:uZ).range(r.from,r.to)),!0)}map(e){let n=[];for(let r of this.ranges){let s=r.map(e);if(!s)return null;n.push(s)}return new Ed(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const p0=xt.define({map(t,e){return t&&t.map(e)}}),dZ=xt.define(),Af=Br.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(p0))return n.value;if(n.is(dZ)&&t)return new Ed(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>qe.decorations.from(t,e=>e?e.deco:Je.none)});function r5(t,e){return Ce.create(t.filter(n=>n.field==e).map(n=>Ce.range(n.from,n.to)))}function hZ(t){let e=n5.parse(t);return(n,r,s,i)=>{let{text:l,ranges:c}=e.instantiate(n.state,s),{main:d}=n.state.selection,h={changes:{from:s,to:i==d.from?d.to:i,insert:Wt.of(l)},scrollIntoView:!0,annotations:r?[Zw.of(r),gr.userEvent.of("input.complete")]:void 0};if(c.length&&(h.selection=r5(c,0)),c.some(m=>m.field>0)){let m=new Ed(c,0),p=h.effects=[p0.of(m)];n.state.field(Af,!1)===void 0&&p.push(xt.appendConfig.of([Af,xZ,vZ,p_]))}n.dispatch(n.state.update(h))}}function g_(t){return({state:e,dispatch:n})=>{let r=e.field(Af,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(l=>l.field==s+t);return n(e.update({selection:r5(r.ranges,s),effects:p0.of(i?null:new Ed(r.ranges,s)),scrollIntoView:!0})),!0}}const fZ=({state:t,dispatch:e})=>t.field(Af,!1)?(e(t.update({effects:p0.of(null)})),!0):!1,mZ=g_(1),pZ=g_(-1),gZ=[{key:"Tab",run:mZ,shift:pZ},{key:"Escape",run:fZ}],E7=He.define({combine(t){return t.length?t[0]:gZ}}),xZ=jo.highest(o0.compute([E7],t=>t.facet(E7)));function Xa(t,e){return{...e,apply:hZ(t)}}const vZ=qe.domEventHandlers({mousedown(t,e){let n=e.state.field(Af,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let s=n.ranges.find(i=>i.from<=r&&i.to>=r);return!s||s.field==n.active?!1:(e.dispatch({selection:r5(n.ranges,s.field),effects:p0.of(n.ranges.some(i=>i.field>s.field)?new Ed(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),Ef={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},oc=xt.define({map(t,e){let n=e.mapPos(t,-1,Ur.TrackAfter);return n??void 0}}),s5=new class extends yc{};s5.startSide=1;s5.endSide=-1;const x_=Br.define({create(){return Gt.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(oc)&&(t=t.update({add:[s5.range(n.value,n.value+1)]}));return t}});function yZ(){return[wZ,x_]}const Jy="()[]{}<>«»»«[]{}";function v_(t){for(let e=0;e{if((bZ?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&aa(Ms(r,0))==1||e!=s.from||n!=s.to)return!1;let i=OZ(t.state,r);return i?(t.dispatch(i),!0):!1}),SZ=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=y_(t,t.selection.main.head).brackets||Ef.brackets,s=null,i=t.changeByRange(l=>{if(l.empty){let c=jZ(t.doc,l.head);for(let d of r)if(d==c&&Dx(t.doc,l.head)==v_(Ms(d,0)))return{changes:{from:l.head-d.length,to:l.head+d.length},range:Ce.cursor(l.head-d.length)}}return{range:s=l}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},kZ=[{key:"Backspace",run:SZ}];function OZ(t,e){let n=y_(t,t.selection.main.head),r=n.brackets||Ef.brackets;for(let s of r){let i=v_(Ms(s,0));if(e==s)return i==s?TZ(t,s,r.indexOf(s+s+s)>-1,n):NZ(t,s,i,n.before||Ef.before);if(e==i&&b_(t,t.selection.main.from))return CZ(t,s,i)}return null}function b_(t,e){let n=!1;return t.field(x_).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function Dx(t,e){let n=t.sliceString(e,e+2);return n.slice(0,aa(Ms(n,0)))}function jZ(t,e){let n=t.sliceString(e-2,e);return aa(Ms(n,0))==n.length?n:n.slice(1)}function NZ(t,e,n,r){let s=null,i=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:n,from:l.to}],effects:oc.of(l.to+e.length),range:Ce.range(l.anchor+e.length,l.head+e.length)};let c=Dx(t.doc,l.head);return!c||/\s/.test(c)||r.indexOf(c)>-1?{changes:{insert:e+n,from:l.head},effects:oc.of(l.head+e.length),range:Ce.cursor(l.head+e.length)}:{range:s=l}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function CZ(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&Dx(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Ce.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function TZ(t,e,n,r){let s=r.stringPrefixes||Ef.stringPrefixes,i=null,l=t.changeByRange(c=>{if(!c.empty)return{changes:[{insert:e,from:c.from},{insert:e,from:c.to}],effects:oc.of(c.to+e.length),range:Ce.range(c.anchor+e.length,c.head+e.length)};let d=c.head,h=Dx(t.doc,d),m;if(h==e){if(_7(t,d))return{changes:{insert:e+e,from:d},effects:oc.of(d+e.length),range:Ce.cursor(d+e.length)};if(b_(t,d)){let x=n&&t.sliceDoc(d,d+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:d,to:d+x.length,insert:x},range:Ce.cursor(d+x.length)}}}else{if(n&&t.sliceDoc(d-2*e.length,d)==e+e&&(m=D7(t,d-2*e.length,s))>-1&&_7(t,m))return{changes:{insert:e+e+e+e,from:d},effects:oc.of(d+e.length),range:Ce.cursor(d+e.length)};if(t.charCategorizer(d)(h)!=Vn.Word&&D7(t,d,s)>-1&&!MZ(t,d,e,s))return{changes:{insert:e+e,from:d},effects:oc.of(d+e.length),range:Ce.cursor(d+e.length)}}return{range:i=c}});return i?null:t.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function _7(t,e){let n=zr(t).resolveInner(e+1);return n.parent&&n.from==e}function MZ(t,e,n,r){let s=zr(t).resolveInner(e,-1),i=r.reduce((l,c)=>Math.max(l,c.length),0);for(let l=0;l<5;l++){let c=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),d=c.indexOf(n);if(!d||d>-1&&r.indexOf(c.slice(0,d))>-1){let m=s.firstChild;for(;m&&m.from==s.from&&m.to-m.from>n.length+d;){if(t.sliceDoc(m.to-n.length,m.to)==n)return!1;m=m.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function D7(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Vn.Word)return e;for(let s of n){let i=e-s.length;if(t.sliceDoc(i,e)==s&&r(t.sliceDoc(i-1,i))!=Vn.Word)return i}return-1}function AZ(t={}){return[lZ,As,Dr.of(t),iZ,EZ,p_]}const w_=[{key:"Ctrl-Space",run:Zy},{mac:"Alt-`",run:Zy},{mac:"Alt-i",run:Zy},{key:"Escape",run:tZ},{key:"ArrowDown",run:bp(!0)},{key:"ArrowUp",run:bp(!1)},{key:"PageDown",run:bp(!0,"page")},{key:"PageUp",run:bp(!1,"page")},{key:"Enter",run:eZ}],EZ=jo.highest(o0.computeN([Dr],t=>t.facet(Dr).defaultKeymap?[w_]:[]));class R7{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class sc{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(_f).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((v,b)=>v.from-b.from||v.to-b.to),l=new fl,c=[],d=0,h=r.doc.iter(),m=0,p=r.doc.length;for(let v=0;;){let b=v==i.length?null:i[v];if(!b&&!c.length)break;let k,O;if(c.length)k=d,O=c.reduce((M,_)=>Math.min(M,_.to),b&&b.from>k?b.from:1e8);else{if(k=b.from,k>p)break;O=b.to,c.push(b),v++}for(;vM.from||M.to==k))c.push(M),v++,O=Math.min(M.to,O);else{O=Math.min(M.from,O);break}}O=Math.min(O,p);let j=!1;if(c.some(M=>M.from==k&&(M.to==O||O==p))&&(j=k==O,!j&&O-k<10)){let M=k-(m+h.value.length);M>0&&(h.next(M),m=k);for(let _=k;;){if(_>=O){j=!0;break}if(!h.lineBreak&&m+h.value.length>_)break;_=m+h.value.length,m+=h.value.length,h.next()}}let T=HZ(c);if(j)l.add(k,k,Je.widget({widget:new qZ(T),diagnostics:c.slice()}));else{let M=c.reduce((_,D)=>D.markClass?_+" "+D.markClass:_,"");l.add(k,O,Je.mark({class:"cm-lintRange cm-lintRange-"+T+M,diagnostics:c.slice(),inclusiveEnd:c.some(_=>_.to>O)}))}if(d=O,d==p)break;for(let M=0;M{if(!(e&&l.diagnostics.indexOf(e)<0))if(!r)r=new R7(s,i,e||l.diagnostics[0]);else{if(l.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new R7(r.from,i,r.diagnostic)}}),r}function _Z(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(_f).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(l=>l.is(S_))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function DZ(t,e){return t.field(ni,!1)?e:e.concat(xt.appendConfig.of(UZ))}const S_=xt.define(),i5=xt.define(),k_=xt.define(),ni=Br.define({create(){return new sc(Je.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,s=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=xd(n,t.selected.diagnostic,i)||xd(n,null,i)}!n.size&&s&&e.state.facet(_f).autoPanel&&(s=null),t=new sc(n,s,r)}for(let n of e.effects)if(n.is(S_)){let r=e.state.facet(_f).autoPanel?n.value.length?Df.open:null:t.panel;t=sc.init(n.value,r,e.state)}else n.is(i5)?t=new sc(t.diagnostics,n.value?Df.open:null,t.selected):n.is(k_)&&(t=new sc(t.diagnostics,t.panel,n.value));return t},provide:t=>[Sf.from(t,e=>e.panel),qe.decorations.from(t,e=>e.diagnostics)]}),RZ=Je.mark({class:"cm-lintRange cm-lintRange-active"});function zZ(t,e,n){let{diagnostics:r}=t.state.field(ni),s,i=-1,l=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(d,h,{spec:m})=>{if(e>=d&&e<=h&&(d==h||(e>d||n>0)&&(ej_(t,n,!1)))}const BZ=t=>{let e=t.state.field(ni,!1);(!e||!e.panel)&&t.dispatch({effects:DZ(t.state,[i5.of(!0)])});let n=wf(t,Df.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},z7=t=>{let e=t.state.field(ni,!1);return!e||!e.panel?!1:(t.dispatch({effects:i5.of(!1)}),!0)},LZ=t=>{let e=t.state.field(ni,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},IZ=[{key:"Mod-Shift-m",run:BZ,preventDefault:!0},{key:"F8",run:LZ}],_f=He.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...ka(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:P7,tooltipFilter:P7,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,s,i)=>e(r,s,i)||n(r,s,i):e:n,autoPanel:(e,n)=>e||n})}}});function P7(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function O_(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;ri.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function j_(t,e,n){var r;let s=n?O_(e.actions):[];return An("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},An("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,l)=>{let c=!1,d=v=>{if(v.preventDefault(),c)return;c=!0;let b=xd(t.state.field(ni).diagnostics,e);b&&i.apply(t,b.from,b.to)},{name:h}=i,m=s[l]?h.indexOf(s[l]):-1,p=m<0?h:[h.slice(0,m),An("u",h.slice(m,m+1)),h.slice(m+1)],x=i.markClass?" "+i.markClass:"";return An("button",{type:"button",class:"cm-diagnosticAction"+x,onclick:d,onmousedown:d,"aria-label":` Action: ${h}${m<0?"":` (access key "${s[l]})"`}.`},p)}),e.source&&An("div",{class:"cm-diagnosticSource"},e.source))}class qZ extends Oa{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return An("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class B7{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=j_(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Df{constructor(e){this.view=e,this.items=[];let n=s=>{if(s.keyCode==27)z7(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],l=O_(i.actions);for(let c=0;c{for(let i=0;iz7(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(ni).selected;if(!e)return-1;for(let n=0;n{for(let m of h.diagnostics){if(l.has(m))continue;l.add(m);let p=-1,x;for(let v=r;vr&&(this.items.splice(r,p-r),s=!0)),n&&x.diagnostic==n.diagnostic?x.dom.hasAttribute("aria-selected")||(x.dom.setAttribute("aria-selected","true"),i=x):x.dom.hasAttribute("aria-selected")&&x.dom.removeAttribute("aria-selected"),r++}});r({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:c,panel:d})=>{let h=d.height/this.list.offsetHeight;c.topd.bottom&&(this.list.scrollTop+=(c.bottom-d.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(ni),r=xd(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:k_.of(r)})}static open(e){return new Df(e)}}function FZ(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function wp(t){return FZ(``,'width="6" height="3"')}const QZ=qe.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:wp("#d11")},".cm-lintRange-warning":{backgroundImage:wp("orange")},".cm-lintRange-info":{backgroundImage:wp("#999")},".cm-lintRange-hint":{backgroundImage:wp("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function $Z(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function HZ(t){let e="hint",n=1;for(let r of t){let s=$Z(r.severity);s>n&&(n=s,e=r.severity)}return e}const UZ=[ni,qe.decorations.compute([ni],t=>{let{selected:e,panel:n}=t.field(ni);return!e||!n||e.from==e.to?Je.none:Je.set([RZ.range(e.from,e.to)])}),NG(zZ,{hideOn:_Z}),QZ];var L7=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(kZ)),e.defaultKeymap!==!1&&(r=r.concat(aK)),e.searchKeymap!==!1&&(r=r.concat(_K)),e.historyKeymap!==!1&&(r=r.concat(fY)),e.foldKeymap!==!1&&(r=r.concat(kX)),e.completionKeymap!==!1&&(r=r.concat(w_)),e.lintKeymap!==!1&&(r=r.concat(IZ));var s=[];return e.lineNumbers!==!1&&s.push(BG()),e.highlightActiveLineGutter!==!1&&s.push(qG()),e.highlightSpecialChars!==!1&&s.push(tG()),e.history!==!1&&s.push(sY()),e.foldGutter!==!1&&s.push(CX()),e.drawSelection!==!1&&s.push(HW()),e.dropCursor!==!1&&s.push(XW()),e.allowMultipleSelections!==!1&&s.push(Vt.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(mX()),e.syntaxHighlighting!==!1&&s.push(hE(EX,{fallback:!0})),e.bracketMatching!==!1&&s.push(LX()),e.closeBrackets!==!1&&s.push(yZ()),e.autocompletion!==!1&&s.push(AZ()),e.rectangularSelection!==!1&&s.push(pG()),n!==!1&&s.push(vG()),e.highlightActiveLine!==!1&&s.push(lG()),e.highlightSelectionMatches!==!1&&s.push(fK()),e.tabSize&&typeof e.tabSize=="number"&&s.push(u0.of(" ".repeat(e.tabSize))),s.concat([o0.of(r.flat())]).filter(Boolean)};const VZ="#e5c07b",I7="#e06c75",WZ="#56b6c2",GZ="#ffffff",sg="#abb2bf",o4="#7d8799",XZ="#61afef",YZ="#98c379",q7="#d19a66",KZ="#c678dd",ZZ="#21252b",F7="#2c313a",Q7="#282c34",eb="#353a42",JZ="#3E4451",$7="#528bff",eJ=qe.theme({"&":{color:sg,backgroundColor:Q7},".cm-content":{caretColor:$7},".cm-cursor, .cm-dropCursor":{borderLeftColor:$7},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:JZ},".cm-panels":{backgroundColor:ZZ,color:sg},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Q7,color:o4,border:"none"},".cm-activeLineGutter":{backgroundColor:F7},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:eb},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:eb,borderBottomColor:eb},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:F7,color:sg}}},{dark:!0}),tJ=h0.define([{tag:he.keyword,color:KZ},{tag:[he.name,he.deleted,he.character,he.propertyName,he.macroName],color:I7},{tag:[he.function(he.variableName),he.labelName],color:XZ},{tag:[he.color,he.constant(he.name),he.standard(he.name)],color:q7},{tag:[he.definition(he.name),he.separator],color:sg},{tag:[he.typeName,he.className,he.number,he.changed,he.annotation,he.modifier,he.self,he.namespace],color:VZ},{tag:[he.operator,he.operatorKeyword,he.url,he.escape,he.regexp,he.link,he.special(he.string)],color:WZ},{tag:[he.meta,he.comment],color:o4},{tag:he.strong,fontWeight:"bold"},{tag:he.emphasis,fontStyle:"italic"},{tag:he.strikethrough,textDecoration:"line-through"},{tag:he.link,color:o4,textDecoration:"underline"},{tag:he.heading,fontWeight:"bold",color:I7},{tag:[he.atom,he.bool,he.special(he.variableName)],color:q7},{tag:[he.processingInstruction,he.string,he.inserted],color:YZ},{tag:he.invalid,color:GZ}]),N_=[eJ,hE(tJ)];var nJ=qe.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),rJ=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:i="light",placeholder:l="",basicSetup:c=!0}=e,d=[];switch(n&&d.unshift(o0.of([lK])),c&&(typeof c=="boolean"?d.unshift(L7()):d.unshift(L7(c))),l&&d.unshift(dG(l)),i){case"light":d.push(nJ);break;case"dark":d.push(N_);break;case"none":break;default:d.push(i);break}return r===!1&&d.push(qe.editable.of(!1)),s&&d.push(Vt.readOnly.of(!0)),[...d]},sJ=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class iJ{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class H7{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var tb=null,aJ=()=>typeof window>"u"?new H7:(tb||(tb=new H7),tb),U7=Sa.define(),lJ=200,oJ=[];function cJ(t){var{value:e,selection:n,onChange:r,onStatistics:s,onCreateEditor:i,onUpdate:l,extensions:c=oJ,autoFocus:d,theme:h="light",height:m=null,minHeight:p=null,maxHeight:x=null,width:v=null,minWidth:b=null,maxWidth:k=null,placeholder:O="",editable:j=!0,readOnly:T=!1,indentWithTab:M=!0,basicSetup:_=!0,root:D,initialState:E}=t,[z,Q]=S.useState(),[F,L]=S.useState(),[U,V]=S.useState(),ce=S.useState(()=>({current:null}))[0],W=S.useState(()=>({current:null}))[0],J=qe.theme({"&":{height:m,minHeight:p,maxHeight:x,width:v,minWidth:b,maxWidth:k},"& .cm-scroller":{height:"100% !important"}}),H=qe.updateListener.of(ue=>{if(ue.docChanged&&typeof r=="function"&&!ue.transactions.some(Y=>Y.annotation(U7))){ce.current?ce.current.reset():(ce.current=new iJ(()=>{if(W.current){var Y=W.current;W.current=null,Y()}ce.current=null},lJ),aJ().add(ce.current));var R=ue.state.doc,me=R.toString();r(me,ue)}s&&s(sJ(ue))}),ae=rJ({theme:h,editable:j,readOnly:T,placeholder:O,indentWithTab:M,basicSetup:_}),ne=[H,J,...ae];return l&&typeof l=="function"&&ne.push(qe.updateListener.of(l)),ne=ne.concat(c),S.useLayoutEffect(()=>{if(z&&!U){var ue={doc:e,selection:n,extensions:ne},R=E?Vt.fromJSON(E.json,ue,E.fields):Vt.create(ue);if(V(R),!F){var me=new qe({state:R,parent:z,root:D});L(me),i&&i(me,R)}}return()=>{F&&(V(void 0),L(void 0))}},[z,U]),S.useEffect(()=>{t.container&&Q(t.container)},[t.container]),S.useEffect(()=>()=>{F&&(F.destroy(),L(void 0)),ce.current&&(ce.current.cancel(),ce.current=null)},[F]),S.useEffect(()=>{d&&F&&F.focus()},[d,F]),S.useEffect(()=>{F&&F.dispatch({effects:xt.reconfigure.of(ne)})},[h,c,m,p,x,v,b,k,O,j,T,M,_,r,l]),S.useEffect(()=>{if(e!==void 0){var ue=F?F.state.doc.toString():"";if(F&&e!==ue){var R=ce.current&&!ce.current.isDone,me=()=>{F&&e!==F.state.doc.toString()&&F.dispatch({changes:{from:0,to:F.state.doc.toString().length,insert:e||""},annotations:[U7.of(!0)]})};R?W.current=me:me()}}},[e,F]),{state:U,setState:V,view:F,setView:L,container:z,setContainer:Q}}var uJ=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],C_=S.forwardRef((t,e)=>{var{className:n,value:r="",selection:s,extensions:i=[],onChange:l,onStatistics:c,onCreateEditor:d,onUpdate:h,autoFocus:m,theme:p="light",height:x,minHeight:v,maxHeight:b,width:k,minWidth:O,maxWidth:j,basicSetup:T,placeholder:M,indentWithTab:_,editable:D,readOnly:E,root:z,initialState:Q}=t,F=VI(t,uJ),L=S.useRef(null),{state:U,view:V,container:ce,setContainer:W}=cJ({root:z,value:r,autoFocus:m,theme:p,height:x,minHeight:v,maxHeight:b,width:k,minWidth:O,maxWidth:j,basicSetup:T,placeholder:M,indentWithTab:_,editable:D,readOnly:E,selection:s,onChange:l,onStatistics:c,onCreateEditor:d,onUpdate:h,extensions:i,initialState:Q});S.useImperativeHandle(e,()=>({editor:L.current,state:U,view:V}),[L,ce,U,V]);var J=S.useCallback(ae=>{L.current=ae,W(ae)},[W]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var H=typeof p=="string"?"cm-theme-"+p:"cm-theme";return a.jsx("div",WI({ref:J,className:""+H+(n?" "+n:"")},F))});C_.displayName="CodeMirror";var V7={};class Qg{constructor(e,n,r,s,i,l,c,d,h,m=0,p){this.p=e,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=l,this.buffer=c,this.bufferBase=d,this.curContext=h,this.lookAhead=m,this.parent=p}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let s=e.parser.context;return new Qg(e,[],n,r,r,0,[],0,s?new W7(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,s=e&65535,{parser:i}=this.p,l=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=m):this.p.lastBigReductionSized;)this.stack.pop();this.reduceContext(s,h)}storeNode(e,n,r,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&l.buffer[c-4]==0&&l.buffer[c-1]>-1){if(n==r)return;if(l.buffer[c-2]>=n){l.buffer[c-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,s);else{let l=this.buffer.length;if(l>0&&(this.buffer[l-4]!=0||this.buffer[l-1]<0)){let c=!1;for(let d=l;d>0&&this.buffer[d-2]>r;d-=4)if(this.buffer[d-1]>=0){c=!0;break}if(c)for(;l>0&&this.buffer[l-2]>r;)this.buffer[l]=this.buffer[l-4],this.buffer[l+1]=this.buffer[l-3],this.buffer[l+2]=this.buffer[l-2],this.buffer[l+3]=this.buffer[l-1],l-=4,s>4&&(s-=4)}this.buffer[l]=e,this.buffer[l+1]=n,this.buffer[l+2]=r,this.buffer[l+3]=s}}shift(e,n,r,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:l}=this.p;(s>this.pos||n<=l.maxNode)&&(this.pos=s,l.stateFlag(i,1)||(this.reducePos=s)),this.pushState(i,r),this.shiftContext(n,r),n<=l.maxNode&&this.buffer.push(n,r,s,4)}else this.pos=s,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,s,4)}apply(e,n,r,s){e&65536?this.reduce(e):this.shift(e,n,r,s)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(n,s),this.buffer.push(r,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),s=e.bufferBase+n;for(;e&&s==e.bufferBase;)e=e.parent;return new Qg(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new dJ(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let s=[];for(let i=0,l;id&1&&c==l)||s.push(n[i],l)}n=s}let r=[];for(let s=0;s>19,s=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let l=this.findForcedReduction();if(l==null)return!1;n=l}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(s,i)=>{if(!n.includes(s))return n.push(s),e.allActions(s,l=>{if(!(l&393216))if(l&65536){let c=(l>>19)-i;if(c>1){let d=l&65535,h=this.stack.length-c*3;if(h>=0&&e.getGoto(this.stack[h],d,!1)>=0)return c<<19|65536|d}}else{let c=r(l,i+1);if(c!=null)return c}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;nthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class W7{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class dJ{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=s}}class $g{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new $g(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new $g(this.stack,this.pos,this.index)}}function Sp(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r=92&&l--,l>=34&&l--;let d=l-32;if(d>=46&&(d-=46,c=!0),i+=d,c)break;i*=46}n?n[s++]=i:n=new e(i)}return n}class ig{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const G7=new ig;class hJ{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=G7,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,s=this.rangeIndex,i=this.pos+e;for(;ir.to:i>=r.to;){if(s==this.ranges.length-1)return null;let l=this.ranges[++s];i+=l.from-r.to,r=l}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n=this.chunk2Pos&&rc.to&&(this.chunk2=this.chunk2.slice(0,c.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=G7,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let s of this.ranges){if(s.from>=n)break;s.to>e&&(r+=this.input.read(Math.max(s.from,e),Math.min(s.to,n)))}return r}}class Zu{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;fJ(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Zu.prototype.contextual=Zu.prototype.fallback=Zu.prototype.extend=!1;Zu.prototype.fallback=Zu.prototype.extend=!1;class Rx{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function fJ(t,e,n,r,s,i){let l=0,c=1<0){let b=t[v];if(d.allows(b)&&(e.token.value==-1||e.token.value==b||mJ(b,e.token.value,s,i))){e.acceptToken(b);break}}let m=e.next,p=0,x=t[l+2];if(e.next<0&&x>p&&t[h+x*3-3]==65535){l=t[h+x*3-1];continue e}for(;p>1,b=h+v+(v<<1),k=t[b],O=t[b+1]||65536;if(m=O)p=v+1;else{l=t[b+2],e.advance();continue e}}break}}function X7(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function mJ(t,e,n,r){let s=X7(n,r,e);return s<0||X7(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class pJ{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Y7(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Y7(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=l,null;if(i instanceof Dn){if(l==e){if(l=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(l),this.index.push(0))}else this.index[n]++,this.nextStart=l+i.length}}}class gJ{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new ig)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,l=s.stateSlot(e.state,3),c=e.curContext?e.curContext.hash:0,d=0;for(let h=0;hp.end+25&&(d=Math.max(p.lookAhead,d)),p.value!=0)){let x=n;if(p.extended>-1&&(n=this.addActions(e,p.extended,p.end,n)),n=this.addActions(e,p.value,p.end,n),!m.extend&&(r=p,n>x))break}}for(;this.actions.length>n;)this.actions.pop();return d&&e.setLookAhead(d),!r&&e.pos==this.stream.end&&(r=new ig,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new ig,{pos:r,p:s}=e;return n.start=r,n.end=Math.min(r+1,s.stream.end),n.value=r==s.stream.end?s.parser.eofTerm:0,n}updateCachedToken(e,n,r){let s=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(s,e),r),e.value>-1){let{parser:i}=r.p;for(let l=0;l=0&&r.p.parser.dialect.allows(c>>1)){(c&1)==0?e.value=c>>1:e.extended=c>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;ie.bufferLength*4?new pJ(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],s,i;if(this.bigReductionCount>300&&e.length==1){let[l]=e;for(;l.forceReduce()&&l.stack.length&&l.stack[l.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let l=0;ln)r.push(c);else{if(this.advanceStack(c,r,e))continue;{s||(s=[],i=[]),s.push(c);let d=this.tokens.getMainToken(c);i.push(d.value,d.end)}}break}}if(!r.length){let l=s&&bJ(s);if(l)return Ys&&console.log("Finish with "+this.stackID(l)),this.stackToTree(l);if(this.parser.strict)throw Ys&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&s){let l=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,r);if(l)return Ys&&console.log("Force-finish "+this.stackID(l)),this.stackToTree(l.forceAll())}if(this.recovering){let l=this.recovering==1?1:this.recovering*3;if(r.length>l)for(r.sort((c,d)=>d.score-c.score);r.length>l;)r.pop();r.some(c=>c.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let l=0;l500&&h.buffer.length>500)if((c.score-h.score||c.buffer.length-h.buffer.length)>0)r.splice(d--,1);else{r.splice(l--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let l=1;l ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,m=h?e.curContext.hash:0;for(let p=this.fragments.nodeAt(s);p;){let x=this.parser.nodeSet.types[p.type.id]==p.type?i.getGoto(e.state,p.type.id):-1;if(x>-1&&p.length&&(!h||(p.prop(Et.contextHash)||0)==m))return e.useNode(p,x),Ys&&console.log(l+this.stackID(e)+` (via reuse of ${i.getName(p.type.id)})`),!0;if(!(p instanceof Dn)||p.children.length==0||p.positions[0]>0)break;let v=p.children[0];if(v instanceof Dn&&p.positions[0]==0)p=v;else break}}let c=i.stateSlot(e.state,4);if(c>0)return e.reduce(c),Ys&&console.log(l+this.stackID(e)+` (via always-reduce ${i.getName(c&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let d=this.tokens.getActions(e);for(let h=0;hs?n.push(b):r.push(b)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return K7(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let l=0;l ":"";if(c.deadEnd&&(i||(i=!0,c.restart(),Ys&&console.log(m+this.stackID(c)+" (restarted)"),this.advanceFully(c,r))))continue;let p=c.split(),x=m;for(let v=0;v<10&&p.forceReduce()&&(Ys&&console.log(x+this.stackID(p)+" (via force-reduce)"),!this.advanceFully(p,r));v++)Ys&&(x=this.stackID(p)+" -> ");for(let v of c.recoverByInsert(d))Ys&&console.log(m+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,r);this.stream.end>c.pos?(h==c.pos&&(h++,d=0),c.recoverByDelete(d,h),Ys&&console.log(m+this.stackID(c)+` (via recover-delete ${this.parser.getName(d)})`),K7(c,r)):(!s||s.scoret;class yJ{constructor(e){this.start=e.start,this.shift=e.shift||rb,this.reduce=e.reduce||rb,this.reuse=e.reuse||rb,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Rf extends Bw{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let c=0;ce.topRules[c][1]),s=[];for(let c=0;c=0)i(m,d,c[h++]);else{let p=c[h+-m];for(let x=-m;x>0;x--)i(c[h++],d,p);h++}}}this.nodeSet=new jx(n.map((c,d)=>gs.define({name:d>=this.minRepeatTerm?void 0:c,id:d,props:s[d],top:r.indexOf(d)>-1,error:d==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(d)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=VA;let l=Sp(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let c=0;ctypeof c=="number"?new Zu(l,c):c),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let s=new xJ(this,e,n,r);for(let i of this.wrappers)s=i(s,e,n,r);return s}getGoto(e,n,r=!1){let s=this.goto;if(n>=s[0])return-1;for(let i=s[n+1];;){let l=s[i++],c=l&1,d=s[i++];if(c&&r)return d;for(let h=i+(l>>1);i0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),s=r?n(r):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=nl(this.data,i+2);else break;s=n(nl(this.data,i+1))}return s}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=nl(this.data,r+2);else break;if((this.data[r+2]&1)==0){let s=this.data[r+1];n.some((i,l)=>l&1&&i==s)||n.push(this.data[r],s)}}return n}configure(e){let n=Object.assign(Object.create(Rf.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let s=e.tokenizers.find(i=>i.from==r);return s?s.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,s)=>{let i=e.specializers.find(c=>c.from==r.external);if(!i)return r;let l=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=Z7(l),l})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let l=n.indexOf(i);l>=0&&(r[l]=!0)}let s=null;for(let i=0;ir)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}const wJ=1,T_=194,M_=195,SJ=196,J7=197,kJ=198,OJ=199,jJ=200,NJ=2,A_=3,e8=201,CJ=24,TJ=25,MJ=49,AJ=50,EJ=55,_J=56,DJ=57,RJ=59,zJ=60,PJ=61,BJ=62,LJ=63,IJ=65,qJ=238,FJ=71,QJ=241,$J=242,HJ=243,UJ=244,VJ=245,WJ=246,GJ=247,XJ=248,E_=72,YJ=249,KJ=250,ZJ=251,JJ=252,eee=253,tee=254,nee=255,ree=256,see=73,iee=77,aee=263,lee=112,oee=130,cee=151,uee=152,dee=155,jc=10,zf=13,a5=32,zx=9,l5=35,hee=40,fee=46,c4=123,t8=125,__=39,D_=34,n8=92,mee=111,pee=120,gee=78,xee=117,vee=85,yee=new Set([TJ,MJ,AJ,aee,IJ,oee,_J,DJ,qJ,BJ,LJ,E_,see,iee,zJ,PJ,cee,uee,dee,lee]);function sb(t){return t==jc||t==zf}function ib(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}const bee=new Rx((t,e)=>{let n;if(t.next<0)t.acceptToken(OJ);else if(e.context.flags&ag)sb(t.next)&&t.acceptToken(kJ,1);else if(((n=t.peek(-1))<0||sb(n))&&e.canShift(J7)){let r=0;for(;t.next==a5||t.next==zx;)t.advance(),r++;(t.next==jc||t.next==zf||t.next==l5)&&t.acceptToken(J7,-r)}else sb(t.next)&&t.acceptToken(SJ,1)},{contextual:!0}),wee=new Rx((t,e)=>{let n=e.context;if(n.flags)return;let r=t.peek(-1);if(r==jc||r==zf){let s=0,i=0;for(;;){if(t.next==a5)s++;else if(t.next==zx)s+=8-s%8;else break;t.advance(),i++}s!=n.indent&&t.next!=jc&&t.next!=zf&&t.next!=l5&&(s[t,e|R_])),Oee=new yJ({start:See,reduce(t,e,n,r){return t.flags&ag&&yee.has(e)||(e==FJ||e==E_)&&t.flags&R_?t.parent:t},shift(t,e,n,r){return e==T_?new lg(t,kee(r.read(r.pos,n.pos)),0):e==M_?t.parent:e==CJ||e==EJ||e==RJ||e==A_?new lg(t,0,ag):r8.has(e)?new lg(t,0,r8.get(e)|t.flags&ag):t},hash(t){return t.hash}}),jee=new Rx(t=>{for(let e=0;e<5;e++){if(t.next!="print".charCodeAt(e))return;t.advance()}if(!/\w/.test(String.fromCharCode(t.next)))for(let e=0;;e++){let n=t.peek(e);if(!(n==a5||n==zx)){n!=hee&&n!=fee&&n!=jc&&n!=zf&&n!=l5&&t.acceptToken(wJ);return}}}),Nee=new Rx((t,e)=>{let{flags:n}=e.context,r=n&Za?D_:__,s=(n&Ja)>0,i=!(n&el),l=(n&tl)>0,c=t.pos;for(;!(t.next<0);)if(l&&t.next==c4)if(t.peek(1)==c4)t.advance(2);else{if(t.pos==c){t.acceptToken(A_,1);return}break}else if(i&&t.next==n8){if(t.pos==c){t.advance();let d=t.next;d>=0&&(t.advance(),Cee(t,d)),t.acceptToken(NJ);return}break}else if(t.next==n8&&!i&&t.peek(1)>-1)t.advance(2);else if(t.next==r&&(!s||t.peek(1)==r&&t.peek(2)==r)){if(t.pos==c){t.acceptToken(e8,s?3:1);return}break}else if(t.next==jc){if(s)t.advance();else if(t.pos==c){t.acceptToken(e8);return}break}else t.advance();t.pos>c&&t.acceptToken(jJ)});function Cee(t,e){if(e==mee)for(let n=0;n<2&&t.next>=48&&t.next<=55;n++)t.advance();else if(e==pee)for(let n=0;n<2&&ib(t.next);n++)t.advance();else if(e==xee)for(let n=0;n<4&&ib(t.next);n++)t.advance();else if(e==vee)for(let n=0;n<8&&ib(t.next);n++)t.advance();else if(e==gee&&t.next==c4){for(t.advance();t.next>=0&&t.next!=t8&&t.next!=__&&t.next!=D_&&t.next!=jc;)t.advance();t.next==t8&&t.advance()}}const Tee=Lw({'async "*" "**" FormatConversion FormatSpec':he.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":he.controlKeyword,"in not and or is del":he.operatorKeyword,"from def class global nonlocal lambda":he.definitionKeyword,import:he.moduleKeyword,"with as print":he.keyword,Boolean:he.bool,None:he.null,VariableName:he.variableName,"CallExpression/VariableName":he.function(he.variableName),"FunctionDefinition/VariableName":he.function(he.definition(he.variableName)),"ClassDefinition/VariableName":he.definition(he.className),PropertyName:he.propertyName,"CallExpression/MemberExpression/PropertyName":he.function(he.propertyName),Comment:he.lineComment,Number:he.number,String:he.string,FormatString:he.special(he.string),Escape:he.escape,UpdateOp:he.updateOperator,"ArithOp!":he.arithmeticOperator,BitOp:he.bitwiseOperator,CompareOp:he.compareOperator,AssignOp:he.definitionOperator,Ellipsis:he.punctuation,At:he.meta,"( )":he.paren,"[ ]":he.squareBracket,"{ }":he.brace,".":he.derefOperator,", ;":he.separator}),Mee={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},Aee=Rf.deserialize({version:14,states:"##jO`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[jee,wee,bee,Nee,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:t=>Mee[t]||-1}],tokenPrec:7668}),s8=new WG,z_=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function kp(t){return(e,n,r)=>{if(r)return!1;let s=e.node.getChild("VariableName");return s&&n(s,t),!0}}const Eee={FunctionDefinition:kp("function"),ClassDefinition:kp("class"),ForStatement(t,e,n){if(n){for(let r=t.node.firstChild;r;r=r.nextSibling)if(r.name=="VariableName")e(r,"variable");else if(r.name=="in")break}},ImportStatement(t,e){var n,r;let{node:s}=t,i=((n=s.firstChild)===null||n===void 0?void 0:n.name)=="from";for(let l=s.getChild("import");l;l=l.nextSibling)l.name=="VariableName"&&((r=l.nextSibling)===null||r===void 0?void 0:r.name)!="as"&&e(l,i?"variable":"namespace")},AssignStatement(t,e){for(let n=t.node.firstChild;n;n=n.nextSibling)if(n.name=="VariableName")e(n,"variable");else if(n.name==":"||n.name=="AssignOp")break},ParamList(t,e){for(let n=null,r=t.node.firstChild;r;r=r.nextSibling)r.name=="VariableName"&&(!n||!/\*|AssignOp/.test(n.name))&&e(r,"variable"),n=r},CapturePattern:kp("variable"),AsPattern:kp("variable"),__proto__:null};function P_(t,e){let n=s8.get(e);if(n)return n;let r=[],s=!0;function i(l,c){let d=t.sliceString(l.from,l.to);r.push({label:d,type:c})}return e.cursor(Or.IncludeAnonymous).iterate(l=>{if(l.name){let c=Eee[l.name];if(c&&c(l,i,s)||!s&&z_.has(l.name))return!1;s=!1}else if(l.to-l.from>8192){for(let c of P_(t,l.node))r.push(c);return!1}}),s8.set(e,r),r}const i8=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,B_=["String","FormatString","Comment","PropertyName"];function _ee(t){let e=zr(t.state).resolveInner(t.pos,-1);if(B_.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&i8.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let s=e;s;s=s.parent)z_.has(s.name)&&(r=r.concat(P_(t.state.doc,s)));return{options:r,from:n?e.from:t.pos,validFor:i8}}const Dee=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(t=>({label:t,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(t=>({label:t,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(t=>({label:t,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(t=>({label:t,type:"function"}))),Ree=[Xa("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),Xa("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),Xa("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),Xa("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),Xa(`if \${}: -`,{label:"if",detail:"block",type:"keyword"}),Ya("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),Ya("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),Ya("import ${module}",{label:"import",detail:"statement",type:"keyword"}),Ya("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],zee=BK(B_,d_(Dee.concat(Ree)));function ab(t){let{node:e,pos:n}=t,r=t.lineIndent(n,-1),s=null;for(;;){let i=e.childBefore(n);if(i)if(i.name=="Comment")n=i.from;else if(i.name=="Body"||i.name=="MatchBody")t.baseIndentFor(i)+t.unit<=r&&(s=i),e=i;else if(i.name=="MatchClause")e=i;else if(i.type.is("Statement"))e=i;else break;else break}return s}function lb(t,e){let n=t.baseIndentFor(e),r=t.lineAt(t.pos,-1),s=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&t.node.ton?null:n+t.unit}const ob=jf.define({name:"python",parser:Mee.configure({props:[Cx.add({Body:t=>{var e;let n=/^\s*(#|$)/.test(t.textAfter)&&ab(t)||t.node;return(e=lb(t,n))!==null&&e!==void 0?e:t.continue()},MatchBody:t=>{var e;let n=ab(t);return(e=lb(t,n||t.node))!==null&&e!==void 0?e:t.continue()},IfStatement:t=>/^\s*(else:|elif )/.test(t.textAfter)?t.baseIndent:t.continue(),"ForStatement WhileStatement":t=>/^\s*else:/.test(t.textAfter)?t.baseIndent:t.continue(),TryStatement:t=>/^\s*(except[ :]|finally:|else:)/.test(t.textAfter)?t.baseIndent:t.continue(),MatchStatement:t=>/^\s*case /.test(t.textAfter)?t.baseIndent+t.unit:t.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":Hy({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Hy({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Hy({closing:"]"}),MemberExpression:t=>t.baseIndent+t.unit,"String FormatString":()=>null,Script:t=>{var e;let n=ab(t);return(e=n&&lb(t,n))!==null&&e!==void 0?e:t.continue()}}),Fw.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":rE,Body:(t,e)=>({from:t.from+1,to:t.to-(t.to==e.doc.length?0:1)}),"String FormatString":(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function Pee(){return new eE(ob,[ob.data.of({autocomplete:_ee}),ob.data.of({autocomplete:zee})])}const Bee=Lw({String:he.string,Number:he.number,"True False":he.bool,PropertyName:he.propertyName,Null:he.null,", :":he.separator,"[ ]":he.squareBracket,"{ }":he.brace}),Lee=Rf.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[Bee],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Iee=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=qee(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function qee(t,e){let n;return(n=t.message.match(/at position (\d+)/))?Math.min(+n[1],e.length):(n=t.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+n[1]).from+ +n[2]-1,e.length):0}const Fee=jf.define({name:"json",parser:Lee.configure({props:[Cx.add({Object:a7({except:/^\s*\}/}),Array:a7({except:/^\s*\]/})}),Fw.add({"Object Array":rE})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Qee(){return new eE(Fee)}const $ee={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(t,e){let n;if(!e.inString&&(n=t.match(/^('''|"""|'|")/))&&(e.stringType=n[0],e.inString=!0),t.sol()&&!e.inString&&e.inArray===0&&(e.lhs=!0),e.inString){for(;e.inString;)if(t.match(e.stringType))e.inString=!1;else if(t.peek()==="\\")t.next(),t.next();else{if(t.eol())break;t.match(/^.[^\\\"\']*/)}return e.lhs?"property":"string"}else{if(e.inArray&&t.peek()==="]")return t.next(),e.inArray--,"bracket";if(e.lhs&&t.peek()==="["&&t.skipTo("]"))return t.next(),t.peek()==="]"&&t.next(),"atom";if(t.peek()==="#")return t.skipToEnd(),"comment";if(t.eatSpace())return null;if(e.lhs&&t.eatWhile(function(r){return r!="="&&r!=" "}))return"property";if(e.lhs&&t.peek()==="=")return t.next(),e.lhs=!1,null;if(!e.lhs&&t.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!e.lhs&&(t.match("true")||t.match("false")))return"atom";if(!e.lhs&&t.peek()==="[")return e.inArray++,t.next(),"bracket";if(!e.lhs&&t.match(/^\-?\d+(?:\.\d+)?/))return"number";t.eatSpace()||t.next()}return null},languageData:{commentTokens:{line:"#"}}},Hee={python:[Pee()],json:[Qee(),Iee()],toml:[Qw.define($ee)],text:[]};function Uee({value:t,onChange:e,language:n="text",readOnly:r=!1,height:s="400px",minHeight:i,maxHeight:l,placeholder:c,theme:d="dark",className:h=""}){const[m,p]=S.useState(!1);if(S.useEffect(()=>{p(!0)},[]),!m)return a.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${h}`,style:{height:s,minHeight:i,maxHeight:l}});const x=[...Hee[n]||[],qe.lineWrapping];return r&&x.push(qe.editable.of(!1)),a.jsx("div",{className:`rounded-md overflow-hidden border ${h}`,children:a.jsx(C_,{value:t,height:s,minHeight:i,maxHeight:l,theme:d==="dark"?N_:void 0,extensions:x,onChange:e,placeholder:c,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function Vee(){const[t,e]=S.useState(!0),[n,r]=S.useState(!1),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState("visual"),[b,k]=S.useState(""),[O,j]=S.useState(!1),{toast:T}=Pr(),[A,_]=S.useState(null),[D,E]=S.useState(null),[z,Q]=S.useState(null),[F,L]=S.useState(null),[U,V]=S.useState(null),[ce,W]=S.useState(null),[J,$]=S.useState(null),[ae,ne]=S.useState(null),[ue,R]=S.useState(null),[me,Y]=S.useState(null),[P,K]=S.useState(null),[H,fe]=S.useState(null),[ve,Re]=S.useState(null),[de,We]=S.useState(null),[ct,Oe]=S.useState(null),[nt,ut]=S.useState(null),[Ct,In]=S.useState(null),[Tn,Jn]=S.useState(null),nn=S.useRef(null),_t=S.useRef(!0),Yr=S.useRef({}),qn=S.useCallback(async()=>{try{const re=await RU();k(re),j(!1)}catch(re){T({variant:"destructive",title:"加载失败",description:re instanceof Error?re.message:"加载源代码失败"})}},[T]),or=S.useCallback(async()=>{try{e(!0);const re=await DU();Yr.current=re,_(re.bot),E(re.personality);const Ae=re.chat;Ae.talk_value_rules||(Ae.talk_value_rules=[]),Q(Ae),L(re.expression),V(re.emoji),W(re.memory),$(re.tool),ne(re.mood),R(re.voice),Y(re.lpmm_knowledge),K(re.keyword_reaction),fe(re.response_post_process),Re(re.chinese_typo),We(re.response_splitter),Oe(re.log),ut(re.debug),In(re.maim_message),Jn(re.telemetry),c(!1),_t.current=!1,await qn()}catch(re){console.error("加载配置失败:",re),T({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{e(!1)}},[T,qn]);S.useEffect(()=>{or()},[or]);const yn=S.useCallback(async(re,Ae)=>{if(!_t.current)try{i(!0),await PU(re,Ae),c(!1)}catch(pt){console.error(`自动保存 ${re} 失败:`,pt),c(!0)}finally{i(!1)}},[]),ft=S.useCallback((re,Ae)=>{_t.current||(c(!0),nn.current&&clearTimeout(nn.current),nn.current=setTimeout(()=>{yn(re,Ae)},2e3))},[yn]);S.useEffect(()=>{A&&!_t.current&&ft("bot",A)},[A,ft]),S.useEffect(()=>{D&&!_t.current&&ft("personality",D)},[D,ft]),S.useEffect(()=>{z&&!_t.current&&ft("chat",z)},[z,ft]),S.useEffect(()=>{F&&!_t.current&&ft("expression",F)},[F,ft]),S.useEffect(()=>{U&&!_t.current&&ft("emoji",U)},[U,ft]),S.useEffect(()=>{ce&&!_t.current&&ft("memory",ce)},[ce,ft]),S.useEffect(()=>{J&&!_t.current&&ft("tool",J)},[J,ft]),S.useEffect(()=>{ae&&!_t.current&&ft("mood",ae)},[ae,ft]),S.useEffect(()=>{ue&&!_t.current&&ft("voice",ue)},[ue,ft]),S.useEffect(()=>{me&&!_t.current&&ft("lpmm_knowledge",me)},[me,ft]),S.useEffect(()=>{P&&!_t.current&&ft("keyword_reaction",P)},[P,ft]),S.useEffect(()=>{H&&!_t.current&&ft("response_post_process",H)},[H,ft]),S.useEffect(()=>{ve&&!_t.current&&ft("chinese_typo",ve)},[ve,ft]),S.useEffect(()=>{de&&!_t.current&&ft("response_splitter",de)},[de,ft]),S.useEffect(()=>{ct&&!_t.current&&ft("log",ct)},[ct,ft]),S.useEffect(()=>{nt&&!_t.current&&ft("debug",nt)},[nt,ft]),S.useEffect(()=>{Ct&&!_t.current&&ft("maim_message",Ct)},[Ct,ft]),S.useEffect(()=>{Tn&&!_t.current&&ft("telemetry",Tn)},[Tn,ft]);const ee=async()=>{try{r(!0),await zU(b),c(!1),j(!1),T({title:"保存成功",description:"配置已保存"}),await or()}catch(re){j(!0),T({variant:"destructive",title:"保存失败",description:re instanceof Error?re.message:"保存配置失败"})}finally{r(!1)}},Se=async re=>{if(l){T({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}v(re),re==="source"?await qn():await or()},Be=async()=>{try{r(!0),nn.current&&clearTimeout(nn.current);const re={...Yr.current,bot:A,personality:D,chat:z,expression:F,emoji:U,memory:ce,tool:J,mood:ae,voice:ue,lpmm_knowledge:me,keyword_reaction:P,response_post_process:H,chinese_typo:ve,response_splitter:de,log:ct,debug:nt,maim_message:Ct,telemetry:Tn};await XO(re),c(!1),T({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(re){console.error("保存配置失败:",re),T({title:"保存失败",description:re.message,variant:"destructive"})}finally{r(!1)}},rt=async()=>{try{h(!0),xw().catch(()=>{}),p(!0)}catch(re){console.error("重启失败:",re),p(!1),T({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),h(!1)}},Tt=async()=>{try{r(!0),nn.current&&clearTimeout(nn.current);const re={...Yr.current,bot:A,personality:D,chat:z,expression:F,emoji:U,memory:ce,tool:J,mood:ae,voice:ue,lpmm_knowledge:me,keyword_reaction:P,response_post_process:H,chinese_typo:ve,response_splitter:de,log:ct,debug:nt,maim_message:Ct,telemetry:Tn};await XO(re),c(!1),T({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(Ae=>setTimeout(Ae,500)),await rt()}catch(re){console.error("保存失败:",re),T({title:"保存失败",description:re.message,variant:"destructive"})}finally{r(!1)}},cr=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Kr=()=>{p(!1),h(!1),T({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return t?a.jsx(mn,{className:"h-full",children:a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto items-center",children:[a.jsx(hl,{value:x,onValueChange:re=>Se(re),className:"w-auto",children:a.jsxs(ya,{className:"h-9",children:[a.jsxs($t,{value:"visual",className:"text-xs sm:text-sm px-2 sm:px-3",children:[a.jsx(bq,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化"]}),a.jsxs($t,{value:"source",className:"text-xs sm:text-sm px-2 sm:px-3",children:[a.jsx(wq,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码"]})]})}),a.jsxs(ie,{onClick:x==="visual"?Be:ee,disabled:n||s||!l||d,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":s?"自动保存中...":l?"保存配置":"已保存"]}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:n||s||d,size:"sm",className:"flex-1 sm:flex-none",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),d?"重启中...":l?"保存并重启":"重启麦麦"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重启麦麦?"}),a.jsx(dn,{children:l?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:l?Tt:rt,children:l?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),x==="source"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:[a.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",O&&a.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),a.jsx(Uee,{value:b,onChange:re=>{k(re),c(!0),O&&j(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),x==="visual"&&a.jsx(a.Fragment,{children:a.jsxs(hl,{defaultValue:"bot",className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:a.jsxs(ya,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[a.jsx($t,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),a.jsx($t,{value:"personality",className:"flex-shrink-0",children:"人格"}),a.jsx($t,{value:"chat",className:"flex-shrink-0",children:"聊天"}),a.jsx($t,{value:"expression",className:"flex-shrink-0",children:"表达"}),a.jsx($t,{value:"features",className:"flex-shrink-0",children:"功能"}),a.jsx($t,{value:"processing",className:"flex-shrink-0",children:"处理"}),a.jsx($t,{value:"mood",className:"flex-shrink-0",children:"情绪"}),a.jsx($t,{value:"voice",className:"flex-shrink-0",children:"语音"}),a.jsx($t,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),a.jsx($t,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),a.jsx(kn,{value:"bot",className:"space-y-4",children:A&&a.jsx(Wee,{config:A,onChange:_})}),a.jsx(kn,{value:"personality",className:"space-y-4",children:D&&a.jsx(Gee,{config:D,onChange:E})}),a.jsx(kn,{value:"chat",className:"space-y-4",children:z&&a.jsx(Xee,{config:z,onChange:Q})}),a.jsx(kn,{value:"expression",className:"space-y-4",children:F&&a.jsx(Yee,{config:F,onChange:L})}),a.jsx(kn,{value:"features",className:"space-y-4",children:U&&ce&&J&&a.jsx(Kee,{emojiConfig:U,memoryConfig:ce,toolConfig:J,onEmojiChange:V,onMemoryChange:W,onToolChange:$})}),a.jsx(kn,{value:"processing",className:"space-y-4",children:P&&H&&ve&&de&&a.jsx(Zee,{keywordReactionConfig:P,responsePostProcessConfig:H,chineseTypoConfig:ve,responseSplitterConfig:de,onKeywordReactionChange:K,onResponsePostProcessChange:fe,onChineseTypoChange:Re,onResponseSplitterChange:We})}),a.jsx(kn,{value:"mood",className:"space-y-4",children:ae&&a.jsx(Jee,{config:ae,onChange:ne})}),a.jsx(kn,{value:"voice",className:"space-y-4",children:ue&&a.jsx(ete,{config:ue,onChange:R})}),a.jsx(kn,{value:"lpmm",className:"space-y-4",children:me&&a.jsx(tte,{config:me,onChange:Y})}),a.jsxs(kn,{value:"other",className:"space-y-4",children:[ct&&a.jsx(nte,{config:ct,onChange:Oe}),nt&&a.jsx(rte,{config:nt,onChange:ut}),Ct&&a.jsx(ste,{config:Ct,onChange:In}),Tn&&a.jsx(ite,{config:Tn,onChange:Jn})]})]})}),m&&a.jsx(vw,{onRestartComplete:cr,onRestartFailed:Kr})]})})}function Wee({config:t,onChange:e}){const n=()=>{e({...t,platforms:[...t.platforms,""]})},r=d=>{e({...t,platforms:t.platforms.filter((h,m)=>m!==d)})},s=(d,h)=>{const m=[...t.platforms];m[d]=h,e({...t,platforms:m})},i=()=>{e({...t,alias_names:[...t.alias_names,""]})},l=d=>{e({...t,alias_names:t.alias_names.filter((h,m)=>m!==d)})},c=(d,h)=>{const m=[...t.alias_names];m[d]=h,e({...t,alias_names:m})};return a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"platform",children:"平台"}),a.jsx(Me,{id:"platform",value:t.platform,onChange:d=>e({...t,platform:d.target.value}),placeholder:"qq"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"qq_account",children:"QQ账号"}),a.jsx(Me,{id:"qq_account",value:t.qq_account,onChange:d=>e({...t,qq_account:d.target.value}),placeholder:"123456789"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称"}),a.jsx(Me,{id:"nickname",value:t.nickname,onChange:d=>e({...t,nickname:d.target.value}),placeholder:"麦麦"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"其他平台账号"}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),a.jsxs("div",{className:"space-y-2",children:[t.platforms.map((d,h)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{value:d,onChange:m=>s(h,m.target.value),placeholder:"wx:114514"}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除平台账号 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(h),children:"删除"})]})]})]})]},h)),t.platforms.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"别名"}),a.jsxs(ie,{onClick:i,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),a.jsxs("div",{className:"space-y-2",children:[t.alias_names.map((d,h)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{value:d,onChange:m=>c(h,m.target.value),placeholder:"小麦"}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除别名 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>l(h),children:"删除"})]})]})]})]},h)),t.alias_names.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function Gee({config:t,onChange:e}){const n=()=>{e({...t,states:[...t.states,""]})},r=i=>{e({...t,states:t.states.filter((l,c)=>c!==i)})},s=(i,l)=>{const c=[...t.states];c[i]=l,e({...t,states:c})};return a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"personality",children:"人格特质"}),a.jsx(_n,{id:"personality",value:t.personality,onChange:i=>e({...t,personality:i.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"reply_style",children:"表达风格"}),a.jsx(_n,{id:"reply_style",value:t.reply_style,onChange:i=>e({...t,reply_style:i.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"interest",children:"兴趣"}),a.jsx(_n,{id:"interest",value:t.interest,onChange:i=>e({...t,interest:i.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"plan_style",children:"说话规则与行为风格"}),a.jsx(_n,{id:"plan_style",value:t.plan_style,onChange:i=>e({...t,plan_style:i.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"visual_style",children:"识图规则"}),a.jsx(_n,{id:"visual_style",value:t.visual_style,onChange:i=>e({...t,visual_style:i.target.value}),placeholder:"识图时的处理规则",rows:3})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"private_plan_style",children:"私聊规则"}),a.jsx(_n,{id:"private_plan_style",value:t.private_plan_style,onChange:i=>e({...t,private_plan_style:i.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"状态列表(人格多样性)"}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),a.jsx("div",{className:"space-y-2",children:t.states.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(_n,{value:i,onChange:c=>s(l,c.target.value),placeholder:"描述一个人格状态",rows:2}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsx(dn,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(l),children:"删除"})]})]})]})]},l))})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"state_probability",children:"状态替换概率"}),a.jsx(Me,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:t.state_probability,onChange:i=>e({...t,state_probability:parseFloat(i.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function Xee({config:t,onChange:e}){const n=()=>{e({...t,talk_value_rules:[...t.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},r=c=>{e({...t,talk_value_rules:t.talk_value_rules.filter((d,h)=>h!==c)})},s=(c,d,h)=>{const m=[...t.talk_value_rules];m[c]={...m[c],[d]:h},e({...t,talk_value_rules:m})},i=({value:c,onChange:d})=>{const[h,m]=S.useState("00"),[p,x]=S.useState("00"),[v,b]=S.useState("23"),[k,O]=S.useState("59");S.useEffect(()=>{const T=c.split("-");if(T.length===2){const[A,_]=T,[D,E]=A.split(":"),[z,Q]=_.split(":");D&&m(D.padStart(2,"0")),E&&x(E.padStart(2,"0")),z&&b(z.padStart(2,"0")),Q&&O(Q.padStart(2,"0"))}},[c]);const j=(T,A,_,D)=>{const E=`${T}:${A}-${_}:${D}`;d(E)};return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[a.jsx(dc,{className:"h-4 w-4 mr-2"}),c||"选择时间段"]})}),a.jsx(fl,{className:"w-80",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"小时"}),a.jsxs(Lt,{value:h,onValueChange:T=>{m(T),j(T,p,v,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:24},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"分钟"}),a.jsxs(Lt,{value:p,onValueChange:T=>{x(T),j(h,T,v,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:60},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"小时"}),a.jsxs(Lt,{value:v,onValueChange:T=>{b(T),j(h,p,T,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:24},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"分钟"}),a.jsxs(Lt,{value:k,onValueChange:T=>{O(T),j(h,p,v,T)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:60},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]})]})]})]})})]})},l=({rule:c})=>{const d=`{ target = "${c.target}", time = "${c.time}", value = ${c.value.toFixed(1)} }`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-96",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:d}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),a.jsx(Me,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:t.talk_value,onChange:c=>e({...t,talk_value:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"mentioned_bot_reply",children:"提及回复增幅"}),a.jsx(Me,{id:"mentioned_bot_reply",type:"number",step:"0.1",min:"0",max:"1",value:t.mentioned_bot_reply,onChange:c=>e({...t,mentioned_bot_reply:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"提及时回复概率增幅,1 为 100% 回复"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_context_size",children:"上下文长度"}),a.jsx(Me,{id:"max_context_size",type:"number",min:"1",value:t.max_context_size,onChange:c=>e({...t,max_context_size:parseInt(c.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"planner_smooth",children:"规划器平滑"}),a.jsx(Me,{id:"planner_smooth",type:"number",step:"1",min:"0",value:t.planner_smooth,onChange:c=>e({...t,planner_smooth:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_talk_value_rules",checked:t.enable_talk_value_rules,onCheckedChange:c=>e({...t,enable_talk_value_rules:c})}),a.jsx(te,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"include_planner_reasoning",checked:t.include_planner_reasoning,onCheckedChange:c=>e({...t,include_planner_reasoning:c})}),a.jsx(te,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),t.enable_talk_value_rules&&a.jsxs("div",{className:"border-t pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),a.jsxs(ie,{onClick:n,size:"sm",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),t.talk_value_rules&&t.talk_value_rules.length>0?a.jsx("div",{className:"space-y-4",children:t.talk_value_rules.map((c,d)=>a.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",d+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(l,{rule:c}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{variant:"ghost",size:"sm",children:a.jsx(Ht,{className:"h-4 w-4 text-destructive"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除规则 #",d+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(d),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"配置类型"}),a.jsxs(Lt,{value:c.target===""?"global":"specific",onValueChange:h=>{h==="global"?s(d,"target",""):s(d,"target","qq::group")},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"global",children:"全局配置"}),a.jsx(Pe,{value:"specific",children:"详细配置"})]})]})]}),c.target!==""&&(()=>{const h=c.target.split(":"),m=h[0]||"qq",p=h[1]||"",x=h[2]||"group";return a.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"平台"}),a.jsxs(Lt,{value:m,onValueChange:v=>{s(d,"target",`${v}:${p}:${x}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"qq",children:"QQ"}),a.jsx(Pe,{value:"wx",children:"微信"})]})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"群 ID"}),a.jsx(Me,{value:p,onChange:v=>{s(d,"target",`${m}:${v.target.value}:${x}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"类型"}),a.jsxs(Lt,{value:x,onValueChange:v=>{s(d,"target",`${m}:${p}:${v}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"group",children:"群组(group)"}),a.jsx(Pe,{value:"private",children:"私聊(private)"})]})]})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",c.target||"(未设置)"]})]})})(),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"时间段 (Time)"}),a.jsx(i,{value:c.time,onChange:h=>s(d,"time",h)}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{htmlFor:`rule-value-${d}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),a.jsx(Me,{id:`rule-value-${d}`,type:"number",step:"0.01",min:"0",max:"1",value:c.value,onChange:h=>{const m=parseFloat(h.target.value);isNaN(m)||s(d,"value",Math.max(0,Math.min(1,m)))},className:"w-20 h-8 text-xs"})]}),a.jsx(yx,{value:[c.value],onValueChange:h=>s(d,"value",h[0]),min:0,max:1,step:.01,className:"w-full"}),a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:"0 (完全沉默)"}),a.jsx("span",{children:"0.5"}),a.jsx("span",{children:"1.0 (正常)"})]})]})]})]},d))}):a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:a.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),a.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[a.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),a.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function Yee({config:t,onChange:e}){const n=()=>{e({...t,learning_list:[...t.learning_list,["","enable","enable","1.0"]]})},r=x=>{e({...t,learning_list:t.learning_list.filter((v,b)=>b!==x)})},s=(x,v,b)=>{const k=[...t.learning_list];k[x][v]=b,e({...t,learning_list:k})},i=({rule:x})=>{const v=`["${x[0]}", "${x[1]}", "${x[2]}", "${x[3]}"]`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-96",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:v}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},l=({member:x,groupIndex:v,memberIndex:b,availableChatIds:k})=>{const O=k.includes(x)||x==="*",[j,T]=S.useState(!O);return a.jsxs("div",{className:"flex gap-2",children:[a.jsx("div",{className:"flex-1 flex gap-2",children:j?a.jsxs(a.Fragment,{children:[a.jsx(Me,{value:x,onChange:A=>p(v,b,A.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),k.length>0&&a.jsx(ie,{size:"sm",variant:"outline",onClick:()=>T(!1),title:"切换到下拉选择",children:"下拉"})]}):a.jsxs(a.Fragment,{children:[a.jsxs(Lt,{value:x,onValueChange:A=>p(v,b,A),children:[a.jsx(Dt,{className:"flex-1",children:a.jsx(It,{placeholder:"选择聊天流"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"*",children:"* (全局共享)"}),k.map((A,_)=>a.jsx(Pe,{value:A,children:A},_))]})]}),a.jsx(ie,{size:"sm",variant:"outline",onClick:()=>T(!0),title:"切换到手动输入",children:"输入"})]})}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除组成员 "',x||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>m(v,b),children:"删除"})]})]})]})]})},c=()=>{e({...t,expression_groups:[...t.expression_groups,[]]})},d=x=>{e({...t,expression_groups:t.expression_groups.filter((v,b)=>b!==x)})},h=x=>{const v=[...t.expression_groups];v[x]=[...v[x],""],e({...t,expression_groups:v})},m=(x,v)=>{const b=[...t.expression_groups];b[x]=b[x].filter((k,O)=>O!==v),e({...t,expression_groups:b})},p=(x,v,b)=>{const k=[...t.expression_groups];k[x][v]=b,e({...t,expression_groups:k})};return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),a.jsxs("div",{className:"space-y-4",children:[t.learning_list.map((x,v)=>{const b=t.learning_list.some((_,D)=>D!==v&&_[0]===""),k=x[0]==="",O=x[0].split(":"),j=O[0]||"qq",T=O[1]||"",A=O[2]||"group";return a.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["规则 ",v+1," ",k&&"(全局配置)"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(i,{rule:x}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除学习规则 ",v+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(v),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"配置类型"}),a.jsxs(Lt,{value:k?"global":"specific",onValueChange:_=>{_==="global"?s(v,0,""):s(v,0,"qq::group")},disabled:b&&!k,children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"global",children:"全局配置"}),a.jsx(Pe,{value:"specific",disabled:b&&!k,children:"详细配置"})]})]}),b&&!k&&a.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!k&&a.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"平台"}),a.jsxs(Lt,{value:j,onValueChange:_=>{s(v,0,`${_}:${T}:${A}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"qq",children:"QQ"}),a.jsx(Pe,{value:"wx",children:"微信"})]})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"群 ID"}),a.jsx(Me,{value:T,onChange:_=>{s(v,0,`${j}:${_.target.value}:${A}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"类型"}),a.jsxs(Lt,{value:A,onValueChange:_=>{s(v,0,`${j}:${T}:${_}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"group",children:"群组(group)"}),a.jsx(Pe,{value:"private",children:"私聊(private)"})]})]})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",x[0]||"(未设置)"]})]}),a.jsx("div",{className:"grid gap-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs font-medium",children:"使用学到的表达"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),a.jsx(jt,{checked:x[1]==="enable",onCheckedChange:_=>s(v,1,_?"enable":"disable")})]})}),a.jsx("div",{className:"grid gap-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs font-medium",children:"学习表达"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),a.jsx(jt,{checked:x[2]==="enable",onCheckedChange:_=>s(v,2,_?"enable":"disable")})]})}),a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-xs font-medium",children:"学习强度"}),a.jsx(Me,{type:"number",step:"0.1",min:"0",max:"5",value:x[3],onChange:_=>{const D=parseFloat(_.target.value);isNaN(D)||s(v,3,Math.max(0,Math.min(5,D)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),a.jsx(yx,{value:[parseFloat(x[3])||1],onValueChange:_=>s(v,3,_[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:"0 (不学习)"}),a.jsx("span",{children:"2.5"}),a.jsx("span",{children:"5.0 (快速学习)"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},v)}),t.learning_list.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),a.jsxs(ie,{onClick:c,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),a.jsxs("div",{className:"space-y-4",children:[t.expression_groups.map((x,v)=>{const b=t.learning_list.map(k=>k[0]).filter(k=>k!=="");return a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",v+1,x.length===1&&x[0]==="*"&&"(全局共享)"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ie,{onClick:()=>h(v),size:"sm",variant:"outline",children:a.jsx(Wr,{className:"h-4 w-4"})}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除共享组 ",v+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>d(v),children:"删除"})]})]})]})]})]}),a.jsx("div",{className:"space-y-2",children:x.map((k,O)=>a.jsx(l,{member:k,groupIndex:v,memberIndex:O,availableChatIds:b},O))}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},v)}),t.expression_groups.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function Kee({emojiConfig:t,memoryConfig:e,toolConfig:n,onEmojiChange:r,onMemoryChange:s,onToolChange:i}){return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:l=>i({...n,enable_tool:l})}),a.jsx(te,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),a.jsx(Me,{id:"max_agent_iterations",type:"number",min:"1",value:e.max_agent_iterations,onChange:l=>s({...e,max_agent_iterations:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"emoji_chance",children:"表情包激活概率"}),a.jsx(Me,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:t.emoji_chance,onChange:l=>r({...t,emoji_chance:parseFloat(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_reg_num",children:"最大注册数量"}),a.jsx(Me,{id:"max_reg_num",type:"number",min:"1",value:t.max_reg_num,onChange:l=>r({...t,max_reg_num:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),a.jsx(Me,{id:"check_interval",type:"number",min:"1",value:t.check_interval,onChange:l=>r({...t,check_interval:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"do_replace",checked:t.do_replace,onCheckedChange:l=>r({...t,do_replace:l})}),a.jsx(te,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:l=>r({...t,steal_emoji:l})}),a.jsx(te,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),a.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:l=>r({...t,content_filtration:l})}),a.jsx(te,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),t.content_filtration&&a.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[a.jsx(te,{htmlFor:"filtration_prompt",children:"过滤要求"}),a.jsx(Me,{id:"filtration_prompt",value:t.filtration_prompt,onChange:l=>r({...t,filtration_prompt:l.target.value}),placeholder:"符合公序良俗"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function Zee({keywordReactionConfig:t,responsePostProcessConfig:e,chineseTypoConfig:n,responseSplitterConfig:r,onKeywordReactionChange:s,onResponsePostProcessChange:i,onChineseTypoChange:l,onResponseSplitterChange:c}){const d=()=>{s({...t,regex_rules:[...t.regex_rules,{regex:[""],reaction:""}]})},h=_=>{s({...t,regex_rules:t.regex_rules.filter((D,E)=>E!==_)})},m=(_,D,E)=>{const z=[...t.regex_rules];D==="regex"&&typeof E=="string"?z[_]={...z[_],regex:[E]}:D==="reaction"&&typeof E=="string"&&(z[_]={...z[_],reaction:E}),s({...t,regex_rules:z})},p=({regex:_,reaction:D,onRegexChange:E,onReactionChange:z})=>{const[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,ce]=S.useState(null),[W,J]=S.useState(""),[$,ae]=S.useState({}),[ne,ue]=S.useState(""),R=S.useRef(null),[me,Y]=S.useState("build"),P=ve=>ve.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),K=(ve,Re=0)=>{const de=R.current;if(!de)return;const We=de.selectionStart||0,ct=de.selectionEnd||0,Oe=_.substring(0,We)+ve+_.substring(ct);E(Oe),setTimeout(()=>{const nt=We+ve.length+Re;de.setSelectionRange(nt,nt),de.focus()},0)};S.useEffect(()=>{if(!_||!L){ce(null),ae({}),ue(D),J("");return}try{const ve=P(_),Re=new RegExp(ve,"g"),de=L.match(Re);ce(de),J("");const ct=new RegExp(ve).exec(L);if(ct&&ct.groups){ae(ct.groups);let Oe=D;Object.entries(ct.groups).forEach(([nt,ut])=>{Oe=Oe.replace(new RegExp(`\\[${nt}\\]`,"g"),ut||"")}),ue(Oe)}else ae({}),ue(D)}catch(ve){J(ve.message),ce(null),ae({}),ue(D)}},[_,L,D]);const H=()=>{if(!L||!V||V.length===0)return a.jsx("span",{className:"text-muted-foreground",children:L||"请输入测试文本"});try{const ve=P(_),Re=new RegExp(ve,"g");let de=0;const We=[];let ct;for(;(ct=Re.exec(L))!==null;)ct.index>de&&We.push(a.jsx("span",{children:L.substring(de,ct.index)},`text-${de}`)),We.push(a.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:ct[0]},`match-${ct.index}`)),de=ct.index+ct[0].length;return de)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return a.jsxs(Rr,{open:Q,onOpenChange:F,children:[a.jsx(mw,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(fg,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"正则表达式编辑器"}),a.jsx(Gr,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),a.jsx(mn,{className:"max-h-[calc(90vh-120px)]",children:a.jsxs(hl,{value:me,onValueChange:ve=>Y(ve),className:"w-full",children:[a.jsxs(ya,{className:"grid w-full grid-cols-2",children:[a.jsx($t,{value:"build",children:"🔧 构建器"}),a.jsx($t,{value:"test",children:"🧪 测试器"})]}),a.jsxs(kn,{value:"build",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"正则表达式"}),a.jsx(Me,{ref:R,value:_,onChange:ve=>E(ve.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"Reaction 内容"}),a.jsx(_n,{value:D,onChange:ve=>z(ve.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),a.jsxs("div",{className:"space-y-4 border-t pt-4",children:[fe.map(ve=>a.jsxs("div",{className:"space-y-2",children:[a.jsx("h5",{className:"text-xs font-semibold text-primary",children:ve.category}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:ve.items.map(Re=>a.jsx(ie,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>K(Re.pattern,Re.moveCursor||0),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsxs("div",{className:"flex items-center gap-2 w-full",children:[a.jsx("span",{className:"text-xs font-medium",children:Re.label}),a.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:Re.pattern})]}),a.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:Re.desc})]})},Re.label))})]},ve.category)),a.jsxs("div",{className:"space-y-2 border-t pt-4",children:[a.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("^(?P\\S{1,20})是这样的$"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?P.+?)(?:是|为什么|怎么)"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),a.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),a.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),a.jsxs("li",{children:["命名捕获组格式:",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),a.jsxs("li",{children:["在 reaction 中使用 ",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),a.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),a.jsxs(kn,{value:"test",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"当前正则表达式"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:_||"(未设置)"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),a.jsx(_n,{id:"test-text",value:L,onChange:ve=>U(ve.target.value),placeholder:`在此输入要测试的文本... -例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),W&&a.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[a.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),a.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:W})]}),!W&&L&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"flex items-center gap-2",children:V&&V.length>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),a.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",V.length," 处)"]})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),a.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"匹配高亮"}),a.jsx(mn,{className:"h-40 rounded-md bg-muted p-3",children:a.jsx("div",{className:"text-sm break-words",children:H()})})]}),Object.keys($).length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"命名捕获组"}),a.jsx(mn,{className:"h-32 rounded-md border p-3",children:a.jsx("div",{className:"space-y-2",children:Object.entries($).map(([ve,Re])=>a.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[a.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",ve,"]"]}),a.jsx("span",{className:"text-muted-foreground",children:"="}),a.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:Re})]},ve))})})]}),Object.keys($).length>0&&D&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"Reaction 替换预览"}),a.jsx(mn,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:a.jsx("div",{className:"text-sm break-words",children:ne})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),a.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),a.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),a.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),a.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),a.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},x=()=>{s({...t,keyword_rules:[...t.keyword_rules,{keywords:[],reaction:""}]})},v=_=>{s({...t,keyword_rules:t.keyword_rules.filter((D,E)=>E!==_)})},b=(_,D,E)=>{const z=[...t.keyword_rules];typeof E=="string"&&(z[_]={...z[_],reaction:E}),s({...t,keyword_rules:z})},k=_=>{const D=[...t.keyword_rules];D[_]={...D[_],keywords:[...D[_].keywords||[],""]},s({...t,keyword_rules:D})},O=(_,D)=>{const E=[...t.keyword_rules];E[_]={...E[_],keywords:(E[_].keywords||[]).filter((z,Q)=>Q!==D)},s({...t,keyword_rules:E})},j=(_,D,E)=>{const z=[...t.keyword_rules],Q=[...z[_].keywords||[]];Q[D]=E,z[_]={...z[_],keywords:Q},s({...t,keyword_rules:z})},T=({rule:_})=>{const D=`{ regex = [${(_.regex||[]).map(E=>`"${E}"`).join(", ")}], reaction = "${_.reaction}" }`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-[95vw] sm:w-[500px]",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx(mn,{className:"h-60 rounded-md bg-muted p-3",children:a.jsx("pre",{className:"font-mono text-xs break-all",children:D})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},A=({rule:_})=>{const D=`[[keyword_reaction.keyword_rules]] +`,{label:"if",detail:"block",type:"keyword"}),Xa("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),Xa("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),Xa("import ${module}",{label:"import",detail:"statement",type:"keyword"}),Xa("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],zee=BK(B_,d_(Dee.concat(Ree)));function ab(t){let{node:e,pos:n}=t,r=t.lineIndent(n,-1),s=null;for(;;){let i=e.childBefore(n);if(i)if(i.name=="Comment")n=i.from;else if(i.name=="Body"||i.name=="MatchBody")t.baseIndentFor(i)+t.unit<=r&&(s=i),e=i;else if(i.name=="MatchClause")e=i;else if(i.type.is("Statement"))e=i;else break;else break}return s}function lb(t,e){let n=t.baseIndentFor(e),r=t.lineAt(t.pos,-1),s=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&t.node.ton?null:n+t.unit}const ob=jf.define({name:"python",parser:Aee.configure({props:[Cx.add({Body:t=>{var e;let n=/^\s*(#|$)/.test(t.textAfter)&&ab(t)||t.node;return(e=lb(t,n))!==null&&e!==void 0?e:t.continue()},MatchBody:t=>{var e;let n=ab(t);return(e=lb(t,n||t.node))!==null&&e!==void 0?e:t.continue()},IfStatement:t=>/^\s*(else:|elif )/.test(t.textAfter)?t.baseIndent:t.continue(),"ForStatement WhileStatement":t=>/^\s*else:/.test(t.textAfter)?t.baseIndent:t.continue(),TryStatement:t=>/^\s*(except[ :]|finally:|else:)/.test(t.textAfter)?t.baseIndent:t.continue(),MatchStatement:t=>/^\s*case /.test(t.textAfter)?t.baseIndent+t.unit:t.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":Hy({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Hy({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Hy({closing:"]"}),MemberExpression:t=>t.baseIndent+t.unit,"String FormatString":()=>null,Script:t=>{var e;let n=ab(t);return(e=n&&lb(t,n))!==null&&e!==void 0?e:t.continue()}}),Fw.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":rE,Body:(t,e)=>({from:t.from+1,to:t.to-(t.to==e.doc.length?0:1)}),"String FormatString":(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function Pee(){return new eE(ob,[ob.data.of({autocomplete:_ee}),ob.data.of({autocomplete:zee})])}const Bee=Lw({String:he.string,Number:he.number,"True False":he.bool,PropertyName:he.propertyName,Null:he.null,", :":he.separator,"[ ]":he.squareBracket,"{ }":he.brace}),Lee=Rf.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[Bee],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Iee=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=qee(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function qee(t,e){let n;return(n=t.message.match(/at position (\d+)/))?Math.min(+n[1],e.length):(n=t.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+n[1]).from+ +n[2]-1,e.length):0}const Fee=jf.define({name:"json",parser:Lee.configure({props:[Cx.add({Object:a7({except:/^\s*\}/}),Array:a7({except:/^\s*\]/})}),Fw.add({"Object Array":rE})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Qee(){return new eE(Fee)}const $ee={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(t,e){let n;if(!e.inString&&(n=t.match(/^('''|"""|'|")/))&&(e.stringType=n[0],e.inString=!0),t.sol()&&!e.inString&&e.inArray===0&&(e.lhs=!0),e.inString){for(;e.inString;)if(t.match(e.stringType))e.inString=!1;else if(t.peek()==="\\")t.next(),t.next();else{if(t.eol())break;t.match(/^.[^\\\"\']*/)}return e.lhs?"property":"string"}else{if(e.inArray&&t.peek()==="]")return t.next(),e.inArray--,"bracket";if(e.lhs&&t.peek()==="["&&t.skipTo("]"))return t.next(),t.peek()==="]"&&t.next(),"atom";if(t.peek()==="#")return t.skipToEnd(),"comment";if(t.eatSpace())return null;if(e.lhs&&t.eatWhile(function(r){return r!="="&&r!=" "}))return"property";if(e.lhs&&t.peek()==="=")return t.next(),e.lhs=!1,null;if(!e.lhs&&t.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!e.lhs&&(t.match("true")||t.match("false")))return"atom";if(!e.lhs&&t.peek()==="[")return e.inArray++,t.next(),"bracket";if(!e.lhs&&t.match(/^\-?\d+(?:\.\d+)?/))return"number";t.eatSpace()||t.next()}return null},languageData:{commentTokens:{line:"#"}}},Hee={python:[Pee()],json:[Qee(),Iee()],toml:[Qw.define($ee)],text:[]};function Uee({value:t,onChange:e,language:n="text",readOnly:r=!1,height:s="400px",minHeight:i,maxHeight:l,placeholder:c,theme:d="dark",className:h=""}){const[m,p]=S.useState(!1);if(S.useEffect(()=>{p(!0)},[]),!m)return a.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${h}`,style:{height:s,minHeight:i,maxHeight:l}});const x=[...Hee[n]||[],qe.lineWrapping];return r&&x.push(qe.editable.of(!1)),a.jsx("div",{className:`rounded-md overflow-hidden border ${h}`,children:a.jsx(C_,{value:t,height:s,minHeight:i,maxHeight:l,theme:d==="dark"?N_:void 0,extensions:x,onChange:e,placeholder:c,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function Vee(){const[t,e]=S.useState(!0),[n,r]=S.useState(!1),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState("visual"),[b,k]=S.useState(""),[O,j]=S.useState(!1),{toast:T}=Pr(),[M,_]=S.useState(null),[D,E]=S.useState(null),[z,Q]=S.useState(null),[F,L]=S.useState(null),[U,V]=S.useState(null),[ce,W]=S.useState(null),[J,H]=S.useState(null),[ae,ne]=S.useState(null),[ue,R]=S.useState(null),[me,Y]=S.useState(null),[P,K]=S.useState(null),[$,fe]=S.useState(null),[ve,Re]=S.useState(null),[de,We]=S.useState(null),[ct,Oe]=S.useState(null),[nt,ut]=S.useState(null),[Ct,In]=S.useState(null),[Tn,Jn]=S.useState(null),nn=S.useRef(null),_t=S.useRef(!0),Yr=S.useRef({}),qn=S.useCallback(async()=>{try{const re=await RU();k(re),j(!1)}catch(re){T({variant:"destructive",title:"加载失败",description:re instanceof Error?re.message:"加载源代码失败"})}},[T]),or=S.useCallback(async()=>{try{e(!0);const re=await DU();Yr.current=re,_(re.bot),E(re.personality);const Me=re.chat;Me.talk_value_rules||(Me.talk_value_rules=[]),Q(Me),L(re.expression),V(re.emoji),W(re.memory),H(re.tool),ne(re.mood),R(re.voice),Y(re.lpmm_knowledge),K(re.keyword_reaction),fe(re.response_post_process),Re(re.chinese_typo),We(re.response_splitter),Oe(re.log),ut(re.debug),In(re.maim_message),Jn(re.telemetry),c(!1),_t.current=!1,await qn()}catch(re){console.error("加载配置失败:",re),T({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{e(!1)}},[T,qn]);S.useEffect(()=>{or()},[or]);const yn=S.useCallback(async(re,Me)=>{if(!_t.current)try{i(!0),await PU(re,Me),c(!1)}catch(pt){console.error(`自动保存 ${re} 失败:`,pt),c(!0)}finally{i(!1)}},[]),ft=S.useCallback((re,Me)=>{_t.current||(c(!0),nn.current&&clearTimeout(nn.current),nn.current=setTimeout(()=>{yn(re,Me)},2e3))},[yn]);S.useEffect(()=>{M&&!_t.current&&ft("bot",M)},[M,ft]),S.useEffect(()=>{D&&!_t.current&&ft("personality",D)},[D,ft]),S.useEffect(()=>{z&&!_t.current&&ft("chat",z)},[z,ft]),S.useEffect(()=>{F&&!_t.current&&ft("expression",F)},[F,ft]),S.useEffect(()=>{U&&!_t.current&&ft("emoji",U)},[U,ft]),S.useEffect(()=>{ce&&!_t.current&&ft("memory",ce)},[ce,ft]),S.useEffect(()=>{J&&!_t.current&&ft("tool",J)},[J,ft]),S.useEffect(()=>{ae&&!_t.current&&ft("mood",ae)},[ae,ft]),S.useEffect(()=>{ue&&!_t.current&&ft("voice",ue)},[ue,ft]),S.useEffect(()=>{me&&!_t.current&&ft("lpmm_knowledge",me)},[me,ft]),S.useEffect(()=>{P&&!_t.current&&ft("keyword_reaction",P)},[P,ft]),S.useEffect(()=>{$&&!_t.current&&ft("response_post_process",$)},[$,ft]),S.useEffect(()=>{ve&&!_t.current&&ft("chinese_typo",ve)},[ve,ft]),S.useEffect(()=>{de&&!_t.current&&ft("response_splitter",de)},[de,ft]),S.useEffect(()=>{ct&&!_t.current&&ft("log",ct)},[ct,ft]),S.useEffect(()=>{nt&&!_t.current&&ft("debug",nt)},[nt,ft]),S.useEffect(()=>{Ct&&!_t.current&&ft("maim_message",Ct)},[Ct,ft]),S.useEffect(()=>{Tn&&!_t.current&&ft("telemetry",Tn)},[Tn,ft]);const ee=async()=>{try{r(!0),await zU(b),c(!1),j(!1),T({title:"保存成功",description:"配置已保存"}),await or()}catch(re){j(!0),T({variant:"destructive",title:"保存失败",description:re instanceof Error?re.message:"保存配置失败"})}finally{r(!1)}},Se=async re=>{if(l){T({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}v(re),re==="source"?await qn():await or()},Be=async()=>{try{r(!0),nn.current&&clearTimeout(nn.current);const re={...Yr.current,bot:M,personality:D,chat:z,expression:F,emoji:U,memory:ce,tool:J,mood:ae,voice:ue,lpmm_knowledge:me,keyword_reaction:P,response_post_process:$,chinese_typo:ve,response_splitter:de,log:ct,debug:nt,maim_message:Ct,telemetry:Tn};await XO(re),c(!1),T({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(re){console.error("保存配置失败:",re),T({title:"保存失败",description:re.message,variant:"destructive"})}finally{r(!1)}},rt=async()=>{try{h(!0),xw().catch(()=>{}),p(!0)}catch(re){console.error("重启失败:",re),p(!1),T({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),h(!1)}},Tt=async()=>{try{r(!0),nn.current&&clearTimeout(nn.current);const re={...Yr.current,bot:M,personality:D,chat:z,expression:F,emoji:U,memory:ce,tool:J,mood:ae,voice:ue,lpmm_knowledge:me,keyword_reaction:P,response_post_process:$,chinese_typo:ve,response_splitter:de,log:ct,debug:nt,maim_message:Ct,telemetry:Tn};await XO(re),c(!1),T({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(Me=>setTimeout(Me,500)),await rt()}catch(re){console.error("保存失败:",re),T({title:"保存失败",description:re.message,variant:"destructive"})}finally{r(!1)}},cr=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Kr=()=>{p(!1),h(!1),T({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return t?a.jsx(fn,{className:"h-full",children:a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):a.jsx(fn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto items-center",children:[a.jsx(dl,{value:x,onValueChange:re=>Se(re),className:"w-auto",children:a.jsxs(va,{className:"h-9",children:[a.jsxs($t,{value:"visual",className:"text-xs sm:text-sm px-2 sm:px-3",children:[a.jsx(bq,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化"]}),a.jsxs($t,{value:"source",className:"text-xs sm:text-sm px-2 sm:px-3",children:[a.jsx(wq,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码"]})]})}),a.jsxs(ie,{onClick:x==="visual"?Be:ee,disabled:n||s||!l||d,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":s?"自动保存中...":l?"保存配置":"已保存"]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:n||s||d,size:"sm",className:"flex-1 sm:flex-none",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),d?"重启中...":l?"保存并重启":"重启麦麦"]})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认重启麦麦?"}),a.jsx(un,{children:l?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:l?Tt:rt,children:l?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(oo,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),x==="source"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs(ld,{children:[a.jsx(oo,{className:"h-4 w-4"}),a.jsxs(od,{children:[a.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",O&&a.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),a.jsx(Uee,{value:b,onChange:re=>{k(re),c(!0),O&&j(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),x==="visual"&&a.jsx(a.Fragment,{children:a.jsxs(dl,{defaultValue:"bot",className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:a.jsxs(va,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[a.jsx($t,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),a.jsx($t,{value:"personality",className:"flex-shrink-0",children:"人格"}),a.jsx($t,{value:"chat",className:"flex-shrink-0",children:"聊天"}),a.jsx($t,{value:"expression",className:"flex-shrink-0",children:"表达"}),a.jsx($t,{value:"features",className:"flex-shrink-0",children:"功能"}),a.jsx($t,{value:"processing",className:"flex-shrink-0",children:"处理"}),a.jsx($t,{value:"mood",className:"flex-shrink-0",children:"情绪"}),a.jsx($t,{value:"voice",className:"flex-shrink-0",children:"语音"}),a.jsx($t,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),a.jsx($t,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),a.jsx(kn,{value:"bot",className:"space-y-4",children:M&&a.jsx(Wee,{config:M,onChange:_})}),a.jsx(kn,{value:"personality",className:"space-y-4",children:D&&a.jsx(Gee,{config:D,onChange:E})}),a.jsx(kn,{value:"chat",className:"space-y-4",children:z&&a.jsx(Xee,{config:z,onChange:Q})}),a.jsx(kn,{value:"expression",className:"space-y-4",children:F&&a.jsx(Yee,{config:F,onChange:L})}),a.jsx(kn,{value:"features",className:"space-y-4",children:U&&ce&&J&&a.jsx(Kee,{emojiConfig:U,memoryConfig:ce,toolConfig:J,onEmojiChange:V,onMemoryChange:W,onToolChange:H})}),a.jsx(kn,{value:"processing",className:"space-y-4",children:P&&$&&ve&&de&&a.jsx(Zee,{keywordReactionConfig:P,responsePostProcessConfig:$,chineseTypoConfig:ve,responseSplitterConfig:de,onKeywordReactionChange:K,onResponsePostProcessChange:fe,onChineseTypoChange:Re,onResponseSplitterChange:We})}),a.jsx(kn,{value:"mood",className:"space-y-4",children:ae&&a.jsx(Jee,{config:ae,onChange:ne})}),a.jsx(kn,{value:"voice",className:"space-y-4",children:ue&&a.jsx(ete,{config:ue,onChange:R})}),a.jsx(kn,{value:"lpmm",className:"space-y-4",children:me&&a.jsx(tte,{config:me,onChange:Y})}),a.jsxs(kn,{value:"other",className:"space-y-4",children:[ct&&a.jsx(nte,{config:ct,onChange:Oe}),nt&&a.jsx(rte,{config:nt,onChange:ut}),Ct&&a.jsx(ste,{config:Ct,onChange:In}),Tn&&a.jsx(ite,{config:Tn,onChange:Jn})]})]})}),m&&a.jsx(vw,{onRestartComplete:cr,onRestartFailed:Kr})]})})}function Wee({config:t,onChange:e}){const n=()=>{e({...t,platforms:[...t.platforms,""]})},r=d=>{e({...t,platforms:t.platforms.filter((h,m)=>m!==d)})},s=(d,h)=>{const m=[...t.platforms];m[d]=h,e({...t,platforms:m})},i=()=>{e({...t,alias_names:[...t.alias_names,""]})},l=d=>{e({...t,alias_names:t.alias_names.filter((h,m)=>m!==d)})},c=(d,h)=>{const m=[...t.alias_names];m[d]=h,e({...t,alias_names:m})};return a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"platform",children:"平台"}),a.jsx(Ae,{id:"platform",value:t.platform,onChange:d=>e({...t,platform:d.target.value}),placeholder:"qq"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"qq_account",children:"QQ账号"}),a.jsx(Ae,{id:"qq_account",value:t.qq_account,onChange:d=>e({...t,qq_account:d.target.value}),placeholder:"123456789"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称"}),a.jsx(Ae,{id:"nickname",value:t.nickname,onChange:d=>e({...t,nickname:d.target.value}),placeholder:"麦麦"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"其他平台账号"}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),a.jsxs("div",{className:"space-y-2",children:[t.platforms.map((d,h)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ae,{value:d,onChange:m=>s(h,m.target.value),placeholder:"wx:114514"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:['确定要删除平台账号 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>r(h),children:"删除"})]})]})]})]},h)),t.platforms.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"别名"}),a.jsxs(ie,{onClick:i,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),a.jsxs("div",{className:"space-y-2",children:[t.alias_names.map((d,h)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ae,{value:d,onChange:m=>c(h,m.target.value),placeholder:"小麦"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:['确定要删除别名 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>l(h),children:"删除"})]})]})]})]},h)),t.alias_names.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function Gee({config:t,onChange:e}){const n=()=>{e({...t,states:[...t.states,""]})},r=i=>{e({...t,states:t.states.filter((l,c)=>c!==i)})},s=(i,l)=>{const c=[...t.states];c[i]=l,e({...t,states:c})};return a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"personality",children:"人格特质"}),a.jsx(_n,{id:"personality",value:t.personality,onChange:i=>e({...t,personality:i.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"reply_style",children:"表达风格"}),a.jsx(_n,{id:"reply_style",value:t.reply_style,onChange:i=>e({...t,reply_style:i.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"interest",children:"兴趣"}),a.jsx(_n,{id:"interest",value:t.interest,onChange:i=>e({...t,interest:i.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"plan_style",children:"说话规则与行为风格"}),a.jsx(_n,{id:"plan_style",value:t.plan_style,onChange:i=>e({...t,plan_style:i.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"visual_style",children:"识图规则"}),a.jsx(_n,{id:"visual_style",value:t.visual_style,onChange:i=>e({...t,visual_style:i.target.value}),placeholder:"识图时的处理规则",rows:3})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"private_plan_style",children:"私聊规则"}),a.jsx(_n,{id:"private_plan_style",value:t.private_plan_style,onChange:i=>e({...t,private_plan_style:i.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"状态列表(人格多样性)"}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),a.jsx("div",{className:"space-y-2",children:t.states.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(_n,{value:i,onChange:c=>s(l,c.target.value),placeholder:"描述一个人格状态",rows:2}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsx(un,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>r(l),children:"删除"})]})]})]})]},l))})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"state_probability",children:"状态替换概率"}),a.jsx(Ae,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:t.state_probability,onChange:i=>e({...t,state_probability:parseFloat(i.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function Xee({config:t,onChange:e}){const n=()=>{e({...t,talk_value_rules:[...t.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},r=c=>{e({...t,talk_value_rules:t.talk_value_rules.filter((d,h)=>h!==c)})},s=(c,d,h)=>{const m=[...t.talk_value_rules];m[c]={...m[c],[d]:h},e({...t,talk_value_rules:m})},i=({value:c,onChange:d})=>{const[h,m]=S.useState("00"),[p,x]=S.useState("00"),[v,b]=S.useState("23"),[k,O]=S.useState("59");S.useEffect(()=>{const T=c.split("-");if(T.length===2){const[M,_]=T,[D,E]=M.split(":"),[z,Q]=_.split(":");D&&m(D.padStart(2,"0")),E&&x(E.padStart(2,"0")),z&&b(z.padStart(2,"0")),Q&&O(Q.padStart(2,"0"))}},[c]);const j=(T,M,_,D)=>{const E=`${T}:${M}-${_}:${D}`;d(E)};return a.jsxs(co,{children:[a.jsx(uo,{asChild:!0,children:a.jsxs(ie,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[a.jsx(uc,{className:"h-4 w-4 mr-2"}),c||"选择时间段"]})}),a.jsx(hl,{className:"w-80",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"小时"}),a.jsxs(Lt,{value:h,onValueChange:T=>{m(T),j(T,p,v,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:24},(T,M)=>M).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"分钟"}),a.jsxs(Lt,{value:p,onValueChange:T=>{x(T),j(h,T,v,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:60},(T,M)=>M).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"小时"}),a.jsxs(Lt,{value:v,onValueChange:T=>{b(T),j(h,p,T,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:24},(T,M)=>M).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"分钟"}),a.jsxs(Lt,{value:k,onValueChange:T=>{O(T),j(h,p,v,T)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:60},(T,M)=>M).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]})]})]})]})})]})},l=({rule:c})=>{const d=`{ target = "${c.target}", time = "${c.time}", value = ${c.value.toFixed(1)} }`;return a.jsxs(co,{children:[a.jsx(uo,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(Fi,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(hl,{className:"w-96",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:d}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),a.jsx(Ae,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:t.talk_value,onChange:c=>e({...t,talk_value:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"mentioned_bot_reply",children:"提及回复增幅"}),a.jsx(Ae,{id:"mentioned_bot_reply",type:"number",step:"0.1",min:"0",max:"1",value:t.mentioned_bot_reply,onChange:c=>e({...t,mentioned_bot_reply:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"提及时回复概率增幅,1 为 100% 回复"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_context_size",children:"上下文长度"}),a.jsx(Ae,{id:"max_context_size",type:"number",min:"1",value:t.max_context_size,onChange:c=>e({...t,max_context_size:parseInt(c.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"planner_smooth",children:"规划器平滑"}),a.jsx(Ae,{id:"planner_smooth",type:"number",step:"1",min:"0",value:t.planner_smooth,onChange:c=>e({...t,planner_smooth:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_talk_value_rules",checked:t.enable_talk_value_rules,onCheckedChange:c=>e({...t,enable_talk_value_rules:c})}),a.jsx(te,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"include_planner_reasoning",checked:t.include_planner_reasoning,onCheckedChange:c=>e({...t,include_planner_reasoning:c})}),a.jsx(te,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),t.enable_talk_value_rules&&a.jsxs("div",{className:"border-t pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),a.jsxs(ie,{onClick:n,size:"sm",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),t.talk_value_rules&&t.talk_value_rules.length>0?a.jsx("div",{className:"space-y-4",children:t.talk_value_rules.map((c,d)=>a.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",d+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(l,{rule:c}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{variant:"ghost",size:"sm",children:a.jsx(Ht,{className:"h-4 w-4 text-destructive"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:["确定要删除规则 #",d+1," 吗?此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>r(d),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"配置类型"}),a.jsxs(Lt,{value:c.target===""?"global":"specific",onValueChange:h=>{h==="global"?s(d,"target",""):s(d,"target","qq::group")},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"global",children:"全局配置"}),a.jsx(Pe,{value:"specific",children:"详细配置"})]})]})]}),c.target!==""&&(()=>{const h=c.target.split(":"),m=h[0]||"qq",p=h[1]||"",x=h[2]||"group";return a.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"平台"}),a.jsxs(Lt,{value:m,onValueChange:v=>{s(d,"target",`${v}:${p}:${x}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"qq",children:"QQ"}),a.jsx(Pe,{value:"wx",children:"微信"})]})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"群 ID"}),a.jsx(Ae,{value:p,onChange:v=>{s(d,"target",`${m}:${v.target.value}:${x}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"类型"}),a.jsxs(Lt,{value:x,onValueChange:v=>{s(d,"target",`${m}:${p}:${v}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"group",children:"群组(group)"}),a.jsx(Pe,{value:"private",children:"私聊(private)"})]})]})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",c.target||"(未设置)"]})]})})(),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"时间段 (Time)"}),a.jsx(i,{value:c.time,onChange:h=>s(d,"time",h)}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{htmlFor:`rule-value-${d}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),a.jsx(Ae,{id:`rule-value-${d}`,type:"number",step:"0.01",min:"0",max:"1",value:c.value,onChange:h=>{const m=parseFloat(h.target.value);isNaN(m)||s(d,"value",Math.max(0,Math.min(1,m)))},className:"w-20 h-8 text-xs"})]}),a.jsx(yx,{value:[c.value],onValueChange:h=>s(d,"value",h[0]),min:0,max:1,step:.01,className:"w-full"}),a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:"0 (完全沉默)"}),a.jsx("span",{children:"0.5"}),a.jsx("span",{children:"1.0 (正常)"})]})]})]})]},d))}):a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:a.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),a.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[a.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),a.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function Yee({config:t,onChange:e}){const n=()=>{e({...t,learning_list:[...t.learning_list,["","enable","enable","1.0"]]})},r=x=>{e({...t,learning_list:t.learning_list.filter((v,b)=>b!==x)})},s=(x,v,b)=>{const k=[...t.learning_list];k[x][v]=b,e({...t,learning_list:k})},i=({rule:x})=>{const v=`["${x[0]}", "${x[1]}", "${x[2]}", "${x[3]}"]`;return a.jsxs(co,{children:[a.jsx(uo,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(Fi,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(hl,{className:"w-96",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:v}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},l=({member:x,groupIndex:v,memberIndex:b,availableChatIds:k})=>{const O=k.includes(x)||x==="*",[j,T]=S.useState(!O);return a.jsxs("div",{className:"flex gap-2",children:[a.jsx("div",{className:"flex-1 flex gap-2",children:j?a.jsxs(a.Fragment,{children:[a.jsx(Ae,{value:x,onChange:M=>p(v,b,M.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),k.length>0&&a.jsx(ie,{size:"sm",variant:"outline",onClick:()=>T(!1),title:"切换到下拉选择",children:"下拉"})]}):a.jsxs(a.Fragment,{children:[a.jsxs(Lt,{value:x,onValueChange:M=>p(v,b,M),children:[a.jsx(Dt,{className:"flex-1",children:a.jsx(It,{placeholder:"选择聊天流"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"*",children:"* (全局共享)"}),k.map((M,_)=>a.jsx(Pe,{value:M,children:M},_))]})]}),a.jsx(ie,{size:"sm",variant:"outline",onClick:()=>T(!0),title:"切换到手动输入",children:"输入"})]})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:['确定要删除组成员 "',x||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>m(v,b),children:"删除"})]})]})]})]})},c=()=>{e({...t,expression_groups:[...t.expression_groups,[]]})},d=x=>{e({...t,expression_groups:t.expression_groups.filter((v,b)=>b!==x)})},h=x=>{const v=[...t.expression_groups];v[x]=[...v[x],""],e({...t,expression_groups:v})},m=(x,v)=>{const b=[...t.expression_groups];b[x]=b[x].filter((k,O)=>O!==v),e({...t,expression_groups:b})},p=(x,v,b)=>{const k=[...t.expression_groups];k[x][v]=b,e({...t,expression_groups:k})};return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),a.jsxs("div",{className:"space-y-4",children:[t.learning_list.map((x,v)=>{const b=t.learning_list.some((_,D)=>D!==v&&_[0]===""),k=x[0]==="",O=x[0].split(":"),j=O[0]||"qq",T=O[1]||"",M=O[2]||"group";return a.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["规则 ",v+1," ",k&&"(全局配置)"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(i,{rule:x}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:["确定要删除学习规则 ",v+1," 吗?此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>r(v),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"配置类型"}),a.jsxs(Lt,{value:k?"global":"specific",onValueChange:_=>{_==="global"?s(v,0,""):s(v,0,"qq::group")},disabled:b&&!k,children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"global",children:"全局配置"}),a.jsx(Pe,{value:"specific",disabled:b&&!k,children:"详细配置"})]})]}),b&&!k&&a.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!k&&a.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"平台"}),a.jsxs(Lt,{value:j,onValueChange:_=>{s(v,0,`${_}:${T}:${M}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"qq",children:"QQ"}),a.jsx(Pe,{value:"wx",children:"微信"})]})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"群 ID"}),a.jsx(Ae,{value:T,onChange:_=>{s(v,0,`${j}:${_.target.value}:${M}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"类型"}),a.jsxs(Lt,{value:M,onValueChange:_=>{s(v,0,`${j}:${T}:${_}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"group",children:"群组(group)"}),a.jsx(Pe,{value:"private",children:"私聊(private)"})]})]})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",x[0]||"(未设置)"]})]}),a.jsx("div",{className:"grid gap-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs font-medium",children:"使用学到的表达"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),a.jsx(jt,{checked:x[1]==="enable",onCheckedChange:_=>s(v,1,_?"enable":"disable")})]})}),a.jsx("div",{className:"grid gap-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs font-medium",children:"学习表达"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),a.jsx(jt,{checked:x[2]==="enable",onCheckedChange:_=>s(v,2,_?"enable":"disable")})]})}),a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-xs font-medium",children:"学习强度"}),a.jsx(Ae,{type:"number",step:"0.1",min:"0",max:"5",value:x[3],onChange:_=>{const D=parseFloat(_.target.value);isNaN(D)||s(v,3,Math.max(0,Math.min(5,D)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),a.jsx(yx,{value:[parseFloat(x[3])||1],onValueChange:_=>s(v,3,_[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:"0 (不学习)"}),a.jsx("span",{children:"2.5"}),a.jsx("span",{children:"5.0 (快速学习)"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},v)}),t.learning_list.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),a.jsxs(ie,{onClick:c,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),a.jsxs("div",{className:"space-y-4",children:[t.expression_groups.map((x,v)=>{const b=t.learning_list.map(k=>k[0]).filter(k=>k!=="");return a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",v+1,x.length===1&&x[0]==="*"&&"(全局共享)"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ie,{onClick:()=>h(v),size:"sm",variant:"outline",children:a.jsx(Wr,{className:"h-4 w-4"})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:["确定要删除共享组 ",v+1," 吗?此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>d(v),children:"删除"})]})]})]})]})]}),a.jsx("div",{className:"space-y-2",children:x.map((k,O)=>a.jsx(l,{member:k,groupIndex:v,memberIndex:O,availableChatIds:b},O))}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},v)}),t.expression_groups.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function Kee({emojiConfig:t,memoryConfig:e,toolConfig:n,onEmojiChange:r,onMemoryChange:s,onToolChange:i}){return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:l=>i({...n,enable_tool:l})}),a.jsx(te,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),a.jsx(Ae,{id:"max_agent_iterations",type:"number",min:"1",value:e.max_agent_iterations,onChange:l=>s({...e,max_agent_iterations:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"emoji_chance",children:"表情包激活概率"}),a.jsx(Ae,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:t.emoji_chance,onChange:l=>r({...t,emoji_chance:parseFloat(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_reg_num",children:"最大注册数量"}),a.jsx(Ae,{id:"max_reg_num",type:"number",min:"1",value:t.max_reg_num,onChange:l=>r({...t,max_reg_num:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),a.jsx(Ae,{id:"check_interval",type:"number",min:"1",value:t.check_interval,onChange:l=>r({...t,check_interval:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"do_replace",checked:t.do_replace,onCheckedChange:l=>r({...t,do_replace:l})}),a.jsx(te,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:l=>r({...t,steal_emoji:l})}),a.jsx(te,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),a.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:l=>r({...t,content_filtration:l})}),a.jsx(te,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),t.content_filtration&&a.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[a.jsx(te,{htmlFor:"filtration_prompt",children:"过滤要求"}),a.jsx(Ae,{id:"filtration_prompt",value:t.filtration_prompt,onChange:l=>r({...t,filtration_prompt:l.target.value}),placeholder:"符合公序良俗"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function Zee({keywordReactionConfig:t,responsePostProcessConfig:e,chineseTypoConfig:n,responseSplitterConfig:r,onKeywordReactionChange:s,onResponsePostProcessChange:i,onChineseTypoChange:l,onResponseSplitterChange:c}){const d=()=>{s({...t,regex_rules:[...t.regex_rules,{regex:[""],reaction:""}]})},h=_=>{s({...t,regex_rules:t.regex_rules.filter((D,E)=>E!==_)})},m=(_,D,E)=>{const z=[...t.regex_rules];D==="regex"&&typeof E=="string"?z[_]={...z[_],regex:[E]}:D==="reaction"&&typeof E=="string"&&(z[_]={...z[_],reaction:E}),s({...t,regex_rules:z})},p=({regex:_,reaction:D,onRegexChange:E,onReactionChange:z})=>{const[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,ce]=S.useState(null),[W,J]=S.useState(""),[H,ae]=S.useState({}),[ne,ue]=S.useState(""),R=S.useRef(null),[me,Y]=S.useState("build"),P=ve=>ve.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),K=(ve,Re=0)=>{const de=R.current;if(!de)return;const We=de.selectionStart||0,ct=de.selectionEnd||0,Oe=_.substring(0,We)+ve+_.substring(ct);E(Oe),setTimeout(()=>{const nt=We+ve.length+Re;de.setSelectionRange(nt,nt),de.focus()},0)};S.useEffect(()=>{if(!_||!L){ce(null),ae({}),ue(D),J("");return}try{const ve=P(_),Re=new RegExp(ve,"g"),de=L.match(Re);ce(de),J("");const ct=new RegExp(ve).exec(L);if(ct&&ct.groups){ae(ct.groups);let Oe=D;Object.entries(ct.groups).forEach(([nt,ut])=>{Oe=Oe.replace(new RegExp(`\\[${nt}\\]`,"g"),ut||"")}),ue(Oe)}else ae({}),ue(D)}catch(ve){J(ve.message),ce(null),ae({}),ue(D)}},[_,L,D]);const $=()=>{if(!L||!V||V.length===0)return a.jsx("span",{className:"text-muted-foreground",children:L||"请输入测试文本"});try{const ve=P(_),Re=new RegExp(ve,"g");let de=0;const We=[];let ct;for(;(ct=Re.exec(L))!==null;)ct.index>de&&We.push(a.jsx("span",{children:L.substring(de,ct.index)},`text-${de}`)),We.push(a.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:ct[0]},`match-${ct.index}`)),de=ct.index+ct[0].length;return de)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return a.jsxs(Rr,{open:Q,onOpenChange:F,children:[a.jsx(mw,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(fg,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"正则表达式编辑器"}),a.jsx(Gr,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),a.jsx(fn,{className:"max-h-[calc(90vh-120px)]",children:a.jsxs(dl,{value:me,onValueChange:ve=>Y(ve),className:"w-full",children:[a.jsxs(va,{className:"grid w-full grid-cols-2",children:[a.jsx($t,{value:"build",children:"🔧 构建器"}),a.jsx($t,{value:"test",children:"🧪 测试器"})]}),a.jsxs(kn,{value:"build",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"正则表达式"}),a.jsx(Ae,{ref:R,value:_,onChange:ve=>E(ve.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"Reaction 内容"}),a.jsx(_n,{value:D,onChange:ve=>z(ve.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),a.jsxs("div",{className:"space-y-4 border-t pt-4",children:[fe.map(ve=>a.jsxs("div",{className:"space-y-2",children:[a.jsx("h5",{className:"text-xs font-semibold text-primary",children:ve.category}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:ve.items.map(Re=>a.jsx(ie,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>K(Re.pattern,Re.moveCursor||0),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsxs("div",{className:"flex items-center gap-2 w-full",children:[a.jsx("span",{className:"text-xs font-medium",children:Re.label}),a.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:Re.pattern})]}),a.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:Re.desc})]})},Re.label))})]},ve.category)),a.jsxs("div",{className:"space-y-2 border-t pt-4",children:[a.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("^(?P\\S{1,20})是这样的$"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?P.+?)(?:是|为什么|怎么)"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),a.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),a.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),a.jsxs("li",{children:["命名捕获组格式:",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),a.jsxs("li",{children:["在 reaction 中使用 ",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),a.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),a.jsxs(kn,{value:"test",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"当前正则表达式"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:_||"(未设置)"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),a.jsx(_n,{id:"test-text",value:L,onChange:ve=>U(ve.target.value),placeholder:`在此输入要测试的文本... +例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),W&&a.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[a.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),a.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:W})]}),!W&&L&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"flex items-center gap-2",children:V&&V.length>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),a.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",V.length," 处)"]})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),a.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"匹配高亮"}),a.jsx(fn,{className:"h-40 rounded-md bg-muted p-3",children:a.jsx("div",{className:"text-sm break-words",children:$()})})]}),Object.keys(H).length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"命名捕获组"}),a.jsx(fn,{className:"h-32 rounded-md border p-3",children:a.jsx("div",{className:"space-y-2",children:Object.entries(H).map(([ve,Re])=>a.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[a.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",ve,"]"]}),a.jsx("span",{className:"text-muted-foreground",children:"="}),a.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:Re})]},ve))})})]}),Object.keys(H).length>0&&D&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"Reaction 替换预览"}),a.jsx(fn,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:a.jsx("div",{className:"text-sm break-words",children:ne})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),a.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),a.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),a.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),a.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),a.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},x=()=>{s({...t,keyword_rules:[...t.keyword_rules,{keywords:[],reaction:""}]})},v=_=>{s({...t,keyword_rules:t.keyword_rules.filter((D,E)=>E!==_)})},b=(_,D,E)=>{const z=[...t.keyword_rules];typeof E=="string"&&(z[_]={...z[_],reaction:E}),s({...t,keyword_rules:z})},k=_=>{const D=[...t.keyword_rules];D[_]={...D[_],keywords:[...D[_].keywords||[],""]},s({...t,keyword_rules:D})},O=(_,D)=>{const E=[...t.keyword_rules];E[_]={...E[_],keywords:(E[_].keywords||[]).filter((z,Q)=>Q!==D)},s({...t,keyword_rules:E})},j=(_,D,E)=>{const z=[...t.keyword_rules],Q=[...z[_].keywords||[]];Q[D]=E,z[_]={...z[_],keywords:Q},s({...t,keyword_rules:z})},T=({rule:_})=>{const D=`{ regex = [${(_.regex||[]).map(E=>`"${E}"`).join(", ")}], reaction = "${_.reaction}" }`;return a.jsxs(co,{children:[a.jsx(uo,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(Fi,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(hl,{className:"w-[95vw] sm:w-[500px]",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx(fn,{className:"h-60 rounded-md bg-muted p-3",children:a.jsx("pre",{className:"font-mono text-xs break-all",children:D})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},M=({rule:_})=>{const D=`[[keyword_reaction.keyword_rules]] keywords = [${(_.keywords||[]).map(E=>`"${E}"`).join(", ")}] -reaction = "${_.reaction}"`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-[95vw] sm:w-[500px]",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx(mn,{className:"h-60 rounded-md bg-muted p-3",children:a.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:D})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),a.jsxs(ie,{onClick:d,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),a.jsxs("div",{className:"space-y-3",children:[t.regex_rules.map((_,D)=>a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",D+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(p,{regex:_.regex&&_.regex[0]||"",reaction:_.reaction,onRegexChange:E=>m(D,"regex",E),onReactionChange:E=>m(D,"reaction",E)}),a.jsx(T,{rule:_}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除正则规则 ",D+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>h(D),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),a.jsx(Me,{value:_.regex&&_.regex[0]||"",onChange:E=>m(D,"regex",E.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"反应内容"}),a.jsx(_n,{value:_.reaction,onChange:E=>m(D,"reaction",E.target.value),placeholder:`触发后麦麦的反应... -可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},D)),t.regex_rules.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),a.jsxs("div",{className:"space-y-4 border-t pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),a.jsxs(ie,{onClick:x,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),a.jsxs("div",{className:"space-y-3",children:[t.keyword_rules.map((_,D)=>a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",D+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(A,{rule:_}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除关键词规则 ",D+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>v(D),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-xs font-medium",children:"关键词列表"}),a.jsxs(ie,{onClick:()=>k(D),size:"sm",variant:"ghost",children:[a.jsx(Wr,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),a.jsxs("div",{className:"space-y-2",children:[(_.keywords||[]).map((E,z)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{value:E,onChange:Q=>j(D,z,Q.target.value),placeholder:"关键词",className:"flex-1"}),a.jsx(ie,{onClick:()=>O(D,z),size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})]},z)),(!_.keywords||_.keywords.length===0)&&a.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"反应内容"}),a.jsx(_n,{value:_.reaction,onChange:E=>b(D,"reaction",E.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},D)),t.keyword_rules.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_response_post_process",checked:e.enable_response_post_process,onCheckedChange:_=>i({...e,enable_response_post_process:_})}),a.jsx(te,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),e.enable_response_post_process&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"border-t pt-6 space-y-4",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[a.jsx(jt,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:_=>l({...n,enable:_})}),a.jsx(te,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&a.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),a.jsx(Me,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:_=>l({...n,error_rate:parseFloat(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),a.jsx(Me,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:_=>l({...n,min_freq:parseInt(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),a.jsx(Me,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:_=>l({...n,tone_error_rate:parseFloat(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),a.jsx(Me,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:_=>l({...n,word_replace_rate:parseFloat(_.target.value)})})]})]})]})}),a.jsx("div",{className:"border-t pt-6 space-y-4",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[a.jsx(jt,{id:"enable_response_splitter",checked:r.enable,onCheckedChange:_=>c({...r,enable:_})}),a.jsx(te,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),r.enable&&a.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),a.jsx(Me,{id:"max_length",type:"number",min:"1",value:r.max_length,onChange:_=>c({...r,max_length:parseInt(_.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),a.jsx(Me,{id:"max_sentence_num",type:"number",min:"1",value:r.max_sentence_num,onChange:_=>c({...r,max_sentence_num:parseInt(_.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_kaomoji_protection",checked:r.enable_kaomoji_protection,onCheckedChange:_=>c({...r,enable_kaomoji_protection:_})}),a.jsx(te,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_overflow_return_all",checked:r.enable_overflow_return_all,onCheckedChange:_=>c({...r,enable_overflow_return_all:_})}),a.jsx(te,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),a.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function Jee({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用情绪系统"})]}),t.enable_mood&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"情绪更新阈值"}),a.jsx(Me,{type:"number",min:"1",value:t.mood_update_threshold,onChange:n=>e({...t,mood_update_threshold:parseInt(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"情感特征"}),a.jsx(_n,{value:t.emotion_style,onChange:n=>e({...t,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function ete({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable_asr,onCheckedChange:n=>e({...t,enable_asr:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用语音识别"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function tte({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),t.enable&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"LPMM 模式"}),a.jsxs(Lt,{value:t.lpmm_mode,onValueChange:n=>e({...t,lpmm_mode:n}),children:[a.jsx(Dt,{children:a.jsx(It,{placeholder:"选择 LPMM 模式"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"classic",children:"经典模式"}),a.jsx(Pe,{value:"agent",children:"Agent 模式"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"同义词搜索 TopK"}),a.jsx(Me,{type:"number",min:"1",value:t.rag_synonym_search_top_k,onChange:n=>e({...t,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"同义词阈值"}),a.jsx(Me,{type:"number",step:"0.1",min:"0",max:"1",value:t.rag_synonym_threshold,onChange:n=>e({...t,rag_synonym_threshold:parseFloat(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"实体提取线程数"}),a.jsx(Me,{type:"number",min:"1",value:t.info_extraction_workers,onChange:n=>e({...t,info_extraction_workers:parseInt(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"嵌入向量维度"}),a.jsx(Me,{type:"number",min:"1",value:t.embedding_dimension,onChange:n=>e({...t,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function nte({config:t,onChange:e}){const[n,r]=S.useState(""),[s,i]=S.useState("WARNING"),l=()=>{n&&!t.suppress_libraries.includes(n)&&(e({...t,suppress_libraries:[...t.suppress_libraries,n]}),r(""))},c=v=>{e({...t,suppress_libraries:t.suppress_libraries.filter(b=>b!==v)})},d=()=>{n&&!t.library_log_levels[n]&&(e({...t,library_log_levels:{...t.library_log_levels,[n]:s}}),r(""),i("WARNING"))},h=v=>{const b={...t.library_log_levels};delete b[v],e({...t,library_log_levels:b})},m=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],p=["FULL","compact","lite"],x=["none","title","full"];return a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日期格式"}),a.jsx(Me,{value:t.date_style,onChange:v=>e({...t,date_style:v.target.value}),placeholder:"例如: m-d H:i:s"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日志级别样式"}),a.jsxs(Lt,{value:t.log_level_style,onValueChange:v=>e({...t,log_level_style:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:p.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日志文本颜色"}),a.jsxs(Lt,{value:t.color_text,onValueChange:v=>e({...t,color_text:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:x.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"全局日志级别"}),a.jsxs(Lt,{value:t.log_level,onValueChange:v=>e({...t,log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"控制台日志级别"}),a.jsxs(Lt,{value:t.console_log_level,onValueChange:v=>e({...t,console_log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"文件日志级别"}),a.jsxs(Lt,{value:t.file_log_level,onValueChange:v=>e({...t,file_log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"完全屏蔽的库"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Me,{value:n,onChange:v=>r(v.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),l())}}),a.jsx(ie,{onClick:l,size:"sm",className:"flex-shrink-0",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:t.suppress_libraries.map(v=>a.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[a.jsx("span",{className:"text-sm",children:v}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>c(v),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},v))})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"特定库的日志级别"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Me,{value:n,onChange:v=>r(v.target.value),placeholder:"输入库名",className:"flex-1"}),a.jsxs(Lt,{value:s,onValueChange:i,children:[a.jsx(Dt,{className:"w-32",children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]}),a.jsx(ie,{onClick:d,size:"sm",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"space-y-2",children:Object.entries(t.library_log_levels).map(([v,b])=>a.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[a.jsx("span",{className:"text-sm font-medium",children:v}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:b}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>h(v),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},v))})]})]})}function rte({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示 Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),a.jsx(jt,{checked:t.show_prompt,onCheckedChange:n=>e({...t,show_prompt:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示回复器 Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),a.jsx(jt,{checked:t.show_replyer_prompt,onCheckedChange:n=>e({...t,show_replyer_prompt:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示回复器推理"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),a.jsx(jt,{checked:t.show_replyer_reasoning,onCheckedChange:n=>e({...t,show_replyer_reasoning:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示 Jargon Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),a.jsx(jt,{checked:t.show_jargon_prompt,onCheckedChange:n=>e({...t,show_jargon_prompt:n})})]})]})]})}function ste({config:t,onChange:e}){const[n,r]=S.useState(""),s=()=>{n&&!t.auth_token.includes(n)&&(e({...t,auth_token:[...t.auth_token,n]}),r(""))},i=l=>{e({...t,auth_token:t.auth_token.filter((c,d)=>d!==l)})};return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"启用自定义服务器"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),a.jsx(jt,{checked:t.use_custom,onCheckedChange:l=>e({...t,use_custom:l})})]}),t.use_custom&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"主机地址"}),a.jsx(Me,{value:t.host,onChange:l=>e({...t,host:l.target.value}),placeholder:"127.0.0.1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"端口号"}),a.jsx(Me,{type:"number",value:t.port,onChange:l=>e({...t,port:parseInt(l.target.value)}),placeholder:"8090"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"连接模式"}),a.jsxs(Lt,{value:t.mode,onValueChange:l=>e({...t,mode:l}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"ws",children:"WebSocket (ws)"}),a.jsx(Pe,{value:"tcp",children:"TCP"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.use_wss,onCheckedChange:l=>e({...t,use_wss:l}),disabled:t.mode!=="ws"}),a.jsx(te,{children:"使用 WSS 安全连接"})]})]}),t.use_wss&&t.mode==="ws"&&a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"SSL 证书文件路径"}),a.jsx(Me,{value:t.cert_file,onChange:l=>e({...t,cert_file:l.target.value}),placeholder:"cert.pem"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"SSL 密钥文件路径"}),a.jsx(Me,{value:t.key_file,onChange:l=>e({...t,key_file:l.target.value}),placeholder:"key.pem"})]})]})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"认证令牌"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Me,{value:n,onChange:l=>r(l.target.value),placeholder:"输入认证令牌",onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),s())}}),a.jsx(ie,{onClick:s,size:"sm",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"space-y-2",children:t.auth_token.map((l,c)=>a.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[a.jsx("span",{className:"text-sm font-mono",children:l}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>i(c),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},c))})]})]})}function ite({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"启用统计信息发送"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),a.jsx(jt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})})]})]})}const Mc=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{className:"relative w-full overflow-auto",children:a.jsx("table",{ref:n,className:ye("w-full caption-bottom text-sm",t),...e})}));Mc.displayName="Table";const Ec=S.forwardRef(({className:t,...e},n)=>a.jsx("thead",{ref:n,className:ye("[&_tr]:border-b",t),...e}));Ec.displayName="TableHeader";const _c=S.forwardRef(({className:t,...e},n)=>a.jsx("tbody",{ref:n,className:ye("[&_tr:last-child]:border-0",t),...e}));_c.displayName="TableBody";const ate=S.forwardRef(({className:t,...e},n)=>a.jsx("tfoot",{ref:n,className:ye("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));ate.displayName="TableFooter";const xr=S.forwardRef(({className:t,...e},n)=>a.jsx("tr",{ref:n,className:ye("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));xr.displayName="TableRow";const xt=S.forwardRef(({className:t,...e},n)=>a.jsx("th",{ref:n,className:ye("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));xt.displayName="TableHead";const it=S.forwardRef(({className:t,...e},n)=>a.jsx("td",{ref:n,className:ye("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));it.displayName="TableCell";const lte=S.forwardRef(({className:t,...e},n)=>a.jsx("caption",{ref:n,className:ye("mt-4 text-sm text-muted-foreground",t),...e}));lte.displayName="TableCaption";const ss=S.forwardRef(({className:t,...e},n)=>a.jsx(A9,{ref:n,className:ye("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:a.jsx(rq,{className:ye("grid place-content-center text-current"),children:a.jsx(hc,{className:"h-4 w-4"})})}));ss.displayName=A9.displayName;function ote(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(null),[T,A]=S.useState(null),[_,D]=S.useState(!1),[E,z]=S.useState(null),[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,ce]=S.useState(new Set),[W,J]=S.useState(!1),[$,ae]=S.useState(1),[ne,ue]=S.useState(20),[R,me]=S.useState(""),{toast:Y}=Pr(),P=S.useRef(null),K=S.useRef(!0);S.useEffect(()=>{H()},[]);const H=async()=>{try{r(!0);const ee=await Vu();e(ee.api_providers||[]),h(!1),K.current=!1}catch(ee){console.error("加载配置失败:",ee)}finally{r(!1)}},fe=async()=>{try{p(!0),xw().catch(()=>{}),v(!0)}catch(ee){console.error("重启失败:",ee),v(!1),Y({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),p(!1)}},ve=async()=>{try{i(!0),P.current&&clearTimeout(P.current);const ee=await Vu();ee.api_providers=t,await wg(ee),h(!1),Y({title:"保存成功",description:"正在重启麦麦..."}),await fe()}catch(ee){console.error("保存配置失败:",ee),Y({title:"保存失败",description:ee.message,variant:"destructive"}),i(!1)}},Re=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},de=()=>{v(!1),p(!1),Y({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},We=S.useCallback(async ee=>{if(!K.current)try{c(!0),await h2("api_providers",ee),h(!1)}catch(Se){console.error("自动保存失败:",Se),h(!0)}finally{c(!1)}},[]);S.useEffect(()=>{if(!K.current)return h(!0),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{We(t)},2e3),()=>{P.current&&clearTimeout(P.current)}},[t,We]);const ct=async()=>{try{i(!0),P.current&&clearTimeout(P.current);const ee=await Vu();ee.api_providers=t,await wg(ee),h(!1),Y({title:"保存成功",description:"模型提供商配置已保存"})}catch(ee){console.error("保存配置失败:",ee),Y({title:"保存失败",description:ee.message,variant:"destructive"})}finally{i(!1)}},Oe=(ee,Se)=>{j(ee||{name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),A(Se),F(!1),k(!0)},nt=async()=>{if(O?.api_key)try{await navigator.clipboard.writeText(O.api_key),Y({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{Y({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},ut=()=>{if(!O)return;const ee={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};if(T!==null){const Se=[...t];Se[T]=ee,e(Se)}else e([...t,ee]);k(!1),j(null),A(null)},Ct=ee=>{if(!ee&&O){const Se={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};j(Se)}k(ee)},In=ee=>{z(ee),D(!0)},Tn=()=>{if(E!==null){const ee=t.filter((Se,Be)=>Be!==E);e(ee),Y({title:"删除成功",description:"提供商已从列表中移除"})}D(!1),z(null)},Jn=ee=>{const Se=new Set(V);Se.has(ee)?Se.delete(ee):Se.add(ee),ce(Se)},nn=()=>{if(V.size===qn.length)ce(new Set);else{const ee=qn.map((Se,Be)=>t.findIndex(rt=>rt===qn[Be]));ce(new Set(ee))}},_t=()=>{if(V.size===0){Y({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}J(!0)},Yr=()=>{const ee=t.filter((Se,Be)=>!V.has(Be));e(ee),ce(new Set),J(!1),Y({title:"批量删除成功",description:`已删除 ${V.size} 个提供商`})},qn=t.filter(ee=>{if(!L)return!0;const Se=L.toLowerCase();return ee.name.toLowerCase().includes(Se)||ee.base_url.toLowerCase().includes(Se)||ee.client_type.toLowerCase().includes(Se)}),or=Math.ceil(qn.length/ne),yn=qn.slice(($-1)*ne,$*ne),ft=()=>{const ee=parseInt(R);ee>=1&&ee<=or&&(ae(ee),me(""))};return n?a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型提供商配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 API 提供商配置"})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[V.size>0&&a.jsxs(ie,{onClick:_t,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",V.size,")"]}),a.jsxs(ie,{onClick:()=>Oe(null,null),size:"sm",className:"w-full sm:w-auto",children:[a.jsx(Wr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),a.jsxs(ie,{onClick:ct,disabled:s||l||!d||m,size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),s?"保存中...":l?"自动保存中...":d?"保存配置":"已保存"]}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:s||l||m,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),m?"重启中...":d?"保存并重启":"重启麦麦"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重启麦麦?"}),a.jsx(dn,{children:d?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:d?ve:fe,children:d?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),a.jsxs(mn,{className:"h-[calc(100vh-260px)]",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[a.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索提供商名称、URL 或类型...",value:L,onChange:ee=>U(ee.target.value),className:"pl-9"})]}),L&&a.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",qn.length," 个结果"]})]}),a.jsx("div",{className:"md:hidden space-y-3",children:qn.length===0?a.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:L?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):yn.map((ee,Se)=>{const Be=t.findIndex(rt=>rt===ee);return a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h3",{className:"font-semibold text-base truncate",children:ee.name}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:ee.base_url})]}),a.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Oe(ee,Be),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>In(Be),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),a.jsx("p",{className:"font-medium",children:ee.client_type})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),a.jsx("p",{className:"font-medium",children:ee.max_retry})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),a.jsx("p",{className:"font-medium",children:ee.timeout})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),a.jsx("p",{className:"font-medium",children:ee.retry_interval})]})]})]},Se)})}),a.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:V.size===qn.length&&qn.length>0,onCheckedChange:nn})}),a.jsx(xt,{children:"名称"}),a.jsx(xt,{children:"基础URL"}),a.jsx(xt,{children:"客户端类型"}),a.jsx(xt,{className:"text-right",children:"最大重试"}),a.jsx(xt,{className:"text-right",children:"超时(秒)"}),a.jsx(xt,{className:"text-right",children:"重试间隔(秒)"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:yn.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center text-muted-foreground py-8",children:L?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):yn.map((ee,Se)=>{const Be=t.findIndex(rt=>rt===ee);return a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:V.has(Be),onCheckedChange:()=>Jn(Be)})}),a.jsx(it,{className:"font-medium",children:ee.name}),a.jsx(it,{className:"max-w-xs truncate",title:ee.base_url,children:ee.base_url}),a.jsx(it,{children:ee.client_type}),a.jsx(it,{className:"text-right",children:ee.max_retry}),a.jsx(it,{className:"text-right",children:ee.timeout}),a.jsx(it,{className:"text-right",children:ee.retry_interval}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Oe(ee,Be),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>In(Be),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Se)})})]})}),qn.length>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:ne.toString(),onValueChange:ee=>{ue(parseInt(ee)),ae(1),ce(new Set)},children:[a.jsx(Dt,{id:"page-size-provider",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",($-1)*ne+1," 到"," ",Math.min($*ne,qn.length)," 条,共 ",qn.length," 条"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ae(1),disabled:$===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(ee=>Math.max(1,ee-1)),disabled:$===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:R,onChange:ee=>me(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&ft(),placeholder:$.toString(),className:"w-16 h-8 text-center",min:1,max:or}),a.jsx(ie,{variant:"outline",size:"sm",onClick:ft,disabled:!R,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(ee=>ee+1),disabled:$>=or,children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ae(or),disabled:$>=or,className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]}),a.jsx(Rr,{open:b,onOpenChange:Ct,children:a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:T!==null?"编辑提供商":"添加提供商"}),a.jsx(Gr,{children:"配置 API 提供商的连接信息和参数"})]}),a.jsxs("div",{className:"grid gap-4 py-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"name",children:"名称 *"}),a.jsx(Me,{id:"name",value:O?.name||"",onChange:ee=>j(Se=>Se?{...Se,name:ee.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"base_url",children:"基础 URL *"}),a.jsx(Me,{id:"base_url",value:O?.base_url||"",onChange:ee=>j(Se=>Se?{...Se,base_url:ee.target.value}:null),placeholder:"https://api.example.com/v1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"api_key",children:"API Key *"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{id:"api_key",type:Q?"text":"password",value:O?.api_key||"",onChange:ee=>j(Se=>Se?{...Se,api_key:ee.target.value}:null),placeholder:"sk-...",className:"flex-1"}),a.jsx(ie,{type:"button",variant:"outline",size:"icon",onClick:()=>F(!Q),title:Q?"隐藏密钥":"显示密钥",children:Q?a.jsx(Yb,{className:"h-4 w-4"}):a.jsx($i,{className:"h-4 w-4"})}),a.jsx(ie,{type:"button",variant:"outline",size:"icon",onClick:nt,title:"复制密钥",children:a.jsx(Xb,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"client_type",children:"客户端类型"}),a.jsxs(Lt,{value:O?.client_type||"openai",onValueChange:ee=>j(Se=>Se?{...Se,client_type:ee}:null),children:[a.jsx(Dt,{id:"client_type",children:a.jsx(It,{placeholder:"选择客户端类型"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"openai",children:"OpenAI"}),a.jsx(Pe,{value:"gemini",children:"Gemini"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_retry",children:"最大重试"}),a.jsx(Me,{id:"max_retry",type:"number",min:"0",value:O?.max_retry??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,max_retry:Se}:null)},placeholder:"默认: 2"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"timeout",children:"超时(秒)"}),a.jsx(Me,{id:"timeout",type:"number",min:"1",value:O?.timeout??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,timeout:Se}:null)},placeholder:"默认: 30"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),a.jsx(Me,{id:"retry_interval",type:"number",min:"1",value:O?.retry_interval??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,retry_interval:Se}:null)},placeholder:"默认: 10"})]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>k(!1),children:"取消"}),a.jsx(ie,{onClick:ut,children:"保存"})]})]})}),a.jsx(pn,{open:_,onOpenChange:D,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除提供商 "',E!==null?t[E]?.name:"",'" 吗? 此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:Tn,children:"删除"})]})]})}),a.jsx(pn,{open:W,onOpenChange:J,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["确定要删除选中的 ",V.size," 个提供商吗? 此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:Yr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),x&&a.jsx(vw,{onRestartComplete:Re,onRestartFailed:de})]})}var a8=1,cte=.9,ute=.8,dte=.17,cb=.1,ub=.999,hte=.9999,fte=.99,mte=/[\\\/_+.#"@\[\(\{&]/,pte=/[\\\/_+.#"@\[\(\{&]/g,gte=/[\s-]/,L_=/[\s-]/g;function u4(t,e,n,r,s,i,l){if(i===e.length)return s===t.length?a8:fte;var c=`${s},${i}`;if(l[c]!==void 0)return l[c];for(var d=r.charAt(i),h=n.indexOf(d,s),m=0,p,x,v,b;h>=0;)p=u4(t,e,n,r,h+1,i+1,l),p>m&&(h===s?p*=a8:mte.test(t.charAt(h-1))?(p*=ute,v=t.slice(s,h-1).match(pte),v&&s>0&&(p*=Math.pow(ub,v.length))):gte.test(t.charAt(h-1))?(p*=cte,b=t.slice(s,h-1).match(L_),b&&s>0&&(p*=Math.pow(ub,b.length))):(p*=dte,s>0&&(p*=Math.pow(ub,h-s))),t.charAt(h)!==e.charAt(i)&&(p*=hte)),(pp&&(p=x*cb)),p>m&&(m=p),h=n.indexOf(d,h+1);return l[c]=m,m}function l8(t){return t.toLowerCase().replace(L_," ")}function xte(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,u4(t,e,l8(t),l8(e),0,0,{})}var vte=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],To=vte.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Bh='[cmdk-group=""]',db='[cmdk-group-items=""]',yte='[cmdk-group-heading=""]',I_='[cmdk-item=""]',o8=`${I_}:not([aria-disabled="true"])`,d4="cmdk-item-select",Pu="data-value",bte=(t,e,n)=>xte(t,e,n),q_=S.createContext(void 0),g0=()=>S.useContext(q_),F_=S.createContext(void 0),o5=()=>S.useContext(F_),Q_=S.createContext(void 0),$_=S.forwardRef((t,e)=>{let n=Bu(()=>{var Y,P;return{search:"",value:(P=(Y=t.value)!=null?Y:t.defaultValue)!=null?P:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Bu(()=>new Set),s=Bu(()=>new Map),i=Bu(()=>new Map),l=Bu(()=>new Set),c=H_(t),{label:d,children:h,value:m,onValueChange:p,filter:x,shouldFilter:v,loop:b,disablePointerSelection:k=!1,vimBindings:O=!0,...j}=t,T=ji(),A=ji(),_=ji(),D=S.useRef(null),E=Ete();Nc(()=>{if(m!==void 0){let Y=m.trim();n.current.value=Y,z.emit()}},[m]),Nc(()=>{E(6,ce)},[]);let z=S.useMemo(()=>({subscribe:Y=>(l.current.add(Y),()=>l.current.delete(Y)),snapshot:()=>n.current,setState:(Y,P,K)=>{var H,fe,ve,Re;if(!Object.is(n.current[Y],P)){if(n.current[Y]=P,Y==="search")V(),L(),E(1,U);else if(Y==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let de=document.getElementById(_);de?de.focus():(H=document.getElementById(T))==null||H.focus()}if(E(7,()=>{var de;n.current.selectedItemId=(de=W())==null?void 0:de.id,z.emit()}),K||E(5,ce),((fe=c.current)==null?void 0:fe.value)!==void 0){let de=P??"";(Re=(ve=c.current).onValueChange)==null||Re.call(ve,de);return}}z.emit()}},emit:()=>{l.current.forEach(Y=>Y())}}),[]),Q=S.useMemo(()=>({value:(Y,P,K)=>{var H;P!==((H=i.current.get(Y))==null?void 0:H.value)&&(i.current.set(Y,{value:P,keywords:K}),n.current.filtered.items.set(Y,F(P,K)),E(2,()=>{L(),z.emit()}))},item:(Y,P)=>(r.current.add(Y),P&&(s.current.has(P)?s.current.get(P).add(Y):s.current.set(P,new Set([Y]))),E(3,()=>{V(),L(),n.current.value||U(),z.emit()}),()=>{i.current.delete(Y),r.current.delete(Y),n.current.filtered.items.delete(Y);let K=W();E(4,()=>{V(),K?.getAttribute("id")===Y&&U(),z.emit()})}),group:Y=>(s.current.has(Y)||s.current.set(Y,new Set),()=>{i.current.delete(Y),s.current.delete(Y)}),filter:()=>c.current.shouldFilter,label:d||t["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:T,inputId:_,labelId:A,listInnerRef:D}),[]);function F(Y,P){var K,H;let fe=(H=(K=c.current)==null?void 0:K.filter)!=null?H:bte;return Y?fe(Y,n.current.search,P):0}function L(){if(!n.current.search||c.current.shouldFilter===!1)return;let Y=n.current.filtered.items,P=[];n.current.filtered.groups.forEach(H=>{let fe=s.current.get(H),ve=0;fe.forEach(Re=>{let de=Y.get(Re);ve=Math.max(de,ve)}),P.push([H,ve])});let K=D.current;J().sort((H,fe)=>{var ve,Re;let de=H.getAttribute("id"),We=fe.getAttribute("id");return((ve=Y.get(We))!=null?ve:0)-((Re=Y.get(de))!=null?Re:0)}).forEach(H=>{let fe=H.closest(db);fe?fe.appendChild(H.parentElement===fe?H:H.closest(`${db} > *`)):K.appendChild(H.parentElement===K?H:H.closest(`${db} > *`))}),P.sort((H,fe)=>fe[1]-H[1]).forEach(H=>{var fe;let ve=(fe=D.current)==null?void 0:fe.querySelector(`${Bh}[${Pu}="${encodeURIComponent(H[0])}"]`);ve?.parentElement.appendChild(ve)})}function U(){let Y=J().find(K=>K.getAttribute("aria-disabled")!=="true"),P=Y?.getAttribute(Pu);z.setState("value",P||void 0)}function V(){var Y,P,K,H;if(!n.current.search||c.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let fe=0;for(let ve of r.current){let Re=(P=(Y=i.current.get(ve))==null?void 0:Y.value)!=null?P:"",de=(H=(K=i.current.get(ve))==null?void 0:K.keywords)!=null?H:[],We=F(Re,de);n.current.filtered.items.set(ve,We),We>0&&fe++}for(let[ve,Re]of s.current)for(let de of Re)if(n.current.filtered.items.get(de)>0){n.current.filtered.groups.add(ve);break}n.current.filtered.count=fe}function ce(){var Y,P,K;let H=W();H&&(((Y=H.parentElement)==null?void 0:Y.firstChild)===H&&((K=(P=H.closest(Bh))==null?void 0:P.querySelector(yte))==null||K.scrollIntoView({block:"nearest"})),H.scrollIntoView({block:"nearest"}))}function W(){var Y;return(Y=D.current)==null?void 0:Y.querySelector(`${I_}[aria-selected="true"]`)}function J(){var Y;return Array.from(((Y=D.current)==null?void 0:Y.querySelectorAll(o8))||[])}function $(Y){let P=J()[Y];P&&z.setState("value",P.getAttribute(Pu))}function ae(Y){var P;let K=W(),H=J(),fe=H.findIndex(Re=>Re===K),ve=H[fe+Y];(P=c.current)!=null&&P.loop&&(ve=fe+Y<0?H[H.length-1]:fe+Y===H.length?H[0]:H[fe+Y]),ve&&z.setState("value",ve.getAttribute(Pu))}function ne(Y){let P=W(),K=P?.closest(Bh),H;for(;K&&!H;)K=Y>0?Ate(K,Bh):Mte(K,Bh),H=K?.querySelector(o8);H?z.setState("value",H.getAttribute(Pu)):ae(Y)}let ue=()=>$(J().length-1),R=Y=>{Y.preventDefault(),Y.metaKey?ue():Y.altKey?ne(1):ae(1)},me=Y=>{Y.preventDefault(),Y.metaKey?$(0):Y.altKey?ne(-1):ae(-1)};return S.createElement(To.div,{ref:e,tabIndex:-1,...j,"cmdk-root":"",onKeyDown:Y=>{var P;(P=j.onKeyDown)==null||P.call(j,Y);let K=Y.nativeEvent.isComposing||Y.keyCode===229;if(!(Y.defaultPrevented||K))switch(Y.key){case"n":case"j":{O&&Y.ctrlKey&&R(Y);break}case"ArrowDown":{R(Y);break}case"p":case"k":{O&&Y.ctrlKey&&me(Y);break}case"ArrowUp":{me(Y);break}case"Home":{Y.preventDefault(),$(0);break}case"End":{Y.preventDefault(),ue();break}case"Enter":{Y.preventDefault();let H=W();if(H){let fe=new Event(d4);H.dispatchEvent(fe)}}}}},S.createElement("label",{"cmdk-label":"",htmlFor:Q.inputId,id:Q.labelId,style:Dte},d),Px(t,Y=>S.createElement(F_.Provider,{value:z},S.createElement(q_.Provider,{value:Q},Y))))}),wte=S.forwardRef((t,e)=>{var n,r;let s=ji(),i=S.useRef(null),l=S.useContext(Q_),c=g0(),d=H_(t),h=(r=(n=d.current)==null?void 0:n.forceMount)!=null?r:l?.forceMount;Nc(()=>{if(!h)return c.item(s,l?.id)},[h]);let m=U_(s,i,[t.value,t.children,i],t.keywords),p=o5(),x=vo(E=>E.value&&E.value===m.current),v=vo(E=>h||c.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);S.useEffect(()=>{let E=i.current;if(!(!E||t.disabled))return E.addEventListener(d4,b),()=>E.removeEventListener(d4,b)},[v,t.onSelect,t.disabled]);function b(){var E,z;k(),(z=(E=d.current).onSelect)==null||z.call(E,m.current)}function k(){p.setState("value",m.current,!0)}if(!v)return null;let{disabled:O,value:j,onSelect:T,forceMount:A,keywords:_,...D}=t;return S.createElement(To.div,{ref:oo(i,e),...D,id:s,"cmdk-item":"",role:"option","aria-disabled":!!O,"aria-selected":!!x,"data-disabled":!!O,"data-selected":!!x,onPointerMove:O||c.getDisablePointerSelection()?void 0:k,onClick:O?void 0:b},t.children)}),Ste=S.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,l=ji(),c=S.useRef(null),d=S.useRef(null),h=ji(),m=g0(),p=vo(v=>s||m.filter()===!1?!0:v.search?v.filtered.groups.has(l):!0);Nc(()=>m.group(l),[]),U_(l,c,[t.value,t.heading,d]);let x=S.useMemo(()=>({id:l,forceMount:s}),[s]);return S.createElement(To.div,{ref:oo(c,e),...i,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},n&&S.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),Px(t,v=>S.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},S.createElement(Q_.Provider,{value:x},v))))}),kte=S.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=S.useRef(null),i=vo(l=>!l.search);return!n&&!i?null:S.createElement(To.div,{ref:oo(s,e),...r,"cmdk-separator":"",role:"separator"})}),Ote=S.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=o5(),l=vo(h=>h.search),c=vo(h=>h.selectedItemId),d=g0();return S.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),S.createElement(To.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":c,id:d.inputId,type:"text",value:s?t.value:l,onChange:h=>{s||i.setState("search",h.target.value),n?.(h.target.value)}})}),jte=S.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=S.useRef(null),l=S.useRef(null),c=vo(h=>h.selectedItemId),d=g0();return S.useEffect(()=>{if(l.current&&i.current){let h=l.current,m=i.current,p,x=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let v=h.offsetHeight;m.style.setProperty("--cmdk-list-height",v.toFixed(1)+"px")})});return x.observe(h),()=>{cancelAnimationFrame(p),x.unobserve(h)}}},[]),S.createElement(To.div,{ref:oo(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":r,id:d.listId},Px(t,h=>S.createElement("div",{ref:oo(l,d.listInnerRef),"cmdk-list-sizer":""},h)))}),Nte=S.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:l,...c}=t;return S.createElement(W4,{open:n,onOpenChange:r},S.createElement($4,{container:l},S.createElement(nx,{"cmdk-overlay":"",className:s}),S.createElement(rx,{"aria-label":t.label,"cmdk-dialog":"",className:i},S.createElement($_,{ref:e,...c}))))}),Cte=S.forwardRef((t,e)=>vo(n=>n.filtered.count===0)?S.createElement(To.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),Tte=S.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return S.createElement(To.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Px(t,l=>S.createElement("div",{"aria-hidden":!0},l)))}),Is=Object.assign($_,{List:jte,Item:wte,Input:Ote,Group:Ste,Separator:kte,Dialog:Nte,Empty:Cte,Loading:Tte});function Ate(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function Mte(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function H_(t){let e=S.useRef(t);return Nc(()=>{e.current=t}),e}var Nc=typeof window>"u"?S.useEffect:S.useLayoutEffect;function Bu(t){let e=S.useRef();return e.current===void 0&&(e.current=t()),e}function vo(t){let e=o5(),n=()=>t(e.snapshot());return S.useSyncExternalStore(e.subscribe,n,n)}function U_(t,e,n,r=[]){let s=S.useRef(),i=g0();return Nc(()=>{var l;let c=(()=>{var h;for(let m of n){if(typeof m=="string")return m.trim();if(typeof m=="object"&&"current"in m)return m.current?(h=m.current.textContent)==null?void 0:h.trim():s.current}})(),d=r.map(h=>h.trim());i.value(t,c,d),(l=e.current)==null||l.setAttribute(Pu,c),s.current=c}),s}var Ete=()=>{let[t,e]=S.useState(),n=Bu(()=>new Map);return Nc(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function _te(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function Px({asChild:t,children:e},n){return t&&S.isValidElement(e)?S.cloneElement(_te(e),{ref:e.ref},n(e.props.children)):n(e)}var Dte={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const V_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is,{ref:n,className:ye("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));V_.displayName=Is.displayName;const W_=S.forwardRef(({className:t,...e},n)=>a.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[a.jsx(Bs,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),a.jsx(Is.Input,{ref:n,className:ye("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));W_.displayName=Is.Input.displayName;const G_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.List,{ref:n,className:ye("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));G_.displayName=Is.List.displayName;const X_=S.forwardRef((t,e)=>a.jsx(Is.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));X_.displayName=Is.Empty.displayName;const Y_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.Group,{ref:n,className:ye("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...e}));Y_.displayName=Is.Group.displayName;const Rte=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.Separator,{ref:n,className:ye("-mx-1 h-px bg-border",t),...e}));Rte.displayName=Is.Separator.displayName;const K_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.Item,{ref:n,className:ye("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...e}));K_.displayName=Is.Item.displayName;function zte({options:t,selected:e,onChange:n,placeholder:r="选择选项...",emptyText:s="未找到选项",className:i}){const[l,c]=S.useState(!1),d=m=>{e.includes(m)?n(e.filter(p=>p!==m)):n([...e,m])},h=m=>{n(e.filter(p=>p!==m))};return a.jsxs(uo,{open:l,onOpenChange:c,children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",role:"combobox","aria-expanded":l,className:ye("w-full justify-between min-h-10 h-auto",i),children:[a.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:e.length===0?a.jsx("span",{className:"text-muted-foreground",children:r}):e.map(m=>{const p=t.find(x=>x.value===m);return a.jsxs(On,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80",onClick:x=>{x.stopPropagation(),h(m)},children:[p?.label||m,a.jsx(Gf,{className:"ml-1 h-3 w-3",strokeWidth:2,fill:"none"})]},m)})}),a.jsx(Sq,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),a.jsx(fl,{className:"w-full p-0",align:"start",children:a.jsxs(V_,{children:[a.jsx(W_,{placeholder:"搜索...",className:"h-9"}),a.jsxs(G_,{children:[a.jsx(X_,{children:s}),a.jsx(Y_,{children:t.map(m=>{const p=e.includes(m.value);return a.jsxs(K_,{value:m.value,onSelect:()=>d(m.value),children:[a.jsx("div",{className:ye("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",p?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:a.jsx(hc,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),a.jsx("span",{children:m.label})]},m.value)})})]})]})})]})}function Pte(){const[t,e]=S.useState([]),[n,r]=S.useState([]),[s,i]=S.useState([]),[l,c]=S.useState(null),[d,h]=S.useState(!0),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,A]=S.useState(!1),[_,D]=S.useState(!1),[E,z]=S.useState(null),[Q,F]=S.useState(null),[L,U]=S.useState(!1),[V,ce]=S.useState(null),[W,J]=S.useState(""),[$,ae]=S.useState(new Set),[ne,ue]=S.useState(!1),[R,me]=S.useState(1),[Y,P]=S.useState(20),[K,H]=S.useState(""),{toast:fe}=Pr(),ve=S.useRef(null),Re=S.useRef(null),de=S.useRef(!0);S.useEffect(()=>{We()},[]);const We=async()=>{try{h(!0);const re=await Vu(),Ae=re.models||[];e(Ae),i(Ae.map(yt=>yt.name));const pt=re.api_providers||[];r(pt.map(yt=>yt.name)),c(re.model_task_config||null),k(!1),de.current=!1}catch(re){console.error("加载配置失败:",re)}finally{h(!1)}},ct=async()=>{try{j(!0),xw().catch(()=>{}),A(!0)}catch(re){console.error("重启失败:",re),A(!1),fe({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),j(!1)}},Oe=async()=>{try{p(!0),ve.current&&clearTimeout(ve.current),Re.current&&clearTimeout(Re.current);const re=await Vu();re.models=t,re.model_task_config=l,await wg(re),k(!1),fe({title:"保存成功",description:"正在重启麦麦..."}),await ct()}catch(re){console.error("保存配置失败:",re),fe({title:"保存失败",description:re.message,variant:"destructive"}),p(!1)}},nt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},ut=()=>{A(!1),j(!1),fe({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Ct=S.useCallback(async re=>{if(!de.current)try{v(!0),await h2("models",re),k(!1)}catch(Ae){console.error("自动保存模型列表失败:",Ae),k(!0)}finally{v(!1)}},[]),In=S.useCallback(async re=>{if(!de.current)try{v(!0),await h2("model_task_config",re),k(!1)}catch(Ae){console.error("自动保存任务配置失败:",Ae),k(!0)}finally{v(!1)}},[]);S.useEffect(()=>{if(!de.current)return k(!0),ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{Ct(t)},2e3),()=>{ve.current&&clearTimeout(ve.current)}},[t,Ct]),S.useEffect(()=>{if(!(de.current||!l))return k(!0),Re.current&&clearTimeout(Re.current),Re.current=setTimeout(()=>{In(l)},2e3),()=>{Re.current&&clearTimeout(Re.current)}},[l,In]);const Tn=async()=>{try{p(!0),ve.current&&clearTimeout(ve.current),Re.current&&clearTimeout(Re.current);const re=await Vu();re.models=t,re.model_task_config=l,await wg(re),k(!1),fe({title:"保存成功",description:"模型配置已保存"}),await We()}catch(re){console.error("保存配置失败:",re),fe({title:"保存失败",description:re.message,variant:"destructive"})}finally{p(!1)}},Jn=(re,Ae)=>{z(re||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),F(Ae),D(!0)},nn=()=>{if(!E)return;const re={...E,price_in:E.price_in??0,price_out:E.price_out??0};let Ae;Q!==null?(Ae=[...t],Ae[Q]=re):Ae=[...t,re],e(Ae),i(Ae.map(pt=>pt.name)),D(!1),z(null),F(null)},_t=re=>{if(!re&&E){const Ae={...E,price_in:E.price_in??0,price_out:E.price_out??0};z(Ae)}D(re)},Yr=re=>{ce(re),U(!0)},qn=()=>{if(V!==null){const re=t.filter((Ae,pt)=>pt!==V);e(re),i(re.map(Ae=>Ae.name)),fe({title:"删除成功",description:"模型已从列表中移除"})}U(!1),ce(null)},or=re=>{const Ae=new Set($);Ae.has(re)?Ae.delete(re):Ae.add(re),ae(Ae)},yn=()=>{if($.size===Be.length)ae(new Set);else{const re=Be.map((Ae,pt)=>t.findIndex(yt=>yt===Be[pt]));ae(new Set(re))}},ft=()=>{if($.size===0){fe({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ue(!0)},ee=()=>{const re=t.filter((Ae,pt)=>!$.has(pt));e(re),i(re.map(Ae=>Ae.name)),ae(new Set),ue(!1),fe({title:"批量删除成功",description:`已删除 ${$.size} 个模型`})},Se=(re,Ae,pt)=>{l&&c({...l,[re]:{...l[re],[Ae]:pt}})},Be=t.filter(re=>{if(!W)return!0;const Ae=W.toLowerCase();return re.name.toLowerCase().includes(Ae)||re.model_identifier.toLowerCase().includes(Ae)||re.api_provider.toLowerCase().includes(Ae)}),rt=Math.ceil(Be.length/Y),Tt=Be.slice((R-1)*Y,R*Y),cr=()=>{const re=parseInt(K);re>=1&&re<=rt&&(me(re),H(""))},Kr=re=>l?[l.utils?.model_list||[],l.utils_small?.model_list||[],l.tool_use?.model_list||[],l.replyer?.model_list||[],l.planner?.model_list||[],l.vlm?.model_list||[],l.voice?.model_list||[],l.embedding?.model_list||[],l.lpmm_entity_extract?.model_list||[],l.lpmm_rdf_build?.model_list||[],l.lpmm_qa?.model_list||[]].some(pt=>pt.includes(re)):!1;return d?a.jsx(mn,{className:"h-full",children:a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理模型和任务配置"})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[a.jsxs(ie,{onClick:Tn,disabled:m||x||!b||O,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),m?"保存中...":x?"自动保存中...":b?"保存配置":"已保存"]}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:m||x||O,size:"sm",className:"flex-1 sm:flex-none",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),O?"重启中...":b?"保存并重启":"重启麦麦"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重启麦麦?"}),a.jsx(dn,{children:b?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:b?Oe:ct,children:b?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),a.jsxs(hl,{defaultValue:"models",className:"w-full",children:[a.jsxs(ya,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[a.jsx($t,{value:"models",children:"模型配置"}),a.jsx($t,{value:"tasks",children:"模型任务配置"})]}),a.jsxs(kn,{value:"models",className:"space-y-4 mt-0",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[$.size>0&&a.jsxs(ie,{onClick:ft,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",$.size,")"]}),a.jsxs(ie,{onClick:()=>Jn(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(Wr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[a.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索模型名称、标识符或提供商...",value:W,onChange:re=>J(re.target.value),className:"pl-9"})]}),W&&a.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Be.length," 个结果"]})]}),a.jsx("div",{className:"md:hidden space-y-3",children:Tt.length===0?a.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:W?"未找到匹配的模型":"暂无模型配置"}):Tt.map((re,Ae)=>{const pt=t.findIndex(vs=>vs===re),yt=Kr(re.name);return a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("h3",{className:"font-semibold text-base",children:re.name}),a.jsx(On,{variant:yt?"default":"secondary",className:yt?"bg-green-600 hover:bg-green-700":"",children:yt?"已使用":"未使用"})]}),a.jsx("p",{className:"text-xs text-muted-foreground break-all",title:re.model_identifier,children:re.model_identifier})]}),a.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Jn(re,pt),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>Yr(pt),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),a.jsx("p",{className:"font-medium",children:re.api_provider})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),a.jsx("p",{className:"font-medium",children:re.force_stream_mode?"是":"否"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),a.jsxs("p",{className:"font-medium",children:["¥",re.price_in,"/M"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),a.jsxs("p",{className:"font-medium",children:["¥",re.price_out,"/M"]})]})]})]},Ae)})}),a.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:$.size===Be.length&&Be.length>0,onCheckedChange:yn})}),a.jsx(xt,{className:"w-24",children:"使用状态"}),a.jsx(xt,{children:"模型名称"}),a.jsx(xt,{children:"模型标识符"}),a.jsx(xt,{children:"提供商"}),a.jsx(xt,{className:"text-right",children:"输入价格"}),a.jsx(xt,{className:"text-right",children:"输出价格"}),a.jsx(xt,{className:"text-center",children:"强制流式"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:Tt.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:9,className:"text-center text-muted-foreground py-8",children:W?"未找到匹配的模型":"暂无模型配置"})}):Tt.map((re,Ae)=>{const pt=t.findIndex(vs=>vs===re),yt=Kr(re.name);return a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:$.has(pt),onCheckedChange:()=>or(pt)})}),a.jsx(it,{children:a.jsx(On,{variant:yt?"default":"secondary",className:yt?"bg-green-600 hover:bg-green-700":"",children:yt?"已使用":"未使用"})}),a.jsx(it,{className:"font-medium",children:re.name}),a.jsx(it,{className:"max-w-xs truncate",title:re.model_identifier,children:re.model_identifier}),a.jsx(it,{children:re.api_provider}),a.jsxs(it,{className:"text-right",children:["¥",re.price_in,"/M"]}),a.jsxs(it,{className:"text-right",children:["¥",re.price_out,"/M"]}),a.jsx(it,{className:"text-center",children:re.force_stream_mode?"是":"否"}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Jn(re,pt),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>Yr(pt),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Ae)})})]})}),Be.length>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:Y.toString(),onValueChange:re=>{P(parseInt(re)),me(1),ae(new Set)},children:[a.jsx(Dt,{id:"page-size-model",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*Y+1," 到"," ",Math.min(R*Y,Be.length)," 条,共 ",Be.length," 条"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>me(1),disabled:R===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>me(re=>Math.max(1,re-1)),disabled:R===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:K,onChange:re=>H(re.target.value),onKeyDown:re=>re.key==="Enter"&&cr(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:rt}),a.jsx(ie,{variant:"outline",size:"sm",onClick:cr,disabled:!K,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>me(re=>re+1),disabled:R>=rt,children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>me(rt),disabled:R>=rt,className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]}),a.jsxs(kn,{value:"tasks",className:"space-y-6 mt-0",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),l&&a.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[a.jsx(Pi,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:l.utils,modelNames:s,onChange:(re,Ae)=>Se("utils",re,Ae)}),a.jsx(Pi,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:l.utils_small,modelNames:s,onChange:(re,Ae)=>Se("utils_small",re,Ae)}),a.jsx(Pi,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:l.tool_use,modelNames:s,onChange:(re,Ae)=>Se("tool_use",re,Ae)}),a.jsx(Pi,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:l.replyer,modelNames:s,onChange:(re,Ae)=>Se("replyer",re,Ae)}),a.jsx(Pi,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:l.planner,modelNames:s,onChange:(re,Ae)=>Se("planner",re,Ae)}),a.jsx(Pi,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:l.vlm,modelNames:s,onChange:(re,Ae)=>Se("vlm",re,Ae),hideTemperature:!0}),a.jsx(Pi,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:l.voice,modelNames:s,onChange:(re,Ae)=>Se("voice",re,Ae),hideTemperature:!0,hideMaxTokens:!0}),a.jsx(Pi,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:l.embedding,modelNames:s,onChange:(re,Ae)=>Se("embedding",re,Ae),hideTemperature:!0,hideMaxTokens:!0}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),a.jsx(Pi,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:l.lpmm_entity_extract,modelNames:s,onChange:(re,Ae)=>Se("lpmm_entity_extract",re,Ae)}),a.jsx(Pi,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:l.lpmm_rdf_build,modelNames:s,onChange:(re,Ae)=>Se("lpmm_rdf_build",re,Ae)}),a.jsx(Pi,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:l.lpmm_qa,modelNames:s,onChange:(re,Ae)=>Se("lpmm_qa",re,Ae)})]})]})]})]}),a.jsx(Rr,{open:_,onOpenChange:_t,children:a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:Q!==null?"编辑模型":"添加模型"}),a.jsx(Gr,{children:"配置模型的基本信息和参数"})]}),a.jsxs("div",{className:"grid gap-4 py-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"model_name",children:"模型名称 *"}),a.jsx(Me,{id:"model_name",value:E?.name||"",onChange:re=>z(Ae=>Ae?{...Ae,name:re.target.value}:null),placeholder:"例如: qwen3-30b"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"model_identifier",children:"模型标识符 *"}),a.jsx(Me,{id:"model_identifier",value:E?.model_identifier||"",onChange:re=>z(Ae=>Ae?{...Ae,model_identifier:re.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"API 提供商提供的模型 ID"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"api_provider",children:"API 提供商 *"}),a.jsxs(Lt,{value:E?.api_provider||"",onValueChange:re=>z(Ae=>Ae?{...Ae,api_provider:re}:null),children:[a.jsx(Dt,{id:"api_provider",children:a.jsx(It,{placeholder:"选择提供商"})}),a.jsx(Rt,{children:n.map(re=>a.jsx(Pe,{value:re,children:re},re))})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),a.jsx(Me,{id:"price_in",type:"number",step:"0.1",min:"0",value:E?.price_in??"",onChange:re=>{const Ae=re.target.value===""?null:parseFloat(re.target.value);z(pt=>pt?{...pt,price_in:Ae}:null)},placeholder:"默认: 0"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),a.jsx(Me,{id:"price_out",type:"number",step:"0.1",min:"0",value:E?.price_out??"",onChange:re=>{const Ae=re.target.value===""?null:parseFloat(re.target.value);z(pt=>pt?{...pt,price_out:Ae}:null)},placeholder:"默认: 0"})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"force_stream_mode",checked:E?.force_stream_mode||!1,onCheckedChange:re=>z(Ae=>Ae?{...Ae,force_stream_mode:re}:null)}),a.jsx(te,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>D(!1),children:"取消"}),a.jsx(ie,{onClick:nn,children:"保存"})]})]})}),a.jsx(pn,{open:L,onOpenChange:U,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除模型 "',V!==null?t[V]?.name:"",'" 吗? 此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:qn,children:"删除"})]})]})}),a.jsx(pn,{open:ne,onOpenChange:ue,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["确定要删除选中的 ",$.size," 个模型吗? 此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),T&&a.jsx(vw,{onRestartComplete:nt,onRestartFailed:ut})]})})}function Pi({title:t,description:e,taskConfig:n,modelNames:r,onChange:s,hideTemperature:i=!1,hideMaxTokens:l=!1}){const c=d=>{s("model_list",d)};return a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:t}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:e})]}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"模型列表"}),a.jsx(zte,{options:r.map(d=>({label:d,value:d})),selected:n.model_list||[],onChange:c,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!i&&a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"温度"}),a.jsx(Me,{type:"number",step:"0.1",min:"0",max:"1",value:n.temperature??.3,onChange:d=>{const h=parseFloat(d.target.value);!isNaN(h)&&h>=0&&h<=1&&s("temperature",h)},className:"w-20 h-8 text-sm"})]}),a.jsx(yx,{value:[n.temperature??.3],onValueChange:d=>s("temperature",d[0]),min:0,max:1,step:.1,className:"w-full"})]}),!l&&a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"最大 Token"}),a.jsx(Me,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:d=>s("max_tokens",parseInt(d.target.value))})]})]})]})]})}const Bx="/api/webui/config";async function Bte(){const e=await(await ot(`${Bx}/adapter-config/path`)).json();return!e.success||!e.path?null:{path:e.path,lastModified:e.lastModified}}async function Lte(t){const n=await(await ot(`${Bx}/adapter-config/path`,{method:"POST",headers:bt(),body:JSON.stringify({path:t})})).json();if(!n.success)throw new Error(n.message||"保存路径失败")}async function Ite(t){const n=await(await ot(`${Bx}/adapter-config?path=${encodeURIComponent(t)}`)).json();if(!n.success)throw new Error("读取配置文件失败");return n.content}async function c8(t,e){const r=await(await ot(`${Bx}/adapter-config`,{method:"POST",headers:bt(),body:JSON.stringify({path:t,content:e})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}const Zs={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}};function qte(){const[t,e]=S.useState("upload"),[n,r]=S.useState(null),[s,i]=S.useState(""),[l,c]=S.useState(""),[d,h]=S.useState(""),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,A]=S.useState(null),_=S.useRef(null),{toast:D}=Pr(),E=S.useRef(null),z=K=>{if(!K.trim())return{valid:!1,error:"路径不能为空"};const H=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,fe=/^(\/|~\/).+\.toml$/i,ve=H.test(K),Re=fe.test(K);return!ve&&!Re?{valid:!1,error:"路径格式错误。Windows: C:\\path\\file.toml,Linux: /path/file.toml"}:K.toLowerCase().endsWith(".toml")?/[<>"|?*\x00-\x1F]/.test(K)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}:{valid:!1,error:"文件必须是 .toml 格式"}},Q=K=>{if(c(K),K.trim()){const H=z(K);h(H.error)}else h("")};S.useEffect(()=>{(async()=>{try{const H=await Bte();H&&H.path&&(c(H.path),e("path"),await F(H.path))}catch(H){console.error("加载保存的路径失败:",H)}})()},[]);const F=async K=>{const H=z(K);if(!H.valid){h(H.error),D({title:"路径无效",description:H.error,variant:"destructive"});return}h(""),v(!0);try{const fe=await Ite(K),ve=ue(fe);r(ve),c(K),await Lte(K),D({title:"加载成功",description:"已从配置文件加载"})}catch(fe){console.error("加载配置失败:",fe),D({title:"加载失败",description:fe instanceof Error?fe.message:"无法读取配置文件",variant:"destructive"})}finally{v(!1)}},L=S.useCallback(K=>{t!=="path"||!l||(E.current&&clearTimeout(E.current),E.current=setTimeout(async()=>{p(!0);try{const H=R(K);await c8(l,H),D({title:"自动保存成功",description:"配置已保存到文件"})}catch(H){console.error("自动保存失败:",H),D({title:"自动保存失败",description:H instanceof Error?H.message:"保存配置失败",variant:"destructive"})}finally{p(!1)}},1e3))},[t,l,D]),U=async()=>{if(!n||!l)return;const K=z(l);if(!K.valid){D({title:"保存失败",description:K.error,variant:"destructive"});return}p(!0);try{const H=R(n);await c8(l,H),D({title:"保存成功",description:"配置已保存到文件"})}catch(H){console.error("保存失败:",H),D({title:"保存失败",description:H instanceof Error?H.message:"保存配置失败",variant:"destructive"})}finally{p(!1)}},V=async()=>{l&&await F(l)},ce=K=>{if(K!==t){if(n){A(K),k(!0);return}W(K)}},W=K=>{r(null),i(""),h(""),e(K),D({title:"已切换模式",description:K==="upload"?"现在可以上传配置文件":"现在可以指定配置文件路径"})},J=()=>{T&&(W(T),A(null)),k(!1)},$=()=>{if(n){j(!0);return}ae()},ae=()=>{c(""),r(null),h(""),D({title:"已清空",description:"路径和配置已清空"})},ne=()=>{ae(),j(!1)},ue=K=>{const H=JSON.parse(JSON.stringify(Zs)),fe=K.split(` -`);let ve="";for(const Re of fe){const de=Re.trim();if(!de||de.startsWith("#"))continue;const We=de.match(/^\[(\w+)\]$/);if(We){ve=We[1];continue}const ct=de.match(/^(\w+)\s*=\s*(.+)$/);if(ct&&ve){const[,Oe,nt]=ct,ut=nt.trim();let Ct;if(ut==="true")Ct=!0;else if(ut==="false")Ct=!1;else if(ut.startsWith("[")&&ut.endsWith("]")){const In=ut.slice(1,-1).trim();if(In){const Tn=In.split(",").map(nn=>{const _t=nn.trim();return isNaN(Number(_t))?_t.replace(/"/g,""):Number(_t)}),Jn=typeof Tn[0];Ct=Tn.every(nn=>typeof nn===Jn)?Tn:Tn.filter(nn=>typeof nn=="number")}else Ct=[]}else ut.startsWith('"')&&ut.endsWith('"')?Ct=ut.slice(1,-1):isNaN(Number(ut))?Ct=ut.replace(/"/g,""):Ct=Number(ut);if(ve in H){const In=H[ve];In[Oe]=Ct}}}return H},R=K=>{const H=[],fe=(ve,Re)=>ve===""||ve===null||ve===void 0?Re:ve;return H.push("[inner]"),H.push(`version = "${fe(K.inner.version,Zs.inner.version)}" # 版本号`),H.push("# 请勿修改版本号,除非你知道自己在做什么"),H.push(""),H.push("[nickname] # 现在没用"),H.push(`nickname = "${fe(K.nickname.nickname,Zs.nickname.nickname)}"`),H.push(""),H.push("[napcat_server] # Napcat连接的ws服务设置"),H.push(`host = "${fe(K.napcat_server.host,Zs.napcat_server.host)}" # Napcat设定的主机地址`),H.push(`port = ${fe(K.napcat_server.port||0,Zs.napcat_server.port)} # Napcat设定的端口`),H.push(`token = "${fe(K.napcat_server.token,Zs.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),H.push(`heartbeat_interval = ${fe(K.napcat_server.heartbeat_interval||0,Zs.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),H.push(""),H.push("[maibot_server] # 连接麦麦的ws服务设置"),H.push(`host = "${fe(K.maibot_server.host,Zs.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),H.push(`port = ${fe(K.maibot_server.port||0,Zs.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),H.push(""),H.push("[chat] # 黑白名单功能"),H.push(`group_list_type = "${fe(K.chat.group_list_type,Zs.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),H.push(`group_list = [${K.chat.group_list.join(", ")}] # 群组名单`),H.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),H.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),H.push(`private_list_type = "${fe(K.chat.private_list_type,Zs.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),H.push(`private_list = [${K.chat.private_list.join(", ")}] # 私聊名单`),H.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),H.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),H.push(`ban_user_id = [${K.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),H.push(`ban_qq_bot = ${K.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),H.push(`enable_poke = ${K.chat.enable_poke} # 是否启用戳一戳功能`),H.push(""),H.push("[voice] # 发送语音设置"),H.push(`use_tts = ${K.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),H.push(""),H.push("[debug]"),H.push(`level = "${fe(K.debug.level,Zs.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),H.join(` -`)},me=K=>{const H=K.target.files?.[0];if(!H)return;const fe=new FileReader;fe.onload=ve=>{try{const Re=ve.target?.result,de=ue(Re);r(de),i(H.name),D({title:"上传成功",description:`已加载配置文件:${H.name}`})}catch(Re){console.error("解析配置文件失败:",Re),D({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},fe.readAsText(H)},Y=()=>{if(!n)return;const K=R(n),H=new Blob([K],{type:"text/plain;charset=utf-8"}),fe=URL.createObjectURL(H),ve=document.createElement("a");ve.href=fe,ve.download=s||"config.toml",document.body.appendChild(ve),ve.click(),document.body.removeChild(ve),URL.revokeObjectURL(fe),D({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},P=()=>{r(JSON.parse(JSON.stringify(Zs))),i("config.toml"),D({title:"已加载默认配置",description:"可以开始编辑配置"})};return a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"工作模式"}),a.jsx(Sr,{children:"选择配置文件的管理方式"})]}),a.jsxs(an,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 md:gap-4",children:[a.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>ce("upload"),children:a.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[a.jsx(oO,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),a.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>ce("path"),children:a.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[a.jsx(kq,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),t==="path"&&a.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs("div",{className:"flex-1 space-y-1",children:[a.jsx(Me,{id:"config-path",value:l,onChange:K=>Q(K.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${d?"border-destructive":""}`}),d&&a.jsx("p",{className:"text-xs text-destructive",children:d})]}),a.jsx(ie,{onClick:()=>F(l),disabled:x||!l||!!d,className:"w-full sm:w-auto",children:x?a.jsxs(a.Fragment,{children:[a.jsx(Fi,{className:"h-4 w-4 animate-spin mr-2"}),a.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"sm:hidden",children:"加载配置"}),a.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),a.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[a.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[a.jsx("span",{children:"路径格式说明"}),a.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),a.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[a.jsx("div",{children:"C:\\Adapter\\config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),a.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[a.jsx("div",{children:"/opt/adapter/config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),a.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsx(od,{children:t==="upload"?a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",m&&" (正在保存...)"]})})]}),t==="upload"&&!n&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[a.jsx("input",{ref:_,type:"file",accept:".toml",className:"hidden",onChange:me}),a.jsxs(ie,{onClick:()=>_.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(oO,{className:"mr-2 h-4 w-4"}),"上传配置"]}),a.jsxs(ie,{onClick:P,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),t==="upload"&&n&&a.jsx("div",{className:"flex gap-2",children:a.jsxs(ie,{onClick:Y,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(fc,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),t==="path"&&n&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs(ie,{onClick:U,size:"sm",disabled:m||!!d,className:"w-full sm:w-auto",children:[a.jsx(lx,{className:"mr-2 h-4 w-4"}),m?"保存中...":"立即保存"]}),a.jsxs(ie,{onClick:V,size:"sm",variant:"outline",disabled:x,className:"w-full sm:w-auto",children:[a.jsx(Fi,{className:`mr-2 h-4 w-4 ${x?"animate-spin":""}`}),"刷新"]}),a.jsxs(ie,{onClick:$,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),n?a.jsxs(hl,{defaultValue:"napcat",className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:a.jsxs(ya,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[a.jsxs($t,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),a.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),a.jsxs($t,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),a.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),a.jsxs($t,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),a.jsx("span",{className:"sm:hidden",children:"聊天"})]}),a.jsxs($t,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),a.jsx("span",{className:"sm:hidden",children:"语音"})]}),a.jsx($t,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),a.jsx(kn,{value:"napcat",className:"space-y-4",children:a.jsx(Fte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"maibot",className:"space-y-4",children:a.jsx(Qte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"chat",className:"space-y-4",children:a.jsx($te,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"voice",className:"space-y-4",children:a.jsx(Hte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"debug",className:"space-y-4",children:a.jsx(Ute,{config:n,onChange:K=>{r(K),L(K)}})})]}):a.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:a.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[a.jsx(ao,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:t==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),a.jsx(pn,{open:b,onOpenChange:k,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认切换模式"}),a.jsxs(dn,{children:["切换模式将清空当前配置,确定要继续吗?",a.jsx("br",{}),a.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),a.jsxs(cn,{children:[a.jsx(fn,{onClick:()=>{k(!1),A(null)},children:"取消"}),a.jsx(hn,{onClick:J,children:"确认切换"})]})]})}),a.jsx(pn,{open:O,onOpenChange:j,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认清空路径"}),a.jsxs(dn,{children:["清空路径将清除当前配置,确定要继续吗?",a.jsx("br",{}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),a.jsxs(cn,{children:[a.jsx(fn,{onClick:()=>j(!1),children:"取消"}),a.jsx(hn,{onClick:ne,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function Fte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),a.jsxs("div",{className:"grid gap-3 md:gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),a.jsx(Me,{id:"napcat-host",value:t.napcat_server.host,onChange:n=>e({...t,napcat_server:{...t.napcat_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),a.jsx(Me,{id:"napcat-port",type:"number",value:t.napcat_server.port||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),a.jsx(Me,{id:"napcat-token",type:"password",value:t.napcat_server.token,onChange:n=>e({...t,napcat_server:{...t.napcat_server,token:n.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),a.jsx(Me,{id:"napcat-heartbeat",type:"number",value:t.napcat_server.heartbeat_interval||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,heartbeat_interval:n.target.value?parseInt(n.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function Qte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),a.jsxs("div",{className:"grid gap-3 md:gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),a.jsx(Me,{id:"maibot-host",value:t.maibot_server.host,onChange:n=>e({...t,maibot_server:{...t.maibot_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),a.jsx(Me,{id:"maibot-port",type:"number",value:t.maibot_server.port||"",onChange:n=>e({...t,maibot_server:{...t.maibot_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function $te({config:t,onChange:e}){const n=i=>{const l={...t};i==="group"?l.chat.group_list=[...l.chat.group_list,0]:i==="private"?l.chat.private_list=[...l.chat.private_list,0]:l.chat.ban_user_id=[...l.chat.ban_user_id,0],e(l)},r=(i,l)=>{const c={...t};i==="group"?c.chat.group_list=c.chat.group_list.filter((d,h)=>h!==l):i==="private"?c.chat.private_list=c.chat.private_list.filter((d,h)=>h!==l):c.chat.ban_user_id=c.chat.ban_user_id.filter((d,h)=>h!==l),e(c)},s=(i,l,c)=>{const d={...t};i==="group"?d.chat.group_list[l]=c:i==="private"?d.chat.private_list[l]=c:d.chat.ban_user_id[l]=c,e(d)};return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),a.jsxs("div",{className:"grid gap-4 md:gap-6",children:[a.jsxs("div",{className:"space-y-3 md:space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"群组名单类型"}),a.jsxs(Lt,{value:t.chat.group_list_type,onValueChange:i=>e({...t,chat:{...t.chat,group_list_type:i}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),a.jsx(Pe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsx(te,{className:"text-sm md:text-base",children:"群组列表"}),a.jsxs(ie,{onClick:()=>n("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),t.chat.group_list.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{type:"number",value:i,onChange:c=>s("group",l,parseInt(c.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除群号 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r("group",l),children:"删除"})]})]})]})]},l)),t.chat.group_list.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),a.jsxs("div",{className:"space-y-3 md:space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"私聊名单类型"}),a.jsxs(Lt,{value:t.chat.private_list_type,onValueChange:i=>e({...t,chat:{...t.chat,private_list_type:i}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),a.jsx(Pe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsx(te,{className:"text-sm md:text-base",children:"私聊列表"}),a.jsxs(ie,{onClick:()=>n("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.private_list.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{type:"number",value:i,onChange:c=>s("private",l,parseInt(c.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除用户 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r("private",l),children:"删除"})]})]})]})]},l)),t.chat.private_list.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"全局禁止名单"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),a.jsxs(ie,{onClick:()=>n("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.ban_user_id.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{type:"number",value:i,onChange:c=>s("ban",l,parseInt(c.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要从全局禁止名单中删除用户 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r("ban",l),children:"删除"})]})]})]})]},l)),t.chat.ban_user_id.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),a.jsx(jt,{checked:t.chat.ban_qq_bot,onCheckedChange:i=>e({...t,chat:{...t.chat,ban_qq_bot:i}})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),a.jsx(jt,{checked:t.chat.enable_poke,onCheckedChange:i=>e({...t,chat:{...t.chat,enable_poke:i}})})]})]})]})})}function Hte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),a.jsx(jt,{checked:t.voice.use_tts,onCheckedChange:n=>e({...t,voice:{use_tts:n}})})]})]})})}function Ute({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),a.jsx("div",{className:"grid gap-3 md:gap-4",children:a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"日志等级"}),a.jsxs(Lt,{value:t.debug.level,onValueChange:n=>e({...t,debug:{level:n}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"DEBUG",children:"DEBUG(调试)"}),a.jsx(Pe,{value:"INFO",children:"INFO(信息)"}),a.jsx(Pe,{value:"WARNING",children:"WARNING(警告)"}),a.jsx(Pe,{value:"ERROR",children:"ERROR(错误)"}),a.jsx(Pe,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function u8(t){const e=[],n=String(t||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const l=n.slice(s,r).trim();(l||!i)&&e.push(l),s=r+1,r=n.indexOf(",",s)}return e}function Vte(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Wte=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Gte=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xte={};function d8(t,e){return(Xte.jsx?Gte:Wte).test(t)}const Yte=/[ \t\n\f\r]/g;function Kte(t){return typeof t=="object"?t.type==="text"?h8(t.value):!1:h8(t)}function h8(t){return t.replace(Yte,"")===""}class x0{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}x0.prototype.normal={};x0.prototype.property={};x0.prototype.space=void 0;function Z_(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new x0(n,r,e)}function Pf(t){return t.toLowerCase()}class qs{constructor(e,n){this.attribute=n,this.property=e}}qs.prototype.attribute="";qs.prototype.booleanish=!1;qs.prototype.boolean=!1;qs.prototype.commaOrSpaceSeparated=!1;qs.prototype.commaSeparated=!1;qs.prototype.defined=!1;qs.prototype.mustUseProperty=!1;qs.prototype.number=!1;qs.prototype.overloadedBoolean=!1;qs.prototype.property="";qs.prototype.spaceSeparated=!1;qs.prototype.space=void 0;let Zte=0;const Ot=Dc(),mr=Dc(),h4=Dc(),ze=Dc(),Bn=Dc(),Ju=Dc(),Js=Dc();function Dc(){return 2**++Zte}const f4=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ot,booleanish:mr,commaOrSpaceSeparated:Js,commaSeparated:Ju,number:ze,overloadedBoolean:h4,spaceSeparated:Bn},Symbol.toStringTag,{value:"Module"})),hb=Object.keys(f4);class c5 extends qs{constructor(e,n,r,s){let i=-1;if(super(e,n),f8(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&rne.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(m8,ine);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!m8.test(i)){let l=i.replace(nne,sne);l.charAt(0)!=="-"&&(l="-"+l),e="data"+l}}s=c5}return new s(r,e)}function sne(t){return"-"+t.toLowerCase()}function ine(t){return t.charAt(1).toUpperCase()}const aD=Z_([J_,Jte,nD,rD,sD],"html"),Lx=Z_([J_,ene,nD,rD,sD],"svg");function p8(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function ane(t){return t.join(" ").trim()}var Nu={},fb,g8;function lne(){if(g8)return fb;g8=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,d=` -`,h="/",m="*",p="",x="comment",v="declaration";function b(O,j){if(typeof O!="string")throw new TypeError("First argument must be a string");if(!O)return[];j=j||{};var T=1,A=1;function _(W){var J=W.match(e);J&&(T+=J.length);var $=W.lastIndexOf(d);A=~$?W.length-$:A+W.length}function D(){var W={line:T,column:A};return function(J){return J.position=new E(W),F(),J}}function E(W){this.start=W,this.end={line:T,column:A},this.source=j.source}E.prototype.content=O;function z(W){var J=new Error(j.source+":"+T+":"+A+": "+W);if(J.reason=W,J.filename=j.source,J.line=T,J.column=A,J.source=O,!j.silent)throw J}function Q(W){var J=W.exec(O);if(J){var $=J[0];return _($),O=O.slice($.length),J}}function F(){Q(n)}function L(W){var J;for(W=W||[];J=U();)J!==!1&&W.push(J);return W}function U(){var W=D();if(!(h!=O.charAt(0)||m!=O.charAt(1))){for(var J=2;p!=O.charAt(J)&&(m!=O.charAt(J)||h!=O.charAt(J+1));)++J;if(J+=2,p===O.charAt(J-1))return z("End of comment missing");var $=O.slice(2,J-2);return A+=2,_($),O=O.slice(J),A+=2,W({type:x,comment:$})}}function V(){var W=D(),J=Q(r);if(J){if(U(),!Q(s))return z("property missing ':'");var $=Q(i),ae=W({type:v,property:k(J[0].replace(t,p)),value:$?k($[0].replace(t,p)):p});return Q(l),ae}}function ce(){var W=[];L(W);for(var J;J=V();)J!==!1&&(W.push(J),L(W));return W}return F(),ce()}function k(O){return O?O.replace(c,p):p}return fb=b,fb}var x8;function one(){if(x8)return Nu;x8=1;var t=Nu&&Nu.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Nu,"__esModule",{value:!0}),Nu.default=n;const e=t(lne());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const l=(0,e.default)(r),c=typeof s=="function";return l.forEach(d=>{if(d.type!=="declaration")return;const{property:h,value:m}=d;c?s(h,m,d):m&&(i=i||{},i[h]=m)}),i}return Nu}var Lh={},v8;function cne(){if(v8)return Lh;v8=1,Object.defineProperty(Lh,"__esModule",{value:!0}),Lh.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(h){return!h||n.test(h)||t.test(h)},l=function(h,m){return m.toUpperCase()},c=function(h,m){return"".concat(m,"-")},d=function(h,m){return m===void 0&&(m={}),i(h)?h:(h=h.toLowerCase(),m.reactCompat?h=h.replace(s,c):h=h.replace(r,c),h.replace(e,l))};return Lh.camelCase=d,Lh}var Ih,y8;function une(){if(y8)return Ih;y8=1;var t=Ih&&Ih.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(one()),n=cne();function r(s,i){var l={};return!s||typeof s!="string"||(0,e.default)(s,function(c,d){c&&d&&(l[(0,n.camelCase)(c,i)]=d)}),l}return r.default=r,Ih=r,Ih}var dne=une();const hne=u9(dne),lD=oD("end"),u5=oD("start");function oD(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function fne(t){const e=u5(t),n=lD(t);if(e&&n)return{start:e,end:n}}function af(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?b8(t.position):"start"in t||"end"in t?b8(t):"line"in t||"column"in t?m4(t):""}function m4(t){return w8(t&&t.line)+":"+w8(t&&t.column)}function b8(t){return m4(t&&t.start)+"-"+m4(t&&t.end)}function w8(t){return t&&typeof t=="number"?t:1}class as extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},l=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?s=e:!i.cause&&e&&(l=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?i.ruleId=r:(i.source=r.slice(0,d),i.ruleId=r.slice(d+1))}if(!i.place&&i.ancestors&&i.ancestors){const d=i.ancestors[i.ancestors.length-1];d&&(i.place=d.position)}const c=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=c?c.line:void 0,this.name=af(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=l&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}as.prototype.file="";as.prototype.name="";as.prototype.reason="";as.prototype.message="";as.prototype.stack="";as.prototype.column=void 0;as.prototype.line=void 0;as.prototype.ancestors=void 0;as.prototype.cause=void 0;as.prototype.fatal=void 0;as.prototype.place=void 0;as.prototype.ruleId=void 0;as.prototype.source=void 0;const d5={}.hasOwnProperty,mne=new Map,pne=/[A-Z]/g,gne=new Set(["table","tbody","thead","tfoot","tr"]),xne=new Set(["td","th"]),cD="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function vne(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Nne(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=jne(n,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?Lx:aD,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=uD(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function uD(t,e,n){if(e.type==="element")return yne(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return bne(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return Sne(t,e,n);if(e.type==="mdxjsEsm")return wne(t,e);if(e.type==="root")return kne(t,e,n);if(e.type==="text")return One(t,e)}function yne(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Lx,t.schema=s),t.ancestors.push(e);const i=hD(t,e.tagName,!1),l=Cne(t,e);let c=f5(t,e);return gne.has(e.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!Kte(d):!0})),dD(t,l,i,e),h5(l,c),t.ancestors.pop(),t.schema=r,t.create(e,i,l,n)}function bne(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}Bf(t,e.position)}function wne(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Bf(t,e.position)}function Sne(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=Lx,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:hD(t,e.name,!0),l=Tne(t,e),c=f5(t,e);return dD(t,l,i,e),h5(l,c),t.ancestors.pop(),t.schema=r,t.create(e,i,l,n)}function kne(t,e,n){const r={};return h5(r,f5(t,e)),t.create(e,t.Fragment,r,n)}function One(t,e){return e.value}function dD(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function h5(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function jne(t,e,n){return r;function r(s,i,l,c){const h=Array.isArray(l.children)?n:e;return c?h(i,l,c):h(i,l)}}function Nne(t,e){return n;function n(r,s,i,l){const c=Array.isArray(i.children),d=u5(r);return e(s,i,l,c,{columnNumber:d?d.column-1:void 0,fileName:t,lineNumber:d?d.line:void 0},void 0)}}function Cne(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&d5.call(e.properties,s)){const i=Ane(t,s,e.properties[s]);if(i){const[l,c]=i;t.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&xne.has(e.tagName)?r=c:n[l]=c}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Tne(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const l=i.expression;l.type;const c=l.properties[0];c.type,Object.assign(n,t.evaluater.evaluateExpression(c.argument))}else Bf(t,e.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const c=r.value.data.estree.body[0];c.type,i=t.evaluater.evaluateExpression(c.expression)}else Bf(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function f5(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:mne;for(;++rs?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(e,n),t.splice(...l);else for(n&&t.splice(e,n);i0?(si(t,t.length,0,e),t):e}const O8={}.hasOwnProperty;function mD(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Qi(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ds=Ao(/[A-Za-z]/),rs=Ao(/[\dA-Za-z]/),Lne=Ao(/[#-'*+\--9=?A-Z^-~]/);function Hg(t){return t!==null&&(t<32||t===127)}const p4=Ao(/\d/),Ine=Ao(/[\dA-Fa-f]/),qne=Ao(/[!-/:-@[-`{-~]/);function Ze(t){return t!==null&&t<-2}function Rn(t){return t!==null&&(t<0||t===32)}function qt(t){return t===-2||t===-1||t===32}const Ix=Ao(new RegExp("\\p{P}|\\p{S}","u")),Cc=Ao(/\s/);function Ao(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Dd(t){const e=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const c=t.charCodeAt(n+1);i<56320&&c>56319&&c<57344?(l=String.fromCharCode(i,c),s=1):l="�"}else l=String.fromCharCode(i);l&&(e.push(t.slice(r,n),encodeURIComponent(l)),r=n+s+1,l=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function zt(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return l;function l(d){return qt(d)?(t.enter(n),c(d)):e(d)}function c(d){return qt(d)&&i++l))return;const z=e.events.length;let Q=z,F,L;for(;Q--;)if(e.events[Q][0]==="exit"&&e.events[Q][1].type==="chunkFlow"){if(F){L=e.events[Q][1].end;break}F=!0}for(j(r),E=z;EA;){const D=n[_];e.containerState=D[1],D[0].exit.call(e,t)}n.length=A}function T(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function Une(t,e,n){return zt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function vd(t){if(t===null||Rn(t)||Cc(t))return 1;if(Ix(t))return 2}function qx(t,e,n){const r=[];let s=-1;for(;++s1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const p={...t[r][1].end},x={...t[n][1].start};N8(p,-d),N8(x,d),l={type:d>1?"strongSequence":"emphasisSequence",start:p,end:{...t[r][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:x},i={type:d>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:d>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},t[r][1].end={...l.start},t[n][1].start={...c.end},h=[],t[r][1].end.offset-t[r][1].start.offset&&(h=bi(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=bi(h,[["enter",s,e],["enter",l,e],["exit",l,e],["enter",i,e]]),h=bi(h,qx(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=bi(h,[["exit",i,e],["enter",c,e],["exit",c,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(m=2,h=bi(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):m=0,si(t,r-1,n-r+3,h),n=r+h.length-m-2;break}}for(n=-1;++n0&&qt(E)?zt(t,T,"linePrefix",i+1)(E):T(E)}function T(E){return E===null||Ze(E)?t.check(C8,k,_)(E):(t.enter("codeFlowValue"),A(E))}function A(E){return E===null||Ze(E)?(t.exit("codeFlowValue"),T(E)):(t.consume(E),A)}function _(E){return t.exit("codeFenced"),e(E)}function D(E,z,Q){let F=0;return L;function L(J){return E.enter("lineEnding"),E.consume(J),E.exit("lineEnding"),U}function U(J){return E.enter("codeFencedFence"),qt(J)?zt(E,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(J):V(J)}function V(J){return J===c?(E.enter("codeFencedFenceSequence"),ce(J)):Q(J)}function ce(J){return J===c?(F++,E.consume(J),ce):F>=l?(E.exit("codeFencedFenceSequence"),qt(J)?zt(E,W,"whitespace")(J):W(J)):Q(J)}function W(J){return J===null||Ze(J)?(E.exit("codeFencedFence"),z(J)):Q(J)}}}function rre(t,e,n){const r=this;return s;function s(l){return l===null?n(l):(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i)}function i(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}const pb={name:"codeIndented",tokenize:ire},sre={partial:!0,tokenize:are};function ire(t,e,n){const r=this;return s;function s(h){return t.enter("codeIndented"),zt(t,i,"linePrefix",5)(h)}function i(h){const m=r.events[r.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(h):n(h)}function l(h){return h===null?d(h):Ze(h)?t.attempt(sre,l,d)(h):(t.enter("codeFlowValue"),c(h))}function c(h){return h===null||Ze(h)?(t.exit("codeFlowValue"),l(h)):(t.consume(h),c)}function d(h){return t.exit("codeIndented"),e(h)}}function are(t,e,n){const r=this;return s;function s(l){return r.parser.lazy[r.now().line]?n(l):Ze(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),s):zt(t,i,"linePrefix",5)(l)}function i(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(l):Ze(l)?s(l):n(l)}}const lre={name:"codeText",previous:cre,resolve:ore,tokenize:ure};function ore(t){let e=t.length-4,n=3,r,s;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&qh(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),qh(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),qh(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(l):t.interrupt(r.parser.constructs.flow,n,e)(l)}}function bD(t,e,n,r,s,i,l,c,d){const h=d||Number.POSITIVE_INFINITY;let m=0;return p;function p(j){return j===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(j),t.exit(i),x):j===null||j===32||j===41||Hg(j)?n(j):(t.enter(r),t.enter(l),t.enter(c),t.enter("chunkString",{contentType:"string"}),k(j))}function x(j){return j===62?(t.enter(i),t.consume(j),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(c),t.enter("chunkString",{contentType:"string"}),v(j))}function v(j){return j===62?(t.exit("chunkString"),t.exit(c),x(j)):j===null||j===60||Ze(j)?n(j):(t.consume(j),j===92?b:v)}function b(j){return j===60||j===62||j===92?(t.consume(j),v):v(j)}function k(j){return!m&&(j===null||j===41||Rn(j))?(t.exit("chunkString"),t.exit(c),t.exit(l),t.exit(r),e(j)):m999||v===null||v===91||v===93&&!d||v===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(v):v===93?(t.exit(i),t.enter(s),t.consume(v),t.exit(s),t.exit(r),e):Ze(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),m):(t.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===null||v===91||v===93||Ze(v)||c++>999?(t.exit("chunkString"),m(v)):(t.consume(v),d||(d=!qt(v)),v===92?x:p)}function x(v){return v===91||v===92||v===93?(t.consume(v),c++,p):p(v)}}function SD(t,e,n,r,s,i){let l;return c;function c(x){return x===34||x===39||x===40?(t.enter(r),t.enter(s),t.consume(x),t.exit(s),l=x===40?41:x,d):n(x)}function d(x){return x===l?(t.enter(s),t.consume(x),t.exit(s),t.exit(r),e):(t.enter(i),h(x))}function h(x){return x===l?(t.exit(i),d(l)):x===null?n(x):Ze(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),zt(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===l||x===null||Ze(x)?(t.exit("chunkString"),h(x)):(t.consume(x),x===92?p:m)}function p(x){return x===l||x===92?(t.consume(x),m):m(x)}}function lf(t,e){let n;return r;function r(s){return Ze(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):qt(s)?zt(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const vre={name:"definition",tokenize:bre},yre={partial:!0,tokenize:wre};function bre(t,e,n){const r=this;let s;return i;function i(v){return t.enter("definition"),l(v)}function l(v){return wD.call(r,t,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function c(v){return s=Qi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),d):n(v)}function d(v){return Rn(v)?lf(t,h)(v):h(v)}function h(v){return bD(t,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function m(v){return t.attempt(yre,p,p)(v)}function p(v){return qt(v)?zt(t,x,"whitespace")(v):x(v)}function x(v){return v===null||Ze(v)?(t.exit("definition"),r.parser.defined.push(s),e(v)):n(v)}}function wre(t,e,n){return r;function r(c){return Rn(c)?lf(t,s)(c):n(c)}function s(c){return SD(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function i(c){return qt(c)?zt(t,l,"whitespace")(c):l(c)}function l(c){return c===null||Ze(c)?e(c):n(c)}}const Sre={name:"hardBreakEscape",tokenize:kre};function kre(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return Ze(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const Ore={name:"headingAtx",resolve:jre,tokenize:Nre};function jre(t,e){let n=t.length-2,r=3,s,i;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},si(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function Nre(t,e,n){let r=0;return s;function s(m){return t.enter("atxHeading"),i(m)}function i(m){return t.enter("atxHeadingSequence"),l(m)}function l(m){return m===35&&r++<6?(t.consume(m),l):m===null||Rn(m)?(t.exit("atxHeadingSequence"),c(m)):n(m)}function c(m){return m===35?(t.enter("atxHeadingSequence"),d(m)):m===null||Ze(m)?(t.exit("atxHeading"),e(m)):qt(m)?zt(t,c,"whitespace")(m):(t.enter("atxHeadingText"),h(m))}function d(m){return m===35?(t.consume(m),d):(t.exit("atxHeadingSequence"),c(m))}function h(m){return m===null||m===35||Rn(m)?(t.exit("atxHeadingText"),c(m)):(t.consume(m),h)}}const Cre=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],A8=["pre","script","style","textarea"],Tre={concrete:!0,name:"htmlFlow",resolveTo:Ere,tokenize:_re},Are={partial:!0,tokenize:Rre},Mre={partial:!0,tokenize:Dre};function Ere(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function _re(t,e,n){const r=this;let s,i,l,c,d;return h;function h(P){return m(P)}function m(P){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(P),p}function p(P){return P===33?(t.consume(P),x):P===47?(t.consume(P),i=!0,k):P===63?(t.consume(P),s=3,r.interrupt?e:R):ds(P)?(t.consume(P),l=String.fromCharCode(P),O):n(P)}function x(P){return P===45?(t.consume(P),s=2,v):P===91?(t.consume(P),s=5,c=0,b):ds(P)?(t.consume(P),s=4,r.interrupt?e:R):n(P)}function v(P){return P===45?(t.consume(P),r.interrupt?e:R):n(P)}function b(P){const K="CDATA[";return P===K.charCodeAt(c++)?(t.consume(P),c===K.length?r.interrupt?e:V:b):n(P)}function k(P){return ds(P)?(t.consume(P),l=String.fromCharCode(P),O):n(P)}function O(P){if(P===null||P===47||P===62||Rn(P)){const K=P===47,H=l.toLowerCase();return!K&&!i&&A8.includes(H)?(s=1,r.interrupt?e(P):V(P)):Cre.includes(l.toLowerCase())?(s=6,K?(t.consume(P),j):r.interrupt?e(P):V(P)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):i?T(P):A(P))}return P===45||rs(P)?(t.consume(P),l+=String.fromCharCode(P),O):n(P)}function j(P){return P===62?(t.consume(P),r.interrupt?e:V):n(P)}function T(P){return qt(P)?(t.consume(P),T):L(P)}function A(P){return P===47?(t.consume(P),L):P===58||P===95||ds(P)?(t.consume(P),_):qt(P)?(t.consume(P),A):L(P)}function _(P){return P===45||P===46||P===58||P===95||rs(P)?(t.consume(P),_):D(P)}function D(P){return P===61?(t.consume(P),E):qt(P)?(t.consume(P),D):A(P)}function E(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(t.consume(P),d=P,z):qt(P)?(t.consume(P),E):Q(P)}function z(P){return P===d?(t.consume(P),d=null,F):P===null||Ze(P)?n(P):(t.consume(P),z)}function Q(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||Rn(P)?D(P):(t.consume(P),Q)}function F(P){return P===47||P===62||qt(P)?A(P):n(P)}function L(P){return P===62?(t.consume(P),U):n(P)}function U(P){return P===null||Ze(P)?V(P):qt(P)?(t.consume(P),U):n(P)}function V(P){return P===45&&s===2?(t.consume(P),$):P===60&&s===1?(t.consume(P),ae):P===62&&s===4?(t.consume(P),me):P===63&&s===3?(t.consume(P),R):P===93&&s===5?(t.consume(P),ue):Ze(P)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(Are,Y,ce)(P)):P===null||Ze(P)?(t.exit("htmlFlowData"),ce(P)):(t.consume(P),V)}function ce(P){return t.check(Mre,W,Y)(P)}function W(P){return t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),J}function J(P){return P===null||Ze(P)?ce(P):(t.enter("htmlFlowData"),V(P))}function $(P){return P===45?(t.consume(P),R):V(P)}function ae(P){return P===47?(t.consume(P),l="",ne):V(P)}function ne(P){if(P===62){const K=l.toLowerCase();return A8.includes(K)?(t.consume(P),me):V(P)}return ds(P)&&l.length<8?(t.consume(P),l+=String.fromCharCode(P),ne):V(P)}function ue(P){return P===93?(t.consume(P),R):V(P)}function R(P){return P===62?(t.consume(P),me):P===45&&s===2?(t.consume(P),R):V(P)}function me(P){return P===null||Ze(P)?(t.exit("htmlFlowData"),Y(P)):(t.consume(P),me)}function Y(P){return t.exit("htmlFlow"),e(P)}}function Dre(t,e,n){const r=this;return s;function s(l){return Ze(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i):n(l)}function i(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}function Rre(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(v0,e,n)}}const zre={name:"htmlText",tokenize:Pre};function Pre(t,e,n){const r=this;let s,i,l;return c;function c(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),d}function d(R){return R===33?(t.consume(R),h):R===47?(t.consume(R),D):R===63?(t.consume(R),A):ds(R)?(t.consume(R),Q):n(R)}function h(R){return R===45?(t.consume(R),m):R===91?(t.consume(R),i=0,b):ds(R)?(t.consume(R),T):n(R)}function m(R){return R===45?(t.consume(R),v):n(R)}function p(R){return R===null?n(R):R===45?(t.consume(R),x):Ze(R)?(l=p,ae(R)):(t.consume(R),p)}function x(R){return R===45?(t.consume(R),v):p(R)}function v(R){return R===62?$(R):R===45?x(R):p(R)}function b(R){const me="CDATA[";return R===me.charCodeAt(i++)?(t.consume(R),i===me.length?k:b):n(R)}function k(R){return R===null?n(R):R===93?(t.consume(R),O):Ze(R)?(l=k,ae(R)):(t.consume(R),k)}function O(R){return R===93?(t.consume(R),j):k(R)}function j(R){return R===62?$(R):R===93?(t.consume(R),j):k(R)}function T(R){return R===null||R===62?$(R):Ze(R)?(l=T,ae(R)):(t.consume(R),T)}function A(R){return R===null?n(R):R===63?(t.consume(R),_):Ze(R)?(l=A,ae(R)):(t.consume(R),A)}function _(R){return R===62?$(R):A(R)}function D(R){return ds(R)?(t.consume(R),E):n(R)}function E(R){return R===45||rs(R)?(t.consume(R),E):z(R)}function z(R){return Ze(R)?(l=z,ae(R)):qt(R)?(t.consume(R),z):$(R)}function Q(R){return R===45||rs(R)?(t.consume(R),Q):R===47||R===62||Rn(R)?F(R):n(R)}function F(R){return R===47?(t.consume(R),$):R===58||R===95||ds(R)?(t.consume(R),L):Ze(R)?(l=F,ae(R)):qt(R)?(t.consume(R),F):$(R)}function L(R){return R===45||R===46||R===58||R===95||rs(R)?(t.consume(R),L):U(R)}function U(R){return R===61?(t.consume(R),V):Ze(R)?(l=U,ae(R)):qt(R)?(t.consume(R),U):F(R)}function V(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),s=R,ce):Ze(R)?(l=V,ae(R)):qt(R)?(t.consume(R),V):(t.consume(R),W)}function ce(R){return R===s?(t.consume(R),s=void 0,J):R===null?n(R):Ze(R)?(l=ce,ae(R)):(t.consume(R),ce)}function W(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Rn(R)?F(R):(t.consume(R),W)}function J(R){return R===47||R===62||Rn(R)?F(R):n(R)}function $(R){return R===62?(t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),e):n(R)}function ae(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),ne}function ne(R){return qt(R)?zt(t,ue,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):ue(R)}function ue(R){return t.enter("htmlTextData"),l(R)}}const g5={name:"labelEnd",resolveAll:qre,resolveTo:Fre,tokenize:Qre},Bre={tokenize:$re},Lre={tokenize:Hre},Ire={tokenize:Ure};function qre(t){let e=-1;const n=[];for(;++e=3&&(h===null||Ze(h))?(t.exit("thematicBreak"),e(h)):n(h)}function d(h){return h===s?(t.consume(h),r++,d):(t.exit("thematicBreakSequence"),qt(h)?zt(t,c,"whitespace")(h):c(h))}}const Ns={continuation:{tokenize:tse},exit:rse,name:"list",tokenize:ese},Zre={partial:!0,tokenize:sse},Jre={partial:!0,tokenize:nse};function ese(t,e,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,l=0;return c;function c(v){const b=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:p4(v)){if(r.containerState.type||(r.containerState.type=b,t.enter(b,{_container:!0})),b==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(og,n,h)(v):h(v);if(!r.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),d(v)}return n(v)}function d(v){return p4(v)&&++l<10?(t.consume(v),d):(!r.interrupt||l<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),h(v)):n(v)}function h(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,t.check(v0,r.interrupt?n:m,t.attempt(Zre,x,p))}function m(v){return r.containerState.initialBlankLine=!0,i++,x(v)}function p(v){return qt(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),x):n(v)}function x(v){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(v)}}function tse(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(v0,s,i);function s(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,zt(t,e,"listItemIndent",r.containerState.size+1)(c)}function i(c){return r.containerState.furtherBlankLines||!qt(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(Jre,e,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,zt(t,t.attempt(Ns,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function nse(t,e,n){const r=this;return zt(t,s,"listItemIndent",r.containerState.size+1);function s(i){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?e(i):n(i)}}function rse(t){t.exit(this.containerState.type)}function sse(t,e,n){const r=this;return zt(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const l=r.events[r.events.length-1];return!qt(i)&&l&&l[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const M8={name:"setextUnderline",resolveTo:ise,tokenize:ase};function ise(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const l={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",l,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=l,t.push(["exit",l,e]),t}function ase(t,e,n){const r=this;let s;return i;function i(h){let m=r.events.length,p;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){p=r.events[m][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(t.enter("setextHeadingLine"),s=h,l(h)):n(h)}function l(h){return t.enter("setextHeadingLineSequence"),c(h)}function c(h){return h===s?(t.consume(h),c):(t.exit("setextHeadingLineSequence"),qt(h)?zt(t,d,"lineSuffix")(h):d(h))}function d(h){return h===null||Ze(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const lse={tokenize:ose};function ose(t){const e=this,n=t.attempt(v0,r,t.attempt(this.parser.constructs.flowInitial,s,zt(t,t.attempt(this.parser.constructs.flow,s,t.attempt(fre,s)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const cse={resolveAll:OD()},use=kD("string"),dse=kD("text");function kD(t){return{resolveAll:OD(t==="text"?hse:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,l,c);return l;function l(m){return h(m)?i(m):c(m)}function c(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),d}function d(m){return h(m)?(n.exit("data"),i(m)):(n.consume(m),d)}function h(m){if(m===null)return!0;const p=s[m];let x=-1;if(p)for(;++x-1){const c=l[0];typeof c=="string"?l[0]=c.slice(r):l.shift()}i>0&&l.push(t[s].slice(0,i))}return l}function jse(t,e){let n=-1;const r=[];let s;for(;++na.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",D+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(p,{regex:_.regex&&_.regex[0]||"",reaction:_.reaction,onRegexChange:E=>m(D,"regex",E),onReactionChange:E=>m(D,"reaction",E)}),a.jsx(T,{rule:_}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:["确定要删除正则规则 ",D+1," 吗?此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>h(D),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),a.jsx(Ae,{value:_.regex&&_.regex[0]||"",onChange:E=>m(D,"regex",E.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"反应内容"}),a.jsx(_n,{value:_.reaction,onChange:E=>m(D,"reaction",E.target.value),placeholder:`触发后麦麦的反应... +可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},D)),t.regex_rules.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),a.jsxs("div",{className:"space-y-4 border-t pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),a.jsxs(ie,{onClick:x,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),a.jsxs("div",{className:"space-y-3",children:[t.keyword_rules.map((_,D)=>a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",D+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(M,{rule:_}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:["确定要删除关键词规则 ",D+1," 吗?此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>v(D),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-xs font-medium",children:"关键词列表"}),a.jsxs(ie,{onClick:()=>k(D),size:"sm",variant:"ghost",children:[a.jsx(Wr,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),a.jsxs("div",{className:"space-y-2",children:[(_.keywords||[]).map((E,z)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ae,{value:E,onChange:Q=>j(D,z,Q.target.value),placeholder:"关键词",className:"flex-1"}),a.jsx(ie,{onClick:()=>O(D,z),size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})]},z)),(!_.keywords||_.keywords.length===0)&&a.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"反应内容"}),a.jsx(_n,{value:_.reaction,onChange:E=>b(D,"reaction",E.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},D)),t.keyword_rules.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_response_post_process",checked:e.enable_response_post_process,onCheckedChange:_=>i({...e,enable_response_post_process:_})}),a.jsx(te,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),e.enable_response_post_process&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"border-t pt-6 space-y-4",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[a.jsx(jt,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:_=>l({...n,enable:_})}),a.jsx(te,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&a.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),a.jsx(Ae,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:_=>l({...n,error_rate:parseFloat(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),a.jsx(Ae,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:_=>l({...n,min_freq:parseInt(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),a.jsx(Ae,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:_=>l({...n,tone_error_rate:parseFloat(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),a.jsx(Ae,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:_=>l({...n,word_replace_rate:parseFloat(_.target.value)})})]})]})]})}),a.jsx("div",{className:"border-t pt-6 space-y-4",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[a.jsx(jt,{id:"enable_response_splitter",checked:r.enable,onCheckedChange:_=>c({...r,enable:_})}),a.jsx(te,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),r.enable&&a.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),a.jsx(Ae,{id:"max_length",type:"number",min:"1",value:r.max_length,onChange:_=>c({...r,max_length:parseInt(_.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),a.jsx(Ae,{id:"max_sentence_num",type:"number",min:"1",value:r.max_sentence_num,onChange:_=>c({...r,max_sentence_num:parseInt(_.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_kaomoji_protection",checked:r.enable_kaomoji_protection,onCheckedChange:_=>c({...r,enable_kaomoji_protection:_})}),a.jsx(te,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_overflow_return_all",checked:r.enable_overflow_return_all,onCheckedChange:_=>c({...r,enable_overflow_return_all:_})}),a.jsx(te,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),a.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function Jee({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用情绪系统"})]}),t.enable_mood&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"情绪更新阈值"}),a.jsx(Ae,{type:"number",min:"1",value:t.mood_update_threshold,onChange:n=>e({...t,mood_update_threshold:parseInt(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"情感特征"}),a.jsx(_n,{value:t.emotion_style,onChange:n=>e({...t,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function ete({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable_asr,onCheckedChange:n=>e({...t,enable_asr:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用语音识别"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function tte({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),t.enable&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"LPMM 模式"}),a.jsxs(Lt,{value:t.lpmm_mode,onValueChange:n=>e({...t,lpmm_mode:n}),children:[a.jsx(Dt,{children:a.jsx(It,{placeholder:"选择 LPMM 模式"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"classic",children:"经典模式"}),a.jsx(Pe,{value:"agent",children:"Agent 模式"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"同义词搜索 TopK"}),a.jsx(Ae,{type:"number",min:"1",value:t.rag_synonym_search_top_k,onChange:n=>e({...t,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"同义词阈值"}),a.jsx(Ae,{type:"number",step:"0.1",min:"0",max:"1",value:t.rag_synonym_threshold,onChange:n=>e({...t,rag_synonym_threshold:parseFloat(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"实体提取线程数"}),a.jsx(Ae,{type:"number",min:"1",value:t.info_extraction_workers,onChange:n=>e({...t,info_extraction_workers:parseInt(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"嵌入向量维度"}),a.jsx(Ae,{type:"number",min:"1",value:t.embedding_dimension,onChange:n=>e({...t,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function nte({config:t,onChange:e}){const[n,r]=S.useState(""),[s,i]=S.useState("WARNING"),l=()=>{n&&!t.suppress_libraries.includes(n)&&(e({...t,suppress_libraries:[...t.suppress_libraries,n]}),r(""))},c=v=>{e({...t,suppress_libraries:t.suppress_libraries.filter(b=>b!==v)})},d=()=>{n&&!t.library_log_levels[n]&&(e({...t,library_log_levels:{...t.library_log_levels,[n]:s}}),r(""),i("WARNING"))},h=v=>{const b={...t.library_log_levels};delete b[v],e({...t,library_log_levels:b})},m=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],p=["FULL","compact","lite"],x=["none","title","full"];return a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日期格式"}),a.jsx(Ae,{value:t.date_style,onChange:v=>e({...t,date_style:v.target.value}),placeholder:"例如: m-d H:i:s"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日志级别样式"}),a.jsxs(Lt,{value:t.log_level_style,onValueChange:v=>e({...t,log_level_style:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:p.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日志文本颜色"}),a.jsxs(Lt,{value:t.color_text,onValueChange:v=>e({...t,color_text:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:x.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"全局日志级别"}),a.jsxs(Lt,{value:t.log_level,onValueChange:v=>e({...t,log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"控制台日志级别"}),a.jsxs(Lt,{value:t.console_log_level,onValueChange:v=>e({...t,console_log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"文件日志级别"}),a.jsxs(Lt,{value:t.file_log_level,onValueChange:v=>e({...t,file_log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"完全屏蔽的库"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Ae,{value:n,onChange:v=>r(v.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),l())}}),a.jsx(ie,{onClick:l,size:"sm",className:"flex-shrink-0",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:t.suppress_libraries.map(v=>a.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[a.jsx("span",{className:"text-sm",children:v}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>c(v),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},v))})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"特定库的日志级别"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Ae,{value:n,onChange:v=>r(v.target.value),placeholder:"输入库名",className:"flex-1"}),a.jsxs(Lt,{value:s,onValueChange:i,children:[a.jsx(Dt,{className:"w-32",children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]}),a.jsx(ie,{onClick:d,size:"sm",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"space-y-2",children:Object.entries(t.library_log_levels).map(([v,b])=>a.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[a.jsx("span",{className:"text-sm font-medium",children:v}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:b}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>h(v),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},v))})]})]})}function rte({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示 Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),a.jsx(jt,{checked:t.show_prompt,onCheckedChange:n=>e({...t,show_prompt:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示回复器 Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),a.jsx(jt,{checked:t.show_replyer_prompt,onCheckedChange:n=>e({...t,show_replyer_prompt:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示回复器推理"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),a.jsx(jt,{checked:t.show_replyer_reasoning,onCheckedChange:n=>e({...t,show_replyer_reasoning:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示 Jargon Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),a.jsx(jt,{checked:t.show_jargon_prompt,onCheckedChange:n=>e({...t,show_jargon_prompt:n})})]})]})]})}function ste({config:t,onChange:e}){const[n,r]=S.useState(""),s=()=>{n&&!t.auth_token.includes(n)&&(e({...t,auth_token:[...t.auth_token,n]}),r(""))},i=l=>{e({...t,auth_token:t.auth_token.filter((c,d)=>d!==l)})};return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"启用自定义服务器"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),a.jsx(jt,{checked:t.use_custom,onCheckedChange:l=>e({...t,use_custom:l})})]}),t.use_custom&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"主机地址"}),a.jsx(Ae,{value:t.host,onChange:l=>e({...t,host:l.target.value}),placeholder:"127.0.0.1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"端口号"}),a.jsx(Ae,{type:"number",value:t.port,onChange:l=>e({...t,port:parseInt(l.target.value)}),placeholder:"8090"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"连接模式"}),a.jsxs(Lt,{value:t.mode,onValueChange:l=>e({...t,mode:l}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"ws",children:"WebSocket (ws)"}),a.jsx(Pe,{value:"tcp",children:"TCP"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.use_wss,onCheckedChange:l=>e({...t,use_wss:l}),disabled:t.mode!=="ws"}),a.jsx(te,{children:"使用 WSS 安全连接"})]})]}),t.use_wss&&t.mode==="ws"&&a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"SSL 证书文件路径"}),a.jsx(Ae,{value:t.cert_file,onChange:l=>e({...t,cert_file:l.target.value}),placeholder:"cert.pem"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"SSL 密钥文件路径"}),a.jsx(Ae,{value:t.key_file,onChange:l=>e({...t,key_file:l.target.value}),placeholder:"key.pem"})]})]})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"认证令牌"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Ae,{value:n,onChange:l=>r(l.target.value),placeholder:"输入认证令牌",onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),s())}}),a.jsx(ie,{onClick:s,size:"sm",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"space-y-2",children:t.auth_token.map((l,c)=>a.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[a.jsx("span",{className:"text-sm font-mono",children:l}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>i(c),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},c))})]})]})}function ite({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"启用统计信息发送"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),a.jsx(jt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})})]})]})}const Ac=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{className:"relative w-full overflow-auto",children:a.jsx("table",{ref:n,className:ye("w-full caption-bottom text-sm",t),...e})}));Ac.displayName="Table";const Ec=S.forwardRef(({className:t,...e},n)=>a.jsx("thead",{ref:n,className:ye("[&_tr]:border-b",t),...e}));Ec.displayName="TableHeader";const _c=S.forwardRef(({className:t,...e},n)=>a.jsx("tbody",{ref:n,className:ye("[&_tr:last-child]:border-0",t),...e}));_c.displayName="TableBody";const ate=S.forwardRef(({className:t,...e},n)=>a.jsx("tfoot",{ref:n,className:ye("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));ate.displayName="TableFooter";const xr=S.forwardRef(({className:t,...e},n)=>a.jsx("tr",{ref:n,className:ye("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));xr.displayName="TableRow";const gt=S.forwardRef(({className:t,...e},n)=>a.jsx("th",{ref:n,className:ye("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));gt.displayName="TableHead";const it=S.forwardRef(({className:t,...e},n)=>a.jsx("td",{ref:n,className:ye("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));it.displayName="TableCell";const lte=S.forwardRef(({className:t,...e},n)=>a.jsx("caption",{ref:n,className:ye("mt-4 text-sm text-muted-foreground",t),...e}));lte.displayName="TableCaption";const ss=S.forwardRef(({className:t,...e},n)=>a.jsx(M9,{ref:n,className:ye("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:a.jsx(rq,{className:ye("grid place-content-center text-current"),children:a.jsx(hc,{className:"h-4 w-4"})})}));ss.displayName=M9.displayName;function ote(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(null),[T,M]=S.useState(null),[_,D]=S.useState(!1),[E,z]=S.useState(null),[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,ce]=S.useState(new Set),[W,J]=S.useState(!1),[H,ae]=S.useState(1),[ne,ue]=S.useState(20),[R,me]=S.useState(""),{toast:Y}=Pr(),P=S.useRef(null),K=S.useRef(!0);S.useEffect(()=>{$()},[]);const $=async()=>{try{r(!0);const ee=await Vu();e(ee.api_providers||[]),h(!1),K.current=!1}catch(ee){console.error("加载配置失败:",ee)}finally{r(!1)}},fe=async()=>{try{p(!0),xw().catch(()=>{}),v(!0)}catch(ee){console.error("重启失败:",ee),v(!1),Y({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),p(!1)}},ve=async()=>{try{i(!0),P.current&&clearTimeout(P.current);const ee=await Vu();ee.api_providers=t,await wg(ee),h(!1),Y({title:"保存成功",description:"正在重启麦麦..."}),await fe()}catch(ee){console.error("保存配置失败:",ee),Y({title:"保存失败",description:ee.message,variant:"destructive"}),i(!1)}},Re=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},de=()=>{v(!1),p(!1),Y({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},We=S.useCallback(async ee=>{if(!K.current)try{c(!0),await h2("api_providers",ee),h(!1)}catch(Se){console.error("自动保存失败:",Se),h(!0)}finally{c(!1)}},[]);S.useEffect(()=>{if(!K.current)return h(!0),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{We(t)},2e3),()=>{P.current&&clearTimeout(P.current)}},[t,We]);const ct=async()=>{try{i(!0),P.current&&clearTimeout(P.current);const ee=await Vu();ee.api_providers=t,await wg(ee),h(!1),Y({title:"保存成功",description:"模型提供商配置已保存"})}catch(ee){console.error("保存配置失败:",ee),Y({title:"保存失败",description:ee.message,variant:"destructive"})}finally{i(!1)}},Oe=(ee,Se)=>{j(ee||{name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),M(Se),F(!1),k(!0)},nt=async()=>{if(O?.api_key)try{await navigator.clipboard.writeText(O.api_key),Y({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{Y({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},ut=()=>{if(!O)return;const ee={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};if(T!==null){const Se=[...t];Se[T]=ee,e(Se)}else e([...t,ee]);k(!1),j(null),M(null)},Ct=ee=>{if(!ee&&O){const Se={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};j(Se)}k(ee)},In=ee=>{z(ee),D(!0)},Tn=()=>{if(E!==null){const ee=t.filter((Se,Be)=>Be!==E);e(ee),Y({title:"删除成功",description:"提供商已从列表中移除"})}D(!1),z(null)},Jn=ee=>{const Se=new Set(V);Se.has(ee)?Se.delete(ee):Se.add(ee),ce(Se)},nn=()=>{if(V.size===qn.length)ce(new Set);else{const ee=qn.map((Se,Be)=>t.findIndex(rt=>rt===qn[Be]));ce(new Set(ee))}},_t=()=>{if(V.size===0){Y({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}J(!0)},Yr=()=>{const ee=t.filter((Se,Be)=>!V.has(Be));e(ee),ce(new Set),J(!1),Y({title:"批量删除成功",description:`已删除 ${V.size} 个提供商`})},qn=t.filter(ee=>{if(!L)return!0;const Se=L.toLowerCase();return ee.name.toLowerCase().includes(Se)||ee.base_url.toLowerCase().includes(Se)||ee.client_type.toLowerCase().includes(Se)}),or=Math.ceil(qn.length/ne),yn=qn.slice((H-1)*ne,H*ne),ft=()=>{const ee=parseInt(R);ee>=1&&ee<=or&&(ae(ee),me(""))};return n?a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型提供商配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 API 提供商配置"})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[V.size>0&&a.jsxs(ie,{onClick:_t,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",V.size,")"]}),a.jsxs(ie,{onClick:()=>Oe(null,null),size:"sm",className:"w-full sm:w-auto",children:[a.jsx(Wr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),a.jsxs(ie,{onClick:ct,disabled:s||l||!d||m,size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),s?"保存中...":l?"自动保存中...":d?"保存配置":"已保存"]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:s||l||m,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),m?"重启中...":d?"保存并重启":"重启麦麦"]})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认重启麦麦?"}),a.jsx(un,{children:d?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:d?ve:fe,children:d?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(oo,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),a.jsxs(fn,{className:"h-[calc(100vh-260px)]",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[a.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[a.jsx(Ps,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Ae,{placeholder:"搜索提供商名称、URL 或类型...",value:L,onChange:ee=>U(ee.target.value),className:"pl-9"})]}),L&&a.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",qn.length," 个结果"]})]}),a.jsx("div",{className:"md:hidden space-y-3",children:qn.length===0?a.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:L?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):yn.map((ee,Se)=>{const Be=t.findIndex(rt=>rt===ee);return a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h3",{className:"font-semibold text-base truncate",children:ee.name}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:ee.base_url})]}),a.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Oe(ee,Be),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>In(Be),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),a.jsx("p",{className:"font-medium",children:ee.client_type})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),a.jsx("p",{className:"font-medium",children:ee.max_retry})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),a.jsx("p",{className:"font-medium",children:ee.timeout})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),a.jsx("p",{className:"font-medium",children:ee.retry_interval})]})]})]},Se)})}),a.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:a.jsxs(Ac,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(gt,{className:"w-12",children:a.jsx(ss,{checked:V.size===qn.length&&qn.length>0,onCheckedChange:nn})}),a.jsx(gt,{children:"名称"}),a.jsx(gt,{children:"基础URL"}),a.jsx(gt,{children:"客户端类型"}),a.jsx(gt,{className:"text-right",children:"最大重试"}),a.jsx(gt,{className:"text-right",children:"超时(秒)"}),a.jsx(gt,{className:"text-right",children:"重试间隔(秒)"}),a.jsx(gt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:yn.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center text-muted-foreground py-8",children:L?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):yn.map((ee,Se)=>{const Be=t.findIndex(rt=>rt===ee);return a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:V.has(Be),onCheckedChange:()=>Jn(Be)})}),a.jsx(it,{className:"font-medium",children:ee.name}),a.jsx(it,{className:"max-w-xs truncate",title:ee.base_url,children:ee.base_url}),a.jsx(it,{children:ee.client_type}),a.jsx(it,{className:"text-right",children:ee.max_retry}),a.jsx(it,{className:"text-right",children:ee.timeout}),a.jsx(it,{className:"text-right",children:ee.retry_interval}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Oe(ee,Be),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>In(Be),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Se)})})]})}),qn.length>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:ne.toString(),onValueChange:ee=>{ue(parseInt(ee)),ae(1),ce(new Set)},children:[a.jsx(Dt,{id:"page-size-provider",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(H-1)*ne+1," 到"," ",Math.min(H*ne,qn.length)," 条,共 ",qn.length," 条"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ae(1),disabled:H===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(ee=>Math.max(1,ee-1)),disabled:H===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ae,{type:"number",value:R,onChange:ee=>me(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&ft(),placeholder:H.toString(),className:"w-16 h-8 text-center",min:1,max:or}),a.jsx(ie,{variant:"outline",size:"sm",onClick:ft,disabled:!R,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(ee=>ee+1),disabled:H>=or,children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Mc,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ae(or),disabled:H>=or,className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]}),a.jsx(Rr,{open:b,onOpenChange:Ct,children:a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:T!==null?"编辑提供商":"添加提供商"}),a.jsx(Gr,{children:"配置 API 提供商的连接信息和参数"})]}),a.jsxs("div",{className:"grid gap-4 py-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"name",children:"名称 *"}),a.jsx(Ae,{id:"name",value:O?.name||"",onChange:ee=>j(Se=>Se?{...Se,name:ee.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"base_url",children:"基础 URL *"}),a.jsx(Ae,{id:"base_url",value:O?.base_url||"",onChange:ee=>j(Se=>Se?{...Se,base_url:ee.target.value}:null),placeholder:"https://api.example.com/v1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"api_key",children:"API Key *"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ae,{id:"api_key",type:Q?"text":"password",value:O?.api_key||"",onChange:ee=>j(Se=>Se?{...Se,api_key:ee.target.value}:null),placeholder:"sk-...",className:"flex-1"}),a.jsx(ie,{type:"button",variant:"outline",size:"icon",onClick:()=>F(!Q),title:Q?"隐藏密钥":"显示密钥",children:Q?a.jsx(Yb,{className:"h-4 w-4"}):a.jsx(Fi,{className:"h-4 w-4"})}),a.jsx(ie,{type:"button",variant:"outline",size:"icon",onClick:nt,title:"复制密钥",children:a.jsx(Xb,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"client_type",children:"客户端类型"}),a.jsxs(Lt,{value:O?.client_type||"openai",onValueChange:ee=>j(Se=>Se?{...Se,client_type:ee}:null),children:[a.jsx(Dt,{id:"client_type",children:a.jsx(It,{placeholder:"选择客户端类型"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"openai",children:"OpenAI"}),a.jsx(Pe,{value:"gemini",children:"Gemini"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_retry",children:"最大重试"}),a.jsx(Ae,{id:"max_retry",type:"number",min:"0",value:O?.max_retry??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,max_retry:Se}:null)},placeholder:"默认: 2"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"timeout",children:"超时(秒)"}),a.jsx(Ae,{id:"timeout",type:"number",min:"1",value:O?.timeout??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,timeout:Se}:null)},placeholder:"默认: 30"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),a.jsx(Ae,{id:"retry_interval",type:"number",min:"1",value:O?.retry_interval??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,retry_interval:Se}:null)},placeholder:"默认: 10"})]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>k(!1),children:"取消"}),a.jsx(ie,{onClick:ut,children:"保存"})]})]})}),a.jsx(mn,{open:_,onOpenChange:D,children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:['确定要删除提供商 "',E!==null?t[E]?.name:"",'" 吗? 此操作无法撤销。']})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:Tn,children:"删除"})]})]})}),a.jsx(mn,{open:W,onOpenChange:J,children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认批量删除"}),a.jsxs(un,{children:["确定要删除选中的 ",V.size," 个提供商吗? 此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:Yr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),x&&a.jsx(vw,{onRestartComplete:Re,onRestartFailed:de})]})}var a8=1,cte=.9,ute=.8,dte=.17,cb=.1,ub=.999,hte=.9999,fte=.99,mte=/[\\\/_+.#"@\[\(\{&]/,pte=/[\\\/_+.#"@\[\(\{&]/g,gte=/[\s-]/,L_=/[\s-]/g;function u4(t,e,n,r,s,i,l){if(i===e.length)return s===t.length?a8:fte;var c=`${s},${i}`;if(l[c]!==void 0)return l[c];for(var d=r.charAt(i),h=n.indexOf(d,s),m=0,p,x,v,b;h>=0;)p=u4(t,e,n,r,h+1,i+1,l),p>m&&(h===s?p*=a8:mte.test(t.charAt(h-1))?(p*=ute,v=t.slice(s,h-1).match(pte),v&&s>0&&(p*=Math.pow(ub,v.length))):gte.test(t.charAt(h-1))?(p*=cte,b=t.slice(s,h-1).match(L_),b&&s>0&&(p*=Math.pow(ub,b.length))):(p*=dte,s>0&&(p*=Math.pow(ub,h-s))),t.charAt(h)!==e.charAt(i)&&(p*=hte)),(pp&&(p=x*cb)),p>m&&(m=p),h=n.indexOf(d,h+1);return l[c]=m,m}function l8(t){return t.toLowerCase().replace(L_," ")}function xte(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,u4(t,e,l8(t),l8(e),0,0,{})}var vte=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Co=vte.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Bh='[cmdk-group=""]',db='[cmdk-group-items=""]',yte='[cmdk-group-heading=""]',I_='[cmdk-item=""]',o8=`${I_}:not([aria-disabled="true"])`,d4="cmdk-item-select",Pu="data-value",bte=(t,e,n)=>xte(t,e,n),q_=S.createContext(void 0),g0=()=>S.useContext(q_),F_=S.createContext(void 0),o5=()=>S.useContext(F_),Q_=S.createContext(void 0),$_=S.forwardRef((t,e)=>{let n=Bu(()=>{var Y,P;return{search:"",value:(P=(Y=t.value)!=null?Y:t.defaultValue)!=null?P:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Bu(()=>new Set),s=Bu(()=>new Map),i=Bu(()=>new Map),l=Bu(()=>new Set),c=H_(t),{label:d,children:h,value:m,onValueChange:p,filter:x,shouldFilter:v,loop:b,disablePointerSelection:k=!1,vimBindings:O=!0,...j}=t,T=Oi(),M=Oi(),_=Oi(),D=S.useRef(null),E=Ete();Nc(()=>{if(m!==void 0){let Y=m.trim();n.current.value=Y,z.emit()}},[m]),Nc(()=>{E(6,ce)},[]);let z=S.useMemo(()=>({subscribe:Y=>(l.current.add(Y),()=>l.current.delete(Y)),snapshot:()=>n.current,setState:(Y,P,K)=>{var $,fe,ve,Re;if(!Object.is(n.current[Y],P)){if(n.current[Y]=P,Y==="search")V(),L(),E(1,U);else if(Y==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let de=document.getElementById(_);de?de.focus():($=document.getElementById(T))==null||$.focus()}if(E(7,()=>{var de;n.current.selectedItemId=(de=W())==null?void 0:de.id,z.emit()}),K||E(5,ce),((fe=c.current)==null?void 0:fe.value)!==void 0){let de=P??"";(Re=(ve=c.current).onValueChange)==null||Re.call(ve,de);return}}z.emit()}},emit:()=>{l.current.forEach(Y=>Y())}}),[]),Q=S.useMemo(()=>({value:(Y,P,K)=>{var $;P!==(($=i.current.get(Y))==null?void 0:$.value)&&(i.current.set(Y,{value:P,keywords:K}),n.current.filtered.items.set(Y,F(P,K)),E(2,()=>{L(),z.emit()}))},item:(Y,P)=>(r.current.add(Y),P&&(s.current.has(P)?s.current.get(P).add(Y):s.current.set(P,new Set([Y]))),E(3,()=>{V(),L(),n.current.value||U(),z.emit()}),()=>{i.current.delete(Y),r.current.delete(Y),n.current.filtered.items.delete(Y);let K=W();E(4,()=>{V(),K?.getAttribute("id")===Y&&U(),z.emit()})}),group:Y=>(s.current.has(Y)||s.current.set(Y,new Set),()=>{i.current.delete(Y),s.current.delete(Y)}),filter:()=>c.current.shouldFilter,label:d||t["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:T,inputId:_,labelId:M,listInnerRef:D}),[]);function F(Y,P){var K,$;let fe=($=(K=c.current)==null?void 0:K.filter)!=null?$:bte;return Y?fe(Y,n.current.search,P):0}function L(){if(!n.current.search||c.current.shouldFilter===!1)return;let Y=n.current.filtered.items,P=[];n.current.filtered.groups.forEach($=>{let fe=s.current.get($),ve=0;fe.forEach(Re=>{let de=Y.get(Re);ve=Math.max(de,ve)}),P.push([$,ve])});let K=D.current;J().sort(($,fe)=>{var ve,Re;let de=$.getAttribute("id"),We=fe.getAttribute("id");return((ve=Y.get(We))!=null?ve:0)-((Re=Y.get(de))!=null?Re:0)}).forEach($=>{let fe=$.closest(db);fe?fe.appendChild($.parentElement===fe?$:$.closest(`${db} > *`)):K.appendChild($.parentElement===K?$:$.closest(`${db} > *`))}),P.sort(($,fe)=>fe[1]-$[1]).forEach($=>{var fe;let ve=(fe=D.current)==null?void 0:fe.querySelector(`${Bh}[${Pu}="${encodeURIComponent($[0])}"]`);ve?.parentElement.appendChild(ve)})}function U(){let Y=J().find(K=>K.getAttribute("aria-disabled")!=="true"),P=Y?.getAttribute(Pu);z.setState("value",P||void 0)}function V(){var Y,P,K,$;if(!n.current.search||c.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let fe=0;for(let ve of r.current){let Re=(P=(Y=i.current.get(ve))==null?void 0:Y.value)!=null?P:"",de=($=(K=i.current.get(ve))==null?void 0:K.keywords)!=null?$:[],We=F(Re,de);n.current.filtered.items.set(ve,We),We>0&&fe++}for(let[ve,Re]of s.current)for(let de of Re)if(n.current.filtered.items.get(de)>0){n.current.filtered.groups.add(ve);break}n.current.filtered.count=fe}function ce(){var Y,P,K;let $=W();$&&(((Y=$.parentElement)==null?void 0:Y.firstChild)===$&&((K=(P=$.closest(Bh))==null?void 0:P.querySelector(yte))==null||K.scrollIntoView({block:"nearest"})),$.scrollIntoView({block:"nearest"}))}function W(){var Y;return(Y=D.current)==null?void 0:Y.querySelector(`${I_}[aria-selected="true"]`)}function J(){var Y;return Array.from(((Y=D.current)==null?void 0:Y.querySelectorAll(o8))||[])}function H(Y){let P=J()[Y];P&&z.setState("value",P.getAttribute(Pu))}function ae(Y){var P;let K=W(),$=J(),fe=$.findIndex(Re=>Re===K),ve=$[fe+Y];(P=c.current)!=null&&P.loop&&(ve=fe+Y<0?$[$.length-1]:fe+Y===$.length?$[0]:$[fe+Y]),ve&&z.setState("value",ve.getAttribute(Pu))}function ne(Y){let P=W(),K=P?.closest(Bh),$;for(;K&&!$;)K=Y>0?Mte(K,Bh):Ate(K,Bh),$=K?.querySelector(o8);$?z.setState("value",$.getAttribute(Pu)):ae(Y)}let ue=()=>H(J().length-1),R=Y=>{Y.preventDefault(),Y.metaKey?ue():Y.altKey?ne(1):ae(1)},me=Y=>{Y.preventDefault(),Y.metaKey?H(0):Y.altKey?ne(-1):ae(-1)};return S.createElement(Co.div,{ref:e,tabIndex:-1,...j,"cmdk-root":"",onKeyDown:Y=>{var P;(P=j.onKeyDown)==null||P.call(j,Y);let K=Y.nativeEvent.isComposing||Y.keyCode===229;if(!(Y.defaultPrevented||K))switch(Y.key){case"n":case"j":{O&&Y.ctrlKey&&R(Y);break}case"ArrowDown":{R(Y);break}case"p":case"k":{O&&Y.ctrlKey&&me(Y);break}case"ArrowUp":{me(Y);break}case"Home":{Y.preventDefault(),H(0);break}case"End":{Y.preventDefault(),ue();break}case"Enter":{Y.preventDefault();let $=W();if($){let fe=new Event(d4);$.dispatchEvent(fe)}}}}},S.createElement("label",{"cmdk-label":"",htmlFor:Q.inputId,id:Q.labelId,style:Dte},d),Px(t,Y=>S.createElement(F_.Provider,{value:z},S.createElement(q_.Provider,{value:Q},Y))))}),wte=S.forwardRef((t,e)=>{var n,r;let s=Oi(),i=S.useRef(null),l=S.useContext(Q_),c=g0(),d=H_(t),h=(r=(n=d.current)==null?void 0:n.forceMount)!=null?r:l?.forceMount;Nc(()=>{if(!h)return c.item(s,l?.id)},[h]);let m=U_(s,i,[t.value,t.children,i],t.keywords),p=o5(),x=xo(E=>E.value&&E.value===m.current),v=xo(E=>h||c.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);S.useEffect(()=>{let E=i.current;if(!(!E||t.disabled))return E.addEventListener(d4,b),()=>E.removeEventListener(d4,b)},[v,t.onSelect,t.disabled]);function b(){var E,z;k(),(z=(E=d.current).onSelect)==null||z.call(E,m.current)}function k(){p.setState("value",m.current,!0)}if(!v)return null;let{disabled:O,value:j,onSelect:T,forceMount:M,keywords:_,...D}=t;return S.createElement(Co.div,{ref:lo(i,e),...D,id:s,"cmdk-item":"",role:"option","aria-disabled":!!O,"aria-selected":!!x,"data-disabled":!!O,"data-selected":!!x,onPointerMove:O||c.getDisablePointerSelection()?void 0:k,onClick:O?void 0:b},t.children)}),Ste=S.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,l=Oi(),c=S.useRef(null),d=S.useRef(null),h=Oi(),m=g0(),p=xo(v=>s||m.filter()===!1?!0:v.search?v.filtered.groups.has(l):!0);Nc(()=>m.group(l),[]),U_(l,c,[t.value,t.heading,d]);let x=S.useMemo(()=>({id:l,forceMount:s}),[s]);return S.createElement(Co.div,{ref:lo(c,e),...i,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},n&&S.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),Px(t,v=>S.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},S.createElement(Q_.Provider,{value:x},v))))}),kte=S.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=S.useRef(null),i=xo(l=>!l.search);return!n&&!i?null:S.createElement(Co.div,{ref:lo(s,e),...r,"cmdk-separator":"",role:"separator"})}),Ote=S.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=o5(),l=xo(h=>h.search),c=xo(h=>h.selectedItemId),d=g0();return S.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),S.createElement(Co.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":c,id:d.inputId,type:"text",value:s?t.value:l,onChange:h=>{s||i.setState("search",h.target.value),n?.(h.target.value)}})}),jte=S.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=S.useRef(null),l=S.useRef(null),c=xo(h=>h.selectedItemId),d=g0();return S.useEffect(()=>{if(l.current&&i.current){let h=l.current,m=i.current,p,x=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let v=h.offsetHeight;m.style.setProperty("--cmdk-list-height",v.toFixed(1)+"px")})});return x.observe(h),()=>{cancelAnimationFrame(p),x.unobserve(h)}}},[]),S.createElement(Co.div,{ref:lo(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":r,id:d.listId},Px(t,h=>S.createElement("div",{ref:lo(l,d.listInnerRef),"cmdk-list-sizer":""},h)))}),Nte=S.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:l,...c}=t;return S.createElement(W4,{open:n,onOpenChange:r},S.createElement($4,{container:l},S.createElement(nx,{"cmdk-overlay":"",className:s}),S.createElement(rx,{"aria-label":t.label,"cmdk-dialog":"",className:i},S.createElement($_,{ref:e,...c}))))}),Cte=S.forwardRef((t,e)=>xo(n=>n.filtered.count===0)?S.createElement(Co.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),Tte=S.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return S.createElement(Co.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Px(t,l=>S.createElement("div",{"aria-hidden":!0},l)))}),Ls=Object.assign($_,{List:jte,Item:wte,Input:Ote,Group:Ste,Separator:kte,Dialog:Nte,Empty:Cte,Loading:Tte});function Mte(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function Ate(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function H_(t){let e=S.useRef(t);return Nc(()=>{e.current=t}),e}var Nc=typeof window>"u"?S.useEffect:S.useLayoutEffect;function Bu(t){let e=S.useRef();return e.current===void 0&&(e.current=t()),e}function xo(t){let e=o5(),n=()=>t(e.snapshot());return S.useSyncExternalStore(e.subscribe,n,n)}function U_(t,e,n,r=[]){let s=S.useRef(),i=g0();return Nc(()=>{var l;let c=(()=>{var h;for(let m of n){if(typeof m=="string")return m.trim();if(typeof m=="object"&&"current"in m)return m.current?(h=m.current.textContent)==null?void 0:h.trim():s.current}})(),d=r.map(h=>h.trim());i.value(t,c,d),(l=e.current)==null||l.setAttribute(Pu,c),s.current=c}),s}var Ete=()=>{let[t,e]=S.useState(),n=Bu(()=>new Map);return Nc(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function _te(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function Px({asChild:t,children:e},n){return t&&S.isValidElement(e)?S.cloneElement(_te(e),{ref:e.ref},n(e.props.children)):n(e)}var Dte={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const V_=S.forwardRef(({className:t,...e},n)=>a.jsx(Ls,{ref:n,className:ye("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));V_.displayName=Ls.displayName;const W_=S.forwardRef(({className:t,...e},n)=>a.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[a.jsx(Ps,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),a.jsx(Ls.Input,{ref:n,className:ye("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));W_.displayName=Ls.Input.displayName;const G_=S.forwardRef(({className:t,...e},n)=>a.jsx(Ls.List,{ref:n,className:ye("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));G_.displayName=Ls.List.displayName;const X_=S.forwardRef((t,e)=>a.jsx(Ls.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));X_.displayName=Ls.Empty.displayName;const Y_=S.forwardRef(({className:t,...e},n)=>a.jsx(Ls.Group,{ref:n,className:ye("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...e}));Y_.displayName=Ls.Group.displayName;const Rte=S.forwardRef(({className:t,...e},n)=>a.jsx(Ls.Separator,{ref:n,className:ye("-mx-1 h-px bg-border",t),...e}));Rte.displayName=Ls.Separator.displayName;const K_=S.forwardRef(({className:t,...e},n)=>a.jsx(Ls.Item,{ref:n,className:ye("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...e}));K_.displayName=Ls.Item.displayName;function zte({options:t,selected:e,onChange:n,placeholder:r="选择选项...",emptyText:s="未找到选项",className:i}){const[l,c]=S.useState(!1),d=m=>{e.includes(m)?n(e.filter(p=>p!==m)):n([...e,m])},h=m=>{n(e.filter(p=>p!==m))};return a.jsxs(co,{open:l,onOpenChange:c,children:[a.jsx(uo,{asChild:!0,children:a.jsxs(ie,{variant:"outline",role:"combobox","aria-expanded":l,className:ye("w-full justify-between min-h-10 h-auto",i),children:[a.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:e.length===0?a.jsx("span",{className:"text-muted-foreground",children:r}):e.map(m=>{const p=t.find(x=>x.value===m);return a.jsxs(On,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80",onClick:x=>{x.stopPropagation(),h(m)},children:[p?.label||m,a.jsx(Gf,{className:"ml-1 h-3 w-3",strokeWidth:2,fill:"none"})]},m)})}),a.jsx(Sq,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),a.jsx(hl,{className:"w-full p-0",align:"start",children:a.jsxs(V_,{children:[a.jsx(W_,{placeholder:"搜索...",className:"h-9"}),a.jsxs(G_,{children:[a.jsx(X_,{children:s}),a.jsx(Y_,{children:t.map(m=>{const p=e.includes(m.value);return a.jsxs(K_,{value:m.value,onSelect:()=>d(m.value),children:[a.jsx("div",{className:ye("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",p?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:a.jsx(hc,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),a.jsx("span",{children:m.label})]},m.value)})})]})]})})]})}function Pte(){const[t,e]=S.useState([]),[n,r]=S.useState([]),[s,i]=S.useState([]),[l,c]=S.useState(null),[d,h]=S.useState(!0),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,M]=S.useState(!1),[_,D]=S.useState(!1),[E,z]=S.useState(null),[Q,F]=S.useState(null),[L,U]=S.useState(!1),[V,ce]=S.useState(null),[W,J]=S.useState(""),[H,ae]=S.useState(new Set),[ne,ue]=S.useState(!1),[R,me]=S.useState(1),[Y,P]=S.useState(20),[K,$]=S.useState(""),{toast:fe}=Pr(),ve=S.useRef(null),Re=S.useRef(null),de=S.useRef(!0);S.useEffect(()=>{We()},[]);const We=async()=>{try{h(!0);const re=await Vu(),Me=re.models||[];e(Me),i(Me.map(vt=>vt.name));const pt=re.api_providers||[];r(pt.map(vt=>vt.name)),c(re.model_task_config||null),k(!1),de.current=!1}catch(re){console.error("加载配置失败:",re)}finally{h(!1)}},ct=async()=>{try{j(!0),xw().catch(()=>{}),M(!0)}catch(re){console.error("重启失败:",re),M(!1),fe({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),j(!1)}},Oe=async()=>{try{p(!0),ve.current&&clearTimeout(ve.current),Re.current&&clearTimeout(Re.current);const re=await Vu();re.models=t,re.model_task_config=l,await wg(re),k(!1),fe({title:"保存成功",description:"正在重启麦麦..."}),await ct()}catch(re){console.error("保存配置失败:",re),fe({title:"保存失败",description:re.message,variant:"destructive"}),p(!1)}},nt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},ut=()=>{M(!1),j(!1),fe({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Ct=S.useCallback(async re=>{if(!de.current)try{v(!0),await h2("models",re),k(!1)}catch(Me){console.error("自动保存模型列表失败:",Me),k(!0)}finally{v(!1)}},[]),In=S.useCallback(async re=>{if(!de.current)try{v(!0),await h2("model_task_config",re),k(!1)}catch(Me){console.error("自动保存任务配置失败:",Me),k(!0)}finally{v(!1)}},[]);S.useEffect(()=>{if(!de.current)return k(!0),ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{Ct(t)},2e3),()=>{ve.current&&clearTimeout(ve.current)}},[t,Ct]),S.useEffect(()=>{if(!(de.current||!l))return k(!0),Re.current&&clearTimeout(Re.current),Re.current=setTimeout(()=>{In(l)},2e3),()=>{Re.current&&clearTimeout(Re.current)}},[l,In]);const Tn=async()=>{try{p(!0),ve.current&&clearTimeout(ve.current),Re.current&&clearTimeout(Re.current);const re=await Vu();re.models=t,re.model_task_config=l,await wg(re),k(!1),fe({title:"保存成功",description:"模型配置已保存"}),await We()}catch(re){console.error("保存配置失败:",re),fe({title:"保存失败",description:re.message,variant:"destructive"})}finally{p(!1)}},Jn=(re,Me)=>{z(re||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),F(Me),D(!0)},nn=()=>{if(!E)return;const re={...E,price_in:E.price_in??0,price_out:E.price_out??0};let Me;Q!==null?(Me=[...t],Me[Q]=re):Me=[...t,re],e(Me),i(Me.map(pt=>pt.name)),D(!1),z(null),F(null)},_t=re=>{if(!re&&E){const Me={...E,price_in:E.price_in??0,price_out:E.price_out??0};z(Me)}D(re)},Yr=re=>{ce(re),U(!0)},qn=()=>{if(V!==null){const re=t.filter((Me,pt)=>pt!==V);e(re),i(re.map(Me=>Me.name)),fe({title:"删除成功",description:"模型已从列表中移除"})}U(!1),ce(null)},or=re=>{const Me=new Set(H);Me.has(re)?Me.delete(re):Me.add(re),ae(Me)},yn=()=>{if(H.size===Be.length)ae(new Set);else{const re=Be.map((Me,pt)=>t.findIndex(vt=>vt===Be[pt]));ae(new Set(re))}},ft=()=>{if(H.size===0){fe({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ue(!0)},ee=()=>{const re=t.filter((Me,pt)=>!H.has(pt));e(re),i(re.map(Me=>Me.name)),ae(new Set),ue(!1),fe({title:"批量删除成功",description:`已删除 ${H.size} 个模型`})},Se=(re,Me,pt)=>{l&&c({...l,[re]:{...l[re],[Me]:pt}})},Be=t.filter(re=>{if(!W)return!0;const Me=W.toLowerCase();return re.name.toLowerCase().includes(Me)||re.model_identifier.toLowerCase().includes(Me)||re.api_provider.toLowerCase().includes(Me)}),rt=Math.ceil(Be.length/Y),Tt=Be.slice((R-1)*Y,R*Y),cr=()=>{const re=parseInt(K);re>=1&&re<=rt&&(me(re),$(""))},Kr=re=>l?[l.utils?.model_list||[],l.utils_small?.model_list||[],l.tool_use?.model_list||[],l.replyer?.model_list||[],l.planner?.model_list||[],l.vlm?.model_list||[],l.voice?.model_list||[],l.embedding?.model_list||[],l.lpmm_entity_extract?.model_list||[],l.lpmm_rdf_build?.model_list||[],l.lpmm_qa?.model_list||[]].some(pt=>pt.includes(re)):!1;return d?a.jsx(fn,{className:"h-full",children:a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):a.jsx(fn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理模型和任务配置"})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[a.jsxs(ie,{onClick:Tn,disabled:m||x||!b||O,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),m?"保存中...":x?"自动保存中...":b?"保存配置":"已保存"]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:m||x||O,size:"sm",className:"flex-1 sm:flex-none",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),O?"重启中...":b?"保存并重启":"重启麦麦"]})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认重启麦麦?"}),a.jsx(un,{children:b?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:b?Oe:ct,children:b?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(oo,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),a.jsxs(dl,{defaultValue:"models",className:"w-full",children:[a.jsxs(va,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[a.jsx($t,{value:"models",children:"模型配置"}),a.jsx($t,{value:"tasks",children:"模型任务配置"})]}),a.jsxs(kn,{value:"models",className:"space-y-4 mt-0",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[H.size>0&&a.jsxs(ie,{onClick:ft,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",H.size,")"]}),a.jsxs(ie,{onClick:()=>Jn(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(Wr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[a.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[a.jsx(Ps,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Ae,{placeholder:"搜索模型名称、标识符或提供商...",value:W,onChange:re=>J(re.target.value),className:"pl-9"})]}),W&&a.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Be.length," 个结果"]})]}),a.jsx("div",{className:"md:hidden space-y-3",children:Tt.length===0?a.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:W?"未找到匹配的模型":"暂无模型配置"}):Tt.map((re,Me)=>{const pt=t.findIndex(vs=>vs===re),vt=Kr(re.name);return a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("h3",{className:"font-semibold text-base",children:re.name}),a.jsx(On,{variant:vt?"default":"secondary",className:vt?"bg-green-600 hover:bg-green-700":"",children:vt?"已使用":"未使用"})]}),a.jsx("p",{className:"text-xs text-muted-foreground break-all",title:re.model_identifier,children:re.model_identifier})]}),a.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Jn(re,pt),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>Yr(pt),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),a.jsx("p",{className:"font-medium",children:re.api_provider})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),a.jsx("p",{className:"font-medium",children:re.force_stream_mode?"是":"否"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),a.jsxs("p",{className:"font-medium",children:["¥",re.price_in,"/M"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),a.jsxs("p",{className:"font-medium",children:["¥",re.price_out,"/M"]})]})]})]},Me)})}),a.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:a.jsxs(Ac,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(gt,{className:"w-12",children:a.jsx(ss,{checked:H.size===Be.length&&Be.length>0,onCheckedChange:yn})}),a.jsx(gt,{className:"w-24",children:"使用状态"}),a.jsx(gt,{children:"模型名称"}),a.jsx(gt,{children:"模型标识符"}),a.jsx(gt,{children:"提供商"}),a.jsx(gt,{className:"text-right",children:"输入价格"}),a.jsx(gt,{className:"text-right",children:"输出价格"}),a.jsx(gt,{className:"text-center",children:"强制流式"}),a.jsx(gt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:Tt.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:9,className:"text-center text-muted-foreground py-8",children:W?"未找到匹配的模型":"暂无模型配置"})}):Tt.map((re,Me)=>{const pt=t.findIndex(vs=>vs===re),vt=Kr(re.name);return a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:H.has(pt),onCheckedChange:()=>or(pt)})}),a.jsx(it,{children:a.jsx(On,{variant:vt?"default":"secondary",className:vt?"bg-green-600 hover:bg-green-700":"",children:vt?"已使用":"未使用"})}),a.jsx(it,{className:"font-medium",children:re.name}),a.jsx(it,{className:"max-w-xs truncate",title:re.model_identifier,children:re.model_identifier}),a.jsx(it,{children:re.api_provider}),a.jsxs(it,{className:"text-right",children:["¥",re.price_in,"/M"]}),a.jsxs(it,{className:"text-right",children:["¥",re.price_out,"/M"]}),a.jsx(it,{className:"text-center",children:re.force_stream_mode?"是":"否"}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Jn(re,pt),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>Yr(pt),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Me)})})]})}),Be.length>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:Y.toString(),onValueChange:re=>{P(parseInt(re)),me(1),ae(new Set)},children:[a.jsx(Dt,{id:"page-size-model",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*Y+1," 到"," ",Math.min(R*Y,Be.length)," 条,共 ",Be.length," 条"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>me(1),disabled:R===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>me(re=>Math.max(1,re-1)),disabled:R===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ae,{type:"number",value:K,onChange:re=>$(re.target.value),onKeyDown:re=>re.key==="Enter"&&cr(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:rt}),a.jsx(ie,{variant:"outline",size:"sm",onClick:cr,disabled:!K,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>me(re=>re+1),disabled:R>=rt,children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Mc,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>me(rt),disabled:R>=rt,className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]}),a.jsxs(kn,{value:"tasks",className:"space-y-6 mt-0",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),l&&a.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[a.jsx(zi,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:l.utils,modelNames:s,onChange:(re,Me)=>Se("utils",re,Me)}),a.jsx(zi,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:l.utils_small,modelNames:s,onChange:(re,Me)=>Se("utils_small",re,Me)}),a.jsx(zi,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:l.tool_use,modelNames:s,onChange:(re,Me)=>Se("tool_use",re,Me)}),a.jsx(zi,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:l.replyer,modelNames:s,onChange:(re,Me)=>Se("replyer",re,Me)}),a.jsx(zi,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:l.planner,modelNames:s,onChange:(re,Me)=>Se("planner",re,Me)}),a.jsx(zi,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:l.vlm,modelNames:s,onChange:(re,Me)=>Se("vlm",re,Me),hideTemperature:!0}),a.jsx(zi,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:l.voice,modelNames:s,onChange:(re,Me)=>Se("voice",re,Me),hideTemperature:!0,hideMaxTokens:!0}),a.jsx(zi,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:l.embedding,modelNames:s,onChange:(re,Me)=>Se("embedding",re,Me),hideTemperature:!0,hideMaxTokens:!0}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),a.jsx(zi,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:l.lpmm_entity_extract,modelNames:s,onChange:(re,Me)=>Se("lpmm_entity_extract",re,Me)}),a.jsx(zi,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:l.lpmm_rdf_build,modelNames:s,onChange:(re,Me)=>Se("lpmm_rdf_build",re,Me)}),a.jsx(zi,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:l.lpmm_qa,modelNames:s,onChange:(re,Me)=>Se("lpmm_qa",re,Me)})]})]})]})]}),a.jsx(Rr,{open:_,onOpenChange:_t,children:a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:Q!==null?"编辑模型":"添加模型"}),a.jsx(Gr,{children:"配置模型的基本信息和参数"})]}),a.jsxs("div",{className:"grid gap-4 py-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"model_name",children:"模型名称 *"}),a.jsx(Ae,{id:"model_name",value:E?.name||"",onChange:re=>z(Me=>Me?{...Me,name:re.target.value}:null),placeholder:"例如: qwen3-30b"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"model_identifier",children:"模型标识符 *"}),a.jsx(Ae,{id:"model_identifier",value:E?.model_identifier||"",onChange:re=>z(Me=>Me?{...Me,model_identifier:re.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"API 提供商提供的模型 ID"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"api_provider",children:"API 提供商 *"}),a.jsxs(Lt,{value:E?.api_provider||"",onValueChange:re=>z(Me=>Me?{...Me,api_provider:re}:null),children:[a.jsx(Dt,{id:"api_provider",children:a.jsx(It,{placeholder:"选择提供商"})}),a.jsx(Rt,{children:n.map(re=>a.jsx(Pe,{value:re,children:re},re))})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),a.jsx(Ae,{id:"price_in",type:"number",step:"0.1",min:"0",value:E?.price_in??"",onChange:re=>{const Me=re.target.value===""?null:parseFloat(re.target.value);z(pt=>pt?{...pt,price_in:Me}:null)},placeholder:"默认: 0"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),a.jsx(Ae,{id:"price_out",type:"number",step:"0.1",min:"0",value:E?.price_out??"",onChange:re=>{const Me=re.target.value===""?null:parseFloat(re.target.value);z(pt=>pt?{...pt,price_out:Me}:null)},placeholder:"默认: 0"})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"force_stream_mode",checked:E?.force_stream_mode||!1,onCheckedChange:re=>z(Me=>Me?{...Me,force_stream_mode:re}:null)}),a.jsx(te,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>D(!1),children:"取消"}),a.jsx(ie,{onClick:nn,children:"保存"})]})]})}),a.jsx(mn,{open:L,onOpenChange:U,children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:['确定要删除模型 "',V!==null?t[V]?.name:"",'" 吗? 此操作无法撤销。']})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:qn,children:"删除"})]})]})}),a.jsx(mn,{open:ne,onOpenChange:ue,children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认批量删除"}),a.jsxs(un,{children:["确定要删除选中的 ",H.size," 个模型吗? 此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),T&&a.jsx(vw,{onRestartComplete:nt,onRestartFailed:ut})]})})}function zi({title:t,description:e,taskConfig:n,modelNames:r,onChange:s,hideTemperature:i=!1,hideMaxTokens:l=!1}){const c=d=>{s("model_list",d)};return a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:t}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:e})]}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"模型列表"}),a.jsx(zte,{options:r.map(d=>({label:d,value:d})),selected:n.model_list||[],onChange:c,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!i&&a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"温度"}),a.jsx(Ae,{type:"number",step:"0.1",min:"0",max:"1",value:n.temperature??.3,onChange:d=>{const h=parseFloat(d.target.value);!isNaN(h)&&h>=0&&h<=1&&s("temperature",h)},className:"w-20 h-8 text-sm"})]}),a.jsx(yx,{value:[n.temperature??.3],onValueChange:d=>s("temperature",d[0]),min:0,max:1,step:.1,className:"w-full"})]}),!l&&a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"最大 Token"}),a.jsx(Ae,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:d=>s("max_tokens",parseInt(d.target.value))})]})]})]})]})}const Bx="/api/webui/config";async function Bte(){const e=await(await ot(`${Bx}/adapter-config/path`)).json();return!e.success||!e.path?null:{path:e.path,lastModified:e.lastModified}}async function Lte(t){const n=await(await ot(`${Bx}/adapter-config/path`,{method:"POST",headers:bt(),body:JSON.stringify({path:t})})).json();if(!n.success)throw new Error(n.message||"保存路径失败")}async function Ite(t){const n=await(await ot(`${Bx}/adapter-config?path=${encodeURIComponent(t)}`)).json();if(!n.success)throw new Error("读取配置文件失败");return n.content}async function c8(t,e){const r=await(await ot(`${Bx}/adapter-config`,{method:"POST",headers:bt(),body:JSON.stringify({path:t,content:e})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}const Ks={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}};function qte(){const[t,e]=S.useState("upload"),[n,r]=S.useState(null),[s,i]=S.useState(""),[l,c]=S.useState(""),[d,h]=S.useState(""),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,M]=S.useState(null),_=S.useRef(null),{toast:D}=Pr(),E=S.useRef(null),z=K=>{if(!K.trim())return{valid:!1,error:"路径不能为空"};const $=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,fe=/^(\/|~\/).+\.toml$/i,ve=$.test(K),Re=fe.test(K);return!ve&&!Re?{valid:!1,error:"路径格式错误。Windows: C:\\path\\file.toml,Linux: /path/file.toml"}:K.toLowerCase().endsWith(".toml")?/[<>"|?*\x00-\x1F]/.test(K)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}:{valid:!1,error:"文件必须是 .toml 格式"}},Q=K=>{if(c(K),K.trim()){const $=z(K);h($.error)}else h("")};S.useEffect(()=>{(async()=>{try{const $=await Bte();$&&$.path&&(c($.path),e("path"),await F($.path))}catch($){console.error("加载保存的路径失败:",$)}})()},[]);const F=async K=>{const $=z(K);if(!$.valid){h($.error),D({title:"路径无效",description:$.error,variant:"destructive"});return}h(""),v(!0);try{const fe=await Ite(K),ve=ue(fe);r(ve),c(K),await Lte(K),D({title:"加载成功",description:"已从配置文件加载"})}catch(fe){console.error("加载配置失败:",fe),D({title:"加载失败",description:fe instanceof Error?fe.message:"无法读取配置文件",variant:"destructive"})}finally{v(!1)}},L=S.useCallback(K=>{t!=="path"||!l||(E.current&&clearTimeout(E.current),E.current=setTimeout(async()=>{p(!0);try{const $=R(K);await c8(l,$),D({title:"自动保存成功",description:"配置已保存到文件"})}catch($){console.error("自动保存失败:",$),D({title:"自动保存失败",description:$ instanceof Error?$.message:"保存配置失败",variant:"destructive"})}finally{p(!1)}},1e3))},[t,l,D]),U=async()=>{if(!n||!l)return;const K=z(l);if(!K.valid){D({title:"保存失败",description:K.error,variant:"destructive"});return}p(!0);try{const $=R(n);await c8(l,$),D({title:"保存成功",description:"配置已保存到文件"})}catch($){console.error("保存失败:",$),D({title:"保存失败",description:$ instanceof Error?$.message:"保存配置失败",variant:"destructive"})}finally{p(!1)}},V=async()=>{l&&await F(l)},ce=K=>{if(K!==t){if(n){M(K),k(!0);return}W(K)}},W=K=>{r(null),i(""),h(""),e(K),D({title:"已切换模式",description:K==="upload"?"现在可以上传配置文件":"现在可以指定配置文件路径"})},J=()=>{T&&(W(T),M(null)),k(!1)},H=()=>{if(n){j(!0);return}ae()},ae=()=>{c(""),r(null),h(""),D({title:"已清空",description:"路径和配置已清空"})},ne=()=>{ae(),j(!1)},ue=K=>{const $=JSON.parse(JSON.stringify(Ks)),fe=K.split(` +`);let ve="";for(const Re of fe){const de=Re.trim();if(!de||de.startsWith("#"))continue;const We=de.match(/^\[(\w+)\]$/);if(We){ve=We[1];continue}const ct=de.match(/^(\w+)\s*=\s*(.+)$/);if(ct&&ve){const[,Oe,nt]=ct,ut=nt.trim();let Ct;if(ut==="true")Ct=!0;else if(ut==="false")Ct=!1;else if(ut.startsWith("[")&&ut.endsWith("]")){const In=ut.slice(1,-1).trim();if(In){const Tn=In.split(",").map(nn=>{const _t=nn.trim();return isNaN(Number(_t))?_t.replace(/"/g,""):Number(_t)}),Jn=typeof Tn[0];Ct=Tn.every(nn=>typeof nn===Jn)?Tn:Tn.filter(nn=>typeof nn=="number")}else Ct=[]}else ut.startsWith('"')&&ut.endsWith('"')?Ct=ut.slice(1,-1):isNaN(Number(ut))?Ct=ut.replace(/"/g,""):Ct=Number(ut);if(ve in $){const In=$[ve];In[Oe]=Ct}}}return $},R=K=>{const $=[],fe=(ve,Re)=>ve===""||ve===null||ve===void 0?Re:ve;return $.push("[inner]"),$.push(`version = "${fe(K.inner.version,Ks.inner.version)}" # 版本号`),$.push("# 请勿修改版本号,除非你知道自己在做什么"),$.push(""),$.push("[nickname] # 现在没用"),$.push(`nickname = "${fe(K.nickname.nickname,Ks.nickname.nickname)}"`),$.push(""),$.push("[napcat_server] # Napcat连接的ws服务设置"),$.push(`host = "${fe(K.napcat_server.host,Ks.napcat_server.host)}" # Napcat设定的主机地址`),$.push(`port = ${fe(K.napcat_server.port||0,Ks.napcat_server.port)} # Napcat设定的端口`),$.push(`token = "${fe(K.napcat_server.token,Ks.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),$.push(`heartbeat_interval = ${fe(K.napcat_server.heartbeat_interval||0,Ks.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),$.push(""),$.push("[maibot_server] # 连接麦麦的ws服务设置"),$.push(`host = "${fe(K.maibot_server.host,Ks.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),$.push(`port = ${fe(K.maibot_server.port||0,Ks.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),$.push(""),$.push("[chat] # 黑白名单功能"),$.push(`group_list_type = "${fe(K.chat.group_list_type,Ks.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),$.push(`group_list = [${K.chat.group_list.join(", ")}] # 群组名单`),$.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),$.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),$.push(`private_list_type = "${fe(K.chat.private_list_type,Ks.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),$.push(`private_list = [${K.chat.private_list.join(", ")}] # 私聊名单`),$.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),$.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),$.push(`ban_user_id = [${K.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),$.push(`ban_qq_bot = ${K.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),$.push(`enable_poke = ${K.chat.enable_poke} # 是否启用戳一戳功能`),$.push(""),$.push("[voice] # 发送语音设置"),$.push(`use_tts = ${K.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),$.push(""),$.push("[debug]"),$.push(`level = "${fe(K.debug.level,Ks.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),$.join(` +`)},me=K=>{const $=K.target.files?.[0];if(!$)return;const fe=new FileReader;fe.onload=ve=>{try{const Re=ve.target?.result,de=ue(Re);r(de),i($.name),D({title:"上传成功",description:`已加载配置文件:${$.name}`})}catch(Re){console.error("解析配置文件失败:",Re),D({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},fe.readAsText($)},Y=()=>{if(!n)return;const K=R(n),$=new Blob([K],{type:"text/plain;charset=utf-8"}),fe=URL.createObjectURL($),ve=document.createElement("a");ve.href=fe,ve.download=s||"config.toml",document.body.appendChild(ve),ve.click(),document.body.removeChild(ve),URL.revokeObjectURL(fe),D({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},P=()=>{r(JSON.parse(JSON.stringify(Ks))),i("config.toml"),D({title:"已加载默认配置",description:"可以开始编辑配置"})};return a.jsx(fn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"工作模式"}),a.jsx(Sr,{children:"选择配置文件的管理方式"})]}),a.jsxs(vn,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 md:gap-4",children:[a.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>ce("upload"),children:a.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[a.jsx(oO,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),a.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>ce("path"),children:a.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[a.jsx(kq,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),t==="path"&&a.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs("div",{className:"flex-1 space-y-1",children:[a.jsx(Ae,{id:"config-path",value:l,onChange:K=>Q(K.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${d?"border-destructive":""}`}),d&&a.jsx("p",{className:"text-xs text-destructive",children:d})]}),a.jsx(ie,{onClick:()=>F(l),disabled:x||!l||!!d,className:"w-full sm:w-auto",children:x?a.jsxs(a.Fragment,{children:[a.jsx(Ii,{className:"h-4 w-4 animate-spin mr-2"}),a.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"sm:hidden",children:"加载配置"}),a.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),a.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[a.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[a.jsx("span",{children:"路径格式说明"}),a.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),a.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[a.jsx("div",{children:"C:\\Adapter\\config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),a.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[a.jsx("div",{children:"/opt/adapter/config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),a.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(oo,{className:"h-4 w-4"}),a.jsx(od,{children:t==="upload"?a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",m&&" (正在保存...)"]})})]}),t==="upload"&&!n&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[a.jsx("input",{ref:_,type:"file",accept:".toml",className:"hidden",onChange:me}),a.jsxs(ie,{onClick:()=>_.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(oO,{className:"mr-2 h-4 w-4"}),"上传配置"]}),a.jsxs(ie,{onClick:P,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(io,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),t==="upload"&&n&&a.jsx("div",{className:"flex gap-2",children:a.jsxs(ie,{onClick:Y,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(fc,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),t==="path"&&n&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs(ie,{onClick:U,size:"sm",disabled:m||!!d,className:"w-full sm:w-auto",children:[a.jsx(lx,{className:"mr-2 h-4 w-4"}),m?"保存中...":"立即保存"]}),a.jsxs(ie,{onClick:V,size:"sm",variant:"outline",disabled:x,className:"w-full sm:w-auto",children:[a.jsx(Ii,{className:`mr-2 h-4 w-4 ${x?"animate-spin":""}`}),"刷新"]}),a.jsxs(ie,{onClick:H,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),n?a.jsxs(dl,{defaultValue:"napcat",className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:a.jsxs(va,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[a.jsxs($t,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),a.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),a.jsxs($t,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),a.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),a.jsxs($t,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),a.jsx("span",{className:"sm:hidden",children:"聊天"})]}),a.jsxs($t,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),a.jsx("span",{className:"sm:hidden",children:"语音"})]}),a.jsx($t,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),a.jsx(kn,{value:"napcat",className:"space-y-4",children:a.jsx(Fte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"maibot",className:"space-y-4",children:a.jsx(Qte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"chat",className:"space-y-4",children:a.jsx($te,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"voice",className:"space-y-4",children:a.jsx(Hte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"debug",className:"space-y-4",children:a.jsx(Ute,{config:n,onChange:K=>{r(K),L(K)}})})]}):a.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:a.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[a.jsx(io,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:t==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),a.jsx(mn,{open:b,onOpenChange:k,children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认切换模式"}),a.jsxs(un,{children:["切换模式将清空当前配置,确定要继续吗?",a.jsx("br",{}),a.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),a.jsxs(on,{children:[a.jsx(hn,{onClick:()=>{k(!1),M(null)},children:"取消"}),a.jsx(dn,{onClick:J,children:"确认切换"})]})]})}),a.jsx(mn,{open:O,onOpenChange:j,children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认清空路径"}),a.jsxs(un,{children:["清空路径将清除当前配置,确定要继续吗?",a.jsx("br",{}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),a.jsxs(on,{children:[a.jsx(hn,{onClick:()=>j(!1),children:"取消"}),a.jsx(dn,{onClick:ne,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function Fte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),a.jsxs("div",{className:"grid gap-3 md:gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),a.jsx(Ae,{id:"napcat-host",value:t.napcat_server.host,onChange:n=>e({...t,napcat_server:{...t.napcat_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),a.jsx(Ae,{id:"napcat-port",type:"number",value:t.napcat_server.port||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),a.jsx(Ae,{id:"napcat-token",type:"password",value:t.napcat_server.token,onChange:n=>e({...t,napcat_server:{...t.napcat_server,token:n.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),a.jsx(Ae,{id:"napcat-heartbeat",type:"number",value:t.napcat_server.heartbeat_interval||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,heartbeat_interval:n.target.value?parseInt(n.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function Qte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),a.jsxs("div",{className:"grid gap-3 md:gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),a.jsx(Ae,{id:"maibot-host",value:t.maibot_server.host,onChange:n=>e({...t,maibot_server:{...t.maibot_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),a.jsx(Ae,{id:"maibot-port",type:"number",value:t.maibot_server.port||"",onChange:n=>e({...t,maibot_server:{...t.maibot_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function $te({config:t,onChange:e}){const n=i=>{const l={...t};i==="group"?l.chat.group_list=[...l.chat.group_list,0]:i==="private"?l.chat.private_list=[...l.chat.private_list,0]:l.chat.ban_user_id=[...l.chat.ban_user_id,0],e(l)},r=(i,l)=>{const c={...t};i==="group"?c.chat.group_list=c.chat.group_list.filter((d,h)=>h!==l):i==="private"?c.chat.private_list=c.chat.private_list.filter((d,h)=>h!==l):c.chat.ban_user_id=c.chat.ban_user_id.filter((d,h)=>h!==l),e(c)},s=(i,l,c)=>{const d={...t};i==="group"?d.chat.group_list[l]=c:i==="private"?d.chat.private_list[l]=c:d.chat.ban_user_id[l]=c,e(d)};return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),a.jsxs("div",{className:"grid gap-4 md:gap-6",children:[a.jsxs("div",{className:"space-y-3 md:space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"群组名单类型"}),a.jsxs(Lt,{value:t.chat.group_list_type,onValueChange:i=>e({...t,chat:{...t.chat,group_list_type:i}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),a.jsx(Pe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsx(te,{className:"text-sm md:text-base",children:"群组列表"}),a.jsxs(ie,{onClick:()=>n("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(io,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),t.chat.group_list.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ae,{type:"number",value:i,onChange:c=>s("group",l,parseInt(c.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:["确定要删除群号 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>r("group",l),children:"删除"})]})]})]})]},l)),t.chat.group_list.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),a.jsxs("div",{className:"space-y-3 md:space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"私聊名单类型"}),a.jsxs(Lt,{value:t.chat.private_list_type,onValueChange:i=>e({...t,chat:{...t.chat,private_list_type:i}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),a.jsx(Pe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsx(te,{className:"text-sm md:text-base",children:"私聊列表"}),a.jsxs(ie,{onClick:()=>n("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(io,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.private_list.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ae,{type:"number",value:i,onChange:c=>s("private",l,parseInt(c.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:["确定要删除用户 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>r("private",l),children:"删除"})]})]})]})]},l)),t.chat.private_list.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"全局禁止名单"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),a.jsxs(ie,{onClick:()=>n("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(io,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.ban_user_id.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ae,{type:"number",value:i,onChange:c=>s("ban",l,parseInt(c.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:["确定要从全局禁止名单中删除用户 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>r("ban",l),children:"删除"})]})]})]})]},l)),t.chat.ban_user_id.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),a.jsx(jt,{checked:t.chat.ban_qq_bot,onCheckedChange:i=>e({...t,chat:{...t.chat,ban_qq_bot:i}})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),a.jsx(jt,{checked:t.chat.enable_poke,onCheckedChange:i=>e({...t,chat:{...t.chat,enable_poke:i}})})]})]})]})})}function Hte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),a.jsx(jt,{checked:t.voice.use_tts,onCheckedChange:n=>e({...t,voice:{use_tts:n}})})]})]})})}function Ute({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),a.jsx("div",{className:"grid gap-3 md:gap-4",children:a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"日志等级"}),a.jsxs(Lt,{value:t.debug.level,onValueChange:n=>e({...t,debug:{level:n}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"DEBUG",children:"DEBUG(调试)"}),a.jsx(Pe,{value:"INFO",children:"INFO(信息)"}),a.jsx(Pe,{value:"WARNING",children:"WARNING(警告)"}),a.jsx(Pe,{value:"ERROR",children:"ERROR(错误)"}),a.jsx(Pe,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function u8(t){const e=[],n=String(t||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const l=n.slice(s,r).trim();(l||!i)&&e.push(l),s=r+1,r=n.indexOf(",",s)}return e}function Vte(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Wte=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Gte=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xte={};function d8(t,e){return(Xte.jsx?Gte:Wte).test(t)}const Yte=/[ \t\n\f\r]/g;function Kte(t){return typeof t=="object"?t.type==="text"?h8(t.value):!1:h8(t)}function h8(t){return t.replace(Yte,"")===""}class x0{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}x0.prototype.normal={};x0.prototype.property={};x0.prototype.space=void 0;function Z_(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new x0(n,r,e)}function Pf(t){return t.toLowerCase()}class Is{constructor(e,n){this.attribute=n,this.property=e}}Is.prototype.attribute="";Is.prototype.booleanish=!1;Is.prototype.boolean=!1;Is.prototype.commaOrSpaceSeparated=!1;Is.prototype.commaSeparated=!1;Is.prototype.defined=!1;Is.prototype.mustUseProperty=!1;Is.prototype.number=!1;Is.prototype.overloadedBoolean=!1;Is.prototype.property="";Is.prototype.spaceSeparated=!1;Is.prototype.space=void 0;let Zte=0;const Ot=Dc(),mr=Dc(),h4=Dc(),ze=Dc(),Bn=Dc(),Ju=Dc(),Zs=Dc();function Dc(){return 2**++Zte}const f4=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ot,booleanish:mr,commaOrSpaceSeparated:Zs,commaSeparated:Ju,number:ze,overloadedBoolean:h4,spaceSeparated:Bn},Symbol.toStringTag,{value:"Module"})),hb=Object.keys(f4);class c5 extends Is{constructor(e,n,r,s){let i=-1;if(super(e,n),f8(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&rne.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(m8,ine);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!m8.test(i)){let l=i.replace(nne,sne);l.charAt(0)!=="-"&&(l="-"+l),e="data"+l}}s=c5}return new s(r,e)}function sne(t){return"-"+t.toLowerCase()}function ine(t){return t.charAt(1).toUpperCase()}const aD=Z_([J_,Jte,nD,rD,sD],"html"),Lx=Z_([J_,ene,nD,rD,sD],"svg");function p8(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function ane(t){return t.join(" ").trim()}var Nu={},fb,g8;function lne(){if(g8)return fb;g8=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,d=` +`,h="/",m="*",p="",x="comment",v="declaration";function b(O,j){if(typeof O!="string")throw new TypeError("First argument must be a string");if(!O)return[];j=j||{};var T=1,M=1;function _(W){var J=W.match(e);J&&(T+=J.length);var H=W.lastIndexOf(d);M=~H?W.length-H:M+W.length}function D(){var W={line:T,column:M};return function(J){return J.position=new E(W),F(),J}}function E(W){this.start=W,this.end={line:T,column:M},this.source=j.source}E.prototype.content=O;function z(W){var J=new Error(j.source+":"+T+":"+M+": "+W);if(J.reason=W,J.filename=j.source,J.line=T,J.column=M,J.source=O,!j.silent)throw J}function Q(W){var J=W.exec(O);if(J){var H=J[0];return _(H),O=O.slice(H.length),J}}function F(){Q(n)}function L(W){var J;for(W=W||[];J=U();)J!==!1&&W.push(J);return W}function U(){var W=D();if(!(h!=O.charAt(0)||m!=O.charAt(1))){for(var J=2;p!=O.charAt(J)&&(m!=O.charAt(J)||h!=O.charAt(J+1));)++J;if(J+=2,p===O.charAt(J-1))return z("End of comment missing");var H=O.slice(2,J-2);return M+=2,_(H),O=O.slice(J),M+=2,W({type:x,comment:H})}}function V(){var W=D(),J=Q(r);if(J){if(U(),!Q(s))return z("property missing ':'");var H=Q(i),ae=W({type:v,property:k(J[0].replace(t,p)),value:H?k(H[0].replace(t,p)):p});return Q(l),ae}}function ce(){var W=[];L(W);for(var J;J=V();)J!==!1&&(W.push(J),L(W));return W}return F(),ce()}function k(O){return O?O.replace(c,p):p}return fb=b,fb}var x8;function one(){if(x8)return Nu;x8=1;var t=Nu&&Nu.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Nu,"__esModule",{value:!0}),Nu.default=n;const e=t(lne());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const l=(0,e.default)(r),c=typeof s=="function";return l.forEach(d=>{if(d.type!=="declaration")return;const{property:h,value:m}=d;c?s(h,m,d):m&&(i=i||{},i[h]=m)}),i}return Nu}var Lh={},v8;function cne(){if(v8)return Lh;v8=1,Object.defineProperty(Lh,"__esModule",{value:!0}),Lh.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(h){return!h||n.test(h)||t.test(h)},l=function(h,m){return m.toUpperCase()},c=function(h,m){return"".concat(m,"-")},d=function(h,m){return m===void 0&&(m={}),i(h)?h:(h=h.toLowerCase(),m.reactCompat?h=h.replace(s,c):h=h.replace(r,c),h.replace(e,l))};return Lh.camelCase=d,Lh}var Ih,y8;function une(){if(y8)return Ih;y8=1;var t=Ih&&Ih.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(one()),n=cne();function r(s,i){var l={};return!s||typeof s!="string"||(0,e.default)(s,function(c,d){c&&d&&(l[(0,n.camelCase)(c,i)]=d)}),l}return r.default=r,Ih=r,Ih}var dne=une();const hne=u9(dne),lD=oD("end"),u5=oD("start");function oD(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function fne(t){const e=u5(t),n=lD(t);if(e&&n)return{start:e,end:n}}function af(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?b8(t.position):"start"in t||"end"in t?b8(t):"line"in t||"column"in t?m4(t):""}function m4(t){return w8(t&&t.line)+":"+w8(t&&t.column)}function b8(t){return m4(t&&t.start)+"-"+m4(t&&t.end)}function w8(t){return t&&typeof t=="number"?t:1}class as extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},l=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?s=e:!i.cause&&e&&(l=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?i.ruleId=r:(i.source=r.slice(0,d),i.ruleId=r.slice(d+1))}if(!i.place&&i.ancestors&&i.ancestors){const d=i.ancestors[i.ancestors.length-1];d&&(i.place=d.position)}const c=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=c?c.line:void 0,this.name=af(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=l&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}as.prototype.file="";as.prototype.name="";as.prototype.reason="";as.prototype.message="";as.prototype.stack="";as.prototype.column=void 0;as.prototype.line=void 0;as.prototype.ancestors=void 0;as.prototype.cause=void 0;as.prototype.fatal=void 0;as.prototype.place=void 0;as.prototype.ruleId=void 0;as.prototype.source=void 0;const d5={}.hasOwnProperty,mne=new Map,pne=/[A-Z]/g,gne=new Set(["table","tbody","thead","tfoot","tr"]),xne=new Set(["td","th"]),cD="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function vne(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Nne(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=jne(n,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?Lx:aD,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=uD(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function uD(t,e,n){if(e.type==="element")return yne(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return bne(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return Sne(t,e,n);if(e.type==="mdxjsEsm")return wne(t,e);if(e.type==="root")return kne(t,e,n);if(e.type==="text")return One(t,e)}function yne(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Lx,t.schema=s),t.ancestors.push(e);const i=hD(t,e.tagName,!1),l=Cne(t,e);let c=f5(t,e);return gne.has(e.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!Kte(d):!0})),dD(t,l,i,e),h5(l,c),t.ancestors.pop(),t.schema=r,t.create(e,i,l,n)}function bne(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}Bf(t,e.position)}function wne(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Bf(t,e.position)}function Sne(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=Lx,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:hD(t,e.name,!0),l=Tne(t,e),c=f5(t,e);return dD(t,l,i,e),h5(l,c),t.ancestors.pop(),t.schema=r,t.create(e,i,l,n)}function kne(t,e,n){const r={};return h5(r,f5(t,e)),t.create(e,t.Fragment,r,n)}function One(t,e){return e.value}function dD(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function h5(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function jne(t,e,n){return r;function r(s,i,l,c){const h=Array.isArray(l.children)?n:e;return c?h(i,l,c):h(i,l)}}function Nne(t,e){return n;function n(r,s,i,l){const c=Array.isArray(i.children),d=u5(r);return e(s,i,l,c,{columnNumber:d?d.column-1:void 0,fileName:t,lineNumber:d?d.line:void 0},void 0)}}function Cne(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&d5.call(e.properties,s)){const i=Mne(t,s,e.properties[s]);if(i){const[l,c]=i;t.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&xne.has(e.tagName)?r=c:n[l]=c}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Tne(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const l=i.expression;l.type;const c=l.properties[0];c.type,Object.assign(n,t.evaluater.evaluateExpression(c.argument))}else Bf(t,e.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const c=r.value.data.estree.body[0];c.type,i=t.evaluater.evaluateExpression(c.expression)}else Bf(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function f5(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:mne;for(;++rs?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(e,n),t.splice(...l);else for(n&&t.splice(e,n);i0?(ri(t,t.length,0,e),t):e}const O8={}.hasOwnProperty;function mD(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function qi(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ds=To(/[A-Za-z]/),rs=To(/[\dA-Za-z]/),Lne=To(/[#-'*+\--9=?A-Z^-~]/);function Hg(t){return t!==null&&(t<32||t===127)}const p4=To(/\d/),Ine=To(/[\dA-Fa-f]/),qne=To(/[!-/:-@[-`{-~]/);function Ze(t){return t!==null&&t<-2}function Rn(t){return t!==null&&(t<0||t===32)}function qt(t){return t===-2||t===-1||t===32}const Ix=To(new RegExp("\\p{P}|\\p{S}","u")),Cc=To(/\s/);function To(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Dd(t){const e=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const c=t.charCodeAt(n+1);i<56320&&c>56319&&c<57344?(l=String.fromCharCode(i,c),s=1):l="�"}else l=String.fromCharCode(i);l&&(e.push(t.slice(r,n),encodeURIComponent(l)),r=n+s+1,l=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function zt(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return l;function l(d){return qt(d)?(t.enter(n),c(d)):e(d)}function c(d){return qt(d)&&i++l))return;const z=e.events.length;let Q=z,F,L;for(;Q--;)if(e.events[Q][0]==="exit"&&e.events[Q][1].type==="chunkFlow"){if(F){L=e.events[Q][1].end;break}F=!0}for(j(r),E=z;EM;){const D=n[_];e.containerState=D[1],D[0].exit.call(e,t)}n.length=M}function T(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function Une(t,e,n){return zt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function vd(t){if(t===null||Rn(t)||Cc(t))return 1;if(Ix(t))return 2}function qx(t,e,n){const r=[];let s=-1;for(;++s1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const p={...t[r][1].end},x={...t[n][1].start};N8(p,-d),N8(x,d),l={type:d>1?"strongSequence":"emphasisSequence",start:p,end:{...t[r][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:x},i={type:d>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:d>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},t[r][1].end={...l.start},t[n][1].start={...c.end},h=[],t[r][1].end.offset-t[r][1].start.offset&&(h=yi(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=yi(h,[["enter",s,e],["enter",l,e],["exit",l,e],["enter",i,e]]),h=yi(h,qx(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=yi(h,[["exit",i,e],["enter",c,e],["exit",c,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(m=2,h=yi(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):m=0,ri(t,r-1,n-r+3,h),n=r+h.length-m-2;break}}for(n=-1;++n0&&qt(E)?zt(t,T,"linePrefix",i+1)(E):T(E)}function T(E){return E===null||Ze(E)?t.check(C8,k,_)(E):(t.enter("codeFlowValue"),M(E))}function M(E){return E===null||Ze(E)?(t.exit("codeFlowValue"),T(E)):(t.consume(E),M)}function _(E){return t.exit("codeFenced"),e(E)}function D(E,z,Q){let F=0;return L;function L(J){return E.enter("lineEnding"),E.consume(J),E.exit("lineEnding"),U}function U(J){return E.enter("codeFencedFence"),qt(J)?zt(E,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(J):V(J)}function V(J){return J===c?(E.enter("codeFencedFenceSequence"),ce(J)):Q(J)}function ce(J){return J===c?(F++,E.consume(J),ce):F>=l?(E.exit("codeFencedFenceSequence"),qt(J)?zt(E,W,"whitespace")(J):W(J)):Q(J)}function W(J){return J===null||Ze(J)?(E.exit("codeFencedFence"),z(J)):Q(J)}}}function rre(t,e,n){const r=this;return s;function s(l){return l===null?n(l):(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i)}function i(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}const pb={name:"codeIndented",tokenize:ire},sre={partial:!0,tokenize:are};function ire(t,e,n){const r=this;return s;function s(h){return t.enter("codeIndented"),zt(t,i,"linePrefix",5)(h)}function i(h){const m=r.events[r.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(h):n(h)}function l(h){return h===null?d(h):Ze(h)?t.attempt(sre,l,d)(h):(t.enter("codeFlowValue"),c(h))}function c(h){return h===null||Ze(h)?(t.exit("codeFlowValue"),l(h)):(t.consume(h),c)}function d(h){return t.exit("codeIndented"),e(h)}}function are(t,e,n){const r=this;return s;function s(l){return r.parser.lazy[r.now().line]?n(l):Ze(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),s):zt(t,i,"linePrefix",5)(l)}function i(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(l):Ze(l)?s(l):n(l)}}const lre={name:"codeText",previous:cre,resolve:ore,tokenize:ure};function ore(t){let e=t.length-4,n=3,r,s;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&qh(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),qh(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),qh(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(l):t.interrupt(r.parser.constructs.flow,n,e)(l)}}function bD(t,e,n,r,s,i,l,c,d){const h=d||Number.POSITIVE_INFINITY;let m=0;return p;function p(j){return j===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(j),t.exit(i),x):j===null||j===32||j===41||Hg(j)?n(j):(t.enter(r),t.enter(l),t.enter(c),t.enter("chunkString",{contentType:"string"}),k(j))}function x(j){return j===62?(t.enter(i),t.consume(j),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(c),t.enter("chunkString",{contentType:"string"}),v(j))}function v(j){return j===62?(t.exit("chunkString"),t.exit(c),x(j)):j===null||j===60||Ze(j)?n(j):(t.consume(j),j===92?b:v)}function b(j){return j===60||j===62||j===92?(t.consume(j),v):v(j)}function k(j){return!m&&(j===null||j===41||Rn(j))?(t.exit("chunkString"),t.exit(c),t.exit(l),t.exit(r),e(j)):m999||v===null||v===91||v===93&&!d||v===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(v):v===93?(t.exit(i),t.enter(s),t.consume(v),t.exit(s),t.exit(r),e):Ze(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),m):(t.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===null||v===91||v===93||Ze(v)||c++>999?(t.exit("chunkString"),m(v)):(t.consume(v),d||(d=!qt(v)),v===92?x:p)}function x(v){return v===91||v===92||v===93?(t.consume(v),c++,p):p(v)}}function SD(t,e,n,r,s,i){let l;return c;function c(x){return x===34||x===39||x===40?(t.enter(r),t.enter(s),t.consume(x),t.exit(s),l=x===40?41:x,d):n(x)}function d(x){return x===l?(t.enter(s),t.consume(x),t.exit(s),t.exit(r),e):(t.enter(i),h(x))}function h(x){return x===l?(t.exit(i),d(l)):x===null?n(x):Ze(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),zt(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===l||x===null||Ze(x)?(t.exit("chunkString"),h(x)):(t.consume(x),x===92?p:m)}function p(x){return x===l||x===92?(t.consume(x),m):m(x)}}function lf(t,e){let n;return r;function r(s){return Ze(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):qt(s)?zt(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const vre={name:"definition",tokenize:bre},yre={partial:!0,tokenize:wre};function bre(t,e,n){const r=this;let s;return i;function i(v){return t.enter("definition"),l(v)}function l(v){return wD.call(r,t,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function c(v){return s=qi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),d):n(v)}function d(v){return Rn(v)?lf(t,h)(v):h(v)}function h(v){return bD(t,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function m(v){return t.attempt(yre,p,p)(v)}function p(v){return qt(v)?zt(t,x,"whitespace")(v):x(v)}function x(v){return v===null||Ze(v)?(t.exit("definition"),r.parser.defined.push(s),e(v)):n(v)}}function wre(t,e,n){return r;function r(c){return Rn(c)?lf(t,s)(c):n(c)}function s(c){return SD(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function i(c){return qt(c)?zt(t,l,"whitespace")(c):l(c)}function l(c){return c===null||Ze(c)?e(c):n(c)}}const Sre={name:"hardBreakEscape",tokenize:kre};function kre(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return Ze(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const Ore={name:"headingAtx",resolve:jre,tokenize:Nre};function jre(t,e){let n=t.length-2,r=3,s,i;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},ri(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function Nre(t,e,n){let r=0;return s;function s(m){return t.enter("atxHeading"),i(m)}function i(m){return t.enter("atxHeadingSequence"),l(m)}function l(m){return m===35&&r++<6?(t.consume(m),l):m===null||Rn(m)?(t.exit("atxHeadingSequence"),c(m)):n(m)}function c(m){return m===35?(t.enter("atxHeadingSequence"),d(m)):m===null||Ze(m)?(t.exit("atxHeading"),e(m)):qt(m)?zt(t,c,"whitespace")(m):(t.enter("atxHeadingText"),h(m))}function d(m){return m===35?(t.consume(m),d):(t.exit("atxHeadingSequence"),c(m))}function h(m){return m===null||m===35||Rn(m)?(t.exit("atxHeadingText"),c(m)):(t.consume(m),h)}}const Cre=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],M8=["pre","script","style","textarea"],Tre={concrete:!0,name:"htmlFlow",resolveTo:Ere,tokenize:_re},Mre={partial:!0,tokenize:Rre},Are={partial:!0,tokenize:Dre};function Ere(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function _re(t,e,n){const r=this;let s,i,l,c,d;return h;function h(P){return m(P)}function m(P){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(P),p}function p(P){return P===33?(t.consume(P),x):P===47?(t.consume(P),i=!0,k):P===63?(t.consume(P),s=3,r.interrupt?e:R):ds(P)?(t.consume(P),l=String.fromCharCode(P),O):n(P)}function x(P){return P===45?(t.consume(P),s=2,v):P===91?(t.consume(P),s=5,c=0,b):ds(P)?(t.consume(P),s=4,r.interrupt?e:R):n(P)}function v(P){return P===45?(t.consume(P),r.interrupt?e:R):n(P)}function b(P){const K="CDATA[";return P===K.charCodeAt(c++)?(t.consume(P),c===K.length?r.interrupt?e:V:b):n(P)}function k(P){return ds(P)?(t.consume(P),l=String.fromCharCode(P),O):n(P)}function O(P){if(P===null||P===47||P===62||Rn(P)){const K=P===47,$=l.toLowerCase();return!K&&!i&&M8.includes($)?(s=1,r.interrupt?e(P):V(P)):Cre.includes(l.toLowerCase())?(s=6,K?(t.consume(P),j):r.interrupt?e(P):V(P)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):i?T(P):M(P))}return P===45||rs(P)?(t.consume(P),l+=String.fromCharCode(P),O):n(P)}function j(P){return P===62?(t.consume(P),r.interrupt?e:V):n(P)}function T(P){return qt(P)?(t.consume(P),T):L(P)}function M(P){return P===47?(t.consume(P),L):P===58||P===95||ds(P)?(t.consume(P),_):qt(P)?(t.consume(P),M):L(P)}function _(P){return P===45||P===46||P===58||P===95||rs(P)?(t.consume(P),_):D(P)}function D(P){return P===61?(t.consume(P),E):qt(P)?(t.consume(P),D):M(P)}function E(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(t.consume(P),d=P,z):qt(P)?(t.consume(P),E):Q(P)}function z(P){return P===d?(t.consume(P),d=null,F):P===null||Ze(P)?n(P):(t.consume(P),z)}function Q(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||Rn(P)?D(P):(t.consume(P),Q)}function F(P){return P===47||P===62||qt(P)?M(P):n(P)}function L(P){return P===62?(t.consume(P),U):n(P)}function U(P){return P===null||Ze(P)?V(P):qt(P)?(t.consume(P),U):n(P)}function V(P){return P===45&&s===2?(t.consume(P),H):P===60&&s===1?(t.consume(P),ae):P===62&&s===4?(t.consume(P),me):P===63&&s===3?(t.consume(P),R):P===93&&s===5?(t.consume(P),ue):Ze(P)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(Mre,Y,ce)(P)):P===null||Ze(P)?(t.exit("htmlFlowData"),ce(P)):(t.consume(P),V)}function ce(P){return t.check(Are,W,Y)(P)}function W(P){return t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),J}function J(P){return P===null||Ze(P)?ce(P):(t.enter("htmlFlowData"),V(P))}function H(P){return P===45?(t.consume(P),R):V(P)}function ae(P){return P===47?(t.consume(P),l="",ne):V(P)}function ne(P){if(P===62){const K=l.toLowerCase();return M8.includes(K)?(t.consume(P),me):V(P)}return ds(P)&&l.length<8?(t.consume(P),l+=String.fromCharCode(P),ne):V(P)}function ue(P){return P===93?(t.consume(P),R):V(P)}function R(P){return P===62?(t.consume(P),me):P===45&&s===2?(t.consume(P),R):V(P)}function me(P){return P===null||Ze(P)?(t.exit("htmlFlowData"),Y(P)):(t.consume(P),me)}function Y(P){return t.exit("htmlFlow"),e(P)}}function Dre(t,e,n){const r=this;return s;function s(l){return Ze(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i):n(l)}function i(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}function Rre(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(v0,e,n)}}const zre={name:"htmlText",tokenize:Pre};function Pre(t,e,n){const r=this;let s,i,l;return c;function c(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),d}function d(R){return R===33?(t.consume(R),h):R===47?(t.consume(R),D):R===63?(t.consume(R),M):ds(R)?(t.consume(R),Q):n(R)}function h(R){return R===45?(t.consume(R),m):R===91?(t.consume(R),i=0,b):ds(R)?(t.consume(R),T):n(R)}function m(R){return R===45?(t.consume(R),v):n(R)}function p(R){return R===null?n(R):R===45?(t.consume(R),x):Ze(R)?(l=p,ae(R)):(t.consume(R),p)}function x(R){return R===45?(t.consume(R),v):p(R)}function v(R){return R===62?H(R):R===45?x(R):p(R)}function b(R){const me="CDATA[";return R===me.charCodeAt(i++)?(t.consume(R),i===me.length?k:b):n(R)}function k(R){return R===null?n(R):R===93?(t.consume(R),O):Ze(R)?(l=k,ae(R)):(t.consume(R),k)}function O(R){return R===93?(t.consume(R),j):k(R)}function j(R){return R===62?H(R):R===93?(t.consume(R),j):k(R)}function T(R){return R===null||R===62?H(R):Ze(R)?(l=T,ae(R)):(t.consume(R),T)}function M(R){return R===null?n(R):R===63?(t.consume(R),_):Ze(R)?(l=M,ae(R)):(t.consume(R),M)}function _(R){return R===62?H(R):M(R)}function D(R){return ds(R)?(t.consume(R),E):n(R)}function E(R){return R===45||rs(R)?(t.consume(R),E):z(R)}function z(R){return Ze(R)?(l=z,ae(R)):qt(R)?(t.consume(R),z):H(R)}function Q(R){return R===45||rs(R)?(t.consume(R),Q):R===47||R===62||Rn(R)?F(R):n(R)}function F(R){return R===47?(t.consume(R),H):R===58||R===95||ds(R)?(t.consume(R),L):Ze(R)?(l=F,ae(R)):qt(R)?(t.consume(R),F):H(R)}function L(R){return R===45||R===46||R===58||R===95||rs(R)?(t.consume(R),L):U(R)}function U(R){return R===61?(t.consume(R),V):Ze(R)?(l=U,ae(R)):qt(R)?(t.consume(R),U):F(R)}function V(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),s=R,ce):Ze(R)?(l=V,ae(R)):qt(R)?(t.consume(R),V):(t.consume(R),W)}function ce(R){return R===s?(t.consume(R),s=void 0,J):R===null?n(R):Ze(R)?(l=ce,ae(R)):(t.consume(R),ce)}function W(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Rn(R)?F(R):(t.consume(R),W)}function J(R){return R===47||R===62||Rn(R)?F(R):n(R)}function H(R){return R===62?(t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),e):n(R)}function ae(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),ne}function ne(R){return qt(R)?zt(t,ue,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):ue(R)}function ue(R){return t.enter("htmlTextData"),l(R)}}const g5={name:"labelEnd",resolveAll:qre,resolveTo:Fre,tokenize:Qre},Bre={tokenize:$re},Lre={tokenize:Hre},Ire={tokenize:Ure};function qre(t){let e=-1;const n=[];for(;++e=3&&(h===null||Ze(h))?(t.exit("thematicBreak"),e(h)):n(h)}function d(h){return h===s?(t.consume(h),r++,d):(t.exit("thematicBreakSequence"),qt(h)?zt(t,c,"whitespace")(h):c(h))}}const Ns={continuation:{tokenize:tse},exit:rse,name:"list",tokenize:ese},Zre={partial:!0,tokenize:sse},Jre={partial:!0,tokenize:nse};function ese(t,e,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,l=0;return c;function c(v){const b=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:p4(v)){if(r.containerState.type||(r.containerState.type=b,t.enter(b,{_container:!0})),b==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(og,n,h)(v):h(v);if(!r.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),d(v)}return n(v)}function d(v){return p4(v)&&++l<10?(t.consume(v),d):(!r.interrupt||l<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),h(v)):n(v)}function h(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,t.check(v0,r.interrupt?n:m,t.attempt(Zre,x,p))}function m(v){return r.containerState.initialBlankLine=!0,i++,x(v)}function p(v){return qt(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),x):n(v)}function x(v){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(v)}}function tse(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(v0,s,i);function s(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,zt(t,e,"listItemIndent",r.containerState.size+1)(c)}function i(c){return r.containerState.furtherBlankLines||!qt(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(Jre,e,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,zt(t,t.attempt(Ns,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function nse(t,e,n){const r=this;return zt(t,s,"listItemIndent",r.containerState.size+1);function s(i){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?e(i):n(i)}}function rse(t){t.exit(this.containerState.type)}function sse(t,e,n){const r=this;return zt(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const l=r.events[r.events.length-1];return!qt(i)&&l&&l[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const A8={name:"setextUnderline",resolveTo:ise,tokenize:ase};function ise(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const l={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",l,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=l,t.push(["exit",l,e]),t}function ase(t,e,n){const r=this;let s;return i;function i(h){let m=r.events.length,p;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){p=r.events[m][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(t.enter("setextHeadingLine"),s=h,l(h)):n(h)}function l(h){return t.enter("setextHeadingLineSequence"),c(h)}function c(h){return h===s?(t.consume(h),c):(t.exit("setextHeadingLineSequence"),qt(h)?zt(t,d,"lineSuffix")(h):d(h))}function d(h){return h===null||Ze(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const lse={tokenize:ose};function ose(t){const e=this,n=t.attempt(v0,r,t.attempt(this.parser.constructs.flowInitial,s,zt(t,t.attempt(this.parser.constructs.flow,s,t.attempt(fre,s)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const cse={resolveAll:OD()},use=kD("string"),dse=kD("text");function kD(t){return{resolveAll:OD(t==="text"?hse:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,l,c);return l;function l(m){return h(m)?i(m):c(m)}function c(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),d}function d(m){return h(m)?(n.exit("data"),i(m)):(n.consume(m),d)}function h(m){if(m===null)return!0;const p=s[m];let x=-1;if(p)for(;++x-1){const c=l[0];typeof c=="string"?l[0]=c.slice(r):l.shift()}i>0&&l.push(t[s].slice(0,i))}return l}function jse(t,e){let n=-1;const r=[];let s;for(;++n0){const cr=Be.tokenStack[Be.tokenStack.length-1];(cr[1]||_8).call(Be,void 0,cr[0])}for(Se.position={start:Xl(ee.length>0?ee[0][1].start:{line:1,column:1,offset:0}),end:Xl(ee.length>0?ee[ee.length-2][1].end:{line:1,column:1,offset:0})},Tt=-1;++Tt0){const cr=Be.tokenStack[Be.tokenStack.length-1];(cr[1]||_8).call(Be,void 0,cr[0])}for(Se.position={start:Gl(ee.length>0?ee[0][1].start:{line:1,column:1,offset:0}),end:Gl(ee.length>0?ee[ee.length-2][1].end:{line:1,column:1,offset:0})},Tt=-1;++Tt1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};t.patch(e,d);const h={type:"element",tagName:"sup",properties:{},children:[d]};return t.patch(e,h),t.applyData(e,h)}function Qse(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function $se(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function CD(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const l=s[s.length-1];return l&&l.type==="text"?l.value+=r:s.push({type:"text",value:r}),s}function Hse(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return CD(t,e);const s={src:Dd(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,i),t.applyData(e,i)}function Use(t,e){const n={src:Dd(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function Vse(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function Wse(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return CD(t,e);const s={href:Dd(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function Gse(t,e){const n={href:Dd(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Xse(t,e,n){const r=t.all(e),s=n?Yse(n):TD(e),i={},l=[];if(typeof e.checked=="boolean"){const m=r[0];let p;m&&m.type==="element"&&m.tagName==="p"?p=m:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let c=-1;for(;++c1}function Kse(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s0){const l={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},c=u5(e.children[1]),d=lD(e.children[e.children.length-1]);c&&d&&(l.position={start:c,end:d}),s.push(l)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function nie(t,e,n){const r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,c=l?l.length:e.children.length;let d=-1;const h=[];for(;++d0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return i.push(z8(e.slice(s),s>0,!1)),i.join("")}function z8(t,e,n){let r=0,s=t.length;if(e){let i=t.codePointAt(r);for(;i===D8||i===R8;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(s-1);for(;i===D8||i===R8;)s--,i=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function iie(t,e){const n={type:"text",value:sie(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function aie(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const lie={blockquote:Pse,break:Bse,code:Lse,delete:Ise,emphasis:qse,footnoteReference:Fse,heading:Qse,html:$se,imageReference:Hse,image:Use,inlineCode:Vse,linkReference:Wse,link:Gse,listItem:Xse,list:Kse,paragraph:Zse,root:Jse,strong:eie,table:tie,tableCell:rie,tableRow:nie,text:iie,thematicBreak:aie,toml:Op,yaml:Op,definition:Op,footnoteDefinition:Op};function Op(){}const AD=-1,Fx=0,of=1,Ug=2,x5=3,v5=4,y5=5,b5=6,MD=7,ED=8,P8=typeof self=="object"?self:globalThis,oie=(t,e)=>{const n=(s,i)=>(t.set(i,s),s),r=s=>{if(t.has(s))return t.get(s);const[i,l]=e[s];switch(i){case Fx:case AD:return n(l,s);case of:{const c=n([],s);for(const d of l)c.push(r(d));return c}case Ug:{const c=n({},s);for(const[d,h]of l)c[r(d)]=r(h);return c}case x5:return n(new Date(l),s);case v5:{const{source:c,flags:d}=l;return n(new RegExp(c,d),s)}case y5:{const c=n(new Map,s);for(const[d,h]of l)c.set(r(d),r(h));return c}case b5:{const c=n(new Set,s);for(const d of l)c.add(r(d));return c}case MD:{const{name:c,message:d}=l;return n(new P8[c](d),s)}case ED:return n(BigInt(l),s);case"BigInt":return n(Object(BigInt(l)),s);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:c}=new Uint8Array(l);return n(new DataView(c),l)}}return n(new P8[i](l),s)};return r},B8=t=>oie(new Map,t)(0),Cu="",{toString:cie}={},{keys:uie}=Object,Fh=t=>{const e=typeof t;if(e!=="object"||!t)return[Fx,e];const n=cie.call(t).slice(8,-1);switch(n){case"Array":return[of,Cu];case"Object":return[Ug,Cu];case"Date":return[x5,Cu];case"RegExp":return[v5,Cu];case"Map":return[y5,Cu];case"Set":return[b5,Cu];case"DataView":return[of,n]}return n.includes("Array")?[of,n]:n.includes("Error")?[MD,n]:[Ug,n]},jp=([t,e])=>t===Fx&&(e==="function"||e==="symbol"),die=(t,e,n,r)=>{const s=(l,c)=>{const d=r.push(l)-1;return n.set(c,d),d},i=l=>{if(n.has(l))return n.get(l);let[c,d]=Fh(l);switch(c){case Fx:{let m=l;switch(d){case"bigint":c=ED,m=l.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+d);m=null;break;case"undefined":return s([AD],l)}return s([c,m],l)}case of:{if(d){let x=l;return d==="DataView"?x=new Uint8Array(l.buffer):d==="ArrayBuffer"&&(x=new Uint8Array(l)),s([d,[...x]],l)}const m=[],p=s([c,m],l);for(const x of l)m.push(i(x));return p}case Ug:{if(d)switch(d){case"BigInt":return s([d,l.toString()],l);case"Boolean":case"Number":case"String":return s([d,l.valueOf()],l)}if(e&&"toJSON"in l)return i(l.toJSON());const m=[],p=s([c,m],l);for(const x of uie(l))(t||!jp(Fh(l[x])))&&m.push([i(x),i(l[x])]);return p}case x5:return s([c,l.toISOString()],l);case v5:{const{source:m,flags:p}=l;return s([c,{source:m,flags:p}],l)}case y5:{const m=[],p=s([c,m],l);for(const[x,v]of l)(t||!(jp(Fh(x))||jp(Fh(v))))&&m.push([i(x),i(v)]);return p}case b5:{const m=[],p=s([c,m],l);for(const x of l)(t||!jp(Fh(x)))&&m.push(i(x));return p}}const{message:h}=l;return s([c,{name:d,message:h}],l)};return i},L8=(t,{json:e,lossy:n}={})=>{const r=[];return die(!(e||n),!!e,new Map,r)(t),r},Vg=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?B8(L8(t,e)):structuredClone(t):(t,e)=>B8(L8(t,e));function hie(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function fie(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function mie(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||hie,r=t.options.footnoteBackLabel||fie,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",l=t.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let d=-1;for(;++d0&&b.push({type:"text",value:" "});let T=typeof n=="string"?n:n(d,v);typeof T=="string"&&(T={type:"text",value:T}),b.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+x+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(d,v),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}const O=m[m.length-1];if(O&&O.type==="element"&&O.tagName==="p"){const T=O.children[O.children.length-1];T&&T.type==="text"?T.value+=" ":O.children.push({type:"text",value:" "}),O.children.push(...b)}else m.push(...b);const j={type:"element",tagName:"li",properties:{id:e+"fn-"+x},children:t.wrap(m,!0)};t.patch(h,j),c.push(j)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Vg(l),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` +`});const h={type:"element",tagName:"li",properties:i,children:l};return t.patch(e,h),t.applyData(e,h)}function Yse(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r1}function Kse(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s0){const l={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},c=u5(e.children[1]),d=lD(e.children[e.children.length-1]);c&&d&&(l.position={start:c,end:d}),s.push(l)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function nie(t,e,n){const r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,c=l?l.length:e.children.length;let d=-1;const h=[];for(;++d0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return i.push(z8(e.slice(s),s>0,!1)),i.join("")}function z8(t,e,n){let r=0,s=t.length;if(e){let i=t.codePointAt(r);for(;i===D8||i===R8;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(s-1);for(;i===D8||i===R8;)s--,i=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function iie(t,e){const n={type:"text",value:sie(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function aie(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const lie={blockquote:Pse,break:Bse,code:Lse,delete:Ise,emphasis:qse,footnoteReference:Fse,heading:Qse,html:$se,imageReference:Hse,image:Use,inlineCode:Vse,linkReference:Wse,link:Gse,listItem:Xse,list:Kse,paragraph:Zse,root:Jse,strong:eie,table:tie,tableCell:rie,tableRow:nie,text:iie,thematicBreak:aie,toml:Op,yaml:Op,definition:Op,footnoteDefinition:Op};function Op(){}const MD=-1,Fx=0,of=1,Ug=2,x5=3,v5=4,y5=5,b5=6,AD=7,ED=8,P8=typeof self=="object"?self:globalThis,oie=(t,e)=>{const n=(s,i)=>(t.set(i,s),s),r=s=>{if(t.has(s))return t.get(s);const[i,l]=e[s];switch(i){case Fx:case MD:return n(l,s);case of:{const c=n([],s);for(const d of l)c.push(r(d));return c}case Ug:{const c=n({},s);for(const[d,h]of l)c[r(d)]=r(h);return c}case x5:return n(new Date(l),s);case v5:{const{source:c,flags:d}=l;return n(new RegExp(c,d),s)}case y5:{const c=n(new Map,s);for(const[d,h]of l)c.set(r(d),r(h));return c}case b5:{const c=n(new Set,s);for(const d of l)c.add(r(d));return c}case AD:{const{name:c,message:d}=l;return n(new P8[c](d),s)}case ED:return n(BigInt(l),s);case"BigInt":return n(Object(BigInt(l)),s);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:c}=new Uint8Array(l);return n(new DataView(c),l)}}return n(new P8[i](l),s)};return r},B8=t=>oie(new Map,t)(0),Cu="",{toString:cie}={},{keys:uie}=Object,Fh=t=>{const e=typeof t;if(e!=="object"||!t)return[Fx,e];const n=cie.call(t).slice(8,-1);switch(n){case"Array":return[of,Cu];case"Object":return[Ug,Cu];case"Date":return[x5,Cu];case"RegExp":return[v5,Cu];case"Map":return[y5,Cu];case"Set":return[b5,Cu];case"DataView":return[of,n]}return n.includes("Array")?[of,n]:n.includes("Error")?[AD,n]:[Ug,n]},jp=([t,e])=>t===Fx&&(e==="function"||e==="symbol"),die=(t,e,n,r)=>{const s=(l,c)=>{const d=r.push(l)-1;return n.set(c,d),d},i=l=>{if(n.has(l))return n.get(l);let[c,d]=Fh(l);switch(c){case Fx:{let m=l;switch(d){case"bigint":c=ED,m=l.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+d);m=null;break;case"undefined":return s([MD],l)}return s([c,m],l)}case of:{if(d){let x=l;return d==="DataView"?x=new Uint8Array(l.buffer):d==="ArrayBuffer"&&(x=new Uint8Array(l)),s([d,[...x]],l)}const m=[],p=s([c,m],l);for(const x of l)m.push(i(x));return p}case Ug:{if(d)switch(d){case"BigInt":return s([d,l.toString()],l);case"Boolean":case"Number":case"String":return s([d,l.valueOf()],l)}if(e&&"toJSON"in l)return i(l.toJSON());const m=[],p=s([c,m],l);for(const x of uie(l))(t||!jp(Fh(l[x])))&&m.push([i(x),i(l[x])]);return p}case x5:return s([c,l.toISOString()],l);case v5:{const{source:m,flags:p}=l;return s([c,{source:m,flags:p}],l)}case y5:{const m=[],p=s([c,m],l);for(const[x,v]of l)(t||!(jp(Fh(x))||jp(Fh(v))))&&m.push([i(x),i(v)]);return p}case b5:{const m=[],p=s([c,m],l);for(const x of l)(t||!jp(Fh(x)))&&m.push(i(x));return p}}const{message:h}=l;return s([c,{name:d,message:h}],l)};return i},L8=(t,{json:e,lossy:n}={})=>{const r=[];return die(!(e||n),!!e,new Map,r)(t),r},Vg=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?B8(L8(t,e)):structuredClone(t):(t,e)=>B8(L8(t,e));function hie(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function fie(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function mie(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||hie,r=t.options.footnoteBackLabel||fie,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",l=t.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let d=-1;for(;++d0&&b.push({type:"text",value:" "});let T=typeof n=="string"?n:n(d,v);typeof T=="string"&&(T={type:"text",value:T}),b.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+x+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(d,v),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}const O=m[m.length-1];if(O&&O.type==="element"&&O.tagName==="p"){const T=O.children[O.children.length-1];T&&T.type==="text"?T.value+=" ":O.children.push({type:"text",value:" "}),O.children.push(...b)}else m.push(...b);const j={type:"element",tagName:"li",properties:{id:e+"fn-"+x},children:t.wrap(m,!0)};t.patch(h,j),c.push(j)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Vg(l),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:t.wrap(c,!0)},{type:"text",value:` `}]}}const y0=(function(t){if(t==null)return vie;if(typeof t=="function")return Qx(t);if(typeof t=="object")return Array.isArray(t)?pie(t):gie(t);if(typeof t=="string")return xie(t);throw new Error("Expected function, string, or object as test")});function pie(t){const e=[];let n=-1;for(;++n":""))+")"})}return x;function x(){let v=_D,b,k,O;if((!e||i(d,h,m[m.length-1]||void 0))&&(v=wie(n(d,m)),v[0]===x4))return v;if("children"in d&&d.children){const j=d;if(j.children&&v[0]!==DD)for(k=(r?j.children.length:-1)+l,O=m.concat(j);k>-1&&k0&&n.push({type:"text",value:` `}),n}function I8(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function q8(t,e){const n=kie(t,e),r=n.one(t,void 0),s=mie(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:` -`},s),i}function Tie(t,e){return t&&"run"in t?async function(n,r){const s=q8(n,{file:r,...e});await t.run(s,r)}:function(n,r){return q8(n,{file:r,...t||e})}}function F8(t){if(t)throw t}var xb,Q8;function Aie(){if(Q8)return xb;Q8=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):e.call(h)==="[object Array]"},i=function(h){if(!h||e.call(h)!=="[object Object]")return!1;var m=t.call(h,"constructor"),p=h.constructor&&h.constructor.prototype&&t.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!m&&!p)return!1;var x;for(x in h);return typeof x>"u"||t.call(h,x)},l=function(h,m){n&&m.name==="__proto__"?n(h,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):h[m.name]=m.newValue},c=function(h,m){if(m==="__proto__")if(t.call(h,m)){if(r)return r(h,m).value}else return;return h[m]};return xb=function d(){var h,m,p,x,v,b,k=arguments[0],O=1,j=arguments.length,T=!1;for(typeof k=="boolean"&&(T=k,k=arguments[1]||{},O=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});Ol.length;let d;c&&l.push(s);try{d=t.apply(this,l)}catch(h){const m=h;if(c&&n)throw m;return s(m)}c||(d&&d.then&&typeof d.then=="function"?d.then(i,s):d instanceof Error?s(d):i(d))}function s(l,...c){n||(n=!0,e(l,...c))}function i(l){s(null,l)}}const ia={basename:Die,dirname:Rie,extname:zie,join:Pie,sep:"/"};function Die(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');b0(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let l=-1,c=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else l<0&&(i=!0,l=s+1),c>-1&&(t.codePointAt(s)===e.codePointAt(c--)?c<0&&(r=s):(c=-1,r=l));return n===r?r=l:r<0&&(r=t.length),t.slice(n,r)}function Rie(t){if(b0(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function zie(t){b0(t);let e=t.length,n=-1,r=0,s=-1,i=0,l;for(;e--;){const c=t.codePointAt(e);if(c===47){if(l){r=e+1;break}continue}n<0&&(l=!0,n=e+1),c===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function Pie(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function Lie(t,e){let n="",r=0,s=-1,i=0,l=-1,c,d;for(;++l<=t.length;){if(l2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",r=0):(n=n.slice(0,d),r=n.length-1-n.lastIndexOf("/")),s=l,i=0;continue}}else if(n.length>0){n="",r=0,s=l,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,l):n=t.slice(s+1,l),r=l-s-1;s=l,i=0}else c===46&&i>-1?i++:i=-1}return n}function b0(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Iie={cwd:qie};function qie(){return"/"}function b4(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function Fie(t){if(typeof t=="string")t=new URL(t);else if(!b4(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Qie(t)}function Qie(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[v,...b]=m;const k=r[x][1];y4(k)&&y4(v)&&(v=vb(!0,k,v)),r[x]=[h,v,...b]}}}}const Vie=new k5().freeze();function Sb(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function kb(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Ob(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function H8(t){if(!y4(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function U8(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Np(t){return Wie(t)?t:new RD(t)}function Wie(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Gie(t){return typeof t=="string"||Xie(t)}function Xie(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Yie="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",V8=[],W8={allowDangerousHtml:!0},Kie=/^(https?|ircs?|mailto|xmpp)$/i,Zie=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Jie(t){const e=eae(t),n=tae(t);return nae(e.runSync(e.parse(n),n),t)}function eae(t){const e=t.rehypePlugins||V8,n=t.remarkPlugins||V8,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...W8}:W8;return Vie().use(zse).use(n).use(Tie,r).use(e)}function tae(t){const e=t.children||"",n=new RD;return typeof e=="string"&&(n.value=e),n}function nae(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,l=e.skipHtml,c=e.unwrapDisallowed,d=e.urlTransform||rae;for(const m of Zie)Object.hasOwn(e,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+Yie+m.id,void 0);return S5(t,h),vne(t,{Fragment:a.Fragment,components:s,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function h(m,p,x){if(m.type==="raw"&&x&&typeof p=="number")return l?x.children.splice(p,1):x.children[p]={type:"text",value:m.value},p;if(m.type==="element"){let v;for(v in mb)if(Object.hasOwn(mb,v)&&Object.hasOwn(m.properties,v)){const b=m.properties[v],k=mb[v];(k===null||k.includes(m.tagName))&&(m.properties[v]=d(String(b||""),v,m))}}if(m.type==="element"){let v=n?!n.includes(m.tagName):i?i.includes(m.tagName):!1;if(!v&&r&&typeof p=="number"&&(v=!r(m,p,x)),v&&x&&typeof p=="number")return c&&m.children?x.children.splice(p,1,...m.children):x.children.splice(p,1),p}}}function rae(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||Kie.test(t.slice(0,e))?t:""}function G8(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function sae(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function iae(t,e,n){const s=y0((n||{}).ignore||[]),i=aae(e);let l=-1;for(;++l0?{type:"text",value:E}:void 0),E===!1?x.lastIndex=_+1:(b!==_&&T.push({type:"text",value:h.value.slice(b,_)}),Array.isArray(E)?T.push(...E):E&&T.push(E),b=_+A[0].length,j=!0),!x.global)break;A=x.exec(h.value)}return j?(b?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const s=G8(t,"(");let i=G8(t,")");for(;r!==-1&&s>i;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[t,n]}function zD(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Cc(n)||Ix(n))&&(!e||n!==47)}PD.peek=Aae;function wae(){this.buffer()}function Sae(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function kae(){this.buffer()}function Oae(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function jae(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qi(this.sliceSerialize(t)).toLowerCase(),n.label=e}function Nae(t){this.exit(t)}function Cae(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qi(this.sliceSerialize(t)).toLowerCase(),n.label=e}function Tae(t){this.exit(t)}function Aae(){return"["}function PD(t,e,n,r){const s=n.createTracker(r);let i=s.move("[^");const l=n.enter("footnoteReference"),c=n.enter("reference");return i+=s.move(n.safe(n.associationId(t),{after:"]",before:i})),c(),l(),i+=s.move("]"),i}function Mae(){return{enter:{gfmFootnoteCallString:wae,gfmFootnoteCall:Sae,gfmFootnoteDefinitionLabelString:kae,gfmFootnoteDefinition:Oae},exit:{gfmFootnoteCallString:jae,gfmFootnoteCall:Nae,gfmFootnoteDefinitionLabelString:Cae,gfmFootnoteDefinition:Tae}}}function Eae(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:PD},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,l){const c=i.createTracker(l);let d=c.move("[^");const h=i.enter("footnoteDefinition"),m=i.enter("label");return d+=c.move(i.safe(i.associationId(r),{before:d,after:"]"})),m(),d+=c.move("]:"),r.children&&r.children.length>0&&(c.shift(4),d+=c.move((e?` -`:" ")+i.indentLines(i.containerFlow(r,c.current()),e?BD:_ae))),h(),d}}function _ae(t,e,n){return e===0?t:BD(t,e,n)}function BD(t,e,n){return(n?"":" ")+t}const Dae=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];LD.peek=Lae;function Rae(){return{canContainEols:["delete"],enter:{strikethrough:Pae},exit:{strikethrough:Bae}}}function zae(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Dae}],handlers:{delete:LD}}}function Pae(t){this.enter({type:"delete",children:[]},t)}function Bae(t){this.exit(t)}function LD(t,e,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let l=s.move("~~");return l+=n.containerPhrasing(t,{...s.current(),before:l,after:"~"}),l+=s.move("~~"),i(),l}function Lae(){return"~"}function Iae(t){return t.length}function qae(t,e){const n=e||{},r=(n.align||[]).concat(),s=n.stringLength||Iae,i=[],l=[],c=[],d=[];let h=0,m=-1;for(;++mh&&(h=t[m].length);++jd[j])&&(d[j]=A)}k.push(T)}l[m]=k,c[m]=O}let p=-1;if(typeof r=="object"&&"length"in r)for(;++pd[p]&&(d[p]=T),v[p]=T),x[p]=A}l.splice(1,0,x),c.splice(1,0,v),m=-1;const b=[];for(;++m"u"||t.call(h,x)},l=function(h,m){n&&m.name==="__proto__"?n(h,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):h[m.name]=m.newValue},c=function(h,m){if(m==="__proto__")if(t.call(h,m)){if(r)return r(h,m).value}else return;return h[m]};return xb=function d(){var h,m,p,x,v,b,k=arguments[0],O=1,j=arguments.length,T=!1;for(typeof k=="boolean"&&(T=k,k=arguments[1]||{},O=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});Ol.length;let d;c&&l.push(s);try{d=t.apply(this,l)}catch(h){const m=h;if(c&&n)throw m;return s(m)}c||(d&&d.then&&typeof d.then=="function"?d.then(i,s):d instanceof Error?s(d):i(d))}function s(l,...c){n||(n=!0,e(l,...c))}function i(l){s(null,l)}}const ra={basename:Die,dirname:Rie,extname:zie,join:Pie,sep:"/"};function Die(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');b0(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let l=-1,c=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else l<0&&(i=!0,l=s+1),c>-1&&(t.codePointAt(s)===e.codePointAt(c--)?c<0&&(r=s):(c=-1,r=l));return n===r?r=l:r<0&&(r=t.length),t.slice(n,r)}function Rie(t){if(b0(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function zie(t){b0(t);let e=t.length,n=-1,r=0,s=-1,i=0,l;for(;e--;){const c=t.codePointAt(e);if(c===47){if(l){r=e+1;break}continue}n<0&&(l=!0,n=e+1),c===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function Pie(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function Lie(t,e){let n="",r=0,s=-1,i=0,l=-1,c,d;for(;++l<=t.length;){if(l2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",r=0):(n=n.slice(0,d),r=n.length-1-n.lastIndexOf("/")),s=l,i=0;continue}}else if(n.length>0){n="",r=0,s=l,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,l):n=t.slice(s+1,l),r=l-s-1;s=l,i=0}else c===46&&i>-1?i++:i=-1}return n}function b0(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Iie={cwd:qie};function qie(){return"/"}function b4(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function Fie(t){if(typeof t=="string")t=new URL(t);else if(!b4(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Qie(t)}function Qie(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[v,...b]=m;const k=r[x][1];y4(k)&&y4(v)&&(v=vb(!0,k,v)),r[x]=[h,v,...b]}}}}const Vie=new k5().freeze();function Sb(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function kb(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Ob(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function H8(t){if(!y4(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function U8(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Np(t){return Wie(t)?t:new RD(t)}function Wie(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Gie(t){return typeof t=="string"||Xie(t)}function Xie(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Yie="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",V8=[],W8={allowDangerousHtml:!0},Kie=/^(https?|ircs?|mailto|xmpp)$/i,Zie=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Jie(t){const e=eae(t),n=tae(t);return nae(e.runSync(e.parse(n),n),t)}function eae(t){const e=t.rehypePlugins||V8,n=t.remarkPlugins||V8,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...W8}:W8;return Vie().use(zse).use(n).use(Tie,r).use(e)}function tae(t){const e=t.children||"",n=new RD;return typeof e=="string"&&(n.value=e),n}function nae(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,l=e.skipHtml,c=e.unwrapDisallowed,d=e.urlTransform||rae;for(const m of Zie)Object.hasOwn(e,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+Yie+m.id,void 0);return S5(t,h),vne(t,{Fragment:a.Fragment,components:s,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function h(m,p,x){if(m.type==="raw"&&x&&typeof p=="number")return l?x.children.splice(p,1):x.children[p]={type:"text",value:m.value},p;if(m.type==="element"){let v;for(v in mb)if(Object.hasOwn(mb,v)&&Object.hasOwn(m.properties,v)){const b=m.properties[v],k=mb[v];(k===null||k.includes(m.tagName))&&(m.properties[v]=d(String(b||""),v,m))}}if(m.type==="element"){let v=n?!n.includes(m.tagName):i?i.includes(m.tagName):!1;if(!v&&r&&typeof p=="number"&&(v=!r(m,p,x)),v&&x&&typeof p=="number")return c&&m.children?x.children.splice(p,1,...m.children):x.children.splice(p,1),p}}}function rae(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||Kie.test(t.slice(0,e))?t:""}function G8(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function sae(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function iae(t,e,n){const s=y0((n||{}).ignore||[]),i=aae(e);let l=-1;for(;++l0?{type:"text",value:E}:void 0),E===!1?x.lastIndex=_+1:(b!==_&&T.push({type:"text",value:h.value.slice(b,_)}),Array.isArray(E)?T.push(...E):E&&T.push(E),b=_+M[0].length,j=!0),!x.global)break;M=x.exec(h.value)}return j?(b?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const s=G8(t,"(");let i=G8(t,")");for(;r!==-1&&s>i;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[t,n]}function zD(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Cc(n)||Ix(n))&&(!e||n!==47)}PD.peek=Mae;function wae(){this.buffer()}function Sae(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function kae(){this.buffer()}function Oae(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function jae(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=qi(this.sliceSerialize(t)).toLowerCase(),n.label=e}function Nae(t){this.exit(t)}function Cae(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=qi(this.sliceSerialize(t)).toLowerCase(),n.label=e}function Tae(t){this.exit(t)}function Mae(){return"["}function PD(t,e,n,r){const s=n.createTracker(r);let i=s.move("[^");const l=n.enter("footnoteReference"),c=n.enter("reference");return i+=s.move(n.safe(n.associationId(t),{after:"]",before:i})),c(),l(),i+=s.move("]"),i}function Aae(){return{enter:{gfmFootnoteCallString:wae,gfmFootnoteCall:Sae,gfmFootnoteDefinitionLabelString:kae,gfmFootnoteDefinition:Oae},exit:{gfmFootnoteCallString:jae,gfmFootnoteCall:Nae,gfmFootnoteDefinitionLabelString:Cae,gfmFootnoteDefinition:Tae}}}function Eae(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:PD},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,l){const c=i.createTracker(l);let d=c.move("[^");const h=i.enter("footnoteDefinition"),m=i.enter("label");return d+=c.move(i.safe(i.associationId(r),{before:d,after:"]"})),m(),d+=c.move("]:"),r.children&&r.children.length>0&&(c.shift(4),d+=c.move((e?` +`:" ")+i.indentLines(i.containerFlow(r,c.current()),e?BD:_ae))),h(),d}}function _ae(t,e,n){return e===0?t:BD(t,e,n)}function BD(t,e,n){return(n?"":" ")+t}const Dae=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];LD.peek=Lae;function Rae(){return{canContainEols:["delete"],enter:{strikethrough:Pae},exit:{strikethrough:Bae}}}function zae(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Dae}],handlers:{delete:LD}}}function Pae(t){this.enter({type:"delete",children:[]},t)}function Bae(t){this.exit(t)}function LD(t,e,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let l=s.move("~~");return l+=n.containerPhrasing(t,{...s.current(),before:l,after:"~"}),l+=s.move("~~"),i(),l}function Lae(){return"~"}function Iae(t){return t.length}function qae(t,e){const n=e||{},r=(n.align||[]).concat(),s=n.stringLength||Iae,i=[],l=[],c=[],d=[];let h=0,m=-1;for(;++mh&&(h=t[m].length);++jd[j])&&(d[j]=M)}k.push(T)}l[m]=k,c[m]=O}let p=-1;if(typeof r=="object"&&"length"in r)for(;++pd[p]&&(d[p]=T),v[p]=T),x[p]=M}l.splice(1,0,x),c.splice(1,0,v),m=-1;const b=[];for(;++m "),i.shift(2);const l=n.indentLines(n.containerFlow(t,i.current()),$ae);return s(),l}function $ae(t,e,n){return">"+(n?"":" ")+t}function Hae(t,e){return Y8(t,e.inConstruct,!0)&&!Y8(t,e.notInConstruct,!1)}function Y8(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++rl&&(l=i):i=1,s=r+e.length,r=n.indexOf(e,s);return l}function Uae(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function Vae(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function Wae(t,e,n,r){const s=Vae(n),i=t.value||"",l=s==="`"?"GraveAccent":"Tilde";if(Uae(t,n)){const p=n.enter("codeIndented"),x=n.indentLines(i,Gae);return p(),x}const c=n.createTracker(r),d=s.repeat(Math.max(ID(i,s)+1,3)),h=n.enter("codeFenced");let m=c.move(d);if(t.lang){const p=n.enter(`codeFencedLang${l}`);m+=c.move(n.safe(t.lang,{before:m,after:" ",encode:["`"],...c.current()})),p()}if(t.lang&&t.meta){const p=n.enter(`codeFencedMeta${l}`);m+=c.move(" "),m+=c.move(n.safe(t.meta,{before:m,after:` @@ -89,11 +89,11 @@ reaction = "${_.reaction}"`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,chi `))+1))}const l="#".repeat(s),c=n.enter("headingAtx"),d=n.enter("phrasing");i.move(l+" ");let h=n.containerPhrasing(t,{before:"# ",after:` `,...i.current()});return/^[\t ]/.test(h)&&(h=Lf(h.charCodeAt(0))+h.slice(1)),h=h?l+" "+h:l,n.options.closeAtx&&(h+=" "+l),d(),c(),h}FD.peek=ele;function FD(t){return t.value||""}function ele(){return"<"}QD.peek=tle;function QD(t,e,n,r){const s=O5(n),i=s==='"'?"Quote":"Apostrophe",l=n.enter("image");let c=n.enter("label");const d=n.createTracker(r);let h=d.move("![");return h+=d.move(n.safe(t.alt,{before:h,after:"]",...d.current()})),h+=d.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(n.safe(t.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(c=n.enter("destinationRaw"),h+=d.move(n.safe(t.url,{before:h,after:t.title?" ":")",...d.current()}))),c(),t.title&&(c=n.enter(`title${i}`),h+=d.move(" "+s),h+=d.move(n.safe(t.title,{before:h,after:s,...d.current()})),h+=d.move(s),c()),h+=d.move(")"),l(),h}function tle(){return"!"}$D.peek=nle;function $D(t,e,n,r){const s=t.referenceType,i=n.enter("imageReference");let l=n.enter("label");const c=n.createTracker(r);let d=c.move("![");const h=n.safe(t.alt,{before:d,after:"]",...c.current()});d+=c.move(h+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(t),{before:d,after:"]",...c.current()});return l(),n.stack=m,i(),s==="full"||!h||h!==p?d+=c.move(p+"]"):s==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function nle(){return"!"}HD.peek=rle;function HD(t,e,n){let r=t.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i\u007F]/.test(t.url))}VD.peek=sle;function VD(t,e,n,r){const s=O5(n),i=s==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let c,d;if(UD(t,n)){const m=n.stack;n.stack=[],c=n.enter("autolink");let p=l.move("<");return p+=l.move(n.containerPhrasing(t,{before:p,after:">",...l.current()})),p+=l.move(">"),c(),n.stack=m,p}c=n.enter("link"),d=n.enter("label");let h=l.move("[");return h+=l.move(n.containerPhrasing(t,{before:h,after:"](",...l.current()})),h+=l.move("]("),d(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(d=n.enter("destinationLiteral"),h+=l.move("<"),h+=l.move(n.safe(t.url,{before:h,after:">",...l.current()})),h+=l.move(">")):(d=n.enter("destinationRaw"),h+=l.move(n.safe(t.url,{before:h,after:t.title?" ":")",...l.current()}))),d(),t.title&&(d=n.enter(`title${i}`),h+=l.move(" "+s),h+=l.move(n.safe(t.title,{before:h,after:s,...l.current()})),h+=l.move(s),d()),h+=l.move(")"),c(),h}function sle(t,e,n){return UD(t,n)?"<":"["}WD.peek=ile;function WD(t,e,n,r){const s=t.referenceType,i=n.enter("linkReference");let l=n.enter("label");const c=n.createTracker(r);let d=c.move("[");const h=n.containerPhrasing(t,{before:d,after:"]",...c.current()});d+=c.move(h+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(t),{before:d,after:"]",...c.current()});return l(),n.stack=m,i(),s==="full"||!h||h!==p?d+=c.move(p+"]"):s==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function ile(){return"["}function j5(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function ale(t){const e=j5(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function lle(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function GD(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function ole(t,e,n,r){const s=n.enter("list"),i=n.bulletCurrent;let l=t.ordered?lle(n):j5(n);const c=t.ordered?l==="."?")":".":ale(n);let d=e&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!t.ordered){const m=t.children?t.children[0]:void 0;if((l==="*"||l==="-")&&m&&(!m.children||!m.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(d=!0),GD(n)===l&&m){let p=-1;for(;++p-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+i);let l=i.length+1;(s==="tab"||s==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(l=Math.ceil(l/4)*4);const c=n.createTracker(r);c.move(i+" ".repeat(l-i.length)),c.shift(l);const d=n.enter("listItem"),h=n.indentLines(n.containerFlow(t,c.current()),m);return d(),h;function m(p,x,v){return x?(v?"":" ".repeat(l))+p:(v?i:i+" ".repeat(l-i.length))+p}}function dle(t,e,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),l=n.containerPhrasing(t,r);return i(),s(),l}const hle=y0(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function fle(t,e,n,r){return(t.children.some(function(l){return hle(l)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function mle(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}XD.peek=ple;function XD(t,e,n,r){const s=mle(n),i=n.enter("strong"),l=n.createTracker(r),c=l.move(s+s);let d=l.move(n.containerPhrasing(t,{after:s,before:c,...l.current()}));const h=d.charCodeAt(0),m=Wg(r.before.charCodeAt(r.before.length-1),h,s);m.inside&&(d=Lf(h)+d.slice(1));const p=d.charCodeAt(d.length-1),x=Wg(r.after.charCodeAt(0),p,s);x.inside&&(d=d.slice(0,-1)+Lf(p));const v=l.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:x.outside,before:m.outside},c+d+v}function ple(t,e,n){return n.options.strong||"*"}function gle(t,e,n,r){return n.safe(t.value,r)}function xle(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function vle(t,e,n){const r=(GD(n)+(n.options.ruleSpaces?" ":"")).repeat(xle(n));return n.options.ruleSpaces?r.slice(0,-1):r}const YD={blockquote:Qae,break:K8,code:Wae,definition:Xae,emphasis:qD,hardBreak:K8,heading:Jae,html:FD,image:QD,imageReference:$D,inlineCode:HD,link:VD,linkReference:WD,list:ole,listItem:ule,paragraph:dle,root:fle,strong:XD,text:gle,thematicBreak:vle};function yle(){return{enter:{table:ble,tableData:Z8,tableHeader:Z8,tableRow:Sle},exit:{codeText:kle,table:wle,tableData:Tb,tableHeader:Tb,tableRow:Tb}}}function ble(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function wle(t){this.exit(t),this.data.inTable=void 0}function Sle(t){this.enter({type:"tableRow",children:[]},t)}function Tb(t){this.exit(t)}function Z8(t){this.enter({type:"tableCell",children:[]},t)}function kle(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,Ole));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function Ole(t,e){return e==="|"?e:t}function jle(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,s=e.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:l,tableCell:d,tableRow:c}};function l(v,b,k,O){return h(m(v,k,O),v.align)}function c(v,b,k,O){const j=p(v,k,O),T=h([j]);return T.slice(0,T.indexOf(` -`))}function d(v,b,k,O){const j=k.enter("tableCell"),T=k.enter("phrasing"),A=k.containerPhrasing(v,{...O,before:i,after:i});return T(),j(),A}function h(v,b){return qae(v,{align:b,alignDelimiters:r,padding:n,stringLength:s})}function m(v,b,k){const O=v.children;let j=-1;const T=[],A=b.enter("table");for(;++j0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const $le={tokenize:Kle,partial:!0};function Hle(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Gle,continuation:{tokenize:Xle},exit:Yle}},text:{91:{name:"gfmFootnoteCall",tokenize:Wle},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Ule,resolveTo:Vle}}}}function Ule(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;s--;){const d=r.events[s][1];if(d.type==="labelImage"){l=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return c;function c(d){if(!l||!l._balanced)return n(d);const h=Qi(r.sliceSerialize({start:l.end,end:r.now()}));return h.codePointAt(0)!==94||!i.includes(h.slice(1))?n(d):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),e(d))}}function Vle(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},c=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",l,e],["exit",l,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...c),t}function Wle(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,l;return c;function c(p){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),d}function d(p){return p!==94?n(p):(t.enter("gfmFootnoteCallMarker"),t.consume(p),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(p){if(i>999||p===93&&!l||p===null||p===91||Rn(p))return n(p);if(p===93){t.exit("chunkString");const x=t.exit("gfmFootnoteCallString");return s.includes(Qi(r.sliceSerialize(x)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(p)}return Rn(p)||(l=!0),i++,t.consume(p),p===92?m:h}function m(p){return p===91||p===92||p===93?(t.consume(p),i++,h):h(p)}}function Gle(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,l=0,c;return d;function d(b){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(b){return b===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",m):n(b)}function m(b){if(l>999||b===93&&!c||b===null||b===91||Rn(b))return n(b);if(b===93){t.exit("chunkString");const k=t.exit("gfmFootnoteDefinitionLabelString");return i=Qi(r.sliceSerialize(k)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),x}return Rn(b)||(c=!0),l++,t.consume(b),b===92?p:m}function p(b){return b===91||b===92||b===93?(t.consume(b),l++,m):m(b)}function x(b){return b===58?(t.enter("definitionMarker"),t.consume(b),t.exit("definitionMarker"),s.includes(i)||s.push(i),zt(t,v,"gfmFootnoteDefinitionWhitespace")):n(b)}function v(b){return e(b)}}function Xle(t,e,n){return t.check(v0,e,t.attempt($le,e,n))}function Yle(t){t.exit("gfmFootnoteDefinition")}function Kle(t,e,n){const r=this;return zt(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?e(i):n(i)}}function Zle(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(l,c){let d=-1;for(;++d1?d(b):(l.consume(b),p++,v);if(p<2&&!n)return d(b);const O=l.exit("strikethroughSequenceTemporary"),j=vd(b);return O._open=!j||j===2&&!!k,O._close=!k||k===2&&!!j,c(b)}}}class Jle{constructor(){this.map=[]}add(e,n,r){eoe(this,e,n,r)}consume(e){if(this.map.sort(function(i,l){return i[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let s=r.pop();for(;s;){for(const i of s)e.push(i);s=r.pop()}this.map.length=0}}function eoe(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const W=r.events[U][1].type;if(W==="lineEnding"||W==="linePrefix")U--;else break}const V=U>-1?r.events[U][1].type:null,ce=V==="tableHead"||V==="tableRow"?E:d;return ce===E&&r.parser.lazy[r.now().line]?n(L):ce(L)}function d(L){return t.enter("tableHead"),t.enter("tableRow"),h(L)}function h(L){return L===124||(l=!0,i+=1),m(L)}function m(L){return L===null?n(L):Ze(L)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(L),t.exit("lineEnding"),v):n(L):qt(L)?zt(t,m,"whitespace")(L):(i+=1,l&&(l=!1,s+=1),L===124?(t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),l=!0,m):(t.enter("data"),p(L)))}function p(L){return L===null||L===124||Rn(L)?(t.exit("data"),m(L)):(t.consume(L),L===92?x:p)}function x(L){return L===92||L===124?(t.consume(L),p):p(L)}function v(L){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(L):(t.enter("tableDelimiterRow"),l=!1,qt(L)?zt(t,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):b(L))}function b(L){return L===45||L===58?O(L):L===124?(l=!0,t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),k):D(L)}function k(L){return qt(L)?zt(t,O,"whitespace")(L):O(L)}function O(L){return L===58?(i+=1,l=!0,t.enter("tableDelimiterMarker"),t.consume(L),t.exit("tableDelimiterMarker"),j):L===45?(i+=1,j(L)):L===null||Ze(L)?_(L):D(L)}function j(L){return L===45?(t.enter("tableDelimiterFiller"),T(L)):D(L)}function T(L){return L===45?(t.consume(L),T):L===58?(l=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(L),t.exit("tableDelimiterMarker"),A):(t.exit("tableDelimiterFiller"),A(L))}function A(L){return qt(L)?zt(t,_,"whitespace")(L):_(L)}function _(L){return L===124?b(L):L===null||Ze(L)?!l||s!==i?D(L):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(L)):D(L)}function D(L){return n(L)}function E(L){return t.enter("tableRow"),z(L)}function z(L){return L===124?(t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),z):L===null||Ze(L)?(t.exit("tableRow"),e(L)):qt(L)?zt(t,z,"whitespace")(L):(t.enter("data"),Q(L))}function Q(L){return L===null||L===124||Rn(L)?(t.exit("data"),z(L)):(t.consume(L),L===92?F:Q)}function F(L){return L===92||L===124?(t.consume(L),Q):Q(L)}}function soe(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],l=[0,0,0,0],c=!1,d=0,h,m,p;const x=new Jle;for(;++nn[2]+1){const b=n[2]+1,k=n[3]-n[2]-1;t.add(b,k,[])}}t.add(n[3]+1,0,[["exit",p,e]])}return s!==void 0&&(i.end=Object.assign({},Lu(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function eN(t,e,n,r,s){const i=[],l=Lu(e.events,n);s&&(s.end=Object.assign({},l),i.push(["exit",s,e])),r.end=Object.assign({},l),i.push(["exit",r,e]),t.add(n+1,0,i)}function Lu(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const ioe={name:"tasklistCheck",tokenize:loe};function aoe(){return{text:{91:ioe}}}function loe(t,e,n){const r=this;return s;function s(d){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(d):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),i)}function i(d){return Rn(d)?(t.enter("taskListCheckValueUnchecked"),t.consume(d),t.exit("taskListCheckValueUnchecked"),l):d===88||d===120?(t.enter("taskListCheckValueChecked"),t.consume(d),t.exit("taskListCheckValueChecked"),l):n(d)}function l(d){return d===93?(t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),c):n(d)}function c(d){return Ze(d)?e(d):qt(d)?t.check({tokenize:ooe},e,n)(d):n(d)}}function ooe(t,e,n){return zt(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function coe(t){return mD([Rle(),Hle(),Zle(t),noe(),aoe()])}const uoe={};function doe(t){const e=this,n=t||uoe,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(coe(n)),i.push(Mle()),l.push(Ele(n))}function hoe(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:c,mathText:l,mathTextData:c}};function t(d){const h={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[h]}},d)}function e(){this.buffer()}function n(){const d=this.resume(),h=this.stack[this.stack.length-1];h.type,h.meta=d}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(d){const h=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),m=this.stack[this.stack.length-1];m.type,this.exit(d),m.value=h;const p=m.data.hChildren[0];p.type,p.tagName,p.children.push({type:"text",value:h}),this.data.mathFlowInside=void 0}function i(d){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},d),this.buffer()}function l(d){const h=this.resume(),m=this.stack[this.stack.length-1];m.type,this.exit(d),m.value=h,m.data.hChildren.push({type:"text",value:h})}function c(d){this.config.enter.data.call(this,d),this.config.exit.data.call(this,d)}}function foe(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` +`))}function d(v,b,k,O){const j=k.enter("tableCell"),T=k.enter("phrasing"),M=k.containerPhrasing(v,{...O,before:i,after:i});return T(),j(),M}function h(v,b){return qae(v,{align:b,alignDelimiters:r,padding:n,stringLength:s})}function m(v,b,k){const O=v.children;let j=-1;const T=[],M=b.enter("table");for(;++j0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const $le={tokenize:Kle,partial:!0};function Hle(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Gle,continuation:{tokenize:Xle},exit:Yle}},text:{91:{name:"gfmFootnoteCall",tokenize:Wle},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Ule,resolveTo:Vle}}}}function Ule(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;s--;){const d=r.events[s][1];if(d.type==="labelImage"){l=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return c;function c(d){if(!l||!l._balanced)return n(d);const h=qi(r.sliceSerialize({start:l.end,end:r.now()}));return h.codePointAt(0)!==94||!i.includes(h.slice(1))?n(d):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),e(d))}}function Vle(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},c=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",l,e],["exit",l,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...c),t}function Wle(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,l;return c;function c(p){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),d}function d(p){return p!==94?n(p):(t.enter("gfmFootnoteCallMarker"),t.consume(p),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(p){if(i>999||p===93&&!l||p===null||p===91||Rn(p))return n(p);if(p===93){t.exit("chunkString");const x=t.exit("gfmFootnoteCallString");return s.includes(qi(r.sliceSerialize(x)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(p)}return Rn(p)||(l=!0),i++,t.consume(p),p===92?m:h}function m(p){return p===91||p===92||p===93?(t.consume(p),i++,h):h(p)}}function Gle(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,l=0,c;return d;function d(b){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(b){return b===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",m):n(b)}function m(b){if(l>999||b===93&&!c||b===null||b===91||Rn(b))return n(b);if(b===93){t.exit("chunkString");const k=t.exit("gfmFootnoteDefinitionLabelString");return i=qi(r.sliceSerialize(k)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),x}return Rn(b)||(c=!0),l++,t.consume(b),b===92?p:m}function p(b){return b===91||b===92||b===93?(t.consume(b),l++,m):m(b)}function x(b){return b===58?(t.enter("definitionMarker"),t.consume(b),t.exit("definitionMarker"),s.includes(i)||s.push(i),zt(t,v,"gfmFootnoteDefinitionWhitespace")):n(b)}function v(b){return e(b)}}function Xle(t,e,n){return t.check(v0,e,t.attempt($le,e,n))}function Yle(t){t.exit("gfmFootnoteDefinition")}function Kle(t,e,n){const r=this;return zt(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?e(i):n(i)}}function Zle(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(l,c){let d=-1;for(;++d1?d(b):(l.consume(b),p++,v);if(p<2&&!n)return d(b);const O=l.exit("strikethroughSequenceTemporary"),j=vd(b);return O._open=!j||j===2&&!!k,O._close=!k||k===2&&!!j,c(b)}}}class Jle{constructor(){this.map=[]}add(e,n,r){eoe(this,e,n,r)}consume(e){if(this.map.sort(function(i,l){return i[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let s=r.pop();for(;s;){for(const i of s)e.push(i);s=r.pop()}this.map.length=0}}function eoe(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const W=r.events[U][1].type;if(W==="lineEnding"||W==="linePrefix")U--;else break}const V=U>-1?r.events[U][1].type:null,ce=V==="tableHead"||V==="tableRow"?E:d;return ce===E&&r.parser.lazy[r.now().line]?n(L):ce(L)}function d(L){return t.enter("tableHead"),t.enter("tableRow"),h(L)}function h(L){return L===124||(l=!0,i+=1),m(L)}function m(L){return L===null?n(L):Ze(L)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(L),t.exit("lineEnding"),v):n(L):qt(L)?zt(t,m,"whitespace")(L):(i+=1,l&&(l=!1,s+=1),L===124?(t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),l=!0,m):(t.enter("data"),p(L)))}function p(L){return L===null||L===124||Rn(L)?(t.exit("data"),m(L)):(t.consume(L),L===92?x:p)}function x(L){return L===92||L===124?(t.consume(L),p):p(L)}function v(L){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(L):(t.enter("tableDelimiterRow"),l=!1,qt(L)?zt(t,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):b(L))}function b(L){return L===45||L===58?O(L):L===124?(l=!0,t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),k):D(L)}function k(L){return qt(L)?zt(t,O,"whitespace")(L):O(L)}function O(L){return L===58?(i+=1,l=!0,t.enter("tableDelimiterMarker"),t.consume(L),t.exit("tableDelimiterMarker"),j):L===45?(i+=1,j(L)):L===null||Ze(L)?_(L):D(L)}function j(L){return L===45?(t.enter("tableDelimiterFiller"),T(L)):D(L)}function T(L){return L===45?(t.consume(L),T):L===58?(l=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(L),t.exit("tableDelimiterMarker"),M):(t.exit("tableDelimiterFiller"),M(L))}function M(L){return qt(L)?zt(t,_,"whitespace")(L):_(L)}function _(L){return L===124?b(L):L===null||Ze(L)?!l||s!==i?D(L):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(L)):D(L)}function D(L){return n(L)}function E(L){return t.enter("tableRow"),z(L)}function z(L){return L===124?(t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),z):L===null||Ze(L)?(t.exit("tableRow"),e(L)):qt(L)?zt(t,z,"whitespace")(L):(t.enter("data"),Q(L))}function Q(L){return L===null||L===124||Rn(L)?(t.exit("data"),z(L)):(t.consume(L),L===92?F:Q)}function F(L){return L===92||L===124?(t.consume(L),Q):Q(L)}}function soe(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],l=[0,0,0,0],c=!1,d=0,h,m,p;const x=new Jle;for(;++nn[2]+1){const b=n[2]+1,k=n[3]-n[2]-1;t.add(b,k,[])}}t.add(n[3]+1,0,[["exit",p,e]])}return s!==void 0&&(i.end=Object.assign({},Lu(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function eN(t,e,n,r,s){const i=[],l=Lu(e.events,n);s&&(s.end=Object.assign({},l),i.push(["exit",s,e])),r.end=Object.assign({},l),i.push(["exit",r,e]),t.add(n+1,0,i)}function Lu(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const ioe={name:"tasklistCheck",tokenize:loe};function aoe(){return{text:{91:ioe}}}function loe(t,e,n){const r=this;return s;function s(d){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(d):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),i)}function i(d){return Rn(d)?(t.enter("taskListCheckValueUnchecked"),t.consume(d),t.exit("taskListCheckValueUnchecked"),l):d===88||d===120?(t.enter("taskListCheckValueChecked"),t.consume(d),t.exit("taskListCheckValueChecked"),l):n(d)}function l(d){return d===93?(t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),c):n(d)}function c(d){return Ze(d)?e(d):qt(d)?t.check({tokenize:ooe},e,n)(d):n(d)}}function ooe(t,e,n){return zt(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function coe(t){return mD([Rle(),Hle(),Zle(t),noe(),aoe()])}const uoe={};function doe(t){const e=this,n=t||uoe,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(coe(n)),i.push(Ale()),l.push(Ele(n))}function hoe(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:c,mathText:l,mathTextData:c}};function t(d){const h={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[h]}},d)}function e(){this.buffer()}function n(){const d=this.resume(),h=this.stack[this.stack.length-1];h.type,h.meta=d}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(d){const h=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),m=this.stack[this.stack.length-1];m.type,this.exit(d),m.value=h;const p=m.data.hChildren[0];p.type,p.tagName,p.children.push({type:"text",value:h}),this.data.mathFlowInside=void 0}function i(d){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},d),this.buffer()}function l(d){const h=this.resume(),m=this.stack[this.stack.length-1];m.type,this.exit(d),m.value=h,m.data.hChildren.push({type:"text",value:h})}function c(d){this.config.enter.data.call(this,d),this.config.exit.data.call(this,d)}}function foe(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` `,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(i,l,c,d){const h=i.value||"",m=c.createTracker(d),p="$".repeat(Math.max(ID(h,"$")+1,2)),x=c.enter("mathFlow");let v=m.move(p);if(i.meta){const b=c.enter("mathFlowMeta");v+=m.move(c.safe(i.meta,{after:` `,before:v,encode:["$"],...m.current()})),b()}return v+=m.move(` `),h&&(v+=m.move(h+` -`)),v+=m.move(p),x(),v}function r(i,l,c){let d=i.value||"",h=1;for(e||h++;new RegExp("(^|[^$])"+"\\$".repeat(h)+"([^$]|$)").test(d);)h++;const m="$".repeat(h);/[^ \r\n]/.test(d)&&(/^[ \r\n]/.test(d)&&/[ \r\n]$/.test(d)||/^\$|\$$/.test(d))&&(d=" "+d+" ");let p=-1;for(;++p15?h="…"+c.slice(s-15,s):h=c.slice(0,s);var m;i+15":">","<":"<",'"':""","'":"'"},joe=/[&><"']/g;function Noe(t){return String(t).replace(joe,e=>Ooe[e])}var iR=function t(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?t(e.body[0]):e:e.type==="font"?t(e.body):e},Coe=function(e){var n=iR(e);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},Toe=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},Aoe=function(e){var n=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},tn={deflt:woe,escape:Noe,hyphenate:koe,getBaseElem:iR,isCharacterBox:Coe,protocolFromUrl:Aoe},cg={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand ",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function Moe(t){if(t.default)return t.default;var e=t.type,n=Array.isArray(e)?e[0]:e;if(typeof n!="string")return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class C5{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var n in cg)if(cg.hasOwnProperty(n)){var r=cg[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:Moe(r)}}reportNonstrict(e,n,r){var s=this.strict;if(typeof s=="function"&&(s=s(e,n,r)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new De("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+e+"]"),r);s==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]"))}}useStrictBehavior(e,n,r){var s=this.strict;if(typeof s=="function")try{s=s(e,n,r)}catch{s="error"}return!s||s==="ignore"?!1:s===!0||s==="error"?!0:s==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var n=tn.protocolFromUrl(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class Yl{constructor(e,n,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=n,this.cramped=r}sup(){return la[Eoe[this.id]]}sub(){return la[_oe[this.id]]}fracNum(){return la[Doe[this.id]]}fracDen(){return la[Roe[this.id]]}cramp(){return la[zoe[this.id]]}text(){return la[Poe[this.id]]}isTight(){return this.size>=2}}var T5=0,Gg=1,ed=2,ul=3,If=4,Oi=5,yd=6,hs=7,la=[new Yl(T5,0,!1),new Yl(Gg,0,!0),new Yl(ed,1,!1),new Yl(ul,1,!0),new Yl(If,2,!1),new Yl(Oi,2,!0),new Yl(yd,3,!1),new Yl(hs,3,!0)],Eoe=[If,Oi,If,Oi,yd,hs,yd,hs],_oe=[Oi,Oi,Oi,Oi,hs,hs,hs,hs],Doe=[ed,ul,If,Oi,yd,hs,yd,hs],Roe=[ul,ul,Oi,Oi,hs,hs,hs,hs],zoe=[Gg,Gg,ul,ul,Oi,Oi,hs,hs],Poe=[T5,Gg,ed,ul,ed,ul,ed,ul],at={DISPLAY:la[T5],TEXT:la[ed],SCRIPT:la[If],SCRIPTSCRIPT:la[yd]},S4=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function Boe(t){for(var e=0;e=s[0]&&t<=s[1])return n.name}return null}var ug=[];S4.forEach(t=>t.blocks.forEach(e=>ug.push(...e)));function aR(t){for(var e=0;e=ug[e]&&t<=ug[e+1])return!0;return!1}var Tu=80,Loe=function(e,n){return"M95,"+(622+e+n)+` +`)),v+=m.move(p),x(),v}function r(i,l,c){let d=i.value||"",h=1;for(e||h++;new RegExp("(^|[^$])"+"\\$".repeat(h)+"([^$]|$)").test(d);)h++;const m="$".repeat(h);/[^ \r\n]/.test(d)&&(/^[ \r\n]/.test(d)&&/[ \r\n]$/.test(d)||/^\$|\$$/.test(d))&&(d=" "+d+" ");let p=-1;for(;++p15?h="…"+c.slice(s-15,s):h=c.slice(0,s);var m;i+15":">","<":"<",'"':""","'":"'"},joe=/[&><"']/g;function Noe(t){return String(t).replace(joe,e=>Ooe[e])}var iR=function t(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?t(e.body[0]):e:e.type==="font"?t(e.body):e},Coe=function(e){var n=iR(e);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},Toe=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},Moe=function(e){var n=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},tn={deflt:woe,escape:Noe,hyphenate:koe,getBaseElem:iR,isCharacterBox:Coe,protocolFromUrl:Moe},cg={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand ",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function Aoe(t){if(t.default)return t.default;var e=t.type,n=Array.isArray(e)?e[0]:e;if(typeof n!="string")return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class C5{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var n in cg)if(cg.hasOwnProperty(n)){var r=cg[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:Aoe(r)}}reportNonstrict(e,n,r){var s=this.strict;if(typeof s=="function"&&(s=s(e,n,r)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new De("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+e+"]"),r);s==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]"))}}useStrictBehavior(e,n,r){var s=this.strict;if(typeof s=="function")try{s=s(e,n,r)}catch{s="error"}return!s||s==="ignore"?!1:s===!0||s==="error"?!0:s==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var n=tn.protocolFromUrl(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class Xl{constructor(e,n,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=n,this.cramped=r}sup(){return ia[Eoe[this.id]]}sub(){return ia[_oe[this.id]]}fracNum(){return ia[Doe[this.id]]}fracDen(){return ia[Roe[this.id]]}cramp(){return ia[zoe[this.id]]}text(){return ia[Poe[this.id]]}isTight(){return this.size>=2}}var T5=0,Gg=1,ed=2,cl=3,If=4,ki=5,yd=6,hs=7,ia=[new Xl(T5,0,!1),new Xl(Gg,0,!0),new Xl(ed,1,!1),new Xl(cl,1,!0),new Xl(If,2,!1),new Xl(ki,2,!0),new Xl(yd,3,!1),new Xl(hs,3,!0)],Eoe=[If,ki,If,ki,yd,hs,yd,hs],_oe=[ki,ki,ki,ki,hs,hs,hs,hs],Doe=[ed,cl,If,ki,yd,hs,yd,hs],Roe=[cl,cl,ki,ki,hs,hs,hs,hs],zoe=[Gg,Gg,cl,cl,ki,ki,hs,hs],Poe=[T5,Gg,ed,cl,ed,cl,ed,cl],at={DISPLAY:ia[T5],TEXT:ia[ed],SCRIPT:ia[If],SCRIPTSCRIPT:ia[yd]},S4=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function Boe(t){for(var e=0;e=s[0]&&t<=s[1])return n.name}return null}var ug=[];S4.forEach(t=>t.blocks.forEach(e=>ug.push(...e)));function aR(t){for(var e=0;e=ug[e]&&t<=ug[e+1])return!0;return!1}var Tu=80,Loe=function(e,n){return"M95,"+(622+e+n)+` c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 @@ -347,13 +347,13 @@ c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6 c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, --470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class w0{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),n=0;nn.toText();return this.children.map(e).join("")}}var pa={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Tp={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},rN={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function Goe(t,e){pa[t]=e}function A5(t,e,n){if(!pa[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),s=pa[e][r];if(!s&&t[0]in rN&&(r=rN[t[0]].charCodeAt(0),s=pa[e][r]),!s&&n==="text"&&aR(r)&&(s=pa[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var Ab={};function Xoe(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!Ab[e]){var n=Ab[e]={cssEmPerMu:Tp.quad[e]/18};for(var r in Tp)Tp.hasOwnProperty(r)&&(n[r]=Tp[r][e])}return Ab[e]}var Yoe=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],sN=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],iN=function(e,n){return n.size<2?e:Yoe[e-1][n.size-1]};class sl{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||sl.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=sN[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return new sl(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:iN(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:sN[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=iN(sl.BASESIZE,e);return this.size===n&&this.textSize===sl.BASESIZE&&this.style===e?this:this.extend({style:e,size:n})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==sl.BASESIZE?["sizing","reset-size"+this.size,"size"+sl.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Xoe(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}sl.BASESIZE=6;var k4={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},Koe={ex:!0,em:!0,mu:!0},lR=function(e){return typeof e!="string"&&(e=e.unit),e in k4||e in Koe||e==="ex"},Kn=function(e,n){var r;if(e.unit in k4)r=k4[e.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(e.unit==="mu")r=n.fontMetrics().cssEmPerMu;else{var s;if(n.style.isTight()?s=n.havingStyle(n.style.text()):s=n,e.unit==="ex")r=s.fontMetrics().xHeight;else if(e.unit==="em")r=s.fontMetrics().quad;else throw new De("Invalid unit: '"+e.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},Le=function(e){return+e.toFixed(4)+"em"},yo=function(e){return e.filter(n=>n).join(" ")},oR=function(e,n,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},n){n.style.isTight()&&this.classes.push("mtight");var s=n.getColor();s&&(this.style.color=s)}},cR=function(e){var n=document.createElement(e);n.className=yo(this.classes);for(var r in this.style)this.style.hasOwnProperty(r)&&(n.style[r]=this.style[r]);for(var s in this.attributes)this.attributes.hasOwnProperty(s)&&n.setAttribute(s,this.attributes[s]);for(var i=0;i/=\x00-\x1f]/,uR=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+tn.escape(yo(this.classes))+'"');var r="";for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=tn.hyphenate(s)+":"+this.style[s]+";");r&&(n+=' style="'+tn.escape(r)+'"');for(var i in this.attributes)if(this.attributes.hasOwnProperty(i)){if(Zoe.test(i))throw new De("Invalid attribute name '"+i+"'");n+=" "+i+'="'+tn.escape(this.attributes[i])+'"'}n+=">";for(var l=0;l",n};class S0{constructor(e,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,oR.call(this,e,r,s),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return cR.call(this,"span")}toMarkup(){return uR.call(this,"span")}}class M5{constructor(e,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,oR.call(this,n,s),this.children=r||[],this.setAttribute("href",e)}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return cR.call(this,"a")}toMarkup(){return uR.call(this,"a")}}class Joe{constructor(e,n,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=e,this.classes=["mord"],this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var n in this.style)this.style.hasOwnProperty(n)&&(e.style[n]=this.style[n]);return e}toMarkup(){var e=''+tn.escape(this.alt)+'0&&(n=document.createElement("span"),n.style.marginRight=Le(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=yo(this.classes));for(var r in this.style)this.style.hasOwnProperty(r)&&(n=n||document.createElement("span"),n.style[r]=this.style[r]);return n?(n.appendChild(e),n):e}toMarkup(){var e=!1,n="0&&(r+="margin-right:"+this.italic+"em;");for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=tn.hyphenate(s)+":"+this.style[s]+";");r&&(e=!0,n+=' style="'+tn.escape(r)+'"');var i=tn.escape(this.text);return e?(n+=">",n+=i,n+="",n):i}}class xl{constructor(e,n){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=n||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);for(var s=0;s':''}}class O4{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"line");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var e=" but got "+String(t)+".")}var nce={bin:1,close:1,inner:1,open:1,punct:1,rel:1},rce={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Ln={math:{},text:{}};function N(t,e,n,r,s,i){Ln[t][s]={font:e,group:n,replace:r},i&&r&&(Ln[t][r]=Ln[t][s])}var C="math",Ee="text",B="main",G="ams",Wn="accent-token",Ve="bin",xs="close",Rd="inner",st="mathord",yr="op-token",li="open",$x="punct",X="rel",Sl="spacing",le="textord";N(C,B,X,"≡","\\equiv",!0);N(C,B,X,"≺","\\prec",!0);N(C,B,X,"≻","\\succ",!0);N(C,B,X,"∼","\\sim",!0);N(C,B,X,"⊥","\\perp");N(C,B,X,"⪯","\\preceq",!0);N(C,B,X,"⪰","\\succeq",!0);N(C,B,X,"≃","\\simeq",!0);N(C,B,X,"∣","\\mid",!0);N(C,B,X,"≪","\\ll",!0);N(C,B,X,"≫","\\gg",!0);N(C,B,X,"≍","\\asymp",!0);N(C,B,X,"∥","\\parallel");N(C,B,X,"⋈","\\bowtie",!0);N(C,B,X,"⌣","\\smile",!0);N(C,B,X,"⊑","\\sqsubseteq",!0);N(C,B,X,"⊒","\\sqsupseteq",!0);N(C,B,X,"≐","\\doteq",!0);N(C,B,X,"⌢","\\frown",!0);N(C,B,X,"∋","\\ni",!0);N(C,B,X,"∝","\\propto",!0);N(C,B,X,"⊢","\\vdash",!0);N(C,B,X,"⊣","\\dashv",!0);N(C,B,X,"∋","\\owns");N(C,B,$x,".","\\ldotp");N(C,B,$x,"⋅","\\cdotp");N(C,B,le,"#","\\#");N(Ee,B,le,"#","\\#");N(C,B,le,"&","\\&");N(Ee,B,le,"&","\\&");N(C,B,le,"ℵ","\\aleph",!0);N(C,B,le,"∀","\\forall",!0);N(C,B,le,"ℏ","\\hbar",!0);N(C,B,le,"∃","\\exists",!0);N(C,B,le,"∇","\\nabla",!0);N(C,B,le,"♭","\\flat",!0);N(C,B,le,"ℓ","\\ell",!0);N(C,B,le,"♮","\\natural",!0);N(C,B,le,"♣","\\clubsuit",!0);N(C,B,le,"℘","\\wp",!0);N(C,B,le,"♯","\\sharp",!0);N(C,B,le,"♢","\\diamondsuit",!0);N(C,B,le,"ℜ","\\Re",!0);N(C,B,le,"♡","\\heartsuit",!0);N(C,B,le,"ℑ","\\Im",!0);N(C,B,le,"♠","\\spadesuit",!0);N(C,B,le,"§","\\S",!0);N(Ee,B,le,"§","\\S");N(C,B,le,"¶","\\P",!0);N(Ee,B,le,"¶","\\P");N(C,B,le,"†","\\dag");N(Ee,B,le,"†","\\dag");N(Ee,B,le,"†","\\textdagger");N(C,B,le,"‡","\\ddag");N(Ee,B,le,"‡","\\ddag");N(Ee,B,le,"‡","\\textdaggerdbl");N(C,B,xs,"⎱","\\rmoustache",!0);N(C,B,li,"⎰","\\lmoustache",!0);N(C,B,xs,"⟯","\\rgroup",!0);N(C,B,li,"⟮","\\lgroup",!0);N(C,B,Ve,"∓","\\mp",!0);N(C,B,Ve,"⊖","\\ominus",!0);N(C,B,Ve,"⊎","\\uplus",!0);N(C,B,Ve,"⊓","\\sqcap",!0);N(C,B,Ve,"∗","\\ast");N(C,B,Ve,"⊔","\\sqcup",!0);N(C,B,Ve,"◯","\\bigcirc",!0);N(C,B,Ve,"∙","\\bullet",!0);N(C,B,Ve,"‡","\\ddagger");N(C,B,Ve,"≀","\\wr",!0);N(C,B,Ve,"⨿","\\amalg");N(C,B,Ve,"&","\\And");N(C,B,X,"⟵","\\longleftarrow",!0);N(C,B,X,"⇐","\\Leftarrow",!0);N(C,B,X,"⟸","\\Longleftarrow",!0);N(C,B,X,"⟶","\\longrightarrow",!0);N(C,B,X,"⇒","\\Rightarrow",!0);N(C,B,X,"⟹","\\Longrightarrow",!0);N(C,B,X,"↔","\\leftrightarrow",!0);N(C,B,X,"⟷","\\longleftrightarrow",!0);N(C,B,X,"⇔","\\Leftrightarrow",!0);N(C,B,X,"⟺","\\Longleftrightarrow",!0);N(C,B,X,"↦","\\mapsto",!0);N(C,B,X,"⟼","\\longmapsto",!0);N(C,B,X,"↗","\\nearrow",!0);N(C,B,X,"↩","\\hookleftarrow",!0);N(C,B,X,"↪","\\hookrightarrow",!0);N(C,B,X,"↘","\\searrow",!0);N(C,B,X,"↼","\\leftharpoonup",!0);N(C,B,X,"⇀","\\rightharpoonup",!0);N(C,B,X,"↙","\\swarrow",!0);N(C,B,X,"↽","\\leftharpoondown",!0);N(C,B,X,"⇁","\\rightharpoondown",!0);N(C,B,X,"↖","\\nwarrow",!0);N(C,B,X,"⇌","\\rightleftharpoons",!0);N(C,G,X,"≮","\\nless",!0);N(C,G,X,"","\\@nleqslant");N(C,G,X,"","\\@nleqq");N(C,G,X,"⪇","\\lneq",!0);N(C,G,X,"≨","\\lneqq",!0);N(C,G,X,"","\\@lvertneqq");N(C,G,X,"⋦","\\lnsim",!0);N(C,G,X,"⪉","\\lnapprox",!0);N(C,G,X,"⊀","\\nprec",!0);N(C,G,X,"⋠","\\npreceq",!0);N(C,G,X,"⋨","\\precnsim",!0);N(C,G,X,"⪹","\\precnapprox",!0);N(C,G,X,"≁","\\nsim",!0);N(C,G,X,"","\\@nshortmid");N(C,G,X,"∤","\\nmid",!0);N(C,G,X,"⊬","\\nvdash",!0);N(C,G,X,"⊭","\\nvDash",!0);N(C,G,X,"⋪","\\ntriangleleft");N(C,G,X,"⋬","\\ntrianglelefteq",!0);N(C,G,X,"⊊","\\subsetneq",!0);N(C,G,X,"","\\@varsubsetneq");N(C,G,X,"⫋","\\subsetneqq",!0);N(C,G,X,"","\\@varsubsetneqq");N(C,G,X,"≯","\\ngtr",!0);N(C,G,X,"","\\@ngeqslant");N(C,G,X,"","\\@ngeqq");N(C,G,X,"⪈","\\gneq",!0);N(C,G,X,"≩","\\gneqq",!0);N(C,G,X,"","\\@gvertneqq");N(C,G,X,"⋧","\\gnsim",!0);N(C,G,X,"⪊","\\gnapprox",!0);N(C,G,X,"⊁","\\nsucc",!0);N(C,G,X,"⋡","\\nsucceq",!0);N(C,G,X,"⋩","\\succnsim",!0);N(C,G,X,"⪺","\\succnapprox",!0);N(C,G,X,"≆","\\ncong",!0);N(C,G,X,"","\\@nshortparallel");N(C,G,X,"∦","\\nparallel",!0);N(C,G,X,"⊯","\\nVDash",!0);N(C,G,X,"⋫","\\ntriangleright");N(C,G,X,"⋭","\\ntrianglerighteq",!0);N(C,G,X,"","\\@nsupseteqq");N(C,G,X,"⊋","\\supsetneq",!0);N(C,G,X,"","\\@varsupsetneq");N(C,G,X,"⫌","\\supsetneqq",!0);N(C,G,X,"","\\@varsupsetneqq");N(C,G,X,"⊮","\\nVdash",!0);N(C,G,X,"⪵","\\precneqq",!0);N(C,G,X,"⪶","\\succneqq",!0);N(C,G,X,"","\\@nsubseteqq");N(C,G,Ve,"⊴","\\unlhd");N(C,G,Ve,"⊵","\\unrhd");N(C,G,X,"↚","\\nleftarrow",!0);N(C,G,X,"↛","\\nrightarrow",!0);N(C,G,X,"⇍","\\nLeftarrow",!0);N(C,G,X,"⇏","\\nRightarrow",!0);N(C,G,X,"↮","\\nleftrightarrow",!0);N(C,G,X,"⇎","\\nLeftrightarrow",!0);N(C,G,X,"△","\\vartriangle");N(C,G,le,"ℏ","\\hslash");N(C,G,le,"▽","\\triangledown");N(C,G,le,"◊","\\lozenge");N(C,G,le,"Ⓢ","\\circledS");N(C,G,le,"®","\\circledR");N(Ee,G,le,"®","\\circledR");N(C,G,le,"∡","\\measuredangle",!0);N(C,G,le,"∄","\\nexists");N(C,G,le,"℧","\\mho");N(C,G,le,"Ⅎ","\\Finv",!0);N(C,G,le,"⅁","\\Game",!0);N(C,G,le,"‵","\\backprime");N(C,G,le,"▲","\\blacktriangle");N(C,G,le,"▼","\\blacktriangledown");N(C,G,le,"■","\\blacksquare");N(C,G,le,"⧫","\\blacklozenge");N(C,G,le,"★","\\bigstar");N(C,G,le,"∢","\\sphericalangle",!0);N(C,G,le,"∁","\\complement",!0);N(C,G,le,"ð","\\eth",!0);N(Ee,B,le,"ð","ð");N(C,G,le,"╱","\\diagup");N(C,G,le,"╲","\\diagdown");N(C,G,le,"□","\\square");N(C,G,le,"□","\\Box");N(C,G,le,"◊","\\Diamond");N(C,G,le,"¥","\\yen",!0);N(Ee,G,le,"¥","\\yen",!0);N(C,G,le,"✓","\\checkmark",!0);N(Ee,G,le,"✓","\\checkmark");N(C,G,le,"ℶ","\\beth",!0);N(C,G,le,"ℸ","\\daleth",!0);N(C,G,le,"ℷ","\\gimel",!0);N(C,G,le,"ϝ","\\digamma",!0);N(C,G,le,"ϰ","\\varkappa");N(C,G,li,"┌","\\@ulcorner",!0);N(C,G,xs,"┐","\\@urcorner",!0);N(C,G,li,"└","\\@llcorner",!0);N(C,G,xs,"┘","\\@lrcorner",!0);N(C,G,X,"≦","\\leqq",!0);N(C,G,X,"⩽","\\leqslant",!0);N(C,G,X,"⪕","\\eqslantless",!0);N(C,G,X,"≲","\\lesssim",!0);N(C,G,X,"⪅","\\lessapprox",!0);N(C,G,X,"≊","\\approxeq",!0);N(C,G,Ve,"⋖","\\lessdot");N(C,G,X,"⋘","\\lll",!0);N(C,G,X,"≶","\\lessgtr",!0);N(C,G,X,"⋚","\\lesseqgtr",!0);N(C,G,X,"⪋","\\lesseqqgtr",!0);N(C,G,X,"≑","\\doteqdot");N(C,G,X,"≓","\\risingdotseq",!0);N(C,G,X,"≒","\\fallingdotseq",!0);N(C,G,X,"∽","\\backsim",!0);N(C,G,X,"⋍","\\backsimeq",!0);N(C,G,X,"⫅","\\subseteqq",!0);N(C,G,X,"⋐","\\Subset",!0);N(C,G,X,"⊏","\\sqsubset",!0);N(C,G,X,"≼","\\preccurlyeq",!0);N(C,G,X,"⋞","\\curlyeqprec",!0);N(C,G,X,"≾","\\precsim",!0);N(C,G,X,"⪷","\\precapprox",!0);N(C,G,X,"⊲","\\vartriangleleft");N(C,G,X,"⊴","\\trianglelefteq");N(C,G,X,"⊨","\\vDash",!0);N(C,G,X,"⊪","\\Vvdash",!0);N(C,G,X,"⌣","\\smallsmile");N(C,G,X,"⌢","\\smallfrown");N(C,G,X,"≏","\\bumpeq",!0);N(C,G,X,"≎","\\Bumpeq",!0);N(C,G,X,"≧","\\geqq",!0);N(C,G,X,"⩾","\\geqslant",!0);N(C,G,X,"⪖","\\eqslantgtr",!0);N(C,G,X,"≳","\\gtrsim",!0);N(C,G,X,"⪆","\\gtrapprox",!0);N(C,G,Ve,"⋗","\\gtrdot");N(C,G,X,"⋙","\\ggg",!0);N(C,G,X,"≷","\\gtrless",!0);N(C,G,X,"⋛","\\gtreqless",!0);N(C,G,X,"⪌","\\gtreqqless",!0);N(C,G,X,"≖","\\eqcirc",!0);N(C,G,X,"≗","\\circeq",!0);N(C,G,X,"≜","\\triangleq",!0);N(C,G,X,"∼","\\thicksim");N(C,G,X,"≈","\\thickapprox");N(C,G,X,"⫆","\\supseteqq",!0);N(C,G,X,"⋑","\\Supset",!0);N(C,G,X,"⊐","\\sqsupset",!0);N(C,G,X,"≽","\\succcurlyeq",!0);N(C,G,X,"⋟","\\curlyeqsucc",!0);N(C,G,X,"≿","\\succsim",!0);N(C,G,X,"⪸","\\succapprox",!0);N(C,G,X,"⊳","\\vartriangleright");N(C,G,X,"⊵","\\trianglerighteq");N(C,G,X,"⊩","\\Vdash",!0);N(C,G,X,"∣","\\shortmid");N(C,G,X,"∥","\\shortparallel");N(C,G,X,"≬","\\between",!0);N(C,G,X,"⋔","\\pitchfork",!0);N(C,G,X,"∝","\\varpropto");N(C,G,X,"◀","\\blacktriangleleft");N(C,G,X,"∴","\\therefore",!0);N(C,G,X,"∍","\\backepsilon");N(C,G,X,"▶","\\blacktriangleright");N(C,G,X,"∵","\\because",!0);N(C,G,X,"⋘","\\llless");N(C,G,X,"⋙","\\gggtr");N(C,G,Ve,"⊲","\\lhd");N(C,G,Ve,"⊳","\\rhd");N(C,G,X,"≂","\\eqsim",!0);N(C,B,X,"⋈","\\Join");N(C,G,X,"≑","\\Doteq",!0);N(C,G,Ve,"∔","\\dotplus",!0);N(C,G,Ve,"∖","\\smallsetminus");N(C,G,Ve,"⋒","\\Cap",!0);N(C,G,Ve,"⋓","\\Cup",!0);N(C,G,Ve,"⩞","\\doublebarwedge",!0);N(C,G,Ve,"⊟","\\boxminus",!0);N(C,G,Ve,"⊞","\\boxplus",!0);N(C,G,Ve,"⋇","\\divideontimes",!0);N(C,G,Ve,"⋉","\\ltimes",!0);N(C,G,Ve,"⋊","\\rtimes",!0);N(C,G,Ve,"⋋","\\leftthreetimes",!0);N(C,G,Ve,"⋌","\\rightthreetimes",!0);N(C,G,Ve,"⋏","\\curlywedge",!0);N(C,G,Ve,"⋎","\\curlyvee",!0);N(C,G,Ve,"⊝","\\circleddash",!0);N(C,G,Ve,"⊛","\\circledast",!0);N(C,G,Ve,"⋅","\\centerdot");N(C,G,Ve,"⊺","\\intercal",!0);N(C,G,Ve,"⋒","\\doublecap");N(C,G,Ve,"⋓","\\doublecup");N(C,G,Ve,"⊠","\\boxtimes",!0);N(C,G,X,"⇢","\\dashrightarrow",!0);N(C,G,X,"⇠","\\dashleftarrow",!0);N(C,G,X,"⇇","\\leftleftarrows",!0);N(C,G,X,"⇆","\\leftrightarrows",!0);N(C,G,X,"⇚","\\Lleftarrow",!0);N(C,G,X,"↞","\\twoheadleftarrow",!0);N(C,G,X,"↢","\\leftarrowtail",!0);N(C,G,X,"↫","\\looparrowleft",!0);N(C,G,X,"⇋","\\leftrightharpoons",!0);N(C,G,X,"↶","\\curvearrowleft",!0);N(C,G,X,"↺","\\circlearrowleft",!0);N(C,G,X,"↰","\\Lsh",!0);N(C,G,X,"⇈","\\upuparrows",!0);N(C,G,X,"↿","\\upharpoonleft",!0);N(C,G,X,"⇃","\\downharpoonleft",!0);N(C,B,X,"⊶","\\origof",!0);N(C,B,X,"⊷","\\imageof",!0);N(C,G,X,"⊸","\\multimap",!0);N(C,G,X,"↭","\\leftrightsquigarrow",!0);N(C,G,X,"⇉","\\rightrightarrows",!0);N(C,G,X,"⇄","\\rightleftarrows",!0);N(C,G,X,"↠","\\twoheadrightarrow",!0);N(C,G,X,"↣","\\rightarrowtail",!0);N(C,G,X,"↬","\\looparrowright",!0);N(C,G,X,"↷","\\curvearrowright",!0);N(C,G,X,"↻","\\circlearrowright",!0);N(C,G,X,"↱","\\Rsh",!0);N(C,G,X,"⇊","\\downdownarrows",!0);N(C,G,X,"↾","\\upharpoonright",!0);N(C,G,X,"⇂","\\downharpoonright",!0);N(C,G,X,"⇝","\\rightsquigarrow",!0);N(C,G,X,"⇝","\\leadsto");N(C,G,X,"⇛","\\Rrightarrow",!0);N(C,G,X,"↾","\\restriction");N(C,B,le,"‘","`");N(C,B,le,"$","\\$");N(Ee,B,le,"$","\\$");N(Ee,B,le,"$","\\textdollar");N(C,B,le,"%","\\%");N(Ee,B,le,"%","\\%");N(C,B,le,"_","\\_");N(Ee,B,le,"_","\\_");N(Ee,B,le,"_","\\textunderscore");N(C,B,le,"∠","\\angle",!0);N(C,B,le,"∞","\\infty",!0);N(C,B,le,"′","\\prime");N(C,B,le,"△","\\triangle");N(C,B,le,"Γ","\\Gamma",!0);N(C,B,le,"Δ","\\Delta",!0);N(C,B,le,"Θ","\\Theta",!0);N(C,B,le,"Λ","\\Lambda",!0);N(C,B,le,"Ξ","\\Xi",!0);N(C,B,le,"Π","\\Pi",!0);N(C,B,le,"Σ","\\Sigma",!0);N(C,B,le,"Υ","\\Upsilon",!0);N(C,B,le,"Φ","\\Phi",!0);N(C,B,le,"Ψ","\\Psi",!0);N(C,B,le,"Ω","\\Omega",!0);N(C,B,le,"A","Α");N(C,B,le,"B","Β");N(C,B,le,"E","Ε");N(C,B,le,"Z","Ζ");N(C,B,le,"H","Η");N(C,B,le,"I","Ι");N(C,B,le,"K","Κ");N(C,B,le,"M","Μ");N(C,B,le,"N","Ν");N(C,B,le,"O","Ο");N(C,B,le,"P","Ρ");N(C,B,le,"T","Τ");N(C,B,le,"X","Χ");N(C,B,le,"¬","\\neg",!0);N(C,B,le,"¬","\\lnot");N(C,B,le,"⊤","\\top");N(C,B,le,"⊥","\\bot");N(C,B,le,"∅","\\emptyset");N(C,G,le,"∅","\\varnothing");N(C,B,st,"α","\\alpha",!0);N(C,B,st,"β","\\beta",!0);N(C,B,st,"γ","\\gamma",!0);N(C,B,st,"δ","\\delta",!0);N(C,B,st,"ϵ","\\epsilon",!0);N(C,B,st,"ζ","\\zeta",!0);N(C,B,st,"η","\\eta",!0);N(C,B,st,"θ","\\theta",!0);N(C,B,st,"ι","\\iota",!0);N(C,B,st,"κ","\\kappa",!0);N(C,B,st,"λ","\\lambda",!0);N(C,B,st,"μ","\\mu",!0);N(C,B,st,"ν","\\nu",!0);N(C,B,st,"ξ","\\xi",!0);N(C,B,st,"ο","\\omicron",!0);N(C,B,st,"π","\\pi",!0);N(C,B,st,"ρ","\\rho",!0);N(C,B,st,"σ","\\sigma",!0);N(C,B,st,"τ","\\tau",!0);N(C,B,st,"υ","\\upsilon",!0);N(C,B,st,"ϕ","\\phi",!0);N(C,B,st,"χ","\\chi",!0);N(C,B,st,"ψ","\\psi",!0);N(C,B,st,"ω","\\omega",!0);N(C,B,st,"ε","\\varepsilon",!0);N(C,B,st,"ϑ","\\vartheta",!0);N(C,B,st,"ϖ","\\varpi",!0);N(C,B,st,"ϱ","\\varrho",!0);N(C,B,st,"ς","\\varsigma",!0);N(C,B,st,"φ","\\varphi",!0);N(C,B,Ve,"∗","*",!0);N(C,B,Ve,"+","+");N(C,B,Ve,"−","-",!0);N(C,B,Ve,"⋅","\\cdot",!0);N(C,B,Ve,"∘","\\circ",!0);N(C,B,Ve,"÷","\\div",!0);N(C,B,Ve,"±","\\pm",!0);N(C,B,Ve,"×","\\times",!0);N(C,B,Ve,"∩","\\cap",!0);N(C,B,Ve,"∪","\\cup",!0);N(C,B,Ve,"∖","\\setminus",!0);N(C,B,Ve,"∧","\\land");N(C,B,Ve,"∨","\\lor");N(C,B,Ve,"∧","\\wedge",!0);N(C,B,Ve,"∨","\\vee",!0);N(C,B,le,"√","\\surd");N(C,B,li,"⟨","\\langle",!0);N(C,B,li,"∣","\\lvert");N(C,B,li,"∥","\\lVert");N(C,B,xs,"?","?");N(C,B,xs,"!","!");N(C,B,xs,"⟩","\\rangle",!0);N(C,B,xs,"∣","\\rvert");N(C,B,xs,"∥","\\rVert");N(C,B,X,"=","=");N(C,B,X,":",":");N(C,B,X,"≈","\\approx",!0);N(C,B,X,"≅","\\cong",!0);N(C,B,X,"≥","\\ge");N(C,B,X,"≥","\\geq",!0);N(C,B,X,"←","\\gets");N(C,B,X,">","\\gt",!0);N(C,B,X,"∈","\\in",!0);N(C,B,X,"","\\@not");N(C,B,X,"⊂","\\subset",!0);N(C,B,X,"⊃","\\supset",!0);N(C,B,X,"⊆","\\subseteq",!0);N(C,B,X,"⊇","\\supseteq",!0);N(C,G,X,"⊈","\\nsubseteq",!0);N(C,G,X,"⊉","\\nsupseteq",!0);N(C,B,X,"⊨","\\models");N(C,B,X,"←","\\leftarrow",!0);N(C,B,X,"≤","\\le");N(C,B,X,"≤","\\leq",!0);N(C,B,X,"<","\\lt",!0);N(C,B,X,"→","\\rightarrow",!0);N(C,B,X,"→","\\to");N(C,G,X,"≱","\\ngeq",!0);N(C,G,X,"≰","\\nleq",!0);N(C,B,Sl," ","\\ ");N(C,B,Sl," ","\\space");N(C,B,Sl," ","\\nobreakspace");N(Ee,B,Sl," ","\\ ");N(Ee,B,Sl," "," ");N(Ee,B,Sl," ","\\space");N(Ee,B,Sl," ","\\nobreakspace");N(C,B,Sl,null,"\\nobreak");N(C,B,Sl,null,"\\allowbreak");N(C,B,$x,",",",");N(C,B,$x,";",";");N(C,G,Ve,"⊼","\\barwedge",!0);N(C,G,Ve,"⊻","\\veebar",!0);N(C,B,Ve,"⊙","\\odot",!0);N(C,B,Ve,"⊕","\\oplus",!0);N(C,B,Ve,"⊗","\\otimes",!0);N(C,B,le,"∂","\\partial",!0);N(C,B,Ve,"⊘","\\oslash",!0);N(C,G,Ve,"⊚","\\circledcirc",!0);N(C,G,Ve,"⊡","\\boxdot",!0);N(C,B,Ve,"△","\\bigtriangleup");N(C,B,Ve,"▽","\\bigtriangledown");N(C,B,Ve,"†","\\dagger");N(C,B,Ve,"⋄","\\diamond");N(C,B,Ve,"⋆","\\star");N(C,B,Ve,"◃","\\triangleleft");N(C,B,Ve,"▹","\\triangleright");N(C,B,li,"{","\\{");N(Ee,B,le,"{","\\{");N(Ee,B,le,"{","\\textbraceleft");N(C,B,xs,"}","\\}");N(Ee,B,le,"}","\\}");N(Ee,B,le,"}","\\textbraceright");N(C,B,li,"{","\\lbrace");N(C,B,xs,"}","\\rbrace");N(C,B,li,"[","\\lbrack",!0);N(Ee,B,le,"[","\\lbrack",!0);N(C,B,xs,"]","\\rbrack",!0);N(Ee,B,le,"]","\\rbrack",!0);N(C,B,li,"(","\\lparen",!0);N(C,B,xs,")","\\rparen",!0);N(Ee,B,le,"<","\\textless",!0);N(Ee,B,le,">","\\textgreater",!0);N(C,B,li,"⌊","\\lfloor",!0);N(C,B,xs,"⌋","\\rfloor",!0);N(C,B,li,"⌈","\\lceil",!0);N(C,B,xs,"⌉","\\rceil",!0);N(C,B,le,"\\","\\backslash");N(C,B,le,"∣","|");N(C,B,le,"∣","\\vert");N(Ee,B,le,"|","\\textbar",!0);N(C,B,le,"∥","\\|");N(C,B,le,"∥","\\Vert");N(Ee,B,le,"∥","\\textbardbl");N(Ee,B,le,"~","\\textasciitilde");N(Ee,B,le,"\\","\\textbackslash");N(Ee,B,le,"^","\\textasciicircum");N(C,B,X,"↑","\\uparrow",!0);N(C,B,X,"⇑","\\Uparrow",!0);N(C,B,X,"↓","\\downarrow",!0);N(C,B,X,"⇓","\\Downarrow",!0);N(C,B,X,"↕","\\updownarrow",!0);N(C,B,X,"⇕","\\Updownarrow",!0);N(C,B,yr,"∐","\\coprod");N(C,B,yr,"⋁","\\bigvee");N(C,B,yr,"⋀","\\bigwedge");N(C,B,yr,"⨄","\\biguplus");N(C,B,yr,"⋂","\\bigcap");N(C,B,yr,"⋃","\\bigcup");N(C,B,yr,"∫","\\int");N(C,B,yr,"∫","\\intop");N(C,B,yr,"∬","\\iint");N(C,B,yr,"∭","\\iiint");N(C,B,yr,"∏","\\prod");N(C,B,yr,"∑","\\sum");N(C,B,yr,"⨂","\\bigotimes");N(C,B,yr,"⨁","\\bigoplus");N(C,B,yr,"⨀","\\bigodot");N(C,B,yr,"∮","\\oint");N(C,B,yr,"∯","\\oiint");N(C,B,yr,"∰","\\oiiint");N(C,B,yr,"⨆","\\bigsqcup");N(C,B,yr,"∫","\\smallint");N(Ee,B,Rd,"…","\\textellipsis");N(C,B,Rd,"…","\\mathellipsis");N(Ee,B,Rd,"…","\\ldots",!0);N(C,B,Rd,"…","\\ldots",!0);N(C,B,Rd,"⋯","\\@cdots",!0);N(C,B,Rd,"⋱","\\ddots",!0);N(C,B,le,"⋮","\\varvdots");N(Ee,B,le,"⋮","\\varvdots");N(C,B,Wn,"ˊ","\\acute");N(C,B,Wn,"ˋ","\\grave");N(C,B,Wn,"¨","\\ddot");N(C,B,Wn,"~","\\tilde");N(C,B,Wn,"ˉ","\\bar");N(C,B,Wn,"˘","\\breve");N(C,B,Wn,"ˇ","\\check");N(C,B,Wn,"^","\\hat");N(C,B,Wn,"⃗","\\vec");N(C,B,Wn,"˙","\\dot");N(C,B,Wn,"˚","\\mathring");N(C,B,st,"","\\@imath");N(C,B,st,"","\\@jmath");N(C,B,le,"ı","ı");N(C,B,le,"ȷ","ȷ");N(Ee,B,le,"ı","\\i",!0);N(Ee,B,le,"ȷ","\\j",!0);N(Ee,B,le,"ß","\\ss",!0);N(Ee,B,le,"æ","\\ae",!0);N(Ee,B,le,"œ","\\oe",!0);N(Ee,B,le,"ø","\\o",!0);N(Ee,B,le,"Æ","\\AE",!0);N(Ee,B,le,"Œ","\\OE",!0);N(Ee,B,le,"Ø","\\O",!0);N(Ee,B,Wn,"ˊ","\\'");N(Ee,B,Wn,"ˋ","\\`");N(Ee,B,Wn,"ˆ","\\^");N(Ee,B,Wn,"˜","\\~");N(Ee,B,Wn,"ˉ","\\=");N(Ee,B,Wn,"˘","\\u");N(Ee,B,Wn,"˙","\\.");N(Ee,B,Wn,"¸","\\c");N(Ee,B,Wn,"˚","\\r");N(Ee,B,Wn,"ˇ","\\v");N(Ee,B,Wn,"¨",'\\"');N(Ee,B,Wn,"˝","\\H");N(Ee,B,Wn,"◯","\\textcircled");var dR={"--":!0,"---":!0,"``":!0,"''":!0};N(Ee,B,le,"–","--",!0);N(Ee,B,le,"–","\\textendash");N(Ee,B,le,"—","---",!0);N(Ee,B,le,"—","\\textemdash");N(Ee,B,le,"‘","`",!0);N(Ee,B,le,"‘","\\textquoteleft");N(Ee,B,le,"’","'",!0);N(Ee,B,le,"’","\\textquoteright");N(Ee,B,le,"“","``",!0);N(Ee,B,le,"“","\\textquotedblleft");N(Ee,B,le,"”","''",!0);N(Ee,B,le,"”","\\textquotedblright");N(C,B,le,"°","\\degree",!0);N(Ee,B,le,"°","\\degree");N(Ee,B,le,"°","\\textdegree",!0);N(C,B,le,"£","\\pounds");N(C,B,le,"£","\\mathsterling",!0);N(Ee,B,le,"£","\\pounds");N(Ee,B,le,"£","\\textsterling",!0);N(C,G,le,"✠","\\maltese");N(Ee,G,le,"✠","\\maltese");var lN='0123456789/@."';for(var Mb=0;Mb0)return Li(i,h,s,n,l.concat(m));if(d){var p,x;if(d==="boldsymbol"){var v=ace(i,s,n,l,r);p=v.fontName,x=[v.fontClass]}else c?(p=mR[d].fontName,x=[d]):(p=_p(d,n.fontWeight,n.fontShape),x=[d,n.fontWeight,n.fontShape]);if(Hx(i,p,s).metrics)return Li(i,p,s,n,l.concat(x));if(dR.hasOwnProperty(i)&&p.slice(0,10)==="Typewriter"){for(var b=[],k=0;k{if(yo(t.classes)!==yo(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize)return!1;if(t.classes.length===1){var n=t.classes[0];if(n==="mbin"||n==="mord")return!1}for(var r in t.style)if(t.style.hasOwnProperty(r)&&t.style[r]!==e.style[r])return!1;for(var s in e.style)if(e.style.hasOwnProperty(s)&&t.style[s]!==e.style[s])return!1;return!0},cce=t=>{for(var e=0;en&&(n=l.height),l.depth>r&&(r=l.depth),l.maxFontSize>s&&(s=l.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=s},Cs=function(e,n,r,s){var i=new S0(e,n,r,s);return E5(i),i},hR=(t,e,n,r)=>new S0(t,e,n,r),uce=function(e,n,r){var s=Cs([e],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Le(s.height),s.maxFontSize=1,s},dce=function(e,n,r,s){var i=new M5(e,n,r,s);return E5(i),i},fR=function(e){var n=new w0(e);return E5(n),n},hce=function(e,n){return e instanceof w0?Cs([],[e],n):e},fce=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,l=1;l{var n=Cs(["mspace"],[],e),r=Kn(t,e);return n.style.marginRight=Le(r),n},_p=function(e,n,r){var s="";switch(e){case"amsrm":s="AMS";break;case"textrm":s="Main";break;case"textsf":s="SansSerif";break;case"texttt":s="Typewriter";break;default:s=e}var i;return n==="textbf"&&r==="textit"?i="BoldItalic":n==="textbf"?i="Bold":n==="textit"?i="Italic":i="Regular",s+"-"+i},mR={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},pR={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},gce=function(e,n){var[r,s,i]=pR[e],l=new bo(r),c=new xl([l],{width:Le(s),height:Le(i),style:"width:"+Le(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),d=hR(["overlay"],[c],n);return d.height=i,d.style.height=Le(i),d.style.width=Le(s),d},ge={fontMap:mR,makeSymbol:Li,mathsym:ice,makeSpan:Cs,makeSvgSpan:hR,makeLineSpan:uce,makeAnchor:dce,makeFragment:fR,wrapFragment:hce,makeVList:mce,makeOrd:lce,makeGlue:pce,staticSvg:gce,svgData:pR,tryCombineChars:cce},Xn={number:3,unit:"mu"},tc={number:4,unit:"mu"},Ka={number:5,unit:"mu"},xce={mord:{mop:Xn,mbin:tc,mrel:Ka,minner:Xn},mop:{mord:Xn,mop:Xn,mrel:Ka,minner:Xn},mbin:{mord:tc,mop:tc,mopen:tc,minner:tc},mrel:{mord:Ka,mop:Ka,mopen:Ka,minner:Ka},mopen:{},mclose:{mop:Xn,mbin:tc,mrel:Ka,minner:Xn},mpunct:{mord:Xn,mop:Xn,mrel:Ka,mopen:Xn,mclose:Xn,mpunct:Xn,minner:Xn},minner:{mord:Xn,mop:Xn,mbin:tc,mrel:Ka,mopen:Xn,mpunct:Xn,minner:Xn}},vce={mord:{mop:Xn},mop:{mord:Xn,mop:Xn},mbin:{},mrel:{},mopen:{},mclose:{mop:Xn},mpunct:{},minner:{mop:Xn}},gR={},Yg={},Kg={};function Qe(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:l}=t,c={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:s},d=0;d{var O=k.classes[0],j=b.classes[0];O==="mbin"&&bce.includes(j)?k.classes[0]="mord":j==="mbin"&&yce.includes(O)&&(b.classes[0]="mord")},{node:p},x,v),hN(i,(b,k)=>{var O=N4(k),j=N4(b),T=O&&j?b.hasClass("mtight")?vce[O][j]:xce[O][j]:null;if(T)return ge.makeGlue(T,h)},{node:p},x,v),i},hN=function t(e,n,r,s,i){s&&e.push(s);for(var l=0;lx=>{e.splice(p+1,0,x),l++})(l)}s&&e.pop()},xR=function(e){return e instanceof w0||e instanceof M5||e instanceof S0&&e.hasClass("enclosing")?e:null},kce=function t(e,n){var r=xR(e);if(r){var s=r.children;if(s.length){if(n==="right")return t(s[s.length-1],"right");if(n==="left")return t(s[0],"left")}}return e},N4=function(e,n){return e?(n&&(e=kce(e,n)),Sce[e.classes[0]]||null):null},qf=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return vl(n.concat(r))},Kt=function(e,n,r){if(!e)return vl();if(Yg[e.type]){var s=Yg[e.type](e,n);if(r&&n.size!==r.size){s=vl(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new De("Got group of unknown type: '"+e.type+"'")};function Dp(t,e){var n=vl(["base"],t,e),r=vl(["strut"]);return r.style.height=Le(n.height+n.depth),n.depth&&(r.style.verticalAlign=Le(-n.depth)),n.children.unshift(r),n}function C4(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=Ar(t,e,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],l=[],c=0;c0&&(i.push(Dp(l,e)),l=[]),i.push(r[c]));l.length>0&&i.push(Dp(l,e));var h;n?(h=Dp(Ar(n,e,!0)),h.classes=["tag"],i.push(h)):s&&i.push(s);var m=vl(["katex-html"],i);if(m.setAttribute("aria-hidden","true"),h){var p=h.children[0];p.style.height=Le(m.height+m.depth),m.depth&&(p.style.verticalAlign=Le(-m.depth))}return m}function vR(t){return new w0(t)}class ni{constructor(e,n,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=n||[],this.classes=r||[]}setAttribute(e,n){this.attributes[e]=n}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&e.setAttribute(n,this.attributes[n]);this.classes.length>0&&(e.className=yo(this.classes));for(var r=0;r0&&(e+=' class ="'+tn.escape(yo(this.classes))+'"'),e+=">";for(var r=0;r",e}toText(){return this.children.map(e=>e.toText()).join("")}}class ga{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return tn.escape(this.toText())}toText(){return this.text}}class Oce{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",Le(this.width)),e}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var _e={MathNode:ni,TextNode:ga,SpaceNode:Oce,newDocumentFragment:vR},Mi=function(e,n,r){return Ln[n][e]&&Ln[n][e].replace&&e.charCodeAt(0)!==55349&&!(dR.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=Ln[n][e].replace),new _e.TextNode(e)},_5=function(e){return e.length===1?e[0]:new _e.MathNode("mrow",e)},D5=function(e,n){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold";var r=n.font;if(!r||r==="mathnormal")return null;var s=e.mode;if(r==="mathit")return"italic";if(r==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(r==="mathbf")return"bold";if(r==="mathbb")return"double-struck";if(r==="mathsfit")return"sans-serif-italic";if(r==="mathfrak")return"fraktur";if(r==="mathscr"||r==="mathcal")return"script";if(r==="mathsf")return"sans-serif";if(r==="mathtt")return"monospace";var i=e.text;if(["\\imath","\\jmath"].includes(i))return null;Ln[s][i]&&Ln[s][i].replace&&(i=Ln[s][i].replace);var l=ge.fontMap[r].fontName;return A5(i,l,s)?ge.fontMap[r].variant:null};function Rb(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof ga&&e.text==="."}else if(t.type==="mo"&&t.children.length===1&&t.getAttribute("separator")==="true"&&t.getAttribute("lspace")==="0em"&&t.getAttribute("rspace")==="0em"){var n=t.children[0];return n instanceof ga&&n.text===","}else return!1}var Fs=function(e,n,r){if(e.length===1){var s=zn(e[0],n);return r&&s instanceof ni&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],l,c=0;c=1&&(l.type==="mn"||Rb(l))){var h=d.children[0];h instanceof ni&&h.type==="mn"&&(h.children=[...l.children,...h.children],i.pop())}else if(l.type==="mi"&&l.children.length===1){var m=l.children[0];if(m instanceof ga&&m.text==="̸"&&(d.type==="mo"||d.type==="mi"||d.type==="mn")){var p=d.children[0];p instanceof ga&&p.text.length>0&&(p.text=p.text.slice(0,1)+"̸"+p.text.slice(1),i.pop())}}}i.push(d),l=d}return i},wo=function(e,n,r){return _5(Fs(e,n,r))},zn=function(e,n){if(!e)return new _e.MathNode("mrow");if(Kg[e.type]){var r=Kg[e.type](e,n);return r}else throw new De("Got group of unknown type: '"+e.type+"'")};function fN(t,e,n,r,s){var i=Fs(t,n),l;i.length===1&&i[0]instanceof ni&&["mrow","mtable"].includes(i[0].type)?l=i[0]:l=new _e.MathNode("mrow",i);var c=new _e.MathNode("annotation",[new _e.TextNode(e)]);c.setAttribute("encoding","application/x-tex");var d=new _e.MathNode("semantics",[l,c]),h=new _e.MathNode("math",[d]);h.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&h.setAttribute("display","block");var m=s?"katex":"katex-mathml";return ge.makeSpan([m],[h])}var yR=function(e){return new sl({style:e.displayMode?at.DISPLAY:at.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},bR=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=ge.makeSpan(r,[e])}return e},jce=function(e,n,r){var s=yR(r),i;if(r.output==="mathml")return fN(e,n,s,r.displayMode,!0);if(r.output==="html"){var l=C4(e,s);i=ge.makeSpan(["katex"],[l])}else{var c=fN(e,n,s,r.displayMode,!1),d=C4(e,s);i=ge.makeSpan(["katex"],[c,d])}return bR(i,r)},Nce=function(e,n,r){var s=yR(r),i=C4(e,s),l=ge.makeSpan(["katex"],[i]);return bR(l,r)},Cce={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Tce=function(e){var n=new _e.MathNode("mo",[new _e.TextNode(Cce[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},Ace={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Mce=function(e){return e.type==="ordgroup"?e.body.length:1},Ece=function(e,n){function r(){var c=4e5,d=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(d)){var h=e,m=Mce(h.base),p,x,v;if(m>5)d==="widehat"||d==="widecheck"?(p=420,c=2364,v=.42,x=d+"4"):(p=312,c=2340,v=.34,x="tilde4");else{var b=[1,1,2,2,3,3][m];d==="widehat"||d==="widecheck"?(c=[0,1062,2364,2364,2364][b],p=[0,239,300,360,420][b],v=[0,.24,.3,.3,.36,.42][b],x=d+b):(c=[0,600,1033,2339,2340][b],p=[0,260,286,306,312][b],v=[0,.26,.286,.3,.306,.34][b],x="tilde"+b)}var k=new bo(x),O=new xl([k],{width:"100%",height:Le(v),viewBox:"0 0 "+c+" "+p,preserveAspectRatio:"none"});return{span:ge.makeSvgSpan([],[O],n),minWidth:0,height:v}}else{var j=[],T=Ace[d],[A,_,D]=T,E=D/1e3,z=A.length,Q,F;if(z===1){var L=T[3];Q=["hide-tail"],F=[L]}else if(z===2)Q=["halfarrow-left","halfarrow-right"],F=["xMinYMin","xMaxYMin"];else if(z===3)Q=["brace-left","brace-center","brace-right"],F=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support - `+z+" children.");for(var U=0;U0&&(s.style.minWidth=Le(i)),s},_ce=function(e,n,r,s,i){var l,c=e.height+e.depth+r+s;if(/fbox|color|angl/.test(n)){if(l=ge.makeSpan(["stretchy",n],[],i),n==="fbox"){var d=i.color&&i.getColor();d&&(l.style.borderColor=d)}}else{var h=[];/^[bx]cancel$/.test(n)&&h.push(new O4({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&h.push(new O4({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var m=new xl(h,{width:"100%",height:Le(c)});l=ge.makeSvgSpan([],[m],i)}return l.height=c,l.style.height=Le(c),l},yl={encloseSpan:_ce,mathMLnode:Tce,svgSpan:Ece};function Nt(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function R5(t){var e=Ux(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function Ux(t){return t&&(t.type==="atom"||rce.hasOwnProperty(t.type))?t:null}var z5=(t,e)=>{var n,r,s;t&&t.type==="supsub"?(r=Nt(t.base,"accent"),n=r.base,t.base=n,s=tce(Kt(t,e)),t.base=r):(r=Nt(t,"accent"),n=r.base);var i=Kt(n,e.havingCrampedStyle()),l=r.isShifty&&tn.isCharacterBox(n),c=0;if(l){var d=tn.getBaseElem(n),h=Kt(d,e.havingCrampedStyle());c=aN(h).skew}var m=r.label==="\\c",p=m?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),x;if(r.isStretchy)x=yl.svgSpan(r,e),x=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:x,wrapperClasses:["svg-align"],wrapperStyle:c>0?{width:"calc(100% - "+Le(2*c)+")",marginLeft:Le(2*c)}:void 0}]},e);else{var v,b;r.label==="\\vec"?(v=ge.staticSvg("vec",e),b=ge.svgData.vec[1]):(v=ge.makeOrd({mode:r.mode,text:r.label},e,"textord"),v=aN(v),v.italic=0,b=v.width,m&&(p+=v.depth)),x=ge.makeSpan(["accent-body"],[v]);var k=r.label==="\\textcircled";k&&(x.classes.push("accent-full"),p=i.height);var O=c;k||(O-=b/2),x.style.left=Le(O),r.label==="\\textcircled"&&(x.style.top=".2em"),x=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-p},{type:"elem",elem:x}]},e)}var j=ge.makeSpan(["mord","accent"],[x],e);return s?(s.children[0]=j,s.height=Math.max(j.height,s.height),s.classes[0]="mord",s):j},wR=(t,e)=>{var n=t.isStretchy?yl.mathMLnode(t.label):new _e.MathNode("mo",[Mi(t.label,t.mode)]),r=new _e.MathNode("mover",[zn(t.base,e),n]);return r.setAttribute("accent","true"),r},Dce=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));Qe({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(t,e)=>{var n=Zg(e[0]),r=!Dce.test(t.funcName),s=!r||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:r,isShifty:s,base:n}},htmlBuilder:z5,mathmlBuilder:wR});Qe({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(t,e)=>{var n=e[0],r=t.parser.mode;return r==="math"&&(t.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+t.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:t.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:z5,mathmlBuilder:wR});Qe({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"accentUnder",mode:n.mode,label:r,base:s}},htmlBuilder:(t,e)=>{var n=Kt(t.base,e),r=yl.svgSpan(t,e),s=t.label==="\\utilde"?.12:0,i=ge.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]},e);return ge.makeSpan(["mord","accentunder"],[i],e)},mathmlBuilder:(t,e)=>{var n=yl.mathMLnode(t.label),r=new _e.MathNode("munder",[zn(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var Rp=t=>{var e=new _e.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Qe({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r,funcName:s}=t;return{type:"xArrow",mode:r.mode,label:s,body:e[0],below:n[0]}},htmlBuilder(t,e){var n=e.style,r=e.havingStyle(n.sup()),s=ge.wrapFragment(Kt(t.body,r,e),e),i=t.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var l;t.below&&(r=e.havingStyle(n.sub()),l=ge.wrapFragment(Kt(t.below,r,e),e),l.classes.push(i+"-arrow-pad"));var c=yl.svgSpan(t,e),d=-e.fontMetrics().axisHeight+.5*c.height,h=-e.fontMetrics().axisHeight-.5*c.height-.111;(s.depth>.25||t.label==="\\xleftequilibrium")&&(h-=s.depth);var m;if(l){var p=-e.fontMetrics().axisHeight+l.height+.5*c.height+.111;m=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:c,shift:d},{type:"elem",elem:l,shift:p}]},e)}else m=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:c,shift:d}]},e);return m.children[0].children[0].children[1].classes.push("svg-align"),ge.makeSpan(["mrel","x-arrow"],[m],e)},mathmlBuilder(t,e){var n=yl.mathMLnode(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var s=Rp(zn(t.body,e));if(t.below){var i=Rp(zn(t.below,e));r=new _e.MathNode("munderover",[n,i,s])}else r=new _e.MathNode("mover",[n,s])}else if(t.below){var l=Rp(zn(t.below,e));r=new _e.MathNode("munder",[n,l])}else r=Rp(),r=new _e.MathNode("mover",[n,r]);return r}});var Rce=ge.makeSpan;function SR(t,e){var n=Ar(t.body,e,!0);return Rce([t.mclass],n,e)}function kR(t,e){var n,r=Fs(t.body,e);return t.mclass==="minner"?n=new _e.MathNode("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new _e.MathNode("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new _e.MathNode("mo",r),t.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):t.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):t.mclass==="mopen"||t.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):t.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}Qe({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:ar(s),isCharacterBox:tn.isCharacterBox(s)}},htmlBuilder:SR,mathmlBuilder:kR});var Vx=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};Qe({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:Vx(e[0]),body:ar(e[1]),isCharacterBox:tn.isCharacterBox(e[1])}}});Qe({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,s=e[1],i=e[0],l;r!=="\\stackrel"?l=Vx(s):l="mrel";var c={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:ar(s)},d={type:"supsub",mode:i.mode,base:c,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:l,body:[d],isCharacterBox:tn.isCharacterBox(d)}},htmlBuilder:SR,mathmlBuilder:kR});Qe({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:Vx(e[0]),body:ar(e[0])}},htmlBuilder(t,e){var n=Ar(t.body,e,!0),r=ge.makeSpan([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=Fs(t.body,e),r=new _e.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var zce={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},mN=()=>({type:"styling",body:[],mode:"math",style:"display"}),pN=t=>t.type==="textord"&&t.text==="@",Pce=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function Bce(t,e,n){var r=zce[t];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var s=n.callFunction("\\\\cdleft",[e[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},l=n.callFunction("\\Big",[i],[]),c=n.callFunction("\\\\cdright",[e[1]],[]),d={type:"ordgroup",mode:"math",body:[s,l,c]};return n.callFunction("\\\\cdparent",[d],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var h={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[h],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Lce(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var n=t.fetch().text;if(n==="&"||n==="\\\\")t.consume();else if(n==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new De("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],s=[r],i=0;i-1))if("<>AV".indexOf(h)>-1)for(var p=0;p<2;p++){for(var x=!0,v=d+1;vAV=|." after @',l[d]);var b=Bce(h,m,t),k={type:"styling",body:[b],mode:"math",style:"display"};r.push(k),c=mN()}i%2===0?r.push(c):r.shift(),r=[],s.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var O=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:O,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}Qe({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:e[0]}},htmlBuilder(t,e){var n=e.havingStyle(e.style.sup()),r=ge.wrapFragment(Kt(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=Le(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new _e.MathNode("mrow",[zn(t.label,e)]);return n=new _e.MathNode("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new _e.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Qe({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(t,e){var{parser:n}=t;return{type:"cdlabelparent",mode:n.mode,fragment:e[0]}},htmlBuilder(t,e){var n=ge.wrapFragment(Kt(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new _e.MathNode("mrow",[zn(t.fragment,e)])}});Qe({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=Nt(e[0],"ordgroup"),s=r.body,i="",l=0;l=1114111)throw new De("\\@char with invalid code point "+i);return d<=65535?h=String.fromCharCode(d):(d-=65536,h=String.fromCharCode((d>>10)+55296,(d&1023)+56320)),{type:"textord",mode:n.mode,text:h}}});var OR=(t,e)=>{var n=Ar(t.body,e.withColor(t.color),!1);return ge.makeFragment(n)},jR=(t,e)=>{var n=Fs(t.body,e.withColor(t.color)),r=new _e.MathNode("mstyle",n);return r.setAttribute("mathcolor",t.color),r};Qe({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=Nt(e[0],"color-token").color,s=e[1];return{type:"color",mode:n.mode,color:r,body:ar(s)}},htmlBuilder:OR,mathmlBuilder:jR});Qe({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,s=Nt(e[0],"color-token").color;n.gullet.macros.set("\\current@color",s);var i=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:s,body:i}},htmlBuilder:OR,mathmlBuilder:jR});Qe({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(t,e,n){var{parser:r}=t,s=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,i=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:i,size:s&&Nt(s,"size").value}},htmlBuilder(t,e){var n=ge.makeSpan(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=Le(Kn(t.size,e)))),n},mathmlBuilder(t,e){var n=new _e.MathNode("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",Le(Kn(t.size,e)))),n}});var T4={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},NR=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new De("Expected a control sequence",t);return e},Ice=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},CR=(t,e,n,r)=>{var s=t.gullet.macros.get(n.text);s==null&&(n.noexpand=!0,s={tokens:[n],numArgs:0,unexpandable:!t.gullet.isExpandable(n.text)}),t.gullet.macros.set(e,s,r)};Qe({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(t){var{parser:e,funcName:n}=t;e.consumeSpaces();var r=e.fetch();if(T4[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=T4[r.text]),Nt(e.parseFunction(),"internal");throw new De("Invalid token after macro prefix",r)}});Qe({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=e.gullet.popToken(),s=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new De("Expected a control sequence",r);for(var i=0,l,c=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){l=e.gullet.future(),c[i].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new De('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new De('Argument number "'+r.text+'" out of order');i++,c.push([])}else{if(r.text==="EOF")throw new De("Expected a macro definition");c[i].push(r.text)}var{tokens:d}=e.gullet.consumeArg();return l&&d.unshift(l),(n==="\\edef"||n==="\\xdef")&&(d=e.gullet.expandTokens(d),d.reverse()),e.gullet.macros.set(s,{tokens:d,numArgs:i,delimiters:c},n===T4[n]),{type:"internal",mode:e.mode}}});Qe({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=NR(e.gullet.popToken());e.gullet.consumeSpaces();var s=Ice(e);return CR(e,r,s,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});Qe({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=NR(e.gullet.popToken()),s=e.gullet.popToken(),i=e.gullet.popToken();return CR(e,r,i,n==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});var Vh=function(e,n,r){var s=Ln.math[e]&&Ln.math[e].replace,i=A5(s||e,n,r);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return i},P5=function(e,n,r,s){var i=r.havingBaseStyle(n),l=ge.makeSpan(s.concat(i.sizingClasses(r)),[e],r),c=i.sizeMultiplier/r.sizeMultiplier;return l.height*=c,l.depth*=c,l.maxFontSize=i.sizeMultiplier,l},TR=function(e,n,r){var s=n.havingBaseStyle(r),i=(1-n.sizeMultiplier/s.sizeMultiplier)*n.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=Le(i),e.height-=i,e.depth+=i},qce=function(e,n,r,s,i,l){var c=ge.makeSymbol(e,"Main-Regular",i,s),d=P5(c,n,s,l);return r&&TR(d,s,n),d},Fce=function(e,n,r,s){return ge.makeSymbol(e,"Size"+n+"-Regular",r,s)},AR=function(e,n,r,s,i,l){var c=Fce(e,n,i,s),d=P5(ge.makeSpan(["delimsizing","size"+n],[c],s),at.TEXT,s,l);return r&&TR(d,s,at.TEXT),d},zb=function(e,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=ge.makeSpan(["delimsizinginner",s],[ge.makeSpan([],[ge.makeSymbol(e,n,r)])]);return{type:"elem",elem:i}},Pb=function(e,n,r){var s=pa["Size4-Regular"][e.charCodeAt(0)]?pa["Size4-Regular"][e.charCodeAt(0)][4]:pa["Size1-Regular"][e.charCodeAt(0)][4],i=new bo("inner",Voe(e,Math.round(1e3*n))),l=new xl([i],{width:Le(s),height:Le(n),style:"width:"+Le(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),c=ge.makeSvgSpan([],[l],r);return c.height=n,c.style.height=Le(n),c.style.width=Le(s),{type:"elem",elem:c}},A4=.008,zp={type:"kern",size:-1*A4},Qce=["|","\\lvert","\\rvert","\\vert"],$ce=["\\|","\\lVert","\\rVert","\\Vert"],MR=function(e,n,r,s,i,l){var c,d,h,m,p="",x=0;c=h=m=e,d=null;var v="Size1-Regular";e==="\\uparrow"?h=m="⏐":e==="\\Uparrow"?h=m="‖":e==="\\downarrow"?c=h="⏐":e==="\\Downarrow"?c=h="‖":e==="\\updownarrow"?(c="\\uparrow",h="⏐",m="\\downarrow"):e==="\\Updownarrow"?(c="\\Uparrow",h="‖",m="\\Downarrow"):Qce.includes(e)?(h="∣",p="vert",x=333):$ce.includes(e)?(h="∥",p="doublevert",x=556):e==="["||e==="\\lbrack"?(c="⎡",h="⎢",m="⎣",v="Size4-Regular",p="lbrack",x=667):e==="]"||e==="\\rbrack"?(c="⎤",h="⎥",m="⎦",v="Size4-Regular",p="rbrack",x=667):e==="\\lfloor"||e==="⌊"?(h=c="⎢",m="⎣",v="Size4-Regular",p="lfloor",x=667):e==="\\lceil"||e==="⌈"?(c="⎡",h=m="⎢",v="Size4-Regular",p="lceil",x=667):e==="\\rfloor"||e==="⌋"?(h=c="⎥",m="⎦",v="Size4-Regular",p="rfloor",x=667):e==="\\rceil"||e==="⌉"?(c="⎤",h=m="⎥",v="Size4-Regular",p="rceil",x=667):e==="("||e==="\\lparen"?(c="⎛",h="⎜",m="⎝",v="Size4-Regular",p="lparen",x=875):e===")"||e==="\\rparen"?(c="⎞",h="⎟",m="⎠",v="Size4-Regular",p="rparen",x=875):e==="\\{"||e==="\\lbrace"?(c="⎧",d="⎨",m="⎩",h="⎪",v="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(c="⎫",d="⎬",m="⎭",h="⎪",v="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(c="⎧",m="⎩",h="⎪",v="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(c="⎫",m="⎭",h="⎪",v="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(c="⎧",m="⎭",h="⎪",v="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(c="⎫",m="⎩",h="⎪",v="Size4-Regular");var b=Vh(c,v,i),k=b.height+b.depth,O=Vh(h,v,i),j=O.height+O.depth,T=Vh(m,v,i),A=T.height+T.depth,_=0,D=1;if(d!==null){var E=Vh(d,v,i);_=E.height+E.depth,D=2}var z=k+A+_,Q=Math.max(0,Math.ceil((n-z)/(D*j))),F=z+Q*D*j,L=s.fontMetrics().axisHeight;r&&(L*=s.sizeMultiplier);var U=F/2-L,V=[];if(p.length>0){var ce=F-k-A,W=Math.round(F*1e3),J=Woe(p,Math.round(ce*1e3)),$=new bo(p,J),ae=(x/1e3).toFixed(3)+"em",ne=(W/1e3).toFixed(3)+"em",ue=new xl([$],{width:ae,height:ne,viewBox:"0 0 "+x+" "+W}),R=ge.makeSvgSpan([],[ue],s);R.height=W/1e3,R.style.width=ae,R.style.height=ne,V.push({type:"elem",elem:R})}else{if(V.push(zb(m,v,i)),V.push(zp),d===null){var me=F-k-A+2*A4;V.push(Pb(h,me,s))}else{var Y=(F-k-A-_)/2+2*A4;V.push(Pb(h,Y,s)),V.push(zp),V.push(zb(d,v,i)),V.push(zp),V.push(Pb(h,Y,s))}V.push(zp),V.push(zb(c,v,i))}var P=s.havingBaseStyle(at.TEXT),K=ge.makeVList({positionType:"bottom",positionData:U,children:V},P);return P5(ge.makeSpan(["delimsizing","mult"],[K],P),at.TEXT,s,l)},Bb=80,Lb=.08,Ib=function(e,n,r,s,i){var l=Uoe(e,s,r),c=new bo(e,l),d=new xl([c],{width:"400em",height:Le(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return ge.makeSvgSpan(["hide-tail"],[d],i)},Hce=function(e,n){var r=n.havingBaseSizing(),s=RR("\\surd",e*r.sizeMultiplier,DR,r),i=r.sizeMultiplier,l=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),c,d=0,h=0,m=0,p;return s.type==="small"?(m=1e3+1e3*l+Bb,e<1?i=1:e<1.4&&(i=.7),d=(1+l+Lb)/i,h=(1+l)/i,c=Ib("sqrtMain",d,m,l,n),c.style.minWidth="0.853em",p=.833/i):s.type==="large"?(m=(1e3+Bb)*cf[s.size],h=(cf[s.size]+l)/i,d=(cf[s.size]+l+Lb)/i,c=Ib("sqrtSize"+s.size,d,m,l,n),c.style.minWidth="1.02em",p=1/i):(d=e+l+Lb,h=e+l,m=Math.floor(1e3*e+l)+Bb,c=Ib("sqrtTall",d,m,l,n),c.style.minWidth="0.742em",p=1.056),c.height=h,c.style.height=Le(d),{span:c,advanceWidth:p,ruleWidth:(n.fontMetrics().sqrtRuleThickness+l)*i}},ER=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Uce=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],_R=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],cf=[0,1.2,1.8,2.4,3],Vce=function(e,n,r,s,i){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),ER.includes(e)||_R.includes(e))return AR(e,n,!1,r,s,i);if(Uce.includes(e))return MR(e,cf[n],!1,r,s,i);throw new De("Illegal delimiter: '"+e+"'")},Wce=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Gce=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"stack"}],DR=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Xce=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},RR=function(e,n,r,s){for(var i=Math.min(2,3-s.style.size),l=i;ln)return r[l]}return r[r.length-1]},zR=function(e,n,r,s,i,l){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var c;_R.includes(e)?c=Wce:ER.includes(e)?c=DR:c=Gce;var d=RR(e,n,c,s);return d.type==="small"?qce(e,d.style,r,s,i,l):d.type==="large"?AR(e,d.size,r,s,i,l):MR(e,n,r,s,i,l)},Yce=function(e,n,r,s,i,l){var c=s.fontMetrics().axisHeight*s.sizeMultiplier,d=901,h=5/s.fontMetrics().ptPerEm,m=Math.max(n-c,r+c),p=Math.max(m/500*d,2*m-h);return zR(e,p,!0,s,i,l)},dl={sqrtImage:Hce,sizedDelim:Vce,sizeToMaxHeight:cf,customSizedDelim:zR,leftRightDelim:Yce},gN={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Kce=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function Wx(t,e){var n=Ux(t);if(n&&Kce.includes(n.text))return n;throw n?new De("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new De("Invalid delimiter type '"+t.type+"'",t)}Qe({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,e)=>{var n=Wx(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:gN[t.funcName].size,mclass:gN[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?ge.makeSpan([t.mclass]):dl.sizedDelim(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(Mi(t.delim,t.mode));var n=new _e.MathNode("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Le(dl.sizeToMaxHeight[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function xN(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Qe({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=t.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new De("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:Wx(e[0],t).text,color:n}}});Qe({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Wx(e[0],t),r=t.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=Nt(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(t,e)=>{xN(t);for(var n=Ar(t.body,e,!0,["mopen","mclose"]),r=0,s=0,i=!1,l=0;l{xN(t);var n=Fs(t.body,e);if(t.left!=="."){var r=new _e.MathNode("mo",[Mi(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var s=new _e.MathNode("mo",[Mi(t.right,t.mode)]);s.setAttribute("fence","true"),t.rightColor&&s.setAttribute("mathcolor",t.rightColor),n.push(s)}return _5(n)}});Qe({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Wx(e[0],t);if(!t.parser.leftrightDepth)throw new De("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=qf(e,[]);else{n=dl.sizedDelim(t.delim,1,e,t.mode,[]);var r={delim:t.delim,options:e};n.isMiddle=r}return n},mathmlBuilder:(t,e)=>{var n=t.delim==="\\vert"||t.delim==="|"?Mi("|","text"):Mi(t.delim,t.mode),r=new _e.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var B5=(t,e)=>{var n=ge.wrapFragment(Kt(t.body,e),e),r=t.label.slice(1),s=e.sizeMultiplier,i,l=0,c=tn.isCharacterBox(t.body);if(r==="sout")i=ge.makeSpan(["stretchy","sout"]),i.height=e.fontMetrics().defaultRuleThickness/s,l=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var d=Kn({number:.6,unit:"pt"},e),h=Kn({number:.35,unit:"ex"},e),m=e.havingBaseSizing();s=s/m.sizeMultiplier;var p=n.height+n.depth+d+h;n.style.paddingLeft=Le(p/2+d);var x=Math.floor(1e3*p*s),v=$oe(x),b=new xl([new bo("phase",v)],{width:"400em",height:Le(x/1e3),viewBox:"0 0 400000 "+x,preserveAspectRatio:"xMinYMin slice"});i=ge.makeSvgSpan(["hide-tail"],[b],e),i.style.height=Le(p),l=n.depth+d+h}else{/cancel/.test(r)?c||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var k=0,O=0,j=0;/box/.test(r)?(j=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),k=e.fontMetrics().fboxsep+(r==="colorbox"?0:j),O=k):r==="angl"?(j=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),k=4*j,O=Math.max(0,.25-n.depth)):(k=c?.2:0,O=k),i=yl.encloseSpan(n,r,k,O,e),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Le(j)):r==="angl"&&j!==.049&&(i.style.borderTopWidth=Le(j),i.style.borderRightWidth=Le(j)),l=n.depth+O,t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor,t.borderColor&&(i.style.borderColor=t.borderColor))}var T;if(t.backgroundColor)T=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:l},{type:"elem",elem:n,shift:0}]},e);else{var A=/cancel|phase/.test(r)?["svg-align"]:[];T=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:l,wrapperClasses:A}]},e)}return/cancel/.test(r)&&(T.height=n.height,T.depth=n.depth),/cancel/.test(r)&&!c?ge.makeSpan(["mord","cancel-lap"],[T],e):ge.makeSpan(["mord"],[T],e)},L5=(t,e)=>{var n=0,r=new _e.MathNode(t.label.indexOf("colorbox")>-1?"mpadded":"menclose",[zn(t.body,e)]);switch(t.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),t.label==="\\fcolorbox"){var s=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+s+"em solid "+String(t.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};Qe({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Nt(e[0],"color-token").color,l=e[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:l}},htmlBuilder:B5,mathmlBuilder:L5});Qe({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Nt(e[0],"color-token").color,l=Nt(e[1],"color-token").color,c=e[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:l,borderColor:i,body:c}},htmlBuilder:B5,mathmlBuilder:L5});Qe({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\fbox",body:e[0]}}});Qe({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"enclose",mode:n.mode,label:r,body:s}},htmlBuilder:B5,mathmlBuilder:L5});Qe({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\angl",body:e[0]}}});var PR={};function Ca(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:l}=t,c={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},d=0;d{var e=t.parser.settings;if(!e.displayMode)throw new De("{"+t.envName+"} can be used only in display mode.")};function I5(t){if(t.indexOf("ed")===-1)return t.indexOf("*")===-1}function Mo(t,e,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:l,colSeparationType:c,autoTag:d,singleRow:h,emptySingleRow:m,maxNumCols:p,leqno:x}=e;if(t.gullet.beginGroup(),h||t.gullet.macros.set("\\cr","\\\\\\relax"),!l){var v=t.gullet.expandMacroAsText("\\arraystretch");if(v==null)l=1;else if(l=parseFloat(v),!l||l<0)throw new De("Invalid \\arraystretch: "+v)}t.gullet.beginGroup();var b=[],k=[b],O=[],j=[],T=d!=null?[]:void 0;function A(){d&&t.gullet.macros.set("\\@eqnsw","1",!0)}function _(){T&&(t.gullet.macros.get("\\df@tag")?(T.push(t.subparse([new ii("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):T.push(!!d&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(A(),j.push(vN(t));;){var D=t.parseExpression(!1,h?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),D={type:"ordgroup",mode:t.mode,body:D},n&&(D={type:"styling",mode:t.mode,style:n,body:[D]}),b.push(D);var E=t.fetch().text;if(E==="&"){if(p&&b.length===p){if(h||c)throw new De("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(E==="\\end"){_(),b.length===1&&D.type==="styling"&&D.body[0].body.length===0&&(k.length>1||!m)&&k.pop(),j.length0&&(A+=.25),h.push({pos:A,isDashed:Jn[nn]})}for(_(l[0]),r=0;r0&&(U+=T,zJn))for(r=0;r=c)){var ve=void 0;(s>0||e.hskipBeforeAndAfter)&&(ve=tn.deflt(Y.pregap,x),ve!==0&&(J=ge.makeSpan(["arraycolsep"],[]),J.style.width=Le(ve),W.push(J)));var Re=[];for(r=0;r0){for(var Oe=ge.makeLineSpan("hline",n,m),nt=ge.makeLineSpan("hdashline",n,m),ut=[{type:"elem",elem:d,shift:0}];h.length>0;){var Ct=h.pop(),In=Ct.pos-V;Ct.isDashed?ut.push({type:"elem",elem:nt,shift:In}):ut.push({type:"elem",elem:Oe,shift:In})}d=ge.makeVList({positionType:"individualShift",children:ut},n)}if(ae.length===0)return ge.makeSpan(["mord"],[d],n);var Tn=ge.makeVList({positionType:"individualShift",children:ae},n);return Tn=ge.makeSpan(["tag"],[Tn],n),ge.makeFragment([d,Tn])},Zce={c:"center ",l:"left ",r:"right "},Aa=function(e,n){for(var r=[],s=new _e.MathNode("mtd",[],["mtr-glue"]),i=new _e.MathNode("mtd",[],["mml-eqn-num"]),l=0;l0){var b=e.cols,k="",O=!1,j=0,T=b.length;b[0].type==="separator"&&(x+="top ",j=1),b[b.length-1].type==="separator"&&(x+="bottom ",T-=1);for(var A=j;A0?"left ":"",x+=Q[Q.length-1].length>0?"right ":"";for(var F=1;F-1?"alignat":"align",i=e.envName==="split",l=Mo(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:I5(e.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),c,d=0,h={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var m="",p=0;p0&&v&&(O=1),r[b]={type:"align",align:k,pregap:O,postgap:0}}return l.colSeparationType=v?"align":"alignat",l};Ca({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=Ux(e[0]),r=n?[e[0]]:Nt(e[0],"ordgroup").body,s=r.map(function(l){var c=R5(l),d=c.text;if("lcr".indexOf(d)!==-1)return{type:"align",align:d};if(d==="|")return{type:"separator",separator:"|"};if(d===":")return{type:"separator",separator:":"};throw new De("Unknown column alignment: "+d,l)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return Mo(t.parser,i,q5(t.envName))},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(t.envName.charAt(t.envName.length-1)==="*"){var s=t.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),n=s.fetch().text,"lcr".indexOf(n)===-1)throw new De("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=Mo(t.parser,r,q5(t.envName)),l=Math.max(0,...i.body.map(c=>c.length));return i.cols=new Array(l).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[i],left:e[0],right:e[1],rightColor:void 0}:i},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=Mo(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=Ux(e[0]),r=n?[e[0]]:Nt(e[0],"ordgroup").body,s=r.map(function(l){var c=R5(l),d=c.text;if("lc".indexOf(d)!==-1)return{type:"align",align:d};throw new De("Unknown column alignment: "+d,l)});if(s.length>1)throw new De("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5};if(i=Mo(t.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new De("{subarray} can contain only one column");return i},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=Mo(t.parser,e,q5(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.indexOf("r")>-1?".":"\\{",right:t.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:LR,htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){["gather","gather*"].includes(t.envName)&&Gx(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:I5(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return Mo(t.parser,e,"display")},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:LR,htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){Gx(t);var e={autoTag:I5(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return Mo(t.parser,e,"display")},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["CD"],props:{numArgs:0},handler(t){return Gx(t),Lce(t.parser)},htmlBuilder:Ta,mathmlBuilder:Aa});q("\\nonumber","\\gdef\\@eqnsw{0}");q("\\notag","\\nonumber");Qe({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new De(t.funcName+" valid only within array environment")}});var yN=PR;Qe({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];if(s.type!=="ordgroup")throw new De("Invalid environment name",s);for(var i="",l=0;l{var n=t.font,r=e.withFont(n);return Kt(t.body,r)},qR=(t,e)=>{var n=t.font,r=e.withFont(n);return zn(t.body,r)},bN={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Qe({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=Zg(e[0]),i=r;return i in bN&&(i=bN[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:IR,mathmlBuilder:qR});Qe({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0],s=tn.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:Vx(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:s}}});Qe({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,breakOnTokenText:s}=t,{mode:i}=n,l=n.parseExpression(!0,s),c="math"+r.slice(1);return{type:"font",mode:i,font:c,body:{type:"ordgroup",mode:n.mode,body:l}}},htmlBuilder:IR,mathmlBuilder:qR});var FR=(t,e)=>{var n=e;return t==="display"?n=n.id>=at.SCRIPT.id?n.text():at.DISPLAY:t==="text"&&n.size===at.DISPLAY.size?n=at.TEXT:t==="script"?n=at.SCRIPT:t==="scriptscript"&&(n=at.SCRIPTSCRIPT),n},F5=(t,e)=>{var n=FR(t.size,e.style),r=n.fracNum(),s=n.fracDen(),i;i=e.havingStyle(r);var l=Kt(t.numer,i,e);if(t.continued){var c=8.5/e.fontMetrics().ptPerEm,d=3.5/e.fontMetrics().ptPerEm;l.height=l.height0?b=3*x:b=7*x,k=e.fontMetrics().denom1):(p>0?(v=e.fontMetrics().num2,b=x):(v=e.fontMetrics().num3,b=3*x),k=e.fontMetrics().denom2);var O;if(m){var T=e.fontMetrics().axisHeight;v-l.depth-(T+.5*p){var n=new _e.MathNode("mfrac",[zn(t.numer,e),zn(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=Kn(t.barSize,e);n.setAttribute("linethickness",Le(r))}var s=FR(t.size,e.style);if(s.size!==e.style.size){n=new _e.MathNode("mstyle",[n]);var i=s.size===at.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",i),n.setAttribute("scriptlevel","0")}if(t.leftDelim!=null||t.rightDelim!=null){var l=[];if(t.leftDelim!=null){var c=new _e.MathNode("mo",[new _e.TextNode(t.leftDelim.replace("\\",""))]);c.setAttribute("fence","true"),l.push(c)}if(l.push(n),t.rightDelim!=null){var d=new _e.MathNode("mo",[new _e.TextNode(t.rightDelim.replace("\\",""))]);d.setAttribute("fence","true"),l.push(d)}return _5(l)}return n};Qe({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1],l,c=null,d=null,h="auto";switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":l=!0;break;case"\\\\atopfrac":l=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":l=!1,c="(",d=")";break;case"\\\\bracefrac":l=!1,c="\\{",d="\\}";break;case"\\\\brackfrac":l=!1,c="[",d="]";break;default:throw new Error("Unrecognized genfrac command")}switch(r){case"\\dfrac":case"\\dbinom":h="display";break;case"\\tfrac":case"\\tbinom":h="text";break}return{type:"genfrac",mode:n.mode,continued:!1,numer:s,denom:i,hasBarLine:l,leftDelim:c,rightDelim:d,size:h,barSize:null}},htmlBuilder:F5,mathmlBuilder:Q5});Qe({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1];return{type:"genfrac",mode:n.mode,continued:!0,numer:s,denom:i,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});Qe({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(t){var{parser:e,funcName:n,token:r}=t,s;switch(n){case"\\over":s="\\frac";break;case"\\choose":s="\\binom";break;case"\\atop":s="\\\\atopfrac";break;case"\\brace":s="\\\\bracefrac";break;case"\\brack":s="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:s,token:r}}});var wN=["display","text","script","scriptscript"],SN=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};Qe({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(t,e){var{parser:n}=t,r=e[4],s=e[5],i=Zg(e[0]),l=i.type==="atom"&&i.family==="open"?SN(i.text):null,c=Zg(e[1]),d=c.type==="atom"&&c.family==="close"?SN(c.text):null,h=Nt(e[2],"size"),m,p=null;h.isBlank?m=!0:(p=h.value,m=p.number>0);var x="auto",v=e[3];if(v.type==="ordgroup"){if(v.body.length>0){var b=Nt(v.body[0],"textord");x=wN[Number(b.text)]}}else v=Nt(v,"textord"),x=wN[Number(v.text)];return{type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:m,barSize:p,leftDelim:l,rightDelim:d,size:x}},htmlBuilder:F5,mathmlBuilder:Q5});Qe({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(t,e){var{parser:n,funcName:r,token:s}=t;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:Nt(e[0],"size").value,token:s}}});Qe({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=Toe(Nt(e[1],"infix").size),l=e[2],c=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:l,continued:!1,hasBarLine:c,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:F5,mathmlBuilder:Q5});var QR=(t,e)=>{var n=e.style,r,s;t.type==="supsub"?(r=t.sup?Kt(t.sup,e.havingStyle(n.sup()),e):Kt(t.sub,e.havingStyle(n.sub()),e),s=Nt(t.base,"horizBrace")):s=Nt(t,"horizBrace");var i=Kt(s.base,e.havingBaseStyle(at.DISPLAY)),l=yl.svgSpan(s,e),c;if(s.isOver?(c=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:l}]},e),c.children[0].children[0].children[1].classes.push("svg-align")):(c=ge.makeVList({positionType:"bottom",positionData:i.depth+.1+l.height,children:[{type:"elem",elem:l},{type:"kern",size:.1},{type:"elem",elem:i}]},e),c.children[0].children[0].children[0].classes.push("svg-align")),r){var d=ge.makeSpan(["mord",s.isOver?"mover":"munder"],[c],e);s.isOver?c=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:d},{type:"kern",size:.2},{type:"elem",elem:r}]},e):c=ge.makeVList({positionType:"bottom",positionData:d.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:d}]},e)}return ge.makeSpan(["mord",s.isOver?"mover":"munder"],[c],e)},Jce=(t,e)=>{var n=yl.mathMLnode(t.label);return new _e.MathNode(t.isOver?"mover":"munder",[zn(t.base,e),n])};Qe({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"horizBrace",mode:n.mode,label:r,isOver:/^\\over/.test(r),base:e[0]}},htmlBuilder:QR,mathmlBuilder:Jce});Qe({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],s=Nt(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:ar(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=Ar(t.body,e,!1);return ge.makeAnchor(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=wo(t.body,e);return n instanceof ni||(n=new ni("mrow",[n])),n.setAttribute("href",t.href),n}});Qe({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=Nt(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var s=[],i=0;i{var{parser:n,funcName:r,token:s}=t,i=Nt(e[0],"raw").string,l=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var c,d={};switch(r){case"\\htmlClass":d.class=i,c={command:"\\htmlClass",class:i};break;case"\\htmlId":d.id=i,c={command:"\\htmlId",id:i};break;case"\\htmlStyle":d.style=i,c={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var h=i.split(","),m=0;m{var n=Ar(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var s=ge.makeSpan(r,n,e);for(var i in t.attributes)i!=="class"&&t.attributes.hasOwnProperty(i)&&s.setAttribute(i,t.attributes[i]);return s},mathmlBuilder:(t,e)=>wo(t.body,e)});Qe({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:ar(e[0]),mathml:ar(e[1])}},htmlBuilder:(t,e)=>{var n=Ar(t.html,e,!1);return ge.makeFragment(n)},mathmlBuilder:(t,e)=>wo(t.mathml,e)});var qb=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!n)throw new De("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!lR(r))throw new De("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Qe({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(t,e,n)=>{var{parser:r}=t,s={number:0,unit:"em"},i={number:.9,unit:"em"},l={number:0,unit:"em"},c="";if(n[0])for(var d=Nt(n[0],"raw").string,h=d.split(","),m=0;m{var n=Kn(t.height,e),r=0;t.totalheight.number>0&&(r=Kn(t.totalheight,e)-n);var s=0;t.width.number>0&&(s=Kn(t.width,e));var i={height:Le(n+r)};s>0&&(i.width=Le(s)),r>0&&(i.verticalAlign=Le(-r));var l=new Joe(t.src,t.alt,i);return l.height=n,l.depth=r,l},mathmlBuilder:(t,e)=>{var n=new _e.MathNode("mglyph",[]);n.setAttribute("alt",t.alt);var r=Kn(t.height,e),s=0;if(t.totalheight.number>0&&(s=Kn(t.totalheight,e)-r,n.setAttribute("valign",Le(-s))),n.setAttribute("height",Le(r+s)),t.width.number>0){var i=Kn(t.width,e);n.setAttribute("width",Le(i))}return n.setAttribute("src",t.src),n}});Qe({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=Nt(e[0],"size");if(n.settings.strict){var i=r[1]==="m",l=s.value.unit==="mu";i?(l||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):l&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:s.value}},htmlBuilder(t,e){return ge.makeGlue(t.dimension,e)},mathmlBuilder(t,e){var n=Kn(t.dimension,e);return new _e.SpaceNode(n)}});Qe({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:s}},htmlBuilder:(t,e)=>{var n;t.alignment==="clap"?(n=ge.makeSpan([],[Kt(t.body,e)]),n=ge.makeSpan(["inner"],[n],e)):n=ge.makeSpan(["inner"],[Kt(t.body,e)]);var r=ge.makeSpan(["fix"],[]),s=ge.makeSpan([t.alignment],[n,r],e),i=ge.makeSpan(["strut"]);return i.style.height=Le(s.height+s.depth),s.depth&&(i.style.verticalAlign=Le(-s.depth)),s.children.unshift(i),s=ge.makeSpan(["thinbox"],[s],e),ge.makeSpan(["mord","vbox"],[s],e)},mathmlBuilder:(t,e)=>{var n=new _e.MathNode("mpadded",[zn(t.body,e)]);if(t.alignment!=="rlap"){var r=t.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});Qe({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){var{funcName:n,parser:r}=t,s=r.mode;r.switchMode("math");var i=n==="\\("?"\\)":"$",l=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",body:l}}});Qe({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new De("Mismatched "+t.funcName)}});var kN=(t,e)=>{switch(e.style.size){case at.DISPLAY.size:return t.display;case at.TEXT.size:return t.text;case at.SCRIPT.size:return t.script;case at.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};Qe({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:ar(e[0]),text:ar(e[1]),script:ar(e[2]),scriptscript:ar(e[3])}},htmlBuilder:(t,e)=>{var n=kN(t,e),r=Ar(n,e,!1);return ge.makeFragment(r)},mathmlBuilder:(t,e)=>{var n=kN(t,e);return wo(n,e)}});var $R=(t,e,n,r,s,i,l)=>{t=ge.makeSpan([],[t]);var c=n&&tn.isCharacterBox(n),d,h;if(e){var m=Kt(e,r.havingStyle(s.sup()),r);h={elem:m,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-m.depth)}}if(n){var p=Kt(n,r.havingStyle(s.sub()),r);d={elem:p,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-p.height)}}var x;if(h&&d){var v=r.fontMetrics().bigOpSpacing5+d.elem.height+d.elem.depth+d.kern+t.depth+l;x=ge.makeVList({positionType:"bottom",positionData:v,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:d.elem,marginLeft:Le(-i)},{type:"kern",size:d.kern},{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Le(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(d){var b=t.height-l;x=ge.makeVList({positionType:"top",positionData:b,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:d.elem,marginLeft:Le(-i)},{type:"kern",size:d.kern},{type:"elem",elem:t}]},r)}else if(h){var k=t.depth+l;x=ge.makeVList({positionType:"bottom",positionData:k,children:[{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Le(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else return t;var O=[x];if(d&&i!==0&&!c){var j=ge.makeSpan(["mspace"],[],r);j.style.marginRight=Le(i),O.unshift(j)}return ge.makeSpan(["mop","op-limits"],O,r)},HR=["\\smallint"],zd=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Nt(t.base,"op"),s=!0):i=Nt(t,"op");var l=e.style,c=!1;l.size===at.DISPLAY.size&&i.symbol&&!HR.includes(i.name)&&(c=!0);var d;if(i.symbol){var h=c?"Size2-Regular":"Size1-Regular",m="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(m=i.name.slice(1),i.name=m==="oiint"?"\\iint":"\\iiint"),d=ge.makeSymbol(i.name,h,"math",e,["mop","op-symbol",c?"large-op":"small-op"]),m.length>0){var p=d.italic,x=ge.staticSvg(m+"Size"+(c?"2":"1"),e);d=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:d,shift:0},{type:"elem",elem:x,shift:c?.08:0}]},e),i.name="\\"+m,d.classes.unshift("mop"),d.italic=p}}else if(i.body){var v=Ar(i.body,e,!0);v.length===1&&v[0]instanceof Ai?(d=v[0],d.classes[0]="mop"):d=ge.makeSpan(["mop"],v,e)}else{for(var b=[],k=1;k{var n;if(t.symbol)n=new ni("mo",[Mi(t.name,t.mode)]),HR.includes(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new ni("mo",Fs(t.body,e));else{n=new ni("mi",[new ga(t.name.slice(1))]);var r=new ni("mo",[Mi("⁡","text")]);t.parentIsSupSub?n=new ni("mrow",[n,r]):n=vR([n,r])}return n},eue={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Qe({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=r;return s.length===1&&(s=eue[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:zd,mathmlBuilder:k0});Qe({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:ar(r)}},htmlBuilder:zd,mathmlBuilder:k0});var tue={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Qe({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:zd,mathmlBuilder:k0});Qe({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:zd,mathmlBuilder:k0});Qe({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t,r=n;return r.length===1&&(r=tue[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:zd,mathmlBuilder:k0});var UR=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Nt(t.base,"operatorname"),s=!0):i=Nt(t,"operatorname");var l;if(i.body.length>0){for(var c=i.body.map(p=>{var x=p.text;return typeof x=="string"?{type:"textord",mode:p.mode,text:x}:p}),d=Ar(c,e.withFont("mathrm"),!0),h=0;h{for(var n=Fs(t.body,e.withFont("mathrm")),r=!0,s=0;sm.toText()).join("");n=[new _e.TextNode(c)]}var d=new _e.MathNode("mi",n);d.setAttribute("mathvariant","normal");var h=new _e.MathNode("mo",[Mi("⁡","text")]);return t.parentIsSupSub?new _e.MathNode("mrow",[d,h]):_e.newDocumentFragment([d,h])};Qe({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"operatorname",mode:n.mode,body:ar(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:UR,mathmlBuilder:nue});q("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Rc({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?ge.makeFragment(Ar(t.body,e,!1)):ge.makeSpan(["mord"],Ar(t.body,e,!0),e)},mathmlBuilder(t,e){return wo(t.body,e,!0)}});Qe({type:"overline",names:["\\overline"],props:{numArgs:1},handler(t,e){var{parser:n}=t,r=e[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(t,e){var n=Kt(t.body,e.havingCrampedStyle()),r=ge.makeLineSpan("overline-line",e),s=e.fontMetrics().defaultRuleThickness,i=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]},e);return ge.makeSpan(["mord","overline"],[i],e)},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[new _e.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new _e.MathNode("mover",[zn(t.body,e),n]);return r.setAttribute("accent","true"),r}});Qe({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"phantom",mode:n.mode,body:ar(r)}},htmlBuilder:(t,e)=>{var n=Ar(t.body,e.withPhantom(),!1);return ge.makeFragment(n)},mathmlBuilder:(t,e)=>{var n=Fs(t.body,e);return new _e.MathNode("mphantom",n)}});Qe({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=ge.makeSpan([],[Kt(t.body,e.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r{var n=Fs(ar(t.body),e),r=new _e.MathNode("mphantom",n),s=new _e.MathNode("mpadded",[r]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});Qe({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=ge.makeSpan(["inner"],[Kt(t.body,e.withPhantom())]),r=ge.makeSpan(["fix"],[]);return ge.makeSpan(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=Fs(ar(t.body),e),r=new _e.MathNode("mphantom",n),s=new _e.MathNode("mpadded",[r]);return s.setAttribute("width","0px"),s}});Qe({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=Nt(e[0],"size").value,s=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(t,e){var n=Kt(t.body,e),r=Kn(t.dy,e);return ge.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){var n=new _e.MathNode("mpadded",[zn(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});Qe({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});Qe({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(t,e,n){var{parser:r}=t,s=n[0],i=Nt(e[0],"size"),l=Nt(e[1],"size");return{type:"rule",mode:r.mode,shift:s&&Nt(s,"size").value,width:i.value,height:l.value}},htmlBuilder(t,e){var n=ge.makeSpan(["mord","rule"],[],e),r=Kn(t.width,e),s=Kn(t.height,e),i=t.shift?Kn(t.shift,e):0;return n.style.borderRightWidth=Le(r),n.style.borderTopWidth=Le(s),n.style.bottom=Le(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=Kn(t.width,e),r=Kn(t.height,e),s=t.shift?Kn(t.shift,e):0,i=e.color&&e.getColor()||"black",l=new _e.MathNode("mspace");l.setAttribute("mathbackground",i),l.setAttribute("width",Le(n)),l.setAttribute("height",Le(r));var c=new _e.MathNode("mpadded",[l]);return s>=0?c.setAttribute("height",Le(s)):(c.setAttribute("height",Le(s)),c.setAttribute("depth",Le(-s))),c.setAttribute("voffset",Le(s)),c}});function VR(t,e,n){for(var r=Ar(t,e,!1),s=e.sizeMultiplier/n.sizeMultiplier,i=0;i{var n=e.havingSize(t.size);return VR(t.body,n,e)};Qe({type:"sizing",names:ON,props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!1,n);return{type:"sizing",mode:s.mode,size:ON.indexOf(r)+1,body:i}},htmlBuilder:rue,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=Fs(t.body,n),s=new _e.MathNode("mstyle",r);return s.setAttribute("mathsize",Le(n.sizeMultiplier)),s}});Qe({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,s=!1,i=!1,l=n[0]&&Nt(n[0],"ordgroup");if(l)for(var c="",d=0;d{var n=ge.makeSpan([],[Kt(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return n;if(t.smashHeight&&(n.height=0,n.children))for(var r=0;r{var n=new _e.MathNode("mpadded",[zn(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});Qe({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r}=t,s=n[0],i=e[0];return{type:"sqrt",mode:r.mode,body:i,index:s}},htmlBuilder(t,e){var n=Kt(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=ge.wrapFragment(n,e);var r=e.fontMetrics(),s=r.defaultRuleThickness,i=s;e.style.idn.height+n.depth+l&&(l=(l+p-n.height-n.depth)/2);var x=d.height-n.height-l-h;n.style.paddingLeft=Le(m);var v=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+x)},{type:"elem",elem:d},{type:"kern",size:h}]},e);if(t.index){var b=e.havingStyle(at.SCRIPTSCRIPT),k=Kt(t.index,b,e),O=.6*(v.height-v.depth),j=ge.makeVList({positionType:"shift",positionData:-O,children:[{type:"elem",elem:k}]},e),T=ge.makeSpan(["root"],[j]);return ge.makeSpan(["mord","sqrt"],[T,v],e)}else return ge.makeSpan(["mord","sqrt"],[v],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new _e.MathNode("mroot",[zn(n,e),zn(r,e)]):new _e.MathNode("msqrt",[zn(n,e)])}});var jN={display:at.DISPLAY,text:at.TEXT,script:at.SCRIPT,scriptscript:at.SCRIPTSCRIPT};Qe({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t,e){var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!0,n),l=r.slice(1,r.length-5);return{type:"styling",mode:s.mode,style:l,body:i}},htmlBuilder(t,e){var n=jN[t.style],r=e.havingStyle(n).withFont("");return VR(t.body,r,e)},mathmlBuilder(t,e){var n=jN[t.style],r=e.havingStyle(n),s=Fs(t.body,r),i=new _e.MathNode("mstyle",s),l={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},c=l[t.style];return i.setAttribute("scriptlevel",c[0]),i.setAttribute("displaystyle",c[1]),i}});var sue=function(e,n){var r=e.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===at.DISPLAY.size||r.alwaysHandleSupSub);return s?zd:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===at.DISPLAY.size||r.limits);return i?UR:null}else{if(r.type==="accent")return tn.isCharacterBox(r.base)?z5:null;if(r.type==="horizBrace"){var l=!e.sub;return l===r.isOver?QR:null}else return null}else return null};Rc({type:"supsub",htmlBuilder(t,e){var n=sue(t,e);if(n)return n(t,e);var{base:r,sup:s,sub:i}=t,l=Kt(r,e),c,d,h=e.fontMetrics(),m=0,p=0,x=r&&tn.isCharacterBox(r);if(s){var v=e.havingStyle(e.style.sup());c=Kt(s,v,e),x||(m=l.height-v.fontMetrics().supDrop*v.sizeMultiplier/e.sizeMultiplier)}if(i){var b=e.havingStyle(e.style.sub());d=Kt(i,b,e),x||(p=l.depth+b.fontMetrics().subDrop*b.sizeMultiplier/e.sizeMultiplier)}var k;e.style===at.DISPLAY?k=h.sup1:e.style.cramped?k=h.sup3:k=h.sup2;var O=e.sizeMultiplier,j=Le(.5/h.ptPerEm/O),T=null;if(d){var A=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(l instanceof Ai||A)&&(T=Le(-l.italic))}var _;if(c&&d){m=Math.max(m,k,c.depth+.25*h.xHeight),p=Math.max(p,h.sub2);var D=h.defaultRuleThickness,E=4*D;if(m-c.depth-(d.height-p)0&&(m+=z,p-=z)}var Q=[{type:"elem",elem:d,shift:p,marginRight:j,marginLeft:T},{type:"elem",elem:c,shift:-m,marginRight:j}];_=ge.makeVList({positionType:"individualShift",children:Q},e)}else if(d){p=Math.max(p,h.sub1,d.height-.8*h.xHeight);var F=[{type:"elem",elem:d,marginLeft:T,marginRight:j}];_=ge.makeVList({positionType:"shift",positionData:p,children:F},e)}else if(c)m=Math.max(m,k,c.depth+.25*h.xHeight),_=ge.makeVList({positionType:"shift",positionData:-m,children:[{type:"elem",elem:c,marginRight:j}]},e);else throw new Error("supsub must have either sup or sub.");var L=N4(l,"right")||"mord";return ge.makeSpan([L],[l,ge.makeSpan(["msupsub"],[_])],e)},mathmlBuilder(t,e){var n=!1,r,s;t.base&&t.base.type==="horizBrace"&&(s=!!t.sup,s===t.base.isOver&&(n=!0,r=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var i=[zn(t.base,e)];t.sub&&i.push(zn(t.sub,e)),t.sup&&i.push(zn(t.sup,e));var l;if(n)l=r?"mover":"munder";else if(t.sub)if(t.sup){var h=t.base;h&&h.type==="op"&&h.limits&&e.style===at.DISPLAY||h&&h.type==="operatorname"&&h.alwaysHandleSupSub&&(e.style===at.DISPLAY||h.limits)?l="munderover":l="msubsup"}else{var d=t.base;d&&d.type==="op"&&d.limits&&(e.style===at.DISPLAY||d.alwaysHandleSupSub)||d&&d.type==="operatorname"&&d.alwaysHandleSupSub&&(d.limits||e.style===at.DISPLAY)?l="munder":l="msub"}else{var c=t.base;c&&c.type==="op"&&c.limits&&(e.style===at.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||e.style===at.DISPLAY)?l="mover":l="msup"}return new _e.MathNode(l,i)}});Rc({type:"atom",htmlBuilder(t,e){return ge.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[Mi(t.text,t.mode)]);if(t.family==="bin"){var r=D5(t,e);r==="bold-italic"&&n.setAttribute("mathvariant",r)}else t.family==="punct"?n.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&n.setAttribute("stretchy","false");return n}});var WR={mi:"italic",mn:"normal",mtext:"normal"};Rc({type:"mathord",htmlBuilder(t,e){return ge.makeOrd(t,e,"mathord")},mathmlBuilder(t,e){var n=new _e.MathNode("mi",[Mi(t.text,t.mode,e)]),r=D5(t,e)||"italic";return r!==WR[n.type]&&n.setAttribute("mathvariant",r),n}});Rc({type:"textord",htmlBuilder(t,e){return ge.makeOrd(t,e,"textord")},mathmlBuilder(t,e){var n=Mi(t.text,t.mode,e),r=D5(t,e)||"normal",s;return t.mode==="text"?s=new _e.MathNode("mtext",[n]):/[0-9]/.test(t.text)?s=new _e.MathNode("mn",[n]):t.text==="\\prime"?s=new _e.MathNode("mo",[n]):s=new _e.MathNode("mi",[n]),r!==WR[s.type]&&s.setAttribute("mathvariant",r),s}});var Fb={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Qb={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Rc({type:"spacing",htmlBuilder(t,e){if(Qb.hasOwnProperty(t.text)){var n=Qb[t.text].className||"";if(t.mode==="text"){var r=ge.makeOrd(t,e,"textord");return r.classes.push(n),r}else return ge.makeSpan(["mspace",n],[ge.mathsym(t.text,t.mode,e)],e)}else{if(Fb.hasOwnProperty(t.text))return ge.makeSpan(["mspace",Fb[t.text]],[],e);throw new De('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(Qb.hasOwnProperty(t.text))n=new _e.MathNode("mtext",[new _e.TextNode(" ")]);else{if(Fb.hasOwnProperty(t.text))return new _e.MathNode("mspace");throw new De('Unknown type of space "'+t.text+'"')}return n}});var NN=()=>{var t=new _e.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};Rc({type:"tag",mathmlBuilder(t,e){var n=new _e.MathNode("mtable",[new _e.MathNode("mtr",[NN(),new _e.MathNode("mtd",[wo(t.body,e)]),NN(),new _e.MathNode("mtd",[wo(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var CN={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},TN={"\\textbf":"textbf","\\textmd":"textmd"},iue={"\\textit":"textit","\\textup":"textup"},AN=(t,e)=>{var n=t.font;if(n){if(CN[n])return e.withTextFontFamily(CN[n]);if(TN[n])return e.withTextFontWeight(TN[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(iue[n])};Qe({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"text",mode:n.mode,body:ar(s),font:r}},htmlBuilder(t,e){var n=AN(t,e),r=Ar(t.body,n,!0);return ge.makeSpan(["mord","text"],r,n)},mathmlBuilder(t,e){var n=AN(t,e);return wo(t.body,n)}});Qe({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"underline",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Kt(t.body,e),r=ge.makeLineSpan("underline-line",e),s=e.fontMetrics().defaultRuleThickness,i=ge.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]},e);return ge.makeSpan(["mord","underline"],[i],e)},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[new _e.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new _e.MathNode("munder",[zn(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});Qe({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"vcenter",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Kt(t.body,e),r=e.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return ge.makeVList({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){return new _e.MathNode("mpadded",[zn(t.body,e)],["vcenter"])}});Qe({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new De("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=MN(t),r=[],s=e.havingStyle(e.style.text()),i=0;it.body.replace(/ /g,t.star?"␣":" "),io=gR,GR=`[ \r +-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class w0{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),n=0;nn.toText();return this.children.map(e).join("")}}var ma={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Tp={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},rN={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function Goe(t,e){ma[t]=e}function M5(t,e,n){if(!ma[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),s=ma[e][r];if(!s&&t[0]in rN&&(r=rN[t[0]].charCodeAt(0),s=ma[e][r]),!s&&n==="text"&&aR(r)&&(s=ma[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var Mb={};function Xoe(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!Mb[e]){var n=Mb[e]={cssEmPerMu:Tp.quad[e]/18};for(var r in Tp)Tp.hasOwnProperty(r)&&(n[r]=Tp[r][e])}return Mb[e]}var Yoe=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],sN=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],iN=function(e,n){return n.size<2?e:Yoe[e-1][n.size-1]};class rl{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||rl.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=sN[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return new rl(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:iN(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:sN[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=iN(rl.BASESIZE,e);return this.size===n&&this.textSize===rl.BASESIZE&&this.style===e?this:this.extend({style:e,size:n})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==rl.BASESIZE?["sizing","reset-size"+this.size,"size"+rl.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Xoe(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}rl.BASESIZE=6;var k4={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},Koe={ex:!0,em:!0,mu:!0},lR=function(e){return typeof e!="string"&&(e=e.unit),e in k4||e in Koe||e==="ex"},Kn=function(e,n){var r;if(e.unit in k4)r=k4[e.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(e.unit==="mu")r=n.fontMetrics().cssEmPerMu;else{var s;if(n.style.isTight()?s=n.havingStyle(n.style.text()):s=n,e.unit==="ex")r=s.fontMetrics().xHeight;else if(e.unit==="em")r=s.fontMetrics().quad;else throw new De("Invalid unit: '"+e.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},Le=function(e){return+e.toFixed(4)+"em"},vo=function(e){return e.filter(n=>n).join(" ")},oR=function(e,n,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},n){n.style.isTight()&&this.classes.push("mtight");var s=n.getColor();s&&(this.style.color=s)}},cR=function(e){var n=document.createElement(e);n.className=vo(this.classes);for(var r in this.style)this.style.hasOwnProperty(r)&&(n.style[r]=this.style[r]);for(var s in this.attributes)this.attributes.hasOwnProperty(s)&&n.setAttribute(s,this.attributes[s]);for(var i=0;i/=\x00-\x1f]/,uR=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+tn.escape(vo(this.classes))+'"');var r="";for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=tn.hyphenate(s)+":"+this.style[s]+";");r&&(n+=' style="'+tn.escape(r)+'"');for(var i in this.attributes)if(this.attributes.hasOwnProperty(i)){if(Zoe.test(i))throw new De("Invalid attribute name '"+i+"'");n+=" "+i+'="'+tn.escape(this.attributes[i])+'"'}n+=">";for(var l=0;l",n};class S0{constructor(e,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,oR.call(this,e,r,s),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return cR.call(this,"span")}toMarkup(){return uR.call(this,"span")}}class A5{constructor(e,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,oR.call(this,n,s),this.children=r||[],this.setAttribute("href",e)}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return cR.call(this,"a")}toMarkup(){return uR.call(this,"a")}}class Joe{constructor(e,n,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=e,this.classes=["mord"],this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var n in this.style)this.style.hasOwnProperty(n)&&(e.style[n]=this.style[n]);return e}toMarkup(){var e=''+tn.escape(this.alt)+'0&&(n=document.createElement("span"),n.style.marginRight=Le(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=vo(this.classes));for(var r in this.style)this.style.hasOwnProperty(r)&&(n=n||document.createElement("span"),n.style[r]=this.style[r]);return n?(n.appendChild(e),n):e}toMarkup(){var e=!1,n="0&&(r+="margin-right:"+this.italic+"em;");for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=tn.hyphenate(s)+":"+this.style[s]+";");r&&(e=!0,n+=' style="'+tn.escape(r)+'"');var i=tn.escape(this.text);return e?(n+=">",n+=i,n+="",n):i}}class gl{constructor(e,n){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=n||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);for(var s=0;s':''}}class O4{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"line");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var e=" but got "+String(t)+".")}var nce={bin:1,close:1,inner:1,open:1,punct:1,rel:1},rce={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Ln={math:{},text:{}};function N(t,e,n,r,s,i){Ln[t][s]={font:e,group:n,replace:r},i&&r&&(Ln[t][r]=Ln[t][s])}var C="math",Ee="text",B="main",G="ams",Wn="accent-token",Ve="bin",xs="close",Rd="inner",st="mathord",yr="op-token",ai="open",$x="punct",X="rel",wl="spacing",le="textord";N(C,B,X,"≡","\\equiv",!0);N(C,B,X,"≺","\\prec",!0);N(C,B,X,"≻","\\succ",!0);N(C,B,X,"∼","\\sim",!0);N(C,B,X,"⊥","\\perp");N(C,B,X,"⪯","\\preceq",!0);N(C,B,X,"⪰","\\succeq",!0);N(C,B,X,"≃","\\simeq",!0);N(C,B,X,"∣","\\mid",!0);N(C,B,X,"≪","\\ll",!0);N(C,B,X,"≫","\\gg",!0);N(C,B,X,"≍","\\asymp",!0);N(C,B,X,"∥","\\parallel");N(C,B,X,"⋈","\\bowtie",!0);N(C,B,X,"⌣","\\smile",!0);N(C,B,X,"⊑","\\sqsubseteq",!0);N(C,B,X,"⊒","\\sqsupseteq",!0);N(C,B,X,"≐","\\doteq",!0);N(C,B,X,"⌢","\\frown",!0);N(C,B,X,"∋","\\ni",!0);N(C,B,X,"∝","\\propto",!0);N(C,B,X,"⊢","\\vdash",!0);N(C,B,X,"⊣","\\dashv",!0);N(C,B,X,"∋","\\owns");N(C,B,$x,".","\\ldotp");N(C,B,$x,"⋅","\\cdotp");N(C,B,le,"#","\\#");N(Ee,B,le,"#","\\#");N(C,B,le,"&","\\&");N(Ee,B,le,"&","\\&");N(C,B,le,"ℵ","\\aleph",!0);N(C,B,le,"∀","\\forall",!0);N(C,B,le,"ℏ","\\hbar",!0);N(C,B,le,"∃","\\exists",!0);N(C,B,le,"∇","\\nabla",!0);N(C,B,le,"♭","\\flat",!0);N(C,B,le,"ℓ","\\ell",!0);N(C,B,le,"♮","\\natural",!0);N(C,B,le,"♣","\\clubsuit",!0);N(C,B,le,"℘","\\wp",!0);N(C,B,le,"♯","\\sharp",!0);N(C,B,le,"♢","\\diamondsuit",!0);N(C,B,le,"ℜ","\\Re",!0);N(C,B,le,"♡","\\heartsuit",!0);N(C,B,le,"ℑ","\\Im",!0);N(C,B,le,"♠","\\spadesuit",!0);N(C,B,le,"§","\\S",!0);N(Ee,B,le,"§","\\S");N(C,B,le,"¶","\\P",!0);N(Ee,B,le,"¶","\\P");N(C,B,le,"†","\\dag");N(Ee,B,le,"†","\\dag");N(Ee,B,le,"†","\\textdagger");N(C,B,le,"‡","\\ddag");N(Ee,B,le,"‡","\\ddag");N(Ee,B,le,"‡","\\textdaggerdbl");N(C,B,xs,"⎱","\\rmoustache",!0);N(C,B,ai,"⎰","\\lmoustache",!0);N(C,B,xs,"⟯","\\rgroup",!0);N(C,B,ai,"⟮","\\lgroup",!0);N(C,B,Ve,"∓","\\mp",!0);N(C,B,Ve,"⊖","\\ominus",!0);N(C,B,Ve,"⊎","\\uplus",!0);N(C,B,Ve,"⊓","\\sqcap",!0);N(C,B,Ve,"∗","\\ast");N(C,B,Ve,"⊔","\\sqcup",!0);N(C,B,Ve,"◯","\\bigcirc",!0);N(C,B,Ve,"∙","\\bullet",!0);N(C,B,Ve,"‡","\\ddagger");N(C,B,Ve,"≀","\\wr",!0);N(C,B,Ve,"⨿","\\amalg");N(C,B,Ve,"&","\\And");N(C,B,X,"⟵","\\longleftarrow",!0);N(C,B,X,"⇐","\\Leftarrow",!0);N(C,B,X,"⟸","\\Longleftarrow",!0);N(C,B,X,"⟶","\\longrightarrow",!0);N(C,B,X,"⇒","\\Rightarrow",!0);N(C,B,X,"⟹","\\Longrightarrow",!0);N(C,B,X,"↔","\\leftrightarrow",!0);N(C,B,X,"⟷","\\longleftrightarrow",!0);N(C,B,X,"⇔","\\Leftrightarrow",!0);N(C,B,X,"⟺","\\Longleftrightarrow",!0);N(C,B,X,"↦","\\mapsto",!0);N(C,B,X,"⟼","\\longmapsto",!0);N(C,B,X,"↗","\\nearrow",!0);N(C,B,X,"↩","\\hookleftarrow",!0);N(C,B,X,"↪","\\hookrightarrow",!0);N(C,B,X,"↘","\\searrow",!0);N(C,B,X,"↼","\\leftharpoonup",!0);N(C,B,X,"⇀","\\rightharpoonup",!0);N(C,B,X,"↙","\\swarrow",!0);N(C,B,X,"↽","\\leftharpoondown",!0);N(C,B,X,"⇁","\\rightharpoondown",!0);N(C,B,X,"↖","\\nwarrow",!0);N(C,B,X,"⇌","\\rightleftharpoons",!0);N(C,G,X,"≮","\\nless",!0);N(C,G,X,"","\\@nleqslant");N(C,G,X,"","\\@nleqq");N(C,G,X,"⪇","\\lneq",!0);N(C,G,X,"≨","\\lneqq",!0);N(C,G,X,"","\\@lvertneqq");N(C,G,X,"⋦","\\lnsim",!0);N(C,G,X,"⪉","\\lnapprox",!0);N(C,G,X,"⊀","\\nprec",!0);N(C,G,X,"⋠","\\npreceq",!0);N(C,G,X,"⋨","\\precnsim",!0);N(C,G,X,"⪹","\\precnapprox",!0);N(C,G,X,"≁","\\nsim",!0);N(C,G,X,"","\\@nshortmid");N(C,G,X,"∤","\\nmid",!0);N(C,G,X,"⊬","\\nvdash",!0);N(C,G,X,"⊭","\\nvDash",!0);N(C,G,X,"⋪","\\ntriangleleft");N(C,G,X,"⋬","\\ntrianglelefteq",!0);N(C,G,X,"⊊","\\subsetneq",!0);N(C,G,X,"","\\@varsubsetneq");N(C,G,X,"⫋","\\subsetneqq",!0);N(C,G,X,"","\\@varsubsetneqq");N(C,G,X,"≯","\\ngtr",!0);N(C,G,X,"","\\@ngeqslant");N(C,G,X,"","\\@ngeqq");N(C,G,X,"⪈","\\gneq",!0);N(C,G,X,"≩","\\gneqq",!0);N(C,G,X,"","\\@gvertneqq");N(C,G,X,"⋧","\\gnsim",!0);N(C,G,X,"⪊","\\gnapprox",!0);N(C,G,X,"⊁","\\nsucc",!0);N(C,G,X,"⋡","\\nsucceq",!0);N(C,G,X,"⋩","\\succnsim",!0);N(C,G,X,"⪺","\\succnapprox",!0);N(C,G,X,"≆","\\ncong",!0);N(C,G,X,"","\\@nshortparallel");N(C,G,X,"∦","\\nparallel",!0);N(C,G,X,"⊯","\\nVDash",!0);N(C,G,X,"⋫","\\ntriangleright");N(C,G,X,"⋭","\\ntrianglerighteq",!0);N(C,G,X,"","\\@nsupseteqq");N(C,G,X,"⊋","\\supsetneq",!0);N(C,G,X,"","\\@varsupsetneq");N(C,G,X,"⫌","\\supsetneqq",!0);N(C,G,X,"","\\@varsupsetneqq");N(C,G,X,"⊮","\\nVdash",!0);N(C,G,X,"⪵","\\precneqq",!0);N(C,G,X,"⪶","\\succneqq",!0);N(C,G,X,"","\\@nsubseteqq");N(C,G,Ve,"⊴","\\unlhd");N(C,G,Ve,"⊵","\\unrhd");N(C,G,X,"↚","\\nleftarrow",!0);N(C,G,X,"↛","\\nrightarrow",!0);N(C,G,X,"⇍","\\nLeftarrow",!0);N(C,G,X,"⇏","\\nRightarrow",!0);N(C,G,X,"↮","\\nleftrightarrow",!0);N(C,G,X,"⇎","\\nLeftrightarrow",!0);N(C,G,X,"△","\\vartriangle");N(C,G,le,"ℏ","\\hslash");N(C,G,le,"▽","\\triangledown");N(C,G,le,"◊","\\lozenge");N(C,G,le,"Ⓢ","\\circledS");N(C,G,le,"®","\\circledR");N(Ee,G,le,"®","\\circledR");N(C,G,le,"∡","\\measuredangle",!0);N(C,G,le,"∄","\\nexists");N(C,G,le,"℧","\\mho");N(C,G,le,"Ⅎ","\\Finv",!0);N(C,G,le,"⅁","\\Game",!0);N(C,G,le,"‵","\\backprime");N(C,G,le,"▲","\\blacktriangle");N(C,G,le,"▼","\\blacktriangledown");N(C,G,le,"■","\\blacksquare");N(C,G,le,"⧫","\\blacklozenge");N(C,G,le,"★","\\bigstar");N(C,G,le,"∢","\\sphericalangle",!0);N(C,G,le,"∁","\\complement",!0);N(C,G,le,"ð","\\eth",!0);N(Ee,B,le,"ð","ð");N(C,G,le,"╱","\\diagup");N(C,G,le,"╲","\\diagdown");N(C,G,le,"□","\\square");N(C,G,le,"□","\\Box");N(C,G,le,"◊","\\Diamond");N(C,G,le,"¥","\\yen",!0);N(Ee,G,le,"¥","\\yen",!0);N(C,G,le,"✓","\\checkmark",!0);N(Ee,G,le,"✓","\\checkmark");N(C,G,le,"ℶ","\\beth",!0);N(C,G,le,"ℸ","\\daleth",!0);N(C,G,le,"ℷ","\\gimel",!0);N(C,G,le,"ϝ","\\digamma",!0);N(C,G,le,"ϰ","\\varkappa");N(C,G,ai,"┌","\\@ulcorner",!0);N(C,G,xs,"┐","\\@urcorner",!0);N(C,G,ai,"└","\\@llcorner",!0);N(C,G,xs,"┘","\\@lrcorner",!0);N(C,G,X,"≦","\\leqq",!0);N(C,G,X,"⩽","\\leqslant",!0);N(C,G,X,"⪕","\\eqslantless",!0);N(C,G,X,"≲","\\lesssim",!0);N(C,G,X,"⪅","\\lessapprox",!0);N(C,G,X,"≊","\\approxeq",!0);N(C,G,Ve,"⋖","\\lessdot");N(C,G,X,"⋘","\\lll",!0);N(C,G,X,"≶","\\lessgtr",!0);N(C,G,X,"⋚","\\lesseqgtr",!0);N(C,G,X,"⪋","\\lesseqqgtr",!0);N(C,G,X,"≑","\\doteqdot");N(C,G,X,"≓","\\risingdotseq",!0);N(C,G,X,"≒","\\fallingdotseq",!0);N(C,G,X,"∽","\\backsim",!0);N(C,G,X,"⋍","\\backsimeq",!0);N(C,G,X,"⫅","\\subseteqq",!0);N(C,G,X,"⋐","\\Subset",!0);N(C,G,X,"⊏","\\sqsubset",!0);N(C,G,X,"≼","\\preccurlyeq",!0);N(C,G,X,"⋞","\\curlyeqprec",!0);N(C,G,X,"≾","\\precsim",!0);N(C,G,X,"⪷","\\precapprox",!0);N(C,G,X,"⊲","\\vartriangleleft");N(C,G,X,"⊴","\\trianglelefteq");N(C,G,X,"⊨","\\vDash",!0);N(C,G,X,"⊪","\\Vvdash",!0);N(C,G,X,"⌣","\\smallsmile");N(C,G,X,"⌢","\\smallfrown");N(C,G,X,"≏","\\bumpeq",!0);N(C,G,X,"≎","\\Bumpeq",!0);N(C,G,X,"≧","\\geqq",!0);N(C,G,X,"⩾","\\geqslant",!0);N(C,G,X,"⪖","\\eqslantgtr",!0);N(C,G,X,"≳","\\gtrsim",!0);N(C,G,X,"⪆","\\gtrapprox",!0);N(C,G,Ve,"⋗","\\gtrdot");N(C,G,X,"⋙","\\ggg",!0);N(C,G,X,"≷","\\gtrless",!0);N(C,G,X,"⋛","\\gtreqless",!0);N(C,G,X,"⪌","\\gtreqqless",!0);N(C,G,X,"≖","\\eqcirc",!0);N(C,G,X,"≗","\\circeq",!0);N(C,G,X,"≜","\\triangleq",!0);N(C,G,X,"∼","\\thicksim");N(C,G,X,"≈","\\thickapprox");N(C,G,X,"⫆","\\supseteqq",!0);N(C,G,X,"⋑","\\Supset",!0);N(C,G,X,"⊐","\\sqsupset",!0);N(C,G,X,"≽","\\succcurlyeq",!0);N(C,G,X,"⋟","\\curlyeqsucc",!0);N(C,G,X,"≿","\\succsim",!0);N(C,G,X,"⪸","\\succapprox",!0);N(C,G,X,"⊳","\\vartriangleright");N(C,G,X,"⊵","\\trianglerighteq");N(C,G,X,"⊩","\\Vdash",!0);N(C,G,X,"∣","\\shortmid");N(C,G,X,"∥","\\shortparallel");N(C,G,X,"≬","\\between",!0);N(C,G,X,"⋔","\\pitchfork",!0);N(C,G,X,"∝","\\varpropto");N(C,G,X,"◀","\\blacktriangleleft");N(C,G,X,"∴","\\therefore",!0);N(C,G,X,"∍","\\backepsilon");N(C,G,X,"▶","\\blacktriangleright");N(C,G,X,"∵","\\because",!0);N(C,G,X,"⋘","\\llless");N(C,G,X,"⋙","\\gggtr");N(C,G,Ve,"⊲","\\lhd");N(C,G,Ve,"⊳","\\rhd");N(C,G,X,"≂","\\eqsim",!0);N(C,B,X,"⋈","\\Join");N(C,G,X,"≑","\\Doteq",!0);N(C,G,Ve,"∔","\\dotplus",!0);N(C,G,Ve,"∖","\\smallsetminus");N(C,G,Ve,"⋒","\\Cap",!0);N(C,G,Ve,"⋓","\\Cup",!0);N(C,G,Ve,"⩞","\\doublebarwedge",!0);N(C,G,Ve,"⊟","\\boxminus",!0);N(C,G,Ve,"⊞","\\boxplus",!0);N(C,G,Ve,"⋇","\\divideontimes",!0);N(C,G,Ve,"⋉","\\ltimes",!0);N(C,G,Ve,"⋊","\\rtimes",!0);N(C,G,Ve,"⋋","\\leftthreetimes",!0);N(C,G,Ve,"⋌","\\rightthreetimes",!0);N(C,G,Ve,"⋏","\\curlywedge",!0);N(C,G,Ve,"⋎","\\curlyvee",!0);N(C,G,Ve,"⊝","\\circleddash",!0);N(C,G,Ve,"⊛","\\circledast",!0);N(C,G,Ve,"⋅","\\centerdot");N(C,G,Ve,"⊺","\\intercal",!0);N(C,G,Ve,"⋒","\\doublecap");N(C,G,Ve,"⋓","\\doublecup");N(C,G,Ve,"⊠","\\boxtimes",!0);N(C,G,X,"⇢","\\dashrightarrow",!0);N(C,G,X,"⇠","\\dashleftarrow",!0);N(C,G,X,"⇇","\\leftleftarrows",!0);N(C,G,X,"⇆","\\leftrightarrows",!0);N(C,G,X,"⇚","\\Lleftarrow",!0);N(C,G,X,"↞","\\twoheadleftarrow",!0);N(C,G,X,"↢","\\leftarrowtail",!0);N(C,G,X,"↫","\\looparrowleft",!0);N(C,G,X,"⇋","\\leftrightharpoons",!0);N(C,G,X,"↶","\\curvearrowleft",!0);N(C,G,X,"↺","\\circlearrowleft",!0);N(C,G,X,"↰","\\Lsh",!0);N(C,G,X,"⇈","\\upuparrows",!0);N(C,G,X,"↿","\\upharpoonleft",!0);N(C,G,X,"⇃","\\downharpoonleft",!0);N(C,B,X,"⊶","\\origof",!0);N(C,B,X,"⊷","\\imageof",!0);N(C,G,X,"⊸","\\multimap",!0);N(C,G,X,"↭","\\leftrightsquigarrow",!0);N(C,G,X,"⇉","\\rightrightarrows",!0);N(C,G,X,"⇄","\\rightleftarrows",!0);N(C,G,X,"↠","\\twoheadrightarrow",!0);N(C,G,X,"↣","\\rightarrowtail",!0);N(C,G,X,"↬","\\looparrowright",!0);N(C,G,X,"↷","\\curvearrowright",!0);N(C,G,X,"↻","\\circlearrowright",!0);N(C,G,X,"↱","\\Rsh",!0);N(C,G,X,"⇊","\\downdownarrows",!0);N(C,G,X,"↾","\\upharpoonright",!0);N(C,G,X,"⇂","\\downharpoonright",!0);N(C,G,X,"⇝","\\rightsquigarrow",!0);N(C,G,X,"⇝","\\leadsto");N(C,G,X,"⇛","\\Rrightarrow",!0);N(C,G,X,"↾","\\restriction");N(C,B,le,"‘","`");N(C,B,le,"$","\\$");N(Ee,B,le,"$","\\$");N(Ee,B,le,"$","\\textdollar");N(C,B,le,"%","\\%");N(Ee,B,le,"%","\\%");N(C,B,le,"_","\\_");N(Ee,B,le,"_","\\_");N(Ee,B,le,"_","\\textunderscore");N(C,B,le,"∠","\\angle",!0);N(C,B,le,"∞","\\infty",!0);N(C,B,le,"′","\\prime");N(C,B,le,"△","\\triangle");N(C,B,le,"Γ","\\Gamma",!0);N(C,B,le,"Δ","\\Delta",!0);N(C,B,le,"Θ","\\Theta",!0);N(C,B,le,"Λ","\\Lambda",!0);N(C,B,le,"Ξ","\\Xi",!0);N(C,B,le,"Π","\\Pi",!0);N(C,B,le,"Σ","\\Sigma",!0);N(C,B,le,"Υ","\\Upsilon",!0);N(C,B,le,"Φ","\\Phi",!0);N(C,B,le,"Ψ","\\Psi",!0);N(C,B,le,"Ω","\\Omega",!0);N(C,B,le,"A","Α");N(C,B,le,"B","Β");N(C,B,le,"E","Ε");N(C,B,le,"Z","Ζ");N(C,B,le,"H","Η");N(C,B,le,"I","Ι");N(C,B,le,"K","Κ");N(C,B,le,"M","Μ");N(C,B,le,"N","Ν");N(C,B,le,"O","Ο");N(C,B,le,"P","Ρ");N(C,B,le,"T","Τ");N(C,B,le,"X","Χ");N(C,B,le,"¬","\\neg",!0);N(C,B,le,"¬","\\lnot");N(C,B,le,"⊤","\\top");N(C,B,le,"⊥","\\bot");N(C,B,le,"∅","\\emptyset");N(C,G,le,"∅","\\varnothing");N(C,B,st,"α","\\alpha",!0);N(C,B,st,"β","\\beta",!0);N(C,B,st,"γ","\\gamma",!0);N(C,B,st,"δ","\\delta",!0);N(C,B,st,"ϵ","\\epsilon",!0);N(C,B,st,"ζ","\\zeta",!0);N(C,B,st,"η","\\eta",!0);N(C,B,st,"θ","\\theta",!0);N(C,B,st,"ι","\\iota",!0);N(C,B,st,"κ","\\kappa",!0);N(C,B,st,"λ","\\lambda",!0);N(C,B,st,"μ","\\mu",!0);N(C,B,st,"ν","\\nu",!0);N(C,B,st,"ξ","\\xi",!0);N(C,B,st,"ο","\\omicron",!0);N(C,B,st,"π","\\pi",!0);N(C,B,st,"ρ","\\rho",!0);N(C,B,st,"σ","\\sigma",!0);N(C,B,st,"τ","\\tau",!0);N(C,B,st,"υ","\\upsilon",!0);N(C,B,st,"ϕ","\\phi",!0);N(C,B,st,"χ","\\chi",!0);N(C,B,st,"ψ","\\psi",!0);N(C,B,st,"ω","\\omega",!0);N(C,B,st,"ε","\\varepsilon",!0);N(C,B,st,"ϑ","\\vartheta",!0);N(C,B,st,"ϖ","\\varpi",!0);N(C,B,st,"ϱ","\\varrho",!0);N(C,B,st,"ς","\\varsigma",!0);N(C,B,st,"φ","\\varphi",!0);N(C,B,Ve,"∗","*",!0);N(C,B,Ve,"+","+");N(C,B,Ve,"−","-",!0);N(C,B,Ve,"⋅","\\cdot",!0);N(C,B,Ve,"∘","\\circ",!0);N(C,B,Ve,"÷","\\div",!0);N(C,B,Ve,"±","\\pm",!0);N(C,B,Ve,"×","\\times",!0);N(C,B,Ve,"∩","\\cap",!0);N(C,B,Ve,"∪","\\cup",!0);N(C,B,Ve,"∖","\\setminus",!0);N(C,B,Ve,"∧","\\land");N(C,B,Ve,"∨","\\lor");N(C,B,Ve,"∧","\\wedge",!0);N(C,B,Ve,"∨","\\vee",!0);N(C,B,le,"√","\\surd");N(C,B,ai,"⟨","\\langle",!0);N(C,B,ai,"∣","\\lvert");N(C,B,ai,"∥","\\lVert");N(C,B,xs,"?","?");N(C,B,xs,"!","!");N(C,B,xs,"⟩","\\rangle",!0);N(C,B,xs,"∣","\\rvert");N(C,B,xs,"∥","\\rVert");N(C,B,X,"=","=");N(C,B,X,":",":");N(C,B,X,"≈","\\approx",!0);N(C,B,X,"≅","\\cong",!0);N(C,B,X,"≥","\\ge");N(C,B,X,"≥","\\geq",!0);N(C,B,X,"←","\\gets");N(C,B,X,">","\\gt",!0);N(C,B,X,"∈","\\in",!0);N(C,B,X,"","\\@not");N(C,B,X,"⊂","\\subset",!0);N(C,B,X,"⊃","\\supset",!0);N(C,B,X,"⊆","\\subseteq",!0);N(C,B,X,"⊇","\\supseteq",!0);N(C,G,X,"⊈","\\nsubseteq",!0);N(C,G,X,"⊉","\\nsupseteq",!0);N(C,B,X,"⊨","\\models");N(C,B,X,"←","\\leftarrow",!0);N(C,B,X,"≤","\\le");N(C,B,X,"≤","\\leq",!0);N(C,B,X,"<","\\lt",!0);N(C,B,X,"→","\\rightarrow",!0);N(C,B,X,"→","\\to");N(C,G,X,"≱","\\ngeq",!0);N(C,G,X,"≰","\\nleq",!0);N(C,B,wl," ","\\ ");N(C,B,wl," ","\\space");N(C,B,wl," ","\\nobreakspace");N(Ee,B,wl," ","\\ ");N(Ee,B,wl," "," ");N(Ee,B,wl," ","\\space");N(Ee,B,wl," ","\\nobreakspace");N(C,B,wl,null,"\\nobreak");N(C,B,wl,null,"\\allowbreak");N(C,B,$x,",",",");N(C,B,$x,";",";");N(C,G,Ve,"⊼","\\barwedge",!0);N(C,G,Ve,"⊻","\\veebar",!0);N(C,B,Ve,"⊙","\\odot",!0);N(C,B,Ve,"⊕","\\oplus",!0);N(C,B,Ve,"⊗","\\otimes",!0);N(C,B,le,"∂","\\partial",!0);N(C,B,Ve,"⊘","\\oslash",!0);N(C,G,Ve,"⊚","\\circledcirc",!0);N(C,G,Ve,"⊡","\\boxdot",!0);N(C,B,Ve,"△","\\bigtriangleup");N(C,B,Ve,"▽","\\bigtriangledown");N(C,B,Ve,"†","\\dagger");N(C,B,Ve,"⋄","\\diamond");N(C,B,Ve,"⋆","\\star");N(C,B,Ve,"◃","\\triangleleft");N(C,B,Ve,"▹","\\triangleright");N(C,B,ai,"{","\\{");N(Ee,B,le,"{","\\{");N(Ee,B,le,"{","\\textbraceleft");N(C,B,xs,"}","\\}");N(Ee,B,le,"}","\\}");N(Ee,B,le,"}","\\textbraceright");N(C,B,ai,"{","\\lbrace");N(C,B,xs,"}","\\rbrace");N(C,B,ai,"[","\\lbrack",!0);N(Ee,B,le,"[","\\lbrack",!0);N(C,B,xs,"]","\\rbrack",!0);N(Ee,B,le,"]","\\rbrack",!0);N(C,B,ai,"(","\\lparen",!0);N(C,B,xs,")","\\rparen",!0);N(Ee,B,le,"<","\\textless",!0);N(Ee,B,le,">","\\textgreater",!0);N(C,B,ai,"⌊","\\lfloor",!0);N(C,B,xs,"⌋","\\rfloor",!0);N(C,B,ai,"⌈","\\lceil",!0);N(C,B,xs,"⌉","\\rceil",!0);N(C,B,le,"\\","\\backslash");N(C,B,le,"∣","|");N(C,B,le,"∣","\\vert");N(Ee,B,le,"|","\\textbar",!0);N(C,B,le,"∥","\\|");N(C,B,le,"∥","\\Vert");N(Ee,B,le,"∥","\\textbardbl");N(Ee,B,le,"~","\\textasciitilde");N(Ee,B,le,"\\","\\textbackslash");N(Ee,B,le,"^","\\textasciicircum");N(C,B,X,"↑","\\uparrow",!0);N(C,B,X,"⇑","\\Uparrow",!0);N(C,B,X,"↓","\\downarrow",!0);N(C,B,X,"⇓","\\Downarrow",!0);N(C,B,X,"↕","\\updownarrow",!0);N(C,B,X,"⇕","\\Updownarrow",!0);N(C,B,yr,"∐","\\coprod");N(C,B,yr,"⋁","\\bigvee");N(C,B,yr,"⋀","\\bigwedge");N(C,B,yr,"⨄","\\biguplus");N(C,B,yr,"⋂","\\bigcap");N(C,B,yr,"⋃","\\bigcup");N(C,B,yr,"∫","\\int");N(C,B,yr,"∫","\\intop");N(C,B,yr,"∬","\\iint");N(C,B,yr,"∭","\\iiint");N(C,B,yr,"∏","\\prod");N(C,B,yr,"∑","\\sum");N(C,B,yr,"⨂","\\bigotimes");N(C,B,yr,"⨁","\\bigoplus");N(C,B,yr,"⨀","\\bigodot");N(C,B,yr,"∮","\\oint");N(C,B,yr,"∯","\\oiint");N(C,B,yr,"∰","\\oiiint");N(C,B,yr,"⨆","\\bigsqcup");N(C,B,yr,"∫","\\smallint");N(Ee,B,Rd,"…","\\textellipsis");N(C,B,Rd,"…","\\mathellipsis");N(Ee,B,Rd,"…","\\ldots",!0);N(C,B,Rd,"…","\\ldots",!0);N(C,B,Rd,"⋯","\\@cdots",!0);N(C,B,Rd,"⋱","\\ddots",!0);N(C,B,le,"⋮","\\varvdots");N(Ee,B,le,"⋮","\\varvdots");N(C,B,Wn,"ˊ","\\acute");N(C,B,Wn,"ˋ","\\grave");N(C,B,Wn,"¨","\\ddot");N(C,B,Wn,"~","\\tilde");N(C,B,Wn,"ˉ","\\bar");N(C,B,Wn,"˘","\\breve");N(C,B,Wn,"ˇ","\\check");N(C,B,Wn,"^","\\hat");N(C,B,Wn,"⃗","\\vec");N(C,B,Wn,"˙","\\dot");N(C,B,Wn,"˚","\\mathring");N(C,B,st,"","\\@imath");N(C,B,st,"","\\@jmath");N(C,B,le,"ı","ı");N(C,B,le,"ȷ","ȷ");N(Ee,B,le,"ı","\\i",!0);N(Ee,B,le,"ȷ","\\j",!0);N(Ee,B,le,"ß","\\ss",!0);N(Ee,B,le,"æ","\\ae",!0);N(Ee,B,le,"œ","\\oe",!0);N(Ee,B,le,"ø","\\o",!0);N(Ee,B,le,"Æ","\\AE",!0);N(Ee,B,le,"Œ","\\OE",!0);N(Ee,B,le,"Ø","\\O",!0);N(Ee,B,Wn,"ˊ","\\'");N(Ee,B,Wn,"ˋ","\\`");N(Ee,B,Wn,"ˆ","\\^");N(Ee,B,Wn,"˜","\\~");N(Ee,B,Wn,"ˉ","\\=");N(Ee,B,Wn,"˘","\\u");N(Ee,B,Wn,"˙","\\.");N(Ee,B,Wn,"¸","\\c");N(Ee,B,Wn,"˚","\\r");N(Ee,B,Wn,"ˇ","\\v");N(Ee,B,Wn,"¨",'\\"');N(Ee,B,Wn,"˝","\\H");N(Ee,B,Wn,"◯","\\textcircled");var dR={"--":!0,"---":!0,"``":!0,"''":!0};N(Ee,B,le,"–","--",!0);N(Ee,B,le,"–","\\textendash");N(Ee,B,le,"—","---",!0);N(Ee,B,le,"—","\\textemdash");N(Ee,B,le,"‘","`",!0);N(Ee,B,le,"‘","\\textquoteleft");N(Ee,B,le,"’","'",!0);N(Ee,B,le,"’","\\textquoteright");N(Ee,B,le,"“","``",!0);N(Ee,B,le,"“","\\textquotedblleft");N(Ee,B,le,"”","''",!0);N(Ee,B,le,"”","\\textquotedblright");N(C,B,le,"°","\\degree",!0);N(Ee,B,le,"°","\\degree");N(Ee,B,le,"°","\\textdegree",!0);N(C,B,le,"£","\\pounds");N(C,B,le,"£","\\mathsterling",!0);N(Ee,B,le,"£","\\pounds");N(Ee,B,le,"£","\\textsterling",!0);N(C,G,le,"✠","\\maltese");N(Ee,G,le,"✠","\\maltese");var lN='0123456789/@."';for(var Ab=0;Ab0)return Bi(i,h,s,n,l.concat(m));if(d){var p,x;if(d==="boldsymbol"){var v=ace(i,s,n,l,r);p=v.fontName,x=[v.fontClass]}else c?(p=mR[d].fontName,x=[d]):(p=_p(d,n.fontWeight,n.fontShape),x=[d,n.fontWeight,n.fontShape]);if(Hx(i,p,s).metrics)return Bi(i,p,s,n,l.concat(x));if(dR.hasOwnProperty(i)&&p.slice(0,10)==="Typewriter"){for(var b=[],k=0;k{if(vo(t.classes)!==vo(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize)return!1;if(t.classes.length===1){var n=t.classes[0];if(n==="mbin"||n==="mord")return!1}for(var r in t.style)if(t.style.hasOwnProperty(r)&&t.style[r]!==e.style[r])return!1;for(var s in e.style)if(e.style.hasOwnProperty(s)&&t.style[s]!==e.style[s])return!1;return!0},cce=t=>{for(var e=0;en&&(n=l.height),l.depth>r&&(r=l.depth),l.maxFontSize>s&&(s=l.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=s},Cs=function(e,n,r,s){var i=new S0(e,n,r,s);return E5(i),i},hR=(t,e,n,r)=>new S0(t,e,n,r),uce=function(e,n,r){var s=Cs([e],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Le(s.height),s.maxFontSize=1,s},dce=function(e,n,r,s){var i=new A5(e,n,r,s);return E5(i),i},fR=function(e){var n=new w0(e);return E5(n),n},hce=function(e,n){return e instanceof w0?Cs([],[e],n):e},fce=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,l=1;l{var n=Cs(["mspace"],[],e),r=Kn(t,e);return n.style.marginRight=Le(r),n},_p=function(e,n,r){var s="";switch(e){case"amsrm":s="AMS";break;case"textrm":s="Main";break;case"textsf":s="SansSerif";break;case"texttt":s="Typewriter";break;default:s=e}var i;return n==="textbf"&&r==="textit"?i="BoldItalic":n==="textbf"?i="Bold":n==="textit"?i="Italic":i="Regular",s+"-"+i},mR={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},pR={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},gce=function(e,n){var[r,s,i]=pR[e],l=new yo(r),c=new gl([l],{width:Le(s),height:Le(i),style:"width:"+Le(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),d=hR(["overlay"],[c],n);return d.height=i,d.style.height=Le(i),d.style.width=Le(s),d},ge={fontMap:mR,makeSymbol:Bi,mathsym:ice,makeSpan:Cs,makeSvgSpan:hR,makeLineSpan:uce,makeAnchor:dce,makeFragment:fR,wrapFragment:hce,makeVList:mce,makeOrd:lce,makeGlue:pce,staticSvg:gce,svgData:pR,tryCombineChars:cce},Xn={number:3,unit:"mu"},ec={number:4,unit:"mu"},Ya={number:5,unit:"mu"},xce={mord:{mop:Xn,mbin:ec,mrel:Ya,minner:Xn},mop:{mord:Xn,mop:Xn,mrel:Ya,minner:Xn},mbin:{mord:ec,mop:ec,mopen:ec,minner:ec},mrel:{mord:Ya,mop:Ya,mopen:Ya,minner:Ya},mopen:{},mclose:{mop:Xn,mbin:ec,mrel:Ya,minner:Xn},mpunct:{mord:Xn,mop:Xn,mrel:Ya,mopen:Xn,mclose:Xn,mpunct:Xn,minner:Xn},minner:{mord:Xn,mop:Xn,mbin:ec,mrel:Ya,mopen:Xn,mpunct:Xn,minner:Xn}},vce={mord:{mop:Xn},mop:{mord:Xn,mop:Xn},mbin:{},mrel:{},mopen:{},mclose:{mop:Xn},mpunct:{},minner:{mop:Xn}},gR={},Yg={},Kg={};function Qe(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:l}=t,c={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:s},d=0;d{var O=k.classes[0],j=b.classes[0];O==="mbin"&&bce.includes(j)?k.classes[0]="mord":j==="mbin"&&yce.includes(O)&&(b.classes[0]="mord")},{node:p},x,v),hN(i,(b,k)=>{var O=N4(k),j=N4(b),T=O&&j?b.hasClass("mtight")?vce[O][j]:xce[O][j]:null;if(T)return ge.makeGlue(T,h)},{node:p},x,v),i},hN=function t(e,n,r,s,i){s&&e.push(s);for(var l=0;lx=>{e.splice(p+1,0,x),l++})(l)}s&&e.pop()},xR=function(e){return e instanceof w0||e instanceof A5||e instanceof S0&&e.hasClass("enclosing")?e:null},kce=function t(e,n){var r=xR(e);if(r){var s=r.children;if(s.length){if(n==="right")return t(s[s.length-1],"right");if(n==="left")return t(s[0],"left")}}return e},N4=function(e,n){return e?(n&&(e=kce(e,n)),Sce[e.classes[0]]||null):null},qf=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return xl(n.concat(r))},Xt=function(e,n,r){if(!e)return xl();if(Yg[e.type]){var s=Yg[e.type](e,n);if(r&&n.size!==r.size){s=xl(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new De("Got group of unknown type: '"+e.type+"'")};function Dp(t,e){var n=xl(["base"],t,e),r=xl(["strut"]);return r.style.height=Le(n.height+n.depth),n.depth&&(r.style.verticalAlign=Le(-n.depth)),n.children.unshift(r),n}function C4(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=Mr(t,e,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],l=[],c=0;c0&&(i.push(Dp(l,e)),l=[]),i.push(r[c]));l.length>0&&i.push(Dp(l,e));var h;n?(h=Dp(Mr(n,e,!0)),h.classes=["tag"],i.push(h)):s&&i.push(s);var m=xl(["katex-html"],i);if(m.setAttribute("aria-hidden","true"),h){var p=h.children[0];p.style.height=Le(m.height+m.depth),m.depth&&(p.style.verticalAlign=Le(-m.depth))}return m}function vR(t){return new w0(t)}class ti{constructor(e,n,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=n||[],this.classes=r||[]}setAttribute(e,n){this.attributes[e]=n}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&e.setAttribute(n,this.attributes[n]);this.classes.length>0&&(e.className=vo(this.classes));for(var r=0;r0&&(e+=' class ="'+tn.escape(vo(this.classes))+'"'),e+=">";for(var r=0;r",e}toText(){return this.children.map(e=>e.toText()).join("")}}class pa{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return tn.escape(this.toText())}toText(){return this.text}}class Oce{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",Le(this.width)),e}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var _e={MathNode:ti,TextNode:pa,SpaceNode:Oce,newDocumentFragment:vR},Mi=function(e,n,r){return Ln[n][e]&&Ln[n][e].replace&&e.charCodeAt(0)!==55349&&!(dR.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=Ln[n][e].replace),new _e.TextNode(e)},_5=function(e){return e.length===1?e[0]:new _e.MathNode("mrow",e)},D5=function(e,n){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold";var r=n.font;if(!r||r==="mathnormal")return null;var s=e.mode;if(r==="mathit")return"italic";if(r==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(r==="mathbf")return"bold";if(r==="mathbb")return"double-struck";if(r==="mathsfit")return"sans-serif-italic";if(r==="mathfrak")return"fraktur";if(r==="mathscr"||r==="mathcal")return"script";if(r==="mathsf")return"sans-serif";if(r==="mathtt")return"monospace";var i=e.text;if(["\\imath","\\jmath"].includes(i))return null;Ln[s][i]&&Ln[s][i].replace&&(i=Ln[s][i].replace);var l=ge.fontMap[r].fontName;return M5(i,l,s)?ge.fontMap[r].variant:null};function Rb(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof pa&&e.text==="."}else if(t.type==="mo"&&t.children.length===1&&t.getAttribute("separator")==="true"&&t.getAttribute("lspace")==="0em"&&t.getAttribute("rspace")==="0em"){var n=t.children[0];return n instanceof pa&&n.text===","}else return!1}var qs=function(e,n,r){if(e.length===1){var s=zn(e[0],n);return r&&s instanceof ti&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],l,c=0;c=1&&(l.type==="mn"||Rb(l))){var h=d.children[0];h instanceof ti&&h.type==="mn"&&(h.children=[...l.children,...h.children],i.pop())}else if(l.type==="mi"&&l.children.length===1){var m=l.children[0];if(m instanceof pa&&m.text==="̸"&&(d.type==="mo"||d.type==="mi"||d.type==="mn")){var p=d.children[0];p instanceof pa&&p.text.length>0&&(p.text=p.text.slice(0,1)+"̸"+p.text.slice(1),i.pop())}}}i.push(d),l=d}return i},bo=function(e,n,r){return _5(qs(e,n,r))},zn=function(e,n){if(!e)return new _e.MathNode("mrow");if(Kg[e.type]){var r=Kg[e.type](e,n);return r}else throw new De("Got group of unknown type: '"+e.type+"'")};function fN(t,e,n,r,s){var i=qs(t,n),l;i.length===1&&i[0]instanceof ti&&["mrow","mtable"].includes(i[0].type)?l=i[0]:l=new _e.MathNode("mrow",i);var c=new _e.MathNode("annotation",[new _e.TextNode(e)]);c.setAttribute("encoding","application/x-tex");var d=new _e.MathNode("semantics",[l,c]),h=new _e.MathNode("math",[d]);h.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&h.setAttribute("display","block");var m=s?"katex":"katex-mathml";return ge.makeSpan([m],[h])}var yR=function(e){return new rl({style:e.displayMode?at.DISPLAY:at.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},bR=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=ge.makeSpan(r,[e])}return e},jce=function(e,n,r){var s=yR(r),i;if(r.output==="mathml")return fN(e,n,s,r.displayMode,!0);if(r.output==="html"){var l=C4(e,s);i=ge.makeSpan(["katex"],[l])}else{var c=fN(e,n,s,r.displayMode,!1),d=C4(e,s);i=ge.makeSpan(["katex"],[c,d])}return bR(i,r)},Nce=function(e,n,r){var s=yR(r),i=C4(e,s),l=ge.makeSpan(["katex"],[i]);return bR(l,r)},Cce={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Tce=function(e){var n=new _e.MathNode("mo",[new _e.TextNode(Cce[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},Mce={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Ace=function(e){return e.type==="ordgroup"?e.body.length:1},Ece=function(e,n){function r(){var c=4e5,d=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(d)){var h=e,m=Ace(h.base),p,x,v;if(m>5)d==="widehat"||d==="widecheck"?(p=420,c=2364,v=.42,x=d+"4"):(p=312,c=2340,v=.34,x="tilde4");else{var b=[1,1,2,2,3,3][m];d==="widehat"||d==="widecheck"?(c=[0,1062,2364,2364,2364][b],p=[0,239,300,360,420][b],v=[0,.24,.3,.3,.36,.42][b],x=d+b):(c=[0,600,1033,2339,2340][b],p=[0,260,286,306,312][b],v=[0,.26,.286,.3,.306,.34][b],x="tilde"+b)}var k=new yo(x),O=new gl([k],{width:"100%",height:Le(v),viewBox:"0 0 "+c+" "+p,preserveAspectRatio:"none"});return{span:ge.makeSvgSpan([],[O],n),minWidth:0,height:v}}else{var j=[],T=Mce[d],[M,_,D]=T,E=D/1e3,z=M.length,Q,F;if(z===1){var L=T[3];Q=["hide-tail"],F=[L]}else if(z===2)Q=["halfarrow-left","halfarrow-right"],F=["xMinYMin","xMaxYMin"];else if(z===3)Q=["brace-left","brace-center","brace-right"],F=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support + `+z+" children.");for(var U=0;U0&&(s.style.minWidth=Le(i)),s},_ce=function(e,n,r,s,i){var l,c=e.height+e.depth+r+s;if(/fbox|color|angl/.test(n)){if(l=ge.makeSpan(["stretchy",n],[],i),n==="fbox"){var d=i.color&&i.getColor();d&&(l.style.borderColor=d)}}else{var h=[];/^[bx]cancel$/.test(n)&&h.push(new O4({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&h.push(new O4({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var m=new gl(h,{width:"100%",height:Le(c)});l=ge.makeSvgSpan([],[m],i)}return l.height=c,l.style.height=Le(c),l},vl={encloseSpan:_ce,mathMLnode:Tce,svgSpan:Ece};function Nt(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function R5(t){var e=Ux(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function Ux(t){return t&&(t.type==="atom"||rce.hasOwnProperty(t.type))?t:null}var z5=(t,e)=>{var n,r,s;t&&t.type==="supsub"?(r=Nt(t.base,"accent"),n=r.base,t.base=n,s=tce(Xt(t,e)),t.base=r):(r=Nt(t,"accent"),n=r.base);var i=Xt(n,e.havingCrampedStyle()),l=r.isShifty&&tn.isCharacterBox(n),c=0;if(l){var d=tn.getBaseElem(n),h=Xt(d,e.havingCrampedStyle());c=aN(h).skew}var m=r.label==="\\c",p=m?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),x;if(r.isStretchy)x=vl.svgSpan(r,e),x=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:x,wrapperClasses:["svg-align"],wrapperStyle:c>0?{width:"calc(100% - "+Le(2*c)+")",marginLeft:Le(2*c)}:void 0}]},e);else{var v,b;r.label==="\\vec"?(v=ge.staticSvg("vec",e),b=ge.svgData.vec[1]):(v=ge.makeOrd({mode:r.mode,text:r.label},e,"textord"),v=aN(v),v.italic=0,b=v.width,m&&(p+=v.depth)),x=ge.makeSpan(["accent-body"],[v]);var k=r.label==="\\textcircled";k&&(x.classes.push("accent-full"),p=i.height);var O=c;k||(O-=b/2),x.style.left=Le(O),r.label==="\\textcircled"&&(x.style.top=".2em"),x=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-p},{type:"elem",elem:x}]},e)}var j=ge.makeSpan(["mord","accent"],[x],e);return s?(s.children[0]=j,s.height=Math.max(j.height,s.height),s.classes[0]="mord",s):j},wR=(t,e)=>{var n=t.isStretchy?vl.mathMLnode(t.label):new _e.MathNode("mo",[Mi(t.label,t.mode)]),r=new _e.MathNode("mover",[zn(t.base,e),n]);return r.setAttribute("accent","true"),r},Dce=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));Qe({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(t,e)=>{var n=Zg(e[0]),r=!Dce.test(t.funcName),s=!r||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:r,isShifty:s,base:n}},htmlBuilder:z5,mathmlBuilder:wR});Qe({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(t,e)=>{var n=e[0],r=t.parser.mode;return r==="math"&&(t.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+t.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:t.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:z5,mathmlBuilder:wR});Qe({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"accentUnder",mode:n.mode,label:r,base:s}},htmlBuilder:(t,e)=>{var n=Xt(t.base,e),r=vl.svgSpan(t,e),s=t.label==="\\utilde"?.12:0,i=ge.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]},e);return ge.makeSpan(["mord","accentunder"],[i],e)},mathmlBuilder:(t,e)=>{var n=vl.mathMLnode(t.label),r=new _e.MathNode("munder",[zn(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var Rp=t=>{var e=new _e.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Qe({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r,funcName:s}=t;return{type:"xArrow",mode:r.mode,label:s,body:e[0],below:n[0]}},htmlBuilder(t,e){var n=e.style,r=e.havingStyle(n.sup()),s=ge.wrapFragment(Xt(t.body,r,e),e),i=t.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var l;t.below&&(r=e.havingStyle(n.sub()),l=ge.wrapFragment(Xt(t.below,r,e),e),l.classes.push(i+"-arrow-pad"));var c=vl.svgSpan(t,e),d=-e.fontMetrics().axisHeight+.5*c.height,h=-e.fontMetrics().axisHeight-.5*c.height-.111;(s.depth>.25||t.label==="\\xleftequilibrium")&&(h-=s.depth);var m;if(l){var p=-e.fontMetrics().axisHeight+l.height+.5*c.height+.111;m=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:c,shift:d},{type:"elem",elem:l,shift:p}]},e)}else m=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:c,shift:d}]},e);return m.children[0].children[0].children[1].classes.push("svg-align"),ge.makeSpan(["mrel","x-arrow"],[m],e)},mathmlBuilder(t,e){var n=vl.mathMLnode(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var s=Rp(zn(t.body,e));if(t.below){var i=Rp(zn(t.below,e));r=new _e.MathNode("munderover",[n,i,s])}else r=new _e.MathNode("mover",[n,s])}else if(t.below){var l=Rp(zn(t.below,e));r=new _e.MathNode("munder",[n,l])}else r=Rp(),r=new _e.MathNode("mover",[n,r]);return r}});var Rce=ge.makeSpan;function SR(t,e){var n=Mr(t.body,e,!0);return Rce([t.mclass],n,e)}function kR(t,e){var n,r=qs(t.body,e);return t.mclass==="minner"?n=new _e.MathNode("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new _e.MathNode("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new _e.MathNode("mo",r),t.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):t.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):t.mclass==="mopen"||t.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):t.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}Qe({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:ar(s),isCharacterBox:tn.isCharacterBox(s)}},htmlBuilder:SR,mathmlBuilder:kR});var Vx=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};Qe({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:Vx(e[0]),body:ar(e[1]),isCharacterBox:tn.isCharacterBox(e[1])}}});Qe({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,s=e[1],i=e[0],l;r!=="\\stackrel"?l=Vx(s):l="mrel";var c={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:ar(s)},d={type:"supsub",mode:i.mode,base:c,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:l,body:[d],isCharacterBox:tn.isCharacterBox(d)}},htmlBuilder:SR,mathmlBuilder:kR});Qe({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:Vx(e[0]),body:ar(e[0])}},htmlBuilder(t,e){var n=Mr(t.body,e,!0),r=ge.makeSpan([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=qs(t.body,e),r=new _e.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var zce={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},mN=()=>({type:"styling",body:[],mode:"math",style:"display"}),pN=t=>t.type==="textord"&&t.text==="@",Pce=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function Bce(t,e,n){var r=zce[t];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var s=n.callFunction("\\\\cdleft",[e[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},l=n.callFunction("\\Big",[i],[]),c=n.callFunction("\\\\cdright",[e[1]],[]),d={type:"ordgroup",mode:"math",body:[s,l,c]};return n.callFunction("\\\\cdparent",[d],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var h={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[h],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Lce(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var n=t.fetch().text;if(n==="&"||n==="\\\\")t.consume();else if(n==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new De("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],s=[r],i=0;i-1))if("<>AV".indexOf(h)>-1)for(var p=0;p<2;p++){for(var x=!0,v=d+1;vAV=|." after @',l[d]);var b=Bce(h,m,t),k={type:"styling",body:[b],mode:"math",style:"display"};r.push(k),c=mN()}i%2===0?r.push(c):r.shift(),r=[],s.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var O=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:O,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}Qe({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:e[0]}},htmlBuilder(t,e){var n=e.havingStyle(e.style.sup()),r=ge.wrapFragment(Xt(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=Le(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new _e.MathNode("mrow",[zn(t.label,e)]);return n=new _e.MathNode("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new _e.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Qe({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(t,e){var{parser:n}=t;return{type:"cdlabelparent",mode:n.mode,fragment:e[0]}},htmlBuilder(t,e){var n=ge.wrapFragment(Xt(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new _e.MathNode("mrow",[zn(t.fragment,e)])}});Qe({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=Nt(e[0],"ordgroup"),s=r.body,i="",l=0;l=1114111)throw new De("\\@char with invalid code point "+i);return d<=65535?h=String.fromCharCode(d):(d-=65536,h=String.fromCharCode((d>>10)+55296,(d&1023)+56320)),{type:"textord",mode:n.mode,text:h}}});var OR=(t,e)=>{var n=Mr(t.body,e.withColor(t.color),!1);return ge.makeFragment(n)},jR=(t,e)=>{var n=qs(t.body,e.withColor(t.color)),r=new _e.MathNode("mstyle",n);return r.setAttribute("mathcolor",t.color),r};Qe({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=Nt(e[0],"color-token").color,s=e[1];return{type:"color",mode:n.mode,color:r,body:ar(s)}},htmlBuilder:OR,mathmlBuilder:jR});Qe({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,s=Nt(e[0],"color-token").color;n.gullet.macros.set("\\current@color",s);var i=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:s,body:i}},htmlBuilder:OR,mathmlBuilder:jR});Qe({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(t,e,n){var{parser:r}=t,s=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,i=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:i,size:s&&Nt(s,"size").value}},htmlBuilder(t,e){var n=ge.makeSpan(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=Le(Kn(t.size,e)))),n},mathmlBuilder(t,e){var n=new _e.MathNode("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",Le(Kn(t.size,e)))),n}});var T4={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},NR=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new De("Expected a control sequence",t);return e},Ice=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},CR=(t,e,n,r)=>{var s=t.gullet.macros.get(n.text);s==null&&(n.noexpand=!0,s={tokens:[n],numArgs:0,unexpandable:!t.gullet.isExpandable(n.text)}),t.gullet.macros.set(e,s,r)};Qe({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(t){var{parser:e,funcName:n}=t;e.consumeSpaces();var r=e.fetch();if(T4[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=T4[r.text]),Nt(e.parseFunction(),"internal");throw new De("Invalid token after macro prefix",r)}});Qe({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=e.gullet.popToken(),s=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new De("Expected a control sequence",r);for(var i=0,l,c=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){l=e.gullet.future(),c[i].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new De('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new De('Argument number "'+r.text+'" out of order');i++,c.push([])}else{if(r.text==="EOF")throw new De("Expected a macro definition");c[i].push(r.text)}var{tokens:d}=e.gullet.consumeArg();return l&&d.unshift(l),(n==="\\edef"||n==="\\xdef")&&(d=e.gullet.expandTokens(d),d.reverse()),e.gullet.macros.set(s,{tokens:d,numArgs:i,delimiters:c},n===T4[n]),{type:"internal",mode:e.mode}}});Qe({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=NR(e.gullet.popToken());e.gullet.consumeSpaces();var s=Ice(e);return CR(e,r,s,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});Qe({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=NR(e.gullet.popToken()),s=e.gullet.popToken(),i=e.gullet.popToken();return CR(e,r,i,n==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});var Vh=function(e,n,r){var s=Ln.math[e]&&Ln.math[e].replace,i=M5(s||e,n,r);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return i},P5=function(e,n,r,s){var i=r.havingBaseStyle(n),l=ge.makeSpan(s.concat(i.sizingClasses(r)),[e],r),c=i.sizeMultiplier/r.sizeMultiplier;return l.height*=c,l.depth*=c,l.maxFontSize=i.sizeMultiplier,l},TR=function(e,n,r){var s=n.havingBaseStyle(r),i=(1-n.sizeMultiplier/s.sizeMultiplier)*n.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=Le(i),e.height-=i,e.depth+=i},qce=function(e,n,r,s,i,l){var c=ge.makeSymbol(e,"Main-Regular",i,s),d=P5(c,n,s,l);return r&&TR(d,s,n),d},Fce=function(e,n,r,s){return ge.makeSymbol(e,"Size"+n+"-Regular",r,s)},MR=function(e,n,r,s,i,l){var c=Fce(e,n,i,s),d=P5(ge.makeSpan(["delimsizing","size"+n],[c],s),at.TEXT,s,l);return r&&TR(d,s,at.TEXT),d},zb=function(e,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=ge.makeSpan(["delimsizinginner",s],[ge.makeSpan([],[ge.makeSymbol(e,n,r)])]);return{type:"elem",elem:i}},Pb=function(e,n,r){var s=ma["Size4-Regular"][e.charCodeAt(0)]?ma["Size4-Regular"][e.charCodeAt(0)][4]:ma["Size1-Regular"][e.charCodeAt(0)][4],i=new yo("inner",Voe(e,Math.round(1e3*n))),l=new gl([i],{width:Le(s),height:Le(n),style:"width:"+Le(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),c=ge.makeSvgSpan([],[l],r);return c.height=n,c.style.height=Le(n),c.style.width=Le(s),{type:"elem",elem:c}},M4=.008,zp={type:"kern",size:-1*M4},Qce=["|","\\lvert","\\rvert","\\vert"],$ce=["\\|","\\lVert","\\rVert","\\Vert"],AR=function(e,n,r,s,i,l){var c,d,h,m,p="",x=0;c=h=m=e,d=null;var v="Size1-Regular";e==="\\uparrow"?h=m="⏐":e==="\\Uparrow"?h=m="‖":e==="\\downarrow"?c=h="⏐":e==="\\Downarrow"?c=h="‖":e==="\\updownarrow"?(c="\\uparrow",h="⏐",m="\\downarrow"):e==="\\Updownarrow"?(c="\\Uparrow",h="‖",m="\\Downarrow"):Qce.includes(e)?(h="∣",p="vert",x=333):$ce.includes(e)?(h="∥",p="doublevert",x=556):e==="["||e==="\\lbrack"?(c="⎡",h="⎢",m="⎣",v="Size4-Regular",p="lbrack",x=667):e==="]"||e==="\\rbrack"?(c="⎤",h="⎥",m="⎦",v="Size4-Regular",p="rbrack",x=667):e==="\\lfloor"||e==="⌊"?(h=c="⎢",m="⎣",v="Size4-Regular",p="lfloor",x=667):e==="\\lceil"||e==="⌈"?(c="⎡",h=m="⎢",v="Size4-Regular",p="lceil",x=667):e==="\\rfloor"||e==="⌋"?(h=c="⎥",m="⎦",v="Size4-Regular",p="rfloor",x=667):e==="\\rceil"||e==="⌉"?(c="⎤",h=m="⎥",v="Size4-Regular",p="rceil",x=667):e==="("||e==="\\lparen"?(c="⎛",h="⎜",m="⎝",v="Size4-Regular",p="lparen",x=875):e===")"||e==="\\rparen"?(c="⎞",h="⎟",m="⎠",v="Size4-Regular",p="rparen",x=875):e==="\\{"||e==="\\lbrace"?(c="⎧",d="⎨",m="⎩",h="⎪",v="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(c="⎫",d="⎬",m="⎭",h="⎪",v="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(c="⎧",m="⎩",h="⎪",v="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(c="⎫",m="⎭",h="⎪",v="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(c="⎧",m="⎭",h="⎪",v="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(c="⎫",m="⎩",h="⎪",v="Size4-Regular");var b=Vh(c,v,i),k=b.height+b.depth,O=Vh(h,v,i),j=O.height+O.depth,T=Vh(m,v,i),M=T.height+T.depth,_=0,D=1;if(d!==null){var E=Vh(d,v,i);_=E.height+E.depth,D=2}var z=k+M+_,Q=Math.max(0,Math.ceil((n-z)/(D*j))),F=z+Q*D*j,L=s.fontMetrics().axisHeight;r&&(L*=s.sizeMultiplier);var U=F/2-L,V=[];if(p.length>0){var ce=F-k-M,W=Math.round(F*1e3),J=Woe(p,Math.round(ce*1e3)),H=new yo(p,J),ae=(x/1e3).toFixed(3)+"em",ne=(W/1e3).toFixed(3)+"em",ue=new gl([H],{width:ae,height:ne,viewBox:"0 0 "+x+" "+W}),R=ge.makeSvgSpan([],[ue],s);R.height=W/1e3,R.style.width=ae,R.style.height=ne,V.push({type:"elem",elem:R})}else{if(V.push(zb(m,v,i)),V.push(zp),d===null){var me=F-k-M+2*M4;V.push(Pb(h,me,s))}else{var Y=(F-k-M-_)/2+2*M4;V.push(Pb(h,Y,s)),V.push(zp),V.push(zb(d,v,i)),V.push(zp),V.push(Pb(h,Y,s))}V.push(zp),V.push(zb(c,v,i))}var P=s.havingBaseStyle(at.TEXT),K=ge.makeVList({positionType:"bottom",positionData:U,children:V},P);return P5(ge.makeSpan(["delimsizing","mult"],[K],P),at.TEXT,s,l)},Bb=80,Lb=.08,Ib=function(e,n,r,s,i){var l=Uoe(e,s,r),c=new yo(e,l),d=new gl([c],{width:"400em",height:Le(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return ge.makeSvgSpan(["hide-tail"],[d],i)},Hce=function(e,n){var r=n.havingBaseSizing(),s=RR("\\surd",e*r.sizeMultiplier,DR,r),i=r.sizeMultiplier,l=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),c,d=0,h=0,m=0,p;return s.type==="small"?(m=1e3+1e3*l+Bb,e<1?i=1:e<1.4&&(i=.7),d=(1+l+Lb)/i,h=(1+l)/i,c=Ib("sqrtMain",d,m,l,n),c.style.minWidth="0.853em",p=.833/i):s.type==="large"?(m=(1e3+Bb)*cf[s.size],h=(cf[s.size]+l)/i,d=(cf[s.size]+l+Lb)/i,c=Ib("sqrtSize"+s.size,d,m,l,n),c.style.minWidth="1.02em",p=1/i):(d=e+l+Lb,h=e+l,m=Math.floor(1e3*e+l)+Bb,c=Ib("sqrtTall",d,m,l,n),c.style.minWidth="0.742em",p=1.056),c.height=h,c.style.height=Le(d),{span:c,advanceWidth:p,ruleWidth:(n.fontMetrics().sqrtRuleThickness+l)*i}},ER=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Uce=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],_R=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],cf=[0,1.2,1.8,2.4,3],Vce=function(e,n,r,s,i){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),ER.includes(e)||_R.includes(e))return MR(e,n,!1,r,s,i);if(Uce.includes(e))return AR(e,cf[n],!1,r,s,i);throw new De("Illegal delimiter: '"+e+"'")},Wce=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Gce=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"stack"}],DR=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Xce=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},RR=function(e,n,r,s){for(var i=Math.min(2,3-s.style.size),l=i;ln)return r[l]}return r[r.length-1]},zR=function(e,n,r,s,i,l){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var c;_R.includes(e)?c=Wce:ER.includes(e)?c=DR:c=Gce;var d=RR(e,n,c,s);return d.type==="small"?qce(e,d.style,r,s,i,l):d.type==="large"?MR(e,d.size,r,s,i,l):AR(e,n,r,s,i,l)},Yce=function(e,n,r,s,i,l){var c=s.fontMetrics().axisHeight*s.sizeMultiplier,d=901,h=5/s.fontMetrics().ptPerEm,m=Math.max(n-c,r+c),p=Math.max(m/500*d,2*m-h);return zR(e,p,!0,s,i,l)},ul={sqrtImage:Hce,sizedDelim:Vce,sizeToMaxHeight:cf,customSizedDelim:zR,leftRightDelim:Yce},gN={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Kce=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function Wx(t,e){var n=Ux(t);if(n&&Kce.includes(n.text))return n;throw n?new De("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new De("Invalid delimiter type '"+t.type+"'",t)}Qe({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,e)=>{var n=Wx(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:gN[t.funcName].size,mclass:gN[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?ge.makeSpan([t.mclass]):ul.sizedDelim(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(Mi(t.delim,t.mode));var n=new _e.MathNode("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Le(ul.sizeToMaxHeight[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function xN(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Qe({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=t.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new De("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:Wx(e[0],t).text,color:n}}});Qe({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Wx(e[0],t),r=t.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=Nt(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(t,e)=>{xN(t);for(var n=Mr(t.body,e,!0,["mopen","mclose"]),r=0,s=0,i=!1,l=0;l{xN(t);var n=qs(t.body,e);if(t.left!=="."){var r=new _e.MathNode("mo",[Mi(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var s=new _e.MathNode("mo",[Mi(t.right,t.mode)]);s.setAttribute("fence","true"),t.rightColor&&s.setAttribute("mathcolor",t.rightColor),n.push(s)}return _5(n)}});Qe({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Wx(e[0],t);if(!t.parser.leftrightDepth)throw new De("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=qf(e,[]);else{n=ul.sizedDelim(t.delim,1,e,t.mode,[]);var r={delim:t.delim,options:e};n.isMiddle=r}return n},mathmlBuilder:(t,e)=>{var n=t.delim==="\\vert"||t.delim==="|"?Mi("|","text"):Mi(t.delim,t.mode),r=new _e.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var B5=(t,e)=>{var n=ge.wrapFragment(Xt(t.body,e),e),r=t.label.slice(1),s=e.sizeMultiplier,i,l=0,c=tn.isCharacterBox(t.body);if(r==="sout")i=ge.makeSpan(["stretchy","sout"]),i.height=e.fontMetrics().defaultRuleThickness/s,l=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var d=Kn({number:.6,unit:"pt"},e),h=Kn({number:.35,unit:"ex"},e),m=e.havingBaseSizing();s=s/m.sizeMultiplier;var p=n.height+n.depth+d+h;n.style.paddingLeft=Le(p/2+d);var x=Math.floor(1e3*p*s),v=$oe(x),b=new gl([new yo("phase",v)],{width:"400em",height:Le(x/1e3),viewBox:"0 0 400000 "+x,preserveAspectRatio:"xMinYMin slice"});i=ge.makeSvgSpan(["hide-tail"],[b],e),i.style.height=Le(p),l=n.depth+d+h}else{/cancel/.test(r)?c||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var k=0,O=0,j=0;/box/.test(r)?(j=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),k=e.fontMetrics().fboxsep+(r==="colorbox"?0:j),O=k):r==="angl"?(j=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),k=4*j,O=Math.max(0,.25-n.depth)):(k=c?.2:0,O=k),i=vl.encloseSpan(n,r,k,O,e),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Le(j)):r==="angl"&&j!==.049&&(i.style.borderTopWidth=Le(j),i.style.borderRightWidth=Le(j)),l=n.depth+O,t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor,t.borderColor&&(i.style.borderColor=t.borderColor))}var T;if(t.backgroundColor)T=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:l},{type:"elem",elem:n,shift:0}]},e);else{var M=/cancel|phase/.test(r)?["svg-align"]:[];T=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:l,wrapperClasses:M}]},e)}return/cancel/.test(r)&&(T.height=n.height,T.depth=n.depth),/cancel/.test(r)&&!c?ge.makeSpan(["mord","cancel-lap"],[T],e):ge.makeSpan(["mord"],[T],e)},L5=(t,e)=>{var n=0,r=new _e.MathNode(t.label.indexOf("colorbox")>-1?"mpadded":"menclose",[zn(t.body,e)]);switch(t.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),t.label==="\\fcolorbox"){var s=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+s+"em solid "+String(t.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};Qe({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Nt(e[0],"color-token").color,l=e[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:l}},htmlBuilder:B5,mathmlBuilder:L5});Qe({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Nt(e[0],"color-token").color,l=Nt(e[1],"color-token").color,c=e[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:l,borderColor:i,body:c}},htmlBuilder:B5,mathmlBuilder:L5});Qe({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\fbox",body:e[0]}}});Qe({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"enclose",mode:n.mode,label:r,body:s}},htmlBuilder:B5,mathmlBuilder:L5});Qe({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\angl",body:e[0]}}});var PR={};function Na(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:l}=t,c={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},d=0;d{var e=t.parser.settings;if(!e.displayMode)throw new De("{"+t.envName+"} can be used only in display mode.")};function I5(t){if(t.indexOf("ed")===-1)return t.indexOf("*")===-1}function Mo(t,e,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:l,colSeparationType:c,autoTag:d,singleRow:h,emptySingleRow:m,maxNumCols:p,leqno:x}=e;if(t.gullet.beginGroup(),h||t.gullet.macros.set("\\cr","\\\\\\relax"),!l){var v=t.gullet.expandMacroAsText("\\arraystretch");if(v==null)l=1;else if(l=parseFloat(v),!l||l<0)throw new De("Invalid \\arraystretch: "+v)}t.gullet.beginGroup();var b=[],k=[b],O=[],j=[],T=d!=null?[]:void 0;function M(){d&&t.gullet.macros.set("\\@eqnsw","1",!0)}function _(){T&&(t.gullet.macros.get("\\df@tag")?(T.push(t.subparse([new si("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):T.push(!!d&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(M(),j.push(vN(t));;){var D=t.parseExpression(!1,h?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),D={type:"ordgroup",mode:t.mode,body:D},n&&(D={type:"styling",mode:t.mode,style:n,body:[D]}),b.push(D);var E=t.fetch().text;if(E==="&"){if(p&&b.length===p){if(h||c)throw new De("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(E==="\\end"){_(),b.length===1&&D.type==="styling"&&D.body[0].body.length===0&&(k.length>1||!m)&&k.pop(),j.length0&&(M+=.25),h.push({pos:M,isDashed:Jn[nn]})}for(_(l[0]),r=0;r0&&(U+=T,zJn))for(r=0;r=c)){var ve=void 0;(s>0||e.hskipBeforeAndAfter)&&(ve=tn.deflt(Y.pregap,x),ve!==0&&(J=ge.makeSpan(["arraycolsep"],[]),J.style.width=Le(ve),W.push(J)));var Re=[];for(r=0;r0){for(var Oe=ge.makeLineSpan("hline",n,m),nt=ge.makeLineSpan("hdashline",n,m),ut=[{type:"elem",elem:d,shift:0}];h.length>0;){var Ct=h.pop(),In=Ct.pos-V;Ct.isDashed?ut.push({type:"elem",elem:nt,shift:In}):ut.push({type:"elem",elem:Oe,shift:In})}d=ge.makeVList({positionType:"individualShift",children:ut},n)}if(ae.length===0)return ge.makeSpan(["mord"],[d],n);var Tn=ge.makeVList({positionType:"individualShift",children:ae},n);return Tn=ge.makeSpan(["tag"],[Tn],n),ge.makeFragment([d,Tn])},Zce={c:"center ",l:"left ",r:"right "},Ta=function(e,n){for(var r=[],s=new _e.MathNode("mtd",[],["mtr-glue"]),i=new _e.MathNode("mtd",[],["mml-eqn-num"]),l=0;l0){var b=e.cols,k="",O=!1,j=0,T=b.length;b[0].type==="separator"&&(x+="top ",j=1),b[b.length-1].type==="separator"&&(x+="bottom ",T-=1);for(var M=j;M0?"left ":"",x+=Q[Q.length-1].length>0?"right ":"";for(var F=1;F-1?"alignat":"align",i=e.envName==="split",l=Mo(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:I5(e.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),c,d=0,h={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var m="",p=0;p0&&v&&(O=1),r[b]={type:"align",align:k,pregap:O,postgap:0}}return l.colSeparationType=v?"align":"alignat",l};Na({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=Ux(e[0]),r=n?[e[0]]:Nt(e[0],"ordgroup").body,s=r.map(function(l){var c=R5(l),d=c.text;if("lcr".indexOf(d)!==-1)return{type:"align",align:d};if(d==="|")return{type:"separator",separator:"|"};if(d===":")return{type:"separator",separator:":"};throw new De("Unknown column alignment: "+d,l)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return Mo(t.parser,i,q5(t.envName))},htmlBuilder:Ca,mathmlBuilder:Ta});Na({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(t.envName.charAt(t.envName.length-1)==="*"){var s=t.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),n=s.fetch().text,"lcr".indexOf(n)===-1)throw new De("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=Mo(t.parser,r,q5(t.envName)),l=Math.max(0,...i.body.map(c=>c.length));return i.cols=new Array(l).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[i],left:e[0],right:e[1],rightColor:void 0}:i},htmlBuilder:Ca,mathmlBuilder:Ta});Na({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=Mo(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:Ca,mathmlBuilder:Ta});Na({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=Ux(e[0]),r=n?[e[0]]:Nt(e[0],"ordgroup").body,s=r.map(function(l){var c=R5(l),d=c.text;if("lc".indexOf(d)!==-1)return{type:"align",align:d};throw new De("Unknown column alignment: "+d,l)});if(s.length>1)throw new De("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5};if(i=Mo(t.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new De("{subarray} can contain only one column");return i},htmlBuilder:Ca,mathmlBuilder:Ta});Na({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=Mo(t.parser,e,q5(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.indexOf("r")>-1?".":"\\{",right:t.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:Ca,mathmlBuilder:Ta});Na({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:LR,htmlBuilder:Ca,mathmlBuilder:Ta});Na({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){["gather","gather*"].includes(t.envName)&&Gx(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:I5(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return Mo(t.parser,e,"display")},htmlBuilder:Ca,mathmlBuilder:Ta});Na({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:LR,htmlBuilder:Ca,mathmlBuilder:Ta});Na({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){Gx(t);var e={autoTag:I5(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return Mo(t.parser,e,"display")},htmlBuilder:Ca,mathmlBuilder:Ta});Na({type:"array",names:["CD"],props:{numArgs:0},handler(t){return Gx(t),Lce(t.parser)},htmlBuilder:Ca,mathmlBuilder:Ta});q("\\nonumber","\\gdef\\@eqnsw{0}");q("\\notag","\\nonumber");Qe({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new De(t.funcName+" valid only within array environment")}});var yN=PR;Qe({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];if(s.type!=="ordgroup")throw new De("Invalid environment name",s);for(var i="",l=0;l{var n=t.font,r=e.withFont(n);return Xt(t.body,r)},qR=(t,e)=>{var n=t.font,r=e.withFont(n);return zn(t.body,r)},bN={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Qe({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=Zg(e[0]),i=r;return i in bN&&(i=bN[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:IR,mathmlBuilder:qR});Qe({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0],s=tn.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:Vx(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:s}}});Qe({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,breakOnTokenText:s}=t,{mode:i}=n,l=n.parseExpression(!0,s),c="math"+r.slice(1);return{type:"font",mode:i,font:c,body:{type:"ordgroup",mode:n.mode,body:l}}},htmlBuilder:IR,mathmlBuilder:qR});var FR=(t,e)=>{var n=e;return t==="display"?n=n.id>=at.SCRIPT.id?n.text():at.DISPLAY:t==="text"&&n.size===at.DISPLAY.size?n=at.TEXT:t==="script"?n=at.SCRIPT:t==="scriptscript"&&(n=at.SCRIPTSCRIPT),n},F5=(t,e)=>{var n=FR(t.size,e.style),r=n.fracNum(),s=n.fracDen(),i;i=e.havingStyle(r);var l=Xt(t.numer,i,e);if(t.continued){var c=8.5/e.fontMetrics().ptPerEm,d=3.5/e.fontMetrics().ptPerEm;l.height=l.height0?b=3*x:b=7*x,k=e.fontMetrics().denom1):(p>0?(v=e.fontMetrics().num2,b=x):(v=e.fontMetrics().num3,b=3*x),k=e.fontMetrics().denom2);var O;if(m){var T=e.fontMetrics().axisHeight;v-l.depth-(T+.5*p){var n=new _e.MathNode("mfrac",[zn(t.numer,e),zn(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=Kn(t.barSize,e);n.setAttribute("linethickness",Le(r))}var s=FR(t.size,e.style);if(s.size!==e.style.size){n=new _e.MathNode("mstyle",[n]);var i=s.size===at.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",i),n.setAttribute("scriptlevel","0")}if(t.leftDelim!=null||t.rightDelim!=null){var l=[];if(t.leftDelim!=null){var c=new _e.MathNode("mo",[new _e.TextNode(t.leftDelim.replace("\\",""))]);c.setAttribute("fence","true"),l.push(c)}if(l.push(n),t.rightDelim!=null){var d=new _e.MathNode("mo",[new _e.TextNode(t.rightDelim.replace("\\",""))]);d.setAttribute("fence","true"),l.push(d)}return _5(l)}return n};Qe({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1],l,c=null,d=null,h="auto";switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":l=!0;break;case"\\\\atopfrac":l=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":l=!1,c="(",d=")";break;case"\\\\bracefrac":l=!1,c="\\{",d="\\}";break;case"\\\\brackfrac":l=!1,c="[",d="]";break;default:throw new Error("Unrecognized genfrac command")}switch(r){case"\\dfrac":case"\\dbinom":h="display";break;case"\\tfrac":case"\\tbinom":h="text";break}return{type:"genfrac",mode:n.mode,continued:!1,numer:s,denom:i,hasBarLine:l,leftDelim:c,rightDelim:d,size:h,barSize:null}},htmlBuilder:F5,mathmlBuilder:Q5});Qe({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1];return{type:"genfrac",mode:n.mode,continued:!0,numer:s,denom:i,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});Qe({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(t){var{parser:e,funcName:n,token:r}=t,s;switch(n){case"\\over":s="\\frac";break;case"\\choose":s="\\binom";break;case"\\atop":s="\\\\atopfrac";break;case"\\brace":s="\\\\bracefrac";break;case"\\brack":s="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:s,token:r}}});var wN=["display","text","script","scriptscript"],SN=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};Qe({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(t,e){var{parser:n}=t,r=e[4],s=e[5],i=Zg(e[0]),l=i.type==="atom"&&i.family==="open"?SN(i.text):null,c=Zg(e[1]),d=c.type==="atom"&&c.family==="close"?SN(c.text):null,h=Nt(e[2],"size"),m,p=null;h.isBlank?m=!0:(p=h.value,m=p.number>0);var x="auto",v=e[3];if(v.type==="ordgroup"){if(v.body.length>0){var b=Nt(v.body[0],"textord");x=wN[Number(b.text)]}}else v=Nt(v,"textord"),x=wN[Number(v.text)];return{type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:m,barSize:p,leftDelim:l,rightDelim:d,size:x}},htmlBuilder:F5,mathmlBuilder:Q5});Qe({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(t,e){var{parser:n,funcName:r,token:s}=t;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:Nt(e[0],"size").value,token:s}}});Qe({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=Toe(Nt(e[1],"infix").size),l=e[2],c=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:l,continued:!1,hasBarLine:c,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:F5,mathmlBuilder:Q5});var QR=(t,e)=>{var n=e.style,r,s;t.type==="supsub"?(r=t.sup?Xt(t.sup,e.havingStyle(n.sup()),e):Xt(t.sub,e.havingStyle(n.sub()),e),s=Nt(t.base,"horizBrace")):s=Nt(t,"horizBrace");var i=Xt(s.base,e.havingBaseStyle(at.DISPLAY)),l=vl.svgSpan(s,e),c;if(s.isOver?(c=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:l}]},e),c.children[0].children[0].children[1].classes.push("svg-align")):(c=ge.makeVList({positionType:"bottom",positionData:i.depth+.1+l.height,children:[{type:"elem",elem:l},{type:"kern",size:.1},{type:"elem",elem:i}]},e),c.children[0].children[0].children[0].classes.push("svg-align")),r){var d=ge.makeSpan(["mord",s.isOver?"mover":"munder"],[c],e);s.isOver?c=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:d},{type:"kern",size:.2},{type:"elem",elem:r}]},e):c=ge.makeVList({positionType:"bottom",positionData:d.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:d}]},e)}return ge.makeSpan(["mord",s.isOver?"mover":"munder"],[c],e)},Jce=(t,e)=>{var n=vl.mathMLnode(t.label);return new _e.MathNode(t.isOver?"mover":"munder",[zn(t.base,e),n])};Qe({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"horizBrace",mode:n.mode,label:r,isOver:/^\\over/.test(r),base:e[0]}},htmlBuilder:QR,mathmlBuilder:Jce});Qe({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],s=Nt(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:ar(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=Mr(t.body,e,!1);return ge.makeAnchor(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=bo(t.body,e);return n instanceof ti||(n=new ti("mrow",[n])),n.setAttribute("href",t.href),n}});Qe({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=Nt(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var s=[],i=0;i{var{parser:n,funcName:r,token:s}=t,i=Nt(e[0],"raw").string,l=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var c,d={};switch(r){case"\\htmlClass":d.class=i,c={command:"\\htmlClass",class:i};break;case"\\htmlId":d.id=i,c={command:"\\htmlId",id:i};break;case"\\htmlStyle":d.style=i,c={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var h=i.split(","),m=0;m{var n=Mr(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var s=ge.makeSpan(r,n,e);for(var i in t.attributes)i!=="class"&&t.attributes.hasOwnProperty(i)&&s.setAttribute(i,t.attributes[i]);return s},mathmlBuilder:(t,e)=>bo(t.body,e)});Qe({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:ar(e[0]),mathml:ar(e[1])}},htmlBuilder:(t,e)=>{var n=Mr(t.html,e,!1);return ge.makeFragment(n)},mathmlBuilder:(t,e)=>bo(t.mathml,e)});var qb=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!n)throw new De("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!lR(r))throw new De("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Qe({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(t,e,n)=>{var{parser:r}=t,s={number:0,unit:"em"},i={number:.9,unit:"em"},l={number:0,unit:"em"},c="";if(n[0])for(var d=Nt(n[0],"raw").string,h=d.split(","),m=0;m{var n=Kn(t.height,e),r=0;t.totalheight.number>0&&(r=Kn(t.totalheight,e)-n);var s=0;t.width.number>0&&(s=Kn(t.width,e));var i={height:Le(n+r)};s>0&&(i.width=Le(s)),r>0&&(i.verticalAlign=Le(-r));var l=new Joe(t.src,t.alt,i);return l.height=n,l.depth=r,l},mathmlBuilder:(t,e)=>{var n=new _e.MathNode("mglyph",[]);n.setAttribute("alt",t.alt);var r=Kn(t.height,e),s=0;if(t.totalheight.number>0&&(s=Kn(t.totalheight,e)-r,n.setAttribute("valign",Le(-s))),n.setAttribute("height",Le(r+s)),t.width.number>0){var i=Kn(t.width,e);n.setAttribute("width",Le(i))}return n.setAttribute("src",t.src),n}});Qe({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=Nt(e[0],"size");if(n.settings.strict){var i=r[1]==="m",l=s.value.unit==="mu";i?(l||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):l&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:s.value}},htmlBuilder(t,e){return ge.makeGlue(t.dimension,e)},mathmlBuilder(t,e){var n=Kn(t.dimension,e);return new _e.SpaceNode(n)}});Qe({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:s}},htmlBuilder:(t,e)=>{var n;t.alignment==="clap"?(n=ge.makeSpan([],[Xt(t.body,e)]),n=ge.makeSpan(["inner"],[n],e)):n=ge.makeSpan(["inner"],[Xt(t.body,e)]);var r=ge.makeSpan(["fix"],[]),s=ge.makeSpan([t.alignment],[n,r],e),i=ge.makeSpan(["strut"]);return i.style.height=Le(s.height+s.depth),s.depth&&(i.style.verticalAlign=Le(-s.depth)),s.children.unshift(i),s=ge.makeSpan(["thinbox"],[s],e),ge.makeSpan(["mord","vbox"],[s],e)},mathmlBuilder:(t,e)=>{var n=new _e.MathNode("mpadded",[zn(t.body,e)]);if(t.alignment!=="rlap"){var r=t.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});Qe({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){var{funcName:n,parser:r}=t,s=r.mode;r.switchMode("math");var i=n==="\\("?"\\)":"$",l=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",body:l}}});Qe({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new De("Mismatched "+t.funcName)}});var kN=(t,e)=>{switch(e.style.size){case at.DISPLAY.size:return t.display;case at.TEXT.size:return t.text;case at.SCRIPT.size:return t.script;case at.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};Qe({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:ar(e[0]),text:ar(e[1]),script:ar(e[2]),scriptscript:ar(e[3])}},htmlBuilder:(t,e)=>{var n=kN(t,e),r=Mr(n,e,!1);return ge.makeFragment(r)},mathmlBuilder:(t,e)=>{var n=kN(t,e);return bo(n,e)}});var $R=(t,e,n,r,s,i,l)=>{t=ge.makeSpan([],[t]);var c=n&&tn.isCharacterBox(n),d,h;if(e){var m=Xt(e,r.havingStyle(s.sup()),r);h={elem:m,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-m.depth)}}if(n){var p=Xt(n,r.havingStyle(s.sub()),r);d={elem:p,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-p.height)}}var x;if(h&&d){var v=r.fontMetrics().bigOpSpacing5+d.elem.height+d.elem.depth+d.kern+t.depth+l;x=ge.makeVList({positionType:"bottom",positionData:v,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:d.elem,marginLeft:Le(-i)},{type:"kern",size:d.kern},{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Le(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(d){var b=t.height-l;x=ge.makeVList({positionType:"top",positionData:b,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:d.elem,marginLeft:Le(-i)},{type:"kern",size:d.kern},{type:"elem",elem:t}]},r)}else if(h){var k=t.depth+l;x=ge.makeVList({positionType:"bottom",positionData:k,children:[{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Le(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else return t;var O=[x];if(d&&i!==0&&!c){var j=ge.makeSpan(["mspace"],[],r);j.style.marginRight=Le(i),O.unshift(j)}return ge.makeSpan(["mop","op-limits"],O,r)},HR=["\\smallint"],zd=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Nt(t.base,"op"),s=!0):i=Nt(t,"op");var l=e.style,c=!1;l.size===at.DISPLAY.size&&i.symbol&&!HR.includes(i.name)&&(c=!0);var d;if(i.symbol){var h=c?"Size2-Regular":"Size1-Regular",m="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(m=i.name.slice(1),i.name=m==="oiint"?"\\iint":"\\iiint"),d=ge.makeSymbol(i.name,h,"math",e,["mop","op-symbol",c?"large-op":"small-op"]),m.length>0){var p=d.italic,x=ge.staticSvg(m+"Size"+(c?"2":"1"),e);d=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:d,shift:0},{type:"elem",elem:x,shift:c?.08:0}]},e),i.name="\\"+m,d.classes.unshift("mop"),d.italic=p}}else if(i.body){var v=Mr(i.body,e,!0);v.length===1&&v[0]instanceof Ti?(d=v[0],d.classes[0]="mop"):d=ge.makeSpan(["mop"],v,e)}else{for(var b=[],k=1;k{var n;if(t.symbol)n=new ti("mo",[Mi(t.name,t.mode)]),HR.includes(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new ti("mo",qs(t.body,e));else{n=new ti("mi",[new pa(t.name.slice(1))]);var r=new ti("mo",[Mi("⁡","text")]);t.parentIsSupSub?n=new ti("mrow",[n,r]):n=vR([n,r])}return n},eue={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Qe({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=r;return s.length===1&&(s=eue[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:zd,mathmlBuilder:k0});Qe({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:ar(r)}},htmlBuilder:zd,mathmlBuilder:k0});var tue={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Qe({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:zd,mathmlBuilder:k0});Qe({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:zd,mathmlBuilder:k0});Qe({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t,r=n;return r.length===1&&(r=tue[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:zd,mathmlBuilder:k0});var UR=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Nt(t.base,"operatorname"),s=!0):i=Nt(t,"operatorname");var l;if(i.body.length>0){for(var c=i.body.map(p=>{var x=p.text;return typeof x=="string"?{type:"textord",mode:p.mode,text:x}:p}),d=Mr(c,e.withFont("mathrm"),!0),h=0;h{for(var n=qs(t.body,e.withFont("mathrm")),r=!0,s=0;sm.toText()).join("");n=[new _e.TextNode(c)]}var d=new _e.MathNode("mi",n);d.setAttribute("mathvariant","normal");var h=new _e.MathNode("mo",[Mi("⁡","text")]);return t.parentIsSupSub?new _e.MathNode("mrow",[d,h]):_e.newDocumentFragment([d,h])};Qe({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"operatorname",mode:n.mode,body:ar(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:UR,mathmlBuilder:nue});q("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Rc({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?ge.makeFragment(Mr(t.body,e,!1)):ge.makeSpan(["mord"],Mr(t.body,e,!0),e)},mathmlBuilder(t,e){return bo(t.body,e,!0)}});Qe({type:"overline",names:["\\overline"],props:{numArgs:1},handler(t,e){var{parser:n}=t,r=e[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(t,e){var n=Xt(t.body,e.havingCrampedStyle()),r=ge.makeLineSpan("overline-line",e),s=e.fontMetrics().defaultRuleThickness,i=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]},e);return ge.makeSpan(["mord","overline"],[i],e)},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[new _e.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new _e.MathNode("mover",[zn(t.body,e),n]);return r.setAttribute("accent","true"),r}});Qe({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"phantom",mode:n.mode,body:ar(r)}},htmlBuilder:(t,e)=>{var n=Mr(t.body,e.withPhantom(),!1);return ge.makeFragment(n)},mathmlBuilder:(t,e)=>{var n=qs(t.body,e);return new _e.MathNode("mphantom",n)}});Qe({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=ge.makeSpan([],[Xt(t.body,e.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r{var n=qs(ar(t.body),e),r=new _e.MathNode("mphantom",n),s=new _e.MathNode("mpadded",[r]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});Qe({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=ge.makeSpan(["inner"],[Xt(t.body,e.withPhantom())]),r=ge.makeSpan(["fix"],[]);return ge.makeSpan(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=qs(ar(t.body),e),r=new _e.MathNode("mphantom",n),s=new _e.MathNode("mpadded",[r]);return s.setAttribute("width","0px"),s}});Qe({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=Nt(e[0],"size").value,s=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(t,e){var n=Xt(t.body,e),r=Kn(t.dy,e);return ge.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){var n=new _e.MathNode("mpadded",[zn(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});Qe({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});Qe({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(t,e,n){var{parser:r}=t,s=n[0],i=Nt(e[0],"size"),l=Nt(e[1],"size");return{type:"rule",mode:r.mode,shift:s&&Nt(s,"size").value,width:i.value,height:l.value}},htmlBuilder(t,e){var n=ge.makeSpan(["mord","rule"],[],e),r=Kn(t.width,e),s=Kn(t.height,e),i=t.shift?Kn(t.shift,e):0;return n.style.borderRightWidth=Le(r),n.style.borderTopWidth=Le(s),n.style.bottom=Le(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=Kn(t.width,e),r=Kn(t.height,e),s=t.shift?Kn(t.shift,e):0,i=e.color&&e.getColor()||"black",l=new _e.MathNode("mspace");l.setAttribute("mathbackground",i),l.setAttribute("width",Le(n)),l.setAttribute("height",Le(r));var c=new _e.MathNode("mpadded",[l]);return s>=0?c.setAttribute("height",Le(s)):(c.setAttribute("height",Le(s)),c.setAttribute("depth",Le(-s))),c.setAttribute("voffset",Le(s)),c}});function VR(t,e,n){for(var r=Mr(t,e,!1),s=e.sizeMultiplier/n.sizeMultiplier,i=0;i{var n=e.havingSize(t.size);return VR(t.body,n,e)};Qe({type:"sizing",names:ON,props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!1,n);return{type:"sizing",mode:s.mode,size:ON.indexOf(r)+1,body:i}},htmlBuilder:rue,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=qs(t.body,n),s=new _e.MathNode("mstyle",r);return s.setAttribute("mathsize",Le(n.sizeMultiplier)),s}});Qe({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,s=!1,i=!1,l=n[0]&&Nt(n[0],"ordgroup");if(l)for(var c="",d=0;d{var n=ge.makeSpan([],[Xt(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return n;if(t.smashHeight&&(n.height=0,n.children))for(var r=0;r{var n=new _e.MathNode("mpadded",[zn(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});Qe({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r}=t,s=n[0],i=e[0];return{type:"sqrt",mode:r.mode,body:i,index:s}},htmlBuilder(t,e){var n=Xt(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=ge.wrapFragment(n,e);var r=e.fontMetrics(),s=r.defaultRuleThickness,i=s;e.style.idn.height+n.depth+l&&(l=(l+p-n.height-n.depth)/2);var x=d.height-n.height-l-h;n.style.paddingLeft=Le(m);var v=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+x)},{type:"elem",elem:d},{type:"kern",size:h}]},e);if(t.index){var b=e.havingStyle(at.SCRIPTSCRIPT),k=Xt(t.index,b,e),O=.6*(v.height-v.depth),j=ge.makeVList({positionType:"shift",positionData:-O,children:[{type:"elem",elem:k}]},e),T=ge.makeSpan(["root"],[j]);return ge.makeSpan(["mord","sqrt"],[T,v],e)}else return ge.makeSpan(["mord","sqrt"],[v],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new _e.MathNode("mroot",[zn(n,e),zn(r,e)]):new _e.MathNode("msqrt",[zn(n,e)])}});var jN={display:at.DISPLAY,text:at.TEXT,script:at.SCRIPT,scriptscript:at.SCRIPTSCRIPT};Qe({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t,e){var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!0,n),l=r.slice(1,r.length-5);return{type:"styling",mode:s.mode,style:l,body:i}},htmlBuilder(t,e){var n=jN[t.style],r=e.havingStyle(n).withFont("");return VR(t.body,r,e)},mathmlBuilder(t,e){var n=jN[t.style],r=e.havingStyle(n),s=qs(t.body,r),i=new _e.MathNode("mstyle",s),l={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},c=l[t.style];return i.setAttribute("scriptlevel",c[0]),i.setAttribute("displaystyle",c[1]),i}});var sue=function(e,n){var r=e.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===at.DISPLAY.size||r.alwaysHandleSupSub);return s?zd:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===at.DISPLAY.size||r.limits);return i?UR:null}else{if(r.type==="accent")return tn.isCharacterBox(r.base)?z5:null;if(r.type==="horizBrace"){var l=!e.sub;return l===r.isOver?QR:null}else return null}else return null};Rc({type:"supsub",htmlBuilder(t,e){var n=sue(t,e);if(n)return n(t,e);var{base:r,sup:s,sub:i}=t,l=Xt(r,e),c,d,h=e.fontMetrics(),m=0,p=0,x=r&&tn.isCharacterBox(r);if(s){var v=e.havingStyle(e.style.sup());c=Xt(s,v,e),x||(m=l.height-v.fontMetrics().supDrop*v.sizeMultiplier/e.sizeMultiplier)}if(i){var b=e.havingStyle(e.style.sub());d=Xt(i,b,e),x||(p=l.depth+b.fontMetrics().subDrop*b.sizeMultiplier/e.sizeMultiplier)}var k;e.style===at.DISPLAY?k=h.sup1:e.style.cramped?k=h.sup3:k=h.sup2;var O=e.sizeMultiplier,j=Le(.5/h.ptPerEm/O),T=null;if(d){var M=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(l instanceof Ti||M)&&(T=Le(-l.italic))}var _;if(c&&d){m=Math.max(m,k,c.depth+.25*h.xHeight),p=Math.max(p,h.sub2);var D=h.defaultRuleThickness,E=4*D;if(m-c.depth-(d.height-p)0&&(m+=z,p-=z)}var Q=[{type:"elem",elem:d,shift:p,marginRight:j,marginLeft:T},{type:"elem",elem:c,shift:-m,marginRight:j}];_=ge.makeVList({positionType:"individualShift",children:Q},e)}else if(d){p=Math.max(p,h.sub1,d.height-.8*h.xHeight);var F=[{type:"elem",elem:d,marginLeft:T,marginRight:j}];_=ge.makeVList({positionType:"shift",positionData:p,children:F},e)}else if(c)m=Math.max(m,k,c.depth+.25*h.xHeight),_=ge.makeVList({positionType:"shift",positionData:-m,children:[{type:"elem",elem:c,marginRight:j}]},e);else throw new Error("supsub must have either sup or sub.");var L=N4(l,"right")||"mord";return ge.makeSpan([L],[l,ge.makeSpan(["msupsub"],[_])],e)},mathmlBuilder(t,e){var n=!1,r,s;t.base&&t.base.type==="horizBrace"&&(s=!!t.sup,s===t.base.isOver&&(n=!0,r=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var i=[zn(t.base,e)];t.sub&&i.push(zn(t.sub,e)),t.sup&&i.push(zn(t.sup,e));var l;if(n)l=r?"mover":"munder";else if(t.sub)if(t.sup){var h=t.base;h&&h.type==="op"&&h.limits&&e.style===at.DISPLAY||h&&h.type==="operatorname"&&h.alwaysHandleSupSub&&(e.style===at.DISPLAY||h.limits)?l="munderover":l="msubsup"}else{var d=t.base;d&&d.type==="op"&&d.limits&&(e.style===at.DISPLAY||d.alwaysHandleSupSub)||d&&d.type==="operatorname"&&d.alwaysHandleSupSub&&(d.limits||e.style===at.DISPLAY)?l="munder":l="msub"}else{var c=t.base;c&&c.type==="op"&&c.limits&&(e.style===at.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||e.style===at.DISPLAY)?l="mover":l="msup"}return new _e.MathNode(l,i)}});Rc({type:"atom",htmlBuilder(t,e){return ge.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[Mi(t.text,t.mode)]);if(t.family==="bin"){var r=D5(t,e);r==="bold-italic"&&n.setAttribute("mathvariant",r)}else t.family==="punct"?n.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&n.setAttribute("stretchy","false");return n}});var WR={mi:"italic",mn:"normal",mtext:"normal"};Rc({type:"mathord",htmlBuilder(t,e){return ge.makeOrd(t,e,"mathord")},mathmlBuilder(t,e){var n=new _e.MathNode("mi",[Mi(t.text,t.mode,e)]),r=D5(t,e)||"italic";return r!==WR[n.type]&&n.setAttribute("mathvariant",r),n}});Rc({type:"textord",htmlBuilder(t,e){return ge.makeOrd(t,e,"textord")},mathmlBuilder(t,e){var n=Mi(t.text,t.mode,e),r=D5(t,e)||"normal",s;return t.mode==="text"?s=new _e.MathNode("mtext",[n]):/[0-9]/.test(t.text)?s=new _e.MathNode("mn",[n]):t.text==="\\prime"?s=new _e.MathNode("mo",[n]):s=new _e.MathNode("mi",[n]),r!==WR[s.type]&&s.setAttribute("mathvariant",r),s}});var Fb={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Qb={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Rc({type:"spacing",htmlBuilder(t,e){if(Qb.hasOwnProperty(t.text)){var n=Qb[t.text].className||"";if(t.mode==="text"){var r=ge.makeOrd(t,e,"textord");return r.classes.push(n),r}else return ge.makeSpan(["mspace",n],[ge.mathsym(t.text,t.mode,e)],e)}else{if(Fb.hasOwnProperty(t.text))return ge.makeSpan(["mspace",Fb[t.text]],[],e);throw new De('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(Qb.hasOwnProperty(t.text))n=new _e.MathNode("mtext",[new _e.TextNode(" ")]);else{if(Fb.hasOwnProperty(t.text))return new _e.MathNode("mspace");throw new De('Unknown type of space "'+t.text+'"')}return n}});var NN=()=>{var t=new _e.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};Rc({type:"tag",mathmlBuilder(t,e){var n=new _e.MathNode("mtable",[new _e.MathNode("mtr",[NN(),new _e.MathNode("mtd",[bo(t.body,e)]),NN(),new _e.MathNode("mtd",[bo(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var CN={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},TN={"\\textbf":"textbf","\\textmd":"textmd"},iue={"\\textit":"textit","\\textup":"textup"},MN=(t,e)=>{var n=t.font;if(n){if(CN[n])return e.withTextFontFamily(CN[n]);if(TN[n])return e.withTextFontWeight(TN[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(iue[n])};Qe({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"text",mode:n.mode,body:ar(s),font:r}},htmlBuilder(t,e){var n=MN(t,e),r=Mr(t.body,n,!0);return ge.makeSpan(["mord","text"],r,n)},mathmlBuilder(t,e){var n=MN(t,e);return bo(t.body,n)}});Qe({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"underline",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Xt(t.body,e),r=ge.makeLineSpan("underline-line",e),s=e.fontMetrics().defaultRuleThickness,i=ge.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]},e);return ge.makeSpan(["mord","underline"],[i],e)},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[new _e.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new _e.MathNode("munder",[zn(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});Qe({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"vcenter",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Xt(t.body,e),r=e.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return ge.makeVList({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){return new _e.MathNode("mpadded",[zn(t.body,e)],["vcenter"])}});Qe({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new De("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=AN(t),r=[],s=e.havingStyle(e.style.text()),i=0;it.body.replace(/ /g,t.star?"␣":" "),so=gR,GR=`[ \r ]`,aue="\\\\[a-zA-Z@]+",lue="\\\\[^\uD800-\uDFFF]",oue="("+aue+")"+GR+"*",cue=`\\\\( |[ \r ]+ -?)[ \r ]*`,M4="[̀-ͯ]",uue=new RegExp(M4+"+$"),due="("+GR+"+)|"+(cue+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(M4+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(M4+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+oue)+("|"+lue+")");class EN{constructor(e,n){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=n,this.tokenRegex=new RegExp(due,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,n){this.catcodes[e]=n}lex(){var e=this.input,n=this.tokenRegex.lastIndex;if(n===e.length)return new ii("EOF",new Ts(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new De("Unexpected character: '"+e[n]+"'",new ii(e[n],new Ts(this,n,n+1)));var s=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[s]===14){var i=e.indexOf(` -`,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new ii(s,new Ts(this,n,this.tokenRegex.lastIndex))}}class hue{constructor(e,n){e===void 0&&(e={}),n===void 0&&(n={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=n,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new De("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var n in e)e.hasOwnProperty(n)&&(e[n]==null?delete this.current[n]:this.current[n]=e[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,n,r){if(r===void 0&&(r=!1),r){for(var s=0;s0&&(this.undefStack[this.undefStack.length-1][e]=n)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(e)&&(i[e]=this.current[e])}n==null?delete this.current[e]:this.current[e]=n}}var fue=BR;q("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});q("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});q("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});q("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});q("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var n=t.future();return e[0].length===1&&e[0][0].text===n.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});q("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");q("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var _N={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};q("\\char",function(t){var e=t.popToken(),n,r="";if(e.text==="'")n=8,e=t.popToken();else if(e.text==='"')n=16,e=t.popToken();else if(e.text==="`")if(e=t.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new De("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=_N[e.text],r==null||r>=n)throw new De("Invalid base-"+n+" digit "+e.text);for(var s;(s=_N[t.future().text])!=null&&s{var s=t.consumeArg().tokens;if(s.length!==1)throw new De("\\newcommand's first argument must be a macro name");var i=s[0].text,l=t.isDefined(i);if(l&&!e)throw new De("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!l&&!n)throw new De("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var c=0;if(s=t.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var d="",h=t.expandNextToken();h.text!=="]"&&h.text!=="EOF";)d+=h.text,h=t.expandNextToken();if(!d.match(/^\s*[0-9]+\s*$/))throw new De("Invalid number of arguments: "+d);c=parseInt(d),s=t.consumeArg().tokens}return l&&r||t.macros.set(i,{tokens:s,numArgs:c}),""};q("\\newcommand",t=>$5(t,!1,!0,!1));q("\\renewcommand",t=>$5(t,!0,!1,!1));q("\\providecommand",t=>$5(t,!0,!0,!0));q("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});q("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});q("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),io[n],Ln.math[n],Ln.text[n]),""});q("\\bgroup","{");q("\\egroup","}");q("~","\\nobreakspace");q("\\lq","`");q("\\rq","'");q("\\aa","\\r a");q("\\AA","\\r A");q("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");q("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");q("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");q("ℬ","\\mathscr{B}");q("ℰ","\\mathscr{E}");q("ℱ","\\mathscr{F}");q("ℋ","\\mathscr{H}");q("ℐ","\\mathscr{I}");q("ℒ","\\mathscr{L}");q("ℳ","\\mathscr{M}");q("ℛ","\\mathscr{R}");q("ℭ","\\mathfrak{C}");q("ℌ","\\mathfrak{H}");q("ℨ","\\mathfrak{Z}");q("\\Bbbk","\\Bbb{k}");q("·","\\cdotp");q("\\llap","\\mathllap{\\textrm{#1}}");q("\\rlap","\\mathrlap{\\textrm{#1}}");q("\\clap","\\mathclap{\\textrm{#1}}");q("\\mathstrut","\\vphantom{(}");q("\\underbar","\\underline{\\text{#1}}");q("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');q("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");q("\\ne","\\neq");q("≠","\\neq");q("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");q("∉","\\notin");q("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");q("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");q("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");q("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");q("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");q("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");q("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");q("⟂","\\perp");q("‼","\\mathclose{!\\mkern-0.8mu!}");q("∌","\\notni");q("⌜","\\ulcorner");q("⌝","\\urcorner");q("⌞","\\llcorner");q("⌟","\\lrcorner");q("©","\\copyright");q("®","\\textregistered");q("️","\\textregistered");q("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');q("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');q("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');q("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');q("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");q("⋮","\\vdots");q("\\varGamma","\\mathit{\\Gamma}");q("\\varDelta","\\mathit{\\Delta}");q("\\varTheta","\\mathit{\\Theta}");q("\\varLambda","\\mathit{\\Lambda}");q("\\varXi","\\mathit{\\Xi}");q("\\varPi","\\mathit{\\Pi}");q("\\varSigma","\\mathit{\\Sigma}");q("\\varUpsilon","\\mathit{\\Upsilon}");q("\\varPhi","\\mathit{\\Phi}");q("\\varPsi","\\mathit{\\Psi}");q("\\varOmega","\\mathit{\\Omega}");q("\\substack","\\begin{subarray}{c}#1\\end{subarray}");q("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");q("\\boxed","\\fbox{$\\displaystyle{#1}$}");q("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");q("\\implies","\\DOTSB\\;\\Longrightarrow\\;");q("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");q("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");q("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var DN={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};q("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in DN?e=DN[n]:(n.slice(0,4)==="\\not"||n in Ln.math&&["bin","rel"].includes(Ln.math[n].group))&&(e="\\dotsb"),e});var H5={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};q("\\dotso",function(t){var e=t.future().text;return e in H5?"\\ldots\\,":"\\ldots"});q("\\dotsc",function(t){var e=t.future().text;return e in H5&&e!==","?"\\ldots\\,":"\\ldots"});q("\\cdots",function(t){var e=t.future().text;return e in H5?"\\@cdots\\,":"\\@cdots"});q("\\dotsb","\\cdots");q("\\dotsm","\\cdots");q("\\dotsi","\\!\\cdots");q("\\dotsx","\\ldots\\,");q("\\DOTSI","\\relax");q("\\DOTSB","\\relax");q("\\DOTSX","\\relax");q("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");q("\\,","\\tmspace+{3mu}{.1667em}");q("\\thinspace","\\,");q("\\>","\\mskip{4mu}");q("\\:","\\tmspace+{4mu}{.2222em}");q("\\medspace","\\:");q("\\;","\\tmspace+{5mu}{.2777em}");q("\\thickspace","\\;");q("\\!","\\tmspace-{3mu}{.1667em}");q("\\negthinspace","\\!");q("\\negmedspace","\\tmspace-{4mu}{.2222em}");q("\\negthickspace","\\tmspace-{5mu}{.277em}");q("\\enspace","\\kern.5em ");q("\\enskip","\\hskip.5em\\relax");q("\\quad","\\hskip1em\\relax");q("\\qquad","\\hskip2em\\relax");q("\\tag","\\@ifstar\\tag@literal\\tag@paren");q("\\tag@paren","\\tag@literal{({#1})}");q("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new De("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});q("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");q("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");q("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");q("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");q("\\newline","\\\\\\relax");q("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var XR=Le(pa["Main-Regular"][84][1]-.7*pa["Main-Regular"][65][1]);q("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+XR+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");q("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+XR+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");q("\\hspace","\\@ifstar\\@hspacer\\@hspace");q("\\@hspace","\\hskip #1\\relax");q("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");q("\\ordinarycolon",":");q("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");q("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');q("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');q("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');q("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');q("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');q("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');q("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');q("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');q("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');q("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');q("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');q("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');q("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');q("∷","\\dblcolon");q("∹","\\eqcolon");q("≔","\\coloneqq");q("≕","\\eqqcolon");q("⩴","\\Coloneqq");q("\\ratio","\\vcentcolon");q("\\coloncolon","\\dblcolon");q("\\colonequals","\\coloneqq");q("\\coloncolonequals","\\Coloneqq");q("\\equalscolon","\\eqqcolon");q("\\equalscoloncolon","\\Eqqcolon");q("\\colonminus","\\coloneq");q("\\coloncolonminus","\\Coloneq");q("\\minuscolon","\\eqcolon");q("\\minuscoloncolon","\\Eqcolon");q("\\coloncolonapprox","\\Colonapprox");q("\\coloncolonsim","\\Colonsim");q("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");q("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");q("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");q("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");q("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");q("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");q("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");q("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");q("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");q("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");q("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");q("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");q("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");q("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");q("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");q("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");q("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");q("\\nleqq","\\html@mathml{\\@nleqq}{≰}");q("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");q("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");q("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");q("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");q("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");q("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");q("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");q("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");q("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");q("\\imath","\\html@mathml{\\@imath}{ı}");q("\\jmath","\\html@mathml{\\@jmath}{ȷ}");q("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");q("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");q("⟦","\\llbracket");q("⟧","\\rrbracket");q("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");q("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");q("⦃","\\lBrace");q("⦄","\\rBrace");q("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");q("⦵","\\minuso");q("\\darr","\\downarrow");q("\\dArr","\\Downarrow");q("\\Darr","\\Downarrow");q("\\lang","\\langle");q("\\rang","\\rangle");q("\\uarr","\\uparrow");q("\\uArr","\\Uparrow");q("\\Uarr","\\Uparrow");q("\\N","\\mathbb{N}");q("\\R","\\mathbb{R}");q("\\Z","\\mathbb{Z}");q("\\alef","\\aleph");q("\\alefsym","\\aleph");q("\\Alpha","\\mathrm{A}");q("\\Beta","\\mathrm{B}");q("\\bull","\\bullet");q("\\Chi","\\mathrm{X}");q("\\clubs","\\clubsuit");q("\\cnums","\\mathbb{C}");q("\\Complex","\\mathbb{C}");q("\\Dagger","\\ddagger");q("\\diamonds","\\diamondsuit");q("\\empty","\\emptyset");q("\\Epsilon","\\mathrm{E}");q("\\Eta","\\mathrm{H}");q("\\exist","\\exists");q("\\harr","\\leftrightarrow");q("\\hArr","\\Leftrightarrow");q("\\Harr","\\Leftrightarrow");q("\\hearts","\\heartsuit");q("\\image","\\Im");q("\\infin","\\infty");q("\\Iota","\\mathrm{I}");q("\\isin","\\in");q("\\Kappa","\\mathrm{K}");q("\\larr","\\leftarrow");q("\\lArr","\\Leftarrow");q("\\Larr","\\Leftarrow");q("\\lrarr","\\leftrightarrow");q("\\lrArr","\\Leftrightarrow");q("\\Lrarr","\\Leftrightarrow");q("\\Mu","\\mathrm{M}");q("\\natnums","\\mathbb{N}");q("\\Nu","\\mathrm{N}");q("\\Omicron","\\mathrm{O}");q("\\plusmn","\\pm");q("\\rarr","\\rightarrow");q("\\rArr","\\Rightarrow");q("\\Rarr","\\Rightarrow");q("\\real","\\Re");q("\\reals","\\mathbb{R}");q("\\Reals","\\mathbb{R}");q("\\Rho","\\mathrm{P}");q("\\sdot","\\cdot");q("\\sect","\\S");q("\\spades","\\spadesuit");q("\\sub","\\subset");q("\\sube","\\subseteq");q("\\supe","\\supseteq");q("\\Tau","\\mathrm{T}");q("\\thetasym","\\vartheta");q("\\weierp","\\wp");q("\\Zeta","\\mathrm{Z}");q("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");q("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");q("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");q("\\bra","\\mathinner{\\langle{#1}|}");q("\\ket","\\mathinner{|{#1}\\rangle}");q("\\braket","\\mathinner{\\langle{#1}\\rangle}");q("\\Bra","\\left\\langle#1\\right|");q("\\Ket","\\left|#1\\right\\rangle");var YR=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,s=e.consumeArg().tokens,i=e.consumeArg().tokens,l=e.macros.get("|"),c=e.macros.get("\\|");e.macros.beginGroup();var d=p=>x=>{t&&(x.macros.set("|",l),s.length&&x.macros.set("\\|",c));var v=p;if(!p&&s.length){var b=x.future();b.text==="|"&&(x.popToken(),v=!0)}return{tokens:v?s:r,numArgs:0}};e.macros.set("|",d(!1)),s.length&&e.macros.set("\\|",d(!0));var h=e.consumeArg().tokens,m=e.expandTokens([...i,...h,...n]);return e.macros.endGroup(),{tokens:m.reverse(),numArgs:0}};q("\\bra@ket",YR(!1));q("\\bra@set",YR(!0));q("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");q("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");q("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");q("\\angln","{\\angl n}");q("\\blue","\\textcolor{##6495ed}{#1}");q("\\orange","\\textcolor{##ffa500}{#1}");q("\\pink","\\textcolor{##ff00af}{#1}");q("\\red","\\textcolor{##df0030}{#1}");q("\\green","\\textcolor{##28ae7b}{#1}");q("\\gray","\\textcolor{gray}{#1}");q("\\purple","\\textcolor{##9d38bd}{#1}");q("\\blueA","\\textcolor{##ccfaff}{#1}");q("\\blueB","\\textcolor{##80f6ff}{#1}");q("\\blueC","\\textcolor{##63d9ea}{#1}");q("\\blueD","\\textcolor{##11accd}{#1}");q("\\blueE","\\textcolor{##0c7f99}{#1}");q("\\tealA","\\textcolor{##94fff5}{#1}");q("\\tealB","\\textcolor{##26edd5}{#1}");q("\\tealC","\\textcolor{##01d1c1}{#1}");q("\\tealD","\\textcolor{##01a995}{#1}");q("\\tealE","\\textcolor{##208170}{#1}");q("\\greenA","\\textcolor{##b6ffb0}{#1}");q("\\greenB","\\textcolor{##8af281}{#1}");q("\\greenC","\\textcolor{##74cf70}{#1}");q("\\greenD","\\textcolor{##1fab54}{#1}");q("\\greenE","\\textcolor{##0d923f}{#1}");q("\\goldA","\\textcolor{##ffd0a9}{#1}");q("\\goldB","\\textcolor{##ffbb71}{#1}");q("\\goldC","\\textcolor{##ff9c39}{#1}");q("\\goldD","\\textcolor{##e07d10}{#1}");q("\\goldE","\\textcolor{##a75a05}{#1}");q("\\redA","\\textcolor{##fca9a9}{#1}");q("\\redB","\\textcolor{##ff8482}{#1}");q("\\redC","\\textcolor{##f9685d}{#1}");q("\\redD","\\textcolor{##e84d39}{#1}");q("\\redE","\\textcolor{##bc2612}{#1}");q("\\maroonA","\\textcolor{##ffbde0}{#1}");q("\\maroonB","\\textcolor{##ff92c6}{#1}");q("\\maroonC","\\textcolor{##ed5fa6}{#1}");q("\\maroonD","\\textcolor{##ca337c}{#1}");q("\\maroonE","\\textcolor{##9e034e}{#1}");q("\\purpleA","\\textcolor{##ddd7ff}{#1}");q("\\purpleB","\\textcolor{##c6b9fc}{#1}");q("\\purpleC","\\textcolor{##aa87ff}{#1}");q("\\purpleD","\\textcolor{##7854ab}{#1}");q("\\purpleE","\\textcolor{##543b78}{#1}");q("\\mintA","\\textcolor{##f5f9e8}{#1}");q("\\mintB","\\textcolor{##edf2df}{#1}");q("\\mintC","\\textcolor{##e0e5cc}{#1}");q("\\grayA","\\textcolor{##f6f7f7}{#1}");q("\\grayB","\\textcolor{##f0f1f2}{#1}");q("\\grayC","\\textcolor{##e3e5e6}{#1}");q("\\grayD","\\textcolor{##d6d8da}{#1}");q("\\grayE","\\textcolor{##babec2}{#1}");q("\\grayF","\\textcolor{##888d93}{#1}");q("\\grayG","\\textcolor{##626569}{#1}");q("\\grayH","\\textcolor{##3b3e40}{#1}");q("\\grayI","\\textcolor{##21242c}{#1}");q("\\kaBlue","\\textcolor{##314453}{#1}");q("\\kaGreen","\\textcolor{##71B307}{#1}");var KR={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class mue{constructor(e,n,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(e),this.macros=new hue(fue,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new EN(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var n,r,s;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:s,end:r}=this.consumeArg(["]"])}else({tokens:s,start:n,end:r}=this.consumeArg());return this.pushToken(new ii("EOF",r.loc)),this.pushTokens(s),new ii("",Ts.range(n,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var n=[],r=e&&e.length>0;r||this.consumeSpaces();var s=this.future(),i,l=0,c=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++l;else if(i.text==="}"){if(--l,l===-1)throw new De("Extra }",i)}else if(i.text==="EOF")throw new De("Unexpected end of input in a macro argument, expected '"+(e&&r?e[c]:"}")+"'",i);if(e&&r)if((l===0||l===1&&e[c]==="{")&&i.text===e[c]){if(++c,c===e.length){n.splice(-c,c);break}}else c=0}while(l!==0||r);return s.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:s,end:i}}consumeArgs(e,n){if(n){if(n.length!==e+1)throw new De("The length of delimiters doesn't match the number of args!");for(var r=n[0],s=0;sthis.settings.maxExpand)throw new De("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var n=this.popToken(),r=n.text,s=n.noexpand?null:this._getExpansion(r);if(s==null||e&&s.unexpandable){if(e&&s==null&&r[0]==="\\"&&!this.isDefined(r))throw new De("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var i=s.tokens,l=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var c=i.length-1;c>=0;--c){var d=i[c];if(d.text==="#"){if(c===0)throw new De("Incomplete placeholder at end of macro body",d);if(d=i[--c],d.text==="#")i.splice(c+1,1);else if(/^[1-9]$/.test(d.text))i.splice(c,2,...l[+d.text-1]);else throw new De("Not a valid argument number",d)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new ii(e)]):void 0}expandTokens(e){var n=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),n.push(s)}return this.countExpansion(n.length),n}expandMacroAsText(e){var n=this.expandMacro(e);return n&&n.map(r=>r.text).join("")}_getExpansion(e){var n=this.macros.get(e);if(n==null)return n;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var s=typeof n=="function"?n(this):n;if(typeof s=="string"){var i=0;if(s.indexOf("#")!==-1)for(var l=s.replace(/##/g,"");l.indexOf("#"+(i+1))!==-1;)++i;for(var c=new EN(s,this.settings),d=[],h=c.lex();h.text!=="EOF";)d.push(h),h=c.lex();d.reverse();var m={tokens:d,numArgs:i};return m}return s}isDefined(e){return this.macros.has(e)||io.hasOwnProperty(e)||Ln.math.hasOwnProperty(e)||Ln.text.hasOwnProperty(e)||KR.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:io.hasOwnProperty(e)&&!io[e].primitive}}var RN=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Pp=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),$b={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},zN={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Xx{constructor(e,n){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new mue(e,n,this.mode),this.settings=n,this.leftrightDepth=0}expect(e,n){if(n===void 0&&(n=!0),this.fetch().text!==e)throw new De("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var n=this.nextToken;this.consume(),this.gullet.pushToken(new ii("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,r}parseExpression(e,n){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var s=this.fetch();if(Xx.endOfExpression.indexOf(s.text)!==-1||n&&s.text===n||e&&io[s.text]&&io[s.text].infix)break;var i=this.parseAtom(n);if(i){if(i.type==="internal")continue}else break;r.push(i)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var n=-1,r,s=0;s=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var c=Ln[this.mode][n].group,d=Ts.range(e),h;if(nce.hasOwnProperty(c)){var m=c;h={type:"atom",mode:this.mode,family:m,loc:d,text:n}}else h={type:c,mode:this.mode,loc:d,text:n};l=h}else if(n.charCodeAt(0)>=128)this.settings.strict&&(aR(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),e)),l={type:"textord",mode:"text",loc:Ts.range(e),text:n};else return null;if(this.consume(),i)for(var p=0;ph&&(h=m):m&&(h!==void 0&&h>-1&&d.push(` +?)[ \r ]*`,A4="[̀-ͯ]",uue=new RegExp(A4+"+$"),due="("+GR+"+)|"+(cue+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(A4+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(A4+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+oue)+("|"+lue+")");class EN{constructor(e,n){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=n,this.tokenRegex=new RegExp(due,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,n){this.catcodes[e]=n}lex(){var e=this.input,n=this.tokenRegex.lastIndex;if(n===e.length)return new si("EOF",new Ts(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new De("Unexpected character: '"+e[n]+"'",new si(e[n],new Ts(this,n,n+1)));var s=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[s]===14){var i=e.indexOf(` +`,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new si(s,new Ts(this,n,this.tokenRegex.lastIndex))}}class hue{constructor(e,n){e===void 0&&(e={}),n===void 0&&(n={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=n,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new De("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var n in e)e.hasOwnProperty(n)&&(e[n]==null?delete this.current[n]:this.current[n]=e[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,n,r){if(r===void 0&&(r=!1),r){for(var s=0;s0&&(this.undefStack[this.undefStack.length-1][e]=n)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(e)&&(i[e]=this.current[e])}n==null?delete this.current[e]:this.current[e]=n}}var fue=BR;q("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});q("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});q("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});q("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});q("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var n=t.future();return e[0].length===1&&e[0][0].text===n.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});q("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");q("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var _N={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};q("\\char",function(t){var e=t.popToken(),n,r="";if(e.text==="'")n=8,e=t.popToken();else if(e.text==='"')n=16,e=t.popToken();else if(e.text==="`")if(e=t.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new De("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=_N[e.text],r==null||r>=n)throw new De("Invalid base-"+n+" digit "+e.text);for(var s;(s=_N[t.future().text])!=null&&s{var s=t.consumeArg().tokens;if(s.length!==1)throw new De("\\newcommand's first argument must be a macro name");var i=s[0].text,l=t.isDefined(i);if(l&&!e)throw new De("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!l&&!n)throw new De("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var c=0;if(s=t.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var d="",h=t.expandNextToken();h.text!=="]"&&h.text!=="EOF";)d+=h.text,h=t.expandNextToken();if(!d.match(/^\s*[0-9]+\s*$/))throw new De("Invalid number of arguments: "+d);c=parseInt(d),s=t.consumeArg().tokens}return l&&r||t.macros.set(i,{tokens:s,numArgs:c}),""};q("\\newcommand",t=>$5(t,!1,!0,!1));q("\\renewcommand",t=>$5(t,!0,!1,!1));q("\\providecommand",t=>$5(t,!0,!0,!0));q("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});q("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});q("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),so[n],Ln.math[n],Ln.text[n]),""});q("\\bgroup","{");q("\\egroup","}");q("~","\\nobreakspace");q("\\lq","`");q("\\rq","'");q("\\aa","\\r a");q("\\AA","\\r A");q("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");q("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");q("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");q("ℬ","\\mathscr{B}");q("ℰ","\\mathscr{E}");q("ℱ","\\mathscr{F}");q("ℋ","\\mathscr{H}");q("ℐ","\\mathscr{I}");q("ℒ","\\mathscr{L}");q("ℳ","\\mathscr{M}");q("ℛ","\\mathscr{R}");q("ℭ","\\mathfrak{C}");q("ℌ","\\mathfrak{H}");q("ℨ","\\mathfrak{Z}");q("\\Bbbk","\\Bbb{k}");q("·","\\cdotp");q("\\llap","\\mathllap{\\textrm{#1}}");q("\\rlap","\\mathrlap{\\textrm{#1}}");q("\\clap","\\mathclap{\\textrm{#1}}");q("\\mathstrut","\\vphantom{(}");q("\\underbar","\\underline{\\text{#1}}");q("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');q("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");q("\\ne","\\neq");q("≠","\\neq");q("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");q("∉","\\notin");q("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");q("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");q("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");q("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");q("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");q("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");q("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");q("⟂","\\perp");q("‼","\\mathclose{!\\mkern-0.8mu!}");q("∌","\\notni");q("⌜","\\ulcorner");q("⌝","\\urcorner");q("⌞","\\llcorner");q("⌟","\\lrcorner");q("©","\\copyright");q("®","\\textregistered");q("️","\\textregistered");q("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');q("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');q("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');q("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');q("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");q("⋮","\\vdots");q("\\varGamma","\\mathit{\\Gamma}");q("\\varDelta","\\mathit{\\Delta}");q("\\varTheta","\\mathit{\\Theta}");q("\\varLambda","\\mathit{\\Lambda}");q("\\varXi","\\mathit{\\Xi}");q("\\varPi","\\mathit{\\Pi}");q("\\varSigma","\\mathit{\\Sigma}");q("\\varUpsilon","\\mathit{\\Upsilon}");q("\\varPhi","\\mathit{\\Phi}");q("\\varPsi","\\mathit{\\Psi}");q("\\varOmega","\\mathit{\\Omega}");q("\\substack","\\begin{subarray}{c}#1\\end{subarray}");q("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");q("\\boxed","\\fbox{$\\displaystyle{#1}$}");q("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");q("\\implies","\\DOTSB\\;\\Longrightarrow\\;");q("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");q("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");q("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var DN={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};q("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in DN?e=DN[n]:(n.slice(0,4)==="\\not"||n in Ln.math&&["bin","rel"].includes(Ln.math[n].group))&&(e="\\dotsb"),e});var H5={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};q("\\dotso",function(t){var e=t.future().text;return e in H5?"\\ldots\\,":"\\ldots"});q("\\dotsc",function(t){var e=t.future().text;return e in H5&&e!==","?"\\ldots\\,":"\\ldots"});q("\\cdots",function(t){var e=t.future().text;return e in H5?"\\@cdots\\,":"\\@cdots"});q("\\dotsb","\\cdots");q("\\dotsm","\\cdots");q("\\dotsi","\\!\\cdots");q("\\dotsx","\\ldots\\,");q("\\DOTSI","\\relax");q("\\DOTSB","\\relax");q("\\DOTSX","\\relax");q("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");q("\\,","\\tmspace+{3mu}{.1667em}");q("\\thinspace","\\,");q("\\>","\\mskip{4mu}");q("\\:","\\tmspace+{4mu}{.2222em}");q("\\medspace","\\:");q("\\;","\\tmspace+{5mu}{.2777em}");q("\\thickspace","\\;");q("\\!","\\tmspace-{3mu}{.1667em}");q("\\negthinspace","\\!");q("\\negmedspace","\\tmspace-{4mu}{.2222em}");q("\\negthickspace","\\tmspace-{5mu}{.277em}");q("\\enspace","\\kern.5em ");q("\\enskip","\\hskip.5em\\relax");q("\\quad","\\hskip1em\\relax");q("\\qquad","\\hskip2em\\relax");q("\\tag","\\@ifstar\\tag@literal\\tag@paren");q("\\tag@paren","\\tag@literal{({#1})}");q("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new De("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});q("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");q("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");q("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");q("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");q("\\newline","\\\\\\relax");q("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var XR=Le(ma["Main-Regular"][84][1]-.7*ma["Main-Regular"][65][1]);q("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+XR+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");q("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+XR+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");q("\\hspace","\\@ifstar\\@hspacer\\@hspace");q("\\@hspace","\\hskip #1\\relax");q("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");q("\\ordinarycolon",":");q("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");q("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');q("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');q("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');q("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');q("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');q("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');q("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');q("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');q("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');q("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');q("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');q("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');q("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');q("∷","\\dblcolon");q("∹","\\eqcolon");q("≔","\\coloneqq");q("≕","\\eqqcolon");q("⩴","\\Coloneqq");q("\\ratio","\\vcentcolon");q("\\coloncolon","\\dblcolon");q("\\colonequals","\\coloneqq");q("\\coloncolonequals","\\Coloneqq");q("\\equalscolon","\\eqqcolon");q("\\equalscoloncolon","\\Eqqcolon");q("\\colonminus","\\coloneq");q("\\coloncolonminus","\\Coloneq");q("\\minuscolon","\\eqcolon");q("\\minuscoloncolon","\\Eqcolon");q("\\coloncolonapprox","\\Colonapprox");q("\\coloncolonsim","\\Colonsim");q("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");q("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");q("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");q("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");q("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");q("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");q("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");q("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");q("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");q("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");q("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");q("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");q("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");q("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");q("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");q("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");q("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");q("\\nleqq","\\html@mathml{\\@nleqq}{≰}");q("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");q("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");q("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");q("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");q("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");q("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");q("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");q("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");q("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");q("\\imath","\\html@mathml{\\@imath}{ı}");q("\\jmath","\\html@mathml{\\@jmath}{ȷ}");q("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");q("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");q("⟦","\\llbracket");q("⟧","\\rrbracket");q("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");q("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");q("⦃","\\lBrace");q("⦄","\\rBrace");q("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");q("⦵","\\minuso");q("\\darr","\\downarrow");q("\\dArr","\\Downarrow");q("\\Darr","\\Downarrow");q("\\lang","\\langle");q("\\rang","\\rangle");q("\\uarr","\\uparrow");q("\\uArr","\\Uparrow");q("\\Uarr","\\Uparrow");q("\\N","\\mathbb{N}");q("\\R","\\mathbb{R}");q("\\Z","\\mathbb{Z}");q("\\alef","\\aleph");q("\\alefsym","\\aleph");q("\\Alpha","\\mathrm{A}");q("\\Beta","\\mathrm{B}");q("\\bull","\\bullet");q("\\Chi","\\mathrm{X}");q("\\clubs","\\clubsuit");q("\\cnums","\\mathbb{C}");q("\\Complex","\\mathbb{C}");q("\\Dagger","\\ddagger");q("\\diamonds","\\diamondsuit");q("\\empty","\\emptyset");q("\\Epsilon","\\mathrm{E}");q("\\Eta","\\mathrm{H}");q("\\exist","\\exists");q("\\harr","\\leftrightarrow");q("\\hArr","\\Leftrightarrow");q("\\Harr","\\Leftrightarrow");q("\\hearts","\\heartsuit");q("\\image","\\Im");q("\\infin","\\infty");q("\\Iota","\\mathrm{I}");q("\\isin","\\in");q("\\Kappa","\\mathrm{K}");q("\\larr","\\leftarrow");q("\\lArr","\\Leftarrow");q("\\Larr","\\Leftarrow");q("\\lrarr","\\leftrightarrow");q("\\lrArr","\\Leftrightarrow");q("\\Lrarr","\\Leftrightarrow");q("\\Mu","\\mathrm{M}");q("\\natnums","\\mathbb{N}");q("\\Nu","\\mathrm{N}");q("\\Omicron","\\mathrm{O}");q("\\plusmn","\\pm");q("\\rarr","\\rightarrow");q("\\rArr","\\Rightarrow");q("\\Rarr","\\Rightarrow");q("\\real","\\Re");q("\\reals","\\mathbb{R}");q("\\Reals","\\mathbb{R}");q("\\Rho","\\mathrm{P}");q("\\sdot","\\cdot");q("\\sect","\\S");q("\\spades","\\spadesuit");q("\\sub","\\subset");q("\\sube","\\subseteq");q("\\supe","\\supseteq");q("\\Tau","\\mathrm{T}");q("\\thetasym","\\vartheta");q("\\weierp","\\wp");q("\\Zeta","\\mathrm{Z}");q("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");q("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");q("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");q("\\bra","\\mathinner{\\langle{#1}|}");q("\\ket","\\mathinner{|{#1}\\rangle}");q("\\braket","\\mathinner{\\langle{#1}\\rangle}");q("\\Bra","\\left\\langle#1\\right|");q("\\Ket","\\left|#1\\right\\rangle");var YR=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,s=e.consumeArg().tokens,i=e.consumeArg().tokens,l=e.macros.get("|"),c=e.macros.get("\\|");e.macros.beginGroup();var d=p=>x=>{t&&(x.macros.set("|",l),s.length&&x.macros.set("\\|",c));var v=p;if(!p&&s.length){var b=x.future();b.text==="|"&&(x.popToken(),v=!0)}return{tokens:v?s:r,numArgs:0}};e.macros.set("|",d(!1)),s.length&&e.macros.set("\\|",d(!0));var h=e.consumeArg().tokens,m=e.expandTokens([...i,...h,...n]);return e.macros.endGroup(),{tokens:m.reverse(),numArgs:0}};q("\\bra@ket",YR(!1));q("\\bra@set",YR(!0));q("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");q("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");q("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");q("\\angln","{\\angl n}");q("\\blue","\\textcolor{##6495ed}{#1}");q("\\orange","\\textcolor{##ffa500}{#1}");q("\\pink","\\textcolor{##ff00af}{#1}");q("\\red","\\textcolor{##df0030}{#1}");q("\\green","\\textcolor{##28ae7b}{#1}");q("\\gray","\\textcolor{gray}{#1}");q("\\purple","\\textcolor{##9d38bd}{#1}");q("\\blueA","\\textcolor{##ccfaff}{#1}");q("\\blueB","\\textcolor{##80f6ff}{#1}");q("\\blueC","\\textcolor{##63d9ea}{#1}");q("\\blueD","\\textcolor{##11accd}{#1}");q("\\blueE","\\textcolor{##0c7f99}{#1}");q("\\tealA","\\textcolor{##94fff5}{#1}");q("\\tealB","\\textcolor{##26edd5}{#1}");q("\\tealC","\\textcolor{##01d1c1}{#1}");q("\\tealD","\\textcolor{##01a995}{#1}");q("\\tealE","\\textcolor{##208170}{#1}");q("\\greenA","\\textcolor{##b6ffb0}{#1}");q("\\greenB","\\textcolor{##8af281}{#1}");q("\\greenC","\\textcolor{##74cf70}{#1}");q("\\greenD","\\textcolor{##1fab54}{#1}");q("\\greenE","\\textcolor{##0d923f}{#1}");q("\\goldA","\\textcolor{##ffd0a9}{#1}");q("\\goldB","\\textcolor{##ffbb71}{#1}");q("\\goldC","\\textcolor{##ff9c39}{#1}");q("\\goldD","\\textcolor{##e07d10}{#1}");q("\\goldE","\\textcolor{##a75a05}{#1}");q("\\redA","\\textcolor{##fca9a9}{#1}");q("\\redB","\\textcolor{##ff8482}{#1}");q("\\redC","\\textcolor{##f9685d}{#1}");q("\\redD","\\textcolor{##e84d39}{#1}");q("\\redE","\\textcolor{##bc2612}{#1}");q("\\maroonA","\\textcolor{##ffbde0}{#1}");q("\\maroonB","\\textcolor{##ff92c6}{#1}");q("\\maroonC","\\textcolor{##ed5fa6}{#1}");q("\\maroonD","\\textcolor{##ca337c}{#1}");q("\\maroonE","\\textcolor{##9e034e}{#1}");q("\\purpleA","\\textcolor{##ddd7ff}{#1}");q("\\purpleB","\\textcolor{##c6b9fc}{#1}");q("\\purpleC","\\textcolor{##aa87ff}{#1}");q("\\purpleD","\\textcolor{##7854ab}{#1}");q("\\purpleE","\\textcolor{##543b78}{#1}");q("\\mintA","\\textcolor{##f5f9e8}{#1}");q("\\mintB","\\textcolor{##edf2df}{#1}");q("\\mintC","\\textcolor{##e0e5cc}{#1}");q("\\grayA","\\textcolor{##f6f7f7}{#1}");q("\\grayB","\\textcolor{##f0f1f2}{#1}");q("\\grayC","\\textcolor{##e3e5e6}{#1}");q("\\grayD","\\textcolor{##d6d8da}{#1}");q("\\grayE","\\textcolor{##babec2}{#1}");q("\\grayF","\\textcolor{##888d93}{#1}");q("\\grayG","\\textcolor{##626569}{#1}");q("\\grayH","\\textcolor{##3b3e40}{#1}");q("\\grayI","\\textcolor{##21242c}{#1}");q("\\kaBlue","\\textcolor{##314453}{#1}");q("\\kaGreen","\\textcolor{##71B307}{#1}");var KR={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class mue{constructor(e,n,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(e),this.macros=new hue(fue,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new EN(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var n,r,s;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:s,end:r}=this.consumeArg(["]"])}else({tokens:s,start:n,end:r}=this.consumeArg());return this.pushToken(new si("EOF",r.loc)),this.pushTokens(s),new si("",Ts.range(n,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var n=[],r=e&&e.length>0;r||this.consumeSpaces();var s=this.future(),i,l=0,c=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++l;else if(i.text==="}"){if(--l,l===-1)throw new De("Extra }",i)}else if(i.text==="EOF")throw new De("Unexpected end of input in a macro argument, expected '"+(e&&r?e[c]:"}")+"'",i);if(e&&r)if((l===0||l===1&&e[c]==="{")&&i.text===e[c]){if(++c,c===e.length){n.splice(-c,c);break}}else c=0}while(l!==0||r);return s.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:s,end:i}}consumeArgs(e,n){if(n){if(n.length!==e+1)throw new De("The length of delimiters doesn't match the number of args!");for(var r=n[0],s=0;sthis.settings.maxExpand)throw new De("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var n=this.popToken(),r=n.text,s=n.noexpand?null:this._getExpansion(r);if(s==null||e&&s.unexpandable){if(e&&s==null&&r[0]==="\\"&&!this.isDefined(r))throw new De("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var i=s.tokens,l=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var c=i.length-1;c>=0;--c){var d=i[c];if(d.text==="#"){if(c===0)throw new De("Incomplete placeholder at end of macro body",d);if(d=i[--c],d.text==="#")i.splice(c+1,1);else if(/^[1-9]$/.test(d.text))i.splice(c,2,...l[+d.text-1]);else throw new De("Not a valid argument number",d)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new si(e)]):void 0}expandTokens(e){var n=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),n.push(s)}return this.countExpansion(n.length),n}expandMacroAsText(e){var n=this.expandMacro(e);return n&&n.map(r=>r.text).join("")}_getExpansion(e){var n=this.macros.get(e);if(n==null)return n;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var s=typeof n=="function"?n(this):n;if(typeof s=="string"){var i=0;if(s.indexOf("#")!==-1)for(var l=s.replace(/##/g,"");l.indexOf("#"+(i+1))!==-1;)++i;for(var c=new EN(s,this.settings),d=[],h=c.lex();h.text!=="EOF";)d.push(h),h=c.lex();d.reverse();var m={tokens:d,numArgs:i};return m}return s}isDefined(e){return this.macros.has(e)||so.hasOwnProperty(e)||Ln.math.hasOwnProperty(e)||Ln.text.hasOwnProperty(e)||KR.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:so.hasOwnProperty(e)&&!so[e].primitive}}var RN=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Pp=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),$b={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},zN={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Xx{constructor(e,n){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new mue(e,n,this.mode),this.settings=n,this.leftrightDepth=0}expect(e,n){if(n===void 0&&(n=!0),this.fetch().text!==e)throw new De("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var n=this.nextToken;this.consume(),this.gullet.pushToken(new si("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,r}parseExpression(e,n){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var s=this.fetch();if(Xx.endOfExpression.indexOf(s.text)!==-1||n&&s.text===n||e&&so[s.text]&&so[s.text].infix)break;var i=this.parseAtom(n);if(i){if(i.type==="internal")continue}else break;r.push(i)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var n=-1,r,s=0;s=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var c=Ln[this.mode][n].group,d=Ts.range(e),h;if(nce.hasOwnProperty(c)){var m=c;h={type:"atom",mode:this.mode,family:m,loc:d,text:n}}else h={type:c,mode:this.mode,loc:d,text:n};l=h}else if(n.charCodeAt(0)>=128)this.settings.strict&&(aR(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),e)),l={type:"textord",mode:"text",loc:Ts.range(e),text:n};else return null;if(this.consume(),i)for(var p=0;ph&&(h=m):m&&(h!==void 0&&h>-1&&d.push(` `.repeat(h)||" "),h=-1,d.push(m))}return d.join("")}function sz(t,e,n){return t.type==="element"?Uue(t,e,n):t.type==="text"?n.whitespace==="normal"?iz(t,n):Vue(t):[]}function Uue(t,e,n){const r=az(t,n),s=t.children||[];let i=-1,l=[];if($ue(t))return l;let c,d;for(_4(t)||HN(t)&&qN(e,t,HN)?d=` -`:Que(t)?(c=2,d=2):rz(t)&&(c=1,d=1);++i{try{i(!0);const Oe=await nde({page:l,page_size:m,search:x||void 0,is_registered:b==="all"?void 0:b==="registered",is_banned:O==="all"?void 0:O==="banned",format:T==="all"?void 0:T,sort_by:"usage_count",sort_order:"desc"});e(Oe.data),h(Oe.total)}catch(Oe){const nt=Oe instanceof Error?Oe.message:"加载表情包列表失败";ne({title:"错误",description:nt,variant:"destructive"})}finally{i(!1)}},[l,m,x,b,O,T,ne]),R=async()=>{try{const Oe=await ade();r(Oe.data)}catch(Oe){console.error("加载统计数据失败:",Oe)}};S.useEffect(()=>{ue()},[ue]),S.useEffect(()=>{R()},[]);const me=async Oe=>{try{const nt=await rde(Oe.id);D(nt.data),z(!0)}catch(nt){const ut=nt instanceof Error?nt.message:"加载详情失败";ne({title:"错误",description:ut,variant:"destructive"})}},Y=Oe=>{D(Oe),F(!0)},P=Oe=>{D(Oe),U(!0)},K=async()=>{if(_)try{await ide(_.id),ne({title:"成功",description:"表情包已删除"}),U(!1),D(null),ue(),R()}catch(Oe){const nt=Oe instanceof Error?Oe.message:"删除失败";ne({title:"错误",description:nt,variant:"destructive"})}},H=async Oe=>{try{await lde(Oe.id),ne({title:"成功",description:"表情包已注册"}),ue(),R()}catch(nt){const ut=nt instanceof Error?nt.message:"注册失败";ne({title:"错误",description:ut,variant:"destructive"})}},fe=async Oe=>{try{await ode(Oe.id),ne({title:"成功",description:"表情包已封禁"}),ue(),R()}catch(nt){const ut=nt instanceof Error?nt.message:"封禁失败";ne({title:"错误",description:ut,variant:"destructive"})}},ve=Oe=>{const nt=new Set(V);nt.has(Oe)?nt.delete(Oe):nt.add(Oe),ce(nt)},Re=()=>{V.size===t.length&&t.length>0?ce(new Set):ce(new Set(t.map(Oe=>Oe.id)))},de=async()=>{try{const Oe=await cde(Array.from(V));ne({title:"批量删除完成",description:Oe.message}),ce(new Set),J(!1),ue(),R()}catch(Oe){ne({title:"批量删除失败",description:Oe instanceof Error?Oe.message:"批量删除失败",variant:"destructive"})}},We=()=>{const Oe=parseInt($),nt=Math.ceil(d/m);Oe>=1&&Oe<=nt?(c(Oe),ae("")):ne({title:"无效的页码",description:`请输入1-${nt}之间的页码`,variant:"destructive"})},ct=n?.formats?Object.keys(n.formats):[];return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsxs("div",{className:"mb-4 sm:mb-6",children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),a.jsx(mn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&a.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"总数"}),a.jsx(Gt,{className:"text-2xl",children:n.total})]})}),a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"已注册"}),a.jsx(Gt,{className:"text-2xl text-green-600",children:n.registered})]})}),a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"已封禁"}),a.jsx(Gt,{className:"text-2xl text-red-600",children:n.banned})]})}),a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"未注册"}),a.jsx(Gt,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),a.jsxs(gt,{children:[a.jsx(Wt,{children:a.jsxs(Gt,{className:"flex items-center gap-2",children:[a.jsx(t2,{className:"h-5 w-5"}),"搜索和筛选"]})}),a.jsxs(an,{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"搜索"}),a.jsxs("div",{className:"relative",children:[a.jsx(Bs,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"描述或哈希值...",value:x,onChange:Oe=>{v(Oe.target.value),c(1)},className:"pl-8"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"注册状态"}),a.jsxs(Lt,{value:b,onValueChange:Oe=>{k(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"registered",children:"已注册"}),a.jsx(Pe,{value:"unregistered",children:"未注册"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"封禁状态"}),a.jsxs(Lt,{value:O,onValueChange:Oe=>{j(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"banned",children:"已封禁"}),a.jsx(Pe,{value:"unbanned",children:"未封禁"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"格式"}),a.jsxs(Lt,{value:T,onValueChange:Oe=>{A(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),ct.map(Oe=>a.jsxs(Pe,{value:Oe,children:[Oe.toUpperCase()," (",n?.formats[Oe],")"]},Oe))]})]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:V.size>0&&a.jsxs("span",{children:["已选择 ",V.size," 个表情包"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:m.toString(),onValueChange:Oe=>{p(parseInt(Oe)),c(1),ce(new Set)},children:[a.jsx(Dt,{id:"emoji-page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),V.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ce(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:()=>J(!0),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),a.jsx("div",{className:"flex justify-end pt-4 border-t",children:a.jsxs(ie,{variant:"outline",size:"sm",onClick:ue,disabled:s,children:[a.jsx(Fi,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"表情包列表"}),a.jsxs(Sr,{children:["共 ",d," 个表情包,当前第 ",l," 页"]})]}),a.jsxs(an,{children:[a.jsx("div",{className:"hidden md:block rounded-md border overflow-hidden",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:t.length>0&&V.size===t.length,onCheckedChange:Re,"aria-label":"全选"})}),a.jsx(xt,{className:"w-16",children:"预览"}),a.jsx(xt,{children:"描述"}),a.jsx(xt,{children:"格式"}),a.jsx(xt,{children:"情绪标签"}),a.jsx(xt,{className:"text-center",children:"状态"}),a.jsx(xt,{className:"text-right",children:"使用次数"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(Oe=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:V.has(Oe.id),onCheckedChange:()=>ve(Oe.id),"aria-label":`选择 ${Oe.description}`})}),a.jsx(it,{children:a.jsx("div",{className:"w-20 h-20 bg-muted rounded flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(Oe.id),alt:Oe.description||"表情包",className:"w-full h-full object-cover",onError:nt=>{const ut=nt.target;ut.style.display="none";const Ct=ut.parentElement;Ct&&(Ct.innerHTML='')}})})}),a.jsx(it,{children:a.jsxs("div",{className:"space-y-1 max-w-xs",children:[a.jsx("div",{className:"font-medium truncate",title:Oe.description||"无描述",children:Oe.description||"无描述"}),a.jsxs("div",{className:"text-xs text-muted-foreground font-mono",children:[Oe.emoji_hash.slice(0,16),"..."]})]})}),a.jsx(it,{children:a.jsx(On,{variant:"outline",children:Oe.format.toUpperCase()})}),a.jsx(it,{children:a.jsx(UN,{emotions:Oe.emotion})}),a.jsx(it,{className:"align-middle",children:a.jsxs("div",{className:"flex gap-2 justify-center",children:[Oe.is_registered&&a.jsxs(On,{variant:"default",className:"bg-green-600",children:[a.jsx(Es,{className:"h-3 w-3 mr-1"}),"已注册"]}),Oe.is_banned&&a.jsxs(On,{variant:"destructive",children:[a.jsx(Kb,{className:"h-3 w-3 mr-1"}),"已封禁"]})]})}),a.jsx(it,{className:"text-right font-mono",children:Oe.usage_count}),a.jsx(it,{children:a.jsxs("div",{className:"flex items-center justify-end gap-1 flex-wrap",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>me(Oe),children:[a.jsx(co,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Y(Oe),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),!Oe.is_registered&&a.jsxs(ie,{size:"sm",onClick:()=>H(Oe),className:"bg-green-600 hover:bg-green-700 text-white",children:[a.jsx(Es,{className:"h-4 w-4 mr-1"}),"注册"]}),!Oe.is_banned&&a.jsxs(ie,{size:"sm",onClick:()=>fe(Oe),className:"bg-orange-600 hover:bg-orange-700 text-white",children:[a.jsx(cO,{className:"h-4 w-4 mr-1"}),"封禁"]}),a.jsxs(ie,{size:"sm",onClick:()=>P(Oe),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},Oe.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3",children:t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(Oe=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex gap-3",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("div",{className:"w-16 h-16 bg-muted rounded flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(Oe.id),alt:Oe.description||"表情包",className:"w-full h-full object-cover",onError:nt=>{const ut=nt.target;ut.style.display="none";const Ct=ut.parentElement;Ct&&(Ct.innerHTML='')}})})}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[a.jsxs("div",{className:"min-w-0 w-full overflow-hidden",children:[a.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",title:Oe.description||"无描述",children:Oe.description||"无描述"}),a.jsxs("p",{className:"text-xs text-muted-foreground font-mono line-clamp-1 w-full break-all",children:[Oe.emoji_hash.slice(0,16),"..."]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 items-center min-w-0",children:[a.jsx(On,{variant:"outline",className:"text-xs flex-shrink-0",children:Oe.format.toUpperCase()}),Oe.is_registered&&a.jsxs(On,{variant:"default",className:"bg-green-600 text-xs flex-shrink-0",children:[a.jsx(Es,{className:"h-3 w-3 mr-1"}),"已注册"]}),Oe.is_banned&&a.jsxs(On,{variant:"destructive",className:"text-xs flex-shrink-0",children:[a.jsx(Kb,{className:"h-3 w-3 mr-1"}),"已封禁"]}),a.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:["使用: ",Oe.usage_count]})]}),Oe.emotion&&Oe.emotion.length>0&&a.jsx("div",{className:"min-w-0 overflow-hidden",children:a.jsx(UN,{emotions:Oe.emotion})})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>me(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(co,{className:"h-3 w-3 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Y(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),!Oe.is_registered&&a.jsxs(ie,{size:"sm",onClick:()=>H(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-green-600 hover:bg-green-700 text-white",children:[a.jsx(Es,{className:"h-3 w-3 mr-1"}),"注册"]}),!Oe.is_banned&&a.jsxs(ie,{size:"sm",onClick:()=>fe(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-orange-600 hover:bg-orange-700 text-white",children:[a.jsx(cO,{className:"h-3 w-3 mr-1"}),"封禁"]}),a.jsxs(ie,{size:"sm",onClick:()=>P(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},Oe.id))}),d>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(l-1)*m+1," 到"," ",Math.min(l*m,d)," 条,共 ",d," 条"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(Oe=>Math.max(1,Oe-1)),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:$,onChange:Oe=>ae(Oe.target.value),onKeyDown:Oe=>Oe.key==="Enter"&&We(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/m)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:We,disabled:!$,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(Oe=>Oe+1),disabled:l>=Math.ceil(d/m),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(d/m)),disabled:l>=Math.ceil(d/m),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]}),a.jsx(dde,{emoji:_,open:E,onOpenChange:z}),a.jsx(hde,{emoji:_,open:Q,onOpenChange:F,onSuccess:()=>{ue(),R()}})]})}),a.jsx(pn,{open:W,onOpenChange:J,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["你确定要删除选中的 ",V.size," 个表情包吗?此操作不可撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:de,children:"确认删除"})]})]})}),a.jsx(Rr,{open:L,onOpenChange:U,children:a.jsxs(Nr,{children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"确认删除"}),a.jsx(Gr,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>U(!1),children:"取消"}),a.jsx(ie,{variant:"destructive",onClick:K,children:"删除"})]})]})})]})}function dde({emoji:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[90vh]",children:[a.jsx(Cr,{children:a.jsx(Tr,{children:"表情包详情"})}),a.jsx(mn,{className:"max-h-[calc(90vh-8rem)] pr-4",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex justify-center",children:a.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(t.id),alt:t.description||"表情包",className:"w-full h-full object-cover",onError:s=>{const i=s.target;i.style.display="none";const l=i.parentElement;l&&(l.innerHTML='')}})})}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"ID"}),a.jsx("div",{className:"mt-1 font-mono",children:t.id})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"格式"}),a.jsx("div",{className:"mt-1",children:a.jsx(On,{variant:"outline",children:t.format.toUpperCase()})})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"文件路径"}),a.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.full_path})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"哈希值"}),a.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.emoji_hash})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"描述"}),t.description?a.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:a.jsx(tde,{className:"prose-sm",children:t.description})}):a.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"情绪标签"}),a.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:(()=>{const s=t.emotion?t.emotion.split(/[,,]/).map(i=>i.trim()).filter(Boolean):[];return s.length>0?s.map((i,l)=>a.jsx(On,{variant:"secondary",children:i},l)):a.jsx("span",{className:"text-sm text-muted-foreground",children:"无"})})()})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"状态"}),a.jsxs("div",{className:"mt-2 flex gap-2",children:[t.is_registered&&a.jsx(On,{variant:"default",className:"bg-green-600",children:"已注册"}),t.is_banned&&a.jsx(On,{variant:"destructive",children:"已封禁"}),!t.is_registered&&!t.is_banned&&a.jsx(On,{variant:"outline",children:"未注册"})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"使用次数"}),a.jsx("div",{className:"mt-1 font-mono text-lg",children:t.usage_count})]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"记录时间"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.record_time)})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"注册时间"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.register_time)})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"最后使用"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.last_used_time)})]})]})})]})})}function hde({emoji:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState(""),[l,c]=S.useState(""),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState(!1),{toast:b}=Pr();S.useEffect(()=>{t&&(i(t.description||""),c(t.emotion||""),h(t.is_registered),p(t.is_banned))},[t]);const k=async()=>{if(t)try{v(!0);const O=l.split(/[,,]/).map(j=>j.trim()).filter(Boolean).join(",");await sde(t.id,{description:s||void 0,emotion:O||void 0,is_registered:d,is_banned:m}),b({title:"成功",description:"表情包信息已更新"}),n(!1),r()}catch(O){const j=O instanceof Error?O.message:"保存失败";b({title:"错误",description:j,variant:"destructive"})}finally{v(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑表情包"}),a.jsx(Gr,{children:"修改表情包的描述和标签信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(te,{children:"描述"}),a.jsx(_n,{value:s,onChange:O=>i(O.target.value),placeholder:"输入表情包描述...",rows:3,className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(te,{children:"情绪标签"}),a.jsx(Me,{value:l,onChange:O=>c(O.target.value),placeholder:"使用逗号分隔多个标签,如:开心, 微笑, 快乐",className:"mt-1"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入多个标签时使用逗号分隔(支持中英文逗号)"})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"is_registered",checked:d,onCheckedChange:O=>h(O===!0)}),a.jsx(te,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"is_banned",checked:m,onCheckedChange:O=>p(O===!0)}),a.jsx(te,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:k,disabled:x,children:x?"保存中...":"保存"})]})]})}):null}function UN({emotions:t}){const e=t?t.split(/[,,]/).map(i=>i.trim()).filter(Boolean):[];if(e.length===0)return a.jsx("span",{className:"text-xs text-muted-foreground",children:"-"});const n=(i,l=6)=>i.length<=l?i:i.slice(0,l)+"...",r=e.slice(0,3),s=e.length-3;return a.jsxs("div",{className:"flex flex-wrap gap-1 max-w-full overflow-hidden",children:[r.map((i,l)=>a.jsx(On,{variant:"secondary",className:"text-xs flex-shrink-0",title:i,children:n(i)},l)),s>0&&a.jsxs(On,{variant:"outline",className:"text-xs flex-shrink-0",title:`还有 ${s} 个标签: ${e.slice(3).join(", ")}`,children:["+",s]})]})}const Pc="/api/webui/expression";async function fde(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.chat_id&&e.append("chat_id",t.chat_id);const n=await ot(`${Pc}/list?${e}`,{headers:bt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取表达方式列表失败")}return n.json()}async function mde(t){const e=await ot(`${Pc}/${t}`,{headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取表达方式详情失败")}return e.json()}async function pde(t){const e=await ot(`${Pc}/`,{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"创建表达方式失败")}return e.json()}async function gde(t,e){const n=await ot(`${Pc}/${t}`,{method:"PATCH",headers:bt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新表达方式失败")}return n.json()}async function xde(t){const e=await ot(`${Pc}/${t}`,{method:"DELETE",headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除表达方式失败")}return e.json()}async function vde(t){const e=await ot(`${Pc}/batch/delete`,{method:"POST",headers:bt(),body:JSON.stringify({ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除表达方式失败")}return e.json()}async function yde(){const t=await ot(`${Pc}/stats/summary`,{headers:bt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}function bde(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(1),[d,h]=S.useState(20),[m,p]=S.useState(""),[x,v]=S.useState(null),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,A]=S.useState(!1),[_,D]=S.useState(null),[E,z]=S.useState(new Set),[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,ce]=S.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),{toast:W}=Pr(),J=async()=>{try{r(!0);const H=await fde({page:l,page_size:d,search:m||void 0});e(H.data),i(H.total)}catch(H){W({title:"加载失败",description:H instanceof Error?H.message:"无法加载表达方式",variant:"destructive"})}finally{r(!1)}},$=async()=>{try{const H=await yde();ce(H.data)}catch(H){console.error("加载统计数据失败:",H)}};S.useEffect(()=>{J(),$()},[l,d,m]);const ae=async H=>{try{const fe=await mde(H.id);v(fe.data),k(!0)}catch(fe){W({title:"加载详情失败",description:fe instanceof Error?fe.message:"无法加载表达方式详情",variant:"destructive"})}},ne=H=>{v(H),j(!0)},ue=async H=>{try{await xde(H.id),W({title:"删除成功",description:`已删除表达方式: ${H.situation}`}),D(null),J(),$()}catch(fe){W({title:"删除失败",description:fe instanceof Error?fe.message:"无法删除表达方式",variant:"destructive"})}},R=H=>{const fe=new Set(E);fe.has(H)?fe.delete(H):fe.add(H),z(fe)},me=()=>{E.size===t.length&&t.length>0?z(new Set):z(new Set(t.map(H=>H.id)))},Y=async()=>{try{await vde(Array.from(E)),W({title:"批量删除成功",description:`已删除 ${E.size} 个表达方式`}),z(new Set),F(!1),J(),$()}catch(H){W({title:"批量删除失败",description:H instanceof Error?H.message:"无法批量删除表达方式",variant:"destructive"})}},P=()=>{const H=parseInt(L),fe=Math.ceil(s/d);H>=1&&H<=fe?(c(H),U("")):W({title:"无效的页码",description:`请输入1-${fe}之间的页码`,variant:"destructive"})},K=H=>H?new Date(H*1e3).toLocaleString("zh-CN"):"-";return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsx("div",{className:"mb-4 sm:mb-6",children:a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[a.jsx(Wf,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),a.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),a.jsxs(ie,{onClick:()=>A(!0),className:"gap-2",children:[a.jsx(Wr,{className:"h-4 w-4"}),"新增表达方式"]})]})}),a.jsx(mn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),a.jsx("div",{className:"text-2xl font-bold mt-1",children:V.total})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:V.recent_7days})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:V.chat_count})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx(te,{htmlFor:"search",children:"搜索"}),a.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Bs,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{id:"search",placeholder:"搜索情境、风格或上下文...",value:m,onChange:H=>p(H.target.value),className:"pl-9"})]})}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:E.size>0&&a.jsxs("span",{children:["已选择 ",E.size," 个表达方式"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:d.toString(),onValueChange:H=>{h(parseInt(H)),c(1),z(new Set)},children:[a.jsx(Dt,{id:"page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),E.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>z(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:()=>F(!0),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card",children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:E.size===t.length&&t.length>0,onCheckedChange:me})}),a.jsx(xt,{children:"情境"}),a.jsx(xt,{children:"风格"}),a.jsx(xt,{children:"聊天ID"}),a.jsx(xt,{children:"最后活跃"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n?a.jsx(xr,{children:a.jsx(it,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(H=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:E.has(H.id),onCheckedChange:()=>R(H.id)})}),a.jsx(it,{className:"font-medium max-w-xs truncate",children:H.situation}),a.jsx(it,{className:"max-w-xs truncate",children:H.style}),a.jsx(it,{className:"font-mono text-sm",children:H.chat_id}),a.jsx(it,{className:"text-sm text-muted-foreground",children:K(H.last_active_time)}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ae(H),children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ne(H),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>D(H),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},H.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(H=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ss,{checked:E.has(H.id),onCheckedChange:()=>R(H.id),className:"mt-1"}),a.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),a.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:H.situation,children:H.situation})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),a.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:H.style,children:H.style})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天ID"}),a.jsx("p",{className:"font-mono text-xs truncate",children:H.chat_id})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后活跃"}),a.jsx("p",{className:"text-xs",children:K(H.last_active_time)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(H),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx($i,{className:"h-3 w-3 mr-1"}),"查看"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ne(H),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>D(H),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},H.id))}),s>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",l," / ",Math.ceil(s/d)," 页"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l-1),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:L,onChange:H=>U(H.target.value),onKeyDown:H=>H.key==="Enter"&&P(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/d)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:P,disabled:!L,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l+1),disabled:l>=Math.ceil(s/d),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(s/d)),disabled:l>=Math.ceil(s/d),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]})}),a.jsx(wde,{expression:x,open:b,onOpenChange:k}),a.jsx(Sde,{open:T,onOpenChange:A,onSuccess:()=>{J(),$(),A(!1)}}),a.jsx(kde,{expression:x,open:O,onOpenChange:j,onSuccess:()=>{J(),$(),j(!1)}}),a.jsx(pn,{open:!!_,onOpenChange:()=>D(null),children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除表达方式 "',_?.situation,'" 吗? 此操作不可撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>_&&ue(_),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),a.jsx(Ode,{open:Q,onOpenChange:F,onConfirm:Y,count:E.size})]})}function wde({expression:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"表达方式详情"}),a.jsx(Gr,{children:"查看表达方式的完整信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Au,{label:"情境",value:t.situation}),a.jsx(Au,{label:"风格",value:t.style}),a.jsx(Au,{icon:mg,label:"聊天ID",value:t.chat_id,mono:!0}),a.jsx(Au,{icon:mg,label:"记录ID",value:t.id.toString(),mono:!0})]}),t.context&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"上下文"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.context})]}),t.up_content&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"上文内容"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.up_content})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Au,{icon:dc,label:"最后活跃",value:r(t.last_active_time)}),a.jsx(Au,{icon:dc,label:"创建时间",value:r(t.create_date)})]})]}),a.jsx(ps,{children:a.jsx(ie,{onClick:()=>n(!1),children:"关闭"})})]})})}function Au({icon:t,label:e,value:n,mono:r=!1}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs(te,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&a.jsx(t,{className:"h-3 w-3"}),e]}),a.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Sde({open:t,onOpenChange:e,onSuccess:n}){const[r,s]=S.useState({situation:"",style:"",context:"",up_content:"",chat_id:""}),[i,l]=S.useState(!1),{toast:c}=Pr(),d=async()=>{if(!r.situation||!r.style||!r.chat_id){c({title:"验证失败",description:"请填写必填字段:情境、风格和聊天ID",variant:"destructive"});return}try{l(!0),await pde(r),c({title:"创建成功",description:"表达方式已创建"}),s({situation:"",style:"",context:"",up_content:"",chat_id:""}),n()}catch(h){c({title:"创建失败",description:h instanceof Error?h.message:"无法创建表达方式",variant:"destructive"})}finally{l(!1)}};return a.jsx(Rr,{open:t,onOpenChange:e,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"新增表达方式"}),a.jsx(Gr,{children:"创建新的表达方式记录"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"situation",children:["情境 ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Me,{id:"situation",value:r.situation,onChange:h=>s({...r,situation:h.target.value}),placeholder:"描述使用场景"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"style",children:["风格 ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Me,{id:"style",value:r.style,onChange:h=>s({...r,style:h.target.value}),placeholder:"描述表达风格"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"chat_id",children:["聊天ID ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Me,{id:"chat_id",value:r.chat_id,onChange:h=>s({...r,chat_id:h.target.value}),placeholder:"关联的聊天ID"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"context",children:"上下文"}),a.jsx(_n,{id:"context",value:r.context,onChange:h=>s({...r,context:h.target.value}),placeholder:"上下文信息(可选)",rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"up_content",children:"上文内容"}),a.jsx(_n,{id:"up_content",value:r.up_content,onChange:h=>s({...r,up_content:h.target.value}),placeholder:"上文内容(可选)",rows:3})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>e(!1),children:"取消"}),a.jsx(ie,{onClick:d,disabled:i,children:i?"创建中...":"创建"})]})]})})}function kde({expression:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState({}),[l,c]=S.useState(!1),{toast:d}=Pr();S.useEffect(()=>{t&&i({situation:t.situation,style:t.style,context:t.context||"",up_content:t.up_content||"",chat_id:t.chat_id})},[t]);const h=async()=>{if(t)try{c(!0),await gde(t.id,s),d({title:"保存成功",description:"表达方式已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新表达方式",variant:"destructive"})}finally{c(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑表达方式"}),a.jsx(Gr,{children:"修改表达方式的信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_situation",children:"情境"}),a.jsx(Me,{id:"edit_situation",value:s.situation||"",onChange:m=>i({...s,situation:m.target.value}),placeholder:"描述使用场景"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_style",children:"风格"}),a.jsx(Me,{id:"edit_style",value:s.style||"",onChange:m=>i({...s,style:m.target.value}),placeholder:"描述表达风格"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_chat_id",children:"聊天ID"}),a.jsx(Me,{id:"edit_chat_id",value:s.chat_id||"",onChange:m=>i({...s,chat_id:m.target.value}),placeholder:"关联的聊天ID"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_context",children:"上下文"}),a.jsx(_n,{id:"edit_context",value:s.context||"",onChange:m=>i({...s,context:m.target.value}),placeholder:"上下文信息",rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_up_content",children:"上文内容"}),a.jsx(_n,{id:"edit_up_content",value:s.up_content||"",onChange:m=>i({...s,up_content:m.target.value}),placeholder:"上文内容",rows:3})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:h,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function Ode({open:t,onOpenChange:e,onConfirm:n,count:r}){return a.jsx(pn,{open:t,onOpenChange:e,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["您即将删除 ",r," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const Pd="/api/webui/person";async function jde(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.is_known!==void 0&&e.append("is_known",t.is_known.toString()),t.platform&&e.append("platform",t.platform);const n=await ot(`${Pd}/list?${e}`,{headers:bt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取人物列表失败")}return n.json()}async function Nde(t){const e=await ot(`${Pd}/${t}`,{headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取人物详情失败")}return e.json()}async function Cde(t,e){const n=await ot(`${Pd}/${t}`,{method:"PATCH",headers:bt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新人物信息失败")}return n.json()}async function Tde(t){const e=await ot(`${Pd}/${t}`,{method:"DELETE",headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除人物信息失败")}return e.json()}async function Ade(){const t=await ot(`${Pd}/stats/summary`,{headers:bt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}async function Mde(t){const e=await ot(`${Pd}/batch/delete`,{method:"POST",headers:bt(),body:JSON.stringify({person_ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除失败")}return e.json()}function Ede(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(1),[d,h]=S.useState(20),[m,p]=S.useState(""),[x,v]=S.useState(void 0),[b,k]=S.useState(void 0),[O,j]=S.useState(null),[T,A]=S.useState(!1),[_,D]=S.useState(!1),[E,z]=S.useState(null),[Q,F]=S.useState({total:0,known:0,unknown:0,platforms:{}}),[L,U]=S.useState(new Set),[V,ce]=S.useState(!1),[W,J]=S.useState(""),{toast:$}=Pr(),ae=async()=>{try{r(!0);const de=await jde({page:l,page_size:d,search:m||void 0,is_known:x,platform:b});e(de.data),i(de.total)}catch(de){$({title:"加载失败",description:de instanceof Error?de.message:"无法加载人物信息",variant:"destructive"})}finally{r(!1)}},ne=async()=>{try{const de=await Ade();F(de.data)}catch(de){console.error("加载统计数据失败:",de)}};S.useEffect(()=>{ae(),ne()},[l,d,m,x,b]);const ue=async de=>{try{const We=await Nde(de.person_id);j(We.data),A(!0)}catch(We){$({title:"加载详情失败",description:We instanceof Error?We.message:"无法加载人物详情",variant:"destructive"})}},R=de=>{j(de),D(!0)},me=async de=>{try{await Tde(de.person_id),$({title:"删除成功",description:`已删除人物信息: ${de.person_name||de.nickname||de.user_id}`}),z(null),ae(),ne()}catch(We){$({title:"删除失败",description:We instanceof Error?We.message:"无法删除人物信息",variant:"destructive"})}},Y=S.useMemo(()=>Object.keys(Q.platforms),[Q.platforms]),P=de=>{const We=new Set(L);We.has(de)?We.delete(de):We.add(de),U(We)},K=()=>{L.size===t.length&&t.length>0?U(new Set):U(new Set(t.map(de=>de.person_id)))},H=()=>{if(L.size===0){$({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}ce(!0)},fe=async()=>{try{const de=await Mde(Array.from(L));$({title:"批量删除完成",description:de.message}),U(new Set),ce(!1),ae(),ne()}catch(de){$({title:"批量删除失败",description:de instanceof Error?de.message:"批量删除失败",variant:"destructive"})}},ve=()=>{const de=parseInt(W),We=Math.ceil(s/d);de>=1&&de<=We?(c(de),J("")):$({title:"无效的页码",description:`请输入1-${We}之间的页码`,variant:"destructive"})},Re=de=>de?new Date(de*1e3).toLocaleString("zh-CN"):"-";return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsx("div",{className:"mb-4 sm:mb-6",children:a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[a.jsx(Oq,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),a.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),a.jsx(mn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),a.jsx("div",{className:"text-2xl font-bold mt-1",children:Q.total})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:Q.known})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:Q.unknown})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"sm:col-span-2",children:[a.jsx(te,{htmlFor:"search",children:"搜索"}),a.jsxs("div",{className:"relative mt-1.5",children:[a.jsx(Bs,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:m,onChange:de=>p(de.target.value),className:"pl-9"})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"filter-known",children:"认识状态"}),a.jsxs(Lt,{value:x===void 0?"all":x.toString(),onValueChange:de=>{v(de==="all"?void 0:de==="true"),c(1)},children:[a.jsx(Dt,{id:"filter-known",className:"mt-1.5",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"true",children:"已认识"}),a.jsx(Pe,{value:"false",children:"未认识"})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"filter-platform",children:"平台"}),a.jsxs(Lt,{value:b||"all",onValueChange:de=>{k(de==="all"?void 0:de),c(1)},children:[a.jsx(Dt,{id:"filter-platform",className:"mt-1.5",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部平台"}),Y.map(de=>a.jsxs(Pe,{value:de,children:[de," (",Q.platforms[de],")"]},de))]})]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:L.size>0&&a.jsxs("span",{children:["已选择 ",L.size," 个人物"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:d.toString(),onValueChange:de=>{h(parseInt(de)),c(1),U(new Set)},children:[a.jsx(Dt,{id:"page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),L.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>U(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:H,children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card",children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:t.length>0&&L.size===t.length,onCheckedChange:K,"aria-label":"全选"})}),a.jsx(xt,{children:"状态"}),a.jsx(xt,{children:"名称"}),a.jsx(xt,{children:"昵称"}),a.jsx(xt,{children:"平台"}),a.jsx(xt,{children:"用户ID"}),a.jsx(xt,{children:"最后更新"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(de=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:L.has(de.person_id),onCheckedChange:()=>P(de.person_id),"aria-label":`选择 ${de.person_name||de.nickname||de.user_id}`})}),a.jsx(it,{children:a.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",de.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:de.is_known?"已认识":"未认识"})}),a.jsx(it,{className:"font-medium",children:de.person_name||a.jsx("span",{className:"text-muted-foreground",children:"-"})}),a.jsx(it,{children:de.nickname||"-"}),a.jsx(it,{children:de.platform}),a.jsx(it,{className:"font-mono text-sm",children:de.user_id}),a.jsx(it,{className:"text-sm text-muted-foreground",children:Re(de.last_know)}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ue(de),children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>R(de),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>z(de),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},de.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(de=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ss,{checked:L.has(de.person_id),onCheckedChange:()=>P(de.person_id),className:"mt-1"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",de.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:de.is_known?"已认识":"未认识"}),a.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:de.person_name||a.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),de.nickname&&a.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",de.nickname]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),a.jsx("p",{className:"font-medium text-xs",children:de.platform})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),a.jsx("p",{className:"font-mono text-xs truncate",title:de.user_id,children:de.user_id})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),a.jsx("p",{className:"text-xs",children:Re(de.last_know)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ue(de),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx($i,{className:"h-3 w-3 mr-1"}),"查看"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>R(de),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>z(de),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},de.id))}),s>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",l," / ",Math.ceil(s/d)," 页"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l-1),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:W,onChange:de=>J(de.target.value),onKeyDown:de=>de.key==="Enter"&&ve(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/d)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:ve,disabled:!W,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l+1),disabled:l>=Math.ceil(s/d),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(s/d)),disabled:l>=Math.ceil(s/d),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]})}),a.jsx(_de,{person:O,open:T,onOpenChange:A}),a.jsx(Dde,{person:O,open:_,onOpenChange:D,onSuccess:()=>{ae(),ne(),D(!1)}}),a.jsx(pn,{open:!!E,onOpenChange:()=>z(null),children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除人物信息 "',E?.person_name||E?.nickname||E?.user_id,'" 吗? 此操作不可撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>E&&me(E),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),a.jsx(pn,{open:V,onOpenChange:ce,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["确定要删除选中的 ",L.size," 个人物信息吗? 此操作不可撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:fe,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function _de({person:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"人物详情"}),a.jsxs(Gr,{children:["查看 ",t.person_name||t.nickname||t.user_id," 的完整信息"]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Za,{icon:D9,label:"人物名称",value:t.person_name}),a.jsx(Za,{icon:Wf,label:"昵称",value:t.nickname}),a.jsx(Za,{icon:mg,label:"用户ID",value:t.user_id,mono:!0}),a.jsx(Za,{icon:mg,label:"人物ID",value:t.person_id,mono:!0}),a.jsx(Za,{label:"平台",value:t.platform}),a.jsx(Za,{label:"状态",value:t.is_known?"已认识":"未认识"})]}),t.name_reason&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),a.jsx("p",{className:"mt-1 text-sm",children:t.name_reason})]}),t.memory_points&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"个人印象"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.memory_points})]}),t.group_nick_name&&t.group_nick_name.length>0&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"群昵称"}),a.jsx("div",{className:"mt-2 space-y-1",children:t.group_nick_name.map((s,i)=>a.jsxs("div",{className:"text-sm flex items-center gap-2",children:[a.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:s.group_id}),a.jsx("span",{children:"→"}),a.jsx("span",{children:s.group_nick_name})]},i))})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsx(Za,{icon:dc,label:"认识时间",value:r(t.know_times)}),a.jsx(Za,{icon:dc,label:"首次记录",value:r(t.know_since)}),a.jsx(Za,{icon:dc,label:"最后更新",value:r(t.last_know)})]})]}),a.jsx(ps,{children:a.jsx(ie,{onClick:()=>n(!1),children:"关闭"})})]})})}function Za({icon:t,label:e,value:n,mono:r=!1}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs(te,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&a.jsx(t,{className:"h-3 w-3"}),e]}),a.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Dde({person:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState({}),[l,c]=S.useState(!1),{toast:d}=Pr();S.useEffect(()=>{t&&i({person_name:t.person_name||"",name_reason:t.name_reason||"",nickname:t.nickname||"",memory_points:t.memory_points||"",is_known:t.is_known})},[t]);const h=async()=>{if(t)try{c(!0),await Cde(t.person_id,s),d({title:"保存成功",description:"人物信息已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新人物信息",variant:"destructive"})}finally{c(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑人物信息"}),a.jsxs(Gr,{children:["修改 ",t.person_name||t.nickname||t.user_id," 的信息"]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"person_name",children:"人物名称"}),a.jsx(Me,{id:"person_name",value:s.person_name||"",onChange:m=>i({...s,person_name:m.target.value}),placeholder:"为这个人设置一个名称"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称"}),a.jsx(Me,{id:"nickname",value:s.nickname||"",onChange:m=>i({...s,nickname:m.target.value}),placeholder:"昵称"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"name_reason",children:"名称设定原因"}),a.jsx(_n,{id:"name_reason",value:s.name_reason||"",onChange:m=>i({...s,name_reason:m.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"memory_points",children:"个人印象"}),a.jsx(_n,{id:"memory_points",value:s.memory_points||"",onChange:m=>i({...s,memory_points:m.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),a.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[a.jsxs("div",{children:[a.jsx(te,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),a.jsx(jt,{id:"is_known",checked:s.is_known,onCheckedChange:m=>i({...s,is_known:m})})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:h,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function Rde(t,e,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:n}).format(e).split(/\s/g).slice(2).join(" ")}const zde={},Wh={};function uc(t,e){try{const r=(zde[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in Wh?Wh[r]:VN(r,r.split(":"))}catch{if(t in Wh)return Wh[t];const n=t?.match(Pde);return n?VN(t,n.slice(1)):NaN}}const Pde=/([+-]\d\d):?(\d\d)?/;function VN(t,e){const n=+(e[0]||0),r=+(e[1]||0),s=+(e[2]||0)/60;return Wh[t]=n*60+r>0?n*60+r+s:n*60-r-s}class xa extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(uc(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),lz(this),R4(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new xa(...n,e):new xa(Date.now(),e)}withTimeZone(e){return new xa(+this,e)}getTimezoneOffset(){const e=-uc(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),R4(this),+this}[Symbol.for("constructDateFrom")](e){return new xa(+new Date(e),this.timeZone)}}const WN=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!WN.test(t))return;const e=t.replace(WN,"$1UTC");xa.prototype[e]&&(t.startsWith("get")?xa.prototype[t]=function(){return this.internal[e]()}:(xa.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),Bde(this),+this},xa.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),R4(this),+this}))});function R4(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-uc(t.timeZone,t)*60))}function Bde(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),lz(t)}function lz(t){const e=uc(t.timeZone,t),n=e>0?Math.floor(e):Math.ceil(e),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const s=-new Date(+t).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),l=s-i,c=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();l&&c&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+l);const d=s-n;d&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+d);const h=new Date(+t);h.setUTCSeconds(0);const m=s>0?h.getSeconds():(h.getSeconds()-60)%60,p=Math.round(-(uc(t.timeZone,t)*60))%60;(p||m)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+p),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+p+m));const x=uc(t.timeZone,t),v=x>0?Math.floor(x):Math.ceil(x),k=-new Date(+t).getTimezoneOffset()-v,O=v!==n,j=k-d;if(O&&j){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+j);const T=uc(t.timeZone,t),A=T>0?Math.floor(T):Math.ceil(T),_=v-A;_&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+_),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+_))}}class Zr extends xa{static tz(e,...n){return n.length?new Zr(...n,e):new Zr(Date.now(),e)}toISOString(){const[e,n,r]=this.tzComponents(),s=`${e}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,n,r,s]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${r} ${n} ${s}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[n,r,s]=this.tzComponents();return`${e} GMT${n}${r}${s} (${Rde(this.timeZone,this)})`}toLocaleString(e,n){return Date.prototype.toLocaleString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(e,n){return Date.prototype.toLocaleDateString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(e,n){return Date.prototype.toLocaleTimeString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),n=e>0?"-":"+",r=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),s=String(Math.abs(e)%60).padStart(2,"0");return[n,r,s]}withTimeZone(e){return new Zr(+this,e)}[Symbol.for("constructDateFrom")](e){return new Zr(+new Date(e),this.timeZone)}}const oz=6048e5,Lde=864e5,GN=Symbol.for("constructDateFrom");function vr(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&GN in t?t[GN](e):t instanceof Date?new t.constructor(e):new Date(e)}function Nn(t,e){return vr(e||t,t)}function cz(t,e,n){const r=Nn(t,n?.in);return isNaN(e)?vr(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function uz(t,e,n){const r=Nn(t,n?.in);if(isNaN(e))return vr(t,NaN);if(!e)return r;const s=r.getDate(),i=vr(t,r.getTime());i.setMonth(r.getMonth()+e+1,0);const l=i.getDate();return s>=l?i:(r.setFullYear(i.getFullYear(),i.getMonth(),s),r)}let Ide={};function O0(){return Ide}function So(t,e){const n=O0(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Nn(t,e?.in),i=s.getDay(),l=(i=i.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function XN(t){const e=Nn(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Bc(t,...e){const n=vr.bind(null,t||e.find(r=>typeof r=="object"));return e.map(n)}function Qf(t,e){const n=Nn(t,e?.in);return n.setHours(0,0,0,0),n}function hz(t,e,n){const[r,s]=Bc(n?.in,t,e),i=Qf(r),l=Qf(s),c=+i-XN(i),d=+l-XN(l);return Math.round((c-d)/Lde)}function qde(t,e){const n=dz(t,e),r=vr(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Ff(r)}function Fde(t,e,n){return cz(t,e*7,n)}function Qde(t,e,n){return uz(t,e*12,n)}function $de(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=vr.bind(null,s));const i=Nn(s,r);(!n||n{!r&&typeof s=="object"&&(r=vr.bind(null,s));const i=Nn(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),vr(r,n||NaN)}function Ude(t,e,n){const[r,s]=Bc(n?.in,t,e);return+Qf(r)==+Qf(s)}function fz(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Vde(t){return!(!fz(t)&&typeof t!="number"||isNaN(+Nn(t)))}function Wde(t,e,n){const[r,s]=Bc(n?.in,t,e),i=r.getFullYear()-s.getFullYear(),l=r.getMonth()-s.getMonth();return i*12+l}function Gde(t,e){const n=Nn(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function mz(t,e){const[n,r]=Bc(t,e.start,e.end);return{start:n,end:r}}function Xde(t,e){const{start:n,end:r}=mz(e?.in,t);let s=+n>+r;const i=s?+n:+r,l=s?r:n;l.setHours(0,0,0,0),l.setDate(1);let c=1;const d=[];for(;+l<=i;)d.push(vr(n,l)),l.setMonth(l.getMonth()+c);return s?d.reverse():d}function Yde(t,e){const n=Nn(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Kde(t,e){const n=Nn(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function pz(t,e){const n=Nn(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Zde(t,e){const{start:n,end:r}=mz(e?.in,t);let s=+n>+r;const i=s?+n:+r,l=s?r:n;l.setHours(0,0,0,0),l.setMonth(0,1);let c=1;const d=[];for(;+l<=i;)d.push(vr(n,l)),l.setFullYear(l.getFullYear()+c);return s?d.reverse():d}function gz(t,e){const n=O0(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Nn(t,e?.in),i=s.getDay(),l=(i{let r;const s=ehe[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function td(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const nhe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},rhe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},she={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ihe={date:td({formats:nhe,defaultWidth:"full"}),time:td({formats:rhe,defaultWidth:"full"}),dateTime:td({formats:she,defaultWidth:"full"})},ahe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},lhe=(t,e,n,r)=>ahe[t];function ua(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const l=t.defaultFormattingWidth||t.defaultWidth,c=n?.width?String(n.width):l;s=t.formattingValues[c]||t.formattingValues[l]}else{const l=t.defaultWidth,c=n?.width?String(n.width):t.defaultWidth;s=t.values[c]||t.values[l]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const ohe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},che={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},uhe={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},dhe={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},hhe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},fhe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},mhe=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},phe={ordinalNumber:mhe,era:ua({values:ohe,defaultWidth:"wide"}),quarter:ua({values:che,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ua({values:uhe,defaultWidth:"wide"}),day:ua({values:dhe,defaultWidth:"wide"}),dayPeriod:ua({values:hhe,defaultWidth:"wide",formattingValues:fhe,defaultFormattingWidth:"wide"})};function da(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const l=i[0],c=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],d=Array.isArray(c)?xhe(c,p=>p.test(l)):ghe(c,p=>p.test(l));let h;h=t.valueCallback?t.valueCallback(d):d,h=n.valueCallback?n.valueCallback(h):h;const m=e.slice(l.length);return{value:h,rest:m}}}function ghe(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function xhe(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let l=t.valueCallback?t.valueCallback(i[0]):i[0];l=n.valueCallback?n.valueCallback(l):l;const c=e.slice(s.length);return{value:l,rest:c}}}const vhe=/^(\d+)(th|st|nd|rd)?/i,yhe=/\d+/i,bhe={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},whe={any:[/^b/i,/^(a|c)/i]},She={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},khe={any:[/1/i,/2/i,/3/i,/4/i]},Ohe={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},jhe={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Nhe={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Che={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},The={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Ahe={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Mhe={ordinalNumber:xz({matchPattern:vhe,parsePattern:yhe,valueCallback:t=>parseInt(t,10)}),era:da({matchPatterns:bhe,defaultMatchWidth:"wide",parsePatterns:whe,defaultParseWidth:"any"}),quarter:da({matchPatterns:She,defaultMatchWidth:"wide",parsePatterns:khe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:da({matchPatterns:Ohe,defaultMatchWidth:"wide",parsePatterns:jhe,defaultParseWidth:"any"}),day:da({matchPatterns:Nhe,defaultMatchWidth:"wide",parsePatterns:Che,defaultParseWidth:"any"}),dayPeriod:da({matchPatterns:The,defaultMatchWidth:"any",parsePatterns:Ahe,defaultParseWidth:"any"})},G5={code:"en-US",formatDistance:the,formatLong:ihe,formatRelative:lhe,localize:phe,match:Mhe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ehe(t,e){const n=Nn(t,e?.in);return hz(n,pz(n))+1}function vz(t,e){const n=Nn(t,e?.in),r=+Ff(n)-+qde(n);return Math.round(r/oz)+1}function yz(t,e){const n=Nn(t,e?.in),r=n.getFullYear(),s=O0(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,l=vr(e?.in||t,0);l.setFullYear(r+1,0,i),l.setHours(0,0,0,0);const c=So(l,e),d=vr(e?.in||t,0);d.setFullYear(r,0,i),d.setHours(0,0,0,0);const h=So(d,e);return+n>=+c?r+1:+n>=+h?r:r-1}function _he(t,e){const n=O0(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=yz(t,e),i=vr(e?.in||t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),So(i,e)}function bz(t,e){const n=Nn(t,e?.in),r=+So(n,e)-+_he(n,e);return Math.round(r/oz)+1}function vn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const Zl={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return vn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):vn(n+1,2)},d(t,e){return vn(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return vn(t.getHours()%12||12,e.length)},H(t,e){return vn(t.getHours(),e.length)},m(t,e){return vn(t.getMinutes(),e.length)},s(t,e){return vn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return vn(s,e.length)}},Mu={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},YN={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return Zl.y(t,e)},Y:function(t,e,n,r){const s=yz(t,r),i=s>0?s:1-s;if(e==="YY"){const l=i%100;return vn(l,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):vn(i,e.length)},R:function(t,e){const n=dz(t);return vn(n,e.length)},u:function(t,e){const n=t.getFullYear();return vn(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return vn(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return vn(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return Zl.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return vn(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const s=bz(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):vn(s,e.length)},I:function(t,e,n){const r=vz(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):vn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Zl.d(t,e)},D:function(t,e,n){const r=Ehe(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):vn(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return vn(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return vn(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return vn(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let s;switch(r===12?s=Mu.noon:r===0?s=Mu.midnight:s=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let s;switch(r>=17?s=Mu.evening:r>=12?s=Mu.afternoon:r>=4?s=Mu.morning:s=Mu.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Zl.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Zl.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):vn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):vn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Zl.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Zl.s(t,e)},S:function(t,e){return Zl.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return ZN(r);case"XXXX":case"XX":return rc(r);case"XXXXX":case"XXX":default:return rc(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return ZN(r);case"xxxx":case"xx":return rc(r);case"xxxxx":case"xxx":default:return rc(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+KN(r,":");case"OOOO":default:return"GMT"+rc(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+KN(r,":");case"zzzz":default:return"GMT"+rc(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return vn(r,e.length)},T:function(t,e,n){return vn(+t,e.length)}};function KN(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+e+vn(i,2)}function ZN(t,e){return t%60===0?(t>0?"-":"+")+vn(Math.abs(t)/60,2):rc(t,e)}function rc(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=vn(Math.trunc(r/60),2),i=vn(r%60,2);return n+s+e+i}const JN=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},wz=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Dhe=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return JN(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",JN(r,e)).replace("{{time}}",wz(s,e))},Rhe={p:wz,P:Dhe},zhe=/^D+$/,Phe=/^Y+$/,Bhe=["D","DD","YY","YYYY"];function Lhe(t){return zhe.test(t)}function Ihe(t){return Phe.test(t)}function qhe(t,e,n){const r=Fhe(t,e,n);if(console.warn(r),Bhe.includes(t))throw new RangeError(r)}function Fhe(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Qhe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,$he=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Hhe=/^'([^]*?)'?$/,Uhe=/''/g,Vhe=/[a-zA-Z]/;function dg(t,e,n){const r=O0(),s=n?.locale??r.locale??G5,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,l=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,c=Nn(t,n?.in);if(!Vde(c))throw new RangeError("Invalid time value");let d=e.match($he).map(m=>{const p=m[0];if(p==="p"||p==="P"){const x=Rhe[p];return x(m,s.formatLong)}return m}).join("").match(Qhe).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const p=m[0];if(p==="'")return{isToken:!1,value:Whe(m)};if(YN[p])return{isToken:!0,value:m};if(p.match(Vhe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+p+"`");return{isToken:!1,value:m}});s.localize.preprocessor&&(d=s.localize.preprocessor(c,d));const h={firstWeekContainsDate:i,weekStartsOn:l,locale:s};return d.map(m=>{if(!m.isToken)return m.value;const p=m.value;(!n?.useAdditionalWeekYearTokens&&Ihe(p)||!n?.useAdditionalDayOfYearTokens&&Lhe(p))&&qhe(p,e,String(t));const x=YN[p[0]];return x(c,p,s.localize,h)}).join("")}function Whe(t){const e=t.match(Hhe);return e?e[1].replace(Uhe,"'"):t}function Ghe(t,e){const n=Nn(t,e?.in),r=n.getFullYear(),s=n.getMonth(),i=vr(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function Xhe(t,e){return Nn(t,e?.in).getMonth()}function Yhe(t,e){return Nn(t,e?.in).getFullYear()}function Khe(t,e){return+Nn(t)>+Nn(e)}function Zhe(t,e){return+Nn(t)<+Nn(e)}function Jhe(t,e,n){const[r,s]=Bc(n?.in,t,e);return+So(r,n)==+So(s,n)}function efe(t,e,n){const[r,s]=Bc(n?.in,t,e);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function tfe(t,e,n){const[r,s]=Bc(n?.in,t,e);return r.getFullYear()===s.getFullYear()}function nfe(t,e,n){const r=Nn(t,n?.in),s=r.getFullYear(),i=r.getDate(),l=vr(t,0);l.setFullYear(s,e,15),l.setHours(0,0,0,0);const c=Ghe(l);return r.setMonth(e,Math.min(i,c)),r}function rfe(t,e,n){const r=Nn(t,n?.in);return isNaN(+r)?vr(t,NaN):(r.setFullYear(e),r)}const e9=5,sfe=4;function ife(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,s=e.addDays(t,-r+1),i=e.addDays(s,e9*7-1);return e.getMonth(t)===e.getMonth(i)?e9:sfe}function Sz(t,e){const n=e.startOfMonth(t),r=n.getDay();return r===1?n:r===0?e.addDays(n,-6):e.addDays(n,-1*(r-1))}function afe(t,e){const n=Sz(t,e),r=ife(t,e);return e.addDays(n,r*7-1)}class ai{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Zr.tz(this.options.timeZone):new this.Date,this.newDate=(r,s,i)=>this.overrides?.newDate?this.overrides.newDate(r,s,i):this.options.timeZone?new Zr(r,s,i,this.options.timeZone):new Date(r,s,i),this.addDays=(r,s)=>this.overrides?.addDays?this.overrides.addDays(r,s):cz(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):uz(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):Fde(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):Qde(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):hz(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):Wde(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Xde(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):Zde(r),i=new Set(s.map(c=>this.getYear(c)));if(i.size===s.length)return s;const l=[];return i.forEach(c=>{l.push(new Date(c,0,1))}),l},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):afe(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):Jde(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):Gde(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):gz(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):Kde(r),this.format=(r,s,i)=>{const l=this.overrides?.format?this.overrides.format(r,s,this.options):dg(r,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(l):l},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):vz(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):Xhe(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):Yhe(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):bz(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):Khe(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):Zhe(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):fz(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):Ude(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):efe(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):tfe(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):$de(r),this.min=r=>this.overrides?.min?this.overrides.min(r):Hde(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):nfe(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):rfe(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):Sz(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):Qf(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Ff(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):Yde(r),this.startOfWeek=(r,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):So(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):pz(r),this.options={locale:G5,...e},this.overrides=n}getDigitMap(){const{numerals:e="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:e}),r={};for(let s=0;s<10;s++)r[s.toString()]=n.format(s);return r}replaceDigits(e){const n=this.getDigitMap();return e.replace(/\d/g,r=>n[r]||r)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&ai.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:s}=this.options,i=n?.code;if(i&&ai.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:s}).format(e)}catch{}const l=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,l)}}ai.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Ma=new ai;class kz{constructor(e,n,r=Ma){this.date=e,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(e,n)),this.dateLib=r}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class lfe{constructor(e,n){this.date=e,this.weeks=n}}class ofe{constructor(e,n){this.days=n,this.weekNumber=e}}function cfe(t){return Ue.createElement("button",{...t})}function ufe(t){return Ue.createElement("span",{...t})}function dfe(t){const{size:e=24,orientation:n="left",className:r}=t;return Ue.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&Ue.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&Ue.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&Ue.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&Ue.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function hfe(t){const{day:e,modifiers:n,...r}=t;return Ue.createElement("td",{...r})}function ffe(t){const{day:e,modifiers:n,...r}=t,s=Ue.useRef(null);return Ue.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),Ue.createElement("button",{ref:s,...r})}var et;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})(et||(et={}));var Yn;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(Yn||(Yn={}));var qi;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(qi||(qi={}));var ti;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(ti||(ti={}));function mfe(t){const{options:e,className:n,components:r,classNames:s,...i}=t,l=[s[et.Dropdown],n].join(" "),c=e?.find(({value:d})=>d===i.value);return Ue.createElement("span",{"data-disabled":i.disabled,className:s[et.DropdownRoot]},Ue.createElement(r.Select,{className:l,...i},e?.map(({value:d,label:h,disabled:m})=>Ue.createElement(r.Option,{key:d,value:d,disabled:m},h))),Ue.createElement("span",{className:s[et.CaptionLabel],"aria-hidden":!0},c?.label,Ue.createElement(r.Chevron,{orientation:"down",size:18,className:s[et.Chevron]})))}function pfe(t){return Ue.createElement("div",{...t})}function gfe(t){return Ue.createElement("div",{...t})}function xfe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return Ue.createElement("div",{...r},t.children)}function vfe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return Ue.createElement("div",{...r})}function yfe(t){return Ue.createElement("table",{...t})}function bfe(t){return Ue.createElement("div",{...t})}const Oz=S.createContext(void 0);function j0(){const t=S.useContext(Oz);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function wfe(t){const{components:e}=j0();return Ue.createElement(e.Dropdown,{...t})}function Sfe(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:s,...i}=t,{components:l,classNames:c,labels:{labelPrevious:d,labelNext:h}}=j0(),m=S.useCallback(x=>{s&&n?.(x)},[s,n]),p=S.useCallback(x=>{r&&e?.(x)},[r,e]);return Ue.createElement("nav",{...i},Ue.createElement(l.PreviousMonthButton,{type:"button",className:c[et.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":d(r),onClick:p},Ue.createElement(l.Chevron,{disabled:r?void 0:!0,className:c[et.Chevron],orientation:"left"})),Ue.createElement(l.NextMonthButton,{type:"button",className:c[et.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":h(s),onClick:m},Ue.createElement(l.Chevron,{disabled:s?void 0:!0,orientation:"right",className:c[et.Chevron]})))}function kfe(t){const{components:e}=j0();return Ue.createElement(e.Button,{...t})}function Ofe(t){return Ue.createElement("option",{...t})}function jfe(t){const{components:e}=j0();return Ue.createElement(e.Button,{...t})}function Nfe(t){const{rootRef:e,...n}=t;return Ue.createElement("div",{...n,ref:e})}function Cfe(t){return Ue.createElement("select",{...t})}function Tfe(t){const{week:e,...n}=t;return Ue.createElement("tr",{...n})}function Afe(t){return Ue.createElement("th",{...t})}function Mfe(t){return Ue.createElement("thead",{"aria-hidden":!0},Ue.createElement("tr",{...t}))}function Efe(t){const{week:e,...n}=t;return Ue.createElement("th",{...n})}function _fe(t){return Ue.createElement("th",{...t})}function Dfe(t){return Ue.createElement("tbody",{...t})}function Rfe(t){const{components:e}=j0();return Ue.createElement(e.Dropdown,{...t})}const zfe=Object.freeze(Object.defineProperty({__proto__:null,Button:cfe,CaptionLabel:ufe,Chevron:dfe,Day:hfe,DayButton:ffe,Dropdown:mfe,DropdownNav:pfe,Footer:gfe,Month:xfe,MonthCaption:vfe,MonthGrid:yfe,Months:bfe,MonthsDropdown:wfe,Nav:Sfe,NextMonthButton:kfe,Option:Ofe,PreviousMonthButton:jfe,Root:Nfe,Select:Cfe,Week:Tfe,WeekNumber:Efe,WeekNumberHeader:_fe,Weekday:Afe,Weekdays:Mfe,Weeks:Dfe,YearsDropdown:Rfe},Symbol.toStringTag,{value:"Module"}));function ll(t,e,n=!1,r=Ma){let{from:s,to:i}=t;const{differenceInCalendarDays:l,isSameDay:c}=r;return s&&i?(l(i,s)<0&&([s,i]=[i,s]),l(e,s)>=(n?1:0)&&l(i,e)>=(n?1:0)):!n&&i?c(i,e):!n&&s?c(s,e):!1}function jz(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function X5(t){return!!(t&&typeof t=="object"&&"from"in t)}function Nz(t){return!!(t&&typeof t=="object"&&"after"in t)}function Cz(t){return!!(t&&typeof t=="object"&&"before"in t)}function Tz(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function Az(t,e){return Array.isArray(t)&&t.every(e.isDate)}function ol(t,e,n=Ma){const r=Array.isArray(e)?e:[e],{isSameDay:s,differenceInCalendarDays:i,isAfter:l}=n;return r.some(c=>{if(typeof c=="boolean")return c;if(n.isDate(c))return s(t,c);if(Az(c,n))return c.includes(t);if(X5(c))return ll(c,t,!1,n);if(Tz(c))return Array.isArray(c.dayOfWeek)?c.dayOfWeek.includes(t.getDay()):c.dayOfWeek===t.getDay();if(jz(c)){const d=i(c.before,t),h=i(c.after,t),m=d>0,p=h<0;return l(c.before,c.after)?p&&m:m||p}return Nz(c)?i(t,c.after)>0:Cz(c)?i(c.before,t)>0:typeof c=="function"?c(t):!1})}function Pfe(t,e,n,r,s){const{disabled:i,hidden:l,modifiers:c,showOutsideDays:d,broadcastCalendar:h,today:m}=e,{isSameDay:p,isSameMonth:x,startOfMonth:v,isBefore:b,endOfMonth:k,isAfter:O}=s,j=n&&v(n),T=r&&k(r),A={[Yn.focused]:[],[Yn.outside]:[],[Yn.disabled]:[],[Yn.hidden]:[],[Yn.today]:[]},_={};for(const D of t){const{date:E,displayMonth:z}=D,Q=!!(z&&!x(E,z)),F=!!(j&&b(E,j)),L=!!(T&&O(E,T)),U=!!(i&&ol(E,i,s)),V=!!(l&&ol(E,l,s))||F||L||!h&&!d&&Q||h&&d===!1&&Q,ce=p(E,m??s.today());Q&&A.outside.push(D),U&&A.disabled.push(D),V&&A.hidden.push(D),ce&&A.today.push(D),c&&Object.keys(c).forEach(W=>{const J=c?.[W];J&&ol(E,J,s)&&(_[W]?_[W].push(D):_[W]=[D])})}return D=>{const E={[Yn.focused]:!1,[Yn.disabled]:!1,[Yn.hidden]:!1,[Yn.outside]:!1,[Yn.today]:!1},z={};for(const Q in A){const F=A[Q];E[Q]=F.some(L=>L===D)}for(const Q in _)z[Q]=_[Q].some(F=>F===D);return{...E,...z}}}function Bfe(t,e,n={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):e[Yn[i]]?s.push(e[Yn[i]]):e[qi[i]]&&s.push(e[qi[i]]),s),[e[et.Day]])}function Lfe(t){return{...zfe,...t}}function Ife(t){const e={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([n,r])=>{n.startsWith("data-")&&(e[n]=r)}),e}function Y5(){const t={};for(const e in et)t[et[e]]=`rdp-${et[e]}`;for(const e in Yn)t[Yn[e]]=`rdp-${Yn[e]}`;for(const e in qi)t[qi[e]]=`rdp-${qi[e]}`;for(const e in ti)t[ti[e]]=`rdp-${ti[e]}`;return t}function Mz(t,e,n){return(n??new ai(e)).formatMonthYear(t)}const qfe=Mz;function Ffe(t,e,n){return(n??new ai(e)).format(t,"d")}function Qfe(t,e=Ma){return e.format(t,"LLLL")}function $fe(t,e,n){return(n??new ai(e)).format(t,"cccccc")}function Hfe(t,e=Ma){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function Ufe(){return""}function Ez(t,e=Ma){return e.format(t,"yyyy")}const Vfe=Ez,Wfe=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:Mz,formatDay:Ffe,formatMonthCaption:qfe,formatMonthDropdown:Qfe,formatWeekNumber:Hfe,formatWeekNumberHeader:Ufe,formatWeekdayName:$fe,formatYearCaption:Vfe,formatYearDropdown:Ez},Symbol.toStringTag,{value:"Module"}));function Gfe(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...Wfe,...t}}function Xfe(t,e,n,r,s){const{startOfMonth:i,startOfYear:l,endOfYear:c,eachMonthOfInterval:d,getMonth:h}=s;return d({start:l(t),end:c(t)}).map(x=>{const v=r.formatMonthDropdown(x,s),b=h(x),k=e&&xi(n)||!1;return{value:b,label:v,disabled:k}})}function Yfe(t,e={},n={}){let r={...e?.[et.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function Kfe(t,e,n){const r=t.today(),s=e?t.startOfISOWeek(r):t.startOfWeek(r),i=[];for(let l=0;l<7;l++){const c=t.addDays(s,l);i.push(c)}return i}function Zfe(t,e,n,r,s=!1){if(!t||!e)return;const{startOfYear:i,endOfYear:l,eachYearOfInterval:c,getYear:d}=r,h=i(t),m=l(e),p=c({start:h,end:m});return s&&p.reverse(),p.map(x=>{const v=n.formatYearDropdown(x,r);return{value:d(x),label:v,disabled:!1}})}function _z(t,e,n,r){let s=(r??new ai(n)).format(t,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s}const Jfe=_z;function Dz(t,e,n){return(n??new ai(e)).formatMonthYear(t)}const e0e=Dz;function t0e(t,e,n,r){let s=(r??new ai(n)).format(t,"PPPP");return e?.today&&(s=`Today, ${s}`),s}function n0e(t){return"Choose the Month"}function r0e(){return""}function s0e(t){return"Go to the Next Month"}function i0e(t){return"Go to the Previous Month"}function a0e(t,e,n){return(n??new ai(e)).format(t,"cccc")}function l0e(t,e){return`Week ${t}`}function o0e(t){return"Week Number"}function c0e(t){return"Choose the Year"}const u0e=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:e0e,labelDay:Jfe,labelDayButton:_z,labelGrid:Dz,labelGridcell:t0e,labelMonthDropdown:n0e,labelNav:r0e,labelNext:s0e,labelPrevious:i0e,labelWeekNumber:l0e,labelWeekNumberHeader:o0e,labelWeekday:a0e,labelYearDropdown:c0e},Symbol.toStringTag,{value:"Module"})),N0=t=>t instanceof HTMLElement?t:null,Ub=t=>[...t.querySelectorAll("[data-animated-month]")??[]],d0e=t=>N0(t.querySelector("[data-animated-month]")),Vb=t=>N0(t.querySelector("[data-animated-caption]")),Wb=t=>N0(t.querySelector("[data-animated-weeks]")),h0e=t=>N0(t.querySelector("[data-animated-nav]")),f0e=t=>N0(t.querySelector("[data-animated-weekdays]"));function m0e(t,e,{classNames:n,months:r,focused:s,dateLib:i}){const l=S.useRef(null),c=S.useRef(r),d=S.useRef(!1);S.useLayoutEffect(()=>{const h=c.current;if(c.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||h.length===0||r.length!==h.length)return;const m=i.isSameMonth(r[0].date,h[0].date),p=i.isAfter(r[0].date,h[0].date),x=p?n[ti.caption_after_enter]:n[ti.caption_before_enter],v=p?n[ti.weeks_after_enter]:n[ti.weeks_before_enter],b=l.current,k=t.current.cloneNode(!0);if(k instanceof HTMLElement?(Ub(k).forEach(A=>{if(!(A instanceof HTMLElement))return;const _=d0e(A);_&&A.contains(_)&&A.removeChild(_);const D=Vb(A);D&&D.classList.remove(x);const E=Wb(A);E&&E.classList.remove(v)}),l.current=k):l.current=null,d.current||m||s)return;const O=b instanceof HTMLElement?Ub(b):[],j=Ub(t.current);if(j?.every(T=>T instanceof HTMLElement)&&O&&O.every(T=>T instanceof HTMLElement)){d.current=!0,t.current.style.isolation="isolate";const T=h0e(t.current);T&&(T.style.zIndex="1"),j.forEach((A,_)=>{const D=O[_];if(!D)return;A.style.position="relative",A.style.overflow="hidden";const E=Vb(A);E&&E.classList.add(x);const z=Wb(A);z&&z.classList.add(v);const Q=()=>{d.current=!1,t.current&&(t.current.style.isolation=""),T&&(T.style.zIndex=""),E&&E.classList.remove(x),z&&z.classList.remove(v),A.style.position="",A.style.overflow="",A.contains(D)&&A.removeChild(D)};D.style.pointerEvents="none",D.style.position="absolute",D.style.overflow="hidden",D.setAttribute("aria-hidden","true");const F=f0e(D);F&&(F.style.opacity="0");const L=Vb(D);L&&(L.classList.add(p?n[ti.caption_before_exit]:n[ti.caption_after_exit]),L.addEventListener("animationend",Q));const U=Wb(D);U&&U.classList.add(p?n[ti.weeks_before_exit]:n[ti.weeks_after_exit]),A.insertBefore(D,A.firstChild)})}})}function p0e(t,e,n,r){const s=t[0],i=t[t.length-1],{ISOWeek:l,fixedWeeks:c,broadcastCalendar:d}=n??{},{addDays:h,differenceInCalendarDays:m,differenceInCalendarMonths:p,endOfBroadcastWeek:x,endOfISOWeek:v,endOfMonth:b,endOfWeek:k,isAfter:O,startOfBroadcastWeek:j,startOfISOWeek:T,startOfWeek:A}=r,_=d?j(s,r):l?T(s):A(s),D=d?x(i):l?v(b(i)):k(b(i)),E=m(D,_),z=p(i,s)+1,Q=[];for(let U=0;U<=E;U++){const V=h(_,U);if(e&&O(V,e))break;Q.push(V)}const L=(d?35:42)*z;if(c&&Q.length{const s=r.weeks.reduce((i,l)=>i.concat(l.days.slice()),e.slice());return n.concat(s.slice())},e.slice())}function x0e(t,e,n,r){const{numberOfMonths:s=1}=n,i=[];for(let l=0;le)break;i.push(c)}return i}function t9(t,e,n,r){const{month:s,defaultMonth:i,today:l=r.today(),numberOfMonths:c=1}=t;let d=s||i||l;const{differenceInCalendarMonths:h,addMonths:m,startOfMonth:p}=r;if(n&&h(n,d){const j=n.broadcastCalendar?p(O,r):n.ISOWeek?x(O):v(O),T=n.broadcastCalendar?i(O):n.ISOWeek?l(c(O)):d(c(O)),A=e.filter(z=>z>=j&&z<=T),_=n.broadcastCalendar?35:42;if(n.fixedWeeks&&A.length<_){const z=e.filter(Q=>{const F=_-A.length;return Q>T&&Q<=s(T,F)});A.push(...z)}const D=A.reduce((z,Q)=>{const F=n.ISOWeek?h(Q):m(Q),L=z.find(V=>V.weekNumber===F),U=new kz(Q,O,r);return L?L.days.push(U):z.push(new ofe(F,[U])),z},[]),E=new lfe(O,D);return k.push(E),k},[]);return n.reverseMonths?b.reverse():b}function y0e(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:s,startOfDay:i,startOfMonth:l,endOfMonth:c,addYears:d,endOfYear:h,newDate:m,today:p}=e,{fromYear:x,toYear:v,fromMonth:b,toMonth:k}=t;!n&&b&&(n=b),!n&&x&&(n=e.newDate(x,0,1)),!r&&k&&(r=k),!r&&v&&(r=m(v,11,31));const O=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=l(n):x?n=m(x,0,1):!n&&O&&(n=s(d(t.today??p(),-100))),r?r=c(r):v?r=m(v,11,31):!r&&O&&(r=h(t.today??p())),[n&&i(n),r&&i(r)]}function b0e(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:l,addMonths:c,differenceInCalendarMonths:d}=r,h=s?i:1,m=l(t);if(!e)return c(m,h);if(!(d(e,t)n.concat(r.weeks.slice()),e.slice())}function Yx(t,e){const[n,r]=S.useState(t);return[e===void 0?n:e,r]}function k0e(t,e){const[n,r]=y0e(t,e),{startOfMonth:s,endOfMonth:i}=e,l=t9(t,n,r,e),[c,d]=Yx(l,t.month?l:void 0);S.useEffect(()=>{const E=t9(t,n,r,e);d(E)},[t.timeZone]);const h=x0e(c,r,t,e),m=p0e(h,t.endMonth?i(t.endMonth):void 0,t,e),p=v0e(h,m,t,e),x=S0e(p),v=g0e(p),b=w0e(c,n,t,e),k=b0e(c,r,t,e),{disableNavigation:O,onMonthChange:j}=t,T=E=>x.some(z=>z.days.some(Q=>Q.isEqualTo(E))),A=E=>{if(O)return;let z=s(E);n&&zs(r)&&(z=s(r)),d(z),j?.(z)};return{months:p,weeks:x,days:v,navStart:n,navEnd:r,previousMonth:b,nextMonth:k,goToMonth:A,goToDay:E=>{T(E)||A(E.date)}}}var aa;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(aa||(aa={}));function n9(t){return!t[Yn.disabled]&&!t[Yn.hidden]&&!t[Yn.outside]}function O0e(t,e,n,r){let s,i=-1;for(const l of t){const c=e(l);n9(c)&&(c[Yn.focused]&&in9(e(l)))),s}function j0e(t,e,n,r,s,i,l){const{ISOWeek:c,broadcastCalendar:d}=i,{addDays:h,addMonths:m,addWeeks:p,addYears:x,endOfBroadcastWeek:v,endOfISOWeek:b,endOfWeek:k,max:O,min:j,startOfBroadcastWeek:T,startOfISOWeek:A,startOfWeek:_}=l;let E={day:h,week:p,month:m,year:x,startOfWeek:z=>d?T(z,l):c?A(z):_(z),endOfWeek:z=>d?v(z):c?b(z):k(z)}[t](n,e==="after"?1:-1);return e==="before"&&r?E=O([r,E]):e==="after"&&s&&(E=j([s,E])),E}function Rz(t,e,n,r,s,i,l,c=0){if(c>365)return;const d=j0e(t,e,n.date,r,s,i,l),h=!!(i.disabled&&ol(d,i.disabled,l)),m=!!(i.hidden&&ol(d,i.hidden,l)),p=d,x=new kz(d,p,l);return!h&&!m?x:Rz(t,e,x,r,s,i,l,c+1)}function N0e(t,e,n,r,s){const{autoFocus:i}=t,[l,c]=S.useState(),d=O0e(e.days,n,r||(()=>!1),l),[h,m]=S.useState(i?d:void 0);return{isFocusTarget:k=>!!d?.isEqualTo(k),setFocused:m,focused:h,blur:()=>{c(h),m(void 0)},moveFocus:(k,O)=>{if(!h)return;const j=Rz(k,O,h,e.navStart,e.navEnd,t,s);j&&(t.disableNavigation&&!e.days.some(A=>A.isEqualTo(j))||(e.goToDay(j),m(j)))}}}function C0e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,l]=Yx(n,s?n:void 0),c=s?n:i,{isSameDay:d}=e,h=v=>c?.some(b=>d(b,v))??!1,{min:m,max:p}=t;return{selected:c,select:(v,b,k)=>{let O=[...c??[]];if(h(v)){if(c?.length===m||r&&c?.length===1)return;O=c?.filter(j=>!d(j,v))}else c?.length===p?O=[v]:O=[...O,v];return s||l(O),s?.(O,v,b,k),O},isSelected:h}}function T0e(t,e,n=0,r=0,s=!1,i=Ma){const{from:l,to:c}=e||{},{isSameDay:d,isAfter:h,isBefore:m}=i;let p;if(!l&&!c)p={from:t,to:n>0?void 0:t};else if(l&&!c)d(l,t)?n===0?p={from:l,to:t}:s?p={from:l,to:void 0}:p=void 0:m(t,l)?p={from:t,to:l}:p={from:l,to:t};else if(l&&c)if(d(l,t)&&d(c,t))s?p={from:l,to:c}:p=void 0;else if(d(l,t))p={from:l,to:n>0?void 0:t};else if(d(c,t))p={from:t,to:n>0?void 0:t};else if(m(t,l))p={from:t,to:c};else if(h(t,l))p={from:l,to:t};else if(h(t,c))p={from:l,to:t};else throw new Error("Invalid range");if(p?.from&&p?.to){const x=i.differenceInCalendarDays(p.to,p.from);r>0&&x>r?p={from:t,to:void 0}:n>1&&xtypeof c!="function").some(c=>typeof c=="boolean"?c:n.isDate(c)?ll(t,c,!1,n):Az(c,n)?c.some(d=>ll(t,d,!1,n)):X5(c)?c.from&&c.to?r9(t,{from:c.from,to:c.to},n):!1:Tz(c)?A0e(t,c.dayOfWeek,n):jz(c)?n.isAfter(c.before,c.after)?r9(t,{from:n.addDays(c.after,1),to:n.addDays(c.before,-1)},n):ol(t.from,c,n)||ol(t.to,c,n):Nz(c)||Cz(c)?ol(t.from,c,n)||ol(t.to,c,n):!1))return!0;const l=r.filter(c=>typeof c=="function");if(l.length){let c=t.from;const d=n.differenceInCalendarDays(t.to,t.from);for(let h=0;h<=d;h++){if(l.some(m=>m(c)))return!0;c=n.addDays(c,1)}}return!1}function E0e(t,e){const{disabled:n,excludeDisabled:r,selected:s,required:i,onSelect:l}=t,[c,d]=Yx(s,l?s:void 0),h=l?s:c;return{selected:h,select:(x,v,b)=>{const{min:k,max:O}=t,j=x?T0e(x,h,k,O,i,e):void 0;return r&&n&&j?.from&&j.to&&M0e({from:j.from,to:j.to},n,e)&&(j.from=x,j.to=void 0),l||d(j),l?.(j,x,v,b),j},isSelected:x=>h&&ll(h,x,!1,e)}}function _0e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,l]=Yx(n,s?n:void 0),c=s?n:i,{isSameDay:d}=e;return{selected:c,select:(p,x,v)=>{let b=p;return!r&&c&&c&&d(p,c)&&(b=void 0),s||l(b),s?.(b,p,x,v),b},isSelected:p=>c?d(c,p):!1}}function D0e(t,e){const n=_0e(t,e),r=C0e(t,e),s=E0e(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function R0e(t){let e=t;e.timeZone&&(e={...t},e.today&&(e.today=new Zr(e.today,e.timeZone)),e.month&&(e.month=new Zr(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new Zr(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new Zr(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new Zr(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new Zr(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(dt=>new Zr(dt,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new Zr(e.selected.from,e.timeZone):void 0,to:e.selected.to?new Zr(e.selected.to,e.timeZone):void 0}));const{components:n,formatters:r,labels:s,dateLib:i,locale:l,classNames:c}=S.useMemo(()=>{const dt={...G5,...e.locale};return{dateLib:new ai({locale:dt,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib),components:Lfe(e.components),formatters:Gfe(e.formatters),labels:{...u0e,...e.labels},locale:dt,classNames:{...Y5(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]),{captionLayout:d,mode:h,navLayout:m,numberOfMonths:p=1,onDayBlur:x,onDayClick:v,onDayFocus:b,onDayKeyDown:k,onDayMouseEnter:O,onDayMouseLeave:j,onNextClick:T,onPrevClick:A,showWeekNumber:_,styles:D}=e,{formatCaption:E,formatDay:z,formatMonthDropdown:Q,formatWeekNumber:F,formatWeekNumberHeader:L,formatWeekdayName:U,formatYearDropdown:V}=r,ce=k0e(e,i),{days:W,months:J,navStart:$,navEnd:ae,previousMonth:ne,nextMonth:ue,goToMonth:R}=ce,me=Pfe(W,e,$,ae,i),{isSelected:Y,select:P,selected:K}=D0e(e,i)??{},{blur:H,focused:fe,isFocusTarget:ve,moveFocus:Re,setFocused:de}=N0e(e,ce,me,Y??(()=>!1),i),{labelDayButton:We,labelGridcell:ct,labelGrid:Oe,labelMonthDropdown:nt,labelNav:ut,labelPrevious:Ct,labelNext:In,labelWeekday:Tn,labelWeekNumber:Jn,labelWeekNumberHeader:nn,labelYearDropdown:_t}=s,Yr=S.useMemo(()=>Kfe(i,e.ISOWeek),[i,e.ISOWeek]),qn=h!==void 0||v!==void 0,or=S.useCallback(()=>{ne&&(R(ne),A?.(ne))},[ne,R,A]),yn=S.useCallback(()=>{ue&&(R(ue),T?.(ue))},[R,ue,T]),ft=S.useCallback((dt,Pn)=>mt=>{mt.preventDefault(),mt.stopPropagation(),de(dt),P?.(dt.date,Pn,mt),v?.(dt.date,Pn,mt)},[P,v,de]),ee=S.useCallback((dt,Pn)=>mt=>{de(dt),b?.(dt.date,Pn,mt)},[b,de]),Se=S.useCallback((dt,Pn)=>mt=>{H(),x?.(dt.date,Pn,mt)},[H,x]),Be=S.useCallback((dt,Pn)=>mt=>{const rn={ArrowLeft:[mt.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[mt.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[mt.shiftKey?"year":"week","after"],ArrowUp:[mt.shiftKey?"year":"week","before"],PageUp:[mt.shiftKey?"year":"month","before"],PageDown:[mt.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(rn[mt.key]){mt.preventDefault(),mt.stopPropagation();const[Mr,At]=rn[mt.key];Re(Mr,At)}k?.(dt.date,Pn,mt)},[Re,k,e.dir]),rt=S.useCallback((dt,Pn)=>mt=>{O?.(dt.date,Pn,mt)},[O]),Tt=S.useCallback((dt,Pn)=>mt=>{j?.(dt.date,Pn,mt)},[j]),cr=S.useCallback(dt=>Pn=>{const mt=Number(Pn.target.value),rn=i.setMonth(i.startOfMonth(dt),mt);R(rn)},[i,R]),Kr=S.useCallback(dt=>Pn=>{const mt=Number(Pn.target.value),rn=i.setYear(i.startOfMonth(dt),mt);R(rn)},[i,R]),{className:re,style:Ae}=S.useMemo(()=>({className:[c[et.Root],e.className].filter(Boolean).join(" "),style:{...D?.[et.Root],...e.style}}),[c,e.className,e.style,D]),pt=Ife(e),yt=S.useRef(null);m0e(yt,!!e.animate,{classNames:c,months:J,focused:fe,dateLib:i});const vs={dayPickerProps:e,selected:K,select:P,isSelected:Y,months:J,nextMonth:ue,previousMonth:ne,goToMonth:R,getModifiers:me,components:n,classNames:c,styles:D,labels:s,formatters:r};return Ue.createElement(Oz.Provider,{value:vs},Ue.createElement(n.Root,{rootRef:e.animate?yt:void 0,className:re,style:Ae,dir:e.dir,id:e.id,lang:e.lang,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...pt},Ue.createElement(n.Months,{className:c[et.Months],style:D?.[et.Months]},!e.hideNavigation&&!m&&Ue.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[et.Nav],style:D?.[et.Nav],"aria-label":ut(),onPreviousClick:or,onNextClick:yn,previousMonth:ne,nextMonth:ue}),J.map((dt,Pn)=>Ue.createElement(n.Month,{"data-animated-month":e.animate?"true":void 0,className:c[et.Month],style:D?.[et.Month],key:Pn,displayIndex:Pn,calendarMonth:dt},m==="around"&&!e.hideNavigation&&Pn===0&&Ue.createElement(n.PreviousMonthButton,{type:"button",className:c[et.PreviousMonthButton],tabIndex:ne?void 0:-1,"aria-disabled":ne?void 0:!0,"aria-label":Ct(ne),onClick:or,"data-animated-button":e.animate?"true":void 0},Ue.createElement(n.Chevron,{disabled:ne?void 0:!0,className:c[et.Chevron],orientation:e.dir==="rtl"?"right":"left"})),Ue.createElement(n.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:c[et.MonthCaption],style:D?.[et.MonthCaption],calendarMonth:dt,displayIndex:Pn},d?.startsWith("dropdown")?Ue.createElement(n.DropdownNav,{className:c[et.Dropdowns],style:D?.[et.Dropdowns]},(()=>{const mt=d==="dropdown"||d==="dropdown-months"?Ue.createElement(n.MonthsDropdown,{key:"month",className:c[et.MonthsDropdown],"aria-label":nt(),classNames:c,components:n,disabled:!!e.disableNavigation,onChange:cr(dt.date),options:Xfe(dt.date,$,ae,r,i),style:D?.[et.Dropdown],value:i.getMonth(dt.date)}):Ue.createElement("span",{key:"month"},Q(dt.date,i)),rn=d==="dropdown"||d==="dropdown-years"?Ue.createElement(n.YearsDropdown,{key:"year",className:c[et.YearsDropdown],"aria-label":_t(i.options),classNames:c,components:n,disabled:!!e.disableNavigation,onChange:Kr(dt.date),options:Zfe($,ae,r,i,!!e.reverseYears),style:D?.[et.Dropdown],value:i.getYear(dt.date)}):Ue.createElement("span",{key:"year"},V(dt.date,i));return i.getMonthYearOrder()==="year-first"?[rn,mt]:[mt,rn]})(),Ue.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},E(dt.date,i.options,i))):Ue.createElement(n.CaptionLabel,{className:c[et.CaptionLabel],role:"status","aria-live":"polite"},E(dt.date,i.options,i))),m==="around"&&!e.hideNavigation&&Pn===p-1&&Ue.createElement(n.NextMonthButton,{type:"button",className:c[et.NextMonthButton],tabIndex:ue?void 0:-1,"aria-disabled":ue?void 0:!0,"aria-label":In(ue),onClick:yn,"data-animated-button":e.animate?"true":void 0},Ue.createElement(n.Chevron,{disabled:ue?void 0:!0,className:c[et.Chevron],orientation:e.dir==="rtl"?"left":"right"})),Pn===p-1&&m==="after"&&!e.hideNavigation&&Ue.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[et.Nav],style:D?.[et.Nav],"aria-label":ut(),onPreviousClick:or,onNextClick:yn,previousMonth:ne,nextMonth:ue}),Ue.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":h==="multiple"||h==="range","aria-label":Oe(dt.date,i.options,i)||void 0,className:c[et.MonthGrid],style:D?.[et.MonthGrid]},!e.hideWeekdays&&Ue.createElement(n.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:c[et.Weekdays],style:D?.[et.Weekdays]},_&&Ue.createElement(n.WeekNumberHeader,{"aria-label":nn(i.options),className:c[et.WeekNumberHeader],style:D?.[et.WeekNumberHeader],scope:"col"},L()),Yr.map(mt=>Ue.createElement(n.Weekday,{"aria-label":Tn(mt,i.options,i),className:c[et.Weekday],key:String(mt),style:D?.[et.Weekday],scope:"col"},U(mt,i.options,i)))),Ue.createElement(n.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:c[et.Weeks],style:D?.[et.Weeks]},dt.weeks.map(mt=>Ue.createElement(n.Week,{className:c[et.Week],key:mt.weekNumber,style:D?.[et.Week],week:mt},_&&Ue.createElement(n.WeekNumber,{week:mt,style:D?.[et.WeekNumber],"aria-label":Jn(mt.weekNumber,{locale:l}),className:c[et.WeekNumber],scope:"row",role:"rowheader"},F(mt.weekNumber,i)),mt.days.map(rn=>{const{date:Mr}=rn,At=me(rn);if(At[Yn.focused]=!At.hidden&&!!fe?.isEqualTo(rn),At[qi.selected]=Y?.(Mr)||At.selected,X5(K)){const{from:qc,to:Do}=K;At[qi.range_start]=!!(qc&&Do&&i.isSameDay(Mr,qc)),At[qi.range_end]=!!(qc&&Do&&i.isSameDay(Mr,Do)),At[qi.range_middle]=ll(K,Mr,!0,i)}const Ic=Yfe(At,D,e.modifiersStyles),_o=Bfe(At,c,e.modifiersClassNames),t1=!qn&&!At.hidden?ct(Mr,At,i.options,i):void 0;return Ue.createElement(n.Day,{key:`${i.format(Mr,"yyyy-MM-dd")}_${i.format(rn.displayMonth,"yyyy-MM")}`,day:rn,modifiers:At,className:_o.join(" "),style:Ic,role:"gridcell","aria-selected":At.selected||void 0,"aria-label":t1,"data-day":i.format(Mr,"yyyy-MM-dd"),"data-month":rn.outside?i.format(Mr,"yyyy-MM"):void 0,"data-selected":At.selected||void 0,"data-disabled":At.disabled||void 0,"data-hidden":At.hidden||void 0,"data-outside":rn.outside||void 0,"data-focused":At.focused||void 0,"data-today":At.today||void 0},!At.hidden&&qn?Ue.createElement(n.DayButton,{className:c[et.DayButton],style:D?.[et.DayButton],type:"button",day:rn,modifiers:At,disabled:At.disabled||void 0,tabIndex:ve(rn)?0:-1,"aria-label":We(Mr,At,i.options,i),onClick:ft(rn,At),onBlur:Se(rn,At),onFocus:ee(rn,At),onKeyDown:Be(rn,At),onMouseEnter:rt(rn,At),onMouseLeave:Tt(rn,At)},z(Mr,i.options,i)):!At.hidden&&z(rn.date,i.options,i))})))))))),e.footer&&Ue.createElement(n.Footer,{className:c[et.Footer],style:D?.[et.Footer],role:"status","aria-live":"polite"},e.footer)))}function s9({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:l,...c}){const d=Y5();return a.jsx(R0e,{showOutsideDays:n,className:ye("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,t),captionLayout:r,formatters:{formatMonthDropdown:h=>h.toLocaleString("default",{month:"short"}),...i},classNames:{root:ye("w-fit",d.root),months:ye("relative flex flex-col gap-4 md:flex-row",d.months),month:ye("flex w-full flex-col gap-4",d.month),nav:ye("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",d.nav),button_previous:ye(ff({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_previous),button_next:ye(ff({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_next),month_caption:ye("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",d.month_caption),dropdowns:ye("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",d.dropdowns),dropdown_root:ye("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",d.dropdown_root),dropdown:ye("bg-popover absolute inset-0 opacity-0",d.dropdown),caption_label:ye("select-none font-medium",r==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",d.caption_label),table:"w-full border-collapse",weekdays:ye("flex",d.weekdays),weekday:ye("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",d.weekday),week:ye("mt-2 flex w-full",d.week),week_number_header:ye("w-[--cell-size] select-none",d.week_number_header),week_number:ye("text-muted-foreground select-none text-[0.8rem]",d.week_number),day:ye("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",d.day),range_start:ye("bg-accent rounded-l-md",d.range_start),range_middle:ye("rounded-none",d.range_middle),range_end:ye("bg-accent rounded-r-md",d.range_end),today:ye("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",d.today),outside:ye("text-muted-foreground aria-selected:text-muted-foreground",d.outside),disabled:ye("text-muted-foreground opacity-50",d.disabled),hidden:ye("invisible",d.hidden),...e},components:{Root:({className:h,rootRef:m,...p})=>a.jsx("div",{"data-slot":"calendar",ref:m,className:ye(h),...p}),Chevron:({className:h,orientation:m,...p})=>m==="left"?a.jsx(Tc,{className:ye("size-4",h),...p}):m==="right"?a.jsx(Ac,{className:ye("size-4",h),...p}):a.jsx(df,{className:ye("size-4",h),...p}),DayButton:z0e,WeekNumber:({children:h,...m})=>a.jsx("td",{...m,children:a.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:h})}),...l},...c})}function z0e({className:t,day:e,modifiers:n,...r}){const s=Y5(),i=S.useRef(null);return S.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),a.jsx(ie,{ref:i,variant:"ghost",size:"icon","data-day":e.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:ye("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",s.day,t),...r})}class P0e{ws=null;reconnectTimeout=null;reconnectAttempts=0;maxReconnectAttempts=10;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];maxCacheSize=1e3;getWebSocketUrl(){{const e=window.location.protocol==="https:"?"wss:":"ws:",n=window.location.host;return`${e}//${n}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const e=this.getWebSocketUrl();try{this.ws=new WebSocket(e),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=n=>{try{if(n.data==="pong")return;const r=JSON.parse(n.data);this.notifyLog(r)}catch(r){console.error("解析日志消息失败:",r)}},this.ws.onerror=n=>{console.error("❌ WebSocket 错误:",n),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(n){console.error("创建 WebSocket 连接失败:",n),this.attemptReconnect()}}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return;this.reconnectAttempts+=1;const e=Math.min(1e3*this.reconnectAttempts,1e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},e)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(e){return this.logCallbacks.add(e),()=>this.logCallbacks.delete(e)}onConnectionChange(e){return this.connectionCallbacks.add(e),e(this.isConnected),()=>this.connectionCallbacks.delete(e)}notifyLog(e){this.logCache.some(r=>r.id===e.id)||(this.logCache.push(e),this.logCache.length>this.maxCacheSize&&(this.logCache=this.logCache.slice(-this.maxCacheSize)),this.logCallbacks.forEach(r=>{try{r(e)}catch(s){console.error("日志回调执行失败:",s)}}))}notifyConnection(e){this.connectionCallbacks.forEach(n=>{try{n(e)}catch(r){console.error("连接状态回调执行失败:",r)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const Iu=new P0e;typeof window<"u"&&Iu.connect();const B0e={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},L0e=(t,e,n)=>{let r;const s=B0e[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",String(e)),n?.addSuffix?n.comparison&&n.comparison>0?r+"内":r+"前":r},I0e={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},q0e={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},F0e={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Q0e={date:td({formats:I0e,defaultWidth:"full"}),time:td({formats:q0e,defaultWidth:"full"}),dateTime:td({formats:F0e,defaultWidth:"full"})};function i9(t,e,n){const r="eeee p";return Jhe(t,e,n)?r:t.getTime()>e.getTime()?"'下个'"+r:"'上个'"+r}const $0e={lastWeek:i9,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:i9,other:"PP p"},H0e=(t,e,n,r)=>{const s=$0e[t];return typeof s=="function"?s(e,n,r):s},U0e={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},V0e={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},W0e={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},G0e={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},X0e={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},Y0e={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},K0e=(t,e)=>{const n=Number(t);switch(e?.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},Z0e={ordinalNumber:K0e,era:ua({values:U0e,defaultWidth:"wide"}),quarter:ua({values:V0e,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ua({values:W0e,defaultWidth:"wide"}),day:ua({values:G0e,defaultWidth:"wide"}),dayPeriod:ua({values:X0e,defaultWidth:"wide",formattingValues:Y0e,defaultFormattingWidth:"wide"})},J0e=/^(第\s*)?\d+(日|时|分|秒)?/i,eme=/\d+/i,tme={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},nme={any:[/^(前)/i,/^(公元)/i]},rme={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},sme={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},ime={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},ame={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},lme={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},ome={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},cme={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},ume={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},dme={ordinalNumber:xz({matchPattern:J0e,parsePattern:eme,valueCallback:t=>parseInt(t,10)}),era:da({matchPatterns:tme,defaultMatchWidth:"wide",parsePatterns:nme,defaultParseWidth:"any"}),quarter:da({matchPatterns:rme,defaultMatchWidth:"wide",parsePatterns:sme,defaultParseWidth:"any",valueCallback:t=>t+1}),month:da({matchPatterns:ime,defaultMatchWidth:"wide",parsePatterns:ame,defaultParseWidth:"any"}),day:da({matchPatterns:lme,defaultMatchWidth:"wide",parsePatterns:ome,defaultParseWidth:"any"}),dayPeriod:da({matchPatterns:cme,defaultMatchWidth:"any",parsePatterns:ume,defaultParseWidth:"any"})},Bp={code:"zh-CN",formatDistance:L0e,formatLong:Q0e,formatRelative:H0e,localize:Z0e,match:dme,options:{weekStartsOn:1,firstWeekContainsDate:4}};function hme(){const[t,e]=S.useState([]),[n,r]=S.useState(""),[s,i]=S.useState("all"),[l,c]=S.useState("all"),[d,h]=S.useState(void 0),[m,p]=S.useState(void 0),[x,v]=S.useState(!0),[b,k]=S.useState(!1),O=S.useRef(null),j=S.useRef(null);S.useEffect(()=>{const U=Iu.getAllLogs();e(U);const V=Iu.onLog(()=>{e(Iu.getAllLogs())}),ce=Iu.onConnectionChange(W=>{k(W)});return()=>{V(),ce()}},[]),S.useEffect(()=>{x&&j.current&&j.current.scrollIntoView({behavior:"smooth",block:"end"})},[t,x]);const T=S.useMemo(()=>{const U=new Set(t.map(V=>V.module));return Array.from(U).sort()},[t]),A=U=>{switch(U){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},_=U=>{switch(U){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},D=()=>{window.location.reload()},E=()=>{Iu.clearLogs(),e([])},z=()=>{const U=L.map(J=>`${J.timestamp} [${J.level.padEnd(8)}] [${J.module}] ${J.message}`).join(` -`),V=new Blob([U],{type:"text/plain;charset=utf-8"}),ce=URL.createObjectURL(V),W=document.createElement("a");W.href=ce,W.download=`logs-${dg(new Date,"yyyy-MM-dd-HHmmss")}.txt`,W.click(),URL.revokeObjectURL(ce)},Q=()=>{v(!x)},F=()=>{h(void 0),p(void 0)},L=S.useMemo(()=>t.filter(U=>{const V=n===""||U.message.toLowerCase().includes(n.toLowerCase())||U.module.toLowerCase().includes(n.toLowerCase()),ce=s==="all"||U.level===s,W=l==="all"||U.module===l;let J=!0;if(d||m){const $=new Date(U.timestamp);if(d){const ae=new Date(d);ae.setHours(0,0,0,0),J=J&&$>=ae}if(m){const ae=new Date(m);ae.setHours(23,59,59,999),J=J&&$<=ae}}return V&&ce&&W&&J}),[t,n,s,l,d,m]);return a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 p-3 sm:p-4 lg:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:ye("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",b?"bg-green-500 animate-pulse":"bg-red-500")}),a.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:b?"已连接":"未连接"})]})]}),a.jsx(gt,{className:"p-3 sm:p-4",children:a.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索日志...",value:n,onChange:U=>r(U.target.value),className:"pl-9 h-9 text-sm"})]}),a.jsxs(Lt,{value:s,onValueChange:i,children:[a.jsxs(Dt,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[a.jsx(t2,{className:"h-4 w-4 mr-2"}),a.jsx(It,{placeholder:"级别"})]}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部级别"}),a.jsx(Pe,{value:"DEBUG",children:"DEBUG"}),a.jsx(Pe,{value:"INFO",children:"INFO"}),a.jsx(Pe,{value:"WARNING",children:"WARNING"}),a.jsx(Pe,{value:"ERROR",children:"ERROR"}),a.jsx(Pe,{value:"CRITICAL",children:"CRITICAL"})]})]}),a.jsxs(Lt,{value:l,onValueChange:c,children:[a.jsxs(Dt,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[a.jsx(t2,{className:"h-4 w-4 mr-2"}),a.jsx(It,{placeholder:"模块"})]}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部模块"}),T.map(U=>a.jsx(Pe,{value:U,children:U},U))]})]})]}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!d&&"text-muted-foreground"),children:[a.jsx(uO,{className:"mr-2 h-4 w-4"}),a.jsx("span",{className:"text-xs sm:text-sm",children:d?dg(d,"PPP",{locale:Bp}):"开始日期"})]})}),a.jsx(fl,{className:"w-auto p-0",align:"start",children:a.jsx(s9,{mode:"single",selected:d,onSelect:h,initialFocus:!0,locale:Bp})})]}),a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!m&&"text-muted-foreground"),children:[a.jsx(uO,{className:"mr-2 h-4 w-4"}),a.jsx("span",{className:"text-xs sm:text-sm",children:m?dg(m,"PPP",{locale:Bp}):"结束日期"})]})}),a.jsx(fl,{className:"w-auto p-0",align:"start",children:a.jsx(s9,{mode:"single",selected:m,onSelect:p,initialFocus:!0,locale:Bp})})]}),(d||m)&&a.jsxs(ie,{variant:"outline",size:"sm",onClick:F,className:"w-full sm:w-auto h-9",children:[a.jsx(Gf,{className:"h-4 w-4 sm:mr-2"}),a.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),a.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[a.jsxs(ie,{variant:x?"default":"outline",size:"sm",onClick:Q,className:"flex-1 sm:flex-none h-9",children:[x?a.jsx(jq,{className:"h-4 w-4"}):a.jsx(Nq,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:x?"自动滚动":"已暂停"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:D,className:"flex-1 sm:flex-none h-9",children:[a.jsx(Fi,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:E,className:"flex-1 sm:flex-none h-9",children:[a.jsx(Ht,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:z,className:"flex-1 sm:flex-none h-9",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),a.jsx("div",{className:"flex-1 hidden sm:block"}),a.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[a.jsxs("span",{className:"font-mono",children:[L.length," / ",t.length]}),a.jsx("span",{className:"ml-1",children:"条日志"})]})]})]})}),a.jsx(gt,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900",children:a.jsx(mn,{className:"h-[calc(100vh-280px)] sm:h-[calc(100vh-320px)] lg:h-[calc(100vh-400px)]",children:a.jsxs("div",{ref:O,className:"p-2 sm:p-3 lg:p-4 font-mono text-xs sm:text-sm space-y-1",children:[L.length===0?a.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):L.map(U=>a.jsxs("div",{className:ye("py-2 px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",_(U.level)),children:[a.jsxs("div",{className:"flex flex-col gap-1 sm:hidden",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-600 text-xs",children:U.timestamp}),a.jsxs("span",{className:ye("text-xs font-semibold",A(U.level)),children:["[",U.level,"]"]})]}),a.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 text-xs truncate",children:U.module}),a.jsx("div",{className:"text-gray-300 dark:text-gray-400 text-xs whitespace-pre-wrap break-words",children:U.message})]}),a.jsxs("div",{className:"hidden sm:flex gap-3 items-start",children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[140px] lg:w-[180px] text-xs lg:text-sm",children:U.timestamp}),a.jsxs("span",{className:ye("flex-shrink-0 w-[70px] lg:w-[80px] font-semibold text-xs lg:text-sm",A(U.level)),children:["[",U.level,"]"]}),a.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[120px] lg:w-[150px] truncate text-xs lg:text-sm",children:U.module}),a.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words text-xs lg:text-sm",children:U.message})]})]},U.id)),a.jsx("div",{ref:j,className:"h-4"})]})})})]})})}const fme="Mai-with-u",mme="plugin-repo",pme="main",gme="plugin_details.json";async function xme(){try{const t=await ot("/api/webui/plugins/fetch-raw",{method:"POST",headers:bt(),body:JSON.stringify({owner:fme,repo:mme,branch:pme,file_path:gme})});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success||!e.data)throw new Error(e.error||"获取插件列表失败");return JSON.parse(e.data).filter(s=>!s?.id||!s?.manifest?(console.warn("跳过无效插件数据:",s),!1):!s.manifest.name||!s.manifest.version?(console.warn("跳过缺少必需字段的插件:",s.id),!1):!0).map(s=>({id:s.id,manifest:{manifest_version:s.manifest.manifest_version||1,name:s.manifest.name,version:s.manifest.version,description:s.manifest.description||"",author:s.manifest.author||{name:"Unknown"},license:s.manifest.license||"Unknown",host_application:s.manifest.host_application||{min_version:"0.0.0"},homepage_url:s.manifest.homepage_url,repository_url:s.manifest.repository_url,keywords:s.manifest.keywords||[],categories:s.manifest.categories||[],default_locale:s.manifest.default_locale||"zh-CN",locales_path:s.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(t){throw console.error("Failed to fetch plugin list:",t),t}}async function vme(){try{const t=await ot("/api/webui/plugins/git-status");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to check Git status:",t),{installed:!1,error:"无法检测 Git 安装状态"}}}async function yme(){try{const t=await ot("/api/webui/plugins/version");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to get Maimai version:",t),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function bme(t,e,n){const r=t.split(".").map(c=>parseInt(c)||0),s=r[0]||0,i=r[1]||0,l=r[2]||0;if(n.version_majorparseInt(p)||0),d=c[0]||0,h=c[1]||0,m=c[2]||0;if(n.version_major>d||n.version_major===d&&n.version_minor>h||n.version_major===d&&n.version_minor===h&&n.version_patch>m)return!1}return!0}function wme(t,e){const n=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host,s=new WebSocket(`${n}//${r}/api/webui/ws/plugin-progress`);return s.onopen=()=>{console.log("Plugin progress WebSocket connected");const i=setInterval(()=>{s.readyState===WebSocket.OPEN?s.send("ping"):clearInterval(i)},3e4)},s.onmessage=i=>{try{if(i.data==="pong")return;const l=JSON.parse(i.data);t(l)}catch(l){console.error("Failed to parse progress data:",l)}},s.onerror=i=>{console.error("Plugin progress WebSocket error:",i),e?.(i)},s.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},s}async function Lp(){try{const t=await ot("/api/webui/plugins/installed",{headers:bt()});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success)throw new Error(e.message||"获取已安装插件列表失败");return e.plugins||[]}catch(t){return console.error("Failed to get installed plugins:",t),[]}}function Ip(t,e){return e.some(n=>n.id===t)}function qp(t,e){const n=e.find(r=>r.id===t);if(n)return n.manifest?.version||n.version}async function Sme(t,e,n="main"){const r=await ot("/api/webui/plugins/install",{method:"POST",headers:bt(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"安装失败")}return await r.json()}async function kme(t){const e=await ot("/api/webui/plugins/uninstall",{method:"POST",headers:bt(),body:JSON.stringify({plugin_id:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"卸载失败")}return await e.json()}async function Ome(t,e,n="main"){const r=await ot("/api/webui/plugins/update",{method:"POST",headers:bt(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"更新失败")}return await r.json()}const C0="https://maibot-plugin-stats.maibot-webui.workers.dev";async function zz(t){try{const e=await fetch(`${C0}/stats/${t}`);return e.ok?await e.json():(console.error("Failed to fetch plugin stats:",e.statusText),null)}catch(e){return console.error("Error fetching plugin stats:",e),null}}async function jme(t,e){try{const n=e||K5(),r=await fetch(`${C0}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点赞失败"}}catch(n){return console.error("Error liking plugin:",n),{success:!1,error:"网络错误"}}}async function Nme(t,e){try{const n=e||K5(),r=await fetch(`${C0}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点踩失败"}}catch(n){return console.error("Error disliking plugin:",n),{success:!1,error:"网络错误"}}}async function Cme(t,e,n,r){if(e<1||e>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const s=r||K5(),i=await fetch(`${C0}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,rating:e,comment:n,user_id:s})}),l=await i.json();return i.status===429?{success:!1,error:"每天最多评分 3 次"}:i.ok?{success:!0,...l}:{success:!1,error:l.error||"评分失败"}}catch(s){return console.error("Error rating plugin:",s),{success:!1,error:"网络错误"}}}async function Tme(t){try{const e=await fetch(`${C0}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t})}),n=await e.json();return e.status===429?(console.warn("Download recording rate limited"),{success:!0}):e.ok?{success:!0,...n}:(console.error("Failed to record download:",n.error),{success:!1,error:n.error})}catch(e){return console.error("Error recording download:",e),{success:!1,error:"网络错误"}}}function Ame(){const t=navigator,e=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,t.deviceMemory||0].join("|");let n=0;for(let r=0;r{i(!0);const j=await zz(t);j&&r(j),i(!1)};S.useEffect(()=>{v()},[t]);const b=async()=>{const j=await jme(t);j.success?(x({title:"已点赞",description:"感谢你的支持!"}),v()):x({title:"点赞失败",description:j.error||"未知错误",variant:"destructive"})},k=async()=>{const j=await Nme(t);j.success?(x({title:"已反馈",description:"感谢你的反馈!"}),v()):x({title:"操作失败",description:j.error||"未知错误",variant:"destructive"})},O=async()=>{if(l===0){x({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const j=await Cme(t,l,d||void 0);j.success?(x({title:"评分成功",description:"感谢你的评价!"}),p(!1),c(0),h(""),v()):x({title:"评分失败",description:j.error||"未知错误",variant:"destructive"})};return s?a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:"-"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Jl,{className:"h-4 w-4"}),a.jsx("span",{children:"-"})]})]}):n?e?a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${n.downloads.toLocaleString()}`,children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:n.downloads.toLocaleString()})]}),a.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${n.rating.toFixed(1)} (${n.rating_count} 条评价)`,children:[a.jsx(Jl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsx("span",{children:n.rating.toFixed(1)})]}),a.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${n.likes}`,children:[a.jsx(my,{className:"h-4 w-4"}),a.jsx("span",{children:n.likes})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(fc,{className:"h-5 w-5 text-muted-foreground mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.downloads.toLocaleString()}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(Jl,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),a.jsx("span",{className:"text-2xl font-bold",children:n.rating.toFixed(1)}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.rating_count," 条评价"]})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(my,{className:"h-5 w-5 text-green-500 mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.likes}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(dO,{className:"h-5 w-5 text-red-500 mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.dislikes}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:b,children:[a.jsx(my,{className:"h-4 w-4 mr-1"}),"点赞"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:k,children:[a.jsx(dO,{className:"h-4 w-4 mr-1"}),"点踩"]}),a.jsxs(Rr,{open:m,onOpenChange:p,children:[a.jsx(mw,{asChild:!0,children:a.jsxs(ie,{variant:"default",size:"sm",children:[a.jsx(Jl,{className:"h-4 w-4 mr-1"}),"评分"]})}),a.jsxs(Nr,{children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"为插件评分"}),a.jsx(Gr,{children:"分享你的使用体验,帮助其他用户"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(j=>a.jsx("button",{onClick:()=>c(j),className:"focus:outline-none",children:a.jsx(Jl,{className:`h-8 w-8 transition-colors ${j<=l?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},j))}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[l===0&&"点击星星进行评分",l===1&&"很差",l===2&&"一般",l===3&&"还行",l===4&&"不错",l===5&&"非常好"]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),a.jsx(_n,{value:d,onChange:j=>h(j.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[d.length," / 500"]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>p(!1),children:"取消"}),a.jsx(ie,{onClick:O,disabled:l===0,children:"提交评分"})]})]})]})]}),n.recent_ratings&&n.recent_ratings.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),a.jsx("div",{className:"space-y-3",children:n.recent_ratings.map((j,T)=>a.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(A=>a.jsx(Jl,{className:`h-3 w-3 ${A<=j.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},A))}),a.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(j.created_at).toLocaleDateString()})]}),j.comment&&a.jsx("p",{className:"text-sm text-muted-foreground",children:j.comment})]},T))})]})]}):null}const a9={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function Eme(){const t=wa(),[e,n]=S.useState(null),[r,s]=S.useState(""),[i,l]=S.useState("all"),[c,d]=S.useState("all"),[h,m]=S.useState(!0),[p,x]=S.useState([]),[v,b]=S.useState(!0),[k,O]=S.useState(null),[j,T]=S.useState(null),[A,_]=S.useState(null),[D,E]=S.useState(null),[,z]=S.useState([]),[Q,F]=S.useState({}),{toast:L}=Pr(),U=async R=>{const me=R.map(async K=>{try{const H=await zz(K.id);return{id:K.id,stats:H}}catch(H){return console.warn(`Failed to load stats for ${K.id}:`,H),{id:K.id,stats:null}}}),Y=await Promise.all(me),P={};Y.forEach(({id:K,stats:H})=>{H&&(P[K]=H)}),F(P)};S.useEffect(()=>{let R=null,me=!1;return(async()=>{if(R=wme(P=>{me||(_(P),P.stage==="success"?setTimeout(()=>{me||_(null)},2e3):P.stage==="error"&&(b(!1),O(P.error||"加载失败")))},P=>{console.error("WebSocket error:",P),me||L({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(P=>{if(!R){P();return}const K=()=>{R&&R.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),P()):R&&R.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),P()):setTimeout(K,100)};K()}),!me){const P=await vme();T(P),P.installed||L({title:"Git 未安装",description:P.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!me){const P=await yme();E(P)}if(!me)try{b(!0),O(null);const P=await xme();if(!me){const K=await Lp();z(K);const H=P.map(fe=>{const ve=Ip(fe.id,K),Re=qp(fe.id,K);return{...fe,installed:ve,installed_version:Re}});for(const fe of K)!H.some(Re=>Re.id===fe.id)&&fe.manifest&&H.push({id:fe.id,manifest:{manifest_version:fe.manifest.manifest_version||1,name:fe.manifest.name,version:fe.manifest.version,description:fe.manifest.description||"",author:fe.manifest.author,license:fe.manifest.license||"Unknown",host_application:fe.manifest.host_application,homepage_url:fe.manifest.homepage_url,repository_url:fe.manifest.repository_url,keywords:fe.manifest.keywords||[],categories:fe.manifest.categories||[],default_locale:fe.manifest.default_locale||"zh-CN",locales_path:fe.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:fe.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});x(H),U(H)}}catch(P){if(!me){const K=P instanceof Error?P.message:"加载插件列表失败";O(K),L({title:"加载失败",description:K,variant:"destructive"})}}finally{me||b(!1)}})(),()=>{me=!0,R&&R.close()}},[L]);const V=R=>{if(!R.installed&&D&&!ce(R))return a.jsxs(On,{variant:"destructive",className:"gap-1",children:[a.jsx(xc,{className:"h-3 w-3"}),"不兼容"]});if(R.installed){const me=R.installed_version?.trim(),Y=R.manifest.version?.trim();if(me!==Y){const P=me?.split(".").map(Number)||[0,0,0],K=Y?.split(".").map(Number)||[0,0,0];for(let H=0;H<3;H++){if((K[H]||0)>(P[H]||0))return a.jsxs(On,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[a.jsx(xc,{className:"h-3 w-3"}),"可更新"]});if((K[H]||0)<(P[H]||0))break}}return a.jsxs(On,{variant:"default",className:"gap-1",children:[a.jsx(Es,{className:"h-3 w-3"}),"已安装"]})}return null},ce=R=>!D||!R.manifest?.host_application?!0:bme(R.manifest.host_application.min_version,R.manifest.host_application.max_version,D),W=R=>{if(!R.installed||!R.installed_version||!R.manifest?.version)return!1;const me=R.installed_version.trim(),Y=R.manifest.version.trim();if(me===Y)return!1;const P=me.split(".").map(Number),K=Y.split(".").map(Number);for(let H=0;H<3;H++){if((K[H]||0)>(P[H]||0))return!0;if((K[H]||0)<(P[H]||0))return!1}return!1},J=p.filter(R=>{if(!R.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",R.id),!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(H=>H.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i);let P=!0;c==="installed"?P=R.installed===!0:c==="updates"&&(P=R.installed===!0&&W(R));const K=!h||!D||ce(R);return me&&Y&&P&&K}),$=()=>{n(null)},ae=async R=>{if(!j?.installed){L({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(D&&!ce(R)){L({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await Sme(R.id,R.manifest.repository_url||"","main"),Tme(R.id).catch(Y=>{console.warn("Failed to record download:",Y)}),L({title:"安装成功",description:`${R.manifest.name} 已成功安装`});const me=await Lp();z(me),x(Y=>Y.map(P=>{if(P.id===R.id){const K=Ip(P.id,me),H=qp(P.id,me);return{...P,installed:K,installed_version:H}}return P}))}catch(me){L({title:"安装失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}},ne=async R=>{try{await kme(R.id),L({title:"卸载成功",description:`${R.manifest.name} 已成功卸载`});const me=await Lp();z(me),x(Y=>Y.map(P=>{if(P.id===R.id){const K=Ip(P.id,me),H=qp(P.id,me);return{...P,installed:K,installed_version:H}}return P}))}catch(me){L({title:"卸载失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}},ue=async R=>{if(!j?.installed){L({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const me=await Ome(R.id,R.manifest.repository_url||"","main");L({title:"更新成功",description:`${R.manifest.name} 已从 ${me.old_version} 更新到 ${me.new_version}`});const Y=await Lp();z(Y),x(P=>P.map(K=>{if(K.id===R.id){const H=Ip(K.id,Y),fe=qp(K.id,Y);return{...K,installed:H,installed_version:fe}}return K}))}catch(me){L({title:"更新失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}};return a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),a.jsxs(ie,{onClick:()=>t({to:"/plugin-mirrors"}),children:[a.jsx(Cq,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),j&&!j.installed&&a.jsxs(gt,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[a.jsx(Wt,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Hu,{className:"h-5 w-5 text-orange-600"}),a.jsxs("div",{children:[a.jsx(Gt,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),a.jsx(Sr,{className:"text-orange-800 dark:text-orange-200",children:j.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),a.jsx(an,{children:a.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",a.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索插件...",value:r,onChange:R=>s(R.target.value),className:"pl-9"})]}),a.jsxs(Lt,{value:i,onValueChange:l,children:[a.jsx(Dt,{className:"w-full sm:w-[200px]",children:a.jsx(It,{placeholder:"选择分类"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部分类"}),a.jsx(Pe,{value:"Group Management",children:"群组管理"}),a.jsx(Pe,{value:"Entertainment & Interaction",children:"娱乐互动"}),a.jsx(Pe,{value:"Utility Tools",children:"实用工具"}),a.jsx(Pe,{value:"Content Generation",children:"内容生成"}),a.jsx(Pe,{value:"Multimedia",children:"多媒体"}),a.jsx(Pe,{value:"External Integration",children:"外部集成"}),a.jsx(Pe,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),a.jsx(Pe,{value:"Other",children:"其他"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"compatible-only",checked:h,onCheckedChange:R=>m(R===!0)}),a.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),a.jsx(hl,{value:c,onValueChange:d,className:"w-full",children:a.jsxs(ya,{className:"grid w-full grid-cols-3",children:[a.jsxs($t,{value:"all",children:["全部插件 (",p.filter(R=>{if(!R.manifest)return!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(K=>K.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),P=!h||!D||ce(R);return me&&Y&&P}).length,")"]}),a.jsxs($t,{value:"installed",children:["已安装 (",p.filter(R=>{if(!R.manifest)return!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(K=>K.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),P=!h||!D||ce(R);return R.installed&&me&&Y&&P}).length,")"]}),a.jsxs($t,{value:"updates",children:["可更新 (",p.filter(R=>{if(!R.manifest)return!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(K=>K.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),P=!h||!D||ce(R);return R.installed&&W(R)&&me&&Y&&P}).length,")"]})]})}),A&&A.stage==="loading"&&a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(hf,{className:"h-4 w-4 animate-spin"}),a.jsxs("span",{className:"text-sm font-medium",children:[A.operation==="fetch"&&"加载插件列表",A.operation==="install"&&`安装插件${A.plugin_id?`: ${A.plugin_id}`:""}`,A.operation==="uninstall"&&`卸载插件${A.plugin_id?`: ${A.plugin_id}`:""}`,A.operation==="update"&&`更新插件${A.plugin_id?`: ${A.plugin_id}`:""}`]})]}),a.jsxs("span",{className:"text-sm font-medium",children:[A.progress,"%"]})]}),a.jsx(n0,{value:A.progress,className:"h-2"}),a.jsx("div",{className:"text-xs text-muted-foreground",children:A.message}),A.operation==="fetch"&&A.total_plugins>0&&a.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",A.loaded_plugins," / ",A.total_plugins," 个插件"]})]})}),A&&A.stage==="error"&&A.error&&a.jsx(gt,{className:"border-destructive bg-destructive/10",children:a.jsx(Wt,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Hu,{className:"h-5 w-5 text-destructive"}),a.jsxs("div",{children:[a.jsx(Gt,{className:"text-lg text-destructive",children:"加载失败"}),a.jsx(Sr,{className:"text-destructive/80",children:A.error})]})]})})}),v?a.jsxs("div",{className:"flex items-center justify-center py-12",children:[a.jsx(hf,{className:"h-8 w-8 animate-spin text-muted-foreground"}),a.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):k?a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Hu,{className:"h-12 w-12 text-destructive mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:k}),a.jsx(ie,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):J.length===0?a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Bs,{className:"h-12 w-12 text-muted-foreground mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:r||i!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:J.map(R=>a.jsxs(gt,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[a.jsxs(Wt,{children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx(Gt,{className:"text-xl",children:R.manifest?.name||R.id}),a.jsxs("div",{className:"flex flex-col gap-1",children:[R.manifest?.categories&&R.manifest.categories[0]&&a.jsx(On,{variant:"secondary",className:"text-xs whitespace-nowrap",children:a9[R.manifest.categories[0]]||R.manifest.categories[0]}),V(R)]})]}),a.jsx(Sr,{className:"line-clamp-2",children:R.manifest?.description||"无描述"})]}),a.jsx(an,{className:"flex-1",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:(Q[R.id]?.downloads??R.downloads??0).toLocaleString()})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Jl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsx("span",{children:(Q[R.id]?.rating??R.rating??0).toFixed(1)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[R.manifest?.keywords&&R.manifest.keywords.slice(0,3).map(me=>a.jsx(On,{variant:"outline",className:"text-xs",children:me},me)),R.manifest?.keywords&&R.manifest.keywords.length>3&&a.jsxs(On,{variant:"outline",className:"text-xs",children:["+",R.manifest.keywords.length-3]})]}),a.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[a.jsxs("div",{children:["v",R.manifest?.version||"unknown"," · ",R.manifest?.author?.name||"Unknown"]}),R.manifest?.host_application&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{children:"支持:"}),a.jsxs("span",{className:"font-medium",children:[R.manifest.host_application.min_version,R.manifest.host_application.max_version?` - ${R.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),a.jsx(bC,{className:"pt-4",children:a.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>n(R),children:"查看详情"}),R.installed?W(R)?a.jsxs(ie,{size:"sm",disabled:!j?.installed,title:j?.installed?void 0:"Git 未安装",onClick:()=>ue(R),children:[a.jsx(Fi,{className:"h-4 w-4 mr-1"}),"更新"]}):a.jsxs(ie,{variant:"destructive",size:"sm",disabled:!j?.installed,title:j?.installed?void 0:"Git 未安装",onClick:()=>ne(R),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"卸载"]}):a.jsxs(ie,{size:"sm",disabled:!j?.installed||A?.operation==="install"||D!==null&&!ce(R),title:j?.installed?D!==null&&!ce(R)?`不兼容当前版本 (需要 ${R.manifest?.host_application?.min_version||"未知"}${R.manifest?.host_application?.max_version?` - ${R.manifest.host_application.max_version}`:"+"},当前 ${D?.version})`:void 0:"Git 未安装",onClick:()=>ae(R),children:[a.jsx(fc,{className:"h-4 w-4 mr-1"}),A?.operation==="install"&&A?.plugin_id===R.id?"安装中...":"安装"]})]})})]},R.id))}),a.jsx(Rr,{open:e!==null,onOpenChange:$,children:e&&e.manifest&&a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsx(Cr,{children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"space-y-2 flex-1",children:[a.jsx(Tr,{className:"text-2xl",children:e.manifest.name}),a.jsxs(Gr,{children:["作者: ",e.manifest.author?.name||"Unknown",e.manifest.author?.url&&a.jsx("a",{href:e.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:a.jsx(Yh,{className:"h-3 w-3 inline"})})]})]}),a.jsxs("div",{className:"flex flex-col gap-2",children:[e.manifest.categories&&e.manifest.categories[0]&&a.jsx(On,{variant:"secondary",children:a9[e.manifest.categories[0]]||e.manifest.categories[0]}),V(e)]})]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(Mme,{pluginId:e.id}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"版本"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",e.manifest?.version||"unknown"]}),e.installed&&e.installed_version&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",e.installed_version]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"下载量"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:(Q[e.id]?.downloads??e.downloads??0).toLocaleString()})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"评分"}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Jl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[(Q[e.id]?.rating??e.rating??0).toFixed(1)," (",Q[e.id]?.rating_count??e.review_count??0,")"]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"许可证"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.license||"Unknown"})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.manifest.host_application?.min_version||"未知",e.manifest.host_application?.max_version?` - ${e.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:e.manifest.keywords&&e.manifest.keywords.map(R=>a.jsx(On,{variant:"outline",children:R},R))})]}),e.detailed_description&&a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),a.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:e.detailed_description})]}),!e.detailed_description&&a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.description||"无描述"})]}),a.jsxs("div",{className:"space-y-2",children:[e.manifest.homepage_url&&a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium",children:"主页: "}),a.jsx("a",{href:e.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.homepage_url})]}),e.manifest.repository_url&&a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium",children:"仓库: "}),a.jsx("a",{href:e.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.repository_url})]})]})]}),a.jsxs(ps,{children:[e.manifest.homepage_url&&a.jsxs(ie,{onClick:()=>window.open(e.manifest.homepage_url,"_blank"),children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"访问主页"]}),e.manifest.repository_url&&a.jsxs(ie,{variant:"outline",onClick:()=>window.open(e.manifest.repository_url,"_blank"),children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function _me(){return a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(Fi,{className:"h-4 w-4 mr-2"}),"刷新"]}),a.jsxs(ie,{size:"sm",children:[a.jsx(Ii,{className:"h-4 w-4 mr-2"}),"全局设置"]})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"已安装插件"}),a.jsx(pg,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"正在加载..."})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"已启用"}),a.jsx(Es,{className:"h-4 w-4 text-green-600"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"已禁用"}),a.jsx(xc,{className:"h-4 w-4 text-orange-600"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"可更新"}),a.jsx(Fi,{className:"h-4 w-4 text-blue-600"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"有新版本可用"})]})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"已安装的插件"}),a.jsx(Sr,{children:"查看和管理已安装插件的配置"})]}),a.jsx(an,{children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[a.jsx(pg,{className:"h-16 w-16 text-muted-foreground/50"}),a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"插件配置功能开发中"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"即将支持插件的启用/禁用、参数配置等功能"})]}),a.jsx("div",{className:"flex gap-2",children:a.jsx(ie,{variant:"outline",asChild:!0,children:a.jsxs("a",{href:"/plugins",children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"前往插件市场"]})})})]})})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(gt,{children:[a.jsx(Wt,{children:a.jsx(Gt,{className:"text-base",children:"即将推出的功能"})}),a.jsx(an,{children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"插件启用/禁用"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"快速切换插件运行状态"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"配置参数编辑"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"可视化编辑插件配置文件"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"依赖管理"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"查看和安装插件依赖包"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"插件日志"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"查看插件运行日志和错误信息"})]})]})]})})]}),a.jsxs(gt,{children:[a.jsx(Wt,{children:a.jsx(Gt,{className:"text-base",children:"开发者工具"})}),a.jsx(an,{children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"热重载"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"无需重启即可重新加载插件"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"配置验证"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查配置文件格式和完整性"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"性能监控"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"监控插件的资源占用情况"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"调试模式"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"详细的调试信息和错误追踪"})]})]})]})})]})]}),a.jsx(gt,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:a.jsx(an,{className:"pt-6",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(xc,{className:"h-5 w-5 text-blue-600 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"开发进行中"}),a.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["插件配置功能正在积极开发中。目前您可以通过",a.jsx("strong",{children:"插件市场"}),"安装和卸载插件,完整的配置管理功能即将推出。"]})]})]})})})]})})}function Dme(){const t=wa(),{toast:e}=Pr(),[n,r]=S.useState([]),[s,i]=S.useState(!0),[l,c]=S.useState(null),[d,h]=S.useState(null),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O=S.useCallback(async()=>{try{i(!0),c(null);const z=localStorage.getItem("access-token"),Q=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${z}`}});if(!Q.ok)throw new Error("获取镜像源列表失败");const F=await Q.json();r(F.mirrors||[])}catch(z){const Q=z instanceof Error?z.message:"加载镜像源失败";c(Q),e({title:"加载失败",description:Q,variant:"destructive"})}finally{i(!1)}},[e]);S.useEffect(()=>{O()},[O]);const j=async()=>{try{const z=localStorage.getItem("access-token"),Q=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${z}`,"Content-Type":"application/json"},body:JSON.stringify(b)});if(!Q.ok){const F=await Q.json();throw new Error(F.detail||"添加镜像源失败")}e({title:"添加成功",description:"镜像源已添加"}),p(!1),k({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O()}catch(z){e({title:"添加失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"})}},T=async()=>{if(d)try{const z=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${d.id}`,{method:"PUT",headers:{Authorization:`Bearer ${z}`,"Content-Type":"application/json"},body:JSON.stringify({name:b.name,raw_prefix:b.raw_prefix,clone_prefix:b.clone_prefix,enabled:b.enabled,priority:b.priority})})).ok)throw new Error("更新镜像源失败");e({title:"更新成功",description:"镜像源已更新"}),v(!1),h(null),O()}catch(z){e({title:"更新失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"})}},A=async z=>{if(confirm("确定要删除这个镜像源吗?"))try{const Q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z}`,{method:"DELETE",headers:{Authorization:`Bearer ${Q}`}})).ok)throw new Error("删除镜像源失败");e({title:"删除成功",description:"镜像源已删除"}),O()}catch(Q){e({title:"删除失败",description:Q instanceof Error?Q.message:"未知错误",variant:"destructive"})}},_=async z=>{try{const Q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z.id}`,{method:"PUT",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!z.enabled})})).ok)throw new Error("更新状态失败");O()}catch(Q){e({title:"更新失败",description:Q instanceof Error?Q.message:"未知错误",variant:"destructive"})}},D=z=>{h(z),k({id:z.id,name:z.name,raw_prefix:z.raw_prefix,clone_prefix:z.clone_prefix,enabled:z.enabled,priority:z.priority}),v(!0)},E=async(z,Q)=>{const F=Q==="up"?z.priority-1:z.priority+1;if(!(F<1))try{const L=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z.id}`,{method:"PUT",headers:{Authorization:`Bearer ${L}`,"Content-Type":"application/json"},body:JSON.stringify({priority:F})})).ok)throw new Error("更新优先级失败");O()}catch(L){e({title:"更新失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}};return a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>t({to:"/plugins"}),children:a.jsx(R9,{className:"h-5 w-5"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),a.jsxs(ie,{onClick:()=>p(!0),children:[a.jsx(Wr,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),s?a.jsx(gt,{className:"p-6",children:a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(hf,{className:"h-8 w-8 animate-spin text-primary"})})}):l?a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Hu,{className:"h-12 w-12 text-destructive mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:l}),a.jsx(ie,{onClick:O,children:"重新加载"})]})}):a.jsxs(gt,{children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{children:"状态"}),a.jsx(xt,{children:"名称"}),a.jsx(xt,{children:"ID"}),a.jsx(xt,{children:"优先级"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n.map(z=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(jt,{checked:z.enabled,onCheckedChange:()=>_(z)})}),a.jsx(it,{children:a.jsxs("div",{children:[a.jsx("div",{className:"font-medium",children:z.name}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",z.raw_prefix]})]})}),a.jsx(it,{children:a.jsx(On,{variant:"outline",children:z.id})}),a.jsx(it,{children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-mono",children:z.priority}),a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx(ie,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(z,"up"),disabled:z.priority===1,children:a.jsx(e2,{className:"h-3 w-3"})}),a.jsx(ie,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(z,"down"),children:a.jsx(df,{className:"h-3 w-3"})})]})]})}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>D(z),children:a.jsx(nd,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>A(z.id),children:a.jsx(Ht,{className:"h-4 w-4 text-destructive"})})]})})]},z.id))})]})}),a.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(z=>a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:"font-semibold",children:z.name}),z.enabled&&a.jsx(On,{variant:"default",className:"text-xs",children:"启用"})]}),a.jsx(On,{variant:"outline",className:"mt-1 text-xs",children:z.id})]}),a.jsx(jt,{checked:z.enabled,onCheckedChange:()=>_(z)})]}),a.jsxs("div",{className:"text-sm space-y-1",children:[a.jsxs("div",{className:"text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"Raw: "}),a.jsx("span",{className:"break-all",children:z.raw_prefix})]}),a.jsxs("div",{className:"text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"优先级: "}),a.jsx("span",{className:"font-mono",children:z.priority})]})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[a.jsxs(ie,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>D(z),children:[a.jsx(nd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>E(z,"up"),disabled:z.priority===1,children:a.jsx(e2,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>E(z,"down"),children:a.jsx(df,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"destructive",size:"sm",onClick:()=>A(z.id),children:a.jsx(Ht,{className:"h-4 w-4"})})]})]})},z.id))})]}),a.jsx(Rr,{open:m,onOpenChange:p,children:a.jsxs(Nr,{className:"max-w-lg",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"添加镜像源"}),a.jsx(Gr,{children:"添加新的 Git 镜像源配置"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-id",children:"镜像源 ID *"}),a.jsx(Me,{id:"add-id",placeholder:"例如: my-mirror",value:b.id,onChange:z=>k({...b,id:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-name",children:"名称 *"}),a.jsx(Me,{id:"add-name",placeholder:"例如: 我的镜像源",value:b.name,onChange:z=>k({...b,name:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),a.jsx(Me,{id:"add-raw",placeholder:"https://example.com/raw",value:b.raw_prefix,onChange:z=>k({...b,raw_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-clone",children:"克隆前缀 *"}),a.jsx(Me,{id:"add-clone",placeholder:"https://example.com/clone",value:b.clone_prefix,onChange:z=>k({...b,clone_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-priority",children:"优先级"}),a.jsx(Me,{id:"add-priority",type:"number",min:"1",value:b.priority,onChange:z=>k({...b,priority:parseInt(z.target.value)||1})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"add-enabled",checked:b.enabled,onCheckedChange:z=>k({...b,enabled:z})}),a.jsx(te,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>p(!1),children:"取消"}),a.jsx(ie,{onClick:j,children:"添加"})]})]})}),a.jsx(Rr,{open:x,onOpenChange:v,children:a.jsxs(Nr,{className:"max-w-lg",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑镜像源"}),a.jsx(Gr,{children:"修改镜像源配置"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"镜像源 ID"}),a.jsx(Me,{value:b.id,disabled:!0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-name",children:"名称 *"}),a.jsx(Me,{id:"edit-name",value:b.name,onChange:z=>k({...b,name:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),a.jsx(Me,{id:"edit-raw",value:b.raw_prefix,onChange:z=>k({...b,raw_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-clone",children:"克隆前缀 *"}),a.jsx(Me,{id:"edit-clone",value:b.clone_prefix,onChange:z=>k({...b,clone_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-priority",children:"优先级"}),a.jsx(Me,{id:"edit-priority",type:"number",min:"1",value:b.priority,onChange:z=>k({...b,priority:parseInt(z.target.value)||1})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"edit-enabled",checked:b.enabled,onCheckedChange:z=>k({...b,enabled:z})}),a.jsx(te,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>v(!1),children:"取消"}),a.jsx(ie,{onClick:T,children:"保存"})]})]})})]})})}const Rme=Nd("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),Pz=S.forwardRef(({className:t,size:e,abbrTitle:n,children:r,...s},i)=>a.jsx("kbd",{className:ye(Rme({size:e,className:t})),ref:i,...s,children:n?a.jsx("abbr",{title:n,children:r}):r}));Pz.displayName="Kbd";const zme=[{icon:hg,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:ao,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:z9,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:P9,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:K4,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Wf,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:B9,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:Tq,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:pg,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:fg,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:Ii,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function Pme({open:t,onOpenChange:e}){const[n,r]=S.useState(""),[s,i]=S.useState(0),l=wa(),c=zme.filter(m=>m.title.toLowerCase().includes(n.toLowerCase())||m.description.toLowerCase().includes(n.toLowerCase())||m.category.toLowerCase().includes(n.toLowerCase()));S.useEffect(()=>{t&&(r(""),i(0))},[t]);const d=S.useCallback(m=>{l({to:m}),e(!1)},[l,e]),h=S.useCallback(m=>{m.key==="ArrowDown"?(m.preventDefault(),i(p=>(p+1)%c.length)):m.key==="ArrowUp"?(m.preventDefault(),i(p=>(p-1+c.length)%c.length)):m.key==="Enter"&&c[s]&&(m.preventDefault(),d(c[s].path))},[c,s,d]);return a.jsx(Rr,{open:t,onOpenChange:e,children:a.jsxs(Nr,{className:"max-w-2xl p-0 gap-0",children:[a.jsxs(Cr,{className:"px-4 pt-4 pb-0",children:[a.jsx(Tr,{className:"sr-only",children:"搜索"}),a.jsxs("div",{className:"relative",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),a.jsx(Me,{value:n,onChange:m=>{r(m.target.value),i(0)},onKeyDown:h,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),a.jsx("div",{className:"border-t",children:a.jsx(mn,{className:"h-[400px]",children:c.length>0?a.jsx("div",{className:"p-2",children:c.map((m,p)=>{const x=m.icon;return a.jsxs("button",{onClick:()=>d(m.path),onMouseEnter:()=>i(p),className:ye("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",p===s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[a.jsx(x,{className:"h-5 w-5 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium text-sm",children:m.title}),a.jsx("div",{className:"text-xs text-muted-foreground truncate",children:m.description})]}),a.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:m.category})]},m.path)})}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx(Bs,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),a.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function Bme(t){const e=Lme(t),n=S.forwardRef((r,s)=>{const{children:i,...l}=r,c=S.Children.toArray(i),d=c.find(qme);if(d){const h=d.props.children,m=c.map(p=>p===d?S.Children.count(h)>1?S.Children.only(null):S.isValidElement(h)?h.props.children:null:p);return a.jsx(e,{...l,ref:s,children:S.isValidElement(h)?S.cloneElement(h,void 0,m):null})}return a.jsx(e,{...l,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function Lme(t){const e=S.forwardRef((n,r)=>{const{children:s,...i}=n;if(S.isValidElement(s)){const l=Qme(s),c=Fme(i,s.props);return s.type!==S.Fragment&&(c.ref=r?oo(r,l):l),S.cloneElement(s,c)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Ime=Symbol("radix.slottable");function qme(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Ime}function Fme(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...c)=>{const d=i(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function Qme(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var z4=["Enter"," "],$me=["ArrowDown","PageUp","Home"],Bz=["ArrowUp","PageDown","End"],Hme=[...$me,...Bz],Ume={ltr:[...z4,"ArrowRight"],rtl:[...z4,"ArrowLeft"]},Vme={ltr:["ArrowLeft"],rtl:["ArrowRight"]},T0="Menu",[$f,Wme,Gme]=tx(T0),[Lc,Lz]=Vi(T0,[Gme,wd,fx]),A0=wd(),Iz=fx(),[qz,Eo]=Lc(T0),[Xme,M0]=Lc(T0),Fz=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:l=!0}=t,c=A0(e),[d,h]=S.useState(null),m=S.useRef(!1),p=es(i),x=Vf(s);return S.useEffect(()=>{const v=()=>{m.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>m.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),a.jsx(ix,{...c,children:a.jsx(qz,{scope:e,open:n,onOpenChange:p,content:d,onContentChange:h,children:a.jsx(Xme,{scope:e,onClose:S.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:m,dir:x,modal:l,children:r})})})};Fz.displayName=T0;var Yme="MenuAnchor",Z5=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=A0(n);return a.jsx(ax,{...s,...r,ref:e})});Z5.displayName=Yme;var J5="MenuPortal",[Kme,Qz]=Lc(J5,{forceMount:void 0}),$z=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=Eo(J5,e);return a.jsx(Kme,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};$z.displayName=J5;var Ci="MenuContent",[Zme,e3]=Lc(Ci),Hz=S.forwardRef((t,e)=>{const n=Qz(Ci,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Eo(Ci,t.__scopeMenu),l=M0(Ci,t.__scopeMenu);return a.jsx($f.Provider,{scope:t.__scopeMenu,children:a.jsx(Ls,{present:r||i.open,children:a.jsx($f.Slot,{scope:t.__scopeMenu,children:l.modal?a.jsx(Jme,{...s,ref:e}):a.jsx(epe,{...s,ref:e})})})})}),Jme=S.forwardRef((t,e)=>{const n=Eo(Ci,t.__scopeMenu),r=S.useRef(null),s=Cn(e,r);return S.useEffect(()=>{const i=r.current;if(i)return j9(i)},[]),a.jsx(t3,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:$e(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),epe=S.forwardRef((t,e)=>{const n=Eo(Ci,t.__scopeMenu);return a.jsx(t3,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),tpe=Bme("MenuContent.ScrollLock"),t3=S.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:d,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:x,onDismiss:v,disableOutsideScroll:b,...k}=t,O=Eo(Ci,n),j=M0(Ci,n),T=A0(n),A=Iz(n),_=Wme(n),[D,E]=S.useState(null),z=S.useRef(null),Q=Cn(e,z,O.onContentChange),F=S.useRef(0),L=S.useRef(""),U=S.useRef(0),V=S.useRef(null),ce=S.useRef("right"),W=S.useRef(0),J=b?N9:S.Fragment,$=b?{as:tpe,allowPinchZoom:!0}:void 0,ae=ue=>{const R=L.current+ue,me=_().filter(ve=>!ve.disabled),Y=document.activeElement,P=me.find(ve=>ve.ref.current===Y)?.textValue,K=me.map(ve=>ve.textValue),H=fpe(K,R,P),fe=me.find(ve=>ve.textValue===H)?.ref.current;(function ve(Re){L.current=Re,window.clearTimeout(F.current),Re!==""&&(F.current=window.setTimeout(()=>ve(""),1e3))})(R),fe&&setTimeout(()=>fe.focus())};S.useEffect(()=>()=>window.clearTimeout(F.current),[]),C9();const ne=S.useCallback(ue=>ce.current===V.current?.side&&ppe(ue,V.current?.area),[]);return a.jsx(Zme,{scope:n,searchRef:L,onItemEnter:S.useCallback(ue=>{ne(ue)&&ue.preventDefault()},[ne]),onItemLeave:S.useCallback(ue=>{ne(ue)||(z.current?.focus(),E(null))},[ne]),onTriggerLeave:S.useCallback(ue=>{ne(ue)&&ue.preventDefault()},[ne]),pointerGraceTimerRef:U,onPointerGraceIntentChange:S.useCallback(ue=>{V.current=ue},[]),children:a.jsx(J,{...$,children:a.jsx(T9,{asChild:!0,trapped:s,onMountAutoFocus:$e(i,ue=>{ue.preventDefault(),z.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:x,onDismiss:v,children:a.jsx(NC,{asChild:!0,...A,dir:j.dir,orientation:"vertical",loop:r,currentTabStopId:D,onCurrentTabStopIdChange:E,onEntryFocus:$e(d,ue=>{j.isUsingKeyboardRef.current||ue.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(X4,{role:"menu","aria-orientation":"vertical","data-state":lP(O.open),"data-radix-menu-content":"",dir:j.dir,...T,...k,ref:Q,style:{outline:"none",...k.style},onKeyDown:$e(k.onKeyDown,ue=>{const me=ue.target.closest("[data-radix-menu-content]")===ue.currentTarget,Y=ue.ctrlKey||ue.altKey||ue.metaKey,P=ue.key.length===1;me&&(ue.key==="Tab"&&ue.preventDefault(),!Y&&P&&ae(ue.key));const K=z.current;if(ue.target!==K||!Hme.includes(ue.key))return;ue.preventDefault();const fe=_().filter(ve=>!ve.disabled).map(ve=>ve.ref.current);Bz.includes(ue.key)&&fe.reverse(),dpe(fe)}),onBlur:$e(t.onBlur,ue=>{ue.currentTarget.contains(ue.target)||(window.clearTimeout(F.current),L.current="")}),onPointerMove:$e(t.onPointerMove,Hf(ue=>{const R=ue.target,me=W.current!==ue.clientX;if(ue.currentTarget.contains(R)&&me){const Y=ue.clientX>W.current?"right":"left";ce.current=Y,W.current=ue.clientX}}))})})})})})})});Hz.displayName=Ci;var npe="MenuGroup",n3=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Zt.div,{role:"group",...r,ref:e})});n3.displayName=npe;var rpe="MenuLabel",Uz=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Zt.div,{...r,ref:e})});Uz.displayName=rpe;var Jg="MenuItem",l9="menu.itemSelect",Kx=S.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=S.useRef(null),l=M0(Jg,t.__scopeMenu),c=e3(Jg,t.__scopeMenu),d=Cn(e,i),h=S.useRef(!1),m=()=>{const p=i.current;if(!n&&p){const x=new CustomEvent(l9,{bubbles:!0,cancelable:!0});p.addEventListener(l9,v=>r?.(v),{once:!0}),M9(p,x),x.defaultPrevented?h.current=!1:l.onClose()}};return a.jsx(Vz,{...s,ref:d,disabled:n,onClick:$e(t.onClick,m),onPointerDown:p=>{t.onPointerDown?.(p),h.current=!0},onPointerUp:$e(t.onPointerUp,p=>{h.current||p.currentTarget?.click()}),onKeyDown:$e(t.onKeyDown,p=>{const x=c.searchRef.current!=="";n||x&&p.key===" "||z4.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Kx.displayName=Jg;var Vz=S.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,l=e3(Jg,n),c=Iz(n),d=S.useRef(null),h=Cn(e,d),[m,p]=S.useState(!1),[x,v]=S.useState("");return S.useEffect(()=>{const b=d.current;b&&v((b.textContent??"").trim())},[i.children]),a.jsx($f.ItemSlot,{scope:n,disabled:r,textValue:s??x,children:a.jsx(CC,{asChild:!0,...c,focusable:!r,children:a.jsx(Zt.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:h,onPointerMove:$e(t.onPointerMove,Hf(b=>{r?l.onItemLeave(b):(l.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:$e(t.onPointerLeave,Hf(b=>l.onItemLeave(b))),onFocus:$e(t.onFocus,()=>p(!0)),onBlur:$e(t.onBlur,()=>p(!1))})})})}),spe="MenuCheckboxItem",Wz=S.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return a.jsx(Zz,{scope:t.__scopeMenu,checked:n,children:a.jsx(Kx,{role:"menuitemcheckbox","aria-checked":ex(n)?"mixed":n,...s,ref:e,"data-state":i3(n),onSelect:$e(s.onSelect,()=>r?.(ex(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Wz.displayName=spe;var Gz="MenuRadioGroup",[ipe,ape]=Lc(Gz,{value:void 0,onValueChange:()=>{}}),Xz=S.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=es(r);return a.jsx(ipe,{scope:t.__scopeMenu,value:n,onValueChange:i,children:a.jsx(n3,{...s,ref:e})})});Xz.displayName=Gz;var Yz="MenuRadioItem",Kz=S.forwardRef((t,e)=>{const{value:n,...r}=t,s=ape(Yz,t.__scopeMenu),i=n===s.value;return a.jsx(Zz,{scope:t.__scopeMenu,checked:i,children:a.jsx(Kx,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":i3(i),onSelect:$e(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Kz.displayName=Yz;var r3="MenuItemIndicator",[Zz,lpe]=Lc(r3,{checked:!1}),Jz=S.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=lpe(r3,n);return a.jsx(Ls,{present:r||ex(i.checked)||i.checked===!0,children:a.jsx(Zt.span,{...s,ref:e,"data-state":i3(i.checked)})})});Jz.displayName=r3;var ope="MenuSeparator",eP=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Zt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});eP.displayName=ope;var cpe="MenuArrow",tP=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=A0(n);return a.jsx(Y4,{...s,...r,ref:e})});tP.displayName=cpe;var s3="MenuSub",[upe,nP]=Lc(s3),rP=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:s}=t,i=Eo(s3,e),l=A0(e),[c,d]=S.useState(null),[h,m]=S.useState(null),p=es(s);return S.useEffect(()=>(i.open===!1&&p(!1),()=>p(!1)),[i.open,p]),a.jsx(ix,{...l,children:a.jsx(qz,{scope:e,open:r,onOpenChange:p,content:h,onContentChange:m,children:a.jsx(upe,{scope:e,contentId:ji(),triggerId:ji(),trigger:c,onTriggerChange:d,children:n})})})};rP.displayName=s3;var Gh="MenuSubTrigger",sP=S.forwardRef((t,e)=>{const n=Eo(Gh,t.__scopeMenu),r=M0(Gh,t.__scopeMenu),s=nP(Gh,t.__scopeMenu),i=e3(Gh,t.__scopeMenu),l=S.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:d}=i,h={__scopeMenu:t.__scopeMenu},m=S.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return S.useEffect(()=>m,[m]),S.useEffect(()=>{const p=c.current;return()=>{window.clearTimeout(p),d(null)}},[c,d]),a.jsx(Z5,{asChild:!0,...h,children:a.jsx(Vz,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":lP(n.open),...t,ref:oo(e,s.onTriggerChange),onClick:p=>{t.onClick?.(p),!(t.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:$e(t.onPointerMove,Hf(p=>{i.onItemEnter(p),!p.defaultPrevented&&!t.disabled&&!n.open&&!l.current&&(i.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:$e(t.onPointerLeave,Hf(p=>{m();const x=n.content?.getBoundingClientRect();if(x){const v=n.content?.dataset.side,b=v==="right",k=b?-5:5,O=x[b?"left":"right"],j=x[b?"right":"left"];i.onPointerGraceIntentChange({area:[{x:p.clientX+k,y:p.clientY},{x:O,y:x.top},{x:j,y:x.top},{x:j,y:x.bottom},{x:O,y:x.bottom}],side:v}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(p),p.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:$e(t.onKeyDown,p=>{const x=i.searchRef.current!=="";t.disabled||x&&p.key===" "||Ume[r.dir].includes(p.key)&&(n.onOpenChange(!0),n.content?.focus(),p.preventDefault())})})})});sP.displayName=Gh;var iP="MenuSubContent",aP=S.forwardRef((t,e)=>{const n=Qz(Ci,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Eo(Ci,t.__scopeMenu),l=M0(Ci,t.__scopeMenu),c=nP(iP,t.__scopeMenu),d=S.useRef(null),h=Cn(e,d);return a.jsx($f.Provider,{scope:t.__scopeMenu,children:a.jsx(Ls,{present:r||i.open,children:a.jsx($f.Slot,{scope:t.__scopeMenu,children:a.jsx(t3,{id:c.contentId,"aria-labelledby":c.triggerId,...s,ref:h,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{l.isUsingKeyboardRef.current&&d.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:$e(t.onFocusOutside,m=>{m.target!==c.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:$e(t.onEscapeKeyDown,m=>{l.onClose(),m.preventDefault()}),onKeyDown:$e(t.onKeyDown,m=>{const p=m.currentTarget.contains(m.target),x=Vme[l.dir].includes(m.key);p&&x&&(i.onOpenChange(!1),c.trigger?.focus(),m.preventDefault())})})})})})});aP.displayName=iP;function lP(t){return t?"open":"closed"}function ex(t){return t==="indeterminate"}function i3(t){return ex(t)?"indeterminate":t?"checked":"unchecked"}function dpe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function hpe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function fpe(t,e,n){const s=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let l=hpe(t,Math.max(i,0));s.length===1&&(l=l.filter(h=>h!==n));const d=l.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return d!==n?d:void 0}function mpe(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,l=e.length-1;ir!=x>r&&n<(p-h)*(r-m)/(x-m)+h&&(s=!s)}return s}function ppe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return mpe(n,e)}function Hf(t){return e=>e.pointerType==="mouse"?t(e):void 0}var gpe=Fz,xpe=Z5,vpe=$z,ype=Hz,bpe=n3,wpe=Uz,Spe=Kx,kpe=Wz,Ope=Xz,jpe=Kz,Npe=Jz,Cpe=eP,Tpe=tP,Ape=rP,Mpe=sP,Epe=aP,a3="ContextMenu",[_pe]=Vi(a3,[Lz]),ls=Lz(),[Dpe,oP]=_pe(a3),cP=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:s,modal:i=!0}=t,[l,c]=S.useState(!1),d=ls(e),h=es(r),m=S.useCallback(p=>{c(p),h(p)},[h]);return a.jsx(Dpe,{scope:e,open:l,onOpenChange:m,modal:i,children:a.jsx(gpe,{...d,dir:s,open:l,onOpenChange:m,modal:i,children:n})})};cP.displayName=a3;var uP="ContextMenuTrigger",dP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=t,i=oP(uP,n),l=ls(n),c=S.useRef({x:0,y:0}),d=S.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...c.current})}),h=S.useRef(0),m=S.useCallback(()=>window.clearTimeout(h.current),[]),p=x=>{c.current={x:x.clientX,y:x.clientY},i.onOpenChange(!0)};return S.useEffect(()=>m,[m]),S.useEffect(()=>void(r&&m()),[r,m]),a.jsxs(a.Fragment,{children:[a.jsx(xpe,{...l,virtualRef:d}),a.jsx(Zt.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:$e(t.onContextMenu,x=>{m(),p(x),x.preventDefault()}),onPointerDown:r?t.onPointerDown:$e(t.onPointerDown,Fp(x=>{m(),h.current=window.setTimeout(()=>p(x),700)})),onPointerMove:r?t.onPointerMove:$e(t.onPointerMove,Fp(m)),onPointerCancel:r?t.onPointerCancel:$e(t.onPointerCancel,Fp(m)),onPointerUp:r?t.onPointerUp:$e(t.onPointerUp,Fp(m))})]})});dP.displayName=uP;var Rpe="ContextMenuPortal",hP=t=>{const{__scopeContextMenu:e,...n}=t,r=ls(e);return a.jsx(vpe,{...r,...n})};hP.displayName=Rpe;var fP="ContextMenuContent",mP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=oP(fP,n),i=ls(n),l=S.useRef(!1);return a.jsx(ype,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:c=>{t.onCloseAutoFocus?.(c),!c.defaultPrevented&&l.current&&c.preventDefault(),l.current=!1},onInteractOutside:c=>{t.onInteractOutside?.(c),!c.defaultPrevented&&!s.modal&&(l.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});mP.displayName=fP;var zpe="ContextMenuGroup",Ppe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(bpe,{...s,...r,ref:e})});Ppe.displayName=zpe;var Bpe="ContextMenuLabel",pP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(wpe,{...s,...r,ref:e})});pP.displayName=Bpe;var Lpe="ContextMenuItem",gP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Spe,{...s,...r,ref:e})});gP.displayName=Lpe;var Ipe="ContextMenuCheckboxItem",xP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(kpe,{...s,...r,ref:e})});xP.displayName=Ipe;var qpe="ContextMenuRadioGroup",Fpe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Ope,{...s,...r,ref:e})});Fpe.displayName=qpe;var Qpe="ContextMenuRadioItem",vP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(jpe,{...s,...r,ref:e})});vP.displayName=Qpe;var $pe="ContextMenuItemIndicator",yP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Npe,{...s,...r,ref:e})});yP.displayName=$pe;var Hpe="ContextMenuSeparator",bP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Cpe,{...s,...r,ref:e})});bP.displayName=Hpe;var Upe="ContextMenuArrow",Vpe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Tpe,{...s,...r,ref:e})});Vpe.displayName=Upe;var wP="ContextMenuSub",SP=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,open:s,defaultOpen:i}=t,l=ls(e),[c,d]=ko({prop:s,defaultProp:i??!1,onChange:r,caller:wP});return a.jsx(Ape,{...l,open:c,onOpenChange:d,children:n})};SP.displayName=wP;var Wpe="ContextMenuSubTrigger",kP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Mpe,{...s,...r,ref:e})});kP.displayName=Wpe;var Gpe="ContextMenuSubContent",OP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Epe,{...s,...r,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});OP.displayName=Gpe;function Fp(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var Xpe=cP,Ype=dP,Kpe=hP,jP=mP,NP=pP,CP=gP,TP=xP,AP=vP,MP=yP,EP=bP,Zpe=SP,_P=kP,DP=OP;const Jpe=Xpe,ege=Ype,tge=Zpe,RP=S.forwardRef(({className:t,inset:e,children:n,...r},s)=>a.jsxs(_P,{ref:s,className:ye("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...r,children:[n,a.jsx(Ac,{className:"ml-auto h-4 w-4"})]}));RP.displayName=_P.displayName;const zP=S.forwardRef(({className:t,...e},n)=>a.jsx(DP,{ref:n,className:ye("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 origin-[--radix-context-menu-content-transform-origin]",t),...e}));zP.displayName=DP.displayName;const PP=S.forwardRef(({className:t,...e},n)=>a.jsx(Kpe,{children:a.jsx(jP,{ref:n,className:ye("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-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 origin-[--radix-context-menu-content-transform-origin]",t),...e})}));PP.displayName=jP.displayName;const Bi=S.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(CP,{ref:r,className:ye("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));Bi.displayName=CP.displayName;const nge=S.forwardRef(({className:t,children:e,checked:n,...r},s)=>a.jsxs(TP,{ref:s,className:ye("relative flex 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),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(MP,{children:a.jsx(hc,{className:"h-4 w-4"})})}),e]}));nge.displayName=TP.displayName;const rge=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(AP,{ref:r,className:ye("relative flex 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(MP,{children:a.jsx(Aq,{className:"h-2 w-2 fill-current"})})}),e]}));rge.displayName=AP.displayName;const sge=S.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(NP,{ref:r,className:ye("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...n}));sge.displayName=NP.displayName;const Xh=S.forwardRef(({className:t,...e},n)=>a.jsx(EP,{ref:n,className:ye("-mx-1 my-1 h-px bg-border",t),...e}));Xh.displayName=EP.displayName;const qu=({className:t,...e})=>a.jsx("span",{className:ye("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});qu.displayName="ContextMenuShortcut";var ige=Symbol("radix.slottable");function age(t){const e=({children:n})=>a.jsx(a.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=ige,e}var[Zx]=Vi("Tooltip",[wd]),Jx=wd(),BP="TooltipProvider",lge=700,P4="tooltip.open",[oge,l3]=Zx(BP),LP=t=>{const{__scopeTooltip:e,delayDuration:n=lge,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,l=S.useRef(!0),c=S.useRef(!1),d=S.useRef(0);return S.useEffect(()=>{const h=d.current;return()=>window.clearTimeout(h)},[]),a.jsx(oge,{scope:e,isOpenDelayedRef:l,delayDuration:n,onOpen:S.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:S.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:S.useCallback(h=>{c.current=h},[]),disableHoverableContent:s,children:i})};LP.displayName=BP;var Uf="Tooltip",[cge,E0]=Zx(Uf),IP=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:l,delayDuration:c}=t,d=l3(Uf,t.__scopeTooltip),h=Jx(e),[m,p]=S.useState(null),x=ji(),v=S.useRef(0),b=l??d.disableHoverableContent,k=c??d.delayDuration,O=S.useRef(!1),[j,T]=ko({prop:r,defaultProp:s??!1,onChange:z=>{z?(d.onOpen(),document.dispatchEvent(new CustomEvent(P4))):d.onClose(),i?.(z)},caller:Uf}),A=S.useMemo(()=>j?O.current?"delayed-open":"instant-open":"closed",[j]),_=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,O.current=!1,T(!0)},[T]),D=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,T(!1)},[T]),E=S.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{O.current=!0,T(!0),v.current=0},k)},[k,T]);return S.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),a.jsx(ix,{...h,children:a.jsx(cge,{scope:e,contentId:x,open:j,stateAttribute:A,trigger:m,onTriggerChange:p,onTriggerEnter:S.useCallback(()=>{d.isOpenDelayedRef.current?E():_()},[d.isOpenDelayedRef,E,_]),onTriggerLeave:S.useCallback(()=>{b?D():(window.clearTimeout(v.current),v.current=0)},[D,b]),onOpen:_,onClose:D,disableHoverableContent:b,children:n})})};IP.displayName=Uf;var B4="TooltipTrigger",qP=S.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=E0(B4,n),i=l3(B4,n),l=Jx(n),c=S.useRef(null),d=Cn(e,c,s.onTriggerChange),h=S.useRef(!1),m=S.useRef(!1),p=S.useCallback(()=>h.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),a.jsx(ax,{asChild:!0,...l,children:a.jsx(Zt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:d,onPointerMove:$e(t.onPointerMove,x=>{x.pointerType!=="touch"&&!m.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),m.current=!0)}),onPointerLeave:$e(t.onPointerLeave,()=>{s.onTriggerLeave(),m.current=!1}),onPointerDown:$e(t.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:$e(t.onFocus,()=>{h.current||s.onOpen()}),onBlur:$e(t.onBlur,s.onClose),onClick:$e(t.onClick,s.onClose)})})});qP.displayName=B4;var o3="TooltipPortal",[uge,dge]=Zx(o3,{forceMount:void 0}),FP=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=E0(o3,e);return a.jsx(uge,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};FP.displayName=o3;var bd="TooltipContent",QP=S.forwardRef((t,e)=>{const n=dge(bd,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,l=E0(bd,t.__scopeTooltip);return a.jsx(Ls,{present:r||l.open,children:l.disableHoverableContent?a.jsx($P,{side:s,...i,ref:e}):a.jsx(hge,{side:s,...i,ref:e})})}),hge=S.forwardRef((t,e)=>{const n=E0(bd,t.__scopeTooltip),r=l3(bd,t.__scopeTooltip),s=S.useRef(null),i=Cn(e,s),[l,c]=S.useState(null),{trigger:d,onClose:h}=n,m=s.current,{onPointerInTransitChange:p}=r,x=S.useCallback(()=>{c(null),p(!1)},[p]),v=S.useCallback((b,k)=>{const O=b.currentTarget,j={x:b.clientX,y:b.clientY},T=xge(j,O.getBoundingClientRect()),A=vge(j,T),_=yge(k.getBoundingClientRect()),D=wge([...A,..._]);c(D),p(!0)},[p]);return S.useEffect(()=>()=>x(),[x]),S.useEffect(()=>{if(d&&m){const b=O=>v(O,m),k=O=>v(O,d);return d.addEventListener("pointerleave",b),m.addEventListener("pointerleave",k),()=>{d.removeEventListener("pointerleave",b),m.removeEventListener("pointerleave",k)}}},[d,m,v,x]),S.useEffect(()=>{if(l){const b=k=>{const O=k.target,j={x:k.clientX,y:k.clientY},T=d?.contains(O)||m?.contains(O),A=!bge(j,l);T?x():A&&(x(),h())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[d,m,l,h,x]),a.jsx($P,{...t,ref:i})}),[fge,mge]=Zx(Uf,{isInside:!1}),pge=age("TooltipContent"),$P=S.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:l,...c}=t,d=E0(bd,n),h=Jx(n),{onClose:m}=d;return S.useEffect(()=>(document.addEventListener(P4,m),()=>document.removeEventListener(P4,m)),[m]),S.useEffect(()=>{if(d.trigger){const p=x=>{x.target?.contains(d.trigger)&&m()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[d.trigger,m]),a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:p=>p.preventDefault(),onDismiss:m,children:a.jsxs(X4,{"data-state":d.stateAttribute,...h,...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(pge,{children:r}),a.jsx(fge,{scope:n,isInside:!0,children:a.jsx(sq,{id:d.contentId,role:"tooltip",children:s||r})})]})})});QP.displayName=bd;var HP="TooltipArrow",gge=S.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Jx(n);return mge(HP,n).isInside?null:a.jsx(Y4,{...s,...r,ref:e})});gge.displayName=HP;function xge(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function vge(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 yge(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function bge(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,l=e.length-1;ir!=x>r&&n<(p-h)*(r-m)/(x-m)+h&&(s=!s)}return s}function wge(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),Sge(e)}function Sge(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const i=e[e.length-1],l=e[e.length-2];if((i.x-l.x)*(s.y-l.y)>=(i.y-l.y)*(s.x-l.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],l=n[n.length-2];if((i.x-l.x)*(s.y-l.y)>=(i.y-l.y)*(s.x-l.x))n.pop();else break}n.push(s)}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 kge=LP,Oge=IP,jge=qP,Nge=FP,UP=QP;const Cge=kge,Tge=Oge,Age=jge,VP=S.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(Nge,{children:a.jsx(UP,{ref:r,sideOffset:e,className:ye("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",t),...n})}));VP.displayName=UP.displayName;function Mge({children:t}){CH();const[e,n]=S.useState(!0),[r,s]=S.useState(!1),[i,l]=S.useState(!1),{theme:c,setTheme:d}=dw(),h=AI(),m=wa();S.useEffect(()=>{const k=O=>{(O.metaKey||O.ctrlKey)&&O.key==="k"&&(O.preventDefault(),l(!0))};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[]);const p=[{title:"概览",items:[{icon:hg,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:ao,label:"麦麦主程序配置",path:"/config/bot"},{icon:z9,label:"麦麦模型提供商配置",path:"/config/modelProvider"},{icon:P9,label:"麦麦模型配置",path:"/config/model"},{icon:hO,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:K4,label:"表情包管理",path:"/resource/emoji"},{icon:Wf,label:"表达方式管理",path:"/resource/expression"},{icon:B9,label:"人物信息管理",path:"/resource/person"}]},{title:"扩展与监控",items:[{icon:pg,label:"插件市场",path:"/plugins"},{icon:hO,label:"插件配置",path:"/plugin-config"},{icon:fg,label:"日志查看器",path:"/logs"}]},{title:"系统",items:[{icon:Ii,label:"系统设置",path:"/settings"}]}],v=c==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":c,b=()=>{localStorage.removeItem("access-token"),m({to:"/auth"})};return a.jsx(Cge,{delayDuration:300,children:a.jsxs("div",{className:"flex h-screen overflow-hidden",children:[a.jsxs("aside",{className:ye("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",e?"lg:w-64":"lg:w-16",r?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[a.jsx("div",{className:"flex h-16 items-center border-b px-4",children:a.jsxs("div",{className:ye("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!e&&"lg:flex-none lg:w-8"),children:[a.jsxs("div",{className:ye("flex items-baseline gap-2",!e&&"lg:hidden"),children:[a.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),a.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:rH()})]}),!e&&a.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),a.jsx(mn,{className:"flex-1",children:a.jsx("nav",{className:"p-4",children:a.jsx("ul",{className:ye("space-y-6",!e&&"lg:space-y-3"),children:p.map((k,O)=>a.jsxs("li",{children:[a.jsx("div",{className:ye("px-3 h-[1.25rem]","mb-2",!e&&"lg:mb-1 lg:invisible"),children:a.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:k.title})}),!e&&O>0&&a.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),a.jsx("ul",{className:"space-y-1",children:k.items.map(j=>{const T=h({to:j.path}),A=j.icon,_=a.jsxs(a.Fragment,{children:[T&&a.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),a.jsxs("div",{className:ye("flex items-center transition-all duration-300",e?"gap-3":"lg:gap-0"),children:[a.jsx(A,{className:ye("h-5 w-5 flex-shrink-0",T&&"text-primary"),strokeWidth:2,fill:"none"}),a.jsx("span",{className:ye("text-sm font-medium whitespace-nowrap transition-all duration-300",T&&"font-semibold",e?"opacity-100 max-w-[200px]":"lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:j.label})]})]});return a.jsx("li",{className:"relative",children:a.jsxs(Tge,{children:[a.jsx(Age,{asChild:!0,children:a.jsx(MI,{to:j.path,className:ye("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",T?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",e?"px-3":"lg:px-0 lg:justify-center"),onClick:()=>s(!1),children:_})}),!e&&a.jsx(VP,{side:"right",className:"hidden lg:block",children:a.jsx("p",{children:j.label})})]})},j.path)})})]},k.title))})})})]}),r&&a.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>s(!1)}),a.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[a.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:()=>s(!r),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:a.jsx(Mq,{className:"h-5 w-5"})}),a.jsx("button",{onClick:()=>n(!e),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:e?"收起侧边栏":"展开侧边栏",children:a.jsx(Tc,{className:ye("h-5 w-5 transition-transform",!e&&"rotate-180")})})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>l(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),a.jsxs(Pz,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[a.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),a.jsx(Pme,{open:i,onOpenChange:l}),a.jsxs(ie,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[a.jsx(Eq,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),a.jsx("button",{onClick:k=>{Q$(v==="dark"?"light":"dark",d,k)},className:"rounded-lg p-2 hover:bg-accent",title:v==="dark"?"切换到浅色模式":"切换到深色模式",children:v==="dark"?a.jsx(Zb,{className:"h-5 w-5"}):a.jsx(Jb,{className:"h-5 w-5"})}),a.jsx("div",{className:"h-6 w-px bg-border"}),a.jsxs(ie,{variant:"ghost",size:"sm",onClick:b,className:"gap-2",title:"登出系统",children:[a.jsx(fO,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),a.jsxs(Jpe,{children:[a.jsx(ege,{asChild:!0,children:a.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:t})}),a.jsxs(PP,{className:"w-64",children:[a.jsxs(Bi,{onClick:()=>m({to:"/"}),children:[a.jsx(hg,{className:"mr-2 h-4 w-4"}),"首页"]}),a.jsxs(Bi,{onClick:()=>m({to:"/settings"}),children:[a.jsx(Ii,{className:"mr-2 h-4 w-4"}),"系统设置"]}),a.jsxs(Bi,{onClick:()=>m({to:"/logs"}),children:[a.jsx(fg,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),a.jsx(Xh,{}),a.jsxs(tge,{children:[a.jsxs(RP,{children:[a.jsx(_9,{className:"mr-2 h-4 w-4"}),"切换主题"]}),a.jsxs(zP,{className:"w-48",children:[a.jsxs(Bi,{onClick:()=>d("light"),disabled:c==="light",children:[a.jsx(Zb,{className:"mr-2 h-4 w-4"}),"浅色",c==="light"&&a.jsx(qu,{children:"✓"})]}),a.jsxs(Bi,{onClick:()=>d("dark"),disabled:c==="dark",children:[a.jsx(Jb,{className:"mr-2 h-4 w-4"}),"深色",c==="dark"&&a.jsx(qu,{children:"✓"})]}),a.jsxs(Bi,{onClick:()=>d("system"),disabled:c==="system",children:[a.jsx(Ii,{className:"mr-2 h-4 w-4"}),"跟随系统",c==="system"&&a.jsx(qu,{children:"✓"})]})]})]}),a.jsx(Xh,{}),a.jsxs(Bi,{onClick:()=>window.location.reload(),children:[a.jsx(_q,{className:"mr-2 h-4 w-4"}),"刷新页面",a.jsx(qu,{children:"⌘R"})]}),a.jsxs(Bi,{onClick:()=>l(!0),children:[a.jsx(Bs,{className:"mr-2 h-4 w-4"}),"搜索",a.jsx(qu,{children:"⌘K"})]}),a.jsx(Xh,{}),a.jsxs(Bi,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[a.jsx(Yh,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),a.jsx(Xh,{}),a.jsxs(Bi,{onClick:b,className:"text-destructive focus:text-destructive",children:[a.jsx(fO,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}const _0=EI({component:()=>a.jsxs(a.Fragment,{children:[a.jsx(c9,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!qT())throw DI({to:"/auth"})}}),Ege=Xr({getParentRoute:()=>_0,path:"/auth",component:TH}),_ge=Xr({getParentRoute:()=>_0,path:"/setup",component:WH}),Qs=Xr({getParentRoute:()=>_0,id:"protected",component:()=>a.jsx(Mge,{children:a.jsx(c9,{})})}),Dge=Xr({getParentRoute:()=>Qs,path:"/",component:q$}),Rge=Xr({getParentRoute:()=>Qs,path:"/config/bot",component:Vee}),zge=Xr({getParentRoute:()=>Qs,path:"/config/modelProvider",component:ote}),Pge=Xr({getParentRoute:()=>Qs,path:"/config/model",component:Pte}),Bge=Xr({getParentRoute:()=>Qs,path:"/config/adapter",component:qte}),Lge=Xr({getParentRoute:()=>Qs,path:"/resource/emoji",component:ude}),Ige=Xr({getParentRoute:()=>Qs,path:"/resource/expression",component:bde}),qge=Xr({getParentRoute:()=>Qs,path:"/resource/person",component:Ede}),Fge=Xr({getParentRoute:()=>Qs,path:"/logs",component:hme}),Qge=Xr({getParentRoute:()=>Qs,path:"/plugins",component:Eme}),$ge=Xr({getParentRoute:()=>Qs,path:"/plugin-config",component:_me}),Hge=Xr({getParentRoute:()=>Qs,path:"/plugin-mirrors",component:Dme}),Uge=Xr({getParentRoute:()=>Qs,path:"/settings",component:bH}),Vge=Xr({getParentRoute:()=>_0,path:"*",component:$T}),Wge=_0.addChildren([Ege,_ge,Qs.addChildren([Dge,Rge,zge,Pge,Bge,Lge,Ige,qge,Qge,$ge,Hge,Fge,Uge]),Vge]),Gge=_I({routeTree:Wge,defaultNotFoundComponent:$T});function Xge({children:t,defaultTheme:e="system",storageKey:n="ui-theme",...r}){const[s,i]=S.useState(()=>localStorage.getItem(n)||e);S.useEffect(()=>{const c=window.document.documentElement;if(c.classList.remove("light","dark"),s==="system"){const d=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";c.classList.add(d);return}c.classList.add(s)},[s]),S.useEffect(()=>{const c=localStorage.getItem("accent-color");if(c){const d=document.documentElement,m={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[c];m&&(d.style.setProperty("--primary",m.hsl),m.gradient?(d.style.setProperty("--primary-gradient",m.gradient),d.classList.add("has-gradient")):(d.style.removeProperty("--primary-gradient"),d.classList.remove("has-gradient")))}},[]);const l={theme:s,setTheme:c=>{localStorage.setItem(n,c),i(c)}};return a.jsx(uT.Provider,{...r,value:l,children:t})}function Yge({children:t,defaultEnabled:e=!0,defaultWavesEnabled:n=!0,storageKey:r="enable-animations",wavesStorageKey:s="enable-waves-background"}){const[i,l]=S.useState(()=>{const m=localStorage.getItem(r);return m!==null?m==="true":e}),[c,d]=S.useState(()=>{const m=localStorage.getItem(s);return m!==null?m==="true":n});S.useEffect(()=>{const m=document.documentElement;i?m.classList.remove("no-animations"):m.classList.add("no-animations"),localStorage.setItem(r,String(i))},[i,r]),S.useEffect(()=>{localStorage.setItem(s,String(c))},[c,s]);const h={enableAnimations:i,setEnableAnimations:l,enableWavesBackground:c,setEnableWavesBackground:d};return a.jsx(dT.Provider,{value:h,children:t})}var c3="ToastProvider",[u3,Kge,Zge]=tx("Toast"),[WP]=Vi("Toast",[Zge]),[Jge,e1]=WP(c3),GP=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:l}=t,[c,d]=S.useState(null),[h,m]=S.useState(0),p=S.useRef(!1),x=S.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${c3}\`. Expected non-empty \`string\`.`),a.jsx(u3.Provider,{scope:e,children:a.jsx(Jge,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:h,viewport:c,onViewportChange:d,onToastAdd:S.useCallback(()=>m(v=>v+1),[]),onToastRemove:S.useCallback(()=>m(v=>v-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:x,children:l})})};GP.displayName=c3;var XP="ToastViewport",exe=["F8"],L4="toast.viewportPause",I4="toast.viewportResume",YP=S.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=exe,label:s="Notifications ({hotkey})",...i}=t,l=e1(XP,n),c=Kge(n),d=S.useRef(null),h=S.useRef(null),m=S.useRef(null),p=S.useRef(null),x=Cn(e,p,l.onViewportChange),v=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=l.toastCount>0;S.useEffect(()=>{const O=j=>{r.length!==0&&r.every(A=>j[A]||j.code===A)&&p.current?.focus()};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[r]),S.useEffect(()=>{const O=d.current,j=p.current;if(b&&O&&j){const T=()=>{if(!l.isClosePausedRef.current){const E=new CustomEvent(L4);j.dispatchEvent(E),l.isClosePausedRef.current=!0}},A=()=>{if(l.isClosePausedRef.current){const E=new CustomEvent(I4);j.dispatchEvent(E),l.isClosePausedRef.current=!1}},_=E=>{!O.contains(E.relatedTarget)&&A()},D=()=>{O.contains(document.activeElement)||A()};return O.addEventListener("focusin",T),O.addEventListener("focusout",_),O.addEventListener("pointermove",T),O.addEventListener("pointerleave",D),window.addEventListener("blur",T),window.addEventListener("focus",A),()=>{O.removeEventListener("focusin",T),O.removeEventListener("focusout",_),O.removeEventListener("pointermove",T),O.removeEventListener("pointerleave",D),window.removeEventListener("blur",T),window.removeEventListener("focus",A)}}},[b,l.isClosePausedRef]);const k=S.useCallback(({tabbingDirection:O})=>{const T=c().map(A=>{const _=A.ref.current,D=[_,...fxe(_)];return O==="forwards"?D:D.reverse()});return(O==="forwards"?T.reverse():T).flat()},[c]);return S.useEffect(()=>{const O=p.current;if(O){const j=T=>{const A=T.altKey||T.ctrlKey||T.metaKey;if(T.key==="Tab"&&!A){const D=document.activeElement,E=T.shiftKey;if(T.target===O&&E){h.current?.focus();return}const F=k({tabbingDirection:E?"backwards":"forwards"}),L=F.findIndex(U=>U===D);Gb(F.slice(L+1))?T.preventDefault():E?h.current?.focus():m.current?.focus()}};return O.addEventListener("keydown",j),()=>O.removeEventListener("keydown",j)}},[c,k]),a.jsxs(iq,{ref:d,role:"region","aria-label":s.replace("{hotkey}",v),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&a.jsx(q4,{ref:h,onFocusFromOutsideViewport:()=>{const O=k({tabbingDirection:"forwards"});Gb(O)}}),a.jsx(u3.Slot,{scope:n,children:a.jsx(Zt.ol,{tabIndex:-1,...i,ref:x})}),b&&a.jsx(q4,{ref:m,onFocusFromOutsideViewport:()=>{const O=k({tabbingDirection:"backwards"});Gb(O)}})]})});YP.displayName=XP;var KP="ToastFocusProxy",q4=S.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=e1(KP,n);return a.jsx(E9,{tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:l=>{const c=l.relatedTarget;!i.viewport?.contains(c)&&r()}})});q4.displayName=KP;var D0="Toast",txe="toast.swipeStart",nxe="toast.swipeMove",rxe="toast.swipeCancel",sxe="toast.swipeEnd",ZP=S.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...l}=t,[c,d]=ko({prop:r,defaultProp:s??!0,onChange:i,caller:D0});return a.jsx(Ls,{present:n||c,children:a.jsx(lxe,{open:c,...l,ref:e,onClose:()=>d(!1),onPause:es(t.onPause),onResume:es(t.onResume),onSwipeStart:$e(t.onSwipeStart,h=>{h.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:$e(t.onSwipeMove,h=>{const{x:m,y:p}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","move"),h.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${m}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:$e(t.onSwipeCancel,h=>{h.currentTarget.setAttribute("data-swipe","cancel"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:$e(t.onSwipeEnd,h=>{const{x:m,y:p}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","end"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${m}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),d(!1)})})})});ZP.displayName=D0;var[ixe,axe]=WP(D0,{onClose(){}}),lxe=S.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:l,onEscapeKeyDown:c,onPause:d,onResume:h,onSwipeStart:m,onSwipeMove:p,onSwipeCancel:x,onSwipeEnd:v,...b}=t,k=e1(D0,n),[O,j]=S.useState(null),T=Cn(e,W=>j(W)),A=S.useRef(null),_=S.useRef(null),D=s||k.duration,E=S.useRef(0),z=S.useRef(D),Q=S.useRef(0),{onToastAdd:F,onToastRemove:L}=k,U=es(()=>{O?.contains(document.activeElement)&&k.viewport?.focus(),l()}),V=S.useCallback(W=>{!W||W===1/0||(window.clearTimeout(Q.current),E.current=new Date().getTime(),Q.current=window.setTimeout(U,W))},[U]);S.useEffect(()=>{const W=k.viewport;if(W){const J=()=>{V(z.current),h?.()},$=()=>{const ae=new Date().getTime()-E.current;z.current=z.current-ae,window.clearTimeout(Q.current),d?.()};return W.addEventListener(L4,$),W.addEventListener(I4,J),()=>{W.removeEventListener(L4,$),W.removeEventListener(I4,J)}}},[k.viewport,D,d,h,V]),S.useEffect(()=>{i&&!k.isClosePausedRef.current&&V(D)},[i,D,k.isClosePausedRef,V]),S.useEffect(()=>(F(),()=>L()),[F,L]);const ce=S.useMemo(()=>O?iB(O):null,[O]);return k.viewport?a.jsxs(a.Fragment,{children:[ce&&a.jsx(oxe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:ce}),a.jsx(ixe,{scope:n,onClose:U,children:RI.createPortal(a.jsx(u3.ItemSlot,{scope:n,children:a.jsx(aq,{asChild:!0,onEscapeKeyDown:$e(c,()=>{k.isFocusedToastEscapeKeyDownRef.current||U(),k.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(Zt.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":k.swipeDirection,...b,ref:T,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:$e(t.onKeyDown,W=>{W.key==="Escape"&&(c?.(W.nativeEvent),W.nativeEvent.defaultPrevented||(k.isFocusedToastEscapeKeyDownRef.current=!0,U()))}),onPointerDown:$e(t.onPointerDown,W=>{W.button===0&&(A.current={x:W.clientX,y:W.clientY})}),onPointerMove:$e(t.onPointerMove,W=>{if(!A.current)return;const J=W.clientX-A.current.x,$=W.clientY-A.current.y,ae=!!_.current,ne=["left","right"].includes(k.swipeDirection),ue=["left","up"].includes(k.swipeDirection)?Math.min:Math.max,R=ne?ue(0,J):0,me=ne?0:ue(0,$),Y=W.pointerType==="touch"?10:2,P={x:R,y:me},K={originalEvent:W,delta:P};ae?(_.current=P,Qp(nxe,p,K,{discrete:!1})):o9(P,k.swipeDirection,Y)?(_.current=P,Qp(txe,m,K,{discrete:!1}),W.target.setPointerCapture(W.pointerId)):(Math.abs(J)>Y||Math.abs($)>Y)&&(A.current=null)}),onPointerUp:$e(t.onPointerUp,W=>{const J=_.current,$=W.target;if($.hasPointerCapture(W.pointerId)&&$.releasePointerCapture(W.pointerId),_.current=null,A.current=null,J){const ae=W.currentTarget,ne={originalEvent:W,delta:J};o9(J,k.swipeDirection,k.swipeThreshold)?Qp(sxe,v,ne,{discrete:!0}):Qp(rxe,x,ne,{discrete:!0}),ae.addEventListener("click",ue=>ue.preventDefault(),{once:!0})}})})})}),k.viewport)})]}):null}),oxe=t=>{const{__scopeToast:e,children:n,...r}=t,s=e1(D0,e),[i,l]=S.useState(!1),[c,d]=S.useState(!1);return dxe(()=>l(!0)),S.useEffect(()=>{const h=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(h)},[]),c?null:a.jsx(sx,{asChild:!0,children:a.jsx(E9,{...r,children:i&&a.jsxs(a.Fragment,{children:[s.label," ",n]})})})},cxe="ToastTitle",JP=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(Zt.div,{...r,ref:e})});JP.displayName=cxe;var uxe="ToastDescription",eB=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(Zt.div,{...r,ref:e})});eB.displayName=uxe;var tB="ToastAction",nB=S.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?a.jsx(sB,{altText:n,asChild:!0,children:a.jsx(d3,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${tB}\`. Expected non-empty \`string\`.`),null)});nB.displayName=tB;var rB="ToastClose",d3=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=axe(rB,n);return a.jsx(sB,{asChild:!0,children:a.jsx(Zt.button,{type:"button",...r,ref:e,onClick:$e(t.onClick,s.onClose)})})});d3.displayName=rB;var sB=S.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return a.jsx(Zt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function iB(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),hxe(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const l=r.dataset.radixToastAnnounceAlt;l&&e.push(l)}else e.push(...iB(r))}}),e}function Qp(t,e,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?M9(s,i):s.dispatchEvent(i)}var o9=(t,e,n=0)=>{const r=Math.abs(t.x),s=Math.abs(t.y),i=r>s;return e==="left"||e==="right"?i&&r>n:!i&&s>n};function dxe(t=()=>{}){const e=es(t);h9(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function hxe(t){return t.nodeType===t.ELEMENT_NODE}function fxe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Gb(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var mxe=GP,aB=YP,lB=ZP,oB=JP,cB=eB,uB=nB,dB=d3;const pxe=mxe,hB=S.forwardRef(({className:t,...e},n)=>a.jsx(aB,{ref:n,className:ye("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));hB.displayName=aB.displayName;const gxe=Nd("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),fB=S.forwardRef(({className:t,variant:e,...n},r)=>a.jsx(lB,{ref:r,className:ye(gxe({variant:e}),t),...n}));fB.displayName=lB.displayName;const xxe=S.forwardRef(({className:t,...e},n)=>a.jsx(uB,{ref:n,className:ye("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));xxe.displayName=uB.displayName;const mB=S.forwardRef(({className:t,...e},n)=>a.jsx(dB,{ref:n,className:ye("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:a.jsx(Gf,{className:"h-4 w-4"})}));mB.displayName=dB.displayName;const pB=S.forwardRef(({className:t,...e},n)=>a.jsx(oB,{ref:n,className:ye("text-sm font-semibold [&+div]:text-xs",t),...e}));pB.displayName=oB.displayName;const gB=S.forwardRef(({className:t,...e},n)=>a.jsx(cB,{ref:n,className:ye("text-sm opacity-90",t),...e}));gB.displayName=cB.displayName;function vxe(){const{toasts:t}=Pr();return a.jsxs(pxe,{children:[t.map(function({id:e,title:n,description:r,action:s,...i}){return a.jsxs(fB,{...i,children:[a.jsxs("div",{className:"grid gap-1",children:[n&&a.jsx(pB,{children:n}),r&&a.jsx(gB,{children:r})]}),s,a.jsx(mB,{})]},e)}),a.jsx(hB,{})]})}Bq.createRoot(document.getElementById("root")).render(a.jsx(S.StrictMode,{children:a.jsx(Xge,{defaultTheme:"system",children:a.jsxs(Yge,{children:[a.jsx(zI,{router:Gge}),a.jsx(vxe,{})]})})})); +`:Que(t)?(c=2,d=2):rz(t)&&(c=1,d=1);++i{try{i(!0);const Oe=await nde({page:l,page_size:m,search:x||void 0,is_registered:b==="all"?void 0:b==="registered",is_banned:O==="all"?void 0:O==="banned",format:T==="all"?void 0:T,sort_by:"usage_count",sort_order:"desc"});e(Oe.data),h(Oe.total)}catch(Oe){const nt=Oe instanceof Error?Oe.message:"加载表情包列表失败";ne({title:"错误",description:nt,variant:"destructive"})}finally{i(!1)}},[l,m,x,b,O,T,ne]),R=async()=>{try{const Oe=await ade();r(Oe.data)}catch(Oe){console.error("加载统计数据失败:",Oe)}};S.useEffect(()=>{ue()},[ue]),S.useEffect(()=>{R()},[]);const me=async Oe=>{try{const nt=await rde(Oe.id);D(nt.data),z(!0)}catch(nt){const ut=nt instanceof Error?nt.message:"加载详情失败";ne({title:"错误",description:ut,variant:"destructive"})}},Y=Oe=>{D(Oe),F(!0)},P=Oe=>{D(Oe),U(!0)},K=async()=>{if(_)try{await ide(_.id),ne({title:"成功",description:"表情包已删除"}),U(!1),D(null),ue(),R()}catch(Oe){const nt=Oe instanceof Error?Oe.message:"删除失败";ne({title:"错误",description:nt,variant:"destructive"})}},$=async Oe=>{try{await lde(Oe.id),ne({title:"成功",description:"表情包已注册"}),ue(),R()}catch(nt){const ut=nt instanceof Error?nt.message:"注册失败";ne({title:"错误",description:ut,variant:"destructive"})}},fe=async Oe=>{try{await ode(Oe.id),ne({title:"成功",description:"表情包已封禁"}),ue(),R()}catch(nt){const ut=nt instanceof Error?nt.message:"封禁失败";ne({title:"错误",description:ut,variant:"destructive"})}},ve=Oe=>{const nt=new Set(V);nt.has(Oe)?nt.delete(Oe):nt.add(Oe),ce(nt)},Re=()=>{V.size===t.length&&t.length>0?ce(new Set):ce(new Set(t.map(Oe=>Oe.id)))},de=async()=>{try{const Oe=await cde(Array.from(V));ne({title:"批量删除完成",description:Oe.message}),ce(new Set),J(!1),ue(),R()}catch(Oe){ne({title:"批量删除失败",description:Oe instanceof Error?Oe.message:"批量删除失败",variant:"destructive"})}},We=()=>{const Oe=parseInt(H),nt=Math.ceil(d/m);Oe>=1&&Oe<=nt?(c(Oe),ae("")):ne({title:"无效的页码",description:`请输入1-${nt}之间的页码`,variant:"destructive"})},ct=n?.formats?Object.keys(n.formats):[];return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsxs("div",{className:"mb-4 sm:mb-6",children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),a.jsx(fn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&a.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[a.jsx(yt,{children:a.jsxs(Jt,{className:"pb-2",children:[a.jsx(Sr,{children:"总数"}),a.jsx(en,{className:"text-2xl",children:n.total})]})}),a.jsx(yt,{children:a.jsxs(Jt,{className:"pb-2",children:[a.jsx(Sr,{children:"已注册"}),a.jsx(en,{className:"text-2xl text-green-600",children:n.registered})]})}),a.jsx(yt,{children:a.jsxs(Jt,{className:"pb-2",children:[a.jsx(Sr,{children:"已封禁"}),a.jsx(en,{className:"text-2xl text-red-600",children:n.banned})]})}),a.jsx(yt,{children:a.jsxs(Jt,{className:"pb-2",children:[a.jsx(Sr,{children:"未注册"}),a.jsx(en,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),a.jsxs(yt,{children:[a.jsx(Jt,{children:a.jsxs(en,{className:"flex items-center gap-2",children:[a.jsx(t2,{className:"h-5 w-5"}),"搜索和筛选"]})}),a.jsxs(vn,{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"搜索"}),a.jsxs("div",{className:"relative",children:[a.jsx(Ps,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Ae,{placeholder:"描述或哈希值...",value:x,onChange:Oe=>{v(Oe.target.value),c(1)},className:"pl-8"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"注册状态"}),a.jsxs(Lt,{value:b,onValueChange:Oe=>{k(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"registered",children:"已注册"}),a.jsx(Pe,{value:"unregistered",children:"未注册"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"封禁状态"}),a.jsxs(Lt,{value:O,onValueChange:Oe=>{j(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"banned",children:"已封禁"}),a.jsx(Pe,{value:"unbanned",children:"未封禁"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"格式"}),a.jsxs(Lt,{value:T,onValueChange:Oe=>{M(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),ct.map(Oe=>a.jsxs(Pe,{value:Oe,children:[Oe.toUpperCase()," (",n?.formats[Oe],")"]},Oe))]})]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:V.size>0&&a.jsxs("span",{children:["已选择 ",V.size," 个表情包"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:m.toString(),onValueChange:Oe=>{p(parseInt(Oe)),c(1),ce(new Set)},children:[a.jsx(Dt,{id:"emoji-page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),V.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ce(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:()=>J(!0),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),a.jsx("div",{className:"flex justify-end pt-4 border-t",children:a.jsxs(ie,{variant:"outline",size:"sm",onClick:ue,disabled:s,children:[a.jsx(Ii,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})})]})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"表情包列表"}),a.jsxs(Sr,{children:["共 ",d," 个表情包,当前第 ",l," 页"]})]}),a.jsxs(vn,{children:[a.jsx("div",{className:"hidden md:block rounded-md border overflow-hidden",children:a.jsxs(Ac,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(gt,{className:"w-12",children:a.jsx(ss,{checked:t.length>0&&V.size===t.length,onCheckedChange:Re,"aria-label":"全选"})}),a.jsx(gt,{className:"w-16",children:"预览"}),a.jsx(gt,{children:"描述"}),a.jsx(gt,{children:"格式"}),a.jsx(gt,{children:"情绪标签"}),a.jsx(gt,{className:"text-center",children:"状态"}),a.jsx(gt,{className:"text-right",children:"使用次数"}),a.jsx(gt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(Oe=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:V.has(Oe.id),onCheckedChange:()=>ve(Oe.id),"aria-label":`选择 ${Oe.description}`})}),a.jsx(it,{children:a.jsx("div",{className:"w-20 h-20 bg-muted rounded flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(Oe.id),alt:Oe.description||"表情包",className:"w-full h-full object-cover",onError:nt=>{const ut=nt.target;ut.style.display="none";const Ct=ut.parentElement;Ct&&(Ct.innerHTML='')}})})}),a.jsx(it,{children:a.jsxs("div",{className:"space-y-1 max-w-xs",children:[a.jsx("div",{className:"font-medium truncate",title:Oe.description||"无描述",children:Oe.description||"无描述"}),a.jsxs("div",{className:"text-xs text-muted-foreground font-mono",children:[Oe.emoji_hash.slice(0,16),"..."]})]})}),a.jsx(it,{children:a.jsx(On,{variant:"outline",children:Oe.format.toUpperCase()})}),a.jsx(it,{children:a.jsx(UN,{emotions:Oe.emotion})}),a.jsx(it,{className:"align-middle",children:a.jsxs("div",{className:"flex gap-2 justify-center",children:[Oe.is_registered&&a.jsxs(On,{variant:"default",className:"bg-green-600",children:[a.jsx(ua,{className:"h-3 w-3 mr-1"}),"已注册"]}),Oe.is_banned&&a.jsxs(On,{variant:"destructive",children:[a.jsx(Kb,{className:"h-3 w-3 mr-1"}),"已封禁"]})]})}),a.jsx(it,{className:"text-right font-mono",children:Oe.usage_count}),a.jsx(it,{children:a.jsxs("div",{className:"flex items-center justify-end gap-1 flex-wrap",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>me(Oe),children:[a.jsx(oo,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Y(Oe),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),!Oe.is_registered&&a.jsxs(ie,{size:"sm",onClick:()=>$(Oe),className:"bg-green-600 hover:bg-green-700 text-white",children:[a.jsx(ua,{className:"h-4 w-4 mr-1"}),"注册"]}),!Oe.is_banned&&a.jsxs(ie,{size:"sm",onClick:()=>fe(Oe),className:"bg-orange-600 hover:bg-orange-700 text-white",children:[a.jsx(cO,{className:"h-4 w-4 mr-1"}),"封禁"]}),a.jsxs(ie,{size:"sm",onClick:()=>P(Oe),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},Oe.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3",children:t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(Oe=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex gap-3",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("div",{className:"w-16 h-16 bg-muted rounded flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(Oe.id),alt:Oe.description||"表情包",className:"w-full h-full object-cover",onError:nt=>{const ut=nt.target;ut.style.display="none";const Ct=ut.parentElement;Ct&&(Ct.innerHTML='')}})})}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[a.jsxs("div",{className:"min-w-0 w-full overflow-hidden",children:[a.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",title:Oe.description||"无描述",children:Oe.description||"无描述"}),a.jsxs("p",{className:"text-xs text-muted-foreground font-mono line-clamp-1 w-full break-all",children:[Oe.emoji_hash.slice(0,16),"..."]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 items-center min-w-0",children:[a.jsx(On,{variant:"outline",className:"text-xs flex-shrink-0",children:Oe.format.toUpperCase()}),Oe.is_registered&&a.jsxs(On,{variant:"default",className:"bg-green-600 text-xs flex-shrink-0",children:[a.jsx(ua,{className:"h-3 w-3 mr-1"}),"已注册"]}),Oe.is_banned&&a.jsxs(On,{variant:"destructive",className:"text-xs flex-shrink-0",children:[a.jsx(Kb,{className:"h-3 w-3 mr-1"}),"已封禁"]}),a.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:["使用: ",Oe.usage_count]})]}),Oe.emotion&&Oe.emotion.length>0&&a.jsx("div",{className:"min-w-0 overflow-hidden",children:a.jsx(UN,{emotions:Oe.emotion})})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>me(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(oo,{className:"h-3 w-3 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Y(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),!Oe.is_registered&&a.jsxs(ie,{size:"sm",onClick:()=>$(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-green-600 hover:bg-green-700 text-white",children:[a.jsx(ua,{className:"h-3 w-3 mr-1"}),"注册"]}),!Oe.is_banned&&a.jsxs(ie,{size:"sm",onClick:()=>fe(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-orange-600 hover:bg-orange-700 text-white",children:[a.jsx(cO,{className:"h-3 w-3 mr-1"}),"封禁"]}),a.jsxs(ie,{size:"sm",onClick:()=>P(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},Oe.id))}),d>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(l-1)*m+1," 到"," ",Math.min(l*m,d)," 条,共 ",d," 条"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(Oe=>Math.max(1,Oe-1)),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ae,{type:"number",value:H,onChange:Oe=>ae(Oe.target.value),onKeyDown:Oe=>Oe.key==="Enter"&&We(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/m)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:We,disabled:!H,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(Oe=>Oe+1),disabled:l>=Math.ceil(d/m),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Mc,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(d/m)),disabled:l>=Math.ceil(d/m),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]}),a.jsx(dde,{emoji:_,open:E,onOpenChange:z}),a.jsx(hde,{emoji:_,open:Q,onOpenChange:F,onSuccess:()=>{ue(),R()}})]})}),a.jsx(mn,{open:W,onOpenChange:J,children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认批量删除"}),a.jsxs(un,{children:["你确定要删除选中的 ",V.size," 个表情包吗?此操作不可撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:de,children:"确认删除"})]})]})}),a.jsx(Rr,{open:L,onOpenChange:U,children:a.jsxs(Nr,{children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"确认删除"}),a.jsx(Gr,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>U(!1),children:"取消"}),a.jsx(ie,{variant:"destructive",onClick:K,children:"删除"})]})]})})]})}function dde({emoji:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[90vh]",children:[a.jsx(Cr,{children:a.jsx(Tr,{children:"表情包详情"})}),a.jsx(fn,{className:"max-h-[calc(90vh-8rem)] pr-4",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex justify-center",children:a.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(t.id),alt:t.description||"表情包",className:"w-full h-full object-cover",onError:s=>{const i=s.target;i.style.display="none";const l=i.parentElement;l&&(l.innerHTML='')}})})}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"ID"}),a.jsx("div",{className:"mt-1 font-mono",children:t.id})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"格式"}),a.jsx("div",{className:"mt-1",children:a.jsx(On,{variant:"outline",children:t.format.toUpperCase()})})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"文件路径"}),a.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.full_path})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"哈希值"}),a.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.emoji_hash})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"描述"}),t.description?a.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:a.jsx(tde,{className:"prose-sm",children:t.description})}):a.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"情绪标签"}),a.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:(()=>{const s=t.emotion?t.emotion.split(/[,,]/).map(i=>i.trim()).filter(Boolean):[];return s.length>0?s.map((i,l)=>a.jsx(On,{variant:"secondary",children:i},l)):a.jsx("span",{className:"text-sm text-muted-foreground",children:"无"})})()})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"状态"}),a.jsxs("div",{className:"mt-2 flex gap-2",children:[t.is_registered&&a.jsx(On,{variant:"default",className:"bg-green-600",children:"已注册"}),t.is_banned&&a.jsx(On,{variant:"destructive",children:"已封禁"}),!t.is_registered&&!t.is_banned&&a.jsx(On,{variant:"outline",children:"未注册"})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"使用次数"}),a.jsx("div",{className:"mt-1 font-mono text-lg",children:t.usage_count})]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"记录时间"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.record_time)})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"注册时间"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.register_time)})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"最后使用"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.last_used_time)})]})]})})]})})}function hde({emoji:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState(""),[l,c]=S.useState(""),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState(!1),{toast:b}=Pr();S.useEffect(()=>{t&&(i(t.description||""),c(t.emotion||""),h(t.is_registered),p(t.is_banned))},[t]);const k=async()=>{if(t)try{v(!0);const O=l.split(/[,,]/).map(j=>j.trim()).filter(Boolean).join(",");await sde(t.id,{description:s||void 0,emotion:O||void 0,is_registered:d,is_banned:m}),b({title:"成功",description:"表情包信息已更新"}),n(!1),r()}catch(O){const j=O instanceof Error?O.message:"保存失败";b({title:"错误",description:j,variant:"destructive"})}finally{v(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑表情包"}),a.jsx(Gr,{children:"修改表情包的描述和标签信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(te,{children:"描述"}),a.jsx(_n,{value:s,onChange:O=>i(O.target.value),placeholder:"输入表情包描述...",rows:3,className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(te,{children:"情绪标签"}),a.jsx(Ae,{value:l,onChange:O=>c(O.target.value),placeholder:"使用逗号分隔多个标签,如:开心, 微笑, 快乐",className:"mt-1"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入多个标签时使用逗号分隔(支持中英文逗号)"})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"is_registered",checked:d,onCheckedChange:O=>h(O===!0)}),a.jsx(te,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"is_banned",checked:m,onCheckedChange:O=>p(O===!0)}),a.jsx(te,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:k,disabled:x,children:x?"保存中...":"保存"})]})]})}):null}function UN({emotions:t}){const e=t?t.split(/[,,]/).map(i=>i.trim()).filter(Boolean):[];if(e.length===0)return a.jsx("span",{className:"text-xs text-muted-foreground",children:"-"});const n=(i,l=6)=>i.length<=l?i:i.slice(0,l)+"...",r=e.slice(0,3),s=e.length-3;return a.jsxs("div",{className:"flex flex-wrap gap-1 max-w-full overflow-hidden",children:[r.map((i,l)=>a.jsx(On,{variant:"secondary",className:"text-xs flex-shrink-0",title:i,children:n(i)},l)),s>0&&a.jsxs(On,{variant:"outline",className:"text-xs flex-shrink-0",title:`还有 ${s} 个标签: ${e.slice(3).join(", ")}`,children:["+",s]})]})}const Pc="/api/webui/expression";async function fde(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.chat_id&&e.append("chat_id",t.chat_id);const n=await ot(`${Pc}/list?${e}`,{headers:bt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取表达方式列表失败")}return n.json()}async function mde(t){const e=await ot(`${Pc}/${t}`,{headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取表达方式详情失败")}return e.json()}async function pde(t){const e=await ot(`${Pc}/`,{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"创建表达方式失败")}return e.json()}async function gde(t,e){const n=await ot(`${Pc}/${t}`,{method:"PATCH",headers:bt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新表达方式失败")}return n.json()}async function xde(t){const e=await ot(`${Pc}/${t}`,{method:"DELETE",headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除表达方式失败")}return e.json()}async function vde(t){const e=await ot(`${Pc}/batch/delete`,{method:"POST",headers:bt(),body:JSON.stringify({ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除表达方式失败")}return e.json()}async function yde(){const t=await ot(`${Pc}/stats/summary`,{headers:bt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}function bde(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(1),[d,h]=S.useState(20),[m,p]=S.useState(""),[x,v]=S.useState(null),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,M]=S.useState(!1),[_,D]=S.useState(null),[E,z]=S.useState(new Set),[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,ce]=S.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),{toast:W}=Pr(),J=async()=>{try{r(!0);const $=await fde({page:l,page_size:d,search:m||void 0});e($.data),i($.total)}catch($){W({title:"加载失败",description:$ instanceof Error?$.message:"无法加载表达方式",variant:"destructive"})}finally{r(!1)}},H=async()=>{try{const $=await yde();$?.data&&ce($.data)}catch($){console.error("加载统计数据失败:",$)}};S.useEffect(()=>{J(),H()},[l,d,m]);const ae=async $=>{try{const fe=await mde($.id);v(fe.data),k(!0)}catch(fe){W({title:"加载详情失败",description:fe instanceof Error?fe.message:"无法加载表达方式详情",variant:"destructive"})}},ne=$=>{v($),j(!0)},ue=async $=>{try{await xde($.id),W({title:"删除成功",description:`已删除表达方式: ${$.situation}`}),D(null),J(),H()}catch(fe){W({title:"删除失败",description:fe instanceof Error?fe.message:"无法删除表达方式",variant:"destructive"})}},R=$=>{const fe=new Set(E);fe.has($)?fe.delete($):fe.add($),z(fe)},me=()=>{E.size===t.length&&t.length>0?z(new Set):z(new Set(t.map($=>$.id)))},Y=async()=>{try{await vde(Array.from(E)),W({title:"批量删除成功",description:`已删除 ${E.size} 个表达方式`}),z(new Set),F(!1),J(),H()}catch($){W({title:"批量删除失败",description:$ instanceof Error?$.message:"无法批量删除表达方式",variant:"destructive"})}},P=()=>{const $=parseInt(L),fe=Math.ceil(s/d);$>=1&&$<=fe?(c($),U("")):W({title:"无效的页码",description:`请输入1-${fe}之间的页码`,variant:"destructive"})},K=$=>$?new Date($*1e3).toLocaleString("zh-CN"):"-";return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsx("div",{className:"mb-4 sm:mb-6",children:a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[a.jsx(Wf,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),a.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),a.jsxs(ie,{onClick:()=>M(!0),className:"gap-2",children:[a.jsx(Wr,{className:"h-4 w-4"}),"新增表达方式"]})]})}),a.jsx(fn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),a.jsx("div",{className:"text-2xl font-bold mt-1",children:V.total})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:V.recent_7days})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:V.chat_count})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx(te,{htmlFor:"search",children:"搜索"}),a.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Ps,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Ae,{id:"search",placeholder:"搜索情境、风格或上下文...",value:m,onChange:$=>p($.target.value),className:"pl-9"})]})}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:E.size>0&&a.jsxs("span",{children:["已选择 ",E.size," 个表达方式"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:d.toString(),onValueChange:$=>{h(parseInt($)),c(1),z(new Set)},children:[a.jsx(Dt,{id:"page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),E.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>z(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:()=>F(!0),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card",children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Ac,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(gt,{className:"w-12",children:a.jsx(ss,{checked:E.size===t.length&&t.length>0,onCheckedChange:me})}),a.jsx(gt,{children:"情境"}),a.jsx(gt,{children:"风格"}),a.jsx(gt,{children:"聊天ID"}),a.jsx(gt,{children:"最后活跃"}),a.jsx(gt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n?a.jsx(xr,{children:a.jsx(it,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map($=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:E.has($.id),onCheckedChange:()=>R($.id)})}),a.jsx(it,{className:"font-medium max-w-xs truncate",children:$.situation}),a.jsx(it,{className:"max-w-xs truncate",children:$.style}),a.jsx(it,{className:"font-mono text-sm",children:$.chat_id}),a.jsx(it,{className:"text-sm text-muted-foreground",children:K($.last_active_time)}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ae($),children:[a.jsx(Fi,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ne($),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>D($),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},$.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map($=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ss,{checked:E.has($.id),onCheckedChange:()=>R($.id),className:"mt-1"}),a.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),a.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:$.situation,children:$.situation})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),a.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:$.style,children:$.style})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天ID"}),a.jsx("p",{className:"font-mono text-xs truncate",children:$.chat_id})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后活跃"}),a.jsx("p",{className:"text-xs",children:K($.last_active_time)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae($),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(Fi,{className:"h-3 w-3 mr-1"}),"查看"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ne($),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>D($),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},$.id))}),s>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",l," / ",Math.ceil(s/d)," 页"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l-1),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ae,{type:"number",value:L,onChange:$=>U($.target.value),onKeyDown:$=>$.key==="Enter"&&P(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/d)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:P,disabled:!L,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l+1),disabled:l>=Math.ceil(s/d),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Mc,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(s/d)),disabled:l>=Math.ceil(s/d),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]})}),a.jsx(wde,{expression:x,open:b,onOpenChange:k}),a.jsx(Sde,{open:T,onOpenChange:M,onSuccess:()=>{J(),H(),M(!1)}}),a.jsx(kde,{expression:x,open:O,onOpenChange:j,onSuccess:()=>{J(),H(),j(!1)}}),a.jsx(mn,{open:!!_,onOpenChange:()=>D(null),children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:['确定要删除表达方式 "',_?.situation,'" 吗? 此操作不可撤销。']})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>_&&ue(_),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),a.jsx(Ode,{open:Q,onOpenChange:F,onConfirm:Y,count:E.size})]})}function wde({expression:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"表达方式详情"}),a.jsx(Gr,{children:"查看表达方式的完整信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Mu,{label:"情境",value:t.situation}),a.jsx(Mu,{label:"风格",value:t.style}),a.jsx(Mu,{icon:mg,label:"聊天ID",value:t.chat_id,mono:!0}),a.jsx(Mu,{icon:mg,label:"记录ID",value:t.id.toString(),mono:!0})]}),t.context&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"上下文"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.context})]}),t.up_content&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"上文内容"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.up_content})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Mu,{icon:uc,label:"最后活跃",value:r(t.last_active_time)}),a.jsx(Mu,{icon:uc,label:"创建时间",value:r(t.create_date)})]})]}),a.jsx(ps,{children:a.jsx(ie,{onClick:()=>n(!1),children:"关闭"})})]})})}function Mu({icon:t,label:e,value:n,mono:r=!1}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs(te,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&a.jsx(t,{className:"h-3 w-3"}),e]}),a.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Sde({open:t,onOpenChange:e,onSuccess:n}){const[r,s]=S.useState({situation:"",style:"",context:"",up_content:"",chat_id:""}),[i,l]=S.useState(!1),{toast:c}=Pr(),d=async()=>{if(!r.situation||!r.style||!r.chat_id){c({title:"验证失败",description:"请填写必填字段:情境、风格和聊天ID",variant:"destructive"});return}try{l(!0),await pde(r),c({title:"创建成功",description:"表达方式已创建"}),s({situation:"",style:"",context:"",up_content:"",chat_id:""}),n()}catch(h){c({title:"创建失败",description:h instanceof Error?h.message:"无法创建表达方式",variant:"destructive"})}finally{l(!1)}};return a.jsx(Rr,{open:t,onOpenChange:e,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"新增表达方式"}),a.jsx(Gr,{children:"创建新的表达方式记录"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"situation",children:["情境 ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Ae,{id:"situation",value:r.situation,onChange:h=>s({...r,situation:h.target.value}),placeholder:"描述使用场景"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"style",children:["风格 ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Ae,{id:"style",value:r.style,onChange:h=>s({...r,style:h.target.value}),placeholder:"描述表达风格"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"chat_id",children:["聊天ID ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Ae,{id:"chat_id",value:r.chat_id,onChange:h=>s({...r,chat_id:h.target.value}),placeholder:"关联的聊天ID"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"context",children:"上下文"}),a.jsx(_n,{id:"context",value:r.context,onChange:h=>s({...r,context:h.target.value}),placeholder:"上下文信息(可选)",rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"up_content",children:"上文内容"}),a.jsx(_n,{id:"up_content",value:r.up_content,onChange:h=>s({...r,up_content:h.target.value}),placeholder:"上文内容(可选)",rows:3})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>e(!1),children:"取消"}),a.jsx(ie,{onClick:d,disabled:i,children:i?"创建中...":"创建"})]})]})})}function kde({expression:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState({}),[l,c]=S.useState(!1),{toast:d}=Pr();S.useEffect(()=>{t&&i({situation:t.situation,style:t.style,context:t.context||"",up_content:t.up_content||"",chat_id:t.chat_id})},[t]);const h=async()=>{if(t)try{c(!0),await gde(t.id,s),d({title:"保存成功",description:"表达方式已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新表达方式",variant:"destructive"})}finally{c(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑表达方式"}),a.jsx(Gr,{children:"修改表达方式的信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_situation",children:"情境"}),a.jsx(Ae,{id:"edit_situation",value:s.situation||"",onChange:m=>i({...s,situation:m.target.value}),placeholder:"描述使用场景"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_style",children:"风格"}),a.jsx(Ae,{id:"edit_style",value:s.style||"",onChange:m=>i({...s,style:m.target.value}),placeholder:"描述表达风格"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_chat_id",children:"聊天ID"}),a.jsx(Ae,{id:"edit_chat_id",value:s.chat_id||"",onChange:m=>i({...s,chat_id:m.target.value}),placeholder:"关联的聊天ID"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_context",children:"上下文"}),a.jsx(_n,{id:"edit_context",value:s.context||"",onChange:m=>i({...s,context:m.target.value}),placeholder:"上下文信息",rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_up_content",children:"上文内容"}),a.jsx(_n,{id:"edit_up_content",value:s.up_content||"",onChange:m=>i({...s,up_content:m.target.value}),placeholder:"上文内容",rows:3})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:h,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function Ode({open:t,onOpenChange:e,onConfirm:n,count:r}){return a.jsx(mn,{open:t,onOpenChange:e,children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认批量删除"}),a.jsxs(un,{children:["您即将删除 ",r," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const Pd="/api/webui/person";async function jde(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.is_known!==void 0&&e.append("is_known",t.is_known.toString()),t.platform&&e.append("platform",t.platform);const n=await ot(`${Pd}/list?${e}`,{headers:bt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取人物列表失败")}return n.json()}async function Nde(t){const e=await ot(`${Pd}/${t}`,{headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取人物详情失败")}return e.json()}async function Cde(t,e){const n=await ot(`${Pd}/${t}`,{method:"PATCH",headers:bt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新人物信息失败")}return n.json()}async function Tde(t){const e=await ot(`${Pd}/${t}`,{method:"DELETE",headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除人物信息失败")}return e.json()}async function Mde(){const t=await ot(`${Pd}/stats/summary`,{headers:bt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}async function Ade(t){const e=await ot(`${Pd}/batch/delete`,{method:"POST",headers:bt(),body:JSON.stringify({person_ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除失败")}return e.json()}function Ede(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(1),[d,h]=S.useState(20),[m,p]=S.useState(""),[x,v]=S.useState(void 0),[b,k]=S.useState(void 0),[O,j]=S.useState(null),[T,M]=S.useState(!1),[_,D]=S.useState(!1),[E,z]=S.useState(null),[Q,F]=S.useState({total:0,known:0,unknown:0,platforms:{}}),[L,U]=S.useState(new Set),[V,ce]=S.useState(!1),[W,J]=S.useState(""),{toast:H}=Pr(),ae=async()=>{try{r(!0);const de=await jde({page:l,page_size:d,search:m||void 0,is_known:x,platform:b});e(de.data),i(de.total)}catch(de){H({title:"加载失败",description:de instanceof Error?de.message:"无法加载人物信息",variant:"destructive"})}finally{r(!1)}},ne=async()=>{try{const de=await Mde();de?.data&&F(de.data)}catch(de){console.error("加载统计数据失败:",de)}};S.useEffect(()=>{ae(),ne()},[l,d,m,x,b]);const ue=async de=>{try{const We=await Nde(de.person_id);j(We.data),M(!0)}catch(We){H({title:"加载详情失败",description:We instanceof Error?We.message:"无法加载人物详情",variant:"destructive"})}},R=de=>{j(de),D(!0)},me=async de=>{try{await Tde(de.person_id),H({title:"删除成功",description:`已删除人物信息: ${de.person_name||de.nickname||de.user_id}`}),z(null),ae(),ne()}catch(We){H({title:"删除失败",description:We instanceof Error?We.message:"无法删除人物信息",variant:"destructive"})}},Y=S.useMemo(()=>Object.keys(Q.platforms),[Q.platforms]),P=de=>{const We=new Set(L);We.has(de)?We.delete(de):We.add(de),U(We)},K=()=>{L.size===t.length&&t.length>0?U(new Set):U(new Set(t.map(de=>de.person_id)))},$=()=>{if(L.size===0){H({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}ce(!0)},fe=async()=>{try{const de=await Ade(Array.from(L));H({title:"批量删除完成",description:de.message}),U(new Set),ce(!1),ae(),ne()}catch(de){H({title:"批量删除失败",description:de instanceof Error?de.message:"批量删除失败",variant:"destructive"})}},ve=()=>{const de=parseInt(W),We=Math.ceil(s/d);de>=1&&de<=We?(c(de),J("")):H({title:"无效的页码",description:`请输入1-${We}之间的页码`,variant:"destructive"})},Re=de=>de?new Date(de*1e3).toLocaleString("zh-CN"):"-";return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsx("div",{className:"mb-4 sm:mb-6",children:a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[a.jsx(Oq,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),a.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),a.jsx(fn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),a.jsx("div",{className:"text-2xl font-bold mt-1",children:Q.total})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:Q.known})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:Q.unknown})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"sm:col-span-2",children:[a.jsx(te,{htmlFor:"search",children:"搜索"}),a.jsxs("div",{className:"relative mt-1.5",children:[a.jsx(Ps,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Ae,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:m,onChange:de=>p(de.target.value),className:"pl-9"})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"filter-known",children:"认识状态"}),a.jsxs(Lt,{value:x===void 0?"all":x.toString(),onValueChange:de=>{v(de==="all"?void 0:de==="true"),c(1)},children:[a.jsx(Dt,{id:"filter-known",className:"mt-1.5",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"true",children:"已认识"}),a.jsx(Pe,{value:"false",children:"未认识"})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"filter-platform",children:"平台"}),a.jsxs(Lt,{value:b||"all",onValueChange:de=>{k(de==="all"?void 0:de),c(1)},children:[a.jsx(Dt,{id:"filter-platform",className:"mt-1.5",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部平台"}),Y.map(de=>a.jsxs(Pe,{value:de,children:[de," (",Q.platforms[de],")"]},de))]})]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:L.size>0&&a.jsxs("span",{children:["已选择 ",L.size," 个人物"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:d.toString(),onValueChange:de=>{h(parseInt(de)),c(1),U(new Set)},children:[a.jsx(Dt,{id:"page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),L.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>U(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:$,children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card",children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Ac,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(gt,{className:"w-12",children:a.jsx(ss,{checked:t.length>0&&L.size===t.length,onCheckedChange:K,"aria-label":"全选"})}),a.jsx(gt,{children:"状态"}),a.jsx(gt,{children:"名称"}),a.jsx(gt,{children:"昵称"}),a.jsx(gt,{children:"平台"}),a.jsx(gt,{children:"用户ID"}),a.jsx(gt,{children:"最后更新"}),a.jsx(gt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(de=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:L.has(de.person_id),onCheckedChange:()=>P(de.person_id),"aria-label":`选择 ${de.person_name||de.nickname||de.user_id}`})}),a.jsx(it,{children:a.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",de.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:de.is_known?"已认识":"未认识"})}),a.jsx(it,{className:"font-medium",children:de.person_name||a.jsx("span",{className:"text-muted-foreground",children:"-"})}),a.jsx(it,{children:de.nickname||"-"}),a.jsx(it,{children:de.platform}),a.jsx(it,{className:"font-mono text-sm",children:de.user_id}),a.jsx(it,{className:"text-sm text-muted-foreground",children:Re(de.last_know)}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ue(de),children:[a.jsx(Fi,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>R(de),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>z(de),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},de.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(de=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ss,{checked:L.has(de.person_id),onCheckedChange:()=>P(de.person_id),className:"mt-1"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",de.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:de.is_known?"已认识":"未认识"}),a.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:de.person_name||a.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),de.nickname&&a.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",de.nickname]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),a.jsx("p",{className:"font-medium text-xs",children:de.platform})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),a.jsx("p",{className:"font-mono text-xs truncate",title:de.user_id,children:de.user_id})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),a.jsx("p",{className:"text-xs",children:Re(de.last_know)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ue(de),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(Fi,{className:"h-3 w-3 mr-1"}),"查看"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>R(de),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>z(de),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},de.id))}),s>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",l," / ",Math.ceil(s/d)," 页"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l-1),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ae,{type:"number",value:W,onChange:de=>J(de.target.value),onKeyDown:de=>de.key==="Enter"&&ve(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/d)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:ve,disabled:!W,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l+1),disabled:l>=Math.ceil(s/d),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Mc,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(s/d)),disabled:l>=Math.ceil(s/d),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]})}),a.jsx(_de,{person:O,open:T,onOpenChange:M}),a.jsx(Dde,{person:O,open:_,onOpenChange:D,onSuccess:()=>{ae(),ne(),D(!1)}}),a.jsx(mn,{open:!!E,onOpenChange:()=>z(null),children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认删除"}),a.jsxs(un,{children:['确定要删除人物信息 "',E?.person_name||E?.nickname||E?.user_id,'" 吗? 此操作不可撤销。']})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:()=>E&&me(E),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),a.jsx(mn,{open:V,onOpenChange:ce,children:a.jsxs(an,{children:[a.jsxs(ln,{children:[a.jsx(cn,{children:"确认批量删除"}),a.jsxs(un,{children:["确定要删除选中的 ",L.size," 个人物信息吗? 此操作不可撤销。"]})]}),a.jsxs(on,{children:[a.jsx(hn,{children:"取消"}),a.jsx(dn,{onClick:fe,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function _de({person:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"人物详情"}),a.jsxs(Gr,{children:["查看 ",t.person_name||t.nickname||t.user_id," 的完整信息"]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Ka,{icon:D9,label:"人物名称",value:t.person_name}),a.jsx(Ka,{icon:Wf,label:"昵称",value:t.nickname}),a.jsx(Ka,{icon:mg,label:"用户ID",value:t.user_id,mono:!0}),a.jsx(Ka,{icon:mg,label:"人物ID",value:t.person_id,mono:!0}),a.jsx(Ka,{label:"平台",value:t.platform}),a.jsx(Ka,{label:"状态",value:t.is_known?"已认识":"未认识"})]}),t.name_reason&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),a.jsx("p",{className:"mt-1 text-sm",children:t.name_reason})]}),t.memory_points&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"个人印象"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.memory_points})]}),t.group_nick_name&&t.group_nick_name.length>0&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"群昵称"}),a.jsx("div",{className:"mt-2 space-y-1",children:t.group_nick_name.map((s,i)=>a.jsxs("div",{className:"text-sm flex items-center gap-2",children:[a.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:s.group_id}),a.jsx("span",{children:"→"}),a.jsx("span",{children:s.group_nick_name})]},i))})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsx(Ka,{icon:uc,label:"认识时间",value:r(t.know_times)}),a.jsx(Ka,{icon:uc,label:"首次记录",value:r(t.know_since)}),a.jsx(Ka,{icon:uc,label:"最后更新",value:r(t.last_know)})]})]}),a.jsx(ps,{children:a.jsx(ie,{onClick:()=>n(!1),children:"关闭"})})]})})}function Ka({icon:t,label:e,value:n,mono:r=!1}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs(te,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&a.jsx(t,{className:"h-3 w-3"}),e]}),a.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Dde({person:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState({}),[l,c]=S.useState(!1),{toast:d}=Pr();S.useEffect(()=>{t&&i({person_name:t.person_name||"",name_reason:t.name_reason||"",nickname:t.nickname||"",memory_points:t.memory_points||"",is_known:t.is_known})},[t]);const h=async()=>{if(t)try{c(!0),await Cde(t.person_id,s),d({title:"保存成功",description:"人物信息已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新人物信息",variant:"destructive"})}finally{c(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑人物信息"}),a.jsxs(Gr,{children:["修改 ",t.person_name||t.nickname||t.user_id," 的信息"]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"person_name",children:"人物名称"}),a.jsx(Ae,{id:"person_name",value:s.person_name||"",onChange:m=>i({...s,person_name:m.target.value}),placeholder:"为这个人设置一个名称"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称"}),a.jsx(Ae,{id:"nickname",value:s.nickname||"",onChange:m=>i({...s,nickname:m.target.value}),placeholder:"昵称"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"name_reason",children:"名称设定原因"}),a.jsx(_n,{id:"name_reason",value:s.name_reason||"",onChange:m=>i({...s,name_reason:m.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"memory_points",children:"个人印象"}),a.jsx(_n,{id:"memory_points",value:s.memory_points||"",onChange:m=>i({...s,memory_points:m.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),a.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[a.jsxs("div",{children:[a.jsx(te,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),a.jsx(jt,{id:"is_known",checked:s.is_known,onCheckedChange:m=>i({...s,is_known:m})})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:h,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function Rde(t,e,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:n}).format(e).split(/\s/g).slice(2).join(" ")}const zde={},Wh={};function cc(t,e){try{const r=(zde[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in Wh?Wh[r]:VN(r,r.split(":"))}catch{if(t in Wh)return Wh[t];const n=t?.match(Pde);return n?VN(t,n.slice(1)):NaN}}const Pde=/([+-]\d\d):?(\d\d)?/;function VN(t,e){const n=+(e[0]||0),r=+(e[1]||0),s=+(e[2]||0)/60;return Wh[t]=n*60+r>0?n*60+r+s:n*60-r-s}class ga extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(cc(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),lz(this),R4(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new ga(...n,e):new ga(Date.now(),e)}withTimeZone(e){return new ga(+this,e)}getTimezoneOffset(){const e=-cc(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),R4(this),+this}[Symbol.for("constructDateFrom")](e){return new ga(+new Date(e),this.timeZone)}}const WN=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!WN.test(t))return;const e=t.replace(WN,"$1UTC");ga.prototype[e]&&(t.startsWith("get")?ga.prototype[t]=function(){return this.internal[e]()}:(ga.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),Bde(this),+this},ga.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),R4(this),+this}))});function R4(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-cc(t.timeZone,t)*60))}function Bde(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),lz(t)}function lz(t){const e=cc(t.timeZone,t),n=e>0?Math.floor(e):Math.ceil(e),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const s=-new Date(+t).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),l=s-i,c=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();l&&c&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+l);const d=s-n;d&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+d);const h=new Date(+t);h.setUTCSeconds(0);const m=s>0?h.getSeconds():(h.getSeconds()-60)%60,p=Math.round(-(cc(t.timeZone,t)*60))%60;(p||m)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+p),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+p+m));const x=cc(t.timeZone,t),v=x>0?Math.floor(x):Math.ceil(x),k=-new Date(+t).getTimezoneOffset()-v,O=v!==n,j=k-d;if(O&&j){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+j);const T=cc(t.timeZone,t),M=T>0?Math.floor(T):Math.ceil(T),_=v-M;_&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+_),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+_))}}class Zr extends ga{static tz(e,...n){return n.length?new Zr(...n,e):new Zr(Date.now(),e)}toISOString(){const[e,n,r]=this.tzComponents(),s=`${e}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,n,r,s]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${r} ${n} ${s}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[n,r,s]=this.tzComponents();return`${e} GMT${n}${r}${s} (${Rde(this.timeZone,this)})`}toLocaleString(e,n){return Date.prototype.toLocaleString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(e,n){return Date.prototype.toLocaleDateString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(e,n){return Date.prototype.toLocaleTimeString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),n=e>0?"-":"+",r=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),s=String(Math.abs(e)%60).padStart(2,"0");return[n,r,s]}withTimeZone(e){return new Zr(+this,e)}[Symbol.for("constructDateFrom")](e){return new Zr(+new Date(e),this.timeZone)}}const oz=6048e5,Lde=864e5,GN=Symbol.for("constructDateFrom");function vr(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&GN in t?t[GN](e):t instanceof Date?new t.constructor(e):new Date(e)}function Nn(t,e){return vr(e||t,t)}function cz(t,e,n){const r=Nn(t,n?.in);return isNaN(e)?vr(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function uz(t,e,n){const r=Nn(t,n?.in);if(isNaN(e))return vr(t,NaN);if(!e)return r;const s=r.getDate(),i=vr(t,r.getTime());i.setMonth(r.getMonth()+e+1,0);const l=i.getDate();return s>=l?i:(r.setFullYear(i.getFullYear(),i.getMonth(),s),r)}let Ide={};function O0(){return Ide}function wo(t,e){const n=O0(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Nn(t,e?.in),i=s.getDay(),l=(i=i.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function XN(t){const e=Nn(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Bc(t,...e){const n=vr.bind(null,t||e.find(r=>typeof r=="object"));return e.map(n)}function Qf(t,e){const n=Nn(t,e?.in);return n.setHours(0,0,0,0),n}function hz(t,e,n){const[r,s]=Bc(n?.in,t,e),i=Qf(r),l=Qf(s),c=+i-XN(i),d=+l-XN(l);return Math.round((c-d)/Lde)}function qde(t,e){const n=dz(t,e),r=vr(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Ff(r)}function Fde(t,e,n){return cz(t,e*7,n)}function Qde(t,e,n){return uz(t,e*12,n)}function $de(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=vr.bind(null,s));const i=Nn(s,r);(!n||n{!r&&typeof s=="object"&&(r=vr.bind(null,s));const i=Nn(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),vr(r,n||NaN)}function Ude(t,e,n){const[r,s]=Bc(n?.in,t,e);return+Qf(r)==+Qf(s)}function fz(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Vde(t){return!(!fz(t)&&typeof t!="number"||isNaN(+Nn(t)))}function Wde(t,e,n){const[r,s]=Bc(n?.in,t,e),i=r.getFullYear()-s.getFullYear(),l=r.getMonth()-s.getMonth();return i*12+l}function Gde(t,e){const n=Nn(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function mz(t,e){const[n,r]=Bc(t,e.start,e.end);return{start:n,end:r}}function Xde(t,e){const{start:n,end:r}=mz(e?.in,t);let s=+n>+r;const i=s?+n:+r,l=s?r:n;l.setHours(0,0,0,0),l.setDate(1);let c=1;const d=[];for(;+l<=i;)d.push(vr(n,l)),l.setMonth(l.getMonth()+c);return s?d.reverse():d}function Yde(t,e){const n=Nn(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Kde(t,e){const n=Nn(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function pz(t,e){const n=Nn(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Zde(t,e){const{start:n,end:r}=mz(e?.in,t);let s=+n>+r;const i=s?+n:+r,l=s?r:n;l.setHours(0,0,0,0),l.setMonth(0,1);let c=1;const d=[];for(;+l<=i;)d.push(vr(n,l)),l.setFullYear(l.getFullYear()+c);return s?d.reverse():d}function gz(t,e){const n=O0(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Nn(t,e?.in),i=s.getDay(),l=(i{let r;const s=ehe[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function td(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const nhe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},rhe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},she={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ihe={date:td({formats:nhe,defaultWidth:"full"}),time:td({formats:rhe,defaultWidth:"full"}),dateTime:td({formats:she,defaultWidth:"full"})},ahe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},lhe=(t,e,n,r)=>ahe[t];function oa(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const l=t.defaultFormattingWidth||t.defaultWidth,c=n?.width?String(n.width):l;s=t.formattingValues[c]||t.formattingValues[l]}else{const l=t.defaultWidth,c=n?.width?String(n.width):t.defaultWidth;s=t.values[c]||t.values[l]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const ohe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},che={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},uhe={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},dhe={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},hhe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},fhe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},mhe=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},phe={ordinalNumber:mhe,era:oa({values:ohe,defaultWidth:"wide"}),quarter:oa({values:che,defaultWidth:"wide",argumentCallback:t=>t-1}),month:oa({values:uhe,defaultWidth:"wide"}),day:oa({values:dhe,defaultWidth:"wide"}),dayPeriod:oa({values:hhe,defaultWidth:"wide",formattingValues:fhe,defaultFormattingWidth:"wide"})};function ca(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const l=i[0],c=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],d=Array.isArray(c)?xhe(c,p=>p.test(l)):ghe(c,p=>p.test(l));let h;h=t.valueCallback?t.valueCallback(d):d,h=n.valueCallback?n.valueCallback(h):h;const m=e.slice(l.length);return{value:h,rest:m}}}function ghe(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function xhe(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let l=t.valueCallback?t.valueCallback(i[0]):i[0];l=n.valueCallback?n.valueCallback(l):l;const c=e.slice(s.length);return{value:l,rest:c}}}const vhe=/^(\d+)(th|st|nd|rd)?/i,yhe=/\d+/i,bhe={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},whe={any:[/^b/i,/^(a|c)/i]},She={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},khe={any:[/1/i,/2/i,/3/i,/4/i]},Ohe={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},jhe={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Nhe={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Che={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},The={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Mhe={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Ahe={ordinalNumber:xz({matchPattern:vhe,parsePattern:yhe,valueCallback:t=>parseInt(t,10)}),era:ca({matchPatterns:bhe,defaultMatchWidth:"wide",parsePatterns:whe,defaultParseWidth:"any"}),quarter:ca({matchPatterns:She,defaultMatchWidth:"wide",parsePatterns:khe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:ca({matchPatterns:Ohe,defaultMatchWidth:"wide",parsePatterns:jhe,defaultParseWidth:"any"}),day:ca({matchPatterns:Nhe,defaultMatchWidth:"wide",parsePatterns:Che,defaultParseWidth:"any"}),dayPeriod:ca({matchPatterns:The,defaultMatchWidth:"any",parsePatterns:Mhe,defaultParseWidth:"any"})},G5={code:"en-US",formatDistance:the,formatLong:ihe,formatRelative:lhe,localize:phe,match:Ahe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ehe(t,e){const n=Nn(t,e?.in);return hz(n,pz(n))+1}function vz(t,e){const n=Nn(t,e?.in),r=+Ff(n)-+qde(n);return Math.round(r/oz)+1}function yz(t,e){const n=Nn(t,e?.in),r=n.getFullYear(),s=O0(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,l=vr(e?.in||t,0);l.setFullYear(r+1,0,i),l.setHours(0,0,0,0);const c=wo(l,e),d=vr(e?.in||t,0);d.setFullYear(r,0,i),d.setHours(0,0,0,0);const h=wo(d,e);return+n>=+c?r+1:+n>=+h?r:r-1}function _he(t,e){const n=O0(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=yz(t,e),i=vr(e?.in||t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),wo(i,e)}function bz(t,e){const n=Nn(t,e?.in),r=+wo(n,e)-+_he(n,e);return Math.round(r/oz)+1}function xn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const Kl={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return xn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):xn(n+1,2)},d(t,e){return xn(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return xn(t.getHours()%12||12,e.length)},H(t,e){return xn(t.getHours(),e.length)},m(t,e){return xn(t.getMinutes(),e.length)},s(t,e){return xn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return xn(s,e.length)}},Au={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},YN={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return Kl.y(t,e)},Y:function(t,e,n,r){const s=yz(t,r),i=s>0?s:1-s;if(e==="YY"){const l=i%100;return xn(l,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):xn(i,e.length)},R:function(t,e){const n=dz(t);return xn(n,e.length)},u:function(t,e){const n=t.getFullYear();return xn(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return xn(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return xn(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return Kl.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return xn(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const s=bz(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):xn(s,e.length)},I:function(t,e,n){const r=vz(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):xn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Kl.d(t,e)},D:function(t,e,n){const r=Ehe(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):xn(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return xn(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return xn(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return xn(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let s;switch(r===12?s=Au.noon:r===0?s=Au.midnight:s=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let s;switch(r>=17?s=Au.evening:r>=12?s=Au.afternoon:r>=4?s=Au.morning:s=Au.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Kl.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Kl.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):xn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):xn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Kl.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Kl.s(t,e)},S:function(t,e){return Kl.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return ZN(r);case"XXXX":case"XX":return nc(r);case"XXXXX":case"XXX":default:return nc(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return ZN(r);case"xxxx":case"xx":return nc(r);case"xxxxx":case"xxx":default:return nc(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+KN(r,":");case"OOOO":default:return"GMT"+nc(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+KN(r,":");case"zzzz":default:return"GMT"+nc(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return xn(r,e.length)},T:function(t,e,n){return xn(+t,e.length)}};function KN(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+e+xn(i,2)}function ZN(t,e){return t%60===0?(t>0?"-":"+")+xn(Math.abs(t)/60,2):nc(t,e)}function nc(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=xn(Math.trunc(r/60),2),i=xn(r%60,2);return n+s+e+i}const JN=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},wz=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Dhe=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return JN(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",JN(r,e)).replace("{{time}}",wz(s,e))},Rhe={p:wz,P:Dhe},zhe=/^D+$/,Phe=/^Y+$/,Bhe=["D","DD","YY","YYYY"];function Lhe(t){return zhe.test(t)}function Ihe(t){return Phe.test(t)}function qhe(t,e,n){const r=Fhe(t,e,n);if(console.warn(r),Bhe.includes(t))throw new RangeError(r)}function Fhe(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Qhe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,$he=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Hhe=/^'([^]*?)'?$/,Uhe=/''/g,Vhe=/[a-zA-Z]/;function dg(t,e,n){const r=O0(),s=n?.locale??r.locale??G5,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,l=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,c=Nn(t,n?.in);if(!Vde(c))throw new RangeError("Invalid time value");let d=e.match($he).map(m=>{const p=m[0];if(p==="p"||p==="P"){const x=Rhe[p];return x(m,s.formatLong)}return m}).join("").match(Qhe).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const p=m[0];if(p==="'")return{isToken:!1,value:Whe(m)};if(YN[p])return{isToken:!0,value:m};if(p.match(Vhe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+p+"`");return{isToken:!1,value:m}});s.localize.preprocessor&&(d=s.localize.preprocessor(c,d));const h={firstWeekContainsDate:i,weekStartsOn:l,locale:s};return d.map(m=>{if(!m.isToken)return m.value;const p=m.value;(!n?.useAdditionalWeekYearTokens&&Ihe(p)||!n?.useAdditionalDayOfYearTokens&&Lhe(p))&&qhe(p,e,String(t));const x=YN[p[0]];return x(c,p,s.localize,h)}).join("")}function Whe(t){const e=t.match(Hhe);return e?e[1].replace(Uhe,"'"):t}function Ghe(t,e){const n=Nn(t,e?.in),r=n.getFullYear(),s=n.getMonth(),i=vr(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function Xhe(t,e){return Nn(t,e?.in).getMonth()}function Yhe(t,e){return Nn(t,e?.in).getFullYear()}function Khe(t,e){return+Nn(t)>+Nn(e)}function Zhe(t,e){return+Nn(t)<+Nn(e)}function Jhe(t,e,n){const[r,s]=Bc(n?.in,t,e);return+wo(r,n)==+wo(s,n)}function efe(t,e,n){const[r,s]=Bc(n?.in,t,e);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function tfe(t,e,n){const[r,s]=Bc(n?.in,t,e);return r.getFullYear()===s.getFullYear()}function nfe(t,e,n){const r=Nn(t,n?.in),s=r.getFullYear(),i=r.getDate(),l=vr(t,0);l.setFullYear(s,e,15),l.setHours(0,0,0,0);const c=Ghe(l);return r.setMonth(e,Math.min(i,c)),r}function rfe(t,e,n){const r=Nn(t,n?.in);return isNaN(+r)?vr(t,NaN):(r.setFullYear(e),r)}const e9=5,sfe=4;function ife(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,s=e.addDays(t,-r+1),i=e.addDays(s,e9*7-1);return e.getMonth(t)===e.getMonth(i)?e9:sfe}function Sz(t,e){const n=e.startOfMonth(t),r=n.getDay();return r===1?n:r===0?e.addDays(n,-6):e.addDays(n,-1*(r-1))}function afe(t,e){const n=Sz(t,e),r=ife(t,e);return e.addDays(n,r*7-1)}class ii{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Zr.tz(this.options.timeZone):new this.Date,this.newDate=(r,s,i)=>this.overrides?.newDate?this.overrides.newDate(r,s,i):this.options.timeZone?new Zr(r,s,i,this.options.timeZone):new Date(r,s,i),this.addDays=(r,s)=>this.overrides?.addDays?this.overrides.addDays(r,s):cz(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):uz(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):Fde(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):Qde(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):hz(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):Wde(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Xde(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):Zde(r),i=new Set(s.map(c=>this.getYear(c)));if(i.size===s.length)return s;const l=[];return i.forEach(c=>{l.push(new Date(c,0,1))}),l},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):afe(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):Jde(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):Gde(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):gz(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):Kde(r),this.format=(r,s,i)=>{const l=this.overrides?.format?this.overrides.format(r,s,this.options):dg(r,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(l):l},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):vz(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):Xhe(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):Yhe(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):bz(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):Khe(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):Zhe(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):fz(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):Ude(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):efe(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):tfe(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):$de(r),this.min=r=>this.overrides?.min?this.overrides.min(r):Hde(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):nfe(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):rfe(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):Sz(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):Qf(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Ff(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):Yde(r),this.startOfWeek=(r,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):wo(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):pz(r),this.options={locale:G5,...e},this.overrides=n}getDigitMap(){const{numerals:e="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:e}),r={};for(let s=0;s<10;s++)r[s.toString()]=n.format(s);return r}replaceDigits(e){const n=this.getDigitMap();return e.replace(/\d/g,r=>n[r]||r)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&ii.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:s}=this.options,i=n?.code;if(i&&ii.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:s}).format(e)}catch{}const l=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,l)}}ii.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Ma=new ii;class kz{constructor(e,n,r=Ma){this.date=e,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(e,n)),this.dateLib=r}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class lfe{constructor(e,n){this.date=e,this.weeks=n}}class ofe{constructor(e,n){this.days=n,this.weekNumber=e}}function cfe(t){return Ue.createElement("button",{...t})}function ufe(t){return Ue.createElement("span",{...t})}function dfe(t){const{size:e=24,orientation:n="left",className:r}=t;return Ue.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&Ue.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&Ue.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&Ue.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&Ue.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function hfe(t){const{day:e,modifiers:n,...r}=t;return Ue.createElement("td",{...r})}function ffe(t){const{day:e,modifiers:n,...r}=t,s=Ue.useRef(null);return Ue.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),Ue.createElement("button",{ref:s,...r})}var et;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})(et||(et={}));var Yn;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(Yn||(Yn={}));var Li;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(Li||(Li={}));var ei;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(ei||(ei={}));function mfe(t){const{options:e,className:n,components:r,classNames:s,...i}=t,l=[s[et.Dropdown],n].join(" "),c=e?.find(({value:d})=>d===i.value);return Ue.createElement("span",{"data-disabled":i.disabled,className:s[et.DropdownRoot]},Ue.createElement(r.Select,{className:l,...i},e?.map(({value:d,label:h,disabled:m})=>Ue.createElement(r.Option,{key:d,value:d,disabled:m},h))),Ue.createElement("span",{className:s[et.CaptionLabel],"aria-hidden":!0},c?.label,Ue.createElement(r.Chevron,{orientation:"down",size:18,className:s[et.Chevron]})))}function pfe(t){return Ue.createElement("div",{...t})}function gfe(t){return Ue.createElement("div",{...t})}function xfe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return Ue.createElement("div",{...r},t.children)}function vfe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return Ue.createElement("div",{...r})}function yfe(t){return Ue.createElement("table",{...t})}function bfe(t){return Ue.createElement("div",{...t})}const Oz=S.createContext(void 0);function j0(){const t=S.useContext(Oz);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function wfe(t){const{components:e}=j0();return Ue.createElement(e.Dropdown,{...t})}function Sfe(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:s,...i}=t,{components:l,classNames:c,labels:{labelPrevious:d,labelNext:h}}=j0(),m=S.useCallback(x=>{s&&n?.(x)},[s,n]),p=S.useCallback(x=>{r&&e?.(x)},[r,e]);return Ue.createElement("nav",{...i},Ue.createElement(l.PreviousMonthButton,{type:"button",className:c[et.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":d(r),onClick:p},Ue.createElement(l.Chevron,{disabled:r?void 0:!0,className:c[et.Chevron],orientation:"left"})),Ue.createElement(l.NextMonthButton,{type:"button",className:c[et.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":h(s),onClick:m},Ue.createElement(l.Chevron,{disabled:s?void 0:!0,orientation:"right",className:c[et.Chevron]})))}function kfe(t){const{components:e}=j0();return Ue.createElement(e.Button,{...t})}function Ofe(t){return Ue.createElement("option",{...t})}function jfe(t){const{components:e}=j0();return Ue.createElement(e.Button,{...t})}function Nfe(t){const{rootRef:e,...n}=t;return Ue.createElement("div",{...n,ref:e})}function Cfe(t){return Ue.createElement("select",{...t})}function Tfe(t){const{week:e,...n}=t;return Ue.createElement("tr",{...n})}function Mfe(t){return Ue.createElement("th",{...t})}function Afe(t){return Ue.createElement("thead",{"aria-hidden":!0},Ue.createElement("tr",{...t}))}function Efe(t){const{week:e,...n}=t;return Ue.createElement("th",{...n})}function _fe(t){return Ue.createElement("th",{...t})}function Dfe(t){return Ue.createElement("tbody",{...t})}function Rfe(t){const{components:e}=j0();return Ue.createElement(e.Dropdown,{...t})}const zfe=Object.freeze(Object.defineProperty({__proto__:null,Button:cfe,CaptionLabel:ufe,Chevron:dfe,Day:hfe,DayButton:ffe,Dropdown:mfe,DropdownNav:pfe,Footer:gfe,Month:xfe,MonthCaption:vfe,MonthGrid:yfe,Months:bfe,MonthsDropdown:wfe,Nav:Sfe,NextMonthButton:kfe,Option:Ofe,PreviousMonthButton:jfe,Root:Nfe,Select:Cfe,Week:Tfe,WeekNumber:Efe,WeekNumberHeader:_fe,Weekday:Mfe,Weekdays:Afe,Weeks:Dfe,YearsDropdown:Rfe},Symbol.toStringTag,{value:"Module"}));function al(t,e,n=!1,r=Ma){let{from:s,to:i}=t;const{differenceInCalendarDays:l,isSameDay:c}=r;return s&&i?(l(i,s)<0&&([s,i]=[i,s]),l(e,s)>=(n?1:0)&&l(i,e)>=(n?1:0)):!n&&i?c(i,e):!n&&s?c(s,e):!1}function jz(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function X5(t){return!!(t&&typeof t=="object"&&"from"in t)}function Nz(t){return!!(t&&typeof t=="object"&&"after"in t)}function Cz(t){return!!(t&&typeof t=="object"&&"before"in t)}function Tz(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function Mz(t,e){return Array.isArray(t)&&t.every(e.isDate)}function ll(t,e,n=Ma){const r=Array.isArray(e)?e:[e],{isSameDay:s,differenceInCalendarDays:i,isAfter:l}=n;return r.some(c=>{if(typeof c=="boolean")return c;if(n.isDate(c))return s(t,c);if(Mz(c,n))return c.includes(t);if(X5(c))return al(c,t,!1,n);if(Tz(c))return Array.isArray(c.dayOfWeek)?c.dayOfWeek.includes(t.getDay()):c.dayOfWeek===t.getDay();if(jz(c)){const d=i(c.before,t),h=i(c.after,t),m=d>0,p=h<0;return l(c.before,c.after)?p&&m:m||p}return Nz(c)?i(t,c.after)>0:Cz(c)?i(c.before,t)>0:typeof c=="function"?c(t):!1})}function Pfe(t,e,n,r,s){const{disabled:i,hidden:l,modifiers:c,showOutsideDays:d,broadcastCalendar:h,today:m}=e,{isSameDay:p,isSameMonth:x,startOfMonth:v,isBefore:b,endOfMonth:k,isAfter:O}=s,j=n&&v(n),T=r&&k(r),M={[Yn.focused]:[],[Yn.outside]:[],[Yn.disabled]:[],[Yn.hidden]:[],[Yn.today]:[]},_={};for(const D of t){const{date:E,displayMonth:z}=D,Q=!!(z&&!x(E,z)),F=!!(j&&b(E,j)),L=!!(T&&O(E,T)),U=!!(i&&ll(E,i,s)),V=!!(l&&ll(E,l,s))||F||L||!h&&!d&&Q||h&&d===!1&&Q,ce=p(E,m??s.today());Q&&M.outside.push(D),U&&M.disabled.push(D),V&&M.hidden.push(D),ce&&M.today.push(D),c&&Object.keys(c).forEach(W=>{const J=c?.[W];J&&ll(E,J,s)&&(_[W]?_[W].push(D):_[W]=[D])})}return D=>{const E={[Yn.focused]:!1,[Yn.disabled]:!1,[Yn.hidden]:!1,[Yn.outside]:!1,[Yn.today]:!1},z={};for(const Q in M){const F=M[Q];E[Q]=F.some(L=>L===D)}for(const Q in _)z[Q]=_[Q].some(F=>F===D);return{...E,...z}}}function Bfe(t,e,n={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):e[Yn[i]]?s.push(e[Yn[i]]):e[Li[i]]&&s.push(e[Li[i]]),s),[e[et.Day]])}function Lfe(t){return{...zfe,...t}}function Ife(t){const e={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([n,r])=>{n.startsWith("data-")&&(e[n]=r)}),e}function Y5(){const t={};for(const e in et)t[et[e]]=`rdp-${et[e]}`;for(const e in Yn)t[Yn[e]]=`rdp-${Yn[e]}`;for(const e in Li)t[Li[e]]=`rdp-${Li[e]}`;for(const e in ei)t[ei[e]]=`rdp-${ei[e]}`;return t}function Az(t,e,n){return(n??new ii(e)).formatMonthYear(t)}const qfe=Az;function Ffe(t,e,n){return(n??new ii(e)).format(t,"d")}function Qfe(t,e=Ma){return e.format(t,"LLLL")}function $fe(t,e,n){return(n??new ii(e)).format(t,"cccccc")}function Hfe(t,e=Ma){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function Ufe(){return""}function Ez(t,e=Ma){return e.format(t,"yyyy")}const Vfe=Ez,Wfe=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:Az,formatDay:Ffe,formatMonthCaption:qfe,formatMonthDropdown:Qfe,formatWeekNumber:Hfe,formatWeekNumberHeader:Ufe,formatWeekdayName:$fe,formatYearCaption:Vfe,formatYearDropdown:Ez},Symbol.toStringTag,{value:"Module"}));function Gfe(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...Wfe,...t}}function Xfe(t,e,n,r,s){const{startOfMonth:i,startOfYear:l,endOfYear:c,eachMonthOfInterval:d,getMonth:h}=s;return d({start:l(t),end:c(t)}).map(x=>{const v=r.formatMonthDropdown(x,s),b=h(x),k=e&&xi(n)||!1;return{value:b,label:v,disabled:k}})}function Yfe(t,e={},n={}){let r={...e?.[et.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function Kfe(t,e,n){const r=t.today(),s=e?t.startOfISOWeek(r):t.startOfWeek(r),i=[];for(let l=0;l<7;l++){const c=t.addDays(s,l);i.push(c)}return i}function Zfe(t,e,n,r,s=!1){if(!t||!e)return;const{startOfYear:i,endOfYear:l,eachYearOfInterval:c,getYear:d}=r,h=i(t),m=l(e),p=c({start:h,end:m});return s&&p.reverse(),p.map(x=>{const v=n.formatYearDropdown(x,r);return{value:d(x),label:v,disabled:!1}})}function _z(t,e,n,r){let s=(r??new ii(n)).format(t,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s}const Jfe=_z;function Dz(t,e,n){return(n??new ii(e)).formatMonthYear(t)}const e0e=Dz;function t0e(t,e,n,r){let s=(r??new ii(n)).format(t,"PPPP");return e?.today&&(s=`Today, ${s}`),s}function n0e(t){return"Choose the Month"}function r0e(){return""}function s0e(t){return"Go to the Next Month"}function i0e(t){return"Go to the Previous Month"}function a0e(t,e,n){return(n??new ii(e)).format(t,"cccc")}function l0e(t,e){return`Week ${t}`}function o0e(t){return"Week Number"}function c0e(t){return"Choose the Year"}const u0e=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:e0e,labelDay:Jfe,labelDayButton:_z,labelGrid:Dz,labelGridcell:t0e,labelMonthDropdown:n0e,labelNav:r0e,labelNext:s0e,labelPrevious:i0e,labelWeekNumber:l0e,labelWeekNumberHeader:o0e,labelWeekday:a0e,labelYearDropdown:c0e},Symbol.toStringTag,{value:"Module"})),N0=t=>t instanceof HTMLElement?t:null,Ub=t=>[...t.querySelectorAll("[data-animated-month]")??[]],d0e=t=>N0(t.querySelector("[data-animated-month]")),Vb=t=>N0(t.querySelector("[data-animated-caption]")),Wb=t=>N0(t.querySelector("[data-animated-weeks]")),h0e=t=>N0(t.querySelector("[data-animated-nav]")),f0e=t=>N0(t.querySelector("[data-animated-weekdays]"));function m0e(t,e,{classNames:n,months:r,focused:s,dateLib:i}){const l=S.useRef(null),c=S.useRef(r),d=S.useRef(!1);S.useLayoutEffect(()=>{const h=c.current;if(c.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||h.length===0||r.length!==h.length)return;const m=i.isSameMonth(r[0].date,h[0].date),p=i.isAfter(r[0].date,h[0].date),x=p?n[ei.caption_after_enter]:n[ei.caption_before_enter],v=p?n[ei.weeks_after_enter]:n[ei.weeks_before_enter],b=l.current,k=t.current.cloneNode(!0);if(k instanceof HTMLElement?(Ub(k).forEach(M=>{if(!(M instanceof HTMLElement))return;const _=d0e(M);_&&M.contains(_)&&M.removeChild(_);const D=Vb(M);D&&D.classList.remove(x);const E=Wb(M);E&&E.classList.remove(v)}),l.current=k):l.current=null,d.current||m||s)return;const O=b instanceof HTMLElement?Ub(b):[],j=Ub(t.current);if(j?.every(T=>T instanceof HTMLElement)&&O&&O.every(T=>T instanceof HTMLElement)){d.current=!0,t.current.style.isolation="isolate";const T=h0e(t.current);T&&(T.style.zIndex="1"),j.forEach((M,_)=>{const D=O[_];if(!D)return;M.style.position="relative",M.style.overflow="hidden";const E=Vb(M);E&&E.classList.add(x);const z=Wb(M);z&&z.classList.add(v);const Q=()=>{d.current=!1,t.current&&(t.current.style.isolation=""),T&&(T.style.zIndex=""),E&&E.classList.remove(x),z&&z.classList.remove(v),M.style.position="",M.style.overflow="",M.contains(D)&&M.removeChild(D)};D.style.pointerEvents="none",D.style.position="absolute",D.style.overflow="hidden",D.setAttribute("aria-hidden","true");const F=f0e(D);F&&(F.style.opacity="0");const L=Vb(D);L&&(L.classList.add(p?n[ei.caption_before_exit]:n[ei.caption_after_exit]),L.addEventListener("animationend",Q));const U=Wb(D);U&&U.classList.add(p?n[ei.weeks_before_exit]:n[ei.weeks_after_exit]),M.insertBefore(D,M.firstChild)})}})}function p0e(t,e,n,r){const s=t[0],i=t[t.length-1],{ISOWeek:l,fixedWeeks:c,broadcastCalendar:d}=n??{},{addDays:h,differenceInCalendarDays:m,differenceInCalendarMonths:p,endOfBroadcastWeek:x,endOfISOWeek:v,endOfMonth:b,endOfWeek:k,isAfter:O,startOfBroadcastWeek:j,startOfISOWeek:T,startOfWeek:M}=r,_=d?j(s,r):l?T(s):M(s),D=d?x(i):l?v(b(i)):k(b(i)),E=m(D,_),z=p(i,s)+1,Q=[];for(let U=0;U<=E;U++){const V=h(_,U);if(e&&O(V,e))break;Q.push(V)}const L=(d?35:42)*z;if(c&&Q.length{const s=r.weeks.reduce((i,l)=>i.concat(l.days.slice()),e.slice());return n.concat(s.slice())},e.slice())}function x0e(t,e,n,r){const{numberOfMonths:s=1}=n,i=[];for(let l=0;le)break;i.push(c)}return i}function t9(t,e,n,r){const{month:s,defaultMonth:i,today:l=r.today(),numberOfMonths:c=1}=t;let d=s||i||l;const{differenceInCalendarMonths:h,addMonths:m,startOfMonth:p}=r;if(n&&h(n,d){const j=n.broadcastCalendar?p(O,r):n.ISOWeek?x(O):v(O),T=n.broadcastCalendar?i(O):n.ISOWeek?l(c(O)):d(c(O)),M=e.filter(z=>z>=j&&z<=T),_=n.broadcastCalendar?35:42;if(n.fixedWeeks&&M.length<_){const z=e.filter(Q=>{const F=_-M.length;return Q>T&&Q<=s(T,F)});M.push(...z)}const D=M.reduce((z,Q)=>{const F=n.ISOWeek?h(Q):m(Q),L=z.find(V=>V.weekNumber===F),U=new kz(Q,O,r);return L?L.days.push(U):z.push(new ofe(F,[U])),z},[]),E=new lfe(O,D);return k.push(E),k},[]);return n.reverseMonths?b.reverse():b}function y0e(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:s,startOfDay:i,startOfMonth:l,endOfMonth:c,addYears:d,endOfYear:h,newDate:m,today:p}=e,{fromYear:x,toYear:v,fromMonth:b,toMonth:k}=t;!n&&b&&(n=b),!n&&x&&(n=e.newDate(x,0,1)),!r&&k&&(r=k),!r&&v&&(r=m(v,11,31));const O=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=l(n):x?n=m(x,0,1):!n&&O&&(n=s(d(t.today??p(),-100))),r?r=c(r):v?r=m(v,11,31):!r&&O&&(r=h(t.today??p())),[n&&i(n),r&&i(r)]}function b0e(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:l,addMonths:c,differenceInCalendarMonths:d}=r,h=s?i:1,m=l(t);if(!e)return c(m,h);if(!(d(e,t)n.concat(r.weeks.slice()),e.slice())}function Yx(t,e){const[n,r]=S.useState(t);return[e===void 0?n:e,r]}function k0e(t,e){const[n,r]=y0e(t,e),{startOfMonth:s,endOfMonth:i}=e,l=t9(t,n,r,e),[c,d]=Yx(l,t.month?l:void 0);S.useEffect(()=>{const E=t9(t,n,r,e);d(E)},[t.timeZone]);const h=x0e(c,r,t,e),m=p0e(h,t.endMonth?i(t.endMonth):void 0,t,e),p=v0e(h,m,t,e),x=S0e(p),v=g0e(p),b=w0e(c,n,t,e),k=b0e(c,r,t,e),{disableNavigation:O,onMonthChange:j}=t,T=E=>x.some(z=>z.days.some(Q=>Q.isEqualTo(E))),M=E=>{if(O)return;let z=s(E);n&&zs(r)&&(z=s(r)),d(z),j?.(z)};return{months:p,weeks:x,days:v,navStart:n,navEnd:r,previousMonth:b,nextMonth:k,goToMonth:M,goToDay:E=>{T(E)||M(E.date)}}}var sa;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(sa||(sa={}));function n9(t){return!t[Yn.disabled]&&!t[Yn.hidden]&&!t[Yn.outside]}function O0e(t,e,n,r){let s,i=-1;for(const l of t){const c=e(l);n9(c)&&(c[Yn.focused]&&in9(e(l)))),s}function j0e(t,e,n,r,s,i,l){const{ISOWeek:c,broadcastCalendar:d}=i,{addDays:h,addMonths:m,addWeeks:p,addYears:x,endOfBroadcastWeek:v,endOfISOWeek:b,endOfWeek:k,max:O,min:j,startOfBroadcastWeek:T,startOfISOWeek:M,startOfWeek:_}=l;let E={day:h,week:p,month:m,year:x,startOfWeek:z=>d?T(z,l):c?M(z):_(z),endOfWeek:z=>d?v(z):c?b(z):k(z)}[t](n,e==="after"?1:-1);return e==="before"&&r?E=O([r,E]):e==="after"&&s&&(E=j([s,E])),E}function Rz(t,e,n,r,s,i,l,c=0){if(c>365)return;const d=j0e(t,e,n.date,r,s,i,l),h=!!(i.disabled&&ll(d,i.disabled,l)),m=!!(i.hidden&&ll(d,i.hidden,l)),p=d,x=new kz(d,p,l);return!h&&!m?x:Rz(t,e,x,r,s,i,l,c+1)}function N0e(t,e,n,r,s){const{autoFocus:i}=t,[l,c]=S.useState(),d=O0e(e.days,n,r||(()=>!1),l),[h,m]=S.useState(i?d:void 0);return{isFocusTarget:k=>!!d?.isEqualTo(k),setFocused:m,focused:h,blur:()=>{c(h),m(void 0)},moveFocus:(k,O)=>{if(!h)return;const j=Rz(k,O,h,e.navStart,e.navEnd,t,s);j&&(t.disableNavigation&&!e.days.some(M=>M.isEqualTo(j))||(e.goToDay(j),m(j)))}}}function C0e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,l]=Yx(n,s?n:void 0),c=s?n:i,{isSameDay:d}=e,h=v=>c?.some(b=>d(b,v))??!1,{min:m,max:p}=t;return{selected:c,select:(v,b,k)=>{let O=[...c??[]];if(h(v)){if(c?.length===m||r&&c?.length===1)return;O=c?.filter(j=>!d(j,v))}else c?.length===p?O=[v]:O=[...O,v];return s||l(O),s?.(O,v,b,k),O},isSelected:h}}function T0e(t,e,n=0,r=0,s=!1,i=Ma){const{from:l,to:c}=e||{},{isSameDay:d,isAfter:h,isBefore:m}=i;let p;if(!l&&!c)p={from:t,to:n>0?void 0:t};else if(l&&!c)d(l,t)?n===0?p={from:l,to:t}:s?p={from:l,to:void 0}:p=void 0:m(t,l)?p={from:t,to:l}:p={from:l,to:t};else if(l&&c)if(d(l,t)&&d(c,t))s?p={from:l,to:c}:p=void 0;else if(d(l,t))p={from:l,to:n>0?void 0:t};else if(d(c,t))p={from:t,to:n>0?void 0:t};else if(m(t,l))p={from:t,to:c};else if(h(t,l))p={from:l,to:t};else if(h(t,c))p={from:l,to:t};else throw new Error("Invalid range");if(p?.from&&p?.to){const x=i.differenceInCalendarDays(p.to,p.from);r>0&&x>r?p={from:t,to:void 0}:n>1&&xtypeof c!="function").some(c=>typeof c=="boolean"?c:n.isDate(c)?al(t,c,!1,n):Mz(c,n)?c.some(d=>al(t,d,!1,n)):X5(c)?c.from&&c.to?r9(t,{from:c.from,to:c.to},n):!1:Tz(c)?M0e(t,c.dayOfWeek,n):jz(c)?n.isAfter(c.before,c.after)?r9(t,{from:n.addDays(c.after,1),to:n.addDays(c.before,-1)},n):ll(t.from,c,n)||ll(t.to,c,n):Nz(c)||Cz(c)?ll(t.from,c,n)||ll(t.to,c,n):!1))return!0;const l=r.filter(c=>typeof c=="function");if(l.length){let c=t.from;const d=n.differenceInCalendarDays(t.to,t.from);for(let h=0;h<=d;h++){if(l.some(m=>m(c)))return!0;c=n.addDays(c,1)}}return!1}function E0e(t,e){const{disabled:n,excludeDisabled:r,selected:s,required:i,onSelect:l}=t,[c,d]=Yx(s,l?s:void 0),h=l?s:c;return{selected:h,select:(x,v,b)=>{const{min:k,max:O}=t,j=x?T0e(x,h,k,O,i,e):void 0;return r&&n&&j?.from&&j.to&&A0e({from:j.from,to:j.to},n,e)&&(j.from=x,j.to=void 0),l||d(j),l?.(j,x,v,b),j},isSelected:x=>h&&al(h,x,!1,e)}}function _0e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,l]=Yx(n,s?n:void 0),c=s?n:i,{isSameDay:d}=e;return{selected:c,select:(p,x,v)=>{let b=p;return!r&&c&&c&&d(p,c)&&(b=void 0),s||l(b),s?.(b,p,x,v),b},isSelected:p=>c?d(c,p):!1}}function D0e(t,e){const n=_0e(t,e),r=C0e(t,e),s=E0e(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function R0e(t){let e=t;e.timeZone&&(e={...t},e.today&&(e.today=new Zr(e.today,e.timeZone)),e.month&&(e.month=new Zr(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new Zr(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new Zr(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new Zr(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new Zr(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(dt=>new Zr(dt,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new Zr(e.selected.from,e.timeZone):void 0,to:e.selected.to?new Zr(e.selected.to,e.timeZone):void 0}));const{components:n,formatters:r,labels:s,dateLib:i,locale:l,classNames:c}=S.useMemo(()=>{const dt={...G5,...e.locale};return{dateLib:new ii({locale:dt,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib),components:Lfe(e.components),formatters:Gfe(e.formatters),labels:{...u0e,...e.labels},locale:dt,classNames:{...Y5(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]),{captionLayout:d,mode:h,navLayout:m,numberOfMonths:p=1,onDayBlur:x,onDayClick:v,onDayFocus:b,onDayKeyDown:k,onDayMouseEnter:O,onDayMouseLeave:j,onNextClick:T,onPrevClick:M,showWeekNumber:_,styles:D}=e,{formatCaption:E,formatDay:z,formatMonthDropdown:Q,formatWeekNumber:F,formatWeekNumberHeader:L,formatWeekdayName:U,formatYearDropdown:V}=r,ce=k0e(e,i),{days:W,months:J,navStart:H,navEnd:ae,previousMonth:ne,nextMonth:ue,goToMonth:R}=ce,me=Pfe(W,e,H,ae,i),{isSelected:Y,select:P,selected:K}=D0e(e,i)??{},{blur:$,focused:fe,isFocusTarget:ve,moveFocus:Re,setFocused:de}=N0e(e,ce,me,Y??(()=>!1),i),{labelDayButton:We,labelGridcell:ct,labelGrid:Oe,labelMonthDropdown:nt,labelNav:ut,labelPrevious:Ct,labelNext:In,labelWeekday:Tn,labelWeekNumber:Jn,labelWeekNumberHeader:nn,labelYearDropdown:_t}=s,Yr=S.useMemo(()=>Kfe(i,e.ISOWeek),[i,e.ISOWeek]),qn=h!==void 0||v!==void 0,or=S.useCallback(()=>{ne&&(R(ne),M?.(ne))},[ne,R,M]),yn=S.useCallback(()=>{ue&&(R(ue),T?.(ue))},[R,ue,T]),ft=S.useCallback((dt,Pn)=>mt=>{mt.preventDefault(),mt.stopPropagation(),de(dt),P?.(dt.date,Pn,mt),v?.(dt.date,Pn,mt)},[P,v,de]),ee=S.useCallback((dt,Pn)=>mt=>{de(dt),b?.(dt.date,Pn,mt)},[b,de]),Se=S.useCallback((dt,Pn)=>mt=>{$(),x?.(dt.date,Pn,mt)},[$,x]),Be=S.useCallback((dt,Pn)=>mt=>{const rn={ArrowLeft:[mt.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[mt.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[mt.shiftKey?"year":"week","after"],ArrowUp:[mt.shiftKey?"year":"week","before"],PageUp:[mt.shiftKey?"year":"month","before"],PageDown:[mt.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(rn[mt.key]){mt.preventDefault(),mt.stopPropagation();const[Ar,Mt]=rn[mt.key];Re(Ar,Mt)}k?.(dt.date,Pn,mt)},[Re,k,e.dir]),rt=S.useCallback((dt,Pn)=>mt=>{O?.(dt.date,Pn,mt)},[O]),Tt=S.useCallback((dt,Pn)=>mt=>{j?.(dt.date,Pn,mt)},[j]),cr=S.useCallback(dt=>Pn=>{const mt=Number(Pn.target.value),rn=i.setMonth(i.startOfMonth(dt),mt);R(rn)},[i,R]),Kr=S.useCallback(dt=>Pn=>{const mt=Number(Pn.target.value),rn=i.setYear(i.startOfMonth(dt),mt);R(rn)},[i,R]),{className:re,style:Me}=S.useMemo(()=>({className:[c[et.Root],e.className].filter(Boolean).join(" "),style:{...D?.[et.Root],...e.style}}),[c,e.className,e.style,D]),pt=Ife(e),vt=S.useRef(null);m0e(vt,!!e.animate,{classNames:c,months:J,focused:fe,dateLib:i});const vs={dayPickerProps:e,selected:K,select:P,isSelected:Y,months:J,nextMonth:ue,previousMonth:ne,goToMonth:R,getModifiers:me,components:n,classNames:c,styles:D,labels:s,formatters:r};return Ue.createElement(Oz.Provider,{value:vs},Ue.createElement(n.Root,{rootRef:e.animate?vt:void 0,className:re,style:Me,dir:e.dir,id:e.id,lang:e.lang,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...pt},Ue.createElement(n.Months,{className:c[et.Months],style:D?.[et.Months]},!e.hideNavigation&&!m&&Ue.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[et.Nav],style:D?.[et.Nav],"aria-label":ut(),onPreviousClick:or,onNextClick:yn,previousMonth:ne,nextMonth:ue}),J.map((dt,Pn)=>Ue.createElement(n.Month,{"data-animated-month":e.animate?"true":void 0,className:c[et.Month],style:D?.[et.Month],key:Pn,displayIndex:Pn,calendarMonth:dt},m==="around"&&!e.hideNavigation&&Pn===0&&Ue.createElement(n.PreviousMonthButton,{type:"button",className:c[et.PreviousMonthButton],tabIndex:ne?void 0:-1,"aria-disabled":ne?void 0:!0,"aria-label":Ct(ne),onClick:or,"data-animated-button":e.animate?"true":void 0},Ue.createElement(n.Chevron,{disabled:ne?void 0:!0,className:c[et.Chevron],orientation:e.dir==="rtl"?"right":"left"})),Ue.createElement(n.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:c[et.MonthCaption],style:D?.[et.MonthCaption],calendarMonth:dt,displayIndex:Pn},d?.startsWith("dropdown")?Ue.createElement(n.DropdownNav,{className:c[et.Dropdowns],style:D?.[et.Dropdowns]},(()=>{const mt=d==="dropdown"||d==="dropdown-months"?Ue.createElement(n.MonthsDropdown,{key:"month",className:c[et.MonthsDropdown],"aria-label":nt(),classNames:c,components:n,disabled:!!e.disableNavigation,onChange:cr(dt.date),options:Xfe(dt.date,H,ae,r,i),style:D?.[et.Dropdown],value:i.getMonth(dt.date)}):Ue.createElement("span",{key:"month"},Q(dt.date,i)),rn=d==="dropdown"||d==="dropdown-years"?Ue.createElement(n.YearsDropdown,{key:"year",className:c[et.YearsDropdown],"aria-label":_t(i.options),classNames:c,components:n,disabled:!!e.disableNavigation,onChange:Kr(dt.date),options:Zfe(H,ae,r,i,!!e.reverseYears),style:D?.[et.Dropdown],value:i.getYear(dt.date)}):Ue.createElement("span",{key:"year"},V(dt.date,i));return i.getMonthYearOrder()==="year-first"?[rn,mt]:[mt,rn]})(),Ue.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},E(dt.date,i.options,i))):Ue.createElement(n.CaptionLabel,{className:c[et.CaptionLabel],role:"status","aria-live":"polite"},E(dt.date,i.options,i))),m==="around"&&!e.hideNavigation&&Pn===p-1&&Ue.createElement(n.NextMonthButton,{type:"button",className:c[et.NextMonthButton],tabIndex:ue?void 0:-1,"aria-disabled":ue?void 0:!0,"aria-label":In(ue),onClick:yn,"data-animated-button":e.animate?"true":void 0},Ue.createElement(n.Chevron,{disabled:ue?void 0:!0,className:c[et.Chevron],orientation:e.dir==="rtl"?"left":"right"})),Pn===p-1&&m==="after"&&!e.hideNavigation&&Ue.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[et.Nav],style:D?.[et.Nav],"aria-label":ut(),onPreviousClick:or,onNextClick:yn,previousMonth:ne,nextMonth:ue}),Ue.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":h==="multiple"||h==="range","aria-label":Oe(dt.date,i.options,i)||void 0,className:c[et.MonthGrid],style:D?.[et.MonthGrid]},!e.hideWeekdays&&Ue.createElement(n.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:c[et.Weekdays],style:D?.[et.Weekdays]},_&&Ue.createElement(n.WeekNumberHeader,{"aria-label":nn(i.options),className:c[et.WeekNumberHeader],style:D?.[et.WeekNumberHeader],scope:"col"},L()),Yr.map(mt=>Ue.createElement(n.Weekday,{"aria-label":Tn(mt,i.options,i),className:c[et.Weekday],key:String(mt),style:D?.[et.Weekday],scope:"col"},U(mt,i.options,i)))),Ue.createElement(n.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:c[et.Weeks],style:D?.[et.Weeks]},dt.weeks.map(mt=>Ue.createElement(n.Week,{className:c[et.Week],key:mt.weekNumber,style:D?.[et.Week],week:mt},_&&Ue.createElement(n.WeekNumber,{week:mt,style:D?.[et.WeekNumber],"aria-label":Jn(mt.weekNumber,{locale:l}),className:c[et.WeekNumber],scope:"row",role:"rowheader"},F(mt.weekNumber,i)),mt.days.map(rn=>{const{date:Ar}=rn,Mt=me(rn);if(Mt[Yn.focused]=!Mt.hidden&&!!fe?.isEqualTo(rn),Mt[Li.selected]=Y?.(Ar)||Mt.selected,X5(K)){const{from:qc,to:_o}=K;Mt[Li.range_start]=!!(qc&&_o&&i.isSameDay(Ar,qc)),Mt[Li.range_end]=!!(qc&&_o&&i.isSameDay(Ar,_o)),Mt[Li.range_middle]=al(K,Ar,!0,i)}const Ic=Yfe(Mt,D,e.modifiersStyles),Eo=Bfe(Mt,c,e.modifiersClassNames),t1=!qn&&!Mt.hidden?ct(Ar,Mt,i.options,i):void 0;return Ue.createElement(n.Day,{key:`${i.format(Ar,"yyyy-MM-dd")}_${i.format(rn.displayMonth,"yyyy-MM")}`,day:rn,modifiers:Mt,className:Eo.join(" "),style:Ic,role:"gridcell","aria-selected":Mt.selected||void 0,"aria-label":t1,"data-day":i.format(Ar,"yyyy-MM-dd"),"data-month":rn.outside?i.format(Ar,"yyyy-MM"):void 0,"data-selected":Mt.selected||void 0,"data-disabled":Mt.disabled||void 0,"data-hidden":Mt.hidden||void 0,"data-outside":rn.outside||void 0,"data-focused":Mt.focused||void 0,"data-today":Mt.today||void 0},!Mt.hidden&&qn?Ue.createElement(n.DayButton,{className:c[et.DayButton],style:D?.[et.DayButton],type:"button",day:rn,modifiers:Mt,disabled:Mt.disabled||void 0,tabIndex:ve(rn)?0:-1,"aria-label":We(Ar,Mt,i.options,i),onClick:ft(rn,Mt),onBlur:Se(rn,Mt),onFocus:ee(rn,Mt),onKeyDown:Be(rn,Mt),onMouseEnter:rt(rn,Mt),onMouseLeave:Tt(rn,Mt)},z(Ar,i.options,i)):!Mt.hidden&&z(rn.date,i.options,i))})))))))),e.footer&&Ue.createElement(n.Footer,{className:c[et.Footer],style:D?.[et.Footer],role:"status","aria-live":"polite"},e.footer)))}function s9({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:l,...c}){const d=Y5();return a.jsx(R0e,{showOutsideDays:n,className:ye("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,t),captionLayout:r,formatters:{formatMonthDropdown:h=>h.toLocaleString("default",{month:"short"}),...i},classNames:{root:ye("w-fit",d.root),months:ye("relative flex flex-col gap-4 md:flex-row",d.months),month:ye("flex w-full flex-col gap-4",d.month),nav:ye("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",d.nav),button_previous:ye(ff({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_previous),button_next:ye(ff({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_next),month_caption:ye("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",d.month_caption),dropdowns:ye("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",d.dropdowns),dropdown_root:ye("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",d.dropdown_root),dropdown:ye("bg-popover absolute inset-0 opacity-0",d.dropdown),caption_label:ye("select-none font-medium",r==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",d.caption_label),table:"w-full border-collapse",weekdays:ye("flex",d.weekdays),weekday:ye("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",d.weekday),week:ye("mt-2 flex w-full",d.week),week_number_header:ye("w-[--cell-size] select-none",d.week_number_header),week_number:ye("text-muted-foreground select-none text-[0.8rem]",d.week_number),day:ye("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",d.day),range_start:ye("bg-accent rounded-l-md",d.range_start),range_middle:ye("rounded-none",d.range_middle),range_end:ye("bg-accent rounded-r-md",d.range_end),today:ye("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",d.today),outside:ye("text-muted-foreground aria-selected:text-muted-foreground",d.outside),disabled:ye("text-muted-foreground opacity-50",d.disabled),hidden:ye("invisible",d.hidden),...e},components:{Root:({className:h,rootRef:m,...p})=>a.jsx("div",{"data-slot":"calendar",ref:m,className:ye(h),...p}),Chevron:({className:h,orientation:m,...p})=>m==="left"?a.jsx(Tc,{className:ye("size-4",h),...p}):m==="right"?a.jsx(Mc,{className:ye("size-4",h),...p}):a.jsx(df,{className:ye("size-4",h),...p}),DayButton:z0e,WeekNumber:({children:h,...m})=>a.jsx("td",{...m,children:a.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:h})}),...l},...c})}function z0e({className:t,day:e,modifiers:n,...r}){const s=Y5(),i=S.useRef(null);return S.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),a.jsx(ie,{ref:i,variant:"ghost",size:"icon","data-day":e.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:ye("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",s.day,t),...r})}class P0e{ws=null;reconnectTimeout=null;reconnectAttempts=0;maxReconnectAttempts=10;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];maxCacheSize=1e3;getWebSocketUrl(){{const e=window.location.protocol==="https:"?"wss:":"ws:",n=window.location.host;return`${e}//${n}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const e=this.getWebSocketUrl();try{this.ws=new WebSocket(e),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=n=>{try{if(n.data==="pong")return;const r=JSON.parse(n.data);this.notifyLog(r)}catch(r){console.error("解析日志消息失败:",r)}},this.ws.onerror=n=>{console.error("❌ WebSocket 错误:",n),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(n){console.error("创建 WebSocket 连接失败:",n),this.attemptReconnect()}}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return;this.reconnectAttempts+=1;const e=Math.min(1e3*this.reconnectAttempts,1e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},e)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(e){return this.logCallbacks.add(e),()=>this.logCallbacks.delete(e)}onConnectionChange(e){return this.connectionCallbacks.add(e),e(this.isConnected),()=>this.connectionCallbacks.delete(e)}notifyLog(e){this.logCache.some(r=>r.id===e.id)||(this.logCache.push(e),this.logCache.length>this.maxCacheSize&&(this.logCache=this.logCache.slice(-this.maxCacheSize)),this.logCallbacks.forEach(r=>{try{r(e)}catch(s){console.error("日志回调执行失败:",s)}}))}notifyConnection(e){this.connectionCallbacks.forEach(n=>{try{n(e)}catch(r){console.error("连接状态回调执行失败:",r)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const Iu=new P0e;typeof window<"u"&&Iu.connect();const B0e={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},L0e=(t,e,n)=>{let r;const s=B0e[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",String(e)),n?.addSuffix?n.comparison&&n.comparison>0?r+"内":r+"前":r},I0e={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},q0e={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},F0e={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Q0e={date:td({formats:I0e,defaultWidth:"full"}),time:td({formats:q0e,defaultWidth:"full"}),dateTime:td({formats:F0e,defaultWidth:"full"})};function i9(t,e,n){const r="eeee p";return Jhe(t,e,n)?r:t.getTime()>e.getTime()?"'下个'"+r:"'上个'"+r}const $0e={lastWeek:i9,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:i9,other:"PP p"},H0e=(t,e,n,r)=>{const s=$0e[t];return typeof s=="function"?s(e,n,r):s},U0e={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},V0e={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},W0e={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},G0e={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},X0e={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},Y0e={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},K0e=(t,e)=>{const n=Number(t);switch(e?.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},Z0e={ordinalNumber:K0e,era:oa({values:U0e,defaultWidth:"wide"}),quarter:oa({values:V0e,defaultWidth:"wide",argumentCallback:t=>t-1}),month:oa({values:W0e,defaultWidth:"wide"}),day:oa({values:G0e,defaultWidth:"wide"}),dayPeriod:oa({values:X0e,defaultWidth:"wide",formattingValues:Y0e,defaultFormattingWidth:"wide"})},J0e=/^(第\s*)?\d+(日|时|分|秒)?/i,eme=/\d+/i,tme={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},nme={any:[/^(前)/i,/^(公元)/i]},rme={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},sme={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},ime={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},ame={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},lme={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},ome={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},cme={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},ume={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},dme={ordinalNumber:xz({matchPattern:J0e,parsePattern:eme,valueCallback:t=>parseInt(t,10)}),era:ca({matchPatterns:tme,defaultMatchWidth:"wide",parsePatterns:nme,defaultParseWidth:"any"}),quarter:ca({matchPatterns:rme,defaultMatchWidth:"wide",parsePatterns:sme,defaultParseWidth:"any",valueCallback:t=>t+1}),month:ca({matchPatterns:ime,defaultMatchWidth:"wide",parsePatterns:ame,defaultParseWidth:"any"}),day:ca({matchPatterns:lme,defaultMatchWidth:"wide",parsePatterns:ome,defaultParseWidth:"any"}),dayPeriod:ca({matchPatterns:cme,defaultMatchWidth:"any",parsePatterns:ume,defaultParseWidth:"any"})},Bp={code:"zh-CN",formatDistance:L0e,formatLong:Q0e,formatRelative:H0e,localize:Z0e,match:dme,options:{weekStartsOn:1,firstWeekContainsDate:4}};function hme(){const[t,e]=S.useState([]),[n,r]=S.useState(""),[s,i]=S.useState("all"),[l,c]=S.useState("all"),[d,h]=S.useState(void 0),[m,p]=S.useState(void 0),[x,v]=S.useState(!0),[b,k]=S.useState(!1),O=S.useRef(null),j=S.useRef(null);S.useEffect(()=>{const U=Iu.getAllLogs();e(U);const V=Iu.onLog(()=>{e(Iu.getAllLogs())}),ce=Iu.onConnectionChange(W=>{k(W)});return()=>{V(),ce()}},[]),S.useEffect(()=>{x&&j.current&&j.current.scrollIntoView({behavior:"smooth",block:"end"})},[t,x]);const T=S.useMemo(()=>{const U=new Set(t.map(V=>V.module));return Array.from(U).sort()},[t]),M=U=>{switch(U){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},_=U=>{switch(U){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},D=()=>{window.location.reload()},E=()=>{Iu.clearLogs(),e([])},z=()=>{const U=L.map(J=>`${J.timestamp} [${J.level.padEnd(8)}] [${J.module}] ${J.message}`).join(` +`),V=new Blob([U],{type:"text/plain;charset=utf-8"}),ce=URL.createObjectURL(V),W=document.createElement("a");W.href=ce,W.download=`logs-${dg(new Date,"yyyy-MM-dd-HHmmss")}.txt`,W.click(),URL.revokeObjectURL(ce)},Q=()=>{v(!x)},F=()=>{h(void 0),p(void 0)},L=S.useMemo(()=>t.filter(U=>{const V=n===""||U.message.toLowerCase().includes(n.toLowerCase())||U.module.toLowerCase().includes(n.toLowerCase()),ce=s==="all"||U.level===s,W=l==="all"||U.module===l;let J=!0;if(d||m){const H=new Date(U.timestamp);if(d){const ae=new Date(d);ae.setHours(0,0,0,0),J=J&&H>=ae}if(m){const ae=new Date(m);ae.setHours(23,59,59,999),J=J&&H<=ae}}return V&&ce&&W&&J}),[t,n,s,l,d,m]);return a.jsx(fn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 p-3 sm:p-4 lg:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:ye("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",b?"bg-green-500 animate-pulse":"bg-red-500")}),a.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:b?"已连接":"未连接"})]})]}),a.jsx(yt,{className:"p-3 sm:p-4",children:a.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Ps,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Ae,{placeholder:"搜索日志...",value:n,onChange:U=>r(U.target.value),className:"pl-9 h-9 text-sm"})]}),a.jsxs(Lt,{value:s,onValueChange:i,children:[a.jsxs(Dt,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[a.jsx(t2,{className:"h-4 w-4 mr-2"}),a.jsx(It,{placeholder:"级别"})]}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部级别"}),a.jsx(Pe,{value:"DEBUG",children:"DEBUG"}),a.jsx(Pe,{value:"INFO",children:"INFO"}),a.jsx(Pe,{value:"WARNING",children:"WARNING"}),a.jsx(Pe,{value:"ERROR",children:"ERROR"}),a.jsx(Pe,{value:"CRITICAL",children:"CRITICAL"})]})]}),a.jsxs(Lt,{value:l,onValueChange:c,children:[a.jsxs(Dt,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[a.jsx(t2,{className:"h-4 w-4 mr-2"}),a.jsx(It,{placeholder:"模块"})]}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部模块"}),T.map(U=>a.jsx(Pe,{value:U,children:U},U))]})]})]}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[a.jsxs(co,{children:[a.jsx(uo,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!d&&"text-muted-foreground"),children:[a.jsx(uO,{className:"mr-2 h-4 w-4"}),a.jsx("span",{className:"text-xs sm:text-sm",children:d?dg(d,"PPP",{locale:Bp}):"开始日期"})]})}),a.jsx(hl,{className:"w-auto p-0",align:"start",children:a.jsx(s9,{mode:"single",selected:d,onSelect:h,initialFocus:!0,locale:Bp})})]}),a.jsxs(co,{children:[a.jsx(uo,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!m&&"text-muted-foreground"),children:[a.jsx(uO,{className:"mr-2 h-4 w-4"}),a.jsx("span",{className:"text-xs sm:text-sm",children:m?dg(m,"PPP",{locale:Bp}):"结束日期"})]})}),a.jsx(hl,{className:"w-auto p-0",align:"start",children:a.jsx(s9,{mode:"single",selected:m,onSelect:p,initialFocus:!0,locale:Bp})})]}),(d||m)&&a.jsxs(ie,{variant:"outline",size:"sm",onClick:F,className:"w-full sm:w-auto h-9",children:[a.jsx(Gf,{className:"h-4 w-4 sm:mr-2"}),a.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),a.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[a.jsxs(ie,{variant:x?"default":"outline",size:"sm",onClick:Q,className:"flex-1 sm:flex-none h-9",children:[x?a.jsx(jq,{className:"h-4 w-4"}):a.jsx(Nq,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:x?"自动滚动":"已暂停"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:D,className:"flex-1 sm:flex-none h-9",children:[a.jsx(Ii,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:E,className:"flex-1 sm:flex-none h-9",children:[a.jsx(Ht,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:z,className:"flex-1 sm:flex-none h-9",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),a.jsx("div",{className:"flex-1 hidden sm:block"}),a.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[a.jsxs("span",{className:"font-mono",children:[L.length," / ",t.length]}),a.jsx("span",{className:"ml-1",children:"条日志"})]})]})]})}),a.jsx(yt,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900",children:a.jsx(fn,{className:"h-[calc(100vh-280px)] sm:h-[calc(100vh-320px)] lg:h-[calc(100vh-400px)]",children:a.jsxs("div",{ref:O,className:"p-2 sm:p-3 lg:p-4 font-mono text-xs sm:text-sm space-y-1",children:[L.length===0?a.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):L.map(U=>a.jsxs("div",{className:ye("py-2 px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",_(U.level)),children:[a.jsxs("div",{className:"flex flex-col gap-1 sm:hidden",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-600 text-xs",children:U.timestamp}),a.jsxs("span",{className:ye("text-xs font-semibold",M(U.level)),children:["[",U.level,"]"]})]}),a.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 text-xs truncate",children:U.module}),a.jsx("div",{className:"text-gray-300 dark:text-gray-400 text-xs whitespace-pre-wrap break-words",children:U.message})]}),a.jsxs("div",{className:"hidden sm:flex gap-3 items-start",children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[140px] lg:w-[180px] text-xs lg:text-sm",children:U.timestamp}),a.jsxs("span",{className:ye("flex-shrink-0 w-[70px] lg:w-[80px] font-semibold text-xs lg:text-sm",M(U.level)),children:["[",U.level,"]"]}),a.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[120px] lg:w-[150px] truncate text-xs lg:text-sm",children:U.module}),a.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words text-xs lg:text-sm",children:U.message})]})]},U.id)),a.jsx("div",{ref:j,className:"h-4"})]})})})]})})}const fme="Mai-with-u",mme="plugin-repo",pme="main",gme="plugin_details.json";async function xme(){try{const t=await ot("/api/webui/plugins/fetch-raw",{method:"POST",headers:bt(),body:JSON.stringify({owner:fme,repo:mme,branch:pme,file_path:gme})});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success||!e.data)throw new Error(e.error||"获取插件列表失败");return JSON.parse(e.data).filter(s=>!s?.id||!s?.manifest?(console.warn("跳过无效插件数据:",s),!1):!s.manifest.name||!s.manifest.version?(console.warn("跳过缺少必需字段的插件:",s.id),!1):!0).map(s=>({id:s.id,manifest:{manifest_version:s.manifest.manifest_version||1,name:s.manifest.name,version:s.manifest.version,description:s.manifest.description||"",author:s.manifest.author||{name:"Unknown"},license:s.manifest.license||"Unknown",host_application:s.manifest.host_application||{min_version:"0.0.0"},homepage_url:s.manifest.homepage_url,repository_url:s.manifest.repository_url,keywords:s.manifest.keywords||[],categories:s.manifest.categories||[],default_locale:s.manifest.default_locale||"zh-CN",locales_path:s.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(t){throw console.error("Failed to fetch plugin list:",t),t}}async function vme(){try{const t=await ot("/api/webui/plugins/git-status");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to check Git status:",t),{installed:!1,error:"无法检测 Git 安装状态"}}}async function yme(){try{const t=await ot("/api/webui/plugins/version");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to get Maimai version:",t),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function bme(t,e,n){const r=t.split(".").map(c=>parseInt(c)||0),s=r[0]||0,i=r[1]||0,l=r[2]||0;if(n.version_majorparseInt(p)||0),d=c[0]||0,h=c[1]||0,m=c[2]||0;if(n.version_major>d||n.version_major===d&&n.version_minor>h||n.version_major===d&&n.version_minor===h&&n.version_patch>m)return!1}return!0}function wme(t,e){const n=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host,s=new WebSocket(`${n}//${r}/api/webui/ws/plugin-progress`);return s.onopen=()=>{console.log("Plugin progress WebSocket connected");const i=setInterval(()=>{s.readyState===WebSocket.OPEN?s.send("ping"):clearInterval(i)},3e4)},s.onmessage=i=>{try{if(i.data==="pong")return;const l=JSON.parse(i.data);t(l)}catch(l){console.error("Failed to parse progress data:",l)}},s.onerror=i=>{console.error("Plugin progress WebSocket error:",i),e?.(i)},s.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},s}async function Lp(){try{const t=await ot("/api/webui/plugins/installed",{headers:bt()});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success)throw new Error(e.message||"获取已安装插件列表失败");return e.plugins||[]}catch(t){return console.error("Failed to get installed plugins:",t),[]}}function Ip(t,e){return e.some(n=>n.id===t)}function qp(t,e){const n=e.find(r=>r.id===t);if(n)return n.manifest?.version||n.version}async function Sme(t,e,n="main"){const r=await ot("/api/webui/plugins/install",{method:"POST",headers:bt(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"安装失败")}return await r.json()}async function kme(t){const e=await ot("/api/webui/plugins/uninstall",{method:"POST",headers:bt(),body:JSON.stringify({plugin_id:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"卸载失败")}return await e.json()}async function Ome(t,e,n="main"){const r=await ot("/api/webui/plugins/update",{method:"POST",headers:bt(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"更新失败")}return await r.json()}const C0="https://maibot-plugin-stats.maibot-webui.workers.dev";async function zz(t){try{const e=await fetch(`${C0}/stats/${t}`);return e.ok?await e.json():(console.error("Failed to fetch plugin stats:",e.statusText),null)}catch(e){return console.error("Error fetching plugin stats:",e),null}}async function jme(t,e){try{const n=e||K5(),r=await fetch(`${C0}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点赞失败"}}catch(n){return console.error("Error liking plugin:",n),{success:!1,error:"网络错误"}}}async function Nme(t,e){try{const n=e||K5(),r=await fetch(`${C0}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点踩失败"}}catch(n){return console.error("Error disliking plugin:",n),{success:!1,error:"网络错误"}}}async function Cme(t,e,n,r){if(e<1||e>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const s=r||K5(),i=await fetch(`${C0}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,rating:e,comment:n,user_id:s})}),l=await i.json();return i.status===429?{success:!1,error:"每天最多评分 3 次"}:i.ok?{success:!0,...l}:{success:!1,error:l.error||"评分失败"}}catch(s){return console.error("Error rating plugin:",s),{success:!1,error:"网络错误"}}}async function Tme(t){try{const e=await fetch(`${C0}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t})}),n=await e.json();return e.status===429?(console.warn("Download recording rate limited"),{success:!0}):e.ok?{success:!0,...n}:(console.error("Failed to record download:",n.error),{success:!1,error:n.error})}catch(e){return console.error("Error recording download:",e),{success:!1,error:"网络错误"}}}function Mme(){const t=navigator,e=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,t.deviceMemory||0].join("|");let n=0;for(let r=0;r{i(!0);const j=await zz(t);j&&r(j),i(!1)};S.useEffect(()=>{v()},[t]);const b=async()=>{const j=await jme(t);j.success?(x({title:"已点赞",description:"感谢你的支持!"}),v()):x({title:"点赞失败",description:j.error||"未知错误",variant:"destructive"})},k=async()=>{const j=await Nme(t);j.success?(x({title:"已反馈",description:"感谢你的反馈!"}),v()):x({title:"操作失败",description:j.error||"未知错误",variant:"destructive"})},O=async()=>{if(l===0){x({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const j=await Cme(t,l,d||void 0);j.success?(x({title:"评分成功",description:"感谢你的评价!"}),p(!1),c(0),h(""),v()):x({title:"评分失败",description:j.error||"未知错误",variant:"destructive"})};return s?a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:"-"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Zl,{className:"h-4 w-4"}),a.jsx("span",{children:"-"})]})]}):n?e?a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${n.downloads.toLocaleString()}`,children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:n.downloads.toLocaleString()})]}),a.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${n.rating.toFixed(1)} (${n.rating_count} 条评价)`,children:[a.jsx(Zl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsx("span",{children:n.rating.toFixed(1)})]}),a.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${n.likes}`,children:[a.jsx(my,{className:"h-4 w-4"}),a.jsx("span",{children:n.likes})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(fc,{className:"h-5 w-5 text-muted-foreground mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.downloads.toLocaleString()}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(Zl,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),a.jsx("span",{className:"text-2xl font-bold",children:n.rating.toFixed(1)}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.rating_count," 条评价"]})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(my,{className:"h-5 w-5 text-green-500 mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.likes}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(dO,{className:"h-5 w-5 text-red-500 mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.dislikes}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:b,children:[a.jsx(my,{className:"h-4 w-4 mr-1"}),"点赞"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:k,children:[a.jsx(dO,{className:"h-4 w-4 mr-1"}),"点踩"]}),a.jsxs(Rr,{open:m,onOpenChange:p,children:[a.jsx(mw,{asChild:!0,children:a.jsxs(ie,{variant:"default",size:"sm",children:[a.jsx(Zl,{className:"h-4 w-4 mr-1"}),"评分"]})}),a.jsxs(Nr,{children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"为插件评分"}),a.jsx(Gr,{children:"分享你的使用体验,帮助其他用户"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(j=>a.jsx("button",{onClick:()=>c(j),className:"focus:outline-none",children:a.jsx(Zl,{className:`h-8 w-8 transition-colors ${j<=l?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},j))}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[l===0&&"点击星星进行评分",l===1&&"很差",l===2&&"一般",l===3&&"还行",l===4&&"不错",l===5&&"非常好"]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),a.jsx(_n,{value:d,onChange:j=>h(j.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[d.length," / 500"]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>p(!1),children:"取消"}),a.jsx(ie,{onClick:O,disabled:l===0,children:"提交评分"})]})]})]})]}),n.recent_ratings&&n.recent_ratings.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),a.jsx("div",{className:"space-y-3",children:n.recent_ratings.map((j,T)=>a.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(M=>a.jsx(Zl,{className:`h-3 w-3 ${M<=j.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},M))}),a.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(j.created_at).toLocaleDateString()})]}),j.comment&&a.jsx("p",{className:"text-sm text-muted-foreground",children:j.comment})]},T))})]})]}):null}const a9={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function Eme(){const t=ba(),[e,n]=S.useState(null),[r,s]=S.useState(""),[i,l]=S.useState("all"),[c,d]=S.useState("all"),[h,m]=S.useState(!0),[p,x]=S.useState([]),[v,b]=S.useState(!0),[k,O]=S.useState(null),[j,T]=S.useState(null),[M,_]=S.useState(null),[D,E]=S.useState(null),[,z]=S.useState([]),[Q,F]=S.useState({}),{toast:L}=Pr(),U=async R=>{const me=R.map(async K=>{try{const $=await zz(K.id);return{id:K.id,stats:$}}catch($){return console.warn(`Failed to load stats for ${K.id}:`,$),{id:K.id,stats:null}}}),Y=await Promise.all(me),P={};Y.forEach(({id:K,stats:$})=>{$&&(P[K]=$)}),F(P)};S.useEffect(()=>{let R=null,me=!1;return(async()=>{if(R=wme(P=>{me||(_(P),P.stage==="success"?setTimeout(()=>{me||_(null)},2e3):P.stage==="error"&&(b(!1),O(P.error||"加载失败")))},P=>{console.error("WebSocket error:",P),me||L({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(P=>{if(!R){P();return}const K=()=>{R&&R.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),P()):R&&R.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),P()):setTimeout(K,100)};K()}),!me){const P=await vme();T(P),P.installed||L({title:"Git 未安装",description:P.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!me){const P=await yme();E(P)}if(!me)try{b(!0),O(null);const P=await xme();if(!me){const K=await Lp();z(K);const $=P.map(fe=>{const ve=Ip(fe.id,K),Re=qp(fe.id,K);return{...fe,installed:ve,installed_version:Re}});for(const fe of K)!$.some(Re=>Re.id===fe.id)&&fe.manifest&&$.push({id:fe.id,manifest:{manifest_version:fe.manifest.manifest_version||1,name:fe.manifest.name,version:fe.manifest.version,description:fe.manifest.description||"",author:fe.manifest.author,license:fe.manifest.license||"Unknown",host_application:fe.manifest.host_application,homepage_url:fe.manifest.homepage_url,repository_url:fe.manifest.repository_url,keywords:fe.manifest.keywords||[],categories:fe.manifest.categories||[],default_locale:fe.manifest.default_locale||"zh-CN",locales_path:fe.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:fe.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});x($),U($)}}catch(P){if(!me){const K=P instanceof Error?P.message:"加载插件列表失败";O(K),L({title:"加载失败",description:K,variant:"destructive"})}}finally{me||b(!1)}})(),()=>{me=!0,R&&R.close()}},[L]);const V=R=>{if(!R.installed&&D&&!ce(R))return a.jsxs(On,{variant:"destructive",className:"gap-1",children:[a.jsx(xc,{className:"h-3 w-3"}),"不兼容"]});if(R.installed){const me=R.installed_version?.trim(),Y=R.manifest.version?.trim();if(me!==Y){const P=me?.split(".").map(Number)||[0,0,0],K=Y?.split(".").map(Number)||[0,0,0];for(let $=0;$<3;$++){if((K[$]||0)>(P[$]||0))return a.jsxs(On,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[a.jsx(xc,{className:"h-3 w-3"}),"可更新"]});if((K[$]||0)<(P[$]||0))break}}return a.jsxs(On,{variant:"default",className:"gap-1",children:[a.jsx(ua,{className:"h-3 w-3"}),"已安装"]})}return null},ce=R=>!D||!R.manifest?.host_application?!0:bme(R.manifest.host_application.min_version,R.manifest.host_application.max_version,D),W=R=>{if(!R.installed||!R.installed_version||!R.manifest?.version)return!1;const me=R.installed_version.trim(),Y=R.manifest.version.trim();if(me===Y)return!1;const P=me.split(".").map(Number),K=Y.split(".").map(Number);for(let $=0;$<3;$++){if((K[$]||0)>(P[$]||0))return!0;if((K[$]||0)<(P[$]||0))return!1}return!1},J=p.filter(R=>{if(!R.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",R.id),!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some($=>$.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i);let P=!0;c==="installed"?P=R.installed===!0:c==="updates"&&(P=R.installed===!0&&W(R));const K=!h||!D||ce(R);return me&&Y&&P&&K}),H=()=>{n(null)},ae=async R=>{if(!j?.installed){L({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(D&&!ce(R)){L({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await Sme(R.id,R.manifest.repository_url||"","main"),Tme(R.id).catch(Y=>{console.warn("Failed to record download:",Y)}),L({title:"安装成功",description:`${R.manifest.name} 已成功安装`});const me=await Lp();z(me),x(Y=>Y.map(P=>{if(P.id===R.id){const K=Ip(P.id,me),$=qp(P.id,me);return{...P,installed:K,installed_version:$}}return P}))}catch(me){L({title:"安装失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}},ne=async R=>{try{await kme(R.id),L({title:"卸载成功",description:`${R.manifest.name} 已成功卸载`});const me=await Lp();z(me),x(Y=>Y.map(P=>{if(P.id===R.id){const K=Ip(P.id,me),$=qp(P.id,me);return{...P,installed:K,installed_version:$}}return P}))}catch(me){L({title:"卸载失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}},ue=async R=>{if(!j?.installed){L({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const me=await Ome(R.id,R.manifest.repository_url||"","main");L({title:"更新成功",description:`${R.manifest.name} 已从 ${me.old_version} 更新到 ${me.new_version}`});const Y=await Lp();z(Y),x(P=>P.map(K=>{if(K.id===R.id){const $=Ip(K.id,Y),fe=qp(K.id,Y);return{...K,installed:$,installed_version:fe}}return K}))}catch(me){L({title:"更新失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}};return a.jsx(fn,{className:"h-full",children:a.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),a.jsxs(ie,{onClick:()=>t({to:"/plugin-mirrors"}),children:[a.jsx(Cq,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),j&&!j.installed&&a.jsxs(yt,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[a.jsx(Jt,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Hu,{className:"h-5 w-5 text-orange-600"}),a.jsxs("div",{children:[a.jsx(en,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),a.jsx(Sr,{className:"text-orange-800 dark:text-orange-200",children:j.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),a.jsx(vn,{children:a.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",a.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),a.jsx(yt,{className:"p-4",children:a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Ps,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Ae,{placeholder:"搜索插件...",value:r,onChange:R=>s(R.target.value),className:"pl-9"})]}),a.jsxs(Lt,{value:i,onValueChange:l,children:[a.jsx(Dt,{className:"w-full sm:w-[200px]",children:a.jsx(It,{placeholder:"选择分类"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部分类"}),a.jsx(Pe,{value:"Group Management",children:"群组管理"}),a.jsx(Pe,{value:"Entertainment & Interaction",children:"娱乐互动"}),a.jsx(Pe,{value:"Utility Tools",children:"实用工具"}),a.jsx(Pe,{value:"Content Generation",children:"内容生成"}),a.jsx(Pe,{value:"Multimedia",children:"多媒体"}),a.jsx(Pe,{value:"External Integration",children:"外部集成"}),a.jsx(Pe,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),a.jsx(Pe,{value:"Other",children:"其他"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"compatible-only",checked:h,onCheckedChange:R=>m(R===!0)}),a.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),a.jsx(dl,{value:c,onValueChange:d,className:"w-full",children:a.jsxs(va,{className:"grid w-full grid-cols-3",children:[a.jsxs($t,{value:"all",children:["全部插件 (",p.filter(R=>{if(!R.manifest)return!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(K=>K.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),P=!h||!D||ce(R);return me&&Y&&P}).length,")"]}),a.jsxs($t,{value:"installed",children:["已安装 (",p.filter(R=>{if(!R.manifest)return!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(K=>K.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),P=!h||!D||ce(R);return R.installed&&me&&Y&&P}).length,")"]}),a.jsxs($t,{value:"updates",children:["可更新 (",p.filter(R=>{if(!R.manifest)return!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(K=>K.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),P=!h||!D||ce(R);return R.installed&&W(R)&&me&&Y&&P}).length,")"]})]})}),M&&M.stage==="loading"&&a.jsx(yt,{className:"p-4",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(hf,{className:"h-4 w-4 animate-spin"}),a.jsxs("span",{className:"text-sm font-medium",children:[M.operation==="fetch"&&"加载插件列表",M.operation==="install"&&`安装插件${M.plugin_id?`: ${M.plugin_id}`:""}`,M.operation==="uninstall"&&`卸载插件${M.plugin_id?`: ${M.plugin_id}`:""}`,M.operation==="update"&&`更新插件${M.plugin_id?`: ${M.plugin_id}`:""}`]})]}),a.jsxs("span",{className:"text-sm font-medium",children:[M.progress,"%"]})]}),a.jsx(n0,{value:M.progress,className:"h-2"}),a.jsx("div",{className:"text-xs text-muted-foreground",children:M.message}),M.operation==="fetch"&&M.total_plugins>0&&a.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",M.loaded_plugins," / ",M.total_plugins," 个插件"]})]})}),M&&M.stage==="error"&&M.error&&a.jsx(yt,{className:"border-destructive bg-destructive/10",children:a.jsx(Jt,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Hu,{className:"h-5 w-5 text-destructive"}),a.jsxs("div",{children:[a.jsx(en,{className:"text-lg text-destructive",children:"加载失败"}),a.jsx(Sr,{className:"text-destructive/80",children:M.error})]})]})})}),v?a.jsxs("div",{className:"flex items-center justify-center py-12",children:[a.jsx(hf,{className:"h-8 w-8 animate-spin text-muted-foreground"}),a.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):k?a.jsx(yt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Hu,{className:"h-12 w-12 text-destructive mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:k}),a.jsx(ie,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):J.length===0?a.jsx(yt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Ps,{className:"h-12 w-12 text-muted-foreground mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:r||i!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:J.map(R=>a.jsxs(yt,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[a.jsxs(Jt,{children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx(en,{className:"text-xl",children:R.manifest?.name||R.id}),a.jsxs("div",{className:"flex flex-col gap-1",children:[R.manifest?.categories&&R.manifest.categories[0]&&a.jsx(On,{variant:"secondary",className:"text-xs whitespace-nowrap",children:a9[R.manifest.categories[0]]||R.manifest.categories[0]}),V(R)]})]}),a.jsx(Sr,{className:"line-clamp-2",children:R.manifest?.description||"无描述"})]}),a.jsx(vn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:(Q[R.id]?.downloads??R.downloads??0).toLocaleString()})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Zl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsx("span",{children:(Q[R.id]?.rating??R.rating??0).toFixed(1)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[R.manifest?.keywords&&R.manifest.keywords.slice(0,3).map(me=>a.jsx(On,{variant:"outline",className:"text-xs",children:me},me)),R.manifest?.keywords&&R.manifest.keywords.length>3&&a.jsxs(On,{variant:"outline",className:"text-xs",children:["+",R.manifest.keywords.length-3]})]}),a.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[a.jsxs("div",{children:["v",R.manifest?.version||"unknown"," · ",R.manifest?.author?.name||"Unknown"]}),R.manifest?.host_application&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{children:"支持:"}),a.jsxs("span",{className:"font-medium",children:[R.manifest.host_application.min_version,R.manifest.host_application.max_version?` - ${R.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),a.jsx(bC,{className:"pt-4",children:a.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>n(R),children:"查看详情"}),R.installed?W(R)?a.jsxs(ie,{size:"sm",disabled:!j?.installed,title:j?.installed?void 0:"Git 未安装",onClick:()=>ue(R),children:[a.jsx(Ii,{className:"h-4 w-4 mr-1"}),"更新"]}):a.jsxs(ie,{variant:"destructive",size:"sm",disabled:!j?.installed,title:j?.installed?void 0:"Git 未安装",onClick:()=>ne(R),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"卸载"]}):a.jsxs(ie,{size:"sm",disabled:!j?.installed||M?.operation==="install"||D!==null&&!ce(R),title:j?.installed?D!==null&&!ce(R)?`不兼容当前版本 (需要 ${R.manifest?.host_application?.min_version||"未知"}${R.manifest?.host_application?.max_version?` - ${R.manifest.host_application.max_version}`:"+"},当前 ${D?.version})`:void 0:"Git 未安装",onClick:()=>ae(R),children:[a.jsx(fc,{className:"h-4 w-4 mr-1"}),M?.operation==="install"&&M?.plugin_id===R.id?"安装中...":"安装"]})]})})]},R.id))}),a.jsx(Rr,{open:e!==null,onOpenChange:H,children:e&&e.manifest&&a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsx(Cr,{children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"space-y-2 flex-1",children:[a.jsx(Tr,{className:"text-2xl",children:e.manifest.name}),a.jsxs(Gr,{children:["作者: ",e.manifest.author?.name||"Unknown",e.manifest.author?.url&&a.jsx("a",{href:e.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:a.jsx(Yh,{className:"h-3 w-3 inline"})})]})]}),a.jsxs("div",{className:"flex flex-col gap-2",children:[e.manifest.categories&&e.manifest.categories[0]&&a.jsx(On,{variant:"secondary",children:a9[e.manifest.categories[0]]||e.manifest.categories[0]}),V(e)]})]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(Ame,{pluginId:e.id}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"版本"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",e.manifest?.version||"unknown"]}),e.installed&&e.installed_version&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",e.installed_version]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"下载量"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:(Q[e.id]?.downloads??e.downloads??0).toLocaleString()})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"评分"}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Zl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[(Q[e.id]?.rating??e.rating??0).toFixed(1)," (",Q[e.id]?.rating_count??e.review_count??0,")"]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"许可证"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.license||"Unknown"})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.manifest.host_application?.min_version||"未知",e.manifest.host_application?.max_version?` - ${e.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:e.manifest.keywords&&e.manifest.keywords.map(R=>a.jsx(On,{variant:"outline",children:R},R))})]}),e.detailed_description&&a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),a.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:e.detailed_description})]}),!e.detailed_description&&a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.description||"无描述"})]}),a.jsxs("div",{className:"space-y-2",children:[e.manifest.homepage_url&&a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium",children:"主页: "}),a.jsx("a",{href:e.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.homepage_url})]}),e.manifest.repository_url&&a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium",children:"仓库: "}),a.jsx("a",{href:e.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.repository_url})]})]})]}),a.jsxs(ps,{children:[e.manifest.homepage_url&&a.jsxs(ie,{onClick:()=>window.open(e.manifest.homepage_url,"_blank"),children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"访问主页"]}),e.manifest.repository_url&&a.jsxs(ie,{variant:"outline",onClick:()=>window.open(e.manifest.repository_url,"_blank"),children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function _me(){return a.jsx(fn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(Ii,{className:"h-4 w-4 mr-2"}),"刷新"]}),a.jsxs(ie,{size:"sm",children:[a.jsx(dc,{className:"h-4 w-4 mr-2"}),"全局设置"]})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"已安装插件"}),a.jsx(pg,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(vn,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"正在加载..."})]})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"已启用"}),a.jsx(ua,{className:"h-4 w-4 text-green-600"})]}),a.jsxs(vn,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"已禁用"}),a.jsx(xc,{className:"h-4 w-4 text-orange-600"})]}),a.jsxs(vn,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(en,{className:"text-sm font-medium",children:"可更新"}),a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})]}),a.jsxs(vn,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"有新版本可用"})]})]})]}),a.jsxs(yt,{children:[a.jsxs(Jt,{children:[a.jsx(en,{children:"已安装的插件"}),a.jsx(Sr,{children:"查看和管理已安装插件的配置"})]}),a.jsx(vn,{children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[a.jsx(pg,{className:"h-16 w-16 text-muted-foreground/50"}),a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"插件配置功能开发中"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"即将支持插件的启用/禁用、参数配置等功能"})]}),a.jsx("div",{className:"flex gap-2",children:a.jsx(ie,{variant:"outline",asChild:!0,children:a.jsxs("a",{href:"/plugins",children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"前往插件市场"]})})})]})})]}),a.jsx(yt,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:a.jsx(vn,{className:"pt-6",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(xc,{className:"h-5 w-5 text-blue-600 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"开发进行中"}),a.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["插件配置功能正在积极开发中。目前您可以通过",a.jsx("strong",{children:"插件市场"}),"安装和卸载插件,完整的配置管理功能即将推出。"]})]})]})})})]})})}function Dme(){const t=ba(),{toast:e}=Pr(),[n,r]=S.useState([]),[s,i]=S.useState(!0),[l,c]=S.useState(null),[d,h]=S.useState(null),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O=S.useCallback(async()=>{try{i(!0),c(null);const z=localStorage.getItem("access-token"),Q=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${z}`}});if(!Q.ok)throw new Error("获取镜像源列表失败");const F=await Q.json();r(F.mirrors||[])}catch(z){const Q=z instanceof Error?z.message:"加载镜像源失败";c(Q),e({title:"加载失败",description:Q,variant:"destructive"})}finally{i(!1)}},[e]);S.useEffect(()=>{O()},[O]);const j=async()=>{try{const z=localStorage.getItem("access-token"),Q=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${z}`,"Content-Type":"application/json"},body:JSON.stringify(b)});if(!Q.ok){const F=await Q.json();throw new Error(F.detail||"添加镜像源失败")}e({title:"添加成功",description:"镜像源已添加"}),p(!1),k({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O()}catch(z){e({title:"添加失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"})}},T=async()=>{if(d)try{const z=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${d.id}`,{method:"PUT",headers:{Authorization:`Bearer ${z}`,"Content-Type":"application/json"},body:JSON.stringify({name:b.name,raw_prefix:b.raw_prefix,clone_prefix:b.clone_prefix,enabled:b.enabled,priority:b.priority})})).ok)throw new Error("更新镜像源失败");e({title:"更新成功",description:"镜像源已更新"}),v(!1),h(null),O()}catch(z){e({title:"更新失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"})}},M=async z=>{if(confirm("确定要删除这个镜像源吗?"))try{const Q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z}`,{method:"DELETE",headers:{Authorization:`Bearer ${Q}`}})).ok)throw new Error("删除镜像源失败");e({title:"删除成功",description:"镜像源已删除"}),O()}catch(Q){e({title:"删除失败",description:Q instanceof Error?Q.message:"未知错误",variant:"destructive"})}},_=async z=>{try{const Q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z.id}`,{method:"PUT",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!z.enabled})})).ok)throw new Error("更新状态失败");O()}catch(Q){e({title:"更新失败",description:Q instanceof Error?Q.message:"未知错误",variant:"destructive"})}},D=z=>{h(z),k({id:z.id,name:z.name,raw_prefix:z.raw_prefix,clone_prefix:z.clone_prefix,enabled:z.enabled,priority:z.priority}),v(!0)},E=async(z,Q)=>{const F=Q==="up"?z.priority-1:z.priority+1;if(!(F<1))try{const L=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z.id}`,{method:"PUT",headers:{Authorization:`Bearer ${L}`,"Content-Type":"application/json"},body:JSON.stringify({priority:F})})).ok)throw new Error("更新优先级失败");O()}catch(L){e({title:"更新失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}};return a.jsx(fn,{className:"h-full",children:a.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>t({to:"/plugins"}),children:a.jsx(R9,{className:"h-5 w-5"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),a.jsxs(ie,{onClick:()=>p(!0),children:[a.jsx(Wr,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),s?a.jsx(yt,{className:"p-6",children:a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(hf,{className:"h-8 w-8 animate-spin text-primary"})})}):l?a.jsx(yt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Hu,{className:"h-12 w-12 text-destructive mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:l}),a.jsx(ie,{onClick:O,children:"重新加载"})]})}):a.jsxs(yt,{children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Ac,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(gt,{children:"状态"}),a.jsx(gt,{children:"名称"}),a.jsx(gt,{children:"ID"}),a.jsx(gt,{children:"优先级"}),a.jsx(gt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n.map(z=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(jt,{checked:z.enabled,onCheckedChange:()=>_(z)})}),a.jsx(it,{children:a.jsxs("div",{children:[a.jsx("div",{className:"font-medium",children:z.name}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",z.raw_prefix]})]})}),a.jsx(it,{children:a.jsx(On,{variant:"outline",children:z.id})}),a.jsx(it,{children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-mono",children:z.priority}),a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx(ie,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(z,"up"),disabled:z.priority===1,children:a.jsx(e2,{className:"h-3 w-3"})}),a.jsx(ie,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(z,"down"),children:a.jsx(df,{className:"h-3 w-3"})})]})]})}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>D(z),children:a.jsx(nd,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>M(z.id),children:a.jsx(Ht,{className:"h-4 w-4 text-destructive"})})]})})]},z.id))})]})}),a.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(z=>a.jsx(yt,{className:"p-4",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:"font-semibold",children:z.name}),z.enabled&&a.jsx(On,{variant:"default",className:"text-xs",children:"启用"})]}),a.jsx(On,{variant:"outline",className:"mt-1 text-xs",children:z.id})]}),a.jsx(jt,{checked:z.enabled,onCheckedChange:()=>_(z)})]}),a.jsxs("div",{className:"text-sm space-y-1",children:[a.jsxs("div",{className:"text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"Raw: "}),a.jsx("span",{className:"break-all",children:z.raw_prefix})]}),a.jsxs("div",{className:"text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"优先级: "}),a.jsx("span",{className:"font-mono",children:z.priority})]})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[a.jsxs(ie,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>D(z),children:[a.jsx(nd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>E(z,"up"),disabled:z.priority===1,children:a.jsx(e2,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>E(z,"down"),children:a.jsx(df,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"destructive",size:"sm",onClick:()=>M(z.id),children:a.jsx(Ht,{className:"h-4 w-4"})})]})]})},z.id))})]}),a.jsx(Rr,{open:m,onOpenChange:p,children:a.jsxs(Nr,{className:"max-w-lg",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"添加镜像源"}),a.jsx(Gr,{children:"添加新的 Git 镜像源配置"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-id",children:"镜像源 ID *"}),a.jsx(Ae,{id:"add-id",placeholder:"例如: my-mirror",value:b.id,onChange:z=>k({...b,id:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-name",children:"名称 *"}),a.jsx(Ae,{id:"add-name",placeholder:"例如: 我的镜像源",value:b.name,onChange:z=>k({...b,name:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),a.jsx(Ae,{id:"add-raw",placeholder:"https://example.com/raw",value:b.raw_prefix,onChange:z=>k({...b,raw_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-clone",children:"克隆前缀 *"}),a.jsx(Ae,{id:"add-clone",placeholder:"https://example.com/clone",value:b.clone_prefix,onChange:z=>k({...b,clone_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-priority",children:"优先级"}),a.jsx(Ae,{id:"add-priority",type:"number",min:"1",value:b.priority,onChange:z=>k({...b,priority:parseInt(z.target.value)||1})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"add-enabled",checked:b.enabled,onCheckedChange:z=>k({...b,enabled:z})}),a.jsx(te,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>p(!1),children:"取消"}),a.jsx(ie,{onClick:j,children:"添加"})]})]})}),a.jsx(Rr,{open:x,onOpenChange:v,children:a.jsxs(Nr,{className:"max-w-lg",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑镜像源"}),a.jsx(Gr,{children:"修改镜像源配置"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"镜像源 ID"}),a.jsx(Ae,{value:b.id,disabled:!0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-name",children:"名称 *"}),a.jsx(Ae,{id:"edit-name",value:b.name,onChange:z=>k({...b,name:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),a.jsx(Ae,{id:"edit-raw",value:b.raw_prefix,onChange:z=>k({...b,raw_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-clone",children:"克隆前缀 *"}),a.jsx(Ae,{id:"edit-clone",value:b.clone_prefix,onChange:z=>k({...b,clone_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-priority",children:"优先级"}),a.jsx(Ae,{id:"edit-priority",type:"number",min:"1",value:b.priority,onChange:z=>k({...b,priority:parseInt(z.target.value)||1})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"edit-enabled",checked:b.enabled,onCheckedChange:z=>k({...b,enabled:z})}),a.jsx(te,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>v(!1),children:"取消"}),a.jsx(ie,{onClick:T,children:"保存"})]})]})})]})})}const Rme=Nd("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),Pz=S.forwardRef(({className:t,size:e,abbrTitle:n,children:r,...s},i)=>a.jsx("kbd",{className:ye(Rme({size:e,className:t})),ref:i,...s,children:n?a.jsx("abbr",{title:n,children:r}):r}));Pz.displayName="Kbd";const zme=[{icon:hg,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:io,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:z9,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:P9,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:K4,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Wf,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:B9,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:Tq,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:pg,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:fg,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:dc,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function Pme({open:t,onOpenChange:e}){const[n,r]=S.useState(""),[s,i]=S.useState(0),l=ba(),c=zme.filter(m=>m.title.toLowerCase().includes(n.toLowerCase())||m.description.toLowerCase().includes(n.toLowerCase())||m.category.toLowerCase().includes(n.toLowerCase()));S.useEffect(()=>{t&&(r(""),i(0))},[t]);const d=S.useCallback(m=>{l({to:m}),e(!1)},[l,e]),h=S.useCallback(m=>{m.key==="ArrowDown"?(m.preventDefault(),i(p=>(p+1)%c.length)):m.key==="ArrowUp"?(m.preventDefault(),i(p=>(p-1+c.length)%c.length)):m.key==="Enter"&&c[s]&&(m.preventDefault(),d(c[s].path))},[c,s,d]);return a.jsx(Rr,{open:t,onOpenChange:e,children:a.jsxs(Nr,{className:"max-w-2xl p-0 gap-0",children:[a.jsxs(Cr,{className:"px-4 pt-4 pb-0",children:[a.jsx(Tr,{className:"sr-only",children:"搜索"}),a.jsxs("div",{className:"relative",children:[a.jsx(Ps,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),a.jsx(Ae,{value:n,onChange:m=>{r(m.target.value),i(0)},onKeyDown:h,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),a.jsx("div",{className:"border-t",children:a.jsx(fn,{className:"h-[400px]",children:c.length>0?a.jsx("div",{className:"p-2",children:c.map((m,p)=>{const x=m.icon;return a.jsxs("button",{onClick:()=>d(m.path),onMouseEnter:()=>i(p),className:ye("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",p===s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[a.jsx(x,{className:"h-5 w-5 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium text-sm",children:m.title}),a.jsx("div",{className:"text-xs text-muted-foreground truncate",children:m.description})]}),a.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:m.category})]},m.path)})}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx(Ps,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),a.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function Bme(t){const e=Lme(t),n=S.forwardRef((r,s)=>{const{children:i,...l}=r,c=S.Children.toArray(i),d=c.find(qme);if(d){const h=d.props.children,m=c.map(p=>p===d?S.Children.count(h)>1?S.Children.only(null):S.isValidElement(h)?h.props.children:null:p);return a.jsx(e,{...l,ref:s,children:S.isValidElement(h)?S.cloneElement(h,void 0,m):null})}return a.jsx(e,{...l,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function Lme(t){const e=S.forwardRef((n,r)=>{const{children:s,...i}=n;if(S.isValidElement(s)){const l=Qme(s),c=Fme(i,s.props);return s.type!==S.Fragment&&(c.ref=r?lo(r,l):l),S.cloneElement(s,c)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Ime=Symbol("radix.slottable");function qme(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Ime}function Fme(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...c)=>{const d=i(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function Qme(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var z4=["Enter"," "],$me=["ArrowDown","PageUp","Home"],Bz=["ArrowUp","PageDown","End"],Hme=[...$me,...Bz],Ume={ltr:[...z4,"ArrowRight"],rtl:[...z4,"ArrowLeft"]},Vme={ltr:["ArrowLeft"],rtl:["ArrowRight"]},T0="Menu",[$f,Wme,Gme]=tx(T0),[Lc,Lz]=Hi(T0,[Gme,wd,fx]),M0=wd(),Iz=fx(),[qz,Ao]=Lc(T0),[Xme,A0]=Lc(T0),Fz=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:l=!0}=t,c=M0(e),[d,h]=S.useState(null),m=S.useRef(!1),p=es(i),x=Vf(s);return S.useEffect(()=>{const v=()=>{m.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>m.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),a.jsx(ix,{...c,children:a.jsx(qz,{scope:e,open:n,onOpenChange:p,content:d,onContentChange:h,children:a.jsx(Xme,{scope:e,onClose:S.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:m,dir:x,modal:l,children:r})})})};Fz.displayName=T0;var Yme="MenuAnchor",Z5=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=M0(n);return a.jsx(ax,{...s,...r,ref:e})});Z5.displayName=Yme;var J5="MenuPortal",[Kme,Qz]=Lc(J5,{forceMount:void 0}),$z=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=Ao(J5,e);return a.jsx(Kme,{scope:e,forceMount:n,children:a.jsx(Bs,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};$z.displayName=J5;var Ni="MenuContent",[Zme,e3]=Lc(Ni),Hz=S.forwardRef((t,e)=>{const n=Qz(Ni,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Ao(Ni,t.__scopeMenu),l=A0(Ni,t.__scopeMenu);return a.jsx($f.Provider,{scope:t.__scopeMenu,children:a.jsx(Bs,{present:r||i.open,children:a.jsx($f.Slot,{scope:t.__scopeMenu,children:l.modal?a.jsx(Jme,{...s,ref:e}):a.jsx(epe,{...s,ref:e})})})})}),Jme=S.forwardRef((t,e)=>{const n=Ao(Ni,t.__scopeMenu),r=S.useRef(null),s=Cn(e,r);return S.useEffect(()=>{const i=r.current;if(i)return j9(i)},[]),a.jsx(t3,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:$e(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),epe=S.forwardRef((t,e)=>{const n=Ao(Ni,t.__scopeMenu);return a.jsx(t3,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),tpe=Bme("MenuContent.ScrollLock"),t3=S.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:d,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:x,onDismiss:v,disableOutsideScroll:b,...k}=t,O=Ao(Ni,n),j=A0(Ni,n),T=M0(n),M=Iz(n),_=Wme(n),[D,E]=S.useState(null),z=S.useRef(null),Q=Cn(e,z,O.onContentChange),F=S.useRef(0),L=S.useRef(""),U=S.useRef(0),V=S.useRef(null),ce=S.useRef("right"),W=S.useRef(0),J=b?N9:S.Fragment,H=b?{as:tpe,allowPinchZoom:!0}:void 0,ae=ue=>{const R=L.current+ue,me=_().filter(ve=>!ve.disabled),Y=document.activeElement,P=me.find(ve=>ve.ref.current===Y)?.textValue,K=me.map(ve=>ve.textValue),$=fpe(K,R,P),fe=me.find(ve=>ve.textValue===$)?.ref.current;(function ve(Re){L.current=Re,window.clearTimeout(F.current),Re!==""&&(F.current=window.setTimeout(()=>ve(""),1e3))})(R),fe&&setTimeout(()=>fe.focus())};S.useEffect(()=>()=>window.clearTimeout(F.current),[]),C9();const ne=S.useCallback(ue=>ce.current===V.current?.side&&ppe(ue,V.current?.area),[]);return a.jsx(Zme,{scope:n,searchRef:L,onItemEnter:S.useCallback(ue=>{ne(ue)&&ue.preventDefault()},[ne]),onItemLeave:S.useCallback(ue=>{ne(ue)||(z.current?.focus(),E(null))},[ne]),onTriggerLeave:S.useCallback(ue=>{ne(ue)&&ue.preventDefault()},[ne]),pointerGraceTimerRef:U,onPointerGraceIntentChange:S.useCallback(ue=>{V.current=ue},[]),children:a.jsx(J,{...H,children:a.jsx(T9,{asChild:!0,trapped:s,onMountAutoFocus:$e(i,ue=>{ue.preventDefault(),z.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:x,onDismiss:v,children:a.jsx(NC,{asChild:!0,...M,dir:j.dir,orientation:"vertical",loop:r,currentTabStopId:D,onCurrentTabStopIdChange:E,onEntryFocus:$e(d,ue=>{j.isUsingKeyboardRef.current||ue.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(X4,{role:"menu","aria-orientation":"vertical","data-state":lP(O.open),"data-radix-menu-content":"",dir:j.dir,...T,...k,ref:Q,style:{outline:"none",...k.style},onKeyDown:$e(k.onKeyDown,ue=>{const me=ue.target.closest("[data-radix-menu-content]")===ue.currentTarget,Y=ue.ctrlKey||ue.altKey||ue.metaKey,P=ue.key.length===1;me&&(ue.key==="Tab"&&ue.preventDefault(),!Y&&P&&ae(ue.key));const K=z.current;if(ue.target!==K||!Hme.includes(ue.key))return;ue.preventDefault();const fe=_().filter(ve=>!ve.disabled).map(ve=>ve.ref.current);Bz.includes(ue.key)&&fe.reverse(),dpe(fe)}),onBlur:$e(t.onBlur,ue=>{ue.currentTarget.contains(ue.target)||(window.clearTimeout(F.current),L.current="")}),onPointerMove:$e(t.onPointerMove,Hf(ue=>{const R=ue.target,me=W.current!==ue.clientX;if(ue.currentTarget.contains(R)&&me){const Y=ue.clientX>W.current?"right":"left";ce.current=Y,W.current=ue.clientX}}))})})})})})})});Hz.displayName=Ni;var npe="MenuGroup",n3=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Yt.div,{role:"group",...r,ref:e})});n3.displayName=npe;var rpe="MenuLabel",Uz=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Yt.div,{...r,ref:e})});Uz.displayName=rpe;var Jg="MenuItem",l9="menu.itemSelect",Kx=S.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=S.useRef(null),l=A0(Jg,t.__scopeMenu),c=e3(Jg,t.__scopeMenu),d=Cn(e,i),h=S.useRef(!1),m=()=>{const p=i.current;if(!n&&p){const x=new CustomEvent(l9,{bubbles:!0,cancelable:!0});p.addEventListener(l9,v=>r?.(v),{once:!0}),A9(p,x),x.defaultPrevented?h.current=!1:l.onClose()}};return a.jsx(Vz,{...s,ref:d,disabled:n,onClick:$e(t.onClick,m),onPointerDown:p=>{t.onPointerDown?.(p),h.current=!0},onPointerUp:$e(t.onPointerUp,p=>{h.current||p.currentTarget?.click()}),onKeyDown:$e(t.onKeyDown,p=>{const x=c.searchRef.current!=="";n||x&&p.key===" "||z4.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Kx.displayName=Jg;var Vz=S.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,l=e3(Jg,n),c=Iz(n),d=S.useRef(null),h=Cn(e,d),[m,p]=S.useState(!1),[x,v]=S.useState("");return S.useEffect(()=>{const b=d.current;b&&v((b.textContent??"").trim())},[i.children]),a.jsx($f.ItemSlot,{scope:n,disabled:r,textValue:s??x,children:a.jsx(CC,{asChild:!0,...c,focusable:!r,children:a.jsx(Yt.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:h,onPointerMove:$e(t.onPointerMove,Hf(b=>{r?l.onItemLeave(b):(l.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:$e(t.onPointerLeave,Hf(b=>l.onItemLeave(b))),onFocus:$e(t.onFocus,()=>p(!0)),onBlur:$e(t.onBlur,()=>p(!1))})})})}),spe="MenuCheckboxItem",Wz=S.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return a.jsx(Zz,{scope:t.__scopeMenu,checked:n,children:a.jsx(Kx,{role:"menuitemcheckbox","aria-checked":ex(n)?"mixed":n,...s,ref:e,"data-state":i3(n),onSelect:$e(s.onSelect,()=>r?.(ex(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Wz.displayName=spe;var Gz="MenuRadioGroup",[ipe,ape]=Lc(Gz,{value:void 0,onValueChange:()=>{}}),Xz=S.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=es(r);return a.jsx(ipe,{scope:t.__scopeMenu,value:n,onValueChange:i,children:a.jsx(n3,{...s,ref:e})})});Xz.displayName=Gz;var Yz="MenuRadioItem",Kz=S.forwardRef((t,e)=>{const{value:n,...r}=t,s=ape(Yz,t.__scopeMenu),i=n===s.value;return a.jsx(Zz,{scope:t.__scopeMenu,checked:i,children:a.jsx(Kx,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":i3(i),onSelect:$e(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Kz.displayName=Yz;var r3="MenuItemIndicator",[Zz,lpe]=Lc(r3,{checked:!1}),Jz=S.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=lpe(r3,n);return a.jsx(Bs,{present:r||ex(i.checked)||i.checked===!0,children:a.jsx(Yt.span,{...s,ref:e,"data-state":i3(i.checked)})})});Jz.displayName=r3;var ope="MenuSeparator",eP=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Yt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});eP.displayName=ope;var cpe="MenuArrow",tP=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=M0(n);return a.jsx(Y4,{...s,...r,ref:e})});tP.displayName=cpe;var s3="MenuSub",[upe,nP]=Lc(s3),rP=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:s}=t,i=Ao(s3,e),l=M0(e),[c,d]=S.useState(null),[h,m]=S.useState(null),p=es(s);return S.useEffect(()=>(i.open===!1&&p(!1),()=>p(!1)),[i.open,p]),a.jsx(ix,{...l,children:a.jsx(qz,{scope:e,open:r,onOpenChange:p,content:h,onContentChange:m,children:a.jsx(upe,{scope:e,contentId:Oi(),triggerId:Oi(),trigger:c,onTriggerChange:d,children:n})})})};rP.displayName=s3;var Gh="MenuSubTrigger",sP=S.forwardRef((t,e)=>{const n=Ao(Gh,t.__scopeMenu),r=A0(Gh,t.__scopeMenu),s=nP(Gh,t.__scopeMenu),i=e3(Gh,t.__scopeMenu),l=S.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:d}=i,h={__scopeMenu:t.__scopeMenu},m=S.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return S.useEffect(()=>m,[m]),S.useEffect(()=>{const p=c.current;return()=>{window.clearTimeout(p),d(null)}},[c,d]),a.jsx(Z5,{asChild:!0,...h,children:a.jsx(Vz,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":lP(n.open),...t,ref:lo(e,s.onTriggerChange),onClick:p=>{t.onClick?.(p),!(t.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:$e(t.onPointerMove,Hf(p=>{i.onItemEnter(p),!p.defaultPrevented&&!t.disabled&&!n.open&&!l.current&&(i.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:$e(t.onPointerLeave,Hf(p=>{m();const x=n.content?.getBoundingClientRect();if(x){const v=n.content?.dataset.side,b=v==="right",k=b?-5:5,O=x[b?"left":"right"],j=x[b?"right":"left"];i.onPointerGraceIntentChange({area:[{x:p.clientX+k,y:p.clientY},{x:O,y:x.top},{x:j,y:x.top},{x:j,y:x.bottom},{x:O,y:x.bottom}],side:v}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(p),p.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:$e(t.onKeyDown,p=>{const x=i.searchRef.current!=="";t.disabled||x&&p.key===" "||Ume[r.dir].includes(p.key)&&(n.onOpenChange(!0),n.content?.focus(),p.preventDefault())})})})});sP.displayName=Gh;var iP="MenuSubContent",aP=S.forwardRef((t,e)=>{const n=Qz(Ni,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Ao(Ni,t.__scopeMenu),l=A0(Ni,t.__scopeMenu),c=nP(iP,t.__scopeMenu),d=S.useRef(null),h=Cn(e,d);return a.jsx($f.Provider,{scope:t.__scopeMenu,children:a.jsx(Bs,{present:r||i.open,children:a.jsx($f.Slot,{scope:t.__scopeMenu,children:a.jsx(t3,{id:c.contentId,"aria-labelledby":c.triggerId,...s,ref:h,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{l.isUsingKeyboardRef.current&&d.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:$e(t.onFocusOutside,m=>{m.target!==c.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:$e(t.onEscapeKeyDown,m=>{l.onClose(),m.preventDefault()}),onKeyDown:$e(t.onKeyDown,m=>{const p=m.currentTarget.contains(m.target),x=Vme[l.dir].includes(m.key);p&&x&&(i.onOpenChange(!1),c.trigger?.focus(),m.preventDefault())})})})})})});aP.displayName=iP;function lP(t){return t?"open":"closed"}function ex(t){return t==="indeterminate"}function i3(t){return ex(t)?"indeterminate":t?"checked":"unchecked"}function dpe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function hpe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function fpe(t,e,n){const s=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let l=hpe(t,Math.max(i,0));s.length===1&&(l=l.filter(h=>h!==n));const d=l.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return d!==n?d:void 0}function mpe(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,l=e.length-1;ir!=x>r&&n<(p-h)*(r-m)/(x-m)+h&&(s=!s)}return s}function ppe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return mpe(n,e)}function Hf(t){return e=>e.pointerType==="mouse"?t(e):void 0}var gpe=Fz,xpe=Z5,vpe=$z,ype=Hz,bpe=n3,wpe=Uz,Spe=Kx,kpe=Wz,Ope=Xz,jpe=Kz,Npe=Jz,Cpe=eP,Tpe=tP,Mpe=rP,Ape=sP,Epe=aP,a3="ContextMenu",[_pe]=Hi(a3,[Lz]),ls=Lz(),[Dpe,oP]=_pe(a3),cP=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:s,modal:i=!0}=t,[l,c]=S.useState(!1),d=ls(e),h=es(r),m=S.useCallback(p=>{c(p),h(p)},[h]);return a.jsx(Dpe,{scope:e,open:l,onOpenChange:m,modal:i,children:a.jsx(gpe,{...d,dir:s,open:l,onOpenChange:m,modal:i,children:n})})};cP.displayName=a3;var uP="ContextMenuTrigger",dP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=t,i=oP(uP,n),l=ls(n),c=S.useRef({x:0,y:0}),d=S.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...c.current})}),h=S.useRef(0),m=S.useCallback(()=>window.clearTimeout(h.current),[]),p=x=>{c.current={x:x.clientX,y:x.clientY},i.onOpenChange(!0)};return S.useEffect(()=>m,[m]),S.useEffect(()=>void(r&&m()),[r,m]),a.jsxs(a.Fragment,{children:[a.jsx(xpe,{...l,virtualRef:d}),a.jsx(Yt.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:$e(t.onContextMenu,x=>{m(),p(x),x.preventDefault()}),onPointerDown:r?t.onPointerDown:$e(t.onPointerDown,Fp(x=>{m(),h.current=window.setTimeout(()=>p(x),700)})),onPointerMove:r?t.onPointerMove:$e(t.onPointerMove,Fp(m)),onPointerCancel:r?t.onPointerCancel:$e(t.onPointerCancel,Fp(m)),onPointerUp:r?t.onPointerUp:$e(t.onPointerUp,Fp(m))})]})});dP.displayName=uP;var Rpe="ContextMenuPortal",hP=t=>{const{__scopeContextMenu:e,...n}=t,r=ls(e);return a.jsx(vpe,{...r,...n})};hP.displayName=Rpe;var fP="ContextMenuContent",mP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=oP(fP,n),i=ls(n),l=S.useRef(!1);return a.jsx(ype,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:c=>{t.onCloseAutoFocus?.(c),!c.defaultPrevented&&l.current&&c.preventDefault(),l.current=!1},onInteractOutside:c=>{t.onInteractOutside?.(c),!c.defaultPrevented&&!s.modal&&(l.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});mP.displayName=fP;var zpe="ContextMenuGroup",Ppe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(bpe,{...s,...r,ref:e})});Ppe.displayName=zpe;var Bpe="ContextMenuLabel",pP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(wpe,{...s,...r,ref:e})});pP.displayName=Bpe;var Lpe="ContextMenuItem",gP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Spe,{...s,...r,ref:e})});gP.displayName=Lpe;var Ipe="ContextMenuCheckboxItem",xP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(kpe,{...s,...r,ref:e})});xP.displayName=Ipe;var qpe="ContextMenuRadioGroup",Fpe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Ope,{...s,...r,ref:e})});Fpe.displayName=qpe;var Qpe="ContextMenuRadioItem",vP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(jpe,{...s,...r,ref:e})});vP.displayName=Qpe;var $pe="ContextMenuItemIndicator",yP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Npe,{...s,...r,ref:e})});yP.displayName=$pe;var Hpe="ContextMenuSeparator",bP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Cpe,{...s,...r,ref:e})});bP.displayName=Hpe;var Upe="ContextMenuArrow",Vpe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Tpe,{...s,...r,ref:e})});Vpe.displayName=Upe;var wP="ContextMenuSub",SP=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,open:s,defaultOpen:i}=t,l=ls(e),[c,d]=So({prop:s,defaultProp:i??!1,onChange:r,caller:wP});return a.jsx(Mpe,{...l,open:c,onOpenChange:d,children:n})};SP.displayName=wP;var Wpe="ContextMenuSubTrigger",kP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Ape,{...s,...r,ref:e})});kP.displayName=Wpe;var Gpe="ContextMenuSubContent",OP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Epe,{...s,...r,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});OP.displayName=Gpe;function Fp(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var Xpe=cP,Ype=dP,Kpe=hP,jP=mP,NP=pP,CP=gP,TP=xP,MP=vP,AP=yP,EP=bP,Zpe=SP,_P=kP,DP=OP;const Jpe=Xpe,ege=Ype,tge=Zpe,RP=S.forwardRef(({className:t,inset:e,children:n,...r},s)=>a.jsxs(_P,{ref:s,className:ye("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...r,children:[n,a.jsx(Mc,{className:"ml-auto h-4 w-4"})]}));RP.displayName=_P.displayName;const zP=S.forwardRef(({className:t,...e},n)=>a.jsx(DP,{ref:n,className:ye("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 origin-[--radix-context-menu-content-transform-origin]",t),...e}));zP.displayName=DP.displayName;const PP=S.forwardRef(({className:t,...e},n)=>a.jsx(Kpe,{children:a.jsx(jP,{ref:n,className:ye("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-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 origin-[--radix-context-menu-content-transform-origin]",t),...e})}));PP.displayName=jP.displayName;const Pi=S.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(CP,{ref:r,className:ye("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));Pi.displayName=CP.displayName;const nge=S.forwardRef(({className:t,children:e,checked:n,...r},s)=>a.jsxs(TP,{ref:s,className:ye("relative flex 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),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(AP,{children:a.jsx(hc,{className:"h-4 w-4"})})}),e]}));nge.displayName=TP.displayName;const rge=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(MP,{ref:r,className:ye("relative flex 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(AP,{children:a.jsx(Mq,{className:"h-2 w-2 fill-current"})})}),e]}));rge.displayName=MP.displayName;const sge=S.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(NP,{ref:r,className:ye("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...n}));sge.displayName=NP.displayName;const Xh=S.forwardRef(({className:t,...e},n)=>a.jsx(EP,{ref:n,className:ye("-mx-1 my-1 h-px bg-border",t),...e}));Xh.displayName=EP.displayName;const qu=({className:t,...e})=>a.jsx("span",{className:ye("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});qu.displayName="ContextMenuShortcut";var ige=Symbol("radix.slottable");function age(t){const e=({children:n})=>a.jsx(a.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=ige,e}var[Zx]=Hi("Tooltip",[wd]),Jx=wd(),BP="TooltipProvider",lge=700,P4="tooltip.open",[oge,l3]=Zx(BP),LP=t=>{const{__scopeTooltip:e,delayDuration:n=lge,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,l=S.useRef(!0),c=S.useRef(!1),d=S.useRef(0);return S.useEffect(()=>{const h=d.current;return()=>window.clearTimeout(h)},[]),a.jsx(oge,{scope:e,isOpenDelayedRef:l,delayDuration:n,onOpen:S.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:S.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:S.useCallback(h=>{c.current=h},[]),disableHoverableContent:s,children:i})};LP.displayName=BP;var Uf="Tooltip",[cge,E0]=Zx(Uf),IP=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:l,delayDuration:c}=t,d=l3(Uf,t.__scopeTooltip),h=Jx(e),[m,p]=S.useState(null),x=Oi(),v=S.useRef(0),b=l??d.disableHoverableContent,k=c??d.delayDuration,O=S.useRef(!1),[j,T]=So({prop:r,defaultProp:s??!1,onChange:z=>{z?(d.onOpen(),document.dispatchEvent(new CustomEvent(P4))):d.onClose(),i?.(z)},caller:Uf}),M=S.useMemo(()=>j?O.current?"delayed-open":"instant-open":"closed",[j]),_=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,O.current=!1,T(!0)},[T]),D=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,T(!1)},[T]),E=S.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{O.current=!0,T(!0),v.current=0},k)},[k,T]);return S.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),a.jsx(ix,{...h,children:a.jsx(cge,{scope:e,contentId:x,open:j,stateAttribute:M,trigger:m,onTriggerChange:p,onTriggerEnter:S.useCallback(()=>{d.isOpenDelayedRef.current?E():_()},[d.isOpenDelayedRef,E,_]),onTriggerLeave:S.useCallback(()=>{b?D():(window.clearTimeout(v.current),v.current=0)},[D,b]),onOpen:_,onClose:D,disableHoverableContent:b,children:n})})};IP.displayName=Uf;var B4="TooltipTrigger",qP=S.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=E0(B4,n),i=l3(B4,n),l=Jx(n),c=S.useRef(null),d=Cn(e,c,s.onTriggerChange),h=S.useRef(!1),m=S.useRef(!1),p=S.useCallback(()=>h.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),a.jsx(ax,{asChild:!0,...l,children:a.jsx(Yt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:d,onPointerMove:$e(t.onPointerMove,x=>{x.pointerType!=="touch"&&!m.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),m.current=!0)}),onPointerLeave:$e(t.onPointerLeave,()=>{s.onTriggerLeave(),m.current=!1}),onPointerDown:$e(t.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:$e(t.onFocus,()=>{h.current||s.onOpen()}),onBlur:$e(t.onBlur,s.onClose),onClick:$e(t.onClick,s.onClose)})})});qP.displayName=B4;var o3="TooltipPortal",[uge,dge]=Zx(o3,{forceMount:void 0}),FP=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=E0(o3,e);return a.jsx(uge,{scope:e,forceMount:n,children:a.jsx(Bs,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};FP.displayName=o3;var bd="TooltipContent",QP=S.forwardRef((t,e)=>{const n=dge(bd,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,l=E0(bd,t.__scopeTooltip);return a.jsx(Bs,{present:r||l.open,children:l.disableHoverableContent?a.jsx($P,{side:s,...i,ref:e}):a.jsx(hge,{side:s,...i,ref:e})})}),hge=S.forwardRef((t,e)=>{const n=E0(bd,t.__scopeTooltip),r=l3(bd,t.__scopeTooltip),s=S.useRef(null),i=Cn(e,s),[l,c]=S.useState(null),{trigger:d,onClose:h}=n,m=s.current,{onPointerInTransitChange:p}=r,x=S.useCallback(()=>{c(null),p(!1)},[p]),v=S.useCallback((b,k)=>{const O=b.currentTarget,j={x:b.clientX,y:b.clientY},T=xge(j,O.getBoundingClientRect()),M=vge(j,T),_=yge(k.getBoundingClientRect()),D=wge([...M,..._]);c(D),p(!0)},[p]);return S.useEffect(()=>()=>x(),[x]),S.useEffect(()=>{if(d&&m){const b=O=>v(O,m),k=O=>v(O,d);return d.addEventListener("pointerleave",b),m.addEventListener("pointerleave",k),()=>{d.removeEventListener("pointerleave",b),m.removeEventListener("pointerleave",k)}}},[d,m,v,x]),S.useEffect(()=>{if(l){const b=k=>{const O=k.target,j={x:k.clientX,y:k.clientY},T=d?.contains(O)||m?.contains(O),M=!bge(j,l);T?x():M&&(x(),h())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[d,m,l,h,x]),a.jsx($P,{...t,ref:i})}),[fge,mge]=Zx(Uf,{isInside:!1}),pge=age("TooltipContent"),$P=S.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:l,...c}=t,d=E0(bd,n),h=Jx(n),{onClose:m}=d;return S.useEffect(()=>(document.addEventListener(P4,m),()=>document.removeEventListener(P4,m)),[m]),S.useEffect(()=>{if(d.trigger){const p=x=>{x.target?.contains(d.trigger)&&m()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[d.trigger,m]),a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:p=>p.preventDefault(),onDismiss:m,children:a.jsxs(X4,{"data-state":d.stateAttribute,...h,...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(pge,{children:r}),a.jsx(fge,{scope:n,isInside:!0,children:a.jsx(sq,{id:d.contentId,role:"tooltip",children:s||r})})]})})});QP.displayName=bd;var HP="TooltipArrow",gge=S.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Jx(n);return mge(HP,n).isInside?null:a.jsx(Y4,{...s,...r,ref:e})});gge.displayName=HP;function xge(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function vge(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 yge(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function bge(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,l=e.length-1;ir!=x>r&&n<(p-h)*(r-m)/(x-m)+h&&(s=!s)}return s}function wge(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),Sge(e)}function Sge(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const i=e[e.length-1],l=e[e.length-2];if((i.x-l.x)*(s.y-l.y)>=(i.y-l.y)*(s.x-l.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],l=n[n.length-2];if((i.x-l.x)*(s.y-l.y)>=(i.y-l.y)*(s.x-l.x))n.pop();else break}n.push(s)}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 kge=LP,Oge=IP,jge=qP,Nge=FP,UP=QP;const Cge=kge,Tge=Oge,Mge=jge,VP=S.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(Nge,{children:a.jsx(UP,{ref:r,sideOffset:e,className:ye("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",t),...n})}));VP.displayName=UP.displayName;function Age({children:t}){CH();const[e,n]=S.useState(!0),[r,s]=S.useState(!1),[i,l]=S.useState(!1),{theme:c,setTheme:d}=dw(),h=MI(),m=ba();S.useEffect(()=>{const k=O=>{(O.metaKey||O.ctrlKey)&&O.key==="k"&&(O.preventDefault(),l(!0))};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[]);const p=[{title:"概览",items:[{icon:hg,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:io,label:"麦麦主程序配置",path:"/config/bot"},{icon:z9,label:"麦麦模型提供商配置",path:"/config/modelProvider"},{icon:P9,label:"麦麦模型配置",path:"/config/model"},{icon:hO,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:K4,label:"表情包管理",path:"/resource/emoji"},{icon:Wf,label:"表达方式管理",path:"/resource/expression"},{icon:B9,label:"人物信息管理",path:"/resource/person"}]},{title:"扩展与监控",items:[{icon:pg,label:"插件市场",path:"/plugins"},{icon:hO,label:"插件配置",path:"/plugin-config"},{icon:fg,label:"日志查看器",path:"/logs"}]},{title:"系统",items:[{icon:dc,label:"系统设置",path:"/settings"}]}],v=c==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":c,b=()=>{localStorage.removeItem("access-token"),m({to:"/auth"})};return a.jsx(Cge,{delayDuration:300,children:a.jsxs("div",{className:"flex h-screen overflow-hidden",children:[a.jsxs("aside",{className:ye("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",e?"lg:w-64":"lg:w-16",r?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[a.jsx("div",{className:"flex h-16 items-center border-b px-4",children:a.jsxs("div",{className:ye("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!e&&"lg:flex-none lg:w-8"),children:[a.jsxs("div",{className:ye("flex items-baseline gap-2",!e&&"lg:hidden"),children:[a.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),a.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:rH()})]}),!e&&a.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),a.jsx(fn,{className:"flex-1",children:a.jsx("nav",{className:"p-4",children:a.jsx("ul",{className:ye("space-y-6",!e&&"lg:space-y-3"),children:p.map((k,O)=>a.jsxs("li",{children:[a.jsx("div",{className:ye("px-3 h-[1.25rem]","mb-2",!e&&"lg:mb-1 lg:invisible"),children:a.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:k.title})}),!e&&O>0&&a.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),a.jsx("ul",{className:"space-y-1",children:k.items.map(j=>{const T=h({to:j.path}),M=j.icon,_=a.jsxs(a.Fragment,{children:[T&&a.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),a.jsxs("div",{className:ye("flex items-center transition-all duration-300",e?"gap-3":"lg:gap-0"),children:[a.jsx(M,{className:ye("h-5 w-5 flex-shrink-0",T&&"text-primary"),strokeWidth:2,fill:"none"}),a.jsx("span",{className:ye("text-sm font-medium whitespace-nowrap transition-all duration-300",T&&"font-semibold",e?"opacity-100 max-w-[200px]":"lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:j.label})]})]});return a.jsx("li",{className:"relative",children:a.jsxs(Tge,{children:[a.jsx(Mge,{asChild:!0,children:a.jsx(AI,{to:j.path,className:ye("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",T?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",e?"px-3":"lg:px-0 lg:justify-center"),onClick:()=>s(!1),children:_})}),!e&&a.jsx(VP,{side:"right",className:"hidden lg:block",children:a.jsx("p",{children:j.label})})]})},j.path)})})]},k.title))})})})]}),r&&a.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>s(!1)}),a.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[a.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:()=>s(!r),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:a.jsx(Aq,{className:"h-5 w-5"})}),a.jsx("button",{onClick:()=>n(!e),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:e?"收起侧边栏":"展开侧边栏",children:a.jsx(Tc,{className:ye("h-5 w-5 transition-transform",!e&&"rotate-180")})})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>l(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[a.jsx(Ps,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),a.jsxs(Pz,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[a.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),a.jsx(Pme,{open:i,onOpenChange:l}),a.jsxs(ie,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[a.jsx(Eq,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),a.jsx("button",{onClick:k=>{Q$(v==="dark"?"light":"dark",d,k)},className:"rounded-lg p-2 hover:bg-accent",title:v==="dark"?"切换到浅色模式":"切换到深色模式",children:v==="dark"?a.jsx(Zb,{className:"h-5 w-5"}):a.jsx(Jb,{className:"h-5 w-5"})}),a.jsx("div",{className:"h-6 w-px bg-border"}),a.jsxs(ie,{variant:"ghost",size:"sm",onClick:b,className:"gap-2",title:"登出系统",children:[a.jsx(fO,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),a.jsxs(Jpe,{children:[a.jsx(ege,{asChild:!0,children:a.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:t})}),a.jsxs(PP,{className:"w-64",children:[a.jsxs(Pi,{onClick:()=>m({to:"/"}),children:[a.jsx(hg,{className:"mr-2 h-4 w-4"}),"首页"]}),a.jsxs(Pi,{onClick:()=>m({to:"/settings"}),children:[a.jsx(dc,{className:"mr-2 h-4 w-4"}),"系统设置"]}),a.jsxs(Pi,{onClick:()=>m({to:"/logs"}),children:[a.jsx(fg,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),a.jsx(Xh,{}),a.jsxs(tge,{children:[a.jsxs(RP,{children:[a.jsx(_9,{className:"mr-2 h-4 w-4"}),"切换主题"]}),a.jsxs(zP,{className:"w-48",children:[a.jsxs(Pi,{onClick:()=>d("light"),disabled:c==="light",children:[a.jsx(Zb,{className:"mr-2 h-4 w-4"}),"浅色",c==="light"&&a.jsx(qu,{children:"✓"})]}),a.jsxs(Pi,{onClick:()=>d("dark"),disabled:c==="dark",children:[a.jsx(Jb,{className:"mr-2 h-4 w-4"}),"深色",c==="dark"&&a.jsx(qu,{children:"✓"})]}),a.jsxs(Pi,{onClick:()=>d("system"),disabled:c==="system",children:[a.jsx(dc,{className:"mr-2 h-4 w-4"}),"跟随系统",c==="system"&&a.jsx(qu,{children:"✓"})]})]})]}),a.jsx(Xh,{}),a.jsxs(Pi,{onClick:()=>window.location.reload(),children:[a.jsx(_q,{className:"mr-2 h-4 w-4"}),"刷新页面",a.jsx(qu,{children:"⌘R"})]}),a.jsxs(Pi,{onClick:()=>l(!0),children:[a.jsx(Ps,{className:"mr-2 h-4 w-4"}),"搜索",a.jsx(qu,{children:"⌘K"})]}),a.jsx(Xh,{}),a.jsxs(Pi,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[a.jsx(Yh,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),a.jsx(Xh,{}),a.jsxs(Pi,{onClick:b,className:"text-destructive focus:text-destructive",children:[a.jsx(fO,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}const _0=EI({component:()=>a.jsxs(a.Fragment,{children:[a.jsx(c9,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!qT())throw DI({to:"/auth"})}}),Ege=Xr({getParentRoute:()=>_0,path:"/auth",component:TH}),_ge=Xr({getParentRoute:()=>_0,path:"/setup",component:WH}),Fs=Xr({getParentRoute:()=>_0,id:"protected",component:()=>a.jsx(Age,{children:a.jsx(c9,{})})}),Dge=Xr({getParentRoute:()=>Fs,path:"/",component:q$}),Rge=Xr({getParentRoute:()=>Fs,path:"/config/bot",component:Vee}),zge=Xr({getParentRoute:()=>Fs,path:"/config/modelProvider",component:ote}),Pge=Xr({getParentRoute:()=>Fs,path:"/config/model",component:Pte}),Bge=Xr({getParentRoute:()=>Fs,path:"/config/adapter",component:qte}),Lge=Xr({getParentRoute:()=>Fs,path:"/resource/emoji",component:ude}),Ige=Xr({getParentRoute:()=>Fs,path:"/resource/expression",component:bde}),qge=Xr({getParentRoute:()=>Fs,path:"/resource/person",component:Ede}),Fge=Xr({getParentRoute:()=>Fs,path:"/logs",component:hme}),Qge=Xr({getParentRoute:()=>Fs,path:"/plugins",component:Eme}),$ge=Xr({getParentRoute:()=>Fs,path:"/plugin-config",component:_me}),Hge=Xr({getParentRoute:()=>Fs,path:"/plugin-mirrors",component:Dme}),Uge=Xr({getParentRoute:()=>Fs,path:"/settings",component:bH}),Vge=Xr({getParentRoute:()=>_0,path:"*",component:$T}),Wge=_0.addChildren([Ege,_ge,Fs.addChildren([Dge,Rge,zge,Pge,Bge,Lge,Ige,qge,Qge,$ge,Hge,Fge,Uge]),Vge]),Gge=_I({routeTree:Wge,defaultNotFoundComponent:$T});function Xge({children:t,defaultTheme:e="system",storageKey:n="ui-theme",...r}){const[s,i]=S.useState(()=>localStorage.getItem(n)||e);S.useEffect(()=>{const c=window.document.documentElement;if(c.classList.remove("light","dark"),s==="system"){const d=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";c.classList.add(d);return}c.classList.add(s)},[s]),S.useEffect(()=>{const c=localStorage.getItem("accent-color");if(c){const d=document.documentElement,m={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[c];m&&(d.style.setProperty("--primary",m.hsl),m.gradient?(d.style.setProperty("--primary-gradient",m.gradient),d.classList.add("has-gradient")):(d.style.removeProperty("--primary-gradient"),d.classList.remove("has-gradient")))}},[]);const l={theme:s,setTheme:c=>{localStorage.setItem(n,c),i(c)}};return a.jsx(uT.Provider,{...r,value:l,children:t})}function Yge({children:t,defaultEnabled:e=!0,defaultWavesEnabled:n=!0,storageKey:r="enable-animations",wavesStorageKey:s="enable-waves-background"}){const[i,l]=S.useState(()=>{const m=localStorage.getItem(r);return m!==null?m==="true":e}),[c,d]=S.useState(()=>{const m=localStorage.getItem(s);return m!==null?m==="true":n});S.useEffect(()=>{const m=document.documentElement;i?m.classList.remove("no-animations"):m.classList.add("no-animations"),localStorage.setItem(r,String(i))},[i,r]),S.useEffect(()=>{localStorage.setItem(s,String(c))},[c,s]);const h={enableAnimations:i,setEnableAnimations:l,enableWavesBackground:c,setEnableWavesBackground:d};return a.jsx(dT.Provider,{value:h,children:t})}var c3="ToastProvider",[u3,Kge,Zge]=tx("Toast"),[WP]=Hi("Toast",[Zge]),[Jge,e1]=WP(c3),GP=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:l}=t,[c,d]=S.useState(null),[h,m]=S.useState(0),p=S.useRef(!1),x=S.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${c3}\`. Expected non-empty \`string\`.`),a.jsx(u3.Provider,{scope:e,children:a.jsx(Jge,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:h,viewport:c,onViewportChange:d,onToastAdd:S.useCallback(()=>m(v=>v+1),[]),onToastRemove:S.useCallback(()=>m(v=>v-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:x,children:l})})};GP.displayName=c3;var XP="ToastViewport",exe=["F8"],L4="toast.viewportPause",I4="toast.viewportResume",YP=S.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=exe,label:s="Notifications ({hotkey})",...i}=t,l=e1(XP,n),c=Kge(n),d=S.useRef(null),h=S.useRef(null),m=S.useRef(null),p=S.useRef(null),x=Cn(e,p,l.onViewportChange),v=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=l.toastCount>0;S.useEffect(()=>{const O=j=>{r.length!==0&&r.every(M=>j[M]||j.code===M)&&p.current?.focus()};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[r]),S.useEffect(()=>{const O=d.current,j=p.current;if(b&&O&&j){const T=()=>{if(!l.isClosePausedRef.current){const E=new CustomEvent(L4);j.dispatchEvent(E),l.isClosePausedRef.current=!0}},M=()=>{if(l.isClosePausedRef.current){const E=new CustomEvent(I4);j.dispatchEvent(E),l.isClosePausedRef.current=!1}},_=E=>{!O.contains(E.relatedTarget)&&M()},D=()=>{O.contains(document.activeElement)||M()};return O.addEventListener("focusin",T),O.addEventListener("focusout",_),O.addEventListener("pointermove",T),O.addEventListener("pointerleave",D),window.addEventListener("blur",T),window.addEventListener("focus",M),()=>{O.removeEventListener("focusin",T),O.removeEventListener("focusout",_),O.removeEventListener("pointermove",T),O.removeEventListener("pointerleave",D),window.removeEventListener("blur",T),window.removeEventListener("focus",M)}}},[b,l.isClosePausedRef]);const k=S.useCallback(({tabbingDirection:O})=>{const T=c().map(M=>{const _=M.ref.current,D=[_,...fxe(_)];return O==="forwards"?D:D.reverse()});return(O==="forwards"?T.reverse():T).flat()},[c]);return S.useEffect(()=>{const O=p.current;if(O){const j=T=>{const M=T.altKey||T.ctrlKey||T.metaKey;if(T.key==="Tab"&&!M){const D=document.activeElement,E=T.shiftKey;if(T.target===O&&E){h.current?.focus();return}const F=k({tabbingDirection:E?"backwards":"forwards"}),L=F.findIndex(U=>U===D);Gb(F.slice(L+1))?T.preventDefault():E?h.current?.focus():m.current?.focus()}};return O.addEventListener("keydown",j),()=>O.removeEventListener("keydown",j)}},[c,k]),a.jsxs(iq,{ref:d,role:"region","aria-label":s.replace("{hotkey}",v),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&a.jsx(q4,{ref:h,onFocusFromOutsideViewport:()=>{const O=k({tabbingDirection:"forwards"});Gb(O)}}),a.jsx(u3.Slot,{scope:n,children:a.jsx(Yt.ol,{tabIndex:-1,...i,ref:x})}),b&&a.jsx(q4,{ref:m,onFocusFromOutsideViewport:()=>{const O=k({tabbingDirection:"backwards"});Gb(O)}})]})});YP.displayName=XP;var KP="ToastFocusProxy",q4=S.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=e1(KP,n);return a.jsx(E9,{tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:l=>{const c=l.relatedTarget;!i.viewport?.contains(c)&&r()}})});q4.displayName=KP;var D0="Toast",txe="toast.swipeStart",nxe="toast.swipeMove",rxe="toast.swipeCancel",sxe="toast.swipeEnd",ZP=S.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...l}=t,[c,d]=So({prop:r,defaultProp:s??!0,onChange:i,caller:D0});return a.jsx(Bs,{present:n||c,children:a.jsx(lxe,{open:c,...l,ref:e,onClose:()=>d(!1),onPause:es(t.onPause),onResume:es(t.onResume),onSwipeStart:$e(t.onSwipeStart,h=>{h.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:$e(t.onSwipeMove,h=>{const{x:m,y:p}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","move"),h.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${m}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:$e(t.onSwipeCancel,h=>{h.currentTarget.setAttribute("data-swipe","cancel"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:$e(t.onSwipeEnd,h=>{const{x:m,y:p}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","end"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${m}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),d(!1)})})})});ZP.displayName=D0;var[ixe,axe]=WP(D0,{onClose(){}}),lxe=S.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:l,onEscapeKeyDown:c,onPause:d,onResume:h,onSwipeStart:m,onSwipeMove:p,onSwipeCancel:x,onSwipeEnd:v,...b}=t,k=e1(D0,n),[O,j]=S.useState(null),T=Cn(e,W=>j(W)),M=S.useRef(null),_=S.useRef(null),D=s||k.duration,E=S.useRef(0),z=S.useRef(D),Q=S.useRef(0),{onToastAdd:F,onToastRemove:L}=k,U=es(()=>{O?.contains(document.activeElement)&&k.viewport?.focus(),l()}),V=S.useCallback(W=>{!W||W===1/0||(window.clearTimeout(Q.current),E.current=new Date().getTime(),Q.current=window.setTimeout(U,W))},[U]);S.useEffect(()=>{const W=k.viewport;if(W){const J=()=>{V(z.current),h?.()},H=()=>{const ae=new Date().getTime()-E.current;z.current=z.current-ae,window.clearTimeout(Q.current),d?.()};return W.addEventListener(L4,H),W.addEventListener(I4,J),()=>{W.removeEventListener(L4,H),W.removeEventListener(I4,J)}}},[k.viewport,D,d,h,V]),S.useEffect(()=>{i&&!k.isClosePausedRef.current&&V(D)},[i,D,k.isClosePausedRef,V]),S.useEffect(()=>(F(),()=>L()),[F,L]);const ce=S.useMemo(()=>O?iB(O):null,[O]);return k.viewport?a.jsxs(a.Fragment,{children:[ce&&a.jsx(oxe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:ce}),a.jsx(ixe,{scope:n,onClose:U,children:RI.createPortal(a.jsx(u3.ItemSlot,{scope:n,children:a.jsx(aq,{asChild:!0,onEscapeKeyDown:$e(c,()=>{k.isFocusedToastEscapeKeyDownRef.current||U(),k.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(Yt.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":k.swipeDirection,...b,ref:T,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:$e(t.onKeyDown,W=>{W.key==="Escape"&&(c?.(W.nativeEvent),W.nativeEvent.defaultPrevented||(k.isFocusedToastEscapeKeyDownRef.current=!0,U()))}),onPointerDown:$e(t.onPointerDown,W=>{W.button===0&&(M.current={x:W.clientX,y:W.clientY})}),onPointerMove:$e(t.onPointerMove,W=>{if(!M.current)return;const J=W.clientX-M.current.x,H=W.clientY-M.current.y,ae=!!_.current,ne=["left","right"].includes(k.swipeDirection),ue=["left","up"].includes(k.swipeDirection)?Math.min:Math.max,R=ne?ue(0,J):0,me=ne?0:ue(0,H),Y=W.pointerType==="touch"?10:2,P={x:R,y:me},K={originalEvent:W,delta:P};ae?(_.current=P,Qp(nxe,p,K,{discrete:!1})):o9(P,k.swipeDirection,Y)?(_.current=P,Qp(txe,m,K,{discrete:!1}),W.target.setPointerCapture(W.pointerId)):(Math.abs(J)>Y||Math.abs(H)>Y)&&(M.current=null)}),onPointerUp:$e(t.onPointerUp,W=>{const J=_.current,H=W.target;if(H.hasPointerCapture(W.pointerId)&&H.releasePointerCapture(W.pointerId),_.current=null,M.current=null,J){const ae=W.currentTarget,ne={originalEvent:W,delta:J};o9(J,k.swipeDirection,k.swipeThreshold)?Qp(sxe,v,ne,{discrete:!0}):Qp(rxe,x,ne,{discrete:!0}),ae.addEventListener("click",ue=>ue.preventDefault(),{once:!0})}})})})}),k.viewport)})]}):null}),oxe=t=>{const{__scopeToast:e,children:n,...r}=t,s=e1(D0,e),[i,l]=S.useState(!1),[c,d]=S.useState(!1);return dxe(()=>l(!0)),S.useEffect(()=>{const h=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(h)},[]),c?null:a.jsx(sx,{asChild:!0,children:a.jsx(E9,{...r,children:i&&a.jsxs(a.Fragment,{children:[s.label," ",n]})})})},cxe="ToastTitle",JP=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(Yt.div,{...r,ref:e})});JP.displayName=cxe;var uxe="ToastDescription",eB=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(Yt.div,{...r,ref:e})});eB.displayName=uxe;var tB="ToastAction",nB=S.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?a.jsx(sB,{altText:n,asChild:!0,children:a.jsx(d3,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${tB}\`. Expected non-empty \`string\`.`),null)});nB.displayName=tB;var rB="ToastClose",d3=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=axe(rB,n);return a.jsx(sB,{asChild:!0,children:a.jsx(Yt.button,{type:"button",...r,ref:e,onClick:$e(t.onClick,s.onClose)})})});d3.displayName=rB;var sB=S.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return a.jsx(Yt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function iB(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),hxe(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const l=r.dataset.radixToastAnnounceAlt;l&&e.push(l)}else e.push(...iB(r))}}),e}function Qp(t,e,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?A9(s,i):s.dispatchEvent(i)}var o9=(t,e,n=0)=>{const r=Math.abs(t.x),s=Math.abs(t.y),i=r>s;return e==="left"||e==="right"?i&&r>n:!i&&s>n};function dxe(t=()=>{}){const e=es(t);h9(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function hxe(t){return t.nodeType===t.ELEMENT_NODE}function fxe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Gb(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var mxe=GP,aB=YP,lB=ZP,oB=JP,cB=eB,uB=nB,dB=d3;const pxe=mxe,hB=S.forwardRef(({className:t,...e},n)=>a.jsx(aB,{ref:n,className:ye("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));hB.displayName=aB.displayName;const gxe=Nd("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),fB=S.forwardRef(({className:t,variant:e,...n},r)=>a.jsx(lB,{ref:r,className:ye(gxe({variant:e}),t),...n}));fB.displayName=lB.displayName;const xxe=S.forwardRef(({className:t,...e},n)=>a.jsx(uB,{ref:n,className:ye("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));xxe.displayName=uB.displayName;const mB=S.forwardRef(({className:t,...e},n)=>a.jsx(dB,{ref:n,className:ye("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:a.jsx(Gf,{className:"h-4 w-4"})}));mB.displayName=dB.displayName;const pB=S.forwardRef(({className:t,...e},n)=>a.jsx(oB,{ref:n,className:ye("text-sm font-semibold [&+div]:text-xs",t),...e}));pB.displayName=oB.displayName;const gB=S.forwardRef(({className:t,...e},n)=>a.jsx(cB,{ref:n,className:ye("text-sm opacity-90",t),...e}));gB.displayName=cB.displayName;function vxe(){const{toasts:t}=Pr();return a.jsxs(pxe,{children:[t.map(function({id:e,title:n,description:r,action:s,...i}){return a.jsxs(fB,{...i,children:[a.jsxs("div",{className:"grid gap-1",children:[n&&a.jsx(pB,{children:n}),r&&a.jsx(gB,{children:r})]}),s,a.jsx(mB,{})]},e)}),a.jsx(hB,{})]})}Bq.createRoot(document.getElementById("root")).render(a.jsx(S.StrictMode,{children:a.jsx(Xge,{defaultTheme:"system",children:a.jsxs(Yge,{children:[a.jsx(zI,{router:Gge}),a.jsx(vxe,{})]})})})); diff --git a/webui/dist/index.html b/webui/dist/index.html index dad21f82..d2be1e7e 100644 --- a/webui/dist/index.html +++ b/webui/dist/index.html @@ -5,13 +5,13 @@ MaiBot Dashboard - + - +